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


PHP Mage_Sales_Model_Order_Invoice::getAllItems方法代码示例

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


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

示例1: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $totalTax = 0;
     $baseTotalTax = 0;
     foreach ($invoice->getAllItems() as $item) {
         $orderItem = $item->getOrderItem();
         $orderItemTax = $orderItem->getTaxAmount();
         $baseOrderItemTax = $orderItem->getBaseTaxAmount();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemTax && $orderItemQty) {
             /**
              * Resolve rounding problems
              */
             if ($item->isLast()) {
                 $tax = $orderItemTax - $orderItem->getTaxInvoiced();
                 $baseTax = $baseOrderItemTax - $orderItem->getBaseTaxInvoiced();
             } else {
                 $tax = $orderItemTax * $item->getQty() / $orderItemQty;
                 $baseTax = $baseOrderItemTax * $item->getQty() / $orderItemQty;
                 $tax = $invoice->getStore()->roundPrice($tax);
                 $baseTax = $invoice->getStore()->roundPrice($baseTax);
             }
             $item->setTaxAmount($tax);
             $item->setBaseTaxAmount($baseTax);
             $totalTax += $tax;
             $baseTotalTax += $baseTax;
         }
     }
     $invoice->setTaxAmount($totalTax);
     $invoice->setBaseTaxAmount($baseTotalTax);
     $invoice->setGrandTotal($invoice->getGrandTotal() + $totalTax);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalTax);
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:34,代码来源:Tax.php

示例2: collect

 /**
  * Collect invoice subtotal
  *
  * @param   Mage_Sales_Model_Order_Invoice $invoice
  * @return  Mage_Sales_Model_Order_Invoice_Total_Subtotal
  */
 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $subtotal = 0;
     $baseSubtotal = 0;
     $subtotalInclTax = 0;
     $baseSubtotalInclTax = 0;
     $order = $invoice->getOrder();
     foreach ($invoice->getAllItems() as $item) {
         $item->calcRowTotal();
         if ($item->getOrderItem()->isDummy()) {
             continue;
         }
         $subtotal += $item->getRowTotal();
         $baseSubtotal += $item->getBaseRowTotal();
         $subtotalInclTax += $item->getRowTotalInclTax();
         $baseSubtotalInclTax += $item->getBaseRowTotalInclTax();
     }
     $allowedSubtotal = $order->getSubtotal() - $order->getSubtotalInvoiced();
     $baseAllowedSubtotal = $order->getBaseSubtotal() - $order->getBaseSubtotalInvoiced();
     if ($invoice->isLast()) {
         $subtotal = $allowedSubtotal;
         $baseSubtotal = $baseAllowedSubtotal;
     } else {
         $subtotal = min($allowedSubtotal, $subtotal);
         $baseSubtotal = min($baseAllowedSubtotal, $baseSubtotal);
     }
     $invoice->setSubtotal($subtotal);
     $invoice->setBaseSubtotal($baseSubtotal);
     $invoice->setSubtotalInclTax($subtotalInclTax);
     $invoice->setBaseSubtotalInclTax($baseSubtotalInclTax);
     $invoice->setGrandTotal($invoice->getGrandTotal() + $subtotal);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseSubtotal);
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:40,代码来源:Subtotal.php

示例3: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $baseDiscount = 0;
     $discount = 0;
     foreach ($invoice->getAllItems() as $item) {
         if ($item->getOrderItem()->isDummy()) {
             continue;
         }
         $orderItem = $item->getOrderItem();
         $orderItemDiscount = (double) $orderItem->getAffiliateplusAmount();
         $baseOrderItemDiscount = (double) $orderItem->getBaseAffiliateplusAmount();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemDiscount && $orderItemQty) {
             $discount -= $orderItemDiscount * $item->getQty() / $orderItemQty;
             $baseDiscount -= $baseOrderItemDiscount * $item->getQty() / $orderItemQty;
         }
     }
     if (!floatval($baseDiscount)) {
         $order = $invoice->getOrder();
         $baseDiscount = $order->getBaseAffiliateplusDiscount();
         $discount = $order->getAffiliateplusDiscount();
     }
     if (floatval($baseDiscount)) {
         $baseDiscount = Mage::app()->getStore()->roundPrice($baseDiscount);
         $discount = Mage::app()->getStore()->roundPrice($discount);
         $invoice->setBaseAffiliateplusDiscount($baseDiscount);
         $invoice->setAffiliateplusDiscount($discount);
         $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseDiscount);
         $invoice->setGrandTotal($invoice->getGrandTotal() + $discount);
     }
     return $this;
 }
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:32,代码来源:Magestore_Affiliateplus_Model_Total_Invoice_Affiliateplus.php

