Currency/Valuutta

Started by tpharaoh, 27.09.12 - klo:12:15

Previous topic - Next topic

tpharaoh

I am a Finnish company (foreign owner), with most customers in USA, I invoice them in dollars.  Am I able to set customer specific currency?  Or, invoice specific?

I don't mind coding myself the change if you give me pointers best place to start.

Ere Maijala

To begin with, MLInvoice does not currently handle multiple currencies. There's actually no currency specifier among the amount in products and invoice rows, and the only place where the currency is displayed is in the invoices. Thus, if you'd work with only dollars, it would be simple to override the strings in a local language file, but if you need multiple languages, there's some more work to do. In that case my first suggestion would be to still have a single currency in MLInvoice, but convert it when printing the invoice, as needed. This way you can still get proper reports, for instance. You would need a currency conversion table and an invoice printer class that uses it when it fetches the data from the invoice rows. Then there'd probably need to be a mechanism for updating the conversion table unless you're ok with doing it manually in the code. In the latter case you could even hard-code it.

Take a look at Print Templates at http://www.labs.fi/mlinvoice_usage.eng.php. It describes the basics of how to create your own print template. In this case you'd need to override the init method and modify $invoiceRows before passing them on to the parent::init(). Something like the attached version should get you started. Then create invoice_en-US.local.ini with the following content:

TotalIncludingVAT = 'Total Including VAT (USD)'
FormCurrency = 'USD'


If this doesn't cut it, please let me know more about your needs.

Regards,
Ere