Related to ISSUE-44780. Code Review changes:
authordavid.miguelez <david.miguelez@openbravo.com>
Wed, 12 Aug 2020 09:00:14 +0200
changeset 37508 89b0b6a30daf
parent 37507 19361bd9dc0e
child 37509 549b86216390
Related to ISSUE 44780. Code Review changes:
* Reorder fields in Aging Balance Processes
* In query to exclude reversed payments, do not use comparisons with DocumentNo
column, as it can lead to false positives. Check the fin_rev_payment_id
instead.
* Fix call to show PDF and XLS output with correct values
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
src/org/openbravo/erpCommon/ad_reports/AgingDao_data.xsql
src/org/openbravo/erpCommon/ad_reports/AgingScheduleDetailHTML.jrxml
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Tue Aug 11 12:43:41 2020 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Aug 12 09:00:14 2020 +0200
@@ -27641,6 +27641,20 @@
 <!--71283E5A24CB491CAA154094078D8323-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--71283E5A24CB491CAA154094078D8323--></AD_ELEMENT>
 
+<!--718CE226E80C460FBAD335B2E3D66381--><AD_ELEMENT>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <AD_ELEMENT_ID><![CDATA[718CE226E80C460FBAD335B2E3D66381]]></AD_ELEMENT_ID>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <COLUMNNAME><![CDATA[ShowReversed]]></COLUMNNAME>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <NAME><![CDATA[Reversed payments needs to be included]]></NAME>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <PRINTNAME><![CDATA[Reversed payments needs to be included]]></PRINTNAME>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <DESCRIPTION><![CDATA[Reversed payments needs to be included]]></DESCRIPTION>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <HELP><![CDATA[Reversed payments needs to be included]]></HELP>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--718CE226E80C460FBAD335B2E3D66381-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--718CE226E80C460FBAD335B2E3D66381--></AD_ELEMENT>
+
 <!--719F3857EC4B43BB9C29FCD9764F02AC--><AD_ELEMENT>
 <!--719F3857EC4B43BB9C29FCD9764F02AC-->  <AD_ELEMENT_ID><![CDATA[719F3857EC4B43BB9C29FCD9764F02AC]]></AD_ELEMENT_ID>
 <!--719F3857EC4B43BB9C29FCD9764F02AC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -27655,20 +27669,6 @@
 <!--719F3857EC4B43BB9C29FCD9764F02AC-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--719F3857EC4B43BB9C29FCD9764F02AC--></AD_ELEMENT>
 
-<!--718CE226E80C460FBAD335B2E3D66381--><AD_ELEMENT>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <AD_ELEMENT_ID><![CDATA[718CE226E80C460FBAD335B2E3D66381]]></AD_ELEMENT_ID>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <COLUMNNAME><![CDATA[ShowReversed]]></COLUMNNAME>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <NAME><![CDATA[Reversed payments needs to be included]]></NAME>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <PRINTNAME><![CDATA[Reversed payments needs to be included]]></PRINTNAME>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <DESCRIPTION><![CDATA[Reversed payments needs to be included]]></DESCRIPTION>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <HELP><![CDATA[Reversed payments needs to be included]]></HELP>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--718CE226E80C460FBAD335B2E3D66381-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
-<!--718CE226E80C460FBAD335B2E3D66381--></AD_ELEMENT>
-
 <!--71B1ABC309C8472D9153E2D447C1D929--><AD_ELEMENT>
 <!--71B1ABC309C8472D9153E2D447C1D929-->  <AD_ELEMENT_ID><![CDATA[71B1ABC309C8472D9153E2D447C1D929]]></AD_ELEMENT_ID>
 <!--71B1ABC309C8472D9153E2D447C1D929-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Tue Aug 11 12:43:41 2020 +0200
+++ b/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Wed Aug 12 09:00:14 2020 +0200
@@ -141,7 +141,7 @@
 <!--12B7D22C59ED48D685C27256F04BDEA1-->  <OBUIAPP_PROCESS_ID><![CDATA[0D37A9F6109549DEB058373EF2DAEB6A]]></OBUIAPP_PROCESS_ID>
 <!--12B7D22C59ED48D685C27256F04BDEA1-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
 <!--12B7D22C59ED48D685C27256F04BDEA1-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
-<!--12B7D22C59ED48D685C27256F04BDEA1-->  <NUMCOLUMN><![CDATA[3]]></NUMCOLUMN>
+<!--12B7D22C59ED48D685C27256F04BDEA1-->  <NUMCOLUMN><![CDATA[4]]></NUMCOLUMN>
 <!--12B7D22C59ED48D685C27256F04BDEA1-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--12B7D22C59ED48D685C27256F04BDEA1-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--12B7D22C59ED48D685C27256F04BDEA1-->  <ATT_SHOWINDESCRIPTION><![CDATA[N]]></ATT_SHOWINDESCRIPTION>
