<?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('dossier_individuel');
	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 'option_prime':
			if(!$id) {
				?>
				$j('#qty<?php echo $rnd1; ?>').html('&nbsp;');
				<?php
				break;
			}
			$res = sql("SELECT `gestion_primes`.`idgestion_prime` as 'idgestion_prime', IF(    CHAR_LENGTH(`rythme_prime1`.`rythme`), CONCAT_WS('',   `rythme_prime1`.`rythme`), '') as 'echeance', if(`gestion_primes`.`date`,date_format(`gestion_primes`.`date`,'%d/%m/%Y'),'') as 'date', `gestion_primes`.`mois` as 'mois', `gestion_primes`.`signataire` as 'signataire', `gestion_primes`.`link` as 'link' FROM `gestion_primes` LEFT JOIN `rythme_prime` as rythme_prime1 ON `rythme_prime1`.`idrythme_prime`=`gestion_primes`.`echeance`  WHERE `gestion_primes`.`idgestion_prime`='{$id}' limit 1", $eo);
			$row = db_fetch_assoc($res);
			?>
			$j('#qty<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['echeance']))); ?>&nbsp;');
			<?php
			break;

		case 'categorie':
			if(!$id) {
				?>
				$j('#prime<?php echo $rnd1; ?>').html('&nbsp;');
				<?php
				break;
			}
			$res = sql("SELECT `categories`.`idcategorie` as 'idcategorie', `categories`.`categorie` as 'categorie', REPLACE(FORMAT(`categories`.`prime`, 0), ',', ' ') as 'prime' FROM `categories`  WHERE `categories`.`idcategorie`='{$id}' limit 1", $eo);
			$row = db_fetch_assoc($res);
			?>
			$j('#prime<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['prime']))); ?>&nbsp;');
			<?php
			break;


	}

?>