ilscipio/scipio-erp

View on GitHub
applications/accounting/widget/AccountingPrintScreens.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.
-->

<!-- These screens are for generating printed documents, such as invoices, bills, statements, etc. -->

<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">

    <!-- generate a PDF for the invoice.  sharing the same BSH file as the HTML page for viewing invoice -->
    <screen name="InvoicePDF">
        <section>
            <actions>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="titleProperty" value="AccountingInvoice"/>
                <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy"/>
                <script location="component://party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy"/>
                <script location="component://accounting/webapp/accounting/WEB-INF/actions/order/CompanyHeader.groovy"/>
            </actions>
            <widgets>
                <section>
                    <condition>
                        <or>
                            <if-service-permission service-name="acctgBasePermissionCheck" main-action="VIEW"/>
                            <!-- can always see own invoice -->
                            <if-compare field="invoice.partyIdFrom" operator="equals" value="${userLogin.partyId}"/>
                            <if-compare field="invoice.partyId" operator="equals" value="${userLogin.partyId}"/>
                            <!-- or is a contact of a company who owns the invoice-->
                            <if-compare field="invoice.partyIdFrom" operator="equals" value="${myCompanyId}"/>
                            <if-compare field="invoice.partyId" operator="equals" value="${myCompanyId}"/>
                        </or>
                    </condition>
                    <widgets>
                        <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
                            <decorator-section name="topLeft">
                                <platform-specific>
                                   <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/invoiceReportContactMechs.fo.ftl"/></xsl-fo>
                                </platform-specific>
                            </decorator-section>
                            <decorator-section name="topRight">
                               <include-screen name="CompanyLogo" location="component://accounting/widget/AccountingPrintScreens.xml"/>
                               <platform-specific>
                                    <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl"/></xsl-fo>
                                </platform-specific>
                            </decorator-section>
                            <decorator-section name="body">
                               <platform-specific>
                                   <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/invoiceReportItems.fo.ftl"/></xsl-fo>
                               </platform-specific>
                            </decorator-section>
                            <decorator-section name="footer">
                               <platform-specific>
                                   <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/pdf/ScipioInvoiceFooter.fo.ftl"/></xsl-fo>
                               </platform-specific>
                            </decorator-section>
                        </decorator-screen>
                    </widgets>
                    <fail-widgets>
                        <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
                            <decorator-section name="body">
                                <platform-specific>
                                    <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl"/></xsl-fo>
                                </platform-specific>
                            </decorator-section>
                        </decorator-screen>
                    </fail-widgets>
                </section>
            </widgets>
        </section>
    </screen>

    <screen name="PrintCheckPDF">
        <section>
            <condition>
                <if-service-permission service-name="acctgBasePermissionCheck" main-action="VIEW"/>
            </condition>
            <actions>
                <set field="titleProperty" value="AccountingPrintChecks"/>
            </actions>
            <widgets>
                <!-- SCIPIO: FIXME?: There is no printCheck.fo.ftl in stock, so this can only crash
                <platform-specific>
                    <xsl-fo><html-template location="component://accounting/webapp/accounting/payment/printCheck.fo.ftl"/></xsl-fo>
                </platform-specific>-->
                <label text="${uiLabelMap.CommonNotImplementedSentence}"/>
            </widgets>
            <fail-widgets>
                <label style="common-msg-error-perm" text="${uiLabelMap.AccountingPrintChecksPermissionError}"/>
            </fail-widgets>
        </section>
    </screen>
    <screen name="PrintInvoices">
        <section>
            <actions>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="invoiceIds" from-field="parameters.invoiceIds" type="List"/>
                <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy"/>
            </actions>
            <widgets>
               <platform-specific>
                    <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/PrintInvoices.fo.ftl"/></xsl-fo>
                </platform-specific>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommissionReportPdf">
        <section>
            <actions>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ManufacturingUiLabels" map-name="uiLabelMap" global="true"/>
                <script location="component://accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
                    <decorator-section name="topLeft">
                        <include-screen name="CompanyLogo" location="component://order/widget/ordermgr/OrderPrintScreens.xml"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <platform-specific>
                            <xsl-fo><html-template location="component://accounting/webapp/ap/reports/CommissionReport.fo.ftl"/></xsl-fo>
                        </platform-specific>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: Moved from OrderPrintScreens.xml -->
    <screen name="CompanyLogo">
        <section>
            <widgets>
                <platform-specific><xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/pdf/ScipioCompanyHeader.fo.ftl"/></xsl-fo></platform-specific>
            </widgets>
        </section>
    </screen>
</screens>