/** * Gets the total cost of all items in the invoice, using getTotal() on each Item, * then adds tax via Invoice->getTaxRate(). * * @var Invoice Invoice to total. * * @return float Total cost of the invoice. */ public function getTotal(Invoice $oInvoice) { $fTotal = 0.0; $aItems = $oInvoice->getItems(); foreach ($aItems as $iKey => $oItem) { $fTotal += $oItem->getTotal(); } return $fTotal * (1.0 + $oInvoice->getTaxRate()); }