ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaco...@apache.org
Subject svn commit: r609356 - in /ofbiz/trunk/applications/accounting: config/ script/org/ofbiz/accounting/ledger/ servicedef/ webapp/accounting/WEB-INF/ widget/
Date Sun, 06 Jan 2008 17:59:08 GMT
Author: jacopoc
Date: Sun Jan  6 09:59:05 2008
New Revision: 609356

URL: http://svn.apache.org/viewvc?rev=609356&view=rev
Log:
Misc fixes for the gl auto posting services.
Very first and incomplete version of the comparative balance sheet.

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/widget/Menus.xml
    ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml
    ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties?rev=609356&r1=609355&r2=609356&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties Sun Jan  6 09:59:05
2008
@@ -130,6 +130,7 @@
 AccountingCompanyNameAccount=Company Name on Account
 AccountingCompanyNameCard=Company Name on Card
 AccountingCompanySubtitle=Part of the Open For Business Family of Open Source Software
+AccountingComparativeBalanceSheet=Comparative Balance Sheet
 AccountingCopyAgreement=Copy Agreement
 AccountingCouldNotFindGlAccount=Could not find GlAccount with ID
 AccountingCreateAcctgTransAndEntries=Quick Create an Accounting Transaction

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=609356&r1=609355&r2=609356&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
Sun Jan  6 09:59:05 2008
@@ -487,10 +487,18 @@
             </condition>
             <then>
                 <if-not-empty field-name="parameters.productId">
-                    <entity-one entity-name="GlAccountTypeDefault" value-name="glAccountTypeDefault"
use-cache="true">
-                        <field-map field-name="organizationPartyId" env-name="parameters.organizationPartyId"/>
-                        <field-map field-name="glAccountTypeId" value="SALES_ACCOUNT"/>
-                    </entity-one>
+                    <if-compare field-name="parameters.acctgTransTypeId" operator="equals"
value="PURCHASE_INVOICE">
+                        <entity-one entity-name="GlAccountTypeDefault" value-name="glAccountTypeDefault"
use-cache="true">
+                            <field-map field-name="organizationPartyId" env-name="parameters.organizationPartyId"/>
+                            <field-map field-name="glAccountTypeId" value="UNINVOICED_SHIP_RCPT"/>
+                        </entity-one>
+                    <else>
+                        <entity-one entity-name="GlAccountTypeDefault" value-name="glAccountTypeDefault"
use-cache="true">
+                            <field-map field-name="organizationPartyId" env-name="parameters.organizationPartyId"/>
+                            <field-map field-name="glAccountTypeId" value="SALES_ACCOUNT"/>
+                        </entity-one>
+                    </else>
+                    </if-compare>
                     <if-not-empty field-name="glAccountTypeDefault.glAccountId">
                         <field-to-result field-name="glAccountTypeDefault.glAccountId"
result-name="glAccountId"/>
                         <return/>
@@ -514,7 +522,6 @@
                 <return/>
             </then>
         </if>
-
         <!-- if nothing found or if no such parameters were passed (lookedUpValue empty
in both cases), try GlAccountTypeDefault -->
         <if-empty field-name="lookedUpValue.glAccountId">
             <entity-one entity-name="GlAccountTypeDefault" value-name="lookedUpValue"
use-cache="true"/> 
@@ -1134,6 +1141,95 @@
         <field-to-result field-name="equityBalancesList" result-name="equityBalancesList"/>
     </simple-method>
 
