[Erp5-report] r32077 jerome - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_s...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 28 18:58:02 CET 2010


Author: jerome
Date: Thu Jan 28 18:58:02 2010
New Revision: 32077

URL: http://svn.erp5.org?rev=32077&view=rev
Log:
Fix bugs in Balance Sheet and Profit & Loss:
- Profit & Loss was showing negative value for profit or loss on previous period
- Profit & Loss was not showing previous period loss if current period is a profit
- Balance Sheet was not calculating properly net profit for previous period

Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewBalanceSheetReport.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewProfitAndLossReport.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewBalanceSheetReport.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewBalanceSheetReport.xml?rev=32077&r1=32076&r2=32077&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewBalanceSheetReport.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewBalanceSheetReport.xml [utf8] Thu Jan 28 18:58:02 2010
@@ -83,11 +83,13 @@
               at_date_previous_period python:modules["DateTime"].DateTime(at_date.year() - 1, at_date.month(), at_date.day()).latestTime();\n
               date_formatter nocall:here/Base_viewFieldLibrary/my_date/render_pdf;\n
               from_date python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date);\n
+              from_date_previous_period python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date_previous_period);\n
               portal_type here/getPortalAccountingMovementTypeList;\n
               section_uid python: context.Base_getSectionUidListForSectionCategory(request["section_category"]);\n
               financial_section python:context.getPortalObject().portal_categories.financial_section;\n
               getInventory python: lambda **kw: context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, portal_type=portal_type, **kw);\n
               getInventoryIncomeAccount python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, from_date=from_date, portal_type=portal_type, **kw);\n
+              getInventoryIncomeAccountPreviousPeriod python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date_previous_period, from_date=from_date_previous_period, portal_type=portal_type, **kw);\n
               getInventoryPreviousPeriod python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date_previous_period, portal_type=portal_type, **kw);\'\n
   office:version=\'1.0\'>\n
   <office:scripts/>\n
@@ -620,7 +622,27 @@
                         table:style-name=\'report-content-currency2\'>\n
                         <text:p></text:p>\n
                       </table:table-cell>\n
-                    </tal:block></tal:block>\n
+                  </tal:block>\n
+\n
+                  <!-- previous period -->\n
+                  <tal:block\n
+                      tal:define=\'value python: -getInventoryPreviousPeriod(node_category=node_category) - getInventoryIncomeAccountPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"]);\n
+                                  global total_prev_period python: total_prev_period + value;\'>\n
+                    <table:table-cell\n
+                      tal:condition=\'value\'\n
+                      tal:attributes=\'office:value value\'\n
+                      table:style-name=\'report-content-currency2\'\n
+                      office:value=\'123456.56\'\n
+                      office:value-type=\'float\'>\n
+                      <text:p>123 456,56</text:p>\n
+                    </table:table-cell>\n
+                    <table:table-cell\n
+                      tal:condition=\'not:value\'\n
+                      table:style-name=\'report-content-currency2\'>\n
+                      <text:p></text:p>\n
+                    </table:table-cell>\n
+                  </tal:block>\n
+                </tal:block>\n
 \n
                   <tal:block tal:condition=\'python: cat_level_1.getId() != "net_profit"\'>\n
                     <tal:block \n
@@ -640,7 +662,6 @@
                         <text:p></text:p>\n
                       </table:table-cell>\n
                     </tal:block>\n
-                  </tal:block>\n
 \n
                   <!-- previous period -->\n
                   <tal:block\n
@@ -660,6 +681,9 @@
                       <text:p></text:p>\n
                     </table:table-cell>\n
                   </tal:block>\n
+\n
+                  </tal:block>\n
+\n
                 </tal:block>\n
               </table:table-row>\n
             <!-- }}} -->\n
@@ -721,7 +745,27 @@
                         table:style-name=\'report-content-currency2\'>\n
                         <text:p></text:p>\n
                       </table:table-cell>\n
-                    </tal:block></tal:block>\n
+                  </tal:block>\n
+                \n
+                  <!-- previous period -->\n
+                  <tal:block\n
+                      tal:define=\'value python: -getInventoryPreviousPeriod(node_category=[node_category]) - getInventoryIncomeAccountPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"]);\n
+                      global total_prev_period python: total_prev_period + value;\'>\n
+                    <table:table-cell\n
+                      tal:condition=\'value\'\n
+                      tal:attributes=\'office:value value\'\n
+                      table:style-name=\'report-content-currency2\'\n
+                      office:value=\'123456.56\'\n
+                      office:value-type=\'float\'>\n
+                      <text:p>123 456,56</text:p>\n
+                    </table:table-cell>\n
+                    <table:table-cell\n
+                      tal:condition=\'not:value\'\n
+                      table:style-name=\'report-content-currency2\'>\n
+                      <text:p></text:p>\n
+                    </table:table-cell>\n
+                  </tal:block>\n
+                </tal:block>\n
 \n
                   <tal:block tal:condition=\'python: cat_level_2.getId() != "net_profit"\'>\n
                     <tal:block \n
@@ -741,7 +785,6 @@
                         <text:p></text:p>\n
                       </table:table-cell>\n
                     </tal:block>\n
-                  </tal:block>\n
 \n
                   <!-- previous period -->\n
                   <tal:block\n
@@ -761,6 +804,8 @@
                       <text:p></text:p>\n
                     </table:table-cell>\n
                   </tal:block>\n
+                  </tal:block>\n
+\n
               </table:table-row>\n
 \n
               <!-- }}} -->\n
