<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="COMPTA000055" label="Liste des pièces déséquilibrées" title="= 'Comptabilité ' + SELECT.CH_LABEL + '. Liste des pièces déséquilibrées  (' + SELECT.MOIS_LABEL + ' - ' + SELECT.TOMOIS_LABEL + ')'" 
	database="iCTI" 
	swf="*CTI_view1" 
	globals="COMPTA_globals.XML" 
	dboptimizer="COMPTA_dboptimizer.XML" 
	componentsFile="COMPTA_components.XML" 
	softCode="iCTI_compta" 
	comptaProvider="sigems">
	<VIEWPROPERTIES>
		<PROPERTY name="INDICATEUR_SELECT" value="[EVAL 
						$select = '';
																		
						if ('[INDICATEUR]' != '-1') {
							$select = $select . 'AND ([VIEW.INDICATEUR_COLUMN]) &lt;&gt; 0 ' ;
						}
						
						return $select;
			EVAL]"/>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse" displayText="">
		<GROUP label="Comptabilité">
			<FIELD name="CH" label="" UI="combo" width="150" default="C">
				<OPTION data="C" label="Clinique"/>
				<OPTION data="H" label="Honoraires"/>
			</FIELD>
		</GROUP>
		<GROUP label="Période">
			<FIELD name="MOIS" label="" UI="combo" width="150" default="*FIRST" globalListProvider="MOIS">
			</FIELD>
			<FIELD name="TOMOIS" label="" UI="combo" width="150" default="*FIRST" globalListProvider="MOIS">
			</FIELD>
		</GROUP>
		
	</SELECTIONS>
	<SELECTIONS componentName="ECRITURES_SELECTIONS"/>
	<QUERIES>
		<QUERY>
			<SQL select="
			
					SELECT 
						v_historique_ecritures_1.piece,
						v_historique_ecritures_1.site_code,
						v_historique_ecritures_1.mois_comptable,
						v_historique_ecritures_1.journal_code,
						v_historique_ecritures_1.fin_exercice,
						v_historique_ecritures_1.ajustement,
						
						SUM(v_historique_ecritures_1.montant_debit),
						SUM(v_historique_ecritures_1.montant_credit), 
						SUM(v_historique_ecritures_1.montant_solde_debit)
					FROM compta.v_historique_ecritures_1
					WHERE v_historique_ecritures_1.mois_comptable BETWEEN [MOIS] AND [TOMOIS]
						[VIEW.ECRITURES_SELECT]
					GROUP BY 1,2,3,4,5,6
					HAVING SUM(v_historique_ecritures_1.montant_debit) &lt;&gt; SUM(v_historique_ecritures_1.montant_credit)

					ORDER BY 1 ">
				<FIELDS>
					<FIELD name="PIE"/>
					<FIELD name="SIT"/>
					<FIELD name="MOI"/>
					<FIELD name="JRN"/>
					<FIELD name="Q13"/>
					<FIELD name="QAJ"/>
					
					<FIELD name="DEB"/>
					<FIELD name="CRE"/>
					<FIELD name="SOL"/>
					<FIELD name="IND"/>
				</FIELDS>
			</SQL>
			<SQL select="

					SELECT 
 						count(*),
						SUM(subview.montant_solde_debit),
						-9999999
					FROM 
						(
							SELECT 
								v_historique_ecritures_1.piece,
								v_historique_ecritures_1.site_code,
								v_historique_ecritures_1.mois_comptable,
								v_historique_ecritures_1.journal_code,
								v_historique_ecritures_1.fin_exercice,
								v_historique_ecritures_1.ajustement,
								
								SUM(v_historique_ecritures_1.montant_debit) ,
								SUM(v_historique_ecritures_1.montant_credit), 
								SUM(v_historique_ecritures_1.montant_solde_debit) AS montant_solde_debit
							FROM compta.v_historique_ecritures_1
							WHERE v_historique_ecritures_1.mois_comptable BETWEEN [MOIS] AND [TOMOIS]
								[VIEW.ECRITURES_SELECT]
							GROUP BY 1,2,3,4,5,6
							HAVING SUM(v_historique_ecritures_1.montant_debit) &lt;&gt; SUM(v_historique_ecritures_1.montant_credit)
						) subview
					">
				<FIELDS>
					<FIELD name="PIE"/>
					<FIELD name="SOL"/>
					<FIELD name="MOI"/>
				</FIELDS>
			</SQL>
		</QUERY>
		
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Liste des écritures" shortLabel="Ecritures" view="COMPTA000025.XML" componentName="ECRITURES_VIEWLINK">
				<ARG name="MOIS" value="return ROW.MOIS;"/>
				<ARG name="TOMOIS" value="return ROW.MOIS;"/>
				<ARG name="PIECE" value="return ROW.PIE"/>
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="Pièces déséquilibrées" label="Pièces déséquilibrées">
			<DATAGRID title="" total="true" headerHeight="36" variableRowHeight="true" totalRowInRows="= ROW.MOI == '-9999999'">
				<COLUMN dataField="MOI" type="Date" inputFormat="AAAAMM" outputFormat="MM/YYYY" width="70" visible="true" headerText="Mois comptable" textAlign="left"/>
				<COLUMN dataField="SIT" type="Char" width="40" visible="true" headerText="Site" textAlign="left" totalFunction="text" totalComplement="">
				</COLUMN>
				<COLUMN dataField="PIE" type="Char" width="80" visible="true" headerText="Pièce" textAlign="left">
					<CELLSTYLE name="cellIndicator" value="circle, 5, right top, 0x0000FF" condition="ROW.Q13 == '1'"/>
					<CELLSTYLE name="cellIndicator" value="circle, 5, right top, 0xFF6600" condition="ROW.QAJ == '1' || ROW.QAJ == '2'"/>
				</COLUMN>
				<COLUMN dataField="JRN" type="Char" width="50" visible="true" headerText="Jrn"/>
				<COLUMN dataField="DEB" type="Number" outputFormat="#,00E" width="100" headerText="Débit" align="right" totalFunction="sum"/>
				<COLUMN dataField="CRE" type="Number" outputFormat="#,00 E" width="90" headerText="Crédit" align="right" totalFunction="sum"/>
				<COLUMN dataField="SOL" type="Number" outputFormat="#,00E" width="100" headerText="Solde" align="right" totalFunction="sum"/>
				<COLUMN dataField="QAJ" type="Char" width="0" visible="false"/>
				<COLUMN dataField="Q13" type="Char" width="0" visible="false"/>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
