[2093355 ] Small bugs in OpenXpertya POS
merging to branches/stable as requested by Pirate King who loves burnt chickens.
This commit is contained in:
parent
7e1d0fe0c1
commit
fd1290c921
|
@ -309,22 +309,53 @@ public class SubCheckout extends PosSubPanel implements ActionListener
|
|||
*/
|
||||
public void processOrder()
|
||||
{
|
||||
|
||||
p_posPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
MOrder order = p_posPanel.f_curLine.getOrder();
|
||||
if (order != null)
|
||||
if (order.getDocStatus().equals("DR"))
|
||||
// check if order completed OK
|
||||
if (order.getDocStatus().equals("DR") )
|
||||
{
|
||||
order.setDocAction(DocAction.ACTION_Complete);
|
||||
order.processIt(DocAction.ACTION_Complete);
|
||||
order.save();
|
||||
|
||||
order = null;
|
||||
p_posPanel.newOrder();
|
||||
f_cashGiven.setValue(Env.ZERO);
|
||||
try
|
||||
{
|
||||
if (order.processIt(DocAction.ACTION_Complete) )
|
||||
{
|
||||
order.save();
|
||||
}
|
||||
else
|
||||
{
|
||||
log.info( "SubCheckout - processOrder FAILED");
|
||||
p_posPanel.f_status.setStatusLine("Order can not be completed.");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.severe("Order can not be completed - " + e.getMessage());
|
||||
p_posPanel.f_status.setStatusLine("Error when processing order.");
|
||||
}
|
||||
finally
|
||||
{ // When order failed convert it back to draft so it can be processed
|
||||
if( order.getDocStatus().equals("IN") )
|
||||
{
|
||||
order.setDocStatus("DR");
|
||||
}
|
||||
else if( order.getDocStatus().equals("CO") )
|
||||
{
|
||||
order = null;
|
||||
p_posPanel.newOrder();
|
||||
f_cashGiven.setValue(Env.ZERO);
|
||||
log.info( "SubCheckout - processOrder OK");
|
||||
p_posPanel.f_status.setStatusLine("Order completed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
log.info( "SubCheckout - processOrder - unrecognized DocStatus");
|
||||
p_posPanel.f_status.setStatusLine("Orden was not completed correctly.");
|
||||
}
|
||||
} // try-finally
|
||||
}
|
||||
p_posPanel.setCursor(Cursor.getDefaultCursor());
|
||||
}
|
||||
} // processOrder
|
||||
|
||||
/**
|
||||
* Print Ticket
|
||||
|
@ -373,8 +404,8 @@ public class SubCheckout extends PosSubPanel implements ActionListener
|
|||
BigDecimal total = new BigDecimal(0);
|
||||
if (order != null)
|
||||
total = order.getGrandTotal();
|
||||
double vuelta = given.doubleValue() - total.doubleValue();
|
||||
f_cashReturn.setValue(new BigDecimal(vuelta));
|
||||
double cashReturn = given.doubleValue() - total.doubleValue();
|
||||
f_cashReturn.setValue(new BigDecimal(cashReturn));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.compiere.util.*;
|
|||
* *Basado en Codigo Original Modificado, Revisado y Optimizado de:
|
||||
* *Copyright <EFBFBD> Jorg Janke
|
||||
* @version $Id: SubCurrentLine.java,v 1.3 2004/07/24 04:31:52 jjanke Exp $
|
||||
* red1 - [2093355 ] Small bugs in OpenXpertya POS
|
||||
*/
|
||||
public class SubCurrentLine extends PosSubPanel implements ActionListener {
|
||||
/**
|
||||
|
@ -227,9 +228,9 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
|
|||
*
|
||||
* @param qty
|
||||
*/
|
||||
public void setQty(BigDecimal price) {
|
||||
f_quantity.setValue(price);
|
||||
} // setPrice
|
||||
public void setQty(BigDecimal qty) {
|
||||
f_quantity.setValue(qty);
|
||||
} // setQty
|
||||
|
||||
/**
|
||||
* Get Qty
|
||||
|
@ -238,7 +239,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
|
|||
*/
|
||||
public BigDecimal getQty() {
|
||||
return (BigDecimal) f_quantity.getValue();
|
||||
} // getPrice
|
||||
} // getQty
|
||||
|
||||
/***************************************************************************
|
||||
* New Line
|
||||
|
@ -282,6 +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
|
||||
lineas[row].delete(true);
|
||||
for (int i = row; i < (numLineas - 1); i++)
|
||||
lineas[i] = lineas[i + 1];
|
||||
|
@ -437,31 +439,45 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
|
|||
if (!order.getDocStatus().equals("DR"))
|
||||
return null;
|
||||
//add new line or increase qty
|
||||
MOrderLine[] lineas = order.getLines();
|
||||
int numLineas = lineas.length;
|
||||
for (int i = 0; i < numLineas; i++)
|
||||
|
||||
// catch Exceptions at order.getLines()
|
||||
int numLineas = 0;
|
||||
MOrderLine[] lineas = null;
|
||||
try
|
||||
{
|
||||
if (lineas[i].getM_Product_ID() == product.getM_Product_ID())
|
||||
lineas = order.getLines();
|
||||
numLineas = lineas.length;
|
||||
for (int i = 0; i < numLineas; i++)
|
||||
{
|
||||
//increase qty
|
||||
double current = lineas[i].getQtyEntered().doubleValue();
|
||||
double toadd = QtyOrdered.doubleValue();
|
||||
double total = current + toadd;
|
||||
lineas[i].setQty(new BigDecimal(total));
|
||||
lineas[i].setPrice(); // sets List/limit
|
||||
lineas[i].save();
|
||||
return lineas[i];
|
||||
if (lineas[i].getM_Product_ID() == product.getM_Product_ID())
|
||||
{
|
||||
//increase qty
|
||||
double current = lineas[i].getQtyEntered().doubleValue();
|
||||
double toadd = QtyOrdered.doubleValue();
|
||||
double total = current + toadd;
|
||||
lineas[i].setQty(new BigDecimal(total));
|
||||
lineas[i].setPrice(); // sets List/limit
|
||||
lineas[i].save();
|
||||
return lineas[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
//create new line
|
||||
catch (Exception e)
|
||||
{
|
||||
log.severe("Order lines cannot be created - " + e.getMessage());
|
||||
}
|
||||
|
||||
//create new line
|
||||
MOrderLine line = new MOrderLine(order);
|
||||
line.setProduct(product);
|
||||
line.setQty(QtyOrdered);
|
||||
|
||||
line.setPrice(); // sets List/limit
|
||||
line.setPrice(PriceActual);
|
||||
line.save();
|
||||
return line;
|
||||
} // getLine
|
||||
|
||||
} // createLine
|
||||
|
||||
/**
|
||||
* @param m_c_order_id
|
||||
|
|
|
@ -65,8 +65,8 @@ public class SubFunctionKeys extends PosSubPanel implements ActionListener
|
|||
if (fKeys.get_ID() == 0)
|
||||
return;
|
||||
|
||||
int COLUMNS = 3; // Min Columns
|
||||
int ROWS = 6; // Min Rows
|
||||
int COLUMNS = 4; // Min Columns
|
||||
int ROWS = 5; // Min Rows
|
||||
m_keys = fKeys.getKeys(false);
|
||||
int noKeys = m_keys.length;
|
||||
int rows = Math.max (((noKeys-1) / COLUMNS) + 1, ROWS);
|
||||
|
@ -106,7 +106,7 @@ public class SubFunctionKeys extends PosSubPanel implements ActionListener
|
|||
button.setFocusable(false);
|
||||
content.add (button);
|
||||
}
|
||||
content.setPreferredSize(new Dimension(cols*70, rows*50));
|
||||
content.setPreferredSize(new Dimension(cols*150, rows*50));
|
||||
add (content);
|
||||
} // init
|
||||
|
||||
|
|
|
@ -214,6 +214,7 @@ public class SubLines extends PosSubPanel implements ActionListener
|
|||
if (row < 0)
|
||||
row = 0;
|
||||
m_table.getSelectionModel().setSelectionInterval(row, row);
|
||||
return;
|
||||
}
|
||||
else if ("Next".equalsIgnoreCase(e.getActionCommand()))
|
||||
{
|
||||
|
@ -225,6 +226,7 @@ public class SubLines extends PosSubPanel implements ActionListener
|
|||
if (row >= rows)
|
||||
row = rows - 1;
|
||||
m_table.getSelectionModel().setSelectionInterval(row, row);
|
||||
return;
|
||||
}
|
||||
// Delete
|
||||
else if (action.equals("Delete"))
|
||||
|
|
Loading…
Reference in New Issue