<xsd:schema targetNamespace="urn:schemas-kidtraks-invoice" xmlns:srs="urn:schemas-kidtraks-invoice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sqltypes="http://schemas.microsoft.com/sqlserver/2004/sqltypes" elementFormDefault="qualified" >
  <xsd:import namespace="http://schemas.microsoft.com/sqlserver/2004/sqltypes" schemaLocation="http://schemas.microsoft.com/sqlserver/2004/sqltypes/sqltypes.xsd" />
  <xsd:element name="Control_Record">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Record_Type" minOccurs="1" maxOccurs="1" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="01"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Invoice_Count" type="xsd:integer" minOccurs="1" maxOccurs="1" />
        <xsd:element name="Total_Amount" minOccurs="1" maxOccurs="1">
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="On_Error" minOccurs="1" maxOccurs="1"  >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="A"/>
              <!-- Abort -->
              <xsd:enumeration value="C"/>
              <!-- Continue -->
              <xsd:enumeration value="S"/>
              <!-- Skip -->
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Email_Address" type="xsd:string"   minOccurs="1" maxOccurs="1" />
        <xsd:element name="Phone_Number" type="xsd:string"   minOccurs="1" maxOccurs="1" />
        <xsd:element name="Security_Key" type="xsd:string"   minOccurs="0" maxOccurs="1" />
        <xsd:element ref="srs:Invoice_Header" minOccurs="1" maxOccurs="unbounded" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Invoice_Header">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Record_Type" minOccurs="1"  >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="02"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Vendor_ID" type="xsd:string" minOccurs="1" />
        <xsd:element name="Vendor_Location" type="xsd:string" minOccurs="1" />
        <xsd:element name="Vendor_Address_Seq" type="xsd:integer" minOccurs="1" />
        <xsd:element name="Invoice_Type" minOccurs="1" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="Regular"/>
              <xsd:enumeration value="Homebuilder"/>
              <xsd:enumeration value="ACT"/>
			    <!-- MDRC/UOM Rate Adjustment and Copay/Deductible  -->
			        <xsd:enumeration value="Group Rate Voucher"/>
              <xsd:enumeration value="Family Foster Home"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Bill_Type" minOccurs="1" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="First Bill"/>
              <xsd:enumeration value="Re-Bill"/>
              <xsd:enumeration value="Appeal"/>
			  <!-- MDRC/UOM Rate Adjustment and Copay/Deductible  -->
			  <xsd:enumeration value="Rate Adjustment"/>   
              <xsd:enumeration value="Deductible/Co-pay"/>  	  
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Invoice_Number" minOccurs="1" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="8" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
		<!-- MDRC/UOM xsd:date to xs:dateTime-->
        <xsd:element name="Invoice_Date" type="xsd:date" minOccurs="0" />  
        <!--ignore and inherit from submission date (for future use)-->
        <xsd:element name="Reference_ID" minOccurs="0">
          <!-- future use -->
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="50" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Comments" minOccurs="0">
          <!-- additional misc information -->
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:maxLength value="1000" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Remit_Message" minOccurs="0">
          <!-- future use -->
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="50" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Service_Type" minOccurs="1" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">					
              <xsd:enumeration value="Residential"/>
              <xsd:enumeration value="LCPA"/>
              <xsd:enumeration value="FosterParent"/>
              <xsd:enumeration value="FamilyPreservation"/>
              <xsd:enumeration value="IndependentLiving"/>
              <xsd:enumeration value="Adoption"/>
              <xsd:enumeration value="HomeBuilders"/>
              <xsd:enumeration value="CMHC"/>
              <xsd:enumeration value="Medicaid/BX/BH"/>
              <xsd:enumeration value="Group"/>
              <xsd:enumeration value="Court"/>
              <xsd:enumeration value="Reports"/>
              <xsd:enumeration value="Cross System Care Coord"/>
              <xsd:enumeration value="Appeals/Recon"/>
              <xsd:enumeration value="Material Assistance/Daycare"/>
              <xsd:enumeration value="FamPresPerDiem"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Total_Program_Costs" minOccurs="0">
          <!-- Actual Cost / Cost Reimbursement Invoice use -->
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Other_Revenue" minOccurs="0">
          <!-- Actual Cost / Cost Reimbursement Invoice use -->
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Count_Client_Days_Served" minOccurs="0">
          <!-- Actual Cost / Cost Reimbursement Invoice use -->
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Cost_Per_Client_Service_Day" minOccurs="0">
          <!-- Actual Cost / Cost Reimbursement Invoice use -->
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Avg_Number_of_Youth_Served" minOccurs="0">
          <!-- Actual Cost / Cost Reimbursement Invoice use -->
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Cost_Per_Youth_Service_Day" minOccurs="0">
          <!-- Actual Cost / Cost Reimbursement Invoice use -->
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element ref="srs:Invoice_Line" minOccurs="1"  maxOccurs="48"  />
        <xsd:element ref="srs:Invoice_Header_Participant_Details" minOccurs="0"  maxOccurs="unbounded"  />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Invoice_Line">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Record_Type" minOccurs="1"  >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="03"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Billable_Unit_ID" minOccurs="0">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="50" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Person_ID" type="xsd:double" minOccurs="0" />
        <xsd:element name="Case_ID" type="xsd:double" minOccurs="0" />
        <xsd:element name="Billing_Code" minOccurs="1" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="15" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Service_Code" minOccurs="0" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="5" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Component_Code" minOccurs="0" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="5" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
		<!-- MDRC/UOM "xsd:date" to xs:dateTime-->
        <xsd:element name="Start_Date" type="xsd:dateTime" minOccurs="1" />
        <xsd:element name="End_Date" type="xsd:dateTime" minOccurs="1" />
		<!-- MDRC/UOM Units minOccurs= 0 from 1 -->
        <xsd:element name="Units" minOccurs="0">  
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
		<!-- MDRC/UOM Added all these -->
        <xsd:element name="UOM" minOccurs="0">          
          <xsd:simpleType>
            <xsd:restriction base="sqltypes:varchar" >
              <xsd:enumeration value="ACTUAL COST"/>
			  <xsd:enumeration value="MONTH"/>
			  <xsd:enumeration value="HOUR"/>
			  <xsd:enumeration value="DAY"/>
			  <xsd:enumeration value="SESSION"/>
			  <xsd:enumeration value="TEST"/>
			  <xsd:enumeration value="PER DIEM"/>
			  <xsd:enumeration value="FAMILY"/>
			  <xsd:enumeration value="PERSON"/>
			  <xsd:enumeration value="GROUP"/>
			  <xsd:enumeration value="APPEARANCE"/>
			  <xsd:enumeration value="ASSESSMENT"/>
			  <xsd:enumeration value="15min"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
		<!-- MDRC/UOM rate minOccurs = 0 from 1 -->
        <xsd:element name="Rate" minOccurs="0">
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
		<!-- MDRC/UOM Amount minOccurs = 0 from 1 -->
        <xsd:element name="Amount" minOccurs="0">
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="County_Code" type="xsd:integer" minOccurs="0" />
        <xsd:element name="Comments" minOccurs="0">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="1000" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Place_of_Service" minOccurs="0" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="Ambulance—Air or Water"/>
              <xsd:enumeration value="Ambulance—Land"/>
              <xsd:enumeration value="Ambulatory Surgical Center"/>
              <xsd:enumeration value="Assisted Living Facility"/>
              <xsd:enumeration value="Birthing Center"/>
              <xsd:enumeration value="Community Mental Health Center"/>
              <xsd:enumeration value="Comprehensive Inpatient Rehabilitation Facility"/>
              <xsd:enumeration value="Comprehensive Outpatient Rehabilitation Facility"/>
              <xsd:enumeration value="Custodial Care Facility"/>
              <xsd:enumeration value="Emergency Room-Hospital"/>
              <xsd:enumeration value="End-Stage Renal Disease Treatment Facility"/>
              <xsd:enumeration value="Federally Qualified Health Center"/>
              <xsd:enumeration value="Group Home"/>
              <xsd:enumeration value="Home"/>
              <xsd:enumeration value="Homeless Shelter"/>
              <xsd:enumeration value="Hospice"/>
              <xsd:enumeration value="Independent Clinic"/>
              <xsd:enumeration value="Independent Laboratory"/>
              <xsd:enumeration value="Inpatient Hospital"/>
              <xsd:enumeration value="Inpatient Psychiatric Facility"/>
              <xsd:enumeration value="Intermediate Care Facility/Mentally Retarded"/>
              <xsd:enumeration value="Mass Immunization Center"/>
              <xsd:enumeration value="Military Treatment Facility"/>
              <xsd:enumeration value="Mobile Unit"/>
              <xsd:enumeration value="Non-residential Substance Abuse Treatment Facility"/>
              <xsd:enumeration value="Nursing Facility"/>
              <xsd:enumeration value="Office"/>
              <xsd:enumeration value="Other Place of Service"/>
              <xsd:enumeration value="Outpatient Hospital"/>
              <xsd:enumeration value="Pharmacy"/>
              <xsd:enumeration value="Prison/Correctional Facility"/>
              <xsd:enumeration value="Psychiatric Facility-Partial Hospitalization"/>
              <xsd:enumeration value="Psychiatric Residential Treatment Center"/>
              <xsd:enumeration value="Residential Substance Abuse Treatment Facility"/>
              <xsd:enumeration value="Rural Health Clinic"/>
              <xsd:enumeration value="School"/>
              <xsd:enumeration value="Skilled Nursing Facility"/>
              <xsd:enumeration value="State or Local Public Health Clinic"/>
              <xsd:enumeration value="Temporary Lodging"/>
              <xsd:enumeration value="Urgent Care Facility"/>
              <xsd:enumeration value="Walk-in Retail Health Clinic"/>
              <xsd:enumeration value="DCS Office"/>
              <xsd:enumeration value="Other Public Place"/>
              <xsd:enumeration value="Provider Office"/>
              <xsd:enumeration value="Tribal 638 Free-Standing Facility"/>
              <xsd:enumeration value="Tribal 638 Provider-Based Facility"/>
              <xsd:enumeration value="Indian Health Service Provider-based Facility"/>
              <xsd:enumeration value="Indian Health Service Free-standing Facility"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element ref="srs:File_Attachment" minOccurs="0" maxOccurs="unbounded" />
        <xsd:element ref="srs:Invoice_Line_Travel_Detail" minOccurs="0" maxOccurs="unbounded" />
        <xsd:element ref="srs:Invoice_Line_Travel_Person_Days" minOccurs="0" maxOccurs="unbounded" />
        <xsd:element ref="srs:Invoice_Line_Group_Detail" minOccurs="0" maxOccurs="unbounded" />		
		<xsd:element name="MDRC" type="xsd:string" minOccurs="0" maxOccurs="5" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Invoice_Line_Travel_Detail">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Record_Type" minOccurs="1"  >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="04"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Resource_ID" type="xsd:double" minOccurs="0" />
		<!-- MDRC/UOM "xsd:date" to xs:dateTime-->
        <xsd:element name="Travel_Date" type="xsd:date" minOccurs="1" />
        <xsd:element name="Starting_Address" minOccurs="1">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:maxLength value="1000" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Destination_Address" minOccurs="1">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:maxLength value="1000" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Mileage" minOccurs="0">
          <!-- default - Mapquest will calculate shortest distance-->
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Comments" minOccurs="0">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:maxLength value="2000" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Reason_Code" minOccurs="1">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:enumeration value="FOSTER_HOME"/>
              <xsd:enumeration value="HEALTH_APPT"/>
              <xsd:enumeration value="ADMIN_APPT"/>
              <xsd:enumeration value="OTHER"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Invoice_Line_Group_Detail">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Record_Type" minOccurs="1"  >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="05"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Billable_Unit_ID" minOccurs="1">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="50" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Invoice_Header_Participant_Details">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Record_Type" minOccurs="1"  >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="06"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Billable_Unit_ID" minOccurs="1">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="50" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Person_ID" type="xsd:double" minOccurs="1" />
        <xsd:element name="Case_ID" type="xsd:double" minOccurs="1" />
		<!-- MDRC/UOM "xsd:date" to xs:dateTime-->
        <xsd:element name="Start_Date" type="xsd:dateTime" minOccurs="1" />
        <xsd:element name="End_Date" type="xsd:dateTime" minOccurs="1" />
        <xsd:element name="Units" minOccurs="1">
          <xsd:simpleType>
            <xsd:restriction base="xsd:decimal">
              <xsd:totalDigits value="13" />
              <xsd:fractionDigits value="2" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="File_Attachment">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Record_Type" minOccurs="1"  >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="07"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Title" minOccurs="1"  >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string" >
              <xsd:maxLength value="100" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Type" minOccurs="1" >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="Correspondence"/>
              <xsd:enumeration value="Report"/>
              <xsd:enumeration value="Court Order"/>
              <xsd:enumeration value="Appeal"/>
              <xsd:enumeration value="Adoption Certificate"/>
              <xsd:enumeration value="Other Legal"/>
              <xsd:enumeration value="Evidence"/>
              <xsd:enumeration value="Identity"/>
              <xsd:enumeration value="Medical Record"/>
              <xsd:enumeration value="Service Referral"/>
              <xsd:enumeration value="Progress Report"/>
              <xsd:enumeration value="Grade Report"/>
              <xsd:enumeration value="Other School"/>
              <xsd:enumeration value="Payment Authorization"/>
              <xsd:enumeration value="Voucher"/>
              <xsd:enumeration value="Invoice"/>
              <xsd:enumeration value="Other Financial"/>
              <xsd:enumeration value="License"/>
              <xsd:enumeration value="License Change/Revocation"/>
              <xsd:enumeration value="Inspection"/>
              <xsd:enumeration value="Explanation of Benefits - Insurance"/>
              <xsd:enumeration value="Explanation of Benefits - Public Assistance"/>
              <xsd:enumeration value="Hearing-related Document" />
              <xsd:enumeration value="Other/Unclassified"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="content" type="xsd:base64Binary" minOccurs="1"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Invoice_Line_Travel_Person_Days">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Record_Type" minOccurs="1"  >
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="08"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Person_ID" type="xsd:double" minOccurs="1" />
        <xsd:element name="No_of_Days_At_Home" type="xsd:integer" minOccurs="1" />
        <xsd:element name="Comments" minOccurs="0">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:maxLength value="2000" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>