+    <simple-method method-name="prepareComparativeBalanceSheet" short-description="Prepare
data for the Comparative Balance Sheet">
+        <set field="prepareBalanceSheetInMap.organizationPartyId" from-field="parameters.organizationPartyId"/>
+        <set field="prepareBalanceSheetInMap.glFiscalTypeId" from-field="parameters.period1GlFiscalTypeId"/>
+        <set field="prepareBalanceSheetInMap.thruDate" from-field="parameters.period1ThruDate"/>
+        <call-service service-name="prepareBalanceSheet" in-map-name="prepareBalanceSheetInMap">
+            <result-to-field result-name="assetBalancesList" field-name="period1AssetBalancesList"/>
+            <result-to-field result-name="liabilityBalancesList" field-name="period1LiabilityBalancesList"/>
+            <result-to-field result-name="equityBalancesList" field-name="period1EquityBalancesList"/>
+        </call-service>
+        <set field="prepareBalanceSheetInMap.glFiscalTypeId" from-field="parameters.period2GlFiscalTypeId"/>
+        <set field="prepareBalanceSheetInMap.thruDate" from-field="parameters.period2ThruDate"/>
+        <call-service service-name="prepareBalanceSheet" in-map-name="prepareBalanceSheetInMap">
+            <result-to-field result-name="assetBalancesList" field-name="period2AssetBalancesList"/>
+            <result-to-field result-name="liabilityBalancesList" field-name="period2LiabilityBalancesList"/>
+            <result-to-field result-name="equityBalancesList" field-name="period2EquityBalancesList"/>
+        </call-service>
+
+        <iterate list-name="period2AssetBalancesList" entry-name="period2AssetBalance">
+            <set field="assetBalancesMap.${period2AssetBalance.glAccountId}" from-field="period2AssetBalance.totalAmount"
type="Double"/>
+        </iterate>
+        <iterate list-name="period1AssetBalancesList" entry-name="period1AssetBalance">
+            <set field="amount" from-field="period1AssetBalance.totalAmount" type="Double"/>
+            <calculate field-name="amount">
+                <calcop field-name="amount" operator="negative"/>
+            </calculate>
+            <if-empty field-name="assetBalancesMap.${period1AssetBalance.glAccountId}">
+                <set field="assetBalancesMap.${period1AssetBalance.glAccountId}" value="0.0"
type="Double"/>
+            </if-empty>
+            <calculate field-name="assetBalancesMap.${period1AssetBalance.glAccountId}"
type="Double">
+                <calcop field-name="assetBalancesMap.${period1AssetBalance.glAccountId}"
operator="add"><calcop field-name="amount" operator="get"/></calcop>
+            </calculate>
+        </iterate>
+
+        <iterate list-name="period2LiabilityBalancesList" entry-name="period2LiabilityBalance">
+            <set field="liabilityBalancesMap.${period2LiabilityBalance.glAccountId}" from-field="period2LiabilityBalance.totalAmount"
type="Double"/>
+        </iterate>
+        <iterate list-name="period1LiabilityBalancesList" entry-name="period1LiabilityBalance">
+            <set field="amount" from-field="period1LiabilityBalance.totalAmount" type="Double"/>
+            <calculate field-name="amount">
+                <calcop field-name="amount" operator="negative"/>
+            </calculate>
+            <if-empty field-name="liabilityBalancesMap.${period1LiabilityBalance.glAccountId}">
+                <set field="liabilityBalancesMap.${period1LiabilityBalance.glAccountId}"
value="0.0" type="Double"/>
+            </if-empty>
+            <calculate field-name="liabilityBalancesMap.${period1LiabilityBalance.glAccountId}"
type="Double">
+                <calcop field-name="liabilityBalancesMap.${period1LiabilityBalance.glAccountId}"
operator="add"><calcop field-name="amount" operator="get"/></calcop>
+            </calculate>
+        </iterate>
+
+        <iterate list-name="period2EquityBalancesList" entry-name="period2EquityBalance">
+            <set field="equityBalancesMap.${period2EquityBalance.glAccountId}" from-field="period2EquityBalance.totalAmount"
type="Double"/>
+        </iterate>
+        <iterate list-name="period1EquityBalancesList" entry-name="period1EquityBalance">
+            <set field="amount" from-field="period1EquityBalance.totalAmount" type="Double"/>
+            <calculate field-name="amount">
+                <calcop field-name="amount" operator="negative"/>
+            </calculate>
+            <if-empty field-name="equityBalancesMap.${period1EquityBalance.glAccountId}">
+                <set field="equityBalancesMap.${period1EquityBalance.glAccountId}" value="0.0"
type="Double"/>
+            </if-empty>
+            <calculate field-name="equityBalancesMap.${period1EquityBalance.glAccountId}"
type="Double">
+                <calcop field-name="equityBalancesMap.${period1EquityBalance.glAccountId}"
operator="add"><calcop field-name="amount" operator="get"/></calcop>
+            </calculate>
+        </iterate>
+
+        <iterate-map map-name="assetBalancesMap" key-name="glAccountId" value-name="totalAmount">
+            <clear-field field-name="glAccountTotalMap"/>
+            <set field="glAccountTotalMap.glAccountId" from-field="glAccountId"/>
+            <set field="glAccountTotalMap.totalAmount" from-field="totalAmount"/>
+            <set field="assetBalancesList[]" from-field="glAccountTotalMap"/>
+        </iterate-map>
+        <iterate-map map-name="liabilityBalancesMap" key-name="glAccountId" value-name="totalAmount">
+            <clear-field field-name="glAccountTotalMap"/>
+            <set field="glAccountTotalMap.glAccountId" from-field="glAccountId"/>
+            <set field="glAccountTotalMap.totalAmount" from-field="totalAmount"/>
+            <set field="liabilityBalancesList[]" from-field="glAccountTotalMap"/>
+        </iterate-map>
+        <iterate-map map-name="equityBalancesMap" key-name="glAccountId" value-name="totalAmount">
+            <clear-field field-name="glAccountTotalMap"/>
+            <set field="glAccountTotalMap.glAccountId" from-field="glAccountId"/>
+            <set field="glAccountTotalMap.totalAmount" from-field="totalAmount"/>
+            <set field="equityBalancesList[]" from-field="glAccountTotalMap"/>
+        </iterate-map>
+
+        <field-to-result field-name="assetBalancesList" result-name="assetBalancesList"/>
+        <field-to-result field-name="liabilityBalancesList" result-name="liabilityBalancesList"/>
+        <field-to-result field-name="equityBalancesList" result-name="equityBalancesList"/>
+    </simple-method>
+
     <!-- Services for the automatic creation of accounting transactions based on business
