Mage_Weee_Model_Total_Invoice_Weee Class Reference

Inheritance diagram for Mage_Weee_Model_Total_Invoice_Weee:

Mage_Sales_Model_Order_Invoice_Total_Abstract

List of all members.

Public Member Functions

 collect (Mage_Sales_Model_Order_Invoice $invoice)


Detailed Description

Definition at line 28 of file Weee.php.


Member Function Documentation

collect ( Mage_Sales_Model_Order_Invoice invoice  ) 

Reimplemented from Mage_Sales_Model_Order_Invoice_Total_Abstract.

Definition at line 30 of file Weee.php.

00031     {
00032         $store = $invoice->getStore();
00033 
00034         $totalTax = 0;
00035         $baseTotalTax = 0;
00036 
00037         foreach ($invoice->getAllItems() as $item) {
00038             $orderItem = $item->getOrderItem();
00039             $orderItemQty = $orderItem->getQtyOrdered();
00040 
00041             if ($orderItemQty) {
00042                 if ($orderItem->isDummy()) {
00043                     continue;
00044                 }
00045 
00046                 $weeeTaxAmount = $item->getWeeeTaxAppliedAmount()*$item->getQty();
00047                 $baseWeeeTaxAmount = $item->getBaseWeeeTaxAppliedAmount()*$item->getQty();
00048 
00049                 $item->setWeeeTaxAppliedRowAmount($weeeTaxAmount);
00050                 $item->setBaseWeeeTaxAppliedRowAmount($baseWeeeTaxAmount);
00051                 $newApplied = array();
00052                 $applied = Mage::helper('weee')->getApplied($item);
00053                 foreach ($applied as $one) {
00054                     $one['base_row_amount'] = $one['base_amount']*$item->getQty();
00055                     $one['row_amount'] = $one['amount']*$item->getQty();
00056                     $one['base_row_amount_incl_tax'] = $one['base_amount_incl_tax']*$item->getQty();
00057                     $one['row_amount_incl_tax'] = $one['amount_incl_tax']*$item->getQty();
00058 
00059                     $newApplied[] = $one;
00060                 }
00061                 Mage::helper('weee')->setApplied($item, $newApplied);
00062 
00063                 $item->setWeeeTaxRowDisposition($item->getWeeeTaxDisposition()*$item->getQty());
00064                 $item->setBaseWeeeTaxRowDisposition($item->getBaseWeeeTaxDisposition()*$item->getQty());
00065 
00066                 $totalTax += $weeeTaxAmount;
00067                 $baseTotalTax += $baseWeeeTaxAmount;
00068             }
00069         }
00070         if (Mage::helper('weee')->includeInSubtotal($store)) {
00071             $invoice->setSubtotal($invoice->getSubtotal() + $totalTax);
00072             $invoice->setBaseSubtotal($invoice->getBaseSubtotal() + $baseTotalTax);
00073         } else {
00074             $invoice->setTaxAmount($invoice->getTaxAmount() + $totalTax);
00075             $invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $baseTotalTax);
00076         }
00077 
00078         $invoice->setGrandTotal($invoice->getGrandTotal() + $totalTax);
00079         $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalTax);
00080 
00081         return $this;
00082     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:56 2009 for Magento by  doxygen 1.5.8