View Categories

Foreign currency support

1 min read

Accept foreign currency payments
1. In payment.receipt.tabs, add below lines

payment.addPayment("INR", "payment.icon.cash", "currency");
payment.addPayment("AED", "payment.icon.cash", "currency");

2. Create a new text resource “payment.currency” and add below lines. Here currency.setRate() sets the conversion rate. Please remember to change the conversion rate regularly. In currency.addButton(), the first value is the currency name, which should be kept same as given in currency.setRate(). The second value, “voucher.0”, is the image resource for the denomination, and the third value is the denomination.

currency.setRate("INR", 17.80);
currency.addButton("INR", "voucher.0", 1000.0);
currency.addButton("INR", "voucher.0", 500.0);
currency.addButton("INR", "voucher.0", 100.0);
currency.addButton("INR", "voucher.0", 50.0);
currency.addButton("INR", "voucher.0", 20.0);
currency.addButton("INR", "voucher.0", 10.0);
currency.addButton("INR", "voucher.0", 5.0);
currency.addButton("INR", "voucher.0", 2.0);

currency.setRate("AED", 0.104709);
currency.addButton("AED", "voucher.1", 100.0);
currency.addButton("AED", "voucher.1", 50.0);
currency.addButton("AED", "voucher.1", 10.0);
currency.addButton("AED", "voucher.1", 5.0);
currency.addButton("AED", "voucher.1", 1.0);
currency.addButton("AED", "voucher.1", 0.5);
currency.addButton("AED", "voucher.1", 0.25);
currency.addButton("AED", "voucher.1", 0.1);

3. In Printer.Ticket, add the below lines after the line “#foreach ($paymentline in $ticket.payments)”

#if ($paymentline.name == "currency")
        <line>
            <text bold="true">Currency - ${paymentline.printCurrency()}</text>
        </line>
        <line>
             <text align="left" length="12">Tendered:</text>
             <text align ="right" length="36">${paymentline.printCurrency()}${paymentline.printPaidCurrency()}</text>
         </line>
         <line>
             <text align="left" length="15">Conversion Rate:</text>
             <text align ="right" length="33">${paymentline.printRate()}</text>
         </line>
        <line>
            <text align="left" length="12">Change:</text>
            <text align ="right" length="36">${paymentline.printChange()}</text>
        </line>
#end

4. Add below template in close cash reports

<!-- CURRENCY REPORT -->
        <line>
            <text bold="true">Currency Report</text>
        </line>
        <line></line>
        <line>
            <text length="10">Currency</text>
            <text align="right" length="8">Rate</text>
            <text align="right" length="15">Total</text>
            <text align="right" length="15">Given</text>
        </line>
        <line>
            <text>------------------------------------------------</text>
        </line>
        #foreach ($line in $payments.getSalesByCurrency())
        <line>
            <text length="10">${line.printCurrencyName()}</text>
            <text align="right" length="8">${line.printCurrencyRate()}</text>
            <text align="right" length="15">${line.printCurrencyTotal()}</text>
            <text align="right" length="15">${line.printCurrencyGiven()}</text>
        </line>
        #end
        <line>
            <text>------------------------------------------------</text>
        </line>
        <line></line>
<!-- CURRENCY REPORT END -->

Save & restart

0 Comments

Leave a Reply

Arrow-up