transactions
          Typically, these services are triggered by SECAs -->
 
@@ -1727,12 +1823,13 @@
         <property-to-field resource="arithmetic" property="ledger.rounding" field-name="roundingMode"/>
         <log level="info" message="Using ledger decimals [${ledgerDecimals}] and rounding
[${roundingMode}]"/>
         <set field="totalAmountFromInvoice" type="BigDecimal" value="0"/>
-        <set field="amountFromOrder" type="BigDecimal" value="0"/>
         
         <entity-one entity-name="Invoice" value-name="invoice"/>
         <if-compare field-name="invoice.invoiceTypeId" operator="equals" value="PURCHASE_INVOICE">
             <get-related value-name="invoice" relation-name="InvoiceItem" list-name="invoiceItems"/>
             <iterate list-name="invoiceItems" entry-name="invoiceItem">
+                <set field="amountFromOrder" type="BigDecimal" value="0"/>
+                <set field="amountFromInvoice" type="BigDecimal" value="0"/>
                 <if-empty field-name="invoiceItem.quantity">
                     <set field="invoiceItem.quantity" value="1"/>
                 </if-empty>
@@ -1819,6 +1916,7 @@
             <!-- Set header fields (AcctgTrans) -->
             <set field="createAcctgTransAndEntriesInMap.glFiscalTypeId" value="ACTUAL"/>
             <set field="createAcctgTransAndEntriesInMap.acctgTransTypeId" value="PURCHASE_INVOICE"/>
+            <set field="createAcctgTransAndEntriesInMap.invoiceId" from-field="invoice.invoiceId"/>
             <set field="createAcctgTransAndEntriesInMap.partyId" from-field="invoice.partyIdFrom"/>
             <set field="createAcctgTransAndEntriesInMap.roleTypeId" value="BILL_FROM_VENDOR"/>
             <set field="createAcctgTransAndEntriesInMap.acctgTransEntries" from-field="acctgTransEntries"/>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=609356&r1=609355&r2=609356&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Sun Jan  6 09:59:05
2008
@@ -309,6 +309,18 @@
         <attribute name="liabilityBalancesList" type="List" mode="OUT" optional="true"/>
         <attribute name="equityBalancesList" type="List" mode="OUT" optional="true"/>
     </service>
+    <service name="prepareComparativeBalanceSheet" engine="simple" 
+        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="prepareComparativeBalanceSheet"
auth="true">
+        <description>Prepare the data for the Balance Sheet</description>
+        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
+        <attribute name="period1ThruDate" type="Timestamp" mode="IN" optional="false"/>
+        <attribute name="period1GlFiscalTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="period2ThruDate" type="Timestamp" mode="IN" optional="false"/>
+        <attribute name="period2GlFiscalTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="assetBalancesList" type="List" mode="OUT" optional="true"/>
+        <attribute name="liabilityBalancesList" type="List" mode="OUT" optional="true"/>
+        <attribute name="equityBalancesList" type="List" mode="OUT" optional="true"/>
+    </service>
 
     <!-- Miscellaneous Ledger-related services -->
     <service name="getGlAccountFromAccountType" engine="simple" 

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=609356&r1=609355&r2=609356&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Sun Jan 
6 09:59:05 2008
@@ -1727,6 +1727,13 @@
         <response name="success" type="view" value="BalanceSheet"/>
         <response name="error" type="view" value="BalanceSheet"/>         
     </request-map>
+    <request-map uri="ComparativeBalanceSheet"><security https="true" auth="true"/><response
name="success" type="view" value="ComparativeBalanceSheet"/></request-map>
+    <request-map uri="prepareComparativeBalanceSheet">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="prepareComparativeBalanceSheet"/>
+        <response name="success" type="view" value="ComparativeBalanceSheet"/>
+        <response name="error" type="view" value="ComparativeBalanceSheet"/>      
  
+    </request-map>
     <request-map uri="TransactionTotals"><security https="true" auth="true"/><response
