<?xml version="1.0" encoding="ISO-8859-15"?>
<DBOPTIMIZER>

	<VIEWNAMEOPTIMIZER viewName="V_HISTORIQUE_ECRITURES_X" defaultViewName="v_historique_ecritures_total_1  v_historique_ecritures_1" label="Historique écritures">
		<INDICATOR number="1" label="Détail">
			<FIELD name="date_ecriture" />
			<FIELD name="cle_originale" />
			<FIELD name="compte_contrepartie_id" />
            <FIELD name="compte_contrepartie_section_id" />
			<FIELD name="v_historique_ecritures_1.texte" />
			<FIELD name="date_facture_fournisseur" />
			<FIELD name="piece" />
			<FIELD name="dossier" />
			<FIELD name="date_echeance" />
			<FIELD name="journal_paiement_id" />
			<FIELD name="mode_paiement_id" />
			<FIELD name="numero_cheque" />
			<FIELD name="montant_absolu_ecriture" />
		</INDICATOR>
		<INDICATOR number="2" label="Pole">
			<FIELD name="pole" />
		</INDICATOR>
				
		<RULE indicators="00" viewName="v_historique_ecritures_total_1 v_historique_ecritures_1"/> 
		<RULE indicators="01" viewName="v_historique_ecritures_total_2 v_historique_ecritures_1"/> 
		<RULE indicators="10" viewName="v_historique_ecritures_1"/> 
		<RULE indicators="11" viewName="v_historique_ecritures_2 v_historique_ecritures_1"/> 
		
		<LEFTJOININDICATOR label="Section analytique 2" leftjoin="JOIN compta.v_ecritures_sections_analytiques_2_1 ON v_ecritures_sections_analytiques_2_1.to_section_analytique_2_id = v_historique_ecritures_1.section_analytique_2_id">
			<FIELD name="section_analytique_2" />
		</LEFTJOININDICATOR>
		<LEFTJOININDICATOR label="Section analytique 3" leftjoin="JOIN compta.v_ecritures_sections_analytiques_3_1 ON v_ecritures_sections_analytiques_3_1.to_section_analytique_3_id = v_historique_ecritures_1.section_analytique_3_id">
			<FIELD name="section_analytique_3" />
		</LEFTJOININDICATOR>
		<LEFTJOININDICATOR label="Section analytique 4" leftjoin="JOIN compta.v_ecritures_sections_analytiques_4_1 ON v_ecritures_sections_analytiques_4_1.to_section_analytique_4_id = v_historique_ecritures_1.section_analytique_4_id">
			<FIELD name="section_analytique_4" />
		</LEFTJOININDICATOR>
		<LEFTJOININDICATOR label="Section analytique 5" leftjoin="JOIN compta.v_ecritures_sections_analytiques_5_1 ON v_ecritures_sections_analytiques_5_1.to_section_analytique_5_id = v_historique_ecritures_1.section_analytique_5_id">
			<FIELD name="section_analytique_5" />
		</LEFTJOININDICATOR>
		<LEFTJOININDICATOR label="Section analytique 6" leftjoin="JOIN compta.v_ecritures_sections_analytiques_6_1 ON v_ecritures_sections_analytiques_6_1.to_section_analytique_6_id = v_historique_ecritures_1.section_analytique_6_id">
			<FIELD name="section_analytique_6" />
		</LEFTJOININDICATOR>
        <LEFTJOININDICATOR label="Section analytique 7" leftjoin="JOIN compta.v_ecritures_sections_analytiques_7_1 ON v_ecritures_sections_analytiques_7_1.to_section_analytique_7_id = v_historique_ecritures_1.section_analytique_7_id">
			<FIELD name="section_analytique_7" />
		</LEFTJOININDICATOR>
        <LEFTJOININDICATOR label="Section analytique 8" leftjoin="JOIN compta.v_ecritures_sections_analytiques_8_1 ON v_ecritures_sections_analytiques_8_1.to_section_analytique_8_id = v_historique_ecritures_1.section_analytique_8_id">
			<FIELD name="section_analytique_8" />
		</LEFTJOININDICATOR>
        <LEFTJOININDICATOR label="Section analytique 9" leftjoin="JOIN compta.v_ecritures_sections_analytiques_9_1 ON v_ecritures_sections_analytiques_9_1.to_section_analytique_9_id = v_historique_ecritures_1.section_analytique_9_id">
			<FIELD name="section_analytique_9" />
		</LEFTJOININDICATOR>
		
	</VIEWNAMEOPTIMIZER> 	
	
	<VIEWNAMEOPTIMIZER 
        viewName="INDICATEURS_v_historique_ecritures_1#4" 
        defaultViewName="compta.v_historique_ecritures_total_2 v_historique_ecritures_2" 
        qualifiedName="v_historique_ecritures_2"
        label="Ecritures comptables">
        <FIELD name="date_reference" column_name="date(v_historique_ecritures_2.mois_comptable || '01')" column_name_calc="true" />
	</VIEWNAMEOPTIMIZER>
    
    <VIEWNAMEOPTIMIZER 
        viewName="INDICATEURS_v_historique_ecritures_1_budget#4" 
        defaultViewName="compta.v_historique_ecritures_total_2 v_historique_ecritures_2" 
        qualifiedName="v_historique_ecritures_2"
        label="Ecritures comptables">
        <FIELD name="date_reference" column_name="date(v_historique_ecritures_2.mois_comptable || '01')" column_name_calc="true" />
	</VIEWNAMEOPTIMIZER>
</DBOPTIMIZER>

			
