- Implemented missing counter document support for RMA
- Fixed CreateFromInvoice implementation for RMA
- Vendor Return is captured in Shipment window
- Customer Return is captured in Material Receipt window
This commit is contained in:
Heng Sin Low 2009-06-01 05:23:43 +00:00
parent 41e9ce441d
commit a3d3c92dc7
14 changed files with 1505 additions and 840 deletions

View File

@ -29,8 +29,8 @@ import org.compiere.util.Env;
/** /**
* Shipment/Receipt Callouts * Shipment/Receipt Callouts
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: CalloutInOut.java,v 1.7 2006/07/30 00:51:05 jjanke Exp $ * @version $Id: CalloutInOut.java,v 1.7 2006/07/30 00:51:05 jjanke Exp $
* @author victor.perez@e-evolution.com www.e-evolution.com [ 1867464 ] http://sourceforge.net/tracker/index.php?func=detail&aid=1867464&group_id=176962&atid=879332 * @author victor.perez@e-evolution.com www.e-evolution.com [ 1867464 ] http://sourceforge.net/tracker/index.php?func=detail&aid=1867464&group_id=176962&atid=879332
@ -54,7 +54,7 @@ public class CalloutInOut extends CalloutEngine
// No Callout Active to fire dependent values // No Callout Active to fire dependent values
if (isCalloutActive()) // prevent recursive if (isCalloutActive()) // prevent recursive
return ""; return "";
// Get Details // Get Details
MOrder order = new MOrder (ctx, C_Order_ID.intValue(), null); MOrder order = new MOrder (ctx, C_Order_ID.intValue(), null);
if (order.get_ID() != 0) if (order.get_ID() != 0)
@ -77,15 +77,15 @@ public class CalloutInOut extends CalloutEngine
mTab.setValue("FreightAmt", order.getFreightAmt()); mTab.setValue("FreightAmt", order.getFreightAmt());
mTab.setValue("C_BPartner_ID", new Integer(order.getC_BPartner_ID())); mTab.setValue("C_BPartner_ID", new Integer(order.getC_BPartner_ID()));
//[ 1867464 ] //[ 1867464 ]
mTab.setValue("C_BPartner_Location_ID", new Integer(order.getC_BPartner_Location_ID())); mTab.setValue("C_BPartner_Location_ID", new Integer(order.getC_BPartner_Location_ID()));
mTab.setValue("AD_User_ID", new Integer(order.getAD_User_ID())); mTab.setValue("AD_User_ID", new Integer(order.getAD_User_ID()));
} }
return ""; return "";
} // order } // order
/** /**
* InOut - DocType. * InOut - DocType.
* - sets MovementType * - sets MovementType
@ -107,7 +107,7 @@ public class CalloutInOut extends CalloutEngine
+ "s.AD_Sequence_ID, s.StartNewYear, s.DateColumn, d.IsSOTrx " //4..7 + "s.AD_Sequence_ID, s.StartNewYear, s.DateColumn, d.IsSOTrx " //4..7
+ "FROM C_DocType d " + "FROM C_DocType d "
+ "LEFT OUTER JOIN AD_Sequence s ON (d.DocNoSequence_ID=s.AD_Sequence_ID) " + "LEFT OUTER JOIN AD_Sequence s ON (d.DocNoSequence_ID=s.AD_Sequence_ID) "
+ "WHERE C_DocType_ID=?"; // 1 + "WHERE C_DocType_ID=?"; // 1
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
@ -123,26 +123,28 @@ public class CalloutInOut extends CalloutEngine
// BF [2708789] Read IsSOTrx from C_DocType // BF [2708789] Read IsSOTrx from C_DocType
String trxFlag = rs.getString(7); String trxFlag = rs.getString(7);
if (DocBaseType.equals("MMS")) // Material Shipments if (DocBaseType.equals("MMS")) // Material Shipments
/**solve 1648131 bug vpj-cd e-evolution */ /**solve 1648131 bug vpj-cd e-evolution */
{ {
boolean IsSOTrx = "Y".equals(trxFlag); boolean IsSOTrx = "Y".equals(trxFlag);
if (IsSOTrx) if (IsSOTrx)
mTab.setValue("MovementType", "C-"); // Customer Shipments mTab.setValue("MovementType", "C-"); // Customer Shipments
else else
mTab.setValue("MovementType", "V-"); // Vendor Return mTab.setValue("MovementType", "V-"); // Vendor Return
} }
/**END vpj-cd e-evolution */ /**END vpj-cd e-evolution */
else if (DocBaseType.equals("MMR")) // Material Receipts else if (DocBaseType.equals("MMR")) // Material Receipts
/**solve 1648131 bug vpj-cd e-evolution */ /**solve 1648131 bug vpj-cd e-evolution */
{ {
boolean IsSOTrx = "Y".equals(trxFlag); boolean IsSOTrx = "Y".equals(trxFlag);
if (IsSOTrx) if (IsSOTrx)
mTab.setValue("MovementType", "C+"); // Customer Return mTab.setValue("MovementType", "C+"); // Customer Return
else else
mTab.setValue("MovementType", "V+"); // Vendor Receipts mTab.setValue("MovementType", "V+"); // Vendor Receipts
} }
/**END vpj-cd e-evolution */ if (!(trxFlag.equals(mTab.getValue("IsSOTrx"))))
mTab.setValue("IsSOTrx", trxFlag);
/**END vpj-cd e-evolution */
// DocumentNo // DocumentNo
if (rs.getString("IsDocNoControlled").equals("Y")) if (rs.getString("IsDocNoControlled").equals("Y"))
@ -151,9 +153,9 @@ public class CalloutInOut extends CalloutEngine
{ {
String dateColumn = rs.getString(6); String dateColumn = rs.getString(6);
int AD_Sequence_ID = rs.getInt(4); int AD_Sequence_ID = rs.getInt(4);
mTab.setValue("DocumentNo", mTab.setValue("DocumentNo",
"<" "<"
+ MSequence.getPreliminaryNoByYear(mTab, AD_Sequence_ID, dateColumn, null) + MSequence.getPreliminaryNoByYear(mTab, AD_Sequence_ID, dateColumn, null)
+ ">"); + ">");
} }
else else
@ -214,7 +216,7 @@ public class CalloutInOut extends CalloutEngine
//[ 1867464 ] //[ 1867464 ]
boolean IsSOTrx = "Y".equals(Env.getContext(ctx, WindowNo, "IsSOTrx")); boolean IsSOTrx = "Y".equals(Env.getContext(ctx, WindowNo, "IsSOTrx"));
if (!IsSOTrx) if (!IsSOTrx)
{ {
// Location // Location
Integer ii = new Integer(rs.getInt("C_BPartner_Location_ID")); Integer ii = new Integer(rs.getInt("C_BPartner_Location_ID"));
if (rs.wasNull()) if (rs.wasNull())
@ -250,7 +252,7 @@ public class CalloutInOut extends CalloutEngine
{ {
DB.close(rs, pstmt); DB.close(rs, pstmt);
} }
return ""; return "";
} // bpartner } // bpartner
@ -315,7 +317,7 @@ public class CalloutInOut extends CalloutEngine
return ""; return "";
} // warehouse } // warehouse
/************************************************************************** /**************************************************************************
* OrderLine Callout * OrderLine Callout
* @param ctx context * @param ctx context
@ -330,7 +332,7 @@ public class CalloutInOut extends CalloutEngine
Integer C_OrderLine_ID = (Integer)value; Integer C_OrderLine_ID = (Integer)value;
if (C_OrderLine_ID == null || C_OrderLine_ID.intValue() == 0) if (C_OrderLine_ID == null || C_OrderLine_ID.intValue() == 0)
return ""; return "";
// Get Details // Get Details
MOrderLine ol = new MOrderLine (ctx, C_OrderLine_ID.intValue(), null); MOrderLine ol = new MOrderLine (ctx, C_OrderLine_ID.intValue(), null);
if (ol.get_ID() != 0) if (ol.get_ID() != 0)
@ -375,13 +377,13 @@ public class CalloutInOut extends CalloutEngine
Integer M_Product_ID = (Integer)value; Integer M_Product_ID = (Integer)value;
if (M_Product_ID == null || M_Product_ID.intValue() == 0) if (M_Product_ID == null || M_Product_ID.intValue() == 0)
return ""; return "";
// Set Attribute & Locator // Set Attribute & Locator
int M_Locator_ID = 0; int M_Locator_ID = 0;
if (Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_Product_ID") == M_Product_ID.intValue() if (Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_Product_ID") == M_Product_ID.intValue()
&& Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID") != 0) && Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID") != 0)
{ {
mTab.setValue("M_AttributeSetInstance_ID", mTab.setValue("M_AttributeSetInstance_ID",
new Integer(Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID"))); new Integer(Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID")));
M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_Locator_ID"); M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_Locator_ID");
if (M_Locator_ID != 0) if (M_Locator_ID != 0)
@ -436,7 +438,7 @@ public class CalloutInOut extends CalloutEngine
int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID");
// log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID); // log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID);
BigDecimal MovementQty, QtyEntered; BigDecimal MovementQty, QtyEntered;
// No Product // No Product
if (M_Product_ID == 0) if (M_Product_ID == 0)
{ {
@ -451,19 +453,19 @@ public class CalloutInOut extends CalloutEngine
BigDecimal QtyEntered1 = QtyEntered.setScale(MUOM.getPrecision(ctx, C_UOM_To_ID), BigDecimal.ROUND_HALF_UP); BigDecimal QtyEntered1 = QtyEntered.setScale(MUOM.getPrecision(ctx, C_UOM_To_ID), BigDecimal.ROUND_HALF_UP);
if (QtyEntered.compareTo(QtyEntered1) != 0) if (QtyEntered.compareTo(QtyEntered1) != 0)
{ {
log.fine("Corrected QtyEntered Scale UOM=" + C_UOM_To_ID log.fine("Corrected QtyEntered Scale UOM=" + C_UOM_To_ID
+ "; QtyEntered=" + QtyEntered + "->" + QtyEntered1); + "; QtyEntered=" + QtyEntered + "->" + QtyEntered1);
QtyEntered = QtyEntered1; QtyEntered = QtyEntered1;
mTab.setValue("QtyEntered", QtyEntered); mTab.setValue("QtyEntered", QtyEntered);
} }
MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID, MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered); C_UOM_To_ID, QtyEntered);
if (MovementQty == null) if (MovementQty == null)
MovementQty = QtyEntered; MovementQty = QtyEntered;
boolean conversion = QtyEntered.compareTo(MovementQty) != 0; boolean conversion = QtyEntered.compareTo(MovementQty) != 0;
log.fine("UOM=" + C_UOM_To_ID log.fine("UOM=" + C_UOM_To_ID
+ ", QtyEntered=" + QtyEntered + ", QtyEntered=" + QtyEntered
+ " -> " + conversion + " -> " + conversion
+ " MovementQty=" + MovementQty); + " MovementQty=" + MovementQty);
Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N"); Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
mTab.setValue("MovementQty", MovementQty); mTab.setValue("MovementQty", MovementQty);
@ -482,19 +484,19 @@ public class CalloutInOut extends CalloutEngine
BigDecimal QtyEntered1 = QtyEntered.setScale(MUOM.getPrecision(ctx, C_UOM_To_ID), BigDecimal.ROUND_HALF_UP); BigDecimal QtyEntered1 = QtyEntered.setScale(MUOM.getPrecision(ctx, C_UOM_To_ID), BigDecimal.ROUND_HALF_UP);
if (QtyEntered.compareTo(QtyEntered1) != 0) if (QtyEntered.compareTo(QtyEntered1) != 0)
{ {
log.fine("Corrected QtyEntered Scale UOM=" + C_UOM_To_ID log.fine("Corrected QtyEntered Scale UOM=" + C_UOM_To_ID
+ "; QtyEntered=" + QtyEntered + "->" + QtyEntered1); + "; QtyEntered=" + QtyEntered + "->" + QtyEntered1);
QtyEntered = QtyEntered1; QtyEntered = QtyEntered1;
mTab.setValue("QtyEntered", QtyEntered); mTab.setValue("QtyEntered", QtyEntered);
} }
MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID, MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered); C_UOM_To_ID, QtyEntered);
if (MovementQty == null) if (MovementQty == null)
MovementQty = QtyEntered; MovementQty = QtyEntered;
boolean conversion = QtyEntered.compareTo(MovementQty) != 0; boolean conversion = QtyEntered.compareTo(MovementQty) != 0;
log.fine("UOM=" + C_UOM_To_ID log.fine("UOM=" + C_UOM_To_ID
+ ", QtyEntered=" + QtyEntered + ", QtyEntered=" + QtyEntered
+ " -> " + conversion + " -> " + conversion
+ " MovementQty=" + MovementQty); + " MovementQty=" + MovementQty);
Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N"); Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
mTab.setValue("MovementQty", MovementQty); mTab.setValue("MovementQty", MovementQty);
@ -504,23 +506,23 @@ public class CalloutInOut extends CalloutEngine
{ {
int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID");
MovementQty = (BigDecimal)value; MovementQty = (BigDecimal)value;
int precision = MProduct.get(ctx, M_Product_ID).getUOMPrecision(); int precision = MProduct.get(ctx, M_Product_ID).getUOMPrecision();
BigDecimal MovementQty1 = MovementQty.setScale(precision, BigDecimal.ROUND_HALF_UP); BigDecimal MovementQty1 = MovementQty.setScale(precision, BigDecimal.ROUND_HALF_UP);
if (MovementQty.compareTo(MovementQty1) != 0) if (MovementQty.compareTo(MovementQty1) != 0)
{ {
log.fine("Corrected MovementQty " log.fine("Corrected MovementQty "
+ MovementQty + "->" + MovementQty1); + MovementQty + "->" + MovementQty1);
MovementQty = MovementQty1; MovementQty = MovementQty1;
mTab.setValue("MovementQty", MovementQty); mTab.setValue("MovementQty", MovementQty);
} }
QtyEntered = MUOMConversion.convertProductTo (ctx, M_Product_ID, QtyEntered = MUOMConversion.convertProductTo (ctx, M_Product_ID,
C_UOM_To_ID, MovementQty); C_UOM_To_ID, MovementQty);
if (QtyEntered == null) if (QtyEntered == null)
QtyEntered = MovementQty; QtyEntered = MovementQty;
boolean conversion = MovementQty.compareTo(QtyEntered) != 0; boolean conversion = MovementQty.compareTo(QtyEntered) != 0;
log.fine("UOM=" + C_UOM_To_ID log.fine("UOM=" + C_UOM_To_ID
+ ", MovementQty=" + MovementQty + ", MovementQty=" + MovementQty
+ " -> " + conversion + " -> " + conversion
+ " QtyEntered=" + QtyEntered); + " QtyEntered=" + QtyEntered);
Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N"); Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
mTab.setValue("QtyEntered", QtyEntered); mTab.setValue("QtyEntered", QtyEntered);
@ -551,7 +553,7 @@ public class CalloutInOut extends CalloutEngine
int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, "M_Locator_ID"); int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, "M_Locator_ID");
log.fine("M_Product_ID=" + M_Product_ID log.fine("M_Product_ID=" + M_Product_ID
+ ", M_ASI_ID=" + M_ASI_ID + ", M_ASI_ID=" + M_ASI_ID
+ " - M_Warehouse_ID=" + M_Warehouse_ID + " - M_Warehouse_ID=" + M_Warehouse_ID
+ ", M_Locator_ID=" + M_Locator_ID); + ", M_Locator_ID=" + M_Locator_ID);
// Check Selection // Check Selection
int M_AttributeSetInstance_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID"); int M_AttributeSetInstance_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID");

View File

@ -279,19 +279,6 @@ public interface I_M_RMA
*/ */
public boolean isSOTrx(); public boolean isSOTrx();
/** Column name M_RMA_ID */
public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID";
/** Set RMA.
* Return Material Authorization
*/
public void setM_RMA_ID (int M_RMA_ID);
/** Get RMA.
* Return Material Authorization
*/
public int getM_RMA_ID();
/** Column name M_RMAType_ID */ /** Column name M_RMAType_ID */
public static final String COLUMNNAME_M_RMAType_ID = "M_RMAType_ID"; public static final String COLUMNNAME_M_RMAType_ID = "M_RMAType_ID";
@ -307,6 +294,19 @@ public interface I_M_RMA
public I_M_RMAType getM_RMAType() throws RuntimeException; public I_M_RMAType getM_RMAType() throws RuntimeException;
/** Column name M_RMA_ID */
public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID";
/** Set RMA.
* Return Material Authorization
*/
public void setM_RMA_ID (int M_RMA_ID);
/** Get RMA.
* Return Material Authorization
*/
public int getM_RMA_ID();
/** Column name Name */ /** Column name Name */
public static final String COLUMNNAME_Name = "Name"; public static final String COLUMNNAME_Name = "Name";
@ -342,6 +342,15 @@ public interface I_M_RMA
/** Get Process Now */ /** Get Process Now */
public boolean isProcessing(); public boolean isProcessing();
/** Column name Ref_RMA_ID */
public static final String COLUMNNAME_Ref_RMA_ID = "Ref_RMA_ID";
/** Set Referenced RMA */
public void setRef_RMA_ID (int Ref_RMA_ID);
/** Get Referenced RMA */
public int getRef_RMA_ID();
/** Column name SalesRep_ID */ /** Column name SalesRep_ID */
public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID"; public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID";

View File

