<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="ACTI000089" label="Activité. Clients 'Honoraire'" title="= 'Comptes clients Honoraire par ' +  SELECT.GROUPBY_LABEL + ' (Période comptable : ' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'" database="iCTI" swf="*CTI_view1" softCode="iCTI_activite" globals="ACTI_globals.XML" componentsFile="ACTI_components.XML" 
    helpFile="iCTI_ACTI_ACTI000089.HTML"
    helpDokuWIkiDir="activite:compte_client:comptes _clients_honoraire" 
    helpDokuWIkiFile="acti000089" 
>
    
	<VIEWPROPERTIES componentName="PROPERTIES_COMPTE_CLIENT_H"/>
	
	<SELECTIONS label="Paramètres de l'analyse" displayText="= var display:String = '';
					
					if (SELECT.PERIODEV  != '0001-01-01' || SELECT.TOPERIODEV  != '2099-12-31') {
						if (SELECT.PERIODEV  == '0001-01-01') {
							display = display + 'Date ventes : #B#jusqu à ' + SELECT.TOPERIODEV_LABEL + '#/B#';
						}
						else {
							if (SELECT.TOPERIODEV  == '2099-12-31') {
								display = display + 'Date ventes : #B#A partir de ' + SELECT.PERIODEV_LABEL + '#/B#';
							}
							else {
								display = display + 'Date ventes : #B#Entre ' + SELECT.PERIODEV_LABEL + ' et ' + SELECT.TOPERIODEV_LABEL + '#/B#';
							}
						}
					}
					if (SELECT.PERIODES  != '0001-01-01' || SELECT.TOPERIODES  != '2099-12-31') {
						if (SELECT.PERIODES  == '0001-01-01') {
							display = display + 'Date sortie : #B#jusqu à ' + SELECT.TOPERIODES_LABEL + '#/B#';
						}
						else {
							if (SELECT.TOPERIODES  == '2099-12-31') {
								display = display + 'Date sortie : #B#A partir de ' + SELECT.PERIODES_LABEL + '#/B#';
							}
							else {
								display = display + 'Date sortie : #B#Entre ' + SELECT.PERIODES_LABEL + ' et ' + SELECT.TOPERIODES_LABEL + '#/B#';
							}
						}
					}
					
					return display;
					">
		<GROUP label="Periode comptable">
			<FIELD name="PERIODE" label="" UI="combo" tree="true" width="200" default="2007-01-01" default2="200701">
				<OPTION dataLink="MOIS_D" dataField="date" data2Field="mois" treeLevelField="lvl" labelField="txt"/>
			</FIELD>
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2007-01-31" default2="200701">
				<OPTION dataLink="MOIS_F" dataField="date" data2Field="mois" treeLevelField="lvl" labelField="txt"/>
			</FIELD>
		</GROUP>
		<GROUP label="Periode ventes">
			<FIELD name="PERIODEV" label="" UI="combo" tree="true" width="200" default="0001-01-01">
				<OPTION label="Pas de sélection" data="0001-01-01"/>
				<OPTION dataLink="MOIS_D" dataField="date" data2Field="mois" treeLevelField="lvl" labelField="txt"/>
			</FIELD>
			<FIELD name="TOPERIODEV" label="à" UI="combo" tree="true" width="200" default="2099-12-31">
				<OPTION label="Pas de sélection" data="2099-12-31"/>
				<OPTION dataLink="MOIS_F" dataField="date" data2Field="mois" treeLevelField="lvl" labelField="txt"/>
			</FIELD>
		</GROUP>
		<GROUP label="Periode Sortie">
			<FIELD name="PERIODES" label="" UI="combo" tree="true" width="200" default="0001-01-01">
				<OPTION label="Pas de sélection" data="0001-01-01"/>
				<OPTION dataLink="MOIS_D" dataField="date" data2Field="mois" treeLevelField="lvl" labelField="txt"/>
			</FIELD>
			<FIELD name="TOPERIODES" label="à" UI="combo" tree="true" width="200" default="2099-12-31">
				<OPTION label="Pas de sélection" data="2099-12-31"/>
				<OPTION dataLink="MOIS_F" dataField="date" data2Field="mois" treeLevelField="lvl" labelField="txt"/>
			</FIELD>
		</GROUP>
		<GROUP>
			<FIELD name="GROUPBY" label="Regroupement" UI="combo" default="SER" width="200" tree="true">
				<OPTION label="CLIENTS_H_GROUPBY" data="" globalListProvider="CLIENTS_H_GROUPBY"/>
				<OPTION label="Mois sortie" data="MOIS" />
				<OPTION label="Mois ventes" data="MOIV" />
				<OPTION label="Mois comptable" data="MOIC" />
			</FIELD>
			<FIELD name="GROUPBY_TAB" label="Présentation" UI="combo" default="AUTO" visible="= SELECT.GROUPBY_2 != '-1' ">
				<OPTION label="Automatique" data="AUTO"/>
				<OPTION label="Arbre" data="TREE"/>
				<OPTION label="Onglet" data="TAB"/>
			</FIELD>
		</GROUP>
		<GROUP>
			<FIELD name="GROUPBY_2" label="" UI="combo" default="-1" width="200" tree="true">
				<OPTION label="" data="-1"/>
				<OPTION label="CLIENTS_H_GROUPBY" data="" globalListProvider="CLIENTS_H_GROUPBY"/>
				<OPTION label="Mois sortie" data="MOIS" />
				<OPTION label="Mois ventes" data="MOIV" />
				<OPTION label="Mois comptable" data="MOIC" />
			</FIELD>
		</GROUP>
		<GROUP label="Montants">
			<FIELD name="QSD" label="Solde début" UI="check" labelWidth="80" selectedValue="1" unselectedValue="0" default="1" showIfNotDefault="true"/>
			<FIELD name="QMC" label="Comptabilisé" UI="check" labelWidth="80" selectedValue="1" unselectedValue="0" default="1" showIfNotDefault="true"/>
			<FIELD name="QMR" label="Réglé" UI="check" labelWidth="40" selectedValue="1" unselectedValue="0" default="1" showIfNotDefault="true"/>
			<FIELD name="QSF" label="Solde fin" UI="check" labelWidth="60" selectedValue="1" unselectedValue="0" default="1" showIfNotDefault="true"/>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_CLIENTS_H_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_SEJOURS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_PASSAGES_SELECTIONS" />
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_SEJOURS_X">
				<select><![CDATA[		
					CTISELECT_TREE
					OPTIONS{NOTZERO=1}
					GROUPBY1{[VIEW.GROUPBY_OID_FIELD],, [VIEW.GROUPBY_COD_FIELD],, [VIEW.GROUPBY_TXT_FIELD]}
					GROUPBY1MODE{[GROUPBY_TAB]}
					GROUPBY2{[VIEW.GROUPBY_2_OID_FIELD],, [VIEW.GROUPBY_2_COD_FIELD],, [VIEW.GROUPBY_2_TXT_FIELD]}
					XSIGNIFDATAX{[VIEW.ACTIVITE_SIGNIFICATIVE_DATA],, [ACTIVITE_SIGNIFICATIVE_MODE],, [ACTIVITE_SIGNIFICATIVE_NUMBER]}
					INDICATORS{
						SUM(CASE WHEN date_comptable < '[PERIODE]' AND '[QSD]' = '1' THEN montant_comptabilise - montant_regle ELSE 0 END),,
						SUM(CASE WHEN date_comptable BETWEEN '[PERIODE]' AND '[TOPERIODE]' AND '[QMC]' = '1' THEN montant_comptabilise ELSE 0 END),,
						SUM(CASE WHEN date_comptable BETWEEN '[PERIODE]' AND '[TOPERIODE]' AND '[QMR]' = '1' THEN montant_regle ELSE 0 END),,
						SUM(CASE WHEN date_comptable <= '[TOPERIODE]' AND '[QSF]' = '1' THEN montant_comptabilise - montant_regle ELSE 0 END)
					}
					FROM activite.v_factures_soldes_h_3, #V_SEJOURS_X#
					WHERE date_comptable <= '[TOPERIODE]'
						AND v_factures_soldes_h_3.no_sejour = v_sejours_1.no_sejour
						AND date_vente BETWEEN '[PERIODEV]' AND '[TOPERIODEV]'
						AND date_fin_facture BETWEEN '[PERIODES]' AND '[TOPERIODES]'
					[VIEW.SEJOURS_SELECT]
					[VIEW.CLIENTS_MEDECIN_SELECT]
					[VIEW.CLIENTS_TIERS_SELECT]
					[VIEW.PASSAGES_SELECT]

			
				
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="SD"/>
					<FIELD name="MC"/>
					<FIELD name="MR"/>
					<FIELD name="SF"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="comboLink" name="MOIS_D" forRows="false">
			<SQL select="SELECT date, texte, mois, level FROM activite.v_calendrier_1 WHERE level IN ('1', '2')">
				<FIELDS>
					<FIELD name="date"/>
					<FIELD name="txt"/>
					<FIELD name="mois"/>
					<FIELD name="lvl"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="comboLink" name="MOIS_F" forRows="false">
			<SQL select="SELECT date, texte, mois, level FROM activite.v_calendrier_2 WHERE level IN ('1', '2')">
				<FIELDS>
					<FIELD name="date"/>
					<FIELD name="txt"/>
					<FIELD name="mois"/>
					<FIELD name="lvl"/>
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Justificatif séjours" shortLabel="Justificatif" view="ACTI000088.XML" componentName="COMPTE_CLIENT_H_BASE_VIEWLINK" component3Name="STANDARD_BASE_VIEWLINK">
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="Comptes clients honoraire" label="Comptes clients 'Honoraire'" multiTab="true">
			<CHART title="Compte client (12 premiers)" type="columnChart" subType="overlaid" sortField="COD" sortSeq="A" 
				maxItems="12" maxItemsSortOn="MC" maxItemsSortSeq="D" 
				condition="ROW.LVL == '1'"
				visibleCondition="SELECT.QMC == '1' &amp;&amp; SELECT.QMR == '1'" >
				<CATEGORY field="TXT" type="Char"/>
				<SERIE field="MC" displayName="Comptabilisé"/>
				<SERIE field="MRM" displayName="Réglé"/>
			</CHART>
			<CHART title="Montant comptabilisé (12 premiers)" type="columnChart" subType="overlaid" sortField="COD" sortSeq="A" 
				maxItems="12" maxItemsSortOn="MC" maxItemsSortSeq="D" 
				condition="ROW.LVL == '1'"
				visibleCondition="SELECT.QMC == '1' &amp;&amp; SELECT.QMR != '1'" >
				<CATEGORY field="TXT" type="Char"/>
				<SERIE field="MC" displayName="Comptabilisé"/>
			</CHART>
			<CHART title="Montant réglé (12 premiers)" type="columnChart" subType="overlaid" sortField="COD" sortSeq="A" 
				maxItems="12" maxItemsSortOn="MR" maxItemsSortSeq="D" 
				condition="ROW.LVL == '1'"
				visibleCondition="SELECT.QMC != '1' &amp;&amp; SELECT.QMR == '1'" >
				<CATEGORY field="TXT" type="Char"/>
				<SERIE field="MR" displayName="Comptabilisé"/>
			</CHART>
			<CHART title="Solde (12 premiers)" type="columnChart" subType="" sortField="COD" sortSeq="A" 
				maxItems="12" maxItemsSortOn="SF" maxItemsSortSeq="D" 
				condition="ROW.LVL == '1'"
				visibleCondition="SELECT.QSF == '1' &amp;&amp; SELECT.QSD == '1'" >
				<CATEGORY field="TXT" type="Char"/>
				<SERIE field="SD" displayName="Solde début"/>
				<SERIE field="SF" displayName="Solde fin"/>
			</CHART>
			<CHART title="Solde fin (12 premiers)" type="columnChart" subType="" sortField="COD" sortSeq="A" 
				maxItems="12" maxItemsSortOn="SF" maxItemsSortSeq="D" 
				condition="ROW.LVL == '1'"
				visibleCondition="SELECT.QSF == '1' &amp;&amp; SELECT.QSD != '1'" >
				<CATEGORY field="TXT" type="Char"/>
				<SERIE field="SF" displayName="Solde fin"/>
			</CHART>
			<CHART title="Solde début (12 premiers)" type="columnChart" subType="" sortField="COD" sortSeq="A" 
				maxItems="12" maxItemsSortOn="SD" maxItemsSortSeq="D" 
				condition="ROW.LVL == '1'"
				visibleCondition="SELECT.QSF != '1' &amp;&amp; SELECT.QSD == '1'" >
				<CATEGORY field="TXT" type="Char"/>
				<SERIE field="SD" displayName="Solde début"/>
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" headerHeight="48" variableRowHeight="true" sortable="= SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB'" selectRowInRows="= ROW.OID == '-9999997'" otherRowInRows="= ROW.OID == '-9999998'" totalRowInRows="= ROW.OID == '-9999999'">
				<INSERT name="DATAGRID_MULTITAB_STYLES"/>
				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD" width="80" type="Char" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="TOTAL">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES"/>
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="150" maxWidth="300" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" otherFunction="text" otherComplement="Autres">
				</COLUMN>
				<COLUMN dataField="SD" width="80" type="Number" visibleCondition="SELECT.QSD == '1'" outputFormat="#E" headerText="Solde début période" textAlign="right" totalFunction="sum" otherFunction="">
				</COLUMN>
				<COLUMN dataField="MC" width="80" type="Number" visibleCondition="SELECT.QMC == '1'" outputFormat="#E" headerText="Montant comptabilisé" textAlign="right" totalFunction="sum" otherFunction="">
				</COLUMN>
				<COLUMN dataField="MR" width="80" type="Number" visibleCondition="SELECT.QMR == '1'" outputFormat="#E" headerText="Montant réglé" textAlign="right" totalFunction="sum" otherFunction="">
				</COLUMN>
				<COLUMN dataField="MRM" width="80" type="Number" visibleCondition="SELECT.QMR == '1'" visible="false" outputFormat="#E" headerText="Montant réglé" textAlign="right" totalFunction="calc" otherFunction="" calc="true">
					<CALC formula="0 - ROW.MR"/>
				</COLUMN>
				<COLUMN dataField="SF" width="80" type="Number" visibleCondition="SELECT.QSF == '1'" outputFormat="#E" headerText="Solde fin période" textAlign="right" totalFunction="sum" otherFunction="">
				</COLUMN>
				<COLUMN dataField="SFP" type="Number" visibleCondition="SELECT.QSF == '1'" headerText="% solde/ Total" width="60" outputFormat="0%" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.SF / TOTALROW.SF * 100"/>
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
