View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

POS - Print more customer details in receipts

Code snippet

Name: POS - Print more customer details in receipts
Version: POS/2.20 & 2.30 Beta
Author: Ronny G



This code snippet is intended to ask to the user for more details to be printed in the receipt. For example invoice details,customer details, like the phone or other details needed in your store.

This code has been copied from the Openbravo POS forum message by Ronny G.

Add something like the following to Ticket.Buttons resource.

<button key="button.print" name="button.print" image="img.print" code="Script.PrintBill"/> 

Create a text resource called Script.PrintBill and put this script:

myPlaceName = place; 
 
if (myPlaceName.equals("Prompt1_2")) { 
line = ticket.getLine(0);  
value = javax.swing.JOptionPane.showInputDialog("Enter your Prompt1", line.getProperty("Prompt1"));  
if (value != null) {  
// the user pressed OK  
line.setProperty("Prompt1", value);  
} 
value = javax.swing.JOptionPane.showInputDialog("Enter your Prompt2", line.getProperty("Prompt2"));  
if (value != null) {  
// the user pressed OK  
line.setProperty("Prompt2", value);  
} 
} else if (myPlaceName.equals("Prompt3")) { 
line = ticket.getLine(0);  
value = javax.swing.JOptionPane.showInputDialog("Enter Prompt3", line.getProperty("Prompt3"));  
if (value != null) {  
// the user pressed OK  
line.setProperty("Prompt3", value);  
} 
} else if (myPlaceName.equals("Prompt4")) { 
 
} 
 
sales.printTicket("Printer.TicketBill"); //Print Bill 

Now create a text resource called Printer.TicketBill and put the ticket template in it.

Directly after

#foreach ($ticketline in $ticket.getLines())  

put this code:

#if (($ticketline.getProperty("Prompt1", ""))!= "") 
<line>  
<text align ="left" length="30">Prompt1: ${ticketline.getProperty("Prompt1", "")}</text>  
</line>  
#end 
#if (($ticketline.getProperty("Prompt2", ""))!= "")  
<line>  
<text align ="left" length="30">Prompt2: ${ticketline.getProperty("Prompt2", "")}</text>  
</line>  
#end  
#if (($ticketline.getProperty("Prompt3", ""))!= "")  
<line>  
<text align ="left" length="30">Prompt3: ${ticketline.getProperty("Prompt3", "")}</text>  
</line>  
#end 

Retrieved from "http://wiki.openbravo.com/wiki/POS_-_Print_more_customer_details_in_receipts"

This page has been accessed 10,573 times. This page was last modified on 2 May 2009, at 07:33. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.