@ -173,6 +173,19 @@ public interface I_M_RMALine
public I_M_InOutLine getM_InOutLine() throws RuntimeException; public I_M_InOutLine getM_InOutLine() throws RuntimeException;
/** Column name M_RMALine_ID */
public static final String COLUMNNAME_M_RMALine_ID = "M_RMALine_ID";
/** Set RMA Line.
* Return Material Authorization Line
*/
public void setM_RMALine_ID (int M_RMALine_ID);
/** Get RMA Line.
* Return Material Authorization Line
*/
public int getM_RMALine_ID();
/** Column name M_RMA_ID */ /** Column name M_RMA_ID */
public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID"; public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID";
@ -188,19 +201,6 @@ public interface I_M_RMALine
public I_M_RMA getM_RMA() throws RuntimeException; public I_M_RMA getM_RMA() throws RuntimeException;
/** Column name M_RMALine_ID */
public static final String COLUMNNAME_M_RMALine_ID = "M_RMALine_ID";
/** Set RMA Line.
* Return Material Authorization Line
*/
public void setM_RMALine_ID (int M_RMALine_ID);
/** Get RMA Line.
* Return Material Authorization Line
*/
public int getM_RMALine_ID();
/** Column name Processed */ /** Column name Processed */
public static final String COLUMNNAME_Processed = "Processed"; public static final String COLUMNNAME_Processed = "Processed";
@ -240,6 +240,28 @@ public interface I_M_RMALine
*/ */
public BigDecimal getQtyDelivered(); public BigDecimal getQtyDelivered();
/** Column name QtyInvoiced */
public static final String COLUMNNAME_QtyInvoiced = "QtyInvoiced";
/** Set Quantity Invoiced.
* Invoiced Quantity
*/
public void setQtyInvoiced (BigDecimal QtyInvoiced);
/** Get Quantity Invoiced.
* Invoiced Quantity
*/
public BigDecimal getQtyInvoiced();
/** Column name Ref_RMALine_ID */
public static final String COLUMNNAME_Ref_RMALine_ID = "Ref_RMALine_ID";
/** Set Referenced RMA Line */
public void setRef_RMALine_ID (int Ref_RMALine_ID);
/** Get Referenced RMA Line */
public int getRef_RMALine_ID();
/** Column name Updated */ /** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated"; public static final String COLUMNNAME_Updated = "Updated";

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@ import org.compiere.util.Util;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: MInOutLine.java,v 1.5 2006/07/30 00:51:03 jjanke Exp $ * @version $Id: MInOutLine.java,v 1.5 2006/07/30 00:51:03 jjanke Exp $
* *
* @author Teo Sarca, www.arhipac.ro * @author Teo Sarca, www.arhipac.ro
* <li>BF [ 2784194 ] Check Warehouse-Locator conflict * <li>BF [ 2784194 ] Check Warehouse-Locator conflict
* https://sourceforge.net/tracker/?func=detail&aid=2784194&group_id=176962&atid=879332 * https://sourceforge.net/tracker/?func=detail&aid=2784194&group_id=176962&atid=879332
@ -41,9 +41,9 @@ import org.compiere.util.Util;
public class MInOutLine extends X_M_InOutLine public class MInOutLine extends X_M_InOutLine
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -1196352601949381166L; private static final long serialVersionUID = 8630611882798722864L;
/** /**
* Get Ship lines Of Order Line * Get Ship lines Of Order Line
@ -53,7 +53,7 @@ public class MInOutLine extends X_M_InOutLine
* @param trxName transaction * @param trxName transaction
* @return array of receipt lines * @return array of receipt lines
*/ */
public static MInOutLine[] getOfOrderLine (Properties ctx, public static MInOutLine[] getOfOrderLine (Properties ctx,
int C_OrderLine_ID, String where, String trxName) int C_OrderLine_ID, String where, String trxName)
{ {
String whereClause = "C_OrderLine_ID=?" + (!Util.isEmpty(where, true) ? " AND "+where : ""); String whereClause = "C_OrderLine_ID=?" + (!Util.isEmpty(where, true) ? " AND "+where : "");
@ -63,6 +63,24 @@ public class MInOutLine extends X_M_InOutLine
return list.toArray (new MInOutLine[list.size()]); return list.toArray (new MInOutLine[list.size()]);
} // getOfOrderLine } // getOfOrderLine
/**
* Get Ship lines Of RMA Line
* @param ctx context
* @param M_RMALine_ID line
* @param where optional addition where clause
* @param trxName transaction
* @return array of receipt lines
*/
public static MInOutLine[] getOfRMALine (Properties ctx,
int M_RMALine_ID, String where, String trxName)
{
String whereClause = "M_RMALine_ID=? " + (!Util.isEmpty(where, true) ? " AND "+where : "");
List<MRMALine> list = new Query(ctx, Table_Name, whereClause, trxName)
.setParameters(new Object[]{M_RMALine_ID})
.list();
return list.toArray (new MInOutLine[list.size()]);
} // getOfRMALine
/** /**
* Get Ship lines Of Order Line * Get Ship lines Of Order Line
* @param ctx context * @param ctx context
@ -74,8 +92,8 @@ public class MInOutLine extends X_M_InOutLine
{ {
return getOfOrderLine(ctx, C_OrderLine_ID, null, trxName); return getOfOrderLine(ctx, C_OrderLine_ID, null, trxName);
} // get } // get
/************************************************************************** /**************************************************************************
* Standard Constructor * Standard Constructor
* @param ctx context * @param ctx context
@ -133,7 +151,7 @@ public class MInOutLine extends X_M_InOutLine
private int m_M_Warehouse_ID = 0; private int m_M_Warehouse_ID = 0;
/** Parent */ /** Parent */
private MInOut m_parent = null; private MInOut m_parent = null;
/** /**
* Get Parent * Get Parent
* @return parent * @return parent
@ -144,7 +162,7 @@ public class MInOutLine extends X_M_InOutLine
m_parent = new MInOut (getCtx(), getM_InOut_ID(), get_TrxName()); m_parent = new MInOut (getCtx(), getM_InOut_ID(), get_TrxName());
return m_parent; return m_parent;
} // getParent } // getParent
/** /**
* Set Order Line. * Set Order Line.
* Does not set Quantity! * Does not set Quantity!
@ -192,7 +210,7 @@ public class MInOutLine extends X_M_InOutLine
setUser1_ID(oLine.getUser1_ID()); setUser1_ID(oLine.getUser1_ID());
setUser2_ID(oLine.getUser2_ID()); setUser2_ID(oLine.getUser2_ID());
} // setOrderLine } // setOrderLine
/** /**
* Set Invoice Line. * Set Invoice Line.
* Does not set Quantity! * Does not set Quantity!
@ -215,7 +233,7 @@ public class MInOutLine extends X_M_InOutLine
else else
{ {
setM_Product_ID(M_Product_ID); setM_Product_ID(M_Product_ID);
setM_AttributeSetInstance_ID(iLine.getM_AttributeSetInstance_ID()); setM_AttributeSetInstance_ID(iLine.getM_AttributeSetInstance_ID());
if (M_Locator_ID == 0) if (M_Locator_ID == 0)
setM_Locator_ID(Qty); // requires warehouse, product, asi setM_Locator_ID(Qty); // requires warehouse, product, asi
else else
@ -234,7 +252,7 @@ public class MInOutLine extends X_M_InOutLine
setUser1_ID(iLine.getUser1_ID()); setUser1_ID(iLine.getUser1_ID());
setUser2_ID(iLine.getUser2_ID()); setUser2_ID(iLine.getUser2_ID());
} // setInvoiceLine } // setInvoiceLine
/** /**
* Get Warehouse * Get Warehouse
* @return Returns the m_Warehouse_ID. * @return Returns the m_Warehouse_ID.
@ -245,7 +263,7 @@ public class MInOutLine extends X_M_InOutLine
m_M_Warehouse_ID = getParent().getM_Warehouse_ID(); m_M_Warehouse_ID = getParent().getM_Warehouse_ID();
return m_M_Warehouse_ID; return m_M_Warehouse_ID;
} // getM_Warehouse_ID } // getM_Warehouse_ID
/** /**
* Set Warehouse * Set Warehouse
* @param warehouse_ID The m_Warehouse_ID to set. * @param warehouse_ID The m_Warehouse_ID to set.
@ -262,12 +280,12 @@ public class MInOutLine extends X_M_InOutLine
@Override @Override
public void setM_Locator_ID (int M_Locator_ID) public void setM_Locator_ID (int M_Locator_ID)
{ {
if (M_Locator_ID < 0) if (M_Locator_ID < 0)
throw new IllegalArgumentException ("M_Locator_ID is mandatory."); throw new IllegalArgumentException ("M_Locator_ID is mandatory.");
// set to 0 explicitly to reset // set to 0 explicitly to reset
set_Value (COLUMNNAME_M_Locator_ID, new Integer(M_Locator_ID)); set_Value (COLUMNNAME_M_Locator_ID, new Integer(M_Locator_ID));
} // setM_Locator_ID } // setM_Locator_ID
/** /**
* Set (default) Locator based on qty. * Set (default) Locator based on qty.
* @param Qty quantity * @param Qty quantity
@ -284,10 +302,10 @@ public class MInOutLine extends X_M_InOutLine
set_ValueNoCheck(COLUMNNAME_M_Locator_ID, null); set_ValueNoCheck(COLUMNNAME_M_Locator_ID, null);
return; return;
} }
// Get existing Location // Get existing Location
int M_Locator_ID = MStorage.getM_Locator_ID (getM_Warehouse_ID(), int M_Locator_ID = MStorage.getM_Locator_ID (getM_Warehouse_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(),
Qty, get_TrxName()); Qty, get_TrxName());
// Get default Location // Get default Location
if (M_Locator_ID == 0) if (M_Locator_ID == 0)
@ -297,7 +315,7 @@ public class MInOutLine extends X_M_InOutLine
} }
setM_Locator_ID(M_Locator_ID); setM_Locator_ID(M_Locator_ID);
} // setM_Locator_ID } // setM_Locator_ID
/** /**
* Set Movement/Movement Qty * Set Movement/Movement Qty
* @param Qty Entered/Movement Qty * @param Qty Entered/Movement Qty
@ -309,7 +327,7 @@ public class MInOutLine extends X_M_InOutLine
} // setQtyInvoiced } // setQtyInvoiced
/** /**
* Set Qty Entered - enforce entered UOM * Set Qty Entered - enforce entered UOM
* @param QtyEntered * @param QtyEntered
*/ */
public void setQtyEntered (BigDecimal QtyEntered) public void setQtyEntered (BigDecimal QtyEntered)
@ -323,7 +341,7 @@ public class MInOutLine extends X_M_InOutLine
} // setQtyEntered } // setQtyEntered
/** /**
* Set Movement Qty - enforce Product UOM * Set Movement Qty - enforce Product UOM
* @param MovementQty * @param MovementQty
*/ */
public void setMovementQty (BigDecimal MovementQty) public void setMovementQty (BigDecimal MovementQty)
@ -347,7 +365,7 @@ public class MInOutLine extends X_M_InOutLine
m_product = MProduct.get (getCtx(), getM_Product_ID()); m_product = MProduct.get (getCtx(), getM_Product_ID());
return m_product; return m_product;
} // getProduct } // getProduct
/** /**
* Set Product * Set Product
* @param product product * @param product product
@ -367,7 +385,7 @@ public class MInOutLine extends X_M_InOutLine
} }
setM_AttributeSetInstance_ID(0); setM_AttributeSetInstance_ID(0);
} // setProduct } // setProduct
/** /**
* Set M_Product_ID * Set M_Product_ID
* @param M_Product_ID product * @param M_Product_ID product
@ -381,7 +399,7 @@ public class MInOutLine extends X_M_InOutLine
super.setM_Product_ID (M_Product_ID); super.setM_Product_ID (M_Product_ID);
setM_AttributeSetInstance_ID(0); setM_AttributeSetInstance_ID(0);
} // setM_Product_ID } // setM_Product_ID
/** /**
* Set Product and UOM * Set Product and UOM
* @param M_Product_ID product * @param M_Product_ID product
@ -408,7 +426,7 @@ public class MInOutLine extends X_M_InOutLine
else else
setDescription(desc + " | " + description); setDescription(desc + " | " + description);
} // addDescription } // addDescription
/** /**
* Get C_Project_ID * Get C_Project_ID
* @return project * @return project
@ -420,7 +438,7 @@ public class MInOutLine extends X_M_InOutLine
ii = getParent().getC_Project_ID(); ii = getParent().getC_Project_ID();
return ii; return ii;
} // getC_Project_ID } // getC_Project_ID
/** /**
* Get C_Activity_ID * Get C_Activity_ID
* @return Activity * @return Activity
@ -432,7 +450,7 @@ public class MInOutLine extends X_M_InOutLine
ii = getParent().getC_Activity_ID(); ii = getParent().getC_Activity_ID();
return ii; return ii;
} // getC_Activity_ID } // getC_Activity_ID
/** /**
* Get C_Campaign_ID * Get C_Campaign_ID
* @return Campaign * @return Campaign
@ -444,7 +462,7 @@ public class MInOutLine extends X_M_InOutLine
ii = getParent().getC_Campaign_ID(); ii = getParent().getC_Campaign_ID();
return ii; return ii;
} // getC_Campaign_ID } // getC_Campaign_ID
/** /**
* Get User2_ID * Get User2_ID
* @return User2 * @return User2
@ -495,13 +513,13 @@ public class MInOutLine extends X_M_InOutLine
} }
// Locator is mandatory if no charge is defined - teo_sarca BF [ 2757978 ] // Locator is mandatory if no charge is defined - teo_sarca BF [ 2757978 ]
if(getProduct() != null && MProduct.PRODUCTTYPE_Item.equals(getProduct().getProductType())) if(getProduct() != null && MProduct.PRODUCTTYPE_Item.equals(getProduct().getProductType()))
{ {
if (getM_Locator_ID() <= 0 && getC_Charge_ID() <= 0) if (getM_Locator_ID() <= 0 && getC_Charge_ID() <= 0)
{ {
throw new FillMandatoryException(COLUMNNAME_M_Locator_ID); throw new FillMandatoryException(COLUMNNAME_M_Locator_ID);
} }
} }
// Get Line No // Get Line No
if (getLine() == 0) if (getLine() == 0)
{ {
@ -523,7 +541,7 @@ public class MInOutLine extends X_M_InOutLine
setQtyEntered(getQtyEntered()); setQtyEntered(getQtyEntered());
if (newRecord || is_ValueChanged("MovementQty")) if (newRecord || is_ValueChanged("MovementQty"))
setMovementQty(getMovementQty()); setMovementQty(getMovementQty());
// Order/RMA Line // Order/RMA Line
if (getC_OrderLine_ID() == 0 && getM_RMALine_ID() == 0) if (getC_OrderLine_ID() == 0 && getM_RMALine_ID() == 0)
{ {
@ -533,7 +551,7 @@ public class MInOutLine extends X_M_InOutLine
return false; return false;
} }
} }
// Validate Locator/Warehouse - teo_sarca, BF [ 2784194 ] // Validate Locator/Warehouse - teo_sarca, BF [ 2784194 ]
if (getM_Locator_ID() > 0) if (getM_Locator_ID() > 0)
{ {
@ -546,10 +564,10 @@ public class MInOutLine extends X_M_InOutLine
getLine()); getLine());
} }
} }
// if (getC_Charge_ID() == 0 && getM_Product_ID() == 0) // if (getC_Charge_ID() == 0 && getM_Product_ID() == 0)
// ; // ;
/** Qty on instance ASI /** Qty on instance ASI
if (getM_AttributeSetInstance_ID() != 0) if (getM_AttributeSetInstance_ID() != 0)
{ {
@ -564,7 +582,7 @@ public class MInOutLine extends X_M_InOutLine
// Max // Max
if (isInstance) if (isInstance)
{ {
MStorage storage = MStorage.get(getCtx(), getM_Locator_ID(), MStorage storage = MStorage.get(getCtx(), getM_Locator_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(), get_TrxName()); getM_Product_ID(), getM_AttributeSetInstance_ID(), get_TrxName());
if (storage != null) if (storage != null)
{ {
@ -572,16 +590,16 @@ public class MInOutLine extends X_M_InOutLine
if (getMovementQty().compareTo(qty) > 0) if (getMovementQty().compareTo(qty) > 0)
{ {
log.warning("Qty - Stock=" + qty + ", Movement=" + getMovementQty()); log.warning("Qty - Stock=" + qty + ", Movement=" + getMovementQty());
log.saveError("QtyInsufficient", "=" + qty); log.saveError("QtyInsufficient", "=" + qty);
return false; return false;
} }
} }
} }
} /**/ } /**/
return true; return true;
} // beforeSave } // beforeSave
/** /**
* Before Delete * Before Delete
* @return true if drafted * @return true if drafted
@ -620,7 +638,7 @@ public class MInOutLine extends X_M_InOutLine
{ {
MInvoiceLine m_il = MInvoiceLine.getOfInOutLine(this); MInvoiceLine m_il = MInvoiceLine.getOfInOutLine(this);
if (m_il == null) if (m_il == null)
{ {
log.severe("No Invoice Line for: " + this.toString()); log.severe("No Invoice Line for: " + this.toString());
return Env.ZERO; return Env.ZERO;
} }
@ -654,19 +672,19 @@ public class MInOutLine extends X_M_InOutLine
log.severe("Invalid Criteria: " + CostDistribution); log.severe("Invalid Criteria: " + CostDistribution);
return Env.ZERO; return Env.ZERO;
} // getBase } // getBase
public boolean sameOrderLineUOM() public boolean sameOrderLineUOM()
{ {
if (getC_OrderLine_ID() <= 0) if (getC_OrderLine_ID() <= 0)
return false; return false;
MOrderLine oLine = new MOrderLine(getCtx(), getC_OrderLine_ID(), get_TrxName()); MOrderLine oLine = new MOrderLine(getCtx(), getC_OrderLine_ID(), get_TrxName());
if (oLine.getC_UOM_ID() != getC_UOM_ID()) if (oLine.getC_UOM_ID() != getC_UOM_ID())
return false; return false;
// inout has orderline and both has the same UOM // inout has orderline and both has the same UOM
return true; return true;
} }
} // MInOutLine } // MInOutLine

File diff suppressed because it is too large Load Diff

View File

@ -38,8 +38,9 @@ import org.compiere.util.Msg;
*/ */
public class MInvoiceLine extends X_C_InvoiceLine public class MInvoiceLine extends X_C_InvoiceLine
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 4264055057724565805L; private static final long serialVersionUID = 4264055057724565805L;
@ -73,7 +74,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
} }
catch (Exception e) catch (Exception e)
{ {
s_log.log(Level.SEVERE, sql, e); s_log.log(Level.SEVERE, sql, e);
} }
try try
{ {
@ -87,11 +88,11 @@ public class MInvoiceLine extends X_C_InvoiceLine
} }
return retValue; return retValue;
} // getOfInOutLine } // getOfInOutLine
/** Static Logger */ /** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MInvoiceLine.class); private static CLogger s_log = CLogger.getCLogger (MInvoiceLine.class);
/************************************************************************** /**************************************************************************
* Invoice Line Constructor * Invoice Line Constructor
* @param ctx context * @param ctx context
@ -117,7 +118,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setQtyInvoiced(Env.ZERO); setQtyInvoiced(Env.ZERO);
} }
} // MInvoiceLine } // MInvoiceLine
/** /**
* Parent Constructor * Parent Constructor
* @param invoice parent * @param invoice parent
@ -151,7 +152,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
private boolean m_IsSOTrx = true; private boolean m_IsSOTrx = true;
private boolean m_priceSet = false; private boolean m_priceSet = false;
private MProduct m_product = null; private MProduct m_product = null;
/** Cached Name of the line */ /** Cached Name of the line */
private String m_name = null; private String m_name = null;
/** Cached Precision */ /** Cached Precision */
@ -188,7 +189,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
m_parent = new MInvoice(getCtx(), getC_Invoice_ID(), get_TrxName()); m_parent = new MInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
return m_parent; return m_parent;
} // getParent } // getParent
/** /**
* Set values from Order Line. * Set values from Order Line.
* Does not set quantity! * Does not set quantity!
@ -230,7 +231,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setRRAmt(oLine.getRRAmt()); setRRAmt(oLine.getRRAmt());
setRRStartDate(oLine.getRRStartDate()); setRRStartDate(oLine.getRRStartDate());
} // setOrderLine } // setOrderLine
/** /**
* Set values from Shipment Line. * Set values from Shipment Line.
* Does not set quantity! * Does not set quantity!
@ -242,7 +243,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setC_OrderLine_ID(sLine.getC_OrderLine_ID()); setC_OrderLine_ID(sLine.getC_OrderLine_ID());
// Set RMALine ID if shipment/receipt is based on RMA Doc // Set RMALine ID if shipment/receipt is based on RMA Doc
setM_RMALine_ID(sLine.getM_RMALine_ID()); setM_RMALine_ID(sLine.getM_RMALine_ID());
// //
setLine(sLine.getLine()); setLine(sLine.getLine());
setIsDescription(sLine.isDescription()); setIsDescription(sLine.isDescription());
@ -282,7 +283,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
{ {
// Set Pricing details from the RMA Line on which it is based // Set Pricing details from the RMA Line on which it is based
MRMALine rmaLine = new MRMALine(getCtx(), sLine.getM_RMALine_ID(), get_TrxName()); MRMALine rmaLine = new MRMALine(getCtx(), sLine.getM_RMALine_ID(), get_TrxName());
setPrice(); setPrice();
setPrice(rmaLine.getAmt()); setPrice(rmaLine.getAmt());
setC_Tax_ID(rmaLine.getC_Tax_ID()); setC_Tax_ID(rmaLine.getC_Tax_ID());
@ -329,7 +330,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
super.setM_AttributeSetInstance_ID (M_AttributeSetInstance_ID); super.setM_AttributeSetInstance_ID (M_AttributeSetInstance_ID);
} // setM_AttributeSetInstance_ID } // setM_AttributeSetInstance_ID
/************************************************************************** /**************************************************************************
* Set Price for Product and PriceList. * Set Price for Product and PriceList.
* Uses standard SO price list of not set by invoice constructor * Uses standard SO price list of not set by invoice constructor
@ -344,7 +345,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
throw new IllegalStateException("setPrice - PriceList unknown!"); throw new IllegalStateException("setPrice - PriceList unknown!");
setPrice (m_M_PriceList_ID, m_C_BPartner_ID); setPrice (m_M_PriceList_ID, m_C_BPartner_ID);
} // setPrice } // setPrice
/** /**
* Set Price for Product and PriceList * Set Price for Product and PriceList
* @param M_PriceList_ID price list * @param M_PriceList_ID price list
@ -356,7 +357,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
return; return;
// //
log.fine("M_PriceList_ID=" + M_PriceList_ID); log.fine("M_PriceList_ID=" + M_PriceList_ID);
m_productPricing = new MProductPricing (getM_Product_ID(), m_productPricing = new MProductPricing (getM_Product_ID(),
C_BPartner_ID, getQtyInvoiced(), m_IsSOTrx); C_BPartner_ID, getQtyInvoiced(), m_IsSOTrx);
m_productPricing.setM_PriceList_ID(M_PriceList_ID); m_productPricing.setM_PriceList_ID(M_PriceList_ID);
m_productPricing.setPriceDate(m_DateInvoiced); m_productPricing.setPriceDate(m_DateInvoiced);
@ -379,7 +380,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
/** /**
* Set Price Entered/Actual. * Set Price Entered/Actual.
* Use this Method if the Line UOM is the Product UOM * Use this Method if the Line UOM is the Product UOM
* @param PriceActual price * @param PriceActual price
*/ */
public void setPrice (BigDecimal PriceActual) public void setPrice (BigDecimal PriceActual)
@ -395,12 +396,12 @@ public class MInvoiceLine extends X_C_InvoiceLine
*/ */
public void setPriceActual (BigDecimal PriceActual) public void setPriceActual (BigDecimal PriceActual)
{ {
if (PriceActual == null) if (PriceActual == null)
throw new IllegalArgumentException ("PriceActual is mandatory"); throw new IllegalArgumentException ("PriceActual is mandatory");
set_ValueNoCheck("PriceActual", PriceActual); set_ValueNoCheck("PriceActual", PriceActual);
} // setPriceActual } // setPriceActual
/** /**
* Set Tax - requires Warehouse * Set Tax - requires Warehouse
* @return true if found * @return true if found
@ -425,14 +426,14 @@ public class MInvoiceLine extends X_C_InvoiceLine
return true; return true;
} // setTax } // setTax
/** /**
* Calculare Tax Amt. * Calculare Tax Amt.
* Assumes Line Net is calculated * Assumes Line Net is calculated
*/ */
public void setTaxAmt () public void setTaxAmt ()
{ {
BigDecimal TaxAmt = Env.ZERO; BigDecimal TaxAmt = Env.ZERO;
if (getC_Tax_ID() == 0) if (getC_Tax_ID() == 0)
return; return;
// setLineNetAmt(); // setLineNetAmt();
@ -447,7 +448,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setLineTotalAmt(getLineNetAmt().add(TaxAmt)); setLineTotalAmt(getLineNetAmt().add(TaxAmt));
super.setTaxAmt (TaxAmt); super.setTaxAmt (TaxAmt);
} // setTaxAmt } // setTaxAmt
/** /**
* Calculate Extended Amt. * Calculate Extended Amt.
* May or may not include tax * May or may not include tax
@ -455,12 +456,12 @@ public class MInvoiceLine extends X_C_InvoiceLine
public void setLineNetAmt () public void setLineNetAmt ()
{ {
// Calculations & Rounding // Calculations & Rounding
BigDecimal net = getPriceActual().multiply(getQtyInvoiced()); BigDecimal net = getPriceActual().multiply(getQtyInvoiced());
if (net.scale() > getPrecision()) if (net.scale() > getPrecision())
net = net.setScale(getPrecision(), BigDecimal.ROUND_HALF_UP); net = net.setScale(getPrecision(), BigDecimal.ROUND_HALF_UP);
super.setLineNetAmt (net); super.setLineNetAmt (net);
} // setLineNetAmt } // setLineNetAmt
/** /**
* Set Qty Invoiced/Entered. * Set Qty Invoiced/Entered.
* @param Qty Invoiced/Ordered * @param Qty Invoiced/Ordered
@ -481,7 +482,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
} // setQtyInvoiced } // setQtyInvoiced
/** /**
* Set Qty Entered - enforce entered UOM * Set Qty Entered - enforce entered UOM
* @param QtyEntered * @param QtyEntered
*/ */
public void setQtyEntered (BigDecimal QtyEntered) public void setQtyEntered (BigDecimal QtyEntered)
@ -495,7 +496,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
} // setQtyEntered } // setQtyEntered
/** /**
* Set Qty Invoiced - enforce Product UOM * Set Qty Invoiced - enforce Product UOM
* @param QtyInvoiced * @param QtyInvoiced
*/ */
public void setQtyInvoiced (BigDecimal QtyInvoiced) public void setQtyInvoiced (BigDecimal QtyInvoiced)
@ -529,7 +530,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setM_AttributeSetInstance_ID(0); setM_AttributeSetInstance_ID(0);
} // setProduct } // setProduct
/** /**
* Set M_Product_ID * Set M_Product_ID
* @param M_Product_ID product * @param M_Product_ID product
@ -543,7 +544,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
super.setM_Product_ID (M_Product_ID); super.setM_Product_ID (M_Product_ID);
setM_AttributeSetInstance_ID(0); setM_AttributeSetInstance_ID(0);
} // setM_Product_ID } // setM_Product_ID
/** /**
* Set Product and UOM * Set Product and UOM
* @param M_Product_ID product * @param M_Product_ID product
@ -555,7 +556,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
super.setC_UOM_ID(C_UOM_ID); super.setC_UOM_ID(C_UOM_ID);
setM_AttributeSetInstance_ID(0); setM_AttributeSetInstance_ID(0);
} // setM_Product_ID } // setM_Product_ID
/** /**
* Get Product * Get Product
* @return product or null * @return product or null
@ -578,7 +579,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
ii = getParent().getC_Project_ID(); ii = getParent().getC_Project_ID();
return ii; return ii;
} // getC_Project_ID } // getC_Project_ID
/** /**
* Get C_Activity_ID * Get C_Activity_ID
* @return Activity * @return Activity
@ -590,7 +591,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
ii = getParent().getC_Activity_ID(); ii = getParent().getC_Activity_ID();
return ii; return ii;
} // getC_Activity_ID } // getC_Activity_ID
/** /**
* Get C_Campaign_ID * Get C_Campaign_ID
* @return Campaign * @return Campaign
@ -602,7 +603,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
ii = getParent().getC_Campaign_ID(); ii = getParent().getC_Campaign_ID();
return ii; return ii;
} // getC_Campaign_ID } // getC_Campaign_ID
/** /**
* Get User2_ID * Get User2_ID
* @return User2 * @return User2
@ -726,7 +727,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
{ {
if (m_precision != null) if (m_precision != null)
return m_precision.intValue(); return m_precision.intValue();
String sql = "SELECT c.StdPrecision " String sql = "SELECT c.StdPrecision "
+ "FROM C_Currency c INNER JOIN C_Invoice x ON (x.C_Currency_ID=c.C_Currency_ID) " + "FROM C_Currency c INNER JOIN C_Invoice x ON (x.C_Currency_ID=c.C_Currency_ID) "
+ "WHERE x.C_Invoice_ID=?"; + "WHERE x.C_Invoice_ID=?";
@ -739,7 +740,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
m_precision = new Integer(i); m_precision = new Integer(i);
return m_precision.intValue(); return m_precision.intValue();
} // getPrecision } // getPrecision
/** /**
* Is Tax Included in Amount * Is Tax Included in Amount
* @return true if tax is included * @return true if tax is included
@ -755,8 +756,8 @@ public class MInvoiceLine extends X_C_InvoiceLine
MPriceList pl = MPriceList.get(getCtx(), m_M_PriceList_ID, get_TrxName()); MPriceList pl = MPriceList.get(getCtx(), m_M_PriceList_ID, get_TrxName());
return pl.isTaxIncluded(); return pl.isTaxIncluded();
} // isTaxIncluded } // isTaxIncluded
/************************************************************************** /**************************************************************************
* Before Save * Before Save
* @param newRecord * @param newRecord
@ -779,12 +780,12 @@ public class MInvoiceLine extends X_C_InvoiceLine
} }
else // Set Product Price else // Set Product Price
{ {
if (!m_priceSet if (!m_priceSet
&& Env.ZERO.compareTo(getPriceActual()) == 0 && Env.ZERO.compareTo(getPriceActual()) == 0
&& Env.ZERO.compareTo(getPriceList()) == 0) && Env.ZERO.compareTo(getPriceList()) == 0)
setPrice(); setPrice();
} }
// Set Tax // Set Tax
if (getC_Tax_ID() == 0) if (getC_Tax_ID() == 0)
setTax(); setTax();
@ -818,12 +819,12 @@ public class MInvoiceLine extends X_C_InvoiceLine
// //
return true; return true;
} // beforeSave } // beforeSave
/** /**
* Recalculate invoice tax * Recalculate invoice tax
* @param oldTax true if the old C_Tax_ID should be used * @param oldTax true if the old C_Tax_ID should be used
* @return true if success, false otherwise * @return true if success, false otherwise
* *
* @author teo_sarca [ 1583825 ] * @author teo_sarca [ 1583825 ]
*/ */
private boolean updateInvoiceTax(boolean oldTax) { private boolean updateInvoiceTax(boolean oldTax) {
@ -837,7 +838,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
} }
return true; return true;
} }
/** /**
* After Save * After Save
* @param newRecord new * @param newRecord new
@ -868,21 +869,21 @@ public class MInvoiceLine extends X_C_InvoiceLine
return success; return success;
return updateHeaderTax(); return updateHeaderTax();
} // afterDelete } // afterDelete
/** /**
* Update Tax & Header * Update Tax & Header
* @return true if header updated with tax * @return true if header updated with tax
*/ */
private boolean updateHeaderTax() private boolean updateHeaderTax()
{ {
// Update header only if the document is not processed - teo_sarca BF [ 2317305 ] // Update header only if the document is not processed - teo_sarca BF [ 2317305 ]
if (isProcessed() && !is_ValueChanged(COLUMNNAME_Processed)) if (isProcessed() && !is_ValueChanged(COLUMNNAME_Processed))
return true; return true;
// Recalculate Tax for this Tax // Recalculate Tax for this Tax
if (!updateInvoiceTax(false)) if (!updateInvoiceTax(false))
return false; return false;
// Update Invoice Header // Update Invoice Header
String sql = "UPDATE C_Invoice i" String sql = "UPDATE C_Invoice i"
+ " SET TotalLines=" + " SET TotalLines="
@ -905,11 +906,11 @@ public class MInvoiceLine extends X_C_InvoiceLine
if (no != 1) if (no != 1)
log.warning("(2) #" + no); log.warning("(2) #" + no);
m_parent = null; m_parent = null;
return no == 1; return no == 1;
} // updateHeaderTax } // updateHeaderTax
/************************************************************************** /**************************************************************************
* Allocate Landed Costs * Allocate Landed Costs
* @return error message or "" * @return error message or ""
@ -925,7 +926,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql, get_TrxName());
if (no != 0) if (no != 0)
log.info("Deleted #" + no); log.info("Deleted #" + no);
int inserted = 0; int inserted = 0;
// *** Single Criteria *** // *** Single Criteria ***
if (lcs.length == 1) if (lcs.length == 1)
@ -963,7 +964,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
MLandedCostAllocation lca = new MLandedCostAllocation (this, lc.getM_CostElement_ID()); MLandedCostAllocation lca = new MLandedCostAllocation (this, lc.getM_CostElement_ID());
lca.setM_Product_ID(iol.getM_Product_ID()); lca.setM_Product_ID(iol.getM_Product_ID());
lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID()); lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID());
BigDecimal base = iol.getBase(lc.getLandedCostDistribution()); BigDecimal base = iol.getBase(lc.getLandedCostDistribution());
lca.setBase(base); lca.setBase(base);
// MZ Goodwill // MZ Goodwill
// add set Qty from InOutLine // add set Qty from InOutLine
@ -999,22 +1000,22 @@ public class MInvoiceLine extends X_C_InvoiceLine
// end MZ // end MZ
if (lca.save()) if (lca.save())
return ""; return "";
return "Cannot save single line Allocation = " + lc; return "Cannot save single line Allocation = " + lc;
} }
// Single Product // Single Product
else if (lc.getM_Product_ID() != 0) else if (lc.getM_Product_ID() != 0)
{ {
MLandedCostAllocation lca = new MLandedCostAllocation (this, lc.getM_CostElement_ID()); MLandedCostAllocation lca = new MLandedCostAllocation (this, lc.getM_CostElement_ID());
lca.setM_Product_ID(lc.getM_Product_ID()); // No ASI lca.setM_Product_ID(lc.getM_Product_ID()); // No ASI
lca.setAmt(getLineNetAmt()); lca.setAmt(getLineNetAmt());
if (lca.save()) if (lca.save())
return ""; return "";
return "Cannot save Product Allocation = " + lc; return "Cannot save Product Allocation = " + lc;
} }
else else
return "No Reference for " + lc; return "No Reference for " + lc;
} }
// *** Multiple Criteria *** // *** Multiple Criteria ***
String LandedCostDistribution = lcs[0].getLandedCostDistribution(); String LandedCostDistribution = lcs[0].getLandedCostDistribution();
int M_CostElement_ID = lcs[0].getM_CostElement_ID(); int M_CostElement_ID = lcs[0].getM_CostElement_ID();
@ -1039,7 +1040,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
MInOutLine[] lines = ship.getLines(); MInOutLine[] lines = ship.getLines();
for (int i = 0; i < lines.length; i++) for (int i = 0; i < lines.length; i++)
{ {
if (lines[i].isDescription() // decription or no product if (lines[i].isDescription() // decription or no product
|| lines[i].getM_Product_ID() == 0) || lines[i].getM_Product_ID() == 0)
continue; continue;
if (lc.getM_Product_ID() == 0 // no restriction or product match if (lc.getM_Product_ID() == 0 // no restriction or product match
@ -1072,7 +1073,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
MLandedCostAllocation lca = new MLandedCostAllocation (this, lcs[0].getM_CostElement_ID()); MLandedCostAllocation lca = new MLandedCostAllocation (this, lcs[0].getM_CostElement_ID());
lca.setM_Product_ID(iol.getM_Product_ID()); lca.setM_Product_ID(iol.getM_Product_ID());
lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID()); lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID());
BigDecimal base = iol.getBase(LandedCostDistribution); BigDecimal base = iol.getBase(LandedCostDistribution);
lca.setBase(base); lca.setBase(base);
// MZ Goodwill // MZ Goodwill
// add set Qty from InOutLine // add set Qty from InOutLine
@ -1088,7 +1089,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
return "Cannot save line Allocation = " + lca; return "Cannot save line Allocation = " + lca;
inserted++; inserted++;
} }
log.info("Inserted " + inserted); log.info("Inserted " + inserted);
allocateLandedCostRounding(); allocateLandedCostRounding();
return ""; return "";
@ -1106,7 +1107,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
for (int i = 0; i < allocations.length; i++) for (int i = 0; i < allocations.length; i++)
{ {
MLandedCostAllocation allocation = allocations[i]; MLandedCostAllocation allocation = allocations[i];
if (largestAmtAllocation == null if (largestAmtAllocation == null
|| allocation.getAmt().compareTo(largestAmtAllocation.getAmt()) > 0) || allocation.getAmt().compareTo(largestAmtAllocation.getAmt()) > 0)
largestAmtAllocation = allocation; largestAmtAllocation = allocation;
allocationAmt = allocationAmt.add(allocation.getAmt()); allocationAmt = allocationAmt.add(allocation.getAmt());
@ -1116,7 +1117,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
{ {
largestAmtAllocation.setAmt(largestAmtAllocation.getAmt().add(difference)); largestAmtAllocation.setAmt(largestAmtAllocation.getAmt().add(difference));
largestAmtAllocation.save(); largestAmtAllocation.save();
log.config("Difference=" + difference log.config("Difference=" + difference
+ ", C_LandedCostAllocation_ID=" + largestAmtAllocation.getC_LandedCostAllocation_ID() + ", C_LandedCostAllocation_ID=" + largestAmtAllocation.getC_LandedCostAllocation_ID()
+ ", Amt" + largestAmtAllocation.getAmt()); + ", Amt" + largestAmtAllocation.getAmt());
} }
@ -1170,7 +1171,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
list.toArray(landedCost); list.toArray(landedCost);
return landedCost; return landedCost;
} // getLandedCost } // getLandedCost
/** /**
* Copy LandedCost From other InvoiceLine. * Copy LandedCost From other InvoiceLine.
* @param otherInvoiceLine invoiceline * @param otherInvoiceLine invoiceline
@ -1197,7 +1198,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
return count; return count;
} // copyLinesFrom } // copyLinesFrom
// end MZ // end MZ
/** /**
* @param rmaline * @param rmaline
*/ */
@ -1212,7 +1213,6 @@ public class MInvoiceLine extends X_C_InvoiceLine
setC_UOM_ID(rmaLine.getC_UOM_ID()); setC_UOM_ID(rmaLine.getC_UOM_ID());
setC_Tax_ID(rmaLine.getC_Tax_ID()); setC_Tax_ID(rmaLine.getC_Tax_ID());
setPrice(rmaLine.getAmt()); setPrice(rmaLine.getAmt());
setQty(rmaLine.getQty());
setLineNetAmt(); setLineNetAmt();
setTaxAmt(); setTaxAmt();
setLineTotalAmt(rmaLine.getLineNetAmt()); setLineTotalAmt(rmaLine.getLineNetAmt());
@ -1220,7 +1220,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setC_Activity_ID(rmaLine.getC_Activity_ID()); setC_Activity_ID(rmaLine.getC_Activity_ID());
setC_Campaign_ID(rmaLine.getC_Campaign_ID()); setC_Campaign_ID(rmaLine.getC_Campaign_ID());
} }
/** /**
* @return matched qty * @return matched qty
*/ */