示例4: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $invoice->setGomageGiftWrapAmount(0);
     $invoice->setBaseGomageGiftWrapAmount(0);
     $totalGomageGiftWrapAmount = 0;
     $baseTotalGomageGiftWrapAmount = 0;
     foreach ($invoice->getAllItems() as $item) {
         if ($item->getOrderItem()->isDummy()) {
             continue;
         }
         $orderItem = $item->getOrderItem();
         $orderItemGomageGiftWrap = (double) $orderItem->getGomageGiftWrapAmount();
         $baseOrderItemGomageGiftWrap = (double) $orderItem->getBaseGomageGiftWrapAmount();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemGomageGiftWrap && $orderItemQty) {
             $GomageGiftWrap = $orderItemGomageGiftWrap * $item->getQty() / $orderItemQty;
             $baseGomageGiftWrap = $baseOrderItemGomageGiftWrap * $item->getQty() / $orderItemQty;
             $GomageGiftWrap = $invoice->getStore()->roundPrice($GomageGiftWrap);
             $baseGomageGiftWrap = $invoice->getStore()->roundPrice($baseGomageGiftWrap);
             $item->setGomageGiftWrapAmount($GomageGiftWrap);
             $item->setBaseGomageGiftWrapAmount($baseGomageGiftWrap);
             $totalGomageGiftWrapAmount += $GomageGiftWrap;
             $baseTotalGomageGiftWrapAmount += $baseGomageGiftWrap;
         }
     }
     $invoice->setGomageGiftWrapAmount($totalGomageGiftWrapAmount);
     $invoice->setBaseGomageGiftWrapAmount($baseTotalGomageGiftWrapAmount);
     $invoice->setGrandTotal($invoice->getGrandTotal() + $totalGomageGiftWrapAmount);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalGomageGiftWrapAmount);
     return $this;
 }
开发者ID:jpedro21,项目名称:comerciodoboi,代码行数:31,代码来源:Giftwrap.php

示例5: 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

示例6: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $invoice->setDiscountAmount(0);
     $invoice->setBaseDiscountAmount(0);
     $totalDiscountAmount = 0;
     $baseTotalDiscountAmount = 0;
     /**
      * Checking if shipping discount was added in previous invoices.
      * So basically if we have invoice with positive discount and it
      * was not canceled we don't add shipping discount to this one.
      */
     $addShippingDicount = true;
     foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) {
         if ($previusInvoice->getDiscountAmount()) {
             $addShippingDicount = false;
         }
     }
     if ($addShippingDicount) {
         $totalDiscountAmount = $totalDiscountAmount + $invoice->getOrder()->getShippingDiscountAmount();
         $baseTotalDiscountAmount = $baseTotalDiscountAmount + $invoice->getOrder()->getBaseShippingDiscountAmount();
     }
     /** @var $item Mage_Sales_Model_Order_Invoice_Item */
     foreach ($invoice->getAllItems() as $item) {
         $orderItem = $item->getOrderItem();
         if ($orderItem->isDummy()) {
             continue;
         }
         $orderItemDiscount = (double) $orderItem->getDiscountAmount();
         $baseOrderItemDiscount = (double) $orderItem->getBaseDiscountAmount();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemDiscount && $orderItemQty) {
             /**
              * Resolve rounding problems
              *
              * We dont want to include the weee discount amount as the right amount
              * is added when calculating the taxes.
              *
              * Also the subtotal is without weee
              */
             $discount = $orderItemDiscount - $orderItem->getDiscountInvoiced();
             $baseDiscount = $baseOrderItemDiscount - $orderItem->getBaseDiscountInvoiced();
             if (!$item->isLast()) {
                 $activeQty = $orderItemQty - $orderItem->getQtyInvoiced();
                 $discount = $invoice->roundPrice($discount / $activeQty * $item->getQty(), 'regular', true);
                 $baseDiscount = $invoice->roundPrice($baseDiscount / $activeQty * $item->getQty(), 'base', true);
             }
             $item->setDiscountAmount($discount);
             $item->setBaseDiscountAmount($baseDiscount);
             $totalDiscountAmount += $discount;
             $baseTotalDiscountAmount += $baseDiscount;
         }
     }
     $invoice->setDiscountAmount(-$totalDiscountAmount);
     $invoice->setBaseDiscountAmount(-$baseTotalDiscountAmount);
     $invoice->setGrandTotal($invoice->getGrandTotal() - $totalDiscountAmount);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() - $baseTotalDiscountAmount);
     return $this;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:58,代码来源:Discount.php

