Fixes issue 21746: Modified the SQL query definition.
authorDavid Miguelez <david.miguelez@openbravo.com>
Thu, 27 Sep 2012 11:57:35 +0200
changeset 18061 c2224e800e33
parent 18060 f11aaaf1781e
child 18062 4b455cfbbff4
Fixes issue 21746: Modified the SQL query definition.
src-db/database/sourcedata/AD_COLUMN.xml
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Tue Sep 25 13:12:50 2012 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Thu Sep 27 11:57:35 2012 +0200
@@ -292755,7 +292755,7 @@
 <!--F02817A43E904DF394E07DE81E98C767-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--F02817A43E904DF394E07DE81E98C767-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
 <!--F02817A43E904DF394E07DE81E98C767-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
-<!--F02817A43E904DF394E07DE81E98C767-->  <SQLLOGIC><![CDATA[(SELECT CASE WHEN to_number(max(p.paymentdate) -min(ps.origduedate)) > 0 THEN to_number(max(p.paymentdate) -min(ps.origduedate)) ELSE 0 END AS "case" FROM fin_payment_schedule ps LEFT JOIN fin_payment_scheduledetail psd ON ps.fin_payment_schedule_id =  psd.fin_payment_schedule_invoice LEFT JOIN fin_payment_detail pd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id LEFT JOIN fin_payment p ON p.fin_payment_id = pd.fin_payment_id WHERE ps.fin_payment_schedule_id = fin_payment_schedule_id)]]></SQLLOGIC>
+<!--F02817A43E904DF394E07DE81E98C767-->  <SQLLOGIC><![CDATA[(SELECT CASE WHEN to_number(trunc((case when max(ps.outstandingamt) = 0 then max(p.paymentdate) else now() end)) -trunc(min(ps.origduedate))) > 0 THEN to_number(trunc((case when max(ps.outstandingamt) = 0 then max(p.paymentdate) else now() end)) -trunc(min(ps.origduedate)))ELSE 0 END AS "case" FROM fin_payment_schedule ps LEFT JOIN fin_payment_scheduledetail psd ON ps.fin_payment_schedule_id =  psd.fin_payment_schedule_invoice LEFT JOIN fin_payment_detail pd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id LEFT JOIN fin_payment p ON p.fin_payment_id = pd.fin_payment_id WHERE ps.fin_payment_schedule_id = fin_payment_schedule_id)]]></SQLLOGIC>
 <!--F02817A43E904DF394E07DE81E98C767--></AD_COLUMN>
 
 <!--F038FDD2AAEC47AAA752573384DF5DCB--><AD_COLUMN>