name="success" type="view" value="TransactionTotals"/></request-map>
     <!-- end of request mappings -->
 
@@ -1918,6 +1925,7 @@
     <view-map name="TrialBalance" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#TrialBalance"/>
     <view-map name="IncomeStatement" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#IncomeStatement"/>
     <view-map name="BalanceSheet" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#BalanceSheet"/>
+    <view-map name="ComparativeBalanceSheet" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeBalanceSheet"/>
     <view-map name="TransactionTotals" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#TransactionTotals"/>
     
     <!-- Assignment Mappings -->

Modified: ofbiz/trunk/applications/accounting/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/Menus.xml?rev=609356&r1=609355&r2=609356&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/Menus.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/Menus.xml Sun Jan  6 09:59:05 2008
@@ -454,6 +454,9 @@
         <menu-item name="BalanceSheet" title="${uiLabelMap.AccountingBalanceSheet}">
             <link target="BalanceSheet?organizationPartyId=${organizationPartyId}"/>
         </menu-item>
+        <menu-item name="ComparativeBalanceSheet" title="${uiLabelMap.AccountingComparativeBalanceSheet}">
+            <link target="ComparativeBalanceSheet?organizationPartyId=${organizationPartyId}"/>
+        </menu-item>
         <menu-item name="TransactionTotals" title="${uiLabelMap.AccountingTransactionTotals}">
             <link target="TransactionTotals?organizationPartyId=${organizationPartyId}"/>
         </menu-item>

Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=609356&r1=609355&r2=609356&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml Sun Jan  6
09:59:05 2008
@@ -132,6 +132,26 @@
         </field>
         <field name="submitButton" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
+    <form name="ComparativeBalanceSheetParameters" type="single" target="prepareComparativeBalanceSheet">
+        <field name="organizationPartyId"><hidden/></field>
+        <field name="period1ThruDate"><date-time/></field>
+        <field name="period1GlFiscalTypeId">
+            <drop-down>
+                <entity-options entity-name="GlFiscalType" key-field-name="glFiscalTypeId"
description="${description}">
+                    <entity-order-by field-name="glFiscalTypeId"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="period2ThruDate"><date-time/></field>
+        <field name="period2GlFiscalTypeId">
+            <drop-down>
+                <entity-options entity-name="GlFiscalType" key-field-name="glFiscalTypeId"
description="${description}">
+                    <entity-order-by field-name="glFiscalTypeId"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="submitButton" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
 
     <form name="BalanceSheetAssetList" type="list" list-name="assetBalancesList">
         <row-actions>

Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=609356&r1=609355&r2=609356&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Sun Jan 
6 09:59:05 2008
@@ -318,6 +318,57 @@
         </section>
     </screen>
 
+    <screen name="ComparativeBalanceSheet">
+        <section>
+            <actions>
+                <set field="tabButtonItem" value="OrganizationAccountingReports"/>
+                <set field="tabButtonItem2" value="ComparativeBalanceSheet"/>
+                <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
+                <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
+                <entity-one entity-name="PartyAcctgPreference" value-name="partyAcctgPreference"
auto-field-map="false">
+                    <field-map field-name="partyId" env-name="organizationPartyId"/>
+                </entity-one>
+                <set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
+                <set field="assetBalancesList" from-field="parameters.assetBalancesList"/>
+                <set field="liabilityBalancesList" from-field="parameters.liabilityBalancesList"/>
+                <set field="equityBalancesList" from-field="parameters.equityBalancesList"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonOrganizationAccountingReportsDecorator"
location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container>
+                            <label style="head2" text="${uiLabelMap.AccountingComparativeBalanceSheet}"/>
+                        </container>
+                        <include-form name="ComparativeBalanceSheetParameters" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        <section>
+                            <condition>
+                                <or>
+                                    <not><if-empty field-name="assetBalancesList"/></not>
+                                    <not><if-empty field-name="liabilityBalancesList"/></not>
+                                    <not><if-empty field-name="equityBalancesList"/></not>
+                                </or>
+                            </condition>
+                            <widgets>
+                                <container>
+                                    <label style="head2" text="${uiLabelMap.AccountingAssets}"/>
+                                </container>
+                                <include-form name="BalanceSheetAssetList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                                <container>
+                                    <label style="head2" text="${uiLabelMap.AccountingLiabilities}"/>
+                                </container>
+                                <include-form name="BalanceSheetLiabilityList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                                <container>
+                                    <label style="head2" text="${uiLabelMap.AccountingEquities}"/>
+                                </container>
+                                <include-form name="BalanceSheetEquityList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
     <!-- TODO: this is just a placeholder: the report is not still implemented -->
     <screen name="TransactionTotals">
         <section>



Mime
View raw message