This commit is contained in:
hodianto 2018-09-10 09:45:33 +07:00
commit 720e6f37f5
20 changed files with 7280 additions and 8 deletions

View File

@ -0,0 +1,42 @@
package andromedia.midsuit.callout;
import java.util.Properties;
import org.adempiere.base.IColumnCallout;
import org.compiere.model.CalloutEngine;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
import org.compiere.model.MInOut;
import org.compiere.model.MOrder;
public class MID_CalloutInOut extends CalloutEngine implements IColumnCallout{
@Override
public String start(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
// TODO Auto-generated method stub
if(value == null) return null;
if(mField.getColumnName().equals(MInOut.COLUMNNAME_MovementDate)) {
mTab.setValue(MInOut.COLUMNNAME_DateAcct, value);
}
if(mField.getColumnName().equals(MInOut.COLUMNNAME_C_Order_ID)) {
setAJU(ctx, WindowNo, mTab, mField, value, oldValue);
}
return null;
}
public String setAJU(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
MOrder order = new MOrder(ctx, (int)value, null);
if(order != null) {
mTab.setValue("noaju1", order.get_ValueAsString("noaju1") == null ? null : order.get_ValueAsString("noaju1"));
mTab.setValue("noaju2", order.get_ValueAsString("noaju2") == null ? null : order.get_ValueAsString("noaju2"));
mTab.setValue("noaju3", order.get_ValueAsString("noaju3") == null ? null : order.get_ValueAsString("noaju3"));
mTab.setValue("noaju4", order.get_ValueAsString("noaju4") == null ? null : order.get_ValueAsString("noaju4"));
}
return null;
}
}

View File

@ -0,0 +1,34 @@
package andromedia.midsuit.callout;
import java.util.Properties;
import org.adempiere.base.IColumnCallout;
import org.compiere.model.CalloutEngine;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
import org.compiere.model.MInOutLine;
import org.compiere.model.MOrderLine;
public class MID_CalloutInOutLine extends CalloutEngine implements IColumnCallout{
@Override
public String start(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
// TODO Auto-generated method stub
if(value == null) return null;
if(mField.getColumnName().equals(MInOutLine.COLUMNNAME_C_OrderLine_ID)) {
this.setDescription(ctx, WindowNo, mTab, mField, value, oldValue);
}
return null;
}
public String setDescription(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
MOrderLine ol = new MOrderLine(ctx, (int)value, null);
mTab.setValue(MInOutLine.COLUMNNAME_Description, ol.getDescription() != null ? ol.getDescription() : null);
return null;
}
}

View File

@ -16,10 +16,14 @@ public class MID_CalloutOrder extends CalloutEngine implements IColumnCallout {
@Override
public String start(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
// TODO Auto-generated method stub
if(value == null) return null;
if(mField.getColumnName().equals(MOrder.COLUMNNAME_AD_Org_ID)) {
if(value == null) return null;
return setPricelistByOrg(ctx, WindowNo, mTab, mField, value, oldValue);
}
if(mField.getColumnName().equals(MOrder.COLUMNNAME_DateOrdered)) {
mTab.setValue(MOrder.COLUMNNAME_DatePromised, value);
}
return null;
}

View File

@ -5,11 +5,15 @@ import java.util.List;
import org.adempiere.base.IColumnCallout;
import org.adempiere.base.IColumnCalloutFactory;
import org.compiere.model.MInOut;
import org.compiere.model.MInOutLine;
import org.compiere.model.MOrder;
import org.compiere.model.MProduction;
import org.compiere.model.MProductionLine;
import andromedia.midsuit.callout.MID_CalloutAnalysisQC;
import andromedia.midsuit.callout.MID_CalloutInOut;
import andromedia.midsuit.callout.MID_CalloutInOutLine;
import andromedia.midsuit.callout.MID_CalloutOrder;
import andromedia.midsuit.callout.MID_CalloutProduction;
import andromedia.midsuit.callout.MID_CalloutProductionLine;
@ -33,6 +37,10 @@ public class MID_CalloutFactory implements IColumnCalloutFactory{
list.add(new MID_CalloutProductionLine());
if(tableName.equals(MID_Analysis.Table_Name))
list.add(new MID_CalloutAnalysisQC());
if(tableName.equals(MInOut.Table_Name))
list.add(new MID_CalloutInOut());
if(tableName.equals(MInOutLine.Table_Name))
list.add(new MID_CalloutInOutLine());
return list != null ? list.toArray(new IColumnCallout[0]) : new IColumnCallout[0];
}

View File

@ -3,9 +3,13 @@ package andromedia.midsuit.factory;
import org.compiere.grid.ICreateFrom;
import org.compiere.grid.ICreateFromFactory;
import org.compiere.model.GridTab;
import org.compiere.model.MInOut;
import org.compiere.model.MInvoice;
import org.compiere.model.X_C_Invoice;
import org.compiere.model.X_C_Order;
import org.compiere.model.X_M_InOut;
import andromedia.midsuit.form.MID_WCreateFromInvoice;
import andromedia.midsuit.form.MID_WCreateFromOrder;
import andromedia.midsuit.form.MID_WCreateFromShipment;
@ -17,6 +21,8 @@ public class MID_CreateFromFactory implements ICreateFromFactory{
return new MID_WCreateFromOrder(mTab);
if (tableName.equals(X_M_InOut.Table_Name))
return new MID_WCreateFromShipment(mTab);
if (tableName.equals(X_C_Invoice.Table_Name))
return new MID_WCreateFromInvoice(mTab);
return null;
}

View File

@ -12,8 +12,10 @@ import org.compiere.model.MTable;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.eevolution.model.MDDOrder;
import andromedia.midsuit.doc.MID_DocAnalysis;
import andromedia.midsuit.doc.MID_DocDDOrder;
import andromedia.midsuit.doc.MID_DocInvoice;
import andromedia.midsuit.doc.MID_DocMRPPPO;
import andromedia.midsuit.doc.MID_DocMidRequsiition;
@ -63,7 +65,11 @@ public class MID_DocFactory implements IDocFactory{
return new MID_DocAnalysis(as, rs, trxName);
if(tableName.equals(MInvoice.Table_Name)) {
s_log.log(Level.SEVERE,"IN");
return new MID_DocInvoice(as, rs, trxName);}
return new MID_DocInvoice(as, rs, trxName);
}
if(tableName.equals(MDDOrder.Table_Name))
return new MID_DocDDOrder(as, rs, trxName);
return null;
}

View File

@ -15,6 +15,8 @@ import andromedia.midsuit.model.MID_AnalysisLine;
import andromedia.midsuit.model.MID_AnalysisPro;
import andromedia.midsuit.model.MID_MBillingList;
import andromedia.midsuit.model.MID_MBillingListLine;
import andromedia.midsuit.model.MID_MDDOrder;
import andromedia.midsuit.model.MID_MDDOrderLine;
import andromedia.midsuit.model.MID_MProductionConfirm;
import andromedia.midsuit.model.MID_MRequisitionTrx;
import andromedia.midsuit.model.MID_MRequisitionTrxLine;
@ -36,6 +38,8 @@ public class MID_ModelFactory implements IModelFactory{
mapTableModels.put(MID_Analysis.Table_Name, "andromedia.midsuit.model.MID_Analysis");
mapTableModels.put(MID_AnalysisPro.Table_Name, "andromedia.midsuit.model.MID_AnalysisPro");
mapTableModels.put(MID_AnalysisLine.Table_Name, "andromedia.midsuit.model.MID_AnalysisLine");
mapTableModels.put(MID_MDDOrder.Table_Name, "andromedia.midsuit.model.MID_MDDOrder");
mapTableModels.put(MID_MDDOrderLine.Table_Name, "andromedia.midsuit.model.MID_MDDOrderLine");
}
@Override

View File

