<?xml version="1.0"?>

<!--TimeEntryESF 3.1.1 multiple payor [2021-09-16-22-00]-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">

 

    <!--Root-->

 

    <xs:element name="esfdoc">

        <xs:complexType>

            <xs:all>

                <xs:element type="payorOrgsType" name="payor_orgs" minOccurs="1"/>

            </xs:all>

        </xs:complexType>

    </xs:element>

 

    <!--PayorOrgs-->

 

    <xs:complexType name="payorOrgsType">

        <xs:sequence>

            <xs:element type="payorOrgType" name="payor_org" minOccurs="1" maxOccurs="unbounded"/>

        </xs:sequence>

    </xs:complexType>

 

    <xs:complexType name="payorOrgType">

        <xs:all>

            <xs:element type="invoiceType" name="invoice" minOccurs="1"/>

        </xs:all>

        <xs:attribute type="string60NoSpace" name="id" use="required"/>

        <xs:attribute type="xs:unsignedInt" name="ebilling_id" use="required"/>

        <xs:attribute type="xs:string" name="node_id" use="optional"/>

    </xs:complexType>

 

    <!--Invoice-->

 

    <xs:complexType name="invoiceType">

        <xs:all>

            <xs:element type="xs:string" name="date" minOccurs="1"/>

            <xs:element type="mattersType" name="matters" minOccurs="1" maxOccurs="1">

                <xs:unique name="UniqueMatterIdsForEachInvoiceSegment">

                    <xs:selector xpath="matter"/>

                    <xs:field xpath="biller_org_matter_id"/>

                </xs:unique>

            </xs:element>

        </xs:all>

        <xs:attribute type="string60NoSpace" name="id" use="required"/>

        <xs:attribute type="xs:string" name="node_id" use="optional"/>

    </xs:complexType>

 

    <!--Matter-->

 

    <xs:complexType name="mattersType">

        <xs:sequence>

            <xs:element type="matterType" name="matter" minOccurs="1" maxOccurs="unbounded"/>

        </xs:sequence>

    </xs:complexType>

 

    <xs:complexType name="matterType">

        <xs:all>

            <xs:element type="string60" name="biller_org_matter_id" minOccurs="1"/>

            <xs:element type="xs:string" name="name" minOccurs="1"/>

            <xs:element type="feesType" name="fees" minOccurs="0" maxOccurs="1"/>

            <xs:element type="expensesType" name="expenses" minOccurs="0" maxOccurs="1"/>

            <xs:element type="timekeepersType" name="timekeepers" minOccurs="0" maxOccurs="1"/>

        </xs:all>

        <xs:attribute type="xs:string" name="node_id" use="optional"/>

    </xs:complexType>

 

    <!--Fees, expenses, timekeepers-->

 

    <xs:complexType name="feesType">

        <xs:sequence>

            <xs:element type="feeType" name="fee" minOccurs="0" maxOccurs="unbounded"/>

        </xs:sequence>

    </xs:complexType>

 

    <xs:complexType name="feeType">

        <xs:all>

            <xs:element type="xs:string" name="charge_date" minOccurs="0"/>

            <xs:element type="xs:string" name="timekeeper_id" minOccurs="0"/>

            <xs:element type="xs:string" name="timekeeper_level" minOccurs="0"/>

            <xs:element type="xs:string" name="charge_description" minOccurs="0"/>

            <xs:element type="xs:string" name="task_code" minOccurs="0"/>

            <xs:element type="xs:string" name="activity_code" minOccurs="0"/>

            <xs:element type="xs:decimal" name="units" minOccurs="1"/>

            <xs:element type="xs:decimal" name="rate" minOccurs="1"/>

            <xs:element type="xs:decimal" name="base_amount" minOccurs="1"/>

            <xs:element type="xs:decimal" name="units_work" minOccurs="0"/>

            <xs:element type="xs:decimal" name="rate_work" minOccurs="0"/>

            <xs:element type="xs:decimal" name="base_amount_work" minOccurs="0"/>

        </xs:all>

        <xs:attribute type="xs:string" name="id" use="required"/>

        <xs:attribute type="xs:string" name="node_id" use="optional"/>

    </xs:complexType>

 

    <xs:complexType name="expensesType" mixed="true">

        <xs:sequence>

            <xs:element type="expenseType" name="expense" minOccurs="0" maxOccurs="unbounded"/>

        </xs:sequence>

    </xs:complexType>

 

    <xs:complexType name="expenseType">

        <xs:all>

            <xs:element type="xs:string" name="charge_date" minOccurs="0"/>

            <xs:element type="xs:string" name="timekeeper_id" minOccurs="0"/>

            <xs:element type="xs:string" name="timekeeper_level" minOccurs="0"/>

            <xs:element type="xs:string" name="charge_description" minOccurs="0"/>

            <xs:element type="xs:string" name="task_code" minOccurs="0"/>

            <xs:element type="xs:string" name="expense_code" minOccurs="0"/>

            <xs:element type="xs:decimal" name="units" minOccurs="1"/>

            <xs:element type="xs:decimal" name="rate" minOccurs="1"/>

            <xs:element type="xs:decimal" name="base_amount" minOccurs="1"/>

        </xs:all>

        <xs:attribute type="xs:string" name="id" use="required"/>

        <xs:attribute type="xs:string" name="node_id" use="optional"/>

    </xs:complexType>

 

    <xs:complexType name="timekeepersType" mixed="true">

        <xs:sequence>

            <xs:element type="timekeeperType" name="timekeeper" minOccurs="0" maxOccurs="unbounded"/>

        </xs:sequence>

    </xs:complexType>

 

    <xs:complexType name="timekeeperType">

        <xs:all>

            <xs:element type="xs:string" name="first_name" minOccurs="1"/>

            <xs:element type="xs:string" name="last_name" minOccurs="1"/>

            <xs:element type="xs:string" name="tkinitials" minOccurs="0"/>

            <xs:element type="xs:string" name="level" minOccurs="1"/>

            <xs:element type="xs:decimal" name="rate" minOccurs="1"/>

        </xs:all>

        <xs:attribute type="xs:string" name="id" use="required"/>

        <xs:attribute type="xs:string" name="node_id" use="optional"/>

    </xs:complexType>

 

    <!--String types-->

 

    <xs:simpleType name="stringNoSpace">

        <xs:restriction base="xs:string">

            <xs:pattern value=".*[^\s].*"/>

        </xs:restriction>

    </xs:simpleType>

 

    <xs:simpleType name="string60">

        <xs:restriction base="xs:string">

            <xs:maxLength value="60"/>

        </xs:restriction>

    </xs:simpleType>

 

    <xs:simpleType name="string60NoSpace">

        <xs:restriction base="string60">

            <xs:pattern value=".*[^\s].*"/>

        </xs:restriction>

    </xs:simpleType>

 

</xs:schema>