- 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
* @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
@ -54,7 +54,7 @@ public class CalloutInOut extends CalloutEngine
// No Callout Active to fire dependent values
if (isCalloutActive()) // prevent recursive
return "";
// Get Details
MOrder order = new MOrder (ctx, C_Order_ID.intValue(), null);
if (order.get_ID() != 0)
@ -77,15 +77,15 @@ public class CalloutInOut extends CalloutEngine
mTab.setValue("FreightAmt", order.getFreightAmt());
mTab.setValue("C_BPartner_ID", new Integer(order.getC_BPartner_ID()));
//[ 1867464 ]
mTab.setValue("C_BPartner_Location_ID", new Integer(order.getC_BPartner_Location_ID()));
mTab.setValue("AD_User_ID", new Integer(order.getAD_User_ID()));
}
return "";
} // order
/**
* InOut - DocType.
* - sets MovementType
@ -107,7 +107,7 @@ public class CalloutInOut extends CalloutEngine
+ "s.AD_Sequence_ID, s.StartNewYear, s.DateColumn, d.IsSOTrx " //4..7
+ "FROM C_DocType d "
+ "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;
ResultSet rs = null;
try
@ -123,26 +123,28 @@ public class CalloutInOut extends CalloutEngine
// BF [2708789] Read IsSOTrx from C_DocType
String trxFlag = rs.getString(7);
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);
if (IsSOTrx)
mTab.setValue("MovementType", "C-"); // Customer Shipments
else
else
mTab.setValue("MovementType", "V-"); // Vendor Return
}
/**END vpj-cd e-evolution */
/**END vpj-cd e-evolution */
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);
if (IsSOTrx)
mTab.setValue("MovementType", "C+"); // Customer Return
else
mTab.setValue("MovementType", "C+"); // Customer Return
else
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
if (rs.getString("IsDocNoControlled").equals("Y"))
@ -151,9 +153,9 @@ public class CalloutInOut extends CalloutEngine
{
String dateColumn = rs.getString(6);
int AD_Sequence_ID = rs.getInt(4);
mTab.setValue("DocumentNo",
"<"
+ MSequence.getPreliminaryNoByYear(mTab, AD_Sequence_ID, dateColumn, null)
mTab.setValue("DocumentNo",
"<"
+ MSequence.getPreliminaryNoByYear(mTab, AD_Sequence_ID, dateColumn, null)
+ ">");
}
else
@ -214,7 +216,7 @@ public class CalloutInOut extends CalloutEngine
//[ 1867464 ]
boolean IsSOTrx = "Y".equals(Env.getContext(ctx, WindowNo, "IsSOTrx"));
if (!IsSOTrx)
{
{
// Location
Integer ii = new Integer(rs.getInt("C_BPartner_Location_ID"));
if (rs.wasNull())
@ -250,7 +252,7 @@ public class CalloutInOut extends CalloutEngine
{
DB.close(rs, pstmt);
}
return "";
} // bpartner
@ -315,7 +317,7 @@ public class CalloutInOut extends CalloutEngine
return "";
} // warehouse
/**************************************************************************
* OrderLine Callout
* @param ctx context
@ -330,7 +332,7 @@ public class CalloutInOut extends CalloutEngine
Integer C_OrderLine_ID = (Integer)value;
if (C_OrderLine_ID == null || C_OrderLine_ID.intValue() == 0)
return "";
// Get Details
MOrderLine ol = new MOrderLine (ctx, C_OrderLine_ID.intValue(), null);
if (ol.get_ID() != 0)
@ -375,13 +377,13 @@ public class CalloutInOut extends CalloutEngine
Integer M_Product_ID = (Integer)value;
if (M_Product_ID == null || M_Product_ID.intValue() == 0)
return "";
// Set Attribute & Locator
int M_Locator_ID = 0;
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)
{
mTab.setValue("M_AttributeSetInstance_ID",
mTab.setValue("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");
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");
// log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID);
BigDecimal MovementQty, QtyEntered;
// No Product
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);
if (QtyEntered.compareTo(QtyEntered1) != 0)
{
log.fine("Corrected QtyEntered Scale UOM=" + C_UOM_To_ID
+ "; QtyEntered=" + QtyEntered + "->" + QtyEntered1);
log.fine("Corrected QtyEntered Scale UOM=" + C_UOM_To_ID
+ "; QtyEntered=" + QtyEntered + "->" + QtyEntered1);
QtyEntered = QtyEntered1;
mTab.setValue("QtyEntered", QtyEntered);
}
MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered);
if (MovementQty == null)
MovementQty = QtyEntered;
boolean conversion = QtyEntered.compareTo(MovementQty) != 0;
log.fine("UOM=" + C_UOM_To_ID
log.fine("UOM=" + C_UOM_To_ID
+ ", QtyEntered=" + QtyEntered
+ " -> " + conversion
+ " -> " + conversion
+ " MovementQty=" + MovementQty);
Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
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);
if (QtyEntered.compareTo(QtyEntered1) != 0)
{
log.fine("Corrected QtyEntered Scale UOM=" + C_UOM_To_ID
+ "; QtyEntered=" + QtyEntered + "->" + QtyEntered1);
log.fine("Corrected QtyEntered Scale UOM=" + C_UOM_To_ID
+ "; QtyEntered=" + QtyEntered + "->" + QtyEntered1);
QtyEntered = QtyEntered1;
mTab.setValue("QtyEntered", QtyEntered);
}
MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered);
if (MovementQty == null)
MovementQty = QtyEntered;
boolean conversion = QtyEntered.compareTo(MovementQty) != 0;
log.fine("UOM=" + C_UOM_To_ID
log.fine("UOM=" + C_UOM_To_ID
+ ", QtyEntered=" + QtyEntered
+ " -> " + conversion
+ " -> " + conversion
+ " MovementQty=" + MovementQty);
Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
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");
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);
if (MovementQty.compareTo(MovementQty1) != 0)
{
log.fine("Corrected MovementQty "
+ MovementQty + "->" + MovementQty1);
log.fine("Corrected MovementQty "
+ MovementQty + "->" + MovementQty1);
MovementQty = MovementQty1;
mTab.setValue("MovementQty", MovementQty);
}
QtyEntered = MUOMConversion.convertProductTo (ctx, M_Product_ID,
QtyEntered = MUOMConversion.convertProductTo (ctx, M_Product_ID,
C_UOM_To_ID, MovementQty);
if (QtyEntered == null)
QtyEntered = MovementQty;
boolean conversion = MovementQty.compareTo(QtyEntered) != 0;
log.fine("UOM=" + C_UOM_To_ID
log.fine("UOM=" + C_UOM_To_ID
+ ", MovementQty=" + MovementQty
+ " -> " + conversion
+ " -> " + conversion
+ " QtyEntered=" + QtyEntered);
Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
mTab.setValue("QtyEntered", QtyEntered);
@ -551,7 +553,7 @@ public class CalloutInOut extends CalloutEngine
int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, "M_Locator_ID");
log.fine("M_Product_ID=" + M_Product_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);
// Check Selection
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();
/** 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 */
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;
/** 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 */
public static final String COLUMNNAME_Name = "Name";
@ -342,6 +342,15 @@ public interface I_M_RMA
/** Get Process Now */
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 */
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;
/** 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 */
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;
/** 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 */
public static final String COLUMNNAME_Processed = "Processed";
@ -240,6 +240,28 @@ public interface I_M_RMALine
*/
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 */
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
* @version $Id: MInOutLine.java,v 1.5 2006/07/30 00:51:03 jjanke Exp $
*
*
* @author Teo Sarca, www.arhipac.ro
* <li>BF [ 2784194 ] Check Warehouse-Locator conflict
* 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
{
/**
*
*
*/
private static final long serialVersionUID = -1196352601949381166L;
private static final long serialVersionUID = 8630611882798722864L;
/**
* Get Ship lines Of Order Line
@ -53,7 +53,7 @@ public class MInOutLine extends X_M_InOutLine
* @param trxName transaction
* @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)
{
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()]);
} // 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
* @param ctx context
@ -74,8 +92,8 @@ public class MInOutLine extends X_M_InOutLine
{
return getOfOrderLine(ctx, C_OrderLine_ID, null, trxName);
} // get
/**************************************************************************
* Standard Constructor
* @param ctx context
@ -133,7 +151,7 @@ public class MInOutLine extends X_M_InOutLine
private int m_M_Warehouse_ID = 0;
/** Parent */
private MInOut m_parent = null;
/**
* Get Parent
* @return parent
@ -144,7 +162,7 @@ public class MInOutLine extends X_M_InOutLine
m_parent = new MInOut (getCtx(), getM_InOut_ID(), get_TrxName());
return m_parent;
} // getParent
/**
* Set Order Line.
* Does not set Quantity!
@ -192,7 +210,7 @@ public class MInOutLine extends X_M_InOutLine
setUser1_ID(oLine.getUser1_ID());
setUser2_ID(oLine.getUser2_ID());
} // setOrderLine
/**
* Set Invoice Line.
* Does not set Quantity!
@ -215,7 +233,7 @@ public class MInOutLine extends X_M_InOutLine
else
{
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)
setM_Locator_ID(Qty); // requires warehouse, product, asi
else
@ -234,7 +252,7 @@ public class MInOutLine extends X_M_InOutLine
setUser1_ID(iLine.getUser1_ID());
setUser2_ID(iLine.getUser2_ID());
} // setInvoiceLine
/**
* Get Warehouse
* @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();
return m_M_Warehouse_ID;
} // getM_Warehouse_ID
/**
* Set Warehouse
* @param warehouse_ID The m_Warehouse_ID to set.
@ -262,12 +280,12 @@ public class MInOutLine extends X_M_InOutLine
@Override
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.");
// 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
/**
* Set (default) Locator based on qty.
* @param Qty quantity
@ -284,10 +302,10 @@ public class MInOutLine extends X_M_InOutLine
set_ValueNoCheck(COLUMNNAME_M_Locator_ID, null);
return;
}
// Get existing Location
int M_Locator_ID = MStorage.getM_Locator_ID (getM_Warehouse_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(),
int M_Locator_ID = MStorage.getM_Locator_ID (getM_Warehouse_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(),
Qty, get_TrxName());
// Get default Location
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
/**
* Set Movement/Movement Qty
* @param Qty Entered/Movement Qty
@ -309,7 +327,7 @@ public class MInOutLine extends X_M_InOutLine
} // setQtyInvoiced
/**
* Set Qty Entered - enforce entered UOM
* Set Qty Entered - enforce entered UOM
* @param QtyEntered
*/
public void setQtyEntered (BigDecimal QtyEntered)
@ -323,7 +341,7 @@ public class MInOutLine extends X_M_InOutLine
} // setQtyEntered
/**
* Set Movement Qty - enforce Product UOM
* Set Movement Qty - enforce Product UOM
* @param 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());
return m_product;
} // getProduct
/**
* Set Product
* @param product product
@ -367,7 +385,7 @@ public class MInOutLine extends X_M_InOutLine
}
setM_AttributeSetInstance_ID(0);
} // setProduct
/**
* Set M_Product_ID
* @param M_Product_ID product
@ -381,7 +399,7 @@ public class MInOutLine extends X_M_InOutLine
super.setM_Product_ID (M_Product_ID);
setM_AttributeSetInstance_ID(0);
} // setM_Product_ID
/**
* Set Product and UOM
* @param M_Product_ID product
@ -408,7 +426,7 @@ public class MInOutLine extends X_M_InOutLine
else
setDescription(desc + " | " + description);
} // addDescription
/**
* Get C_Project_ID
* @return project
@ -420,7 +438,7 @@ public class MInOutLine extends X_M_InOutLine
ii = getParent().getC_Project_ID();
return ii;
} // getC_Project_ID
/**
* Get C_Activity_ID
* @return Activity
@ -432,7 +450,7 @@ public class MInOutLine extends X_M_InOutLine
ii = getParent().getC_Activity_ID();
return ii;
} // getC_Activity_ID
/**
* Get C_Campaign_ID
* @return Campaign
@ -444,7 +462,7 @@ public class MInOutLine extends X_M_InOutLine
ii = getParent().getC_Campaign_ID();
return ii;
} // getC_Campaign_ID
/**
* Get User2_ID
* @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 ]
if(getProduct() != null && MProduct.PRODUCTTYPE_Item.equals(getProduct().getProductType()))
{
{
if (getM_Locator_ID() <= 0 && getC_Charge_ID() <= 0)
{
throw new FillMandatoryException(COLUMNNAME_M_Locator_ID);
}
}
// Get Line No
if (getLine() == 0)
{
@ -523,7 +541,7 @@ public class MInOutLine extends X_M_InOutLine
setQtyEntered(getQtyEntered());
if (newRecord || is_ValueChanged("MovementQty"))
setMovementQty(getMovementQty());
// Order/RMA Line
if (getC_OrderLine_ID() == 0 && getM_RMALine_ID() == 0)
{
@ -533,7 +551,7 @@ public class MInOutLine extends X_M_InOutLine
return false;
}
}
// Validate Locator/Warehouse - teo_sarca, BF [ 2784194 ]
if (getM_Locator_ID() > 0)
{
@ -546,10 +564,10 @@ public class MInOutLine extends X_M_InOutLine
getLine());
}
}
// if (getC_Charge_ID() == 0 && getM_Product_ID() == 0)
// ;
/** Qty on instance ASI
if (getM_AttributeSetInstance_ID() != 0)
{
@ -564,7 +582,7 @@ public class MInOutLine extends X_M_InOutLine
// Max
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());
if (storage != null)
{
@ -572,16 +590,16 @@ public class MInOutLine extends X_M_InOutLine
if (getMovementQty().compareTo(qty) > 0)
{
log.warning("Qty - Stock=" + qty + ", Movement=" + getMovementQty());
log.saveError("QtyInsufficient", "=" + qty);
log.saveError("QtyInsufficient", "=" + qty);
return false;
}
}
}
} /**/
return true;
} // beforeSave
/**
* Before Delete
* @return true if drafted
@ -620,7 +638,7 @@ public class MInOutLine extends X_M_InOutLine
{
MInvoiceLine m_il = MInvoiceLine.getOfInOutLine(this);
if (m_il == null)
{
{
log.severe("No Invoice Line for: " + this.toString());
return Env.ZERO;
}
@ -654,19 +672,19 @@ public class MInOutLine extends X_M_InOutLine
log.severe("Invalid Criteria: " + CostDistribution);
return Env.ZERO;
} // getBase
public boolean sameOrderLineUOM()
{
if (getC_OrderLine_ID() <= 0)
return false;
MOrderLine oLine = new MOrderLine(getCtx(), getC_OrderLine_ID(), get_TrxName());
if (oLine.getC_UOM_ID() != getC_UOM_ID())
return false;
// inout has orderline and both has the same UOM
return true;
}
} // 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
{
/**
*
*
*/
private static final long serialVersionUID = 4264055057724565805L;
@ -73,7 +74,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
}
catch (Exception e)
{
s_log.log(Level.SEVERE, sql, e);
s_log.log(Level.SEVERE, sql, e);
}
try
{
@ -87,11 +88,11 @@ public class MInvoiceLine extends X_C_InvoiceLine
}
return retValue;
} // getOfInOutLine
/** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MInvoiceLine.class);
/**************************************************************************
* Invoice Line Constructor
* @param ctx context
@ -117,7 +118,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setQtyInvoiced(Env.ZERO);
}
} // MInvoiceLine
/**
* Parent Constructor
* @param invoice parent
@ -151,7 +152,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
private boolean m_IsSOTrx = true;
private boolean m_priceSet = false;
private MProduct m_product = null;
/** Cached Name of the line */
private String m_name = null;
/** Cached Precision */
@ -188,7 +189,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
m_parent = new MInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
return m_parent;
} // getParent
/**
* Set values from Order Line.
* Does not set quantity!
@ -230,7 +231,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setRRAmt(oLine.getRRAmt());
setRRStartDate(oLine.getRRStartDate());
} // setOrderLine
/**
* Set values from Shipment Line.
* Does not set quantity!
@ -242,7 +243,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setC_OrderLine_ID(sLine.getC_OrderLine_ID());
// Set RMALine ID if shipment/receipt is based on RMA Doc
setM_RMALine_ID(sLine.getM_RMALine_ID());
//
setLine(sLine.getLine());
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
MRMALine rmaLine = new MRMALine(getCtx(), sLine.getM_RMALine_ID(), get_TrxName());
setPrice();
setPrice(rmaLine.getAmt());
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);
} // setM_AttributeSetInstance_ID
/**************************************************************************
* Set Price for Product and PriceList.
* 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!");
setPrice (m_M_PriceList_ID, m_C_BPartner_ID);
} // setPrice
/**
* Set Price for Product and PriceList
* @param M_PriceList_ID price list
@ -356,7 +357,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
return;
//
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);
m_productPricing.setM_PriceList_ID(M_PriceList_ID);
m_productPricing.setPriceDate(m_DateInvoiced);
@ -379,7 +380,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
/**
* 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
*/
public void setPrice (BigDecimal PriceActual)
@ -395,12 +396,12 @@ public class MInvoiceLine extends X_C_InvoiceLine
*/
public void setPriceActual (BigDecimal PriceActual)
{
if (PriceActual == null)
if (PriceActual == null)
throw new IllegalArgumentException ("PriceActual is mandatory");
set_ValueNoCheck("PriceActual", PriceActual);
} // setPriceActual
/**
* Set Tax - requires Warehouse
* @return true if found
@ -425,14 +426,14 @@ public class MInvoiceLine extends X_C_InvoiceLine
return true;
} // setTax
/**
* Calculare Tax Amt.
* Assumes Line Net is calculated
*/
public void setTaxAmt ()
{
BigDecimal TaxAmt = Env.ZERO;
BigDecimal TaxAmt = Env.ZERO;
if (getC_Tax_ID() == 0)
return;
// setLineNetAmt();
@ -447,7 +448,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setLineTotalAmt(getLineNetAmt().add(TaxAmt));
super.setTaxAmt (TaxAmt);
} // setTaxAmt
/**
* Calculate Extended Amt.
* May or may not include tax
@ -455,12 +456,12 @@ public class MInvoiceLine extends X_C_InvoiceLine
public void setLineNetAmt ()
{
// Calculations & Rounding
BigDecimal net = getPriceActual().multiply(getQtyInvoiced());
BigDecimal net = getPriceActual().multiply(getQtyInvoiced());
if (net.scale() > getPrecision())
net = net.setScale(getPrecision(), BigDecimal.ROUND_HALF_UP);
super.setLineNetAmt (net);
} // setLineNetAmt
/**
* Set Qty Invoiced/Entered.
* @param Qty Invoiced/Ordered
@ -481,7 +482,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
} // setQtyInvoiced
/**
* Set Qty Entered - enforce entered UOM
* Set Qty Entered - enforce entered UOM
* @param QtyEntered
*/
public void setQtyEntered (BigDecimal QtyEntered)
@ -495,7 +496,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
} // setQtyEntered
/**
* Set Qty Invoiced - enforce Product UOM
* Set Qty Invoiced - enforce Product UOM
* @param QtyInvoiced
*/
public void setQtyInvoiced (BigDecimal QtyInvoiced)
@ -529,7 +530,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setM_AttributeSetInstance_ID(0);
} // setProduct
/**
* Set M_Product_ID
* @param M_Product_ID product
@ -543,7 +544,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
super.setM_Product_ID (M_Product_ID);
setM_AttributeSetInstance_ID(0);
} // setM_Product_ID
/**
* Set Product and UOM
* @param M_Product_ID product
@ -555,7 +556,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
super.setC_UOM_ID(C_UOM_ID);
setM_AttributeSetInstance_ID(0);
} // setM_Product_ID
/**
* Get Product
* @return product or null
@ -578,7 +579,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
ii = getParent().getC_Project_ID();
return ii;
} // getC_Project_ID
/**
* Get C_Activity_ID
* @return Activity
@ -590,7 +591,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
ii = getParent().getC_Activity_ID();
return ii;
} // getC_Activity_ID
/**
* Get C_Campaign_ID
* @return Campaign
@ -602,7 +603,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
ii = getParent().getC_Campaign_ID();
return ii;
} // getC_Campaign_ID
/**
* Get User2_ID
* @return User2
@ -726,7 +727,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
{
if (m_precision != null)
return m_precision.intValue();
String sql = "SELECT c.StdPrecision "
+ "FROM C_Currency c INNER JOIN C_Invoice x ON (x.C_Currency_ID=c.C_Currency_ID) "
+ "WHERE x.C_Invoice_ID=?";
@ -739,7 +740,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
m_precision = new Integer(i);
return m_precision.intValue();
} // getPrecision
/**
* Is Tax Included in Amount
* @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());
return pl.isTaxIncluded();
} // isTaxIncluded
/**************************************************************************
* Before Save
* @param newRecord
@ -779,12 +780,12 @@ public class MInvoiceLine extends X_C_InvoiceLine
}
else // Set Product Price
{
if (!m_priceSet
if (!m_priceSet
&& Env.ZERO.compareTo(getPriceActual()) == 0
&& Env.ZERO.compareTo(getPriceList()) == 0)
setPrice();
}
// Set Tax
if (getC_Tax_ID() == 0)
setTax();
@ -818,12 +819,12 @@ public class MInvoiceLine extends X_C_InvoiceLine
//
return true;
} // beforeSave
/**
* Recalculate invoice tax
* @param oldTax true if the old C_Tax_ID should be used
* @return true if success, false otherwise
*
*
* @author teo_sarca [ 1583825 ]
*/
private boolean updateInvoiceTax(boolean oldTax) {
@ -837,7 +838,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
}
return true;
}
/**
* After Save
* @param newRecord new
@ -868,21 +869,21 @@ public class MInvoiceLine extends X_C_InvoiceLine
return success;
return updateHeaderTax();
} // afterDelete
/**
* Update Tax & Header
* @return true if header updated with tax
*/
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))
return true;
// Recalculate Tax for this Tax
if (!updateInvoiceTax(false))
return false;
// Update Invoice Header
String sql = "UPDATE C_Invoice i"
+ " SET TotalLines="
@ -905,11 +906,11 @@ public class MInvoiceLine extends X_C_InvoiceLine
if (no != 1)
log.warning("(2) #" + no);
m_parent = null;
return no == 1;
} // updateHeaderTax
/**************************************************************************
* Allocate Landed Costs
* @return error message or ""
@ -925,7 +926,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
int no = DB.executeUpdate(sql, get_TrxName());
if (no != 0)
log.info("Deleted #" + no);
int inserted = 0;
// *** Single Criteria ***
if (lcs.length == 1)
@ -963,7 +964,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
MLandedCostAllocation lca = new MLandedCostAllocation (this, lc.getM_CostElement_ID());
lca.setM_Product_ID(iol.getM_Product_ID());
lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID());
BigDecimal base = iol.getBase(lc.getLandedCostDistribution());
BigDecimal base = iol.getBase(lc.getLandedCostDistribution());
lca.setBase(base);
// MZ Goodwill
// add set Qty from InOutLine
@ -999,22 +1000,22 @@ public class MInvoiceLine extends X_C_InvoiceLine
// end MZ
if (lca.save())
return "";
return "Cannot save single line Allocation = " + lc;
return "Cannot save single line Allocation = " + lc;
}
// Single Product
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.setAmt(getLineNetAmt());
if (lca.save())
return "";
return "Cannot save Product Allocation = " + lc;
return "Cannot save Product Allocation = " + lc;
}
else
return "No Reference for " + lc;
}
// *** Multiple Criteria ***
String LandedCostDistribution = lcs[0].getLandedCostDistribution();
int M_CostElement_ID = lcs[0].getM_CostElement_ID();
@ -1039,7 +1040,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
MInOutLine[] lines = ship.getLines();
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)
continue;
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());
lca.setM_Product_ID(iol.getM_Product_ID());
lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID());
BigDecimal base = iol.getBase(LandedCostDistribution);
BigDecimal base = iol.getBase(LandedCostDistribution);
lca.setBase(base);
// MZ Goodwill
// add set Qty from InOutLine
@ -1088,7 +1089,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
return "Cannot save line Allocation = " + lca;
inserted++;
}
log.info("Inserted " + inserted);
allocateLandedCostRounding();
return "";
@ -1106,7 +1107,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
for (int i = 0; i < allocations.length; i++)
{
MLandedCostAllocation allocation = allocations[i];
if (largestAmtAllocation == null
if (largestAmtAllocation == null
|| allocation.getAmt().compareTo(largestAmtAllocation.getAmt()) > 0)
largestAmtAllocation = allocation;
allocationAmt = allocationAmt.add(allocation.getAmt());
@ -1116,7 +1117,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
{
largestAmtAllocation.setAmt(largestAmtAllocation.getAmt().add(difference));
largestAmtAllocation.save();
log.config("Difference=" + difference
log.config("Difference=" + difference
+ ", C_LandedCostAllocation_ID=" + largestAmtAllocation.getC_LandedCostAllocation_ID()
+ ", Amt" + largestAmtAllocation.getAmt());
}
@ -1170,7 +1171,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
list.toArray(landedCost);
return landedCost;
} // getLandedCost
/**
* Copy LandedCost From other InvoiceLine.
* @param otherInvoiceLine invoiceline
@ -1197,7 +1198,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
return count;
} // copyLinesFrom
// end MZ
/**
* @param rmaline
*/
@ -1212,7 +1213,6 @@ public class MInvoiceLine extends X_C_InvoiceLine
setC_UOM_ID(rmaLine.getC_UOM_ID());
setC_Tax_ID(rmaLine.getC_Tax_ID());
setPrice(rmaLine.getAmt());
setQty(rmaLine.getQty());
setLineNetAmt();
setTaxAmt();
setLineTotalAmt(rmaLine.getLineNetAmt());
@ -1220,7 +1220,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
setC_Activity_ID(rmaLine.getC_Activity_ID());
setC_Campaign_ID(rmaLine.getC_Campaign_ID());
}
/**
* @return matched qty
*/

