<?php

include_once ("includes/setup.inc.php");
set_time_limit(0);
ini_set('max_execution_time', '3000'); 
									 
$dateTimeNow = dateTimeNow();

$target_dir = "upload_nokelompok/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

$muatnaik_program = fetch_postget_val("muatnaik_program", $_POST, $_GET);
$muatnaik_daerah = fetch_postget_val("muatnaik_daerah", $_POST, $_GET);
$muatnaik_kelompok = fetch_postget_val("muatnaik_kelompok", $_POST, $_GET);

$filename = $_FILES["file"]["tmp_name"];

//if success, uplaod to server
move_uploaded_file($filename, 'upload_daftar/'.$muatnaik_kelompok.'.txt'); //it will auto replace

if(count($pemohonList) > 0)
{
	$PDO_stmt = $PDO->prepare("
		SELECT A.*, B.nama_pemohon, C.desk_bank, D.desk_dun
		FROM $eft_table A
		LEFT JOIN m_pemohon B ON A.id_pemohon = B.id_pemohon
		LEFT JOIN i_bank C ON A.id_bank = C.id_bank
		LEFT JOIN i_dun D ON A.id_dun = D.id_dun
		WHERE A.no_kelompok = ?
		AND A.id_pemohon IN (".join(',', $pemohonList).")
	");
	$PDO_stmt->bindValue(1, $nokelompok, PDO::PARAM_STR);
	$PDO_stmt->execute();
	$counter = 1;
	while($result = $PDO_stmt->fetch(PDO::FETCH_ASSOC))
	{
		echo '<tr>';
			echo '<td>'.($counter++).'</td>';
			echo '<td>'.$result['nama_pemohon'].'</td>';
			echo '<td>'.$result['desk_dun'].'</td>';
			echo '<td>'.formatDate('d/m/Y', $result['tkh_bayar']).'</td>';
			echo '<td>'.$result['desk_bank'].'</td>';
			echo '<td>'.$result['no_akaun'].'</td>';
			echo '<td>'.$result['id_pemohon'].'</td>';
			echo '<td>'.$result['jum_bayaran'].'</td>';
			echo '<td>'.$result['ulasan_statusEFT'].'</td>';
		echo '</tr>';
	}
}

?>