<?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_banques');
	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 'compte_emetteur':
			if(!$id) {
				?>
				$j('#numero<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#banque<?php echo $rnd1; ?>').html('&nbsp;');
				<?php
				break;
			}
			$res = sql("SELECT `gestion_comptes_1`.`idgestioncompte` as 'idgestioncompte', `gestion_comptes_1`.`nom_compte` as 'nom_compte', `gestion_comptes_1`.`num_compte` as 'num_compte', IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS('',   `banques1`.`banque`), '') as 'banque', IF(    CHAR_LENGTH(`type_comptes1`.`type_compte`), CONCAT_WS('',   `type_comptes1`.`type_compte`), '') as 'type_compte', `gestion_comptes_1`.`observations` as 'observations', `gestion_comptes_1`.`groupe` as 'groupe', `gestion_comptes_1`.`agent` as 'agent' FROM `gestion_comptes_1` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes_1`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes_1`.`type_compte`  WHERE `gestion_comptes_1`.`idgestioncompte`='{$id}' limit 1", $eo);
			$row = db_fetch_assoc($res);
			?>
			$j('#numero<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['num_compte']))); ?>&nbsp;');
			$j('#banque<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['banque']))); ?>&nbsp;');
			<?php
			break;

		case 'compte_beneficiaire':
			if(!$id) {
				?>
				$j('#numero_cb<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#banque_cb<?php echo $rnd1; ?>').html('&nbsp;');
				<?php
				break;
			}
			$res = sql("SELECT `gestion_comptes`.`idgestioncompte` as 'idgestioncompte', `gestion_comptes`.`nom_compte` as 'nom_compte', `gestion_comptes`.`num_compte` as 'num_compte', IF(    CHAR_LENGTH(`banques1`.`banque`), CONCAT_WS('',   `banques1`.`banque`), '') as 'banque', IF(    CHAR_LENGTH(`type_comptes1`.`type_compte`), CONCAT_WS('',   `type_comptes1`.`type_compte`), '') as 'type_compte', `gestion_comptes`.`observations` as 'observations', `gestion_comptes`.`groupe` as 'groupe', `gestion_comptes`.`agent` as 'agent' FROM `gestion_comptes` LEFT JOIN `banques` as banques1 ON `banques1`.`idbanque`=`gestion_comptes`.`banque` LEFT JOIN `type_comptes` as type_comptes1 ON `type_comptes1`.`idtypecompte`=`gestion_comptes`.`type_compte`  WHERE `gestion_comptes`.`idgestioncompte`='{$id}' limit 1", $eo);
			$row = db_fetch_assoc($res);
			?>
			$j('#numero_cb<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['num_compte']))); ?>&nbsp;');
			$j('#banque_cb<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['banque']))); ?>&nbsp;');
			<?php
			break;


	}

?>