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


PHP Mage_Sales_Model_Order_Invoice::getBaseSubtotal方法代码示例

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


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

示例1: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $store = $invoice->getStore();
     $totalTax = 0;
     $baseTotalTax = 0;
     foreach ($invoice->getAllItems() as $item) {
         $orderItem = $item->getOrderItem();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemQty) {
             if ($orderItem->isDummy()) {
                 continue;
             }
             $weeeTaxAmount = $item->getWeeeTaxAppliedAmount() * $item->getQty();
             $baseWeeeTaxAmount = $item->getBaseWeeeTaxAppliedAmount() * $item->getQty();
             $item->setWeeeTaxAppliedRowAmount($weeeTaxAmount);
             $item->setBaseWeeeTaxAppliedRowAmount($baseWeeeTaxAmount);
             $newApplied = array();
             $applied = Mage::helper('weee')->getApplied($item);
             foreach ($applied as $one) {
                 $one['base_row_amount'] = $one['base_amount'] * $item->getQty();
                 $one['row_amount'] = $one['amount'] * $item->getQty();
                 $one['base_row_amount_incl_tax'] = $one['base_amount_incl_tax'] * $item->getQty();
                 $one['row_amount_incl_tax'] = $one['amount_incl_tax'] * $item->getQty();
                 $newApplied[] = $one;
             }
             Mage::helper('weee')->setApplied($item, $newApplied);
             $item->setWeeeTaxRowDisposition($item->getWeeeTaxDisposition() * $item->getQty());
             $item->setBaseWeeeTaxRowDisposition($item->getBaseWeeeTaxDisposition() * $item->getQty());
             $totalTax += $weeeTaxAmount;
             $baseTotalTax += $baseWeeeTaxAmount;
         }
     }
     /*
      * Add FPT to totals
      * Notice that we check restriction on allowed tax, because
      * a) for last invoice we don't need to collect FPT - it is automatically collected by subtotal/tax collector,
      * that adds whole remaining (not invoiced) subtotal/tax value, so fpt is automatically included into it
      * b) FPT tax is included into order subtotal/tax value, so after multiple invoices with partial item quantities
      * it can happen that other collector will take some FPT value from shared subtotal/tax order value
      */
     $order = $invoice->getOrder();
     if (Mage::helper('weee')->includeInSubtotal($store)) {
         $allowedSubtotal = $order->getSubtotal() - $order->getSubtotalInvoiced() - $invoice->getSubtotal();
         $allowedBaseSubtotal = $order->getBaseSubtotal() - $order->getBaseSubtotalInvoiced() - $invoice->getBaseSubtotal();
         $totalTax = min($allowedSubtotal, $totalTax);
         $baseTotalTax = min($allowedBaseSubtotal, $baseTotalTax);
         $invoice->setSubtotal($invoice->getSubtotal() + $totalTax);
         $invoice->setBaseSubtotal($invoice->getBaseSubtotal() + $baseTotalTax);
     } else {
         $allowedTax = $order->getTaxAmount() - $order->getTaxInvoiced() - $invoice->getTaxAmount();
         $allowedBaseTax = $order->getBaseTaxAmount() - $order->getBaseTaxInvoiced() - $invoice->getBaseTaxAmount();
         $totalTax = min($allowedTax, $totalTax);
         $baseTotalTax = min($allowedBaseTax, $baseTotalTax);
         $invoice->setTaxAmount($invoice->getTaxAmount() + $totalTax);
         $invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $baseTotalTax);
     }
     $invoice->setGrandTotal($invoice->getGrandTotal() + $totalTax);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalTax);
     return $this;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:60,代码来源:Weee.php

