I want to print total paid and total due in the invoice and shipment pdf in magento.
i can now able to print subtotal tax and grand total
please help me
So for the invoice pdf printing take a look at the model Mage_Sales_Model_Order_Pdf_Invoice
. This is the standard model invoice pdf creation and the "magic" happens during the function getPdf
.
But since you are only working with totals what you are actually interested in is the function insertTotals
. Yeah it is in its own function but is on the abstract model Mage_Sales_Model_Order_Pdf_Abstract
and not the Invoice level.
If you continue to dive down into the functions it will appear as if there is a function to load all the totals, which for you look hopeful. This function is Mage_Sales_Model_Order_Pdf_Abstract::_getTotalsList
what is interesting here is that if appears to load the totals from the config.xml.
$totals = Mage::getConfig()->getNode('global/pdf/totals')->asArray();
So it appears very possible to inject your own totals to be printed in the pdf, though you do have to be careful as to which totals will be shown as this by default happens on the global pdf level and I am not sure how it effects the pdf when the total is not set or if it is zero.