本文整理汇总了PHP中Receipt::getTaxDue方法的典型用法代码示例。如果您正苦于以下问题:PHP Receipt::getTaxDue方法的具体用法?PHP Receipt::getTaxDue怎么用?PHP Receipt::getTaxDue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Receipt
的用法示例。
在下文中一共展示了Receipt::getTaxDue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initReceipt
function initReceipt($payment, $taxType)
{
$receipt = new Receipt();
$receipt->setReceiptDate(date("Y-m-d", strtotime("now")));
$receipt->setReceivedFrom($payment->getOwnerID());
$receipt->setTaxType($taxType);
if ($payment->getDueID() != "") {
$due = $this->captureDueDetails($payment->getDueID());
} else {
if ($payment->getBacktaxTDID() != "") {
$due = $this->captureBacktaxTDDetails($payment->getBacktaxTDID(), $payment->getDueType());
} else {
// should not get here.
// cannot establish taxDue and thus a proper receipt.
// exit("error. payment has no dueID / backtaxTDID associated. cannot establish receipts");
}
}
switch ($taxType) {
case "basic":
$receipt->setTaxDue(un_number_format($due->getBasicTax()));
break;
case "sef":
$receipt->setTaxDue(un_number_format($due->getSefTax()));
break;
case "idle":
$receipt->setTaxDue(un_number_format($due->getIdleTax()));
break;
}
// use: basicAdvancedPaymentDiscount = (advancedPaymentDiscount/taxDue)(basicTax)
$advancedPaymentDiscount = un_number_format($payment->getAdvancedPaymentDiscount()) / un_number_format($payment->getTaxDue());
$advancedPaymentDiscount = $advancedPaymentDiscount * un_number_format($receipt->getTaxDue());
$receipt->setAdvancedPaymentDiscount($advancedPaymentDiscount);
// use: basicEarlyPaymentDiscount = (earlyPaymentDiscount/taxDue)(basicTax)
$earlyPaymentDiscount = un_number_format($payment->getEarlyPaymentDiscount()) / un_number_format($payment->getTaxDue());
$earlyPaymentDiscount = $earlyPaymentDiscount * un_number_format($receipt->getTaxDue());
$receipt->setEarlyPaymentDiscount($earlyPaymentDiscount);
// if amountPaidForQuartersForTaxType > 0 use
// use: basicPenalty = (penalty/balanceDue)(basicTax)
// else
// use: basicPenalty = (penalty/taxDue)(basicTax)
if ($amountPaidForQuartersForTaxType > 0) {
$penalty = un_number_format($payment->getPenalty()) / un_number_format($payment->getBalanceDue());
$penalty = $penalty * un_number_format($receipt->getTaxDue());
} else {
$penalty = un_number_format($payment->getPenalty()) / un_number_format($payment->getTaxDue());
$penalty = $penalty * un_number_format($receipt->getTaxDue());
}
$receipt->setPenalty($penalty);
$receipt->setAmnesty($payment->getAmnesty());
// use:
// basicBalanceDue = basicTax
// ** if discount > 0 : basicBalanceDue = basicTax - [basicEarlyPaymentDiscount or basicAdvancedPaymentDiscount]
// ** if amnesty is true : basicBalanceDue += basicPenalty
// basicBalance Due = basicBalanceDue - paidBasic
$balanceDue = $receipt->getTaxDue();
if ($receipt->getAdvancedPaymentDiscount() > 0) {
$balanceDue = $receipt->getTaxDue() - $receipt->getAdvancedPaymentDiscount();
} else {
if ($receipt->getEarlyPaymentDiscount() > 0) {
$balanceDue = $receipt->getTaxDue() - $receipt->getEarlyPaymentDiscount();
}
}
if ($receipt->getAmnesty() != "true") {
$balanceDue = $balanceDue + un_number_format($receipt->getPenalty());
}
$paidTotals = $this->getPaidTotals($payment->getDueID(), $payment->getBacktaxTDID(), $payment->getDueType(), $taxType);
// if Due Type is "Annual" and previous "Quarter" payments have been made, adjust the Tax Due:
// this is for reverted annual payments from quarterly mode
if (is_a($due, "Due")) {
if ($due->getDueType() == "Annual") {
$amountPaidForQuartersForTaxType = $this->getAmountPaidForQuarters($due, $taxType);
}
if ($amountPaidForQuartersForTaxType > 0) {
$paidTotals = $amountPaidForQuartersForTaxType;
}
}
$balanceDue = $balanceDue - $paidTotals;
$receipt->setBalanceDue($balanceDue);
// use: basicAmountPaid = (basicBalanceDue/balanceDue)(amountPaid)
$amountPaid = un_number_format($receipt->getBalanceDue()) / un_number_format($payment->getBalanceDue());
$amountPaid = $amountPaid * un_number_format($payment->getAmountPaid());
$receipt->setAmountPaid($amountPaid);
return $receipt;
}