示例2: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $invoice->setSveaPaymentFeeAmount(0);
     $invoice->setBaseSveaPaymentFeeAmount(0);
     $invoice->setSveaPaymentFeeTaxAmount(0);
     $invoice->setBaseSveaPaymentFeeTaxAmount(0);
     $invoice->setSveaPaymentFeeInclTax(0);
     $invoice->setBaseSveaPaymentFeeInclTax(0);
     $orderPaymentFeeAmount = $invoice->getOrder()->getSveaPaymentFeeAmount();
     $baseOrderPaymentFeeAmount = $invoice->getOrder()->getBaseSveaPaymentFeeAmount();
     $paymentFeeInclTax = $invoice->getOrder()->getSveaPaymentFeeInclTax();
     $basePaymentFeeInclTax = $invoice->getOrder()->getBaseSveaPaymentFeeInclTax();
     if ($orderPaymentFeeAmount) {
         foreach ($invoice->getOrder()->getInvoiceCollection() as $previousInvoice) {
             if ($previousInvoice->getSveaPaymentFeeAmount() && !$previousInvoice->isCanceled()) {
                 // Payment fee has already been invoiced
                 return $this;
             }
         }
         $invoice->setSveaPaymentFeeAmount($orderPaymentFeeAmount);
         $invoice->setBaseSveaPaymentFeeAmount($baseOrderPaymentFeeAmount);
         $invoice->setSveaPaymentFeeTaxAmount($invoice->getOrder()->getSveaPaymentFeeTaxAmount());
         $invoice->setBaseSveaPaymentFeeTaxAmount($invoice->getOrder()->getBaseSveaPaymentFeeTaxAmount());
         $invoice->setSveaPaymentFeeInclTax($paymentFeeInclTax);
         $invoice->setBaseSveaPaymentFeeInclTax($basePaymentFeeInclTax);
         $subtotal = $invoice->getSubtotal();
         $baseSubtotal = $invoice->getBaseSubtotal();
         $subtotalInclTax = $invoice->getSubtotalInclTax();
         $baseSubtotalInclTax = $invoice->getBaseSubtotalInclTax();
         $grandTotal = $invoice->getGrandTotal() + $orderPaymentFeeAmount;
         $baseGrandTotal = $invoice->getBaseGrandTotal() + $baseOrderPaymentFeeAmount;
         $totalTax = $invoice->getTaxAmount();
         $baseTotalTax = $invoice->getBaseTaxAmount();
         if ($invoice->isLast()) {
             $subtotalInclTax -= $invoice->getOrder()->getSveaPaymentFeeTaxAmount();
             $baseSubtotalInclTax -= $invoice->getOrder()->getBaseSveaPaymentFeeTaxAmount();
         } else {
             $totalTax += $invoice->getOrder()->getSveaPaymentFeeTaxAmount();
             $baseTotalTax += $invoice->getOrder()->getBaseSveaPaymentFeeTaxAmount();
             $subtotalInclTax += $invoice->getOrder()->getSveaPaymentFeeTaxAmount();
             $baseSubtotalInclTax += $invoice->getOrder()->getBaseSveaPaymentFeeTaxAmount();
             $grandTotal += $invoice->getOrder()->getSveaPaymentFeeTaxAmount();
             $baseGrandTotal += $invoice->getOrder()->getBaseSveaPaymentFeeTaxAmount();
         }
         $invoice->setSubtotal($subtotal);
         $invoice->setBaseSubtotal($baseSubtotal);
         $invoice->setSubtotalInclTax($subtotalInclTax);
         $invoice->setBaseSubtotalInclTax($baseSubtotalInclTax);
         $invoice->setTaxAmount($totalTax);
         $invoice->setBaseTaxAmount($baseTotalTax);
         $invoice->setGrandTotal($grandTotal);
         $invoice->setBaseGrandTotal($baseGrandTotal);
     }
     return $this;
 }
开发者ID:LybeAB,项目名称:magento-module,代码行数:55,代码来源:Paymentfee.php

示例3: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $store = $invoice->getStore();
     $totalTax = 0;
     $baseTotalTax = 0;
     foreach ($invoice->getAllItems() as $item) {
         $orderItem = $item->getOrderItem();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemQty) {
             if ($orderItem->isDummy()) {
                 continue;
             }
             $weeeTaxAmount = $item->getWeeeTaxAppliedAmount() * $item->getQty();
             $baseWeeeTaxAmount = $item->getBaseWeeeTaxAppliedAmount() * $item->getQty();
             $item->setWeeeTaxAppliedRowAmount($weeeTaxAmount);
             $item->setBaseWeeeTaxAppliedRowAmount($baseWeeeTaxAmount);
             $newApplied = array();
             $applied = Mage::helper('weee')->getApplied($item);
             foreach ($applied as $one) {
                 $one['base_row_amount'] = $one['base_amount'] * $item->getQty();
                 $one['row_amount'] = $one['amount'] * $item->getQty();
                 $one['base_row_amount_incl_tax'] = $one['base_amount_incl_tax'] * $item->getQty();
                 $one['row_amount_incl_tax'] = $one['amount_incl_tax'] * $item->getQty();
                 $newApplied[] = $one;
             }
             Mage::helper('weee')->setApplied($item, $newApplied);
             $item->setWeeeTaxRowDisposition($item->getWeeeTaxDisposition() * $item->getQty());
             $item->setBaseWeeeTaxRowDisposition($item->getBaseWeeeTaxDisposition() * $item->getQty());
             $totalTax += $weeeTaxAmount;
             $baseTotalTax += $baseWeeeTaxAmount;
         }
     }
     if (Mage::helper('weee')->includeInSubtotal($store)) {
         $invoice->setSubtotal($invoice->getSubtotal() + $totalTax);
         $invoice->setBaseSubtotal($invoice->getBaseSubtotal() + $baseTotalTax);
     } else {
         $invoice->setTaxAmount($invoice->getTaxAmount() + $totalTax);
         $invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $baseTotalTax);
     }
     $invoice->setGrandTotal($invoice->getGrandTotal() + $totalTax);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalTax);
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:43,代码来源:Weee.php


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