IDEMPIERE-3714 Includes Shipment as parameter of Generate Invoice Process

This commit is contained in:
Ricardo Santana 2019-08-02 12:35:29 +02:00
parent f7111b1097
commit 1b700d7ac9
3 changed files with 31 additions and 4 deletions

View File

@ -0,0 +1,10 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3714 Shipment Parameter on Generate Invoices
-- 16/05/2018 15h44min26s BRT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted) VALUES (200227,0,0,'Y',TO_DATE('2018-05-16 15:44:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-16 15:44:25','YYYY-MM-DD HH24:MI:SS'),100,'Shipment/Receipt','Material Shipment Document','The Material Shipment / Receipt ',119,70,30,337,'N',52055,0,'N','M_InOut_ID','Y','D',1025,'@C_Order_ID@<1','4bedf18d-4f2a-46cb-8cc1-11f7a739ecff','N')
;
SELECT register_migration_script('201805161551_IDEMPIERE-3714.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
-- IDEMPIERE-3714 Shipment Parameter on Generate Invoices
-- 16/05/2018 15h44min26s BRT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted) VALUES (200227,0,0,'Y',TO_TIMESTAMP('2018-05-16 15:44:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-16 15:44:25','YYYY-MM-DD HH24:MI:SS'),100,'Shipment/Receipt','Material Shipment Document','The Material Shipment / Receipt ',119,70,30,337,'N',52055,0,'N','M_InOut_ID','Y','D',1025,'@C_Order_ID@<1','4bedf18d-4f2a-46cb-8cc1-11f7a739ecff','N')
;
SELECT register_migration_script('201805161551_IDEMPIERE-3714.sql') FROM dual
;

View File

@ -67,6 +67,8 @@ public class InvoiceGenerate extends SvrProcess
private int p_C_BPartner_ID = 0; private int p_C_BPartner_ID = 0;
/** Order */ /** Order */
private int p_C_Order_ID = 0; private int p_C_Order_ID = 0;
/** Shipment */
private int p_M_InOut_ID = 0;
/** Consolidate */ /** Consolidate */
private boolean p_ConsolidateDocument = true; private boolean p_ConsolidateDocument = true;
/** Invoice Document Action */ /** Invoice Document Action */
@ -110,6 +112,8 @@ public class InvoiceGenerate extends SvrProcess
p_C_BPartner_ID = para[i].getParameterAsInt(); p_C_BPartner_ID = para[i].getParameterAsInt();
else if (name.equals("C_Order_ID")) else if (name.equals("C_Order_ID"))
p_C_Order_ID = para[i].getParameterAsInt(); p_C_Order_ID = para[i].getParameterAsInt();
else if (name.equals("M_InOut_ID"))
p_M_InOut_ID = para[i].getParameterAsInt();
else if (name.equals("ConsolidateDocument")) else if (name.equals("ConsolidateDocument"))
p_ConsolidateDocument = "Y".equals(para[i].getParameter()); p_ConsolidateDocument = "Y".equals(para[i].getParameter());
else if (name.equals("DocAction")) else if (name.equals("DocAction"))
@ -150,7 +154,7 @@ public class InvoiceGenerate extends SvrProcess
.append("WHERE C_Order.DocStatus='CO' AND C_Order.IsSOTrx='Y' ") .append("WHERE C_Order.DocStatus='CO' AND C_Order.IsSOTrx='Y' ")
.append("AND C_Order.C_Order_ID = T_Selection.T_Selection_ID ") .append("AND C_Order.C_Order_ID = T_Selection.T_Selection_ID ")
.append("AND T_Selection.AD_PInstance_ID=? ") .append("AND T_Selection.AD_PInstance_ID=? ")
.append("ORDER BY C_Order.M_Warehouse_ID, C_Order.PriorityRule, C_Order.C_BPartner_ID, C_Order.Bill_Location_ID, C_Order.C_Order_ID"); .append("ORDER BY C_Order.AD_Org_ID, C_Order.M_Warehouse_ID, C_Order.PriorityRule, C_Order.C_BPartner_ID, C_Order.Bill_Location_ID, C_Order.C_Order_ID");
} }
else else
{ {
@ -164,10 +168,14 @@ public class InvoiceGenerate extends SvrProcess
sql.append(" AND C_Order_ID=?"); sql.append(" AND C_Order_ID=?");
// //
sql.append(" AND EXISTS (SELECT * FROM C_OrderLine ol ") sql.append(" AND EXISTS (SELECT * FROM C_OrderLine ol ")
.append("WHERE o.C_Order_ID=ol.C_Order_ID AND ol.QtyOrdered<>ol.QtyInvoiced) ") .append("WHERE o.C_Order_ID=ol.C_Order_ID AND ol.QtyOrdered<>ol.QtyInvoiced ");
.append("AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType ") //
if (p_M_InOut_ID != 0)
sql.append(" AND EXISTS (SELECT '1' FROM M_InOutLine iol WHERE iol.C_OrderLine_ID=ol.C_OrderLine_ID AND iol.M_InOut_ID=?) ");
//
sql.append(") AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType ")
.append("WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR')) ") .append("WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR')) ")
.append("ORDER BY M_Warehouse_ID, PriorityRule, C_BPartner_ID, Bill_Location_ID, C_Order_ID"); .append("ORDER BY AD_Org_ID, M_Warehouse_ID, PriorityRule, C_BPartner_ID, Bill_Location_ID, C_Order_ID");
} }
// sql += " FOR UPDATE"; // sql += " FOR UPDATE";
@ -188,6 +196,8 @@ public class InvoiceGenerate extends SvrProcess
pstmt.setInt(index++, p_C_BPartner_ID); pstmt.setInt(index++, p_C_BPartner_ID);
if (p_C_Order_ID != 0) if (p_C_Order_ID != 0)
pstmt.setInt(index++, p_C_Order_ID); pstmt.setInt(index++, p_C_Order_ID);
if (p_M_InOut_ID != 0)
pstmt.setInt(index++, p_M_InOut_ID);
} }
} }
catch (Exception e) catch (Exception e)