You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ap...@apache.org on 2009/08/10 18:10:20 UTC

svn commit: r802840 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/ledger/ webapp/accounting/WEB-INF/ webapp/accounting/reports/ widget/

Author: apatel
Date: Mon Aug 10 16:10:19 2009
New Revision: 802840

URL: http://svn.apache.org/viewvc?rev=802840&view=rev
Log:
Pdf export of Cost Center reports.

Added:
    ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl   (with props)
Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.ftl
    ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=802840&r1=802839&r2=802840&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Mon Aug 10 16:10:19 2009
@@ -2522,10 +2522,12 @@
             <set field="fromDate" from-field="customTimePeriod.fromDate" type="Timestamp"/>
             <set field="thruDate" from-field="customTimePeriod.thruDate" type="Timestamp"/>
         </if-empty>
-
+        <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
+        <set field="partyIds" value="${groovy:org.ofbiz.party.party.PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')}" type="List"/>
+        <set field="partyIds[]" from-field="organizationPartyId"/>
         <entity-condition entity-name="GlAccountOrganization" list="glAccountOrganizations" use-cache="true">
             <condition-list>
-                <condition-expr field-name="organizationPartyId" from-field="parameters.organizationPartyId"/>
+                <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/>
                 <condition-expr field-name="postedBalance" operator="not-equals" value=""/>
                 <condition-list combine="or">
                     <condition-expr field-name="fromDate" operator="greater-equals" from-field="fromDate"/>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=802840&r1=802839&r2=802840&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Mon Aug 10 16:10:19 2009
@@ -2396,6 +2396,12 @@
         <response name="success" type="view" value="CostCenterReport"/>
         <response name="error" type="view" value="CostCenterReport"/>
     </request-map>
+
+    <request-map uri="CostCentersReport.pdf">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="CostCentersReportPdf"/>
+    </request-map>
+
     <!-- end of request mappings -->
 
     <!-- View Mappings -->
@@ -2686,5 +2692,7 @@
     <view-map name="EditGlAccountCategoryMember" type="screen" page="component://accounting/widget/GlSetupScreens.xml#EditGlAccountCategoryMember"/>
     <view-map name="CostCenters" type="screen" page="component://accounting/widget/GlobalGlAccountsScreens.xml#CostCenters"/>
     <view-map name="CostCenterReport" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CostCenterReport"/>
+    <view-map name="CostCentersReportPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CostCentersReportPdf" content-type="application/pdf" encoding="none"/>
+    
     <!-- end of view mappings -->
 </site-conf>

Added: ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl?rev=802840&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl (added)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl Mon Aug 10 16:10:19 2009
@@ -0,0 +1,70 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<#escape x as x?xml>
+    <#if glAcctgOrgAndCostCenterMapList?has_content && glAccountCategories?has_content>
+        <fo:table border="1pt solid" border-width=".1mm" width="19cm">
+            <fo:table-header>
+                <fo:table-cell border="1pt solid" border-width=".1mm">
+                    <fo:block text-align="center">${uiLabelMap.FormFieldTitle_glAccountId}</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="1pt solid" border-width=".1mm">
+                    <fo:block text-align="center">${uiLabelMap.FormFieldTitle_accountCode}</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="1pt solid" border-width=".1mm">
+                    <fo:block text-align="center">${uiLabelMap.FormFieldTitle_accountName}</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="1pt solid" border-width=".1mm">
+                    <fo:block text-align="center">${uiLabelMap.FormFieldTitle_postedBalance} - (${currencyUomId?if_exists})</fo:block>
+                </fo:table-cell>
+                <#list glAccountCategories as glAccountCategory>
+                    <fo:table-cell border="1pt solid" border-width=".1mm">
+                        <fo:block text-align="center">${glAccountCategory.description?if_exists} - (${currencyUomId?if_exists})</fo:block>
+                    </fo:table-cell>
+                </#list>
+            </fo:table-header>
+            <fo:table-body>
+                <#list glAcctgOrgAndCostCenterMapList as glAcctgOrgAndCostCenterMap>
+                    <#if glAcctgOrgAndCostCenterMap?has_content>
+                        <fo:table-row>
+                            <fo:table-cell border="1pt solid" border-width=".1mm">
+                                <fo:block text-align="center">${glAcctgOrgAndCostCenterMap.glAccountId?if_exists}</fo:block>
+                            </fo:table-cell>
+                            <fo:table-cell border="1pt solid" border-width=".1mm">
+                                <fo:block text-align="center">${glAcctgOrgAndCostCenterMap.accountCode?if_exists}</fo:block>
+                            </fo:table-cell>
+                            <fo:table-cell border="1pt solid" border-width=".1mm">
+                                <fo:block text-align="center">${glAcctgOrgAndCostCenterMap.accountName?if_exists}</fo:block>
+                            </fo:table-cell>
+                            <fo:table-cell border="1pt solid" border-width=".1mm">
+                                <fo:block text-align="center">${glAcctgOrgAndCostCenterMap.postedBalance?if_exists!}</fo:block>
+                            </fo:table-cell>
+                            <#list glAccountCategories as glAccountCategory>
+                                <fo:table-cell border="1pt solid" border-width=".1mm">
+                                    <fo:block text-align="center">${(glAcctgOrgAndCostCenterMap[glAccountCategory.glAccountCategoryId?if_exists]?if_exists)}</fo:block>
+                                </fo:table-cell>
+                            </#list>
+                        </fo:table-row>
+                    </#if>
+                </#list>
+            </fo:table-body>
+        </fo:table>
+    <#else>
+        <fo:block text-align="center">${uiLabelMap.AccountingNoRecordFound}</fo:block>
+    </#if>
+</#escape>

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.ftl?rev=802840&r1=802839&r2=802840&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/reports/CostCentersReport.ftl Mon Aug 10 16:10:19 2009
@@ -18,6 +18,13 @@
 under the License.
 -->
 <#if glAcctgOrgAndCostCenterMapList?has_content && glAccountCategories?has_content>
