ilscipio/scipio-erp

View on GitHub
applications/accounting/widget/CommonScreens.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->

<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
        
    <!-- SCIPIO: Common settings for other *Screens.xml files in this app that primarily use decorators referenced using parameters.mainDecoratorLocation -->
    <screen-settings name="common-settings"><!-- all settings are currently valid/needed for this file as well, so omit: active="false" -->
        <decorator-screen-settings default-fallback-location="component://accounting/widget/CommonScreens.xml"/>
    </screen-settings>
        
    <!-- SCIPIO: The settings for this file (active) -->
    <screen-settings name="local-settings">
        <!-- These settings are automatically included in all *Screens.xml files in the same folder as this CommonScreens.xml file or any subfolder without its own CommonScreens.xml -->
        <auto-include-settings>
            <include-settings as-name="local-settings" name="common-settings" location="component://accounting/widget/CommonScreens.xml"/>
        </auto-include-settings>
    </screen-settings>
        
    <!-- SCIPIO: Actions automatically included at beginning of every render request, for our webapp (discovered via web.xml, mainDecoratorLocation) -->
    <screen name="webapp-common-actions">
        <actions>
            <!-- Make the main side bar name/location available to all (without need for globals) -->
            <include-screen-actions name="MainSideBarMenu"/>
            <set field="mainSideBarMenuCfg" from-field="menuCfg"/>
            <set field="mainComplexMenuCfg" from-field="menuCfg"/>
            <set field="menuCfg" value=""/>
        </actions>
    </screen>
        
    <screen name="main-decorator">
        <section>
            <actions>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="WorkEffortUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ManufacturingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>

                <set field="layoutSettings.companyName" from-field="uiLabelMap.AccountingCompanyName" global="true"/>
                <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.AccountingCompanySubtitle" global="true"/>
                <!-- layoutSettings.headerImageUrl can be used to specify an application specific logo; if not set,
                     then the global layoutSettings.commonHeaderImageUrl (specified in GlobalDecorator) will be used. -->
                <!--<set field="layoutSettings.headerImageUrl" value="/images/ofbiz_logo.gif" global="true"/>-->
                <set field="activeApp" value="accounting" global="true"/>
                <set field="applicationMenuName" value="AccountingAppBar" global="true"/>
                <set field="applicationMenuLocation" value="component://accounting/widget/AccountingMenus.xml" global="true"/>
                <set field="applicationTitle" value="${uiLabelMap.AccountingManagerApplication}" global="true"/>
                <!-- SCIPIO: This uses activeSubMenu/activeSubMenuItem to automatically determine activeMainMenuItem -->
                <set field="menuCfg" from-field="mainComplexMenuCfg"/>
                <include-screen-actions name="DeriveComplexSideBarMenuItems" location="component://common/widget/CommonScreens.xml"/>
            </actions>
            <widgets>
                <decorator-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml">
                    <decorator-section name="left-column" use-when="${context.widePage != true}"> <!-- override-by-auto-include="true" -->
                        <section>
                            <condition>
                                <not><if-empty-section section-name="left-column" /></not>
                            </condition>
                            <widgets>
                                <decorator-section-include name="left-column"/>
                            </widgets>
                            <fail-widgets>
                                <!-- provide default column for all others -->
                                <include-screen name="DefMainSideBarMenu" location="component://accounting/widget/CommonScreens.xml"/>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: App-wide common decorator, wrapper around main-decorator; expected to have globally unique name. See Admin app CommonScreens.xml for more info. -->
    <screen name="CommonAccountingAppDecorator">
        <section>
            <actions>
                <condition-to-field field="commonAccountingAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-service-permission service-name="acctgBasePermissionCheck" main-action="VIEW"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="left-column" use-when="${context.widePage != true}" override-by-auto-include="true">
                        <include-screen name="CommonAccountingAppSideBarMenu"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <!-- do check for ACCOUNTING, _VIEW permission -->
                            <condition>
                                <if-true field="commonAccountingAppBasePermCond"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm" text="${uiLabelMap.AccountingViewPermissionError}"/>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- 
    ***************
    * Accounts Payable
    ***************
     -->
     <screen name="CommonApDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#AccountsPayableSideBar"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- 
    ***************
    * Accounts Receivable
    ***************
     -->
     <screen name="CommonArDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#AccountsReceivableSideBar"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- 
    ***************
    * Billing Accounts
    ***************
     -->
    <screen name="CommonBillingAccountDecorator">
        <section>
            <actions>
                <!-- SCIPIO: This submenu is empty, this can't work... 
                    so force activeSubMenuItem to the entry in the top menu.
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#BillingAccountSideBar"/>-->
                <set field="activeSubMenuItem" value="billingaccount"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <!-- 
    ***************
    * Chart of Accounts / Ledger
    ***************
     -->
     <screen name="CommonGLDecorator">
        <section>
            <actions>
                <set field="glAccountId" from-field="parameters.glAccountId"/>
                <entity-one entity-name="GlAccount" value-field="glAccount"/>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#CommonGLSideBar"/>
                <set field="activeSubMenuItem" default-value="chartofaccounts" from-field="activeSubMenuItem"/>
                <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="chartofaccounts"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonPartyGlDecorator">
        <section>
            <actions>
                <!-- <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="PartyAccounts"/>-->
                <set field="organizationPartyId" from-field="parameters.organizationPartyId" global="true"/>
                <entity-one entity-name="PartyNameView" value-field="currentOrganization" auto-field-map="false">
                    <field-map field-name="partyId" from-field="organizationPartyId"/>
                </entity-one>
            </actions>
            <widgets>
                <decorator-screen name="CommonGLDecorator" location="${parameters.mainDecoratorLocation}"><!-- SCIPIO: obsolete: ${parameters.partyDecoratorLocation} -->
                    <decorator-section name="body">
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!--
    ***************
    * Contracts
    ***************
    -->
    <screen name="CommonAgreementDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#ContractsSideBar" />
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true" />
                <property-map resource="WorkEffortUiLabels" map-name="uiLabelMap" global="true" />
                
                <!-- sidebar additional condition -->
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <and>
                        <if-service-permission service-name="acctgAgreementPermissionCheck" main-action="VIEW" />
                        <not><if-empty field="agreement"/></not>
                    </and>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-service-permission service-name="acctgAgreementPermissionCheck" main-action="VIEW" />
                            </condition>
                            <widgets>
                                <section>
                                    <condition>
                                        <not>
                                            <if-empty field="agreement" />
                                        </not>
                                    </condition>
                                    <widgets>
                                        <label style="heading">${agreement.description} [${agreement.agreementId}]</label>
                                        <section>
                                            <condition>
                                                <not>
                                                    <if-empty field="agreementItem" />
                                                </not>
                                            </condition>
                                            <widgets>
                                                <!--
                                                <include-menu location="component://accounting/widget/AccountingMenus.xml"
                                                    name="AgreementItemTabBar" />-->
                                                <container style="button-bar">
                                                    <link target="EditAgreement" text="${uiLabelMap.AccountingNewAgreement}"
                                                        style="${styles.link_nav} ${styles.action_add}" />
                                                    <include-menu location="component://accounting/widget/AccountingMenus.xml"
                                                        name="AgreementItemSubTabBar" />
                                                </container>
                                            </widgets>
                                            <fail-widgets>
                                                <container style="button-bar">
                                                    <link target="EditAgreement" text="${uiLabelMap.AccountingNewAgreement}"
                                                        style="${styles.link_nav} ${styles.action_add}" />
                                                    <include-menu location="component://accounting/widget/AccountingMenus.xml"
                                                        name="AgreementTabBar" />
                                                </container>
                                            </fail-widgets>
                                        </section>
                                    </widgets>
                                </section>
                                <decorator-section-include name="body" />
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.AccountingViewPermissionError}
                                </label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="AgreementSubDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" value="AgreementItem"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonAgreementDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- 
    ***************
    * Controlling
    ***************
     -->
    <screen name="CommonControllingDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#ControllingSideBar"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen> 
     
    <screen name="CommonBudgetDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItem" value="ListBudgets"/>
                <set field="budgetId" from-field="budget.budgetId" default-value="${parameters.budgetId}"/>
                <entity-one entity-name="Budget" value-field="budget"/>
                <entity-and entity-name="BudgetStatus" list="budgetStatus">
                    <field-map field-name="budgetId" from-field="budgetId"/>
                    <order-by field-name="-statusDate"/>
                </entity-and>
                <set field="statusId" from-field="budgetStatus[0].statusId"/>
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.budgetId}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonControllingDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <not><if-empty field="budgetId"/></not>
                            </condition>
                            <widgets>
                                <include-menu name="BudgetTabBar" location="component://accounting/widget/AccountingMenus.xml"/>
                                <include-menu name="BudgetSubTabBar" location="component://accounting/widget/AccountingMenus.xml"/>
                                <label style="heading" text="Budget : [${budgetId}]"/>
                            </widgets>
                        </section>
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>  
      
    
    <!-- 
    ***************
    * Financial Accounts
    ***************
     -->
    <screen name="CommonFinAccountDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#FinAccount" />
                <entity-one entity-name="FinAccount" value-field="finAccount"/>
                
                <!-- sidebar additional condition -->
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.finAccountId}"/>
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-service-permission service-name="acctgFinAcctPermissionCheck" main-action="VIEW"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-service-permission service-name="acctgFinAcctPermissionCheck" main-action="VIEW"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm" text="${uiLabelMap.AccountingViewPermissionError}"/>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <!--
    *************** 
    * Fixed Assets
    ***************
     -->
    <screen name="CommonFixedAssetsDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="FixedAsset"/>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#FixedAssetsSideBar" />
                <set field="organizationPartyId" from-field="parameters.organizationPartyId" default-value="${defaultOrganizationPartyId}" global="true"/>             
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen> 
    <screen name="FixedAssetDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#FixedAssetsSideBar" />
                <set field="fixedAssetId" from-field="fixedAsset.fixedAssetId" default-value="${parameters.fixedAssetId}"/>
                <entity-one entity-name="FixedAsset" value-field="fixedAsset"/>
                
                <set field="titleFormat" value="\${finalTitle}${groovy: context.fixedAsset ? (': ' + context.fixedAsset.fixedAssetName + ' [' + context.fixedAssetId + ']') : ''}"/>
                
                <!-- sidebar additional condition -->
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.fixedAssetId}"/>
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-service-permission service-name="fixedAssetPermissionCheck" main-action="VIEW"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonFixedAssetsDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-service-permission service-name="fixedAssetPermissionCheck" main-action="VIEW"/>
                            </condition>
                            <widgets>
                                <!-- <include-menu name="FixedAssetTabBar" location="component://accounting/widget/AccountingMenus.xml"/> -->
                                <!--<section>
                                    <condition>
                                        <not><if-empty field="fixedAssetId"/></not>
                                    </condition>
                                    <widgets>
                                        <section>
                                            <condition>
                                                <not><if-empty field="title"/></not>
                                            </condition>
                                            <widgets>
                                                <label style="heading" text="${title} ${uiLabelMap.CommonFor} ${fixedAsset.fixedAssetName} [${fixedAssetId}]  ${${extraFunctionName}}"/>
                                            </widgets>
                                            <fail-widgets>
                                                <label style="heading" text="${uiLabelMap[titleProperty]} ${uiLabelMap.CommonFor} ${fixedAsset.fixedAssetName} [${fixedAssetId}]  ${${extraFunctionName}}"/>
                                            </fail-widgets>
                                        </section>
                                    </widgets>
                                </section>-->
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm" text="${uiLabelMap.AccountingViewPermissionError}"/>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    
    <screen name="CommonOrganizationAccountingReportsDecorator">
        <section>
            <actions>
                <set field="organizationPartyId" from-field="parameters.organizationPartyId" default-value="${defaultOrganizationPartyId}" global="true"/>
                <if>
                    <condition><not><if-empty field="organizationPartyId" /></not></condition>
                    <then>
                        <service service-name="getPartyAccountingPreferences" result-map="result">
                        <field-map field-name="organizationPartyId"/>
                        </service>
                        
                        <set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
                        <set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
                        
                        <entity-one entity-name="PartyNameView" value-field="currentOrganization" auto-field-map="false">
                            <field-map field-name="partyId" from-field="organizationPartyId"/>
                        </entity-one>
                        <!-- sidebar additional condition -->
                        <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.organizationPartyId}"/>
                    </then>
                    <else>
                        <set field="titleProperty" value="AccountingAvailableInternalOrganizations"/>
                        <set field="labelTitleProperty" value="" />
                        <entity-condition entity-name="PartyAcctgPreference" list="parties"/>
                    </else>
                </if>
                
                               
            </actions>
            <widgets>
                <decorator-screen name="CommonReportsDecorator" location="${parameters.mainDecoratorLocation}"><!-- SCIPIO: obsolete: ${parameters.partyDecoratorLocation} -->
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <not><if-empty field="organizationPartyId" /></not>
                            </condition>
                            <widgets>
                                <include-menu name="OrganizationTabBar" location="component://accounting/widget/AccountingMenus.xml"/>
                                <label style="heading">${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${currentOrganization.groupName} [${organizationPartyId}]</label>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="heading">${uiLabelMap[labelTitleProperty]} Select organization</label>
                                <platform-specific><html><html-template location="component://accounting/webapp/accounting/reports/SelectOrganization.ftl"></html-template></html></platform-specific>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!--
    ********** 
    * Invoices 
    **********-->
    <screen name="CommonInvoicesDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="ListInvoices"/>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#InvoicesSideBar" />
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-service-permission service-name="acctgInvoicePermissionCheck" main-action="VIEW"/>
                </condition-to-field>              
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-service-permission service-name="acctgInvoicePermissionCheck" main-action="VIEW"/>
                            </condition>
                            <widgets>
                                <section>
                                    <condition><not><if-empty field="parameters.invoiceId"/></not></condition>
                                    <widgets>
                                        <include-menu name="InvoiceSubTabBar" location="component://accounting/widget/AccountingMenus.xml"/>
                                        <!-- <container style="leftclear">
                                            <label style="heading" text="${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${invoice.description} [${invoiceId}]  ${${extraFunctionName}}"/>
                                        </container> -->
                                    </widgets>
                                </section>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.AccountingViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="InvoiceDecorator">
        <section>
            <actions>

                <set field="activeMainMenu" from-field="activeMainMenu" default-value="InvoiceSideBar" />
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="InvoiceSideBar" />
                <!--<set field="activeSubMenuItem" from-field="activeSubMenu" default-value="InvoiceSideBar" />-->
                <set field="invoiceId" from-field="invoice.invoiceId" default-value="${parameters.invoiceId}"/>
                <entity-one entity-name="Invoice" value-field="invoice"/>

                <set field="titleFormat" value="\${finalTitle}${groovy: context.invoiceId ? ('[' + context.invoiceId + ']') : ''}"/>

                <!-- sidebar additional condition -->
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.invoiceId}"/>
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-service-permission service-name="acctgInvoicePermissionCheck" main-action="VIEW"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonInvoicesDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-service-permission service-name="acctgInvoicePermissionCheck" main-action="VIEW"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm" text="${uiLabelMap.AccountingViewPermissionError}"/>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>

    </screen>
    
    <!--
    *************** 
    * Import/Export
    ***************
     -->
    <screen name="CommonImportExportDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#ImportExportSideBar" />
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <!--
    *************** 
    * Transactions
    ***************
     -->
    <screen name="CommonTransactionsDecorator">
        <section>
            <actions>
                <!--  <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="Transactions"/> -->
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#TransactionsSideBar" />
                <set field="organizationPartyId" from-field="parameters.organizationPartyId" default-value="${defaultOrganizationPartyId}" global="true"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <!--
    *************** 
    * Reports
    ***************
     -->
    <screen name="CommonReportsDecorator">
        <section>
            <actions>
                <!-- <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="TransactionReports"/> -->
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#TransactionReportsSideBar" />
                <!-- <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#JournalsSideBar" /> -->
                <set field="organizationPartyId" from-field="parameters.organizationPartyId" default-value="${defaultOrganizationPartyId}" global="true"/>             
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonPartyDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="Journals"/>
                <set field="organizationPartyId" from-field="parameters.organizationPartyId" default-value="${defaultOrganizationPartyId}" global="true"/>             
                <!-- sidebar additional condition -->
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.organizationPartyId}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonReportsDecorator" location="${parameters.mainDecoratorLocation}"><!-- SCIPIO: obsolete: ${parameters.partyDecoratorLocation} -->
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <not><if-empty field="organizationPartyId"/></not>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error" text="${uiLabelMap.AccountingUserOrgNotSpecified}"/>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonAdminChecksDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="PartyAccounts"/>
                <entity-one entity-name="PartyNameView" value-field="currentOrganization" auto-field-map="false">
                    <field-map field-name="partyId" from-field="organizationPartyId"/>
                </entity-one>
            </actions>
            <widgets>
                <decorator-screen name="CommonPartyDecorator" location="${parameters.mainDecoratorLocation}"><!-- SCIPIO: obsolete: ${parameters.partyDecoratorLocation} -->
                    <decorator-section name="body">
                        <include-menu name="OrganizationTabBar" location="component://accounting/widget/AccountingMenus.xml"/>
                        <include-menu name="PartyAccountingChecksTabBar" location="component://accounting/widget/AccountingMenus.xml"/>
                        <label style="heading">${uiLabelMap.CommonFor}: ${currentOrganization.groupName} [${organizationPartyId}]</label>
                        <decorator-section-include name="checks-body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!--
    *************** 
    * Payments
    ***************
     -->
    <screen name="CommonPaymentDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#PaymentSideBar" />
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-menu name="PaymentSubTabBar" location="component://accounting/widget/AccountingMenus.xml"/>
                        <!-- <container style="leftclear">
                            <label style="heading" text="${uiLabelMap[labelTitleProperty]} [${paymentId}]  ${${extraFunctionName}}"/>
                        </container> -->
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonPaymentGroupDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#PaymentGroup" />
                <set field="paymentGroupId" from-field="parameters.paymentGroupId"/>
                <entity-one entity-name="PaymentGroup" value-field="paymentGroup"/>
                <entity-and entity-name="PaymentGroupMember" list="paymentGroupMembers" filter-by-date="true">
                    <field-map field-name="paymentGroupId"/>
                </entity-and>
                <!-- sidebar additional condition -->
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.paymentGroup}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-menu name="PaymentGroupSubTabBar" location="component://accounting/widget/AccountingMenus.xml"/>
                        <!-- TODO: Scipio - I don't think this is needed -->
                        <!-- <section>
                            <condition>
                                <not><if-empty field="paymentGroupId"/></not>
                            </condition>
                            <widgets>     
                                <section>
                                    <condition>
                                        <not><if-empty field="title"/></not>
                                    </condition>
                                    <widgets>
                                        <label style="heading" text="${title} ${uiLabelMap.CommonFor} ${paymenGroup.paymentGroupName} [${paymentGroupId}]"/>
                                    </widgets>
                                    <fail-widgets>
                                        <label style="heading" text="${uiLabelMap[titleProperty]} ${uiLabelMap.CommonFor} ${paymenGroup.paymentGroupName} [${paymentGroupId}]"/>
                                    </fail-widgets>
                                </section>                                   
                            </widgets>                                  
                        </section> -->
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    
    <!--
    *************** 
    * Settings
    ***************
     -->
    <screen name="CommonGlSetupDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#PartyAdmin" />
                <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="Admin"/>
                <entity-one entity-name="PartyNameView" value-field="currentOrganization" auto-field-map="false">
                    <field-map field-name="partyId" from-field="organizationPartyId"/>
                </entity-one>
            </actions>
            <widgets>
                <decorator-screen name="CommonSettingsDecorator" location="${parameters.mainDecoratorLocation}"><!-- SCIPIO: obsolete: ${parameters.partyDecoratorLocation} -->
                    <decorator-section name="body">
                        <!--<include-menu name="PartyAdminTabBar" location="component://accounting/widget/AccountingMenus.xml"/>-->
                        <section>
                            <condition>
                                <if-compare field="activeSubMenuItem" operator="equals" value="GlAccountAssignment"/>
                            </condition>
                            <widgets>
                                <include-menu name="PartyAdminAssignTabBar" location="component://accounting/widget/AccountingMenus.xml"/>
                            </widgets>
                        </section>
                        <label style="heading">${labelTitleProperty} ${uiLabelMap.CommonFor}: ${currentOrganization.groupName} [${organizationPartyId}]</label>
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonSettingsDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://accounting/widget/AccountingMenus.xml#SettingsSideBar" />
            </actions>
            <widgets>
                <decorator-screen name="CommonAccountingAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonTaxAuthorityDecorator">
        <section>
            <actions>
                <!-- SCIPIO: now has own sub-menu 
                <set field="activeSubMenuItem" value="TaxAuthorities"/>-->
                <set field="activeSubMenu" value="TaxAuthority"/>
                <set field="taxAuthPartyId" from-field="parameters.taxAuthPartyId"/>
                <set field="taxAuthGeoId" from-field="parameters.taxAuthGeoId"/>
                <entity-one entity-name="TaxAuthority" value-field="taxAuthority"/>
                <entity-one entity-name="PartyNameView" value-field="taxAuthPartyName" auto-field-map="false">
                    <field-map field-name="partyId" from-field="taxAuthority.taxAuthPartyId"/>
                </entity-one>
                <get-related-one value-field="taxAuthority" relation-name="TaxAuthGeo" to-value-field="taxAuthGeo" use-cache="true"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonSettingsDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <not><if-empty field="taxAuthority"/></not>
                            </condition>
                            <widgets>
                                <label style="heading+2">${uiLabelMap.CommonFor}: ${taxAuthPartyName.firstName} ${taxAuthPartyName.middleName} ${taxAuthPartyName.lastName} ${taxAuthPartyName.groupName} [${taxAuthority.taxAuthPartyId}] / ${taxAuthGeo.geoName} [${taxAuthority.taxAuthGeoId}]</label>
                            </widgets>
                        </section>
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    
    <!--
    ********** 
    * WIDGETS 
    **********-->
    <!-- Decorator includes -->
        
    <!-- SCIPIO: Main SideBar Menu (see component://common/widget/CommonScreens.xml#ComplexSideBarMenu for available arguments and Admin app CommonScreens.xml for more info) -->
    <screen name="MainSideBarMenu">
        <section>
            <actions>
                <set field="menuCfg.location" value="component://accounting/widget/AccountingMenus.xml"/>
                <set field="menuCfg.name" value="AccountingAppSideBar"/>
                <set field="menuCfg.defLocation" value="component://accounting/widget/AccountingMenus.xml"/>
            </actions>
            <widgets>
                <include-screen location="component://common/widget/CommonScreens.xml" name="ComplexSideBarMenu"/>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: Default Main SideBar Menu, version of MainSideBarMenu that disregards screen's selected/active sub-menu -->
    <screen name="DefMainSideBarMenu">
        <section>
            <actions>
                <script location="component://common/webcommon/WEB-INF/actions/includes/scipio/PrepareDefComplexSideBarMenu.groovy"/>
            </actions>
            <widgets>
                <include-screen name="MainSideBarMenu"/>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: Common SideBar Menu inclusion logic, for/from Common*AppDecorator, with application-specific logic 
        (see component://common/widget/CommonScreens.xml#CommonSideBarMenu for available arguments and Admin app CommonScreens.xml for more info) -->
    <screen name="CommonAccountingAppSideBarMenu">
        <section>
            <actions>
                <condition-to-field field="commonAccountingAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-service-permission service-name="acctgBasePermissionCheck" main-action="VIEW"/>
                </condition-to-field>
                <set field="commonSideBarMenu.cond" from-field="commonSideBarMenu.cond" type="Boolean" default-value="${commonAccountingAppBasePermCond}"/>
                <set field="commonSideBarMenu.menuLoc" type="String" value="component://accounting/widget/CommonScreens.xml"/><!-- Remove to rely on parameters.mainDecoratorLocation -->
            </actions>
            <widgets>
                <include-screen name="CommonSideBarMenu" location="component://common/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>
    
    
    
    <!-- SCIPIO: Widget implementation -->
    <screen name="ScipioIncomesExpenses">
        <section>
            <actions>
                <set field="chartType" value="bar"/>                                    
                <set field="chartLibrary" value="chart"/>
                <set field="chartIntervalScope" value="month"/>
                <set field="chartIntervalCount" value="6"/>
                <set field="chartDatasets" value="2"/>                                                                        
                <set field="organizationPartyId" from-field="parameters.organizationPartyId" default-value="${defaultOrganizationPartyId}" global="true"/>                         
                <set field="glFiscalTypeId" from-field="parameters.glFiscalTypeId" default-value="ACTUAL"/>
                <set field="xlabel" value=""/> <!-- x-axis label -->
                <set field="ylabel" value=""/> <!-- y-axis label -->
                <set field="label1" value="${uiLabelMap.AccountingIncome}"/> <!-- 1st dataset label -->
                <set field="label2" value="${uiLabelMap.AccountingExpenses}"/> <!-- 2nd dataset label -->  
                <!-- IMPORTANT NOTE: This script only retrieves the existing (income/expense) transactions for the default 
                currency defined in general.properties - currency.uom.id.default -->                                 
                <script location="component://accounting/script/com/ilscipio/scipio/accounting/dashboard/IncomeExpenses.groovy"/>
           </actions>
           <widgets>
                <section>
                    <condition>
                        <not>
                            <if-empty field="totalMap"/>
                        </not>
                    </condition>
                     <widgets>
                       <screenlet title="${uiLabelMap.AccountingIncomesExpenses}">
                           <platform-specific>
                                <html><html-template location="component://accounting/webapp/accounting/dashboard/incomeExpenses.ftl"/></html>
                            </platform-specific>
                       </screenlet>     
                   </widgets>
                </section>
           </widgets>
        </section>
    </screen>
    
    <screen name="creditCardFields">
        <section>
            <actions>
                <set field="fieldNamePrefix" from-field="ccfFieldNamePrefix" default-value="${''}" />
                <set field="showSecurityCodeField" from-field="ccfShowSecurityCodeField" type="Boolean" default-value="false" />
                <!-- SCIPIO: Parametrized, to reuse actions here (once needed) -->
                <set field="ccfTemplateLocation" from-field="ccfTemplateLocation" default-value="component://accounting/webapp/accounting/common/creditcardfields.ftl" />
            </actions>
            <widgets>
                <platform-specific><html><html-template location="${ccfTemplateLocation}"/></html></platform-specific>
            </widgets>
        </section>
    </screen>
    
    <!-- AP widgets-->
    <!-- SCIPIO: Form migration -->
    <screen name="ApPastDueInvoices">
        <section>
           <actions>
                <set field="invoiceTypeId" value="PURCHASE_INVOICE"/>
                <set field="organizationPartyId" from-field="organizationPartyId" default-value="${defaultOrganizationPartyId}" global="true"/>
                <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy"/>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="invoices" from-field="PastDueInvoices"/>
            </actions>
            <widgets>
                <section>
                    <condition>
                        <not>
                            <if-empty field="invoices"/>
                        </not>
                    </condition>
                    <widgets>
                        <screenlet title="${uiLabelMap.AccountingAccountsPayable}">
                            <include-screen name="ScipioInvoices" location="component://accounting/widget/invoice/InvoiceScreens.xml"/>
                        </screenlet>
                    </widgets>              
                </section>
            </widgets>
        </section>
    </screen>
    
    <screen name="ApInvoicesDueSoon">
        <section>
            <actions>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="invoices" from-field="InvoicesDueSoon"/>
            </actions>
            <widgets>
                <section>
                    <condition>
                        <not>
                            <if-empty field="invoices"/>
                        </not>
                    </condition>
                    <widgets>
                        <screenlet title="${uiLabelMap.AccountingInvoicesDueSoon}: (${InvoicesDueSoonTotalAmount})">
                            <include-screen name="ScipioInvoices" location="component://accounting/widget/invoice/InvoiceScreens.xml"/>
                        </screenlet>
                    </widgets>              
                </section>
            </widgets>
        </section>
    </screen>
    
    <!-- AR widgets -->
    <!-- SCIPIO: Form migration -->
    <screen name="ArPastDueInvoices">
        <section>
           <actions>
                <set field="invoiceTypeId" value="SALES_INVOICE"/>
                <set field="organizationPartyId" from-field="organizationPartyId" default-value="${defaultOrganizationPartyId}" global="true"/>
                <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy"/>
           
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="invoices" from-field="PastDueInvoices"/>
            </actions>
            <widgets>
                <section>
                    <condition>
                        <not>
                            <if-empty field="invoices"/>
                        </not>
                    </condition>
                    <widgets>
                        <screenlet title="${uiLabelMap.AccountingAccountsReceivable}">
                            <include-screen name="ScipioInvoices" location="component://accounting/widget/invoice/InvoiceScreens.xml"/>
                        </screenlet>
                    </widgets>              
                </section>
            </widgets>
        </section>
    </screen>
    
    <screen name="ArInvoicesDueSoon">
        <section>
            <actions>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="invoices" from-field="InvoicesDueSoon"/>
            </actions>
            <widgets>
                <section>
                    <condition>
                        <not>
                            <if-empty field="invoices"/>
                        </not>
                    </condition>
                    <widgets>
                        <screenlet title="${uiLabelMap.AccountingInvoicesDueSoon}: (${InvoicesDueSoonTotalAmount})">
                            <include-screen name="ScipioInvoices" location="component://accounting/widget/invoice/InvoiceScreens.xml"/>
                        </screenlet>
                    </widgets>              
                </section>
            </widgets>
        </section>
    </screen>
</screens>