bug in subselect to find first line. Must match also product not only invoice

This commit is contained in:
marekmosiewicz 2006-12-01 13:37:48 +00:00
parent 947138c8eb
commit e898568505
1 changed files with 2 additions and 1 deletions

View File

@ -933,7 +933,8 @@ public class Doc_Invoice extends Doc
+ " currencyConvert(il.LineNetAmt,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),il.QtyInvoiced "
+ "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
+ " AND il.c_invoiceline_id = (SELECT MIN(C_InvoiceLine_ID) FROM C_InvoiceLine WHERE C_Invoice_ID=")
+ " AND il.c_invoiceline_id = (SELECT MIN(C_InvoiceLine_ID) FROM C_InvoiceLine il2" +
" WHERE il2.M_PRODUCT_ID=il.M_PRODUCT_ID AND C_Invoice_ID=")
.append(get_ID()).append(")"
+ " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
+ " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=")