@@ -283,7 +283,7 @@
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <NAME><![CDATA[Voided invoices needs to be included]]></NAME>
-<!--2305516C1F794ED499EEDB3006C30DEF-->  <SEQNO><![CDATA[100]]></SEQNO>
+<!--2305516C1F794ED499EEDB3006C30DEF-->  <SEQNO><![CDATA[65]]></SEQNO>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <COLUMNNAME><![CDATA[ShowVoid]]></COLUMNNAME>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
@@ -296,7 +296,7 @@
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <OBUIAPP_PROCESS_ID><![CDATA[EB4C4053F3B94A17A08D1DD7E89CEB7E]]></OBUIAPP_PROCESS_ID>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <DISPLAYLOGIC><![CDATA[OB.PropertyStore.get('AGING_ShowVoidCheckbox')='Y']]></DISPLAYLOGIC>
-<!--2305516C1F794ED499EEDB3006C30DEF-->  <NUMCOLUMN><![CDATA[1]]></NUMCOLUMN>
+<!--2305516C1F794ED499EEDB3006C30DEF-->  <NUMCOLUMN><![CDATA[3]]></NUMCOLUMN>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--2305516C1F794ED499EEDB3006C30DEF-->  <ATT_SHOWINDESCRIPTION><![CDATA[N]]></ATT_SHOWINDESCRIPTION>
@@ -1071,7 +1071,7 @@
 <!--60B62F7555A246169121B3175AD8BD23-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--60B62F7555A246169121B3175AD8BD23-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--60B62F7555A246169121B3175AD8BD23-->  <NAME><![CDATA[Show Details]]></NAME>
-<!--60B62F7555A246169121B3175AD8BD23-->  <SEQNO><![CDATA[90]]></SEQNO>
+<!--60B62F7555A246169121B3175AD8BD23-->  <SEQNO><![CDATA[25]]></SEQNO>
 <!--60B62F7555A246169121B3175AD8BD23-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
 <!--60B62F7555A246169121B3175AD8BD23-->  <COLUMNNAME><![CDATA[Details]]></COLUMNNAME>
 <!--60B62F7555A246169121B3175AD8BD23-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
@@ -1082,7 +1082,7 @@
 <!--60B62F7555A246169121B3175AD8BD23-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--60B62F7555A246169121B3175AD8BD23-->  <OBUIAPP_PROCESS_ID><![CDATA[EB4C4053F3B94A17A08D1DD7E89CEB7E]]></OBUIAPP_PROCESS_ID>
 <!--60B62F7555A246169121B3175AD8BD23-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--60B62F7555A246169121B3175AD8BD23-->  <NUMCOLUMN><![CDATA[1]]></NUMCOLUMN>
+<!--60B62F7555A246169121B3175AD8BD23-->  <NUMCOLUMN><![CDATA[3]]></NUMCOLUMN>
 <!--60B62F7555A246169121B3175AD8BD23-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--60B62F7555A246169121B3175AD8BD23-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--60B62F7555A246169121B3175AD8BD23-->  <ATT_SHOWINDESCRIPTION><![CDATA[N]]></ATT_SHOWINDESCRIPTION>