View File

@ -32,7 +32,7 @@ import org.compiere.util.Msg;
/**
* RMA Model
*
*
* @author Jorg Janke
* @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
{
/**
*
*
*/
private static final long serialVersionUID = -2967208431264929454L;
private static final long serialVersionUID = -3310525910645254261L;
/**
* Standard Constructor
@ -77,12 +77,12 @@ public class MRMA extends X_M_RMA implements DocAction
{
super(ctx, rs, trxName);
} // MRMA
/** Lines */
private MRMALine[] m_lines = null;
/** The Shipment */
private MInOut m_inout = null;
/**
* Get Lines
* @param requery requery
@ -123,12 +123,12 @@ public class MRMA extends X_M_RMA implements DocAction
{
pstmt = null;
}
m_lines = new MRMALine[list.size ()];
list.toArray (m_lines);
return m_lines;
} // getLines
/**
* Get 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());
return m_inout;
} // getShipment
/**
* Get the original order on which the shipment/receipt defined is based upon.
* @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());
}
/**
* Get the original invoice on which the shipment/receipt defined is based upon.
* @return invoice
@ -165,9 +165,9 @@ public class MRMA extends X_M_RMA implements DocAction
{
return null;
}
int invId = 0;
if (shipment.getC_Invoice_ID() != 0)
{
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=?";
invId = DB.getSQLValue(null, sqlStmt, shipment.getC_Order_ID());
}
if (invId <= 0)
{
return null;
}
return new MInvoice(getCtx(), invId, get_TrxName());
}
/**
* Set M_InOut_ID
* @param M_InOut_ID id
@ -198,8 +198,8 @@ public class MRMA extends X_M_RMA implements DocAction
setC_BPartner_ID(0);
m_inout = null;
} // setM_InOut_ID
/**
* Get Document Info
* @return document info (untranslated)
@ -241,7 +241,7 @@ public class MRMA extends X_M_RMA implements DocAction
// return re.getPDF(file);
} // createPDF
/**
* Before Save
* 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());
setC_Currency_ID(order.getC_Currency_ID());
}
}
else if (m_inout.getC_Invoice_ID() != 0)
{
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
if (m_inout != null && m_inout.isSOTrx() != isSOTrx())
{
log.saveError("RMA.IsSOTrx <> InOut.IsSOTrx", "");
return false;
}
return true;
} // beforeSave
/**************************************************************************
* Process document
* @param processAction document action
@ -297,7 +297,7 @@ public class MRMA extends X_M_RMA implements DocAction
DocumentEngine engine = new DocumentEngine (this, getDocStatus());
return engine.processIt (processAction, getDocAction());
} // process
/** Process Message */
private String m_processMsg = null;
/** Just Prepared Flag */
@ -305,7 +305,7 @@ public class MRMA extends X_M_RMA implements DocAction
/**
* Unlock Document.
* @return true if success
* @return true if success
*/
public boolean unlockIt()
{
@ -313,20 +313,20 @@ public class MRMA extends X_M_RMA implements DocAction
setProcessing(false);
return true;
} // unlockIt
/**
* Invalidate Document
* @return true if success
* @return true if success
*/
public boolean invalidateIt()
{
log.info("invalidateIt - " + toString());
return true;
} // invalidateIt
/**
* Prepare Document
* @return new status (In Progress or Invalid)
* @return new status (In Progress or Invalid)
*/
public String prepareIt()
{
@ -335,17 +335,16 @@ public class MRMA extends X_M_RMA implements DocAction
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
MRMALine[] lines = getLines(false);
if (lines.length == 0)
{
m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid;
}
// Updates Amount
setAmt(getTotalAmount());
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -353,10 +352,10 @@ public class MRMA extends X_M_RMA implements DocAction
m_justPrepared = true;
return DocAction.STATUS_InProgress;
} // prepareIt
/**
* Approve Document
* @return true if success
* @return true if success
*/
public boolean approveIt()
{
@ -364,10 +363,10 @@ public class MRMA extends X_M_RMA implements DocAction
setIsApproved(true);
return true;
} // approveIt
/**
* Reject Approval
* @return true if success
* @return true if success
*/
public boolean rejectIt()
{
@ -375,7 +374,7 @@ public class MRMA extends X_M_RMA implements DocAction
setIsApproved(false);
return true;
} // rejectIt
/**
* Complete Document
* @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))
return status;
}
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null)
return DocAction.STATUS_Invalid;
@ -407,6 +406,12 @@ public class MRMA extends X_M_RMA implements DocAction
return DocAction.STATUS_InProgress;
}
*/
// Counter Documents
MRMA counter = createCounterDoc();
if (counter != null)
m_processMsg = "@CounterDoc@: RMA=" + counter.getDocumentNo();
// User Validation
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null)
@ -423,7 +428,7 @@ public class MRMA extends X_M_RMA implements DocAction
setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed;
} // completeIt
/**
* 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.
* @return true if success
* @return true if success
*/
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);
if (m_processMsg != null)
return false;
MRMALine lines[] = getLines(true);
// Set Qty and Amt on all lines to be Zero
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.setQty(Env.ZERO);
rmaLine.setAmt(Env.ZERO);
if (!rmaLine.save())
{
m_processMsg = "Could not update line";
}
}
addDescription(Msg.getMsg(getCtx(), "Voided"));
setAmt(Env.ZERO);
// After Void
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null)
return false;
setProcessed(true);
setDocAction(DOCACTION_None);
return true;
} // voidIt
/**
* Close Document.
* Cancel not delivered Qunatities
* @return true if success
* @return true if success
*/
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);
if (m_processMsg != null)
return false;
return true;
} // closeIt
/**
* Reverse Correction
* @return true if success
* @return true if success
*/
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);
if (m_processMsg != null)
return false;
// After reverseCorrect
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null)
return false;
return false;
} // reverseCorrectionIt
/**
* Reverse Accrual - none
* @return true if success
* @return true if success
*/
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);
if (m_processMsg != null)
return false;
// After reverseAccrual
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null)
return false;
return false;
} // reverseAccrualIt
/**
/**
* Re-activate
* @return true if success
* @return true if success
*/
public boolean reActivateIt()
{
@ -550,16 +735,16 @@ public class MRMA extends X_M_RMA implements DocAction
// Before reActivate
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null)
return false;
return false;
// After reActivate
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null)
return false;
return false;
} // reActivateIt
/**
* Set Processed.
* Propagate to Lines
@ -577,7 +762,7 @@ public class MRMA extends X_M_RMA implements DocAction
m_lines = null;
log.fine("setProcessed - " + processed + " - Lines=" + noLine);
} // setProcessed
/**
* Add to Description
* @param description text
@ -590,7 +775,7 @@ public class MRMA extends X_M_RMA implements DocAction
else
setDescription(desc + " | " + description);
} // addDescription
/**
* Get the total amount based on the lines
* @return Total Amount
@ -598,17 +783,17 @@ public class MRMA extends X_M_RMA implements DocAction
public BigDecimal getTotalAmount()
{
MRMALine lines[] = this.getLines(true);
BigDecimal amt = Env.ZERO;
for (MRMALine line : lines)
{
amt = amt.add(line.getLineNetAmt());
}
return amt;
}
/**
* Updates the amount on the document
*/
@ -616,7 +801,7 @@ public class MRMA extends X_M_RMA implements DocAction
{
setAmt(getTotalAmount());
}
/*************************************************************************
* Get Summary
* @return Summary of Document
@ -634,7 +819,7 @@ public class MRMA extends X_M_RMA implements DocAction
sb.append(" - ").append(getDescription());
return sb.toString();
} // getSummary
/**
* Retrieves all the charge lines that is present on the document
* @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(get_ID());
whereClause.append(" AND C_Charge_ID IS NOT null");
int rmaLineIds[] = MRMALine.getAllIDs(MRMALine.Table_Name, whereClause.toString(), get_TrxName());
ArrayList<MRMALine> chargeLineList = new ArrayList<MRMALine>();
for (int i = 0; i < rmaLineIds.length; i++)
{
MRMALine rmaLine = new MRMALine(getCtx(), rmaLineIds[i], get_TrxName());
chargeLineList.add(rmaLine);
}
MRMALine lines[] = new MRMALine[chargeLineList.size()];
chargeLineList.toArray(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
*/
public boolean isTaxIncluded()
{
MOrder order = getOriginalOrder();
if (order != null && order.get_ID() != 0)
{
return order.isTaxIncluded();
}
return true;
}
/**
* Get Process Message
* @return clear text error message
@ -686,7 +871,7 @@ public class MRMA extends X_M_RMA implements DocAction
{
return m_processMsg;
} // getProcessMsg
/**
* Get Document Owner (Responsible)
* @return AD_User_ID
@ -712,9 +897,9 @@ public class MRMA extends X_M_RMA implements DocAction
public boolean isComplete()
{
String ds = getDocStatus();
return DOCSTATUS_Completed.equals(ds)
return DOCSTATUS_Completed.equals(ds)
|| DOCSTATUS_Closed.equals(ds)
|| DOCSTATUS_Reversed.equals(ds);
} // isComplete
} // MRMA

View File

@ -26,15 +26,15 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
/** Generated Model for M_RMA
* @author Adempiere (generated)
* @author Adempiere (generated)
* @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 */
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);
setIsSOTrx (false);
// @IsSOTrx@
setM_RMA_ID (0);
setM_RMAType_ID (0);
setM_RMA_ID (0);
setName (null);
setProcessed (false);
setSalesRep_ID (0);
@ -67,7 +67,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
}
/** AccessLevel
* @return 1 - Org
* @return 1 - Org
*/
protected int get_AccessLevel()
{
@ -89,7 +89,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
}
/** Set Amount.
@param Amt
@param Amt
Amount
*/
public void setAmt (BigDecimal Amt)
@ -100,7 +100,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Amount.
@return Amount
*/
public BigDecimal getAmt ()
public BigDecimal getAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Amt);
if (bd == null)
@ -108,7 +108,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
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);
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 .
@param C_BPartner_ID
@param C_BPartner_ID
Identifies a Business Partner
*/
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);
else
else
set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID));
}
/** Get 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);
if (ii == null)
@ -147,7 +147,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
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);
I_C_Currency result = null;
@ -164,21 +164,21 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
}
/** Set Currency.
@param C_Currency_ID
@param C_Currency_ID
The Currency for this record
*/
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);
else
else
set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID));
}
/** Get Currency.
@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);
if (ii == null)
@ -187,20 +187,21 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
}
/** Set Document Type.
@param C_DocType_ID
@param C_DocType_ID
Document type or rules
*/
public void setC_DocType_ID (int C_DocType_ID)
{
if (C_DocType_ID < 0)
throw new IllegalArgumentException ("C_DocType_ID is mandatory.");
set_Value (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID));
set_Value (COLUMNNAME_C_DocType_ID, null);
else
set_Value (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID));
}
/** Get Document Type.
@return Document type or rules
*/
public int getC_DocType_ID ()
public int getC_DocType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID);
if (ii == null)
@ -208,7 +209,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
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);
I_C_Order result = null;
@ -225,21 +226,21 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
}
/** Set Order.
@param C_Order_ID
@param C_Order_ID
Order
*/
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);
else
else
set_ValueNoCheck (COLUMNNAME_C_Order_ID, Integer.valueOf(C_Order_ID));
}
/** Get Order.
@return Order
*/
public int getC_Order_ID ()
public int getC_Order_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Order_ID);
if (ii == null)
@ -248,7 +249,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
}
/** Set Description.
@param Description
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
@ -259,7 +260,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
public String getDescription ()
{
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 */
public static final String DOCACTION_WaitComplete = "WC";
/** Set Document Action.
@param DocAction
@param DocAction
The targeted status of the document
*/
public void setDocAction (String DocAction)
{
if (DocAction == null) throw new IllegalArgumentException ("DocAction is mandatory");
set_Value (COLUMNNAME_DocAction, DocAction);
}
/** Get Document Action.
@return The targeted status of the document
*/
public String getDocAction ()
public String getDocAction ()
{
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 */
public static final String DOCSTATUS_WaitingConfirmation = "WC";
/** Set Document Status.
@param DocStatus
@param DocStatus
The current status of the document
*/
public void setDocStatus (String DocStatus)
{
if (DocStatus == null) throw new IllegalArgumentException ("DocStatus is mandatory");
set_Value (COLUMNNAME_DocStatus, DocStatus);
}
/** Get Document Status.
@return The current status of the document
*/
public String getDocStatus ()
public String getDocStatus ()
{
return (String)get_Value(COLUMNNAME_DocStatus);
}
/** Set Document No.
@param DocumentNo
@param DocumentNo
Document sequence number of the document
*/
public void setDocumentNo (String DocumentNo)
{
if (DocumentNo == null)
throw new IllegalArgumentException ("DocumentNo is mandatory.");
set_Value (COLUMNNAME_DocumentNo, DocumentNo);
}
/** Get Document No.
@return Document sequence number of the document
*/
public String getDocumentNo ()
public String getDocumentNo ()
{
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
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getDocumentNo());
}
/** Set Generate To.
@param GenerateTo
@param GenerateTo
Generate To
*/
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.
@return Generate To
*/
public String getGenerateTo ()
public String getGenerateTo ()
{
return (String)get_Value(COLUMNNAME_GenerateTo);
}
/** Set Comment/Help.
@param Help
@param Help
Comment or Hint
*/
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.
@return Comment or Hint
*/
public String getHelp ()
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Shipment/Receipt.
@param InOut_ID
@param InOut_ID
MaterialShipment Document
*/
public void setInOut_ID (int InOut_ID)
{
if (InOut_ID < 1)
throw new IllegalArgumentException ("InOut_ID is mandatory.");
set_ValueNoCheck (COLUMNNAME_InOut_ID, Integer.valueOf(InOut_ID));
set_ValueNoCheck (COLUMNNAME_InOut_ID, null);
else
set_ValueNoCheck (COLUMNNAME_InOut_ID, Integer.valueOf(InOut_ID));
}
/** Get Shipment/Receipt.
@return MaterialShipment Document
*/
public int getInOut_ID ()
public int getInOut_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_InOut_ID);
if (ii == null)
@ -440,7 +440,7 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
}
/** Set Approved.
@param IsApproved
@param IsApproved
Indicates if this document requires approval
*/
public void setIsApproved (boolean IsApproved)
@ -451,20 +451,20 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Approved.
@return Indicates if this document requires approval
*/
public boolean isApproved ()
public boolean isApproved ()
{
Object oo = get_Value(COLUMNNAME_IsApproved);
if (oo != null)
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Sales Transaction.
@param IsSOTrx
@param IsSOTrx
This is a Sales Transaction
*/
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.
@return This is a Sales Transaction
*/
public boolean isSOTrx ()
public boolean isSOTrx ()
{
Object oo = get_Value(COLUMNNAME_IsSOTrx);
if (oo != null)
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set RMA.
@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
public I_M_RMAType getM_RMAType() throws RuntimeException
{
Class<?> clazz = MTable.getClass(I_M_RMAType.Table_Name);
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.
@param M_RMAType_ID
@param M_RMAType_ID
Return Material Authorization Type
*/
public void setM_RMAType_ID (int M_RMAType_ID)
{
if (M_RMAType_ID < 1)
throw new IllegalArgumentException ("M_RMAType_ID is mandatory.");
set_Value (COLUMNNAME_M_RMAType_ID, Integer.valueOf(M_RMAType_ID));
set_Value (COLUMNNAME_M_RMAType_ID, null);
else
set_Value (COLUMNNAME_M_RMAType_ID, Integer.valueOf(M_RMAType_ID));
}
/** Get RMA 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);
if (ii == null)
@ -547,27 +526,48 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
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.
@param Name
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
if (Name == null)
throw new IllegalArgumentException ("Name is mandatory.");
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Processed.
@param Processed
@param Processed
The document has been 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.
@return The document has been processed
*/
public boolean isProcessed ()
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
@ -599,33 +599,54 @@ public class X_M_RMA extends PO implements I_M_RMA, I_Persistent
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
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.
@param SalesRep_ID
@param SalesRep_ID
Sales Representative or Company Agent
*/
public void setSalesRep_ID (int SalesRep_ID)
{
if (SalesRep_ID < 1)
throw new IllegalArgumentException ("SalesRep_ID is mandatory.");
set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID));
set_Value (COLUMNNAME_SalesRep_ID, null);
else
set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID));
}
/** Get Sales Representative.
@return Sales Representative or Company Agent
*/
public int getSalesRep_ID ()
public int getSalesRep_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID);
if (ii == null)