示例7: collect

 /**
  * Collect invoice subtotal
  *
  * @param   Mage_Sales_Model_Order_Invoice $invoice
  * @return  Mage_Sales_Model_Order_Invoice_Total_Subtotal
  */
 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $subtotal = 0;
     $baseSubtotal = 0;
     $subtotalInclTax = 0;
     $baseSubtotalInclTax = 0;
     $order = $invoice->getOrder();
     foreach ($invoice->getAllItems() as $item) {
         if ($item->getOrderItem()->isDummy()) {
             continue;
         }
         $item->calcRowTotal();
         $subtotal += $item->getRowTotal();
         $baseSubtotal += $item->getBaseRowTotal();
         $subtotalInclTax += $item->getRowTotalInclTax();
         $baseSubtotalInclTax += $item->getBaseRowTotalInclTax();
     }
     $allowedSubtotal = $order->getSubtotal() - $order->getSubtotalInvoiced();
     $baseAllowedSubtotal = $order->getBaseSubtotal() - $order->getBaseSubtotalInvoiced();
     $allowedSubtotalInclTax = $allowedSubtotal + $order->getHiddenTaxAmount() + $order->getTaxAmount() - $order->getTaxInvoiced() - $order->getHiddenTaxInvoiced();
     $baseAllowedSubtotalInclTax = $baseAllowedSubtotal + $order->getBaseHiddenTaxAmount() + $order->getBaseTaxAmount() - $order->getBaseTaxInvoiced() - $order->getBaseHiddenTaxInvoiced();
     /**
      * Check if shipping tax calculation is included to current invoice.
      */
     $includeShippingTax = true;
     foreach ($invoice->getOrder()->getInvoiceCollection() as $previousInvoice) {
         if ($previousInvoice->getShippingAmount() && !$previousInvoice->isCanceled()) {
             $includeShippingTax = false;
             break;
         }
     }
     if ($includeShippingTax) {
         $allowedSubtotalInclTax -= $order->getShippingTaxAmount();
         $baseAllowedSubtotalInclTax -= $order->getBaseShippingTaxAmount();
     } else {
         $allowedSubtotalInclTax += $order->getShippingHiddenTaxAmount();
         $baseAllowedSubtotalInclTax += $order->getBaseShippingHiddenTaxAmount();
     }
     if ($invoice->isLast()) {
         $subtotal = $allowedSubtotal;
         $baseSubtotal = $baseAllowedSubtotal;
         $subtotalInclTax = $allowedSubtotalInclTax;
         $baseSubtotalInclTax = $baseAllowedSubtotalInclTax;
     } else {
         $subtotal = min($allowedSubtotal, $subtotal);
         $baseSubtotal = min($baseAllowedSubtotal, $baseSubtotal);
         $subtotalInclTax = min($allowedSubtotalInclTax, $subtotalInclTax);
         $baseSubtotalInclTax = min($baseAllowedSubtotalInclTax, $baseSubtotalInclTax);
     }
     $invoice->setSubtotal($subtotal);
     $invoice->setBaseSubtotal($baseSubtotal);
     $invoice->setSubtotalInclTax($subtotalInclTax);
     $invoice->setBaseSubtotalInclTax($baseSubtotalInclTax);
     $invoice->setGrandTotal($invoice->getGrandTotal() + $subtotal);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseSubtotal);
     return $this;
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:63,代码来源:Subtotal.php