@ -0,0 +1,619 @@
package andromedia.midsuit.form;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Vector;
import java.util.logging.Level;
import org.compiere.apps.IStatusBar;
import org.compiere.grid.CreateFrom;
import org.compiere.minigrid.IMiniTable;
import org.compiere.model.GridTab;
import org.compiere.model.MCurrency;
import org.compiere.model.MInOut;
import org.compiere.model.MInOutLine;
import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
import org.compiere.model.MInvoicePaySchedule;
import org.compiere.model.MOrder;
import org.compiere.model.MOrderLine;
import org.compiere.model.MOrderPaySchedule;
import org.compiere.model.MProduct;
import org.compiere.model.MRMA;
import org.compiere.model.MRMALine;
import org.compiere.model.MUOMConversion;
import org.compiere.model.PO;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
public abstract class MID_CreateFromInvoice extends CreateFrom {
protected MInOut m_inout = null;
/**
* Protected Constructor
* @param mTab MTab
*/
public MID_CreateFromInvoice(GridTab mTab)
{
super(mTab);
if (log.isLoggable(Level.INFO)) log.info(mTab.toString());
} // VCreateFromInvoice
/**
* Dynamic Init
* @return true if initialized
*/
public boolean dynInit() throws Exception
{
log.config("");
setTitle(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false) + " .. " + Msg.translate(Env.getCtx(), "CreateFrom"));
return true;
} // dynInit
/**
* Load PBartner dependent Order/Invoice/Shipment Field.
* @param C_BPartner_ID
*/
protected ArrayList<KeyNamePair> loadShipmentData (int C_BPartner_ID)
{
String isSOTrxParam = isSOTrx ? "Y":"N";
ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();
// Display
StringBuffer display = new StringBuffer("s.DocumentNo||' - '||")
.append(DB.TO_CHAR("s.MovementDate", DisplayType.Date, Env.getAD_Language(Env.getCtx())));
//
StringBuffer sql = new StringBuffer("SELECT s.M_InOut_ID,").append(display)
.append(" FROM M_InOut s "
+ "WHERE s.C_BPartner_ID=? AND s.IsSOTrx=? AND s.DocStatus IN ('CL','CO')"
+ " AND s.M_InOut_ID IN "
+ "(SELECT sl.M_InOut_ID FROM M_InOutLine sl");
if(!isSOTrx)
sql.append(" LEFT OUTER JOIN M_MatchInv mi ON (sl.M_InOutLine_ID=mi.M_InOutLine_ID) "
+ " JOIN M_InOut s2 ON (sl.M_InOut_ID=s2.M_InOut_ID) "
+ " WHERE s2.C_BPartner_ID=? AND s2.IsSOTrx=? AND s2.DocStatus IN ('CL','CO') "
+ " GROUP BY sl.M_InOut_ID,sl.MovementQty,mi.M_InOutLine_ID"
+ " HAVING (sl.MovementQty<>SUM(mi.Qty) AND mi.M_InOutLine_ID IS NOT NULL)"
+ " OR mi.M_InOutLine_ID IS NULL ");
else
sql.append(" INNER JOIN M_InOut s2 ON (sl.M_InOut_ID=s2.M_InOut_ID)"
+ " LEFT JOIN C_InvoiceLine il ON sl.M_InOutLine_ID = il.M_InOutLine_ID"
+ " WHERE s2.C_BPartner_ID=? AND s2.IsSOTrx=? AND s2.DocStatus IN ('CL','CO')"
+ " GROUP BY sl.M_InOutLine_ID"
+ " HAVING sl.MovementQty - sum(COALESCE(il.QtyInvoiced,0)) > 0");
sql.append(") ORDER BY s.MovementDate");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, C_BPartner_ID);
pstmt.setString(2, isSOTrxParam);
pstmt.setInt(3, C_BPartner_ID);
pstmt.setString(4, isSOTrxParam);
rs = pstmt.executeQuery();
while (rs.next())
{
list.add(new KeyNamePair(rs.getInt(1), rs.getString(2)));
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
return list;
}
/**
* Load PBartner dependent Order/Invoice/Shipment Field.
* @param C_BPartner_ID BPartner
*/
protected ArrayList<KeyNamePair> loadRMAData(int C_BPartner_ID) {
ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();
String sqlStmt = "SELECT r.M_RMA_ID, r.DocumentNo || '-' || r.Amt from M_RMA r "
+ "WHERE ISSOTRX='N' AND r.DocStatus in ('CO', 'CL') "
+ "AND r.C_BPartner_ID=? "
+ "AND NOT EXISTS (SELECT * FROM C_Invoice inv "
+ "WHERE inv.M_RMA_ID=r.M_RMA_ID AND inv.DocStatus IN ('CO', 'CL'))";
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = DB.prepareStatement(sqlStmt, null);
pstmt.setInt(1, C_BPartner_ID);
rs = pstmt.executeQuery();
while (rs.next()) {
list.add(new KeyNamePair(rs.getInt(1), rs.getString(2)));
}
} catch (SQLException e) {
log.log(Level.SEVERE, sqlStmt.toString(), e);
} finally{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
return list;
}
/**
* Load Data - Shipment not invoiced
* @param M_InOut_ID InOut
*/
protected Vector<Vector<Object>> getShipmentData(int M_InOut_ID)
{
if (log.isLoggable(Level.CONFIG)) log.config("M_InOut_ID=" + M_InOut_ID);
MInOut inout = new MInOut(Env.getCtx(), M_InOut_ID, null);
p_order = null;
m_inout = inout;
if (inout.getC_Order_ID() != 0)
p_order = new MOrder (Env.getCtx(), inout.getC_Order_ID(), null);
m_rma = null;
if (inout.getM_RMA_ID() != 0)
m_rma = new MRMA (Env.getCtx(), inout.getM_RMA_ID(), null);
//
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
StringBuilder sql = new StringBuilder("SELECT "); // QtyEntered
if(!isSOTrx)
sql.append("l.MovementQty-SUM(COALESCE(mi.Qty, 0)),");
else
sql.append("l.MovementQty-SUM(COALESCE(il.QtyInvoiced,0)),");
sql.append(" l.QtyEntered/l.MovementQty,"
+ " l.C_UOM_ID, COALESCE(uom.UOMSymbol, uom.Name)," // 3..4
+ " l.M_Product_ID, p.Name, po.VendorProductNo, l.M_InOutLine_ID, l.Line," // 5..9
+ " l.C_OrderLine_ID " // 10
+ " FROM M_InOutLine l "
);
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)");
else
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("')");
sql.append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)")
.append(" INNER JOIN M_InOut io ON (l.M_InOut_ID=io.M_InOut_ID)");
if(!isSOTrx)
sql.append(" LEFT OUTER JOIN M_MatchInv mi ON (l.M_InOutLine_ID=mi.M_InOutLine_ID)");
else
sql.append(" LEFT JOIN C_InvoiceLine il ON l.M_InOutLine_ID = il.M_InOutLine_ID");
sql.append(" LEFT OUTER JOIN M_Product_PO po ON (l.M_Product_ID = po.M_Product_ID AND io.C_BPartner_ID = po.C_BPartner_ID)")
.append(" WHERE l.M_InOut_ID=? AND l.MovementQty<>0 ")
.append("GROUP BY l.MovementQty, l.QtyEntered/l.MovementQty, "
+ "l.C_UOM_ID, COALESCE(uom.UOMSymbol, uom.Name), "
+ "l.M_Product_ID, p.Name, po.VendorProductNo, l.M_InOutLine_ID, l.Line, l.C_OrderLine_ID ");
if(!isSOTrx)
sql.append(" HAVING l.MovementQty-SUM(COALESCE(mi.Qty, 0)) <>0");
else
sql.append(" HAVING l.MovementQty-SUM(COALESCE(il.QtyInvoiced,0)) <>0");
sql.append("ORDER BY l.Line");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, M_InOut_ID);
rs = pstmt.executeQuery();
while (rs.next())
{
Vector<Object> line = new Vector<Object>(7);
line.add(new Boolean(false)); // 0-Selection
BigDecimal qtyMovement = rs.getBigDecimal(1);
BigDecimal multiplier = rs.getBigDecimal(2);
BigDecimal qtyEntered = qtyMovement.multiply(multiplier);
line.add(qtyEntered); // 1-Qty
KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim());
line.add(pp); // 2-UOM
pp = new KeyNamePair(rs.getInt(5), rs.getString(6));
line.add(pp); // 3-Product
line.add(rs.getString(7)); // 4-VendorProductNo
int C_OrderLine_ID = rs.getInt(10);
if (rs.wasNull())
line.add(null); // 5-Order
else
line.add(new KeyNamePair(C_OrderLine_ID,"."));
pp = new KeyNamePair(rs.getInt(8), rs.getString(9));
line.add(pp); // 6-Ship
line.add(null); // 7-RMA
data.add(line);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
return data;
} // loadShipment
/**
* Load RMA details
* @param M_RMA_ID RMA
*/
protected Vector<Vector<Object>> getRMAData(int M_RMA_ID)
{
p_order = null;
// MRMA m_rma = new MRMA(Env.getCtx(), M_RMA_ID, null);
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
StringBuilder sqlStmt = new StringBuilder();
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - COALESCE(rl.QtyInvoiced, 0), 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 ");
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
{
sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=iol.C_UOM_ID) ");
}
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(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("WHERE rl.M_RMA_ID=? ");
sqlStmt.append("AND rl.M_INOUTLINE_ID IS NOT NULL");
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("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"))
{
sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=100) ");
}
else
{
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("WHERE rl.M_RMA_ID=? ");
sqlStmt.append("AND rl.C_Charge_ID IS NOT NULL");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sqlStmt.toString(), null);
pstmt.setInt(1, M_RMA_ID);
pstmt.setInt(2, M_RMA_ID);
rs = pstmt.executeQuery();
while (rs.next())
{
Vector<Object> line = new Vector<Object>(7);
line.add(new Boolean(false)); // 0-Selection
line.add(rs.getBigDecimal(3)); // 1-Qty
KeyNamePair pp = new KeyNamePair(rs.getInt(6), rs.getString(7));
line.add(pp); // 2-UOM
pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
line.add(pp); // 3-Product
line.add(null); //4-Vendor Product No
line.add(null); //5-Order
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
line.add(null); //6-Ship
line.add(pp); //7-RMA
data.add(line);
}
}
catch (Exception ex)
{
log.log(Level.SEVERE, sqlStmt.toString(), ex);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
return data;
}
/**
* List number of rows selected
*/
public void info(IMiniTable miniTable, IStatusBar statusBar)
{
} // infoInvoice
protected void configureMiniTable (IMiniTable miniTable)
{
miniTable.setColumnClass(0, Boolean.class, false); // 0-Selection
miniTable.setColumnClass(1, BigDecimal.class, true); // 1-Qty
miniTable.setColumnClass(2, String.class, true); // 2-UOM
miniTable.setColumnClass(3, String.class, true); // 3-Product
miniTable.setColumnClass(4, String.class, true); // 4-VendorProductNo
miniTable.setColumnClass(5, String.class, true); // 5-Order
miniTable.setColumnClass(6, String.class, true); // 6-Ship
miniTable.setColumnClass(7, String.class, true); // 7-Invoice
// Table UI
miniTable.autoSize();
}
/**
* Save - Create Invoice Lines
* @return true if saved
*/
public boolean save(IMiniTable miniTable, String trxName)
{
// Invoice
int C_Invoice_ID = ((Integer)getGridTab().getValue("C_Invoice_ID")).intValue();
MInvoice invoice = new MInvoice (Env.getCtx(), C_Invoice_ID, trxName);
if (log.isLoggable(Level.CONFIG)) log.config(invoice.toString());
if (p_order != null)
{
invoice.setOrder(p_order); // overwrite header values
invoice.saveEx();
}
if (m_rma != null)
{
invoice.setM_RMA_ID(m_rma.getM_RMA_ID());
invoice.saveEx();
}
if (m_inout != null)
{
invoice.set_ValueNoCheck("M_InOut_ID", (int)m_inout.getM_InOut_ID());
invoice.saveEx();
}
// MInOut inout = null;
// if (m_M_InOut_ID > 0)
// {
// inout = new MInOut(Env.getCtx(), m_M_InOut_ID, trxName);
// }
// if (inout != null && inout.getM_InOut_ID() != 0
// && inout.getC_Invoice_ID() == 0) // only first time
// {
// inout.setC_Invoice_ID(C_Invoice_ID);
// inout.saveEx();
// }
// Lines
for (int i = 0; i < miniTable.getRowCount(); i++)
{
if (((Boolean)miniTable.getValueAt(i, 0)).booleanValue())
{
MProduct product = null;
// variable values
BigDecimal QtyEntered = (BigDecimal)miniTable.getValueAt(i, 1); // 1-Qty
KeyNamePair pp = (KeyNamePair)miniTable.getValueAt(i, 2); // 2-UOM
int C_UOM_ID = pp.getKey();
//
pp = (KeyNamePair)miniTable.getValueAt(i, 3); // 3-Product
int M_Product_ID = 0;
if (pp != null)
M_Product_ID = pp.getKey();
//
int C_OrderLine_ID = 0;
pp = (KeyNamePair)miniTable.getValueAt(i, 5); // 5-OrderLine
if (pp != null)
C_OrderLine_ID = pp.getKey();
int M_InOutLine_ID = 0;
pp = (KeyNamePair)miniTable.getValueAt(i, 6); // 6-Shipment
if (pp != null)
M_InOutLine_ID = pp.getKey();
//
int M_RMALine_ID = 0;
pp = (KeyNamePair)miniTable.getValueAt(i, 7); // 7-RMALine
if (pp != null)
M_RMALine_ID = pp.getKey();
// Precision of Qty UOM
int precision = 2;
if (M_Product_ID != 0)
{
product = MProduct.get(Env.getCtx(), M_Product_ID);
precision = product.getUOMPrecision();
}
QtyEntered = QtyEntered.setScale(precision, BigDecimal.ROUND_HALF_DOWN);
//
if (log.isLoggable(Level.FINE)) log.fine("Line QtyEntered=" + QtyEntered
+ ", Product_ID=" + M_Product_ID
+ ", OrderLine_ID=" + C_OrderLine_ID + ", InOutLine_ID=" + M_InOutLine_ID);
// Create new Invoice Line
MInvoiceLine invoiceLine = new MInvoiceLine (invoice);
invoiceLine.setM_Product_ID(M_Product_ID, C_UOM_ID); // Line UOM
invoiceLine.setQty(QtyEntered); // Invoiced/Entered
BigDecimal QtyInvoiced = null;
if (M_Product_ID > 0 && product.getC_UOM_ID() != C_UOM_ID) {
QtyInvoiced = MUOMConversion.convertProductFrom(Env.getCtx(), M_Product_ID, C_UOM_ID, QtyEntered);
}
if (QtyInvoiced == null)
QtyInvoiced = QtyEntered;
invoiceLine.setQtyInvoiced(QtyInvoiced);
// Info
MOrderLine orderLine = null;
if (C_OrderLine_ID != 0)
orderLine = new MOrderLine (Env.getCtx(), C_OrderLine_ID, trxName);
//
MRMALine rmaLine = null;
if (M_RMALine_ID > 0)
rmaLine = new MRMALine (Env.getCtx(), M_RMALine_ID, null);
//
MInOutLine inoutLine = null;
if (M_InOutLine_ID != 0)
{
inoutLine = new MInOutLine (Env.getCtx(), M_InOutLine_ID, trxName);
if (orderLine == null && inoutLine.getC_OrderLine_ID() != 0)
{
C_OrderLine_ID = inoutLine.getC_OrderLine_ID();
orderLine = new MOrderLine (Env.getCtx(), C_OrderLine_ID, trxName);
}
}
else if (C_OrderLine_ID > 0)
{
String whereClause = "EXISTS (SELECT 1 FROM M_InOut io WHERE io.M_InOut_ID=M_InOutLine.M_InOut_ID AND io.DocStatus IN ('CO','CL'))";
MInOutLine[] lines = MInOutLine.getOfOrderLine(Env.getCtx(),
C_OrderLine_ID, whereClause, trxName);
if (log.isLoggable(Level.FINE)) log.fine ("Receipt Lines with OrderLine = #" + lines.length);
if (lines.length > 0)
{
for (int j = 0; j < lines.length; j++)
{
MInOutLine line = lines[j];
if (line.getQtyEntered().compareTo(QtyEntered) == 0)
{
inoutLine = line;
M_InOutLine_ID = inoutLine.getM_InOutLine_ID();
break;
}
}
// if (inoutLine == null)
// {
// inoutLine = lines[0]; // first as default
// M_InOutLine_ID = inoutLine.getM_InOutLine_ID();
// }
}
}
else if (M_RMALine_ID != 0)
{
String whereClause = "EXISTS (SELECT 1 FROM M_InOut io WHERE io.M_InOut_ID=M_InOutLine.M_InOut_ID AND io.DocStatus IN ('CO','CL'))";
MInOutLine[] lines = MInOutLine.getOfRMALine(Env.getCtx(), M_RMALine_ID, whereClause, null);
if (log.isLoggable(Level.FINE)) log.fine ("Receipt Lines with RMALine = #" + lines.length);
if (lines.length > 0)
{
for (int j = 0; j < lines.length; j++)
{
MInOutLine line = lines[j];
if (rmaLine.getQty().compareTo(QtyEntered) == 0)
{
inoutLine = line;
M_InOutLine_ID = inoutLine.getM_InOutLine_ID();
break;
}
}
if (rmaLine == null)
{
inoutLine = lines[0]; // first as default
M_InOutLine_ID = inoutLine.getM_InOutLine_ID();
}
}
}
// get Ship info
// Shipment Info
if (inoutLine != null)
{
invoiceLine.setShipLine(inoutLine); // overwrites
}
else {
log.fine("No Receipt Line");
// Order Info
if (orderLine != null)
{
invoiceLine.setOrderLine(orderLine); // overwrites
}
else
{
log.fine("No Order Line");
invoiceLine.setPrice();
invoiceLine.setTax();
}
//RMA Info
if (rmaLine != null)
{
invoiceLine.setRMALine(rmaLine); // overwrites
}
else
log.fine("No RMA Line");
}
invoiceLine.saveEx();
} // if selected
} // for all rows
if (p_order != null) {
invoice.setPaymentRule(p_order.getPaymentRule());
invoice.setC_PaymentTerm_ID(p_order.getC_PaymentTerm_ID());
invoice.saveEx();
invoice.load(invoice.get_TrxName()); // refresh from DB
// copy payment schedule from order if invoice doesn't have a current payment schedule
MOrderPaySchedule[] opss = MOrderPaySchedule.getOrderPaySchedule(invoice.getCtx(), p_order.getC_Order_ID(), 0, invoice.get_TrxName());
MInvoicePaySchedule[] ipss = MInvoicePaySchedule.getInvoicePaySchedule(invoice.getCtx(), invoice.getC_Invoice_ID(), 0, invoice.get_TrxName());
if (ipss.length == 0 && opss.length > 0) {
BigDecimal ogt = p_order.getGrandTotal();
BigDecimal igt = invoice.getGrandTotal();
BigDecimal percent = Env.ONE;
if (ogt.compareTo(igt) != 0)
percent = igt.divide(ogt, 10, BigDecimal.ROUND_HALF_UP);
MCurrency cur = MCurrency.get(p_order.getCtx(), p_order.getC_Currency_ID());
int scale = cur.getStdPrecision();
for (MOrderPaySchedule ops : opss) {
MInvoicePaySchedule ips = new MInvoicePaySchedule(invoice.getCtx(), 0, invoice.get_TrxName());
PO.copyValues(ops, ips);
if (percent != Env.ONE) {
BigDecimal propDueAmt = ops.getDueAmt().multiply(percent);
if (propDueAmt.scale() > scale)
propDueAmt = propDueAmt.setScale(scale, BigDecimal.ROUND_HALF_UP);
ips.setDueAmt(propDueAmt);
}
ips.setC_Invoice_ID(invoice.getC_Invoice_ID());
ips.setAD_Org_ID(ops.getAD_Org_ID());
ips.setProcessing(ops.isProcessing());
ips.setIsActive(ops.isActive());
ips.saveEx();
}
invoice.validatePaySchedule();
invoice.saveEx();
}
invoice.set_ValueOfColumn("noaju1", p_order.get_ValueAsString("noaju1") == null ? null : p_order.get_ValueAsString("noaju1"));
invoice.set_ValueOfColumn("noaju2", p_order.get_ValueAsString("noaju2") == null ? null : p_order.get_ValueAsString("noaju2"));
invoice.set_ValueOfColumn("noaju3", p_order.get_ValueAsString("noaju3") == null ? null : p_order.get_ValueAsString("noaju3"));
invoice.set_ValueOfColumn("noaju4", p_order.get_ValueAsString("noaju4") == null ? null : p_order.get_ValueAsString("noaju4"));
invoice.saveEx();
}
return true;
} // saveInvoice
protected Vector<String> getOISColumnNames()
{
// Header Info
Vector<String> columnNames = new Vector<String>(7);
columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
columnNames.add(Msg.translate(Env.getCtx(), "Quantity"));
columnNames.add(Msg.translate(Env.getCtx(), "C_UOM_ID"));
columnNames.add(Msg.translate(Env.getCtx(), "M_Product_ID"));
columnNames.add(Msg.getElement(Env.getCtx(), "VendorProductNo", isSOTrx));
columnNames.add(Msg.getElement(Env.getCtx(), "C_Order_ID", isSOTrx));
columnNames.add(Msg.getElement(Env.getCtx(), "M_InOut_ID", isSOTrx));
columnNames.add(Msg.getElement(Env.getCtx(), "M_RMA_ID", isSOTrx));
return columnNames;
}
}

View File

@ -568,7 +568,7 @@ public class MID_CreateFromOrder extends CreateFrom {
}
}
}
order.setDescription(order.getDescription()==null? desc : order.getDescription()+";"+desc);
// order.setDescription(order.getDescription()==null? desc : order.getDescription()+";"+desc);
order.saveEx();
return true;
}

View File

