Openbravo Forum End of Life Notice

Dear Openbravo Forum User,

Because of continued very low usage we decided to stop the forums on 31st of August 2017

In case of questions: webmaster "at" openbravo.com

Kitchen - Bar - Saladbar printing, finished & works perfect!

<<

Manos Zahariadis

Posts: 5

Joined: Fri Oct 12, 2012 5:31 am

Post Mon Nov 12, 2012 8:41 pm

Kitchen - Bar - Saladbar printing, finished & works perfect!

I'm very proud of this cause it's my first time I envole scripting :lol: :lol: hahaha!
so, a great thanks to Ronny G 4 his great guid! in that bace i just added the "Saladbar" printer!!!

sto the steps are similar with http://wiki.openbravo.com/wiki/POS_-_Kitchen%5CBar_Printing:
using Openbravo pos 2.30.2
step 1

is by adding the code in the "preferences" Tab of your products. e.g.

# Kitchen
  Code:
UPDATE products SET Attributes = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> 
<properties> 
<entry key="printkb">Kitchen</entry>
<entry key="sendstatus">No</entry>
</properties>' where REFERENCE <2000 ;


# Bar
  Code:
UPDATE products SET Attributes = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> 
<properties> 
<entry key="printkb">Bar</entry>
<entry key="sendstatus">No</entry>
</properties>' where REFERENCE < 4000 ;


# SaladBar
  Code:
UPDATE products SET Attributes = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> 
<properties> 
<entry key="printkb">Saladbar</entry>
<entry key="sendstatus">No</entry>
</properties>' where REFERENCE < 2000 ;



follow the same steps as Ronny's gude & in
step 6) Add the Script SendOrder

Create a text resource called Script.SendOrder. Add the following script to it:
  Code:
// Print an order ticket to the Kitchen Saladbar & Bar\Dessert 

boolean kitchen = false;
boolean bar = false;
boolean saladbar = false;
boolean change_kitchen = false;
boolean change_bar = false;
boolean change_saladbar = false;

for(int i= 0; i < ticket.getLinesCount(); i++){ 
line = ticket.getLine(i);

// Set Discount(printkb=NULL) to N/A so it does not error on next section.
if (line.getProperty("printkb") == null){
line.setProperty("printkb", "N/A");
}
if (line.getProperty("sendstatus") == null){
line.setProperty("sendstatus", "No");
}

if((line.getProperty("printkb").equals("Kitchen")) && (line.getProperty("sendstatus").equals("No"))){
kitchen = true; //There is something to print to kitchen
}else if ((line.getProperty("printkb").equals("Bar")) && (line.getProperty("sendstatus").equals("No"))){
bar = true; //There is something to print to bar
}else if ((line.getProperty("printkb").equals("SaladBar")) && (line.getProperty("sendstatus").equals("No"))){
saladbar = true; //There is something to print to saladbar
}else if ((line.getProperty("printkb").equals("Kitchen")) && (line.getProperty("sendstatus").equals("Cancel"))){
change_kitchen = true; //There is something to change for kitchen
}else if ((line.getProperty("printkb").equals("Bar")) && (line.getProperty("sendstatus").equals("Cancel"))){
change_bar = true; //There is something to change for bar
}else if ((line.getProperty("printkb").equals("SaladBar")) && (line.getProperty("sendstatus").equals("Cancel"))){
change_saladbar = true; //There is something to change for saladbar
}


if ((change_kitchen && kitchen) || (change_kitchen && !kitchen)) {
sales.printTicket("Printer.TicketChange_Kitchen"); //Print changed kitchen items to kitchen printer
}
if ((change_bar && bar) || (change_bar && !bar)) {
sales.printTicket("Printer.TicketChange_Bar"); //Print changed bar items to bar printer
}
if ((change_saladbar && saladbar) || (change_saladbar && !saladbar)) {
sales.printTicket("Printer.TicketChange_SaladBar"); //Print changed saladbar items to saladbar printer
}
if (kitchen && !change_kitchen) {
sales.printTicket("Printer.TicketKitchen"); //Print kitchen items to kitchen printer
}
if (bar && !change_bar) {
sales.printTicket("Printer.TicketBar"); //Print bar items to bar printer
}
if (saladbar && !change_saladbar) {
sales.printTicket("Printer.TicketSaladBar"); //Print saladbar items to saladbar printer
}

//Show a nice message for confirmation
if (kitchen && bar && saladbar){
javax.swing.JOptionPane.showMessageDialog(null, "Στάλθηκε σε Κουζίνα, SaladBar & Bar."); 
} else if (kitchen && !bar && !saladbar){
javax.swing.JOptionPane.showMessageDialog(null, "Στάλθηκε ΜΟΝΟ στη Κουζίνα."); 
} else if (!kitchen && bar && !saladbar){
javax.swing.JOptionPane.showMessageDialog(null, "Στάλθηκε ΜΟΝΟ στο Bar."); 
} else if (!kitchen && !bar && saladbar){
javax.swing.JOptionPane.showMessageDialog(null, "Στάλθηκε ΜΟΝΟ στο SaladBar.");
} else if (change_kitchen || change_bar || change_Saladbar){
javax.swing.JOptionPane.showMessageDialog(null, "Οι ακυρώσεις Στάλθηκαν."); 
} else {
javax.swing.JOptionPane.showMessageDialog(null, "Τίποτα νέο να σταλεί.", "Print Warning", JOptionPane.WARNING_MESSAGE);
}

//Set printkb property of item to Yes so it is not printed again
for(int i = ticket.getLinesCount()-1; i>= 0 ; i--){ 

line = ticket.getLine(i);
String a = line.getProperty("sendstatus");
String b = "Cancel";

if(((line.getProperty("printkb").equals("Kitchen")) || (line.getProperty("printkb").equals("Bar")) || (line.getProperty("printkb").equals("SaladBar"))) && (line.getProperty("sendstatus").equals("No"))){
line.setProperty("sendstatus", "Yes");
}

//Remove cancelled lines
if (a.equals(b)) {   
ticket.removeLine(i);
}
}


follow the same (missing from here) steps from Ronny's guide

11) Create the Kitchen, Saladbar and Bar Printer Tickets

