VCreateFromShipment:

* fix indentation (CTRL-I)
* proper close ResultSet in finally block
This commit is contained in:
teo_sarca 2008-12-12 07:13:43 +00:00
parent f051858880
commit 02332db6db
1 changed files with 381 additions and 390 deletions

View File

@ -141,8 +141,8 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
} }
// == END OF INNER CLASS InnerLocatorTableCellEditor // == END OF INNER CLASS InnerLocatorTableCellEditor
/** /**
* Protected Constructor * Protected Constructor
* @param mTab MTab * @param mTab MTab
@ -150,76 +150,76 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
public VCreateFromShipment(GridTab mTab) public VCreateFromShipment(GridTab mTab)
{ {
super (mTab); super (mTab);
// log.info( "VCreateFromShipment"); // log.info( "VCreateFromShipment");
} // VCreateFromShipment } // VCreateFromShipment
/** Loaded Invoice */ /** Loaded Invoice */
private MInvoice m_invoice = null; private MInvoice m_invoice = null;
/** Loaded RMA */ /** Loaded RMA */
private MRMA m_rma = null; private MRMA m_rma = null;
private static int COL_SELECT = 0; private static int COL_SELECT = 0;
private static int COL_QTY = 1; private static int COL_QTY = 1;
private static int COL_UOM = 2; private static int COL_UOM = 2;
private static int COL_LOCATOR_ID = 3; private static int COL_LOCATOR_ID = 3;
private static int COL_PRODUCT_ID = 4; private static int COL_PRODUCT_ID = 4;
private static int COL_VENDORPRODNO = 5; private static int COL_VENDORPRODNO = 5;
private static int COL_ORDER_ID = 6; private static int COL_ORDER_ID = 6;
private static int COL_RMA_ID = 7; private static int COL_RMA_ID = 7;
private static int COL_INVOICE_ID = 8; private static int COL_INVOICE_ID = 8;
/**
* Column names
* Override names from parent class since it differs on COL_RMA_ID.
*/
protected String[] colNames = new String[] {
Msg.getMsg(Env.getCtx(), "Select"),
Msg.translate(Env.getCtx(), "Quantity"),
Msg.translate(Env.getCtx(), "C_UOM_ID"),
Msg.translate((Env.getCtx()), "M_Locator_ID"),
Msg.translate(Env.getCtx(), "M_Product_ID"),
Msg.getElement(Env.getCtx(), "VendorProductNo", false),
Msg.getElement(Env.getCtx(), "C_Order_ID", false),
Msg.getElement(Env.getCtx(), "M_RMA_ID", false),
Msg.getElement(Env.getCtx(), "C_Invoice_ID", false)
};
/** /**
* Load Order/Invoice/RMA data into Table * Column names
* @param data data * Override names from parent class since it differs on COL_RMA_ID.
*/ */
@Override protected String[] colNames = new String[] {
protected void loadTableOIS (Vector data) Msg.getMsg(Env.getCtx(), "Select"),
{ Msg.translate(Env.getCtx(), "Quantity"),
// Header Info Msg.translate(Env.getCtx(), "C_UOM_ID"),
Vector<String> columnNames = new Vector<String>(colNames.length); Msg.translate((Env.getCtx()), "M_Locator_ID"),
for (int i=0; i<colNames.length; i++) { Msg.translate(Env.getCtx(), "M_Product_ID"),
columnNames.add(colNames[i]); Msg.getElement(Env.getCtx(), "VendorProductNo", false),
} Msg.getElement(Env.getCtx(), "C_Order_ID", false),
Msg.getElement(Env.getCtx(), "M_RMA_ID", false),
Msg.getElement(Env.getCtx(), "C_Invoice_ID", false)
};
/**
* Load Order/Invoice/RMA data into Table
* @param data data
*/
@Override
protected void loadTableOIS (Vector data)
{
// Header Info
Vector<String> columnNames = new Vector<String>(colNames.length);
for (int i=0; i<colNames.length; i++) {
columnNames.add(colNames[i]);
}
// Remove previous listeners
dataTable.getModel().removeTableModelListener(this);
// Set Model
DefaultTableModel model = new DefaultTableModel(data, columnNames);
model.addTableModelListener(this);
dataTable.setModel(model);
//
dataTable.setColumnClass(COL_SELECT, Boolean.class, false); // Selection
dataTable.setColumnClass(COL_QTY, BigDecimal.class, false); // Qty
dataTable.setColumnClass(COL_UOM, String.class, true); // UOM
dataTable.setColumnClass(COL_LOCATOR_ID, String.class, false); // Locator
TableColumn col = dataTable.getColumnModel().getColumn(COL_LOCATOR_ID);
col.setCellEditor(new InnerLocatorTableCellEditor());
dataTable.setColumnClass(COL_PRODUCT_ID, String.class, true); // Product
dataTable.setColumnClass(COL_VENDORPRODNO, String.class, true); // VendorProductNo
dataTable.setColumnClass(COL_ORDER_ID, String.class, true); // Order
dataTable.setColumnClass(COL_RMA_ID, String.class, true); // Ship
dataTable.setColumnClass(COL_INVOICE_ID, String.class, true); // Invoice
// Table UI
dataTable.autoSize();
} // loadOrder
// Remove previous listeners
dataTable.getModel().removeTableModelListener(this);
// Set Model
DefaultTableModel model = new DefaultTableModel(data, columnNames);
model.addTableModelListener(this);
dataTable.setModel(model);
//
dataTable.setColumnClass(COL_SELECT, Boolean.class, false); // Selection
dataTable.setColumnClass(COL_QTY, BigDecimal.class, false); // Qty
dataTable.setColumnClass(COL_UOM, String.class, true); // UOM
dataTable.setColumnClass(COL_LOCATOR_ID, String.class, false); // Locator
TableColumn col = dataTable.getColumnModel().getColumn(COL_LOCATOR_ID);
col.setCellEditor(new InnerLocatorTableCellEditor());
dataTable.setColumnClass(COL_PRODUCT_ID, String.class, true); // Product
dataTable.setColumnClass(COL_VENDORPRODNO, String.class, true); // VendorProductNo
dataTable.setColumnClass(COL_ORDER_ID, String.class, true); // Order
dataTable.setColumnClass(COL_RMA_ID, String.class, true); // Ship
dataTable.setColumnClass(COL_INVOICE_ID, String.class, true); // Invoice
// Table UI
dataTable.autoSize();
} // loadOrder
/** /**
* Dynamic Init * Dynamic Init
* @throws Exception if Lookups cannot be initialized * @throws Exception if Lookups cannot be initialized
@ -254,115 +254,115 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
log.config("C_BPartner_ID=" + C_BPartner_ID); log.config("C_BPartner_ID=" + C_BPartner_ID);
initBPInvoiceDetails(C_BPartner_ID); initBPInvoiceDetails(C_BPartner_ID);
initBPRMADetails(C_BPartner_ID); initBPRMADetails(C_BPartner_ID);
} // initBPDetails } // initBPDetails
/**
* Init Details - load invoices not shipped
* @param C_BPartner_ID BPartner
*/
private void initBPInvoiceDetails(int C_BPartner_ID)
{
// load AP Invoice closed or complete
invoiceField.removeActionListener(this);
invoiceField.removeAllItems();
// None
KeyNamePair pp = new KeyNamePair(0,"");
invoiceField.addItem(pp);
StringBuffer display = new StringBuffer("i.DocumentNo||' - '||")
.append(DB.TO_CHAR("DateInvoiced", DisplayType.Date, Env.getAD_Language(Env.getCtx())))
.append("|| ' - ' ||")
.append(DB.TO_CHAR("GrandTotal", DisplayType.Amount, Env.getAD_Language(Env.getCtx())));
//
StringBuffer sql = new StringBuffer("SELECT i.C_Invoice_ID,").append(display)
.append(" FROM C_Invoice i "
+ "WHERE i.C_BPartner_ID=? AND i.IsSOTrx='N' AND i.DocStatus IN ('CL','CO')"
+ " AND i.C_Invoice_ID IN "
+ "(SELECT il.C_Invoice_ID FROM C_InvoiceLine il"
+ " LEFT OUTER JOIN M_MatchInv mi ON (il.C_InvoiceLine_ID=mi.C_InvoiceLine_ID) "
+ " JOIN C_Invoice i2 ON (il.C_Invoice_ID = i2.C_Invoice_ID) "
+ " WHERE i2.C_BPartner_ID=? AND i2.IsSOTrx='N' AND i2.DocStatus IN ('CL','CO') "
+ "GROUP BY il.C_Invoice_ID,mi.C_InvoiceLine_ID,il.QtyInvoiced "
+ "HAVING (il.QtyInvoiced<>SUM(mi.Qty) AND mi.C_InvoiceLine_ID IS NOT NULL)"
+ " OR mi.C_InvoiceLine_ID IS NULL) "
+ "ORDER BY i.DateInvoiced");
try /**
{ * Init Details - load invoices not shipped
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null); * @param C_BPartner_ID BPartner
pstmt.setInt(1, C_BPartner_ID); */
pstmt.setInt(2, C_BPartner_ID); private void initBPInvoiceDetails(int C_BPartner_ID)
ResultSet rs = pstmt.executeQuery(); {
while (rs.next()) // load AP Invoice closed or complete
{ invoiceField.removeActionListener(this);
pp = new KeyNamePair(rs.getInt(1), rs.getString(2)); invoiceField.removeAllItems();
invoiceField.addItem(pp); // None
} KeyNamePair pp = new KeyNamePair(0,"");
rs.close(); invoiceField.addItem(pp);
pstmt.close(); StringBuffer display = new StringBuffer("i.DocumentNo||' - '||")
} .append(DB.TO_CHAR("DateInvoiced", DisplayType.Date, Env.getAD_Language(Env.getCtx())))
catch (SQLException e) .append("|| ' - ' ||")
{ .append(DB.TO_CHAR("GrandTotal", DisplayType.Amount, Env.getAD_Language(Env.getCtx())));
log.log(Level.SEVERE, sql.toString(), e); //
} StringBuffer sql = new StringBuffer("SELECT i.C_Invoice_ID,").append(display)
invoiceField.setSelectedIndex(0); .append(" FROM C_Invoice i "
invoiceField.addActionListener(this); + "WHERE i.C_BPartner_ID=? AND i.IsSOTrx='N' AND i.DocStatus IN ('CL','CO')"
upcField.addActionListener(this); + " AND i.C_Invoice_ID IN "
} + "(SELECT il.C_Invoice_ID FROM C_InvoiceLine il"
+ " LEFT OUTER JOIN M_MatchInv mi ON (il.C_InvoiceLine_ID=mi.C_InvoiceLine_ID) "
/** + " JOIN C_Invoice i2 ON (il.C_Invoice_ID = i2.C_Invoice_ID) "
* Load RMA that are candidates for shipment + " WHERE i2.C_BPartner_ID=? AND i2.IsSOTrx='N' AND i2.DocStatus IN ('CL','CO') "
* @param C_BPartner_ID BPartner + "GROUP BY il.C_Invoice_ID,mi.C_InvoiceLine_ID,il.QtyInvoiced "
*/ + "HAVING (il.QtyInvoiced<>SUM(mi.Qty) AND mi.C_InvoiceLine_ID IS NOT NULL)"
private void initBPRMADetails(int C_BPartner_ID) + " OR mi.C_InvoiceLine_ID IS NULL) "
{ + "ORDER BY i.DateInvoiced");
rmaField.removeActionListener(this);
rmaField.removeAllItems(); try
// None {
KeyNamePair pp = new KeyNamePair(0,""); PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
rmaField.addItem(pp); pstmt.setInt(1, C_BPartner_ID);
pstmt.setInt(2, C_BPartner_ID);
String sqlStmt = "SELECT r.M_RMA_ID, r.DocumentNo || '-' || r.Amt from M_RMA r " ResultSet rs = pstmt.executeQuery();
+ "WHERE ISSOTRX='Y' AND r.DocStatus in ('CO', 'CL') " while (rs.next())
+ "AND r.C_BPartner_ID=? " {
+ "AND r.M_RMA_ID in (SELECT rl.M_RMA_ID FROM M_RMALine rl " pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
+ "WHERE rl.M_RMA_ID=r.M_RMA_ID AND rl.QtyDelivered < rl.Qty " invoiceField.addItem(pp);
+ "AND rl.M_InOutLine_ID IS NOT NULL)"; }
rs.close();
PreparedStatement pstmt = null; pstmt.close();
try }
{ catch (SQLException e)
pstmt = DB.prepareStatement(sqlStmt, null); {
pstmt.setInt(1, C_BPartner_ID); log.log(Level.SEVERE, sql.toString(), e);
ResultSet rs = pstmt.executeQuery(); }
while (rs.next()) invoiceField.setSelectedIndex(0);
{ invoiceField.addActionListener(this);
pp = new KeyNamePair(rs.getInt(1), rs.getString(2)); upcField.addActionListener(this);
rmaField.addItem(pp); }
}
rs.close(); /**
} * Load RMA that are candidates for shipment
catch (SQLException e) * @param C_BPartner_ID BPartner
{ */
log.log(Level.SEVERE, sqlStmt.toString(), e); private void initBPRMADetails(int C_BPartner_ID)
} {
finally rmaField.removeActionListener(this);
{ rmaField.removeAllItems();
if (pstmt != null) // None
{ KeyNamePair pp = new KeyNamePair(0,"");
try rmaField.addItem(pp);
{
pstmt.close(); String sqlStmt = "SELECT r.M_RMA_ID, r.DocumentNo || '-' || r.Amt from M_RMA r "
} + "WHERE ISSOTRX='Y' AND r.DocStatus in ('CO', 'CL') "
catch (Exception ex) + "AND r.C_BPartner_ID=? "
{ + "AND r.M_RMA_ID in (SELECT rl.M_RMA_ID FROM M_RMALine rl "
log.severe("Could not close prepared statement"); + "WHERE rl.M_RMA_ID=r.M_RMA_ID AND rl.QtyDelivered < rl.Qty "
} + "AND rl.M_InOutLine_ID IS NOT NULL)";
}
} PreparedStatement pstmt = null;
rmaField.setSelectedIndex(0); try
rmaField.addActionListener(this); {
} pstmt = DB.prepareStatement(sqlStmt, null);
pstmt.setInt(1, C_BPartner_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
rmaField.addItem(pp);
}
rs.close();
}
catch (SQLException e)
{
log.log(Level.SEVERE, sqlStmt.toString(), e);
}
finally
{
if (pstmt != null)
{
try
{
pstmt.close();
}
catch (Exception ex)
{
log.severe("Could not close prepared statement");
}
}
}
rmaField.setSelectedIndex(0);
rmaField.addActionListener(this);
}
/** /**
@ -386,7 +386,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
// set Invoice and Shipment to Null // set Invoice and Shipment to Null
invoiceField.setSelectedIndex(-1); invoiceField.setSelectedIndex(-1);
shipmentField.setSelectedIndex(-1); shipmentField.setSelectedIndex(-1);
rmaField.setSelectedIndex(-1); rmaField.setSelectedIndex(-1);
loadOrder(C_Order_ID, false); loadOrder(C_Order_ID, false);
m_invoice = null; m_invoice = null;
} }
@ -403,36 +403,36 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
// set Order and Shipment to Null // set Order and Shipment to Null
orderField.setSelectedIndex(-1); orderField.setSelectedIndex(-1);
shipmentField.setSelectedIndex(-1); shipmentField.setSelectedIndex(-1);
rmaField.setSelectedIndex(-1); rmaField.setSelectedIndex(-1);
loadInvoice(C_Invoice_ID); loadInvoice(C_Invoice_ID);
} }
} }
// RMA // RMA
else if (e.getSource().equals(rmaField)) else if (e.getSource().equals(rmaField))
{ {
KeyNamePair pp = (KeyNamePair)rmaField.getSelectedItem(); KeyNamePair pp = (KeyNamePair)rmaField.getSelectedItem();
if (pp == null || pp.getKey() == 0) if (pp == null || pp.getKey() == 0)
; ;
else else
{ {
int M_RMA_ID = pp.getKey(); int M_RMA_ID = pp.getKey();
// set Order and Shipment to Null // set Order and Shipment to Null
orderField.setSelectedIndex(-1); orderField.setSelectedIndex(-1);
shipmentField.setSelectedIndex(-1); shipmentField.setSelectedIndex(-1);
invoiceField.setSelectedIndex(-1); invoiceField.setSelectedIndex(-1);
loadRMA(M_RMA_ID); loadRMA(M_RMA_ID);
} }
} }
//sameWarehouseCb //sameWarehouseCb
else if (e.getSource().equals(sameWarehouseCb)) else if (e.getSource().equals(sameWarehouseCb))
{ {
initBPartnerOIS(((Integer)bPartnerField.getValue()).intValue(), false); initBPartnerOIS(((Integer)bPartnerField.getValue()).intValue(), false);
} }
else if (e.getSource().equals(upcField)) else if (e.getSource().equals(upcField))
{ {
checkProductUsingUPC(); checkProductUsingUPC();
} }
} // actionPerformed } // actionPerformed
@ -511,7 +511,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
* Selected - 0 * Selected - 0
* Qty - 1 * Qty - 1
* C_UOM_ID - 2 * C_UOM_ID - 2
* M_Locator_ID - 3 * M_Locator_ID - 3
* M_Product_ID - 4 * M_Product_ID - 4
* VendorProductNo - 5 * VendorProductNo - 5
* OrderLine - 6 * OrderLine - 6
@ -523,32 +523,32 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
Vector<Vector<?>> data = new Vector<Vector<?>>(); Vector<Vector<?>> data = new Vector<Vector<?>>();
StringBuffer sql = new StringBuffer("SELECT " StringBuffer sql = new StringBuffer("SELECT "
+ "l.QtyOrdered-SUM(COALESCE(m.Qty,0))," // 1 + "l.QtyOrdered-SUM(COALESCE(m.Qty,0))," // 1
+ "CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END," // 2 + "CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END," // 2
+ " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4 + " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4
+ " p.M_Locator_ID, loc.Value, " // 5..6 + " p.M_Locator_ID, loc.Value, " // 5..6
+ " COALESCE(l.M_Product_ID,0),COALESCE(p.Name,c.Name), " // 7..8 + " COALESCE(l.M_Product_ID,0),COALESCE(p.Name,c.Name), " // 7..8
+ " po.VendorProductNo, " // 9 + " po.VendorProductNo, " // 9
+ " l.C_OrderLine_ID,l.Line " // 10..11 + " l.C_OrderLine_ID,l.Line " // 10..11
+ "FROM C_OrderLine l" + "FROM C_OrderLine l"
+ " LEFT OUTER JOIN M_Product_PO po ON (l.M_Product_ID = po.M_Product_ID AND l.C_BPartner_ID = po.C_BPartner_ID) " + " LEFT OUTER JOIN M_Product_PO po ON (l.M_Product_ID = po.M_Product_ID AND l.C_BPartner_ID = po.C_BPartner_ID) "
+ " LEFT OUTER JOIN M_MatchPO m ON (l.C_OrderLine_ID=m.C_OrderLine_ID AND "); + " LEFT OUTER JOIN M_MatchPO m ON (l.C_OrderLine_ID=m.C_OrderLine_ID AND ");
sql.append(forInvoice ? "m.C_InvoiceLine_ID" : "m.M_InOutLine_ID"); sql.append(forInvoice ? "m.C_InvoiceLine_ID" : "m.M_InOutLine_ID");
sql.append(" IS NOT NULL)") sql.append(" IS NOT NULL)")
.append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)" .append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)"
+ " LEFT OUTER JOIN M_Locator loc on (p.M_Locator_ID=loc.M_Locator_ID)" + " LEFT OUTER JOIN M_Locator loc on (p.M_Locator_ID=loc.M_Locator_ID)"
+ " LEFT OUTER JOIN C_Charge c ON (l.C_Charge_ID=c.C_Charge_ID)"); + " LEFT OUTER JOIN C_Charge c ON (l.C_Charge_ID=c.C_Charge_ID)");
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM")) if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)"); sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)");
else else
sql.append(" LEFT OUTER JOIN C_UOM_Trl uom ON (l.C_UOM_ID=uom.C_UOM_ID AND uom.AD_Language='") sql.append(" LEFT OUTER JOIN C_UOM_Trl uom ON (l.C_UOM_ID=uom.C_UOM_ID AND uom.AD_Language='")
.append(Env.getAD_Language(Env.getCtx())).append("')"); .append(Env.getAD_Language(Env.getCtx())).append("')");
// //
sql.append(" WHERE l.C_Order_ID=? " // #1 sql.append(" WHERE l.C_Order_ID=? " // #1
+ "GROUP BY l.QtyOrdered,CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END, " + "GROUP BY l.QtyOrdered,CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END, "
+ "l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name), p.M_Locator_ID, loc.Value, po.VendorProductNo, " + "l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name), p.M_Locator_ID, loc.Value, po.VendorProductNo, "
+ "l.M_Product_ID,COALESCE(p.Name,c.Name), l.Line,l.C_OrderLine_ID " + "l.M_Product_ID,COALESCE(p.Name,c.Name), l.Line,l.C_OrderLine_ID "
+ "ORDER BY l.Line"); + "ORDER BY l.Line");
// //
log.finer(sql.toString()); log.finer(sql.toString());
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
@ -568,10 +568,10 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
line.add(qtyEntered); // 1-Qty line.add(qtyEntered); // 1-Qty
KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim()); KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim());
line.add(pp); // 2-UOM line.add(pp); // 2-UOM
// Add locator // Add locator
pp = new KeyNamePair(rs.getInt(5), rs.getString(6)); pp = new KeyNamePair(rs.getInt(5), rs.getString(6));
line.add(pp); // 3-Locator line.add(pp); // 3-Locator
// Add product // Add product
pp = new KeyNamePair(rs.getInt(7), rs.getString(8)); pp = new KeyNamePair(rs.getInt(7), rs.getString(8));
line.add(pp); // 4-Product line.add(pp); // 4-Product
line.add(rs.getString(9)); // 5-VendorProductNo line.add(rs.getString(9)); // 5-VendorProductNo
@ -598,29 +598,29 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
/** /**
* Load Data - Invoice * Load Data - Invoice
* @param C_Invoice_ID Invoice * @param C_Invoice_ID Invoice
* *
* Selected - 0 * Selected - 0
* Qty - 1 * Qty - 1
* C_UOM_ID - 2 * C_UOM_ID - 2
* M_Locator_ID - 3 * M_Locator_ID - 3
* M_Product_ID - 4 * M_Product_ID - 4
* VendorProductNo - 5 * VendorProductNo - 5
* OrderLine - 6 * OrderLine - 6
* ShipmentLine - 7 * ShipmentLine - 7
* InvoiceLine - 8 * InvoiceLine - 8
*/ */
private void loadInvoice(int C_Invoice_ID) private void loadInvoice(int C_Invoice_ID)
{ {
log.config("C_Invoice_ID=" + C_Invoice_ID); log.config("C_Invoice_ID=" + C_Invoice_ID);
m_invoice = new MInvoice(Env.getCtx(), C_Invoice_ID, null); // save m_invoice = new MInvoice(Env.getCtx(), C_Invoice_ID, null); // save
p_order = null; p_order = null;
m_rma = null; m_rma = null;
Vector<Vector<?>> data = new Vector<Vector<?>>(); Vector<Vector<?>> data = new Vector<Vector<?>>();
StringBuffer sql = new StringBuffer("SELECT " // Entered UOM StringBuffer sql = new StringBuffer("SELECT " // Entered UOM
+ "l.QtyInvoiced-SUM(NVL(mi.Qty,0)),l.QtyEntered/l.QtyInvoiced," + "l.QtyInvoiced-SUM(NVL(mi.Qty,0)),l.QtyEntered/l.QtyInvoiced,"
+ " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4 + " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4
+ " p.M_Locator_ID, loc.Value, " // 5..6 + " p.M_Locator_ID, loc.Value, " // 5..6
+ " l.M_Product_ID,p.Name, po.VendorProductNo, l.C_InvoiceLine_ID,l.Line," // 7..11 + " l.M_Product_ID,p.Name, po.VendorProductNo, l.C_InvoiceLine_ID,l.Line," // 7..11
+ " l.C_OrderLine_ID " // 12 + " l.C_OrderLine_ID " // 12
+ " FROM C_InvoiceLine l "); + " FROM C_InvoiceLine l ");
@ -628,20 +628,20 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)"); sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)");
else else
sql.append(" LEFT OUTER JOIN C_UOM_Trl uom ON (l.C_UOM_ID=uom.C_UOM_ID AND uom.AD_Language='") sql.append(" LEFT OUTER JOIN C_UOM_Trl uom ON (l.C_UOM_ID=uom.C_UOM_ID AND uom.AD_Language='")
.append(Env.getAD_Language(Env.getCtx())).append("')"); .append(Env.getAD_Language(Env.getCtx())).append("')");
sql.append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)") sql.append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)")
.append(" LEFT OUTER JOIN M_Locator loc on (p.M_Locator_ID=loc.M_Locator_ID)") .append(" LEFT OUTER JOIN M_Locator loc on (p.M_Locator_ID=loc.M_Locator_ID)")
.append(" INNER JOIN C_Invoice inv ON (l.C_Invoice_ID=inv.C_Invoice_ID)") .append(" INNER JOIN C_Invoice inv ON (l.C_Invoice_ID=inv.C_Invoice_ID)")
.append(" LEFT OUTER JOIN M_Product_PO po ON (l.M_Product_ID = po.M_Product_ID AND inv.C_BPartner_ID = po.C_BPartner_ID)") .append(" LEFT OUTER JOIN M_Product_PO po ON (l.M_Product_ID = po.M_Product_ID AND inv.C_BPartner_ID = po.C_BPartner_ID)")
.append(" LEFT OUTER JOIN M_MatchInv mi ON (l.C_InvoiceLine_ID=mi.C_InvoiceLine_ID)") .append(" LEFT OUTER JOIN M_MatchInv mi ON (l.C_InvoiceLine_ID=mi.C_InvoiceLine_ID)")
.append(" WHERE l.C_Invoice_ID=? AND l.QtyInvoiced<>0 ") .append(" WHERE l.C_Invoice_ID=? AND l.QtyInvoiced<>0 ")
.append("GROUP BY l.QtyInvoiced,l.QtyEntered/l.QtyInvoiced," .append("GROUP BY l.QtyInvoiced,l.QtyEntered/l.QtyInvoiced,"
+ "l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," + "l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name),"
+ "p.M_Locator_ID, loc.Value, " + "p.M_Locator_ID, loc.Value, "
+ "l.M_Product_ID,p.Name, po.VendorProductNo, l.C_InvoiceLine_ID,l.Line,l.C_OrderLine_ID ") + "l.M_Product_ID,p.Name, po.VendorProductNo, l.C_InvoiceLine_ID,l.Line,l.C_OrderLine_ID ")
.append("ORDER BY l.Line"); .append("ORDER BY l.Line");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
@ -659,9 +659,9 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
line.add(qtyEntered); // 1-Qty line.add(qtyEntered); // 1-Qty
KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim()); KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim());
line.add(pp); // 2-UOM line.add(pp); // 2-UOM
// Add locator // Add locator
pp = new KeyNamePair(rs.getInt(5), rs.getString(6)); pp = new KeyNamePair(rs.getInt(5), rs.getString(6));
line.add(pp); // 3-Locator line.add(pp); // 3-Locator
pp = new KeyNamePair(rs.getInt(7), rs.getString(8)); pp = new KeyNamePair(rs.getInt(7), rs.getString(8));
line.add(pp); // 4-Product line.add(pp); // 4-Product
@ -689,100 +689,90 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
} }
loadTableOIS(data); loadTableOIS(data);
} // loadInvoice } // loadInvoice
/** /**
* Load RMA details * Load RMA details
* @param M_RMA_ID RMA * @param M_RMA_ID RMA
*/ */
private void loadRMA(int M_RMA_ID) private void loadRMA(int M_RMA_ID)
{ {
m_invoice = null; m_invoice = null;
p_order = null; p_order = null;
m_rma = new MRMA(Env.getCtx(), M_RMA_ID, null); m_rma = new MRMA(Env.getCtx(), M_RMA_ID, null);
Vector<Vector<?>> data = new Vector<Vector<?>>(); Vector<Vector<?>> data = new Vector<Vector<?>>();
StringBuffer sqlStmt = new StringBuffer(); StringBuffer sqlStmt = new StringBuffer();
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, iol.M_Product_ID, p.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) "); sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, iol.M_Product_ID, p.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) ");
sqlStmt.append("FROM M_RMALine rl INNER JOIN M_InOutLine iol ON rl.M_InOutLine_ID=iol.M_InOutLine_ID "); sqlStmt.append("FROM M_RMALine rl INNER JOIN M_InOutLine iol ON rl.M_InOutLine_ID=iol.M_InOutLine_ID ");
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM")) if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
{ {
sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=iol.C_UOM_ID) "); sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=iol.C_UOM_ID) ");
} }
else else
{ {
sqlStmt.append("LEFT OUTER JOIN C_UOM_Trl uom ON (uom.C_UOM_ID=iol.C_UOM_ID AND uom.AD_Language='"); sqlStmt.append("LEFT OUTER JOIN C_UOM_Trl uom ON (uom.C_UOM_ID=iol.C_UOM_ID AND uom.AD_Language='");
sqlStmt.append(Env.getAD_Language(Env.getCtx())).append("') "); sqlStmt.append(Env.getAD_Language(Env.getCtx())).append("') ");
} }
sqlStmt.append("LEFT OUTER JOIN M_Product p ON p.M_Product_ID=iol.M_Product_ID "); sqlStmt.append("LEFT OUTER JOIN M_Product p ON p.M_Product_ID=iol.M_Product_ID ");
sqlStmt.append("WHERE rl.M_RMA_ID=? "); sqlStmt.append("WHERE rl.M_RMA_ID=? ");
sqlStmt.append("AND rl.M_INOUTLINE_ID IS NOT NULL"); sqlStmt.append("AND rl.M_INOUTLINE_ID IS NOT NULL");
sqlStmt.append(" UNION "); sqlStmt.append(" UNION ");
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, 0, c.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) "); sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, 0, c.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) ");
sqlStmt.append("FROM M_RMALine rl INNER JOIN C_Charge c ON c.C_Charge_ID = rl.C_Charge_ID "); sqlStmt.append("FROM M_RMALine rl INNER JOIN C_Charge c ON c.C_Charge_ID = rl.C_Charge_ID ");
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM")) if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
{ {
sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=100) "); sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=100) ");
} }
else else
{ {
sqlStmt.append("LEFT OUTER JOIN C_UOM_Trl uom ON (uom.C_UOM_ID=100 AND uom.AD_Language='"); sqlStmt.append("LEFT OUTER JOIN C_UOM_Trl uom ON (uom.C_UOM_ID=100 AND uom.AD_Language='");
sqlStmt.append(Env.getAD_Language(Env.getCtx())).append("') "); sqlStmt.append(Env.getAD_Language(Env.getCtx())).append("') ");
} }
sqlStmt.append("WHERE rl.M_RMA_ID=? "); sqlStmt.append("WHERE rl.M_RMA_ID=? ");
sqlStmt.append("AND rl.C_Charge_ID IS NOT NULL"); sqlStmt.append("AND rl.C_Charge_ID IS NOT NULL");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(sqlStmt.toString(), null); pstmt = DB.prepareStatement(sqlStmt.toString(), null);
pstmt.setInt(1, M_RMA_ID); pstmt.setInt(1, M_RMA_ID);
pstmt.setInt(2, M_RMA_ID); pstmt.setInt(2, M_RMA_ID);
ResultSet rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
Vector<Object> line = new Vector<Object>(7); Vector<Object> line = new Vector<Object>(7);
line.add(new Boolean(false)); // 0-Selection line.add(new Boolean(false)); // 0-Selection
line.add(rs.getBigDecimal(3)); // 1-Qty line.add(rs.getBigDecimal(3)); // 1-Qty
KeyNamePair pp = new KeyNamePair(rs.getInt(6), rs.getString(7)); KeyNamePair pp = new KeyNamePair(rs.getInt(6), rs.getString(7));
line.add(pp); // 2-UOM line.add(pp); // 2-UOM
line.add(null); // 3-Locator - TODO: Not implemented since RMA is in alpha and can't be tested. line.add(null); // 3-Locator - TODO: Not implemented since RMA is in alpha and can't be tested.
pp = new KeyNamePair(rs.getInt(4), rs.getString(5)); pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
line.add(pp); // 4-Product line.add(pp); // 4-Product
line.add(null); //5-Vendor Product No line.add(null); //5-Vendor Product No
line.add(null); //6-Order line.add(null); //6-Order
pp = new KeyNamePair(rs.getInt(1), rs.getString(2)); pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
line.add(pp); //7-RMA line.add(pp); //7-RMA
line.add(null); //8-invoice line.add(null); //8-invoice
data.add(line); data.add(line);
} }
rs.close(); }
} catch (Exception ex)
catch (Exception ex) {
{ log.log(Level.SEVERE, sqlStmt.toString(), ex);
log.log(Level.SEVERE, sqlStmt.toString(), ex); }
} finally
finally {
{ DB.close(rs, pstmt);
if (pstmt != null) rs = null; pstmt = null;
{ }
try loadTableOIS(data);
{ }
pstmt.close();
}
catch (Exception ex)
{
log.severe("Could not close prepared statement");
}
}
}
loadTableOIS(data);
}
/** /**
* List number of rows selected * List number of rows selected
@ -803,8 +793,8 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
* *
* @return true if saved * @return true if saved
*/ */
protected boolean save() { protected boolean save()
{
dataTable.stopEditor(true); dataTable.stopEditor(true);
log.config(""); log.config("");
TableModel model = dataTable.getModel(); TableModel model = dataTable.getModel();
@ -824,27 +814,28 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
log.config(inout + ", C_Locator_ID=" + M_Locator_ID); log.config(inout + ", C_Locator_ID=" + M_Locator_ID);
// Lines // Lines
for (int i = 0; i < rows; i++) { for (int i = 0; i < rows; i++)
{
if (((Boolean) model.getValueAt(i, 0)).booleanValue()) { if (((Boolean) model.getValueAt(i, 0)).booleanValue()) {
// variable values // variable values
BigDecimal QtyEntered = (BigDecimal) model.getValueAt(i, COL_QTY); // Qty BigDecimal QtyEntered = (BigDecimal) model.getValueAt(i, COL_QTY); // Qty
KeyNamePair pp = (KeyNamePair) model.getValueAt(i, COL_UOM); // UOM KeyNamePair pp = (KeyNamePair) model.getValueAt(i, COL_UOM); // UOM
int C_UOM_ID = pp.getKey(); int C_UOM_ID = pp.getKey();
pp = (KeyNamePair) model.getValueAt(i, COL_LOCATOR_ID); // Locator pp = (KeyNamePair) model.getValueAt(i, COL_LOCATOR_ID); // Locator
// If a locator is specified on the product, choose that otherwise default locator // If a locator is specified on the product, choose that otherwise default locator
M_Locator_ID = pp!=null && pp.getKey()!=0 ? pp.getKey() : defaultLoc.intValue(); M_Locator_ID = pp!=null && pp.getKey()!=0 ? pp.getKey() : defaultLoc.intValue();
pp = (KeyNamePair) model.getValueAt(i, COL_PRODUCT_ID); // Product pp = (KeyNamePair) model.getValueAt(i, COL_PRODUCT_ID); // Product
int M_Product_ID = pp.getKey(); int M_Product_ID = pp.getKey();
int C_OrderLine_ID = 0; int C_OrderLine_ID = 0;
pp = (KeyNamePair) model.getValueAt(i, COL_ORDER_ID); // OrderLine pp = (KeyNamePair) model.getValueAt(i, COL_ORDER_ID); // OrderLine
if (pp != null) if (pp != null)
C_OrderLine_ID = pp.getKey(); C_OrderLine_ID = pp.getKey();
int M_RMALine_ID = 0; int M_RMALine_ID = 0;
pp = (KeyNamePair) model.getValueAt(i, COL_RMA_ID); // RMA pp = (KeyNamePair) model.getValueAt(i, COL_RMA_ID); // RMA
// If we have RMA // If we have RMA
if (pp != null) if (pp != null)
M_RMALine_ID = pp.getKey(); M_RMALine_ID = pp.getKey();
int C_InvoiceLine_ID = 0; int C_InvoiceLine_ID = 0;
MInvoiceLine il = null; MInvoiceLine il = null;
pp = (KeyNamePair) model.getValueAt(i, COL_INVOICE_ID); // InvoiceLine pp = (KeyNamePair) model.getValueAt(i, COL_INVOICE_ID); // InvoiceLine
@ -863,13 +854,13 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
QtyEntered = QtyEntered.setScale(precision, BigDecimal.ROUND_HALF_DOWN); QtyEntered = QtyEntered.setScale(precision, BigDecimal.ROUND_HALF_DOWN);
// //
log.fine("Line QtyEntered=" + QtyEntered log.fine("Line QtyEntered=" + QtyEntered
+ ", Product=" + M_Product_ID + ", Product=" + M_Product_ID
+ ", OrderLine=" + C_OrderLine_ID + ", InvoiceLine=" + C_InvoiceLine_ID); + ", OrderLine=" + C_OrderLine_ID + ", InvoiceLine=" + C_InvoiceLine_ID);
// Credit Memo - negative Qty // Credit Memo - negative Qty
if (m_invoice != null && m_invoice.isCreditMemo() ) if (m_invoice != null && m_invoice.isCreditMemo() )
QtyEntered = QtyEntered.negate(); QtyEntered = QtyEntered.negate();
// Create new InOut Line // Create new InOut Line
MInOutLine iol = new MInOutLine (inout); MInOutLine iol = new MInOutLine (inout);
iol.setM_Product_ID(M_Product_ID, C_UOM_ID); // Line UOM iol.setM_Product_ID(M_Product_ID, C_UOM_ID); // Line UOM
@ -884,8 +875,8 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
if (ol.getQtyEntered().compareTo(ol.getQtyOrdered()) != 0) if (ol.getQtyEntered().compareTo(ol.getQtyOrdered()) != 0)
{ {
iol.setMovementQty(QtyEntered iol.setMovementQty(QtyEntered
.multiply(ol.getQtyOrdered()) .multiply(ol.getQtyOrdered())
.divide(ol.getQtyEntered(), 12, BigDecimal.ROUND_HALF_UP)); .divide(ol.getQtyEntered(), 12, BigDecimal.ROUND_HALF_UP));
iol.setC_UOM_ID(ol.getC_UOM_ID()); iol.setC_UOM_ID(ol.getC_UOM_ID());
} }
iol.setM_AttributeSetInstance_ID(ol.getM_AttributeSetInstance_ID()); iol.setM_AttributeSetInstance_ID(ol.getM_AttributeSetInstance_ID());
@ -905,8 +896,8 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
if (il.getQtyEntered().compareTo(il.getQtyInvoiced()) != 0) if (il.getQtyEntered().compareTo(il.getQtyInvoiced()) != 0)
{ {
iol.setQtyEntered(QtyEntered iol.setQtyEntered(QtyEntered
.multiply(il.getQtyInvoiced()) .multiply(il.getQtyInvoiced())
.divide(il.getQtyEntered(), 12, BigDecimal.ROUND_HALF_UP)); .divide(il.getQtyEntered(), 12, BigDecimal.ROUND_HALF_UP));
iol.setC_UOM_ID(il.getC_UOM_ID()); iol.setC_UOM_ID(il.getC_UOM_ID());
} }
iol.setDescription(il.getDescription()); iol.setDescription(il.getDescription());
@ -919,22 +910,22 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
iol.setUser1_ID(il.getUser1_ID()); iol.setUser1_ID(il.getUser1_ID());
iol.setUser2_ID(il.getUser2_ID()); iol.setUser2_ID(il.getUser2_ID());
} }
else if (M_RMALine_ID != 0) else if (M_RMALine_ID != 0)
{ {
rmal = new MRMALine(Env.getCtx(), M_RMALine_ID, null); rmal = new MRMALine(Env.getCtx(), M_RMALine_ID, null);
iol.setM_RMALine_ID(M_RMALine_ID); iol.setM_RMALine_ID(M_RMALine_ID);
iol.setQtyEntered(QtyEntered); iol.setQtyEntered(QtyEntered);
iol.setDescription(rmal.getDescription()); iol.setDescription(rmal.getDescription());
iol.setM_AttributeSetInstance_ID(rmal.getM_AttributeSetInstance_ID()); iol.setM_AttributeSetInstance_ID(rmal.getM_AttributeSetInstance_ID());
iol.setC_Project_ID(rmal.getC_Project_ID()); iol.setC_Project_ID(rmal.getC_Project_ID());
iol.setC_ProjectPhase_ID(rmal.getC_ProjectPhase_ID()); iol.setC_ProjectPhase_ID(rmal.getC_ProjectPhase_ID());
iol.setC_ProjectTask_ID(rmal.getC_ProjectTask_ID()); iol.setC_ProjectTask_ID(rmal.getC_ProjectTask_ID());
iol.setC_Activity_ID(rmal.getC_Activity_ID()); iol.setC_Activity_ID(rmal.getC_Activity_ID());
iol.setAD_OrgTrx_ID(rmal.getAD_OrgTrx_ID()); iol.setAD_OrgTrx_ID(rmal.getAD_OrgTrx_ID());
iol.setUser1_ID(rmal.getUser1_ID()); iol.setUser1_ID(rmal.getUser1_ID());
iol.setUser2_ID(rmal.getUser2_ID()); iol.setUser2_ID(rmal.getUser2_ID());
} }
// Charge // Charge
if (M_Product_ID == 0) if (M_Product_ID == 0)
{ {
@ -943,7 +934,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
else if (il != null && il.getC_Charge_ID() != 0) // from invoice else if (il != null && il.getC_Charge_ID() != 0) // from invoice
iol.setC_Charge_ID(il.getC_Charge_ID()); iol.setC_Charge_ID(il.getC_Charge_ID());
else if (rmal != null && rmal.getC_Charge_ID() != 0) // from rma else if (rmal != null && rmal.getC_Charge_ID() != 0) // from rma
iol.setC_Charge_ID(rmal.getC_Charge_ID()); iol.setC_Charge_ID(rmal.getC_Charge_ID());
} }
// Set locator // Set locator
iol.setM_Locator_ID(M_Locator_ID); iol.setM_Locator_ID(M_Locator_ID);
@ -980,7 +971,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
inout.setDropShip_BPartner_ID(p_order.getDropShip_BPartner_ID()); inout.setDropShip_BPartner_ID(p_order.getDropShip_BPartner_ID());
inout.setDropShip_Location_ID(p_order.getDropShip_Location_ID()); inout.setDropShip_Location_ID(p_order.getDropShip_Location_ID());
inout.setDropShip_User_ID(p_order.getDropShip_User_ID()); inout.setDropShip_User_ID(p_order.getDropShip_User_ID());
} }
} }
if (m_invoice != null && m_invoice.getC_Invoice_ID() != 0) if (m_invoice != null && m_invoice.getC_Invoice_ID() != 0)
{ {
@ -994,20 +985,20 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
inout.setUser1_ID(m_invoice.getUser1_ID()); inout.setUser1_ID(m_invoice.getUser1_ID());
inout.setUser2_ID(m_invoice.getUser2_ID()); inout.setUser2_ID(m_invoice.getUser2_ID());
} }
if (m_rma != null && m_rma.getM_RMA_ID() != 0) if (m_rma != null && m_rma.getM_RMA_ID() != 0)
{ {
MInOut originalIO = m_rma.getShipment(); MInOut originalIO = m_rma.getShipment();
inout.setIsSOTrx(m_rma.isSOTrx()); inout.setIsSOTrx(m_rma.isSOTrx());
inout.setC_Order_ID(0); inout.setC_Order_ID(0);
inout.setC_Invoice_ID(0); inout.setC_Invoice_ID(0);
inout.setM_RMA_ID(m_rma.getM_RMA_ID()); inout.setM_RMA_ID(m_rma.getM_RMA_ID());
inout.setAD_OrgTrx_ID(originalIO.getAD_OrgTrx_ID()); inout.setAD_OrgTrx_ID(originalIO.getAD_OrgTrx_ID());
inout.setC_Project_ID(originalIO.getC_Project_ID()); inout.setC_Project_ID(originalIO.getC_Project_ID());
inout.setC_Campaign_ID(originalIO.getC_Campaign_ID()); inout.setC_Campaign_ID(originalIO.getC_Campaign_ID());
inout.setC_Activity_ID(originalIO.getC_Activity_ID()); inout.setC_Activity_ID(originalIO.getC_Activity_ID());
inout.setUser1_ID(originalIO.getUser1_ID()); inout.setUser1_ID(originalIO.getUser1_ID());
inout.setUser2_ID(originalIO.getUser2_ID()); inout.setUser2_ID(originalIO.getUser2_ID());
} }
inout.save(); inout.save();
return true; return true;
} // save } // save