@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Vector;
import java.util.logging.Level;
import org.adempiere.webui.panel.InfoInOutPanel;
import org.compiere.apps.IStatusBar;
import org.compiere.grid.CreateFrom;
import org.compiere.minigrid.IMiniTable;
@ -707,8 +708,11 @@ public abstract class MID_CreateFromShipment extends CreateFrom
inout.setC_Activity_ID(p_order.getC_Activity_ID());
inout.setUser1_ID(p_order.getUser1_ID());
inout.setUser2_ID(p_order.getUser2_ID());
inout.setDateOrdered(p_order.getDateOrdered());
inout.set_ValueOfColumn("noaju1", p_order.get_ValueAsString("noaju1") == null ? null : p_order.get_ValueAsString("noaju1"));
inout.set_ValueOfColumn("noaju2", p_order.get_ValueAsString("noaju2") == null ? null : p_order.get_ValueAsString("noaju2"));
inout.set_ValueOfColumn("noaju3", p_order.get_ValueAsString("noaju3") == null ? null : p_order.get_ValueAsString("noaju3"));
inout.set_ValueOfColumn("noaju4", p_order.get_ValueAsString("noaju4") == null ? null : p_order.get_ValueAsString("noaju4"));
if ( p_order.isDropShip() )
{
inout.setM_Warehouse_ID( p_order.getM_Warehouse_ID() );
@ -729,6 +733,10 @@ public abstract class MID_CreateFromShipment extends CreateFrom
inout.setC_Activity_ID(m_invoice.getC_Activity_ID());
inout.setUser1_ID(m_invoice.getUser1_ID());
inout.setUser2_ID(m_invoice.getUser2_ID());
inout.set_ValueOfColumn("noaju1", m_invoice.get_ValueAsString("noaju1") == null ? null : m_invoice.get_ValueAsString("noaju1"));
inout.set_ValueOfColumn("noaju2", m_invoice.get_ValueAsString("noaju2") == null ? null : m_invoice.get_ValueAsString("noaju2"));
inout.set_ValueOfColumn("noaju3", m_invoice.get_ValueAsString("noaju3") == null ? null : m_invoice.get_ValueAsString("noaju3"));
inout.set_ValueOfColumn("noaju4", m_invoice.get_ValueAsString("noaju4") == null ? null : m_invoice.get_ValueAsString("noaju4"));
}
if (m_rma != null && m_rma.getM_RMA_ID() != 0)
{
@ -783,5 +791,4 @@ public abstract class MID_CreateFromShipment extends CreateFrom
defaultLocator_ID = M_Locator_ID;
return getInvoiceData (C_Invoice_ID);
}
}

View File

@ -0,0 +1,475 @@
package andromedia.midsuit.form;
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_BPARTNER_ID;
import java.util.ArrayList;
import java.util.Vector;
import java.util.logging.Level;
import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.form.WCreateFromInvoiceUI;
import org.adempiere.webui.apps.form.WCreateFromWindow;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.ListModelTable;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.grid.CreateFromInvoice;
import org.compiere.model.GridTab;
import org.compiere.model.MDocType;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.util.CLogger;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Space;
public class MID_WCreateFromInvoice extends MID_CreateFromInvoice implements EventListener<Event>, ValueChangeListener
{
private WCreateFromWindow window;
public MID_WCreateFromInvoice(GridTab tab)
{
super(tab);
log.info(getGridTab().toString());
window = new WCreateFromWindow(this, getGridTab().getWindowNo());
p_WindowNo = getGridTab().getWindowNo();
try
{
if (!dynInit())
return;
zkInit();
setInitOK(true);
}
catch(Exception e)
{
log.log(Level.SEVERE, "", e);
setInitOK(false);
}
AEnv.showWindow(window);
}
/** Window No */
private int p_WindowNo;
/** Logger */
private CLogger log = CLogger.getCLogger(getClass());
protected Label bPartnerLabel = new Label();
protected WEditor bPartnerField;
protected Label orderLabel = new Label();
protected Listbox orderField = ListboxFactory.newDropdownListbox();
protected Label shipmentLabel = new Label();
protected Listbox shipmentField = ListboxFactory.newDropdownListbox();
/** Label for the rma selection */
protected Label rmaLabel = new Label();
/** Combo box for selecting RMA document */
protected Listbox rmaField = ListboxFactory.newDropdownListbox();
private Grid parameterStdLayout;
/**
* Dynamic Init
* @throws Exception if Lookups cannot be initialized
* @return true if initialized
*/
public boolean dynInit() throws Exception
{
log.config("");
super.dynInit();
window.setTitle(getTitle());
// RMA Selection option should only be available for AP Credit Memo
Integer docTypeId = (Integer)getGridTab().getValue("C_DocTypeTarget_ID");
MDocType docType = MDocType.get(Env.getCtx(), docTypeId);
if (!MDocType.DOCBASETYPE_APCreditMemo.equals(docType.getDocBaseType()))
{
rmaLabel.setVisible(false);
rmaField.setVisible(false);
}
initBPartner(true);
bPartnerField.addValueChangeListener(this);
return true;
} // dynInit
protected void zkInit() throws Exception
{
bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID"));
orderLabel.setText(Msg.getElement(Env.getCtx(), "C_Order_ID", isSOTrx));
shipmentLabel.setText(Msg.getElement(Env.getCtx(), "M_InOut_ID", isSOTrx));
rmaLabel.setText(Msg.translate(Env.getCtx(), "M_RMA_ID"));
Panel parameterPanel = window.getParameterPanel();
parameterStdLayout = GridFactory.newGridLayout();
Panel parameterStdPanel = new Panel();
parameterStdPanel.appendChild(parameterStdLayout);
setupColumns(parameterStdLayout);
parameterPanel.appendChild(parameterStdPanel);
ZKUpdateUtil.setVflex(parameterStdLayout, "min");
Rows rows = (Rows) parameterStdLayout.newRows();
Row row = rows.newRow();
row.appendChild(bPartnerLabel.rightAlign());
if (bPartnerField != null)
row.appendChild(bPartnerField.getComponent());
row.appendChild(orderLabel.rightAlign());
ZKUpdateUtil.setHflex(orderField, "1");
row.appendChild(orderField);
row = rows.newRow();
row.appendChild(new Space());
row.appendChild(new Space());
row.appendChild(shipmentLabel.rightAlign());
ZKUpdateUtil.setHflex(shipmentField, "1");
row.appendChild(shipmentField);
// Add RMA document selection to panel
row = rows.newRow();
row.appendChild(new Space());
row.appendChild(new Space());
row.appendChild(rmaLabel.rightAlign());
ZKUpdateUtil.setHflex(rmaField, "1");
row.appendChild(rmaField);
if (ClientInfo.isMobile()) {
if (noOfParameterColumn == 2)
LayoutUtils.compactTo(parameterStdLayout, 2);
ClientInfo.onClientInfo(window, this::onClientInfo);
}
hideEmptyRow(rows);
}
private void hideEmptyRow(org.zkoss.zul.Rows rows) {
for(Component a : rows.getChildren()) {
Row row = (Row) a;
boolean visible = false;
for(Component b : row.getChildren()) {
if (b instanceof Space)
continue;
else if (!b.isVisible()) {
continue;
} else {
if (!b.getChildren().isEmpty()) {
for (Component c : b.getChildren()) {
if (c.isVisible()) {
visible = true;
break;
}
}
} else {
visible = true;
break;
}
}
}
row.setVisible(visible);
}
}
private boolean m_actionActive = false;
private int noOfParameterColumn;
/**
* Action Listener
* @param e event
* @throws Exception
*/
public void onEvent(Event e) throws Exception
{
if (m_actionActive)
return;
m_actionActive = true;
// Order
if (e.getTarget().equals(orderField))
{
ListItem li = orderField.getSelectedItem();
int C_Order_ID = 0;
if (li != null && li.getValue() != null)
C_Order_ID = ((Integer) li.getValue()).intValue();
// set Invoice, RMA and Shipment to Null
rmaField.setSelectedIndex(-1);
shipmentField.setSelectedIndex(-1);
loadOrder(C_Order_ID, true);
}
// Shipment
else if (e.getTarget().equals(shipmentField))
{
ListItem li = shipmentField.getSelectedItem();
int M_InOut_ID = 0;
if (li != null && li.getValue() != null)
M_InOut_ID = ((Integer) li.getValue()).intValue();
// set Order, RMA and Invoice to Null
orderField.setSelectedIndex(-1);
rmaField.setSelectedIndex(-1);
loadShipment(M_InOut_ID);
}
// RMA
else if (e.getTarget().equals(rmaField))
{
ListItem li = rmaField.getSelectedItem();
int M_RMA_ID = 0;
if (li != null && li.getValue() != null)
M_RMA_ID = ((Integer) li.getValue()).intValue();
// set Order and Invoice to Null
orderField.setSelectedIndex(-1);
shipmentField.setSelectedIndex(-1);
loadRMA(M_RMA_ID);
}
m_actionActive = false;
}
/**
* Change Listener
* @param e event
*/
public void valueChange (ValueChangeEvent e)
{
if (log.isLoggable(Level.CONFIG)) log.config(e.getPropertyName() + "=" + e.getNewValue());
// BPartner - load Order/Invoice/Shipment
if (e.getPropertyName().equals("C_BPartner_ID"))
{
int C_BPartner_ID = ((Integer)e.getNewValue()).intValue();
initBPOrderDetails (C_BPartner_ID, true);
}
window.tableChanged(null);
} // vetoableChange
/**************************************************************************
* Load BPartner Field
* @param forInvoice true if Invoices are to be created, false receipts
* @throws Exception if Lookups cannot be initialized
*/
protected void initBPartner (boolean forInvoice) throws Exception
{
// load BPartner
int AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID
MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.Search);
bPartnerField = new WSearchEditor ("C_BPartner_ID", true, false, true, lookup);
//
int C_BPartner_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
bPartnerField.setValue(new Integer(C_BPartner_ID));
// initial loading
initBPOrderDetails(C_BPartner_ID, forInvoice);
} // initBPartner
/**
* Load PBartner dependent Order/Invoice/Shipment Field.
* @param C_BPartner_ID BPartner
* @param forInvoice for invoice
*/
protected void initBPOrderDetails (int C_BPartner_ID, boolean forInvoice)
{
if (log.isLoggable(Level.CONFIG)) log.config("C_BPartner_ID=" + C_BPartner_ID);
KeyNamePair pp = new KeyNamePair(0,"");
// load PO Orders - Closed, Completed
orderField.removeActionListener(this);
orderField.removeAllItems();
orderField.addItem(pp);
ArrayList<KeyNamePair> list = loadOrderData(C_BPartner_ID, forInvoice, false);
for(KeyNamePair knp : list)
orderField.addItem(knp);
orderField.setSelectedIndex(0);
orderField.addActionListener(this);
initBPDetails(C_BPartner_ID);
} // initBPartnerOIS
public void initBPDetails(int C_BPartner_ID)
{
initBPShipmentDetails(C_BPartner_ID);
initBPRMADetails(C_BPartner_ID);
}
/**
* Load PBartner dependent Order/Invoice/Shipment Field.
* @param C_BPartner_ID
*/
private void initBPShipmentDetails(int C_BPartner_ID)
{
if (log.isLoggable(Level.CONFIG)) log.config("C_BPartner_ID" + C_BPartner_ID);
// load Shipments (Receipts) - Completed, Closed
shipmentField.removeActionListener(this);
shipmentField.removeAllItems();
// None
KeyNamePair pp = new KeyNamePair(0,"");
shipmentField.addItem(pp);
ArrayList<KeyNamePair> list = loadShipmentData(C_BPartner_ID);
for(KeyNamePair knp : list)
shipmentField.addItem(knp);
shipmentField.setSelectedIndex(0);
shipmentField.addActionListener(this);
}
/**
* Load RMA that are candidates for shipment
* @param C_BPartner_ID BPartner
*/
private void initBPRMADetails(int C_BPartner_ID)
{
rmaField.removeActionListener(this);
rmaField.removeAllItems();
// None
KeyNamePair pp = new KeyNamePair(0,"");
rmaField.addItem(pp);
ArrayList<KeyNamePair> list = loadRMAData(C_BPartner_ID);
for(KeyNamePair knp : list)
rmaField.addItem(knp);
rmaField.setSelectedIndex(0);
rmaField.addActionListener(this);
}
/**
* Load Data - Order
* @param C_Order_ID Order
* @param forInvoice true if for invoice vs. delivery qty
*/
protected void loadOrder (int C_Order_ID, boolean forInvoice)
{
loadTableOIS(getOrderData(C_Order_ID, forInvoice));
} // LoadOrder
protected void loadRMA (int M_RMA_ID)
{
loadTableOIS(getRMAData(M_RMA_ID));
}
protected void loadShipment (int M_InOut_ID)
{
loadTableOIS(getShipmentData(M_InOut_ID));
}
/**
* Load Order/Invoice/Shipment data into Table
* @param data data
*/
protected void loadTableOIS (Vector<?> data)
{
window.getWListbox().clear();
// Remove previous listeners
window.getWListbox().getModel().removeTableModelListener(window);
// Set Model
ListModelTable model = new ListModelTable(data);
model.addTableModelListener(window);
window.getWListbox().setData(model, getOISColumnNames());
//
configureMiniTable(window.getWListbox());
} // loadOrder
public void showWindow()
{
window.setVisible(true);
}
public void closeWindow()
{
window.dispose();
}
@Override
public Object getWindow() {
return window;
}
protected void setupColumns(Grid parameterGrid) {
noOfParameterColumn = ClientInfo.maxWidth((ClientInfo.EXTRA_SMALL_WIDTH+ClientInfo.SMALL_WIDTH)/2) ? 2 : 4;
Columns columns = new Columns();
parameterGrid.appendChild(columns);
if (ClientInfo.maxWidth((ClientInfo.EXTRA_SMALL_WIDTH+ClientInfo.SMALL_WIDTH)/2))
{
Column column = new Column();
ZKUpdateUtil.setWidth(column, "35%");
columns.appendChild(column);
column = new Column();
ZKUpdateUtil.setWidth(column, "65%");
columns.appendChild(column);
}
else
{
Column column = new Column();
columns.appendChild(column);
column = new Column();
ZKUpdateUtil.setWidth(column, "15%");
columns.appendChild(column);
ZKUpdateUtil.setWidth(column, "35%");
column = new Column();
ZKUpdateUtil.setWidth(column, "15%");
columns.appendChild(column);
column = new Column();
ZKUpdateUtil.setWidth(column, "35%");
columns.appendChild(column);
}
}
protected void onClientInfo()
{
if (ClientInfo.isMobile() && parameterStdLayout != null && parameterStdLayout.getRows() != null)
{
int nc = ClientInfo.maxWidth((ClientInfo.EXTRA_SMALL_WIDTH+ClientInfo.SMALL_WIDTH)/2) ? 2 : 4;
int cc = noOfParameterColumn;
if (nc == cc)
return;
parameterStdLayout.getColumns().detach();
setupColumns(parameterStdLayout);
if (cc > nc)
{
LayoutUtils.compactTo(parameterStdLayout, nc);
}
else
{
LayoutUtils.expandTo(parameterStdLayout, nc, false);
}
hideEmptyRow(parameterStdLayout.getRows());
ZKUpdateUtil.setCSSHeight(window);
ZKUpdateUtil.setCSSWidth(window);
window.invalidate();
}
}
}

