本文整理汇总了PHP中DateModules::GetDiffInMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP DateModules::GetDiffInMonth方法的具体用法?PHP DateModules::GetDiffInMonth怎么用?PHP DateModules::GetDiffInMonth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateModules
的用法示例。
在下文中一共展示了DateModules::GetDiffInMonth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ComputeWageOfSHekoofa
function ComputeWageOfSHekoofa($partObj)
{
$payments = LON_payments::Get(" AND RequestID=? order by PayDate", array($partObj->RequestID));
$payments = $payments->fetchAll();
//--------------- 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 = 0;
$wages = array();
foreach ($payments as $row) {
$wages[] = array();
$wageindex = count($wages) - 1;
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);
$jdiff = DateModules::GDateMinusGDate($installmentDate, $row["PayDate"]);
$wage = round($row["PayAmount"] / $partObj->InstallmentCount * $jdiff * $partObj->CustomerWage / 36500);
$wages[$wageindex][] = $wage;
$totalWage += $wage;
}
}
return $totalWage;
}
示例2: 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;
}