[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
|
@ -308,23 +308,54 @@ public class SubCheckout extends PosSubPanel implements ActionListener
|
||||||
* *Copyright <EFBFBD> ConSerTi
|
* *Copyright <EFBFBD> ConSerTi
|
||||||
*/
|
*/
|
||||||
public void processOrder()
|
public void processOrder()
|
||||||
{
|
{
|
||||||
|
|
||||||
p_posPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
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"))
|
// check if order completed OK
|
||||||
|
if (order.getDocStatus().equals("DR") )
|
||||||
{
|
{
|
||||||
order.setDocAction(DocAction.ACTION_Complete);
|
order.setDocAction(DocAction.ACTION_Complete);
|
||||||
order.processIt(DocAction.ACTION_Complete);
|
try
|
||||||
order.save();
|
{
|
||||||
|
if (order.processIt(DocAction.ACTION_Complete) )
|
||||||
order = null;
|
{
|
||||||
p_posPanel.newOrder();
|
order.save();
|
||||||
f_cashGiven.setValue(Env.ZERO);
|
}
|
||||||
|
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());
|
p_posPanel.setCursor(Cursor.getDefaultCursor());
|
||||||
}
|
} // processOrder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print Ticket
|
* Print Ticket
|
||||||
|
@ -373,8 +404,8 @@ public class SubCheckout extends PosSubPanel implements ActionListener
|
||||||
BigDecimal total = new BigDecimal(0);
|
BigDecimal total = new BigDecimal(0);
|
||||||
if (order != null)
|
if (order != null)
|
||||||
total = order.getGrandTotal();
|
total = order.getGrandTotal();
|
||||||
double vuelta = given.doubleValue() - total.doubleValue();
|
double cashReturn = given.doubleValue() - total.doubleValue();
|
||||||
f_cashReturn.setValue(new BigDecimal(vuelta));
|
f_cashReturn.setValue(new BigDecimal(cashReturn));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.compiere.util.*;
|
||||||
* *Basado en Codigo Original Modificado, Revisado y Optimizado de:
|
* *Basado en Codigo Original Modificado, Revisado y Optimizado de:
|
||||||
* *Copyright <EFBFBD> Jorg Janke
|
* *Copyright <EFBFBD> Jorg Janke
|
||||||
* @version $Id: SubCurrentLine.java,v 1.3 2004/07/24 04:31:52 jjanke Exp $
|
* @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 {
|
public class SubCurrentLine extends PosSubPanel implements ActionListener {
|
||||||
/**
|
/**
|
||||||
|
@ -227,9 +228,9 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
|
||||||
*
|
*
|
||||||
* @param qty
|
* @param qty
|
||||||
*/
|
*/
|
||||||
public void setQty(BigDecimal price) {
|
public void setQty(BigDecimal qty) {
|
||||||
f_quantity.setValue(price);
|
f_quantity.setValue(qty);
|
||||||
} // setPrice
|
} // setQty
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Qty
|
* Get Qty
|
||||||
|
@ -238,7 +239,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
|
||||||
*/
|
*/
|
||||||
public BigDecimal getQty() {
|
public BigDecimal getQty() {
|
||||||
return (BigDecimal) f_quantity.getValue();
|
return (BigDecimal) f_quantity.getValue();
|
||||||
} // getPrice
|
} // getQty
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* New Line
|
* New Line
|
||||||
|
@ -282,6 +283,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
|
||||||
if (numLineas > row)
|
if (numLineas > row)
|
||||||
{
|
{
|
||||||
//delete line from order
|
//delete line from order
|
||||||
|
lineas[row].setQtyReserved(Env.ZERO); //red1 - [2093355 ] Small bugs in OpenXpertya POS
|
||||||
lineas[row].delete(true);
|
lineas[row].delete(true);
|
||||||
for (int i = row; i < (numLineas - 1); i++)
|
for (int i = row; i < (numLineas - 1); i++)
|
||||||
lineas[i] = lineas[i + 1];
|
lineas[i] = lineas[i + 1];
|
||||||
|
@ -437,31 +439,45 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
|
||||||
if (!order.getDocStatus().equals("DR"))
|
if (!order.getDocStatus().equals("DR"))
|
||||||
return null;
|
return null;
|
||||||
//add new line or increase qty
|
//add new line or increase qty
|
||||||
MOrderLine[] lineas = order.getLines();
|
|
||||||
int numLineas = lineas.length;
|
// catch Exceptions at order.getLines()
|
||||||
for (int i = 0; i < numLineas; i++)
|
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
|
if (lineas[i].getM_Product_ID() == product.getM_Product_ID())
|
||||||
double current = lineas[i].getQtyEntered().doubleValue();
|
{
|
||||||
double toadd = QtyOrdered.doubleValue();
|
//increase qty
|
||||||
double total = current + toadd;
|
double current = lineas[i].getQtyEntered().doubleValue();
|
||||||
lineas[i].setQty(new BigDecimal(total));
|
double toadd = QtyOrdered.doubleValue();
|
||||||
lineas[i].setPrice(); // sets List/limit
|
double total = current + toadd;
|
||||||
lineas[i].save();
|
lineas[i].setQty(new BigDecimal(total));
|
||||||
return lineas[i];
|
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);
|
MOrderLine line = new MOrderLine(order);
|
||||||
line.setProduct(product);
|
line.setProduct(product);
|
||||||
line.setQty(QtyOrdered);
|
line.setQty(QtyOrdered);
|
||||||
|
|
||||||
line.setPrice(); // sets List/limit
|
line.setPrice(); // sets List/limit
|
||||||
line.setPrice(PriceActual);
|
line.setPrice(PriceActual);
|
||||||
line.save();
|
line.save();
|
||||||
return line;
|
return line;
|
||||||
} // getLine
|
|
||||||
|
} // createLine
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param m_c_order_id
|
* @param m_c_order_id
|
||||||
|
|
|
@ -65,8 +65,8 @@ public class SubFunctionKeys extends PosSubPanel implements ActionListener
|
||||||
if (fKeys.get_ID() == 0)
|
if (fKeys.get_ID() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int COLUMNS = 3; // Min Columns
|
int COLUMNS = 4; // Min Columns
|
||||||
int ROWS = 6; // Min Rows
|
int ROWS = 5; // Min Rows
|
||||||
m_keys = fKeys.getKeys(false);
|
m_keys = fKeys.getKeys(false);
|
||||||
int noKeys = m_keys.length;
|
int noKeys = m_keys.length;
|
||||||
int rows = Math.max (((noKeys-1) / COLUMNS) + 1, ROWS);
|
int rows = Math.max (((noKeys-1) / COLUMNS) + 1, ROWS);
|
||||||
|
@ -106,7 +106,7 @@ public class SubFunctionKeys extends PosSubPanel implements ActionListener
|
||||||
button.setFocusable(false);
|
button.setFocusable(false);
|
||||||
content.add (button);
|
content.add (button);
|
||||||
}
|
}
|
||||||
content.setPreferredSize(new Dimension(cols*70, rows*50));
|
content.setPreferredSize(new Dimension(cols*150, rows*50));
|
||||||
add (content);
|
add (content);
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,7 @@ public class SubLines extends PosSubPanel implements ActionListener
|
||||||
if (row < 0)
|
if (row < 0)
|
||||||
row = 0;
|
row = 0;
|
||||||
m_table.getSelectionModel().setSelectionInterval(row, row);
|
m_table.getSelectionModel().setSelectionInterval(row, row);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if ("Next".equalsIgnoreCase(e.getActionCommand()))
|
else if ("Next".equalsIgnoreCase(e.getActionCommand()))
|
||||||
{
|
{
|
||||||
|
@ -225,6 +226,7 @@ public class SubLines extends PosSubPanel implements ActionListener
|
||||||
if (row >= rows)
|
if (row >= rows)
|
||||||
row = rows - 1;
|
row = rows - 1;
|
||||||
m_table.getSelectionModel().setSelectionInterval(row, row);
|
m_table.getSelectionModel().setSelectionInterval(row, row);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// Delete
|
// Delete
|
||||||
else if (action.equals("Delete"))
|
else if (action.equals("Delete"))
|
||||||
|
|
Loading…
Reference in New Issue