[2093355 ] Small bugs in OpenXpertya POS

merging to branches/stable as requested by Pirate King who loves burnt chickens.
This commit is contained in:
Redhuan D. Oon 2008-11-28 18:33:49 +00:00
parent 7e1d0fe0c1
commit fd1290c921
4 changed files with 82 additions and 33 deletions

View File

@ -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)
// check if order completed OK
if (order.getDocStatus().equals("DR") )
{
order.setDocAction(DocAction.ACTION_Complete);
order.processIt(DocAction.ACTION_Complete);
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));
}
}

View File

@ -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,8 +439,14 @@ 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;
// catch Exceptions at order.getLines()
int numLineas = 0;
MOrderLine[] lineas = null;
try
{
lineas = order.getLines();
numLineas = lineas.length;
for (int i = 0; i < numLineas; i++)
{
if (lineas[i].getM_Product_ID() == product.getM_Product_ID())
@ -453,15 +461,23 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener {
return lineas[i];
}
}
}
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

View File

@ -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

View File

@ -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"))