<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">

    <form name="FindAgreements" target="FindAgreement" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
        <auto-fields-entity entity-name="Agreement" default-field-type="find"/>
        <field name="productId" title="${uiLabelMap.AccountingProductId}">
            <lookup target-form-name="LookupProduct"/>
        </field>
        <field name="agreementTypeId" title="${uiLabelMap.AccountingAgreementTypeId}">
            <drop-down allow-empty="true">
                <entity-options entity-name="AgreementType"/>
            </drop-down>
        </field>
        <field name="partyIdFrom" title="${uiLabelMap.AccountingPartyIdFrom}">
            <lookup target-form-name="LookupPartyName"/>
        </field>
        <field name="partyIdTo" title="${uiLabelMap.AccountingPartyIdTo}">
            <lookup target-form-name="LookupPartyName"/>
        </field>
        <field name="roleTypeIdFrom" title="${uiLabelMap.AccountingRoleTypeIdFrom}"><hidden/></field>
        <field name="roleTypeIdTo" title="${uiLabelMap.AccountingRoleTypeIdTo}"><hidden/></field>
        <field name="agreementDate" title="${uiLabelMap.AccountingAgreementDate}"><hidden/></field>
        <field name="description" title="${uiLabelMap.Description}"><hidden/></field>
        <field name="textData" title="${uiLabelMap.AccountingTextData}"><hidden/></field>
        <field name="thruDate" title="${uiLabelMap.AccountingThruDate}"><hidden/></field>
        <field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
        <field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>

    <grid name="ListAgreements" list-name="listIt" target="" title="" paginate-target="FindAgreement"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar" header-row-style="header-row-2">
        <actions>
            <set field="entityName" value="Agreement"/>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" from-field="entityName"/>
                <field-map field-name="orderBy" from-field="parameters.sortField"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
            </service>
        </actions>
        <row-actions>
            <script location="component://accounting/groovyScripts/agreement/GetPartyNameForDate.groovy"/>
        </row-actions>         
        <auto-fields-entity entity-name="Agreement" default-field-type="display"/>
        <field name="agreementId" title="${uiLabelMap.CommonEdit}" widget-style="buttontext" sort-field="true">
            <hyperlink description="${agreementId}" target="EditAgreement" also-hidden="false">
                <parameter param-name="agreementId"/>
            </hyperlink>
        </field>
        <field name="productId" sort-field="true"></field>
        <field name="partyIdFrom" sort-field="true">
            <hyperlink description="${partyNameResultFrom.fullName} [${partyIdFrom}]" target="/partymgr/control/viewprofile" target-type="inter-app">
                <parameter param-name="partyId" from-field="partyIdFrom"/>
            </hyperlink> 
        </field>
        <field name="partyIdTo" sort-field="true">
            <hyperlink description="${partyNameResultTo.fullName} [${partyIdTo}]" target="/partymgr/control/viewprofile" target-type="inter-app">
                <parameter param-name="partyId" from-field="partyIdTo"/>
            </hyperlink>
        </field>
        <field name="roleTypeIdFrom" title="${uiLabelMap.AccountingRoleTypeIdFrom}"><hidden/></field>
        <field name="roleTypeIdTo" title="${uiLabelMap.AccountingRoleTypeIdTo}" sort-field="true">
            <display-entity entity-name="RoleType" key-field-name="roleTypeId"/>
        </field>
        <field name="agreementTypeId" title="${uiLabelMap.AccountingAgreementTypeId}" sort-field="true">
            <display-entity entity-name="AgreementType"/>
        </field>
        <field name="fromDate" sort-field="true"></field>
        <field name="thruDate" title="${uiLabelMap.AccountingThruDate}" sort-field="true"></field>
        <field name="agreementDate" title="${uiLabelMap.AccountingAgreementDate}"><hidden/></field>
        <field name="textData" title="${uiLabelMap.AccountingTextData}"><hidden/></field>
        <field name="description" sort-field="true"></field>
        <field name="cancelLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonCancel}" target="cancelAgreement" also-hidden="false">
                <parameter param-name="agreementId"/>
            </hyperlink>
        </field>
    </grid>

    <form name="EditAgreement" type="single" target="updateAgreement" title="" default-map-name="agreement"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="agreement==null" target="createAgreement"/>
        <auto-fields-service service-name="updateAgreement" default-field-type="edit" map-name="agreement"/>
        <field name="agreementId" use-when="agreementId!=null"><display/></field>
        <field name="agreementId" use-when="agreement==null&amp;&amp;agreementId==null"><ignored/></field>
        <field name="productId" title="${uiLabelMap.AccountingProductId}">
            <lookup target-form-name="LookupProduct"/>
        </field>
        <field name="agreementTypeId" title="${uiLabelMap.AccountingAgreementTypeId}">
            <drop-down allow-empty="true">
                <entity-options entity-name="AgreementType" key-field-name="agreementTypeId"/>
            </drop-down>
        </field>
        <field name="partyIdFrom" title="${uiLabelMap.AccountingPartyIdFrom}">
            <lookup target-form-name="LookupPartyName"/>
        </field>
        <field name="roleTypeIdFrom" title="${uiLabelMap.AccountingRoleTypeIdFrom}">
            <drop-down allow-empty="true">
                <entity-options entity-name="RoleType" key-field-name="roleTypeId"/>
            </drop-down>
        </field>
        <field name="roleTypeIdTo" title="${uiLabelMap.AccountingRoleTypeIdTo}">
            <drop-down allow-empty="true">
                <entity-options entity-name="RoleType" key-field-name="roleTypeId"/>
            </drop-down>
        </field>
        <field name="partyIdTo" title="${uiLabelMap.AccountingPartyIdTo}">
            <lookup target-form-name="LookupPartyName"/>
        </field>
        <field name="fromDate"><date-time default-value="${nowTimestamp}"/></field>

        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>

    <grid name="ListAgreementItems" list-name="agreementItems" target=""  title="" paginate-target="ListAgreementItems"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <auto-fields-entity entity-name="AgreementItem" default-field-type="display"/>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.CommonEdit}" widget-style="buttontext">
            <hyperlink description="${agreementItemSeqId}" target="EditAgreementItem" also-hidden="false">
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
        <field name="agreementItemTypeId" title="${uiLabelMap.AccountingAgreementItemTypeId}">
            <display-entity entity-name="AgreementItemType"/>
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonRemove}" target="removeAgreementItem" also-hidden="false">
                <parameter param-name="agreementItemSeqId"/>
                <parameter param-name="agreementId"/>
            </hyperlink>
        </field>
    </grid>

    <form name="EditAgreementItem" type="single" target="updateAgreementItem" title="" default-map-name="agreementItem"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="agreementItem==null" target="createAgreementItem"/>
        <auto-fields-entity entity-name="AgreementItem" default-field-type="edit"/>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" use-when="agreementItem!=null" title="${uiLabelMap.AccountingAgreementItemSeqId}"><display/></field>
        <field name="agreementItemSeqId" use-when="agreementItem==null" ><ignored/></field>
        <field name="agreementItemTypeId" title="${uiLabelMap.AccountingAgreementItemTypeId}">
            <drop-down allow-empty="true">
                <entity-options entity-name="AgreementItemType" key-field-name="agreementItemTypeId"/>
            </drop-down>
        </field>
        <field name="currencyUomId" title="${uiLabelMap.CommonCurrency}">
            <drop-down allow-empty="true" no-current-selected-key="${defaultOrganizationPartyCurrencyUomId}">
                <entity-options key-field-name="uomId" description="${description} - ${abbreviation}" entity-name="Uom">
                    <entity-constraint name="uomTypeId" operator="equals" value="CURRENCY_MEASURE"/>
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>

    <grid name="ListAgreementItemTerms" target="" title="" list-name="agreementTerms" paginate-target="ListAgreementItemTerms"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <auto-fields-entity entity-name="AgreementTerm" default-field-type="display"/>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.AccountingAgreementItemSeqId}"><hidden/></field>
        <field name="agreementTermId" title="${uiLabelMap.CommonEdit}" widget-style="buttontext">
            <hyperlink description="${agreementTermId}" target="EditAgreementItemTerm" also-hidden="false">
                <parameter param-name="agreementTermId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
             </hyperlink>
        </field>
        <field name="termTypeId" title="${uiLabelMap.AccountingTermTypeId}">
            <display-entity entity-name="TermType"/>
        </field>
        <field name="invoiceItemTypeId">
            <display-entity entity-name="InvoiceItemType"/>
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonRemove}" target="removeAgreementItemTerm" also-hidden="false">
                <parameter param-name="agreementTermId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
    </grid>
    
    <grid name="ListAgreementTerms" target="updateAgreementTerm" list-name="agreementTerms" paginate-target="EditAgreementTerms" title=""
        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
        <actions>
            <entity-and entity-name="AgreementTerm" list="agreementTerms">
                <field-map field-name="agreementId" from-field="agreementId"/>
                <order-by field-name="agreementItemSeqId"/>
                <order-by field-name="agreementTermId"/>
            </entity-and>
        </actions>
        <auto-fields-service service-name="updateAgreementTerm"/>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementTermId" ><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.AccountingAgreementItemSeqId}"><display/></field>
        <field name="termTypeId" title="${uiLabelMap.AccountingTermTypeId}">
            <display-entity entity-name="TermType"/>
        </field>
        <field name="invoiceItemTypeId">
            <drop-down allow-empty="true">
                <entity-options entity-name="InvoiceItemType">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonRemove}" target="deleteAgreementTerm" also-hidden="false">
                <parameter param-name="agreementTermId"/>
                <parameter param-name="agreementId"/>
            </hyperlink>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </grid>
    
    <form name="AddAgreementTerm" type="single" target="createAgreementTerm" title="" default-map-name="agreementTerm"
        header-row-style="header-row" default-table-style="basic-table">
        <auto-fields-entity entity-name="AgreementTerm" default-field-type="edit"/>
        <field name="agreementTermId" title="${uiLabelMap.AccountingAgreementTermId}"><ignored/></field>
        <field name="termTypeId" title="${uiLabelMap.AccountingTermTypeId}">
            <drop-down allow-empty="false">
                <entity-options entity-name="TermType">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.AccountingAgreementItemSeqId}"><hidden/></field>
        <field name="invoiceItemTypeId">
            <drop-down allow-empty="true">
                <entity-options entity-name="InvoiceItemType">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>
    
    <grid name="ListAgreementContent" target="removeAgreementContent" list-name="contentDataResourceList" paginate-target="ListAgreementContents" title=""
        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
        <field name="agreementId"><hidden/></field>
        <field name="agreementItemSeqId"><display/></field>
        <field name="contentId"><hidden/></field>
        <field name="contentName">
            <display-entity entity-name="Content" description="${contentName}" key-field-name="contentId">
                <sub-hyperlink target="stream" description="${contentId}" link-style="smallSubmit" link-type="anchor">
                    <parameter param-name="contentId"/>
                </sub-hyperlink>
            </display-entity>
        </field>
        <field name="agreementContentTypeId"><display-entity entity-name="AgreementContentType"/></field>
        <field name="statusId"><display-entity entity-name="StatusItem"></display-entity></field>
        <field name="contentTypeId"><display-entity entity-name="ContentType"></display-entity></field>
        <field name="fromDate"><display type="date-time"/></field>
        <field name="thruDate"><display type="date-time"/></field>
        <field name="remove" title="${uiLabelMap.CommonRemove}"><submit/></field>
    </grid>
    
    <form name="AddAgreementContent" type="upload" target="uploadAgreementContent">
        <field name="agreementId"><hidden value="${agreement.agreementId}"/></field>
        <field name="agreementItemSeqId">
            <drop-down allow-empty="false">
                <option key="_NA_" description=" "/>
                <entity-options entity-name="AgreementItem" description="${agreementItemSeqId}">
                    <entity-constraint name="agreementId" env-name="agreement.agreementId"/>
                    <entity-order-by field-name="agreementItemSeqId"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="agreementContentTypeId" >
            <drop-down allow-empty="false">
                <entity-options entity-name="AgreementContentType">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="contentTypeId">
            <drop-down allow-empty="false" no-current-selected-key="DOCUMENT">
                <entity-options entity-name="ContentType"/>
            </drop-down>
        </field>
        <field name="statusId">
            <drop-down allow-empty="false" no-current-selected-key="CTNT_AVAILABLE">
                <entity-options entity-name="StatusItem">
                    <entity-constraint name="statusTypeId" value="CONTENT_STATUS"/>
                    <entity-order-by field-name="sequenceId"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="fromDate"><date-time default-value="${nowTimestamp}"/></field>
        <field name="thruDate"><date-time/></field>
        <field name="uploadedFile" title="${uiLabelMap.ContentFile}"><file/></field>
        <field name="submitButton" title="${uiLabelMap.CommonUpload}"><submit/></field>
    </form>
    <form name="EditAgreementItemTerm" type="single" target="updateAgreementItemTerm" title="" default-map-name="agreementTerm"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="agreementTerm==null" target="createAgreementItemTerm"/>
        <auto-fields-entity entity-name="AgreementTerm" default-field-type="edit"/>
        <field name="agreementTermId" title="${uiLabelMap.AccountingAgreementTermId}"><display/></field>
        <field name="termTypeId" title="${uiLabelMap.AccountingTermTypeId}">
            <drop-down allow-empty="false">
                <entity-options entity-name="TermType"/>
            </drop-down>
        </field>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.AccountingAgreementItemSeqId}"><hidden/></field>
        <field name="invoiceItemTypeId">
            <drop-down allow-empty="true">
                <entity-options entity-name="InvoiceItemType">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>
    <grid name="ListAgreementItemProducts" list-name="agreementProducts" target="" title="" paginate-target="ListAgreementItemProducts"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <auto-fields-entity entity-name="AgreementProductAppl" default-field-type="display"/>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.AccountingAgreementItemSeqId}"><hidden/></field>
        <field name="productId" title="${uiLabelMap.CommonEdit}" widget-style="buttontext">
           <hyperlink description="${productId}" target="EditAgreementItemProduct" also-hidden="false">
                <parameter param-name="productId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
        <field name="internalName" entry-name="productId">
            <display-entity entity-name="Product" key-field-name="productId" description="${internalName}"/>
        </field>
        <field name="price"><display type="currency" currency="${agreementItem.currencyUomId}"/></field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonRemove}" target="removeAgreementItemProduct" also-hidden="false">
                <parameter param-name="productId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
    </grid>
    
    <grid name="ListAgreementItemFacilities" list-name="agreementFacilities" target="" title="" paginate-target="ListAgreementItemFacilities"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <auto-fields-entity entity-name="AgreementFacilityAppl" default-field-type="display"/>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.AccountingAgreementItemSeqId}"><hidden/></field>
        <field name="facilityId" title="${uiLabelMap.CommonEdit}" widget-style="buttontext">
           <hyperlink description="${facilityId}" target="EditAgreementItemFacility" also-hidden="false">
                <parameter param-name="facilityId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
        <field name="internalName" entry-name="facilityId">
            <display-entity entity-name="Facility" key-field-name="facilityId" description="${internalName}"/>
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonRemove}" target="removeAgreementItemFacility" also-hidden="false">
                <parameter param-name="facilityId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
    </grid>
    
    <grid name="ListAgreementItemSupplierProducts" list-name="agreementProducts" target="" title="" paginate-target="ListAgreementItemSupplierProducts"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <auto-fields-entity entity-name="SupplierProduct" default-field-type="display"/>
        <field name="agreementId"><hidden/></field>
        <field name="agreementItemSeqId"><hidden/></field>
        <field name="partyId"><hidden/></field>
        <field name="currencyUomId"><hidden/></field>
        <field name="productId" title="${uiLabelMap.CommonEdit}" widget-style="buttontext">
            <hyperlink description="${productId}" target="EditAgreementItemSupplierProduct" also-hidden="false">
                <parameter param-name="minimumOrderQuantity"/>
                <parameter param-name="currencyUomId"/>
                <parameter param-name="availableFromDate"/>
                <parameter param-name="partyId"/>
                <parameter param-name="productId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
        <field name="internalName" entry-name="productId">
            <display-entity entity-name="Product" key-field-name="productId" description="${internalName}"/>
        </field>
        <field name="lastPrice"><display type="currency" currency="${agreementItem.currencyUomId}"/></field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonRemove}" target="removeAgreementItemSupplierProduct" also-hidden="false">
                <parameter param-name="minimumOrderQuantity"/>
                <parameter param-name="currencyUomId"/>
                <parameter param-name="availableFromDate"/>
                <parameter param-name="partyId"/>
                <parameter param-name="productId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
    </grid>

    <form name="ViewAgreementInfoForReport" type="single" title="" default-map-name="agreement"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="agreementId"><text/></field>
        <field name="partyIdFrom"><text/></field>
        <field name="partyIdTo">
            <display-entity entity-name="PartyGroup" key-field-name="partyId" description="${partyId} - ${groupName}"/>
        </field>
        <field name="fromDate"><display/></field>
        <field name="thruDate" title="${uiLabelMap.AccountingThruDate}"><display/></field>
        <field name="description"><display/></field>
    </form>
    <form name="ViewAgreementItemInfoForReport" type="single" title="" default-map-name="agreementItem"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="agreementItemSeqId"><display/></field>
        <field name="currencyUomId"><display/></field>
    </form>
    
    <grid name="ListAgreementItemProductsForReport" list-name="agreementProducts" target="" title=""
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <field name="productId" title-area-style="tableheadmedium"><display/></field>
        <field name="internalName" entry-name="productId">
            <display-entity entity-name="Product" key-field-name="productId" description="${internalName}"/>
        </field>
        <field name="price" title-area-style="tableheadmedium"><display type="currency" currency="${agreementItem.currencyUomId}"/></field>
    </grid>
    
    <grid name="ListAgreementItemSupplierProductsForReport" list-name="agreementProducts" target="" title=""
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <field name="productId" title-area-style="tableheadmedium"><display/></field>
        <field name="supplierProductId" title-area-style="tableheadmedium"><display/></field>
        <field name="internalName" entry-name="productId">
            <display-entity entity-name="Product" key-field-name="productId" description="${internalName}"/>
        </field>
        <field name="lastPrice" title-area-style="tableheadmedium"><display type="currency" currency="${agreementItem.currencyUomId}"/></field>
    </grid>
    
    <form name="EditAgreementItemProduct" type="single" target="updateAgreementItemProduct" title="" default-map-name="agreementProductAppl"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="agreementProductAppl==null" target="createAgreementItemProduct"/>
        <auto-fields-entity entity-name="AgreementProductAppl" default-field-type="edit"/>
        <field name="agreementId"><hidden/></field>
        <field name="agreementItemSeqId"><hidden/></field>
        <field name="productId" use-when="agreementProductAppl==null" required-field="true">
            <lookup target-form-name="LookupProduct"/>
        </field>
        <field name="productId" use-when="agreementProductAppl!=null"><display/></field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>
    <form name="EditAgreementItemFacility" type="single" target="updateAgreementItemFacility" title="" default-map-name="agreementFacilityAppl"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="agreementFacilityAppl==null" target="createAgreementItemFacility"/>
        <auto-fields-entity entity-name="AgreementFacilityAppl" default-field-type="edit"/>
        <field name="agreementId"><hidden/></field>
        <field name="agreementItemSeqId"><hidden/></field>
        <field name="facilityId" use-when="agreementFacilityAppl==null" required-field="true">
            <lookup target-form-name="LookupFacility"/>
        </field>
        <field name="facilityId" use-when="agreementFacilityAppl!=null"><display/></field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>
    <form name="EditAgreementItemSupplierProduct" type="single" target="updateAgreementItemSupplierProduct" title="" default-map-name="agreementProductAppl"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="agreementProductAppl==null" target="createAgreementItemSupplierProduct"/>
        <auto-fields-entity entity-name="SupplierProduct" default-field-type="edit"/>
        <field name="agreementId"><hidden/></field>
        <field name="agreementItemSeqId"><hidden/></field>
        <field name="partyId"><hidden value="${agreement.partyIdTo}"/></field>
        <field name="currencyUomId"><hidden value="${agreementItem.currencyUomId}"/></field>
        <field name="availableFromDate" use-when="agreementProductAppl==null">
            <!--<date-time default-value="${groovy: org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp()}"/>-->
            <date-time default-value="${agreement.fromDate}"/>
        </field>
        <field name="availableFromDate" use-when="agreementProductAppl!=null">
            <display/>
        </field>
        <field name="minimumOrderQuantity" use-when="agreementProductAppl==null">
            <text default-value="0" size="5"/>
        </field>
        <field name="minimumOrderQuantity" use-when="agreementProductAppl!=null">
            <display/>
        </field>
        <field name="productId" use-when="agreementProductAppl==null">
            <lookup target-form-name="LookupProduct"/>
        </field>
        <field name="productId" use-when="agreementProductAppl!=null"><display/></field>
        <field name="supplierPrefOrderId">
            <drop-down allow-empty="true">
                <entity-options entity-name="SupplierPrefOrder" key-field-name="supplierPrefOrderId">
                    <entity-order-by field-name="supplierPrefOrderId"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="supplierRatingTypeId">
            <drop-down allow-empty="true">
                <entity-options entity-name="SupplierRatingType" key-field-name="supplierRatingTypeId">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="quantityUomId" title="${uiLabelMap.ProductQuantityUomId}">
            <drop-down allow-empty="true">
                <entity-options entity-name="UomAndType" key-field-name="uomId" description="${typeDescription}: ${description} (${abbreviation})">
                    <entity-constraint name="uomTypeId" operator="not-equals" value="CURRENCY_MEASURE"/>
                    <entity-order-by field-name="typeDescription"/>
                    <entity-order-by field-name="uomId"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}">
            <submit button-type="button"/>
        </field>
    </form>

    <grid name="ListAgreementPromoAppls" list-name="agreementPromoAppls" target="" title="" paginate-target="ListAgreementPromoAppls"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <auto-fields-entity entity-name="AgreementPromoAppl" default-field-type="display"/>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.AccountingAgreementItemSeqId}"><hidden/></field>
        <field name="productPromoId" title="${uiLabelMap.CommonEdit}" widget-style="buttontext">
            <hyperlink description="${productPromoId}" target="EditAgreementPromoAppl" also-hidden="false">
                <parameter param-name="productPromoId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
                <parameter param-name="fromDate"/>
            </hyperlink>
        </field>
        <field name="productPromoName" entry-name="productPromoId">
            <display-entity entity-name="ProductPromo" key-field-name="productPromoId" description="${promoName}"/>
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonRemove}" target="removeAgreementPromoAppl" also-hidden="false">
                <parameter param-name="productPromoId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
                <parameter param-name="fromDate"/>
            </hyperlink>
        </field>
    </grid>
    
    <form name="EditAgreementPromoAppl" type="single" target="updateAgreementPromoAppl" title="" default-map-name="agreementPromoAppl"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="agreementPromoAppl==null" target="createAgreementPromoAppl"/>
        <auto-fields-entity entity-name="AgreementPromoAppl" default-field-type="edit"/>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.AccountingAgreementItemSeqId}"><hidden/></field>
        <field use-when="agreementPromoAppl!=null" name="productPromoId" title="${uiLabelMap.FormFieldTitle_productPromoId}">
            <display-entity entity-name="ProductPromo" key-field-name="productPromoId" description="${promoName}"/>
        </field>
        <field name="productPromoId" use-when="agreementPromoAppl==null">
            <drop-down allow-empty="true">
                <entity-options description="${promoName}" entity-name="ProductPromo" key-field-name="productPromoId"/>
            </drop-down>
        </field>

        <field use-when="agreementPromoAppl!=null" name="fromDate"><display/></field>
        <field use-when="agreementPromoAppl==null" name="fromDate"><date-time default-value="${nowTimestamp}"/></field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>
    
    <grid name="ListAgreementItemParties" list-name="agreementParties" target="" title="" paginate-target="ListAgreementItemParties"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <auto-fields-entity entity-name="AgreementPartyApplic" default-field-type="display"/>
        <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><hidden/></field>
        <field name="agreementItemSeqId" title="${uiLabelMap.AccountingAgreementItemSeqId}"><hidden/></field>
        <field name="partyId" title="${uiLabelMap.CommonEdit}" widget-style="buttontext">
           <hyperlink description="${partyId}" target="EditAgreementItemParty" also-hidden="false">
                <parameter param-name="partyId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
        <field name="partyName" title="${uiLabelMap.PartyName}" entry-name="partyId">
            <display-entity entity-name="PartyNameView" key-field-name="partyId" description="${groupName} ${firstName} ${lastName}"/>
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="removeAgreementItemParty" also-hidden="false">
                <parameter param-name="partyId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
    </grid>
    
    <form name="EditAgreementItemParty" type="single" target="updateAgreementItemParty" title="" default-map-name="agreementPartyApplic"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="agreementPartyApplic==null" target="createAgreementItemParty"/>
        <auto-fields-entity entity-name="AgreementPartyApplic" default-field-type="edit"/>
        <field name="agreementId"><hidden/></field>
        <field name="agreementItemSeqId"><hidden/></field>
        <field name="partyId" use-when="agreementPartyApplic==null" required-field="true">
            <lookup target-form-name="LookupPartyName"/>
        </field>
        <field name="partyId" use-when="agreementPartyApplic!=null"><display/></field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>
    
    <grid name="ListAgreementGeographicalApplic" target="" title="" list-name="agreementGeographicalApplics" paginate-target="ListAgreementGeographicalApplic"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <auto-fields-entity entity-name="AgreementGeographicalApplic" default-field-type="display"/>
        <field name="agreementId"><hidden/></field>
        <field name="agreementItemSeqId"><hidden/></field>
        <field name="geoId" title="${uiLabelMap.CommonDescription}">
            <display-entity entity-name="Geo" key-field-name="geoId" description="${geoName} [${geoId}]"/>
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="removeAgreementGeographicalApplic" also-hidden="false">
                <parameter param-name="geoId"/>
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
            </hyperlink>
        </field>
    </grid>
    
    <form name="EditAgreementGeographicalApplic" type="single" target="updateAgreementGeographicalApplic" title="" default-map-name="agreementGeographicalApplic"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="agreementGeographicalApplic==null" target="createAgreementGeographicalApplic"/>
        <auto-fields-entity entity-name="AgreementGeographicalApplic" default-field-type="edit"/>
        <field name="agreementId"><hidden/></field>
        <field name="agreementItemSeqId"><hidden/></field>
        <field name="geoId" use-when="agreementGeographicalApplic==null">
            <drop-down allow-empty="false">
                <entity-options entity-name="Geo" description="${geoName} [${geoId}]">
                    <entity-order-by field-name="geoName"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="geoId" use-when="agreementGeographicalApplic!=null"><display/></field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>
    <!-- Agreement WorkEffort Applic-->
    <form name="AddAgreementWorkEffortApplic" target="createAgreementWorkEffortApplic" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="agreementId"><hidden value="${agreementId}"/></field>
        <field name="agreementItemSeqId">
            <drop-down allow-empty="false">
                <option key="_NA_" description="${uiLabelMap.CommonNA}"/>
                <entity-options entity-name="AgreementItem" description="${agreementItemSeqId}">
                    <entity-constraint name="agreementId" operator="equals" env-name="agreementId"/>
                    <entity-order-by field-name="agreementItemSeqId"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="workEffortId">
            <lookup target-form-name="LookupWorkEffort"/>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>
    <grid name="ListAgreementWorkEffortApplics" target="updateAgreementWorkEffortApplic" list-name="agreementWorkEffortApplics"
        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
        <actions>
            <entity-and entity-name="AgreementWorkEffortApplic" use-cache="true" list="agreementWorkEffortApplics">
                <field-map field-name="agreementId" from-field="agreementId"/>
            </entity-and>
        </actions>
        <field name="agreementItemSeqId"><display/></field>
        <field name="workEffortId"><display/></field>
        <field name="deleteLink" title=" " widget-style="buttontext">
           <hyperlink description="${uiLabelMap.CommonDelete}" target="deleteAgreementWorkEffortApplic" also-hidden="false">
                <parameter param-name="agreementId"/>
                <parameter param-name="agreementItemSeqId"/>
                <parameter param-name="workEffortId"/>
            </hyperlink>
        </field>
    </grid>
    
    <grid name="ListAgreementRoles" list-name="agreementRoles" paginate-target="EditAgreementRoles"
        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
        <actions>
            <entity-and entity-name="AgreementRole" use-cache="true" list="agreementRoles">
                <field-map field-name="agreementId" from-field="agreementId"/>
            </entity-and>
        </actions>
        <auto-fields-entity entity-name="AgreementRole" default-field-type="display"/>
        <field name="agreementId"><hidden/></field>
        <field name="partyId" title="${uiLabelMap.PartyPartyId}"><display/></field>
        <field name="roleTypeId" title="${uiLabelMap.PartyRoleTypeId}"><display/></field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonRemove}" target="deleteAgreementRole" also-hidden="false">
                <parameter param-name="agreementId"/>
                <parameter param-name="partyId"/>
                <parameter param-name="roleTypeId"/>
            </hyperlink>
        </field>
    </grid>
    <form name="AddAgreementRole" type="single" target="createAgreementRole"
        header-row-style="header-row" default-table-style="basic-table">
        <auto-fields-entity entity-name="AgreementRole" default-field-type="edit"/>
        <field name="agreementId"><hidden/></field>
        <field name="partyId" title="${uiLabelMap.PartyPartyId}" required-field="true"><lookup target-form-name="LookupPartyName"/></field>
        <field name="roleTypeId" title="${uiLabelMap.PartyRoleTypeId}" required-field="true">
            <drop-down allow-empty="true">
                <entity-options entity-name="RoleType" key-field-name="roleTypeId"/>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>
</forms>
