本文整理汇总了PHP中DateModules::AddToGDate方法的典型用法代码示例。如果您正苦于以下问题:PHP DateModules::AddToGDate方法的具体用法?PHP DateModules::AddToGDate怎么用?PHP DateModules::AddToGDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateModules
的用法示例。
在下文中一共展示了DateModules::AddToGDate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ComputeWagesAndDelays
function ComputeWagesAndDelays($PartObj, $PayAmount, $StartDate, $PayDate)
{
$MaxWage = max($PartObj->CustomerWage * 1, $PartObj->FundWage);
if ($PartObj->PayInterval > 0) {
$YearMonths = $PartObj->IntervalType == "DAY" ? floor(365 / $PartObj->PayInterval) : 12 / $PartObj->PayInterval;
} else {
$YearMonths = 12;
}
$TotalWage = round(ComputeWage($PayAmount, $MaxWage / 100, $PartObj->InstallmentCount, $PartObj->IntervalType, $PartObj->PayInterval));
$CustomerFactor = $MaxWage == 0 ? 0 : $PartObj->CustomerWage / $MaxWage;
$FundFactor = $MaxWage == 0 ? 0 : $PartObj->FundWage / $MaxWage;
$AgentFactor = $MaxWage == 0 ? 0 : ($PartObj->CustomerWage - $PartObj->FundWage) / $MaxWage;
///...........................................................
if ($PartObj->MaxFundWage * 1 > 0) {
if ($PartObj->WageReturn == "INSTALLMENT") {
$FundYears = YearWageCompute($PartObj, $PartObj->MaxFundWage * 1, $YearMonths);
} else {
$FundYears = array();
}
} else {
$years = YearWageCompute($PartObj, $TotalWage * 1, $YearMonths);
$FundYears = array();
foreach ($years as $year => $amount) {
$FundYears[$year] = round($FundFactor * $amount);
}
}
$AgentYears = array();
foreach ($years as $year => $amount) {
$AgentYears[$year] = round($amount - $FundYears[$year]);
}
//.............................................................
$endDelayDate = DateModules::AddToGDate($PayDate, $PartObj->DelayDays * 1, $PartObj->DelayMonths * 1);
$DelayDuration = DateModules::GDateMinusGDate($endDelayDate, $PayDate) + 1;
if ($StartDate == $PayDate) {
if ($PartObj->DelayDays * 1 > 0) {
$CustomerDelay = round($PayAmount * $PartObj->DelayPercent * $DelayDuration / 36500);
$FundDelay = round($PayAmount * $PartObj->FundWage * $DelayDuration / 36500);
$AgentDelay = round($PayAmount * ($PartObj->DelayPercent - $PartObj->FundWage) * $DelayDuration / 36500);
} else {
$CustomerDelay = round($PayAmount * $PartObj->DelayPercent * $PartObj->DelayMonths / 1200);
$FundDelay = round($PayAmount * $PartObj->FundWage * $PartObj->DelayMonths / 1200);
$AgentDelay = round($PayAmount * ($PartObj->DelayPercent - $PartObj->FundWage) * $PartObj->DelayMonths / 1200);
}
} else {
$endDelayDate = DateModules::AddToGDate($StartDate, $PartObj->DelayDays * 1, $PartObj->DelayMonths * 1);
$DelayDuration = DateModules::GDateMinusGDate($endDelayDate, $PayDate) + 1;
$CustomerDelay = round($PayAmount * $PartObj->DelayPercent * $DelayDuration / 36500);
$FundDelay = round($PayAmount * $PartObj->FundWage * $DelayDuration / 36500);
$AgentDelay = round($PayAmount * ($PartObj->DelayPercent - $PartObj->FundWage) * $DelayDuration / 36500);
}
$CustomerYearDelays = SplitYears($PayDate, $endDelayDate, $CustomerDelay);
//.............................................................
return array("TotalFundWage" => round($TotalWage * $FundFactor), "TotalAgentWage" => round($TotalWage * $AgentFactor), "TotalCustomerWage" => round($TotalWage * $CustomerFactor), "FundWageYears" => $FundYears, "AgentWageYears" => $AgentYears, "TotalCustomerDelay" => $CustomerDelay, "TotalFundDelay" => $FundDelay, "TotalAgentDelay" => $AgentDelay, "CustomerYearDelays" => $CustomerYearDelays);
}
示例2: compute_salary_item2_02
/** افزايش سنواتي */
private function compute_salary_item2_02($writ_rec) {
//param1 : افزايش سنوات سال قبل
//param2 : ضريب افزايش سنواتي
//param3 : درصد بسيج
//param4 : مبلغ افزايش سنواتي بدون در نظر گرفتن گروه تشويقي و درصد بسيج
//_____________________________________
// چک کن که حکم قبلي وجود دارد يا خير
$this_writ_year = substr(DateModules::Miladi_to_Shamsi($writ_rec['execute_date']), 0, 4);
$one_year_ago = $this_writ_year - 1;
$one_year_ago_first_day = $one_year_ago . "/01/01";
$one_year_ago_last_day = $one_year_ago . "/12/30";
$one_year_ago_last_day_writ = $one_year_ago . "/12/29";
$Gone_year_ago_first_day = DateModules::Shamsi_to_Miladi($one_year_ago_first_day);
$Gone_year_ago_last_day = DateModules::Shamsi_to_Miladi($one_year_ago_last_day_writ);
$prior_writ = manage_writ::get_last_writ_by_date($writ_rec['staff_id'], DateModules::AddToGDate($writ_rec['execute_date'], -1, 0, 0));
// در صورتی که حکم قبلی وجود داشته باشد که در همان سال باشد افزایش سنواتی آن تغییر نمی کند .
if (!empty($prior_writ->writ_id)) {
if (!DateModules::similar_year($writ_rec['execute_date'], $prior_writ->execute_date)) {
$obj = new manage_writ_item($prior_writ->writ_id, $prior_writ->writ_ver, $prior_writ->staff_id,
($prior_writ->person_type == 5 ) ? SIT5_STAFF_ANNUAL_INC : SIT_STAFF_ANNUAL_INC);
if (!empty($obj->writ_id)) {
$this->param1 = $obj->param1;
$this->param2 = $obj->param2;
$this->param3 = $obj->param3;
if (!$obj->param4)
$this->param4 = $obj->value;
return $obj->value;
}
}
}
//آخرين حکم قبل از سال شخص را استخراج مي کند.
$prior_writ = manage_writ::get_last_writ_by_date($writ_rec['staff_id'], $Gone_year_ago_last_day);
$prior_writ_year = substr(DateModules::Miladi_to_Shamsi($prior_writ->execute_date), 0, 4);
//____________________________________________________
//اولين حكم- محاسبه افزايش سنواتي در بدو استخدام
if (empty($prior_writ->writ_id)) {
//در بدو استخدام: جانبازي + آزادگي + سربازي + جبهه
$this->param1 = 0;
$this->param2 = 0;
$this->param3 = 0;
$this->value = 0;
if ($writ_rec['military_duration'] > 30)
$writ_rec['military_duration'] = 30;
//سربازي : هر ماه 0/25% سالي 3% ، حداكثر 2/5 سال
$this->param2 += $writ_rec['military_duration'] * 0.0025;
if ($writ_rec['execute_date'] < DateModules::Shamsi_to_Miladi('1384-11-12')) {
$temp = manage_person_devotion::GetAllDevotions("d.PersonID=" . $writ_rec["personID"]);
for ($i = 0; $i < count($temp); $i++) {
switch ($temp[$i]['devotion_type']) {
case DEVOTION_TYPE_FIGHTER://رزمندگي
//جبهه : ماهي 5/0% سالي 6% (سوابق تا قبل از 29/5/69
$this->param2 += ($temp[$i]['amount'] / 30) * 0.005;
break;
case DEVOTION_TYPE_PRISONER://آزادگي
//- آزادگي : ماهي 0.5% سالي 6%
$this->param2 += ($temp[$i]['amount'] / 30) * 0.005;
break;
case DEVOTION_TYPE_WOUNDED://جانبازي
//- جانبازي : هر 1% جانبازي 6/0%
$this->param2 += $temp[$i]['amount'] * 0.006;
break;
}
}
}
//____________________________________________
// حقوق مبنا
$base_salary = manage_writ::get_base_salary($writ_rec["writ_id"], $writ_rec["writ_ver"], $writ_rec["staff_id"], $writ_rec["person_type"]);
if (in_array($writ_rec['person_type'], array(1, 2, 3))) {
// حقوق مبنا بدون گروه تشویقی
$nh_base_salary = manage_writ::get_base_salary($writ_rec["writ_id"], $writ_rec["writ_ver"], $writ_rec["staff_id"], $writ_rec["person_type"], false);
}
$value = $base_salary * $this->param2;
if (in_array($writ_rec['person_type'], array(1, 2, 3))) {
$this->param4 = $nh_base_salary * $this->param2;
}
return $value;
}
//احكام طول دوره خدمت
else {
//افزايش سنواتي سال قبل
$obj = new manage_writ_item($prior_writ->writ_id, $prior_writ->writ_ver, $prior_writ->staff_id,
($prior_writ->person_type == 5 ) ? SIT5_STAFF_ANNUAL_INC : SIT_STAFF_ANNUAL_INC);
$this->param1 = $obj->value;
$this->param2 = $obj->param2;
$this->param3 = $obj->param3;
$this->param4 = $obj->param4;
//.........这里部分代码省略.........
示例3: SavePersonShift
function SavePersonShift()
{
$obj = new ATN_PersonShifts();
PdoDataAccess::FillObjectByJsonData($obj, $_POST["record"]);
//............. cut shifts .....................
$FromDate = DateModules::shamsi_to_miladi($obj->FromDate, "-");
$ToDate = DateModules::shamsi_to_miladi($obj->ToDate, "-");
$dt = PdoDataAccess::runquery("select * from ATN_PersonShifts \r\n\t\twhere PersonID=? AND FromDate>? AND FromDate<?", array($obj->PersonID, $FromDate, $ToDate));
if (count($dt) > 0) {
$obj2 = new ATN_PersonShifts();
$obj2->RowID = $dt[0]["RowID"];
$obj2->FromDate = DateModules::AddToGDate($ToDate, 1);
$obj2->Edit();
}
//-------------------
$dt = PdoDataAccess::runquery("select * from ATN_PersonShifts \r\n\t\twhere PersonID=? AND FromDate<? AND ToDate>?", array($obj->PersonID, $FromDate, $ToDate));
if (count($dt) > 0) {
$obj2 = new ATN_PersonShifts();
$obj2->RowID = $dt[0]["RowID"];
$obj2->ToDate = DateModules::AddToGDate($FromDate, -1);
$obj2->Edit();
$obj2 = new ATN_PersonShifts();
$obj2->ShiftID = $dt[0]["ShiftID"];
$obj2->PersonID = $obj->PersonID;
$obj2->FromDate = DateModules::AddToGDate($ToDate, 1);
$obj2->ToDate = $dt[0]["ToDate"];
$obj2->Add();
}
//-------------------
$dt = PdoDataAccess::runquery("select * from ATN_PersonShifts \r\n\t\twhere PersonID=? AND ToDate>? AND ToDate<?", array($obj->PersonID, $FromDate, $ToDate));
if (count($dt) > 0) {
$obj2 = new ATN_PersonShifts();
$obj2->RowID = $dt[0]["RowID"];
$obj2->ToDate = DateModules::AddToGDate($FromDate, -1);
$obj2->Edit();
}
//...............................................
if ($obj->RowID == "") {
$result = $obj->Add();
} else {
$result = $obj->Edit();
}
//print_r(ExceptionHandler::PopAllExceptions());
echo Response::createObjectiveResponse($result, ExceptionHandler::GetExceptionsToString());
die;
}
示例4: IssueWritAction
//.........这里部分代码省略.........
$this->send_letter_date = $this->issue_date;
$this->pay_date = $this->execute_date > $this->issue_date ? $this->execute_date : $this->issue_date;
$this->ref_letter_no = !empty($lastWritObj->ref_letter_no) ? $lastWritObj->ref_letter_no : PDONULL;
//$this->ref_letter_date = (!empty($lastWritObj->ref_letter_date) ) ? $lastWritObj->ref_letter_date : PDONULL ;
//__________________________________________________________
//جايگزيني مقادير مربوط به نوع اصلي و فرعي حکم
if ($writ_subtype_obj->time_limited != 1) {
$this->contract_start_date = '0000-00-00';
PDONULL;
$this->contract_end_date = '0000-00-00';
//PDONULL;
}
if ($writ_subtype_obj->salary_pay_proc > 0) {
$this->salary_pay_proc = $writ_subtype_obj->salary_pay_proc;
}
if ($writ_subtype_obj->annual_effect > 0) {
$this->annual_effect = $writ_subtype_obj->annual_effect;
}
if ($writ_subtype_obj->emp_state > 0) {
$this->emp_state = $writ_subtype_obj->emp_state;
}
if ($writ_subtype_obj->emp_mode > 0) {
$this->emp_mode = $writ_subtype_obj->emp_mode;
}
if ($writ_subtype_obj->worktime_type > 0) {
$this->worktime_type = $writ_subtype_obj->worktime_type;
}
if ($writ_subtype_obj->post_effect == FREE_POST_EFFECT) {
$this->post_id = PDONULL;
}
if (!$writ_subtype_obj->remember_distance) {
$writ_subtype_obj->remember_distance = 0;
}
if ($writ_subtype_obj->remember_distance > 0) {
$this->warning_date = DateModules::AddToGDate($this->execute_date, 0, $writ_subtype_obj->remember_distance);
} else {
$this->warning_date = '0000-00-00';
}
//PDONULL;
$this->warning_message = $writ_subtype_obj->remember_message;
$this->description = $writ_subtype_obj->comments;
if ($this->corrective == true || $this->corrective == 1) {
$this->description = PDONULL;
}
$this->writ_signature_post_owner = $this->issue_date > '2014-02-01' ? ' مهدی پور' : WRIT_SIGNATURE_POST_OWNER;
$this->writ_signature_post_title = WRIT_SIGNATURE_POST_TITLE;
// براي افراد پيماني هر حکم جديد قرارداد جديد مي باشد .
// بنابراين تاريخ شروع قرارداد تاريخ اجراي حکم خواهد بود .
// تاريخ خاتمه قرارداد پرسنل قراردادي پايان سال خواهد بود .
if ($writ_subtype_obj->time_limited == 1 && ($this->emp_state == EMP_STATE_CONTRACTUAL || $this->emp_state == EMP_STATE_SOLDIER_CONTRACTUAL || $this->emp_state == EMP_STATE_ONUS_SOLDIER_CONTRACTUAL)) {
$this->contract_start_date = $this->execute_date;
$arr = preg_split('/\\//', DateModules::Miladi_to_Shamsi($this->execute_date));
$Jdate = $arr[0] . "/12/29";
$this->contract_end_date = DateModules::Shamsi_to_Miladi($Jdate);
}
//__________________________________________________________
$this->remembered = PDONULL;
$this->dont_transfer = PDONULL;
if ($this->history_only && ($this->state == WRIT_PERSONAL || $this->state == PDONULL)) {
$this->history_only = 1;
} else {
$this->history_only = 0;
}
//__________________________________________________________
$this->job_id = empty($this->job_id) ? PDONULL : $this->job_id;
//---------------------
$pObj = new manage_person("", $this->staff_id);
if ($pObj->sex == 2 && $pObj->marital_status == 1) {
$this->family_responsible = 0;
}
if ($pObj->sex == 1 && ($this->person_type == 3 || $this->person_type == 5) && $this->marital_status == 2) {
$this->family_responsible = 1;
}
if ($pObj->sex == 2 && $this->person_type == 5 && $this->execute_date > '2014-03-20') {
$this->family_responsible = 0;
}
//.............................................
$pdo = parent::getPdoObject();
/*@var $pdo PDO*/
$pdo->beginTransaction();
$this->writ_id = manage_writ::LastID() + 1;
if (empty($this->writ_id)) {
parent::PushException("خطاي کد آخرين رکورد");
$pdo->rollBack();
return false;
}
if (!$this->onBeforeInsert()) {
$pdo->rollBack();
return false;
}
$return = parent::insert("HRM_writs", $this);
if (!$return) {
parent::PushException("ايجاد با شکست مواجه شد");
$pdo->rollBack();
return false;
}
$this->onAfterInsert();
$pdo->commit();
return true;
}
示例5: staff_messages
function staff_messages()
{
$current_date = date('Y-m-d');
$next_wheek_date = DateModules::AddToGDate($current_date, 7);
$query = ' DROP TABLE IF EXISTS temp_cw; ';
PdoDataAccess::runquery($query);
$query = " DROP TABLE IF EXISTS temp_cwsi; ";
PdoDataAccess::runquery($query);
$query = " DROP TABLE IF EXISTS temp_messages; ";
PdoDataAccess::runquery($query);
$query = " CREATE TABLE temp_cw TYPE=MyISAM as\n SELECT writ_id,\n writ_ver,\n w.warning_date,\n w.warning_message,\n staff_id , w.ouid\n FROM writs w\n WHERE ( w.remembered != " . REMEMBERED . " OR w.remembered is null ) AND\n w.warning_date < '" . $next_wheek_date . "' AND w.warning_date <> '0000-00-00' ";
PdoDataAccess::runquery($query);
$query = ' CREATE TABLE temp_cwsi TYPE=MyISAM as
SELECT wsi.writ_id,
wsi.writ_ver,
wsi.salary_item_type_id,
wsi.remember_date,
wsi.remember_message,
w.staff_id , w.ouid
FROM writ_salary_items wsi
INNER JOIN writs w
ON(wsi.writ_id = w.writ_id AND wsi.writ_ver = w.writ_ver AND wsi.staff_id = w.staff_id )
WHERE ( wsi.remembered != ' . REMEMBERED . ' OR w.remembered is null ) AND
wsi.remember_date < \'' . $next_wheek_date . '\' AND wsi.salary_item_type_id NOT IN (10232 , 10233 ) ';
PdoDataAccess::runquery($query);
$query = " CREATE TABLE temp_messages TYPE=MyISAM as\n \t\t\t (SELECT p.pfname,\n\t\t\t\t\t\t p.plname,\n p.person_type,\n\t\t\t\t\t\t s.staff_id,\n\t\t\t\t\t\t NULL AS full_title,\n\t\t\t\t\t\t w.writ_id,\n\t\t\t\t\t\t w.writ_ver,\n\t\t\t\t\t\t w.warning_date,\n\t\t\t\t\t\t w.warning_message,w.ouid\n\n\t\t\t\t\t\tFROM temp_cw w\n\t\t\t\t\t\t INNER JOIN staff s\n\t\t\t\t\t\t \t ON (w.staff_id = s.staff_id)\n\t\t\t\t\t\t INNER JOIN persons p\n\t\t\t\t\t\t \t ON (s.PersonID = p.PersonID))\n \n\t\t\t\t\t\tUNION ALL\n\t\t\t\t\t\t(SELECT p.pfname,\n\t\t\t\t\t\t p.plname,\n p.person_type,\n\t\t\t\t\t\t s.staff_id,\n\t\t\t\t\t\t sit.full_title,\n\t\t\t\t\t\t wsi.writ_id,\n\t\t\t\t\t\t wsi.writ_ver,\n\t\t\t\t\t\t wsi.remember_date warning_date,\n\t\t\t\t\t\t wsi.remember_message warning_message , wsi.ouid\n\n\t\t\t\t\t\tFROM temp_cwsi wsi\n\t\t\t\t\t\t INNER JOIN salary_item_types sit\n\t\t\t\t\t\t \t ON (wsi.salary_item_type_id = sit.salary_item_type_id)\n\t\t\t\t\t\t INNER JOIN staff s\n\t\t\t\t\t\t \t ON (wsi.staff_id = s.staff_id)\n\t\t\t\t\t\t INNER JOIN persons p\n\t\t\t\t\t\t \t ON (s.PersonID = p.PersonID))\n \n\t\t\t\t\t\tORDER BY \tplname,pfname,writ_id\n ";
PdoDataAccess::runquery($query);
return true;
}
示例6: ShowReport
function ShowReport($admin){
if($_POST["FromDate"] == "")
{
$StartDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] . "-01", "-");
$EndDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] ."-" . DateModules::DaysOfMonth($_POST["year"] ,$_POST["month"]), "-");
}
else
{
$StartDate = DateModules::shamsi_to_miladi($_POST["FromDate"], "-");
$EndDate = DateModules::shamsi_to_miladi($_POST["ToDate"], "-");
}
$holidays = ATN_holidays::Get(" AND TheDate between ? AND ? order by TheDate", array($StartDate, $EndDate));
$holidayRecord = $holidays->fetch();
$PersonID = $_SESSION["USER"]["PersonID"];
$PersonID = !empty($_POST["PersonID"]) ? $_POST["PersonID"] : $PersonID;
$query = "select * from (
select 'normal' RecordType,'' ReqType, TrafficDate,TrafficTime,s.ShiftTitle,s.FromTime,s.ToTime
,ExceptFromTime,ExceptToTime
from ATN_traffic t
left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND TrafficDate between FromDate AND ToDate)
left join ATN_shifts s on(ps.ShiftID=s.ShiftID)
where t.IsActive='YES' AND t.PersonID=:p AND TrafficDate>= :sd AND TrafficDate <= :ed
union All
select 'start' RecordType,t.ReqType, t.FromDate,StartTime,s.ShiftTitle,s.FromTime,s.ToTime
,ExceptFromTime,ExceptToTime
from ATN_requests t
left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND t.FromDate between ps.FromDate AND ps.ToDate)
left join ATN_shifts s on(ps.ShiftID=s.ShiftID)
where t.PersonID=:p AND t.ToDate is null AND ReqStatus=2 AND t.FromDate>= :sd
union all
select 'end' RecordType,t.ReqType, t.FromDate,EndTime,s.ShiftTitle,s.FromTime,s.ToTime
,ExceptFromTime,ExceptToTime
from ATN_requests t
left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND t.FromDate between ps.FromDate AND ps.ToDate)
left join ATN_shifts s on(ps.ShiftID=s.ShiftID)
where t.PersonID=:p AND t.ToDate is null AND ReqStatus=2 AND t.FromDate>= :sd
AND EndTime is not null
)t2
order by TrafficDate,TrafficTime";
$dt = PdoDataAccess::runquery($query, array(":p" => $PersonID, ":sd" => $StartDate, ":ed" => $EndDate));
/*if($_SESSION["USER"]["UserName"] == "admin")
{
print_r(ExceptionHandler::PopAllExceptions());
echo PdoDataAccess::GetLatestQueryString();
}*/
//print_r($dt);
//........................ create days array ..................
$index = 0;
$returnArr = array();
while($StartDate <= $EndDate)
{
if($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"])
{
while($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"])
$returnArr[] = $dt[$index++];
$StartDate = DateModules::AddToGDate($StartDate, 1);
continue;
}
$shiftRecord = ATN_PersonShifts::GetShiftOfDate($PersonID, $StartDate);
$returnArr[] = array(
"RecordType" => "normal",
"TrafficID" => "",
"TrafficDate" => $StartDate ,
"ShiftTitle" => $shiftRecord["ShiftTitle"],
"FromTime" => $shiftRecord["FromTime"],
"ToTime" => $shiftRecord["ToTime"],
"ExceptFromTime" => $shiftRecord["ExceptFromTime"],
"ExceptToTime" => $shiftRecord["ExceptToTime"],
"TrafficTime" => "");
$StartDate = DateModules::AddToGDate($StartDate, 1);
}
//------------ holidays ------------------
for($i=0; $i<count($returnArr); $i++)
{
$holiday = false;
$holidayTitle = "تعطیل";
if(FridayIsHoliday && DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") == "5")
$holiday = true;
if(ThursdayIsHoliday && DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") == "4")
$holiday = true;
if($holidayRecord && $holidayRecord["TheDate"] == $returnArr[$i]["TrafficDate"])
{
$holidayTitle .= $holidayRecord["details"] != "" ? "(" . $holidayRecord["details"] . ")" : "";
$holiday = true;
$holidayRecord = $holidays->fetch();
}
//.........这里部分代码省略.........
示例7: DelayInstallments
function DelayInstallments()
{
$RequestID = $_POST["RequestID"];
$InstallmentID = $_POST["InstallmentID"];
$newDate = $_POST["newDate"];
$PartObj = LON_ReqParts::GetValidPartObj($RequestID);
$pdo = PdoDataAccess::getPdoObject();
$pdo->beginTransaction();
if ($_POST["IsRemainCompute"] == " 0") {
$dt = LON_installments::SelectAll("r.RequestID=? AND InstallmentID>=?", array($RequestID, $InstallmentID));
$days = 0;
for ($i = 0; $i < count($dt); $i++) {
$obj = new LON_installments();
$obj->InstallmentID = $dt[$i]["InstallmentID"];
$obj->IsDelayed = "YES";
if (!$obj->EditInstallment($pdo)) {
$pdo->rollBack();
echo Response::createObjectiveResponse(false, "1");
die;
}
//...........................................
if ($days == 0) {
$newDate = DateModules::shamsi_to_miladi($newDate, "-");
$days = DateModules::GDateMinusGDate($newDate, $dt[$i]["InstallmentDate"]);
}
$obj = new LON_installments();
$obj->RequestID = $RequestID;
$obj->InstallmentDate = DateModules::AddToGDate($dt[$i]["InstallmentDate"], $days);
$extraWage = round($dt[$i]["InstallmentAmount"] * $PartObj->CustomerWage * $days / 36500);
$obj->InstallmentAmount = $dt[$i]["InstallmentAmount"] * 1 + $extraWage;
if (!$obj->AddInstallment($pdo)) {
$pdo->rollBack();
echo Response::createObjectiveResponse(false, "2");
die;
}
}
} else {
$dt = array();
$dt2 = LON_requests::ComputePayments($RequestID, $dt);
$index = 0;
$ComputeRecord = $dt2[$index++];
$days = 0;
for ($i = 0; $i < count($dt); $i++) {
if ($dt[$i]["InstallmentID"] < $InstallmentID) {
while ($ComputeRecord["InstallmentID"] == $dt[$i]["InstallmentID"]) {
$ComputeRecord = $dt2[++$index];
}
continue;
}
$remain = 0;
while ($ComputeRecord["InstallmentID"] == $dt[$i]["InstallmentID"]) {
$remain = $ComputeRecord["remainder"];
$ComputeRecord = $index + 1 < count($dt2) ? $dt2[++$index] : null;
}
$obj = new LON_installments();
$obj->InstallmentID = $dt[$i]["InstallmentID"];
$obj->IsDelayed = "YES";
if (!$obj->EditInstallment($pdo)) {
$pdo->rollBack();
echo Response::createObjectiveResponse(false, "1");
die;
}
//...........................................
if ($days == 0) {
$newDate = DateModules::shamsi_to_miladi($newDate, "-");
$days = DateModules::GDateMinusGDate($newDate, $dt[$i]["InstallmentDate"]);
}
$obj = new LON_installments();
$obj->RequestID = $RequestID;
$obj->InstallmentDate = DateModules::AddToGDate($dt[$i]["InstallmentDate"], $days);
$extraWage = round($remain * $PartObj->CustomerWage * $days / 36500);
$obj->InstallmentAmount = $dt[$i]["InstallmentAmount"] * 1 + $extraWage;
if (!$obj->AddInstallment($pdo)) {
$pdo->rollBack();
echo Response::createObjectiveResponse(false, "2");
die;
}
}
}
if (ExceptionHandler::GetExceptionCount() > 0) {
$pdo->rollBack();
print_r(ExceptionHandler::PopAllExceptions());
echo Response::createObjectiveResponse(false, "");
die;
}
$pdo->commit();
echo Response::createObjectiveResponse(true, "");
die;
}
示例8: ShowReport
function ShowReport(){
if($_POST["FromDate"] == "")
{
$OrigStartDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] . "-01", "-");
$OrigEndDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] ."-" . DateModules::DaysOfMonth($_POST["year"] ,$_POST["month"]), "-");
}
else
{
$OrigStartDate = DateModules::shamsi_to_miladi($_POST["FromDate"], "-");
$OrigEndDate = DateModules::shamsi_to_miladi($_POST["ToDate"], "-");
}
$holidays = ATN_holidays::Get(" AND TheDate between ? AND ? order by TheDate", array($OrigStartDate, $OrigEndDate));
$holidayIndex = 0;
$holidays = $holidays->fetchAll();
$where = "";
$param = array();
if(!empty($_POST["PersonID"]))
{
$where .= " AND PersonID = ?";
$param[] = $_POST["PersonID"];
}
$PersonsDT = PdoDataAccess::runquery("select PersonID, concat(fname,' ',lname) fullname from BSC_persons
where IsStaff='YES' " . $where, $param);
$returnStr = "";
foreach($PersonsDT as $personRecord)
{
$holidayIndex = 0;
$holidayRecord = $holidayIndex < count($holidays) ? $holidays[$holidayIndex++] : null;
$PersonID = $personRecord["PersonID"];
$SUM = array(
"absence" => 0,
"attend"=> 0,
"firstAbsence" => 0,
"lastAbsence" => 0,
"extra" => 0,
"Off" => 0,
"mission" => 0,
"DailyOff_1" => 0,
"DailyOff_2" => 0,
"DailyOff_3" => 0,
"DailyMission" => 0,
"DailyAbsence" => 0
);
$StartDate = $OrigStartDate;
$EndDate = $OrigEndDate;
$query = "select * from (
select 'normal' RecordType,'' ReqType, TrafficDate,TrafficTime,s.ShiftTitle,s.FromTime,s.ToTime
,ExceptFromTime,ExceptToTime
from ATN_traffic t
left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND TrafficDate between FromDate AND ToDate)
left join ATN_shifts s on(ps.ShiftID=s.ShiftID)
where t.IsActive='YES' AND t.PersonID=:p AND TrafficDate>= :sd AND TrafficDate <= :ed
union All
select 'start' RecordType,t.ReqType, t.FromDate,StartTime,s.ShiftTitle,s.FromTime,s.ToTime
,ExceptFromTime,ExceptToTime
from ATN_requests t
left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND t.FromDate between ps.FromDate AND ps.ToDate)
left join ATN_shifts s on(ps.ShiftID=s.ShiftID)
where t.PersonID=:p AND t.ToDate is null AND ReqStatus=2 AND t.FromDate>= :sd
union all
select 'end' RecordType,t.ReqType, t.FromDate,EndTime,s.ShiftTitle,s.FromTime,s.ToTime
,ExceptFromTime,ExceptToTime
from ATN_requests t
left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND t.FromDate between ps.FromDate AND ps.ToDate)
left join ATN_shifts s on(ps.ShiftID=s.ShiftID)
where t.PersonID=:p AND t.ToDate is null AND ReqStatus=2 AND t.FromDate>= :sd
AND EndTime is not null
)t2
order by TrafficDate,TrafficTime";
$dt = PdoDataAccess::runquery($query, array(":p" => $PersonID,
":sd" => $StartDate, ":ed" => $EndDate));
//........................ create days array ..................
$index = 0;
$returnArr = array();
while($StartDate <= $EndDate)
{
if($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"])
{
while($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"])
$returnArr[] = $dt[$index++];
$StartDate = DateModules::AddToGDate($StartDate, 1);
continue;
}
$shiftRecord = ATN_PersonShifts::GetShiftOfDate($PersonID, $StartDate);
$returnArr[] = array(
//.........这里部分代码省略.........