<?xml version="1.0" encoding="ISO-8859-1"?>
<persistence-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="../../../../defs/config-metier/Persistence.xsd">
	<layer name="mysql" persistence-model="xemelios-sql">
		<!-- persistence-model defines the way informations are defined -->
		<!-- only xemelios-sql is defined at this moment -->
		<document id="etatVersement" repository-import-xslt-file="versement/nomenclature-import-versement.xsl">
			<table type="repository" base-name="VERSEMENT_REPOSITORY" version="2">
				CREATE TABLE IF NOT EXISTS ${base-name} (
				ID VARCHAR(25),
				LIBELLE VARCHAR(100),
				COLLECTIVITE VARCHAR(15) NOT NULL,
				REPOSITORY LONGBLOB,
				ENCODING VARCHAR(20)
				) TYPE MYISAM
				<patch from-version="1">
					<sql failonerror="false">ALTER TABLE ${base-name} ADD ID VARCHAR(25)</sql>
				    <sql failonerror="false">ALTER TABLE ${base-name} ADD LIBELLE VARCHAR(100)</sql>
				</patch>
			</table>
			<table type="special-key" base-name="VERSEMENT_SPECIAL_KEYS" version="1">
				CREATE TABLE IF NOT EXISTS ${base-name} (
					COLLECTIVITE VARCHAR(15) NOT NULL,
					BUDGET VARCHAR(24) NOT NULL,
					INITIAL_DOC_NAME VARCHAR(100) NOT NULL,
					KEY1 VARCHAR(100) NOT NULL,
					LIB1 VARCHAR(200),
					KEY2 VARCHAR(100),
					LIB2 VARCHAR(200),
					KEY3 VARCHAR(100),
					LIB3 VARCHAR(200),
					INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET)
				) TYPE MYISAM
			</table>
			<table type="list-bc" base-name="VERS_LIST_BUDG_COLL" version="1">
				CREATE TABLE IF NOT EXISTS ${base-name} (
				COLLECTIVITE VARCHAR(15) NOT NULL,
				BUDGET VARCHAR(24) NOT NULL,
				BUDGET_LIB VARCHAR(200),
				COLLECTIVITE_LIB VARCHAR(200),
				INITIAL_DOC_NAME VARCHAR(100) NOT NULL,
				INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET)
				) TYPE MYISAM
			</table>
			<etat
				id="etatVersement"
				import-xslt-file="versement/etatVersement-import-mysql.xsl">
				<key1>
					<path>/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/@generated-id</path>
				</key1>
				<key2>
					<path>/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/@generated-id</path>
				</key2>
                <key3>
                    <path>/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:PJRef/@generated-id</path>
                </key3>
				<table
					type="document"
					base-name="VERS_ETATVERS_DOCUMENTS"
					version="1">
					CREATE TABLE IF NOT EXISTS ${base-name} (
					COLLECTIVITE VARCHAR(15) NOT NULL,
					BUDGET VARCHAR(24) NOT NULL,
					INITIAL_DOC_NAME VARCHAR(100) NOT NULL,
					DOC_ID VARCHAR(100) NOT NULL,
					DOC LONGBLOB,
					ENCODING VARCHAR(20),
					INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET,DOC_ID)
					) TYPE MYISAM
				</table>
				<!-- id is local for etat, and valid only for type=index -->
				<table
					type="index"
					id="T1"
					base-name="VERS_ETATVERS_INDEX_VERS"
					version="5"
					main="true">
					CREATE TABLE IF NOT EXISTS ${base-name} (
					COLLECTIVITE VARCHAR(15) NOT NULL,
					BUDGET VARCHAR(24) NOT NULL,
					DOC_ID VARCHAR(100) NOT NULL,
					ANNEE INTEGER,
					ID_VERST VARCHAR(50),
					PRESTATION VARCHAR(50),
					PRESTATION_PRINCIPALE VARCHAR(50),
					DATE_EMISSION DATE,
					ID_DOSSIER VARCHAR(50),
					ID_TIERS VARCHAR(30),
					DATE_MALADE DATE,
					TYPE_TIERS VARCHAR(2),
					NAT_ID_TIERS VARCHAR(2),
					DATE_ID_TIERS DATE,
					REF_TIERS VARCHAR(30),
					CAT_TIERS VARCHAR(2),
					NAT_JUR VARCHAR(2),
					CIVILITE VARCHAR(10),
					NOM VARCHAR(100),
					COMPLEMENT_NOM VARCHAR(50),
					PRENOM VARCHAR(50),
					DATE_NAISS DATE,
					ADR1 VARCHAR(80),
					ADR2 VARCHAR(80),
					ADR3 VARCHAR(80),
					CODE_POSTAL VARCHAR(5),
					VILLE VARCHAR(80),
					CODE_RES SMALLINT,
					CODE_PAYS VARCHAR(3),
					DATE_ADR DATE,
					RIB VARCHAR(23),
					DATE_DECISION DATE,
					DATE_EFFET_DECISION DATE,
					DATE_FIN_DECISION DATE,
					NATURE_DECISION VARCHAR(8),
					ID_DECISION VARCHAR(50),
					PERIODICITE_DECISION VARCHAR(100),
					MONTANT_DECISION DECIMAL(16,3),
					MONTANT_VERSEMENT DECIMAL(16,3),
					NUM_ORDRE_SEQUENCE INTEGER,
					NB_TOTAL_SEQUENCE INTEGER,
					SERVICE VARCHAR(160),
					COMMENTAIRE VARCHAR(250),
					NUM_MANDAT VARCHAR(13),
					CODE_NATURE VARCHAR(24),
					CODE_BUDGET VARCHAR(24),
					CODE_FONCTION VARCHAR(24),
					MOIS VARCHAR(2),
					INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET,DOC_ID)		
					) TYPE MYISAM
					<patch from-version="1">
						<sql failonerror="false">ALTER TABLE ${base-name} ADD MOIS VARCHAR(2)</sql>
						<sql failonerror="false">ALTER TABLE ${base-name} MODIFY NUM_MANDAT VARCHAR(13)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY NOM VARCHAR(100)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY COMPLEMENT_NOM VARCHAR(50)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY PRENOM VARCHAR(50)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR1 VARCHAR(80)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR2 VARCHAR(80)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR3 VARCHAR(80)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY VILLE VARCHAR(80)</sql>
					</patch>
					<patch from-version="2">
						<sql failonerror="false">ALTER TABLE ${base-name} MODIFY NUM_MANDAT VARCHAR(13)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY NOM VARCHAR(100)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY COMPLEMENT_NOM VARCHAR(50)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY PRENOM VARCHAR(50)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR1 VARCHAR(80)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR2 VARCHAR(80)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR3 VARCHAR(80)</sql>
					    <sql failonerror="false">ALTER TABLE ${base-name} MODIFY VILLE VARCHAR(80)</sql>
					</patch>
				    <patch from-version="3">
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY NOM VARCHAR(100)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY COMPLEMENT_NOM VARCHAR(50)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY PRENOM VARCHAR(50)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR1 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR2 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR3 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY VILLE VARCHAR(80)</sql>
				    </patch>
				    <patch from-version="4">
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR1 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR2 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR3 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY VILLE VARCHAR(80)</sql>
				    </patch>
				</table>
				<table
					type="index"
					id="T3"
					base-name="VERS_ETATVERS_INDEX_BENEF"
					version="3"
					based-on="key1">
					Create table  IF NOT EXISTS ${base-name} (
					COLLECTIVITE VARCHAR(15) NOT NULL,
					BUDGET VARCHAR(24) NOT NULL,
					DOC_ID VARCHAR(100) NOT NULL,
					ID_TIERS VARCHAR(30),
					DATE_MALADE DATE,
					TYPE_TIERS VARCHAR(2),
					NAT_ID_TIERS VARCHAR(2),
					DATE_ID_TIERS DATE,
					REF_TIERS VARCHAR(30),
					CAT_TIERS VARCHAR(2),
					NAT_JUR VARCHAR(2),
					CIVILITE VARCHAR(10),
					NOM VARCHAR(100),
					COMPLEMENT_NOM VARCHAR(50),
					PRENOM VARCHAR(50),
					ID_FAMILLE VARCHAR(50),
					DATE_NAISS DATE,
					ADR1 VARCHAR(80),
					ADR2 VARCHAR(80),
					ADR3 VARCHAR(80),
					CODE_POSTAL VARCHAR(5),
					VILLE VARCHAR(80),
					CODE_RES SMALLINT,
					CODE_PAYS VARCHAR(3),
					DATE_ADR DATE,
					RIB VARCHAR(23),
					INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET,DOC_ID)
					) TYPE MYISAM
				    <patch from-version="1">
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY NOM VARCHAR(100)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY COMPLEMENT_NOM VARCHAR(50)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY PRENOM VARCHAR(50)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR1 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR2 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR3 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY VILLE VARCHAR(80)</sql>
				    </patch>
				    <patch from-version="2">
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR1 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR2 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY ADR3 VARCHAR(80)</sql>
				        <sql failonerror="false">ALTER TABLE ${base-name} MODIFY VILLE VARCHAR(80)</sql>
				    </patch>
				</table>
				
				<table
					type="index"
					id="T2"
					base-name="VERS_ETATVERS_INDEX_PJ"
                                        based-on="key3"
					version="1">
					CREATE TABLE IF NOT EXISTS ${base-name} (
					COLLECTIVITE VARCHAR(15) NOT NULL,
					BUDGET VARCHAR(24) NOT NULL,
					DOC_ID VARCHAR(100) NOT NULL,
					SUPPORT_PJ VARCHAR(2),
					ID_UNIQUE_PJ VARCHAR(50),
					NOM_PJ VARCHAR(100),
					INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET,DOC_ID)
					) TYPE MYISAM   		
				</table>
				<table
					type="index"
					id="T4"
					base-name="VERS_ETATVERS_DETAILMT"
					based-on="key2"
					version="1">
					CREATE TABLE IF NOT EXISTS ${base-name} (
					COLLECTIVITE VARCHAR(15) NOT NULL,
					BUDGET VARCHAR(24) NOT NULL,
					DOC_ID VARCHAR(100) NOT NULL,
					NODE_ID VARCHAR(15) NOT NULL,
					DATE_LIGNE DATE,
					DATE_DEBUT DATE,
					DATE_FIN DATE,
					CODE VARCHAR(24),
					LIBELLE VARCHAR(100),
					UNITE VARCHAR(38),
					QUANTITE DECIMAL(16,3),
					MONTANT_UNIT DECIMAL(16,3),
					MONTANT_BASE DECIMAL(16,3),
					TAUX DECIMAL(8,4),
					MONTANT DECIMAL(16,3),
					ORDRE INTEGER,
					COMMENTAIRE VARCHAR(100),
					INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET,DOC_ID)
					) TYPE MYISAM
				</table>
				<criteria id="annee" type="1" sql-index-id="S1">
					<where-clause>${table}.${column}=##VALEUR:annee##</where-clause>
				</criteria>
				<criteria id="mois" type="1" sql-index-id="S87">
					<where-clause>${table}.${column}='##VALEUR:mois##'</where-clause>
				</criteria>
				<criteria id="id_verst" type="1" sql-index-id="S5">
					<where-clause>fn:string-compare(${table}.${column},id_verst)</where-clause>
				</criteria>
				<criteria id="nom_benef" type="1" sql-index-id="S2">
					<where-clause>fn:string-compare(${table}.${column},nom_benef)</where-clause>
				</criteria> 
				<criteria id="nom_dest" type="1" sql-index-id="S3">
					<where-clause>fn:string-compare(${table}.${column},nom_dest)</where-clause>
				</criteria>
				<criteria id="code_prestation" type="1" sql-index-id="S6">
					<where-clause>fn:string-compare(${table}.${column},code_prestation)</where-clause>
				</criteria>
				<criteria id="prestation" type="1" sql-index-id="S6">
					<where-clause>${table}.${column}='##VALEUR:prestation##'</where-clause>
				</criteria>
				<criteria id="code_prestation_principale" type="1" sql-index-id="S68">
					<where-clause>fn:string-compare(${table}.${column},code_prestation_principale)</where-clause>
				</criteria>
				<criteria id="prestation-principale" type="1" sql-index-id="S68">
					<where-clause>${table}.${column}='##VALEUR:prestation-principale##'</where-clause>
				</criteria>
				<criteria id="id_doss" type="1" sql-index-id="S4">
					<where-clause>fn:string-compare(${table}.${column},id_doss)</where-clause>
				</criteria>
				<criteria id="id_tiers_dest" type="1" sql-index-id="S7">
					<where-clause>fn:string-compare(${table}.${column},id_tiers_dest)</where-clause>
				</criteria>
				<criteria id="type_tiers_dest" type="1" sql-index-id="S9">
					<where-clause>fn:string-compare(${table}.${column},type_tiers_dest)</where-clause>
				</criteria>
				<criteria id="ref_tiers_dest" type="1" sql-index-id="S12">
					<where-clause>fn:string-compare(${table}.${column},ref_tiers_dest)</where-clause>
				</criteria>
				<criteria id="cat_tiers_dest" type="1" sql-index-id="S13">
					<where-clause>${table}.${column}='##VALEUR:cat_tiers_value##'</where-clause>
				</criteria>
				<criteria id="adr_dest" type="1" sql-index-id="S19">
					<where-clause>fn:string-compare(${table}.${column},adr_dest)</where-clause>
				</criteria>
				<criteria id="cp_dest" type="1" sql-index-id="S22">
					<where-clause>fn:string-compare(${table}.${column},cp_dest)</where-clause>
				</criteria>
				<criteria id="ville_dest" type="1" sql-index-id="S23">
					<where-clause>fn:string-compare(${table}.${column},ville_dest)</where-clause>
				</criteria>
				<criteria id="date_decision" type="1" sql-index-id="S28">
					<where-clause>fn:date-compare(${table}.${column},date_decision)</where-clause>
				</criteria>
				<criteria id="date_effet_decision" type="1" sql-index-id="S29">
					<where-clause>fn:date-compare(${table}.${column},date_effet_decision)</where-clause>
				</criteria>
				<criteria id="date_fin_decision" type="1" sql-index-id="S30">
					<where-clause>fn:date-compare(${table}.${column},date_fin_decision)</where-clause>
				</criteria>
				<criteria id="nature_decision" type="1" sql-index-id="S31">
					<where-clause>fn:string-compare(${table}.${column},nature_decision)</where-clause>
				</criteria>
				<criteria id="existence_pj" sql-index-id="S44">
					<where-clause>${table}.${column} IS NOT NULL</where-clause>
				</criteria>
				<criteria id="service" type="1" sql-index-id="S38">
					<where-clause>fn:string-compare(${table}.${column},service)</where-clause>
				</criteria>
				<criteria id="id_tiers_benef" type="1" sql-index-id="S47">
					<where-clause>fn:string-compare(${table}.${column},id_tiers_benef)</where-clause>
				</criteria>
				<criteria id="rib_verst" type="1" sql-index-id="S67">
					<where-clause>fn:string-compare(${table}.${column},rib_verst)</where-clause>
				</criteria>
				<criteria id="type_tiers_benef" type="1" sql-index-id="S49">
					<where-clause>fn:string-compare(${table}.${column},type_tiers_benef)</where-clause>
				</criteria>
				<criteria id="ref_tiers_benef" type="1" sql-index-id="S52">
					<where-clause>fn:string-compare(${table}.${column},ref_tiers_benef)</where-clause>
				</criteria>
				<criteria id="cat_tiers_benef" type="1" sql-index-id="S53">
					<where-clause>${table}.${column}='##VALEUR:cat_tiers_value##'</where-clause>
				</criteria>
				<criteria id="adr_benef" type="1" sql-index-id="S59">
					<where-clause>fn:string-compare(${table}.${column},adr_benef)</where-clause>
				</criteria>
				<criteria id="cp_benef" type="1" sql-index-id="S62">
					<where-clause>fn:string-compare(${table}.${column},cp_benef)</where-clause>
				</criteria>
				<criteria id="ville_benef" type="1" sql-index-id="S63">
					<where-clause>fn:string-compare(${table}.${column},ville_benef)</where-clause>
				</criteria>
				<criteria id="decision_id" sql-index-id="S32">
					<where-clause>fn:string-compare(${table}.${column},decision_id)</where-clause>
				</criteria>
				<criteria id="sequence_num_ordre" sql-index-id="S36">
					<where-clause>${table}.${column}##OPERATEUR:sequence_num_ordre####VALEUR:sequence_num_ordre##</where-clause>
				</criteria>
				<criteria id="mandat" sql-index-id="S40">
					<where-clause>fn:string-compare(${table}.${column},mandat)</where-clause>
				</criteria>
				<criteria id="nature" sql-index-id="S41">
					<where-clause>${table}.${column}='##VALEUR:nature##'</where-clause>
				</criteria>
				<criteria id="budget" sql-index-id="S42">
					<where-clause>${table}.${column}='##VALEUR:budget##'</where-clause>
				</criteria>
				<criteria id="fonction" sql-index-id="S43">
					<where-clause>fn:string-compare(${table}.${column},fonction)</where-clause>
				</criteria>
				<criteria id="benef_famille" sql-index-id="S83">
					<where-clause>fn:string-compare(${table}.${column},benef_famille)</where-clause>
				</criteria>
				<criteria id="benef_date_naiss" sql-index-id="S58">
					<where-clause>fn:date-compare(${table}.${column},naissance)</where-clause>
				</criteria>
				<criteria id="date_verst" sql-index-id="S69">
					<where-clause>fn:date-compare(${table}.${column},date_verst)</where-clause>
				</criteria>
				<criteria id="mt_verst" sql-index-id="S35">
					<where-clause>${table}.${column}##OPERATEUR:mt####VALEUR:mt##</where-clause>
				</criteria>
				<sql-index
					id="S1"
					path="/n:EtatVersement/n:Annee/@V"
					datatype="integer"
					column="ANNEE"
					table="T1"/>
				<sql-index
					id="S2"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:Nom/@V"
					datatype="string"
					format="uppercase"
					column="NOM"
					table="T3"/>
				<sql-index
					id="S2bis"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire[1]/n:InfoTiers/n:Nom/@V"
					datatype="string"
					format="uppercase"
					column="NOM"
					table="T3"/>
				<sql-index
					id="S3"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:Nom/@V"
					datatype="string"
					format="uppercase"
					column="NOM"
					table="T1"/>
				<sql-index
					id="S4"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:IdDossier/@V"
					datatype="string"
					column="ID_DOSSIER"
					table="T1"/>
				<sql-index
					id="S5"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:IdVerst/@V"
					datatype="string"
					column="ID_VERST"
					table="T1"/>
				<sql-index
					id="S6"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Prestation/@V"
					datatype="string"
					column="PRESTATION"
					format="uppercase"
					table="T1"/>
				<sql-index
					id="S7"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:IdTiers/@V"
					datatype="string"
					column="ID_TIERS"
					format="uppercase"
					table="T1"/>
				<sql-index
					id="S8"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:DteMalade/@V"
					datatype="date"
					column="DATE_MALADE"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T1"/>
				<sql-index
					id="S9"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:TypTiers/@V"
					datatype="string"
					column="TYPE_TIERS"
					format="uppercase"
					table="T1"/>
				<sql-index
					id="S10"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:NatIdTiers/@V"
					datatype="string"
					column="NAT_ID_TIERS"
					table="T1"/>
				<sql-index
					id="S11"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:DteIdTiers/@V"
					datatype="date"
					column="DATE_ID_TIERS"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T1"/>
				
				<sql-index
					id="S12"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:RefTiers/@V"
					datatype="string"
					column="REF_TIERS"
					table="T1"/>
				
				<sql-index
					id="S13"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:CatTiers/@V"
					datatype="string"
					column="CAT_TIERS"
					table="T1"/>
				
				<sql-index
					id="S14"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:NatJur/@V"
					datatype="string"
					column="NAT_JUR"
					table="T1"/>
				
				<sql-index
					id="S15"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:Civilite/@V"
					datatype="string"
					column="CIVILITE"
					table="T1"/>
				
				<sql-index
					id="S16"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:ComplNom/@V"
					datatype="string"
					column="COMPLEMENT_NOM"
					table="T1"/>
				
				<sql-index
					id="S17"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:InfoTiers/n:Prenom/@V"
					datatype="string"
					column="PRENOM"
					table="T1"/>
				
				<sql-index
					id="S18"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:DateNaissance/@V"
					datatype="date"
					column="DATE_NAISS"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T1"/>
				
				<sql-index
					id="S19"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:Adresse/n:Adr1/@V"
					datatype="string"
					column="ADR1"
					format="uppercase"
					table="T1"/>
				
				<sql-index
					id="S20"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:Adresse/n:Adr2/@V"
					datatype="string"
					column="ADR2"
					format="uppercase"
					table="T1"/>
				
				<sql-index
					id="S21"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:Adresse/n:Adr3/@V"
					datatype="string"
					column="ADR3"
					format="uppercase"
					table="T1"/>
				
				<sql-index
					id="S22"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:Adresse/n:CP/@V"
					datatype="string"
					column="CODE_POSTAL"
					table="T1"/>
				
				<sql-index
					id="S23"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:Adresse/n:Ville/@V"
					datatype="string"
					column="VILLE"
					format="uppercase"
					table="T1"/>
				
				<sql-index
					id="S24"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:Adresse/n:CodeRes/@V"
					datatype="boolean"
					column="CODE_RES"
					table="T1"/>
				
				<sql-index
					id="S25"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:Adresse/n:CodePays/@V"
					datatype="string"
					column="CODE_PAYS"
					table="T1"/>
				
				<sql-index
					id="S26"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:Adresse/n:DteAdr/@V"
					datatype="date"
					column="DATE_ADR"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T1"/>
				
				<!--sql-index
					id="S27"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Destinataire/n:CpteBacaire/@rib"
					datatype="string"
					column="RIB"
					table="T1"/-->
				
				<sql-index
					id="S28"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:Date/@V"
					datatype="date"
					column="DATE_DECISION"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T1"/>
				
				<sql-index
					id="S29"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:DateEffet/@V"
					datatype="date"
					column="DATE_EFFET_DECISION"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T1"/>
				
				<sql-index
					id="S30"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:DateFin/@V"
					datatype="date"
					column="DATE_FIN_DECISION"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T1"/>
				
				<sql-index
					id="S31"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:Nature/@V"
					datatype="string"
					column="NATURE_DECISION"
					table="T1"/>
				
				<sql-index
					id="S32"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:IdDecision/@V"
					datatype="string"
					column="ID_DECISION"
					format="uppercase"
					table="T1"/>
				
				<sql-index
					id="S33"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:Periodicite/@V"
					datatype="string"
					column="PERIODICITE_DECISION"
					table="T1"/>
				
				<sql-index
					id="S34"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:Mt/@V"
					datatype="decimal"
					column="MONTANT_DECISION"
					table="T1"/>
				
				<sql-index
					id="S35"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Mt/@V"
					datatype="decimal"
					column="MONTANT_VERSEMENT"
					table="T1"/>
				
				<sql-index
					id="S36"
					path="/n:EtatVersement/n:Sequence/n:NumOrdre/@V"
					datatype="integer"
					column="NUM_ORDRE_SEQUENCE"
					table="T1"/>
				
				<sql-index
					id="S37"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Sequence/n:NbTotal/@V"
					datatype="integer"
					column="NB_TOTAL_SEQUENCE"
					table="T1"/>
				
				<sql-index
					id="S38"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Service/@V"
					datatype="string"
					column="SERVICE"
					format="uppercase"
					table="T1"/>
				
				<sql-index
					id="S39"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Commentaire/@V"
					datatype="string"
					column="COMMENTAIRE"
					format="uppercase"
					table="T1"/>
				
				<sql-index
					id="S40"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:NumMandat/@V"
					datatype="string"
					column="NUM_MANDAT"
					format="uppercase"
					table="T1"/>
				
				<sql-index
					id="S41"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:CodeNature/@V"
					datatype="string"
					column="CODE_NATURE"
					table="T1"/>
				
				<sql-index
					id="S42"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Code_Budget/@V"
					datatype="string"
					column="CODE_BUDGET"
					table="T1"/>
				
				<sql-index
					id="S43"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:CodeFonction/@V"
					datatype="string"
					column="CODE_FONCTION"
					table="T1"/>
				<!-- *************************************************************************** -->
				<sql-index
					id="S44"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:PJRef/n:Support/@V"
					datatype="string"
					column="SUPPORT_PJ"
					table="T2"/>
				<sql-index
					id="S45"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:PJRef/n:IdUnique/@V"
					datatype="string"
					column="ID_UNIQUE_PJ"
					table="T2"/>
				<sql-index
					id="S46"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Decision/n:PJRef/n:Nom_PJ/@V"
					datatype="string"
					column="NOM_PJ"
					table="T2"/>
				
				<!-- **************************************************************************** -->
				
				<sql-index
					id="S47"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:IdTiers/@V"
					datatype="string"
					column="ID_TIERS"
					format="uppercase"
					table="T3"/>
				<sql-index
					id="S48"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:DteMalade/@V"
					datatype="date"
					column="DATE_MALADE"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T3"/>
				<sql-index
					id="S49"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:TypTiers/@V"
					datatype="string"
					column="TYPE_TIERS"
					format="uppercase"
					table="T3"/>
				<sql-index
					id="S50"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:NatIdTiers/@V"
					datatype="string"
					column="NAT_ID_TIERS"
					format="uppercase"
					table="T3"/>
				<sql-index
					id="S51"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:DteIdTiers/@V"
					datatype="date"
					column="DATE_ID_TIERS"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T3"/>
				
				<sql-index
					id="S52"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:RefTiers/@V"
					datatype="string"
					column="REF_TIERS"
					table="T3"/>
				
				<sql-index
					id="S53"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:CatTiers/@V"
					datatype="string"
					column="CAT_TIERS"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S54"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:NatJur/@V"
					datatype="string"
					column="NAT_JUR"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S55"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:Civilite/@V"
					datatype="string"
					column="CIVILITE"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S56"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:ComplNom/@V"
					datatype="string"
					column="COMPLEMENT_NOM"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S57"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:InfoTiers/n:Prenom/@V"
					datatype="string"
					column="PRENOM"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S58"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:DateNaissance/@V"
					datatype="date"
					column="DATE_NAISS"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T3"/>
				
				<sql-index
					id="S59"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:Adresse/n:Adr1/@V"
					datatype="string"
					column="ADR1"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S60"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:Adresse/n:Adr2/@V"
					datatype="string"
					column="ADR2"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S61"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:Adresse/n:Adr3/@V"
					datatype="string"
					column="ADR3"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S62"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:Adresse/n:CP/@V"
					datatype="string"
					column="CODE_POSTAL"
					table="T3"/>
				
				<sql-index
					id="S63"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:Adresse/n:Ville/@V"
					datatype="string"
					column="VILLE"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S64"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:Adresse/n:CodeRes/@V"
					datatype="boolean"
					column="CODE_RES"
					table="T3"/>
				
				<sql-index
					id="S65"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:Adresse/n:CodePays/@V"
					datatype="string"
					column="CODE_PAYS"
					table="T3"/>
				
				<sql-index
					id="S66"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:Adresse/n:DteAdr/@V"
					datatype="date"
					column="DATE_ADR"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					table="T3"/>
				
				<sql-index
					id="S67"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:CpteBancaire/@rib"
					datatype="string"
					column="RIB"
					table="T1"/>
				<sql-index
					id="S68"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Prestation-principale/n:Code/@V"
					datatype="string"
					column="PRESTATION_PRINCIPALE"
					table="T1"
					format="uppercase"/>

				<sql-index
					id="S69"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Date/@V"
					datatype="date"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					column="DATE_EMISSION"
					table="T1"/>
					
				<sql-index
					id="S70"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/@generated-id"
					datatype="string"
					column="NODE_ID"
					table="T4"/>
				<sql-index
					id="S71"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:Date/@V"
					datatype="date"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					column="DATE"
					table="T4"/>
				<sql-index
					id="S72"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:DateDebut/@V"
					datatype="date"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					column="DATE_DEBUT"
					table="T4"/>
				<sql-index
					id="S73"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:DateFin/@V"
					datatype="date"
					format="yyyy-MM-dd'T'HH:mm:ss;yyyy-MM-dd"
					column="DATE_FIN"
					table="T4"/>
				<sql-index
					id="S74"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:Code/@V"
					datatype="string"
					column="CODE"
					table="T4"/>
				<sql-index
					id="S75"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:Libelle/@V"
					datatype="string"
					format="uppercase"
					column="LIBELLE"
					table="T4"/>
				<sql-index
					id="S76"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:Unite/@V"
					datatype="string"
					column="UNITE"
					format="uppercase"
					table="T4"/>
				<sql-index
					id="S77"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:Quantite/@V"
					datatype="decimal"
					column="QUANTITE"
					table="T4"/>
				<sql-index
					id="S78"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:MtUnitaire/@V"
					datatype="decimal"
					column="MONTANT_UNIT"
					table="T4"/>
				<sql-index
					id="S79"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:MtBase/@V"
					datatype="decimal"
					column="MONTANT_BASE"
					table="T4"/>
				<sql-index
					id="S80"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:Taux/@V"
					datatype="decimal"
					column="TAUX"
					table="T4"/>
				<sql-index
					id="S81"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:Mt/@V"
					datatype="decimal"
					column="MONTANT"
					table="T4"/>
				<sql-index
					id="S82"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:Ordre/@V"
					datatype="integer"
					column="ORDRE"
					table="T4"/>
				<sql-index
					id="S83"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Beneficiaire/n:IdFamille/@V"
					datatype="string"
					column="ID_FAMILLE"
					format="uppercase"
					table="T3"/>
				
				<sql-index
					id="S84"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:DetailMt/n:Commentaire/@V"
					datatype="string"
					format="uppercase"
					column="COMMENTAIRE"
					table="T4"/>
				
			    <!--sql-index
					id="S86"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Prestation/@V"
					datatype="string"
					column="PRESTATION"
					format="uppercase"
					table="T1"/>
				<sql-index
					id="S85"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Prestation-principale/n:Code/@V"
					datatype="string"
					format="uppercase"
					column="PRESTATION_PRINCIPALE"
					table="T1"/n:-->
				<sql-index
					id="S87"
					path="/n:EtatVersement/n:DonneesVersement/n:Versement/n:Mois/@V"
					datatype="string"
					column="MOIS"
					table="T1"/>
				
			</etat>
			
			<etat id="RepartitionNature" import-xslt-file="versement/etatVersement-import-mysql.xsl">
				<table type="document" base-name="VERS_ETATREPARTITION_DOCUMENTS" version="1">
					CREATE TABLE IF NOT EXISTS ${base-name} (
					COLLECTIVITE VARCHAR(15) NOT NULL,
					BUDGET VARCHAR(24) NOT NULL,
					INITIAL_DOC_NAME VARCHAR(100) NOT NULL,
					DOC_ID VARCHAR(100) NOT NULL,
					DOC LONGBLOB,
					ENCODING VARCHAR(20),
					INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET,DOC_ID)
					) TYPE MYISAM
				</table>
				<table type="index" id="T10" base-name="VERS_ETATREPARTITION_INDEX_REPARTITION" version="1" main="true">
					CREATE TABLE IF NOT EXISTS ${base-name} (
					COLLECTIVITE VARCHAR(15) NOT NULL,
					BUDGET VARCHAR(24) NOT NULL,
					DOC_ID VARCHAR(100) NOT NULL,
					ANNEE INTEGER,
					LIBELLE VARCHAR(100),
					CODE_NATURE VARCHAR(24),
					CODE_FONCTION VARCHAR(24),
					CODE_BUDGET VARCHAR(24),
					MONTANT DECIMAL(16,3)
					) TYPE MYISAM
				</table>

				<criteria id="annee" type="1" sql-index-id="P1">
					<where-clause>${table}.${column}=##VALEUR:annee##</where-clause>
				</criteria>
				<criteria id="code-fonction" type="1" sql-index-id="P3">
					<where-clause>fn:string-compare(${table}.${column},code-fonction)</where-clause>
				</criteria>
				<criteria id="code-budget" type="1" sql-index-id="P4">
					<where-clause>${table}.${column}='##VALEUR:code-budget##'</where-clause>
				</criteria>
				
				<sql-index
					id="P1"
					path="/n:EtatVersement/n:Annee/@V"
					datatype="integer"
					column="ANNEE"
					table="T10"/>
				<sql-index
					id="P2"
					path="/n:EtatVersement/n:RepartitionParNature/n:Repartition/n:Code/@V"
					datatype="string"
					format="uppercase"
					column="CODE_NATURE"
					table="T10"/>
				<sql-index
					id="P3"
					path="/n:EtatVersement/n:RepartitionParNature/n:Repartition/n:CodeBudget/@V"
					datatype="string"
					format="uppercase"
					column="CODE_BUDGET"
					table="T10"/>
				<sql-index
					id="P4"
					path="/n:EtatVersement/n:RepartitionParNature/n:Repartition/n:CodeFonction/@V"
					datatype="string"
					format="uppercase"
					column="CODE_FONCTION"
					table="T10"/>
				
			</etat>
		</document>
	</layer>
</persistence-config>
