IDEMPIERE-3529 - Add parameters to InvoicePrint process

This commit is contained in:
Diego Ruiz 2017-10-25 12:46:16 +02:00
parent 1237e22db7
commit dae313ae78
3 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,14 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3529 - Add parameters to InvoicePrint process
-- Oct 25, 2017 12:09:30 PM CEST
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,AD_Process_Para_UU,IsEncrypted) VALUES (200219,0,0,'Y',TO_DATE('2017-10-25 12:09:30','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-10-25 12:09:30','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',200,60,19,170,'N',200097,0,'N','C_DocType_ID','Y','D',196,'554013bb-d6c0-4795-a9c6-aa2cb6dfc2bf','N')
;
-- Oct 25, 2017 12:16:28 PM CEST
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200220,0,0,'Y',TO_DATE('2017-10-25 12:16:28','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-10-25 12:16:28','YYYY-MM-DD HH24:MI:SS'),100,'Paid','The document is paid',200,70,17,319,'N',0,'N','IsPaid','Y','D',1402,'7d2f7567-fb4f-44b0-a098-ddaa81ca7a4f','N')
;
SELECT register_migration_script('201710251241_IDEMPIERE-3529.sql') FROM dual
;

View File

@ -0,0 +1,11 @@
-- IDEMPIERE-3529 - Add parameters to InvoicePrint process
-- Oct 25, 2017 12:09:30 PM CEST
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,AD_Process_Para_UU,IsEncrypted) VALUES (200219,0,0,'Y',TO_TIMESTAMP('2017-10-25 12:09:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-10-25 12:09:30','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',200,60,19,170,'N',200097,0,'N','C_DocType_ID','Y','D',196,'554013bb-d6c0-4795-a9c6-aa2cb6dfc2bf','N')
;
-- Oct 25, 2017 12:16:28 PM CEST
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200220,0,0,'Y',TO_TIMESTAMP('2017-10-25 12:16:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-10-25 12:16:28','YYYY-MM-DD HH24:MI:SS'),100,'Paid','The document is paid',200,70,17,319,'N',0,'N','IsPaid','Y','D',1402,'7d2f7567-fb4f-44b0-a098-ddaa81ca7a4f','N')
;
SELECT register_migration_script('201710251241_IDEMPIERE-3529.sql') FROM dual
;

View File

@ -68,6 +68,8 @@ public class InvoicePrint extends SvrProcess
protected int m_C_Invoice_ID = 0;
protected String m_DocumentNo_From = null;
protected String m_DocumentNo_To = null;
private String p_IsPaid = null;
private int m_C_DocType_ID = 0;
protected volatile StringBuffer sql = new StringBuffer();
protected volatile List<Object> params = new ArrayList<Object>();
@ -101,6 +103,10 @@ public class InvoicePrint extends SvrProcess
m_DocumentNo_From = (String)para[i].getParameter();
m_DocumentNo_To = (String)para[i].getParameter_To();
}
else if (name.equals("IsPaid"))
p_IsPaid = (String)para[i].getParameter();
else if (name.equals("C_DocType_ID"))
m_C_DocType_ID = para[i].getParameterAsInt();
else
log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name);
}
@ -124,7 +130,9 @@ public class InvoicePrint extends SvrProcess
+ ", C_Invoice_ID=" + m_C_Invoice_ID
+ ", EmailPDF=" + p_EMailPDF + ",R_MailText_ID=" + p_R_MailText_ID
+ ", DateInvoiced=" + m_dateInvoiced_From + "-" + m_dateInvoiced_To
+ ", DocumentNo=" + m_DocumentNo_From + "-" + m_DocumentNo_To);
+ ", DocumentNo=" + m_DocumentNo_From + "-" + m_DocumentNo_To
+ ", IsPaid=" + p_IsPaid
+ ", C_DocType_ID=" + m_C_DocType_ID);
MMailText mText = null;
if (p_R_MailText_ID != 0)
@ -377,6 +385,14 @@ public class InvoicePrint extends SvrProcess
/* if emailed to customer only select COmpleted & CLosed invoices */
sql.append(" AND i.DocStatus IN ('CO','CL') ");
}
if (p_IsPaid != null && p_IsPaid.length() == 1)
{
sql.append(" AND i.IsPaid='").append(p_IsPaid).append("'");
}
if (m_C_DocType_ID != 0)
{
sql.append (" AND i.C_DocTypeTarget_ID=").append(m_C_DocType_ID);
}
}
String orgWhere = MRole.getDefault(getCtx(), false).getOrgWhere(MRole.SQL_RO);
if (!Util.isEmpty(orgWhere, true)) {