示例8: collect

 /**
  * Collect gift wrapping tax totals
  *
  * @param Mage_Sales_Model_Order_Invoice $invoice
  * @return Enterprise_GiftWrapping_Model_Total_Invoice_Tax_Giftwrapping
  */
 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     /**
      * Wrapping for items
      */
     $invoiced = 0;
     $baseInvoiced = 0;
     foreach ($invoice->getAllItems() as $invoiceItem) {
         if (!$invoiceItem->getQty() || $invoiceItem->getQty() == 0) {
             continue;
         }
         $orderItem = $invoiceItem->getOrderItem();
         if ($orderItem->getGwId() && $orderItem->getGwBaseTaxAmount() && $orderItem->getGwBaseTaxAmount() != $orderItem->getGwBaseTaxAmountInvoiced()) {
             $orderItem->setGwBaseTaxAmountInvoiced($orderItem->getGwBaseTaxAmount());
             $orderItem->setGwTaxAmountInvoiced($orderItem->getGwTaxAmount());
             $baseInvoiced += $orderItem->getGwBaseTaxAmount();
             $invoiced += $orderItem->getGwTaxAmount();
         }
     }
     if ($invoiced > 0 || $baseInvoiced > 0) {
         $order->setGwItemsBaseTaxInvoiced($order->getGwItemsBaseTaxInvoiced() + $baseInvoiced);
         $order->setGwItemsTaxInvoiced($order->getGwItemsTaxInvoiced() + $invoiced);
         $invoice->setGwItemsBaseTaxAmount($baseInvoiced);
         $invoice->setGwItemsTaxAmount($invoiced);
     }
     /**
      * Wrapping for order
      */
     if ($order->getGwId() && $order->getGwBaseTaxAmount() && $order->getGwBaseTaxAmount() != $order->getGwBaseTaxAmountInvoiced()) {
         $order->setGwBaseTaxAmountInvoiced($order->getGwBaseTaxAmount());
         $order->setGwTaxAmountInvoiced($order->getGwTaxAmount());
         $invoice->setGwBaseTaxAmount($order->getGwBaseTaxAmount());
         $invoice->setGwTaxAmount($order->getGwTaxAmount());
     }
     /**
      * Printed card
      */
     if ($order->getGwAddCard() && $order->getGwCardBaseTaxAmount() && $order->getGwCardBaseTaxAmount() != $order->getGwCardBaseTaxInvoiced()) {
         $order->setGwCardBaseTaxInvoiced($order->getGwCardBaseTaxAmount());
         $order->setGwCardTaxInvoiced($order->getGwCardTaxAmount());
         $invoice->setGwCardBaseTaxAmount($order->getGwCardBaseTaxAmount());
         $invoice->setGwCardTaxAmount($order->getGwCardTaxAmount());
     }
     if (!$invoice->isLast()) {
         $baseTaxAmount = $invoice->getGwItemsBaseTaxAmount() + $invoice->getGwBaseTaxAmount() + $invoice->getGwCardBaseTaxAmount();
         $taxAmount = $invoice->getGwItemsTaxAmount() + $invoice->getGwTaxAmount() + $invoice->getGwCardTaxAmount();
         $invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $baseTaxAmount);
         $invoice->setTaxAmount($invoice->getTaxAmount() + $taxAmount);
         $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTaxAmount);
         $invoice->setGrandTotal($invoice->getGrandTotal() + $taxAmount);
     }
     return $this;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:60,代码来源:Giftwrapping.php

