<?xml version="1.0" encoding="utf-8"?>
<TTServerDataModel xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" QueryTypes="GENERIC,ASK,ANNEXE,MANUAL,ONLY_PARENT" SqlTypes="Text,StoredProcedure" 
		QueryParameterTypes="client_id,clients_table,
							branch_id,branches_table,
							company_id,companies_table,
							introducer_id,introducers_table,
							treaty_id,treaties_table,
							organisme_id,organismes_table,
							actor_id,actors_table,
							policy_id,policies_table,
							policy_situation_id,policies_situations_table,
							invoice_id,invoices_table,
							advance_id,advances_table,
							risk_id,risks_table,
							risk_situation_id,risk_situations_table,
							claim_id,claims_table,
							start_date,end_date,effect_date,variable_code" 
		xmlns="http://aria-si.ro">
  <Queries>
  
	<Query Key="DIF" L1="Input fields" L2="Champs entrée" Sql="select * from doc_input_fields where 1 = 2" SqlType="Text" QueryType="GENERIC">
      <Parameters>
      </Parameters>
    </Query>
  
    <Query Key="CLI" L1="Clients" L2="Clients" Sql="p_tt_clients" SqlType="StoredProcedure" QueryType="GENERIC">
      <Parameters>
        <Parameter Type="clients_table" DBParamName="@clients_table" />
      </Parameters>
    </Query>
	
	<Query Key="POL" L1="Policies situations" L2="Situations contrats" Sql="p_tt_policies_situations" SqlType="StoredProcedure" QueryType="GENERIC">

      <Parameters>
        <Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
      </Parameters>
	  
	  <CustomFields>
		<Field WordName="umr_third_party_liability" DBName="umr_value" L1="UMR Third party liability" L2="UMR Responsabilité civile générale" L3="">
			<Sql Type="StoredProcedure">
				<Text>p_tt_policies_variable_umr_value</Text>
				<Parameters>
					<Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
					<Parameter Type="variable_code" DBParamName="@variable_code">
						<DefaultValue>
							<StringValue>THPALIA</StringValue>
						</DefaultValue>
					</Parameter>
				</Parameters>
			</Sql>
			<DataRelations>
				<Relation ParentFieldName="pols_policy_situation_id" ChildFieldName="pols_policy_situation_id" />
			</DataRelations>
		</Field>
		
		<Field WordName="umr_personal_accident" DBName="umr_value" L1="UMR Personal accident" L2="UMR Individuelle accident" L3="">
			<Sql Type="StoredProcedure">
				<Text>p_tt_policies_variable_umr_value</Text>
				<Parameters>
					<Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
					<Parameter Type="variable_code" DBParamName="@variable_code">
						<DefaultValue>
							<StringValue>PERSACC</StringValue>
						</DefaultValue>
					</Parameter>
				</Parameters>
			</Sql>
			<DataRelations>
				<Relation ParentFieldName="pols_policy_situation_id" ChildFieldName="pols_policy_situation_id" />
			</DataRelations>
		</Field>
		
		<Field WordName="umr_fire" DBName="umr_value" L1="UMR Fire" L2="UMR Incendie" L3="">
			<Sql Type="StoredProcedure">
				<Text>p_tt_policies_variable_umr_value</Text>
				<Parameters>
					<Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
					<Parameter Type="variable_code" DBParamName="@variable_code">
						<DefaultValue>
							<StringValue>FIRE</StringValue>
						</DefaultValue>
					</Parameter>
				</Parameters>
			</Sql>
			<DataRelations>
				<Relation ParentFieldName="pols_policy_situation_id" ChildFieldName="pols_policy_situation_id" />
			</DataRelations>
		</Field>
		
	  </CustomFields>
	  
      <Queries>

        <Query Key="POLUMR" L1="Policies situations - UMR list " L2="Listes UMR des situations contrats" Sql="p_tt_policies_all_umr" SqlType="StoredProcedure" QueryType="GENERIC">
          <DataRelations>
            <Relation ParentFieldName="POL_pols_policy_situation_id" ChildFieldName="POLUMR_pols_policy_situation_id" />
          </DataRelations>
          <Parameters>
            <Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
          </Parameters>
          <Queries />
        </Query>

	  
        <Query Key="POLSI" L1="Policies situations - introducers " L2="Apporteurs des situations contrats" Sql="p_tt_policies_situations_introducers" SqlType="StoredProcedure" QueryType="GENERIC">
          <DataRelations>
            <Relation ParentFieldName="POL_pols_policy_situation_id" ChildFieldName="POLSI_polsi_policy_situation_id" />
          </DataRelations>
          <Parameters>
            <Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
          </Parameters>
          <Queries />
        </Query>
	  
	  
        <Query Key="POLV" L1="Policies situations variables (acquired)" L2="Variables des situations contrats (acquises)" Sql="p_tt_policies_situations_variables" SqlType="StoredProcedure" QueryType="GENERIC">
          <DataRelations>
            <Relation ParentFieldName="POL_pols_policy_situation_id" ChildFieldName="POLV_polv_policy_situation_id" />
          </DataRelations>
          <Parameters>
            <Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
            <Parameter Type="culture_code" DBParamName="@culture_code" />
          </Parameters>
          <Queries />
        </Query>
		
        <Query Key="POLVALL" L1="Policies situations variables (acquired or not)" L2="Variables des situations contrats (acquises ou pas)" Sql="p_tt_policies_situations_variables_all" SqlType="StoredProcedure" QueryType="GENERIC">
          <DataRelations>
			<!-- 
			Le champ POLVALL_polv_policy_situation_id est parfois null (pour les garanties qui ne sont pas acquises), car on a un left join.
			On utilise POLVALL_pols_policy_situation_id à la place.
			-->		  
            <Relation ParentFieldName="POL_pols_policy_situation_id" ChildFieldName="POLVALL_pols_policy_situation_id" />
          </DataRelations>
          <Parameters>
            <Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
            <Parameter Type="culture_code" DBParamName="@culture_code" />
          </Parameters>
          <Queries />
        </Query>
		
		
        <Query Key="INV" L1="Invoices" L2="Les quittances" Sql="p_tt_accounts_invoices" SqlType="StoredProcedure" QueryType="GENERIC">
          <DataRelations>
            <Relation ParentFieldName="POL_pols_policy_situation_id" ChildFieldName="INV_inv_policy_situation_id" />
          </DataRelations>
          <Parameters>
            <Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
			<Parameter Type="invoices_table" DBParamName="@invoices_table" />  <!--voir 0000911: Ajouter button telecharger quittance dans la page details de la quittance -->
          </Parameters>
          <Queries>



          </Queries>
        </Query>        
		
		<Query Key="POLRISV" L1="Policies and risks situations variables (acquired)" L2="Variables des situations contrats et risques (acquises)" Sql="p_tt_policies_risks_situations_variables" SqlType="StoredProcedure" QueryType="GENERIC">
          <DataRelations>
            <Relation ParentFieldName="POL_pols_policy_situation_id" ChildFieldName="POLRISV_polv_policy_situation_id" />
          </DataRelations>
          <Parameters>
            <Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
            <Parameter Type="culture_code" DBParamName="@culture_code" />
          </Parameters>
          <Queries />
        </Query>
		
		<Query Key="POLRISVALL" L1="Policies and risks situations variables (acquired or not)" L2="Variables des situations contrats et risques (acquises ou pas)" Sql="p_tt_policies_risks_situations_variables_all" SqlType="StoredProcedure" QueryType="GENERIC">
		
          <DataRelations>
			<!-- 
			Le champ POLRISVALL_polv_policy_situation_id est parfois null (pour les garanties qui ne sont pas acquises), car on a un left join.
			On utilise POLRISVALL_pols_policy_situation_id à la place.
			-->		  
		  
            <Relation ParentFieldName="POL_pols_policy_situation_id" ChildFieldName="POLRISVALL_pols_policy_situation_id" />
          </DataRelations>
          <Parameters>
            <Parameter Type="policies_situations_table" DBParamName="@policies_situations_table" />
            <Parameter Type="culture_code" DBParamName="@culture_code" />
          </Parameters>
          <Queries />
        </Query>

		
		<Query Key="RISS" L1="Risks situations" L2="Situations risques" Sql="p_tt_risks_situations" SqlType="StoredProcedure" QueryType="GENERIC">
          <DataRelations>
            <Relation ParentFieldName="POL_pols_policy_situation_id" ChildFieldName="RISS_riss_policy_situation_id" />
          </DataRelations>
          <Parameters>
            <Parameter Type="risk_situations_table" DBParamName="@risk_situations_table" /><!-- Acest parametru e facultativ, putem sa tinem cont doar de lista de situatii a riscului. Tabela totusi trebuie pasata chiar daca e goala-->
			<!--<Parameter Type="pol_policies_situations_table" DBParamName="@pol_policies_situations_table" /> -->
          </Parameters>
		  
          <Queries>
			
			<Query Key="RISV" L1="Risks situations variables (acquired)" L2="Variables des situations risques (acquises)" Sql="p_tt_risk_situations_variables" SqlType="StoredProcedure" QueryType="GENERIC">
			  <DataRelations>
				<Relation ParentFieldName="RISS_riss_risk_situation_id" ChildFieldName="RISV_risv_risk_situation_id" />
			  </DataRelations>
			  <Parameters>
				  <Parameter Type="risk_situations_table" DBParamName="@risk_situations_table" />
				  <Parameter Type="culture_code" DBParamName="@culture_code" />
			  </Parameters>
			  <Queries />
			</Query>
			
			<Query Key="RISVALL" L1="Risks situations variables (acquired or not)" L2="Variables des situations risques (acquises ou pas)" Sql="p_tt_risk_situations_variables_all" SqlType="StoredProcedure" QueryType="GENERIC">
			  <DataRelations>
			  
				<!-- 
				Le champ RISVALL_risv_risk_situation_id est parfois null (pour les garanties qui ne sont pas acquises), car on a un left join.
				On utilise RISVALL_riss_risk_situation_id à la place.
				-->
				<Relation ParentFieldName="RISS_riss_risk_situation_id" ChildFieldName="RISVALL_riss_risk_situation_id" />
			  </DataRelations>
			  <Parameters>
				  <Parameter Type="risk_situations_table" DBParamName="@risk_situations_table" />
				  <Parameter Type="culture_code" DBParamName="@culture_code" />
			  </Parameters>
			  <Queries />
			</Query>

			<Query Key="RCPLD" L1="Risks situations - drivers" L2="Conducteurs des situations risques" Sql="p_tt_dyn_risk_drivers" SqlType="StoredProcedure" QueryType="GENERIC">
			  <DataRelations>
				<Relation ParentFieldName="RISS_riss_risk_situation_id" ChildFieldName="RCPLD_rcpl_risk_situation_id" />
			  </DataRelations>
			  <Parameters>
				<Parameter Type="risk_situations_table" DBParamName="@risk_situations_table" />
			  </Parameters>
			  <Queries />
			</Query>		
			
		  </Queries>
        </Query>
		
      </Queries>
    </Query>
	
	
	<Query Key="PL" L1="Policies - last situation" L2="Contrats - dernière situation" Sql="p_tt_policies_last_situation" SqlType="StoredProcedure" QueryType="GENERIC">	
      <Parameters>
        <Parameter Type="policies_table" DBParamName="@policies_table" />
		<Parameter Type="invoices_table" DBParamName="@invoices_table" />
		<Parameter Type="advances_table" DBParamName="@advances_table" />
      </Parameters>
	  
	  <Queries>
		
		<Query Key="PLRISS" L1="Risks situations" L2="Situations risques" Sql="p_tt_risks_situations" SqlType="StoredProcedure" QueryType="GENERIC">
          <DataRelations>
            <Relation ParentFieldName="PL_pols_policy_id" ChildFieldName="PLRISS_riss_policy_id" />
          </DataRelations>
          <Parameters>
            <Parameter Type="risk_situations_table" DBParamName="@risk_situations_table" /><!-- Acest parametru e facultativ, putem sa tinem cont doar de lista de situatii a riscului. Tabela totusi trebuie pasata chiar daca e goala-->
			<!--<Parameter Type="pol_policies_situations_table" DBParamName="@pol_policies_situations_table" /> -->
          </Parameters>
		  
          <Queries>
			
			<Query Key="PLRISSI" L1="Selected invoices (risk variables only)" L2="Quittances sélectionnées (variables risque seulement)" 
					Sql="p_tt_invoices_risk_variables_sum_by_risk_situation_id_invoice_id" SqlType="StoredProcedure" QueryType="GENERIC">
			  <DataRelations>
				<Relation ParentFieldName="PLRISS_riss_risk_situation_id" ChildFieldName="PLRISSI_invris_risk_situation_id" />
			  </DataRelations>
			  <Parameters>
				<Parameter Type="invoices_table" DBParamName="@invoices_table" />
			  </Parameters>
			  <Queries />
			</Query>				
			
		  </Queries>
        </Query>		
		
	  </Queries>
	  
	</Query>
  </Queries>
</TTServerDataModel>