+  <form name="costCentersReportPdfForm" method="post" action="<@o...@ofbizUrl>">
+    <input type="hidden" name="organizationPartyId" value="${parameters.organizationPartyId}"/>
+    <input type="hidden" name="fromDate" value="${parameters.fromDate}"/>
+    <input type="hidden" name="thruDate" value="${parameters.thruDate}"/>
+    <input type="hidden" name="timePeriod" value="${parameters.timePeriod}"/>
+    <a href="javascript:document.costCentersReportPdfForm.submit();" class="buttontext">${uiLabelMap.AccountingExportAsPdf}</a>
+  </form>
   <table class="basic-table hover-bar" cellspacing="0">
     <tr class="header-row">
       <th>${uiLabelMap.FormFieldTitle_glAccountId}</th>

Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=802840&r1=802839&r2=802840&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Mon Aug 10 16:10:19 2009
@@ -1065,11 +1065,13 @@
                                 </or>
                             </condition>
                             <widgets>
-                                <platform-specific>
-                                    <html>
-                                        <html-template location="component://accounting/webapp/accounting/reports/CostCentersReport.ftl"/>
-                                    </html>
-                                </platform-specific>
+                                <screenlet title="${uiLabelMap.FormFieldTitle_costCenters}">
+                                    <platform-specific>
+                                        <html>
+                                            <html-template location="component://accounting/webapp/accounting/reports/CostCentersReport.ftl"/>
+                                        </html>
+                                    </platform-specific>
+                                </screenlet>
                             </widgets>
                         </section>
                     </decorator-section>
@@ -1077,4 +1079,32 @@
             </widgets>
         </section>
     </screen>
+
+    <screen name="CostCentersReportPdf">
+        <section>
+            <actions>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
+                <service service-name="getPartyAccountingPreferences" result-map="result" auto-field-map="true"/>
+                <set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
+                <set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
+                <entity-condition entity-name="GlAccountCategory" list="glAccountCategories">
+                    <condition-expr field-name="glAccountCategoryTypeId" operator="equals" value="COST_CENTER"/>
+                </entity-condition>
+                <service service-name="getGlAcctgOrgWithPostedBalanceSplit" result-map="result" auto-field-map="true"/>
+                <set field="glAcctgOrgAndCostCenterMapList" from-field="result.glAcctgOrgAndCostCenterMapList" type="List"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="SimpleDecorator" location="component://common/widget/CommonScreens.xml">
+                    <decorator-section name="body">
+                            <platform-specific>
+                                <xsl-fo>
+                                    <html-template location="component://accounting/webapp/accounting/reports/CostCentersReport.fo.ftl"/>
+                                </xsl-fo>
+                            </platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 </screens>