View File

@ -32,7 +32,7 @@ import org.compiere.util.Msg;
/** /**
* RMA Model * RMA Model
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: MRMA.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $ * @version $Id: MRMA.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
* *
@ -41,9 +41,9 @@ import org.compiere.util.Msg;
public class MRMA extends X_M_RMA implements DocAction public class MRMA extends X_M_RMA implements DocAction
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -2967208431264929454L; private static final long serialVersionUID = -3310525910645254261L;
/** /**
* Standard Constructor * Standard Constructor
@ -77,12 +77,12 @@ public class MRMA extends X_M_RMA implements DocAction
{ {
super(ctx, rs, trxName); super(ctx, rs, trxName);
} // MRMA } // MRMA
/** Lines */ /** Lines */
private MRMALine[] m_lines = null; private MRMALine[] m_lines = null;
/** The Shipment */ /** The Shipment */
private MInOut m_inout = null; private MInOut m_inout = null;
/** /**
* Get Lines * Get Lines
* @param requery requery * @param requery requery
@ -123,12 +123,12 @@ public class MRMA extends X_M_RMA implements DocAction
{ {
pstmt = null; pstmt = null;
} }
m_lines = new MRMALine[list.size ()]; m_lines = new MRMALine[list.size ()];
list.toArray (m_lines); list.toArray (m_lines);
return m_lines; return m_lines;
} // getLines } // getLines
/** /**
* Get Shipment * Get Shipment
* @return shipment * @return shipment
@ -139,7 +139,7 @@ public class MRMA extends X_M_RMA implements DocAction
m_inout = new MInOut (getCtx(), getInOut_ID(), get_TrxName()); m_inout = new MInOut (getCtx(), getInOut_ID(), get_TrxName());
return m_inout; return m_inout;
} // getShipment } // getShipment
/** /**
* Get the original order on which the shipment/receipt defined is based upon. * Get the original order on which the shipment/receipt defined is based upon.
* @return order * @return order
@ -153,7 +153,7 @@ public class MRMA extends X_M_RMA implements DocAction
} }
return new MOrder(getCtx(), shipment.getC_Order_ID(), get_TrxName()); return new MOrder(getCtx(), shipment.getC_Order_ID(), get_TrxName());
} }
/** /**
* Get the original invoice on which the shipment/receipt defined is based upon. * Get the original invoice on which the shipment/receipt defined is based upon.
* @return invoice * @return invoice
@ -165,9 +165,9 @@ public class MRMA extends X_M_RMA implements DocAction
{ {
return null; return null;
} }
int invId = 0; int invId = 0;
if (shipment.getC_Invoice_ID() != 0) if (shipment.getC_Invoice_ID() != 0)
{ {
invId = shipment.getC_Invoice_ID(); invId = shipment.getC_Invoice_ID();
@ -177,15 +177,15 @@ public class MRMA extends X_M_RMA implements DocAction
String sqlStmt = "SELECT C_Invoice_ID FROM C_Invoice WHERE C_Order_ID=?"; String sqlStmt = "SELECT C_Invoice_ID FROM C_Invoice WHERE C_Order_ID=?";
invId = DB.getSQLValue(null, sqlStmt, shipment.getC_Order_ID()); invId = DB.getSQLValue(null, sqlStmt, shipment.getC_Order_ID());
} }
if (invId <= 0) if (invId <= 0)
{ {
return null; return null;
} }
return new MInvoice(getCtx(), invId, get_TrxName()); return new MInvoice(getCtx(), invId, get_TrxName());
} }
/** /**
* Set M_InOut_ID * Set M_InOut_ID
* @param M_InOut_ID id * @param M_InOut_ID id
@ -198,8 +198,8 @@ public class MRMA extends X_M_RMA implements DocAction
setC_BPartner_ID(0); setC_BPartner_ID(0);
m_inout = null; m_inout = null;
} // setM_InOut_ID } // setM_InOut_ID
/** /**
* Get Document Info * Get Document Info
* @return document info (untranslated) * @return document info (untranslated)
@ -241,7 +241,7 @@ public class MRMA extends X_M_RMA implements DocAction
// return re.getPDF(file); // return re.getPDF(file);
} // createPDF } // createPDF
/** /**
* Before Save * Before Save
* Set BPartner, Currency * Set BPartner, Currency
@ -266,7 +266,7 @@ public class MRMA extends X_M_RMA implements DocAction
{ {
MOrder order = new MOrder (getCtx(), m_inout.getC_Order_ID(), get_TrxName()); MOrder order = new MOrder (getCtx(), m_inout.getC_Order_ID(), get_TrxName());
setC_Currency_ID(order.getC_Currency_ID()); setC_Currency_ID(order.getC_Currency_ID());
} }
else if (m_inout.getC_Invoice_ID() != 0) else if (m_inout.getC_Invoice_ID() != 0)
{ {
MInvoice invoice = new MInvoice (getCtx(), m_inout.getC_Invoice_ID(), get_TrxName()); MInvoice invoice = new MInvoice (getCtx(), m_inout.getC_Invoice_ID(), get_TrxName());
@ -274,18 +274,18 @@ public class MRMA extends X_M_RMA implements DocAction
} }
} }
} }
// Verification whether Shipment/Receipt matches RMA for sales transaction // Verification whether Shipment/Receipt matches RMA for sales transaction
if (m_inout != null && m_inout.isSOTrx() != isSOTrx()) if (m_inout != null && m_inout.isSOTrx() != isSOTrx())
{ {
log.saveError("RMA.IsSOTrx <> InOut.IsSOTrx", ""); log.saveError("RMA.IsSOTrx <> InOut.IsSOTrx", "");
return false; return false;
} }
return true; return true;
} // beforeSave } // beforeSave
/************************************************************************** /**************************************************************************
* Process document * Process document
* @param processAction document action * @param processAction document action
@ -297,7 +297,7 @@ public class MRMA extends X_M_RMA implements DocAction
DocumentEngine engine = new DocumentEngine (this, getDocStatus()); DocumentEngine engine = new DocumentEngine (this, getDocStatus());
return engine.processIt (processAction, getDocAction()); return engine.processIt (processAction, getDocAction());
} // process } // process
/** Process Message */ /** Process Message */
private String m_processMsg = null; private String m_processMsg = null;
/** Just Prepared Flag */ /** Just Prepared Flag */
@ -305,7 +305,7 @@ public class MRMA extends X_M_RMA implements DocAction
/** /**
* Unlock Document. * Unlock Document.
* @return true if success * @return true if success
*/ */
public boolean unlockIt() public boolean unlockIt()
{ {
@ -313,20 +313,20 @@ public class MRMA extends X_M_RMA implements DocAction
setProcessing(false); setProcessing(false);
return true; return true;
} // unlockIt } // unlockIt
/** /**
* Invalidate Document * Invalidate Document
* @return true if success * @return true if success
*/ */
public boolean invalidateIt() public boolean invalidateIt()
{ {
log.info("invalidateIt - " + toString()); log.info("invalidateIt - " + toString());
return true; return true;
} // invalidateIt } // invalidateIt
/** /**
* Prepare Document * Prepare Document
* @return new status (In Progress or Invalid) * @return new status (In Progress or Invalid)
*/ */
public String prepareIt() public String prepareIt()
{ {
@ -335,17 +335,16 @@ public class MRMA extends X_M_RMA implements DocAction
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
MRMALine[] lines = getLines(false); MRMALine[] lines = getLines(false);
if (lines.length == 0) if (lines.length == 0)
{ {
m_processMsg = "@NoLines@"; m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Updates Amount // Updates Amount
setAmt(getTotalAmount()); setAmt(getTotalAmount());
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -353,10 +352,10 @@ public class MRMA extends X_M_RMA implements DocAction
m_justPrepared = true; m_justPrepared = true;
return DocAction.STATUS_InProgress; return DocAction.STATUS_InProgress;
} // prepareIt } // prepareIt
/** /**
* Approve Document * Approve Document
* @return true if success * @return true if success
*/ */
public boolean approveIt() public boolean approveIt()
{ {
@ -364,10 +363,10 @@ public class MRMA extends X_M_RMA implements DocAction
setIsApproved(true); setIsApproved(true);
return true; return true;
} // approveIt } // approveIt
/** /**
* Reject Approval * Reject Approval
* @return true if success * @return true if success
*/ */
public boolean rejectIt() public boolean rejectIt()
{ {
@ -375,7 +374,7 @@ public class MRMA extends X_M_RMA implements DocAction
setIsApproved(false); setIsApproved(false);
return true; return true;
} // rejectIt } // rejectIt
/** /**
* Complete Document * Complete Document
* @return new status (Complete, In Progress, Invalid, Waiting ..) * @return new status (Complete, In Progress, Invalid, Waiting ..)
@ -389,7 +388,7 @@ public class MRMA extends X_M_RMA implements DocAction
if (!DocAction.STATUS_InProgress.equals(status)) if (!DocAction.STATUS_InProgress.equals(status))
return status; return status;
} }
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -407,6 +406,12 @@ public class MRMA extends X_M_RMA implements DocAction
return DocAction.STATUS_InProgress; return DocAction.STATUS_InProgress;
} }
*/ */
// Counter Documents
MRMA counter = createCounterDoc();
if (counter != null)
m_processMsg = "@CounterDoc@: RMA=" + counter.getDocumentNo();
// User Validation // User Validation
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null) if (valid != null)
@ -423,7 +428,7 @@ public class MRMA extends X_M_RMA implements DocAction
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed; return DocAction.STATUS_Completed;
} // completeIt } // completeIt
/** /**
* Set the definite document number after completed * Set the definite document number after completed
*/ */
@ -441,9 +446,189 @@ public class MRMA extends X_M_RMA implements DocAction
} }
} }
/**************************************************************************
* Create Counter Document
* @return InOut
*/
private MRMA createCounterDoc()
{
// Is this a counter doc ?
if (getRef_RMA_ID() > 0)
return null;
// Org Must be linked to BPartner
MOrg org = MOrg.get(getCtx(), getAD_Org_ID());
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(get_TrxName());
if (counterC_BPartner_ID == 0)
return null;
// Business Partner needs to be linked to Org
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int();
if (counterAD_Org_ID == 0)
return null;
// Document Type
int C_DocTypeTarget_ID = 0;
MDocTypeCounter counterDT = MDocTypeCounter.getCounterDocType(getCtx(), getC_DocType_ID());
if (counterDT != null)
{
log.fine(counterDT.toString());
if (!counterDT.isCreateCounter() || !counterDT.isValid())
return null;
C_DocTypeTarget_ID = counterDT.getCounter_C_DocType_ID();
}
else // indirect
{
C_DocTypeTarget_ID = MDocTypeCounter.getCounterDocType_ID(getCtx(), getC_DocType_ID());
log.fine("Indirect C_DocTypeTarget_ID=" + C_DocTypeTarget_ID);
if (C_DocTypeTarget_ID <= 0)
return null;
}
// Deep Copy
MRMA counter = copyFrom(this, C_DocTypeTarget_ID, !isSOTrx(), true, get_TrxName());
//
counter.setAD_Org_ID(counterAD_Org_ID);
counter.setC_BPartner_ID(counterC_BPartner_ID);
counter.save(get_TrxName());
// Update copied lines
MRMALine[] counterLines = counter.getLines(true);
for (int i = 0; i < counterLines.length; i++)
{
MRMALine counterLine = counterLines[i];
counterLine.setClientOrg(counter);
//
counterLine.save(get_TrxName());
}
log.fine(counter.toString());
// Document Action
if (counterDT != null)
{
if (counterDT.getDocAction() != null)
{
counter.setDocAction(counterDT.getDocAction());
counter.processIt(counterDT.getDocAction());
counter.save(get_TrxName());
}
}
return counter;
} // createCounterDoc
/**
* Create new RMA by copying
* @param from RMA
* @param C_DocType_ID doc type
* @param isSOTrx sales order
* @param counter create counter links
* @param trxName trx
* @return MRMA
*/
public static MRMA copyFrom (MRMA from, int C_DocType_ID, boolean isSOTrx, boolean counter, String trxName)
{
MRMA to = new MRMA (from.getCtx(), 0, null);
to.set_TrxName(trxName);
copyValues(from, to, from.getAD_Client_ID(), from.getAD_Org_ID());
to.set_ValueNoCheck ("M_RMA_ID", I_ZERO);
to.set_ValueNoCheck ("DocumentNo", null);
to.setDocStatus (DOCSTATUS_Drafted); // Draft
to.setDocAction(DOCACTION_Complete);
to.setC_DocType_ID (C_DocType_ID);
to.setIsSOTrx(isSOTrx);
to.setIsApproved (false);
to.setProcessed (false);
to.setProcessing(false);
to.setName(from.getName());
to.setDescription(from.getDescription());
to.setSalesRep_ID(from.getSalesRep_ID());
to.setHelp(from.getHelp());
to.setM_RMAType_ID(from.getM_RMAType_ID());
to.setAmt(from.getAmt());
to.setC_Order_ID(0);
// Try to find Order/Shipment/Receipt link
if (from.getC_Order_ID() != 0)
{
MOrder peer = new MOrder (from.getCtx(), from.getC_Order_ID(), from.get_TrxName());
if (peer.getRef_Order_ID() != 0)
to.setC_Order_ID(peer.getRef_Order_ID());
}
if (from.getInOut_ID() != 0)
{
MInOut peer = new MInOut (from.getCtx(), from.getInOut_ID(), from.get_TrxName());
if (peer.getRef_InOut_ID() != 0)
to.setInOut_ID(peer.getRef_InOut_ID());
}
to.set_Value("Ref_RMA_ID", from.getM_RMA_ID());
if (!to.save(trxName))
throw new IllegalStateException("Could not create RMA");
if (counter)
from.set_Value("Ref_RMA_ID", to.getM_RMA_ID());
if (to.copyLinesFrom(from, counter) == 0)
throw new IllegalStateException("Could not create RMA Lines");
return to;
} // copyFrom
/**
* Copy Lines From other RMA
* @param otherRMA
* @param counter set counter info
* @param setOrder set order link
* @return number of lines copied
*/
public int copyLinesFrom (MRMA otherRMA, boolean counter)
{
if (isProcessed() || otherRMA == null)
return 0;
MRMALine[] fromLines = otherRMA.getLines(false);
int count = 0;
for (int i = 0; i < fromLines.length; i++)
{
MRMALine line = new MRMALine(getCtx(), 0, null);
MRMALine fromLine = fromLines[i];
line.set_TrxName(get_TrxName());
if (counter) // header
PO.copyValues(fromLine, line, getAD_Client_ID(), getAD_Org_ID());
else
PO.copyValues(fromLine, line, fromLine.getAD_Client_ID(), fromLine.getAD_Org_ID());
line.setM_RMA_ID(getM_RMA_ID());
line.set_ValueNoCheck ("M_RMALine_ID", I_ZERO); // new
if (counter)
{
line.set_Value("Ref_RMALine_ID", fromLine.getM_RMALine_ID());
if (fromLine.getM_InOutLine_ID() != 0)
{
MInOutLine peer = new MInOutLine (getCtx(), fromLine.getM_InOutLine_ID(), get_TrxName());
if (peer.getRef_InOutLine_ID() != 0)
line.setM_InOutLine_ID(peer.getRef_InOutLine_ID());
}
}
//
line.setProcessed(false);
if (line.save(get_TrxName()))
count++;
// Cross Link
if (counter)
{
fromLine.set_Value("Ref_RMALine_ID", line.getM_RMALine_ID());
fromLine.save(get_TrxName());
}
}
if (fromLines.length != count)
log.log(Level.SEVERE, "Line difference - From=" + fromLines.length + " <> Saved=" + count);
return count;
} // copyLinesFrom
/** /**
* Void Document. * Void Document.
* @return true if success * @return true if success
*/ */
public boolean voidIt() public boolean voidIt()
{ {
@ -452,7 +637,7 @@ public class MRMA extends X_M_RMA implements DocAction
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
MRMALine lines[] = getLines(true); MRMALine lines[] = getLines(true);
// Set Qty and Amt on all lines to be Zero // Set Qty and Amt on all lines to be Zero
for (MRMALine rmaLine : lines) for (MRMALine rmaLine : lines)
@ -460,30 +645,30 @@ public class MRMA extends X_M_RMA implements DocAction
rmaLine.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + rmaLine.getQty() + ")"); rmaLine.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + rmaLine.getQty() + ")");
rmaLine.setQty(Env.ZERO); rmaLine.setQty(Env.ZERO);
rmaLine.setAmt(Env.ZERO); rmaLine.setAmt(Env.ZERO);
if (!rmaLine.save()) if (!rmaLine.save())
{ {
m_processMsg = "Could not update line"; m_processMsg = "Could not update line";
} }
} }
addDescription(Msg.getMsg(getCtx(), "Voided")); addDescription(Msg.getMsg(getCtx(), "Voided"));
setAmt(Env.ZERO); setAmt(Env.ZERO);
// After Void // After Void
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
return true; return true;
} // voidIt } // voidIt
/** /**
* Close Document. * Close Document.
* Cancel not delivered Qunatities * Cancel not delivered Qunatities
* @return true if success * @return true if success
*/ */
public boolean closeIt() public boolean closeIt()
{ {
@ -496,13 +681,13 @@ public class MRMA extends X_M_RMA implements DocAction
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return true; return true;
} // closeIt } // closeIt
/** /**
* Reverse Correction * Reverse Correction
* @return true if success * @return true if success
*/ */
public boolean reverseCorrectIt() public boolean reverseCorrectIt()
{ {
@ -511,18 +696,18 @@ public class MRMA extends X_M_RMA implements DocAction
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseCorrect // After reverseCorrect
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return false; return false;
} // reverseCorrectionIt } // reverseCorrectionIt
/** /**
* Reverse Accrual - none * Reverse Accrual - none
* @return true if success * @return true if success
*/ */
public boolean reverseAccrualIt() public boolean reverseAccrualIt()
{ {
@ -531,18 +716,18 @@ public class MRMA extends X_M_RMA implements DocAction
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseAccrual // After reverseAccrual
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return false; return false;
} // reverseAccrualIt } // reverseAccrualIt
/** /**
* Re-activate * Re-activate
* @return true if success * @return true if success
*/ */
public boolean reActivateIt() public boolean reActivateIt()
{ {
@ -550,16 +735,16 @@ public class MRMA extends X_M_RMA implements DocAction
// Before reActivate // Before reActivate
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reActivate // After reActivate
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return false; return false;
} // reActivateIt } // reActivateIt
/** /**
* Set Processed. * Set Processed.
* Propagate to Lines * Propagate to Lines
@ -577,7 +762,7 @@ public class MRMA extends X_M_RMA implements DocAction
m_lines = null; m_lines = null;
log.fine("setProcessed - " + processed + " - Lines=" + noLine); log.fine("setProcessed - " + processed + " - Lines=" + noLine);
} // setProcessed } // setProcessed
/** /**
* Add to Description * Add to Description
* @param description text * @param description text
@ -590,7 +775,7 @@ public class MRMA extends X_M_RMA implements DocAction
else else
setDescription(desc + " | " + description); setDescription(desc + " | " + description);
} // addDescription } // addDescription
/** /**
* Get the total amount based on the lines * Get the total amount based on the lines
* @return Total Amount * @return Total Amount
@ -598,17 +783,17 @@ public class MRMA extends X_M_RMA implements DocAction
public BigDecimal getTotalAmount() public BigDecimal getTotalAmount()
{ {
MRMALine lines[] = this.getLines(true); MRMALine lines[] = this.getLines(true);
BigDecimal amt = Env.ZERO; BigDecimal amt = Env.ZERO;
for (MRMALine line : lines) for (MRMALine line : lines)
{ {
amt = amt.add(line.getLineNetAmt()); amt = amt.add(line.getLineNetAmt());
} }
return amt; return amt;
} }
/** /**
* Updates the amount on the document * Updates the amount on the document
*/ */
@ -616,7 +801,7 @@ public class MRMA extends X_M_RMA implements DocAction
{ {
setAmt(getTotalAmount()); setAmt(getTotalAmount());
} }
/************************************************************************* /*************************************************************************
* Get Summary * Get Summary
* @return Summary of Document * @return Summary of Document
@ -634,7 +819,7 @@ public class MRMA extends X_M_RMA implements DocAction
sb.append(" - ").append(getDescription()); sb.append(" - ").append(getDescription());
return sb.toString(); return sb.toString();
} // getSummary } // getSummary
/** /**
* Retrieves all the charge lines that is present on the document * Retrieves all the charge lines that is present on the document
* @return Charge Lines * @return Charge Lines
@ -645,39 +830,39 @@ public class MRMA extends X_M_RMA implements DocAction
whereClause.append("IsActive='Y' AND M_RMA_ID="); whereClause.append("IsActive='Y' AND M_RMA_ID=");
whereClause.append(get_ID()); whereClause.append(get_ID());
whereClause.append(" AND C_Charge_ID IS NOT null"); whereClause.append(" AND C_Charge_ID IS NOT null");
int rmaLineIds[] = MRMALine.getAllIDs(MRMALine.Table_Name, whereClause.toString(), get_TrxName()); int rmaLineIds[] = MRMALine.getAllIDs(MRMALine.Table_Name, whereClause.toString(), get_TrxName());
ArrayList<MRMALine> chargeLineList = new ArrayList<MRMALine>(); ArrayList<MRMALine> chargeLineList = new ArrayList<MRMALine>();
for (int i = 0; i < rmaLineIds.length; i++) for (int i = 0; i < rmaLineIds.length; i++)
{ {
MRMALine rmaLine = new MRMALine(getCtx(), rmaLineIds[i], get_TrxName()); MRMALine rmaLine = new MRMALine(getCtx(), rmaLineIds[i], get_TrxName());
chargeLineList.add(rmaLine); chargeLineList.add(rmaLine);
} }
MRMALine lines[] = new MRMALine[chargeLineList.size()]; MRMALine lines[] = new MRMALine[chargeLineList.size()];
chargeLineList.toArray(lines); chargeLineList.toArray(lines);
return lines; return lines;
} }
/** /**
* Get whether Tax is included (based on the original order) * Get whether Tax is included (based on the original order)
* @return True if tax is included * @return True if tax is included
*/ */
public boolean isTaxIncluded() public boolean isTaxIncluded()
{ {
MOrder order = getOriginalOrder(); MOrder order = getOriginalOrder();
if (order != null && order.get_ID() != 0) if (order != null && order.get_ID() != 0)
{ {
return order.isTaxIncluded(); return order.isTaxIncluded();
} }
return true; return true;
} }
/** /**
* Get Process Message * Get Process Message
* @return clear text error message * @return clear text error message
@ -686,7 +871,7 @@ public class MRMA extends X_M_RMA implements DocAction
{ {
return m_processMsg; return m_processMsg;
} // getProcessMsg } // getProcessMsg
/** /**
* Get Document Owner (Responsible) * Get Document Owner (Responsible)
* @return AD_User_ID * @return AD_User_ID
@ -712,9 +897,9 @@ public class MRMA extends X_M_RMA implements DocAction
public boolean isComplete() public boolean isComplete()
{ {
String ds = getDocStatus(); String ds = getDocStatus();
return DOCSTATUS_Completed.equals(ds) return DOCSTATUS_Completed.equals(ds)
|| DOCSTATUS_Closed.equals(ds) || DOCSTATUS_Closed.equals(ds)
|| DOCSTATUS_Reversed.equals(ds); || DOCSTATUS_Reversed.equals(ds);
} // isComplete } // isComplete
} // MRMA } // MRMA

View File

@ -26,15 +26,15 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
/** Generated Model for M_RMA /** Generated Model for M_RMA
* @author Adempiere (generated) * @author Adempiere (generated)
* @version Release 3.5.3a - $Id$ */ * @version Release 3.5.3a - $Id$ */
public class X_M_RMA extends PO implements I_M_RMA, I_Persistent public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 20081221L; private static final long serialVersionUID = 20090601L;
/** Standard Constructor */ /** Standard Constructor */
public X_M_RMA (Properties ctx, int M_RMA_ID, String trxName) public X_M_RMA (Properties ctx, int M_RMA_ID, String trxName)
@ -52,8 +52,8 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
setIsApproved (false); setIsApproved (false);
setIsSOTrx (false); setIsSOTrx (false);
// @IsSOTrx@ // @IsSOTrx@
setM_RMA_ID (0);
setM_RMAType_ID (0); setM_RMAType_ID (0);
setM_RMA_ID (0);
setName (null); setName (null);
setProcessed (false); setProcessed (false);
setSalesRep_ID (0); setSalesRep_ID (0);
@ -67,7 +67,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
} }
/** AccessLevel /** AccessLevel
* @return 1 - Org * @return 1 - Org
*/ */
protected int get_AccessLevel() protected int get_AccessLevel()
{ {
@ -89,7 +89,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
} }
/** Set Amount. /** Set Amount.
@param Amt @param Amt
Amount Amount
*/ */
public void setAmt (BigDecimal Amt) public void setAmt (BigDecimal Amt)
@ -100,7 +100,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Amount. /** Get Amount.
@return Amount @return Amount
*/ */
public BigDecimal getAmt () public BigDecimal getAmt ()
{ {
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Amt); BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Amt);
if (bd == null) if (bd == null)
@ -108,7 +108,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
return bd; return bd;
} }
public I_C_BPartner getC_BPartner() throws RuntimeException public I_C_BPartner getC_BPartner() throws RuntimeException
{ {
Class<?> clazz = MTable.getClass(I_C_BPartner.Table_Name); Class<?> clazz = MTable.getClass(I_C_BPartner.Table_Name);
I_C_BPartner result = null; I_C_BPartner result = null;
@ -125,21 +125,21 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
} }
/** Set Business Partner . /** Set Business Partner .
@param C_BPartner_ID @param C_BPartner_ID
Identifies a Business Partner Identifies a Business Partner
*/ */
public void setC_BPartner_ID (int C_BPartner_ID) public void setC_BPartner_ID (int C_BPartner_ID)
{ {
if (C_BPartner_ID < 1) if (C_BPartner_ID < 1)
set_Value (COLUMNNAME_C_BPartner_ID, null); set_Value (COLUMNNAME_C_BPartner_ID, null);
else else
set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID)); set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID));
} }
/** Get Business Partner . /** Get Business Partner .
@return Identifies a Business Partner @return Identifies a Business Partner
*/ */
public int getC_BPartner_ID () public int getC_BPartner_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID); Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
if (ii == null) if (ii == null)
@ -147,7 +147,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
return ii.intValue(); return ii.intValue();
} }
public I_C_Currency getC_Currency() throws RuntimeException public I_C_Currency getC_Currency() throws RuntimeException
{ {
Class<?> clazz = MTable.getClass(I_C_Currency.Table_Name); Class<?> clazz = MTable.getClass(I_C_Currency.Table_Name);
I_C_Currency result = null; I_C_Currency result = null;
@ -164,21 +164,21 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
} }
/** Set Currency. /** Set Currency.
@param C_Currency_ID @param C_Currency_ID
The Currency for this record The Currency for this record
*/ */
public void setC_Currency_ID (int C_Currency_ID) public void setC_Currency_ID (int C_Currency_ID)
{ {
if (C_Currency_ID < 1) if (C_Currency_ID < 1)
set_Value (COLUMNNAME_C_Currency_ID, null); set_Value (COLUMNNAME_C_Currency_ID, null);
else else
set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID)); set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID));
} }
/** Get Currency. /** Get Currency.
@return The Currency for this record @return The Currency for this record
*/ */
public int getC_Currency_ID () public int getC_Currency_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID); Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID);
if (ii == null) if (ii == null)
@ -187,20 +187,21 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
} }
/** Set Document Type. /** Set Document Type.
@param C_DocType_ID @param C_DocType_ID
Document type or rules Document type or rules
*/ */
public void setC_DocType_ID (int C_DocType_ID) public void setC_DocType_ID (int C_DocType_ID)
{ {
if (C_DocType_ID < 0) if (C_DocType_ID < 0)
throw new IllegalArgumentException ("C_DocType_ID is mandatory."); set_Value (COLUMNNAME_C_DocType_ID, null);
set_Value (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID)); else
set_Value (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID));
} }
/** Get Document Type. /** Get Document Type.
@return Document type or rules @return Document type or rules
*/ */
public int getC_DocType_ID () public int getC_DocType_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID); Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID);
if (ii == null) if (ii == null)
@ -208,7 +209,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
return ii.intValue(); return ii.intValue();
} }
public I_C_Order getC_Order() throws RuntimeException public I_C_Order getC_Order() throws RuntimeException
{ {
Class<?> clazz = MTable.getClass(I_C_Order.Table_Name); Class<?> clazz = MTable.getClass(I_C_Order.Table_Name);
I_C_Order result = null; I_C_Order result = null;
@ -225,21 +226,21 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
} }
/** Set Order. /** Set Order.
@param C_Order_ID @param C_Order_ID
Order Order
*/ */
public void setC_Order_ID (int C_Order_ID) public void setC_Order_ID (int C_Order_ID)
{ {
if (C_Order_ID < 1) if (C_Order_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Order_ID, null); set_ValueNoCheck (COLUMNNAME_C_Order_ID, null);
else else
set_ValueNoCheck (COLUMNNAME_C_Order_ID, Integer.valueOf(C_Order_ID)); set_ValueNoCheck (COLUMNNAME_C_Order_ID, Integer.valueOf(C_Order_ID));
} }
/** Get Order. /** Get Order.
@return Order @return Order
*/ */
public int getC_Order_ID () public int getC_Order_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_C_Order_ID); Integer ii = (Integer)get_Value(COLUMNNAME_C_Order_ID);
if (ii == null) if (ii == null)
@ -248,7 +249,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
} }
/** Set Description. /** Set Description.
@param Description @param Description
Optional short description of the record Optional short description of the record
*/ */
public void setDescription (String Description) public void setDescription (String Description)
@ -259,7 +260,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Description. /** Get Description.
@return Optional short description of the record @return Optional short description of the record
*/ */
public String getDescription () public String getDescription ()
{ {
return (String)get_Value(COLUMNNAME_Description); return (String)get_Value(COLUMNNAME_Description);
} }
@ -295,19 +296,19 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Wait Complete = WC */ /** Wait Complete = WC */
public static final String DOCACTION_WaitComplete = "WC"; public static final String DOCACTION_WaitComplete = "WC";
/** Set Document Action. /** Set Document Action.
@param DocAction @param DocAction
The targeted status of the document The targeted status of the document
*/ */
public void setDocAction (String DocAction) public void setDocAction (String DocAction)
{ {
if (DocAction == null) throw new IllegalArgumentException ("DocAction is mandatory");
set_Value (COLUMNNAME_DocAction, DocAction); set_Value (COLUMNNAME_DocAction, DocAction);
} }
/** Get Document Action. /** Get Document Action.
@return The targeted status of the document @return The targeted status of the document
*/ */
public String getDocAction () public String getDocAction ()
{ {
return (String)get_Value(COLUMNNAME_DocAction); return (String)get_Value(COLUMNNAME_DocAction);
} }
@ -339,38 +340,36 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Waiting Confirmation = WC */ /** Waiting Confirmation = WC */
public static final String DOCSTATUS_WaitingConfirmation = "WC"; public static final String DOCSTATUS_WaitingConfirmation = "WC";
/** Set Document Status. /** Set Document Status.
@param DocStatus @param DocStatus
The current status of the document The current status of the document
*/ */
public void setDocStatus (String DocStatus) public void setDocStatus (String DocStatus)
{ {
if (DocStatus == null) throw new IllegalArgumentException ("DocStatus is mandatory");
set_Value (COLUMNNAME_DocStatus, DocStatus); set_Value (COLUMNNAME_DocStatus, DocStatus);
} }
/** Get Document Status. /** Get Document Status.
@return The current status of the document @return The current status of the document
*/ */
public String getDocStatus () public String getDocStatus ()
{ {
return (String)get_Value(COLUMNNAME_DocStatus); return (String)get_Value(COLUMNNAME_DocStatus);
} }
/** Set Document No. /** Set Document No.
@param DocumentNo @param DocumentNo
Document sequence number of the document Document sequence number of the document
*/ */
public void setDocumentNo (String DocumentNo) public void setDocumentNo (String DocumentNo)
{ {
if (DocumentNo == null)
throw new IllegalArgumentException ("DocumentNo is mandatory.");
set_Value (COLUMNNAME_DocumentNo, DocumentNo); set_Value (COLUMNNAME_DocumentNo, DocumentNo);
} }
/** Get Document No. /** Get Document No.
@return Document sequence number of the document @return Document sequence number of the document
*/ */
public String getDocumentNo () public String getDocumentNo ()
{ {
return (String)get_Value(COLUMNNAME_DocumentNo); return (String)get_Value(COLUMNNAME_DocumentNo);
} }
@ -378,13 +377,13 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Record ID/ColumnName /** Get Record ID/ColumnName
@return ID/ColumnName pair @return ID/ColumnName pair
*/ */
public KeyNamePair getKeyNamePair() public KeyNamePair getKeyNamePair()
{ {
return new KeyNamePair(get_ID(), getDocumentNo()); return new KeyNamePair(get_ID(), getDocumentNo());
} }
/** Set Generate To. /** Set Generate To.
@param GenerateTo @param GenerateTo
Generate To Generate To
*/ */
public void setGenerateTo (String GenerateTo) public void setGenerateTo (String GenerateTo)
@ -395,13 +394,13 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Generate To. /** Get Generate To.
@return Generate To @return Generate To
*/ */
public String getGenerateTo () public String getGenerateTo ()
{ {
return (String)get_Value(COLUMNNAME_GenerateTo); return (String)get_Value(COLUMNNAME_GenerateTo);
} }
/** Set Comment/Help. /** Set Comment/Help.
@param Help @param Help
Comment or Hint Comment or Hint
*/ */
public void setHelp (String Help) public void setHelp (String Help)
@ -412,26 +411,27 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Comment/Help. /** Get Comment/Help.
@return Comment or Hint @return Comment or Hint
*/ */
public String getHelp () public String getHelp ()
{ {
return (String)get_Value(COLUMNNAME_Help); return (String)get_Value(COLUMNNAME_Help);
} }
/** Set Shipment/Receipt. /** Set Shipment/Receipt.
@param InOut_ID @param InOut_ID
MaterialShipment Document MaterialShipment Document
*/ */
public void setInOut_ID (int InOut_ID) public void setInOut_ID (int InOut_ID)
{ {
if (InOut_ID < 1) if (InOut_ID < 1)
throw new IllegalArgumentException ("InOut_ID is mandatory."); set_ValueNoCheck (COLUMNNAME_InOut_ID, null);
set_ValueNoCheck (COLUMNNAME_InOut_ID, Integer.valueOf(InOut_ID)); else
set_ValueNoCheck (COLUMNNAME_InOut_ID, Integer.valueOf(InOut_ID));
} }
/** Get Shipment/Receipt. /** Get Shipment/Receipt.
@return MaterialShipment Document @return MaterialShipment Document
*/ */
public int getInOut_ID () public int getInOut_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_InOut_ID); Integer ii = (Integer)get_Value(COLUMNNAME_InOut_ID);
if (ii == null) if (ii == null)
@ -440,7 +440,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
} }
/** Set Approved. /** Set Approved.
@param IsApproved @param IsApproved
Indicates if this document requires approval Indicates if this document requires approval
*/ */
public void setIsApproved (boolean IsApproved) public void setIsApproved (boolean IsApproved)
@ -451,20 +451,20 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Approved. /** Get Approved.
@return Indicates if this document requires approval @return Indicates if this document requires approval
*/ */
public boolean isApproved () public boolean isApproved ()
{ {
Object oo = get_Value(COLUMNNAME_IsApproved); Object oo = get_Value(COLUMNNAME_IsApproved);
if (oo != null) if (oo != null)
{ {
if (oo instanceof Boolean) if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue(); return ((Boolean)oo).booleanValue();
return "Y".equals(oo); return "Y".equals(oo);
} }
return false; return false;
} }
/** Set Sales Transaction. /** Set Sales Transaction.
@param IsSOTrx @param IsSOTrx
This is a Sales Transaction This is a Sales Transaction
*/ */
public void setIsSOTrx (boolean IsSOTrx) public void setIsSOTrx (boolean IsSOTrx)
@ -475,41 +475,19 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Sales Transaction. /** Get Sales Transaction.
@return This is a Sales Transaction @return This is a Sales Transaction
*/ */
public boolean isSOTrx () public boolean isSOTrx ()
{ {
Object oo = get_Value(COLUMNNAME_IsSOTrx); Object oo = get_Value(COLUMNNAME_IsSOTrx);
if (oo != null) if (oo != null)
{ {
if (oo instanceof Boolean) if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue(); return ((Boolean)oo).booleanValue();
return "Y".equals(oo); return "Y".equals(oo);
} }
return false; return false;
} }
/** Set RMA. public I_M_RMAType getM_RMAType() throws RuntimeException
@param M_RMA_ID
Return Material Authorization
*/
public void setM_RMA_ID (int M_RMA_ID)
{
if (M_RMA_ID < 1)
throw new IllegalArgumentException ("M_RMA_ID is mandatory.");
set_ValueNoCheck (COLUMNNAME_M_RMA_ID, Integer.valueOf(M_RMA_ID));
}
/** Get RMA.
@return Return Material Authorization
*/
public int getM_RMA_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_RMA_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_RMAType getM_RMAType() throws RuntimeException
{ {
Class<?> clazz = MTable.getClass(I_M_RMAType.Table_Name); Class<?> clazz = MTable.getClass(I_M_RMAType.Table_Name);
I_M_RMAType result = null; I_M_RMAType result = null;
@ -526,20 +504,21 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
} }
/** Set RMA Type. /** Set RMA Type.
@param M_RMAType_ID @param M_RMAType_ID
Return Material Authorization Type Return Material Authorization Type
*/ */
public void setM_RMAType_ID (int M_RMAType_ID) public void setM_RMAType_ID (int M_RMAType_ID)
{ {
if (M_RMAType_ID < 1) if (M_RMAType_ID < 1)
throw new IllegalArgumentException ("M_RMAType_ID is mandatory."); set_Value (COLUMNNAME_M_RMAType_ID, null);
set_Value (COLUMNNAME_M_RMAType_ID, Integer.valueOf(M_RMAType_ID)); else
set_Value (COLUMNNAME_M_RMAType_ID, Integer.valueOf(M_RMAType_ID));
} }
/** Get RMA Type. /** Get RMA Type.
@return Return Material Authorization Type @return Return Material Authorization Type
*/ */
public int getM_RMAType_ID () public int getM_RMAType_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_M_RMAType_ID); Integer ii = (Integer)get_Value(COLUMNNAME_M_RMAType_ID);
if (ii == null) if (ii == null)
@ -547,27 +526,48 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
return ii.intValue(); return ii.intValue();
} }
/** Set RMA.
@param M_RMA_ID
Return Material Authorization
*/
public void setM_RMA_ID (int M_RMA_ID)
{
if (M_RMA_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_RMA_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_RMA_ID, Integer.valueOf(M_RMA_ID));
}
/** Get RMA.
@return Return Material Authorization
*/
public int getM_RMA_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_RMA_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name. /** Set Name.
@param Name @param Name
Alphanumeric identifier of the entity Alphanumeric identifier of the entity
*/ */
public void setName (String Name) public void setName (String Name)
{ {
if (Name == null)
throw new IllegalArgumentException ("Name is mandatory.");
set_Value (COLUMNNAME_Name, Name); set_Value (COLUMNNAME_Name, Name);
} }
/** Get Name. /** Get Name.
@return Alphanumeric identifier of the entity @return Alphanumeric identifier of the entity
*/ */
public String getName () public String getName ()
{ {
return (String)get_Value(COLUMNNAME_Name); return (String)get_Value(COLUMNNAME_Name);
} }
/** Set Processed. /** Set Processed.
@param Processed @param Processed
The document has been processed The document has been processed
*/ */
public void setProcessed (boolean Processed) public void setProcessed (boolean Processed)
@ -578,13 +578,13 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Processed. /** Get Processed.
@return The document has been processed @return The document has been processed
*/ */
public boolean isProcessed () public boolean isProcessed ()
{ {
Object oo = get_Value(COLUMNNAME_Processed); Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null) if (oo != null)
{ {
if (oo instanceof Boolean) if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue(); return ((Boolean)oo).booleanValue();
return "Y".equals(oo); return "Y".equals(oo);
} }
return false; return false;
@ -599,33 +599,54 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Process Now. /** Get Process Now.
@return Process Now */ @return Process Now */
public boolean isProcessing () public boolean isProcessing ()
{ {
Object oo = get_Value(COLUMNNAME_Processing); Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null) if (oo != null)
{ {
if (oo instanceof Boolean) if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue(); return ((Boolean)oo).booleanValue();
return "Y".equals(oo); return "Y".equals(oo);
} }
return false; return false;
} }
/** Set Referenced RMA.
@param Ref_RMA_ID Referenced RMA */
public void setRef_RMA_ID (int Ref_RMA_ID)
{
if (Ref_RMA_ID < 1)
set_Value (COLUMNNAME_Ref_RMA_ID, null);
else
set_Value (COLUMNNAME_Ref_RMA_ID, Integer.valueOf(Ref_RMA_ID));
}
/** Get Referenced RMA.
@return Referenced RMA */
public int getRef_RMA_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Ref_RMA_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Sales Representative. /** Set Sales Representative.
@param SalesRep_ID @param SalesRep_ID
Sales Representative or Company Agent Sales Representative or Company Agent
*/ */
public void setSalesRep_ID (int SalesRep_ID) public void setSalesRep_ID (int SalesRep_ID)
{ {
if (SalesRep_ID < 1) if (SalesRep_ID < 1)
throw new IllegalArgumentException ("SalesRep_ID is mandatory."); set_Value (COLUMNNAME_SalesRep_ID, null);
set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID)); else
set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID));
} }
/** Get Sales Representative. /** Get Sales Representative.
@return Sales Representative or Company Agent @return Sales Representative or Company Agent
*/ */
public int getSalesRep_ID () public int getSalesRep_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID); Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID);
if (ii == null) if (ii == null)