View File

@ -64,7 +64,7 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Space;
import org.zkoss.zul.Vlayout;
public class MID_WCreateFromShipment extends CreateFromShipment implements EventListener<Event>, ValueChangeListener
public class MID_WCreateFromShipment extends MID_CreateFromShipment implements EventListener<Event>, ValueChangeListener
{
private WCreateFromWindow window;
@ -221,7 +221,7 @@ public class MID_WCreateFromShipment extends CreateFromShipment implements Event
}
}
private boolean m_actionActive = false;
private boolean m_actionActive = false;
/**
* Action Listener

View File

@ -0,0 +1,904 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package andromedia.midsuit.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.model.*;
import org.compiere.util.KeyNamePair;
/** Generated Interface for DD_Order
* @author iDempiere (generated)
* @version Release 4.1
*/
@SuppressWarnings("all")
public interface I_DD_Order
{
/** TableName=DD_Order */
public static final String Table_Name = "DD_Order";
/** AD_Table_ID=1800015 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_OrgTrx_ID */
public static final String COLUMNNAME_AD_OrgTrx_ID = "AD_OrgTrx_ID";
/** Set Trx Organization.
* Performing or initiating organization
*/
public void setAD_OrgTrx_ID (int AD_OrgTrx_ID);
/** Get Trx Organization.
* Performing or initiating organization
*/
public int getAD_OrgTrx_ID();
/** Column name AD_User_ID */
public static final String COLUMNNAME_AD_User_ID = "AD_User_ID";
/** Set User/Contact.
* User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID);
/** Get User/Contact.
* User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID();
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException;
/** Column name C_Activity_ID */
public static final String COLUMNNAME_C_Activity_ID = "C_Activity_ID";
/** Set Activity.
* Business Activity
*/
public void setC_Activity_ID (int C_Activity_ID);
/** Get Activity.
* Business Activity
*/
public int getC_Activity_ID();
public org.compiere.model.I_C_Activity getC_Activity() throws RuntimeException;
/** Column name C_BPartner_ID */
public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID";
/** Set Business Partner .
* Identifies a Business Partner
*/
public void setC_BPartner_ID (int C_BPartner_ID);
/** Get Business Partner .
* Identifies a Business Partner
*/
public int getC_BPartner_ID();
public org.compiere.model.I_C_BPartner getC_BPartner() throws RuntimeException;
/** Column name C_BPartner_Location_ID */
public static final String COLUMNNAME_C_BPartner_Location_ID = "C_BPartner_Location_ID";
/** Set Partner Location.
* Identifies the (ship to) address for this Business Partner
*/
public void setC_BPartner_Location_ID (int C_BPartner_Location_ID);
/** Get Partner Location.
* Identifies the (ship to) address for this Business Partner
*/
public int getC_BPartner_Location_ID();
public org.compiere.model.I_C_BPartner_Location getC_BPartner_Location() throws RuntimeException;
/** Column name C_Campaign_ID */
public static final String COLUMNNAME_C_Campaign_ID = "C_Campaign_ID";
/** Set DIvision.
* Division
*/
public void setC_Campaign_ID (int C_Campaign_ID);
/** Get DIvision.
* Division
*/
public int getC_Campaign_ID();
public org.compiere.model.I_C_Campaign getC_Campaign() throws RuntimeException;
/** Column name C_Charge_ID */
public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID";
/** Set Charge.
* Additional document charges
*/
public void setC_Charge_ID (int C_Charge_ID);
/** Get Charge.
* Additional document charges
*/
public int getC_Charge_ID();
public org.compiere.model.I_C_Charge getC_Charge() throws RuntimeException;
/** Column name C_DocType_ID */
public static final String COLUMNNAME_C_DocType_ID = "C_DocType_ID";
/** Set Document Type.
* Document type or rules
*/
public void setC_DocType_ID (int C_DocType_ID);
/** Get Document Type.
* Document type or rules
*/
public int getC_DocType_ID();
public org.compiere.model.I_C_DocType getC_DocType() throws RuntimeException;
/** Column name C_Invoice_ID */
public static final String COLUMNNAME_C_Invoice_ID = "C_Invoice_ID";
/** Set Invoice.
* Invoice Identifier
*/
public void setC_Invoice_ID (int C_Invoice_ID);
/** Get Invoice.
* Invoice Identifier
*/
public int getC_Invoice_ID();
public org.compiere.model.I_C_Invoice getC_Invoice() throws RuntimeException;
/** Column name C_Order_ID */
public static final String COLUMNNAME_C_Order_ID = "C_Order_ID";
/** Set Order.
* Order
*/
public void setC_Order_ID (int C_Order_ID);
/** Get Order.
* Order
*/
public int getC_Order_ID();
public org.compiere.model.I_C_Order getC_Order() throws RuntimeException;
/** Column name C_Project_ID */
public static final String COLUMNNAME_C_Project_ID = "C_Project_ID";
/** Set Project.
* Financial Project
*/
public void setC_Project_ID (int C_Project_ID);
/** Get Project.
* Financial Project
*/
public int getC_Project_ID();
public org.compiere.model.I_C_Project getC_Project() throws RuntimeException;
/** Column name ChargeAmt */
public static final String COLUMNNAME_ChargeAmt = "ChargeAmt";
/** Set Charge amount.
* Charge Amount
*/
public void setChargeAmt (BigDecimal ChargeAmt);
/** Get Charge amount.
* Charge Amount
*/
public BigDecimal getChargeAmt();
/** Column name CreateConfirm */
public static final String COLUMNNAME_CreateConfirm = "CreateConfirm";
/** Set Create Confirm */
public void setCreateConfirm (String CreateConfirm);
/** Get Create Confirm */
public String getCreateConfirm();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name CreateFrom */
public static final String COLUMNNAME_CreateFrom = "CreateFrom";
/** Set Create lines from.
* Process which will generate a new document lines based on an existing document
*/
public void setCreateFrom (String CreateFrom);
/** Get Create lines from.
* Process which will generate a new document lines based on an existing document
*/
public String getCreateFrom();
/** Column name CreatePackage */
public static final String COLUMNNAME_CreatePackage = "CreatePackage";
/** Set Create Package */
public void setCreatePackage (String CreatePackage);
/** Get Create Package */
public String getCreatePackage();
/** Column name DateOrdered */
public static final String COLUMNNAME_DateOrdered = "DateOrdered";
/** Set Date Ordered.
* Date of Order
*/
public void setDateOrdered (Timestamp DateOrdered);
/** Get Date Ordered.
* Date of Order
*/
public Timestamp getDateOrdered();
/** Column name DatePrinted */
public static final String COLUMNNAME_DatePrinted = "DatePrinted";
/** Set Date printed.
* Date the document was printed.
*/
public void setDatePrinted (Timestamp DatePrinted);
/** Get Date printed.
* Date the document was printed.
*/
public Timestamp getDatePrinted();
/** Column name DatePromised */
public static final String COLUMNNAME_DatePromised = "DatePromised";
/** Set Date Promised.
* Date Order was promised
*/
public void setDatePromised (Timestamp DatePromised);
/** Get Date Promised.
* Date Order was promised
*/
public Timestamp getDatePromised();
/** Column name DateReceived */
public static final String COLUMNNAME_DateReceived = "DateReceived";
/** Set Date received.
* Date a product was received
*/
public void setDateReceived (Timestamp DateReceived);
/** Get Date received.
* Date a product was received
*/
public Timestamp getDateReceived();
/** Column name DD_Order_ID */
public static final String COLUMNNAME_DD_Order_ID = "DD_Order_ID";
/** Set Distribution Order */
public void setDD_Order_ID (int DD_Order_ID);
/** Get Distribution Order */
public int getDD_Order_ID();
/** Column name DD_Order_UU */
public static final String COLUMNNAME_DD_Order_UU = "DD_Order_UU";
/** Set DD_Order_UU */
public void setDD_Order_UU (String DD_Order_UU);
/** Get DD_Order_UU */
public String getDD_Order_UU();
/** Column name DeliveryRule */
public static final String COLUMNNAME_DeliveryRule = "DeliveryRule";
/** Set Delivery Rule.
* Defines the timing of Delivery
*/
public void setDeliveryRule (String DeliveryRule);
/** Get Delivery Rule.
* Defines the timing of Delivery
*/
public String getDeliveryRule();
/** Column name DeliveryViaRule */
public static final String COLUMNNAME_DeliveryViaRule = "DeliveryViaRule";
/** Set Delivery Via.
* How the order will be delivered
*/
public void setDeliveryViaRule (String DeliveryViaRule);
/** Get Delivery Via.
* How the order will be delivered
*/
public String getDeliveryViaRule();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name DocAction */
public static final String COLUMNNAME_DocAction = "DocAction";
/** Set Document Action.
* The targeted status of the document
*/
public void setDocAction (String DocAction);
/** Get Document Action.
* The targeted status of the document
*/
public String getDocAction();
/** Column name DocStatus */
public static final String COLUMNNAME_DocStatus = "DocStatus";
/** Set Document Status.
* The current status of the document
*/
public void setDocStatus (String DocStatus);
/** Get Document Status.
* The current status of the document
*/
public String getDocStatus();
/** Column name DocumentNo */
public static final String COLUMNNAME_DocumentNo = "DocumentNo";
/** Set Document No.
* Document sequence number of the document
*/
public void setDocumentNo (String DocumentNo);
/** Get Document No.
* Document sequence number of the document
*/
public String getDocumentNo();
/** Column name FreightAmt */
public static final String COLUMNNAME_FreightAmt = "FreightAmt";
/** Set Freight Amount.
* Freight Amount
*/
public void setFreightAmt (BigDecimal FreightAmt);
/** Get Freight Amount.
* Freight Amount
*/
public BigDecimal getFreightAmt();
/** Column name FreightCostRule */
public static final String COLUMNNAME_FreightCostRule = "FreightCostRule";
/** Set Freight Cost Rule.
* Method for charging Freight
*/
public void setFreightCostRule (String FreightCostRule);
/** Get Freight Cost Rule.
* Method for charging Freight
*/
public String getFreightCostRule();
/** Column name GenerateTo */
public static final String COLUMNNAME_GenerateTo = "GenerateTo";
/** Set Generate To.
* Generate To
*/
public void setGenerateTo (String GenerateTo);
/** Get Generate To.
* Generate To
*/
public String getGenerateTo();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name IsApproved */
public static final String COLUMNNAME_IsApproved = "IsApproved";
/** Set Approved.
* Indicates if this document requires approval
*/
public void setIsApproved (boolean IsApproved);
/** Get Approved.
* Indicates if this document requires approval
*/
public boolean isApproved();
/** Column name IsDelivered */
public static final String COLUMNNAME_IsDelivered = "IsDelivered";
/** Set Delivered */
public void setIsDelivered (boolean IsDelivered);
/** Get Delivered */
public boolean isDelivered();
/** Column name IsDropShip */
public static final String COLUMNNAME_IsDropShip = "IsDropShip";
/** Set Drop Shipment.
* Drop Shipments are sent from the Vendor directly to the Customer
*/
public void setIsDropShip (boolean IsDropShip);
/** Get Drop Shipment.
* Drop Shipments are sent from the Vendor directly to the Customer
*/
public boolean isDropShip();
/** Column name IsInDispute */
public static final String COLUMNNAME_IsInDispute = "IsInDispute";
/** Set In Dispute.
* Document is in dispute
*/
public void setIsInDispute (boolean IsInDispute);
/** Get In Dispute.
* Document is in dispute
*/
public boolean isInDispute();
/** Column name IsInTransit */
public static final String COLUMNNAME_IsInTransit = "IsInTransit";
/** Set In Transit.
* Movement is in transit
*/
public void setIsInTransit (boolean IsInTransit);
/** Get In Transit.
* Movement is in transit
*/
public boolean isInTransit();
/** Column name IsPrinted */
public static final String COLUMNNAME_IsPrinted = "IsPrinted";
/** Set Printed.
* Indicates if this document / line is printed
*/
public void setIsPrinted (boolean IsPrinted);
/** Get Printed.
* Indicates if this document / line is printed
*/
public boolean isPrinted();
/** Column name IsSelected */
public static final String COLUMNNAME_IsSelected = "IsSelected";
/** Set Selected */
public void setIsSelected (boolean IsSelected);
/** Get Selected */
public boolean isSelected();
/** Column name IsSOTrx */
public static final String COLUMNNAME_IsSOTrx = "IsSOTrx";
/** Set Sales Transaction.
* This is a Sales Transaction
*/
public void setIsSOTrx (boolean IsSOTrx);
/** Get Sales Transaction.
* This is a Sales Transaction
*/
public boolean isSOTrx();
/** Column name M_Locator_ID */
public static final String COLUMNNAME_M_Locator_ID = "M_Locator_ID";
/** Set Locator.
* Warehouse Locator
*/
public void setM_Locator_ID (int M_Locator_ID);
/** Get Locator.
* Warehouse Locator
*/
public int getM_Locator_ID();
public org.compiere.model.I_M_Locator getM_Locator() throws RuntimeException;
/** Column name M_MovementIn_ID */
public static final String COLUMNNAME_M_MovementIn_ID = "M_MovementIn_ID";
/** Set Inbound Move */
public void setM_MovementIn_ID (int M_MovementIn_ID);
/** Get Inbound Move */
public int getM_MovementIn_ID();
public org.compiere.model.I_M_Movement getM_MovementIn() throws RuntimeException;
/** Column name M_MovementOut_ID */
public static final String COLUMNNAME_M_MovementOut_ID = "M_MovementOut_ID";
/** Set Outbond Move */
public void setM_MovementOut_ID (int M_MovementOut_ID);
/** Get Outbond Move */
public int getM_MovementOut_ID();
public org.compiere.model.I_M_Movement getM_MovementOut() throws RuntimeException;
/** Column name M_Shipper_ID */
public static final String COLUMNNAME_M_Shipper_ID = "M_Shipper_ID";
/** Set Shipper.
* Method or manner of product delivery
*/
public void setM_Shipper_ID (int M_Shipper_ID);
/** Get Shipper.
* Method or manner of product delivery
*/
public int getM_Shipper_ID();
public org.compiere.model.I_M_Shipper getM_Shipper() throws RuntimeException;
/** Column name M_Warehouse_ID */
public static final String COLUMNNAME_M_Warehouse_ID = "M_Warehouse_ID";
/** Set Warehouse.
* Storage Warehouse and Service Point
*/
public void setM_Warehouse_ID (int M_Warehouse_ID);
/** Get Warehouse.
* Storage Warehouse and Service Point
*/
public int getM_Warehouse_ID();
public org.compiere.model.I_M_Warehouse getM_Warehouse() throws RuntimeException;
/** Column name M_WarehouseSource_ID */
public static final String COLUMNNAME_M_WarehouseSource_ID = "M_WarehouseSource_ID";
/** Set Source Warehouse.
* Optional Warehouse to replenish from
*/
public void setM_WarehouseSource_ID (int M_WarehouseSource_ID);
/** Get Source Warehouse.
* Optional Warehouse to replenish from
*/
public int getM_WarehouseSource_ID();
public org.compiere.model.I_M_Warehouse getM_WarehouseSource() throws RuntimeException;
/** Column name M_WarehouseTo_ID */
public static final String COLUMNNAME_M_WarehouseTo_ID = "M_WarehouseTo_ID";
/** Set Warehouse To */
public void setM_WarehouseTo_ID (int M_WarehouseTo_ID);
/** Get Warehouse To */
public int getM_WarehouseTo_ID();
/** Column name NoPackages */
public static final String COLUMNNAME_NoPackages = "NoPackages";
/** Set No Packages.
* Number of packages shipped
*/
public void setNoPackages (int NoPackages);
/** Get No Packages.
* Number of packages shipped
*/
public int getNoPackages();
/** Column name PickDate */
public static final String COLUMNNAME_PickDate = "PickDate";
/** Set Pick Date.
* Date/Time when picked for Shipment
*/
public void setPickDate (Timestamp PickDate);
/** Get Pick Date.
* Date/Time when picked for Shipment
*/
public Timestamp getPickDate();
/** Column name POReference */
public static final String COLUMNNAME_POReference = "POReference";
/** Set Order Reference.
* Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner
*/
public void setPOReference (String POReference);
/** Get Order Reference.
* Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner
*/
public String getPOReference();
/** Column name Posted */
public static final String COLUMNNAME_Posted = "Posted";
/** Set Posted.
* Posting status
*/
public void setPosted (boolean Posted);
/** Get Posted.
* Posting status
*/
public boolean isPosted();
/** Column name PriorityRule */
public static final String COLUMNNAME_PriorityRule = "PriorityRule";
/** Set Priority.
* Priority of a document
*/
public void setPriorityRule (String PriorityRule);
/** Get Priority.
* Priority of a document
*/
public String getPriorityRule();
/** Column name Processed */
public static final String COLUMNNAME_Processed = "Processed";
/** Set Processed.
* The document has been processed
*/
public void setProcessed (boolean Processed);
/** Get Processed.
* The document has been processed
*/
public boolean isProcessed();
/** Column name Processing */
public static final String COLUMNNAME_Processing = "Processing";
/** Set Process Now */
public void setProcessing (boolean Processing);
/** Get Process Now */
public boolean isProcessing();
/** Column name Ref_Order_ID */
public static final String COLUMNNAME_Ref_Order_ID = "Ref_Order_ID";
/** Set Referenced Order.
* Reference to corresponding Sales/Purchase Order
*/
public void setRef_Order_ID (int Ref_Order_ID);
/** Get Referenced Order.
* Reference to corresponding Sales/Purchase Order
*/
public int getRef_Order_ID();
public org.compiere.model.I_C_Order getRef_Order() throws RuntimeException;
/** Column name SalesRep_ID */
public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID";
/** Set Sales Representative.
* Sales Representative or Company Agent
*/
public void setSalesRep_ID (int SalesRep_ID);
/** Get Sales Representative.
* Sales Representative or Company Agent
*/
public int getSalesRep_ID();
public org.compiere.model.I_AD_User getSalesRep() throws RuntimeException;
/** Column name SendEMail */
public static final String COLUMNNAME_SendEMail = "SendEMail";
/** Set Send EMail.
* Enable sending Document EMail
*/
public void setSendEMail (boolean SendEMail);
/** Get Send EMail.
* Enable sending Document EMail
*/
public boolean isSendEMail();
/** Column name ShipDate */
public static final String COLUMNNAME_ShipDate = "ShipDate";
/** Set Ship Date.
* Shipment Date/Time
*/
public void setShipDate (Timestamp ShipDate);
/** Get Ship Date.
* Shipment Date/Time
*/
public Timestamp getShipDate();
/** Column name TrackingNo */
public static final String COLUMNNAME_TrackingNo = "TrackingNo";
/** Set Tracking No.
* Number to track the shipment
*/
public void setTrackingNo (String TrackingNo);
/** Get Tracking No.
* Number to track the shipment
*/
public String getTrackingNo();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
/** Column name User1_ID */
public static final String COLUMNNAME_User1_ID = "User1_ID";
/** Set User Element List 1.
* User defined list element #1
*/
public void setUser1_ID (int User1_ID);
/** Get User Element List 1.
* User defined list element #1
*/
public int getUser1_ID();
public org.compiere.model.I_C_ElementValue getUser1() throws RuntimeException;
/** Column name User2_ID */
public static final String COLUMNNAME_User2_ID = "User2_ID";
/** Set User Element List 2.
* User defined list element #2
*/
public void setUser2_ID (int User2_ID);
/** Get User Element List 2.
* User defined list element #2
*/
public int getUser2_ID();
public org.compiere.model.I_C_ElementValue getUser2() throws RuntimeException;
/** Column name Volume */
public static final String COLUMNNAME_Volume = "Volume";
/** Set Volume.
* Volume of a product
*/
public void setVolume (BigDecimal Volume);
/** Get Volume.
* Volume of a product
*/
public BigDecimal getVolume();
/** Column name Weight */
public static final String COLUMNNAME_Weight = "Weight";
/** Set Weight.
* Weight of a product
*/
public void setWeight (BigDecimal Weight);
/** Get Weight.
* Weight of a product
*/
public BigDecimal getWeight();
}

