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

	$currDir = dirname(__FILE__);
	include("$currDir/defaultLang.php");
	include("$currDir/language.php");
	include("$currDir/lib.php");

	handle_maintenance();

	header('Content-type: text/javascript; charset=' . datalist_db_encoding);

	$table_perms = getTablePermissions('emetteurs');
	if(!$table_perms[0]) { die('// Access denied!'); }

	$mfk = $_GET['mfk'];
	$id = makeSafe($_GET['id']);
	$rnd1 = intval($_GET['rnd1']); if(!$rnd1) $rnd1 = '';

	if(!$mfk) {
		die('// No js code available!');
	}

	switch($mfk) {

		case 'emetteur':
			if(!$id) {
				?>
				$j('#adresse<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#email<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#telephone<?php echo $rnd1; ?>').html('&nbsp;');
				<?php
				break;
			}
			$res = sql("SELECT `clients`.`matricule_client` as 'matricule_client', if(`clients`.`date_inscription`,date_format(`clients`.`date_inscription`,'%d/%m/%Y'),'') as 'date_inscription', IF(    CHAR_LENGTH(`types_client1`.`type_client`), CONCAT_WS('',   `types_client1`.`type_client`), '') as 'type', `clients`.`nom_prenom` as 'nom_prenom', IF(    CHAR_LENGTH(`pays1`.`pays`), CONCAT_WS('',   `pays1`.`pays`), '') as 'nationalite', `clients`.`sexe` as 'sexe', if(`clients`.`date_naissance`,date_format(`clients`.`date_naissance`,'%d/%m/%Y'),'') as 'date_naissance', `clients`.`age` as 'age', `clients`.`nni` as 'nni', IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') as 'fonction', `clients`.`passport` as 'passport', IF(    CHAR_LENGTH(`pays2`.`pays`), CONCAT_WS('',   `pays2`.`pays`), '') as 'lieu', if(`clients`.`date_emis`,date_format(`clients`.`date_emis`,'%d/%m/%Y'),'') as 'date_emis', if(`clients`.`date_exp`,date_format(`clients`.`date_exp`,'%d/%m/%Y'),'') as 'date_exp', `clients`.`validite` as 'validite', `clients`.`adresse` as 'adresse', `clients`.`telephone` as 'telephone', `clients`.`email` as 'email', IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS('',   `banques1`.`banque`), '') as 'banque', `clients`.`compte` as 'compte', IF(    CHAR_LENGTH(`cartes_fidelite1`.`carte_fidelite`), CONCAT_WS('',   `cartes_fidelite1`.`carte_fidelite`), '') as 'carte_fidelite', `clients`.`numero_cf` as 'numero_cf', REPLACE(FORMAT(`clients`.`total_entree`, 0), ',', ' ') as 'total_entree', REPLACE(FORMAT(`clients`.`total_sortie`, 0), ',', ' ') as 'total_sortie', REPLACE(FORMAT(`clients`.`solde`, 0), ',', ' ') as 'solde', `clients`.`photo` as 'photo', `clients`.`signature` as 'signature', IF(    CHAR_LENGTH(`agences1`.`agence`), CONCAT_WS('',   `agences1`.`agence`), '') as 'agence', `clients`.`dossier` as 'dossier', `clients`.`urgence` as 'urgence', `clients`.`observation` as 'observation' FROM `clients` LEFT JOIN `types_client` as types_client1 ON `types_client1`.`idtype_client`=`clients`.`type` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `cartes_fidelite` as cartes_fidelite1 ON `cartes_fidelite1`.`idcartecf`=`clients`.`carte_fidelite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence`  WHERE `clients`.`matricule_client`='{$id}' limit 1", $eo);
			$row = db_fetch_assoc($res);
			?>
			$j('#adresse<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['adresse']))); ?>&nbsp;');
			$j('#email<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['email']))); ?>&nbsp;');
			$j('#telephone<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['telephone']))); ?>&nbsp;');
			<?php
			break;


	}

?>