<?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('gestion_transactions');
	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 'avec_entete':
			if(!$id) {
				?>
				$j('#rs<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#devise<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#logo<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#description<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#adresse<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#telephone<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#whatsapp<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#email<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#site_web<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#bp<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#footer_3<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#notice<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#signataire<?php echo $rnd1; ?>').html('&nbsp;');
				<?php
				break;
			}
			$res = sql("SELECT `entete`.`identete` as 'identete', `entete`.`link_in` as 'link_in', `entete`.`nom` as 'nom', `entete`.`raison_sociale` as 'raison_sociale', `entete`.`description` as 'description', `entete`.`adresse` as 'adresse', `entete`.`telephone` as 'telephone', `entete`.`whatsapp` as 'whatsapp', `entete`.`email` as 'email', `entete`.`site_web` as 'site_web', `entete`.`bp` as 'bp', `entete`.`footer` as 'footer', `entete`.`footer_1` as 'footer_1', `entete`.`footer_2` as 'footer_2', `entete`.`footer_3` as 'footer_3', `entete`.`logo` as 'logo', `entete`.`logop` as 'logop', `entete`.`notice` as 'notice', `entete`.`devise` as 'devise', `entete`.`signataire` as 'signataire', `entete`.`observations` as 'observations', `entete`.`groupe` as 'groupe', `entete`.`agent` as 'agent' FROM `entete`  WHERE `entete`.`identete`='{$id}' limit 1", $eo);
			$row = db_fetch_assoc($res);
			?>
			$j('#rs<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['raison_sociale']))); ?>&nbsp;');
			$j('#devise<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['devise']))); ?>&nbsp;');
			<?php if($row['logo']) { ?> 
				$j('#logo<?php echo $rnd1; ?>').html('<a href="<?php echo $Translation['ImageFolder'] . addslashes(str_replace(array("\r", "\n"), '', $row['logo'])); ?>" data-lightbox="gestion_transactions_dv"><img src="thumbnail.php?i=<?php echo urlencode($row['logo']); ?>&t=entete&f=logo&v=dv" class="img-thumbnail"></a>');
			<?php }else{ ?>
				$j('#logo<?php echo $rnd1; ?>').html('<img src="thumbnail.php?i=&t=entete&f=logo&v=dv" class="img-thumbnail">');
			<?php } ?>
			$j('#description<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['description']))); ?>&nbsp;');
			$j('#adresse<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['adresse']))); ?>&nbsp;');
			$j('#telephone<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['telephone']))); ?>&nbsp;');
			$j('#whatsapp<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['whatsapp']))); ?>&nbsp;');
			$j('#email<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['email']))); ?>&nbsp;');
			$j('#site_web<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['site_web']))); ?>&nbsp;');
			$j('#bp<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['bp']))); ?>&nbsp;');
			$j('#footer_3<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['footer_3']))); ?>&nbsp;');
			$j('#notice<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['notice']))); ?>&nbsp;');
			$j('#signataire<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['signataire']))); ?>&nbsp;');
			<?php
			break;

		case 'nom_prenom':
			if(!$id) {
				?>
				$j('#matricule<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#adclient<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#telclient<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#emclient<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#raison_sociale<?php echo $rnd1; ?>').html('&nbsp;');
				<?php
				break;
			}
			$res = sql("SELECT `clients`.`idclient` as 'idclient', `clients`.`matricule` as 'matricule', `clients`.`agent` as 'agent', if(`clients`.`date_en`,date_format(`clients`.`date_en`,'%d/%m/%Y %H:%i'),'') as 'date_en', IF(    CHAR_LENGTH(`type_client1`.`type_client`), CONCAT_WS('',   `type_client1`.`type_client`), '') as 'type_client', `clients`.`raison_sociale` as 'raison_sociale', `clients`.`personne_contact` as 'personne_contact', `clients`.`email_pc` as 'email_pc', `clients`.`phone_pc` as 'phone_pc', `clients`.`ninea` as 'ninea', `clients`.`rc` as 'rc', `clients`.`genre` as 'genre', `clients`.`prenom` as 'prenom', `clients`.`nom` as 'nom', `clients`.`cin` as 'cin', IF(    CHAR_LENGTH(`agences1`.`agence`), CONCAT_WS('',   `agences1`.`agence`), '') as 'agence', IF(    CHAR_LENGTH(`pays1`.`pays`), CONCAT_WS('',   `pays1`.`pays`), '') as 'nationalite', IF(    CHAR_LENGTH(`produits_services1`.`produit_service`), CONCAT_WS('',   `produits_services1`.`produit_service`), '') as 'categorie', IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') as 'fonction', IF(    CHAR_LENGTH(`activites1`.`activite`), CONCAT_WS('',   `activites1`.`activite`), '') as 'activite', if(`clients`.`date_naissance`,date_format(`clients`.`date_naissance`,'%d/%m/%Y %H:%i'),'') as 'date_naissance', `clients`.`age` as 'age', `clients`.`passport` as 'passport', if(`clients`.`delivre_le`,date_format(`clients`.`delivre_le`,'%d/%m/%Y %H:%i'),'') as 'delivre_le', if(`clients`.`expire_le`,date_format(`clients`.`expire_le`,'%d/%m/%Y %H:%i'),'') as 'expire_le', IF(    CHAR_LENGTH(`pays2`.`pays`), CONCAT_WS('',   `pays2`.`pays`), '') as 'lieu', `clients`.`validite` as 'validite', `clients`.`adresse` as 'adresse', `clients`.`telephone` as 'telephone', `clients`.`whatsapp` as 'whatsapp', `clients`.`urgence` as 'urgence', `clients`.`email` as 'email', `clients`.`compte` as 'compte', IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS('',   `banques1`.`banque`), '') as 'banque', IF(    CHAR_LENGTH(`fidelite1`.`carte_fidelite`), CONCAT_WS('',   `fidelite1`.`carte_fidelite`), '') as 'carte_fidelite', `clients`.`num_carte` as 'num_carte', `clients`.`signature` as 'signature', `clients`.`photo` as 'photo', `clients`.`dossier` as 'dossier', `clients`.`observations` as 'observations', `clients`.`groupe` as 'groupe' FROM `clients` LEFT JOIN `type_client` as type_client1 ON `type_client1`.`idtype_client`=`clients`.`type_client` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`clients`.`agence` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients`.`nationalite` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`clients`.`categorie` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients`.`fonction` LEFT JOIN `activites` as activites1 ON `activites1`.`idactivite`=`clients`.`activite` LEFT JOIN `pays` as pays2 ON `pays2`.`idpays`=`clients`.`lieu` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`clients`.`banque` LEFT JOIN `fidelite` as fidelite1 ON `fidelite1`.`idfidelite`=`clients`.`carte_fidelite`  WHERE `clients`.`idclient`='{$id}' limit 1", $eo);
			$row = db_fetch_assoc($res);
			?>
			$j('#matricule<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['matricule']))); ?>&nbsp;');
			$j('#adclient<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['adresse']))); ?>&nbsp;');
			$j('#telclient<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['telephone']))); ?>&nbsp;');
			$j('#emclient<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['email']))); ?>&nbsp;');
			$j('#raison_sociale<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['raison_sociale']))); ?>&nbsp;');
			<?php
			break;


	}

?>