<?xml version="1.0" encoding="UTF-8"?>
<!-- 
    uniCenta oPOS - Touch friendly Point Of Sale
    Copyright (c) 2009-2018 uniCenta.
    http://sourceforge.net/projects/unicentaopos

    This file is part of uniCenta oPOS.

    uniCenta oPOS is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    uniCenta oPOS is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty or
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with uniCenta oPOS.
  If not, see <http://www.gnu.org/licenses/>.

-->
<output>
    <display>
        <line>
            <text align="left" length="10">Total paid</text>
            <text align="right" length="10">${ticket.printTotalPaid()}</text>
        </line>
        <line>
            <text align="center" length="20">Thank You for your custom</text>
        </line>
    </display>
    <ticket>
        <image>Printer.Ticket.Logo</image>
        <line></line>
        <line>
            <text align="center" length="42">Printer.CustomerPaid</text>
        </line>
        <line>
            <text align="center" length="42">You can change this template</text>
        </line>
        <line>
            <text align="center" length="42">in the Resources panel</text>
        </line>
        <line></line>
        <line>
            <text align="left" length="15">Receipt:</text>
            <text>${ticket.printId()}</text>
        </line>
        <line>
            <text align="left" length="15">Date:</text>
            <text>${ticket.printDate()}</text>
        </line>
        
        #if ($ticket.getCustomer())
            <line>
                <text align="left" length="15">Account:</text>
                <text>${ticket.getCustomer().printTaxid()}</text>
            </line>
            <line>
                <text align="left" length="15">Customer:</text>
                <text>${ticket.getCustomer().printName()}</text>
            </line>

        #end

        <line></line>
        <line size="1">
            <text align ="left" length="32" bold="true">Total Paid</text>
            <text align ="right" length="10" bold="true">${ticket.printTotalPaid()}</text>
        </line>
        <line></line>
        <line>
            <text align ="left" length="32" bold="true">Account Balance</text>
            <text align ="right" length="10" bold="true">${customer.printCurDebt()}</text>
        </line>

    #foreach ($paymentline in $ticket.payments)
        #if ($paymentline.name == "cash")
            <line></line>
            <line>
                <text bold="true">Cash</text>
            </line>
            <line>
                <text align="left" length="22">Tendered:</text>
                <text align ="right" length="20">${paymentline.printPaid()}</text>
            </line>
            <line>
                <text align="left" length="22">Change:</text>
                <text align ="right" length="20">${paymentline.printChange()}</text>
            </line>
        #end

        #if ($paymentline.name == "ccard")
            <line></line>
            <line>
                <text bold="true">Mag card</text>
            </line>
            <line>
            <text align ="right" length="42">${paymentline.printTotal()}</text>
            </line>
            <line>
                <text align ="left" length="22">Number:</text>
                <text>${paymentline.printCardNumber()}</text>
            </line>
            <line>
                <text align ="left" length="22">Expiry Date:</text>
                <text>${paymentline.printExpirationDate()}</text>
            </line>
            <line>
                <text align ="left" length="22">Operation:</text>
                <text>${paymentline.printTransactionID()}</text>
            </line>
            <line>
                <text align ="left" length="22">Authorization:</text>
                <text>${paymentline.printAuthorization()}</text>
            </line>
        #end

        #if ($paymentline.name == "cheque")
            <line></line>
            <line>
                <text bold="true">Cheque</text>
            </line>
            <line>
                <text align ="right" length="42">${paymentline.printTotal()}</text>
            </line>
        #end

        #if ($paymentline.name == "voucherin")
            <line></line>
            <line>
                <text bold="true">Voucher</text>
            </line>
            <line>
                <text align ="right" length="42">${paymentline.printTotal()}</text>
            </line>
        #end
    #end
       <line></line>
        <line>
            <text align="left" length="15">Cashier:</text>
            <text>${ticket.printUser()}</text>
        </line>
        <line></line>
        <line>
            <text align="center" length="42">Thank You for your custom</text>
        </line>
    </ticket>

    #foreach ($paymentline in $ticket.payments)
        #if ($paymentline.name == "cash")
            <opendrawer/>
        #end
    
        #if ($paymentline.name == "cashrefund")
            <opendrawer/>
        #end
    #end
</output>