* [ 1639249 ] Complete the POS implementation

- Now can print and complete a order

Pending:
- Cash drawer and receipt printer support, to consolidate with Posterita code.
- Multi payment type support, openXpertya code only support cash payment type.
Again, to consolidate with Posterita work.
- Cash drawer movement, some openXpertya customization to be ported over.
This commit is contained in:
Heng Sin Low 2007-02-25 08:44:45 +00:00
parent dbd6a623b3
commit b7efaec6c8
1 changed files with 29 additions and 10 deletions

View File

@ -25,6 +25,8 @@ import javax.swing.border.TitledBorder;
import org.compiere.swing.*; import org.compiere.swing.*;
import org.compiere.grid.ed.VNumber; import org.compiere.grid.ed.VNumber;
import org.compiere.model.MOrder; import org.compiere.model.MOrder;
import org.compiere.print.ReportCtl;
import org.compiere.print.ReportEngine;
import org.compiere.process.*; import org.compiere.process.*;
import org.compiere.util.*; import org.compiere.util.*;
@ -148,7 +150,7 @@ public class SubCheckout extends PosSubPanel implements ActionListener
add(caja,gbc); add(caja,gbc);
caja.setPreferredSize(new Dimension(30,30)); caja.setPreferredSize(new Dimension(30,30));
f_cashRegisterFunctions = createButtonAction("CashRegisterFunction", null); f_cashRegisterFunctions = createButtonAction("CashRegisterFunction", null);
f_cashRegisterFunctions.setText("Cash Register\n Movements"); f_cashRegisterFunctions.setText("Cash Drawer\n Movements");
f_cashRegisterFunctions.setPreferredSize(new Dimension(160,30)); f_cashRegisterFunctions.setPreferredSize(new Dimension(160,30));
f_cashRegisterFunctions.setMaximumSize(new Dimension(160,30)); f_cashRegisterFunctions.setMaximumSize(new Dimension(160,30));
f_cashRegisterFunctions.setMinimumSize(new Dimension(160,30)); f_cashRegisterFunctions.setMinimumSize(new Dimension(160,30));
@ -244,27 +246,35 @@ public class SubCheckout extends PosSubPanel implements ActionListener
else else
if (action.equals("Summary")) if (action.equals("Summary"))
{ {
//TODO: new field added by openxpertya to c_order displaySummary();
//p_posPanel.f_status.setStatusLine(p_posPanel.f_curLine.getOrder().getResumen());
displayReturn();
} }
else if (action.equals("Process")) else if (action.equals("Process"))
{ {
if (isOrderFullyPay()) if (isOrderFullyPay())
{ {
displaySummary();
printTicket(); printTicket();
processOrder(); processOrder();
openCashDrawer(); openCashDrawer();
} }
else
{
p_posPanel.f_status.setStatusLine("Order not fully pay.");
}
} }
// Print // Print
else if (action.equals("Print")) else if (action.equals("Print"))
{ {
if (isOrderFullyPay()) if (isOrderFullyPay())
{ {
displaySummary();
printTicket(); printTicket();
openCashDrawer(); openCashDrawer();
} }
else
{
p_posPanel.f_status.setStatusLine("Order not fully pay.");
}
} }
// Cash (Payment) // Cash (Payment)
else if (action.equals("Cash")) else if (action.equals("Cash"))
@ -285,10 +295,14 @@ public class SubCheckout extends PosSubPanel implements ActionListener
Log.print("CreditCard"); Log.print("CreditCard");
} fin del comentario para la Credit Card*/ } fin del comentario para la Credit Card*/
f_cashGiven.setValue(Env.ZERO);
p_posPanel.updateInfo(); p_posPanel.updateInfo();
} // actionPerformed } // actionPerformed
private void displaySummary() {
p_posPanel.f_status.setStatusLine(p_posPanel.f_curLine.getOrder().getSummary());
displayReturn();
}
/** /**
* Process Order * Process Order
* @author Comunidad de Desarrollo OpenXpertya * @author Comunidad de Desarrollo OpenXpertya
@ -298,6 +312,7 @@ public class SubCheckout extends PosSubPanel implements ActionListener
public void processOrder() public void processOrder()
{ {
p_posPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
MOrder order = p_posPanel.f_curLine.getOrder(); MOrder order = p_posPanel.f_curLine.getOrder();
if (order != null) if (order != null)
if (order.getDocStatus().equals("DR")) if (order.getDocStatus().equals("DR"))
@ -308,7 +323,9 @@ public class SubCheckout extends PosSubPanel implements ActionListener
order = null; order = null;
p_posPanel.newOrder(); p_posPanel.newOrder();
f_cashGiven.setValue(Env.ZERO);
} }
p_posPanel.setCursor(Cursor.getDefaultCursor());
} }
/** /**
@ -320,18 +337,20 @@ public class SubCheckout extends PosSubPanel implements ActionListener
public void printTicket() public void printTicket()
{ {
MOrder order = p_posPanel.f_curLine.getOrder(); MOrder order = p_posPanel.f_curLine.getOrder();
int ventana = p_posPanel.getWindowNo(); //int windowNo = p_posPanel.getWindowNo();
Properties m_ctx = p_posPanel.getPropiedades(); //Properties m_ctx = p_posPanel.getPropiedades();
if (order != null) if (order != null)
{ {
try try
{ {
//TODO: to incorporate jpos work from Posterita //TODO: to incorporate work from Posterita
/* /*
if (p_pos.getAD_PrintLabel_ID() != 0) if (p_pos.getAD_PrintLabel_ID() != 0)
PrintLabel.printLabelTicket(order.getC_Order_ID(), p_pos.getAD_PrintLabel_ID()); PrintLabel.printLabelTicket(order.getC_Order_ID(), p_pos.getAD_PrintLabel_ID());
*/ */
//print standard document
ReportCtl.startDocumentPrint(ReportEngine.ORDER, order.getC_Order_ID(), true);
} }
catch (Exception e) catch (Exception e)
{ {
@ -395,7 +414,7 @@ public class SubCheckout extends PosSubPanel implements ActionListener
public void openCashDrawer() public void openCashDrawer()
{ {
String puerto = null; String puerto = null;
//TODO - to incorporate jpos work from Posterita //TODO - to incorporate work from Posterita
/* /*
try try
{ {