@@ -797,7 +842,28 @@
                       <text:p></text:p>\n
                     </table:table-cell>\n
                    </tal:block>\n
-                  </tal:block>\n
+\n
+                  <!-- previous period -->\n
+                  <tal:block\n
+                      tal:define=\'value python: -getInventoryPreviousPeriod(node_category=[node_category]) - getInventoryIncomeAccountPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"]);\n
+                      global total_prev_period python: total_prev_period + value;\'>\n
+                    <table:table-cell\n
+                      tal:condition=\'value\'\n
+                      tal:attributes=\'office:value value\'\n
+                      table:style-name=\'report-content-currency3\'\n
+                      office:value=\'123456.56\'\n
+                      office:value-type=\'float\'>\n
+                      <text:p>123 456,56</text:p>\n
+                    </table:table-cell>\n
+                    <table:table-cell\n
+                      tal:condition=\'not:value\'\n
+                      table:style-name=\'report-content-currency3\'>\n
+                      <text:p></text:p>\n
+                    </table:table-cell>\n
+                  </tal:block>\n
+\n
+                  </tal:block>\n
+\n
                   <tal:block tal:condition=\'python: cat_level_3.getId() != "net_profit"\'>\n
                     <tal:block\n
                       tal:define=\'value python: -getInventory(node_category=node_category);\n
@@ -835,6 +901,7 @@
                       <text:p></text:p>\n
                     </table:table-cell>\n
                   </tal:block>\n
+\n
                 </tal:block>\n
               </tal:block>\n
             </table:table-row>\n

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewProfitAndLossReport.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewProfitAndLossReport.xml?rev=32077&r1=32076&r2=32077&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewProfitAndLossReport.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewProfitAndLossReport.xml [utf8] Thu Jan 28 18:58:02 2010
@@ -80,7 +80,7 @@
   xmlns:metal=\'http://xml.zope.org/namespaces/metal\'\n
   tal:attributes=\'dummy python:request.RESPONSE.setHeader("Content-Type", "text/html;; charset=utf-8")\'\n
   tal:define=\'at_date request/at_date/latestTime;\n
-              at_date_previous_period python:modules["DateTime"].DateTime(at_date.year() - 1, at_date.month(), at_date.day().latestTime());\n
+              at_date_previous_period python:modules["DateTime"].DateTime(at_date.year() - 1, at_date.month(), at_date.day()).latestTime();\n
               from_date python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date);\n
               from_date_previous_period python:context.Base_getAccountingPeriodStartDateForSectionCategory(section_category=request["section_category"], date=at_date_previous_period);\n
               portal_type here/getPortalAccountingMovementTypeList;\n
@@ -90,7 +90,7 @@
               getInventory python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date, from_date=from_date, portal_type=portal_type, **kw);\n
               getInventoryPreviousPeriod python: lambda **kw:context.portal_simulation.getInventoryAssetPrice(section_uid=section_uid, simulation_state=request["simulation_state"], function=request.get("function") or None, project=request.get("project") or None, at_date=at_date_previous_period, from_date=from_date_previous_period, portal_type=portal_type, **kw);\n
               net_income python:getInventory(node_category=["financial_section/income", "financial_section/expense"]);\n
-              net_income_previous_period python:getInventoryPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"])\'\n
+              net_income_previous_period python:getInventoryPreviousPeriod(node_category=["financial_section/income", "financial_section/expense"]);\'\n
   office:version=\'1.0\'>\n
   <office:scripts/>\n
   <office:font-face-decls>\n
@@ -486,7 +486,7 @@
       <!-- }}} -->\n
 \n
         <!-- NET PROFIT {{{ -->\n
-        <table:table-row tal:condition="python: net_income &lt; 0">\n
+        <table:table-row tal:condition="python: net_income &lt; 0 or net_income_previous_period &lt; 0">\n
           <table:table-cell table:style-name=\'report-stat2\'\n
                             office:value-type=\'string\'\n
                             table:number-rows-spanned=\'1\'\n
@@ -499,8 +499,8 @@
             tal:define="global grand_total_current_period python: grand_total_current_period - net_income"\n
             office:value-type=\'float\' office:value=\'123456.56\'><text:p>123 456,56</text:p></table:table-cell>\n
           <table:table-cell table:style-name=\'report-stat-currency2\'\n
-            tal:attributes="office:value python: net_income_previous_period"\n
-            tal:define="global grand_total_previous_period python: grand_total_previous_period + net_income_previous_period"\n
+            tal:attributes="office:value python: - net_income_previous_period"\n
+            tal:define="global grand_total_previous_period python: grand_total_previous_period - net_income_previous_period"\n
             office:value=\'\' office:value-type=\'float\'><text:p></text:p></table:table-cell>\n
         </table:table-row>\n
 \n
@@ -837,7 +837,7 @@
         <!-- }}} --> \n
 \n
         <!-- NET LOSS {{{ -->\n
-        <table:table-row tal:condition="python: net_income &gt; 0">\n
+        <table:table-row tal:condition="python: net_income &gt; 0 or net_income_previous_period &gt; 0">\n
           <table:table-cell table:style-name=\'report-stat2\'\n
                             office:value-type=\'string\'\n
                             table:number-rows-spanned=\'1\'\n

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=32077&r1=32076&r2=32077&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] Thu Jan 28 18:58:02 2010
@@ -1,1 +1,1 @@
-1090
+1091




More information about the Erp5-report mailing list