From e194ec81729e4bd5eb68a74951bc299cd078b028 Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Tue, 2 Dec 2008 16:52:18 +0000 Subject: [PATCH] [2093355 ] Small bugs in OpenXpertya POS SOLVED AS EXPLAINED.. some cosmetics next... 1) Java POS can start a new order while not completed present orders! <-- killer stuff. Can jump to any Order by choice. 2) Java POS do not commit illegal action such as reversing Reserved Qty without Model action. 3) Can delete Drafted non reserved OrderLines. Cannot delete when completed. --- client/src/org/compiere/pos/QueryTicket.java | 6 ++++-- client/src/org/compiere/pos/SubBPartner.java | 2 +- client/src/org/compiere/pos/SubCheckout.java | 4 ++-- client/src/org/compiere/pos/SubCurrentLine.java | 11 +++++++++-- client/src/org/compiere/pos/SubLines.java | 15 ++++++++++----- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/client/src/org/compiere/pos/QueryTicket.java b/client/src/org/compiere/pos/QueryTicket.java index 00b41a9e02..1d9165f6d5 100644 --- a/client/src/org/compiere/pos/QueryTicket.java +++ b/client/src/org/compiere/pos/QueryTicket.java @@ -274,7 +274,7 @@ public class QueryTicket extends PosSubPanel sql += " AND o.C_Order_ID = " + id; if (doc != null && !doc.equalsIgnoreCase("")) sql += " AND o.DocumentNo = '" + doc + "'"; - sql += " AND o.DateOrdered = ?"; + sql += " AND o.DateOrdered = ? Order By o.DocumentNo"; PreparedStatement pstm = DB.prepareStatement(sql, null); pstm.setTimestamp(1, date); @@ -348,7 +348,9 @@ public class QueryTicket extends PosSubPanel if (m_c_order_id > 0) { - p_posPanel.f_curLine.setOldOrder(m_c_order_id); + p_posPanel.f_curLine.setOrder(m_c_order_id); + p_posPanel.updateInfo(); + } p_posPanel.closeQuery(this); } // close diff --git a/client/src/org/compiere/pos/SubBPartner.java b/client/src/org/compiere/pos/SubBPartner.java index 482b1548db..11efa1258f 100644 --- a/client/src/org/compiere/pos/SubBPartner.java +++ b/client/src/org/compiere/pos/SubBPartner.java @@ -153,7 +153,7 @@ public class SubBPartner extends PosSubPanel log.info( "PosSubCustomer - actionPerformed: " + action); // New if (action.equals("New")) - setC_BPartner_ID(0); + p_posPanel.newOrder(); //red1 New POS Order instead - B_Partner already has direct field // Edit else if (action.equals("Edit")) { diff --git a/client/src/org/compiere/pos/SubCheckout.java b/client/src/org/compiere/pos/SubCheckout.java index 1040103d6b..bd379099ff 100644 --- a/client/src/org/compiere/pos/SubCheckout.java +++ b/client/src/org/compiere/pos/SubCheckout.java @@ -251,7 +251,7 @@ public class SubCheckout extends PosSubPanel implements ActionListener } else { - p_posPanel.f_status.setStatusLine("Order not fully pay."); + p_posPanel.f_status.setStatusLine("PAYMENT NOT FULL."); } } // Print @@ -396,7 +396,7 @@ public class SubCheckout extends PosSubPanel implements ActionListener { MOrder order = p_posPanel.f_curLine.getOrder(); BigDecimal total = new BigDecimal(0); - if (order != null) + if (order != null && !order.getTotalLines().equals(Env.ZERO)) total = order.getGrandTotal(); double cashReturn = given.doubleValue() - total.doubleValue(); f_cashReturn.setValue(new BigDecimal(cashReturn)); diff --git a/client/src/org/compiere/pos/SubCurrentLine.java b/client/src/org/compiere/pos/SubCurrentLine.java index 84b6ad386c..4e8596a073 100644 --- a/client/src/org/compiere/pos/SubCurrentLine.java +++ b/client/src/org/compiere/pos/SubCurrentLine.java @@ -283,7 +283,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener { if (numLineas > row) { //delete line from order - lineas[row].setQtyReserved(Env.ZERO); //red1 - [2093355 ] Small bugs in OpenXpertya POS +//illegal! lineas[row].setQtyReserved(Env.ZERO); //red1 - [2093355 ] Small bugs in OpenXpertya POS lineas[row].delete(true); for (int i = row; i < (numLineas - 1); i++) lineas[i] = lineas[i + 1]; @@ -488,5 +488,12 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener { m_order = new MOrder(p_ctx , m_c_order_id, null); p_posPanel.updateInfo(); } - + + /** + * @param m_c_order_id + */ + public void setOrder(int m_c_order_id) + { + m_order = new MOrder(p_ctx , m_c_order_id, null); + } } // PosSubCurrentLine diff --git a/client/src/org/compiere/pos/SubLines.java b/client/src/org/compiere/pos/SubLines.java index 8e924ee294..057f760159 100644 --- a/client/src/org/compiere/pos/SubLines.java +++ b/client/src/org/compiere/pos/SubLines.java @@ -47,6 +47,7 @@ import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.model.Query; /** @@ -288,7 +289,7 @@ public class SubLines extends PosSubPanel implements ActionListener { int noLines = m_table.getRowCount(); p_posPanel.f_status.setStatusDB(noLines); - if (order == null) + if (order == null || noLines == 0) //red1 WORKAROUND (noLines == 0) means total and tax in order head is false. { f_net.setValue(Env.ZERO); f_total.setValue(Env.ZERO); @@ -296,10 +297,14 @@ public class SubLines extends PosSubPanel implements ActionListener } else { - order.prepareIt(); - f_net.setValue(order.getTotalLines()); - f_total.setValue(order.getGrandTotal()); - f_tax.setValue(order.getGrandTotal().subtract(order.getTotalLines())); +// order.prepareIt(); //red1 Avoid Reserving Inventory until final process and update context directly from DB. + p_posPanel.f_curLine.setOrder(order.getC_Order_ID()); + MOrder retValue = p_posPanel.f_curLine.getOrder(); + //red1 - end - + f_net.setValue(retValue.getTotalLines()); + f_total.setValue(retValue.getGrandTotal()); + f_tax.setValue(retValue.getGrandTotal().subtract(retValue.getTotalLines())); + } } // setSums } // PosSubAllLines