本文整理汇总了PHP中DateModules::AddToJDate方法的典型用法代码示例。如果您正苦于以下问题:PHP DateModules::AddToJDate方法的具体用法?PHP DateModules::AddToJDate怎么用?PHP DateModules::AddToJDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateModules
的用法示例。
在下文中一共展示了DateModules::AddToJDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_arrear_document
//.........这里部分代码省略.........
//..........................................................................
$TotalsumDiff = $TotalMainVal = $TotalRowTax = $TotalRowIns = $TotalRowRet = $TotalPay = 0;
for ($t = $_POST['from_pay_year']; $t < $_POST['to_pay_year'] + 1; $t++) {
$retCoef = 1;
$qry = " select max(arrear_ver) MV\r\n\t\t\t\t\tfrom corrective_payment_writs \r\n\t\t\t\t\t\twhere staff_id = " . $SID . " and pay_year = " . $t . "\r\n\t\t ";
$MaxVer = PdoDataAccess::runquery($qry);
if (count($MaxVer) == 0 || $MaxVer[0]['MV'] == 0) {
continue;
}
$res = PdoDataAccess::runquery(" select * \r\n\t\t\t\t\t\t\t\t\t\tfrom compare_arrear_writs \r\n\t\t\t\t\t\t\t\t\t\t\twhere staff_id = " . $SID . " and pay_year =" . $t . " and arrear_ver = " . $MaxVer[0]['MV']);
$prior_execute_date = $current_execute_date = $prior_writ_type = $current_writ_type = '';
$current_writ_items = $prior_writ_items = array();
$sdate = "";
for ($i = 0; $i < count($res); $i++) {
if ($res[$i]['current_writ_id'] == $res[$i]['prev_writ_id'] && $res[$i]['current_writ_ver'] == $res[$i]['prev_writ_ver']) {
continue;
}
if (!empty($LD[$t]['lastDate'])) {
$toDate = $LD[$t]['lastDate'];
} else {
if ($LastDate == '0000-00-00') {
$toDate = $t . "/12/30";
} else {
$toDate = DateModules::CompareDate(str_replace("/", "-", DateModules::shamsi_to_miladi($t . "/12/30")), str_replace("/", "-", DateModules::shamsi_to_miladi($LastDate))) >= 0 ? $LastDate : $t . "/12/30";
}
}
/* if ($sdate != "" && $sdate > '0000-00-00')
$Row .= "<td>" . $sdate . "</td>";
else
$Row .= "<td>" .DateModules::miladi_to_shamsi($res[$i]['current_execute_date']). "</td>";
*/
if ($res[$i]['current_execute_date'] == $res[$i + 1]['current_execute_date']) {
//$Row .= "<td>" . DateModules::AddToJDate($toDate, 1) . "</td>";
$sdate = DateModules::AddToJDate($toDate, 1);
}
/*else if ($sdate != "" && $sdate > '0000-00-00' && empty($res[$i + 1]['current_execute_date']))
$Row .= "<td>" . $t . "/12/29" . "</td>";
elseif($res[$i + 1]['current_execute_date'] !='0000-00-00' && DateModules::CompareDate(DateModules::miladi_to_shamsi($res[$i + 1]['current_execute_date']),$LAST_PAY_DATE) == 1 )
{
$Row .= "<td>" . $LAST_PAY_DATE . "</td>";
}
else
$Row .= "<td>" . ( empty($res[$i + 1]['current_execute_date']) ? $toDate : DateModules::miladi_to_shamsi($res[$i + 1]['current_execute_date']) ) . "</td>";
*/
if (!empty($LD[$t]['lastDate'])) {
$toDate2 = DateModules::shamsi_to_miladi(DateModules::AddToJDate($LD[$t]['lastDate'], 1));
} else {
if ($LastDate == '0000-00-00') {
$toDate2 = DateModules::shamsi_to_miladi($t + 1 . "/01/01");
} else {
$toDate2 = DateModules::CompareDate(str_replace("/", "-", DateModules::shamsi_to_miladi($t . "/12/30")), str_replace("/", "-", DateModules::shamsi_to_miladi($LastDate))) >= 0 ? DateModules::AddToJDate($LastDate, 1) : DateModules::shamsi_to_miladi($t + 1 . "/01/01");
}
}
$endDate = empty($res[$i + 1]['current_execute_date']) ? $toDate2 : $res[$i + 1]['current_execute_date'];
if ($res[$i]['current_execute_date'] == $res[$i + 1]['current_execute_date']) {
$endDate = $toDate2;
}
if ($sdate != "" && $sdate > '0000-00-00' && empty($res[$i + 1]['current_execute_date'])) {
$endDate = $t + 1 . "/1/01";
if ($resPerInfo[0]['person_type'] == 3) {
$DayNo = round(DateModules::GDateMinusGDate(DateModules::shamsi_to_miladi($endDate), DateModules::shamsi_to_miladi($sdate)));
$DayNo2 = calculate_duration($sdate, $endDate);
} else {
$DayNo = calculate_duration($sdate, $endDate);
}
示例2: SplitYears
function SplitYears($startDate, $endDate, $TotalAmount)
{
if (substr($startDate, 0, 1) == 2) {
$startDate = DateModules::miladi_to_shamsi($startDate);
}
if (substr($endDate, 0, 1) == 2) {
$endDate = DateModules::miladi_to_shamsi($endDate);
}
$arr = preg_split('/[\\-\\/]/', $startDate);
$StartYear = $arr[0] * 1;
$totalDays = 0;
$yearDays = array();
$newStartDate = $startDate;
while (DateModules::CompareDate($newStartDate, $endDate) < 0) {
$arr = preg_split('/[\\-\\/]/', $newStartDate);
$LastDayOfYear = DateModules::lastJDateOfYear($arr[0]);
if (DateModules::CompareDate($LastDayOfYear, $endDate) > 0) {
$LastDayOfYear = $endDate;
}
$yearDays[$StartYear] = DateModules::JDateMinusJDate($LastDayOfYear, $newStartDate) + 1;
$totalDays += $yearDays[$StartYear];
$StartYear++;
$newStartDate = DateModules::AddToJDate($LastDayOfYear, 1);
}
$TotalDays = DateModules::JDateMinusJDate($endDate, $startDate) + 1;
$sum = 0;
foreach ($yearDays as $year => $days) {
$yearDays[$year] = round($days / $TotalDays * $TotalAmount);
$sum += $yearDays[$year];
//echo $year . " " . $days . " " . $yearDays[$year] . "\n";
}
if ($sum != $TotalAmount) {
$yearDays[$year] += $TotalAmount - $sum;
}
return $yearDays;
}
示例3: ComputeInstallmentsShekoofa
function ComputeInstallmentsShekoofa($RequestID = "", $returnMode = false)
{
$RequestID = empty($RequestID) ? $_REQUEST["RequestID"] : $RequestID;
$partObj = LON_ReqParts::GetValidPartObj($RequestID);
$payments = LON_payments::Get(" AND RequestID=? order by PayDate", array($RequestID));
$payments = $payments->fetchAll();
if (count($payments) == 0) {
return true;
}
//--------------- total pay months -------------
$firstPay = DateModules::miladi_to_shamsi($payments[0]["PayDate"]);
$LastPay = DateModules::miladi_to_shamsi($payments[count($payments) - 1]["PayDate"]);
$paymentPeriod = DateModules::GetDiffInMonth($firstPay, $LastPay);
//----------------------------------------------
$totalWage = ComputeWageOfSHekoofa($partObj);
$pdo = PdoDataAccess::getPdoObject();
$pdo->beginTransaction();
for ($i = 0; $i < $partObj->InstallmentCount; $i++) {
$monthplus = $paymentPeriod + $partObj->DelayMonths * 1 + ($i + 1) * $partObj->PayInterval * 1;
$installmentDate = DateModules::miladi_to_shamsi($payments[0]["PayDate"]);
$installmentDate = DateModules::AddToJDate($installmentDate, 0, $monthplus);
$installmentDate = DateModules::shamsi_to_miladi($installmentDate);
$obj2 = new LON_installments();
$obj2->RequestID = $RequestID;
$obj2->InstallmentDate = $installmentDate;
$obj2->InstallmentAmount = round($partObj->PartAmount / $partObj->InstallmentCount) + round($totalWage / $partObj->InstallmentCount);
if (!$obj2->AddInstallment($pdo)) {
$pdo->rollBack();
echo Response::createObjectiveResponse(false, "");
die;
}
}
$pdo->commit();
if ($returnMode) {
return true;
}
echo Response::createObjectiveResponse(true, "");
die;
}