<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="COMPTA000010" label="Chiffrier SHS" title="= 'Chiffrier SHS - ' + SELECT.CH_LABEL + ' (' + SELECT.ANNEE_D + '-' + SELECT.ANNEE_F + ')'" database="iCTI" swf="*CTI_view1" softCode="iCTI_compta" comptaProvider="shs" helpFile="iCTI_COMPTA_COMPTA000010.HTML">
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres">
		<GROUP label="Période">
			<FIELD name="ANNEE_D" label="" UI="combo" width="150" default="2006">
				<OPTION dataLink="ANNEES" dataField="annee" labelField="annee"/>
			</FIELD>
			<FIELD name="ANNEE_F" label="à" UI="combo" width="150" default="2008">
				<OPTION dataLink="ANNEES" dataField="annee" labelField="annee"/>
			</FIELD>
		</GROUP>
		<GROUP>
			<FIELD name="CH" label="C/H" UI="combo" width="150" default="C" printable="false">
				<OPTION data="C" label="Clinique"/>
				<OPTION data="H" label="Honoraires"/>
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<QUERIES>
		<QUERY>
			<SQL select="SELECT  clinique_honoraire, mois_comptable, montant_ventes, montant_reglements, montant_solde_client, montant_journaux, montant_journaux_13
						FROM compta.p_chiffrier_shs
						WHERE mois_comptable &gt;= [ANNEE_D]01 AND mois_comptable &lt;= [ANNEE_F]12
						AND clinique_honoraire = '[CH]'
						ORDER BY clinique_honoraire, mois_comptable">
				<FIELDS>
					<FIELD name="CH"/>
					<FIELD name="MOIS"/>
					<FIELD name="VEN"/>
					<FIELD name="REG"/>
					<FIELD name="CLI"/>
					<FIELD name="JRN"/>
					<FIELD name="JRN13"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY>
			<SQL select="SELECT '[CH]', p_calendrier_mois.mois,
								CASE WHEN p_calendrier_mois.mois = p_chiffrier_shs.mois_comptable THEN p_chiffrier_shs.montant_ventes ELSE 0 END AS M,
								CASE WHEN p_calendrier_mois.mois = p_chiffrier_shs_1.mois_comptable + 100 AND p_chiffrier_shs_1.mois_comptable &gt;= [ANNEE_D]01 THEN p_chiffrier_shs_1.montant_ventes ELSE 0 END AS M1,
								CASE WHEN p_calendrier_mois.mois = p_chiffrier_shs_2.mois_comptable + 200 AND p_chiffrier_shs_2.mois_comptable &gt;= [ANNEE_D]01 THEN p_chiffrier_shs_2.montant_ventes ELSE 0 END AS M2
							FROM base.p_calendrier_mois p_calendrier_mois 
								LEFT OUTER JOIN compta.p_chiffrier_shs p_chiffrier_shs ON p_calendrier_mois.mois = p_chiffrier_shs.mois_comptable AND p_chiffrier_shs.clinique_honoraire = '[CH]'
								LEFT OUTER JOIN compta.p_chiffrier_shs p_chiffrier_shs_1 ON p_calendrier_mois.mois = p_chiffrier_shs_1.mois_comptable + 100 AND p_chiffrier_shs_1.clinique_honoraire = '[CH]'
								LEFT OUTER JOIN compta.p_chiffrier_shs p_chiffrier_shs_2 ON p_calendrier_mois.mois = p_chiffrier_shs_2.mois_comptable + 200 AND p_chiffrier_shs_2.clinique_honoraire = '[CH]'
							WHERE annee = [ANNEE_F]
						
						ORDER BY mois">
				<FIELDS>
					<FIELD name="CH"/>
					<FIELD name="MOIS"/>
					<FIELD name="M"/>
					<FIELD name="M1"/>
					<FIELD name="M2"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY>
			<SQL select="SELECT '[CH]', p_calendrier_mois.mois,
								CASE WHEN p_calendrier_mois.mois = p_chiffrier_shs.mois_comptable THEN p_chiffrier_shs.montant_reglements ELSE 0 END AS M,
								CASE WHEN p_calendrier_mois.mois = p_chiffrier_shs_1.mois_comptable + 100 AND p_chiffrier_shs_1.mois_comptable &gt;= [ANNEE_D]01 THEN p_chiffrier_shs_1.montant_reglements ELSE 0 END AS M1,
								CASE WHEN p_calendrier_mois.mois = p_chiffrier_shs_2.mois_comptable + 200 AND p_chiffrier_shs_2.mois_comptable &gt;= [ANNEE_D]01 THEN p_chiffrier_shs_2.montant_reglements ELSE 0 END AS M2
							FROM base.p_calendrier_mois p_calendrier_mois 
								LEFT OUTER JOIN compta.p_chiffrier_shs p_chiffrier_shs ON p_calendrier_mois.mois = p_chiffrier_shs.mois_comptable AND p_chiffrier_shs.clinique_honoraire = '[CH]'
								LEFT OUTER JOIN compta.p_chiffrier_shs p_chiffrier_shs_1 ON p_calendrier_mois.mois = p_chiffrier_shs_1.mois_comptable + 100 AND p_chiffrier_shs_1.clinique_honoraire = '[CH]'
								LEFT OUTER JOIN compta.p_chiffrier_shs p_chiffrier_shs_2 ON p_calendrier_mois.mois = p_chiffrier_shs_2.mois_comptable + 200 AND p_chiffrier_shs_2.clinique_honoraire = '[CH]'
							WHERE annee = [ANNEE_F]
						
						ORDER BY mois">
				<FIELDS>
					<FIELD name="CH"/>
					<FIELD name="MOIS"/>
					<FIELD name="M"/>
					<FIELD name="M1"/>
					<FIELD name="M2"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY>
			<SQL select="SELECT '[CH]', p_calendrier_mois.mois,
								CASE WHEN p_calendrier_mois.mois = p_chiffrier_shs.mois_comptable THEN p_chiffrier_shs.montant_solde_client ELSE 0 END AS M,
								CASE WHEN p_calendrier_mois.mois = p_chiffrier_shs_1.mois_comptable + 100 AND p_chiffrier_shs_1.mois_comptable &gt;= [ANNEE_D]01 THEN p_chiffrier_shs_1.montant_solde_client ELSE 0 END AS M1,
								CASE WHEN p_calendrier_mois.mois = p_chiffrier_shs_2.mois_comptable + 200 AND p_chiffrier_shs_2.mois_comptable &gt;= [ANNEE_D]01 THEN p_chiffrier_shs_2.montant_solde_client ELSE 0 END AS M2
							FROM base.p_calendrier_mois p_calendrier_mois 
								LEFT OUTER JOIN compta.p_chiffrier_shs p_chiffrier_shs ON p_calendrier_mois.mois = p_chiffrier_shs.mois_comptable AND p_chiffrier_shs.clinique_honoraire = '[CH]'
								LEFT OUTER JOIN compta.p_chiffrier_shs p_chiffrier_shs_1 ON p_calendrier_mois.mois = p_chiffrier_shs_1.mois_comptable + 100 AND p_chiffrier_shs_1.clinique_honoraire = '[CH]'
								LEFT OUTER JOIN compta.p_chiffrier_shs p_chiffrier_shs_2 ON p_calendrier_mois.mois = p_chiffrier_shs_2.mois_comptable + 200 AND p_chiffrier_shs_2.clinique_honoraire = '[CH]'
							WHERE annee = [ANNEE_F]
						
					ORDER BY mois">
				<FIELDS>
					<FIELD name="CH"/>
					<FIELD name="MOIS"/>
					<FIELD name="M"/>
					<FIELD name="M1"/>
					<FIELD name="M2"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forRows="false">
			<SQL select="SELECT DISTINCT 'V' || [ANNEE_F]  - annee, annee
							FROM base.p_calendrier_mois
							WHERE annee &gt;= [ANNEE_D] AND annee &lt;= [ANNEE_F]
						UNION
						SELECT DISTINCT 'R' || [ANNEE_F]  - annee, annee
							FROM base.p_calendrier_mois
							WHERE annee &gt;= [ANNEE_D] AND annee &lt;= [ANNEE_F]
						UNION
						SELECT DISTINCT 'C' || [ANNEE_F]  - annee, annee
							FROM base.p_calendrier_mois
							WHERE annee &gt;= [ANNEE_D] AND annee &lt;= [ANNEE_F]
						ORDER BY annee">
				<FIELDS>
					<FIELD name="name"/>
					<FIELD name="value"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="comboLink" name="ANNEES" forRows="false">
			<SQL select="SELECT DISTINCT annee 
						FROM base.p_calendrier_mois, compta.p_chiffrier_shs
						WHERE mois = mois_comptable
						ORDER BY annee DESC ">
				<FIELDS>
					<FIELD name="annee"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="dataLink" name="MOIS" forRows="false">
			<SQL select="SELECT DISTINCT mois, texte 
						FROM base.p_calendrier_mois, compta.p_chiffrier_shs
						WHERE mois = mois_comptable
						ORDER BY mois DESC ">
				<FIELDS>
					<FIELD name="mois"/>
					<FIELD name="texte"/>
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<CALCFIELDS>
	</CALCFIELDS>
	<PRESENTATION>
		<LINKS>
		</LINKS>
		<ONGLET label="Ventes" queryNumber="1" chartsPercentHeight="98">
			<CHART title="Comparatif des ventes" type="columnChart" maxItems="12" sortField="MOIS" sortSeq="A">
				<CATEGORY field="MOIS" type="Date" displayName="Mois" valueName="Montant ventes" inputFormat="AAAAMM" outputFormat="MMM"/>
				<SERIE field="M2" displayName="VIEW.V2" displayNameCalc="true" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 2"/>
				<SERIE field="M1" displayName="VIEW.V1" displayNameCalc="true" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 1"/>
				<SERIE field="M" displayName="VIEW.V0" displayNameCalc="true"/>
			</CHART>
			<DATAGRID title="" key="MOIS" keySeq="A" headerHeight="36" printRatio="1">
				<COLUMN dataField="MOIS" type="Date" inputFormat="AAAAMM" outputFormat="MMMM" minWidth="120" visible="true" headerText="Mois" textAlign="left"/>
				<COLUMN dataField="M2" type="Number" outputFormat="#" width="120" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 2" headerText="VIEW.V2" headerTextCalc="true" align="right"/>
				<COLUMN dataField="M1M2" type="Number" outputFormat="#" width="100" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 2" headerText="'Ecart ' + VIEW.V1 + ' - ' + VIEW.V2" headerTextCalc="true" align="right" calc="true">
					<CALC dataField="M1"/>
					<CALC dataField="M2" operator="-"/>
				</COLUMN>
				<COLUMN dataField="M1" type="Number" outputFormat="#" width="120" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 1" headerText="VIEW.V1" headerTextCalc="true" align="right"/>
				<COLUMN dataField="M0M1" type="Number" outputFormat="#" width="100" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 1" headerText="'Ecart ' + VIEW.V0 + ' - ' + VIEW.V1" headerTextCalc="true" align="right" calc="true">
					<CALC dataField="M"/>
					<CALC dataField="M1" operator="-"/>
				</COLUMN>
				<COLUMN dataField="M" type="Number" outputFormat="#" width="120" headerText="VIEW.V0" headerTextCalc="true" align="right"/>
			</DATAGRID>
		</ONGLET>
		<ONGLET label="Règlements" queryNumber="2" chartsPercentHeight="98">
			<CHART title="Comparatif des règlements" type="columnChart" maxItems="12" sortField="MOIS" sortSeq="A">
				<CATEGORY field="MOIS" type="Date" displayName="Mois" valueName="Montant règlements" inputFormat="AAAAMM" outputFormat="MMM"/>
				<SERIE field="M2" displayName="VIEW.R2" displayNameCalc="true" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 2"/>
				<SERIE field="M1" displayName="VIEW.R1" displayNameCalc="true" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 1"/>
				<SERIE field="M" displayName="VIEW.R0" displayNameCalc="true"/>
			</CHART>
			<DATAGRID title="" key="MOIS" keySeq="A" headerHeight="36" printRatio="1">
				<COLUMN dataField="MOIS" type="Date" inputFormat="AAAAMM" outputFormat="MMMM" minWidth="80" visible="true" headerText="Mois" textAlign="left"/>
				<COLUMN dataField="M2" type="Number" outputFormat="#" width="120" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 2" headerText="VIEW.R2" headerTextCalc="true" align="right"/>
				<COLUMN dataField="M1M2" type="Number" outputFormat="#" width="100" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 2" headerText="'Ecart ' + VIEW.R1 + ' - ' + VIEW.R2" headerTextCalc="true" align="right" calc="true">
					<CALC dataField="M1"/>
					<CALC dataField="M2" operator="-"/>
				</COLUMN>
				<COLUMN dataField="M1" type="Number" outputFormat="#" width="120" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 1" headerText="VIEW.R1" headerTextCalc="true" align="right"/>
				<COLUMN dataField="M0M1" type="Number" outputFormat="#" width="100" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 1" headerText="'Ecart ' + VIEW.R0 + ' - ' + VIEW.R1" headerTextCalc="true" align="right" calc="true">
					<CALC dataField="M"/>
					<CALC dataField="M1" operator="-"/>
				</COLUMN>
				<COLUMN dataField="M" type="Number" outputFormat="#" width="120" headerText="VIEW.R0" headerTextCalc="true" align="right"/>
			</DATAGRID>
		</ONGLET>
		<ONGLET label="Solde clients" queryNumber="3" chartsPercentHeight="98">
			<CHART title="Comparatif des soldes clients" type="columnChart" maxItems="12" sortField="MOIS" sortSeq="A">
				<CATEGORY field="MOIS" type="Date" displayName="Mois" valueName="Montant solde client" inputFormat="AAAAMM" outputFormat="MMM"/>
				<SERIE field="M2" displayName="VIEW.C2" displayNameCalc="true" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 2"/>
				<SERIE field="M1" displayName="VIEW.C1" displayNameCalc="true" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 1"/>
				<SERIE field="M" displayName="VIEW.C0" displayNameCalc="true"/>
			</CHART>
			<DATAGRID title="" key="MOIS" keySeq="A" headerHeight="36" printRatio="1">
				<COLUMN dataField="MOIS" type="Date" inputFormat="AAAAMM" outputFormat="MMMM" minWidth="80" visible="true" headerText="Mois" textAlign="left"/>
				<COLUMN dataField="M2" type="Number" outputFormat="#" width="120" visible="false" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 2" headerText="VIEW.C2" headerTextCalc="true" align="right"/>
				<COLUMN dataField="M1M2" type="Number" outputFormat="#" width="120" visible="false" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 2" headerText="'Ecart ' + VIEW.C1 + ' - ' + VIEW.C2" headerTextCalc="true" align="right" calc="true">
					<CALC dataField="M1"/>
					<CALC dataField="M2" operator="-"/>
				</COLUMN>
				<COLUMN dataField="M1" type="Number" outputFormat="#" width="120" visible="false" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 1" headerText="VIEW.C1" headerTextCalc="true" align="right"/>
				<COLUMN dataField="M0M1" type="Number" outputFormat="#" width="120" visible="false" visibleCondition="Number(SELECT.ANNEE_F) - Number(SELECT.ANNEE_D) &gt;= 1" headerText="'Ecart ' + VIEW.C0 + ' - ' + VIEW.C1" headerTextCalc="true" align="right" calc="true">
					<CALC dataField="M"/>
					<CALC dataField="M1" operator="-"/>
				</COLUMN>
				<COLUMN dataField="M" type="Number" outputFormat="#" width="120" headerText="VIEW.C0" headerTextCalc="true" align="right"/>
			</DATAGRID>
		</ONGLET>
		<ONGLET label="Détail">
			<CHART title="Ventes / règlements / clients 12 derniers mois" type="columnChart" sortField="MOIS" sortSeq="A" maxItems="12" maxItemsSortOn="MOIS" maxItemsSortSeq="D" condition="ROW.CLI != 0">
				<CATEGORY field="MOIS" type="Date" displayName="Mois" valueName="Montant" inputFormat="AAAAMM" outputFormat="MMM YY"/>
				<SERIE field="VEN" displayName="Ventes"/>
				<SERIE field="REG" displayName="Règlements"/>
				<SERIE field="CLI" displayName="Clients"/>
			</CHART>
			<CHART title="Ventes / règlements / clients Historique" type="lineChart" sortField="MOIS" sortSeq="A" maxItems="72" maxItemsSortOn="MOIS" maxItemsSortSeq="D" condition="ROW.CLI != 0">
				<CATEGORY field="MOIS" type="Date" displayName="Mois" valueName="Montant" inputFormat="AAAAMM" outputFormat="MMM YY"/>
				<SERIE field="VEN" displayName="Ventes"/>
				<SERIE field="REG" displayName="Règlements"/>
				<SERIE field="CLI" displayName="Clients"/>
			</CHART>
			<CHART title="Total journaux 12 derniers mois" type="columnChart" subType="stacked" sortField="MOIS" sortSeq="A" maxItems="13" maxItemsSortOn="MOIS" maxItemsSortSeq="D" condition="ROW.JRN != 0">
				<CATEGORY field="MOIS" type="Date" displayName="Mois" valueName="Montant" inputFormat="AAAAMM" outputFormat="MMM YY"/>
				<SERIE field="JRN" displayName="Journaux"/>
				<SERIE field="JRN13" displayName="Journaux 13ème"/>
			</CHART>
			<DATAGRID title="" key="MOIS" keySeq="D" headerHeight="36" printRatio="1">
				<COLUMN dataField="MOIS" type="Date" inputFormat="AAAAMM" outputFormat="MMMM YYYY" minWidth="80" visible="true" headerText="Mois" textAlign="left"/>
				<COLUMN dataField="VEN" type="Number" outputFormat="#" width="120" headerText="Ventes" align="right"/>
				<COLUMN dataField="REG" type="Number" outputFormat="#" width="120" headerText="Règlements" align="right"/>
				<COLUMN dataField="CLI" type="Number" outputFormat="#" width="120" headerText="Solde client" align="right"/>
				<COLUMN dataField="JRN" type="Number" outputFormat="#" width="120" headerText="Total journaux" align="right"/>
				<COLUMN dataField="JRN13" type="Number" outputFormat="#" width="120" headerText="Total journaux / 13èmee" align="right"/>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