示例9: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $invoice->setDiscountAmount(0);
     $invoice->setBaseDiscountAmount(0);
     $totalDiscountAmount = 0;
     $baseTotalDiscountAmount = 0;
     /**
      * Checking if shipping discount was added in previous invoices.
      * So basically if we have invoice with positive discount and it
      * was not canceled we don't add shipping discount to this one.
      */
     $addShippingDicount = true;
     foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) {
         if ($previusInvoice->getDiscountAmount()) {
             $addShippingDicount = false;
         }
     }
     if ($addShippingDicount) {
         $totalDiscountAmount = $totalDiscountAmount + $invoice->getOrder()->getShippingDiscountAmount();
         $baseTotalDiscountAmount = $baseTotalDiscountAmount + $invoice->getOrder()->getBaseShippingDiscountAmount();
     }
     foreach ($invoice->getAllItems() as $item) {
         if ($item->getOrderItem()->isDummy()) {
             continue;
         }
         $orderItem = $item->getOrderItem();
         $orderItemDiscount = (double) $orderItem->getDiscountAmount();
         $baseOrderItemDiscount = (double) $orderItem->getBaseDiscountAmount();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemDiscount && $orderItemQty) {
             /**
              * Resolve rounding problems
              */
             if ($item->isLast()) {
                 $discount = $orderItemDiscount - $orderItem->getDiscountInvoiced();
                 $baseDiscount = $baseOrderItemDiscount - $orderItem->getBaseDiscountInvoiced();
             } else {
                 $discount = $orderItemDiscount * $item->getQty() / $orderItemQty;
                 $baseDiscount = $baseOrderItemDiscount * $item->getQty() / $orderItemQty;
                 $discount = $invoice->getStore()->roundPrice($discount);
                 $baseDiscount = $invoice->getStore()->roundPrice($baseDiscount);
             }
             $item->setDiscountAmount($discount);
             $item->setBaseDiscountAmount($baseDiscount);
             $totalDiscountAmount += $discount;
             $baseTotalDiscountAmount += $baseDiscount;
         }
     }
     $invoice->setDiscountAmount($totalDiscountAmount);
     $invoice->setBaseDiscountAmount($baseTotalDiscountAmount);
     $invoice->setGrandTotal($invoice->getGrandTotal() - $totalDiscountAmount);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() - $baseTotalDiscountAmount);
     return $this;
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:54,代码来源:Discount.php

示例10: collect

 /**
  * Collect total cost of invoiced items
  *
  * @param Mage_Sales_Model_Order_Invoice $invoice
  * @return Mage_Sales_Model_Order_Invoice_Total_Cost
  */
 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $baseInvoiceTotalCost = 0;
     foreach ($invoice->getAllItems() as $item) {
         if (!$item->getHasChildren()) {
             $baseInvoiceTotalCost += $item->getBaseCost() * $item->getQty();
         }
     }
     $invoice->setBaseCost($baseInvoiceTotalCost);
     return $this;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:17,代码来源:Cost.php

示例11: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $totalTax = 0;
     $baseTotalTax = 0;
     foreach ($invoice->getAllItems() as $item) {
         $orderItem = $item->getOrderItem();
         $orderItemTax = $orderItem->getTaxAmount();
         $baseOrderItemTax = $orderItem->getBaseTaxAmount();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemTax && $orderItemQty) {
             if ($item->getOrderItem()->isDummy()) {
                 continue;
             }
             /**
              * Resolve rounding problems
              */
             if ($item->isLast()) {
                 $tax = $orderItemTax - $orderItem->getTaxInvoiced();
                 $baseTax = $baseOrderItemTax - $orderItem->getBaseTaxInvoiced();
             } else {
                 $tax = $orderItemTax * $item->getQty() / $orderItemQty;
                 $baseTax = $baseOrderItemTax * $item->getQty() / $orderItemQty;
                 $tax = $invoice->getStore()->roundPrice($tax);
                 $baseTax = $invoice->getStore()->roundPrice($baseTax);
             }
             $item->setTaxAmount($tax);
             $item->setBaseTaxAmount($baseTax);
             $totalTax += $tax;
             $baseTotalTax += $baseTax;
         }
     }
     $includeShippingTax = true;
     /**
      * Check shipping amount in previus invoices
      */
     foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) {
         if ($previusInvoice->getShippingAmount() && !$previusInvoice->isCanceled()) {
             $includeShippingTax = false;
         }
     }
     if ($includeShippingTax) {
         $totalTax += $invoice->getOrder()->getShippingTaxAmount();
         $baseTotalTax += $invoice->getOrder()->getBaseShippingTaxAmount();
         $invoice->setShippingTaxAmount($invoice->getOrder()->getShippingTaxAmount());
         $invoice->setBaseShippingTaxAmount($invoice->getOrder()->getBaseShippingTaxAmount());
     }
     $invoice->setTaxAmount($totalTax);
     $invoice->setBaseTaxAmount($baseTotalTax);
     $invoice->setGrandTotal($invoice->getGrandTotal() + $totalTax);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalTax);
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:52,代码来源:Order_Invoice_Total_Tax.php