View File

@ -26,15 +26,15 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
/** Generated Model for M_RMALine /** Generated Model for M_RMALine
* @author Adempiere (generated) * @author Adempiere (generated)
* @version Release 3.5.3a - $Id$ */ * @version Release 3.5.3a - $Id$ */
public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 20081221L; private static final long serialVersionUID = 20090601;
/** Standard Constructor */ /** Standard Constructor */
public X_M_RMALine (Properties ctx, int M_RMALine_ID, String trxName) public X_M_RMALine (Properties ctx, int M_RMALine_ID, String trxName)
@ -42,8 +42,8 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
super (ctx, M_RMALine_ID, trxName); super (ctx, M_RMALine_ID, trxName);
/** if (M_RMALine_ID == 0) /** if (M_RMALine_ID == 0)
{ {
setM_RMA_ID (0);
setM_RMALine_ID (0); setM_RMALine_ID (0);
setM_RMA_ID (0);
setProcessed (false); setProcessed (false);
setQty (Env.ZERO); setQty (Env.ZERO);
} */ } */
@ -56,7 +56,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
} }
/** AccessLevel /** AccessLevel
* @return 1 - Org * @return 1 - Org
*/ */
protected int get_AccessLevel() protected int get_AccessLevel()
{ {
@ -78,7 +78,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
} }
/** Set Amount. /** Set Amount.
@param Amt @param Amt
Amount Amount
*/ */
public void setAmt (BigDecimal Amt) public void setAmt (BigDecimal Amt)
@ -89,7 +89,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Amount. /** Get Amount.
@return Amount @return Amount
*/ */
public BigDecimal getAmt () public BigDecimal getAmt ()
{ {
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Amt); BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Amt);
if (bd == null) if (bd == null)
@ -97,7 +97,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
return bd; return bd;
} }
public I_C_Charge getC_Charge() throws RuntimeException public I_C_Charge getC_Charge() throws RuntimeException
{ {
Class<?> clazz = MTable.getClass(I_C_Charge.Table_Name); Class<?> clazz = MTable.getClass(I_C_Charge.Table_Name);
I_C_Charge result = null; I_C_Charge result = null;
@ -114,21 +114,21 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
} }
/** Set Charge. /** Set Charge.
@param C_Charge_ID @param C_Charge_ID
Additional document charges Additional document charges
*/ */
public void setC_Charge_ID (int C_Charge_ID) public void setC_Charge_ID (int C_Charge_ID)
{ {
if (C_Charge_ID < 1) if (C_Charge_ID < 1)
set_Value (COLUMNNAME_C_Charge_ID, null); set_Value (COLUMNNAME_C_Charge_ID, null);
else else
set_Value (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID)); set_Value (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID));
} }
/** Get Charge. /** Get Charge.
@return Additional document charges @return Additional document charges
*/ */
public int getC_Charge_ID () public int getC_Charge_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID); Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID);
if (ii == null) if (ii == null)
@ -137,7 +137,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
} }
/** Set Description. /** Set Description.
@param Description @param Description
Optional short description of the record Optional short description of the record
*/ */
public void setDescription (String Description) public void setDescription (String Description)
@ -148,13 +148,13 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Description. /** Get Description.
@return Optional short description of the record @return Optional short description of the record
*/ */
public String getDescription () public String getDescription ()
{ {
return (String)get_Value(COLUMNNAME_Description); return (String)get_Value(COLUMNNAME_Description);
} }
/** Set Line No. /** Set Line No.
@param Line @param Line
Unique line for this document Unique line for this document
*/ */
public void setLine (int Line) public void setLine (int Line)
@ -165,7 +165,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Line No. /** Get Line No.
@return Unique line for this document @return Unique line for this document
*/ */
public int getLine () public int getLine ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_Line); Integer ii = (Integer)get_Value(COLUMNNAME_Line);
if (ii == null) if (ii == null)
@ -174,7 +174,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
} }
/** Set Line Amount. /** Set Line Amount.
@param LineNetAmt @param LineNetAmt
Line Extended Amount (Quantity * Actual Price) without Freight and Charges Line Extended Amount (Quantity * Actual Price) without Freight and Charges
*/ */
public void setLineNetAmt (BigDecimal LineNetAmt) public void setLineNetAmt (BigDecimal LineNetAmt)
@ -185,7 +185,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Line Amount. /** Get Line Amount.
@return Line Extended Amount (Quantity * Actual Price) without Freight and Charges @return Line Extended Amount (Quantity * Actual Price) without Freight and Charges
*/ */
public BigDecimal getLineNetAmt () public BigDecimal getLineNetAmt ()
{ {
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_LineNetAmt); BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_LineNetAmt);
if (bd == null) if (bd == null)
@ -193,7 +193,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
return bd; return bd;
} }
public I_M_InOutLine getM_InOutLine() throws RuntimeException public I_M_InOutLine getM_InOutLine() throws RuntimeException
{ {
Class<?> clazz = MTable.getClass(I_M_InOutLine.Table_Name); Class<?> clazz = MTable.getClass(I_M_InOutLine.Table_Name);
I_M_InOutLine result = null; I_M_InOutLine result = null;
@ -210,21 +210,21 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
} }
/** Set Shipment/Receipt Line. /** Set Shipment/Receipt Line.
@param M_InOutLine_ID @param M_InOutLine_ID
Line on Shipment or Receipt document Line on Shipment or Receipt document
*/ */
public void setM_InOutLine_ID (int M_InOutLine_ID) public void setM_InOutLine_ID (int M_InOutLine_ID)
{ {
if (M_InOutLine_ID < 1) if (M_InOutLine_ID < 1)
set_Value (COLUMNNAME_M_InOutLine_ID, null); set_Value (COLUMNNAME_M_InOutLine_ID, null);
else else
set_Value (COLUMNNAME_M_InOutLine_ID, Integer.valueOf(M_InOutLine_ID)); set_Value (COLUMNNAME_M_InOutLine_ID, Integer.valueOf(M_InOutLine_ID));
} }
/** Get Shipment/Receipt Line. /** Get Shipment/Receipt Line.
@return Line on Shipment or Receipt document @return Line on Shipment or Receipt document
*/ */
public int getM_InOutLine_ID () public int getM_InOutLine_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_M_InOutLine_ID); Integer ii = (Integer)get_Value(COLUMNNAME_M_InOutLine_ID);
if (ii == null) if (ii == null)
@ -232,7 +232,30 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
return ii.intValue(); return ii.intValue();
} }
public I_M_RMA getM_RMA() throws RuntimeException /** Set RMA Line.
@param M_RMALine_ID
Return Material Authorization Line
*/
public void setM_RMALine_ID (int M_RMALine_ID)
{
if (M_RMALine_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_RMALine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_RMALine_ID, Integer.valueOf(M_RMALine_ID));
}
/** Get RMA Line.
@return Return Material Authorization Line
*/
public int getM_RMALine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_RMALine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_RMA getM_RMA() throws RuntimeException
{ {
Class<?> clazz = MTable.getClass(I_M_RMA.Table_Name); Class<?> clazz = MTable.getClass(I_M_RMA.Table_Name);
I_M_RMA result = null; I_M_RMA result = null;
@ -249,20 +272,21 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
} }
/** Set RMA. /** Set RMA.
@param M_RMA_ID @param M_RMA_ID
Return Material Authorization Return Material Authorization
*/ */
public void setM_RMA_ID (int M_RMA_ID) public void setM_RMA_ID (int M_RMA_ID)
{ {
if (M_RMA_ID < 1) if (M_RMA_ID < 1)
throw new IllegalArgumentException ("M_RMA_ID is mandatory."); set_ValueNoCheck (COLUMNNAME_M_RMA_ID, null);
set_ValueNoCheck (COLUMNNAME_M_RMA_ID, Integer.valueOf(M_RMA_ID)); else
set_ValueNoCheck (COLUMNNAME_M_RMA_ID, Integer.valueOf(M_RMA_ID));
} }
/** Get RMA. /** Get RMA.
@return Return Material Authorization @return Return Material Authorization
*/ */
public int getM_RMA_ID () public int getM_RMA_ID ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_M_RMA_ID); Integer ii = (Integer)get_Value(COLUMNNAME_M_RMA_ID);
if (ii == null) if (ii == null)
@ -273,35 +297,13 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Record ID/ColumnName /** Get Record ID/ColumnName
@return ID/ColumnName pair @return ID/ColumnName pair
*/ */
public KeyNamePair getKeyNamePair() public KeyNamePair getKeyNamePair()
{ {
return new KeyNamePair(get_ID(), String.valueOf(getM_RMA_ID())); return new KeyNamePair(get_ID(), String.valueOf(getM_RMA_ID()));
} }
/** Set RMA Line.
@param M_RMALine_ID
Return Material Authorization Line
*/
public void setM_RMALine_ID (int M_RMALine_ID)
{
if (M_RMALine_ID < 1)
throw new IllegalArgumentException ("M_RMALine_ID is mandatory.");
set_ValueNoCheck (COLUMNNAME_M_RMALine_ID, Integer.valueOf(M_RMALine_ID));
}
/** Get RMA Line.
@return Return Material Authorization Line
*/
public int getM_RMALine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_RMALine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Processed. /** Set Processed.
@param Processed @param Processed
The document has been processed The document has been processed
*/ */
public void setProcessed (boolean Processed) public void setProcessed (boolean Processed)
@ -312,33 +314,31 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Processed. /** Get Processed.
@return The document has been processed @return The document has been processed
*/ */
public boolean isProcessed () public boolean isProcessed ()
{ {
Object oo = get_Value(COLUMNNAME_Processed); Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null) if (oo != null)
{ {
if (oo instanceof Boolean) if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue(); return ((Boolean)oo).booleanValue();
return "Y".equals(oo); return "Y".equals(oo);
} }
return false; return false;
} }
/** Set Quantity. /** Set Quantity.
@param Qty @param Qty
Quantity Quantity
*/ */
public void setQty (BigDecimal Qty) public void setQty (BigDecimal Qty)
{ {
if (Qty == null)
throw new IllegalArgumentException ("Qty is mandatory.");
set_Value (COLUMNNAME_Qty, Qty); set_Value (COLUMNNAME_Qty, Qty);
} }
/** Get Quantity. /** Get Quantity.
@return Quantity @return Quantity
*/ */
public BigDecimal getQty () public BigDecimal getQty ()
{ {
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null) if (bd == null)
@ -347,7 +347,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
} }
/** Set Delivered Quantity. /** Set Delivered Quantity.
@param QtyDelivered @param QtyDelivered
Delivered Quantity Delivered Quantity
*/ */
public void setQtyDelivered (BigDecimal QtyDelivered) public void setQtyDelivered (BigDecimal QtyDelivered)
@ -358,11 +358,51 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Delivered Quantity. /** Get Delivered Quantity.
@return Delivered Quantity @return Delivered Quantity
*/ */
public BigDecimal getQtyDelivered () public BigDecimal getQtyDelivered ()
{ {
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyDelivered); BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyDelivered);
if (bd == null) if (bd == null)
return Env.ZERO; return Env.ZERO;
return bd; return bd;
} }
/** Set Quantity Invoiced.
@param QtyInvoiced
Invoiced Quantity
*/
public void setQtyInvoiced (BigDecimal QtyInvoiced)
{
set_Value (COLUMNNAME_QtyInvoiced, QtyInvoiced);
}
/** Get Quantity Invoiced.
@return Invoiced Quantity
*/
public BigDecimal getQtyInvoiced ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyInvoiced);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Referenced RMA Line.
@param Ref_RMALine_ID Referenced RMA Line */
public void setRef_RMALine_ID (int Ref_RMALine_ID)
{
if (Ref_RMALine_ID < 1)
set_Value (COLUMNNAME_Ref_RMALine_ID, null);
else
set_Value (COLUMNNAME_Ref_RMALine_ID, Integer.valueOf(Ref_RMALine_ID));
}
/** Get Referenced RMA Line.
@return Referenced RMA Line */
public int getRef_RMALine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Ref_RMALine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} }

