当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order_Invoice::setBaseCodTaxAmount方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order_Invoice::setBaseCodTaxAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Invoice::setBaseCodTaxAmount方法的具体用法?PHP Mage_Sales_Model_Order_Invoice::setBaseCodTaxAmount怎么用?PHP Mage_Sales_Model_Order_Invoice::setBaseCodTaxAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order_Invoice的用法示例。


在下文中一共展示了Mage_Sales_Model_Order_Invoice::setBaseCodTaxAmount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $codTax = 0;
     $baseCodTax = 0;
     $includeCodTax = true;
     /**
      * Check Cod amount in previus invoices
      */
     foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) {
         if ($previusInvoice->getCodFee() && !$previusInvoice->isCanceled()) {
             $includeCodTax = false;
         }
     }
     if ($includeCodTax) {
         $codTax += $invoice->getOrder()->getCodTaxAmount();
         $baseCodTax += $invoice->getOrder()->getBaseCodTaxAmount();
         $invoice->setCodTaxAmount($invoice->getOrder()->getCodTaxAmount());
         $invoice->setBaseCodTaxAmount($invoice->getOrder()->getBaseCodTaxAmount());
         $invoice->getOrder()->setCodTaxAmountInvoiced($codTax);
         $invoice->getOrder()->setBaseCodTaxAmountInvoice($baseCodTax);
     }
     //$invoice->setTaxAmount($invoice->getTaxAmount() + $codTax);
     //$invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $baseCodTax);
     //$invoice->setGrandTotal($invoice->getGrandTotal() + $codTax);
     //$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseCodTax);
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:27,代码来源:Tax.php

示例2: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $codTax = 0;
     $baseCodTax = 0;
     $order = $invoice->getOrder();
     $includeCodTax = true;
     if ($order->getPayment()->getMethodInstance()->getCode() != 'phoenix_cashondelivery') {
         return $this;
     }
     /**
      * Check Cod amount in previus invoices
      */
     foreach ($order->getInvoiceCollection() as $previousInvoice) {
         if ($previousInvoice->getCodFee() && !$previousInvoice->isCanceled()) {
             $includeCodTax = false;
         }
     }
     if ($includeCodTax) {
         $codTax = $order->getCodTaxAmount();
         $baseCodTax = $order->getBaseCodTaxAmount();
         $invoice->setCodTaxAmount($order->getCodTaxAmount());
         $invoice->setBaseCodTaxAmount($order->getBaseCodTaxAmount());
         $invoice->getOrder()->setCodTaxAmountInvoiced($codTax);
         $invoice->getOrder()->setBaseCodTaxAmountInvoiced($baseCodTax);
     }
     /**
      * Not isLast() invoice case handling
      * totalTax adjustment
      * check Mage_Sales_Model_Order_Invoice_Total_Tax::collect()
      */
     $allowedTax = $order->getTaxAmount() - $order->getTaxInvoiced();
     $allowedBaseTax = $order->getBaseTaxAmount() - $order->getBaseTaxInvoiced();
     $totalTax = $invoice->getTaxAmount();
     $baseTotalTax = $invoice->getBaseTaxAmount();
     if (!$invoice->isLast() && $allowedTax > $totalTax) {
         $newTotalTax = min($allowedTax, $totalTax + $codTax);
         $newBaseTotalTax = min($allowedBaseTax, $baseTotalTax + $baseCodTax);
         $invoice->setTaxAmount($newTotalTax);
         $invoice->setBaseTaxAmount($newBaseTotalTax);
         $invoice->setGrandTotal($invoice->getGrandTotal() - $totalTax + $newTotalTax);
         $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() - $baseTotalTax + $newBaseTotalTax);
     }
     return $this;
 }
开发者ID:anirudhpandia,项目名称:Magento-CashOnDelivery,代码行数:44,代码来源:Tax.php


注:本文中的Mage_Sales_Model_Order_Invoice::setBaseCodTaxAmount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。