Show Cost Collection in Product
http://mail.google.com/a/e-evolution.com/#inbox/11ecbbbdbf724125 Fix also the error in Sub contract introduced in Revision: 8037 Remove the the PP_Order_BOMLine and PP_Order_ID in M_Transaction this was replace for PP_Cost_Collector_ID that is the document that generate the transaction
This commit is contained in:
parent
98d7251a77
commit
9e72e117e6
|
@ -143,45 +143,6 @@ public interface I_M_Transaction
|
|||
|
||||
public I_M_MovementLine getM_MovementLine() throws RuntimeException;
|
||||
|
||||
/** Column name MovementDate */
|
||||
public static final String COLUMNNAME_MovementDate = "MovementDate";
|
||||
|
||||
/** Set Movement Date.
|
||||
* Date a product was moved in or out of inventory
|
||||
*/
|
||||
public void setMovementDate (Timestamp MovementDate);
|
||||
|
||||
/** Get Movement Date.
|
||||
* Date a product was moved in or out of inventory
|
||||
*/
|
||||
public Timestamp getMovementDate();
|
||||
|
||||
/** Column name MovementQty */
|
||||
public static final String COLUMNNAME_MovementQty = "MovementQty";
|
||||
|
||||
/** Set Movement Quantity.
|
||||
* Quantity of a product moved.
|
||||
*/
|
||||
public void setMovementQty (BigDecimal MovementQty);
|
||||
|
||||
/** Get Movement Quantity.
|
||||
* Quantity of a product moved.
|
||||
*/
|
||||
public BigDecimal getMovementQty();
|
||||
|
||||
/** Column name MovementType */
|
||||
public static final String COLUMNNAME_MovementType = "MovementType";
|
||||
|
||||
/** Set Movement Type.
|
||||
* Method of moving the inventory
|
||||
*/
|
||||
public void setMovementType (String MovementType);
|
||||
|
||||
/** Get Movement Type.
|
||||
* Method of moving the inventory
|
||||
*/
|
||||
public String getMovementType();
|
||||
|
||||
/** Column name M_Product_ID */
|
||||
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
|
||||
|
||||
|
@ -221,25 +182,53 @@ public interface I_M_Transaction
|
|||
/** Get Inventory Transaction */
|
||||
public int getM_Transaction_ID();
|
||||
|
||||
/** Column name PP_Order_BOMLine_ID */
|
||||
public static final String COLUMNNAME_PP_Order_BOMLine_ID = "PP_Order_BOMLine_ID";
|
||||
/** Column name MovementDate */
|
||||
public static final String COLUMNNAME_MovementDate = "MovementDate";
|
||||
|
||||
/** Set Manufacturing Order BOM Line */
|
||||
public void setPP_Order_BOMLine_ID (int PP_Order_BOMLine_ID);
|
||||
/** Set Movement Date.
|
||||
* Date a product was moved in or out of inventory
|
||||
*/
|
||||
public void setMovementDate (Timestamp MovementDate);
|
||||
|
||||
/** Get Manufacturing Order BOM Line */
|
||||
public int getPP_Order_BOMLine_ID();
|
||||
/** Get Movement Date.
|
||||
* Date a product was moved in or out of inventory
|
||||
*/
|
||||
public Timestamp getMovementDate();
|
||||
|
||||
public org.eevolution.model.I_PP_Order_BOMLine getPP_Order_BOMLine() throws RuntimeException;
|
||||
/** Column name MovementQty */
|
||||
public static final String COLUMNNAME_MovementQty = "MovementQty";
|
||||
|
||||
/** Column name PP_Order_ID */
|
||||
public static final String COLUMNNAME_PP_Order_ID = "PP_Order_ID";
|
||||
/** Set Movement Quantity.
|
||||
* Quantity of a product moved.
|
||||
*/
|
||||
public void setMovementQty (BigDecimal MovementQty);
|
||||
|
||||
/** Set Manufacturing Order */
|
||||
public void setPP_Order_ID (int PP_Order_ID);
|
||||
/** Get Movement Quantity.
|
||||
* Quantity of a product moved.
|
||||
*/
|
||||
public BigDecimal getMovementQty();
|
||||
|
||||
/** Get Manufacturing Order */
|
||||
public int getPP_Order_ID();
|
||||
/** Column name MovementType */
|
||||
public static final String COLUMNNAME_MovementType = "MovementType";
|
||||
|
||||
public org.eevolution.model.I_PP_Order getPP_Order() throws RuntimeException;
|
||||
/** Set Movement Type.
|
||||
* Method of moving the inventory
|
||||
*/
|
||||
public void setMovementType (String MovementType);
|
||||
|
||||
/** Get Movement Type.
|
||||
* Method of moving the inventory
|
||||
*/
|
||||
public String getMovementType();
|
||||
|
||||
/** Column name PP_Cost_Collector_ID */
|
||||
public static final String COLUMNNAME_PP_Cost_Collector_ID = "PP_Cost_Collector_ID";
|
||||
|
||||
/** Set Manufacturing Cost Collector */
|
||||
public void setPP_Cost_Collector_ID (int PP_Cost_Collector_ID);
|
||||
|
||||
/** Get Manufacturing Cost Collector */
|
||||
public int getPP_Cost_Collector_ID();
|
||||
|
||||
public org.eevolution.model.I_PP_Cost_Collector getPP_Cost_Collector() throws RuntimeException;
|
||||
}
|
||||
|
|
|
@ -45,11 +45,11 @@ public class X_M_Transaction extends PO implements I_M_Transaction, I_Persistent
|
|||
{
|
||||
setM_AttributeSetInstance_ID (0);
|
||||
setM_Locator_ID (0);
|
||||
setM_Product_ID (0);
|
||||
setM_Transaction_ID (0);
|
||||
setMovementDate (new Timestamp( System.currentTimeMillis() ));
|
||||
setMovementQty (Env.ZERO);
|
||||
setMovementType (null);
|
||||
setM_Product_ID (0);
|
||||
setM_Transaction_ID (0);
|
||||
} */
|
||||
}
|
||||
|
||||
|
@ -281,99 +281,6 @@ public class X_M_Transaction extends PO implements I_M_Transaction, I_Persistent
|
|||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Movement Date.
|
||||
@param MovementDate
|
||||
Date a product was moved in or out of inventory
|
||||
*/
|
||||
public void setMovementDate (Timestamp MovementDate)
|
||||
{
|
||||
if (MovementDate == null)
|
||||
throw new IllegalArgumentException ("MovementDate is mandatory.");
|
||||
set_ValueNoCheck (COLUMNNAME_MovementDate, MovementDate);
|
||||
}
|
||||
|
||||
/** Get Movement Date.
|
||||
@return Date a product was moved in or out of inventory
|
||||
*/
|
||||
public Timestamp getMovementDate ()
|
||||
{
|
||||
return (Timestamp)get_Value(COLUMNNAME_MovementDate);
|
||||
}
|
||||
|
||||
/** Get Record ID/ColumnName
|
||||
@return ID/ColumnName pair
|
||||
*/
|
||||
public KeyNamePair getKeyNamePair()
|
||||
{
|
||||
return new KeyNamePair(get_ID(), String.valueOf(getMovementDate()));
|
||||
}
|
||||
|
||||
/** Set Movement Quantity.
|
||||
@param MovementQty
|
||||
Quantity of a product moved.
|
||||
*/
|
||||
public void setMovementQty (BigDecimal MovementQty)
|
||||
{
|
||||
if (MovementQty == null)
|
||||
throw new IllegalArgumentException ("MovementQty is mandatory.");
|
||||
set_ValueNoCheck (COLUMNNAME_MovementQty, MovementQty);
|
||||
}
|
||||
|
||||
/** Get Movement Quantity.
|
||||
@return Quantity of a product moved.
|
||||
*/
|
||||
public BigDecimal getMovementQty ()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MovementQty);
|
||||
if (bd == null)
|
||||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
|
||||
/** MovementType AD_Reference_ID=189 */
|
||||
public static final int MOVEMENTTYPE_AD_Reference_ID=189;
|
||||
/** Customer Shipment = C- */
|
||||
public static final String MOVEMENTTYPE_CustomerShipment = "C-";
|
||||
/** Customer Returns = C+ */
|
||||
public static final String MOVEMENTTYPE_CustomerReturns = "C+";
|
||||
/** Vendor Receipts = V+ */
|
||||
public static final String MOVEMENTTYPE_VendorReceipts = "V+";
|
||||
/** Vendor Returns = V- */
|
||||
public static final String MOVEMENTTYPE_VendorReturns = "V-";
|
||||
/** Inventory Out = I- */
|
||||
public static final String MOVEMENTTYPE_InventoryOut = "I-";
|
||||
/** Inventory In = I+ */
|
||||
public static final String MOVEMENTTYPE_InventoryIn = "I+";
|
||||
/** Movement From = M- */
|
||||
public static final String MOVEMENTTYPE_MovementFrom = "M-";
|
||||
/** Movement To = M+ */
|
||||
public static final String MOVEMENTTYPE_MovementTo = "M+";
|
||||
/** Production + = P+ */
|
||||
public static final String MOVEMENTTYPE_ProductionPlus = "P+";
|
||||
/** Production - = P- */
|
||||
public static final String MOVEMENTTYPE_Production_ = "P-";
|
||||
/** Work Order + = W+ */
|
||||
public static final String MOVEMENTTYPE_WorkOrderPlus = "W+";
|
||||
/** Work Order - = W- */
|
||||
public static final String MOVEMENTTYPE_WorkOrder_ = "W-";
|
||||
/** Set Movement Type.
|
||||
@param MovementType
|
||||
Method of moving the inventory
|
||||
*/
|
||||
public void setMovementType (String MovementType)
|
||||
{
|
||||
if (MovementType == null) throw new IllegalArgumentException ("MovementType is mandatory");
|
||||
if (MovementType.equals("C-") || MovementType.equals("C+") || MovementType.equals("V+") || MovementType.equals("V-") || MovementType.equals("I-") || MovementType.equals("I+") || MovementType.equals("M-") || MovementType.equals("M+") || MovementType.equals("P+") || MovementType.equals("P-") || MovementType.equals("W+") || MovementType.equals("W-")); else throw new IllegalArgumentException ("MovementType Invalid value - " + MovementType + " - Reference_ID=189 - C- - C+ - V+ - V- - I- - I+ - M- - M+ - P+ - P- - W+ - W-"); set_ValueNoCheck (COLUMNNAME_MovementType, MovementType);
|
||||
}
|
||||
|
||||
/** Get Movement Type.
|
||||
@return Method of moving the inventory
|
||||
*/
|
||||
public String getMovementType ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_MovementType);
|
||||
}
|
||||
|
||||
public I_M_Product getM_Product() throws RuntimeException
|
||||
{
|
||||
Class<?> clazz = MTable.getClass(I_M_Product.Table_Name);
|
||||
|
@ -470,14 +377,110 @@ public class X_M_Transaction extends PO implements I_M_Transaction, I_Persistent
|
|||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.eevolution.model.I_PP_Order_BOMLine getPP_Order_BOMLine() throws RuntimeException
|
||||
/** Set Movement Date.
|
||||
@param MovementDate
|
||||
Date a product was moved in or out of inventory
|
||||
*/
|
||||
public void setMovementDate (Timestamp MovementDate)
|
||||
{
|
||||
if (MovementDate == null)
|
||||
throw new IllegalArgumentException ("MovementDate is mandatory.");
|
||||
set_ValueNoCheck (COLUMNNAME_MovementDate, MovementDate);
|
||||
}
|
||||
|
||||
/** Get Movement Date.
|
||||
@return Date a product was moved in or out of inventory
|
||||
*/
|
||||
public Timestamp getMovementDate ()
|
||||
{
|
||||
return (Timestamp)get_Value(COLUMNNAME_MovementDate);
|
||||
}
|
||||
|
||||
/** Get Record ID/ColumnName
|
||||
@return ID/ColumnName pair
|
||||
*/
|
||||
public KeyNamePair getKeyNamePair()
|
||||
{
|
||||
Class<?> clazz = MTable.getClass(org.eevolution.model.I_PP_Order_BOMLine.Table_Name);
|
||||
org.eevolution.model.I_PP_Order_BOMLine result = null;
|
||||
return new KeyNamePair(get_ID(), String.valueOf(getMovementDate()));
|
||||
}
|
||||
|
||||
/** Set Movement Quantity.
|
||||
@param MovementQty
|
||||
Quantity of a product moved.
|
||||
*/
|
||||
public void setMovementQty (BigDecimal MovementQty)
|
||||
{
|
||||
if (MovementQty == null)
|
||||
throw new IllegalArgumentException ("MovementQty is mandatory.");
|
||||
set_ValueNoCheck (COLUMNNAME_MovementQty, MovementQty);
|
||||
}
|
||||
|
||||
/** Get Movement Quantity.
|
||||
@return Quantity of a product moved.
|
||||
*/
|
||||
public BigDecimal getMovementQty ()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MovementQty);
|
||||
if (bd == null)
|
||||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
|
||||
/** MovementType AD_Reference_ID=189 */
|
||||
public static final int MOVEMENTTYPE_AD_Reference_ID=189;
|
||||
/** Customer Shipment = C- */
|
||||
public static final String MOVEMENTTYPE_CustomerShipment = "C-";
|
||||
/** Customer Returns = C+ */
|
||||
public static final String MOVEMENTTYPE_CustomerReturns = "C+";
|
||||
/** Vendor Receipts = V+ */
|
||||
public static final String MOVEMENTTYPE_VendorReceipts = "V+";
|
||||
/** Vendor Returns = V- */
|
||||
public static final String MOVEMENTTYPE_VendorReturns = "V-";
|
||||
/** Inventory Out = I- */
|
||||
public static final String MOVEMENTTYPE_InventoryOut = "I-";
|
||||
/** Inventory In = I+ */
|
||||
public static final String MOVEMENTTYPE_InventoryIn = "I+";
|
||||
/** Movement From = M- */
|
||||
public static final String MOVEMENTTYPE_MovementFrom = "M-";
|
||||
/** Movement To = M+ */
|
||||
public static final String MOVEMENTTYPE_MovementTo = "M+";
|
||||
/** Production + = P+ */
|
||||
public static final String MOVEMENTTYPE_ProductionPlus = "P+";
|
||||
/** Production - = P- */
|
||||
public static final String MOVEMENTTYPE_Production_ = "P-";
|
||||
/** Work Order + = W+ */
|
||||
public static final String MOVEMENTTYPE_WorkOrderPlus = "W+";
|
||||
/** Work Order - = W- */
|
||||
public static final String MOVEMENTTYPE_WorkOrder_ = "W-";
|
||||
/** Set Movement Type.
|
||||
@param MovementType
|
||||
Method of moving the inventory
|
||||
*/
|
||||
public void setMovementType (String MovementType)
|
||||
{
|
||||
if (MovementType == null) throw new IllegalArgumentException ("MovementType is mandatory");
|
||||
if (MovementType.equals("C-") || MovementType.equals("C+") || MovementType.equals("V+") || MovementType.equals("V-") || MovementType.equals("I-") || MovementType.equals("I+") || MovementType.equals("M-") || MovementType.equals("M+") || MovementType.equals("P+") || MovementType.equals("P-") || MovementType.equals("W+") || MovementType.equals("W-"));
|
||||
else throw new IllegalArgumentException ("MovementType Invalid value - " + MovementType + " - Reference_ID=189 - C- - C+ - V+ - V- - I- - I+ - M- - M+ - P+ - P- - W+ - W-");
|
||||
|
||||
set_ValueNoCheck (COLUMNNAME_MovementType, MovementType);
|
||||
}
|
||||
|
||||
/** Get Movement Type.
|
||||
@return Method of moving the inventory
|
||||
*/
|
||||
public String getMovementType ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_MovementType);
|
||||
}
|
||||
|
||||
public org.eevolution.model.I_PP_Cost_Collector getPP_Cost_Collector() throws RuntimeException
|
||||
{
|
||||
Class<?> clazz = MTable.getClass(org.eevolution.model.I_PP_Cost_Collector.Table_Name);
|
||||
org.eevolution.model.I_PP_Cost_Collector result = null;
|
||||
try {
|
||||
Constructor<?> constructor = null;
|
||||
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
|
||||
result = (org.eevolution.model.I_PP_Order_BOMLine)constructor.newInstance(new Object[] {getCtx(), new Integer(getPP_Order_BOMLine_ID()), get_TrxName()});
|
||||
result = (org.eevolution.model.I_PP_Cost_Collector)constructor.newInstance(new Object[] {getCtx(), new Integer(getPP_Cost_Collector_ID()), get_TrxName()});
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
|
||||
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
|
||||
|
@ -486,57 +489,21 @@ public class X_M_Transaction extends PO implements I_M_Transaction, I_Persistent
|
|||
return result;
|
||||
}
|
||||
|
||||
/** Set Manufacturing Order BOM Line.
|
||||
@param PP_Order_BOMLine_ID Manufacturing Order BOM Line */
|
||||
public void setPP_Order_BOMLine_ID (int PP_Order_BOMLine_ID)
|
||||
/** Set Manufacturing Cost Collector.
|
||||
@param PP_Cost_Collector_ID Manufacturing Cost Collector */
|
||||
public void setPP_Cost_Collector_ID (int PP_Cost_Collector_ID)
|
||||
{
|
||||
if (PP_Order_BOMLine_ID < 1)
|
||||
set_Value (COLUMNNAME_PP_Order_BOMLine_ID, null);
|
||||
if (PP_Cost_Collector_ID < 1)
|
||||
set_Value (COLUMNNAME_PP_Cost_Collector_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_PP_Order_BOMLine_ID, Integer.valueOf(PP_Order_BOMLine_ID));
|
||||
set_Value (COLUMNNAME_PP_Cost_Collector_ID, Integer.valueOf(PP_Cost_Collector_ID));
|
||||
}
|
||||
|
||||
/** Get Manufacturing Order BOM Line.
|
||||
@return Manufacturing Order BOM Line */
|
||||
public int getPP_Order_BOMLine_ID ()
|
||||
/** Get Manufacturing Cost Collector.
|
||||
@return Manufacturing Cost Collector */
|
||||
public int getPP_Cost_Collector_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_PP_Order_BOMLine_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.eevolution.model.I_PP_Order getPP_Order() throws RuntimeException
|
||||
{
|
||||
Class<?> clazz = MTable.getClass(org.eevolution.model.I_PP_Order.Table_Name);
|
||||
org.eevolution.model.I_PP_Order result = null;
|
||||
try {
|
||||
Constructor<?> constructor = null;
|
||||
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
|
||||
result = (org.eevolution.model.I_PP_Order)constructor.newInstance(new Object[] {getCtx(), new Integer(getPP_Order_ID()), get_TrxName()});
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
|
||||
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Set Manufacturing Order.
|
||||
@param PP_Order_ID Manufacturing Order */
|
||||
public void setPP_Order_ID (int PP_Order_ID)
|
||||
{
|
||||
if (PP_Order_ID < 1)
|
||||
set_Value (COLUMNNAME_PP_Order_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_PP_Order_ID, Integer.valueOf(PP_Order_ID));
|
||||
}
|
||||
|
||||
/** Get Manufacturing Order.
|
||||
@return Manufacturing Order */
|
||||
public int getPP_Order_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_PP_Order_ID);
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_PP_Cost_Collector_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
|
|
|
@ -347,8 +347,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
|||
getMovementType(), getM_Locator_ID(),
|
||||
getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),
|
||||
QtyMA, getMovementDate(), get_TrxName());
|
||||
mtrx.setPP_Order_ID(getPP_Order_ID());
|
||||
mtrx.setPP_Order_BOMLine_ID(getPP_Order_BOMLine_ID());
|
||||
mtrx.setPP_Cost_Collector_ID(getPP_Cost_Collector_ID());
|
||||
mtrx.saveEx();
|
||||
}
|
||||
}
|
||||
|
@ -370,8 +369,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
|||
getMovementType(), getM_Locator_ID(),
|
||||
getM_Product_ID(), getM_AttributeSetInstance_ID(),
|
||||
Qty, getMovementDate(), get_TrxName());
|
||||
mtrx.setPP_Order_ID(getPP_Order_ID());
|
||||
mtrx.setPP_Order_BOMLine_ID(getPP_Order_BOMLine_ID());
|
||||
mtrx.setPP_Cost_Collector_ID(getPP_Cost_Collector_ID());
|
||||
mtrx.saveEx();
|
||||
}
|
||||
} // stock movement
|
||||
|
@ -856,10 +854,9 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
|||
//
|
||||
// If Product is not Purchased or is not Service, then it is not a subcontracting candidate [SKIP]
|
||||
MProduct product = MProduct.get(getCtx(), subcontract.getM_Product_ID());
|
||||
if(product.isPurchased() && MProduct.PRODUCTTYPE_Service.equals(product.getProductType()))
|
||||
{
|
||||
if(!product.isPurchased() && MProduct.PRODUCTTYPE_Service.equals(product.getProductType()))
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Vendor and Product PO data
|
||||
int C_BPartner_ID = activity.getC_BPartner_ID();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
-- DROP VIEW rv_pp_order_transactions;
|
||||
|
||||
DROP VIEW rv_pp_order_transactions;
|
||||
CREATE OR REPLACE VIEW rv_pp_order_transactions AS
|
||||
SELECT DISTINCT
|
||||
o.ad_client_id,
|
||||
|
@ -22,15 +23,16 @@ ol.qtyscrap AS qtyscrapline,
|
|||
o.qtyscrap * ol.qtybatch / 100 AS qtyissuescrapshouldbe,
|
||||
mt.createdby AS createdbyissue,
|
||||
mt.updatedby AS updatedbyissue,
|
||||
( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_order_bomline_id = ol.pp_order_bomline_id) AS qtytodeliver,
|
||||
(o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_order_bomline_id = ol.pp_order_bomline_id)) AS differenceqty,
|
||||
( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id) AS qtytodeliver,
|
||||
(o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id)) AS differenceqty,
|
||||
o.issotrx,
|
||||
o.dateordered
|
||||
FROM pp_order o
|
||||
JOIN pp_order_bomline ol ON ol.pp_order_id = o.pp_order_id
|
||||
LEFT JOIN m_transaction mt ON mt.pp_order_bomline_id = ol.pp_order_bomline_id
|
||||
JOIN pp_cost_collector cc ON cc.pp_order_bomline_id = ol.pp_order_bomline_id
|
||||
LEFT JOIN m_transaction mt ON mt.pp_cost_collector_id = cc.pp_cost_collector_id
|
||||
ORDER BY
|
||||
o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby, o.updatedby, o.updated, o.documentno, ol.m_product_id, mt.m_locator_id, mt.movementdate, o.pp_order_id, o.qtydelivered, o.qtyscrap, ol.qtydelivered, o.qtydelivered * ol.qtybatch / 100, ol.qtyscrap, o.qtyscrap * ol.qtybatch / 100, mt.createdby, mt.updatedby,
|
||||
(SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_order_bomline_id = ol.pp_order_bomline_id), (o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_order_bomline_id = ol.pp_order_bomline_id)),
|
||||
(SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id), (o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id)),
|
||||
o.issotrx,
|
||||
o.dateordered;
|
||||
o.dateordered;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
-- DROP VIEW rv_pp_order_transactions;
|
||||
|
||||
DROP VIEW rv_pp_order_transactions;
|
||||
CREATE OR REPLACE VIEW rv_pp_order_transactions AS
|
||||
SELECT DISTINCT
|
||||
o.ad_client_id,
|
||||
|
@ -22,15 +23,16 @@ ol.qtyscrap AS qtyscrapline,
|
|||
o.qtyscrap * ol.qtybatch / 100 AS qtyissuescrapshouldbe,
|
||||
mt.createdby AS createdbyissue,
|
||||
mt.updatedby AS updatedbyissue,
|
||||
( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_order_bomline_id = ol.pp_order_bomline_id) AS qtytodeliver,
|
||||
(o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_order_bomline_id = ol.pp_order_bomline_id)) AS differenceqty,
|
||||
( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id) AS qtytodeliver,
|
||||
(o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id)) AS differenceqty,
|
||||
o.issotrx,
|
||||
o.dateordered
|
||||
FROM pp_order o
|
||||
JOIN pp_order_bomline ol ON ol.pp_order_id = o.pp_order_id
|
||||
LEFT JOIN m_transaction mt ON mt.pp_order_bomline_id = ol.pp_order_bomline_id
|
||||
JOIN pp_cost_collector cc ON cc.pp_order_bomline_id = ol.pp_order_bomline_id
|
||||
LEFT JOIN m_transaction mt ON mt.pp_cost_collector_id = cc.pp_cost_collector_id
|
||||
ORDER BY
|
||||
o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby, o.updatedby, o.updated, o.documentno, ol.m_product_id, mt.m_locator_id, mt.movementdate, o.pp_order_id, o.qtydelivered, o.qtyscrap, ol.qtydelivered, o.qtydelivered * ol.qtybatch / 100, ol.qtyscrap, o.qtyscrap * ol.qtybatch / 100, mt.createdby, mt.updatedby,
|
||||
(SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_order_bomline_id = ol.pp_order_bomline_id), (o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_order_bomline_id = ol.pp_order_bomline_id)),
|
||||
(SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id), (o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id)),
|
||||
o.issotrx,
|
||||
o.dateordered;
|
||||
o.dateordered;
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
DROP VIEW rv_pp_order_transactions;
|
||||
CREATE OR REPLACE VIEW rv_pp_order_transactions AS
|
||||
SELECT DISTINCT
|
||||
o.ad_client_id,
|
||||
o.ad_org_id,
|
||||
o.isactive,
|
||||
o.created,
|
||||
o.createdby,
|
||||
o.updatedby,
|
||||
o.updated,
|
||||
o.documentno,
|
||||
ol.m_product_id,
|
||||
mt.m_locator_id,
|
||||
mt.movementdate,
|
||||
o.pp_order_id,
|
||||
o.qtydelivered,
|
||||
o.qtyscrap,
|
||||
ol.qtydelivered AS qtydeliveredline,
|
||||
o.qtydelivered * ol.qtybatch / 100 AS qtyissueshouldbe,
|
||||
ol.qtyscrap AS qtyscrapline,
|
||||
o.qtyscrap * ol.qtybatch / 100 AS qtyissuescrapshouldbe,
|
||||
mt.createdby AS createdbyissue,
|
||||
mt.updatedby AS updatedbyissue,
|
||||
( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id) AS qtytodeliver,
|
||||
(o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id)) AS differenceqty,
|
||||
o.issotrx,
|
||||
o.dateordered
|
||||
FROM pp_order o
|
||||
JOIN pp_order_bomline ol ON ol.pp_order_id = o.pp_order_id
|
||||
JOIN pp_cost_collector cc ON cc.pp_order_bomline_id = ol.pp_order_bomline_id
|
||||
LEFT JOIN m_transaction mt ON mt.pp_cost_collector_id = cc.pp_cost_collector_id
|
||||
ORDER BY
|
||||
o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby, o.updatedby, o.updated, o.documentno, ol.m_product_id, mt.m_locator_id, mt.movementdate, o.pp_order_id, o.qtydelivered, o.qtyscrap, ol.qtydelivered, o.qtydelivered * ol.qtybatch / 100, ol.qtyscrap, o.qtyscrap * ol.qtybatch / 100, mt.createdby, mt.updatedby,
|
||||
(SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id), (o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id)),
|
||||
o.issotrx,
|
||||
o.dateordered
|
||||
|
||||
ALTER TABLE m_transaction DROP COLUMN pp_order_id;
|
||||
ALTER TABLE m_transaction DROP COLUMN pp_order_bomline_id;
|
||||
|
||||
-- Jan 9, 2009 8:30:36 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
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,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,56574,53310,0,30,808,'PP_Cost_Collector_ID',TO_DATE('2009-01-09 20:30:25','YYYY-MM-DD HH24:MI:SS'),0,'EE01',10,'Y','Y','N','N','N','N','N','N','N','N','N','N','N','Manufacturing Cost Collector',TO_DATE('2009-01-09 20:30:25','YYYY-MM-DD HH24:MI:SS'),0,0)
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:30:36 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
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=56574 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:30:41 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
ALTER TABLE M_CostDetail ADD PP_Cost_Collector_ID NUMBER(10)
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:34:20 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
UPDATE AD_Column SET AD_Element_ID=53310, ColumnName='PP_Cost_Collector_ID', Description=NULL, Help=NULL, Name='Manufacturing Cost Collector',Updated=TO_DATE('2009-01-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53409
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:34:20 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
UPDATE AD_Column_Trl SET IsTranslated='N' WHERE AD_Column_ID=53409
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:34:20 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
UPDATE AD_Field SET Name='Manufacturing Cost Collector', Description=NULL, Help=NULL WHERE AD_Column_ID=53409 AND IsCentrallyMaintained='Y'
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:34:26 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
ALTER TABLE M_Transaction ADD PP_Cost_Collector_ID NUMBER(10)
|
||||
;
|
||||
|
||||
|
||||
-- Jan 12, 2009 11:57:36 AM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
DELETE FROM AD_Field_Trl WHERE AD_Field_ID=53635
|
||||
;
|
||||
|
||||
|
||||
-- Jan 12, 2009 11:57:37 AM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
DELETE FROM AD_Field WHERE AD_Field_ID=53635
|
||||
;
|
||||
|
||||
-- Jan 12, 2009 11:58:36 AM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=53410
|
||||
;
|
||||
|
||||
-- Jan 12, 2009 12:00:03 PM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,53409,56606,0,289,TO_DATE('2009-01-12 12:00:02','YYYY-MM-DD HH24:MI:SS'),0,10,'EE01','Y','Y','Y','N','N','N','N','N','Manufacturing Cost Collector',TO_DATE('2009-01-12 12:00:02','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Jan 12, 2009 12:00:03 PM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_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_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56606 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
|
||||
;
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
DROP VIEW rv_pp_order_transactions;
|
||||
CREATE OR REPLACE VIEW rv_pp_order_transactions AS
|
||||
SELECT DISTINCT
|
||||
o.ad_client_id,
|
||||
o.ad_org_id,
|
||||
o.isactive,
|
||||
o.created,
|
||||
o.createdby,
|
||||
o.updatedby,
|
||||
o.updated,
|
||||
o.documentno,
|
||||
ol.m_product_id,
|
||||
mt.m_locator_id,
|
||||
mt.movementdate,
|
||||
o.pp_order_id,
|
||||
o.qtydelivered,
|
||||
o.qtyscrap,
|
||||
ol.qtydelivered AS qtydeliveredline,
|
||||
o.qtydelivered * ol.qtybatch / 100 AS qtyissueshouldbe,
|
||||
ol.qtyscrap AS qtyscrapline,
|
||||
o.qtyscrap * ol.qtybatch / 100 AS qtyissuescrapshouldbe,
|
||||
mt.createdby AS createdbyissue,
|
||||
mt.updatedby AS updatedbyissue,
|
||||
( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id) AS qtytodeliver,
|
||||
(o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id)) AS differenceqty,
|
||||
o.issotrx,
|
||||
o.dateordered
|
||||
FROM pp_order o
|
||||
JOIN pp_order_bomline ol ON ol.pp_order_id = o.pp_order_id
|
||||
JOIN pp_cost_collector cc ON cc.pp_order_bomline_id = ol.pp_order_bomline_id
|
||||
LEFT JOIN m_transaction mt ON mt.pp_cost_collector_id = cc.pp_cost_collector_id
|
||||
ORDER BY
|
||||
o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby, o.updatedby, o.updated, o.documentno, ol.m_product_id, mt.m_locator_id, mt.movementdate, o.pp_order_id, o.qtydelivered, o.qtyscrap, ol.qtydelivered, o.qtydelivered * ol.qtybatch / 100, ol.qtyscrap, o.qtyscrap * ol.qtybatch / 100, mt.createdby, mt.updatedby,
|
||||
(SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id), (o.qtydelivered + o.qtyscrap) * ol.qtybatch / 100 + (( SELECT sum(t.movementqty) AS sum FROM m_transaction t WHERE t.pp_cost_collector_id = cc.pp_cost_collector_id)),
|
||||
o.issotrx,
|
||||
o.dateordered
|
||||
|
||||
ALTER TABLE m_transaction DROP COLUMN pp_order_id;
|
||||
ALTER TABLE m_transaction DROP COLUMN pp_order_bomline_id;
|
||||
|
||||
-- Jan 9, 2009 8:30:36 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
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,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,56574,53310,0,30,808,'PP_Cost_Collector_ID',TO_TIMESTAMP('2009-01-09 20:30:25','YYYY-MM-DD HH24:MI:SS'),0,'EE01',10,'Y','Y','N','N','N','N','N','N','N','N','N','N','N','Manufacturing Cost Collector',TO_TIMESTAMP('2009-01-09 20:30:25','YYYY-MM-DD HH24:MI:SS'),0,0)
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:30:36 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
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=56574 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:30:41 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
ALTER TABLE M_CostDetail ADD COLUMN PP_Cost_Collector_ID NUMERIC(10)
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:34:20 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
UPDATE AD_Column SET AD_Element_ID=53310, ColumnName='PP_Cost_Collector_ID', Description=NULL, Help=NULL, Name='Manufacturing Cost Collector',Updated=TO_TIMESTAMP('2009-01-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53409
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:34:20 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
UPDATE AD_Column_Trl SET IsTranslated='N' WHERE AD_Column_ID=53409
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:34:20 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
UPDATE AD_Field SET Name='Manufacturing Cost Collector', Description=NULL, Help=NULL WHERE AD_Column_ID=53409 AND IsCentrallyMaintained='Y'
|
||||
;
|
||||
|
||||
-- Jan 9, 2009 8:34:26 PM ECT
|
||||
-- Manufacturing Cost Management
|
||||
ALTER TABLE M_Transaction ADD COLUMN PP_Cost_Collector_ID NUMERIC(10)
|
||||
;
|
||||
|
||||
-- Jan 12, 2009 11:57:36 AM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
DELETE FROM AD_Field_Trl WHERE AD_Field_ID=53635
|
||||
;
|
||||
|
||||
-- Jan 12, 2009 11:57:37 AM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
DELETE FROM AD_Field WHERE AD_Field_ID=53635
|
||||
;
|
||||
|
||||
-- Jan 12, 2009 11:58:36 AM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=53410
|
||||
;
|
||||
|
||||
-- Jan 12, 2009 11:58:36 AM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
DELETE FROM AD_Column WHERE AD_Column_ID=53410
|
||||
;
|
||||
|
||||
-- Jan 12, 2009 12:00:03 PM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,53409,56606,0,289,TO_TIMESTAMP('2009-01-12 12:00:02','YYYY-MM-DD HH24:MI:SS'),0,10,'EE01','Y','Y','Y','N','N','N','N','N','Manufacturing Cost Collector',TO_TIMESTAMP('2009-01-12 12:00:02','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Jan 12, 2009 12:00:03 PM ECT
|
||||
-- Standard Cost for Manufacturing
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_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_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56606 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
|
||||
;
|
||||
|
Loading…
Reference in New Issue