IDEMPIERE-2749 Internal Use Inventory - Document type Print Format ignored

This commit is contained in:
tsvikruha 2015-08-03 11:40:07 +02:00
parent fd16f78caa
commit 6ffc872126
4 changed files with 27 additions and 4 deletions

View File

@ -79,6 +79,7 @@ public class SystemIDs
public final static int PROCESS_RPT_C_DUNNING = 159; public final static int PROCESS_RPT_C_DUNNING = 159;
public final static int PROCESS_RPT_FINREPORT = 202; public final static int PROCESS_RPT_FINREPORT = 202;
public final static int PROCESS_RPT_FINSTATEMENT = 204; public final static int PROCESS_RPT_FINSTATEMENT = 204;
public final static int PROCESS_RPT_M_INVENTORY = 291;
public final static int REFERENCE_DATATYPE_ACCOUNT = 25; public final static int REFERENCE_DATATYPE_ACCOUNT = 25;
public final static int REFERENCE_DATATYPE_AMOUNT = 12; public final static int REFERENCE_DATATYPE_AMOUNT = 12;

View File

@ -17,6 +17,7 @@
package org.compiere.print; package org.compiere.print;
import static org.compiere.model.SystemIDs.TABLE_AD_TABLE; import static org.compiere.model.SystemIDs.TABLE_AD_TABLE;
import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY;
import java.awt.Color; import java.awt.Color;
import java.awt.Font; import java.awt.Font;
@ -74,9 +75,11 @@ import org.compiere.model.MClient;
import org.compiere.model.MColumn; import org.compiere.model.MColumn;
import org.compiere.model.MDunningRunEntry; import org.compiere.model.MDunningRunEntry;
import org.compiere.model.MInOut; import org.compiere.model.MInOut;
import org.compiere.model.MInventory;
import org.compiere.model.MInvoice; import org.compiere.model.MInvoice;
import org.compiere.model.MOrder; import org.compiere.model.MOrder;
import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaySelectionCheck;
import org.compiere.model.MProcess;
import org.compiere.model.MProject; import org.compiere.model.MProject;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MRfQResponse; import org.compiere.model.MRfQResponse;
@ -1398,6 +1401,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
public static final int MANUFACTURING_ORDER = 8; public static final int MANUFACTURING_ORDER = 8;
/** Distribution Order = 9 */ /** Distribution Order = 9 */
public static final int DISTRIBUTION_ORDER = 9; public static final int DISTRIBUTION_ORDER = 9;
/** Physical Inventory = 10 */
public static final int INVENTORY = 10;
// private static final String[] DOC_TABLES = new String[] { // private static final String[] DOC_TABLES = new String[] {
@ -1409,17 +1414,17 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
"C_Order", "M_InOut", "C_Invoice", "C_Project", "C_Order", "M_InOut", "C_Invoice", "C_Project",
"C_RfQResponse", "C_RfQResponse",
"C_PaySelectionCheck", "C_PaySelectionCheck", "C_PaySelectionCheck", "C_PaySelectionCheck",
"C_DunningRunEntry","PP_Order", "DD_Order"}; "C_DunningRunEntry","PP_Order", "DD_Order", "M_Inventory"};
private static final String[] DOC_IDS = new String[] { private static final String[] DOC_IDS = new String[] {
"C_Order_ID", "M_InOut_ID", "C_Invoice_ID", "C_Project_ID", "C_Order_ID", "M_InOut_ID", "C_Invoice_ID", "C_Project_ID",
"C_RfQResponse_ID", "C_RfQResponse_ID",
"C_PaySelectionCheck_ID", "C_PaySelectionCheck_ID", "C_PaySelectionCheck_ID", "C_PaySelectionCheck_ID",
"C_DunningRunEntry_ID" , "PP_Order_ID" , "DD_Order_ID" }; "C_DunningRunEntry_ID" , "PP_Order_ID" , "DD_Order_ID", "M_Inventory_ID" };
private static final int[] DOC_TABLE_ID = new int[] { private static final int[] DOC_TABLE_ID = new int[] {
MOrder.Table_ID, MInOut.Table_ID, MInvoice.Table_ID, MProject.Table_ID, MOrder.Table_ID, MInOut.Table_ID, MInvoice.Table_ID, MProject.Table_ID,
MRfQResponse.Table_ID, MRfQResponse.Table_ID,
MPaySelectionCheck.Table_ID, MPaySelectionCheck.Table_ID, MPaySelectionCheck.Table_ID, MPaySelectionCheck.Table_ID,
MDunningRunEntry.Table_ID, X_PP_Order.Table_ID, MDDOrder.Table_ID }; MDunningRunEntry.Table_ID, X_PP_Order.Table_ID, MDDOrder.Table_ID, MInventory.Table_ID };
/************************************************************************** /**************************************************************************
* Get Document Print Engine for Document Type. * Get Document Print Engine for Document Type.
@ -1555,6 +1560,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
.append("WHERE d." + DOC_IDS[type] + "=?") // info from PrintForm .append("WHERE d." + DOC_IDS[type] + "=?") // info from PrintForm
.append(" AND pf.AD_Org_ID IN (0,d.AD_Org_ID) ") .append(" AND pf.AD_Org_ID IN (0,d.AD_Org_ID) ")
.append("ORDER BY pf.AD_Org_ID DESC"); .append("ORDER BY pf.AD_Org_ID DESC");
else if (type == INVENTORY)
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")
.append(" LEFT OUTER JOIN C_DocType dt ON (d.C_DocType_ID=dt.C_DocType_ID) ")
.append("WHERE d." + DOC_IDS[type] + "=?"); // info from PrintForm
else // Get PrintFormat from Org or 0 of document client else // Get PrintFormat from Org or 0 of document client
sql = new StringBuilder("SELECT pf.Order_PrintFormat_ID,pf.Shipment_PrintFormat_ID,") // 1..2 sql = new StringBuilder("SELECT pf.Order_PrintFormat_ID,pf.Shipment_PrintFormat_ID,") // 1..2
// Prio: 1. BPartner 2. DocType, 3. PrintFormat (Org) // see InvoicePrint // Prio: 1. BPartner 2. DocType, 3. PrintFormat (Org) // see InvoicePrint
@ -1583,7 +1594,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
if (rs.next()) // first record only if (rs.next()) // first record only
{ {
if (type == CHECK || type == DUNNING || type == REMITTANCE if (type == CHECK || type == DUNNING || type == REMITTANCE
|| type == PROJECT || type == RFQ || type == MANUFACTURING_ORDER || type == DISTRIBUTION_ORDER) || type == PROJECT || type == RFQ || type == MANUFACTURING_ORDER || type == DISTRIBUTION_ORDER
|| type == INVENTORY)
{ {
AD_PrintFormat_ID = rs.getInt(1); AD_PrintFormat_ID = rs.getInt(1);
copies = 1; copies = 1;
@ -1599,6 +1611,11 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
} }
else else
DocumentNo = rs.getString(5); DocumentNo = rs.getString(5);
if(AD_PrintFormat_ID == 0 && type == INVENTORY){
MProcess process = MProcess.get(ctx, PROCESS_RPT_M_INVENTORY);
AD_PrintFormat_ID = process.getAD_PrintFormat_ID();
}
} }
else else
{ {

View File

@ -201,6 +201,8 @@ public class ServerReportCtl {
else if (pi.getAD_Process_ID() == 202 // Financial Report else if (pi.getAD_Process_ID() == 202 // Financial Report
|| pi.getAD_Process_ID() == 204) // Financial Statement || pi.getAD_Process_ID() == 204) // Financial Statement
return startFinReport (pi); return startFinReport (pi);
else if (pi.getAD_Process_ID() == 291) // M_Inventory
return startDocumentPrint(ReportEngine.INVENTORY, null, pi.getRecord_ID(), null, pi);
/******************** /********************
* Standard Report * Standard Report
*******************/ *******************/

View File

@ -25,6 +25,7 @@ import static org.compiere.model.SystemIDs.PROCESS_RPT_C_RFQRESPONSE;
import static org.compiere.model.SystemIDs.PROCESS_RPT_FINREPORT; 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_FINSTATEMENT;
import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INOUT; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INOUT;
import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
@ -155,6 +156,8 @@ public class ReportCtl
return startDocumentPrint(ReportEngine.RFQ, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); return startDocumentPrint(ReportEngine.RFQ, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview());
else if (pi.getAD_Process_ID() == PROCESS_RPT_C_PAYMENT) // C_Payment else if (pi.getAD_Process_ID() == PROCESS_RPT_C_PAYMENT) // C_Payment
return startCheckPrint(pi.getRecord_ID(), !pi.isPrintPreview()); 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() == 290) // Movement Submission by VHARCQ else if (pi.getAD_Process_ID() == 290) // Movement Submission by VHARCQ
return startDocumentPrint(ReportEngine.MOVEMENT, pi.getRecord_ID(), parent, WindowNo, IsDirectPrint); return startDocumentPrint(ReportEngine.MOVEMENT, pi.getRecord_ID(), parent, WindowNo, IsDirectPrint);