<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000256" label="PMSI. Validation Chiffrier OVALIDE" database="iCTI" swf="*CTI_view1" softCode="iCTI_pmsi" helpDokuWIkiDir="" helpDokuWIkiFile="pmsi000256"  helpFile="iCTI_PMSI_PMSI000256.HTML">
	<CACHE cachable="false" />
	<title><![CDATA[= 
			var title:String = ''
			
			if (SELECT.VAL_OPTION == 'V') {
				title += 'Validation ';
			} else {
				title += 'IN-Validation ';
			}
			title += 'chiffrier OVALIDE ';
			
			return title;
	]]></title>
	<VIEWPROPERTIES>
		<PROPERTY name="SET_OID" value="[EVAL 
				if ('[VAL_OID]' != '-1') {
					return '[VAL_OID]';
				} else {
					return '';
				}
			EVAL]"/>
		<PROPERTY name="SET_VALIDE" value="[EVAL 
				if ('[VAL_OPTION]' == 'V') {
					return '1';
				} else {
					return '0';
				}
			EVAL]"/>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres">
		<GROUP label="Oid de l'import MCO">
			<FIELD name="VAL_OID" label="" UI="combo" width="200" default="-1" />
		</GROUP>
		<GROUP label="Option">
			<FIELD name="VAL_OPTION" label="" UI="combo" width="200" default="V" >
				<OPTION label="Validation" data="V"/>
				<OPTION label="IN-Validation" data="IV"/>
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<QUERIES>
		<QUERY label="">
			<SQL>
				<select><![CDATA[
				
					UPDATE pmsi.p_imports
					SET mat2a_ok = '[VIEW.SET_VALIDE]'
					WHERE oid = [VIEW.SET_OID]
					;
				
					SELECT
						to_char(date_debut, 'YYYY') AS annee,
						to_char(date_fin - '3 days'::interval, 'MM') AS mois,
						CASE WHEN mat2a_ok = 0 THEN 'IN-Validé' ELSE 'Validé' END AS mat2a_ok
					FROM pmsi.p_imports
					WHERE oid = [VIEW.SET_OID]
					;
				]]>
				</select>
				<FIELDS>
					<FIELD name="ANNEE" />
					<FIELD name="MOIS" />
					<FIELD name="VAL" />
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<ONGLET excelLabel="Chiffrier OVALIDE" label="Chiffrier OVALIDE">
			<DATAGRID title="" total="false" headerHeight="54" printRatio="1">
				<COLUMN dataField="ANNEE"
					type="Char"
					width="200"
					headerText="Année"
					align="right">
				</COLUMN>
				<COLUMN dataField="MOIS"
					type="Char"
					width="200"
					headerText="Mois"
					align="right">
				</COLUMN>
				<COLUMN dataField="VAL"
					type="Char"
					minWidth="200"
					headerText="Etat validation"
					align="right">
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