@@ -2183,7 +2183,9 @@
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <NAME><![CDATA[Reversed payments needs to be included]]></NAME>
-<!--DAA2C7B78E604241A4706AF9D0AA725E-->  <SEQNO><![CDATA[95]]></SEQNO>
+<!--DAA2C7B78E604241A4706AF9D0AA725E-->  <DESCRIPTION><![CDATA[Reversed payments needs to be included]]></DESCRIPTION>
+<!--DAA2C7B78E604241A4706AF9D0AA725E-->  <HELP><![CDATA[Reversed payments needs to be included]]></HELP>
+<!--DAA2C7B78E604241A4706AF9D0AA725E-->  <SEQNO><![CDATA[115]]></SEQNO>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <COLUMNNAME><![CDATA[ShowReversed]]></COLUMNNAME>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
@@ -2196,7 +2198,7 @@
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <OBUIAPP_PROCESS_ID><![CDATA[0D37A9F6109549DEB058373EF2DAEB6A]]></OBUIAPP_PROCESS_ID>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <DISPLAYLOGIC><![CDATA[OB.PropertyStore.get('AGING_ShowReversedCheckbox')='Y']]></DISPLAYLOGIC>
-<!--DAA2C7B78E604241A4706AF9D0AA725E-->  <NUMCOLUMN><![CDATA[4]]></NUMCOLUMN>
+<!--DAA2C7B78E604241A4706AF9D0AA725E-->  <NUMCOLUMN><![CDATA[3]]></NUMCOLUMN>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--DAA2C7B78E604241A4706AF9D0AA725E-->  <ATT_SHOWINDESCRIPTION><![CDATA[N]]></ATT_SHOWINDESCRIPTION>
@@ -2262,7 +2264,7 @@
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <NAME><![CDATA[Reversed payments needs to be included]]></NAME>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <DESCRIPTION><![CDATA[Reversed payments needs to be included]]></DESCRIPTION>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <HELP><![CDATA[Reversed payments needs to be included]]></HELP>
-<!--DCFC931AFC124D67B39F57978A83BE3D-->  <SEQNO><![CDATA[110]]></SEQNO>
+<!--DCFC931AFC124D67B39F57978A83BE3D-->  <SEQNO><![CDATA[85]]></SEQNO>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <COLUMNNAME><![CDATA[ShowReversed]]></COLUMNNAME>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
@@ -2275,6 +2277,7 @@
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <OBUIAPP_PROCESS_ID><![CDATA[EB4C4053F3B94A17A08D1DD7E89CEB7E]]></OBUIAPP_PROCESS_ID>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <DISPLAYLOGIC><![CDATA[OB.PropertyStore.get('AGING_ShowReversedCheckbox')='Y']]></DISPLAYLOGIC>
+<!--DCFC931AFC124D67B39F57978A83BE3D-->  <NUMCOLUMN><![CDATA[3]]></NUMCOLUMN>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--DCFC931AFC124D67B39F57978A83BE3D-->  <ATT_SHOWINDESCRIPTION><![CDATA[N]]></ATT_SHOWINDESCRIPTION>
--- a/src/org/openbravo/erpCommon/ad_reports/AgingDao_data.xsql	Tue Aug 11 12:43:41 2020 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/AgingDao_data.xsql	Wed Aug 12 09:00:14 2020 +0200
@@ -185,7 +185,7 @@
     <Parameter name="asOfDate"/>
     <Parameter name="recOrPay"/>
     <Parameter name="cbPartnerId" optional="true" type="argument" after="AND 2=2"><![CDATA[ AND fp2.C_BPARTNER_ID IN]]></Parameter>
-    <Parameter name="excludeReverseds" type="none" optional="true" after="AND 2=2" text=" AND (fp2.fin_rev_payment_id is null AND fp2.documentno not like ('*R*%'))"/>
+    <Parameter name="excludeReverseds" type="none" optional="true" after="AND 2=2" text=" AND (fp2.fin_rev_payment_id is null AND NOT EXISTS (SELECT 1 FROM fin_payment WHERE fin_rev_payment_id = fp2.fin_payment_id))"/>
     <Parameter name="asOfDate"/>
     <Parameter name="paidStatus" type="replace" optional="true" after="OR ( fp1.status IN (" text="'1'"/>
     <Parameter name="pgLimit" type="argument" optional="true" after=") B"><![CDATA[LIMIT ]]></Parameter>
--- a/src/org/openbravo/erpCommon/ad_reports/AgingScheduleDetailHTML.jrxml	Tue Aug 11 12:43:41 2020 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/AgingScheduleDetailHTML.jrxml	Wed Aug 12 09:00:14 2020 +0200
@@ -460,7 +460,8 @@
 		+"    Doubtful:\'"+$P{showDoubtfulDebt}+"\',"
 		+"    Organization:\'"+$P{organizationID}+"\',"
 		+"    RecOrPay:\'"+$P{recOrPay}+"\',"
-		+"    ShowVoid:\'"+$P{void}+"\'"
+		+"    ShowVoid:\'"+$P{void}+"\',"
+		+"    ShowReversed:\'"+$P{reversed}+"\'"
 		+"  }"
 		+"},"
 		+"{"
@@ -495,7 +496,8 @@
 		+"    Doubtful:\'"+$P{showDoubtfulDebt}+"\',"
 		+"    Organization:\'"+$P{organizationID}+"\',"
 		+"    RecOrPay:\'"+$P{recOrPay}+"\',"
-		+"    ShowVoid:\'"+$P{void}+"\'"
+		+"    ShowVoid:\'"+$P{void}+"\',"
+		+"    ShowReversed:\'"+$P{reversed}+"\'"
 		+"  }"
 		+"},"
 		+"{"