View File

@ -24,37 +24,40 @@ import java.util.logging.Level;
import org.compiere.minigrid.IMiniTable; import org.compiere.minigrid.IMiniTable;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MOrder; import org.compiere.model.MOrder;
import org.compiere.model.MRMA;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
public abstract class CreateFrom implements ICreateFrom public abstract class CreateFrom implements ICreateFrom
{ {
/** Logger */ /** Logger */
protected CLogger log = CLogger.getCLogger(getClass()); protected CLogger log = CLogger.getCLogger(getClass());
/** Loaded Order */ /** Loaded Order */
protected MOrder p_order = null; protected MOrder p_order = null;
/** Loaded RMA */
protected MRMA m_rma = null;
private GridTab gridTab; private GridTab gridTab;
private String title; private String title;
private boolean initOK = false; private boolean initOK = false;
public CreateFrom(GridTab gridTab) { public CreateFrom(GridTab gridTab) {
this.gridTab = gridTab; this.gridTab = gridTab;
} }
public abstract boolean dynInit() throws Exception; public abstract boolean dynInit() throws Exception;
public abstract void info(); public abstract void info();
public abstract boolean save(IMiniTable miniTable, String trxName); public abstract boolean save(IMiniTable miniTable, String trxName);
/** /**
* Init OK to be able to make changes? * Init OK to be able to make changes?
* @return on if initialized * @return on if initialized
@ -63,12 +66,12 @@ public abstract class CreateFrom implements ICreateFrom
{ {
return initOK; return initOK;
} }
public void setInitOK(boolean initOK) public void setInitOK(boolean initOK)
{ {
this.initOK = initOK; this.initOK = initOK;
} }
/** /**
* Load PBartner dependent Order/Invoice/Shipment Field. * Load PBartner dependent Order/Invoice/Shipment Field.
* @param C_BPartner_ID BPartner * @param C_BPartner_ID BPartner
@ -77,7 +80,7 @@ public abstract class CreateFrom implements ICreateFrom
protected ArrayList<KeyNamePair> loadOrderData (int C_BPartner_ID, boolean forInvoice, boolean sameWarehouseOnly) protected ArrayList<KeyNamePair> loadOrderData (int C_BPartner_ID, boolean forInvoice, boolean sameWarehouseOnly)
{ {
ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>(); ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();
// Display // Display
StringBuffer display = new StringBuffer("o.DocumentNo||' - ' ||") StringBuffer display = new StringBuffer("o.DocumentNo||' - ' ||")
.append(DB.TO_CHAR("o.DateOrdered", DisplayType.Date, Env.getAD_Language(Env.getCtx()))) .append(DB.TO_CHAR("o.DateOrdered", DisplayType.Date, Env.getAD_Language(Env.getCtx())))
@ -125,10 +128,10 @@ public abstract class CreateFrom implements ICreateFrom
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; pstmt = null; rs = null; pstmt = null;
} }
return list; return list;
} // initBPartnerOIS } // initBPartnerOIS
/** /**
* Load Data - Order * Load Data - Order
* @param C_Order_ID Order * @param C_Order_ID Order
@ -212,21 +215,21 @@ public abstract class CreateFrom implements ICreateFrom
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; pstmt = null; rs = null; pstmt = null;
} }
return data; return data;
} // LoadOrder } // LoadOrder
public void showWindow() public void showWindow()
{ {
} }
public void closeWindow() public void closeWindow()
{ {
} }
public GridTab getGridTab() public GridTab getGridTab()
{ {
return gridTab; return gridTab;
} }
@ -239,7 +242,7 @@ public abstract class CreateFrom implements ICreateFrom
{ {
return Env.getContextAsInt(Env.getCtx(), gridTab.getWindowNo(), "M_Warehouse_ID"); return Env.getContextAsInt(Env.getCtx(), gridTab.getWindowNo(), "M_Warehouse_ID");
} }
public String getTitle() { public String getTitle() {
return title; return title;
} }

View File

@ -30,6 +30,8 @@ import org.compiere.model.MInvoiceLine;
import org.compiere.model.MOrder; import org.compiere.model.MOrder;
import org.compiere.model.MOrderLine; import org.compiere.model.MOrderLine;
import org.compiere.model.MProduct; import org.compiere.model.MProduct;
import org.compiere.model.MRMA;
import org.compiere.model.MRMALine;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -41,12 +43,12 @@ import org.compiere.util.Msg;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: VCreateFromInvoice.java,v 1.4 2006/07/30 00:51:28 jjanke Exp $ * @version $Id: VCreateFromInvoice.java,v 1.4 2006/07/30 00:51:28 jjanke Exp $
* *
* @author Teo Sarca, SC ARHIPAC SERVICE SRL * @author Teo Sarca, SC ARHIPAC SERVICE SRL
* <li>BF [ 1896947 ] Generate invoice from Order error * <li>BF [ 1896947 ] Generate invoice from Order error
* <li>BF [ 2007837 ] VCreateFrom.save() should run in trx * <li>BF [ 2007837 ] VCreateFrom.save() should run in trx
*/ */
public class CreateFromInvoice extends CreateFrom public class CreateFromInvoice extends CreateFrom
{ {
/** /**
* Protected Constructor * Protected Constructor
@ -66,7 +68,7 @@ public class CreateFromInvoice extends CreateFrom
{ {
log.config(""); log.config("");
setTitle(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false) + " .. " + Msg.translate(Env.getCtx(), "CreateFrom")); setTitle(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false) + " .. " + Msg.translate(Env.getCtx(), "CreateFrom"));
return true; return true;
} // dynInit } // dynInit
@ -77,7 +79,7 @@ public class CreateFromInvoice extends CreateFrom
protected ArrayList<KeyNamePair> loadShipmentData (int C_BPartner_ID) protected ArrayList<KeyNamePair> loadShipmentData (int C_BPartner_ID)
{ {
ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>(); ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();
// Display // Display
StringBuffer display = new StringBuffer("s.DocumentNo||' - '||") StringBuffer display = new StringBuffer("s.DocumentNo||' - '||")
.append(DB.TO_CHAR("s.MovementDate", DisplayType.Date, Env.getAD_Language(Env.getCtx()))); .append(DB.TO_CHAR("s.MovementDate", DisplayType.Date, Env.getAD_Language(Env.getCtx())));
@ -111,10 +113,10 @@ public class CreateFromInvoice extends CreateFrom
{ {
log.log(Level.SEVERE, sql.toString(), e); log.log(Level.SEVERE, sql.toString(), e);
} }
return list; return list;
} }
/** /**
* Load PBartner dependent Order/Invoice/Shipment Field. * Load PBartner dependent Order/Invoice/Shipment Field.
* @param C_BPartner_ID BPartner * @param C_BPartner_ID BPartner
@ -164,6 +166,10 @@ public class CreateFromInvoice extends CreateFrom
if (inout.getC_Order_ID() != 0) if (inout.getC_Order_ID() != 0)
p_order = new MOrder (Env.getCtx(), inout.getC_Order_ID(), null); 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>>(); Vector<Vector<Object>> data = new Vector<Vector<Object>>();
StringBuffer sql = new StringBuffer("SELECT " // QtyEntered StringBuffer sql = new StringBuffer("SELECT " // QtyEntered
@ -172,18 +178,18 @@ public class CreateFromInvoice extends CreateFrom
+ " l.M_Product_ID, p.Name, po.VendorProductNo, l.M_InOutLine_ID, l.Line," // 5..9 + " l.M_Product_ID, p.Name, po.VendorProductNo, l.M_InOutLine_ID, l.Line," // 5..9
+ " l.C_OrderLine_ID " // 10 + " l.C_OrderLine_ID " // 10
+ " FROM M_InOutLine l " + " FROM M_InOutLine l "
); );
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM")) if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)"); sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)");
else else
sql.append(" LEFT OUTER JOIN C_UOM_Trl uom ON (l.C_UOM_ID=uom.C_UOM_ID AND uom.AD_Language='") sql.append(" LEFT OUTER JOIN C_UOM_Trl uom ON (l.C_UOM_ID=uom.C_UOM_ID AND uom.AD_Language='")
.append(Env.getAD_Language(Env.getCtx())).append("')"); .append(Env.getAD_Language(Env.getCtx())).append("')");
sql.append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)") sql.append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)")
.append(" INNER JOIN M_InOut io ON (l.M_InOut_ID=io.M_InOut_ID)") .append(" INNER JOIN M_InOut io ON (l.M_InOut_ID=io.M_InOut_ID)")
.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(" 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(" LEFT OUTER JOIN M_MatchInv mi ON (l.M_InOutLine_ID=mi.M_InOutLine_ID)") .append(" LEFT OUTER JOIN M_MatchInv mi ON (l.M_InOutLine_ID=mi.M_InOutLine_ID)")
.append(" WHERE l.M_InOut_ID=? AND l.MovementQty<>0 ") .append(" WHERE l.M_InOut_ID=? AND l.MovementQty<>0 ")
.append("GROUP BY l.MovementQty, l.QtyEntered/l.MovementQty, " .append("GROUP BY l.MovementQty, l.QtyEntered/l.MovementQty, "
+ "l.C_UOM_ID, COALESCE(uom.UOMSymbol, uom.Name), " + "l.C_UOM_ID, COALESCE(uom.UOMSymbol, uom.Name), "
@ -225,10 +231,10 @@ public class CreateFromInvoice extends CreateFrom
{ {
log.log(Level.SEVERE, sql.toString(), e); log.log(Level.SEVERE, sql.toString(), e);
} }
return data; return data;
} // loadShipment } // loadShipment
/** /**
* Load RMA details * Load RMA details
* @param M_RMA_ID RMA * @param M_RMA_ID RMA
@ -236,14 +242,14 @@ public class CreateFromInvoice extends CreateFrom
protected Vector<Vector<Object>> getRMAData(int M_RMA_ID) protected Vector<Vector<Object>> getRMAData(int M_RMA_ID)
{ {
p_order = null; p_order = null;
// MRMA m_rma = new MRMA(Env.getCtx(), M_RMA_ID, null); // MRMA m_rma = new MRMA(Env.getCtx(), M_RMA_ID, null);
Vector<Vector<Object>> data = new Vector<Vector<Object>>(); Vector<Vector<Object>> data = new Vector<Vector<Object>>();
StringBuffer sqlStmt = new StringBuffer(); StringBuffer sqlStmt = new StringBuffer();
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, iol.M_Product_ID, p.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) "); sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - 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 "); sqlStmt.append("FROM M_RMALine rl INNER JOIN M_InOutLine iol ON rl.M_InOutLine_ID=iol.M_InOutLine_ID ");
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM")) if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
{ {
sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=iol.C_UOM_ID) "); sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=iol.C_UOM_ID) ");
@ -256,9 +262,9 @@ public class CreateFromInvoice extends CreateFrom
sqlStmt.append("LEFT OUTER JOIN M_Product p ON p.M_Product_ID=iol.M_Product_ID "); sqlStmt.append("LEFT OUTER JOIN M_Product p ON p.M_Product_ID=iol.M_Product_ID ");
sqlStmt.append("WHERE rl.M_RMA_ID=? "); sqlStmt.append("WHERE rl.M_RMA_ID=? ");
sqlStmt.append("AND rl.M_INOUTLINE_ID IS NOT NULL"); sqlStmt.append("AND rl.M_INOUTLINE_ID IS NOT NULL");
sqlStmt.append(" UNION "); sqlStmt.append(" UNION ");
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, 0, c.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) "); sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, 0, c.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) ");
sqlStmt.append("FROM M_RMALine rl INNER JOIN C_Charge c ON c.C_Charge_ID = rl.C_Charge_ID "); sqlStmt.append("FROM M_RMALine rl INNER JOIN C_Charge c ON c.C_Charge_ID = rl.C_Charge_ID ");
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM")) if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
@ -272,7 +278,7 @@ public class CreateFromInvoice extends CreateFrom
} }
sqlStmt.append("WHERE rl.M_RMA_ID=? "); sqlStmt.append("WHERE rl.M_RMA_ID=? ");
sqlStmt.append("AND rl.C_Charge_ID IS NOT NULL"); sqlStmt.append("AND rl.C_Charge_ID IS NOT NULL");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
@ -281,7 +287,7 @@ public class CreateFromInvoice extends CreateFrom
pstmt.setInt(1, M_RMA_ID); pstmt.setInt(1, M_RMA_ID);
pstmt.setInt(2, M_RMA_ID); pstmt.setInt(2, M_RMA_ID);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
Vector<Object> line = new Vector<Object>(7); Vector<Object> line = new Vector<Object>(7);
@ -309,7 +315,7 @@ public class CreateFromInvoice extends CreateFrom
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; pstmt = null; rs = null; pstmt = null;
} }
return data; return data;
} }
@ -320,7 +326,7 @@ public class CreateFromInvoice extends CreateFrom
{ {
} // infoInvoice } // infoInvoice
protected void configureMiniTable (IMiniTable miniTable) protected void configureMiniTable (IMiniTable miniTable)
{ {
miniTable.setColumnClass(0, Boolean.class, false); // 0-Selection miniTable.setColumnClass(0, Boolean.class, false); // 0-Selection
@ -351,19 +357,25 @@ public class CreateFromInvoice extends CreateFrom
invoice.setOrder(p_order); // overwrite header values invoice.setOrder(p_order); // overwrite header values
invoice.saveEx(); invoice.saveEx();
} }
if (m_rma != null)
{
invoice.setM_RMA_ID(m_rma.getM_RMA_ID());
invoice.saveEx();
}
MInOut inout = null; MInOut inout = null;
// if (m_M_InOut_ID > 0) // if (m_M_InOut_ID > 0)
// { // {
// inout = new MInOut(Env.getCtx(), m_M_InOut_ID, trxName); // inout = new MInOut(Env.getCtx(), m_M_InOut_ID, trxName);
// } // }
if (inout != null && inout.getM_InOut_ID() != 0 if (inout != null && inout.getM_InOut_ID() != 0
&& inout.getC_Invoice_ID() == 0) // only first time && inout.getC_Invoice_ID() == 0) // only first time
{ {
inout.setC_Invoice_ID(C_Invoice_ID); inout.setC_Invoice_ID(C_Invoice_ID);
inout.saveEx(); inout.saveEx();
} }
// Lines // Lines
for (int i = 0; i < miniTable.getRowCount(); i++) for (int i = 0; i < miniTable.getRowCount(); i++)
{ {
@ -371,7 +383,7 @@ public class CreateFromInvoice extends CreateFrom
{ {
// variable values // variable values
BigDecimal QtyEntered = (BigDecimal)miniTable.getValueAt(i, 1); // 1-Qty BigDecimal QtyEntered = (BigDecimal)miniTable.getValueAt(i, 1); // 1-Qty
KeyNamePair pp = (KeyNamePair)miniTable.getValueAt(i, 2); // 2-UOM KeyNamePair pp = (KeyNamePair)miniTable.getValueAt(i, 2); // 2-UOM
int C_UOM_ID = pp.getKey(); int C_UOM_ID = pp.getKey();
// //
@ -388,6 +400,12 @@ public class CreateFromInvoice extends CreateFrom
pp = (KeyNamePair)miniTable.getValueAt(i, 6); // 6-Shipment pp = (KeyNamePair)miniTable.getValueAt(i, 6); // 6-Shipment
if (pp != null) if (pp != null)
M_InOutLine_ID = pp.getKey(); 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 // Precision of Qty UOM
int precision = 2; int precision = 2;
if (M_Product_ID != 0) if (M_Product_ID != 0)
@ -398,7 +416,7 @@ public class CreateFromInvoice extends CreateFrom
QtyEntered = QtyEntered.setScale(precision, BigDecimal.ROUND_HALF_DOWN); QtyEntered = QtyEntered.setScale(precision, BigDecimal.ROUND_HALF_DOWN);
// //
log.fine("Line QtyEntered=" + QtyEntered log.fine("Line QtyEntered=" + QtyEntered
+ ", Product_ID=" + M_Product_ID + ", Product_ID=" + M_Product_ID
+ ", OrderLine_ID=" + C_OrderLine_ID + ", InOutLine_ID=" + M_InOutLine_ID); + ", OrderLine_ID=" + C_OrderLine_ID + ", InOutLine_ID=" + M_InOutLine_ID);
// Create new Invoice Line // Create new Invoice Line
@ -410,6 +428,11 @@ public class CreateFromInvoice extends CreateFrom
MOrderLine orderLine = null; MOrderLine orderLine = null;
if (C_OrderLine_ID != 0) if (C_OrderLine_ID != 0)
orderLine = new MOrderLine (Env.getCtx(), C_OrderLine_ID, trxName); 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; MInOutLine inoutLine = null;
if (M_InOutLine_ID != 0) if (M_InOutLine_ID != 0)
{ {
@ -420,10 +443,10 @@ public class CreateFromInvoice extends CreateFrom
orderLine = new MOrderLine (Env.getCtx(), C_OrderLine_ID, trxName); orderLine = new MOrderLine (Env.getCtx(), C_OrderLine_ID, trxName);
} }
} }
else 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'))"; 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(), MInOutLine[] lines = MInOutLine.getOfOrderLine(Env.getCtx(),
C_OrderLine_ID, whereClause, trxName); C_OrderLine_ID, whereClause, trxName);
log.fine ("Receipt Lines with OrderLine = #" + lines.length); log.fine ("Receipt Lines with OrderLine = #" + lines.length);
if (lines.length > 0) if (lines.length > 0)
@ -444,7 +467,33 @@ public class CreateFromInvoice extends CreateFrom
M_InOutLine_ID = inoutLine.getM_InOutLine_ID(); M_InOutLine_ID = inoutLine.getM_InOutLine_ID();
} }
} }
} // get Ship info }
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);
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 // Shipment Info
if (inoutLine != null) if (inoutLine != null)
@ -472,6 +521,14 @@ public class CreateFromInvoice extends CreateFrom
invoiceLine.setPrice(); invoiceLine.setPrice();
invoiceLine.setTax(); invoiceLine.setTax();
} }
//RMA Info
if (rmaLine != null)
{
invoiceLine.setRMALine(rmaLine); // overwrites
}
else
log.fine("No RMA Line");
} }
invoiceLine.saveEx(); invoiceLine.saveEx();
} // if selected } // if selected
@ -492,7 +549,7 @@ public class CreateFromInvoice extends CreateFrom
columnNames.add(Msg.getElement(Env.getCtx(), "C_Order_ID", false)); columnNames.add(Msg.getElement(Env.getCtx(), "C_Order_ID", false));
columnNames.add(Msg.getElement(Env.getCtx(), "M_InOut_ID", false)); columnNames.add(Msg.getElement(Env.getCtx(), "M_InOut_ID", false));
columnNames.add(Msg.getElement(Env.getCtx(), "M_RMA_ID", false)); columnNames.add(Msg.getElement(Env.getCtx(), "M_RMA_ID", false));
return columnNames; return columnNames;
} }

View File

@ -0,0 +1,130 @@
-- May 31, 2009 11:58:22 PM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Tab SET WhereClause='MovementType IN (''C-'', ''V-'')',Updated=TO_DATE('2009-05-31 23:58:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=257
;
-- May 31, 2009 11:58:58 PM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Tab SET WhereClause='MovementType IN (''V+'', ''C+'')',Updated=TO_DATE('2009-05-31 23:58:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=296
;
-- Jun 1, 2009 12:01:38 AM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'', ''MMS'')',Updated=TO_DATE('2009-06-01 00:01:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=125
;
-- Jun 1, 2009 12:07:49 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,Description,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52053,'C_DocType.DocBaseType IN (''MMS'')',TO_DATE('2009-06-01 00:07:45','YYYY-MM-DD HH24:MI:SS'),100,'Document Type Material Shipments','D','Y','C_DocType Material Shipments','S',TO_DATE('2009-06-01 00:07:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:08:41 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,Description,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52054,'C_DocType.DocBaseType IN (''MMR'')',TO_DATE('2009-06-01 00:08:39','YYYY-MM-DD HH24:MI:SS'),100,'Document Type Material Receipts','D','Y','C_DocType Material Receipts','S',TO_DATE('2009-06-01 00:08:39','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:10:25 AM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Field SET AD_Reference_ID=19, AD_Val_Rule_ID=52054,Updated=TO_DATE('2009-06-01 00:10:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3489
;
-- Jun 1, 2009 12:11:25 AM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Field SET AD_Reference_ID=19, AD_Val_Rule_ID=52053,Updated=TO_DATE('2009-06-01 00:11:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2931
;
-- Jun 1, 2009 12:17:54 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53866,0,'Ref_RMA_ID',TO_DATE('2009-06-01 00:17:47','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Referenced RMA','Ref RMA',TO_DATE('2009-06-01 00:17:47','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:17:54 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53866 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- Jun 1, 2009 12:18:40 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53867,0,'Ref_RMALine_ID',TO_DATE('2009-06-01 00:18:37','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Referenced RMA Line','Ref RMA Line',TO_DATE('2009-06-01 00:18:37','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:18:40 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53867 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- Jun 1, 2009 12:33:03 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,Description,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,53306,TO_DATE('2009-06-01 00:33:01','YYYY-MM-DD HH24:MI:SS'),100,'RMA','D','Y','N','M_RMA',TO_DATE('2009-06-01 00:33:01','YYYY-MM-DD HH24:MI:SS'),100,'T')
;
-- Jun 1, 2009 12:33:03 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53306 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID)
;
-- Jun 1, 2009 12:36:11 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,OrderByClause,Updated,UpdatedBy) VALUES (0,10841,10847,0,53306,661,TO_DATE('2009-06-01 00:36:11','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','M_RMA.DocumentNo',TO_DATE('2009-06-01 00:36:11','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:37:45 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57790,53866,0,30,53306,661,'Ref_RMA_ID',TO_DATE('2009-06-01 00:37:41','YYYY-MM-DD HH24:MI:SS'),100,'D',22,'Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Referenced RMA',0,TO_DATE('2009-06-01 00:37:41','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Jun 1, 2009 12:37:45 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57790 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- Jun 1, 2009 12:37:54 AM MYT
-- RMA Feature - ID: 1756793
ALTER TABLE M_RMA ADD Ref_RMA_ID NUMBER(10) DEFAULT NULL
;
-- Jun 1, 2009 12:41:24 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,Description,EntityType,Help,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,53307,TO_DATE('2009-06-01 00:41:21','YYYY-MM-DD HH24:MI:SS'),100,'RMA Line','D',NULL,'Y','N','M_RMALine',TO_DATE('2009-06-01 00:41:21','YYYY-MM-DD HH24:MI:SS'),100,'T')
;
-- Jun 1, 2009 12:41:24 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53307 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID)
;
-- Jun 1, 2009 12:41:52 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy) VALUES (0,52004,10831,0,53307,660,TO_DATE('2009-06-01 00:41:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N',TO_DATE('2009-06-01 00:41:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:43:30 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57791,53867,0,18,53307,660,'Ref_RMALine_ID',TO_DATE('2009-06-01 00:43:28','YYYY-MM-DD HH24:MI:SS'),100,'D',22,'Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Referenced RMA Line',0,TO_DATE('2009-06-01 00:43:28','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Jun 1, 2009 12:43:30 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57791 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- Jun 1, 2009 12:47:11 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57792,529,0,29,660,'QtyInvoiced',TO_DATE('2009-06-01 00:47:09','YYYY-MM-DD HH24:MI:SS'),100,'Invoiced Quantity','D',22,'The Invoiced Quantity indicates the quantity of a product that have been invoiced.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Quantity Invoiced',0,TO_DATE('2009-06-01 00:47:09','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Jun 1, 2009 12:47:11 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57792 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- Jun 1, 2009 12:47:30 AM MYT
-- RMA Feature - ID: 1756793
ALTER TABLE M_RMALine ADD QtyInvoiced NUMBER DEFAULT NULL
;
-- Jun 1, 2009 12:49:19 AM MYT
-- RMA Feature - ID: 1756793
ALTER TABLE M_RMALine ADD Ref_RMALine_ID NUMBER(10) DEFAULT NULL
;

View File

@ -0,0 +1,130 @@
-- May 31, 2009 11:58:22 PM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Tab SET WhereClause='MovementType IN (''C-'', ''V-'')',Updated=TO_TIMESTAMP('2009-05-31 23:58:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=257
;
-- May 31, 2009 11:58:58 PM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Tab SET WhereClause='MovementType IN (''V+'', ''C+'')',Updated=TO_TIMESTAMP('2009-05-31 23:58:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=296
;
-- Jun 1, 2009 12:01:38 AM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'', ''MMS'')',Updated=TO_TIMESTAMP('2009-06-01 00:01:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=125
;
-- Jun 1, 2009 12:07:49 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,Description,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52053,'C_DocType.DocBaseType IN (''MMS'')',TO_TIMESTAMP('2009-06-01 00:07:45','YYYY-MM-DD HH24:MI:SS'),100,'Document Type Material Shipments','D','Y','C_DocType Material Shipments','S',TO_TIMESTAMP('2009-06-01 00:07:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:08:41 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,Description,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52054,'C_DocType.DocBaseType IN (''MMR'')',TO_TIMESTAMP('2009-06-01 00:08:39','YYYY-MM-DD HH24:MI:SS'),100,'Document Type Material Receipts','D','Y','C_DocType Material Receipts','S',TO_TIMESTAMP('2009-06-01 00:08:39','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:10:25 AM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Field SET AD_Reference_ID=19, AD_Val_Rule_ID=52054,Updated=TO_TIMESTAMP('2009-06-01 00:10:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3489
;
-- Jun 1, 2009 12:11:25 AM MYT
-- RMA Feature - ID: 1756793
UPDATE AD_Field SET AD_Reference_ID=19, AD_Val_Rule_ID=52053,Updated=TO_TIMESTAMP('2009-06-01 00:11:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2931
;
-- Jun 1, 2009 12:17:54 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53866,0,'Ref_RMA_ID',TO_TIMESTAMP('2009-06-01 00:17:47','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Referenced RMA','Ref RMA',TO_TIMESTAMP('2009-06-01 00:17:47','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:17:54 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53866 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- Jun 1, 2009 12:18:40 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53867,0,'Ref_RMALine_ID',TO_TIMESTAMP('2009-06-01 00:18:37','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Referenced RMA Line','Ref RMA Line',TO_TIMESTAMP('2009-06-01 00:18:37','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:18:40 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53867 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- Jun 1, 2009 12:33:03 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,Description,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,53306,TO_TIMESTAMP('2009-06-01 00:33:01','YYYY-MM-DD HH24:MI:SS'),100,'RMA','D','Y','N','M_RMA',TO_TIMESTAMP('2009-06-01 00:33:01','YYYY-MM-DD HH24:MI:SS'),100,'T')
;
-- Jun 1, 2009 12:33:03 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53306 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID)
;
-- Jun 1, 2009 12:36:11 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,OrderByClause,Updated,UpdatedBy) VALUES (0,10841,10847,0,53306,661,TO_TIMESTAMP('2009-06-01 00:36:11','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','M_RMA.DocumentNo',TO_TIMESTAMP('2009-06-01 00:36:11','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:37:45 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57790,53866,0,30,53306,661,'Ref_RMA_ID',TO_TIMESTAMP('2009-06-01 00:37:41','YYYY-MM-DD HH24:MI:SS'),100,'D',22,'Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Referenced RMA',0,TO_TIMESTAMP('2009-06-01 00:37:41','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Jun 1, 2009 12:37:45 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57790 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- Jun 1, 2009 12:37:54 AM MYT
-- RMA Feature - ID: 1756793
ALTER TABLE M_RMA ADD COLUMN Ref_RMA_ID NUMERIC(10) DEFAULT NULL
;
-- Jun 1, 2009 12:41:24 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,Description,EntityType,Help,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,53307,TO_TIMESTAMP('2009-06-01 00:41:21','YYYY-MM-DD HH24:MI:SS'),100,'RMA Line','D',NULL,'Y','N','M_RMALine',TO_TIMESTAMP('2009-06-01 00:41:21','YYYY-MM-DD HH24:MI:SS'),100,'T')
;
-- Jun 1, 2009 12:41:24 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53307 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID)
;
-- Jun 1, 2009 12:41:52 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy) VALUES (0,52004,10831,0,53307,660,TO_TIMESTAMP('2009-06-01 00:41:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N',TO_TIMESTAMP('2009-06-01 00:41:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jun 1, 2009 12:43:30 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57791,53867,0,18,53307,660,'Ref_RMALine_ID',TO_TIMESTAMP('2009-06-01 00:43:28','YYYY-MM-DD HH24:MI:SS'),100,'D',22,'Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Referenced RMA Line',0,TO_TIMESTAMP('2009-06-01 00:43:28','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Jun 1, 2009 12:43:30 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57791 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- Jun 1, 2009 12:47:11 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57792,529,0,29,660,'QtyInvoiced',TO_TIMESTAMP('2009-06-01 00:47:09','YYYY-MM-DD HH24:MI:SS'),100,'Invoiced Quantity','D',22,'The Invoiced Quantity indicates the quantity of a product that have been invoiced.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Quantity Invoiced',0,TO_TIMESTAMP('2009-06-01 00:47:09','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Jun 1, 2009 12:47:11 AM MYT
-- RMA Feature - ID: 1756793
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57792 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- Jun 1, 2009 12:47:30 AM MYT
-- RMA Feature - ID: 1756793
ALTER TABLE M_RMALine ADD COLUMN QtyInvoiced NUMERIC DEFAULT NULL
;
-- Jun 1, 2009 12:49:19 AM MYT
-- RMA Feature - ID: 1756793
ALTER TABLE M_RMALine ADD COLUMN Ref_RMALine_ID NUMERIC(10) DEFAULT NULL
;