Public Member Functions | |
collect (Mage_Sales_Model_Order_Invoice $invoice) |
Definition at line 28 of file Subtotal.php.
collect | ( | Mage_Sales_Model_Order_Invoice $ | invoice | ) |
Collect invoice subtotal
Mage_Sales_Model_Order_Invoice | $invoice |
Reimplemented from Mage_Sales_Model_Order_Invoice_Total_Abstract.
Definition at line 36 of file Subtotal.php.
00037 { 00038 $subtotal = 0; 00039 $baseSubtotal = 0; 00040 00041 foreach ($invoice->getAllItems() as $item) { 00042 $item->calcRowTotal(); 00043 00044 if ($item->getOrderItem()->isDummy()) { 00045 continue; 00046 } 00047 00048 $subtotal+= $item->getRowTotal(); 00049 $baseSubtotal+= $item->getBaseRowTotal(); 00050 } 00051 00052 $invoice->setSubtotal($subtotal); 00053 $invoice->setBaseSubtotal($baseSubtotal); 00054 00055 $invoice->setGrandTotal($invoice->getGrandTotal() + $subtotal); 00056 $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseSubtotal); 00057 return $this; 00058 }