View File

@ -0,0 +1,587 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package andromedia.midsuit.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.model.*;
import org.compiere.util.KeyNamePair;
/** Generated Interface for DD_OrderLine
* @author iDempiere (generated)
* @version Release 4.1
*/
@SuppressWarnings("all")
public interface I_DD_OrderLine
{
/** TableName=DD_OrderLine */
public static final String Table_Name = "DD_OrderLine";
/** AD_Table_ID=1800016 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_OrgTrx_ID */
public static final String COLUMNNAME_AD_OrgTrx_ID = "AD_OrgTrx_ID";
/** Set Trx Organization.
* Performing or initiating organization
*/
public void setAD_OrgTrx_ID (int AD_OrgTrx_ID);
/** Get Trx Organization.
* Performing or initiating organization
*/
public int getAD_OrgTrx_ID();
/** Column name C_Activity_ID */
public static final String COLUMNNAME_C_Activity_ID = "C_Activity_ID";
/** Set Activity.
* Business Activity
*/
public void setC_Activity_ID (int C_Activity_ID);
/** Get Activity.
* Business Activity
*/
public int getC_Activity_ID();
public org.compiere.model.I_C_Activity getC_Activity() throws RuntimeException;
/** Column name C_Campaign_ID */
public static final String COLUMNNAME_C_Campaign_ID = "C_Campaign_ID";
/** Set DIvision.
* Division
*/
public void setC_Campaign_ID (int C_Campaign_ID);
/** Get DIvision.
* Division
*/
public int getC_Campaign_ID();
public org.compiere.model.I_C_Campaign getC_Campaign() throws RuntimeException;
/** Column name C_Charge_ID */
public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID";
/** Set Charge.
* Additional document charges
*/
public void setC_Charge_ID (int C_Charge_ID);
/** Get Charge.
* Additional document charges
*/
public int getC_Charge_ID();
public org.compiere.model.I_C_Charge getC_Charge() throws RuntimeException;
/** Column name C_Project_ID */
public static final String COLUMNNAME_C_Project_ID = "C_Project_ID";
/** Set Project.
* Financial Project
*/
public void setC_Project_ID (int C_Project_ID);
/** Get Project.
* Financial Project
*/
public int getC_Project_ID();
public org.compiere.model.I_C_Project getC_Project() throws RuntimeException;
/** Column name C_UOM_ID */
public static final String COLUMNNAME_C_UOM_ID = "C_UOM_ID";
/** Set UOM.
* Unit of Measure
*/
public void setC_UOM_ID (int C_UOM_ID);
/** Get UOM.
* Unit of Measure
*/
public int getC_UOM_ID();
public org.compiere.model.I_C_UOM getC_UOM() throws RuntimeException;
/** Column name ConfirmedQty */
public static final String COLUMNNAME_ConfirmedQty = "ConfirmedQty";
/** Set Confirmed Quantity.
* Confirmation of a received quantity
*/
public void setConfirmedQty (BigDecimal ConfirmedQty);
/** Get Confirmed Quantity.
* Confirmation of a received quantity
*/
public BigDecimal getConfirmedQty();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name DateDelivered */
public static final String COLUMNNAME_DateDelivered = "DateDelivered";
/** Set Date Delivered.
* Date when the product was delivered
*/
public void setDateDelivered (Timestamp DateDelivered);
/** Get Date Delivered.
* Date when the product was delivered
*/
public Timestamp getDateDelivered();
/** Column name DateOrdered */
public static final String COLUMNNAME_DateOrdered = "DateOrdered";
/** Set Date Ordered.
* Date of Order
*/
public void setDateOrdered (Timestamp DateOrdered);
/** Get Date Ordered.
* Date of Order
*/
public Timestamp getDateOrdered();
/** Column name DatePromised */
public static final String COLUMNNAME_DatePromised = "DatePromised";
/** Set Date Promised.
* Date Order was promised
*/
public void setDatePromised (Timestamp DatePromised);
/** Get Date Promised.
* Date Order was promised
*/
public Timestamp getDatePromised();
/** Column name DD_Order_ID */
public static final String COLUMNNAME_DD_Order_ID = "DD_Order_ID";
/** Set Distribution Order */
public void setDD_Order_ID (int DD_Order_ID);
/** Get Distribution Order */
public int getDD_Order_ID();
public org.eevolution.model.I_DD_Order getDD_Order() throws RuntimeException;
/** Column name DD_OrderLine_ID */
public static final String COLUMNNAME_DD_OrderLine_ID = "DD_OrderLine_ID";
/** Set Distribution Order Line */
public void setDD_OrderLine_ID (int DD_OrderLine_ID);
/** Get Distribution Order Line */
public int getDD_OrderLine_ID();
/** Column name DD_OrderLine_UU */
public static final String COLUMNNAME_DD_OrderLine_UU = "DD_OrderLine_UU";
/** Set DD_OrderLine_UU */
public void setDD_OrderLine_UU (String DD_OrderLine_UU);
/** Get DD_OrderLine_UU */
public String getDD_OrderLine_UU();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name FreightAmt */
public static final String COLUMNNAME_FreightAmt = "FreightAmt";
/** Set Freight Amount.
* Freight Amount
*/
public void setFreightAmt (BigDecimal FreightAmt);
/** Get Freight Amount.
* Freight Amount
*/
public BigDecimal getFreightAmt();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name IsDescription */
public static final String COLUMNNAME_IsDescription = "IsDescription";
/** Set Description Only.
* if true, the line is just description and no transaction
*/
public void setIsDescription (boolean IsDescription);
/** Get Description Only.
* if true, the line is just description and no transaction
*/
public boolean isDescription();
/** Column name IsInvoiced */
public static final String COLUMNNAME_IsInvoiced = "IsInvoiced";
/** Set Invoiced.
* Is this invoiced?
*/
public void setIsInvoiced (boolean IsInvoiced);
/** Get Invoiced.
* Is this invoiced?
*/
public boolean isInvoiced();
/** Column name Line */
public static final String COLUMNNAME_Line = "Line";
/** Set Line No.
* Unique line for this document
*/
public void setLine (int Line);
/** Get Line No.
* Unique line for this document
*/
public int getLine();
/** Column name LineNetAmt */
public static final String COLUMNNAME_LineNetAmt = "LineNetAmt";
/** Set Line Amount.
* Line Extended Amount (Quantity * Actual Price) without Freight and Charges
*/
public void setLineNetAmt (BigDecimal LineNetAmt);
/** Get Line Amount.
* Line Extended Amount (Quantity * Actual Price) without Freight and Charges
*/
public BigDecimal getLineNetAmt();
/** Column name M_AttributeSetInstance_ID */
public static final String COLUMNNAME_M_AttributeSetInstance_ID = "M_AttributeSetInstance_ID";
/** Set Attribute Set Instance.
* Product Attribute Set Instance
*/
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID);
/** Get Attribute Set Instance.
* Product Attribute Set Instance
*/
public int getM_AttributeSetInstance_ID();
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException;
/** Column name M_AttributeSetInstanceTo_ID */
public static final String COLUMNNAME_M_AttributeSetInstanceTo_ID = "M_AttributeSetInstanceTo_ID";
/** Set Attribute Set Instance To.
* Target Product Attribute Set Instance
*/
public void setM_AttributeSetInstanceTo_ID (int M_AttributeSetInstanceTo_ID);
/** Get Attribute Set Instance To.
* Target Product Attribute Set Instance
*/
public int getM_AttributeSetInstanceTo_ID();
public I_M_AttributeSetInstance getM_AttributeSetInstanceTo() throws RuntimeException;
/** Column name M_Locator_ID */
public static final String COLUMNNAME_M_Locator_ID = "M_Locator_ID";
/** Set Locator.
* Warehouse Locator
*/
public void setM_Locator_ID (int M_Locator_ID);
/** Get Locator.
* Warehouse Locator
*/
public int getM_Locator_ID();
public I_M_Locator getM_Locator() throws RuntimeException;
/** Column name M_LocatorTo_ID */
public static final String COLUMNNAME_M_LocatorTo_ID = "M_LocatorTo_ID";
/** Set Locator To.
* Location inventory is moved to
*/
public void setM_LocatorTo_ID (int M_LocatorTo_ID);
/** Get Locator To.
* Location inventory is moved to
*/
public int getM_LocatorTo_ID();
public I_M_Locator getM_LocatorTo() throws RuntimeException;
/** Column name M_Product_ID */
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
/** Set Product.
* Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID);
/** Get Product.
* Product, Service, Item
*/
public int getM_Product_ID();
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException;
/** Column name M_Shipper_ID */
public static final String COLUMNNAME_M_Shipper_ID = "M_Shipper_ID";
/** Set Shipper.
* Method or manner of product delivery
*/
public void setM_Shipper_ID (int M_Shipper_ID);
/** Get Shipper.
* Method or manner of product delivery
*/
public int getM_Shipper_ID();
public org.compiere.model.I_M_Shipper getM_Shipper() throws RuntimeException;
/** Column name PickedQty */
public static final String COLUMNNAME_PickedQty = "PickedQty";
/** Set Picked Quantity */
public void setPickedQty (BigDecimal PickedQty);
/** Get Picked Quantity */
public BigDecimal getPickedQty();
/** Column name Processed */
public static final String COLUMNNAME_Processed = "Processed";
/** Set Processed.
* The document has been processed
*/
public void setProcessed (boolean Processed);
/** Get Processed.
* The document has been processed
*/
public boolean isProcessed();
/** Column name QtyDelivered */
public static final String COLUMNNAME_QtyDelivered = "QtyDelivered";
/** Set Delivered Quantity.
* Delivered Quantity
*/
public void setQtyDelivered (BigDecimal QtyDelivered);
/** Get Delivered Quantity.
* Delivered Quantity
*/
public BigDecimal getQtyDelivered();
/** Column name QtyEntered */
public static final String COLUMNNAME_QtyEntered = "QtyEntered";
/** Set Quantity.
* The Quantity Entered is based on the selected UoM
*/
public void setQtyEntered (BigDecimal QtyEntered);
/** Get Quantity.
* The Quantity Entered is based on the selected UoM
*/
public BigDecimal getQtyEntered();
/** Column name QtyInTransit */
public static final String COLUMNNAME_QtyInTransit = "QtyInTransit";
/** Set Qty In Transit */
public void setQtyInTransit (BigDecimal QtyInTransit);
/** Get Qty In Transit */
public BigDecimal getQtyInTransit();
/** Column name QtyOrdered */
public static final String COLUMNNAME_QtyOrdered = "QtyOrdered";
/** Set Ordered Quantity.
* Ordered Quantity
*/
public void setQtyOrdered (BigDecimal QtyOrdered);
/** Get Ordered Quantity.
* Ordered Quantity
*/
public BigDecimal getQtyOrdered();
/** Column name QtyReserved */
public static final String COLUMNNAME_QtyReserved = "QtyReserved";
/** Set Reserved Quantity.
* Reserved Quantity
*/
public void setQtyReserved (BigDecimal QtyReserved);
/** Get Reserved Quantity.
* Reserved Quantity
*/
public BigDecimal getQtyReserved();
/** Column name ScrappedQty */
public static final String COLUMNNAME_ScrappedQty = "ScrappedQty";
/** Set Scrapped Quantity.
* The Quantity scrapped due to QA issues
*/
public void setScrappedQty (BigDecimal ScrappedQty);
/** Get Scrapped Quantity.
* The Quantity scrapped due to QA issues
*/
public BigDecimal getScrappedQty();
/** Column name TargetQty */
public static final String COLUMNNAME_TargetQty = "TargetQty";
/** Set Target Quantity.
* Target Movement Quantity
*/
public void setTargetQty (BigDecimal TargetQty);
/** Get Target Quantity.
* Target Movement Quantity
*/
public BigDecimal getTargetQty();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
/** Column name User1_ID */
public static final String COLUMNNAME_User1_ID = "User1_ID";
/** Set User Element List 1.
* User defined list element #1
*/
public void setUser1_ID (int User1_ID);
/** Get User Element List 1.
* User defined list element #1
*/
public int getUser1_ID();
public org.compiere.model.I_C_ElementValue getUser1() throws RuntimeException;
/** Column name User2_ID */
public static final String COLUMNNAME_User2_ID = "User2_ID";
/** Set User Element List 2.
* User defined list element #2
*/
public void setUser2_ID (int User2_ID);
/** Get User Element List 2.
* User defined list element #2
*/
public int getUser2_ID();
public org.compiere.model.I_C_ElementValue getUser2() throws RuntimeException;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,652 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Copyright (C) 2003-2007 e-Evolution,SC. All Rights Reserved. *
* Contributor(s): Victor Perez www.e-evolution.com *
*****************************************************************************/
package andromedia.midsuit.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Properties;
import org.compiere.model.MAttributeSet;
import org.compiere.model.MCharge;
import org.compiere.model.MLocator;
import org.compiere.model.MProduct;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MUOM;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/**
* Order Line Model. <code>
* MDDOrderLine ol = new MDDOrderLine(m_order);
ol.setM_Product_ID(wbl.getM_Product_ID());
ol.setQtyOrdered(wbl.getQuantity());
ol.setPriceActual(wbl.getPrice());
ol.setTax();
ol.saveEx();
* </code>
*
* @author Jorg Janke
* @version $Id: MOrderLine.java,v 1.6 2006/10/02 05:18:39 jjanke Exp $
*/
public class MID_MDDOrderLine extends X_DD_OrderLine {
/**
*
*/
private static final long serialVersionUID = -8878804332001384969L;
/**
* Get Order Unreserved Qty
*
* @param ctx
* context
* @param M_Locator_ID
* wh
* @param M_Product_ID
* product
* @param M_AttributeSetInstance_ID
* asi
* @param excludeC_OrderLine_ID
* exclude C_OrderLine_ID
* @return Unreserved Qty
*/
public static BigDecimal getNotReserved(Properties ctx, int M_Locator_ID, int M_Product_ID,
int M_AttributeSetInstance_ID, int excludeDD_OrderLine_ID) {
ArrayList<Object> params = new ArrayList<Object>();
params.add(M_Locator_ID);
params.add(M_Product_ID);
params.add(excludeDD_OrderLine_ID);
String sql = "SELECT SUM(QtyOrdered-QtyDelivered-QtyReserved) " + "FROM DD_OrderLine ol"
+ " INNER JOIN DD_Order o ON (ol.DD_Order_ID=o.DD_Order_ID) " + "WHERE ol.M_Locator_ID=?" // #1
+ " AND M_Product_ID=?" // #2
+ " AND o.IsSOTrx='N' AND o.DocStatus='DR'" + " AND QtyOrdered-QtyDelivered-QtyReserved<>0"
+ " AND ol.DD_OrderLine_ID<>?";
if (M_AttributeSetInstance_ID != 0) {
sql += " AND M_AttributeSetInstance_ID=?";
params.add(M_AttributeSetInstance_ID);
}
return DB.getSQLValueBD(null, sql.toString(), params);
} // getNotReserved
/** Logger */
@SuppressWarnings("unused")
private static CLogger s_log = CLogger.getCLogger(MID_MDDOrderLine.class);
/**************************************************************************
* Default Constructor
*
* @param ctx
* context
* @param C_OrderLine_ID
* order line to load
* @param trxName
* trx name
*/
public MID_MDDOrderLine(Properties ctx, int C_OrderLine_ID, String trxName) {
super(ctx, C_OrderLine_ID, trxName);
if (C_OrderLine_ID == 0) {
// setC_Order_ID (0);
// setLine (0);
// setM_Warehouse_ID (0); // @M_Warehouse_ID@
// setC_BPartner_ID(0);
// setC_BPartner_Location_ID (0); // @C_BPartner_Location_ID@
// setC_Currency_ID (0); // @C_Currency_ID@
// setDateOrdered (new Timestamp(System.currentTimeMillis())); // @DateOrdered@
//
// setC_Tax_ID (0);
// setC_UOM_ID (0);
//
setFreightAmt(Env.ZERO);
setLineNetAmt(Env.ZERO);
//
setM_AttributeSetInstance_ID(0);
//
setQtyEntered(Env.ZERO);
setQtyInTransit(Env.ZERO);
setConfirmedQty(Env.ZERO);
setTargetQty(Env.ZERO);
setPickedQty(Env.ZERO);
setQtyOrdered(Env.ZERO); // 1
setQtyDelivered(Env.ZERO);
setQtyReserved(Env.ZERO);
//
setIsDescription(false); // N
setProcessed(false);
setLine(0);
}
} // MDDOrderLine
/**
* Parent Constructor. ol.setM_Product_ID(wbl.getM_Product_ID());
* ol.setQtyOrdered(wbl.getQuantity()); ol.setPrice();
* ol.setPriceActual(wbl.getPrice()); ol.setTax(); ol.saveEx();
*
* @param order
* parent order
*/
public MID_MDDOrderLine(MID_MDDOrder order) {
this(order.getCtx(), 0, order.get_TrxName());
if (order.get_ID() == 0)
throw new IllegalArgumentException("Header not saved");
setDD_Order_ID(order.getDD_Order_ID()); // parent
setOrder(order);
} // MDDOrderLine
/**
* Load Constructor
*
* @param ctx
* context
* @param rs
* result set record
* @param trxName
* transaction
*/
public MID_MDDOrderLine(Properties ctx, ResultSet rs, String trxName) {
super(ctx, rs, trxName);
} // MDDOrderLine
private int m_M_PriceList_ID = 0;
//
private boolean m_IsSOTrx = true;
/** Cached Currency Precision */
// private Integer m_precision = null;
/** Product */
private MProduct m_product = null;
/** Parent */
private MID_MDDOrder m_parent = null;
/**
* Set Defaults from Order. Does not set Parent !!
*
* @param order
* order
*/
public void setOrder(MID_MDDOrder order) {
setClientOrg(order);
/*
* setC_BPartner_ID(order.getC_BPartner_ID());
* setC_BPartner_Location_ID(order.getC_BPartner_Location_ID());
*/
// setM_Warehouse_ID(order.getM_Warehouse_ID());
setDateOrdered(order.getDateOrdered());
setDatePromised(order.getDatePromised());
//
setHeaderInfo(order); // sets m_order
// Don't set Activity, etc as they are overwrites
} // setOrder
/**
* Set Header Info
*
* @param order
* order
*/
public void setHeaderInfo(MID_MDDOrder order) {
m_parent = order;
m_IsSOTrx = order.isSOTrx();
} // setHeaderInfo
/**
* Get Parent
*
* @return parent
*/
public MID_MDDOrder getParent() {
if (m_parent == null)
m_parent = new MID_MDDOrder(getCtx(), getDD_Order_ID(), get_TrxName());
return m_parent;
} // getParent
/**
* Set Product
*
* @param product
* product
*/
public void setProduct(MProduct product) {
m_product = product;
if (m_product != null) {
setM_Product_ID(m_product.getM_Product_ID());
setC_UOM_ID(m_product.getC_UOM_ID());
} else {
setM_Product_ID(0);
set_ValueNoCheck("C_UOM_ID", null);
}
setM_AttributeSetInstance_ID(0);
} // setProduct
/**
* Set M_Product_ID
*
* @param M_Product_ID
* product
* @param setUOM
* set also UOM
*/
public void setM_Product_ID(int M_Product_ID, boolean setUOM) {
if (setUOM)
setProduct(MProduct.get(getCtx(), M_Product_ID));
else
super.setM_Product_ID(M_Product_ID);
setM_AttributeSetInstance_ID(0);
} // setM_Product_ID
/**
* Set Product and UOM
*
* @param M_Product_ID
* product
* @param C_UOM_ID
* uom
*/
public void setM_Product_ID(int M_Product_ID, int C_UOM_ID) {
super.setM_Product_ID(M_Product_ID);
if (C_UOM_ID != 0)
super.setC_UOM_ID(C_UOM_ID);
setM_AttributeSetInstance_ID(0);
} // setM_Product_ID
/**
* Get Product
*
* @return product or null
*/
public MProduct getProduct() {
if (m_product == null && getM_Product_ID() != 0)
m_product = MProduct.get(getCtx(), getM_Product_ID());
return m_product;
} // getProduct
/**
* Set M_AttributeSetInstance_ID
*
* @param M_AttributeSetInstance_ID
* id
*/
public void setM_AttributeSetInstance_ID(int M_AttributeSetInstance_ID) {
if (M_AttributeSetInstance_ID == 0) // 0 is valid ID
set_Value("M_AttributeSetInstance_ID", new Integer(0));
else
super.setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID);
} // setM_AttributeSetInstance_ID
/**
* Set Warehouse
*
* @param M_Warehouse_ID
* warehouse
*/
/*
* public void setM_Warehouse_ID (int M_Warehouse_ID) { if (getM_Warehouse_ID()
* > 0 && getM_Warehouse_ID() != M_Warehouse_ID && !canChangeWarehouse())
* log.severe("Ignored - Already Delivered/Invoiced/Reserved"); else
* super.setM_Warehouse_ID (M_Warehouse_ID); } // setM_Warehouse_ID
*/
/**
* Can Change Warehouse
*
* @return true if warehouse can be changed
*/
public boolean canChangeWarehouse() {
if (getQtyDelivered().signum() != 0)
{
log.saveError("Error", Msg.translate(getCtx(), "QtyDelivered") + "=" +
getQtyDelivered());
return false;
}
if (getQtyReserved().signum() != 0)
{
log.saveError("Error", Msg.translate(getCtx(), "QtyReserved") + "=" +
getQtyReserved());
return false;
}
// We can change
return true;
} // canChangeWarehouse
/**
* Get C_Project_ID
*
* @return project
*/
public int getC_Project_ID() {
int ii = super.getC_Project_ID();
if (ii == 0)
ii = getParent().getC_Project_ID();
return ii;
} // getC_Project_ID
/**
* Get C_Activity_ID
*
* @return Activity
*/
public int getC_Activity_ID() {
int ii = super.getC_Activity_ID();
if (ii == 0)
ii = getParent().getC_Activity_ID();
return ii;
} // getC_Activity_ID
/**
* Get C_Campaign_ID
*
* @return Campaign
*/
public int getC_Campaign_ID() {
int ii = super.getC_Campaign_ID();
if (ii == 0)
ii = getParent().getC_Campaign_ID();
return ii;
} // getC_Campaign_ID
/**
* Get User2_ID
*
* @return User2
*/
public int getUser1_ID() {
int ii = super.getUser1_ID();
if (ii == 0)
ii = getParent().getUser1_ID();
return ii;
} // getUser1_ID
/**
* Get User2_ID
*
* @return User2
*/
public int getUser2_ID() {
int ii = super.getUser2_ID();
if (ii == 0)
ii = getParent().getUser2_ID();
return ii;
} // getUser2_ID
/**
* Get AD_OrgTrx_ID
*
* @return trx org
*/
public int getAD_OrgTrx_ID() {
int ii = super.getAD_OrgTrx_ID();
if (ii == 0)
ii = getParent().getAD_OrgTrx_ID();
return ii;
} // getAD_OrgTrx_ID
/**************************************************************************
* String Representation
*
* @return info
*/
public String toString() {
StringBuffer sb = new StringBuffer("MDDOrderLine[").append(get_ID()).append(",Line=").append(getLine())
.append(",Ordered=").append(getQtyOrdered()).append(",Delivered=").append(getQtyDelivered())
.append(",Reserved=").append(getQtyReserved()).append("]");
return sb.toString();
} // toString
/**
* Add to Description
*
* @param description
* text
*/
public void addDescription(String description) {
String desc = getDescription();
if (desc == null)
setDescription(description);
else
setDescription(desc + " | " + description);
} // addDescription
/**
* Get Description Text. For jsp access (vs. isDescription)
*
* @return description
*/
public String getDescriptionText() {
return super.getDescription();
} // getDescriptionText
/**
* Get Name
*
* @return get the name of the line (from Product)
*/
public String getName() {
getProduct();
if (m_product != null)
return m_product.getName();
if (getC_Charge_ID() != 0) {
MCharge charge = MCharge.get(getCtx(), getC_Charge_ID());
return charge.getName();
}
return "";
} // getName
/**
* Set C_Charge_ID
*
* @param C_Charge_ID
* charge
*/
public void setC_Charge_ID(int C_Charge_ID) {
super.setC_Charge_ID(C_Charge_ID);
if (C_Charge_ID > 0)
set_ValueNoCheck("C_UOM_ID", null);
} // setC_Charge_ID
/**
* Set Qty Entered/Ordered. Use this Method if the Line UOM is the Product UOM
*
* @param Qty
* QtyOrdered/Entered
*/
public void setQty(BigDecimal Qty) {
super.setQtyEntered(Qty);
super.setQtyOrdered(getQtyEntered());
} // setQty
/**
* Set Qty Entered - enforce entered UOM
*
* @param QtyEntered
*/
public void setQtyEntered(BigDecimal QtyEntered) {
if (QtyEntered != null && getC_UOM_ID() != 0) {
int precision = MUOM.getPrecision(getCtx(), getC_UOM_ID());
QtyEntered = QtyEntered.setScale(precision, BigDecimal.ROUND_HALF_UP);
}
super.setQtyEntered(QtyEntered);
} // setQtyEntered
/**
* Set Qty Ordered - enforce Product UOM
*
* @param QtyOrdered
*/
public void setQtyOrdered(BigDecimal QtyOrdered) {
MProduct product = getProduct();
if (QtyOrdered != null && product != null) {
int precision = product.getUOMPrecision();
QtyOrdered = QtyOrdered.setScale(precision, BigDecimal.ROUND_HALF_UP);
}
super.setQtyOrdered(QtyOrdered);
} // setQtyOrdered
/**************************************************************************
* Before Save
*
* @param newRecord
* @return true if it can be sabed
*/
protected boolean beforeSave(boolean newRecord) {
if (newRecord && getParent().isComplete()) {
log.saveError("ParentComplete", Msg.translate(getCtx(), "DD_OrderLine"));
return false;
}
// Get Defaults from Parent
/*
* if (getC_BPartner_ID() == 0 || getC_BPartner_Location_ID() == 0 ||
* getM_Warehouse_ID() == 0) setOrder (getParent());
*/
if (m_M_PriceList_ID == 0)
setHeaderInfo(getParent());
// R/O Check - Product/Warehouse Change
if (!newRecord && (is_ValueChanged("M_Product_ID") || is_ValueChanged("M_Locator_ID")
|| is_ValueChanged("M_LocatorTo_ID"))) {
if (!canChangeWarehouse())
return false;
} // Product Changed
// Charge
if (getC_Charge_ID() != 0 && getM_Product_ID() != 0)
setM_Product_ID(0);
// No Product
if (getM_Product_ID() == 0)
setM_AttributeSetInstance_ID(0);
// Product
// UOM
if (getC_UOM_ID() == 0 && (getM_Product_ID() != 0 || getC_Charge_ID() != 0)) {
int C_UOM_ID = MUOM.getDefault_UOM_ID(getCtx());
if (C_UOM_ID > 0)
setC_UOM_ID(C_UOM_ID);
}
// Qty Precision
if (newRecord || is_ValueChanged("QtyEntered"))
setQtyEntered(getQtyEntered());
if (newRecord || is_ValueChanged("QtyOrdered"))
setQtyOrdered(getQtyOrdered());
// Qty on instance ASI for SO
if (m_IsSOTrx && getM_AttributeSetInstance_ID() != 0 && (newRecord || is_ValueChanged("M_Product_ID")
|| is_ValueChanged("M_AttributeSetInstance_ID") || is_ValueChanged("M_Warehouse_ID"))) {
MProduct product = getProduct();
if (product.isStocked()) {
int M_AttributeSet_ID = product.getM_AttributeSet_ID();
boolean isInstance = M_AttributeSet_ID != 0;
if (isInstance) {
MAttributeSet mas = MAttributeSet.get(getCtx(), M_AttributeSet_ID);
isInstance = mas.isInstanceAttribute();
}
// Max
if (isInstance) {
MLocator locator_from = MLocator.get(getCtx(), getM_Locator_ID());
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), locator_from.getM_Warehouse_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(), null, true, false, 0, get_TrxName());
BigDecimal qty = Env.ZERO;
for (int i = 0; i < storages.length; i++) {
if (storages[i].getM_AttributeSetInstance_ID() == getM_AttributeSetInstance_ID())
qty = qty.add(storages[i].getQtyOnHand());
}
if (getQtyOrdered().compareTo(qty) > 0) {
log.warning("Qty - Stock=" + qty + ", Ordered=" + getQtyOrdered());
log.saveError("QtyInsufficient", "=" + qty);
return false;
}
}
} // stocked
} // SO instance
// FreightAmt Not used
if (Env.ZERO.compareTo(getFreightAmt()) != 0)
setFreightAmt(Env.ZERO);
// Get Line No
if (getLine() == 0) {
String sql = "SELECT COALESCE(MAX(Line),0)+10 FROM C_OrderLine WHERE C_Order_ID=?";
int ii = DB.getSQLValue(get_TrxName(), sql, getDD_Order_ID());
setLine(ii);
}
return true;
} // beforeSave
/**
* Before Delete
*
* @return true if it can be deleted
*/
protected boolean beforeDelete() {
// R/O Check - Something delivered. etc.
// if (Env.ZERO.compareTo(getQtyDelivered()) != 0) {
// log.saveError("DeleteError", Msg.translate(getCtx(), "QtyDelivered") + "=" + getQtyDelivered());
// return false;
// }
// if (Env.ZERO.compareTo(getQtyReserved()) != 0) {
// // For PO should be On Order
// log.saveError("DeleteError", Msg.translate(getCtx(), "QtyReserved") + "=" + getQtyReserved());
// return false;
// }
return true;
} // beforeDelete
/**
* After Save
*
* @param newRecord
* new
* @param success
* success
* @return saved
*/
protected boolean afterSave(boolean newRecord, boolean success) {
if (!success)
return success;
return true;
} // afterSave
/**
* After Delete
*
* @param success
* success
* @return deleted
*/
protected boolean afterDelete(boolean success) {
if (!success)
return success;
return true;
} // afterDelete
/**
* Quantity To Deliver
*
* @return Quantity To Deliver
*/
public BigDecimal getQtyToDeliver() {
return getQtyOrdered().subtract(getQtyInTransit()).subtract(getQtyDelivered());
}
} // MDDOrderLine

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,903 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package andromedia.midsuit.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.Properties;
import org.compiere.model.*;
import org.compiere.util.Env;
/** Generated Model for DD_OrderLine
* @author iDempiere (generated)
* @version Release 4.1 - $Id$ */
public class X_DD_OrderLine extends PO implements I_DD_OrderLine, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20171115L;
/** Standard Constructor */
public X_DD_OrderLine (Properties ctx, int DD_OrderLine_ID, String trxName)
{
super (ctx, DD_OrderLine_ID, trxName);
/** if (DD_OrderLine_ID == 0)
{
setC_UOM_ID (0);
setDD_Order_ID (0);
setDD_OrderLine_ID (0);
setIsDescription (false);
setIsInvoiced (false);
setLine (0);
setProcessed (false);
setQtyEntered (Env.ZERO);
setQtyOrdered (Env.ZERO);
} */
}
/** Load Constructor */
public X_DD_OrderLine (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_DD_OrderLine[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Trx Organization.
@param AD_OrgTrx_ID
Performing or initiating organization
*/
public void setAD_OrgTrx_ID (int AD_OrgTrx_ID)
{
if (AD_OrgTrx_ID < 1)
set_Value (COLUMNNAME_AD_OrgTrx_ID, null);
else
set_Value (COLUMNNAME_AD_OrgTrx_ID, Integer.valueOf(AD_OrgTrx_ID));
}
/** Get Trx Organization.
@return Performing or initiating organization
*/
public int getAD_OrgTrx_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_OrgTrx_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_Activity getC_Activity() throws RuntimeException
{
return (org.compiere.model.I_C_Activity)MTable.get(getCtx(), org.compiere.model.I_C_Activity.Table_Name)
.getPO(getC_Activity_ID(), get_TrxName()); }
/** Set Activity.
@param C_Activity_ID
Business Activity
*/
public void setC_Activity_ID (int C_Activity_ID)
{
if (C_Activity_ID < 1)
set_Value (COLUMNNAME_C_Activity_ID, null);
else
set_Value (COLUMNNAME_C_Activity_ID, Integer.valueOf(C_Activity_ID));
}
/** Get Activity.
@return Business Activity
*/
public int getC_Activity_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Activity_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_Campaign getC_Campaign() throws RuntimeException
{
return (org.compiere.model.I_C_Campaign)MTable.get(getCtx(), org.compiere.model.I_C_Campaign.Table_Name)
.getPO(getC_Campaign_ID(), get_TrxName()); }
/** Set DIvision.
@param C_Campaign_ID
Division
*/
public void setC_Campaign_ID (int C_Campaign_ID)
{
if (C_Campaign_ID < 1)
set_Value (COLUMNNAME_C_Campaign_ID, null);
else
set_Value (COLUMNNAME_C_Campaign_ID, Integer.valueOf(C_Campaign_ID));
}
/** Get DIvision.
@return Division
*/
public int getC_Campaign_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Campaign_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_Charge getC_Charge() throws RuntimeException
{
return (org.compiere.model.I_C_Charge)MTable.get(getCtx(), org.compiere.model.I_C_Charge.Table_Name)
.getPO(getC_Charge_ID(), get_TrxName()); }
/** Set Charge.
@param C_Charge_ID
Additional document charges
*/
public void setC_Charge_ID (int C_Charge_ID)
{
if (C_Charge_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Charge_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID));
}
/** Get Charge.
@return Additional document charges
*/
public int getC_Charge_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_Project getC_Project() throws RuntimeException
{
return (org.compiere.model.I_C_Project)MTable.get(getCtx(), org.compiere.model.I_C_Project.Table_Name)
.getPO(getC_Project_ID(), get_TrxName()); }
/** Set Project.
@param C_Project_ID
Financial Project
*/
public void setC_Project_ID (int C_Project_ID)
{
if (C_Project_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Project_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Project_ID, Integer.valueOf(C_Project_ID));
}
/** Get Project.
@return Financial Project
*/
public int getC_Project_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Project_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_UOM getC_UOM() throws RuntimeException
{
return (org.compiere.model.I_C_UOM)MTable.get(getCtx(), org.compiere.model.I_C_UOM.Table_Name)
.getPO(getC_UOM_ID(), get_TrxName()); }
/** Set UOM.
@param C_UOM_ID
Unit of Measure
*/
public void setC_UOM_ID (int C_UOM_ID)
{
if (C_UOM_ID < 1)
set_Value (COLUMNNAME_C_UOM_ID, null);
else
set_Value (COLUMNNAME_C_UOM_ID, Integer.valueOf(C_UOM_ID));
}
/** Get UOM.
@return Unit of Measure
*/
public int getC_UOM_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_UOM_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Confirmed Quantity.
@param ConfirmedQty
Confirmation of a received quantity
*/
public void setConfirmedQty (BigDecimal ConfirmedQty)
{
set_Value (COLUMNNAME_ConfirmedQty, ConfirmedQty);
}
/** Get Confirmed Quantity.
@return Confirmation of a received quantity
*/
public BigDecimal getConfirmedQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ConfirmedQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Date Delivered.
@param DateDelivered
Date when the product was delivered
*/
public void setDateDelivered (Timestamp DateDelivered)
{
set_ValueNoCheck (COLUMNNAME_DateDelivered, DateDelivered);
}
/** Get Date Delivered.
@return Date when the product was delivered
*/
public Timestamp getDateDelivered ()
{
return (Timestamp)get_Value(COLUMNNAME_DateDelivered);
}
/** Set Date Ordered.
@param DateOrdered
Date of Order
*/
public void setDateOrdered (Timestamp DateOrdered)
{
set_ValueNoCheck (COLUMNNAME_DateOrdered, DateOrdered);
}
/** Get Date Ordered.
@return Date of Order
*/
public Timestamp getDateOrdered ()
{
return (Timestamp)get_Value(COLUMNNAME_DateOrdered);
}
/** Set Date Promised.
@param DatePromised
Date Order was promised
*/
public void setDatePromised (Timestamp DatePromised)
{
set_ValueNoCheck (COLUMNNAME_DatePromised, DatePromised);
}
/** Get Date Promised.
@return Date Order was promised
*/
public Timestamp getDatePromised ()
{
return (Timestamp)get_Value(COLUMNNAME_DatePromised);
}
public org.eevolution.model.I_DD_Order getDD_Order() throws RuntimeException
{
return (org.eevolution.model.I_DD_Order)MTable.get(getCtx(), org.eevolution.model.I_DD_Order.Table_Name)
.getPO(getDD_Order_ID(), get_TrxName()); }
/** Set Distribution Order.
@param DD_Order_ID Distribution Order */
public void setDD_Order_ID (int DD_Order_ID)
{
if (DD_Order_ID < 1)
set_ValueNoCheck (COLUMNNAME_DD_Order_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DD_Order_ID, Integer.valueOf(DD_Order_ID));
}
/** Get Distribution Order.
@return Distribution Order */
public int getDD_Order_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DD_Order_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Distribution Order Line.
@param DD_OrderLine_ID Distribution Order Line */
public void setDD_OrderLine_ID (int DD_OrderLine_ID)
{
if (DD_OrderLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_DD_OrderLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DD_OrderLine_ID, Integer.valueOf(DD_OrderLine_ID));
}
/** Get Distribution Order Line.
@return Distribution Order Line */
public int getDD_OrderLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DD_OrderLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set DD_OrderLine_UU.
@param DD_OrderLine_UU DD_OrderLine_UU */
public void setDD_OrderLine_UU (String DD_OrderLine_UU)
{
set_Value (COLUMNNAME_DD_OrderLine_UU, DD_OrderLine_UU);
}
/** Get DD_OrderLine_UU.
@return DD_OrderLine_UU */
public String getDD_OrderLine_UU ()
{
return (String)get_Value(COLUMNNAME_DD_OrderLine_UU);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Freight Amount.
@param FreightAmt
Freight Amount
*/
public void setFreightAmt (BigDecimal FreightAmt)
{
set_Value (COLUMNNAME_FreightAmt, FreightAmt);
}
/** Get Freight Amount.
@return Freight Amount
*/
public BigDecimal getFreightAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_FreightAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Description Only.
@param IsDescription
if true, the line is just description and no transaction
*/
public void setIsDescription (boolean IsDescription)
{
set_ValueNoCheck (COLUMNNAME_IsDescription, Boolean.valueOf(IsDescription));
}
/** Get Description Only.
@return if true, the line is just description and no transaction
*/
public boolean isDescription ()
{
Object oo = get_Value(COLUMNNAME_IsDescription);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Invoiced.
@param IsInvoiced
Is this invoiced?
*/
public void setIsInvoiced (boolean IsInvoiced)
{
set_ValueNoCheck (COLUMNNAME_IsInvoiced, Boolean.valueOf(IsInvoiced));
}
/** Get Invoiced.
@return Is this invoiced?
*/
public boolean isInvoiced ()
{
Object oo = get_Value(COLUMNNAME_IsInvoiced);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Line No.
@param Line
Unique line for this document
*/
public void setLine (int Line)
{
set_ValueNoCheck (COLUMNNAME_Line, Integer.valueOf(Line));
}
/** Get Line No.
@return Unique line for this document
*/
public int getLine ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Line);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Line Amount.
@param LineNetAmt
Line Extended Amount (Quantity * Actual Price) without Freight and Charges
*/
public void setLineNetAmt (BigDecimal LineNetAmt)
{
set_ValueNoCheck (COLUMNNAME_LineNetAmt, LineNetAmt);
}
/** Get Line Amount.
@return Line Extended Amount (Quantity * Actual Price) without Freight and Charges
*/
public BigDecimal getLineNetAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_LineNetAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException
{
return (I_M_AttributeSetInstance)MTable.get(getCtx(), I_M_AttributeSetInstance.Table_Name)
.getPO(getM_AttributeSetInstance_ID(), get_TrxName()); }
/** Set Attribute Set Instance.
@param M_AttributeSetInstance_ID
Product Attribute Set Instance
*/
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID)
{
if (M_AttributeSetInstance_ID < 0)
set_Value (COLUMNNAME_M_AttributeSetInstance_ID, null);
else
set_Value (COLUMNNAME_M_AttributeSetInstance_ID, Integer.valueOf(M_AttributeSetInstance_ID));
}
/** Get Attribute Set Instance.
@return Product Attribute Set Instance
*/
public int getM_AttributeSetInstance_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSetInstance_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_AttributeSetInstance getM_AttributeSetInstanceTo() throws RuntimeException
{
return (I_M_AttributeSetInstance)MTable.get(getCtx(), I_M_AttributeSetInstance.Table_Name)
.getPO(getM_AttributeSetInstanceTo_ID(), get_TrxName()); }
/** Set Attribute Set Instance To.
@param M_AttributeSetInstanceTo_ID
Target Product Attribute Set Instance
*/
public void setM_AttributeSetInstanceTo_ID (int M_AttributeSetInstanceTo_ID)
{
if (M_AttributeSetInstanceTo_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstanceTo_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstanceTo_ID, Integer.valueOf(M_AttributeSetInstanceTo_ID));
}
/** Get Attribute Set Instance To.
@return Target Product Attribute Set Instance
*/
public int getM_AttributeSetInstanceTo_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSetInstanceTo_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_Locator getM_Locator() throws RuntimeException
{
return (I_M_Locator)MTable.get(getCtx(), I_M_Locator.Table_Name)
.getPO(getM_Locator_ID(), get_TrxName()); }
/** Set Locator.
@param M_Locator_ID
Warehouse Locator
*/
public void setM_Locator_ID (int M_Locator_ID)
{
if (M_Locator_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Locator_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Locator_ID, Integer.valueOf(M_Locator_ID));
}
/** Get Locator.
@return Warehouse Locator
*/
public int getM_Locator_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Locator_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_Locator getM_LocatorTo() throws RuntimeException
{
return (I_M_Locator)MTable.get(getCtx(), I_M_Locator.Table_Name)
.getPO(getM_LocatorTo_ID(), get_TrxName()); }
/** Set Locator To.
@param M_LocatorTo_ID
Location inventory is moved to
*/
public void setM_LocatorTo_ID (int M_LocatorTo_ID)
{
if (M_LocatorTo_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_LocatorTo_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_LocatorTo_ID, Integer.valueOf(M_LocatorTo_ID));
}
/** Get Locator To.
@return Location inventory is moved to
*/
public int getM_LocatorTo_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_LocatorTo_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException
{
return (org.compiere.model.I_M_Product)MTable.get(getCtx(), org.compiere.model.I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Product.
@param M_Product_ID
Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_M_Shipper getM_Shipper() throws RuntimeException
{
return (org.compiere.model.I_M_Shipper)MTable.get(getCtx(), org.compiere.model.I_M_Shipper.Table_Name)
.getPO(getM_Shipper_ID(), get_TrxName()); }
/** Set Shipper.
@param M_Shipper_ID
Method or manner of product delivery
*/
public void setM_Shipper_ID (int M_Shipper_ID)
{
if (M_Shipper_ID < 1)
set_Value (COLUMNNAME_M_Shipper_ID, null);
else
set_Value (COLUMNNAME_M_Shipper_ID, Integer.valueOf(M_Shipper_ID));
}
/** Get Shipper.
@return Method or manner of product delivery
*/
public int getM_Shipper_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Shipper_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Picked Quantity.
@param PickedQty Picked Quantity */
public void setPickedQty (BigDecimal PickedQty)
{
set_Value (COLUMNNAME_PickedQty, PickedQty);
}
/** Get Picked Quantity.
@return Picked Quantity */
public BigDecimal getPickedQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PickedQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Processed.
@param Processed
The document has been processed
*/
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Processed.
@return The document has been processed
*/
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Delivered Quantity.
@param QtyDelivered
Delivered Quantity
*/
public void setQtyDelivered (BigDecimal QtyDelivered)
{
set_ValueNoCheck (COLUMNNAME_QtyDelivered, QtyDelivered);
}
/** Get Delivered Quantity.
@return Delivered Quantity
*/
public BigDecimal getQtyDelivered ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyDelivered);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Quantity.
@param QtyEntered
The Quantity Entered is based on the selected UoM
*/
public void setQtyEntered (BigDecimal QtyEntered)
{
set_ValueNoCheck (COLUMNNAME_QtyEntered, QtyEntered);
}
/** Get Quantity.
@return The Quantity Entered is based on the selected UoM
*/
public BigDecimal getQtyEntered ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyEntered);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Qty In Transit.
@param QtyInTransit Qty In Transit */
public void setQtyInTransit (BigDecimal QtyInTransit)
{
set_ValueNoCheck (COLUMNNAME_QtyInTransit, QtyInTransit);
}
/** Get Qty In Transit.
@return Qty In Transit */
public BigDecimal getQtyInTransit ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyInTransit);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Ordered Quantity.
@param QtyOrdered
Ordered Quantity
*/
public void setQtyOrdered (BigDecimal QtyOrdered)
{
set_ValueNoCheck (COLUMNNAME_QtyOrdered, QtyOrdered);
}
/** Get Ordered Quantity.
@return Ordered Quantity
*/
public BigDecimal getQtyOrdered ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOrdered);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Reserved Quantity.
@param QtyReserved
Reserved Quantity
*/
public void setQtyReserved (BigDecimal QtyReserved)
{
set_ValueNoCheck (COLUMNNAME_QtyReserved, QtyReserved);
}
/** Get Reserved Quantity.
@return Reserved Quantity
*/
public BigDecimal getQtyReserved ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyReserved);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Scrapped Quantity.
@param ScrappedQty
The Quantity scrapped due to QA issues
*/
public void setScrappedQty (BigDecimal ScrappedQty)
{
set_Value (COLUMNNAME_ScrappedQty, ScrappedQty);
}
/** Get Scrapped Quantity.
@return The Quantity scrapped due to QA issues
*/
public BigDecimal getScrappedQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ScrappedQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Target Quantity.
@param TargetQty
Target Movement Quantity
*/
public void setTargetQty (BigDecimal TargetQty)
{
set_ValueNoCheck (COLUMNNAME_TargetQty, TargetQty);
}
/** Get Target Quantity.
@return Target Movement Quantity
*/
public BigDecimal getTargetQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TargetQty);
if (bd == null)
return Env.ZERO;
return bd;
}
public org.compiere.model.I_C_ElementValue getUser1() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getUser1_ID(), get_TrxName()); }
/** Set User Element List 1.
@param User1_ID
User defined list element #1
*/
public void setUser1_ID (int User1_ID)
{
if (User1_ID < 1)
set_Value (COLUMNNAME_User1_ID, null);
else
set_Value (COLUMNNAME_User1_ID, Integer.valueOf(User1_ID));
}
/** Get User Element List 1.
@return User defined list element #1
*/
public int getUser1_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User1_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_ElementValue getUser2() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getUser2_ID(), get_TrxName()); }
/** Set User Element List 2.
@param User2_ID
User defined list element #2
*/
public void setUser2_ID (int User2_ID)
{
if (User2_ID < 1)
set_Value (COLUMNNAME_User2_ID, null);
else
set_Value (COLUMNNAME_User2_ID, Integer.valueOf(User2_ID));
}
/** Get User Element List 2.
@return User defined list element #2
*/
public int getUser2_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User2_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}