View File

@ -26,15 +26,15 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
/** Generated Model for M_RMALine
* @author Adempiere (generated)
* @author Adempiere (generated)
* @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 */
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);
/** if (M_RMALine_ID == 0)
{
setM_RMA_ID (0);
setM_RMALine_ID (0);
setM_RMA_ID (0);
setProcessed (false);
setQty (Env.ZERO);
} */
@ -56,7 +56,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
}
/** AccessLevel
* @return 1 - Org
* @return 1 - Org
*/
protected int get_AccessLevel()
{
@ -78,7 +78,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
}
/** Set Amount.
@param Amt
@param Amt
Amount
*/
public void setAmt (BigDecimal Amt)
@ -89,7 +89,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Amount.
@return Amount
*/
public BigDecimal getAmt ()
public BigDecimal getAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Amt);
if (bd == null)
@ -97,7 +97,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
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);
I_C_Charge result = null;
@ -114,21 +114,21 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
}
/** Set Charge.
@param C_Charge_ID
@param C_Charge_ID
Additional document charges
*/
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);
else
else
set_Value (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID));
}
/** Get Charge.
@return Additional document charges
*/
public int getC_Charge_ID ()
public int getC_Charge_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID);
if (ii == null)
@ -137,7 +137,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
}
/** Set Description.
@param Description
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
@ -148,13 +148,13 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Line No.
@param Line
@param Line
Unique line for this document
*/
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.
@return Unique line for this document
*/
public int getLine ()
public int getLine ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Line);
if (ii == null)
@ -174,7 +174,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
}
/** Set Line Amount.
@param LineNetAmt
@param LineNetAmt
Line Extended Amount (Quantity * Actual Price) without Freight and Charges
*/
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.
@return Line Extended Amount (Quantity * Actual Price) without Freight and Charges
*/
public BigDecimal getLineNetAmt ()
public BigDecimal getLineNetAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_LineNetAmt);
if (bd == null)
@ -193,7 +193,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
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);
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.
@param M_InOutLine_ID
@param M_InOutLine_ID
Line on Shipment or Receipt document
*/
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);
else
else
set_Value (COLUMNNAME_M_InOutLine_ID, Integer.valueOf(M_InOutLine_ID));
}
/** Get Shipment/Receipt Line.
@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);
if (ii == null)
@ -232,7 +232,30 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
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);
I_M_RMA result = null;
@ -249,20 +272,21 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
}
/** Set RMA.
@param M_RMA_ID
@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));
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 ()
public int getM_RMA_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_RMA_ID);
if (ii == null)
@ -273,35 +297,13 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
public KeyNamePair getKeyNamePair()
{
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.
@param Processed
@param Processed
The document has been 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.
@return The document has been processed
*/
public boolean isProcessed ()
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Quantity.
@param Qty
@param Qty
Quantity
*/
public void setQty (BigDecimal Qty)
{
if (Qty == null)
throw new IllegalArgumentException ("Qty is mandatory.");
set_Value (COLUMNNAME_Qty, Qty);
}
/** Get Quantity.
@return Quantity
*/
public BigDecimal getQty ()
public BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
@ -347,7 +347,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
}
/** Set Delivered Quantity.
@param QtyDelivered
@param QtyDelivered
Delivered Quantity
*/
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.
@return Delivered Quantity
*/
public BigDecimal getQtyDelivered ()
public BigDecimal getQtyDelivered ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyDelivered);
if (bd == null)
return Env.ZERO;
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.model.GridTab;
import org.compiere.model.MOrder;
import org.compiere.model.MRMA;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
public abstract class CreateFrom implements ICreateFrom
{
/** Logger */
protected CLogger log = CLogger.getCLogger(getClass());
/** Loaded Order */
protected MOrder p_order = null;
/** Loaded RMA */
protected MRMA m_rma = null;
private GridTab gridTab;
private String title;
private boolean initOK = false;
public CreateFrom(GridTab gridTab) {
this.gridTab = gridTab;
}
public abstract boolean dynInit() throws Exception;
public abstract void info();
public abstract boolean save(IMiniTable miniTable, String trxName);
/**
* Init OK to be able to make changes?
* @return on if initialized
@ -63,12 +66,12 @@ public abstract class CreateFrom implements ICreateFrom
{
return initOK;
}
public void setInitOK(boolean initOK)
{
this.initOK = initOK;
}
/**
* Load PBartner dependent Order/Invoice/Shipment Field.
* @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)
{
ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();
// Display
StringBuffer display = new StringBuffer("o.DocumentNo||' - ' ||")
.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);
rs = null; pstmt = null;
}
return list;
} // initBPartnerOIS
/**
* Load Data - Order
* @param C_Order_ID Order
@ -212,21 +215,21 @@ public abstract class CreateFrom implements ICreateFrom
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
return data;
} // LoadOrder
public void showWindow()
{
}
public void closeWindow()
{
}
public GridTab getGridTab()
public GridTab getGridTab()
{
return gridTab;
}
@ -239,7 +242,7 @@ public abstract class CreateFrom implements ICreateFrom
{
return Env.getContextAsInt(Env.getCtx(), gridTab.getWindowNo(), "M_Warehouse_ID");
}
public String getTitle() {
return title;
}

View File

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