<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="ACTI000093" 
	label="Validation chiffrier comptable" 
	database="iCTI" 
	swf="*CTI_view1" 
	softCode="iCTI_compta"
	globals="COMPTA_globals.XML"
	admProvider="">
	<CACHE cachable="false" />
	<title><![CDATA[= 
			var title:String = ''
			
			if (SELECT.VAL_OPTION != 'V') {
				title = title + 'INValidation ';
			}
			else {
				title = title + 'Validation ';
			}
			title = title + ' chiffrier comptable ';
			
			if (SELECT.PERIODE != '-1') {
				if (SELECT.TOPERIODE != '-1') {
					title = title + ' de ' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL;
				}
				else {
					title = title + ' à partir de ' + SELECT.PERIODE_LABEL;
				}
			}
			else {
				if (SELECT.TOPERIODE != '-1') {
					title = title + ' jusque ' + SELECT.TOPERIODE_LABEL;
				}
			}
				
			
			return title;
		]]></title>
	<VIEWPROPERTIES>
	
		<PROPERTY name="CH_SELECT" >
			<value><![CDATA[
				[EVAL 

				if ('[CH]' != '-1') {
					return " AND clinique_honoraire = '[CH]'";
				}

				return '';
				EVAL]
				]]>
			</value>
		</PROPERTY>
				
		<PROPERTY name="SET_VALIDE" value="[EVAL 
												if ('[VAL_OPTION]' != 'V') {return '0';}
												return '1';
											EVAL]"/>

		
	</VIEWPROPERTIES>
	
	<SELECTIONS label="Paramètres">
	
		<GROUP label="Comptabilité">
			<FIELD name="CH" label="" UI="combo" width="250" default="C">
				<OPTION data="-1" label="Clinique &amp; Honoraires"/>
				<OPTION data="C" label="Clinique"/>
				<OPTION data="H" label="Honoraires"/>
			</FIELD>
		</GROUP>
		<GROUP label="Période">
			<FIELD name="MOIS" label="" UI="combo" tree="true" width="200" default="000101">
				<OPTION label="Pas de sélection" data="000101"/>
				<OPTION dataLink="MOIS" dataField="cod" labelField="txt" treeLevelField="lvl"/>
			</FIELD>
			<FIELD name="TOMOIS" label="" UI="combo" tree="true" width="200" default="209912">
				<OPTION label="Pas de sélection" data="209912"/>
				<OPTION dataLink="TOMOIS" dataField="cod" labelField="txt" treeLevelField="lvl"/>
			</FIELD>
		</GROUP>
		
		<GROUP label="Option">
			<FIELD name="VAL_OPTION" label="" UI="combo" width="200" default="V" >
				<OPTION label="Validation" data="V"/>
				<OPTION label="INValidation" data="IV"/>
			</FIELD>
		</GROUP>
		
	</SELECTIONS>
	
	<QUERIES> 
		
		<QUERY> 
			<SQL>
				<select><![CDATA[
							
							UPDATE compta.t_controle_chiffrier 
							SET valide = '[VIEW.SET_VALIDE]'
							WHERE mois_comptable BETWEEN [MOIS] AND [TOMOIS]
								[VIEW.CH_SELECT];
				
							
					
							SELECT 
								mois_comptable,
								clinique_honoraire,
								CASE WHEN valide = '1' THEN 'Mois Validé' ELSE 'Mois INValidé' END
							FROM compta.t_controle_chiffrier
							WHERE mois_comptable BETWEEN [MOIS] AND [TOMOIS]
								[VIEW.CH_SELECT]
							ORDER BY 1 DESC, 2;
							
					]]></select>
				<FIELDS>
					<FIELD name="MOIS" />
					<FIELD name="CH" />
					<FIELD name="VAL" />
				</FIELDS>
			</SQL>
			
			
		</QUERY>
		
		
		
		
		
		<QUERY type="comboLink" name="MOIS" forRows="false">
			<SQL>
				<select><![CDATA[
						SELECT substr(mois_comptable::text,1,4),substr(mois_comptable::text,1,4)||'00', substr(mois_comptable::text,1,4), '1'
						FROM compta.p_mois_comptables 
						GROUP BY 1
						UNION
						SELECT substr(mois_comptable::text,1,4), mois_comptable::text, texte, '2'
						FROM compta.p_mois_comptables 
						ORDER BY 1 DESC, 2
				]]></select>
				<FIELDS>
					<FIELD name="ann" />
					<FIELD name="cod" />
					<FIELD name="txt" />
					<FIELD name="lvl" />
				</FIELDS>
			</SQL>
		</QUERY>
		
		<QUERY type="comboLink" name="TOMOIS" forRows="false">
			<SQL>
				<select><![CDATA[
						SELECT substr(mois_comptable::text,1,4),substr(mois_comptable::text,1,4)||'99', substr(mois_comptable::text,1,4), '1'
						FROM compta.p_mois_comptables 
						GROUP BY 1
						UNION
						SELECT substr(mois_comptable::text,1,4), mois_comptable::text, texte, '2'
						FROM compta.p_mois_comptables 
						ORDER BY 1 DESC, 2 DESC
				]]></select>
				<FIELDS>
					<FIELD name="ann" />
					<FIELD name="cod" />
					<FIELD name="txt" />
					<FIELD name="lvl" />
				</FIELDS>
			</SQL>
		</QUERY>
		
		
			
	</QUERIES> 
	
	<CALCFIELDS>
	</CALCFIELDS>
	
	<PRESENTATION>
	
		<VIEWLINKS>
		
			
		</VIEWLINKS>
			
				
		
		
		<ONGLET excelLabel="Chiffrier Comptable" label="Chiffrier Comptable" queryNumber="0">
				
			<DATAGRID title="" total="false" headerHeight="54" printRatio="1">
														
				<COLUMN dataField="MOIS" type="Date" inputFormat="AAAAMM" outputFormat="MMMM YYYY" minWidth="80" visible="true" multiLine="key" headerText="Mois" textAlign="left" totalFunction="text" totalComplement="TOTAL"/>
				<COLUMN dataField="CH" type="Char" multiLine="key"  width="50" headerText="C/H" align="center"/>
				
				
				<COLUMN dataField="VAL"
					type="Char"
					minWidth="200"
					headerText="Etat validation"
					align="right">
				</COLUMN>
				
					
						
			</DATAGRID>
		
		</ONGLET>
		
		
		
				
	</PRESENTATION>
	
</VUE>

			
