From d8a3155802e9673542684b071932cf1a6922bf5c Mon Sep 17 00:00:00 2001 From: tsvikruha Date: Fri, 7 Aug 2015 13:10:45 +0200 Subject: [PATCH] IDEMPIERE-2760 Inventory Move - Document type Print Format ignored --- .../src/org/compiere/model/SystemIDs.java | 1 + .../src/org/compiere/print/ReportEngine.java | 20 ++++++++++++++----- .../org/compiere/print/ServerReportCtl.java | 3 +++ .../src/org/compiere/print/ReportCtl.java | 3 +++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index a1eee0a94b..a0c7b5ab33 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -80,6 +80,7 @@ public class SystemIDs public final static int PROCESS_RPT_FINREPORT = 202; public final static int PROCESS_RPT_FINSTATEMENT = 204; public final static int PROCESS_RPT_M_INVENTORY = 291; + public final static int PROCESS_RPT_M_MOVEMENT = 290; public final static int REFERENCE_DATATYPE_ACCOUNT = 25; public final static int REFERENCE_DATATYPE_AMOUNT = 12; diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index bf36bd70ba..4733bdf36e 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -18,6 +18,7 @@ package org.compiere.print; import static org.compiere.model.SystemIDs.TABLE_AD_TABLE; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY; +import static org.compiere.model.SystemIDs.PROCESS_RPT_M_MOVEMENT; import java.awt.Color; import java.awt.Font; @@ -77,6 +78,7 @@ import org.compiere.model.MDunningRunEntry; import org.compiere.model.MInOut; import org.compiere.model.MInventory; import org.compiere.model.MInvoice; +import org.compiere.model.MMovement; import org.compiere.model.MOrder; import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MProcess; @@ -1403,6 +1405,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) public static final int DISTRIBUTION_ORDER = 9; /** Physical Inventory = 10 */ public static final int INVENTORY = 10; + /** Inventory Move = 11 */ + public static final int MOVEMENT = 11; // private static final String[] DOC_TABLES = new String[] { @@ -1414,17 +1418,17 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) "C_Order", "M_InOut", "C_Invoice", "C_Project", "C_RfQResponse", "C_PaySelectionCheck", "C_PaySelectionCheck", - "C_DunningRunEntry","PP_Order", "DD_Order", "M_Inventory"}; + "C_DunningRunEntry","PP_Order", "DD_Order", "M_Inventory", "M_Movement"}; private static final String[] DOC_IDS = new String[] { "C_Order_ID", "M_InOut_ID", "C_Invoice_ID", "C_Project_ID", "C_RfQResponse_ID", "C_PaySelectionCheck_ID", "C_PaySelectionCheck_ID", - "C_DunningRunEntry_ID" , "PP_Order_ID" , "DD_Order_ID", "M_Inventory_ID" }; + "C_DunningRunEntry_ID" , "PP_Order_ID" , "DD_Order_ID", "M_Inventory_ID", "M_Movement_ID" }; private static final int[] DOC_TABLE_ID = new int[] { MOrder.Table_ID, MInOut.Table_ID, MInvoice.Table_ID, MProject.Table_ID, MRfQResponse.Table_ID, MPaySelectionCheck.Table_ID, MPaySelectionCheck.Table_ID, - MDunningRunEntry.Table_ID, X_PP_Order.Table_ID, MDDOrder.Table_ID, MInventory.Table_ID }; + MDunningRunEntry.Table_ID, X_PP_Order.Table_ID, MDDOrder.Table_ID, MInventory.Table_ID, MMovement.Table_ID }; /************************************************************************** * Get Document Print Engine for Document Type. @@ -1560,7 +1564,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) .append("WHERE d." + DOC_IDS[type] + "=?") // info from PrintForm .append(" AND pf.AD_Org_ID IN (0,d.AD_Org_ID) ") .append("ORDER BY pf.AD_Org_ID DESC"); - else if (type == INVENTORY) + else if (type == INVENTORY || type == MOVEMENT) sql = new StringBuilder("SELECT COALESCE (dt.AD_PrintFormat_ID, 0), 0,") // 1..2 .append(" NULL, 0 , d.DocumentNo ") // 3..5 .append("FROM " + DOC_BASETABLES[type] + " d") @@ -1595,7 +1599,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) { if (type == CHECK || type == DUNNING || type == REMITTANCE || type == PROJECT || type == RFQ || type == MANUFACTURING_ORDER || type == DISTRIBUTION_ORDER - || type == INVENTORY) + || type == INVENTORY || type == MOVEMENT) { AD_PrintFormat_ID = rs.getInt(1); copies = 1; @@ -1616,6 +1620,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) MProcess process = MProcess.get(ctx, PROCESS_RPT_M_INVENTORY); AD_PrintFormat_ID = process.getAD_PrintFormat_ID(); } + + if(AD_PrintFormat_ID == 0 && type == MOVEMENT){ + MProcess process = MProcess.get(ctx, PROCESS_RPT_M_MOVEMENT); + AD_PrintFormat_ID = process.getAD_PrintFormat_ID(); + } + } else { diff --git a/org.adempiere.base/src/org/compiere/print/ServerReportCtl.java b/org.adempiere.base/src/org/compiere/print/ServerReportCtl.java index 84c3117421..40f5b0f0ee 100644 --- a/org.adempiere.base/src/org/compiere/print/ServerReportCtl.java +++ b/org.adempiere.base/src/org/compiere/print/ServerReportCtl.java @@ -9,6 +9,7 @@ import static org.compiere.model.SystemIDs.PROCESS_RPT_FINREPORT; import static org.compiere.model.SystemIDs.PROCESS_RPT_FINSTATEMENT; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INOUT; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY; +import static org.compiere.model.SystemIDs.PROCESS_RPT_M_MOVEMENT; import java.util.ArrayList; import java.util.Properties; @@ -213,6 +214,8 @@ public class ServerReportCtl { return startFinReport (pi); else if (pi.getAD_Process_ID() == PROCESS_RPT_M_INVENTORY) // M_Inventory return startDocumentPrint(ReportEngine.INVENTORY, null, pi.getRecord_ID(), null, pi); + else if (pi.getAD_Process_ID() == PROCESS_RPT_M_MOVEMENT) // M_Movement + return startDocumentPrint(ReportEngine.MOVEMENT, null, pi.getRecord_ID(), null, pi); /******************** * Standard Report *******************/ diff --git a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java index 861ceaa49f..2f50edf187 100644 --- a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java +++ b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java @@ -26,6 +26,7 @@ import static org.compiere.model.SystemIDs.PROCESS_RPT_FINREPORT; import static org.compiere.model.SystemIDs.PROCESS_RPT_FINSTATEMENT; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INOUT; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY; +import static org.compiere.model.SystemIDs.PROCESS_RPT_M_MOVEMENT; import java.util.Properties; import java.util.logging.Level; @@ -158,6 +159,8 @@ public class ReportCtl return startCheckPrint(pi.getRecord_ID(), !pi.isPrintPreview()); else if (pi.getAD_Process_ID() == PROCESS_RPT_M_INVENTORY) // Physical Inventory return startDocumentPrint(ReportEngine.INVENTORY, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); + else if (pi.getAD_Process_ID() == PROCESS_RPT_M_MOVEMENT) // Inventory Move + return startDocumentPrint(ReportEngine.MOVEMENT, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); /** else if (pi.getAD_Process_ID() == 290) // Movement Submission by VHARCQ return startDocumentPrint(ReportEngine.MOVEMENT, pi.getRecord_ID(), parent, WindowNo, IsDirectPrint);