<?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.
-->

<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entitymodel.xsd">
    <!-- ========================================================= -->
    <!-- ======================== Defaults ======================= -->
    <!-- ========================================================= -->
    <title>Entity of an Apache OFBiz Component</title>
    <description>None</description>
    <version>1.0</version>

    <!-- ========================================================= -->
    <!-- ======================== Data Model ===================== -->
    <!-- The modules in this file are as follows:                  -->
    <!--  - org.apache.ofbiz.accounting.budget -->
    <!--  - org.apache.ofbiz.accounting.finaccount -->
    <!--  - org.apache.ofbiz.accounting.fixedasset -->
    <!--  - org.apache.ofbiz.accounting.invoice -->
    <!--  - org.apache.ofbiz.accounting.ledger -->
    <!--  - org.apache.ofbiz.accounting.payment -->
    <!--  - org.apache.ofbiz.accounting.rate -->
    <!--  - org.apache.ofbiz.accounting.tax -->
    <!-- ========================================================= -->


    <!-- ========================================================= -->
    <!-- org.apache.ofbiz.accounting.budget -->
    <!-- ========================================================= -->

    <entity entity-name="Budget"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget">
      <field name="budgetId" type="id"></field>
      <field name="budgetTypeId" type="id"></field>
      <field name="customTimePeriodId" type="id"></field>
      <field name="comments" type="comment"></field>
      <prim-key field="budgetId"/>
      <relation type="one" fk-name="BUDGET_BGTTYP" rel-entity-name="BudgetType">
        <key-map field-name="budgetTypeId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_CTP" rel-entity-name="CustomTimePeriod">
        <key-map field-name="customTimePeriodId"/>
      </relation>
      <relation type="many" rel-entity-name="BudgetTypeAttr">
        <key-map field-name="budgetTypeId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetAttribute"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Attribute">
      <field name="budgetId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="budgetId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="BUDGET_ATTR_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
      <relation type="many" rel-entity-name="BudgetTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="BudgetItem"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Item">
      <field name="budgetId" type="id"></field>
      <field name="budgetItemSeqId" type="id"></field>
      <field name="budgetItemTypeId" type="id"></field>
      <field name="amount" type="currency-amount"></field>
      <field name="purpose" type="long-varchar"></field>
      <field name="justification" type="long-varchar"></field>
      <prim-key field="budgetId"/>
      <prim-key field="budgetItemSeqId"/>
      <relation type="one" fk-name="BDGTITM_TO_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_ITEM_BTYP" rel-entity-name="BudgetItemType">
        <key-map field-name="budgetItemTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="BudgetItemTypeAttr">
        <key-map field-name="budgetItemTypeId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetItemAttribute"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Item Attribute">
      <field name="budgetId" type="id"></field>
      <field name="budgetItemSeqId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="budgetId"/>
      <prim-key field="budgetItemSeqId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="BUDGET_ITEM_ATTR" rel-entity-name="BudgetItem">
        <key-map field-name="budgetId"/>
        <key-map field-name="budgetItemSeqId"/>
      </relation>
      <relation type="many" rel-entity-name="BudgetItemTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="BudgetItemType"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Item Type">
      <field name="budgetItemTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="budgetItemTypeId"/>
      <relation type="one" fk-name="BUDGET_ITM_TYPPAR" title="Parent" rel-entity-name="BudgetItemType">
        <key-map field-name="parentTypeId" rel-field-name="budgetItemTypeId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetItemTypeAttr"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Item Type Attribute">
      <field name="budgetItemTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="budgetItemTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="BUDGET_ITMTYPATTR" rel-entity-name="BudgetItemType">
        <key-map field-name="budgetItemTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="BudgetItemAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="BudgetItem">
        <key-map field-name="budgetItemTypeId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetReview"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Review">
      <field name="budgetId" type="id"></field>
      <field name="budgetReviewId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="budgetReviewResultTypeId" type="id"></field>
      <field name="reviewDate" type="date-time"></field>
      <prim-key field="budgetId"/>
      <prim-key field="budgetReviewId"/>
      <prim-key field="partyId"/>
      <prim-key field="budgetReviewResultTypeId"/>
      <relation type="one" fk-name="BUDGET_RVW_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_RVW_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_RVW_RTYPE" rel-entity-name="BudgetReviewResultType">
        <key-map field-name="budgetReviewResultTypeId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetReviewResultType"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Review Result Type">
      <field name="budgetReviewResultTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <field name="comments" type="comment"></field>
      <prim-key field="budgetReviewResultTypeId"/>
    </entity>
    <entity entity-name="BudgetRevision"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Revision">
      <field name="budgetId" type="id"></field>
      <field name="revisionSeqId" type="id"></field>
      <field name="dateRevised" type="date-time"></field>
      <prim-key field="budgetId"/>
      <prim-key field="revisionSeqId"/>
      <relation type="one" fk-name="BUDGET_RVSN_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetRevisionImpact"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Revision Impact">
      <field name="budgetId" type="id"></field>
      <field name="budgetItemSeqId" type="id"></field>
      <field name="revisionSeqId" type="id"></field>
      <field name="revisedAmount" type="currency-amount"></field>
      <field name="addDeleteFlag" type="indicator"></field>
      <field name="revisionReason" type="long-varchar"></field>
      <prim-key field="budgetId"/>
      <prim-key field="budgetItemSeqId"/>
      <prim-key field="revisionSeqId"/>
      <relation type="one" fk-name="BUDGET_RNIMP_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_RNIMP_BITM" rel-entity-name="BudgetItem">
        <key-map field-name="budgetId"/>
        <key-map field-name="budgetItemSeqId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_RNIMP_REV" rel-entity-name="BudgetRevision">
        <key-map field-name="budgetId"/>
        <key-map field-name="revisionSeqId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetRole"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Role">
      <field name="budgetId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <prim-key field="budgetId"/>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <relation type="one" fk-name="BUDGET_ROLE_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_ROLE_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_ROLE_PROLE" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetScenario"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Scenario">
      <field name="budgetScenarioId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="budgetScenarioId"/>
    </entity>
    <entity entity-name="BudgetScenarioApplication"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Scenario Application">
      <field name="budgetScenarioApplicId" type="id"></field>
      <field name="budgetScenarioId" type="id"></field>
      <field name="budgetId" type="id"></field>
      <field name="budgetItemSeqId" type="id"></field>
      <field name="amountChange" type="currency-amount"></field>
      <field name="percentageChange" type="fixed-point"></field>
      <prim-key field="budgetScenarioApplicId"/>
      <prim-key field="budgetScenarioId"/>
      <relation type="one" fk-name="BUDGET_SAPL_BSCN" rel-entity-name="BudgetScenario">
        <key-map field-name="budgetScenarioId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_SAPL_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_SAPL_BITM" rel-entity-name="BudgetItem">
        <key-map field-name="budgetId"/>
        <key-map field-name="budgetItemSeqId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetScenarioRule"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Scenario Rule">
      <field name="budgetScenarioId" type="id"></field>
      <field name="budgetItemTypeId" type="id"></field>
      <field name="amountChange" type="currency-amount"></field>
      <field name="percentageChange" type="fixed-point"></field>
      <prim-key field="budgetScenarioId"/>
      <prim-key field="budgetItemTypeId"/>
      <relation type="one" fk-name="BUDGET_SRLE_BSCN" rel-entity-name="BudgetScenario">
        <key-map field-name="budgetScenarioId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_SRLE_BITP" rel-entity-name="BudgetItemType">
        <key-map field-name="budgetItemTypeId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetStatus"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Status">
      <field name="budgetId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="statusDate" type="date-time"></field>
      <field name="comments" type="comment"></field>
      <field name="changeByUserLoginId" type="id-vlong"></field>
      <prim-key field="budgetId"/>
      <prim-key field="statusId"/>
      <relation type="one" fk-name="BUDGET_STTS_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_STTS_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="BUDGET_STTS_USRLGN" title="ChangeBy" rel-entity-name="UserLogin">
          <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetType"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Type">
      <field name="budgetTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="budgetTypeId"/>
      <relation type="one" fk-name="BUDGET_TYPE_PAR" title="Parent" rel-entity-name="BudgetType">
        <key-map field-name="parentTypeId" rel-field-name="budgetTypeId"/>
      </relation>
    </entity>
    <entity entity-name="BudgetTypeAttr"
            package-name="org.apache.ofbiz.accounting.budget"
            title="Budget Type Attribute">
      <field name="budgetTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="budgetTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="BUDGET_TPATR_BT" rel-entity-name="BudgetType">
        <key-map field-name="budgetTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="BudgetAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="Budget">
        <key-map field-name="budgetTypeId"/>
      </relation>
    </entity>

    <!-- ========================================================= -->
    <!-- org.apache.ofbiz.accounting.finaccount -->
    <!-- financial account entities for gift certificates, calling cards, or customer accounts -->
    <!-- ========================================================= -->

    <entity entity-name="FinAccount" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account">
        <field name="finAccountId" type="id"></field>
        <field name="finAccountTypeId" type="id"></field>
        <field name="statusId" type="id"></field>
        <field name="finAccountName" type="name"></field>
        <field name="finAccountCode" type="long-varchar" encrypt="true"></field>
        <field name="finAccountPin" type="long-varchar" encrypt="true"></field>
        <field name="currencyUomId" type="id"/>
        <field name="organizationPartyId" type="id"><description>The internal organization Party that owns (or rather, is liable for) the account.</description></field>
        <field name="ownerPartyId" type="id"><description>The customer or third party that owns the account.</description></field>
        <field name="postToGlAccountId" type="id"></field>
        <field name="fromDate" type="date-time"><description>Describes when account will be valid. If null, valid immediately.</description></field>
        <field name="thruDate" type="date-time"><description>Expiration date of the account. If null, will never expire.</description></field>
        <field name="isRefundable" type="indicator"></field>
        <field name="replenishPaymentId" type="id"></field>
        <field name="replenishLevel" type="currency-amount"></field>
        <field name="actualBalance" type="currency-amount"><description>Calculated as the sum of FinAccountTrans.amount</description></field>
        <field name="availableBalance" type="currency-amount"><description>Calculated as actualBalance minus sum of outstanding FinAccountAuth.amount</description></field>
        <prim-key field="finAccountId"/>
        <relation type="one" fk-name="FINACCT_TYPE" rel-entity-name="FinAccountType">
            <key-map field-name="finAccountTypeId"/>
        </relation>
        <relation type="one" fk-name="FINACCT_CURUOM" title="Currency" rel-entity-name="Uom">
            <key-map field-name="currencyUomId" rel-field-name="uomId"/>
        </relation>
        <relation type="one" fk-name="FINACCT_ORGPTY" title="Organization" rel-entity-name="Party">
            <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="FINACCT_OWNPTY" title="Owner" rel-entity-name="Party">
            <key-map field-name="ownerPartyId" rel-field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="FINACCT_GLAC" title="PostTo" rel-entity-name="GlAccount">
            <key-map field-name="postToGlAccountId" rel-field-name="glAccountId"/>
        </relation>
        <relation type="one" fk-name="FINACCT_PAYMETH" title="Replenish" rel-entity-name="PaymentMethod">
            <key-map field-name="replenishPaymentId" rel-field-name="paymentMethodId"/>
        </relation>
        <relation type="many" rel-entity-name="FinAccountTypeAttr">
            <key-map field-name="finAccountTypeId"/>
        </relation>
    </entity>
    <view-entity entity-name="FinAccountAndRole" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account and Role View">
      <member-entity entity-alias="FA" entity-name="FinAccount"/>
      <member-entity entity-alias="FR" entity-name="FinAccountRole"/>
      <alias-all entity-alias="FA"/>
      <alias name="partyId" entity-alias="FR"/>
      <alias name="roleTypeId" entity-alias="FR"/>
      <alias name="roleFromDate" entity-alias="FR" field="fromDate"/>
      <alias name="roleThruDate" entity-alias="FR" field="thruDate"/>
      <view-link entity-alias="FA" rel-entity-alias="FR">
        <key-map field-name="finAccountId"/>
      </view-link>
    </view-entity>
    <entity entity-name="FinAccountAttribute" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Attribute">
        <field name="finAccountId" type="id"></field>
        <field name="attrName" type="id-long"></field>
        <field name="attrValue" type="value"></field>
        <field name="attrDescription" type="description"></field>
        <prim-key field="finAccountId"/>
        <prim-key field="attrName"/>
        <relation type="one" fk-name="FINACCT_ATTR" rel-entity-name="FinAccount">
            <key-map field-name="finAccountId"/>
        </relation>
        <relation type="many" rel-entity-name="FinAccountTypeAttr">
            <key-map field-name="attrName"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountAuth" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Authorizations record">
        <field name="finAccountAuthId" type="id"/>
        <field name="finAccountId" type="id"/>
        <field name="amount" type="currency-amount"/>
        <field name="currencyUomId" type="id"/>
        <field name="authorizationDate" type="date-time"/>
        <field name="fromDate" type="date-time"/>
        <field name="thruDate" type="date-time"/>
        <prim-key field="finAccountAuthId"/>
        <relation type="one" fk-name="FINACT_AUTH_FINACT" rel-entity-name="FinAccount">
            <key-map field-name="finAccountId"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountRole" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Role">
        <field name="finAccountId" type="id"></field>
        <field name="partyId" type="id"></field>
        <field name="roleTypeId" type="id"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <prim-key field="finAccountId"/>
        <prim-key field="partyId"/>
        <prim-key field="roleTypeId"/>
        <prim-key field="fromDate"/>
        <relation type="one" fk-name="FIN_ACT_RL_FNACT" rel-entity-name="FinAccount">
            <key-map field-name="finAccountId"/>
        </relation>
        <relation type="one-nofk" rel-entity-name="Party">
            <key-map field-name="partyId"/>
        </relation>
        <relation type="one-nofk" rel-entity-name="RoleType">
            <key-map field-name="roleTypeId"/>
        </relation>
        <relation type="one" fk-name="FIN_ACT_RL_RTRL" rel-entity-name="PartyRole">
            <key-map field-name="partyId"/>
            <key-map field-name="roleTypeId"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountStatus" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Status">
        <field name="finAccountId" type="id"></field>
        <field name="statusId" type="id"></field>
        <field name="statusDate" type="date-time"></field>
        <field name="statusEndDate" type="date-time"></field>
        <field name="changeByUserLoginId" type="id-vlong"/>
        <prim-key field="finAccountId"/>
        <prim-key field="statusId"/>
        <prim-key field="statusDate"/>
        <relation type="one" fk-name="FINACT_STTS_FNA" rel-entity-name="FinAccount">
            <key-map field-name="finAccountId"/>
        </relation>
        <relation type="one" fk-name="FINACT_STTS_STI" rel-entity-name="StatusItem">
            <key-map field-name="statusId"/>
        </relation>
        <relation type="one" fk-name="FINACT_STTS_USER" rel-entity-name="UserLogin">
            <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountTrans" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Transaction">
        <field name="finAccountTransId" type="id"></field>
        <field name="finAccountTransTypeId" type="id"></field>
        <field name="finAccountId" type="id"></field>
        <field name="partyId" type="id"></field>
        <field name="glReconciliationId" type="id"></field>
        <field name="transactionDate" type="date-time"></field>
        <field name="entryDate" type="date-time"></field>
        <field name="amount" type="currency-amount"></field>
        <field name="paymentId" type="id"></field>
        <field name="orderId" type="id"></field>
        <field name="orderItemSeqId" type="id"><description>To be used along with orderId to point to an OrderItem that represents the purchase of a product to add money to the account.</description></field>
        <field name="performedByPartyId" type="id"></field>
        <field name="reasonEnumId" type="id"></field>
        <field name="comments" type="comment"></field>
        <field name="statusId" type="id"></field>
        <prim-key field="finAccountTransId"/>
        <relation type="one" fk-name="FINACCT_TX_TYPE" rel-entity-name="FinAccountTransType">
            <key-map field-name="finAccountTransTypeId"/>
        </relation>
        <relation type="many" rel-entity-name="FinAccountTransTypeAttr">
            <key-map field-name="finAccountTransTypeId"/>
        </relation>
        <relation type="one" fk-name="FIN_ACT_TX_FNACT" rel-entity-name="FinAccount">
            <key-map field-name="finAccountId"/>
        </relation>
        <relation type="one" fk-name="FIN_ACT_TX_PARTY" rel-entity-name="Party">
            <key-map field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="FIN_ACT_TX_PMT" rel-entity-name="Payment">
            <key-map field-name="paymentId"/>
        </relation>
        <relation type="one" fk-name="FIN_ACT_TX_ODITM" rel-entity-name="OrderItem">
            <key-map field-name="orderId"/>
            <key-map field-name="orderItemSeqId"/>
        </relation>
        <relation type="one" fk-name="FIN_ACT_TX_PBPTY" title="PerformedBy" rel-entity-name="Party">
            <key-map field-name="performedByPartyId" rel-field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="FIN_ACT_REAS_ENUM" title="Reason" rel-entity-name="Enumeration">
            <key-map field-name="reasonEnumId" rel-field-name="enumId"/>
        </relation>
        <relation type="one" fk-name="FIN_ACT_TX_STI" rel-entity-name="StatusItem">
            <key-map field-name="statusId"/>
        </relation>
        <relation type="one" fk-name="FIN_ACT_TX_GLREC" rel-entity-name="GlReconciliation">
            <key-map field-name="glReconciliationId"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountTransAttribute" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Transaction Attribute">
        <field name="finAccountTransId" type="id"></field>
        <field name="attrName" type="id-long"></field>
        <field name="attrValue" type="value"></field>
        <field name="attrDescription" type="description"></field>
        <prim-key field="finAccountTransId"/>
        <prim-key field="attrName"/>
        <relation type="one" fk-name="FINACCT_TX_ATTR" rel-entity-name="FinAccountTrans">
            <key-map field-name="finAccountTransId"/>
        </relation>
        <relation type="many" rel-entity-name="FinAccountTransTypeAttr">
            <key-map field-name="attrName"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountTransType"
            package-name="org.apache.ofbiz.accounting.finaccount"
            default-resource-name="AccountingEntityLabels"
            title="Financial Account Transaction Type">
        <field name="finAccountTransTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="hasTable" type="indicator"></field>
        <field name="description" type="description"></field>
        <prim-key field="finAccountTransTypeId"/>
        <relation type="one" fk-name="FINACCT_TX_TYPPAR" title="Parent" rel-entity-name="FinAccountTransType">
            <key-map field-name="parentTypeId" rel-field-name="finAccountTransTypeId"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountTransTypeAttr" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Transaction Type Attribute">
        <field name="finAccountTransTypeId" type="id"></field>
        <field name="attrName" type="id-long"></field>
        <field name="description" type="description"></field>
        <prim-key field="finAccountTransTypeId"/>
        <prim-key field="attrName"/>
        <relation type="one" fk-name="FINACCT_TX_TYPATR" rel-entity-name="FinAccountTransType">
            <key-map field-name="finAccountTransTypeId"/>
        </relation>
        <relation type="many" rel-entity-name="FinAccountTransAttribute">
            <key-map field-name="attrName"/>
        </relation>
        <relation type="many" rel-entity-name="FinAccountTrans">
            <key-map field-name="finAccountTransTypeId"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountType"
            package-name="org.apache.ofbiz.accounting.finaccount"
            default-resource-name="AccountingEntityLabels"
            title="Financial Account Type">
        <field name="finAccountTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="replenishEnumId" type="id"></field>
        <field name="isRefundable" type="indicator"></field>
        <field name="hasTable" type="indicator"></field>
        <field name="description" type="description"></field>
        <prim-key field="finAccountTypeId"/>
        <relation type="one" fk-name="FINACCT_TYPE_PAR" title="Parent" rel-entity-name="FinAccountType">
            <key-map field-name="parentTypeId" rel-field-name="finAccountTypeId"/>
        </relation>
        <relation type="one" fk-name="FINACCT_TYPE_RENUM" title="Replenish" rel-entity-name="Enumeration">
            <key-map field-name="replenishEnumId" rel-field-name="enumId"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountTypeAttr" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Type Attribute">
        <field name="finAccountTypeId" type="id"></field>
        <field name="attrName" type="id-long"></field>
        <field name="attrValue" type="long-varchar"></field>
        <field name="description" type="description"></field>
        <prim-key field="finAccountTypeId"/>
        <prim-key field="attrName"/>
        <relation type="one" fk-name="FINACCT_TYPE_ATTR" rel-entity-name="FinAccountType">
            <key-map field-name="finAccountTypeId"/>
        </relation>
        <relation type="many" rel-entity-name="FinAccountAttribute">
            <key-map field-name="attrName"/>
        </relation>
        <relation type="many" rel-entity-name="FinAccount">
            <key-map field-name="finAccountTypeId"/>
        </relation>
    </entity>
    <entity entity-name="FinAccountTypeGlAccount" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Type GL Account">
        <field name="finAccountTypeId" type="id"></field>
        <field name="organizationPartyId" type="id"></field>
        <field name="glAccountId" type="id"></field>
        <prim-key field="finAccountTypeId"/>
        <prim-key field="organizationPartyId"/>
        <relation type="one" fk-name="FINACCT_TGA_PMT" rel-entity-name="FinAccountType">
            <key-map field-name="finAccountTypeId"/>
        </relation>
        <relation type="one" fk-name="FINACCT_TGA_OPTY" title="Organization" rel-entity-name="Party">
            <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="FINACCT_TGA_GLAC" rel-entity-name="GlAccount">
            <key-map field-name="glAccountId"/>
        </relation>
    </entity>
    <view-entity entity-name="FinAccountTransSum" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Transactio Sum">
        <description>View entity to help calculate total of financial account transactions by doing a query for the sum of all amounts
            on a range of transactionDates for a given finAccountId, finAccountTransTypeId</description>
        <member-entity entity-alias="FAT" entity-name="FinAccountTrans"/>
        <alias entity-alias="FAT" name="finAccountId" group-by="true"/>
        <alias entity-alias="FAT" name="finAccountTransTypeId" group-by="false"/> <!-- must not group-by this, or aggregating DEPOSIT and ADJUSTMENT won't work -->
        <alias entity-alias="FAT" name="transactionDate" group-by="false"/>
        <alias entity-alias="FAT" name="amount" function="sum"/>
    </view-entity>
    <view-entity entity-name="FinAccountAuthSum" package-name="org.apache.ofbiz.accounting.finaccount" title="Financial Account Authorization Sum">
        <description>View entity to help calculate total of financial account authorizations by doing a query for the sum of all amounts
            on a range of transactionDates for a given finAccountId.  Note there is no auth type to consider here, but authorizations do
            have from and thru dates</description>
        <member-entity entity-alias="FAA" entity-name="FinAccountAuth"/>
        <alias entity-alias="FAA" name="finAccountId" group-by="true"/>
        <alias entity-alias="FAA" name="authorizationDate" group-by="false"/>
        <alias entity-alias="FAA" name="fromDate" group-by="false"/>
        <alias entity-alias="FAA" name="thruDate" group-by="false"/>
        <alias entity-alias="FAA" name="amount" function="sum"/>
    </view-entity>

    <!-- ========================================================= -->
    <!-- org.apache.ofbiz.accounting.fixedasset -->
    <!-- ========================================================= -->

    <entity entity-name="FixedAsset" package-name="org.apache.ofbiz.accounting.fixedasset" title="Fixed Asset">
        <field name="fixedAssetId" type="id"></field>
        <field name="fixedAssetTypeId" type="id"></field>
        <field name="parentFixedAssetId" type="id"></field>
        <field name="instanceOfProductId" type="id"></field>
        <field name="classEnumId" type="id"></field>
        <field name="partyId" type="id"></field>
        <field name="roleTypeId" type="id"></field>
        <field name="fixedAssetName" type="name"></field>
        <field name="acquireOrderId" type="id"></field>
        <field name="acquireOrderItemSeqId" type="id"></field>
        <field name="dateAcquired" type="date-time"></field>
        <field name="dateLastServiced" type="date-time"></field>
        <field name="dateNextService" type="date-time"></field>
        <field name="expectedEndOfLife" type="date"></field>
        <field name="actualEndOfLife" type="date"></field>
        <field name="productionCapacity" type="fixed-point"></field>
        <field name="uomId" type="id"></field>
        <field name="calendarId" type="id"></field>
        <field name="serialNumber" type="long-varchar"></field>
        <field name="locatedAtFacilityId" type="id"></field>
        <field name="locatedAtLocationSeqId" type="id"></field>
        <field name="salvageValue" type="currency-amount"/>
        <field name="depreciation" type="currency-amount"/>
        <field name="purchaseCost" type="currency-amount"/>
        <field name="purchaseCostUomId" type="id"/>
        <prim-key field="fixedAssetId"/>
        <relation type="one" fk-name="FIXEDAST_TYPE" rel-entity-name="FixedAssetType">
            <key-map field-name="fixedAssetTypeId"/>
        </relation>
        <relation type="many" rel-entity-name="FixedAssetTypeAttr">
            <key-map field-name="fixedAssetTypeId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_PAR" title="Parent" rel-entity-name="FixedAsset">
            <key-map field-name="parentFixedAssetId" rel-field-name="fixedAssetId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_IOPROD" title="InstanceOf" rel-entity-name="Product">
            <key-map field-name="instanceOfProductId" rel-field-name="productId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_CLSENM" title="Class" rel-entity-name="Enumeration">
            <key-map field-name="classEnumId" rel-field-name="enumId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_PARTY" rel-entity-name="Party">
            <key-map field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_ROLETYP" rel-entity-name="RoleType">
            <key-map field-name="roleTypeId"/>
        </relation>
        <relation type="one-nofk" rel-entity-name="PartyRole">
            <key-map field-name="partyId"/>
            <key-map field-name="roleTypeId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_ORDHDR" title="Acquire" rel-entity-name="OrderHeader">
            <key-map field-name="acquireOrderId" rel-field-name="orderId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_ORDITM" title="Acquire" rel-entity-name="OrderItem">
            <key-map field-name="acquireOrderId" rel-field-name="orderId"/>
            <key-map field-name="acquireOrderItemSeqId" rel-field-name="orderItemSeqId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_UOM" rel-entity-name="Uom">
            <key-map field-name="uomId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_CALENDAR" rel-entity-name="TechDataCalendar">
            <key-map field-name="calendarId"/>
        </relation>
        <relation type="one" fk-name="FIXEDAST_FAC" title="LocatedAt" rel-entity-name="Facility">
            <key-map field-name="locatedAtFacilityId" rel-field-name="facilityId"/>
        </relation>
        <relation type="one-nofk" title="LocatedAt" rel-entity-name="FacilityLocation">
            <key-map field-name="locatedAtFacilityId" rel-field-name="facilityId"/>
            <key-map field-name="locatedAtLocationSeqId" rel-field-name="locationSeqId"/>
        </relation>
    </entity>
    <entity entity-name="FixedAssetAttribute"
            package-name="org.apache.ofbiz.accounting.fixedasset"
            title="Fixed Asset Attribute">
      <field name="fixedAssetId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="fixedAssetId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="FIXEDAST_ATTR" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetId"/>
      </relation>
      <relation type="many" rel-entity-name="FixedAssetTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="FixedAssetDepMethod"
            package-name="org.apache.ofbiz.accounting.fixedasset"
            title="Fixed Asset Depreciation Method">
      <field name="depreciationCustomMethodId" type="id"></field>
      <field name="fixedAssetId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="depreciationCustomMethodId"/>
      <prim-key field="fixedAssetId"/>
      <relation type="one" fk-name="FIXDAST_DM_CMET" rel-entity-name="CustomMethod">
        <key-map field-name="depreciationCustomMethodId" rel-field-name="customMethodId"/>
      </relation>
      <relation type="one" fk-name="FIXDAST_DM_FXAST" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetId"/>
      </relation>
    </entity>
    <entity entity-name="FixedAssetGeoPoint" package-name="org.apache.ofbiz.accounting.fixedasset" title="Fixed Asset Geo Location with history">
      <field name="fixedAssetId" type="id"></field>
      <field name="geoPointId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="fixedAssetId"/>
      <prim-key field="geoPointId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="FXDASTGEOPT_FXDAST" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetId"/>
      </relation>
      <relation type="one" fk-name="FXDASTGEOPT_GEOPT" rel-entity-name="GeoPoint">
        <key-map field-name="geoPointId"/>
      </relation>
    </entity>

    <view-entity entity-name="FixedAssetAndGeoPoint" package-name="org.apache.ofbiz.accounting.fixedasset" title="Fixed Asset and Geo Point View">
      <member-entity entity-alias="FA" entity-name="FixedAsset"/>
      <member-entity entity-alias="FAGPT" entity-name="FixedAssetGeoPoint"/>
      <member-entity entity-alias="GPT" entity-name="GeoPoint"/>
      <alias-all entity-alias="GPT"/>
      <alias entity-alias="FA" name="fixedAssetId"/>
      <alias entity-alias="FAGPT" name="fromDate"/>
      <alias entity-alias="FAGPT" name="thruDate"/>
      <view-link entity-alias="FA" rel-entity-alias="FAGPT">
        <key-map field-name="fixedAssetId"/>
      </view-link>
      <view-link entity-alias="FAGPT" rel-entity-alias="GPT">
        <key-map field-name="geoPointId"/>
      </view-link>
      <relation type="many" rel-entity-name="FixedAssetGeoPoint">
        <key-map field-name="fixedAssetId"/>
        <key-map field-name="geoPointId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="GeoPoint">
        <key-map field-name="geoPointId"/>
      </relation>
    </view-entity>

    <entity entity-name="FixedAssetIdent"
        package-name="org.apache.ofbiz.accounting.fixedasset"
        title="Fixed Asset Identification">
        <field name="fixedAssetId" type="id"></field>
        <field name="fixedAssetIdentTypeId" type="id"></field>
        <field name="idValue" type="long-varchar"></field>
        <prim-key field="fixedAssetId"/>
        <prim-key field="fixedAssetIdentTypeId"/>
        <relation type="one" fk-name="FIXDASTID_FXAST" rel-entity-name="FixedAsset">
            <key-map field-name="fixedAssetId"/>
        </relation>
        <relation type="one" fk-name="FIXDASTID_IDTYP" rel-entity-name="FixedAssetIdentType">
            <key-map field-name="fixedAssetIdentTypeId"/>
        </relation>
    </entity>
    <entity entity-name="FixedAssetIdentType"
        package-name="org.apache.ofbiz.accounting.fixedasset"
        default-resource-name="AccountingEntityLabels"
        title="Fixed Asset Identification Type">
        <field name="fixedAssetIdentTypeId" type="id"></field>
        <field name="description" type="description"></field>
        <prim-key field="fixedAssetIdentTypeId"/>
    </entity>
    <entity entity-name="FixedAssetMaint"
        package-name="org.apache.ofbiz.accounting.fixedasset"
        title="Fixed Asset Maintenance">
        <field name="fixedAssetId" type="id"></field>
        <field name="maintHistSeqId" type="id"></field>
        <field name="statusId" type="id"></field>
        <field name="productMaintTypeId" type="id"><description>If productMaintSeqId is known can lookup using that and the FixedAsset.productId; for un-scheduled maintenance is filled in directly</description></field>
        <field name="productMaintSeqId" type="id"><description>Optional, though should be filled in to determine upcoming maintenance for all scheduled maintenance</description></field>
        <field name="scheduleWorkEffortId" type="id"><description>Has field for estimated/actual start and finish dates, etc</description></field>
        <field name="intervalQuantity" type="fixed-point"></field>
        <field name="intervalUomId" type="id"><description>UOM for intervalQuantity; if used intervalMeterTypeId is generally not used (ie one or the other); if a meter reading is done as well that is not tied to the interval it should be tracked in a FixedAssetMeter record</description></field>
        <field name="intervalMeterTypeId" type="id"><description>Meter Type for intervalQuantity; if used intervalUomId is generally not used (ie one or the other)</description></field>
        <field name="purchaseOrderId" type="id"></field>
        <prim-key field="fixedAssetId"/>
        <prim-key field="maintHistSeqId"/>
        <relation type="one" fk-name="FXDASTMNT_FXAST" rel-entity-name="FixedAsset">
            <key-map field-name="fixedAssetId"/>
        </relation>
        <relation type="one" fk-name="FXDASTMNT_PMNTP" rel-entity-name="ProductMaintType">
            <key-map field-name="productMaintTypeId"/>
        </relation>
        <relation type="one" fk-name="FXDASTMNT_SCHWE" title="Schedule" rel-entity-name="WorkEffort">
            <key-map field-name="scheduleWorkEffortId" rel-field-name="workEffortId"/>
        </relation>
        <relation type="one" fk-name="FXDASTMNT_INTUOM" title="Interval" rel-entity-name="Uom">
            <key-map field-name="intervalUomId" rel-field-name="uomId"/>
        </relation>
        <relation type="one" fk-name="FXDASTMNT_PDMTTYP" title="Interval" rel-entity-name="ProductMeterType">
            <key-map field-name="intervalMeterTypeId" rel-field-name="productMeterTypeId"/>
        </relation>
        <relation type="one" fk-name="FXDASTMNT_PURORD" title="Purchase" rel-entity-name="OrderHeader">
            <key-map field-name="purchaseOrderId" rel-field-name="orderId"/>
        </relation>
        <relation type="one" fk-name="FXDASTMNT_SI" rel-entity-name="StatusItem">
            <key-map field-name="statusId"/>
        </relation>

    </entity>
    <entity entity-name="FixedAssetMeter"
        package-name="org.apache.ofbiz.accounting.fixedasset"
        title="Fixed Asset Meter">
        <field name="fixedAssetId" type="id"></field>
        <field name="productMeterTypeId" type="id"></field>
        <field name="readingDate" type="date-time"></field>
        <field name="meterValue" type="fixed-point"></field>
        <field name="readingReasonEnumId" type="id"></field>
        <field name="maintHistSeqId" type="id"></field>
        <field name="workEffortId" type="id"></field>
        <prim-key field="fixedAssetId"/>
        <prim-key field="productMeterTypeId"/>
        <prim-key field="readingDate"/>
        <relation type="one" fk-name="FXDASTMTR_FAMNT" rel-entity-name="FixedAssetMaint">
            <key-map field-name="fixedAssetId"/>
            <key-map field-name="maintHistSeqId"/>
        </relation>
        <relation type="one" fk-name="FXDASTMTR_PMTYP" rel-entity-name="ProductMeterType">
            <key-map field-name="productMeterTypeId"/>
        </relation>
    </entity>
    <entity entity-name="FixedAssetProduct"
            package-name="org.apache.ofbiz.accounting.fixedasset"
            title="Fixed Asset Product Representation">
      <field name="fixedAssetId" type="id"></field>
      <field name="productId" type="id"></field>
      <field name="fixedAssetProductTypeId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="comments" type="comment"></field>
      <field name="sequenceNum" type="numeric"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="quantityUomId" type="id"></field>
      <prim-key field="fixedAssetId"/>
      <prim-key field="productId"/>
      <prim-key field="fixedAssetProductTypeId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="FIXDASTPRD_PRD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="FIXDASTPRD_FA" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetId"/>
      </relation>
      <relation type="one" fk-name="FIXDASTPRD_FAPT" rel-entity-name="FixedAssetProductType">
        <key-map field-name="fixedAssetProductTypeId"/>
      </relation>
      <relation type="one" fk-name="FIXDASTPRD_UOM" rel-entity-name="Uom">
        <key-map field-name="quantityUomId" rel-field-name="uomId"/>
      </relation>
    </entity>
    <entity entity-name="FixedAssetProductType"
            package-name="org.apache.ofbiz.accounting.fixedasset"
            default-resource-name="AccountingEntityLabels"
            title="Fixed Asset Product Type">
      <field name="fixedAssetProductTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="fixedAssetProductTypeId"/>
    </entity>
    <entity entity-name="FixedAssetTypeGlAccount"
            package-name="org.apache.ofbiz.accounting.fixedasset"
            title="Gl Account Mapping For Fixed Asset Or Fixed Asset Types">
      <field name="fixedAssetTypeId" type="id"><description>The fixed asset type for the mappings. This field can be set to _NA_ in order to define a mapping for all types or for a specific asset (specified by the id in the fixedAssetId field).</description></field>
      <field name="fixedAssetId" type="id"><description>The fixed asset id for the mappings. This field can be set to _NA_ in order to define a mapping for all assets of a given type (specified by the id in the fixedAssetTypeId field).</description></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="assetGlAccountId" type="id"><description>The (debit) account for the initial asset value (purchase cost)</description></field>
      <field name="accDepGlAccountId" type="id"><description>The (credit) account for the accumulated depreciation</description></field>
      <field name="depGlAccountId" type="id"><description>The (debit) account for the depreciation expense (matches the accDepGlAccountId)</description></field>
      <field name="profitGlAccountId" type="id"><description>The (credit) account for the eventual profit derived from the sale of the asset</description></field>
      <field name="lossGlAccountId" type="id"><description>The (debit) account for the eventual loss derived from the sale of the asset</description></field>
      <prim-key field="fixedAssetTypeId"/>
      <prim-key field="fixedAssetId"/>
      <prim-key field="organizationPartyId"/>
      <relation type="one-nofk" rel-entity-name="FixedAssetType">
        <key-map field-name="fixedAssetTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetId"/>
      </relation>
      <relation type="one" fk-name="FATGL_OP" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="FATGL_AGL" title="Asset" rel-entity-name="GlAccount">
        <key-map field-name="assetGlAccountId" rel-field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="FATGL_ACCDGL" title="AccumulatedDepreciation" rel-entity-name="GlAccount">
        <key-map field-name="accDepGlAccountId" rel-field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="FATGL_DGL" title="Depreciation" rel-entity-name="GlAccount">
        <key-map field-name="depGlAccountId" rel-field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="FATGL_PGL" title="Profit" rel-entity-name="GlAccount">
        <key-map field-name="profitGlAccountId" rel-field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="FATGL_LGL" title="Loss" rel-entity-name="GlAccount">
        <key-map field-name="lossGlAccountId" rel-field-name="glAccountId"/>
      </relation>
    </entity>

    <entity entity-name="FixedAssetRegistration" package-name="org.apache.ofbiz.accounting.fixedasset" title="Fixed Asset Registration">
        <field name="fixedAssetId" type="id"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <field name="registrationDate" type="date-time"></field>
        <field name="govAgencyPartyId" type="id"></field>
        <field name="registrationNumber" type="long-varchar"></field>
        <field name="licenseNumber" type="long-varchar"></field>
        <prim-key field="fixedAssetId"/>
        <prim-key field="fromDate"/>
        <relation type="one" fk-name="FIXDASTREG_FXAST" rel-entity-name="FixedAsset">
            <key-map field-name="fixedAssetId"/>
        </relation>
        <relation type="one" fk-name="FIXDASTREG_GVAPTY" title="GovAgency" rel-entity-name="Party">
            <key-map field-name="govAgencyPartyId" rel-field-name="partyId"/>
        </relation>
    </entity>
    <entity entity-name="FixedAssetStdCost" package-name="org.apache.ofbiz.accounting.fixedasset" title="Fixed Asset Standard Cost">
        <field name="fixedAssetId" type="id"></field>
        <field name="fixedAssetStdCostTypeId" type="id"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <field name="amountUomId" type="id"></field>
        <field name="amount" type="currency-amount"></field>
        <prim-key field="fixedAssetId"/>
        <prim-key field="fixedAssetStdCostTypeId"/>
        <prim-key field="fromDate"/>
        <relation type="one" fk-name="FIXASTCO_FIXAST" rel-entity-name="FixedAsset">
            <key-map field-name="fixedAssetId"/>
        </relation>
        <relation type="one" fk-name="FIXASTCO_TYPCOS" rel-entity-name="FixedAssetStdCostType">
            <key-map field-name="fixedAssetStdCostTypeId"/>
        </relation>
        <relation type="one" fk-name="FIXASTCO_AMCURR" rel-entity-name="Uom">
            <key-map field-name="amountUomId" rel-field-name="uomId"/>
        </relation>
    </entity>
    <entity entity-name="FixedAssetStdCostType"
        package-name="org.apache.ofbiz.accounting.fixedasset"
        default-resource-name="AccountingEntityLabels"
        title="Fixed Asset Standard Cost Type">
        <field name="fixedAssetStdCostTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="hasTable" type="indicator"></field>
        <field name="description" type="description"></field>
        <prim-key field="fixedAssetStdCostTypeId"/>
        <relation type="one" fk-name="FIXASTCO_TYPPAR" title="Parent" rel-entity-name="FixedAssetStdCostType">
            <key-map field-name="parentTypeId" rel-field-name="fixedAssetStdCostTypeId"/>
        </relation>
    </entity>
    <entity entity-name="FixedAssetType"
            package-name="org.apache.ofbiz.accounting.fixedasset"
            default-resource-name="AccountingEntityLabels"
            title="Fixed Asset Type">
      <field name="fixedAssetTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="fixedAssetTypeId"/>
      <relation type="one" fk-name="FIXEDAST_TYPPAR" title="Parent" rel-entity-name="FixedAssetType">
        <key-map field-name="parentTypeId" rel-field-name="fixedAssetTypeId"/>
      </relation>
    </entity>
    <entity entity-name="FixedAssetTypeAttr"
            package-name="org.apache.ofbiz.accounting.fixedasset"
            title="Fixed Asset Type Attribute">
      <field name="fixedAssetTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="fixedAssetTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="FIXEDAST_TYPATTR" rel-entity-name="FixedAssetType">
        <key-map field-name="fixedAssetTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="FixedAssetAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetTypeId"/>
      </relation>
    </entity>
    <entity entity-name="PartyFixedAssetAssignment"
            package-name="org.apache.ofbiz.accounting.fixedasset"
            title="Party Fixed Asset Assignment">
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="fixedAssetId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="allocatedDate" type="date-time"></field>
      <field name="statusId" type="id"></field>
      <field name="comments" type="comment"></field>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <prim-key field="fixedAssetId"/>
      <prim-key field="fromDate"/>
      <relation type="one-nofk" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="PTY_FASTAS_PTRL" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="PTY_FASTAS_FA" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetId"/>
      </relation>
      <relation type="one" fk-name="PTY_FASTAS_SI" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
    </entity>

    <view-entity entity-name="PartyFixedAssetAssignAndRole" package-name="org.apache.ofbiz.accounting.fixedasset"
        title="PartyFixedAssetAssignment and RoleType View">
        <member-entity entity-alias="PFA" entity-name="PartyFixedAssetAssignment"/>
        <member-entity entity-alias="RT" entity-name="RoleType"/>
        <alias-all entity-alias="PFA"/>
        <alias-all entity-alias="RT"/>
        <view-link entity-alias="PFA" rel-entity-alias="RT">
            <key-map field-name="roleTypeId"/>
        </view-link>
    </view-entity>

    <entity entity-name="FixedAssetMaintOrder" package-name="org.apache.ofbiz.accounting.fixedasset" title="Fixed Asset Maintance And Order">
        <field name="fixedAssetId" type="id"></field>
        <field name="maintHistSeqId" type="id"></field>
        <field name="orderId" type="id"></field>
        <field name="orderItemSeqId" type="id"></field>
        <prim-key field="fixedAssetId"/>
        <prim-key field="maintHistSeqId"/>
        <prim-key field="orderId"/>
        <prim-key field="orderItemSeqId"/>
        <relation type="one" fk-name="FXDASTMNT_ORD_FXAS" rel-entity-name="FixedAsset">
            <key-map field-name="fixedAssetId"/>
        </relation>
        <relation type="one" fk-name="FXDASTMNT_ORD" rel-entity-name="OrderHeader">
            <key-map field-name="orderId"/>
        </relation>
        <relation type="one-nofk" rel-entity-name="OrderItem">
            <key-map field-name="orderId"/>
            <key-map field-name="orderItemSeqId"/>
        </relation>
    </entity>

  <entity entity-name="AccommodationClass"
    package-name="org.apache.ofbiz.accounting.fixedasset"
    title="Accommodation Class">
    <field name="accommodationClassId" type="id"></field>
    <field name="parentClassId" type="id"></field>
    <field name="description" type="description"></field>
    <prim-key field="accommodationClassId"/>
    <relation type="one" fk-name="ACCOMM_CLASS_PAR" title="Parent" rel-entity-name="AccommodationClass">
      <key-map field-name="parentClassId" rel-field-name="accommodationClassId"/>
    </relation>
  </entity>
  <entity entity-name="AccommodationSpot"
    package-name="org.apache.ofbiz.order.reservations"
    title="Accommodation Spot">
    <field name="accommodationSpotId" type="id"></field>
    <field name="accommodationClassId" type="id"></field>
    <field name="fixedAssetId" type="id"></field>
    <field name="numberOfSpaces" type="numeric"></field>
    <field name="description" type="description"></field>
    <prim-key field="accommodationSpotId"/>
    <relation type="one" fk-name="ACCOM_CLASS" rel-entity-name="AccommodationClass">
      <key-map field-name="accommodationClassId"/>
    </relation>
    <relation type="one" fk-name="SPOT_FA" rel-entity-name="FixedAsset">
      <key-map field-name="fixedAssetId"/>
    </relation>
  </entity>

  <entity entity-name="AccommodationMap"
    package-name="org.apache.ofbiz.accounting.fixedasset"
    title="Accommodation Map">
    <field name="accommodationMapId" type="id"></field>
    <field name="accommodationClassId" type="id"></field>
    <field name="fixedAssetId" type="id"></field>
    <field name="accommodationMapTypeId" type="id"></field>
    <field name="numberOfSpaces" type="numeric"></field>
    <prim-key field="accommodationMapId"/>
    <relation type="one" fk-name="ACMD_MAP_CLASS" rel-entity-name="AccommodationClass">
      <key-map field-name="accommodationClassId"/>
    </relation>
    <relation type="one" fk-name="ACMD_MAP_FA" rel-entity-name="FixedAsset">
      <key-map field-name="fixedAssetId"/>
    </relation>
    <relation type="one" fk-name="ACMD_MAP_TYPE" rel-entity-name="AccommodationMapType">
      <key-map field-name="accommodationMapTypeId"/>
    </relation>
  </entity>

  <entity entity-name="AccommodationMapType"
    package-name="org.apache.ofbiz.accounting.fixedasset"
    title="Accommodation Map Type">
    <field name="accommodationMapTypeId" type="id"></field>
    <field name="description" type="description"></field>
    <prim-key field="accommodationMapTypeId"/>
  </entity>
    <view-entity entity-name="FixedAssetMaintWorkEffort" package-name="org.apache.ofbiz.accounting.fixedasset"
        title="FixedAssetMaint and WorkEffort View">
        <member-entity entity-alias="FA" entity-name="FixedAsset"/>
        <member-entity entity-alias="FAM" entity-name="FixedAssetMaint"/>
        <member-entity entity-alias="WE" entity-name="WorkEffort"/>
        <alias-all entity-alias="FA"/>
        <alias-all entity-alias="FAM"/>
        <alias-all entity-alias="WE">
            <exclude field="fixedAssetId"/>
        </alias-all>
        <view-link entity-alias="FAM" rel-entity-alias="FA">
            <key-map field-name="fixedAssetId"/>
        </view-link>
        <view-link entity-alias="FAM" rel-entity-alias="WE">
            <key-map field-name="scheduleWorkEffortId" rel-field-name="workEffortId"/>
        </view-link>
    </view-entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.accounting.invoice -->
  <!-- ========================================================= -->

    <entity entity-name="Invoice"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice">
      <field name="invoiceId" type="id"></field>
      <field name="invoiceTypeId" type="id"></field>
      <field name="partyIdFrom" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="billingAccountId" type="id"></field>
      <field name="contactMechId" type="id"></field>
      <field name="invoiceDate" type="date-time"></field>
      <field name="dueDate" type="date-time"></field>
      <field name="paidDate" type="date-time"></field>
      <field name="invoiceMessage" type="long-varchar"></field>
      <field name="referenceNumber" type="short-varchar"></field> <!-- used to record things like the vendor's invoice number -->
      <field name="description" type="description"></field>
      <field name="currencyUomId" type="id"></field>
      <field name="recurrenceInfoId" type="id"></field>
      <prim-key field="invoiceId"/>
      <relation type="one" fk-name="INVOICE_INVTYP" rel-entity-name="InvoiceType">
        <key-map field-name="invoiceTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="InvoiceTypeAttr">
        <key-map field-name="invoiceTypeId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_PARTY_FRM" title="From" rel-entity-name="Party">
        <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_ROLETYP" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_STTSITM" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_BILLACCT" rel-entity-name="BillingAccount">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_CUOM" title="Currency" rel-entity-name="Uom">
        <key-map field-name="currencyUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_RECINFO" rel-entity-name="RecurrenceInfo">
        <key-map field-name="recurrenceInfoId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceAttribute"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Attribute">
      <field name="invoiceId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="invoiceId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="INVOICE_ATTR" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="many" rel-entity-name="InvoiceTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceContent" 
            package-name="org.apache.ofbiz.accounting.invoice" 
            title="Invoice Content">
        <field name="invoiceId" type="id"></field>
        <field name="invoiceContentTypeId" type="id"></field>
        <field name="contentId" type="id"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <prim-key field="contentId"/>
        <prim-key field="invoiceId"/>
        <prim-key field="invoiceContentTypeId"/>
        <prim-key field="fromDate"/>
        <relation type="one" fk-name="INV_CNT_PROD" rel-entity-name="Invoice">
            <key-map field-name="invoiceId"/>
        </relation>
        <relation type="one" fk-name="INV_CNT_CNT" rel-entity-name="Content">
            <key-map field-name="contentId"/>
        </relation>
        <relation type="one" fk-name="INV_CNT_TYPE" rel-entity-name="InvoiceContentType">
            <key-map field-name="invoiceContentTypeId"/>
        </relation>
    </entity>
    <entity entity-name="InvoiceContentType" 
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Content Type">
        <field name="invoiceContentTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="hasTable" type="indicator"></field>
        <field name="description" type="description"></field>
        <prim-key field="invoiceContentTypeId"/>
        <relation type="one" fk-name="INVCT_TYP_PARENT" title="Parent" rel-entity-name="InvoiceContentType">
            <key-map field-name="parentTypeId" rel-field-name="invoiceContentTypeId"/>
        </relation>
    </entity>
    <entity entity-name="InvoiceContactMech"
            package-name="org.apache.ofbiz.accounting.invoice"
            never-cache="true"
            title="Invoice Contact Mechanism">
      <field name="invoiceId" type="id"></field>
      <field name="contactMechPurposeTypeId" type="id"></field>
      <field name="contactMechId" type="id"></field>
      <prim-key field="invoiceId"/>
      <prim-key field="contactMechPurposeTypeId"/>
      <prim-key field="contactMechId"/>
      <relation type="one" fk-name="INVOICE_CMECH_HDR" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_CMECH_CM" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_CMECH_CMPT" rel-entity-name="ContactMechPurposeType">
        <key-map field-name="contactMechPurposeTypeId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceItem"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Item">
      <field name="invoiceId" type="id"></field>
      <field name="invoiceItemSeqId" type="id"></field>
      <field name="invoiceItemTypeId" type="id"></field>
      <field name="overrideGlAccountId" type="id"><description>used to specify the override or actual glAccountId used for the invoice, avoids problems if configuration changes after initial posting, etc </description></field>
      <field name="overrideOrgPartyId" type="id"><description>Used to specify the organization override rather than using the payToPartyId</description></field>
      <field name="inventoryItemId" type="id"></field>
      <field name="productId" type="id"></field>
      <field name="productFeatureId" type="id"></field>
      <field name="parentInvoiceId" type="id"></field>
      <field name="parentInvoiceItemSeqId" type="id"></field>
      <field name="uomId" type="id"></field>
      <field name="taxableFlag" type="indicator"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="amount" type="currency-precise"></field>
      <field name="description" type="description"></field>
      <field name="taxAuthPartyId" type="id"/>
      <field name="taxAuthGeoId" type="id"/>
      <field name="taxAuthorityRateSeqId" type="id"></field>
      <field name="salesOpportunityId" type="id"></field>
      <prim-key field="invoiceId"/>
      <prim-key field="invoiceItemSeqId"/>
      <relation type="one" fk-name="INVOICE_ITMITYP" rel-entity-name="InvoiceItemType">
        <key-map field-name="invoiceItemTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="InvoiceItemTypeAttr">
        <key-map field-name="invoiceItemTypeId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_INVCE" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_INVITM" rel-entity-name="InventoryItem">
        <key-map field-name="inventoryItemId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_PROD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_PRDFT" rel-entity-name="ProductFeature">
        <key-map field-name="productFeatureId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_PINVIT" rel-entity-name="InvoiceItem">
        <key-map field-name="parentInvoiceId" rel-field-name="invoiceId"/>
        <key-map field-name="parentInvoiceItemSeqId" rel-field-name="invoiceItemSeqId"/>
      </relation>
      <relation type="many" fk-name="INVCE_ITM_CINVIT" title="Children" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceId" rel-field-name="parentInvoiceId"/>
        <key-map field-name="invoiceItemSeqId" rel-field-name="parentInvoiceItemSeqId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_UOM" rel-entity-name="Uom">
        <key-map field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_ORGLA" title="Override" rel-entity-name="GlAccount">
        <key-map field-name="overrideGlAccountId" rel-field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_TAXPTY" title="TaxAuthority" rel-entity-name="Party">
          <key-map field-name="taxAuthPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_TAXGEO" title="Tax" rel-entity-name="Geo">
          <key-map field-name="taxAuthGeoId" rel-field-name="geoId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_ITM_TARP" rel-entity-name="TaxAuthorityRateProduct">
        <key-map field-name="taxAuthorityRateSeqId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_OVRPTY" title="OverrideOrg" rel-entity-name="Party">
        <key-map field-name="overrideOrgPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="INVCE_ITM_SLSOPP" rel-entity-name="SalesOpportunity" >
            <key-map field-name="salesOpportunityId"/>
      </relation>
    </entity>
    
    <entity entity-name="InvoiceItemAssoc"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Item Association">
      <field name="invoiceIdFrom" type="id"></field>
      <field name="invoiceItemSeqIdFrom" type="id"></field>
      <field name="invoiceIdTo" type="id"></field>
      <field name="invoiceItemSeqIdTo" type="id"></field>
      <field name="invoiceItemAssocTypeId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="partyIdFrom" type="id"></field>
      <field name="partyIdTo" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="amount" type="currency-amount"></field>      
      <prim-key field="invoiceIdFrom"/>
      <prim-key field="invoiceItemSeqIdFrom"/>
      <prim-key field="invoiceIdTo"/>
      <prim-key field="invoiceItemSeqIdTo"/>
      <prim-key field="invoiceItemAssocTypeId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="INITMASCTYP_IIASC" rel-entity-name="InvoiceItemAssocType">
        <key-map field-name="invoiceItemAssocTypeId"/>
      </relation>
      <relation type="one" fk-name="INITMASC_FIITM" title="From" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceIdFrom" rel-field-name="invoiceId"/>
        <key-map field-name="invoiceItemSeqIdFrom" rel-field-name="invoiceItemSeqId"/>
      </relation>
      <relation type="one" fk-name="INITMASC_TIITM" title="To" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceIdTo" rel-field-name="invoiceId"/>
        <key-map field-name="invoiceItemSeqIdTo" rel-field-name="invoiceItemSeqId"/>
      </relation>
      <relation type="one-nofk" title="From" rel-entity-name="Party">
        <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
      </relation>
      <relation type="one-nofk" title="To" rel-entity-name="Party">
        <key-map field-name="partyIdTo" rel-field-name="partyId"/>
      </relation>
    </entity>
    
    <entity entity-name="InvoiceItemAssocType"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Item Assoc Type">
      <field name="invoiceItemAssocTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="invoiceItemAssocTypeId"/>
      <relation type="one" fk-name="INITMASCTYP_PRNT" title="Parent" rel-entity-name="InvoiceItemAssocType">
        <key-map field-name="parentTypeId" rel-field-name="invoiceItemAssocTypeId"/>
      </relation>
    </entity>
    
    <entity entity-name="InvoiceItemAttribute"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Item Attribute">
      <field name="invoiceId" type="id"></field>
      <field name="invoiceItemSeqId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="invoiceId"/>
      <prim-key field="invoiceItemSeqId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="INVOICE_IMAT_ITM" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceId"/>
        <key-map field-name="invoiceItemSeqId"/>
      </relation>
      <relation type="many" rel-entity-name="InvoiceItemTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceItemType"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Item Type" default-resource-name="AccountingEntityLabels">
      <field name="invoiceItemTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <field name="defaultGlAccountId" type="id"></field>
      <prim-key field="invoiceItemTypeId"/>
      <relation type="one" fk-name="INVOICE_ITEM_TPAR" title="Parent" rel-entity-name="InvoiceItemType">
        <key-map field-name="parentTypeId" rel-field-name="invoiceItemTypeId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_ITM_DGLAC" title="Default" rel-entity-name="GlAccount">
        <key-map field-name="defaultGlAccountId" rel-field-name="glAccountId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceItemTypeAttr"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Item Type Attribute">
      <field name="invoiceItemTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="invoiceItemTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="INVOICE_ITEM_TATR" rel-entity-name="InvoiceItemType">
        <key-map field-name="invoiceItemTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="InvoiceItemAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceItemTypeId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceItemTypeGlAccount"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Item Type GL Account">
      <field name="invoiceItemTypeId" type="id"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="glAccountId" type="id"></field>
      <prim-key field="invoiceItemTypeId"/>
      <prim-key field="organizationPartyId"/>
      <relation type="one" fk-name="INVOICE_ITGA_IIT" rel-entity-name="InvoiceItemType">
        <key-map field-name="invoiceItemTypeId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_ITGA_OPTY" title="Organization" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_ITGA_GLAC" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceItemTypeMap"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Item Type Map">
      <field name="invoiceItemMapKey" type="id"></field>
      <field name="invoiceTypeId" type="id"></field>
      <field name="invoiceItemTypeId" type="id"></field>
      <prim-key field="invoiceItemMapKey"/>
      <prim-key field="invoiceTypeId"/>
      <relation type="one" fk-name="INVOICE_ITEM_MAP" rel-entity-name="InvoiceItemType">
        <key-map field-name="invoiceItemTypeId"/>
      </relation>
      <relation type="one" fk-name="INVITMMAP_INVTYP" rel-entity-name="InvoiceType">
        <key-map field-name="invoiceTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceItemTypeId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceRole"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Role">
      <field name="invoiceId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="datetimePerformed" type="date-time"></field>
      <field name="percentage" type="fixed-point"></field>
      <prim-key field="invoiceId"/>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <relation type="one" fk-name="INVCE_RLE_INVCE" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="INVCE_RLE_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="INVCE_RLE_PTRL" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceStatus"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Status">
      <field name="statusId" type="id"></field>
      <field name="invoiceId" type="id"></field>
      <field name="statusDate" type="date-time"></field>
      <field name="changeByUserLoginId" type="id-vlong"/>
      <prim-key field="statusId"/>
      <prim-key field="invoiceId"/>
      <prim-key field="statusDate"/>
      <relation type="one" fk-name="INVCE_STS_STSITM" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="INVCE_STS_INVCE" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="INV_STTS_USRLGN" title="ChangeBy" rel-entity-name="UserLogin">
          <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceTerm"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Term">
      <field name="invoiceTermId" type="id"></field>
      <field name="termTypeId" type="id"></field>
      <field name="invoiceId" type="id"></field>
      <field name="invoiceItemSeqId" type="id"></field>
      <field name="termValue" type="currency-amount"></field>
      <field name="termDays" type="numeric"></field>
      <field name="textValue" type="description"></field>
      <field name="description" type="description"></field>
      <field name="uomId" type="id"></field>
      <prim-key field="invoiceTermId"/>
      <relation type="one" fk-name="INVCE_TRM_TRM" rel-entity-name="TermType">
        <key-map field-name="termTypeId"/>
      </relation>
      <relation type="one" fk-name="INVCE_TRM_INVCE" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceId"/>
        <key-map field-name="invoiceItemSeqId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceTermAttribute"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Term Attribute">
      <field name="invoiceTermId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="invoiceTermId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="INVOICE_TRM_ATTR" rel-entity-name="InvoiceTerm">
        <key-map field-name="invoiceTermId"/>
      </relation>
      <relation type="many" rel-entity-name="TermTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceType"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Type" default-resource-name="AccountingEntityLabels">
      <field name="invoiceTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="invoiceTypeId"/>
      <relation type="one" fk-name="INVOICE_TYPE_PAR" title="Parent" rel-entity-name="InvoiceType">
        <key-map field-name="parentTypeId" rel-field-name="invoiceTypeId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceTypeAttr"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Type Attribute">
      <field name="invoiceTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="invoiceTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="INVOICE_TPAT_TYP" rel-entity-name="InvoiceType">
        <key-map field-name="invoiceTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="InvoiceAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="Invoice">
        <key-map field-name="invoiceTypeId"/>
      </relation>
    </entity>
    <entity entity-name="InvoiceNote"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="Invoice Note">
      <field name="invoiceId" type="id"></field>
      <field name="noteId" type="id"></field>
      <prim-key field="invoiceId"/>
      <prim-key field="noteId"/>
      <relation type="one" fk-name="INVOICE_NOTE_INV" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="INVOICE_NOTE_NOTE" rel-entity-name="NoteData">
        <key-map field-name="noteId"/>
      </relation>
    </entity>

  <view-entity entity-name="InvoiceAndApplAndPayment" package-name="org.apache.ofbiz.accounting.invoice" title="Invoice and related applications and payments">
    <member-entity entity-alias="INV" entity-name="Invoice"/>
    <member-entity entity-alias="PAP" entity-name="PaymentApplication"/>
    <member-entity entity-alias="PAM" entity-name="Payment"/>
    <alias-all entity-alias="INV"/>
    <alias-all entity-alias="PAP">
      <exclude field="billingAccountId"/>
    </alias-all>
    <alias-all entity-alias="PAM" prefix="pm"/>
    <view-link entity-alias="INV" rel-entity-alias="PAP">
      <key-map field-name="invoiceId"/>
    </view-link>
    <view-link entity-alias="PAP" rel-entity-alias="PAM">
      <key-map field-name="paymentId"/>
    </view-link>
  </view-entity>

  <view-entity entity-name="InvoiceAndType" package-name="org.apache.ofbiz.accounting.invoice" title="Invoice and InvoiceType to be able to list invoices by invoiceParentType i.e. sales/purchase invoices">
    <member-entity entity-alias="INV" entity-name="Invoice"/>
    <member-entity entity-alias="IVT" entity-name="InvoiceType"/>
    <alias-all entity-alias="INV"/>
    <alias name="parentTypeId" entity-alias="IVT"></alias>
    <alias name="invoiceTypeDesc" entity-alias="IVT" field="description"></alias>
    <view-link entity-alias="INV" rel-entity-alias="IVT">
      <key-map field-name="invoiceTypeId"/>
    </view-link>
    <relation type="many" rel-entity-name="InvoiceItem">
      <key-map field-name="invoiceId"/>
    </relation>
    <relation type="one-nofk" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
    </relation>
    <relation type="many" rel-entity-name="PaymentApplication">
      <key-map field-name="invoiceId"/>
    </relation>
    <relation type="many" rel-entity-name="AcctgTrans">
      <key-map field-name="invoiceId"/>
    </relation>
  </view-entity>

    <view-entity entity-name="InvoiceAndRole" package-name="org.apache.ofbiz.accounting.invoice">
        <member-entity entity-alias="INV" entity-name="Invoice"/>
        <member-entity entity-alias="INR" entity-name="InvoiceRole"/>
        <alias-all entity-alias="INV"/>
        <alias name="invoiceRolePartyId" entity-alias="INR" field="partyId"/>
        <alias name="invoiceRoleTypeId" entity-alias="INR" field="roleTypeId"/>
        <view-link entity-alias="INV" rel-entity-alias="INR" rel-optional="true">
            <key-map field-name="invoiceId"/>
        </view-link>
    </view-entity>

    <view-entity entity-name="InvoiceItemAndAssocProduct" package-name="org.apache.ofbiz.accounting.invoice">
        <member-entity entity-alias="INTM" entity-name="InvoiceItem"/>
        <member-entity entity-alias="IIA" entity-name="InvoiceItemAssoc"/>
        <member-entity entity-alias="PROD" entity-name="Product"/>
        <alias-all entity-alias="IIA">
            <exclude field="amount"/>
        </alias-all>
        <alias name="termAmount" field="amount" entity-alias="IIA"/>
        <alias name="productId" entity-alias="PROD"/>
        <alias name="productName" entity-alias="PROD"/>
        <alias name="amount" entity-alias="INTM"/>
        <view-link entity-alias="INTM" rel-entity-alias="IIA" rel-optional="false">
            <key-map field-name="invoiceId" rel-field-name="invoiceIdFrom"/>
            <key-map field-name="invoiceItemSeqId" rel-field-name="invoiceItemSeqIdFrom"/>
        </view-link>
        <view-link entity-alias="INTM" rel-entity-alias="PROD" rel-optional="false">
            <key-map field-name="productId"/>
        </view-link>
    </view-entity>

    <view-entity entity-name="InvItemAndOrdItem" package-name="org.apache.ofbiz.accounting.invoice">
        <member-entity entity-alias="INVITM" entity-name="InvoiceItem"/>
        <member-entity entity-alias="ORDBIL" entity-name="OrderItemBilling"/>
        <alias-all entity-alias="INVITM"/>
        <alias name="orderId" entity-alias="ORDBIL"/>
        <alias name="orderItemSeqId" entity-alias="ORDBIL"/>
        <view-link entity-alias="INVITM" rel-entity-alias="ORDBIL" rel-optional="true">
            <key-map field-name="invoiceId"/>
            <key-map field-name="invoiceItemSeqId"/>
        </view-link>
    </view-entity>
    <view-entity entity-name="InvoiceItemAndShipmentView" package-name="org.apache.ofbiz.accounting.invoice">
        <member-entity entity-alias="INVITM" entity-name="InvoiceItem"/>
        <member-entity entity-alias="ORDBIL" entity-name="OrderItemBilling"/>
        <member-entity entity-alias="ITMISS" entity-name="ItemIssuance"/>
        <member-entity entity-alias="SHIP" entity-name="Shipment"/>
        <alias-all entity-alias="INVITM"/>
        <alias-all entity-alias="SHIP"/>
        <view-link entity-alias="INVITM" rel-entity-alias="ORDBIL">
            <key-map field-name="invoiceId"/>
            <key-map field-name="invoiceItemSeqId"/>
        </view-link>
        <view-link entity-alias="ORDBIL" rel-entity-alias="ITMISS">
            <key-map field-name="itemIssuanceId"/>
        </view-link>
        <view-link entity-alias="ITMISS" rel-entity-alias="SHIP">
            <key-map field-name="shipmentId"/>
        </view-link>
    </view-entity>

    <view-entity entity-name="InvoiceContentAndInfo"
            package-name="org.apache.ofbiz.accounting.invoice"
            title="InvoiceContent Content and DataResource View">
      <member-entity entity-alias="INVC" entity-name="InvoiceContent"/>
      <member-entity entity-alias="CO" entity-name="Content"/>
      <member-entity entity-alias="DR" entity-name="DataResource"/>
      <alias-all entity-alias="INVC"/>
      <alias-all entity-alias="CO"/>
      <alias-all entity-alias="DR" prefix="dr"/>
      <view-link entity-alias="INVC" rel-entity-alias="CO">
        <key-map field-name="contentId"/>
      </view-link>
      <view-link entity-alias="CO" rel-entity-alias="DR">
        <key-map field-name="dataResourceId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="ElectronicText">
        <key-map field-name="dataResourceId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ImageDataResource">
        <key-map field-name="dataResourceId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OtherDataResource">
        <key-map field-name="dataResourceId"/>
      </relation>
      <relation type="many" rel-entity-name="ContentAssocDataResourceViewFrom">
        <key-map field-name="contentId" rel-field-name="contentIdStart"/>
      </relation>
      <relation type="many" rel-entity-name="ContentAssocDataResourceViewTo">
        <key-map field-name="contentId" rel-field-name="contentIdStart"/>
      </relation>
    </view-entity>
  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.accounting.ledger -->
  <!-- ========================================================= -->

    <entity entity-name="AcctgTrans"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Accounting Transaction">
      <field name="acctgTransId" type="id"></field>
      <field name="acctgTransTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <field name="transactionDate" type="date-time"></field>
      <field name="isPosted" type="indicator"></field>
      <field name="postedDate" type="date-time"></field>
      <field name="scheduledPostingDate" type="date-time"></field>
      <field name="glJournalId" type="id"></field>
      <field name="glFiscalTypeId" type="id"></field>
      <field name="voucherRef" type="short-varchar"></field>
      <field name="voucherDate" type="date-time"></field>
      <field name="groupStatusId" type="id"></field>
      <field name="fixedAssetId" type="id"></field>
      <field name="inventoryItemId" type="id"></field>
      <field name="physicalInventoryId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="invoiceId" type="id"></field>
      <field name="paymentId" type="id"></field>
      <field name="finAccountTransId" type="id"></field>
      <field name="shipmentId" type="id"></field>
      <field name="receiptId" type="id"></field>
      <field name="workEffortId" type="id"></field>
      <field name="theirAcctgTransId" type="id-long"></field>
      <field name="createdDate" type="date-time"></field>      
      <field name="createdByUserLogin" type="id-vlong"></field>
      <field name="lastModifiedDate" type="date-time"></field>
      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
      <prim-key field="acctgTransId"/>
      <relation type="one" fk-name="ACCTTX_TYPE" rel-entity-name="AcctgTransType">
        <key-map field-name="acctgTransTypeId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_GLJRNL" rel-entity-name="GlJournal">
        <key-map field-name="glJournalId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_GLFST" rel-entity-name="GlFiscalType">
        <key-map field-name="glFiscalTypeId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_GRPSTTS" rel-entity-name="StatusItem">
        <key-map field-name="groupStatusId" rel-field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_FASSET" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_PHS_INV" rel-entity-name="PhysicalInventory">
        <key-map field-name="physicalInventoryId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_INVITEM" rel-entity-name="InventoryItem">
        <key-map field-name="inventoryItemId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_INVITEMVAR" rel-entity-name="InventoryItemVariance">
        <key-map field-name="inventoryItemId"/>
        <key-map field-name="physicalInventoryId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_ROLETYP" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_INVOICE" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_PAYMENT" rel-entity-name="Payment">
        <key-map field-name="paymentId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_FNACTTR" rel-entity-name="FinAccountTrans">
        <key-map field-name="finAccountTransId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_SHIPMENT" rel-entity-name="Shipment">
        <key-map field-name="shipmentId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_SHIPRCPT" rel-entity-name="ShipmentReceipt">
        <key-map field-name="receiptId"/>
      </relation>
      <relation type="one" fk-name="ACCTTX_WEFF" rel-entity-name="WorkEffort">
        <key-map field-name="workEffortId"/>
      </relation>
      <relation type="many" rel-entity-name="AcctgTransTypeAttr">
        <key-map field-name="acctgTransTypeId"/>
      </relation>
    </entity>
    <entity entity-name="AcctgTransAttribute"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Accounting Transaction Attribute">
      <field name="acctgTransId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="acctgTransId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="ACCTTX_ATTR" rel-entity-name="AcctgTrans">
        <key-map field-name="acctgTransId"/>
      </relation>
      <relation type="many" rel-entity-name="AcctgTransTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="AcctgTransEntry"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Transaction Entry">
      <field name="acctgTransId" type="id"></field>
      <field name="acctgTransEntrySeqId" type="id"></field>
      <field name="acctgTransEntryTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <field name="voucherRef" type="short-varchar"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="theirPartyId" type="id"></field>
      <field name="productId" type="id"></field>
      <field name="theirProductId" type="id"></field>
      <field name="inventoryItemId" type="id"></field>
      <field name="glAccountTypeId" type="id"></field>
      <field name="glAccountId" type="id"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="amount" type="currency-amount"></field>
      <field name="currencyUomId" type="id"></field>
      <field name="origAmount" type="currency-amount"></field>
      <field name="origCurrencyUomId" type="id"></field>
      <field name="debitCreditFlag" type="indicator"></field>
      <field name="dueDate" type="date"></field>
      <field name="groupId" type="id"></field>
      <field name="taxId" type="id"></field>
      <field name="reconcileStatusId" type="id"></field>
      <field name="settlementTermId" type="id"></field>
      <field name="isSummary" type="indicator"></field>
      <prim-key field="acctgTransId"/>
      <prim-key field="acctgTransEntrySeqId"/>
      <relation type="one" fk-name="ACCTTXENT_ATET" rel-entity-name="AcctgTransEntryType">
        <key-map field-name="acctgTransEntryTypeId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_CURNCY" title="Currency" rel-entity-name="Uom">  <!-- title strictly speaking not necessary here but nice for consistency -->
        <key-map field-name="currencyUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_OCURNCY" title="OrigCurrency" rel-entity-name="Uom">
        <key-map field-name="origCurrencyUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_ACTX" rel-entity-name="AcctgTrans">
        <key-map field-name="acctgTransId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_INVITEM" rel-entity-name="InventoryItem">
        <key-map field-name="inventoryItemId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_RLTYP" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_GLACTT" rel-entity-name="GlAccountType">
        <key-map field-name="glAccountTypeId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_GLACT" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_GLACOG" rel-entity-name="GlAccountOrganization">
        <key-map field-name="glAccountId"/>
        <key-map field-name="organizationPartyId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_RCSTS" rel-entity-name="StatusItem">
        <key-map field-name="reconcileStatusId" rel-field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="ACCTTXENT_STLEN" rel-entity-name="SettlementTerm">
        <key-map field-name="settlementTermId"/>
      </relation>
    </entity>
    <view-entity entity-name="AcctgTransAndEntries"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="View of AcctgTrans and Entries, for easier lookup and calculation">
      <member-entity entity-alias="ATR" entity-name="AcctgTrans"/>
      <member-entity entity-alias="ATT" entity-name="AcctgTransType"/>
      <member-entity entity-alias="ATE" entity-name="AcctgTransEntry"/>
      <member-entity entity-alias="GLA" entity-name="GlAccount"/>
      <member-entity entity-alias="GLAC" entity-name="GlAccountClass"/>
      <alias entity-alias="ATR" name="isPosted"/>
      <alias entity-alias="ATR" name="glFiscalTypeId"/>
      <alias entity-alias="ATR" name="acctgTransTypeId"/>
      <alias entity-alias="ATR" name="transactionDate"/>
      <alias entity-alias="ATR" name="postedDate"/>
      <alias entity-alias="ATR" name="transDescription" field="description"/>
      <alias entity-alias="ATR" name="glJournalId"/>
      <alias entity-alias="ATT" name="transTypeDescription" field="description"/>
      <alias entity-alias="ATR" name="invoiceId"/>
      <alias entity-alias="ATR" name="paymentId"/>
      <alias entity-alias="ATR" name="shipmentId"/>
      <alias entity-alias="ATR" name="receiptId"/>
      <alias entity-alias="ATR" name="inventoryItemId"/>
      <alias entity-alias="ATR" name="workEffortId"/>
      <alias entity-alias="ATR" name="fixedAssetId"/>
      <alias entity-alias="ATR" name="physicalInventoryId"/>
      <alias entity-alias="ATR" name="description"/>
      <alias entity-alias="ATE" name="acctgTransId"/>
      <alias entity-alias="ATE" name="acctgTransEntrySeqId"/>
      <alias entity-alias="ATE" name="glAccountId"/>
      <alias entity-alias="ATE" name="productId"/>
      <alias entity-alias="ATE" name="debitCreditFlag"/>
      <alias entity-alias="ATE" name="amount"/>
      <alias entity-alias="ATE" name="currencyUomId"/>
      <alias entity-alias="ATE" name="origAmount"/>
      <alias entity-alias="ATE" name="origCurrencyUomId"/>
      <alias entity-alias="ATE" name="organizationPartyId"/>
      <alias entity-alias="GLA" name="glAccountTypeId"/>
      <alias entity-alias="GLA" name="accountCode"/>
      <alias entity-alias="GLA" name="accountName"/>
      <alias entity-alias="GLAC" name="glAccountClassId"/>
      <alias entity-alias="ATE" name="partyId"/>
      <alias entity-alias="ATE" name="reconcileStatusId"/>
      <alias entity-alias="ATE" name="acctgTransEntryTypeId"/>
      <view-link entity-alias="ATR" rel-entity-alias="ATE">
        <key-map field-name="acctgTransId"/>
      </view-link>
      <view-link entity-alias="ATR" rel-entity-alias="ATT">
        <key-map field-name="acctgTransTypeId"/>
      </view-link>
      <view-link entity-alias="ATE" rel-entity-alias="GLA" rel-optional="true">
        <key-map field-name="glAccountId"/>
      </view-link>
      <view-link entity-alias="GLA" rel-entity-alias="GLAC" rel-optional="true">
        <key-map field-name="glAccountClassId"/>
      </view-link>
      <relation type="one" fk-name="ATAE_GLACT" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="ATAE_GLACTCLS" rel-entity-name="GlAccountClass">
        <key-map field-name="glAccountClassId"/>
      </relation>
      <relation type="one" fk-name="ATAE_ATTYPE" rel-entity-name="AcctgTransType">
        <key-map field-name="acctgTransTypeId"/>
      </relation>
      <relation type="one" fk-name="ATAE_INVOICE" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="ATAE_PAYMENT" rel-entity-name="Payment">
        <key-map field-name="paymentId"/>
      </relation>
      <relation type="one" fk-name="ATAE_GLJOURNAL" rel-entity-name="GlJournal">
        <key-map field-name="glJournalId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="AcctgTransEntrySums"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Sum of AcctgTransEntry entity amounts grouped by glAccountId, debitCreditFlag">
      <member-entity entity-alias="ATE" entity-name="AcctgTransEntry"/>
      <member-entity entity-alias="ACT" entity-name="AcctgTrans"/>
      <member-entity entity-alias="GLA" entity-name="GlAccount"/>
      <alias entity-alias="ATE" name="glAccountId" group-by="true"/>
      <alias entity-alias="GLA" name="glAccountTypeId" group-by="true"/>
      <alias entity-alias="GLA" name="glAccountClassId" group-by="true"/>
      <alias entity-alias="GLA" name="accountName" group-by="true"/>
      <alias entity-alias="GLA" name="accountCode" group-by="true"/>
      <alias entity-alias="ACT" name="glFiscalTypeId" group-by="true"/>
      <alias entity-alias="ACT" name="acctgTransTypeId" group-by="false"/>
      <alias entity-alias="ATE" name="debitCreditFlag" group-by="true"/>
      <alias entity-alias="ATE" name="amount" function="sum"/>
      <alias entity-alias="ATE" name="organizationPartyId" group-by="false"/>
      <alias entity-alias="ACT" name="isPosted" group-by="false"/>
      <alias entity-alias="ACT" name="transactionDate" group-by="false"/> <!-- so we can select the sum by date -->
      <view-link entity-alias="ATE" rel-entity-alias="ACT">
        <key-map field-name="acctgTransId"/>
      </view-link>
      <view-link entity-alias="ATE" rel-entity-alias="GLA">
        <key-map field-name="glAccountId"/>
      </view-link>
    </view-entity>
    <entity entity-name="AcctgTransEntryType"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Accounting Transaction Entry Type">
      <field name="acctgTransEntryTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="acctgTransEntryTypeId"/>
      <relation type="one" fk-name="ACCTTXE_TYPE_PAR" title="Parent" rel-entity-name="AcctgTransEntryType">
        <key-map field-name="parentTypeId" rel-field-name="acctgTransEntryTypeId"/>
      </relation>
    </entity>
    <entity entity-name="AcctgTransType"
            package-name="org.apache.ofbiz.accounting.ledger"
            default-resource-name="AccountingEntityLabels"
            title="Accounting Transaction Type">
      <field name="acctgTransTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="acctgTransTypeId"/>
      <relation type="one" fk-name="ACCTTX_TYPE_PAR" title="Parent" rel-entity-name="AcctgTransType">
        <key-map field-name="parentTypeId" rel-field-name="acctgTransTypeId"/>
      </relation>
    </entity>
    <entity entity-name="AcctgTransTypeAttr"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Accounting Transaction Type Attribute">
      <field name="acctgTransTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="acctgTransTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="ACCTTX_TYPE_ATTR" rel-entity-name="AcctgTransType">
        <key-map field-name="acctgTransTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="AcctgTransAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="AcctgTrans">
        <key-map field-name="acctgTransTypeId"/>
      </relation>
    </entity>
    <entity entity-name="GlAccount"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Account">
      <!-- default-resource-name="ChartOfAccountsEntityLabels"   <= this does not exist yet and his blocking LookupGlAccount   -->
      <field name="glAccountId" type="id"></field>
      <field name="glAccountTypeId" type="id"></field>
      <field name="glAccountClassId" type="id"></field>
      <field name="glResourceTypeId" type="id"></field>
      <field name="glXbrlClassId" type="id"></field>
      <field name="parentGlAccountId" type="id"></field>
      <field name="accountCode" type="name"></field>
      <field name="accountName" type="name"></field>
      <field name="description" type="description"></field>
      <field name="productId" type="id"></field>
      <field name="externalId" type="id"><description>id of the account in an external system where the accounts are imported/exported</description></field>
      <prim-key field="glAccountId"/>
      <relation type="one" fk-name="GLACCT_TYPE" rel-entity-name="GlAccountType">
        <key-map field-name="glAccountTypeId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_CLSS" rel-entity-name="GlAccountClass">
        <key-map field-name="glAccountClassId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_REC" rel-entity-name="GlResourceType">
        <key-map field-name="glResourceTypeId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_XBRLCLS" rel-entity-name="GlXbrlClass">
        <key-map field-name="glXbrlClassId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_PAR" title="Parent" rel-entity-name="GlAccount">
        <key-map field-name="parentGlAccountId" rel-field-name="glAccountId"/>
      </relation>
      <index name="GLACCT_UNQCD" unique="true">
        <index-field name="accountCode"/>
      </index>
    </entity>
    <entity entity-name="GlAccountClass"
            package-name="org.apache.ofbiz.accounting.ledger"
            default-resource-name="AccountingEntityLabels"
            title="General Ledger Account Class">
      <field name="glAccountClassId" type="id"></field>
      <field name="parentClassId" type="id"></field>
      <field name="description" type="description"></field>
      <field name="isAssetClass" type="indicator"></field>
      <field name="sequenceNum" type="numeric"></field>
      <prim-key field="glAccountClassId"/>
      <relation type="one" fk-name="GLACTCLS_PAR" title="Parent" rel-entity-name="GlAccountClass">
        <key-map field-name="parentClassId" rel-field-name="glAccountClassId"/>
      </relation>
    </entity>
    <entity entity-name="GlAccountGroup"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Account Group">
      <field name="glAccountGroupId" type="id"></field>
      <field name="glAccountGroupTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="glAccountGroupId"/>
      <relation type="one" fk-name="GLACT_GRP_TP" rel-entity-name="GlAccountGroupType">
        <key-map field-name="glAccountGroupTypeId"/>
      </relation>
    </entity>
    <entity entity-name="GlAccountGroupMember"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Account Group Member">
      <field name="glAccountId" type="id"></field>
      <field name="glAccountGroupTypeId" type="id"></field>
      <field name="glAccountGroupId" type="id"></field>
      <prim-key field="glAccountId"/>
      <prim-key field="glAccountGroupTypeId"/>
      <relation type="one" fk-name="GLACT_GPMBR_AC" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="GLACT_GPMBR_GP" rel-entity-name="GlAccountGroup">
        <key-map field-name="glAccountGroupId"/>
      </relation>
      <relation type="one" fk-name="GLACT_GPMBR_TP" rel-entity-name="GlAccountGroupType">
        <key-map field-name="glAccountGroupTypeId"/>
      </relation>
    </entity>
    <entity entity-name="GlAccountGroupType"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Account Group Type">
      <field name="glAccountGroupTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="glAccountGroupTypeId"/>
    </entity>
    <entity entity-name="GlAccountHistory"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="GL Account History">
      <field name="glAccountId" type="id"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="customTimePeriodId" type="id"></field>
      <field name="openingBalance" type="currency-amount"></field>
      <field name="postedDebits" type="currency-amount"></field>
      <field name="postedCredits" type="currency-amount"></field>
      <field name="endingBalance" type="currency-amount"></field>
      <prim-key field="glAccountId"/>
      <prim-key field="organizationPartyId"/>
      <prim-key field="customTimePeriodId"/>
      <relation type="one" fk-name="GLACCT_HST_GLA" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_HST_PARTY" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_HST_CTP" rel-entity-name="CustomTimePeriod">
        <key-map field-name="customTimePeriodId"/>
      </relation>
    </entity>
    <view-entity entity-name="GlAccountAndHistory"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="View of GL Account and its History, for lookup and calculation">
      <member-entity entity-alias="GLA" entity-name="GlAccount"/>
      <member-entity entity-alias="GLAH" entity-name="GlAccountHistory"/>
      <member-entity entity-alias="GLAC" entity-name="GlAccountClass"/>
      <alias-all entity-alias="GLA"/>
      <alias-all entity-alias="GLAH"/>
      <alias entity-alias="GLAC" name="glAccountClassId"/>
      <view-link entity-alias="GLA" rel-entity-alias="GLAH">
        <key-map field-name="glAccountId"/>
      </view-link>
      <view-link entity-alias="GLA" rel-entity-alias="GLAC">
        <key-map field-name="glAccountClassId"/>
      </view-link>
      <relation type="one" fk-name="GLAAH_GLACT" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="GLAAH_GLACTCLS" rel-entity-name="GlAccountClass">
        <key-map field-name="glAccountClassId"/>
      </relation>
      <relation type="one" fk-name="GLAAH_GLAH" rel-entity-name="GlAccountHistory">
        <key-map field-name="glAccountId"/>
        <key-map field-name="organizationPartyId"/>
        <key-map field-name="customTimePeriodId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="GlAccountAndHistoryTotals"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="View of GL Account and its History totals">
      <member-entity entity-alias="GLA" entity-name="GlAccount"/>
      <member-entity entity-alias="GLAH" entity-name="GlAccountHistory"/>
      <alias-all entity-alias="GLA" group-by="true"/>
      <alias-all entity-alias="GLAH" group-by="true"/>
      <alias entity-alias="GLAH" name="totalPostedDebits" field="postedDebits" function="sum"/>
      <alias entity-alias="GLAH" name="totalPostedCredits" field="postedCredits" function="sum"/>
      <alias entity-alias="GLAH" name="totalEndingBalance" field="endingBalance" function="sum"/>
      <view-link entity-alias="GLA" rel-entity-alias="GLAH">
        <key-map field-name="glAccountId"/>
      </view-link>
      <relation type="one" fk-name="GLAAHT_GLACT" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="GLAAHT_GLAH" rel-entity-name="GlAccountHistory">
        <key-map field-name="glAccountId"/>
        <key-map field-name="organizationPartyId"/>
        <key-map field-name="customTimePeriodId"/>
      </relation>
    </view-entity>
    <entity entity-name="GlAccountOrganization"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="GL Account Organization">
      <field name="glAccountId" type="id"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="glAccountId"/>
      <prim-key field="organizationPartyId"/>
      <relation type="one" fk-name="GLACCT_ORG_GLA" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_ORG_PARTY" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PartyRole">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </entity>
    <view-entity entity-name="GlAccountOrganizationAndClass"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="View of GL Account Organization and the GlAccount and class, for lookup and calculation">
      <member-entity entity-alias="GLAO" entity-name="GlAccountOrganization"/>
      <member-entity entity-alias="GLA" entity-name="GlAccount"/>
      <alias-all entity-alias="GLAO"/>
      <alias-all entity-alias="GLA"/>
      <view-link entity-alias="GLAO" rel-entity-alias="GLA">
        <key-map field-name="glAccountId"/>
      </view-link>
      <relation type="one" fk-name="GLAOC_GLA" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="GLAOC_GLAO" rel-entity-name="GlAccountOrganization">
        <key-map field-name="glAccountId"/>
        <key-map field-name="organizationPartyId"/>
      </relation>
    </view-entity>
    <entity entity-name="GlAccountRole"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="GL Account Role">
      <field name="glAccountId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="glAccountId"/>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="GLACCT_RL_GLA" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_RL_PTRLE" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </entity>
    <entity entity-name="GlAccountType"
            package-name="org.apache.ofbiz.accounting.ledger"
            default-resource-name="AccountingEntityLabels"
            title="General Ledger Account Type">
      <field name="glAccountTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="glAccountTypeId"/>
      <relation type="one" fk-name="GLACTTY_PAR" title="Parent" rel-entity-name="GlAccountType">
        <key-map field-name="parentTypeId" rel-field-name="glAccountTypeId"/>
      </relation>
    </entity>
    <entity entity-name="GlAccountTypeDefault"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="GL Account Organization">
      <field name="glAccountTypeId" type="id"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="glAccountId" type="id"></field>
      <prim-key field="glAccountTypeId"/>
      <prim-key field="organizationPartyId"/>
      <relation type="one" fk-name="GLACCT_TPDF_GLAT" rel-entity-name="GlAccountType">
        <key-map field-name="glAccountTypeId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_TPDF_OPTY" title="Organization" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="GLACCT_TPDF_GLA" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
    </entity>
    <entity entity-name="GlBudgetXref"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Budget Cross Reference">
      <field name="glAccountId" type="id"></field>
      <field name="budgetItemTypeId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="allocationPercentage" type="fixed-point"></field>
      <prim-key field="glAccountId"/>
      <prim-key field="budgetItemTypeId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="GL_BDGT_XRF_GLA" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="GL_BDGT_XRF_BIT" rel-entity-name="BudgetItemType">
        <key-map field-name="budgetItemTypeId"/>
      </relation>
    </entity>
    <entity entity-name="GlFiscalType"
            package-name="org.apache.ofbiz.accounting.ledger"
            default-resource-name="AccountingEntityLabels"
            title="General Ledger Fiscal">
      <field name="glFiscalTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="glFiscalTypeId"/>
    </entity>
    <entity entity-name="GlJournal"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Journal">
      <field name="glJournalId" type="id"></field>
      <field name="glJournalName" type="name"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="isPosted" type="indicator"></field>
      <field name="postedDate" type="date-time"></field>
      <prim-key field="glJournalId"/>
      <relation type="one" fk-name="GLJOURN_PARTY" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
    </entity>
    <entity entity-name="GlReconciliation"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Reconciliation">
      <field name="glReconciliationId" type="id"></field>
      <field name="glReconciliationName" type="name"></field>
      <field name="description" type="description"></field>
      <field name="createdDate" type="date-time"></field>
      <field name="createdByUserLogin" type="id-vlong"></field>
      <field name="lastModifiedDate" type="date-time"></field>
      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
      <field name="glAccountId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="reconciledBalance" type="currency-amount"></field>
      <field name="openingBalance" type="currency-amount"></field>
      <field name="reconciledDate" type="date-time"></field>
      <prim-key field="glReconciliationId"/>
      <relation type="one" fk-name="GLREC_GLACCT" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="GLREC_GLPARTY" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="GLREC_STI" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
    </entity>
    <entity entity-name="GlReconciliationEntry"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Reconciliation Entry">
      <field name="glReconciliationId" type="id"></field>
      <field name="acctgTransId" type="id"></field>
      <field name="acctgTransEntrySeqId" type="id"></field>
      <field name="reconciledAmount" type="currency-amount"></field>
      <prim-key field="glReconciliationId"/>
      <prim-key field="acctgTransId"/>
      <prim-key field="acctgTransEntrySeqId"/>
      <relation type="one" fk-name="GL_RECENT_GLREC" rel-entity-name="GlReconciliation">
        <key-map field-name="glReconciliationId"/>
      </relation>
      <relation type="one" fk-name="GL_RECENT_ACTTXE" rel-entity-name="AcctgTransEntry">
        <key-map field-name="acctgTransId"/>
        <key-map field-name="acctgTransEntrySeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="AcctgTrans">
        <key-map field-name="acctgTransId"/>
      </relation>
    </entity>
    <entity entity-name="GlResourceType"
            package-name="org.apache.ofbiz.accounting.ledger"
            default-resource-name="AccountingEntityLabels"
            title="General Ledger Resource">
      <field name="glResourceTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="glResourceTypeId"/>
    </entity>
    <entity entity-name="GlXbrlClass"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger XBRL Class">
      <field name="glXbrlClassId" type="id"></field>
      <field name="parentGlXbrlClassId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="glXbrlClassId"/>
      <relation type="one" fk-name="GL_XBRL_CLSPAR" title="Parent" rel-entity-name="GlXbrlClass">
        <key-map field-name="parentGlXbrlClassId" rel-field-name="glXbrlClassId"/>
      </relation>
    </entity>
    <entity entity-name="PartyAcctgPreference"
        package-name="org.apache.ofbiz.accounting.ledger"
        title="Party (organization) accounting preferences">
        <field name="partyId" type="id"/>
        <field name="fiscalYearStartMonth" type="numeric"/>
        <field name="fiscalYearStartDay" type="numeric"/>
        <field name="taxFormId" type="id"/>
        <field name="cogsMethodId" type="id"/>
        <field name="baseCurrencyUomId" type="id"/>
        <field name="invoiceSeqCustMethId" type="id"/>
        <field name="invoiceIdPrefix" type="very-short"/>
        <field name="lastInvoiceNumber" type="numeric"/>
        <field name="lastInvoiceRestartDate" type="date-time"/>
        <field name="useInvoiceIdForReturns" type="indicator"/>
        <field name="quoteSeqCustMethId" type="id"/>
        <field name="quoteIdPrefix" type="very-short"/>
        <field name="lastQuoteNumber" type="numeric"/>
        <field name="orderSeqCustMethId" type="id"/>
        <field name="orderIdPrefix" type="very-short"/>
        <field name="lastOrderNumber" type="numeric"/>
        <field name="refundPaymentMethodId" type="id"/>
        <field name="errorGlJournalId" type="id">
            <description>
                Journal to which all the failed automatic transaction are assigned.
                If the error journal is set, if the GL posting fails for some reason the triggering operation (finalizing an invoice or payment or whatever) would NOT roll back, instead the partial GL post would be placed into the error journal.
            </description>
        </field>
        <field name="enableAccounting" type="indicator"/>
        <prim-key field="partyId"/>
        <relation type="one" rel-entity-name="Party" fk-name="ACTG_PREF_PTY">
            <key-map field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="ACTGPREF_TAXFORM" title="TaxForm" rel-entity-name="Enumeration">
            <key-map field-name="taxFormId" rel-field-name="enumId"/>
        </relation>
        <relation type="one" fk-name="ACTGPREF_COGS" title="Cogs" rel-entity-name="Enumeration">
            <key-map field-name="cogsMethodId" rel-field-name="enumId"/>
        </relation>
        <relation type="one" fk-name="ACCTGPREF_CURNCY" rel-entity-name="Uom">
            <key-map field-name="baseCurrencyUomId" rel-field-name="uomId"/>
        </relation>
        <relation type="one" fk-name="ACTGPREF_INVCM" title="Invoice" rel-entity-name="CustomMethod">
            <key-map field-name="invoiceSeqCustMethId" rel-field-name="customMethodId"/>
        </relation>
        <relation type="one" fk-name="ACTGPREF_QTECM" title="Quote" rel-entity-name="CustomMethod">
            <key-map field-name="quoteSeqCustMethId" rel-field-name="customMethodId"/>
        </relation>
        <relation type="one" fk-name="ACTGPREF_ODRCM" title="Order" rel-entity-name="CustomMethod">
            <key-map field-name="orderSeqCustMethId" rel-field-name="customMethodId"/>
        </relation>
        <relation type="one" fk-name="ACTGPREF_PAYMTH" rel-entity-name="PaymentMethod">
            <key-map field-name="refundPaymentMethodId" rel-field-name="paymentMethodId"/>
        </relation>
        <relation type="one" fk-name="ACTGPREF_GLJRNL" rel-entity-name="GlJournal">
            <key-map field-name="errorGlJournalId" rel-field-name="glJournalId"/>
        </relation>
    </entity>
    <entity entity-name="PartyPrefDocTypeTpl"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Party (organization) preferences for document type template">
        <field name="partyPrefDocTypeTplId" type="id"/>
        <field name="partyId" type="id"/>
        <field name="fromDate" type="date-time"/>
        <field name="thruDate" type="date-time"/>
        <field name="invoiceTypeId" type="id"/>
        <field name="orderTypeId" type="id"/>
        <field name="quoteTypeId" type="id"/>
        <field name="customScreenId" type="id"/>
        <prim-key field="partyPrefDocTypeTplId"/>
        <relation type="one" rel-entity-name="Party" fk-name="PAPDTT_TO_PTY">
            <key-map field-name="partyId"/>
        </relation>
        <relation type="one" rel-entity-name="PartyAcctgPreference" fk-name="PAPDTT_TO_PAP">
            <key-map field-name="partyId"/>
        </relation>
        <relation type="one" rel-entity-name="InvoiceType" fk-name="PAPDTT_TO_INVT">
            <key-map field-name="invoiceTypeId"/>
        </relation>
        <relation type="one" rel-entity-name="QuoteType" fk-name="PAPDTT_TO_QUOT">
            <key-map field-name="quoteTypeId"/>
        </relation>
        <relation type="one" rel-entity-name="OrderType" fk-name="PAPDTT_TO_ORDT">
            <key-map field-name="orderTypeId"/>
        </relation>
    </entity>
    <view-entity entity-name="PartyPrefDocTypeTplAndCustomScreen"
                 package-name="org.apache.ofbiz.accounting.ledger"
                 title="Party (organization) accounting preferences for document type template and custom screen view">
        <member-entity entity-alias="PAP" entity-name="PartyPrefDocTypeTpl"/>
        <member-entity entity-alias="CS" entity-name="CustomScreen"/>
        <alias-all entity-alias="PAP"/>
        <alias-all entity-alias="CS"/>
        <view-link entity-alias="PAP" rel-entity-alias="CS" rel-optional="true">
            <key-map field-name="customScreenId"/>
        </view-link>
    </view-entity>
    <entity entity-name="ProductAverageCost"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Running tally of average cost">
       <description>Running tally of a product's average cost in a particular company and facility</description>
       <field name="productAverageCostTypeId" type="id"/>
       <field name="organizationPartyId" type="id"/>
       <field name="productId" type="id"/>
       <field name="facilityId" type="id"/>
       <field name="fromDate" type="date-time"/>
       <field name="thruDate" type="date-time"/>
       <field name="averageCost" type="fixed-point"/>
       <prim-key field="productAverageCostTypeId"/>
       <prim-key field="organizationPartyId"/>
       <prim-key field="productId"/>
       <prim-key field="facilityId"/>
       <prim-key field="fromDate"/>
       <relation type="one" rel-entity-name="ProductAverageCostType" fk-name="AVG_COST_TYPE">
           <key-map field-name="productAverageCostTypeId"/>
       </relation>
       <relation type="one" rel-entity-name="Party" fk-name="AVG_COST_PARTY">
           <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
       </relation>
       <relation type="one" rel-entity-name="Product" fk-name="AVG_COST_PROD">
           <key-map field-name="productId"/>
       </relation>
       <relation type="one" rel-entity-name="Facility" fk-name="AVG_COST_FACI">
           <key-map field-name="facilityId"/>
       </relation>
    </entity>
    <entity entity-name="ProductAverageCostType"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Product average cost type" default-resource-name="AccountingEntityLabels">
        <field name="productAverageCostTypeId" type="id"/>
        <field name="parentTypeId" type="id"/>
        <field name="hasTable" type="indicator"/>
        <field name="description" type="description"/>
        <prim-key field="productAverageCostTypeId"/>
        <relation type="one" fk-name="AVGCOST_TYPE_PAR" title="Parent" rel-entity-name="ProductAverageCostType">
            <key-map field-name="parentTypeId" rel-field-name="productAverageCostTypeId"/>
        </relation>
    </entity>
    <entity entity-name="SettlementTerm"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Settlement Term">
      <field name="settlementTermId" type="id"></field>
      <field name="termName" type="name"></field>
      <field name="termValue" type="numeric"></field>
      <field name="uomId" type="id"></field>
      <prim-key field="settlementTermId"/>
    </entity>
    <entity entity-name="VarianceReasonGlAccount"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="Defines GL Accounts for Inventory Variance Reasons">
      <field name="varianceReasonId" type="id"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="glAccountId" type="id"></field>
      <prim-key field="varianceReasonId"/>
      <prim-key field="organizationPartyId"/>
      <relation type="one" fk-name="VRGL_VREAS" rel-entity-name="VarianceReason">
        <key-map field-name="varianceReasonId"/>
      </relation>
      <relation type="one" fk-name="VRGL_PARTY" title="Organization" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="VRGL_GLACCT" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
    </entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.accounting.payment -->
  <!-- ========================================================= -->

    <entity entity-name="BillingAccount"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Billing Account">
      <description>A BillingAccount Payment Method</description>
      <field name="billingAccountId" type="id"></field>
      <field name="accountLimit" type="currency-amount"></field>
      <field name="accountCurrencyUomId" type="id"></field>
      <field name="contactMechId" type="id"><!-- This is a PostalAddress --></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="description" type="description"></field>
      <field name="externalAccountId" type="id"></field>
      <prim-key field="billingAccountId"/>
      <relation type="one" fk-name="BILLACCT_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="BILLACCT_CUOM" rel-entity-name="Uom">
        <key-map field-name="accountCurrencyUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="BILLACCT_PADDR" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
    </entity>
    <view-entity entity-name="BillingAccountAndRole"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Billing Account and Role"
            never-cache="true">
      <member-entity entity-alias="BA" entity-name="BillingAccount"/>
      <member-entity entity-alias="BR" entity-name="BillingAccountRole"/>
      <alias-all entity-alias="BR"/>
      <alias entity-alias="BA" name="billingAccountId"/>
      <alias entity-alias="BA" name="accountLimit"/>
      <alias entity-alias="BA" name="accountCurrencyUomId"/>
      <alias entity-alias="BA" name="contactMechId"/>
      <alias entity-alias="BA" name="accountFromDate" field="fromDate"/>
      <alias entity-alias="BA" name="accountThruDate" field="thruDate"/>
      <alias entity-alias="BA" name="description"/>
      <view-link entity-alias="BA" rel-entity-alias="BR">
        <key-map field-name="billingAccountId"/>
      </view-link>
      <relation type="many" rel-entity-name="OrderHeader">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="many" rel-entity-name="BillingAccountRole">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="many" rel-entity-name="Invoice">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="many" rel-entity-name="PaymentApplication">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </view-entity>
    <entity entity-name="BillingAccountRole"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Billing Account Role">
      <field name="billingAccountId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="billingAccountId"/>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="BILLACCT_ROLE" rel-entity-name="BillingAccount">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="one" fk-name="BILLACCT_RL_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="BILLACCT_RL_PTRL" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </entity>
    <view-entity entity-name="BillingAccountRoleAndAddress"
        package-name="org.apache.ofbiz.accounting.payment"
        title="Billing Account Role and Address">
        <description>Note that the ContactMech is not linked into this view and the PADDR is not optional, this way we naturally only get postal address entries</description>
        <member-entity entity-alias="BAR" entity-name="BillingAccountRole"/>
        <member-entity entity-alias="PCM" entity-name="PartyContactMech"/>
        <member-entity entity-alias="PADDR" entity-name="PostalAddress"/>
        <alias-all entity-alias="BAR"/>
        <alias-all entity-alias="PADDR"/>
        <alias entity-alias="PCM" name="pcmFromDate" field="fromDate"/>
        <alias entity-alias="PCM" name="pcmThruDate" field="thruDate"/>
        <view-link entity-alias="BAR" rel-entity-alias="PCM">
            <key-map field-name="partyId"/>
        </view-link>
        <view-link entity-alias="PCM" rel-entity-alias="PADDR">
            <key-map field-name="contactMechId"/>
        </view-link>
    </view-entity>
    <entity entity-name="BillingAccountTerm"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Billing Account Term">
      <field name="billingAccountTermId" type="id"></field>
      <field name="billingAccountId" type="id"></field>
      <field name="termTypeId" type="id"></field>
      <field name="termValue" type="currency-amount"></field>
      <field name="termDays" type="numeric"></field>
      <field name="uomId" type="id"></field>
      <prim-key field="billingAccountTermId"/>
      <relation type="one" fk-name="BILLACCT_TRM_UOM" rel-entity-name="Uom">
        <key-map field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="BILLACCT_TRM_TRM" rel-entity-name="TermType">
        <key-map field-name="termTypeId"/>
      </relation>
      <relation type="one" fk-name="BILLACCT_TRM_BACT" rel-entity-name="BillingAccount">
        <key-map field-name="billingAccountId"/>
      </relation>
    </entity>
    <entity entity-name="BillingAccountTermAttr"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Billing Account Term Attribute">
      <field name="billingAccountTermId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <prim-key field="billingAccountTermId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="BILLACCT_TRM_ATTR" rel-entity-name="BillingAccountTerm">
        <key-map field-name="billingAccountTermId"/>
      </relation>
      <relation type="many" rel-entity-name="TermTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="CreditCard"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Credit Card Information">
      <field name="paymentMethodId" type="id"></field>
      <field name="cardType" type="short-varchar"></field>
      <field name="cardNumber" type="credit-card-number" encrypt="true"></field>
      <field name="validFromDate" type="credit-card-date"><description>Not common in some parts of the world.</description></field>
      <field name="expireDate" type="credit-card-date"></field>
      <field name="issueNumber" type="credit-card-date"><description>Single digit number on some Switch and Maestro cards</description></field>
      <field name="companyNameOnCard" type="name"></field>
      <field name="titleOnCard" type="name"></field>
      <field name="firstNameOnCard" type="name"></field>
      <field name="middleNameOnCard" type="name"></field>
      <field name="lastNameOnCard" type="name"></field>
      <field name="suffixOnCard" type="name"></field>
      <field name="contactMechId" type="id"><description>The Billing PostalAddress</description></field>
      <field name="consecutiveFailedAuths" type="numeric"></field>
      <field name="lastFailedAuthDate" type="date-time"></field>
      <field name="consecutiveFailedNsf" type="numeric"></field>
      <field name="lastFailedNsfDate" type="date-time"></field>
      <prim-key field="paymentMethodId"/>
      <relation type="one" fk-name="CREDCARD_PMNTMETH" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one" fk-name="CREDCARD_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="CREDCARD_PADDR" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
    </entity>
    <entity entity-name="CreditCardTypeGlAccount"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Credit Card Type GL Account">
      <field name="cardType" type="short-varchar"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="glAccountId" type="id"></field>
      <prim-key field="cardType"/>
      <prim-key field="organizationPartyId"/>
    </entity>
    <entity entity-name="Deduction"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Deduction">
      <field name="deductionId" type="id"></field>
      <field name="deductionTypeId" type="id"></field>
      <field name="paymentId" type="id"></field>
      <field name="amount" type="currency-amount"></field>
      <prim-key field="deductionId"/>
      <relation type="one" fk-name="DEDCTN_DEDTYP" rel-entity-name="DeductionType">
        <key-map field-name="deductionTypeId"/>
      </relation>
      <relation type="one" fk-name="DEDCTN_PMNT" rel-entity-name="Payment">
        <key-map field-name="paymentId"/>
      </relation>
    </entity>
    <entity entity-name="DeductionType"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Deduction Type">
      <field name="deductionTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="deductionTypeId"/>
      <relation type="one" fk-name="DEDUCT_TYP_PAR" title="Parent" rel-entity-name="DeductionType">
        <key-map field-name="parentTypeId" rel-field-name="deductionTypeId"/>
      </relation>
    </entity>
    <entity entity-name="EftAccount"
            package-name="org.apache.ofbiz.accounting.payment"
            title="EFT Account Information">
      <field name="paymentMethodId" type="id"></field>
      <field name="bankName" type="name"></field>
      <field name="routingNumber" type="short-varchar"><description>See https://en.wikipedia.org/wiki/Bank_code </description></field>
      <field name="accountType" type="short-varchar"></field>
      <field name="accountNumber" type="long-varchar"></field>
      <field name="nameOnAccount" type="name"></field>
      <field name="companyNameOnAccount" type="name"></field>
      <field name="contactMechId" type="id"></field>
      <field name="yearsAtBank" type="numeric"></field>
      <prim-key field="paymentMethodId"/>
      <relation type="one" fk-name="EFTACCT_PMETH" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one" fk-name="EFTACCT_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="EFTACCT_PADDR" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
    </entity>

    <entity entity-name="CheckAccount"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Check Information">
      <field name="paymentMethodId" type="id"></field>
      <field name="bankName" type="name"></field>
      <field name="routingNumber" type="short-varchar"><description>See https://en.wikipedia.org/wiki/Bank_code </description></field>
      <field name="accountType" type="short-varchar"></field>
      <field name="accountNumber" type="long-varchar"></field>
      <field name="nameOnAccount" type="name"></field>
      <field name="companyNameOnAccount" type="name"></field>
      <field name="contactMechId" type="id"></field>
      <field name="branchCode" type="short-varchar"></field>
      <prim-key field="paymentMethodId"/>
      <relation type="one" fk-name="CACCT_PMETH" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one" fk-name="CACCT_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="CACCT_PADDR" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
    </entity>

    <entity entity-name="GiftCard"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Gift Card Information">
      <field name="paymentMethodId" type="id"></field>
      <field name="cardNumber" type="long-varchar" encrypt="true"></field>
      <field name="pinNumber" type="long-varchar" encrypt="true"></field>
      <field name="expireDate" type="credit-card-date"></field>
      <field name="contactMechId" type="id"></field>
      <prim-key field="paymentMethodId"/>
      <relation type="one" fk-name="GIFTCARD_PMNTMETH" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one" fk-name="GIFTCARD_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="GIFTCARD_PADDR" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
    </entity>
    <entity entity-name="GiftCardFulfillment"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Gift Card Fulfillment History">
      <field name="fulfillmentId" type="id"></field>
      <field name="typeEnumId" type="id"></field>
      <field name="merchantId" type="id-vlong"></field>
      <field name="partyId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="surveyResponseId" type="id"></field>
      <field name="cardNumber" type="long-varchar" encrypt="true"></field>
      <field name="pinNumber" type="long-varchar" encrypt="true"></field>
      <field name="amount" type="currency-amount"></field>
      <field name="responseCode" type="short-varchar"></field>
      <field name="referenceNum" type="short-varchar"></field>
      <field name="authCode" type="short-varchar"></field>
      <field name="fulfillmentDate" type="date-time"></field>
      <prim-key field="fulfillmentId"/>
      <relation type="one" fk-name="GC_FILL_ENUM" rel-entity-name="Enumeration">
          <key-map field-name="typeEnumId" rel-field-name="enumId"/>
      </relation>
      <relation type="one" fk-name="GC_FILL_PARTY" rel-entity-name="Party">
          <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="GC_FILL_ODRH" rel-entity-name="OrderHeader">
          <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="GC_FILL_ODRI" rel-entity-name="OrderItem">
          <key-map field-name="orderId"/>
          <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="GC_FILL_SURVY" rel-entity-name="SurveyResponse">
          <key-map field-name="surveyResponseId"/>
      </relation>
    </entity>

    <entity entity-name="Payment"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment">
      <field name="paymentId" type="id"></field>
      <field name="paymentTypeId" type="id"></field>
      <field name="paymentMethodTypeId" type="id"></field>
      <field name="paymentMethodId" type="id"></field>
      <field name="paymentGatewayResponseId" type="id"></field>
      <field name="paymentPreferenceId" type="id"></field>
      <field name="partyIdFrom" type="id"></field>
      <field name="partyIdTo" type="id"></field>
      <field name="roleTypeIdTo" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="effectiveDate" type="date-time"></field>
      <field name="paymentRefNum" type="short-varchar"></field>
      <field name="amount" type="currency-amount"></field>
      <field name="currencyUomId" type="id"></field>
      <field name="comments" type="comment"></field>
      <field name="finAccountTransId" type="id"></field>
      <field name="overrideGlAccountId" type="id"></field>
      <field name="actualCurrencyAmount" type="currency-amount"><!-- The ActualCurrency amount and uomId are for the values coming from the bank (if known) and are to be used for reconciliation and such later, and not for PaymentApplication. --></field>
      <field name="actualCurrencyUomId" type="id"></field>
      <prim-key field="paymentId"/>
      <relation type="one" fk-name="PAYMENT_PMTYP" rel-entity-name="PaymentType">
        <key-map field-name="paymentTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="PaymentTypeAttr">
        <key-map field-name="paymentTypeId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_PMETH_TP" rel-entity-name="PaymentMethodType">
        <key-map field-name="paymentMethodTypeId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_PMETH" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_CUOM" title="Currency" rel-entity-name="Uom">
        <key-map field-name="currencyUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_ACUOM" title="ActualCurrency" rel-entity-name="Uom">
        <key-map field-name="actualCurrencyUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="CreditCard">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="EftAccount">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="GiftCard">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_ORDPMPRF" rel-entity-name="OrderPaymentPreference">
        <key-map field-name="paymentPreferenceId" rel-field-name="orderPaymentPreferenceId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_PAYGATR" rel-entity-name="PaymentGatewayResponse">
        <key-map field-name="paymentGatewayResponseId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_FPTY" title="From" rel-entity-name="Party">
        <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_TPTY" title="To" rel-entity-name="Party">
        <key-map field-name="partyIdTo" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_TRTP" title="To" rel-entity-name="RoleType">
        <key-map field-name="roleTypeIdTo" rel-field-name="roleTypeId"/>
      </relation>
      <relation type="one-nofk" title="To" rel-entity-name="PartyRole">
        <key-map field-name="partyIdTo" rel-field-name="partyId"/>
        <key-map field-name="roleTypeIdTo" rel-field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_STTSITM" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_FACTX" rel-entity-name="FinAccountTrans">
        <key-map field-name="finAccountTransId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_ORGLA" rel-entity-name="GlAccount">
        <key-map field-name="overrideGlAccountId" rel-field-name="glAccountId"/>
      </relation>
    </entity>
    <view-entity entity-name="PaymentAndTypePartyNameView"
      package-name="org.apache.ofbiz.accounting.payment"
      title="Payment PaymentType PaymentMethodType StatusItem and Party Name View">
      <member-entity entity-alias="PY" entity-name="Payment"/>
      <member-entity entity-alias="FPNV" entity-name="PartyNameView"/>
      <member-entity entity-alias="TPNV" entity-name="PartyNameView"/>
      <member-entity entity-alias="TY" entity-name="PaymentType"/>
      <member-entity entity-alias="PMT" entity-name="PaymentMethodType"/>
      <member-entity entity-alias="SI" entity-name="StatusItem"/>
      <alias-all entity-alias="PY"/>
      <alias name="partyFromFirstName" entity-alias="FPNV" field="firstName"/>
      <alias name="partyFromLastName" entity-alias="FPNV" field="lastName"/>
      <alias name="partyFromGroupName" entity-alias="FPNV" field="groupName"/>
      <alias name="partyToFirstName" entity-alias="TPNV" field="firstName"/>
      <alias name="partyToLastName" entity-alias="TPNV" field="lastName"/>
      <alias name="partyToGroupName" entity-alias="TPNV" field="groupName"/>
      <alias name="paymentTypeDesc" entity-alias="TY" field="description"/>
      <alias name="parentPaymentTypeId" entity-alias="TY" field="parentTypeId"/>
      <alias name="statusDesc" entity-alias="SI" field="description"/>
      <alias name="paymentMethodTypeDesc" entity-alias="PMT" field="description"/>
      <view-link entity-alias="PY" rel-entity-alias="FPNV">
        <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
      </view-link>
      <view-link entity-alias="PY" rel-entity-alias="TPNV">
        <key-map field-name="partyIdTo" rel-field-name="partyId"/>
      </view-link>
      <view-link entity-alias="PY" rel-entity-alias="TY">
        <key-map field-name="paymentTypeId"/>
      </view-link>
      <view-link entity-alias="PY" rel-entity-alias="PMT">
        <key-map field-name="paymentMethodTypeId"/>
      </view-link>
      <view-link entity-alias="PY" rel-entity-alias="SI">
        <key-map field-name="statusId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="PaymentType">
        <key-map field-name="paymentTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PaymentMethodType">
        <key-map field-name="paymentMethodTypeId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="PaymentAndType"
      package-name="org.apache.ofbiz.accounting.payment"
      never-cache="true"
      title="Payment and Payment type View">
      <member-entity entity-alias="PY" entity-name="Payment"/>
      <member-entity entity-alias="TY" entity-name="PaymentType"/>
      <alias-all entity-alias="PY"/>
      <alias-all entity-alias="TY">
        <exclude field="paymentTypeId"/>
      </alias-all>
      <view-link entity-alias="PY" rel-entity-alias="TY">
        <key-map field-name="paymentTypeId"/>
      </view-link>
      <relation type="many" fk-name="PAYTYPE_PAY" rel-entity-name="PaymentApplication">
        <key-map field-name="paymentId"/>
      </relation>
      <relation type="many" fk-name="PAYTYPE_TOPAY" title="to" rel-entity-name="PaymentApplication">
        <key-map field-name="paymentId" rel-field-name="toPaymentId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="PaymentAndTypeAndCreditCard"
            package-name="org.apache.ofbiz.accounting.payment"
            never-cache="true"
            title="Payment, Payment type and CreadiCard View">
        <member-entity entity-alias="PAT" entity-name="PaymentAndType"/>
        <member-entity entity-alias="CC" entity-name="CreditCard"/>
        <alias-all entity-alias="PAT"/>
        <alias-all entity-alias="CC"/>
        <view-link entity-alias="PAT" rel-entity-alias="CC" rel-optional="true">
            <key-map field-name="paymentMethodId" rel-field-name="paymentMethodId"/>
        </view-link>
    </view-entity>
    <view-entity entity-name="PaymentAndApplication"
            package-name="org.apache.ofbiz.accounting.payment"
            never-cache="true"
            title="Payment and Application View">
      <member-entity entity-alias="PY" entity-name="Payment"/>
      <member-entity entity-alias="PA" entity-name="PaymentApplication"/>
      <alias-all entity-alias="PY">
        <exclude field="overrideGlAccountId"/><!-- already existing in PaymentApplication -->
      </alias-all>
      <alias-all entity-alias="PA"/>
      <view-link entity-alias="PY" rel-entity-alias="PA">
        <key-map field-name="paymentId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="Payment">
        <key-map field-name="paymentId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PaymentApplication">
        <key-map field-name="paymentApplicationId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PaymentType">
        <key-map field-name="paymentTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PaymentMethodType">
        <key-map field-name="paymentMethodTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PaymentGatewayResponse">
        <key-map field-name="paymentGatewayResponseId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="Geo">
        <key-map field-name="taxAuthGeoId" rel-field-name="geoId"/>
      </relation>
    </view-entity>
    <entity entity-name="PaymentApplication"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Application">
      <field name="paymentApplicationId" type="id"></field>
      <field name="paymentId" type="id"></field>
      <field name="invoiceId" type="id"></field>
      <field name="invoiceItemSeqId" type="id"></field>
      <field name="billingAccountId" type="id"></field>
      <field name="overrideGlAccountId" type="id"><description>If filled in, payment is applied directly against this GL account</description></field>
      <field name="toPaymentId" type="id"><!-- To be used when a payment is based on or comes from another payment, like a payment that is a return of a mistaken or over-payment --></field>
      <field name="taxAuthGeoId" type="id"/>
      <field name="amountApplied" type="currency-amount"></field>
      <prim-key field="paymentApplicationId"/>
      <relation type="one" fk-name="PAYMENT_APP_PMT" rel-entity-name="Payment">
        <key-map field-name="paymentId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_APP_INV" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceId"/>
        <key-map field-name="invoiceItemSeqId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_APP_BACT" rel-entity-name="BillingAccount">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_APP_TPMT" title="To" rel-entity-name="Payment">
        <key-map field-name="toPaymentId" rel-field-name="paymentId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_APP_GEO" rel-entity-name="Geo">
        <key-map field-name="taxAuthGeoId" rel-field-name="geoId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_APP_ORGLA" rel-entity-name="GlAccount">
        <key-map field-name="overrideGlAccountId" rel-field-name="glAccountId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentAttribute"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Attribute">
      <field name="paymentId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="paymentId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="PAYMENT_ATTR" rel-entity-name="Payment">
        <key-map field-name="paymentId"/>
      </relation>
      <relation type="many" rel-entity-name="PaymentTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="PaymentBudgetAllocation"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Budget Allocation">
      <field name="budgetId" type="id"></field>
      <field name="budgetItemSeqId" type="id"></field>
      <field name="paymentId" type="id"></field>
      <field name="amount" type="currency-amount"></field>
      <prim-key field="budgetId"/>
      <prim-key field="budgetItemSeqId"/>
      <prim-key field="paymentId"/>
      <relation type="one" fk-name="PAYMENT_BA_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="BudgetItem">
        <key-map field-name="budgetId"/>
        <key-map field-name="budgetItemSeqId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_BA_PMT" rel-entity-name="Payment">
        <key-map field-name="paymentId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentContent" 
            package-name="org.apache.ofbiz.accounting.payment" 
            title="Payment Content">
        <field name="paymentId" type="id"></field>
        <field name="paymentContentTypeId" type="id"></field>
        <field name="contentId" type="id"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <prim-key field="contentId"/>
        <prim-key field="paymentId"/>
        <prim-key field="paymentContentTypeId"/>
        <prim-key field="fromDate"/>
        <relation type="one" fk-name="PAYMENT_CNT_PROD" rel-entity-name="Payment">
            <key-map field-name="paymentId"/>
        </relation>
        <relation type="one" fk-name="PAYMENT_CNT_CNT" rel-entity-name="Content">
            <key-map field-name="contentId"/>
        </relation>
        <relation type="one" fk-name="PAYMENT_CNT_TYPE" rel-entity-name="PaymentContentType">
            <key-map field-name="paymentContentTypeId"/>
        </relation>
    </entity>
    <entity entity-name="PaymentContentType" 
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Content Type">
        <field name="paymentContentTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="hasTable" type="indicator"></field>
        <field name="description" type="description"></field>
        <prim-key field="paymentContentTypeId"/>
        <relation type="one" fk-name="PAYCT_TYP_PARENT" title="Parent" rel-entity-name="PaymentContentType">
            <key-map field-name="parentTypeId" rel-field-name="paymentContentTypeId"/>
        </relation>
    </entity>
    <view-entity entity-name="PaymentContentAndInfo"
            package-name="org.apache.ofbiz.accounting.payment"
            title="PaymentContent Content and DataResource View">
      <member-entity entity-alias="PAYC" entity-name="PaymentContent"/>
      <member-entity entity-alias="CO" entity-name="Content"/>
      <member-entity entity-alias="DR" entity-name="DataResource"/>
      <alias-all entity-alias="PAYC"/>
      <alias-all entity-alias="CO"/>
      <alias-all entity-alias="DR" prefix="dr"/>
      <view-link entity-alias="PAYC" rel-entity-alias="CO">
        <key-map field-name="contentId"/>
      </view-link>
      <view-link entity-alias="CO" rel-entity-alias="DR">
        <key-map field-name="dataResourceId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="ElectronicText">
        <key-map field-name="dataResourceId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ImageDataResource">
        <key-map field-name="dataResourceId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OtherDataResource">
        <key-map field-name="dataResourceId"/>
      </relation>
      <relation type="many" rel-entity-name="ContentAssocDataResourceViewFrom">
        <key-map field-name="contentId" rel-field-name="contentIdStart"/>
      </relation>
      <relation type="many" rel-entity-name="ContentAssocDataResourceViewTo">
        <key-map field-name="contentId" rel-field-name="contentIdStart"/>
      </relation>
    </view-entity>

    <entity entity-name="PaymentMethod"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Method">
      <field name="paymentMethodId" type="id"></field>
      <field name="paymentMethodTypeId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="glAccountId" type="id"></field>
      <field name="finAccountId" type="id"></field>
      <field name="description" type="description"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="paymentMethodId"/>
      <relation type="one" fk-name="PAYMETH_TYPE" rel-entity-name="PaymentMethodType">
        <key-map field-name="paymentMethodTypeId"/>
      </relation>
      <relation type="one" fk-name="PAYMETH_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="PAYMETH_GLACCT" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="PAYMETH_FINACCT" rel-entity-name="FinAccount">
        <key-map field-name="finAccountId"/>
      </relation>
    </entity>
  <view-entity entity-name="PaymentMethodAndCreditCard"
    package-name="org.apache.ofbiz.accounting.payment"
    never-cache="true"
    title="PaymentMethod and CreditCard View">
    <member-entity entity-alias="PM" entity-name="PaymentMethod"/>
    <member-entity entity-alias="CC" entity-name="CreditCard"/>
    <alias entity-alias="PM" name="paymentMethodId"/>
    <alias entity-alias="PM" name="paymentMethodTypeId"/>
    <alias entity-alias="PM" name="partyId"/>
    <alias entity-alias="PM" name="glAccountId"/>
    <alias entity-alias="PM" name="fromDate"/>
    <alias entity-alias="PM" name="thruDate"/>
    <alias entity-alias="PM" name="description"/>
    <alias entity-alias="CC" name="cardType"/>
    <alias entity-alias="CC" name="cardNumber"/>
    <alias entity-alias="CC" name="expireDate"/>
    <alias entity-alias="CC" name="companyNameOnCard"/>
    <alias entity-alias="CC" name="titleOnCard"/>
    <alias entity-alias="CC" name="firstNameOnCard"/>
    <alias entity-alias="CC" name="lastNameOnCard"/>
    <alias entity-alias="CC" name="suffixOnCard"/>
    <alias entity-alias="CC" name="contactMechId"/>
    <view-link entity-alias="PM" rel-entity-alias="CC">
      <key-map field-name="paymentMethodId"/>
    </view-link>
    <relation type="one-nofk" rel-entity-name="PaymentMethod">
      <key-map field-name="paymentMethodId"/>
    </relation>
    <relation type="one-nofk" rel-entity-name="PaymentMethodType">
      <key-map field-name="paymentMethodTypeId"/>
    </relation>
    <relation type="one-nofk" rel-entity-name="CreditCard">
      <key-map field-name="paymentMethodId"/>
    </relation>
    <relation type="one-nofk" rel-entity-name="PostalAddress">
      <key-map field-name="contactMechId"/>
    </relation>
  </view-entity>
  <view-entity entity-name="PaymentMethodAndEftAccount"
    package-name="org.apache.ofbiz.accounting.payment"
    never-cache="true"
    title="PaymentMethod and EftAccount View">
    <member-entity entity-alias="PM" entity-name="PaymentMethod"/>
    <member-entity entity-alias="EA" entity-name="EftAccount"/>
    <alias entity-alias="PM" name="paymentMethodId"/>
    <alias entity-alias="PM" name="paymentMethodTypeId"/>
    <alias entity-alias="PM" name="partyId"/>
    <alias entity-alias="PM" name="glAccountId"/>
    <alias entity-alias="PM" name="fromDate"/>
    <alias entity-alias="PM" name="thruDate"/>
    <alias entity-alias="EA" name="bankName"/>
    <alias entity-alias="EA" name="routingNumber"/><!-- also used for IBAN number, see https://en.wikipedia.org/wiki/Bank_code  -->
    <alias entity-alias="EA" name="accountType"/>
    <alias entity-alias="EA" name="accountNumber"/>
    <alias entity-alias="EA" name="nameOnAccount"/>
    <alias entity-alias="EA" name="companyNameOnAccount"/>
    <alias entity-alias="EA" name="contactMechId"/>
    <alias entity-alias="EA" name="yearsAtBank"/>
    <view-link entity-alias="PM" rel-entity-alias="EA">
      <key-map field-name="paymentMethodId"/>
    </view-link>
    <relation type="one-nofk" rel-entity-name="PaymentMethod">
      <key-map field-name="paymentMethodId"/>
    </relation>
    <relation type="one-nofk" rel-entity-name="PaymentMethodType">
      <key-map field-name="paymentMethodTypeId"/>
    </relation>
    <relation type="one-nofk" rel-entity-name="EftAccount">
      <key-map field-name="paymentMethodId"/>
    </relation>
    <relation type="one-nofk" rel-entity-name="PostalAddress">
      <key-map field-name="contactMechId"/>
    </relation>
  </view-entity>

  <view-entity entity-name="PaymentMethodAndGiftCard"
            package-name="org.apache.ofbiz.accounting.payment"
            never-cache="true"
            title="PaymentMethod and GiftCard View">
      <member-entity entity-alias="PM" entity-name="PaymentMethod"/>
      <member-entity entity-alias="GC" entity-name="GiftCard"/>
      <alias entity-alias="PM" name="paymentMethodId"/>
      <alias entity-alias="PM" name="paymentMethodTypeId"/>
      <alias entity-alias="PM" name="partyId"/>
      <alias entity-alias="PM" name="glAccountId"/>
      <alias entity-alias="PM" name="fromDate"/>
      <alias entity-alias="PM" name="thruDate"/>
      <alias entity-alias="GC" name="cardNumber"/>
      <alias entity-alias="GC" name="pinNumber"/>
      <alias entity-alias="GC" name="expireDate"/>
      <alias entity-alias="GC" name="contactMechId"/>
      <view-link entity-alias="PM" rel-entity-alias="GC">
        <key-map field-name="paymentMethodId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PaymentMethodType">
        <key-map field-name="paymentMethodTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="GiftCard">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
    </view-entity>
    <entity entity-name="PaymentMethodType"
            package-name="org.apache.ofbiz.accounting.payment"
            title="PaymentMethodType" default-resource-name="AccountingEntityLabels">
      <field name="paymentMethodTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <field name="defaultGlAccountId" type="id"></field>
      <prim-key field="paymentMethodTypeId"/>
      <relation type="one" fk-name="PAYMENT_MTP_DGLAC" title="Default" rel-entity-name="GlAccount">
        <key-map field-name="defaultGlAccountId" rel-field-name="glAccountId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentMethodTypeGlAccount"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Method Type GL Account">
      <field name="paymentMethodTypeId" type="id"></field>
      <field name="organizationPartyId" type="id"></field>
      <field name="glAccountId" type="id"></field>
      <prim-key field="paymentMethodTypeId"/>
      <prim-key field="organizationPartyId"/>
      <relation type="one" fk-name="PAYMENT_MTGA_PMT" rel-entity-name="PaymentMethodType">
        <key-map field-name="paymentMethodTypeId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_MTGA_OPTY" title="Organization" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_MTGA_GLAC" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentType"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Type" default-resource-name="AccountingEntityLabels">
      <field name="paymentTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="paymentTypeId"/>
      <relation type="one" fk-name="PAYMENT_TYPE_PAR" title="Parent" rel-entity-name="PaymentType">
        <key-map field-name="parentTypeId" rel-field-name="paymentTypeId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentTypeAttr"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Type Attribute">
      <field name="paymentTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="paymentTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="PAYMETH_TYPE_ATTR" rel-entity-name="PaymentType">
        <key-map field-name="paymentTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="PaymentAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="Payment">
        <key-map field-name="paymentTypeId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGlAccountTypeMap"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Maps PaymentTypes to GlAccountTypes, allowing user to configure payments and gl accounts">
      <field name="paymentTypeId" type="id"></field>
      <field name="organizationPartyId" type="id"/>
      <field name="glAccountTypeId" type="id"/>
      <prim-key field="paymentTypeId"/>
      <prim-key field="organizationPartyId"/>
      <relation type="one" fk-name="PMTGLACCT_PMTTYPE" rel-entity-name="PaymentType">
        <key-map field-name="paymentTypeId"/>
      </relation>
      <relation type="one" fk-name="PMTGLACCT_PARTY" rel-entity-name="Party">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="PMTGLACCT_GLACCT" rel-entity-name="GlAccountType">
        <key-map field-name="glAccountTypeId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayConfigType"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Gateway Config Type">
      <field name="paymentGatewayConfigTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="paymentGatewayConfigTypeId"/>
      <relation type="one" fk-name="PGCT_PAR" title="Parent" rel-entity-name="PaymentGatewayConfigType">
        <key-map field-name="parentTypeId" rel-field-name="paymentGatewayConfigTypeId"/>
      </relation>
      <relation type="many" title="Sibling" rel-entity-name="PaymentGatewayConfigType">
        <key-map field-name="parentTypeId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayConfig"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Gateway Config">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="paymentGatewayConfigTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGC_PGCT" rel-entity-name="PaymentGatewayConfigType">
        <key-map field-name="paymentGatewayConfigTypeId" rel-field-name="paymentGatewayConfigTypeId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewaySagePay"
            package-name="org.apache.ofbiz.accounting.payment"
            title="SagePay Payment Gateway Configuration">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="vendor" type="short-varchar"><description>Vendor name</description></field>
      <field name="productionHost" type="short-varchar"><description>Production Host</description></field>
      <field name="testingHost" type="short-varchar"><description>Testing Host</description></field>
      <field name="sagePayMode" type="short-varchar"><description>Mode (PRODUCTION/TEST)</description></field>
      <field name="protocolVersion" type="very-short"><description>Protocol Version</description></field>
      <field name="authenticationTransType" type="short-varchar"><description>Authentication type (PAYMENT/AUTHENTICATE/DEFERRED)</description></field>
      <field name="authenticationUrl" type="long-varchar"><description>Authentication Url</description></field>
      <field name="authoriseTransType" type="short-varchar"><description>Authorise type (AUTHORISE/RELEASE)</description></field>
      <field name="authoriseUrl" type="long-varchar"><description>Authorise url</description></field>
      <field name="releaseTransType" type="short-varchar"><description>Release type (CANCEL/ABORT)</description></field>
      <field name="releaseUrl" type="long-varchar"><description>Release Url</description></field>
      <field name="voidUrl" type="long-varchar"><description>Void Url</description></field>
      <field name="refundUrl" type="long-varchar"><description>Refund Url</description></field>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGSP_PGC" rel-entity-name="PaymentGatewayConfig">
        <key-map field-name="paymentGatewayConfigId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayAuthorizeNet"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Authorize Dot Net Payment Gateway Configuration">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="transactionUrl" type="value"><description>Transaction URL</description></field>
      <field name="certificateAlias" type="value"><description>Certificate Alias</description></field>
      <field name="apiVersion" type="short-varchar"><description>Target Authorize Dot Net API version</description></field>
      <field name="delimitedData" type="short-varchar"><description>Delimited data (TRUE|FALSE)</description></field>
      <field name="delimiterChar" type="short-varchar"><description>Delimited Character - the delimiter to use in the response</description></field>
      <field name="cpVersion" type="short-varchar"><description>Card Present Version</description></field>
      <field name="cpMarketType" type="short-varchar"><description>Card Present Market Type</description></field>
      <field name="cpDeviceType" type="short-varchar"><description>Card Present Device Type</description></field>
      <field name="method" type="short-varchar"><description>Method - CC for credit card processing</description></field>
      <field name="emailCustomer" type="short-varchar"><description>Email Customer? - if should send an email to the customer for each transaction (TRUE|FALSE)</description></field>
      <field name="emailMerchant" type="short-varchar"><description>Email Merchant? - if should send email to the merchant for each transaction (TRUE|FALSE)</description></field>
      <field name="testMode" type="short-varchar"><description>Test Mode - forces the url property to the test url and adds more logging info to the logs (TRUE|FALSE)</description></field>
      <field name="relayResponse" type="short-varchar"><description>Relay Response? - if should relay the reposnse to a different server (TRUE|FALSE)</description></field>
      <field name="tranKey" type="value" encrypt="true"><description>Transaction Key</description></field>
      <field name="userId" type="value"><description>Username - your authorize.net userid</description></field>
      <field name="pwd" type="value" encrypt="true"><description>Password - your authorize.net password</description></field>
      <field name="transDescription" type="value"><description>Default Transaction Description</description></field>
      <field name="duplicateWindow" type="numeric"><description>Check the duplicate transaction in the specified time duration which is specified in seconds. If duplicate transaction occurs in the defined time limit then return error.</description></field>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGAN_PGC" rel-entity-name="PaymentGatewayConfig">
        <key-map field-name="paymentGatewayConfigId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayEway"
            package-name="org.apache.ofbiz.accounting.payment"
            title="eWay Payment Gateway Configuration">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="customerId" type="value"/>
      <field name="refundPwd" type="value" encrypt="true"/>
      <field name="testMode" type="short-varchar"/>
      <field name="enableCvn" type="short-varchar"/>
      <field name="enableBeagle" type="short-varchar"/>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGEW_PGC" rel-entity-name="PaymentGatewayConfig">
        <key-map field-name="paymentGatewayConfigId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayCyberSource"
            package-name="org.apache.ofbiz.accounting.payment"
            title="CyberSource Payment Gateway Configuration">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="merchantId" type="value"><description>You merchant ID</description></field>
      <field name="apiVersion" type="short-varchar"><description>Target CyberSource API version</description></field>
      <field name="production" type="short-varchar"><description>Enable production "mode" (true|false)</description></field>
      <field name="keysDir" type="value"><description>Directory of the keys from CyberSource (Generate using online tools)</description></field>
      <field name="keysFile" type="value"><description>Name of the keystore (if different then "merchantID".p12)</description></field>
      <field name="logEnabled" type="short-varchar"><description>Log transaction information (true|false)</description></field>
      <field name="logDir" type="value"><description>Log directory</description></field>
      <field name="logFile" type="value"><description>Log file name</description></field>
      <field name="logSize" type="numeric"><description>Max log size (megabytes)</description></field>
      <field name="merchantDescr" type="value"><description>Merchant Description - Shown on credit card statement</description></field>
      <field name="merchantContact" type="value"><description>Merchant Description Contact Information - Shown on credit card statement</description></field>
      <field name="autoBill" type="short-varchar"><description>Auto-Bill In Authorization (true|false)</description></field>
      <field name="enableDav" type="indicator"><description>Use DAV In Authorization -- May not be supported any longer</description></field>
      <field name="fraudScore" type="indicator"><description>Use Fraud Scoring In Authorization -- May not be supported any longer</description></field>
      <field name="ignoreAvs" type="short-varchar"><description>Ignore AVS results (true|false)</description></field>
      <field name="disableBillAvs" type="indicator"><description>Disable AVS for Capture -- May not be supported any longer</description></field>
      <field name="avsDeclineCodes" type="value"><description>AVS Decline Codes -- May not be supported any longer</description></field>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGCS_PGC" rel-entity-name="PaymentGatewayConfig">
        <key-map field-name="paymentGatewayConfigId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayPayflowPro"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payflow Pro Payment Gateway Config">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="certsPath" type="value"><description>Path the the VeriSign Certificate</description></field>
      <field name="hostAddress" type="value"><description>Address of the payment processor</description></field>
      <field name="hostPort" type="numeric"><description>Port of the payment processor</description></field>
      <field name="timeout" type="numeric"><description>Timeout</description></field>
      <field name="proxyAddress" type="value"><description>Proxy Address</description></field>
      <field name="proxyPort" type="numeric"><description>Proxy Port</description></field>
      <field name="proxyLogon" type="value"><description>Proxy Logon</description></field>
      <field name="proxyPassword" type="value" encrypt="true"><description>Proxy Password</description></field>
      <field name="vendor" type="short-varchar"><description>Vendor of account information</description></field>
      <field name="userId" type="short-varchar"><description>PayFlow UserID of account information</description></field>
      <field name="pwd" type="value" encrypt="true"><description>PayFlow Password of account information</description></field>
      <field name="partner" type="short-varchar"><description>PayFlow Partner of account information</description></field>
      <field name="checkAvs" type="indicator"><description>Use Address Verification</description></field>
      <field name="checkCvv2" type="indicator"><description>Require CVV2 Verification</description></field>
      <field name="preAuth" type="indicator"><description>Pre-Authorize Payments (if set to N will auto-capture)</description></field>
      <field name="enableTransmit" type="value"><description>Set to false to not transmit anything</description></field>
      <field name="logFileName" type="value"><description>Log file name</description></field>
      <field name="loggingLevel" type="numeric"><description>Logging level</description></field>
      <field name="maxLogFileSize" type="numeric"><description>Max log file size</description></field>
      <field name="stackTraceOn" type="indicator"><description>Stack trace on/off</description></field>
      <field name="redirectUrl" type="value"><description>Express Checkout Redirect URL</description></field>
      <field name="returnUrl" type="value"><description>Express Checkout Return URL</description></field>
      <field name="cancelReturnUrl" type="value"><description>Express Checkout Return On Cancel URL</description></field>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGPF_PGC" rel-entity-name="PaymentGatewayConfig">
        <key-map field-name="paymentGatewayConfigId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayPayPal"
            package-name="org.apache.ofbiz.accounting.payment"
            title="PayPal Payment Gateway Config">
        <field name="paymentGatewayConfigId" type="id"></field>
        <field name="businessEmail" type="value"><description>Business e-mail</description></field>
        <field name="apiUserName" type="short-varchar"><description>PayPal API UserName</description></field>
        <field name="apiPassword" type="short-varchar"><description>PayPal API Password</description></field>
        <field name="apiSignature" type="short-varchar"><description>PayPal API Signature</description></field>
        <field name="apiEnvironment" type="short-varchar"><description>PayPal API Environment (valid values are: live, sandbox or beta-sandbox)</description></field>
        <field name="notifyUrl" type="value"><description>Notify URL</description></field>
        <field name="returnUrl" type="value"><description>Return URL</description></field>
        <field name="cancelReturnUrl" type="value"><description>Return On Cancel URL</description></field>
        <field name="imageUrl" type="value"><description>Image URL to use on PayPal</description></field>
        <field name="confirmTemplate" type="value"><description>Thank-You / Confirm Order Template (rendered via Freemarker)</description></field>
        <field name="redirectUrl" type="value"><description>PayPal Redirect URL (Sandbox/Production)</description></field>
        <field name="confirmUrl" type="value"><description>PayPal Confirm URL Sandbox/Production (JSSE must be configured to use SSL)</description></field>
        <field name="shippingCallbackUrl" type="url"><description>Specific to Express Checkout which performs callbacks to our server to retrieve shipping estimates</description></field>
        <field name="requireConfirmedShipping" type="indicator"><description>Indicates that you require that the customer’s shipping address on file with PayPal be a confirmed address.</description></field>
        <prim-key field="paymentGatewayConfigId"/>
        <relation type="one" fk-name="PGPP_PGC" rel-entity-name="PaymentGatewayConfig">
            <key-map field-name="paymentGatewayConfigId"/>
        </relation>
    </entity>
    <entity entity-name="PaymentGatewayClearCommerce"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Clear Commerce Payment Gateway Config">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="sourceId" type="short-varchar"><description>Useful for tagging transactions</description></field>
      <field name="groupId" type="short-varchar"><description>Useful for grouping transactions</description></field>
      <field name="clientId" type="short-varchar"><description>Client Id of account information</description></field>
      <field name="username" type="short-varchar"><description>User name of account informatio</description></field>
      <field name="pwd" type="value" encrypt="true"><description>Password of account informatio</description></field>
      <field name="userAlias" type="short-varchar"><description>Alias of account informatio</description></field>
      <field name="effectiveAlias" type="short-varchar"><description>Effective Alias of account information</description></field>
      <field name="processMode" type="indicator"><description>Process mode (Y: approve / N: decline / R: random / P: production)</description></field>
      <field name="serverURL" type="value"><description>Server URL of the payment processor</description></field>
      <field name="enableCVM" type="indicator"><description>Enable Card Verification Methods (CID, CVC, CVV2)</description></field>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGCC_PGC" rel-entity-name="PaymentGatewayConfig">
        <key-map field-name="paymentGatewayConfigId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayWorldPay"
            package-name="org.apache.ofbiz.accounting.payment"
            title="RBS WorldPay Payment Gateway Config">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="redirectUrl" type="value"><description>Redirect URL</description></field>
      <field name="instId" type="value" encrypt="true"><description>Worldpay instance Id</description></field>
      <field name="authMode" type="indicator"><description>Authorization Mode (A: Full-Auth / E: Pre-Auth)</description></field>
      <field name="fixContact" type="indicator"><description>Will displace contact info on WorldPay in non-editable format</description></field>
      <field name="hideContact" type="indicator"><description>Will hide the contact info completely</description></field>
      <field name="hideCurrency" type="indicator"><description>This causes the currency drop down to be no hidden, so fixing the currency that the shopper must value purchase in</description></field>
      <field name="langId" type="short-varchar"><description>The shopper's language choice, as a 2-character ISO 639 code, with optional regionalisation using 2-character country code separated by hyphen</description></field>
      <field name="noLanguageMenu" type="indicator"><description>This suppresses the display of the language menu if noLanguageMenu no you have a choice of languages enabled for your value installation</description></field>
      <field name="withDelivery" type="indicator"><description>Displays input fields for delivery address and withDelivery no mandate that they be filled in</description></field>
      <field name="testMode" type="numeric"><description>Test Mode (100: approve / 101: cancelled / 0: Live Mode (no test)</description></field>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGWP_PGC" rel-entity-name="PaymentGatewayConfig">
        <key-map field-name="paymentGatewayConfigId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayOrbital"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Orbital Payment Gateway Config">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="username" type="short-varchar"><description>Orbital Username of account information</description></field>
      <field name="connectionPassword" type="value" encrypt="true"><description>Orbital Password of account information</description></field>
      <field name="merchantId" type="value"><description>You merchant ID</description></field>
      <field name="engineClass" type="value"><description>Class for the Orbital Gateway - Default should be used - HttpsEngine</description></field>
      <field name="hostName" type="value"><description>Address of the payment processor</description></field>
      <field name="port" type="numeric"><description>Port of the payment processor</description></field>
      <field name="hostNameFailover" type="value"><description>Failover Address of the payment processor</description></field>
      <field name="portFailover" type="numeric"><description>Failover Port of the payment processor</description></field>
      <field name="connectionTimeoutSeconds" type="numeric"><description>Timeout</description></field>
      <field name="readTimeoutSeconds" type="numeric"><description>Read Timeout</description></field>
      <field name="authorizationURI" type="value"><description>Authorization URI</description></field>
      <field name="sdkVersion" type="short-varchar"><description>Target Orbital Gateway API version</description></field>
      <field name="sslSocketFactory" type="short-varchar"><description>SSL Socket Factory (default|strict)</description></field>
      <field name="responseType" type="short-varchar"><description>Response Type (gateway|host)</description></field>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGORB_PGC" rel-entity-name="PaymentGatewayConfig">
        <key-map field-name="paymentGatewayConfigId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewaySecurePay"
            package-name="org.apache.ofbiz.accounting.payment"
            title="SecurePay Payment Gateway Config">
      <field name="paymentGatewayConfigId" type="id"></field>
      <field name="merchantId" type="value"><description>You merchant ID</description></field>
      <field name="pwd" type="value" encrypt="true"><description>SecurePay Password of account information</description></field>
      <field name="serverURL" type="value"><description>Server URL of the payment processor</description></field>
      <field name="processTimeout" type="numeric"><description>Process Timeout</description></field>
      <field name="enableAmountRound" type="indicator"><description>Enable rounds the currency amount to .00 (Y / N)</description></field>
      <prim-key field="paymentGatewayConfigId"/>
      <relation type="one" fk-name="PGSCP_PGC" rel-entity-name="PaymentGatewayConfig">
        <key-map field-name="paymentGatewayConfigId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayRespMsg"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Gateway Response Message">
        <field name="paymentGatewayRespMsgId" type="id"></field>
        <field name="paymentGatewayResponseId" type="id"></field>
        <field name="pgrMessage" type="very-long"></field>
        <prim-key field="paymentGatewayRespMsgId"/>
        <relation type="one" fk-name="PAYGATRM_PAYGR" rel-entity-name="PaymentGatewayResponse">
            <key-map field-name="paymentGatewayResponseId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGatewayResponse"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Gateway Response">
      <field name="paymentGatewayResponseId" type="id"></field>
      <field name="paymentServiceTypeEnumId" type="id"></field>
      <field name="orderPaymentPreferenceId" type="id"></field>
      <field name="paymentMethodTypeId" type="id"></field>
      <field name="paymentMethodId" type="id"></field>
      <field name="transCodeEnumId" type="id"></field>
      <field name="amount" type="currency-amount"></field>
      <field name="currencyUomId" type="id"></field>
      <field name="referenceNum" type="short-varchar"></field>
      <field name="altReference" type="short-varchar"></field>
      <field name="subReference" type="short-varchar"></field>
      <field name="gatewayCode" type="short-varchar"></field>
      <field name="gatewayFlag" type="short-varchar"></field>
      <field name="gatewayAvsResult" type="short-varchar"></field>
      <field name="gatewayCvResult" type="short-varchar"></field>
      <field name="gatewayScoreResult" type="short-varchar"></field>
      <field name="gatewayMessage" type="long-varchar"></field>
      <field name="transactionDate" type="date-time"></field>
      <field name="resultDeclined" type="indicator"></field>
      <field name="resultNsf" type="indicator"></field>
      <field name="resultBadExpire" type="indicator"></field>
      <field name="resultBadCardNumber" type="indicator"></field>
      <prim-key field="paymentGatewayResponseId"/>
      <relation type="one" fk-name="PAYGATR_PSTENUM" title="ServiceType" rel-entity-name="Enumeration">
        <key-map field-name="paymentServiceTypeEnumId" rel-field-name="enumId"/>
      </relation>
      <relation type="one" fk-name="PAYGATR_TXCODE" title="TranCode" rel-entity-name="Enumeration">
        <key-map field-name="transCodeEnumId" rel-field-name="enumId"/>
      </relation>
      <relation type="one" fk-name="PAYGATR_CUOM" rel-entity-name="Uom">
        <key-map field-name="currencyUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="PAYGATR_ORDPMPRF" rel-entity-name="OrderPaymentPreference">
        <key-map field-name="orderPaymentPreferenceId"/>
      </relation>
      <relation type="one" fk-name="PAYGATR_PMTP" rel-entity-name="PaymentMethodType">
        <key-map field-name="paymentMethodTypeId"/>
      </relation>
      <relation type="one" fk-name="PAYGATR_PMETH" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
    </entity>

    <entity entity-name="PaymentGroup"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Group">
      <description>Payment Group</description>
      <field name="paymentGroupId" type="id"></field>
      <field name="paymentGroupTypeId" type="id"></field>
      <field name="paymentGroupName" type="name"></field>
      <prim-key field="paymentGroupId"/>
      <relation type="one" fk-name="PAYMNTGP_PGTYPE" rel-entity-name="PaymentGroupType">
          <key-map field-name="paymentGroupTypeId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGroupType"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Group Type">
      <description>Payment Group Type</description>
      <field name="paymentGroupTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="paymentGroupTypeId"/>
      <relation type="one" fk-name="PAYMNTGP_TYP_PAR" title="Parent" rel-entity-name="PaymentGroupType">
        <key-map field-name="parentTypeId" rel-field-name="paymentGroupTypeId"/>
      </relation>
    </entity>
    <entity entity-name="PaymentGroupMember"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Payment Group Member">
      <description>Payment Group Member</description>
      <field name="paymentGroupId" type="id"></field>
      <field name="paymentId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="sequenceNum" type="numeric"></field>
      <prim-key field="paymentGroupId"/>
      <prim-key field="paymentId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="PAYGRPMMBR_PG" rel-entity-name="PaymentGroup">
          <key-map field-name="paymentGroupId"/>
      </relation>
      <relation type="one" fk-name="PAYGRPMMBR_PAYMNT" rel-entity-name="Payment">
          <key-map field-name="paymentId"/>
      </relation>
    </entity>

    <entity entity-name="PayPalPaymentMethod" 
            package-name="org.apache.ofbiz.accounting.payment">
      <description>PayPal Payment Method Details</description>
      <field name="paymentMethodId" type="id"></field>
      <field name="payerId" type="id"></field>
      <field name="expressCheckoutToken" type="short-varchar"></field>
      <field name="payerStatus" type="short-varchar"></field>
      <field name="avsAddr" type="indicator"></field>
      <field name="avsZip" type="indicator"></field>
      <field name="correlationId" type="id"></field>
      <field name="contactMechId" type="id"></field>
      <field name="transactionId" type="short-varchar"></field>
      <prim-key field="paymentMethodId"/>
      <relation type="one" fk-name="PAYPAL_PMNTMETH" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one" fk-name="PAYPAL_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="PAYPAL_PADDR" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
    </entity>

    <entity entity-name="ValueLinkKey"
            package-name="org.apache.ofbiz.accounting.payment"
            title="Value Link Key Store">
      <field name="merchantId" type="id-vlong"></field>
      <field name="publicKey" type="very-long"></field>
      <field name="privateKey" type="very-long"></field>
      <field name="exchangeKey" type="very-long"></field>
      <field name="workingKey" type="very-long"></field>
      <field name="workingKeyIndex" type="numeric"></field>
      <field name="lastWorkingKey" type="very-long"></field>
      <field name="createdDate" type="date-time"></field>
      <field name="createdByTerminal" type="short-varchar"></field>
      <field name="createdByUserLogin" type="id-vlong"></field>
      <field name="lastModifiedDate" type="date-time"></field>
      <field name="lastModifiedByTerminal" type="short-varchar"></field>
      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
      <prim-key field="merchantId"/>
    </entity>
    <!-- ========================================================= -->
    <!-- org.apache.ofbiz.accounting.tax -->
    <!-- ========================================================= -->

    <entity entity-name="PartyTaxAuthInfo" package-name="org.apache.ofbiz.accounting.tax" title="Party Tax Information">
        <description></description>
        <field name="partyId" type="id"></field>
        <field name="taxAuthGeoId" type="id"></field>
        <field name="taxAuthPartyId" type="id"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <field name="partyTaxId" type="id-long"></field>
        <field name="isExempt" type="indicator"></field>
        <field name="isNexus" type="indicator"><!-- default N; if Y it means that this Party has a sufficient presence in the area to warrant having to charge tax --></field>
        <prim-key field="partyId"/>
        <prim-key field="taxAuthGeoId"/>
        <prim-key field="taxAuthPartyId"/>
        <prim-key field="fromDate"/>
        <relation type="one" fk-name="PARTY_TXAI_PTY" rel-entity-name="Party">
            <key-map field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="PARTY_TXAI_TXA" rel-entity-name="TaxAuthority">
            <key-map field-name="taxAuthGeoId"/>
            <key-map field-name="taxAuthPartyId"/>
        </relation>
    </entity>
    <view-entity entity-name="PartyTaxAuthInfoAndDetail" package-name="org.apache.ofbiz.accounting.tax">
        <member-entity entity-alias="PTAI" entity-name="PartyTaxAuthInfo"/>
        <member-entity entity-alias="PG" entity-name="PartyGroup"/>
        <member-entity entity-alias="GEO" entity-name="Geo"/>
        <alias-all entity-alias="PTAI"/>
        <alias-all entity-alias="PG"/>
        <alias-all entity-alias="GEO"/>
        <view-link entity-alias="PTAI" rel-entity-alias="PG">
            <key-map field-name="taxAuthPartyId" rel-field-name="partyId"/>
        </view-link>
        <view-link entity-alias="PTAI" rel-entity-alias="GEO">
            <key-map field-name="taxAuthGeoId" rel-field-name="geoId"/>
        </view-link>
    </view-entity>
    <entity entity-name="TaxAuthority" package-name="org.apache.ofbiz.accounting.tax" title="Tax Authority">
        <field name="taxAuthGeoId" type="id"></field>
        <field name="taxAuthPartyId" type="id"></field>
        <field name="requireTaxIdForExemption" type="indicator"></field>
        <field name="taxIdFormatPattern" type="long-varchar"></field>
        <field name="includeTaxInPrice" type="indicator"><!-- this is mainly for VAT tax authorities --></field>
        <prim-key field="taxAuthGeoId"/>
        <prim-key field="taxAuthPartyId"/>
        <relation type="one" fk-name="TAXAUTH_TAGEO" title="TaxAuth" rel-entity-name="Geo">
            <key-map field-name="taxAuthGeoId" rel-field-name="geoId"/>
        </relation>
        <relation type="one" fk-name="TAXAUTH_TAPARTY" title="TaxAuth" rel-entity-name="Party">
            <key-map field-name="taxAuthPartyId" rel-field-name="partyId"/>
        </relation>
    </entity>
    <view-entity entity-name="TaxAuthorityAndDetail" package-name="org.apache.ofbiz.accounting.tax">
        <member-entity entity-alias="TA" entity-name="TaxAuthority"/>
        <member-entity entity-alias="PG" entity-name="PartyGroup"/>
        <member-entity entity-alias="GEO" entity-name="Geo"/>
        <alias-all entity-alias="TA"/>
        <alias-all entity-alias="PG"/>
        <alias-all entity-alias="GEO"/>
        <view-link entity-alias="TA" rel-entity-alias="PG">
            <key-map field-name="taxAuthPartyId" rel-field-name="partyId"/>
        </view-link>
        <view-link entity-alias="TA" rel-entity-alias="GEO">
            <key-map field-name="taxAuthGeoId" rel-field-name="geoId"/>
        </view-link>
    </view-entity>
    <entity entity-name="TaxAuthorityAssoc" package-name="org.apache.ofbiz.accounting.tax" title="Tax Authority Association">
        <field name="taxAuthGeoId" type="id"></field>
        <field name="taxAuthPartyId" type="id"></field>
        <field name="toTaxAuthGeoId" type="id"></field>
        <field name="toTaxAuthPartyId" type="id"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <field name="taxAuthorityAssocTypeId" type="id"></field>
        <prim-key field="taxAuthGeoId"/>
        <prim-key field="taxAuthPartyId"/>
        <prim-key field="toTaxAuthGeoId"/>
        <prim-key field="toTaxAuthPartyId"/>
        <prim-key field="fromDate"/>
        <relation type="one" fk-name="TAXAUTHASC_TXA" rel-entity-name="TaxAuthority">
            <key-map field-name="taxAuthGeoId"/>
            <key-map field-name="taxAuthPartyId"/>
        </relation>
        <relation type="one" fk-name="TAXAUTHASC_TOTXA" title="To" rel-entity-name="TaxAuthority">
            <key-map field-name="toTaxAuthGeoId" rel-field-name="taxAuthGeoId"/>
            <key-map field-name="toTaxAuthPartyId" rel-field-name="taxAuthPartyId"/>
        </relation>
        <relation type="one" fk-name="TAXAUTHASC_ASTP" rel-entity-name="TaxAuthorityAssocType">
            <key-map field-name="taxAuthorityAssocTypeId"/>
        </relation>
    </entity>
    <entity entity-name="TaxAuthorityAssocType"
        package-name="org.apache.ofbiz.accounting.tax"
        default-resource-name="AccountingEntityLabels"
        title="Tax Authority Assoc Type">
        <field name="taxAuthorityAssocTypeId" type="id"></field>
        <field name="description" type="description"></field>
        <prim-key field="taxAuthorityAssocTypeId"/>
    </entity>
    <entity entity-name="TaxAuthorityCategory" package-name="org.apache.ofbiz.accounting.tax" title="Tax Authority Product Category">
        <field name="taxAuthGeoId" type="id"></field>
        <field name="taxAuthPartyId" type="id"></field>
        <field name="productCategoryId" type="id"></field>
        <prim-key field="taxAuthGeoId"/>
        <prim-key field="taxAuthPartyId"/>
        <prim-key field="productCategoryId"/>
        <relation type="one" fk-name="TAXAUTHCAT_TXA" rel-entity-name="TaxAuthority">
            <key-map field-name="taxAuthGeoId"/>
            <key-map field-name="taxAuthPartyId"/>
        </relation>
        <relation type="one" fk-name="TAXAUTHCAT_CAT" rel-entity-name="ProductCategory">
            <key-map field-name="productCategoryId"/>
        </relation>
    </entity>
    <view-entity entity-name="TaxAuthorityCategoryView" package-name="org.apache.ofbiz.accounting.tax">
        <member-entity entity-alias="TAC" entity-name="TaxAuthorityCategory"/>
        <member-entity entity-alias="PC" entity-name="ProductCategory"/>
        <alias-all entity-alias="TAC"/>
        <alias-all entity-alias="PC"/>
        <view-link entity-alias="TAC" rel-entity-alias="PC">
            <key-map field-name="productCategoryId"/>
        </view-link>
    </view-entity>
    <entity entity-name="TaxAuthorityGlAccount" package-name="org.apache.ofbiz.accounting.tax" title="Tax Authority GL Account">
        <field name="taxAuthGeoId" type="id"></field>
        <field name="taxAuthPartyId" type="id"></field>
        <field name="organizationPartyId" type="id"></field>
        <field name="glAccountId" type="id"></field>
        <prim-key field="taxAuthGeoId"/>
        <prim-key field="taxAuthPartyId"/>
        <prim-key field="organizationPartyId"/>
        <relation type="one" fk-name="TAXAUTHGLA_TXA" rel-entity-name="TaxAuthority">
            <key-map field-name="taxAuthGeoId"/>
            <key-map field-name="taxAuthPartyId"/>
        </relation>
        <relation type="one" fk-name="TAXAUTHGLA_OPTY" title="Organization" rel-entity-name="Party">
            <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="TAXAUTHGLA_GLA" rel-entity-name="GlAccount">
            <key-map field-name="glAccountId"/>
        </relation>
    </entity>
    <view-entity entity-name="TaxAuthorityGlAccountBalance"
            package-name="org.apache.ofbiz.accounting.tax"
            title="For viewing balances of tax authority GL accounts">
      <member-entity entity-alias="TAGA" entity-name="TaxAuthorityGlAccount"/>
      <member-entity entity-alias="GLAO" entity-name="GlAccountOrganization"/>
      <member-entity entity-alias="PAP" entity-name="PartyAcctgPreference"/>
      <alias-all entity-alias="TAGA"/>
      <alias-all entity-alias="GLAO"/>
      <alias entity-alias="PAP" name="baseCurrencyUomId"/>
      <view-link entity-alias="TAGA" rel-entity-alias="GLAO">
        <key-map field-name="glAccountId"/>
        <key-map field-name="organizationPartyId"/>
      </view-link>
      <view-link entity-alias="TAGA" rel-entity-alias="PAP">
        <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
      </view-link>
    </view-entity>
    <entity entity-name="TaxAuthorityRateProduct" package-name="org.apache.ofbiz.accounting.tax" title="Tax Authority Rate">
        <field name="taxAuthorityRateSeqId" type="id"></field>
        <field name="taxAuthGeoId" type="id"></field>
        <field name="taxAuthPartyId" type="id"></field>
        <field name="taxAuthorityRateTypeId" type="id"></field>
        <field name="productStoreId" type="id"></field>
        <field name="productCategoryId" type="id"></field>
        <field name="titleTransferEnumId" type="id"></field>
        <field name="minItemPrice" type="currency-amount"></field>
        <field name="minPurchase" type="currency-amount"></field>
        <field name="taxShipping" type="indicator"></field>
        <field name="taxPercentage" type="fixed-point"></field>
        <field name="taxPromotions" type="indicator"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <field name="description" type="description"></field>
        <field name="isTaxInShippingPrice" type="indicator"></field>
        <prim-key field="taxAuthorityRateSeqId"/>
        <relation type="one" fk-name="TAXAUTHRTEP_TXA" rel-entity-name="TaxAuthority">
            <key-map field-name="taxAuthGeoId"/>
            <key-map field-name="taxAuthPartyId"/>
        </relation>
        <relation type="one" fk-name="TAXAUTHRTEP_RTTP" rel-entity-name="TaxAuthorityRateType">
            <key-map field-name="taxAuthorityRateTypeId"/>
        </relation>
        <relation type="one" fk-name="TAXAUTHRTEP_PSTR" rel-entity-name="ProductStore">
            <key-map field-name="productStoreId"/>
        </relation>
        <relation type="one" fk-name="TAXAUTHRTEP_PCAT" rel-entity-name="ProductCategory">
            <key-map field-name="productCategoryId"/>
        </relation>
    </entity>
    <entity entity-name="TaxAuthorityRateType"
        package-name="org.apache.ofbiz.accounting.tax"
        default-resource-name="AccountingEntityLabels"
        title="Tax Authority Rate Type">
        <field name="taxAuthorityRateTypeId" type="id"></field>
        <field name="description" type="description"></field>
        <prim-key field="taxAuthorityRateTypeId"/>
    </entity>
    <entity entity-name="ZipSalesRuleLookup" package-name="org.apache.ofbiz.accounting.tax" title="Zip Sales Tax Lookup">
        <field name="stateCode" type="short-varchar"></field>
        <field name="city" type="short-varchar"></field>
        <field name="county" type="short-varchar"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="idCode" type="short-varchar"></field>
        <field name="taxable" type="short-varchar"></field>
        <field name="shipCond" type="long-varchar"></field>
        <prim-key field="stateCode"/>
        <prim-key field="city"/>
        <prim-key field="county"/>
        <prim-key field="fromDate"/>
    </entity>
    <entity entity-name="ZipSalesTaxLookup" package-name="org.apache.ofbiz.accounting.tax" title="Zip Sales Tax Lookup">
        <field name="zipCode" type="short-varchar"></field>
        <field name="stateCode" type="short-varchar"></field>
        <field name="city" type="short-varchar"></field>
        <field name="county" type="short-varchar"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="countyFips" type="short-varchar"></field>
        <field name="countyDefault" type="indicator"></field>
        <field name="generalDefault" type="indicator"></field>
        <field name="insideCity" type="indicator"></field>
        <field name="geoCode" type="short-varchar"></field>
        <field name="stateSalesTax" type="fixed-point"></field>
        <field name="citySalesTax" type="fixed-point"></field>
        <field name="cityLocalSalesTax" type="fixed-point"></field>
        <field name="countySalesTax" type="fixed-point"></field>
        <field name="countyLocalSalesTax" type="fixed-point"></field>
        <field name="comboSalesTax" type="fixed-point"></field>
        <field name="stateUseTax" type="fixed-point"></field>
        <field name="cityUseTax" type="fixed-point"></field>
        <field name="cityLocalUseTax" type="fixed-point"></field>
        <field name="countyUseTax" type="fixed-point"></field>
        <field name="countyLocalUseTax" type="fixed-point"></field>
        <field name="comboUseTax" type="fixed-point"></field>
        <prim-key field="zipCode"/>
        <prim-key field="stateCode"/>
        <prim-key field="city"/>
        <prim-key field="county"/>
        <prim-key field="fromDate"/>
    </entity>

    <entity entity-name="PartyGlAccount" package-name="org.apache.ofbiz.accounting.ledger" title="Party Gl Account">
        <field name="organizationPartyId" type="id"/>
        <field name="partyId" type="id"/>
        <field name="roleTypeId" type="id"/>
        <field name="glAccountTypeId" type="id"/>
        <field name="glAccountId" type="id"/>
        <prim-key field="organizationPartyId"/>
        <prim-key field="partyId"/>
        <prim-key field="roleTypeId"/>
        <prim-key field="glAccountTypeId"/>
        <relation type="one" fk-name="PRTYGLACCT_ORGPRTY" title="Organization" rel-entity-name="Party">
            <key-map field-name="organizationPartyId" rel-field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="PRTYGLACCT_PRTY" rel-entity-name="Party">
            <key-map field-name="partyId"/>
        </relation>
        <relation type="one-nofk" rel-entity-name="RoleType">
            <key-map field-name="roleTypeId"/>
        </relation>
        <relation type="one" fk-name="PRTYGLACCT_PTRL" rel-entity-name="PartyRole">
            <key-map field-name="partyId"/>
            <key-map field-name="roleTypeId"/>
        </relation>
        <relation type="one" fk-name="PRTYGLACCT_GLAT" rel-entity-name="GlAccountType">
            <key-map field-name="glAccountTypeId"/>
        </relation>
        <relation type="one" fk-name="PRTYGLACCT_GLACCT" rel-entity-name="GlAccount">
            <key-map field-name="glAccountId"/>
        </relation>
    </entity>

    <view-entity entity-name="GlAccOrgAndAcctgTransAndEntry"
        package-name="org.apache.ofbiz.accounting.ledger"
        title="GlAccountOrganization, AcctgTransEntry, and AccTrans View Entity Group-By organizationPartyId, glAccountId, debitCreditFlag">
        <member-entity entity-alias="GAO" entity-name="GlAccountOrganization"/>
        <member-entity entity-alias="ATE" entity-name="AcctgTransEntry"/>
        <member-entity entity-alias="ATR" entity-name="AcctgTrans"/>
        <alias entity-alias="GAO" name="glAccountId" group-by="true"/>
        <alias entity-alias="ATE" name="debitCreditFlag" group-by="true"/>
        <alias entity-alias="ATR" name="isPosted" group-by="true"/>
        <alias entity-alias="ATR" name="transactionDate" group-by="true"/>
        <alias entity-alias="ATE" name="acctgTransId" group-by="true"/>
        <alias entity-alias="ATE" name="organizationPartyId" group-by="true"/>
        <alias entity-alias="ATE" name="totalAmount" field="amount" function="sum"/>
        <alias entity-alias="GAO" name="fromDate" group-by="true"/>
        <alias entity-alias="GAO" name="thruDate" group-by="true"/>
        <view-link entity-alias="GAO" rel-entity-alias="ATE">
            <key-map field-name="glAccountId"/>
            <key-map field-name="organizationPartyId"/>
        </view-link>
        <view-link entity-alias="ATE" rel-entity-alias="ATR">
            <key-map field-name="acctgTransId"/>
        </view-link>
    </view-entity>

  <entity entity-name="RateType" package-name="org.apache.ofbiz.accounting.rate"
    title="Rate Type" default-resource-name="AccountingEntityLabels">
    <field name="rateTypeId" type="id"></field>
    <field name="description" type="description"></field>
    <prim-key field="rateTypeId"/>
  </entity>

  <entity entity-name="RateAmount" package-name="org.apache.ofbiz.accounting.rate">
      <field name="rateTypeId" type="id"/>
      <field name="rateCurrencyUomId" type="id"/>
      <field name="periodTypeId" type="id"/>
      <field name="workEffortId" type="id"/>
      <field name="partyId" type="id"/>
      <field name="emplPositionTypeId" type="id"/>
      <field name="fromDate" type="date-time"><description>Describes when a rate amount will be valid. If null, valid immediately.</description></field>
      <field name="thruDate" type="date-time"><description>Describes when a rate amount will be valid untl. If null, valid indefinitly.</description></field>
      <field name="rateAmount" type="currency-amount"/>
      <prim-key field="rateTypeId"/>
      <prim-key field="rateCurrencyUomId"/>
      <prim-key field="periodTypeId"/>
      <prim-key field="partyId"/>
      <prim-key field="workEffortId"/>
      <prim-key field="emplPositionTypeId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="RATE_AMOUNT_RT" rel-entity-name="RateType">
        <key-map field-name="rateTypeId"/>
      </relation>
      <relation type="one" fk-name="RATE_AMOUNT_RCT" rel-entity-name="Uom">
        <key-map field-name="rateCurrencyUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="RATE_AMOUNT_WE" rel-entity-name="WorkEffort">
        <key-map field-name="workEffortId"/>
      </relation>
      <relation type="one" fk-name="RATE_AMOUNT_PTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="RATE_AMOUNT_EPT" rel-entity-name="EmplPositionType">
        <key-map field-name="emplPositionTypeId"/>
      </relation>
      <relation type="one" fk-name="RATE_AMOUNT_PT" rel-entity-name="PeriodType">
        <key-map field-name="periodTypeId"/>
      </relation>
  </entity>

  <view-entity entity-name="RateAmountAndRelations" package-name="org.apache.ofbiz.accounting.rate">
    <member-entity entity-alias="RA" entity-name="RateAmount"/>
    <member-entity entity-alias="RT" entity-name="RateType"/>
    <member-entity entity-alias="PT" entity-name="PeriodType"/>
    <member-entity entity-alias="PN" entity-name="PartyNameView"/>
    <member-entity entity-alias="WE" entity-name="WorkEffort"/>
    <member-entity entity-alias="EPT" entity-name="EmplPositionType"/>
    <alias-all entity-alias="RA"/>
    <alias entity-alias="RT" name="rateDescription" field="description"/>
    <alias entity-alias="PT" name="periodDescription" field="description"/>
    <alias entity-alias="PN" name="firstName"/>
    <alias entity-alias="PN" name="middleName"/>
    <alias entity-alias="PN" name="lastName"/>
    <alias entity-alias="PN" name="groupName"/>
    <alias entity-alias="EPT" name="employeePositionDescription" field="description"/>
    <alias entity-alias="WE" name="workEffortName"/>
    <view-link entity-alias="RA" rel-entity-alias="RT">
      <key-map field-name="rateTypeId"/>
    </view-link>
    <view-link entity-alias="RA" rel-entity-alias="PT">
      <key-map field-name="periodTypeId"/>
    </view-link>
    <view-link entity-alias="RA" rel-entity-alias="PN" rel-optional="true">
      <key-map field-name="partyId"/>
    </view-link>
    <view-link entity-alias="RA" rel-entity-alias="WE" rel-optional="true">
      <key-map field-name="workEffortId"/>
    </view-link>
    <view-link entity-alias="RA" rel-entity-alias="EPT" rel-optional="true">
      <key-map field-name="emplPositionTypeId"/>
    </view-link>
  </view-entity>

  <entity entity-name="PartyRate" package-name="org.apache.ofbiz.accounting.rate"
    title="Party Rate" table-name="PARTY_RATE_NEW">
    <field name="partyId" type="id"/>
    <field name="rateTypeId" type="id"/>
    <field name="defaultRate" type="indicator"/>
    <field name="percentageUsed" type="floating-point"><description>The percentage of the actual hours registered in timeEntries, used for the task and invoice actuals, if the field is null 100% will be used</description></field>
    <field name="fromDate" type="date-time"/>
    <field name="thruDate" type="date-time"/>
    <prim-key field="partyId"/>
    <prim-key field="rateTypeId"/>
    <prim-key field="fromDate"/>
    <relation type="one" fk-name="PRTY_RATE_PRTY" rel-entity-name="Party">
      <key-map field-name="partyId"/>
    </relation>
    <relation type="one" fk-name="PRTY_RATE_RTTP" rel-entity-name="RateType">
      <key-map field-name="rateTypeId"/>
    </relation>
  </entity>

  <entity entity-name="GlAccountCategory"
          package-name="org.apache.ofbiz.accounting.ledger"
          title="General Ledger Account Category">
      <field name="glAccountCategoryId" type="id"></field>
      <field name="glAccountCategoryTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="glAccountCategoryId"/>
      <relation type="one" fk-name="GLACT_CAT_TP" rel-entity-name="GlAccountCategoryType">
        <key-map field-name="glAccountCategoryTypeId"/>
      </relation>
  </entity>

  <entity entity-name="GlAccountCategoryMember"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Account Category Member">
      <field name="glAccountId" type="id"></field>
      <field name="glAccountCategoryId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <field name="amountPercentage" type="fixed-point"></field>
      <prim-key field="glAccountId"/>
      <prim-key field="glAccountCategoryId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="GLACT_CATMBR_AC" rel-entity-name="GlAccount">
        <key-map field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="GLACT_CATMBR_CAT" rel-entity-name="GlAccountCategory">
        <key-map field-name="glAccountCategoryId"/>
      </relation>
  </entity>

  <entity entity-name="GlAccountCategoryType"
            package-name="org.apache.ofbiz.accounting.ledger"
            title="General Ledger Account Category Type">
      <field name="glAccountCategoryTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="glAccountCategoryTypeId"/>
  </entity>

  <view-entity entity-name="PmtGrpMembrPaymentAndFinAcctTrans" package-name="org.apache.ofbiz.accounting.finaccount" title="Payment Group Member, Payment and FinAccountTrans view">
      <member-entity entity-alias="PGM" entity-name="PaymentGroupMember"/>
      <member-entity entity-alias="PY" entity-name="Payment"/>
      <member-entity entity-alias="FAT" entity-name="FinAccountTrans"/>
      <alias-all entity-alias="PGM"/>
      <alias-all entity-alias="PY"/>
      <alias name="finAccountId" entity-alias="FAT"/>
      <alias name="partyId" entity-alias="FAT"/>
      <alias name="finAccountTransStatusId" entity-alias="FAT" field="statusId"/>
      <alias name="finAccountTransAmount" entity-alias="FAT" field="amount"/>
      <alias name="glReconciliationId" entity-alias="FAT"/>
      <view-link entity-alias="PGM" rel-entity-alias="PY">
        <key-map field-name="paymentId"/>
      </view-link>
      <view-link entity-alias="PY" rel-entity-alias="FAT">
        <key-map field-name="finAccountTransId"/>
      </view-link>
    </view-entity>  
    <view-entity entity-name="PaymentMethodAndFinAccount" package-name="org.apache.ofbiz.accounting.finaccount" title="PaymentMethod and FinAccount view">
        <member-entity entity-alias="PM" entity-name="PaymentMethod"/>
        <member-entity entity-alias="FA" entity-name="FinAccount"/>
        <alias-all entity-alias="FA"/>
        <alias-all entity-alias="PM">
            <exclude field="finAccountId"/>
            <exclude field="fromDate"/>
            <exclude field="thruDate"/>
        </alias-all>
        <view-link rel-entity-alias="PM" entity-alias="FA">
            <key-map field-name="finAccountId"/>
        </view-link>
    </view-entity>
</entitymodel>
