IDEMPIERE-690 No Validation in Create Invoice Credit Memo for Customer RMA

This commit is contained in:
Juliana Corredor 2013-04-20 18:13:40 -05:00
parent 761cc1e77e
commit 964d9e7c52
1 changed files with 20 additions and 18 deletions

View File

@ -13,6 +13,9 @@
*****************************************************************************/
package org.compiere.apps.form;
import static org.compiere.model.SystemIDs.PROCESS_C_INVOICE_GENERATERMA_MANUAL;
import static org.compiere.model.SystemIDs.PROCESS_C_INVOICE_GENERATE_MANUAL;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -29,7 +32,6 @@ import org.compiere.model.MPInstance;
import org.compiere.model.MPInstancePara;
import org.compiere.model.MPrivateAccess;
import org.compiere.model.MRMA;
import static org.compiere.model.SystemIDs.*;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger;
@ -127,22 +129,22 @@ public class InvoiceGen extends GenForm
private String getRMASql()
{
StringBuilder sql = new StringBuilder();
sql.append("SELECT rma.M_RMA_ID, org.Name, dt.Name, rma.DocumentNo, bp.Name, rma.Created, rma.Amt ");
sql.append("FROM M_RMA rma INNER JOIN AD_Org org ON rma.AD_Org_ID=org.AD_Org_ID ");
sql.append("INNER JOIN C_DocType dt ON rma.C_DocType_ID=dt.C_DocType_ID ");
sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID ");
sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID ");
sql.append("WHERE rma.DocStatus='CO' ");
sql.append("AND dt.DocBaseType = 'SOO' ");
// sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i ");
// sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
// sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol ");
// sql.append("ON il.M_InOutLine_ID=iol.M_InOutLine_ID INNER JOIN C_Invoice i ");
// sql.append("ON i.C_Invoice_ID=il.C_Invoice_ID WHERE i.DocStatus IN ('CO', 'CL') ");
// sql.append("AND iol.M_InOutLine_ID IN ");
// sql.append("(SELECT M_InOutLine_ID FROM M_RMALine rl WHERE rl.M_RMA_ID=rma.M_RMA_ID ");
// sql.append("AND rl.M_InOutLine_ID IS NOT NULL)) ");
sql.append("AND rma.AD_Client_ID=?");
sql.append("SELECT rma.M_RMA_ID, org.Name, dt.Name, rma.DocumentNo, bp.Name, rma.Created, rma.Amt ");
sql.append("FROM M_RMA rma INNER JOIN AD_Org org ON rma.AD_Org_ID=org.AD_Org_ID ");
sql.append("INNER JOIN C_DocType dt ON rma.C_DocType_ID=dt.C_DocType_ID ");
sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID ");
sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID ");
sql.append("WHERE rma.DocStatus='CO' ");
sql.append("AND dt.DocBaseType = 'SOO' ");
sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i ");
sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol ");
sql.append("ON il.M_InOutLine_ID=iol.M_InOutLine_ID INNER JOIN C_Invoice i ");
sql.append("ON i.C_Invoice_ID=il.C_Invoice_ID WHERE i.DocStatus IN ('CO', 'CL') ");
sql.append("AND iol.M_InOutLine_ID IN ");
sql.append("(SELECT M_InOutLine_ID FROM M_RMALine rl WHERE rl.M_RMA_ID=rma.M_RMA_ID ");
sql.append("AND rl.M_InOutLine_ID IS NOT NULL)) ");
sql.append("AND rma.AD_Client_ID=?");
if (m_AD_Org_ID != null)
sql.append(" AND rma.AD_Org_ID=").append(m_AD_Org_ID);