View File

@ -0,0 +1,99 @@
package andromedia.midsuit.process;
import java.sql.Timestamp;
import java.util.List;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MMovement;
import org.compiere.model.MMovementLine;
import org.compiere.process.DocAction;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
import org.compiere.util.DB;
import andromedia.midsuit.model.MID_MDDOrder;
import andromedia.midsuit.model.MID_MDDOrderLine;
public class MID_ProcessCreateInBoundWH extends SvrProcess {
private Timestamp p_MovementDate = null;
private int p_C_DocType_ID = 0;
@Override
protected void prepare() {
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++) {
String name = para[i].getParameterName();
switch (name) {
case "C_DocType_ID":
p_C_DocType_ID = para[i].getParameterAsInt();
break;
case "MovementDate":
p_MovementDate = para[i].getParameterAsTimestamp();
break;
default:
log.log(Level.SEVERE, "Unknown Parameter: " + name);
break;
}
}
}
@Override
protected String doIt() throws Exception {
// Get Current InterMovement
MID_MDDOrder ddOrder = new MID_MDDOrder(getCtx(), getRecord_ID(), get_TrxName());
MID_MDDOrderLine[] ddOrderLines = ddOrder.getLines("", "");
// Create Movement - Rizky
MMovement movement = new MMovement(getCtx(), 0, get_TrxName());
if (p_MovementDate != null) {
movement.setMovementDate(p_MovementDate);
}
movement.setAD_Org_ID(ddOrder.getAD_Org_ID());
movement.setC_DocType_ID(p_C_DocType_ID);
movement.saveEx();
String toLocatorSQL = "select b.m_locator_id from m_warehouse a "
+ " inner join m_locator b on b.m_warehouse_id = a.m_warehouse_id"
+ " and a.isintransit = 'Y' and a.ad_org_id ="+ddOrder.getAD_Org_ID();
int fromLocatorID = DB.getSQLValue(get_TrxName(), toLocatorSQL);
if (fromLocatorID < 0) {
throw new AdempiereException("Warehouse In-Transit tidak ada!");
}
// Create Inbound Movement for each line
for (MID_MDDOrderLine line : ddOrderLines) {
MMovementLine movementline = new MMovementLine(movement);
movementline.setM_Locator_ID(fromLocatorID);
movementline.setM_LocatorTo_ID(line.getM_LocatorTo_ID());
movementline.setM_Product_ID(line.getM_Product_ID());
movementline.setMovementQty(line.getConfirmedQty());
movementline.setDescription(line.getDescription()==null ? line.getDescription() : "");
movementline.saveEx();
}
// Complete Movement - Rizky
try{
if(!movement.processIt(DocAction.ACTION_Complete)){
throw new AdempiereException("Cannot Complete Inbound Movement" + movement.getProcessMsg());
}
movement.saveEx();
}catch(Exception e){
throw new AdempiereException("Cannot Complete Inbound Movement" + movement.getProcessMsg());
}
// Set Inbound to InterWarehouse Movement
ddOrder.setDateReceived(p_MovementDate);
ddOrder.set_ValueNoCheck("IsDelivered", true);
ddOrder.setM_MovementIn_ID(movement.get_ID());
ddOrder.saveEx();
return null;
}
}

