[Erp5-report] r23148 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/er...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Aug 25 17:03:17 CEST 2008


Author: jerome
Date: Mon Aug 25 17:03:12 2008
New Revision: 23148

URL: http://svn.erp5.org?rev=23148&view=rev
Log:
AccountModule_viewBalanceSheetReport:
- support profit & loss calculation when having only 1 level of equity categories
- take preference into account for date format
AccountModule_viewProfitAndLossReport:
- take preference into account for date format
- fix invalid ODF

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=23148&r1=23147&r2=23148&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewBalanceSheetReport.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewBalanceSheetReport.xml Mon Aug 25 17:03:12 2008
@@ -93,6 +93,7 @@
   tal:attributes=\'dummy python:request.RESPONSE.setHeader("Content-Type", "text/html;; charset=utf-8")\'\n
   tal:define=\'at_date request/at_date;\n
               at_date_previous_period python:modules["DateTime"].DateTime(at_date.year() - 1, at_date.month(), at_date.day());\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
               section_uid python: context.Base_getSectionUidListForSectionCategory(request["section_category"]);\n
               financial_section python:context.getPortalObject().portal_categories.financial_section;\n
@@ -203,10 +204,8 @@
         <table:table-row table:style-name=\'ro2\'>\n
           <table:table-cell table:style-name=\'ce1\'><text:p/></table:table-cell>\n
           <table:table-cell table:style-name=\'report-title-date\'\n
-                            table:number-rows-spanned=\'1\' table:number-columns-spanned=\'4\'\n
-                            office:value-type=\'date\' office:date-value=\'2004-04-05\'\n
-                            tal:attributes=\'office:date-value python:at_date.strftime("%Y-%m-%d")\'>\n
-            <text:p>Date</text:p>\n
+                table:number-rows-spanned=\'1\' table:number-columns-spanned=\'4\'>\n
+            <text:p tal:content="python: date_formatter(at_date)">Date</text:p>\n
           </table:table-cell>\n
           <table:covered-table-cell table:number-columns-repeated=\'2\'/>\n
           <table:covered-table-cell table:style-name=\'ce1\' table:number-columns-repeated=\'1\'/>\n
@@ -596,21 +595,87 @@
               <table:table-cell table:style-name=\'report-content-heading1\'\n
                                 table:number-columns-spanned=\'3\'\n
                                 table:number-rows-spanned=\'1\'\n
-                                office:value-type=\'string\'>\n
+                                office:value-type=\'string\'\n
+                                tal:define="global total_current_period python: 0;\n
+                                            global total_prev_period python: 0;">\n
                 <text:p tal:define="global level1_title cat_level_1/getTranslatedTitle" tal:content="level1_title">Level 1</text:p>\n
               </table:table-cell>\n
               <table:covered-table-cell table:style-name="ce9"/>\n
               <table:covered-table-cell table:style-name="ce9"/>\n
-              <table:table-cell table:style-name=\'report-content-currency1\'>\n
-                <text:p/></table:table-cell>\n
-              <table:table-cell table:style-name=\'report-content-currency1\'>\n
-                <text:p/></table:table-cell>\n
-            </table:table-row>\n
+              <tal:block tal:condition="cat_level_1/contentIds">\n
+                <table:table-cell table:style-name=\'report-content-currency1\'>\n
+                  <text:p/></table:table-cell>\n
+                <table:table-cell table:style-name=\'report-content-currency1\'>\n
+                  <text:p/></table:table-cell>\n
+              </tal:block>\n
+              <tal:block tal:condition="not: cat_level_1/contentIds"\n
+                         tal:define="node_category cat_level_1/getRelativeUrl;">\n
+\n
+                  <!-- current period:\n
+                  If the category have the special ID \'net_profit\', it will also contain the content of income & expense for this period\n
+                  -->\n
+                  <tal:block tal:condition=\'python: cat_level_1.getId() == "net_profit"\'>\n
+                    <tal:block \n
+                      tal:define=\'value python: -getInventory(node_category=[node_category]) - getInventoryIncomeAccount(node_category=["financial_section/income", "financial_section/expense"]);\n
+                                  global total_current_period python: total_current_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-type=\'float\'\n
+                        office:value=\'123456.56\'>\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></tal:block>\n
+\n
+                  <tal:block tal:condition=\'python: cat_level_1.getId() != "net_profit"\'>\n
+                    <tal:block \n
+                      tal:define=\'value python: -getInventory(node_category=node_category);\n
+                                  global total_current_period python: total_current_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-type=\'float\'\n
+                        office:value=\'123456.56\'>\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
+                  <!-- previous period -->\n
+                  <tal:block\n
+                      tal:define=\'value python: -getInventoryPreviousPeriod(node_category=node_category);\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
+              </table:table-row>\n
             <!-- }}} -->\n
           \n
             <!-- LEVEL 2 {{{ -->\n
-            <tal:block tal:define="global total_current_period python: 0;\n
-                                   global total_prev_period python: 0;">\n
               <tal:block tal:repeat="cat_level_2 python:cat_level_1.contentValues(sort_on=((\'int_index\', \'ascending\'),))">\n
               \n
               <!-- if we have sub content at level 3 to display, we will only display a title ...\n
@@ -785,7 +850,6 @@
               </tal:block>\n
             </table:table-row>\n
           </tal:block>\n
-          </tal:block>\n
         <!-- }}} --> \n
 \n
         <!-- TOTAL LEVEL 1 {{{ -->\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=23148&r1=23147&r2=23148&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewProfitAndLossReport.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewProfitAndLossReport.xml Mon Aug 25 17:03:12 2008
@@ -95,6 +95,7 @@
               at_date_previous_period python:modules["DateTime"].DateTime(at_date.year() - 1, at_date.month(), at_date.day());\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
+              date_formatter nocall:here/Base_viewFieldLibrary/my_date/render_pdf;\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"], at_date=at_date, from_date=from_date, **kw);\n
@@ -205,10 +206,8 @@
         <table:table-row table:style-name=\'ro2\'>\n
           <table:table-cell table:style-name=\'ce1\'><text:p/></table:table-cell>\n
           <table:table-cell table:style-name=\'report-title-date\'\n
-                            table:number-rows-spanned=\'1\' table:number-columns-spanned=\'4\'\n
-                            office:value-type=\'date\' office:date-value=\'2004-04-05\'\n
-                            tal:attributes=\'office:date-value python:at_date.strftime("%Y-%m-%d")\'>\n
-            <text:p>Date</text:p>\n
+                            table:number-rows-spanned=\'1\' table:number-columns-spanned=\'4\'>\n
+            <text:p tal:content="python:date_formatter(at_date)">Date</text:p>\n
           </table:table-cell>\n
           <table:covered-table-cell table:number-columns-repeated=\'2\'/>\n
           <table:covered-table-cell table:style-name=\'ce1\' table:number-columns-repeated=\'1\'/>\n
@@ -827,7 +826,7 @@
           <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
-            office:value=\'\' office:value-type=\'string\'><text:p></text:p></table:table-cell>\n
+            office:value=\'\' office:value-type=\'float\'><text:p></text:p></table:table-cell>\n
         </table:table-row>\n
 \n
         <!-- TOTAL LEVEL 2 {{{ -->\n

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=23148&r1=23147&r2=23148&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Mon Aug 25 17:03:12 2008
@@ -1,1 +1,1 @@
-741
+744




More information about the Erp5-report mailing list