Viewing file: processHrPerUnit.php (2.71 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "../class/clsrg_CopyTimeTable.php";
include_once "../class/clsrg_LoadType.php";
include_once "../class/clsrg_HrPerUnit.php";
$huAcY = (! isset($_REQUEST['huAcY'])? "" : $_REQUEST['huAcY']);
$huTmId = (! isset($_REQUEST['huTmId'])? "" : $_REQUEST['huTmId']);
$huLtId = (! isset($_REQUEST['huLtId'])? "" : $_REQUEST['huLtId']);
$huHr = (! isset($_POST['huHr'])? "" : $_POST['huHr']);
$huUnit = (! isset($_POST['huUnit'])? "" : $_POST['huUnit']);
$huMinSt = (! isset($_POST['huMinSt'])? "" : $_POST['huMinSt']);
$huMaxSt = (! isset($_POST['huMaxSt'])? "" : $_POST['huMaxSt']);
$huUnitPerSt = (! isset($_POST['huUnitPerSt'])? "" : $_POST['huUnitPerSt']);
$huDefault = (! isset($_POST['huDefault'])? "" : $_POST['huDefault']);
$conn = new Connection();
$oCt = new rg_CopyTimeTable();
$oLt = new rg_LoadType();
$oHu = new rg_HrPerUnit();
if($method=="add"){
$oLt->SearchByKey($huLtId);
$oLt->GetRecord();
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($huAcY, $huTmId, $oLt->ltSstId);
$flagDefault = $oHu->GetRecord();
if($flagDefault && $huDefault) {
$oHu->Edit();
$oHu->huDefault='';
$oHu->Save();
}
$oHu->AddNew();
$oHu->huAcY=$huAcY;
$oHu->huTmId=$huTmId;
$oHu->huLtId=$huLtId;
$oHu->huHr=$huHr;
$oHu->huUnit=$huUnit;
$oHu->huMinSt=$huMinSt;
$oHu->huMaxSt=$huMaxSt;
$oHu->huUnitPerSt=$huUnitPerSt;
$oHu->huDefault=($flagDefault) ? $huDefault : 'Y';
$oHu->Save();
}else if($method=="edit"){
$oHu->SearchByKey($huAcY, $huTmId, $huLtId);
$oHu->GetRecord();
if($oHu->huDefault)
$flagDefault = false;
else {
$oLt->SearchByKey($huLtId);
$oLt->GetRecord();
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndDefaultIsYAndSstId($huAcY, $huTmId, $oLt->ltSstId);
$flagDefault = $oHu->GetRecord();
if($flagDefault && $huDefault) {
$oHu->Edit();
$oHu->huDefault='';
$oHu->Save();
}
}
$oHu->SearchByKey($huAcY, $huTmId, $huLtId);
$oHu->GetRecord();
$oHu->Edit();
$oHu->huHr=$huHr;
$oHu->huUnit=$huUnit;
$oHu->huMinSt=$huMinSt;
$oHu->huMaxSt=$huMaxSt;
$oHu->huUnitPerSt=$huUnitPerSt;
$oHu->huDefault=($flagDefault) ? $huDefault : 'Y';
$oHu->Save();
}else if($method=="delete"){
$oCt->RSrg_CopyTimeTableByAcYAndSeAndLtId($huAcY, $huTmId, $huLtId);
$oLt->SearchByKey($huLtId);
$oLt->GetRecord();
$oHu->RSrg_HrPerUnitByAcYAndTmIdAndNotLtIdAndSstId($huAcY, $huTmId, $huLtId, $oLt->ltSstId);
$res = $oHu->GetRecord();
$oHu->SearchByKey($huAcY, $huTmId, $huLtId);
$oHu->GetRecord();
if(!$oCt->GetRecord() && (!$oHu->huDefault || ($oHu->huDefault && !$res)))
$oHu->Delete();
}
$oLt->Destroy();
$oHu->Destroy();
$conn->Disconnect();
echo "<meta http-equiv='refresh' content='0; URL=addHrPerUnit.php'>";
?>
|