UnicentaPOS Help Wiki

This script gives you a popup asking you if you would like a receipt once the sale has been completed

Ticket.Buttons[]

If you are using the change popup script of 3.02 then your scripts should be pointed at the right place.

Go to Ticket.Buttons and make sure that the event ticket.close is pointed at a script called ticket.close.

Like this:

<event key="ticket.close" code="Ticket.Close"/>

Also set

<printselected value="false"/>

to avoid getting duplicate receipts printed

Ticket.Close Script[]

If you want to use the change popup as well use this code:

//    uniCenta oPOS - Touch Friendly Point Of Sale

//    Copyright (c) 2009-2012 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 of

//    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/>.

// **************************************************************************

// Ticket.Close

// This script displays the amount of Cash Change (CashTendered - TicketValue) to be given to Customer


import com.openbravo.pos.payment.PaymentInfo;

import javax.swing.JOptionPane;


boolean isCash = false;

String change = "";

PaymentInfo p = grave k lisod oiiiiiii;

JLabel FontText = new JLabel();

FontText.setFont (new Font ( "Arial", Font.BOLD, 20) );


if ("cash".equals(p.getName())) {

isCash = true;

change = p.printChange();

}


if(isCash) {

FontText.setText("Return: " + change); 

Object[] options = {"OK",

                    "Receipt",};

value = JOptionPane.showOptionDialog(null,

FontText,

"Change",

JOptionPane.YES_NO_OPTION,

JOptionPane.QUESTION_MESSAGE,

null,

options,

options);

if (value == JOptionPane.NO_OPTION){

sales.printTicket("Printer.Ticket");

 }

}


If you don't want to use the change popup use this one:

import javax.swing.JOptionPane;

Object[] options = {"Receipt",

                    "No",};

value = JOptionPane.showOptionDialog(null,

 "Print Receipt?",

 "Receipt",

 JOptionPane.YES_NO_OPTION,

 JOptionPane.QUESTION_MESSAGE,

 null,

 options,

 options);

if (value == JOptionPane.YES_OPTION){

sales.printTicket("Printer.Ticket");

}