Create four text resources for tickets called Printer.TicketKitchen, Printer.TicketSaladbar & Printer.TicketBar, Printer.TicketChange_Kitchen, Printer.TicketSaladbar & Printer.TicketChange_Bar.

Add the following to the Printer.TicketKitchen, Printer.TicketSaladbar & Printer.TicketBar though replace the word Kitchen with Bar or Saladbar in the Printer.TicketBar & TicketSaladbar resource.
  Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- 
Openbravo POS is a point of sales application designed for touch screens.
Copyright (C) 2008 Openbravo, S.L.U.
http://sourceforge.net/projects/openbravopos
 
This program 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 2 of the License, or
(at your option) any later version.
 
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
<output>

<display>
<line>
<text align="left" length="10">Order sent to Kitchen</text>
<text align="right" length="10">${ticket.printTotal()}</text>
</line>
<line>
<text align="center" length="20">Thank you.</text>
</line>
</display>

<ticket printer = "2">
<line></line>
<line></line>
<line>
<text align="center" length="42">Kitchen Order</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">Customer:</text>
<text>${ticket.getCustomer().getName()}</text>
</line> 
<line>
<text align="left" length="15"></text>
<text>${ticket.getCustomer().getTaxid()}</text>
</line> 
#end

#if ($place != "")
<line>
<text align="left" length="15">Table:</text>
<text>${place}</text>
</line> 
#end
<line></line> 
<line>
<text align ="left" length="17">Item</text>
<text align ="right" length="5"></text>
</line> 
<line>
<text>------------------------------------------</text>
</line> 
#foreach ($ticketline in $ticket.getLines()) 
#if (($ticketline.getProperty("printkb").equals("Kitchen")) && ($ticketline.getProperty("sendstatus").equals("No")))
<line>
<text align ="left" length="5" bold="true">${ticketline.printMultiply()}x</text>
#if ($ticketline.isProductCom()) 
<text align ="left" length="37">--${ticketline.printName()}</text>
#else
<text align ="left" length="37" bold="true">${ticketline.printName()}</text>
#end
</line>
#end
<!-- Add the following lines only for 2.30 Attributes -->
#if ($ticketline.productAttSetInstId)
<line>
<text align ="left" length="42">    ${ticketline.productAttSetInstDesc}</text>
</line>
#end
<!-- Add the previous lines only for 2.30 Attributes -->
#end 
<line>
<text>------------------------------------------</text>
</line> 
<line>
<text align="left" length="15">Cashier:</text>
<text>${ticket.printUser()}</text>
</line> 
</ticket>
</output>


