<?php
// This script and data application were generated by AppGini 5.76
// Download AppGini for free from https://bigprof.com/appgini/download/

	/* Configuration */
	/*************************************/

		$pcConfig = array(
			'main' => array(   
			),
			'dossier_individuel' => array(   
			),
			'gestion_salaire' => array(   
				'matricule' => array(   
					'parent-table' => 'dossier_individuel',
					'parent-primary-key' => 'iddindividuel',
					'child-primary-key' => 'idgestion_salaire',
					'child-primary-key-index' => 0,
					'tab-label' => 'SALAIRES <span class="hidden child-label-gestion_salaire child-field-caption">(MATRICULE)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/coins_in_hand.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(1 => 'Date', 3 => 'Nom prenom', 4 => 'Fonction', 5 => 'Salaire', 6 => 'Compte', 7 => 'Banque', 8 => 'Mois', 9 => 'Ann&#233;e'),
					'display-field-names' => array(1 => 'date_salaire', 3 => 'nom_prenom', 4 => 'fonction', 5 => 'salaire', 6 => 'compte', 7 => 'banque', 8 => 'mois', 9 => 'annee'),
					'sortable-fields' => array(0 => '`gestion_salaire`.`idgestion_salaire`', 1 => '`gestion_salaire`.`date_salaire`', 2 => '`dossier_individuel1`.`matricule`', 3 => '`dossier_individuel1`.`nom_prenom`', 4 => 5, 5 => '`gestion_salaire`.`salaire`', 6 => '`dossier_individuel1`.`compte`', 7 => 8, 8 => 9, 9 => 10),
					'records-per-page' => 10,
					'default-sort-by' => 1,
					'default-sort-direction' => 'desc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-gestion_salaire',
					'template-printable' => 'children-gestion_salaire-printable',
					'query' => "SELECT `gestion_salaire`.`idgestion_salaire` as 'idgestion_salaire', if(`gestion_salaire`.`date_salaire`,date_format(`gestion_salaire`.`date_salaire`,'%d/%m/%Y'),'') as 'date_salaire', IF(    CHAR_LENGTH(`dossier_individuel1`.`matricule`), CONCAT_WS('',   `dossier_individuel1`.`matricule`), '') as 'matricule', IF(    CHAR_LENGTH(`dossier_individuel1`.`nom_prenom`), CONCAT_WS('',   `dossier_individuel1`.`nom_prenom`), '') as 'nom_prenom', IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') as 'fonction', REPLACE(FORMAT(`gestion_salaire`.`salaire`, 0), ',', ' ') as 'salaire', IF(    CHAR_LENGTH(`dossier_individuel1`.`compte`), CONCAT_WS('',   `dossier_individuel1`.`compte`), '') as 'compte', IF(    CHAR_LENGTH(`les_banques1`.`banque`), CONCAT_WS('',   `les_banques1`.`banque`), '') as 'banque', `gestion_salaire`.`mois` as 'mois', `gestion_salaire`.`annee` as 'annee' FROM `gestion_salaire` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`gestion_salaire`.`matricule` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`dossier_individuel1`.`fonction` LEFT JOIN `les_banques` as les_banques1 ON `les_banques1`.`id`=`dossier_individuel1`.`banque` "
				)
			),
			'gestion_prime' => array(   
				'matricule' => array(   
					'parent-table' => 'dossier_individuel',
					'parent-primary-key' => 'iddindividuel',
					'child-primary-key' => 'idgestion_prime',
					'child-primary-key-index' => 0,
					'tab-label' => 'PRIMES <span class="hidden child-label-gestion_prime child-field-caption">(MATRICULE)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/coin_stack_gold.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(1 => 'Date', 3 => 'Nom prenom', 4 => 'Fonction', 5 => 'Prime', 6 => 'Compte', 7 => 'Banque', 8 => 'MOIS', 9 => 'ANNEE'),
					'display-field-names' => array(1 => 'date_prime', 3 => 'nom_prenom', 4 => 'fonction', 5 => 'prime', 6 => 'compte', 7 => 'banque', 8 => 'mois', 9 => 'annee'),
					'sortable-fields' => array(0 => '`gestion_prime`.`idgestion_prime`', 1 => '`gestion_prime`.`date_prime`', 2 => '`dossier_individuel1`.`matricule`', 3 => '`dossier_individuel1`.`nom_prenom`', 4 => 5, 5 => '`gestion_prime`.`prime`', 6 => '`dossier_individuel1`.`compte`', 7 => 8, 8 => 9, 9 => 10),
					'records-per-page' => 10,
					'default-sort-by' => 1,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-gestion_prime',
					'template-printable' => 'children-gestion_prime-printable',
					'query' => "SELECT `gestion_prime`.`idgestion_prime` as 'idgestion_prime', if(`gestion_prime`.`date_prime`,date_format(`gestion_prime`.`date_prime`,'%d/%m/%Y'),'') as 'date_prime', IF(    CHAR_LENGTH(`dossier_individuel1`.`matricule`), CONCAT_WS('',   `dossier_individuel1`.`matricule`), '') as 'matricule', IF(    CHAR_LENGTH(`dossier_individuel1`.`nom_prenom`), CONCAT_WS('',   `dossier_individuel1`.`nom_prenom`), '') as 'nom_prenom', IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') as 'fonction', REPLACE(FORMAT(`gestion_prime`.`prime`, 0), ',', ' ') as 'prime', IF(    CHAR_LENGTH(`dossier_individuel1`.`compte`), CONCAT_WS('',   `dossier_individuel1`.`compte`), '') as 'compte', IF(    CHAR_LENGTH(`les_banques1`.`banque`), CONCAT_WS('',   `les_banques1`.`banque`), '') as 'banque', `gestion_prime`.`mois` as 'mois', `gestion_prime`.`annee` as 'annee' FROM `gestion_prime` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`gestion_prime`.`matricule` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`dossier_individuel1`.`fonction` LEFT JOIN `les_banques` as les_banques1 ON `les_banques1`.`id`=`dossier_individuel1`.`banque` "
				)
			),
			'paiements' => array(   
			),
			'etat_paiements' => array(   
				'from_paiements' => array(   
					'parent-table' => 'paiements',
					'parent-primary-key' => 'id_paiement',
					'child-primary-key' => 'id_etat_paiement',
					'child-primary-key-index' => 0,
					'tab-label' => 'Etat paiements <span class="hidden child-label-etat_paiements child-field-caption">(From paiements)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/coins_in_hand.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(2 => 'MATRICULE', 3 => 'NOM ET PRENOM', 4 => 'FONCTION', 6 => 'MONTANT', 9 => 'N&#176; COMPTE', 10 => 'BANQUE'),
					'display-field-names' => array(2 => 'matricule', 3 => 'nom_prenom', 4 => 'fonction', 6 => 'montant', 9 => 'n_compte', 10 => 'banque'),
					'sortable-fields' => array(0 => '`etat_paiements`.`id_etat_paiement`', 1 => '`paiements1`.`to_etat_paiements`', 2 => '`dossier_individuel1`.`matricule`', 3 => '`dossier_individuel1`.`nom_prenom`', 4 => 5, 5 => 6, 6 => '`etat_paiements`.`montant`', 7 => '`etat_paiements`.`qte`', 8 => '`etat_paiements`.`total`', 9 => '`dossier_individuel1`.`compte`', 10 => 11),
					'records-per-page' => 10,
					'default-sort-by' => 0,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-etat_paiements',
					'template-printable' => 'children-etat_paiements-printable',
					'query' => "SELECT `etat_paiements`.`id_etat_paiement` as 'id_etat_paiement', IF(    CHAR_LENGTH(`paiements1`.`to_etat_paiements`), CONCAT_WS('',   `paiements1`.`to_etat_paiements`), '') as 'from_paiements', IF(    CHAR_LENGTH(`dossier_individuel1`.`matricule`), CONCAT_WS('',   `dossier_individuel1`.`matricule`), '') as 'matricule', IF(    CHAR_LENGTH(`dossier_individuel1`.`nom_prenom`), CONCAT_WS('',   `dossier_individuel1`.`nom_prenom`), '') as 'nom_prenom', IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') as 'fonction', IF(    CHAR_LENGTH(`dossier_individuel1`.`prime_ts`), CONCAT_WS('',   `dossier_individuel1`.`prime_ts`), '') as 'prime', `etat_paiements`.`montant` as 'montant', `etat_paiements`.`qte` as 'qte', `etat_paiements`.`total` as 'total', IF(    CHAR_LENGTH(`dossier_individuel1`.`compte`), CONCAT_WS('',   `dossier_individuel1`.`compte`), '') as 'n_compte', IF(    CHAR_LENGTH(`les_banques1`.`banque`), CONCAT_WS('',   `les_banques1`.`banque`), '') as 'banque' FROM `etat_paiements` LEFT JOIN `paiements` as paiements1 ON `paiements1`.`id_paiement`=`etat_paiements`.`from_paiements` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`etat_paiements`.`matricule` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`dossier_individuel1`.`fonction` LEFT JOIN `les_banques` as les_banques1 ON `les_banques1`.`id`=`dossier_individuel1`.`banque` "
				)
			),
			'banques' => array(   
			),
			'etat_banques' => array(   
				'from_banque' => array(   
					'parent-table' => 'banques',
					'parent-primary-key' => 'id_banque',
					'child-primary-key' => 'id_etat_banque',
					'child-primary-key-index' => 0,
					'tab-label' => 'ETAT BANQUES <span class="hidden child-label-etat_banques child-field-caption">(From banque)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/card_bank.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(2 => 'Matricule', 3 => 'Nom prenom', 4 => 'Fonction', 6 => 'MONTANT', 9 => 'N compte', 10 => 'Banque'),
					'display-field-names' => array(2 => 'matricule', 3 => 'nom_prenom', 4 => 'fonction', 6 => 'montant', 9 => 'n_compte', 10 => 'banque'),
					'sortable-fields' => array(0 => '`etat_banques`.`id_etat_banque`', 1 => '`banques1`.`to_etat_banques`', 2 => '`dossier_individuel1`.`matricule`', 3 => '`dossier_individuel1`.`nom_prenom`', 4 => 5, 5 => '`dossier_individuel1`.`salaire`', 6 => '`etat_banques`.`montant`', 7 => '`etat_banques`.`qte`', 8 => '`etat_banques`.`total`', 9 => '`dossier_individuel1`.`compte`', 10 => 11),
					'records-per-page' => 10,
					'default-sort-by' => 0,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-etat_banques',
					'template-printable' => 'children-etat_banques-printable',
					'query' => "SELECT `etat_banques`.`id_etat_banque` as 'id_etat_banque', IF(    CHAR_LENGTH(`banques1`.`to_etat_banques`), CONCAT_WS('',   `banques1`.`to_etat_banques`), '') as 'from_banque', IF(    CHAR_LENGTH(`dossier_individuel1`.`matricule`), CONCAT_WS('',   `dossier_individuel1`.`matricule`), '') as 'matricule', IF(    CHAR_LENGTH(`dossier_individuel1`.`nom_prenom`), CONCAT_WS('',   `dossier_individuel1`.`nom_prenom`), '') as 'nom_prenom', IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') as 'fonction', IF(    CHAR_LENGTH(`dossier_individuel1`.`salaire`), CONCAT_WS('',   `dossier_individuel1`.`salaire`), '') as 'salaire', `etat_banques`.`montant` as 'montant', REPLACE(FORMAT(`etat_banques`.`qte`, 0), ',', ' ') as 'qte', REPLACE(FORMAT(`etat_banques`.`total`, 0), ',', ' ') as 'total', IF(    CHAR_LENGTH(`dossier_individuel1`.`compte`), CONCAT_WS('',   `dossier_individuel1`.`compte`), '') as 'n_compte', IF(    CHAR_LENGTH(`les_banques1`.`banque`), CONCAT_WS('',   `les_banques1`.`banque`), '') as 'banque' FROM `etat_banques` LEFT JOIN `banques` as banques1 ON `banques1`.`id_banque`=`etat_banques`.`from_banque` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`etat_banques`.`matricule` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`dossier_individuel1`.`fonction` LEFT JOIN `les_banques` as les_banques1 ON `les_banques1`.`id`=`dossier_individuel1`.`banque` "
				)
			),
			'pointages' => array(   
			),
			'fiche_pointages' => array(   
				'from_pointage' => array(   
					'parent-table' => 'pointages',
					'parent-primary-key' => 'id_pointages',
					'child-primary-key' => 'id_fiche_pointage',
					'child-primary-key-index' => 0,
					'tab-label' => 'POINTAGES <span class="hidden child-label-fiche_pointages child-field-caption">(From pointage)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/session_idle_time.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(2 => 'DATE', 3 => 'NOM ET PRENOM', 4 => 'FONCTION', 5 => 'NNI', 6 => 'HEURE / ARRIVEE', 7 => 'HEURE / DEPART', 8 => 'EMARGEMENT'),
					'display-field-names' => array(2 => 'date_fiche_pointage', 3 => 'nom_prenom_fp', 4 => 'fonction_fp', 5 => 'nni_fp', 6 => 'heure_arrive', 7 => 'heure_depart', 8 => 'emargement'),
					'sortable-fields' => array(0 => '`fiche_pointages`.`id_fiche_pointage`', 1 => '`pointages1`.`to_fiche_pointage`', 2 => '`fiche_pointages`.`date_fiche_pointage`', 3 => '`dossier_individuel1`.`nom_prenom`', 4 => 5, 5 => '`dossier_individuel1`.`nni`', 6 => '`fiche_pointages`.`heure_arrive`', 7 => '`fiche_pointages`.`heure_depart`', 8 => 9),
					'records-per-page' => 10,
					'default-sort-by' => 2,
					'default-sort-direction' => 'desc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-fiche_pointages',
					'template-printable' => 'children-fiche_pointages-printable',
					'query' => "SELECT `fiche_pointages`.`id_fiche_pointage` as 'id_fiche_pointage', IF(    CHAR_LENGTH(`pointages1`.`to_fiche_pointage`), CONCAT_WS('',   `pointages1`.`to_fiche_pointage`), '') as 'from_pointage', if(`fiche_pointages`.`date_fiche_pointage`,date_format(`fiche_pointages`.`date_fiche_pointage`,'%d/%m/%Y'),'') as 'date_fiche_pointage', IF(    CHAR_LENGTH(`dossier_individuel1`.`nom_prenom`), CONCAT_WS('',   `dossier_individuel1`.`nom_prenom`), '') as 'nom_prenom_fp', IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') as 'fonction_fp', IF(    CHAR_LENGTH(`dossier_individuel1`.`nni`), CONCAT_WS('',   `dossier_individuel1`.`nni`), '') as 'nni_fp', `fiche_pointages`.`heure_arrive` as 'heure_arrive', `fiche_pointages`.`heure_depart` as 'heure_depart', `fiche_pointages`.`emargement` as 'emargement' FROM `fiche_pointages` LEFT JOIN `pointages` as pointages1 ON `pointages1`.`id_pointages`=`fiche_pointages`.`from_pointage` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`fiche_pointages`.`nom_prenom_fp` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`dossier_individuel1`.`fonction` "
				)
			),
			'permissions' => array(   
			),
			'conges' => array(   
			),
			'demandes_permission' => array(   
			),
			'demandes_conge_m' => array(   
			),
			'demandes_permissions' => array(   
			),
			'demandes_conge_sg' => array(   
			),
			'conges_permissions' => array(   
			),
			'demandes_conge' => array(   
			),
			'cursus' => array(   
				'idinformation' => array(   
					'parent-table' => 'informations',
					'parent-primary-key' => 'idinformation',
					'child-primary-key' => 'idcursus',
					'child-primary-key-index' => 0,
					'tab-label' => 'CURSUS <span class="hidden child-label-cursus child-field-caption">(Idinformation)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/books.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(2 => 'ANN&#201;E', 3 => 'DUR&#201;E', 4 => 'EMPLOI / ACTIVIT&#201;', 5 => 'EMPLOYEUR', 6 => 'OBSERVATIONS'),
					'display-field-names' => array(2 => 'annee', 3 => 'duree', 4 => 'emploi_activite', 5 => 'employeur', 6 => 'observations'),
					'sortable-fields' => array(0 => '`cursus`.`idcursus`', 1 => '`informations1`.`idinformation`', 2 => 3, 3 => '`cursus`.`duree`', 4 => 5, 5 => 6, 6 => 7),
					'records-per-page' => 10,
					'default-sort-by' => 0,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-cursus',
					'template-printable' => 'children-cursus-printable',
					'query' => "SELECT `cursus`.`idcursus` as 'idcursus', IF(    CHAR_LENGTH(`informations1`.`idinformation`), CONCAT_WS('',   `informations1`.`idinformation`), '') as 'idinformation', `cursus`.`annee` as 'annee', `cursus`.`duree` as 'duree', `cursus`.`emploi_activite` as 'emploi_activite', `cursus`.`employeur` as 'employeur', `cursus`.`observations` as 'observations' FROM `cursus` LEFT JOIN `informations` as informations1 ON `informations1`.`idinformation`=`cursus`.`idinformation` "
				)
			),
			'formations' => array(   
				'matricule' => array(   
					'parent-table' => 'dossier_individuel',
					'parent-primary-key' => 'iddindividuel',
					'child-primary-key' => 'idformation',
					'child-primary-key-index' => 0,
					'tab-label' => 'FORMATIONS <span class="hidden child-label-formations child-field-caption">(MATRICULE)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/books.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(3 => 'SPECIALISATION', 4 => 'ANN&#201;E', 5 => 'DATE', 6 => 'ORGANISME', 7 => 'LIEU', 8 => 'NATURE FORMATION', 9 => 'DUR&#201;E / JOURS', 10 => 'EFFETS VIS&#201;S', 11 => 'RESULTATS PRODUITS', 12 => 'R / C / P'),
					'display-field-names' => array(3 => 'specialisation', 4 => 'annee', 5 => 'date', 6 => 'organisme', 7 => 'lieu', 8 => 'nature', 9 => 'duree', 10 => 'effets', 11 => 'resultat', 12 => 'r_c_p'),
					'sortable-fields' => array(0 => '`formations`.`idformation`', 1 => '`dossier_individuel1`.`matricule`', 2 => '`dossier_individuel1`.`nom_prenom`', 3 => 4, 4 => 5, 5 => '`formations`.`date`', 6 => 7, 7 => 8, 8 => 9, 9 => '`formations`.`duree`', 10 => 11, 11 => 12, 12 => 13),
					'records-per-page' => 10,
					'default-sort-by' => 0,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-formations',
					'template-printable' => 'children-formations-printable',
					'query' => "SELECT `formations`.`idformation` as 'idformation', IF(    CHAR_LENGTH(`dossier_individuel1`.`matricule`), CONCAT_WS('',   `dossier_individuel1`.`matricule`), '') as 'matricule', IF(    CHAR_LENGTH(`dossier_individuel1`.`nom_prenom`), CONCAT_WS('',   `dossier_individuel1`.`nom_prenom`), '') as 'nom_prenom', `formations`.`specialisation` as 'specialisation', `formations`.`annee` as 'annee', if(`formations`.`date`,date_format(`formations`.`date`,'%d/%m/%Y'),'') as 'date', `formations`.`organisme` as 'organisme', `formations`.`lieu` as 'lieu', `formations`.`nature` as 'nature', `formations`.`duree` as 'duree', `formations`.`effets` as 'effets', `formations`.`resultat` as 'resultat', `formations`.`r_c_p` as 'r_c_p' FROM `formations` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`formations`.`matricule` "
				)
			),
			'informations' => array(   
				'matricule' => array(   
					'parent-table' => 'dossier_individuel',
					'parent-primary-key' => 'iddindividuel',
					'child-primary-key' => 'idinformation',
					'child-primary-key-index' => 0,
					'tab-label' => 'EXPERIENCES <span class="hidden child-label-informations child-field-caption">(Matricule)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/chart_pie_alternative.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(5 => 'DIPL&#212;ME PRIMORDIAL', 6 => 'DATE', 7 => 'INSTITUTION', 8 => 'LIEU ', 9 => 'DIPL&#214;ME / CERTIFICAT DE SP&#201;CIALIT&#201;', 10 => 'SP&#201;CIALIT&#201;', 11 => 'INSTITUTION ', 12 => 'LIEU  '),
					'display-field-names' => array(5 => 'diplome_primordial', 6 => 'date_diplome', 7 => 'institution', 8 => 'lieu_diplome', 9 => 'diplome_certificat', 10 => 'specialite', 11 => 'institution_specialite', 12 => 'lieu_specialite'),
					'sortable-fields' => array(0 => '`informations`.`idinformation`', 1 => 2, 2 => 3, 3 => '`dossier_individuel1`.`nom_prenom`', 4 => 5, 5 => 6, 6 => '`informations`.`date_diplome`', 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16, 16 => 17, 17 => 18, 18 => 19, 19 => 20, 20 => 21, 21 => 22),
					'records-per-page' => 10,
					'default-sort-by' => 0,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-informations',
					'template-printable' => 'children-informations-printable',
					'query' => "SELECT `informations`.`idinformation` as 'idinformation', `informations`.`situation` as 'situation', IF(    CHAR_LENGTH(`dossier_individuel1`.`matricule`), CONCAT_WS('',   `dossier_individuel1`.`matricule`, '   '), '') as 'matricule', IF(    CHAR_LENGTH(`dossier_individuel1`.`nom_prenom`), CONCAT_WS('',   `dossier_individuel1`.`nom_prenom`), '') as 'nom_prenom', `informations`.`education` as 'education', `informations`.`diplome_primordial` as 'diplome_primordial', if(`informations`.`date_diplome`,date_format(`informations`.`date_diplome`,'%d/%m/%Y'),'') as 'date_diplome', `informations`.`institution` as 'institution', `informations`.`lieu_diplome` as 'lieu_diplome', `informations`.`diplome_certificat` as 'diplome_certificat', `informations`.`specialite` as 'specialite', `informations`.`institution_specialite` as 'institution_specialite', `informations`.`lieu_specialite` as 'lieu_specialite', `informations`.`langues` as 'langues', `informations`.`arabe` as 'arabe', `informations`.`francais` as 'francais', `informations`.`anglais` as 'anglais', `informations`.`autres1` as 'autres1', `informations`.`autres2` as 'autres2', `informations`.`informatique` as 'informatique', `informations`.`utilisation` as 'utilisation', `informations`.`programmation` as 'programmation' FROM `informations` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`informations`.`matricule` "
				)
			),
			'carrieres' => array(   
				'matricule' => array(   
					'parent-table' => 'dossier_individuel',
					'parent-primary-key' => 'iddindividuel',
					'child-primary-key' => 'idcarriere',
					'child-primary-key-index' => 0,
					'tab-label' => 'CARRIERES  <span class="hidden child-label-carrieres child-field-caption">(MATRICULE)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/award_star_gold_3.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(2 => 'DATE', 3 => 'DESCRIPTION', 4 => 'STATUT'),
					'display-field-names' => array(2 => 'date', 3 => 'r_n_m_a_p_d', 4 => 'statut'),
					'sortable-fields' => array(0 => '`carrieres`.`idcarriere`', 1 => '`dossier_individuel1`.`matricule`', 2 => '`carrieres`.`date`', 3 => '`carrieres_option1`.`description`', 4 => 5),
					'records-per-page' => 10,
					'default-sort-by' => 0,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-carrieres',
					'template-printable' => 'children-carrieres-printable',
					'query' => "SELECT `carrieres`.`idcarriere` as 'idcarriere', IF(    CHAR_LENGTH(`dossier_individuel1`.`matricule`), CONCAT_WS('',   `dossier_individuel1`.`matricule`), '') as 'matricule', if(`carrieres`.`date`,date_format(`carrieres`.`date`,'%d/%m/%Y'),'') as 'date', IF(    CHAR_LENGTH(`carrieres_option1`.`description`), CONCAT_WS('',   `carrieres_option1`.`description`), '') as 'r_n_m_a_p_d', `carrieres`.`statut` as 'statut' FROM `carrieres` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`carrieres`.`matricule` LEFT JOIN `carrieres_option` as carrieres_option1 ON `carrieres_option1`.`idoption`=`carrieres`.`r_n_m_a_p_d` "
				),
				'r_n_m_a_p_d' => array(   
					'parent-table' => 'carrieres_option',
					'parent-primary-key' => 'idoption',
					'child-primary-key' => 'idcarriere',
					'child-primary-key-index' => 0,
					'tab-label' => 'CARRIERES  <span class="hidden child-label-carrieres child-field-caption">(DESCRIPTION)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/award_star_gold_3.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(2 => 'DATE', 3 => 'DESCRIPTION', 4 => 'STATUT'),
					'display-field-names' => array(2 => 'date', 3 => 'r_n_m_a_p_d', 4 => 'statut'),
					'sortable-fields' => array(0 => '`carrieres`.`idcarriere`', 1 => '`dossier_individuel1`.`matricule`', 2 => '`carrieres`.`date`', 3 => '`carrieres_option1`.`description`', 4 => 5),
					'records-per-page' => 10,
					'default-sort-by' => 0,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-carrieres',
					'template-printable' => 'children-carrieres-printable',
					'query' => "SELECT `carrieres`.`idcarriere` as 'idcarriere', IF(    CHAR_LENGTH(`dossier_individuel1`.`matricule`), CONCAT_WS('',   `dossier_individuel1`.`matricule`), '') as 'matricule', if(`carrieres`.`date`,date_format(`carrieres`.`date`,'%d/%m/%Y'),'') as 'date', IF(    CHAR_LENGTH(`carrieres_option1`.`description`), CONCAT_WS('',   `carrieres_option1`.`description`), '') as 'r_n_m_a_p_d', `carrieres`.`statut` as 'statut' FROM `carrieres` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`carrieres`.`matricule` LEFT JOIN `carrieres_option` as carrieres_option1 ON `carrieres_option1`.`idoption`=`carrieres`.`r_n_m_a_p_d` "
				)
			),
			'demandes' => array(   
			),
			'fonctions' => array(   
			),
			'directions' => array(   
			),
			'services' => array(   
			),
			'divisions' => array(   
			),
			'les_banques' => array(   
			),
			'carrieres_option' => array(   
			),
			'statut' => array(   
			),
			'missions' => array(   
			),
			'ordres_missions' => array(   
				'from_mission' => array(   
					'parent-table' => 'missions',
					'parent-primary-key' => 'id_mission',
					'child-primary-key' => 'id_ordre_mission',
					'child-primary-key-index' => 0,
					'tab-label' => 'Ordres missions <span class="hidden child-label-ordres_missions child-field-caption">(From mission)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/folder_edit.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(2 => 'NOM ET PRENOM', 3 => 'FONCTION', 4 => 'DIRECTION', 5 => 'SERVICE'),
					'display-field-names' => array(2 => 'nom_prenom', 3 => 'fonction', 4 => 'direction', 5 => 'service'),
					'sortable-fields' => array(0 => '`ordres_missions`.`id_ordre_mission`', 1 => '`missions1`.`to_mission`', 2 => '`dossier_individuel1`.`nom_prenom`', 3 => 4, 4 => 5, 5 => 6),
					'records-per-page' => 10,
					'default-sort-by' => 0,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-ordres_missions',
					'template-printable' => 'children-ordres_missions-printable',
					'query' => "SELECT `ordres_missions`.`id_ordre_mission` as 'id_ordre_mission', IF(    CHAR_LENGTH(`missions1`.`to_mission`), CONCAT_WS('',   `missions1`.`to_mission`), '') as 'from_mission', IF(    CHAR_LENGTH(`dossier_individuel1`.`nom_prenom`), CONCAT_WS('',   `dossier_individuel1`.`nom_prenom`), '') as 'nom_prenom', IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') as 'fonction', IF(    CHAR_LENGTH(`directions1`.`direction`), CONCAT_WS('',   `directions1`.`direction`), '') as 'direction', IF(    CHAR_LENGTH(`services1`.`service`), CONCAT_WS('',   `services1`.`service`), '') as 'service' FROM `ordres_missions` LEFT JOIN `missions` as missions1 ON `missions1`.`id_mission`=`ordres_missions`.`from_mission` LEFT JOIN `dossier_individuel` as dossier_individuel1 ON `dossier_individuel1`.`iddindividuel`=`ordres_missions`.`nom_prenom` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`dossier_individuel1`.`fonction` LEFT JOIN `directions` as directions1 ON `directions1`.`iddirection`=`dossier_individuel1`.`direction` LEFT JOIN `services` as services1 ON `services1`.`idservice`=`dossier_individuel1`.`service` "
				)
			),
			'decomptes' => array(   
			),
			'details_decompte' => array(   
				'to_decomptes' => array(   
					'parent-table' => 'decomptes',
					'parent-primary-key' => 'iddecompte',
					'child-primary-key' => 'iddetail_decompte',
					'child-primary-key-index' => 0,
					'tab-label' => 'Details decompte <span class="hidden child-label-details_decompte child-field-caption">(To decomptes)</span>',
					'auto-close' => false,
					'table-icon' => 'resources/table_icons/folder_error.png',
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(1 => 'TRANCHES', 2 => 'PERIODES', 3 => 'POURCENTAGE', 4 => 'COEFFICIENT DE PONDERATION', 5 => 'SALAIRE MOYEN', 6 => 'MONTANT'),
					'display-field-names' => array(1 => 'tranches', 2 => 'periodes', 3 => 'pourcentage', 4 => 'coef', 5 => 'salaire_moyen', 6 => 'montant'),
					'sortable-fields' => array(0 => '`details_decompte`.`iddetail_decompte`', 1 => 2, 2 => 3, 3 => '`details_decompte`.`pourcentage`', 4 => '`details_decompte`.`coef`', 5 => '`details_decompte`.`salaire_moyen`', 6 => '`details_decompte`.`montant`', 7 => '`details_decompte`.`mois_preavis`', 8 => '`details_decompte`.`mois_conge`', 9 => '`decomptes1`.`iddecompte`'),
					'records-per-page' => 10,
					'default-sort-by' => 0,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-details_decompte',
					'template-printable' => 'children-details_decompte-printable',
					'query' => "SELECT `details_decompte`.`iddetail_decompte` as 'iddetail_decompte', `details_decompte`.`tranches` as 'tranches', `details_decompte`.`periodes` as 'periodes', `details_decompte`.`pourcentage` as 'pourcentage', `details_decompte`.`coef` as 'coef', `details_decompte`.`salaire_moyen` as 'salaire_moyen', `details_decompte`.`montant` as 'montant', `details_decompte`.`mois_preavis` as 'mois_preavis', `details_decompte`.`mois_conge` as 'mois_conge', IF(    CHAR_LENGTH(`decomptes1`.`iddecompte`), CONCAT_WS('',   `decomptes1`.`iddecompte`), '') as 'to_decomptes' FROM `details_decompte` LEFT JOIN `decomptes` as decomptes1 ON `decomptes1`.`iddecompte`=`details_decompte`.`to_decomptes` "
				)
			),
			'incomes' => array(   
			),
			'expenses' => array(   
			),
			'categorie_prime' => array(   
			),
			'curriculum_vitae' => array(   
			)
		);

	/*************************************/
	/* End of configuration */


	$currDir = dirname(__FILE__);
	include("{$currDir}/defaultLang.php");
	include("{$currDir}/language.php");
	include("{$currDir}/lib.php");
	@header('Content-Type: text/html; charset=' . datalist_db_encoding);

	handle_maintenance();

	/**
	* dynamic configuration based on current user's permissions
	* $userPCConfig array is populated only with parent tables where the user has access to
	* at least one child table
	*/
	$userPCConfig = array();
	foreach($pcConfig as $pcChildTable => $ChildrenLookups){
		$permChild = getTablePermissions($pcChildTable);
		if($permChild[2]){ // user can view records of the child table, so proceed to check children lookups
			foreach($ChildrenLookups as $ChildLookupField => $ChildConfig){
				$permParent = getTablePermissions($ChildConfig['parent-table']);
				if($permParent[2]){ // user can view records of parent table
					$userPCConfig[$pcChildTable][$ChildLookupField] = $pcConfig[$pcChildTable][$ChildLookupField];
					// show add new only if configured above AND the user has insert permission
					if($permChild[1] && $pcConfig[$pcChildTable][$ChildLookupField]['display-add-new']){
						$userPCConfig[$pcChildTable][$ChildLookupField]['display-add-new'] = true;
					}else{
						$userPCConfig[$pcChildTable][$ChildLookupField]['display-add-new'] = false;
					}
				}
			}
		}
	}

	/* Receive, UTF-convert, and validate parameters */
	$ParentTable = $_REQUEST['ParentTable']; // needed only with operation=show-children, will be validated in the processing code
	$ChildTable = $_REQUEST['ChildTable'];
		if(!in_array($ChildTable, array_keys($userPCConfig))){
			/* defaults to first child table in config array if not provided */
			$ChildTable = current(array_keys($userPCConfig));
		}
		if(!$ChildTable){ die('<!-- No tables accessible to current user -->'); }
	$SelectedID = strip_tags($_REQUEST['SelectedID']);
	$ChildLookupField = $_REQUEST['ChildLookupField'];
		if(!in_array($ChildLookupField, array_keys($userPCConfig[$ChildTable]))){
			/* defaults to first lookup in current child config array if not provided */
			$ChildLookupField = current(array_keys($userPCConfig[$ChildTable]));
		}
	$Page = intval($_REQUEST['Page']);
		if($Page < 1){
			$Page = 1;
		}
	$SortBy = ($_REQUEST['SortBy'] != '' ? abs(intval($_REQUEST['SortBy'])) : false);
		if(!in_array($SortBy, array_keys($userPCConfig[$ChildTable][$ChildLookupField]['sortable-fields']), true)){
			$SortBy = $userPCConfig[$ChildTable][$ChildLookupField]['default-sort-by'];
		}
	$SortDirection = strtolower($_REQUEST['SortDirection']);
		if(!in_array($SortDirection, array('asc', 'desc'))){
			$SortDirection = $userPCConfig[$ChildTable][$ChildLookupField]['default-sort-direction'];
		}
	$Operation = strtolower($_REQUEST['Operation']);
		if(!in_array($Operation, array('get-records', 'show-children', 'get-records-printable', 'show-children-printable'))){
			$Operation = 'get-records';
		}

	/* process requested operation */
	switch($Operation){
		/************************************************/
		case 'show-children':
			/* populate HTML and JS content with children tabs */
			$tabLabels = $tabPanels = $tabLoaders = '';
			foreach($userPCConfig as $ChildTable => $childLookups){
				foreach($childLookups as $ChildLookupField => $childConfig){
					if($childConfig['parent-table'] == $ParentTable){
						$TableIcon = ($childConfig['table-icon'] ? "<img src=\"{$childConfig['table-icon']}\" border=\"0\" />" : '');
						$tabLabels .= sprintf('<li%s><a href="#panel_%s-%s" id="tab_%s-%s" data-toggle="tab">%s%s</a></li>' . "\n\t\t\t\t\t",($tabLabels ? '' : ' class="active"'), $ChildTable, $ChildLookupField, $ChildTable, $ChildLookupField, $TableIcon, $childConfig['tab-label']);
						$tabPanels .= sprintf('<div id="panel_%s-%s" class="tab-pane%s"><img src="loading.gif" align="top" />%s</div>' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, ($tabPanels ? '' : ' active'), $Translation['Loading ...']);
						$tabLoaders .= sprintf('post("parent-children.php", { ChildTable: "%s", ChildLookupField: "%s", SelectedID: "%s", Page: 1, SortBy: "", SortDirection: "", Operation: "get-records" }, "panel_%s-%s");' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, addslashes($SelectedID), $ChildTable, $ChildLookupField);
					}
				}
			}

			if(!$tabLabels){ die('<!-- no children of current parent table are accessible to current user -->'); }
			?>
			<div id="children-tabs">
				<ul class="nav nav-tabs">
					<?php echo $tabLabels; ?>
				</ul>
				<span id="pc-loading"></span>
			</div>
			<div class="tab-content"><?php echo $tabPanels; ?></div>

			<script>
				$j(function(){
					/* for iOS, avoid loading child tabs in modals */
					var iOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
					var embedded = ($j('.navbar').length == 0);
					if(iOS && embedded){
						$j('#children-tabs').next('.tab-content').remove();
						$j('#children-tabs').remove();
						return;
					}

					/* ajax loading of each tab's contents */
					<?php echo $tabLoaders; ?>

					/* show child field caption on tab title in case the same child table appears more than once */
					$j('.child-field-caption').each(function() {
						var clss = $j(this).attr('class').split(/\s+/).reduce(function(rc, cc) {
							return (cc.match(/child-label-.*/) ? '.' + cc : rc);
						}, '');

						// if class occurs more than once, remove .hidden
						if($j(clss).length > 1) $j(clss).removeClass('hidden');
					})
				})
			</script>
			<?php
			break;

		/************************************************/
		case 'show-children-printable':
			/* populate HTML and JS content with children buttons */
			$tabLabels = $tabPanels = $tabLoaders = '';
			foreach($userPCConfig as $ChildTable => $childLookups){
				foreach($childLookups as $ChildLookupField => $childConfig){
					if($childConfig['parent-table'] == $ParentTable){
						$TableIcon = ($childConfig['table-icon'] ? "<img src=\"{$childConfig['table-icon']}\" border=\"0\" />" : '');
						$tabLabels .= sprintf('<button type="button" class="btn btn-default" data-target="#panel_%s-%s" id="tab_%s-%s" data-toggle="collapse">%s %s</button>' . "\n\t\t\t\t\t", $ChildTable, $ChildLookupField, $ChildTable, $ChildLookupField, $TableIcon, $childConfig['tab-label']);
						$tabPanels .= sprintf('<div id="panel_%s-%s" class="collapse"><img src="loading.gif" align="top" />%s</div>' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, $Translation['Loading ...']);
						$tabLoaders .= sprintf('post("parent-children.php", { ChildTable: "%s", ChildLookupField: "%s", SelectedID: "%s", Page: 1, SortBy: "", SortDirection: "", Operation: "get-records-printable" }, "panel_%s-%s");' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, addslashes($SelectedID), $ChildTable, $ChildLookupField);
					}
				}
			}

			if(!$tabLabels){ die('<!-- no children of current parent table are accessible to current user -->'); }
			?>
			<div id="children-tabs" class="hidden-print">
				<div class="btn-group btn-group-lg">
					<?php echo $tabLabels; ?>
				</div>
				<span id="pc-loading"></span>
			</div>
			<div class="vspacer-lg"><?php echo $tabPanels; ?></div>

			<script>
				$j(function(){
					/* for iOS, avoid loading child tabs in modals */
					var iOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
					var embedded = ($j('.navbar').length == 0);
					if(iOS && embedded){
						$j('#children-tabs').next('.tab-content').remove();
						$j('#children-tabs').remove();
						return;
					}

					/* ajax loading of each tab's contents */
					<?php echo $tabLoaders; ?>
				})
			</script>
			<?php
			break;

		/************************************************/
		case 'get-records-printable':
		default: /* default is 'get-records' */

			if($Operation == 'get-records-printable'){
				$userPCConfig[$ChildTable][$ChildLookupField]['records-per-page'] = 2000;
			}

			// build the user permissions limiter
			$permissionsWhere = $permissionsJoin = '';
			$permChild = getTablePermissions($ChildTable);
			if($permChild[2] == 1){ // user can view only his own records
				$permissionsWhere = "`$ChildTable`.`{$userPCConfig[$ChildTable][$ChildLookupField]['child-primary-key']}`=`membership_userrecords`.`pkValue` AND `membership_userrecords`.`tableName`='$ChildTable' AND LCASE(`membership_userrecords`.`memberID`)='".getLoggedMemberID()."'";
			}elseif($permChild[2] == 2){ // user can view only his group's records
				$permissionsWhere = "`$ChildTable`.`{$userPCConfig[$ChildTable][$ChildLookupField]['child-primary-key']}`=`membership_userrecords`.`pkValue` AND `membership_userrecords`.`tableName`='$ChildTable' AND `membership_userrecords`.`groupID`='".getLoggedGroupID()."'";
			}elseif($permChild[2] == 3){ // user can view all records
				/* that's the only case remaining ... no need to modify the query in this case */
			}
			$permissionsJoin = ($permissionsWhere ? ", `membership_userrecords`" : '');

			// build the count query
			$forcedWhere = $userPCConfig[$ChildTable][$ChildLookupField]['forced-where'];
			$query = 
				preg_replace('/^select .* from /i', 'SELECT count(1) FROM ', $userPCConfig[$ChildTable][$ChildLookupField]['query']) .
				$permissionsJoin . " WHERE " .
				($permissionsWhere ? "( $permissionsWhere )" : "( 1=1 )") . " AND " .
				($forcedWhere ? "( $forcedWhere )" : "( 2=2 )") . " AND " .
				"`$ChildTable`.`$ChildLookupField`='" . makeSafe($SelectedID) . "'";
			$totalMatches = sqlValue($query);

			// make sure $Page is <= max pages
			$maxPage = ceil($totalMatches / $userPCConfig[$ChildTable][$ChildLookupField]['records-per-page']);
			if($Page > $maxPage){ $Page = $maxPage; }

			// initiate output data array
			$data = array(
				'config' => $userPCConfig[$ChildTable][$ChildLookupField],
				'parameters' => array(
					'ChildTable' => $ChildTable,
					'ChildLookupField' => $ChildLookupField,
					'SelectedID' => $SelectedID,
					'Page' => $Page,
					'SortBy' => $SortBy,
					'SortDirection' => $SortDirection,
					'Operation' => $Operation
				),
				'records' => array(),
				'totalMatches' => $totalMatches
			);

			// build the data query
			if($totalMatches){ // if we have at least one record, proceed with fetching data
				$startRecord = $userPCConfig[$ChildTable][$ChildLookupField]['records-per-page'] * ($Page - 1);
				$data['query'] = 
					$userPCConfig[$ChildTable][$ChildLookupField]['query'] .
					$permissionsJoin . " WHERE " .
					($permissionsWhere ? "( $permissionsWhere )" : "( 1=1 )") . " AND " .
					($forcedWhere ? "( $forcedWhere )" : "( 2=2 )") . " AND " .
					"`$ChildTable`.`$ChildLookupField`='" . makeSafe($SelectedID) . "'" . 
					($SortBy !== false && $userPCConfig[$ChildTable][$ChildLookupField]['sortable-fields'][$SortBy] ? " ORDER BY {$userPCConfig[$ChildTable][$ChildLookupField]['sortable-fields'][$SortBy]} $SortDirection" : '') .
					" LIMIT $startRecord, {$userPCConfig[$ChildTable][$ChildLookupField]['records-per-page']}";
				$res = sql($data['query'], $eo);
				while($row = db_fetch_row($res)){
					$data['records'][$row[$userPCConfig[$ChildTable][$ChildLookupField]['child-primary-key-index']]] = $row;
				}
			}else{ // if no matching records
				$startRecord = 0;
			}

			if($Operation == 'get-records-printable'){
				$response = loadView($userPCConfig[$ChildTable][$ChildLookupField]['template-printable'], $data);
			}else{
				$response = loadView($userPCConfig[$ChildTable][$ChildLookupField]['template'], $data);
			}

			// change name space to ensure uniqueness
			$uniqueNameSpace = $ChildTable.ucfirst($ChildLookupField).'GetRecords';
			echo str_replace("{$ChildTable}GetChildrenRecordsList", $uniqueNameSpace, $response);
		/************************************************/
	}
