Very poor performance on window Generate Invoice (manual) with RMA

Co-authored-by: erpzi <erpzi@zuelligindustrial.com>
This commit is contained in:
ERPZI 2021-08-05 17:19:38 +07:00 committed by GitHub
parent 2cee3ff007
commit 1e4e230f06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -132,9 +132,12 @@ public class InvoiceGen extends GenForm
sql.append("AND EXISTS (SELECT * from C_InvoiceLine il inner join M_InOutLine iol "); 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 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("on i.C_Invoice_ID=il.C_Invoice_ID where i.DocStatus IN ('CO', 'CL') ");
sql.append("AND iol.M_InOutLine_ID IN "); //MPo, 23/07/2020
sql.append("(SELECT M_InOutLine_ID from M_RMALine rl where rl.M_RMA_ID=rma.M_RMA_ID "); //sql.append("AND iol.M_InOutLine_ID IN ");
sql.append("AND rl.M_InOutLine_ID IS NOT NULL)) "); //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 EXISTS (SELECT 1 FROM m_rmaline rl WHERE rl.m_rma_id = rma.m_rma_id AND iol.m_inoutline_id = rl.m_inoutline_id AND rl.m_inoutline_id IS NOT null)) ");
//
sql.append("AND rma.AD_Client_ID=?"); sql.append("AND rma.AD_Client_ID=?");
if (m_AD_Org_ID != null) if (m_AD_Org_ID != null)