Add the following to the Printer.TicketChange_Kitchen, Printer.TicketChange_Saladbar & Printer.TicketChange_Bar though replace the word Kitchen with Bar Or Saladbar in the Printer.TicketChange_Bar & Printer.TicketChange_Saladbar resource.
  Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- 
Openbravo POS is a point of sales application designed for touch screens.
Copyright (C) 2008 Openbravo, S.L.U.
http://sourceforge.net/projects/openbravopos
 
This program 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 2 of the License, or
(at your option) any later version.
 
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
Ticket for changing a Sent Kitchen Order
-->
<output>

<display>
<line>
<text align="left" length="10">Change Sent</text>
<text align="right" length="10">${ticket.printTotal()}</text>
</line>
<line>
<text align="center" length="20">Thank you.</text>
</line>
</display>

<ticket printer = "2">
<line></line>
<line></line>
<line size="1">
<text align="center" length="42" bold="true">Changed Kitchen Items</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">Customer:</text>
<text>${ticket.getCustomer().getName()}</text>
</line> 
<line>
<text align="left" length="15"></text>
<text>${ticket.getCustomer().getTaxid()}</text>
</line> 
#end

#if ($place != "")
<line>
<text align="left" length="15">Table:</text>
<text>${place}</text>
</line> 
#end
<line></line> 
<line>
<text align ="left" length="17">Item</text>
<text align ="right" length="5"></text>
</line> 
<line>
<text>------------------------------------------</text>
</line> 
#foreach ($ticketline in $ticket.getLines()) 
#if (($ticketline.getProperty("printkb").equals("Kitchen") && $ticketline.getProperty("sendstatus").equals("Cancel"))||($ticketline.getProperty("printkb").equals("Kitchen") && $ticketline.getProperty("sendstatus").equals("No")))
<line>
#if ($ticketline.getProperty("sendstatus").equals("No"))
<text align ="left" length="7" bold="true">Add</text>
#else
<text align ="left" length="7" bold="true">${ticketline.getProperty("sendstatus")}</text>
#end
<text align ="left" length="5" bold="true">${ticketline.printMultiply()}x</text>
#if ($ticketline.isProductCom()) 
<text align ="left" length="30">--${ticketline.printName()}</text>
#else
<text align ="left" length="30" bold="true">${ticketline.printName()}</text>
#end
</line>
<!-- Add the following lines only for 2.30 Attributes -->
#if ($ticketline.productAttSetInstId)
<line>
<text align ="left" length="42">    ${ticketline.productAttSetInstDesc}</text>
</line>
#end
<!-- Add the previous lines only for 2.30 Attributes -->
#end
#end 
<line>
<text>------------------------------------------</text>
</line> 
</ticket>
</output>


as we see we can add as many different tickets we want in 3 printers of Openbravo pos!
that's it! cheers from Greece buddies!
<<

Manos Zahariadis

Posts: 5

Joined: Fri Oct 12, 2012 5:31 am

Post Mon Nov 12, 2012 8:49 pm

Re: Kitchen - Bar - Saladbar printing, finished & works perfect!

the main idea was, if for kichen we have
REFERENCE >= 2000 and

bar
REFERENCE < 2000

why don't we use Kitchen reference >= 4000 to give us an empty space between 2001-3999 used as saladbar (that is not tested, i posted thatone that works!!!)
<<

Manos Zahariadis

Posts: 5

Joined: Fri Oct 12, 2012 5:31 am

Post Mon Nov 12, 2012 8:58 pm

Re: Kitchen - Bar - Saladbar printing, finished & works perfect!

the only point that I have 2 sove is the attributes!
e.g.
in kitcken printer i have:

---------
1 x Burger
extra sause
----------


in Saladbar:
--------
1 X Salad
extra cheese
--------


& in Bar
-----------
1 X Cola
Not cold
---------


and All the attributes are printed to All tickets

eg

kitchen oder
---------
Not cold
extra cheese
1 x Burger
extra sause
----------

the same happens with Saladbar & Bar ticket..
is there any help 4 this?

Return to Questions

Who is online

Users browsing this forum: No registered users and 1 guest

Website Terms


Designed by ST Software for PTF.