<?xml version="1.0" encoding="utf-8"?>
<!--
    
    ** OAGIS® Revision: 9.1  **
    ** Date: 11 May 2007 **
    ** Copyright 1997-2007, All Rights Reserved **
    
    This is an OAGIS® BOD XML Schema (XSD) Definition.
    
    License information for this file is provided in the file **OAGi License Agreement.txt** that is provided with this download package.
    
    For support, more information, or to report implementation bugs, please contact the Open Applications Group at xml@openapplications.org.
    
    XML Schema 
    
-->

<!--
    © Copyright 2007 Infor Global Solutions Technology GmbH and/or its affiliates and subsidiaries. All rights reserved. The 
    word and design marks set forth herein are trademarks and/or registered trademarks of Infor Global Solutions 
    Technology GmbH and/or its affiliates and subsidiaries. All rights reserved. All other trademarks listed herein 
    are the property of their respective owners.
    
-->

<!--    *****     Update Log     *****
    
    Date           By      Note
    10 Apr 2008    JB      Added correct Copyright and update comments to schema.
    17 May 2011    NO      Since JournalEntry is now obsolete, incorporated it into this noun rather than reference it...
    16 Mar 2016    LA      ProtocolNumberText moved to Common/Components.xsd, BOD-3091
    24 Oct 2017    LA      Note added to JournalEntryLineType, BOD-3283
    *****     Update End     *****
    
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schema.infor.com/InforOAGIS/2"
    targetNamespace="http://schema.infor.com/InforOAGIS/2" elementFormDefault="qualified"
    attributeFormDefault="unqualified">

    <xsd:include schemaLocation="../Components/Financial/Components.xsd"/>

    <xsd:element name="SourceSystemJournalEntry" type="SourceSystemJournalEntryType">
        <xsd:annotation>
            <xsd:documentation> GLMovement used for associating a chart of accounts, a currency, and
                a calendar.</xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="JournalEntryHeader" type="JournalEntryHeaderType"/>

    <xsd:element name="JournalEntryLine" type="JournalEntryLineType"/>



    <xsd:complexType name="SourceSystemJournalEntryType">
        <xsd:annotation>
            <xsd:documentation source="http://schema.infor.com/InforOAGIS/2">A journal
                represents a change in the balances of a business's financial
                accounts. Many tasks or transactions throughout an enterprise will
                result in the creation of a journal. Some examples are creating a
                customer invoice, paying a vendor, transferring inventory, or paying
                employees. A journal consists of a header with general information,
                and two or more lines specifying what accounts will be affected. A
                journal typically includes balanced debit and credit
                lines.</xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element ref="JournalEntryHeader" minOccurs="0"/>
            <xsd:element ref="JournalEntryLine" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="Status" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="JournalEntryHeaderType">
        <xsd:sequence>
            <xsd:element ref="JournalID" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="DisplayID" minOccurs="0"/>
        	<xsd:element ref="LastModificationDateTime" minOccurs="0"/>
        	<xsd:element ref="LastModificationPerson" minOccurs="0"/>
            <xsd:element ref="BaseJournalEntryHeader" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="BaseJournalEntryHeaderType">
        <xsd:annotation>
            <xsd:documentation source="http://schema.infor.com/InforOAGIS/2">In the
                Header, DocumentReferences is the link that ties back to a sub
                ledger transaction entry ID. It is the identifier of an original
                transaction or document. For example, it could be the receipt or the
                summarized inventory activity. This is the element that refers to an
                audit record. Together with the Sender information, the
                DocumentReferences is part of the referencing system, which will
                enable drill back audit trail functionality.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="LedgerEntryHeaderType">
                <xsd:sequence>
                    <xsd:element ref="UserArea" minOccurs="0"/>
                    <xsd:element ref="SourceJournalID" minOccurs="0"/>
                    <xsd:element ref="LedgerType" minOccurs="0"/>
                    <xsd:element ref="JournalUsage" minOccurs="0"/>
                    <xsd:element ref="AccountingJournalReference" minOccurs="0"/>
                    <xsd:element ref="LedgerSetupReference" minOccurs="0"/>
                    <xsd:element ref="JournalStatus" minOccurs="0"/>
                    <xsd:element ref="SourceSystemJournalCode" minOccurs="0"/>
                    <xsd:element ref="TransactionReferenceText" minOccurs="0" maxOccurs="2"/>
                    <xsd:element ref="ProtocolNumberText" minOccurs="0"/>
                    <xsd:element ref="MultiBook" minOccurs="0"/>
                    <xsd:element ref="EnteredAudit" minOccurs="0"/>
                    <xsd:element ref="ModifiedAudit" minOccurs="0"/>
                    <xsd:element ref="PostedAudit" minOccurs="0"/>
                    <xsd:element ref="ApprovedAudit" minOccurs="0"/>
                    <xsd:element ref="WarningCode" minOccurs="0" maxOccurs="unbounded"/>
                    <xsd:element ref="ExchangeRateDateTime" minOccurs="0"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="BaseJournalEntryHeader" type="BaseJournalEntryHeaderType"/>

    <xsd:complexType name="JournalEntryLineType">
        <xsd:complexContent>
            <xsd:extension base="LedgerEntryLineType">
                <xsd:sequence>
                    <xsd:element ref="UserArea" minOccurs="0"/>
                    <xsd:element ref="SourceLine" minOccurs="0"/>
                    <xsd:element ref="DebitCreditFlag" minOccurs="0">
                        <xsd:annotation>
                            <xsd:documentation> The amount on a
                                transaction should recognize the
                                setting of this flag. In other
                                words, a depreciation account can be
                                defined as having a default type of
                                debit or credit. If it is a credit
                                then the amount posted to it should
                                be positive while it is a debit the
                                amount should be negative.
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element ref="SourceAccountingDate" minOccurs="0"/>
                    <xsd:element ref="SourceDocumentReference" minOccurs="0"/>
                    <xsd:element ref="LineType" minOccurs="0"/>
                    <xsd:element ref="DayBookID" minOccurs="0"/>
                    <xsd:element ref="DocumentReference" minOccurs="0" maxOccurs="unbounded"/>
                    <xsd:element ref="TransactionReferenceText" minOccurs="0" maxOccurs="unbounded"/>
                    <xsd:element ref="ProtocolNumberText" minOccurs="0"/>
                    <xsd:element ref="MultibookCore" minOccurs="0"/>
                    <xsd:element ref="MultiBookLine" minOccurs="0"/>
                    <xsd:element ref="Description" minOccurs="0" maxOccurs="unbounded"/>
                    <xsd:element ref="Note" minOccurs="0" maxOccurs="unbounded"/>
                    <xsd:element ref="MemoAmount" minOccurs="0" maxOccurs="unbounded"/>
                    <xsd:element ref="WarningCode" minOccurs="0" maxOccurs="unbounded"/>
                    <xsd:element ref="ExchangeRateDateTime" minOccurs="0"/>
                    <xsd:element ref="GLFullAccount" minOccurs="0"/>
                </xsd:sequence>
                <xsd:attribute name="sequence" type="PositiveIntegerNumericType" use="optional"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="MultibookType">
        <xsd:sequence>
            <xsd:element ref="FinancialCalendarReference" minOccurs="0"/>
            <xsd:element ref="AccountingChartReference" minOccurs="0"/>
            <xsd:element ref="AccountingDate" minOccurs="0"/>
            <xsd:element ref="DocumentDateTime" minOccurs="0"/>
            <xsd:element ref="LedgerSetupReference" minOccurs="0"/>
            <xsd:element ref="DraftCoreJournalID" minOccurs="0"/>
            <xsd:element ref="Core" minOccurs="0"/>
            <xsd:element ref="PostedBook" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="CoreType">
        <xsd:sequence>
            <xsd:element ref="DocumentDateTime" minOccurs="0"/>
            <xsd:element ref="JournalID" minOccurs="0"/>
            <xsd:element ref="CorrectedJournalID" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="Core" type="CoreType"/>

    <xsd:element name="MultiBook" type="MultibookType"/>

    <xsd:complexType name="MultibookCoreType">
        <xsd:sequence>
            <xsd:element ref="LineNumber" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="MultibookCore" type="MultibookCoreType"/>

    <xsd:complexType name="MultiBookLineType">
        <xsd:sequence>
            <xsd:element ref="LineNumber" minOccurs="0"/>
            <xsd:element ref="CorrectedJournalLineNumber" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="MultiBookLine" type="MultiBookLineType"/>

    <xsd:element name="CorrectedJournalID" type="IdentifierType"/>
    <xsd:element name="DraftCoreJournalID" type="IdentifierType"/>
    <xsd:element name="JournalID" type="IdentifierType"/>
    <xsd:element name="SourceJournalID" type="IdentifierType">
        <xsd:annotation>
            <xsd:documentation>The ledger ID from the source system,
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="MixedDateIndicator" type="IndicatorType">
        <xsd:annotation>
            <xsd:documentation> Indicates that there is more than one AccountingDate at
                the line level </xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="SourceSystemJournalCode" type="CodeType">
        <xsd:annotation>
            <xsd:documentation> The financial controller will do different validation
                depending on the value which comes in on the source system journal
                code.  Example of a few are source ledger system, CDX, Journal Entry, 
                Correction from MBL
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="SourceAccountingDate" type="AccountingDateType"/>

    <xsd:element name="EnteredAudit" type="AuditType"/>
    <xsd:element name="ModifiedAudit" type="AuditType"/>
    <xsd:element name="PostedAudit" type="AuditType"/>
    <xsd:element name="ApprovedAudit" type="AuditType"/>

    <xsd:element name="LedgerType" type="CodeType">
        <xsd:annotation>
            <xsd:documentation> For future use, hard coded to "Actual" on all MBL and
                Financial Controller Journals. </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="PrivateDimensions" type="CodesType"/>

    <xsd:element name="DayBookID" type="IdentifierType"/>


    <xsd:element name="TransactionReferenceText" type="NormalizedStringType"/>

    <xsd:element name="CorrectedJournalLineNumber" type="IdentifierType"/>
    <xsd:element name="SourceLine" type="NormalizedStringType"/>

    <xsd:complexType name="PostedBookType">
        <xsd:sequence>
            <xsd:element ref="JournalID" minOccurs="0"/>
            <xsd:element ref="CorrectedJournalID" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="PostedBook" type="PostedBookType"/>

    

</xsd:schema>