View File

@ -0,0 +1,93 @@
package andromedia.midsuit.process;
import java.sql.Timestamp;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MMovement;
import org.compiere.model.MMovementLine;
import org.compiere.process.DocAction;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
import org.compiere.util.DB;
import andromedia.midsuit.model.MID_MDDOrder;
import andromedia.midsuit.model.MID_MDDOrderLine;
public class MID_ProcessCreateOutBoundWH extends SvrProcess {
private Timestamp p_MovementDate = null;
private int p_C_DocType_ID = 0;
@Override
protected void prepare() {
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++) {
String name = para[i].getParameterName();
switch (name) {
case "C_DocType_ID":
p_C_DocType_ID = para[i].getParameterAsInt();
break;
case "MovementDate":
p_MovementDate = para[i].getParameterAsTimestamp();
break;
default:
log.log(Level.SEVERE, "Unknown Parameter: " + name);
break;
}
}
}
@Override
protected String doIt() throws Exception {
// Get Current InterMovement
MID_MDDOrder ddOrder = new MID_MDDOrder(getCtx(), getRecord_ID(), get_TrxName());
MID_MDDOrderLine[] ddOrderLines = ddOrder.getLines("", "");
// Create Movement - Rizky
MMovement movement = new MMovement(getCtx(), 0, get_TrxName());
if (p_MovementDate != null) {
movement.setMovementDate(p_MovementDate);
}
movement.setDescription(ddOrder.getDescription()!=null ?ddOrder.getDescription() : "");
movement.setAD_Org_ID(ddOrder.getAD_Org_ID());
movement.setC_DocType_ID(p_C_DocType_ID);
movement.saveEx();
String toLocatorSQL = "select b.M_Locator_ID from m_warehouse a "
+ " inner join m_locator b on b.m_warehouse_id = a.m_warehouse_id"
+ " and a.isintransit = 'Y' AND a.AD_Org_ID =" + ddOrder.getAD_Org_ID();
int toLocatorID = DB.getSQLValue(get_TrxName(), toLocatorSQL);
if (toLocatorID < 0) {
throw new AdempiereException("Warehouse In-Transit tidak ada!");
}
// Create Outbound Movement for each line
for (MID_MDDOrderLine line : ddOrderLines) {
MMovementLine movementline = new MMovementLine(movement);
movementline.setM_Locator_ID(line.getM_Locator_ID());
movementline.setM_LocatorTo_ID(toLocatorID);
movementline.setM_Product_ID(line.getM_Product_ID());
movementline.setMovementQty(line.getQtyEntered());
movementline.setDescription(line.getDescription()!=null ? line.getDescription() : "");
movementline.saveEx();
}
// Complete Movement - Rizky
try{
if(!movement.processIt(DocAction.ACTION_Complete)){
throw new AdempiereException("Cannot Complete Inbound Movement" + movement.getProcessMsg());
}
}catch(Exception e){
throw new AdempiereException("Cannot Complete Inbound Movement" + movement.getProcessMsg());
}
// Set Outbound to InterWarehouse Movement
ddOrder.setIsInTransit(true);
ddOrder.setM_MovementOut_ID(movement.get_ID());
ddOrder.saveEx();
return "";
}
}