示例12: collect

 /**
  * Collect invoice subtotal
  *
  * @param   Mage_Sales_Model_Order_Invoice $invoice
  * @return  Mage_Sales_Model_Order_Invoice_Total_Subtotal
  */
 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $subtotal = 0;
     $baseSubtotal = 0;
     foreach ($invoice->getAllItems() as $item) {
         $item->calcRowTotal();
         $subtotal += $item->getRowTotal();
         $baseSubtotal += $item->getBaseRowTotal();
     }
     $invoice->setSubtotal($subtotal);
     $invoice->setBaseSubtotal($baseSubtotal);
     $invoice->setGrandTotal($invoice->getGrandTotal() + $subtotal);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseSubtotal);
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:21,代码来源:Subtotal.php

示例13: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     //$affiliate = Mage::getModel('credit/creditorder')->load($order->getIncrementId())->getAffiliate();
     $affiliate = 0;
     //$credit = Mage::getModel('credit/creditorder')->load($order->getIncrementId())->getCredit();
     $credit = 0;
     $totalDiscountAmount = $affiliate + $credit;
     $baseTotalDiscountAmount = $affiliate + $credit;
     $items = $invoice->getAllItems();
     if (!count($items)) {
         return $this;
     }
     $invoice->setBaseDiscountAmount($invoice->getBaseDiscountAmount() - $baseTotalDiscountAmount);
     $invoice->setGrandTotal($invoice->getGrandTotal() - $totalDiscountAmount);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() - $baseTotalDiscountAmount);
     return $this;
 }
开发者ID:Gilbertoavitia1,项目名称:AHBS,代码行数:18,代码来源:Affiliate.php

示例14: 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

示例15: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     if (!$order->getRewardpointsInvitedBaseDiscount()) {
         return $this;
     }
     $invoice->setRewardpointsInvitedDiscount(0);
     $invoice->setRewardpointsInvitedBaseDiscount(0);
     $totalDiscountAmount = 0;
     $baseTotalDiscountAmount = 0;
     if ($invoice->isLast()) {
         $baseTotalDiscountAmount = $order->getRewardpointsInvitedBaseDiscount();
         $totalDiscountAmount = $order->getRewardpointsInvitedDiscount();
         foreach ($order->getInvoiceCollection() as $existedInvoice) {
             $baseTotalDiscountAmount -= $existedInvoice->getRewardpointsInvitedBaseDiscount();
             $totalDiscountAmount -= $existedInvoice->getRewardpointsInvitedDiscount();
         }
     } else {
         foreach ($invoice->getAllItems() as $item) {
             $orderItem = $item->getOrderItem();
             if ($orderItem->isDummy()) {
                 continue;
             }
             $orderItemDiscount = (double) $orderItem->getRewardpointsInvitedDiscount();
             $baseOrderItemDiscount = (double) $orderItem->getRewardpointsInvitedBaseDiscount();
             $orderItemQty = $orderItem->getQtyOrdered();
             if ($orderItemDiscount && $orderItemQty) {
                 $discount = $invoice->roundPrice($orderItemDiscount / $orderItemQty * $item->getQty(), 'regular', true);
                 $baseDiscount = $invoice->roundPrice($baseOrderItemDiscount / $orderItemQty * $item->getQty(), 'base', true);
                 $item->setRewardpointsInvitedDiscount($discount);
                 $item->setRewardpointsInvitedBaseDiscount($baseDiscount);
                 $totalDiscountAmount += $discount;
                 $baseTotalDiscountAmount += $baseDiscount;
             }
         }
     }
     $invoice->setRewardpointsInvitedDiscount($totalDiscountAmount);
     $invoice->setRewardpointsInvitedBaseDiscount($baseTotalDiscountAmount);
     $invoice->setGrandTotal($invoice->getGrandTotal() - $totalDiscountAmount);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() - $baseTotalDiscountAmount);
     return $this;
 }
开发者ID:sshegde123,项目名称:wmp8,代码行数:42,代码来源:Earning.php


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