Escolar Documentos
Profissional Documentos
Cultura Documentos
php
require_once('connection.php');
$read= $_POST['read'];
//$read= 'jenis_produk';
if($read=="login"){
$username = $_POST['username'];
$password = $_POST['password'];
$count = mysqli_num_rows($query);
if($count == 1) {
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('message'=>'sukses','result'=>$result));
}else {
echo json_encode(array('message'=>'gagal'));
}
}else if($read=="edit_password"){
$username = $_POST['username'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="data_user"){
$username = $_POST['username'];
$result = array();
}else if($read=="data_user_nasabah"){
$username = $_POST['username'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="data_filter_nasabah"){
$id_user= $_POST['id_user'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="data_filter_sf"){
$id_user= $_POST['id_user'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="data_nasabah"){
$id_nasabah= $_POST['id_nasabah'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="data_pengajuan"){
$nomor_pengajuan= $_POST['nomor_pengajuan'];
$result = array();
$query = mysqli_query($CON,"SELECT * FROM tb_pengajuan_fix where
nomor_pengajuan='$nomor_pengajuan' ");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="data_pengajuan_nasabah_lama"){
$nomor_pengajuan= $_POST['nomor_pengajuan'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="pribadi_nasabah_update"){
$username = $_POST['username'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="data_produk_implan"){
$id_jenis_produk = $_POST['id_jenis_produk'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="data_produk_pensiun"){
$id_jenis_produk = $_POST['id_jenis_produk'];
$result = array();
$query = mysqli_query($CON,"SELECT * FROM tb_pensiun where
id_pensiun='$id_jenis_produk' ");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="data_produk_prapen"){
$id_jenis_produk = $_POST['id_jenis_produk'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="cek_send_pengajuan"){
$nomor_pengajuan = $_POST['nomor_pengajuan'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="cek_send_prapen"){
$nomor_pengajuan = $_POST['nomor_pengajuan'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="cek_send_implan"){
$nomor_pengajuan = $_POST['nomor_pengajuan'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="cek_send_implan_sf"){
$nomor_pengajuan = $_POST['nomor_pengajuan'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="cek_send_pensiun_sf"){
$nomor_pengajuan = $_POST['nomor_pengajuan'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="cek_data_jaminan"){
$result = array();
}else if($read=="cek_data_pensiun"){
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="cek_data_prapen"){
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="berita"){
$result = array();
$query = mysqli_query($CON,"SELECT * FROM tb_berita order by id_berita desc
limit 4");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
} else if($read=="nomor_data_nasabah"){
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="detail_berita"){
$judul = $_POST['judul'];
$result = array();
$query = mysqli_query($CON,"SELECT * FROM tb_berita where judul='$judul'");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="id_user"){
$nik = $_POST['nik_user'];
$result = array();
$id_user=0;
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
$id_user = $row['id_user'];
}
echo json_encode(array('result'=>$result));
}else if($read=="nik_nasabah_sf"){
$id_sf = $_POST['id_sf'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="detail_nik"){
$nik = $_POST['nik'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="cek_pengajuan_nasabah"){
$id_nasabah = $_POST['id_nasabah'];
$id_jenis_produk = $_POST['id_jenis_produk'];
$count = mysqli_num_rows($query);
if($count == 1) {
echo json_encode(array('message'=>'pengajuan'));
}else {
echo json_encode(array('message'=>'kosong'));
}
}else if($read=="cek_username"){
$username = $_POST['username'];
$count = mysqli_num_rows($query);
if($count == 1) {
echo json_encode(array('message'=>'ada'));
}else {
echo json_encode(array('message'=>'kosong'));
}
}else if($read=="indikator_input"){
$nomor_pengajuan = $_POST['nomor_pengajuan'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="kota"){
$result = array();
$query = mysqli_query($CON,"SELECT * FROM tb_regencies");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="kpr"){
$result = array();
}else if($read=="nik"){
$nik = $_POST['nik'];
$result = array();
}else if($read=="nik_kota"){
$kota = $_POST['kota'];
$result = array();
$query = mysqli_query($CON,"SELECT * FROM tb_data_pribadi ");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nomor_data_pribadi"){
$result = array();
$query = mysqli_query($CON,"SELECT (MAX(id_pribadi)+1) as np FROM
tb_data_pribadi ");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nomor_pengajuan"){
$result = array();
$query = mysqli_query($CON,"SELECT (MAX(nomor_pengajuan)+1) as np FROM
tb_pengajuan_fix ");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="profil"){
$username = $_POST['username'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="nasabah_lama"){
$id_sf = $_POST['id_sf'];
$status_pengajuan =$_POST['status_pengajuan'];
$result = array();
$id_sf = $_POST['id_petugas'];
$status_pengajuan =$_POST['status_pengajuan'];
$result = array();
}else if($read=="proses_nasabah"){
$id_nasabah = $_POST['id_nasabah'];
$status_pengajuan = $_POST['status_pengajuan'];
$result = array();
//=====================dana talangan============================================
}else if($read=="proses_talangan"){
$id_sf = $_POST['id_petugas'];
$result = array();
}else if($read=="aprv_askrindo"){
$result = array();
}else if($read=="aprv_bm_bsm"){
$result = array();
}else if($read=="done_askrindo"){
$result = array();
}else if($read=="done_bm_bsm"){
$result = array();
}else if($read=="data_jaminan"){
$id_jaminan = $_POST['id_jaminan'];
$result = array();
}else if($read=="proses_cool_sf"){
$id_sf = $_POST['id_petugas'];
$status_pengajuan = $_POST['status_pengajuan'];
$result = array();
}else if($read=="proses_warm_sf"){
$id_sf = $_POST['id_petugas'];
$status_pengajuan = $_POST['status_pengajuan'];
$result = array();
}else if($read=="proses_hot_sf"){
$id_sf = $_POST['id_petugas'];
$status_pengajuan = $_POST['status_pengajuan'];
$result = array();
}
else if($read=="selesai_sf"){
$id_sf = $_POST['id_petugas'];
$status_pengajuan = "3";
$result = array();
}
else if($read=="selesai_nasabah"){
$id_nasabah = $_POST['id_nasabah'];
$status_pengajuan = "4";
$result = array();
$query = mysqli_query($CON,"SELECT * FROM tb_pengajuan_fix,
tb_data_nasabah_fix,tb_pencairan_fix,tb_jenis_produk where
tb_pengajuan_fix.id_jenis_produk=tb_jenis_produk.id_jenis_produk AND where
tb_pengajuan_fix.id_nasabah=tb_data_nasabah_fix.id_nasabah AND
tb_pengajuan_fix.nomor_pengajuan=tb_pencairan_fix.nomor_pengajuan AND
tb_pengajuan_fix.id_nasabah ='$id_nasabah' AND status_pengajuan='$status_pengajuan'
ORDER BY tb_pengajuan_fix.nomor_pengajuan DESC ");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="seleksi_kota"){
$nama_kota = $_POST['nama_kota'];
$result = array();
$query = mysqli_query($CON,"SELECT * FROM tb_regencies where
name='$nama_kota'");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="update"){
$nomor_pengajuan = $_POST['nomor_pengajuan'];
$result = array();
}else if($read=="update_data_pribadi"){
$username = $_POST['username'];
$result = array();
echo json_encode(array('result'=>$result));
}else if($read=="cek_admin"){
$username = $_POST['username'];
$count = mysqli_num_rows($query);
if($count == 1) {
echo json_encode(array('message'=>'admin'));
}else {
echo json_encode(array('message'=>'pelanggan'));
}
// ==========================================================
}else if($read=="cari_tanggal_pengajuan"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_pengajuan_hari"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_pencairan"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($read=="cari_tanggal_pencairan_hari"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_setuju"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($read=="cari_tanggal_setuju_hari"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
//==================================================================
}else if($read=="cari_data_cool"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_cool_hari"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
// CAIR BELUM
}else if($read=="cari_data_warm"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_warm_hari"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
// CAIR BELUM
}else if($read=="cari_data_hot"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_hot_hari"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" ){
if($jenis = $_POST['jenis']=="0"){
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$loksf = $_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
// CAIR BELUM
// ==========================================================
}else if($read=="cari_tanggal_pengajuan_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_pengajuan_hari_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_pencairan_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
// pencarian per hari
}else if($read=="cari_tanggal_pencairan_hari_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_setuju_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_setuju_hari_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
// ==================================================================
}else if($read=="cari_data_cool_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
$query = mysqli_query($CON,"SELECT COUNT(nomor_pengajuan) as status
from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.id='$lok' AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='1' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_cool_hari_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_warm_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
}else if($read=="cari_data_warm_hari_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_hot_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_hot_hari_korwil"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
// ======================================================================
// ==========================================================
}else if($read=="cari_tanggal_pengajuan_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
$query = mysqli_query($CON,"SELECT COUNT(nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='4' AND
id_jenis_produk='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_pengajuan_hari_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_pencairan_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
$query = mysqli_query($CON,"SELECT COUNT(nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND check_data='3' AND id_jenis_produk!
='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
// pencarian per hari
}else if($read=="cari_tanggal_pencairan_hari_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
$query = mysqli_query($CON,"SELECT COUNT(nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal, status_pengajuan from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.id='$lokkorwil' AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y') AND
check_data='3' AND id_jenis_produk='$jenis' AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_setuju_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_tanggal_setuju_hari_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
$query = mysqli_query($CON,"SELECT COUNT(nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal, status_pengajuan from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.id='$lokkorwil' AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y') AND
check_data='2' AND id_jenis_produk!='$jenis' AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
// ==================================================================
}else if($read=="cari_data_cool_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_cool_hari_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
}else if($read=="cari_data_warm_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_warm_hari_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_hot_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
}else if($read=="cari_data_hot_hari_direktur"){
if($_POST['indikator']=="all_data"){
if($jenis = $_POST['jenis']=="0"){
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else if($_POST['indikator']=="detail_data" && $_POST['loksf']==null &&
$_POST['lokkorea']==null){
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}else{
if($jenis = $_POST['jenis']=="0"){
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else{
$lokkorea =$_POST['lokkorea'];
$loksf =$_POST['loksf'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$lokkorwil = $_POST['lokkorwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
}
// ======================================================================
}else if($read=="jenis_produk"){
$result = array();
$query = mysqli_query($CON,"SELECT * FROM tb_jenis_produk");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="filter_jenis_produk"){
$jenis = $_POST['jenis'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nik_data_pribadi"){
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="konfirmasi"){
$kode_konf = $_POST['kode_konf'];
$status_konf = $_POST['status_konf'];
$result = array();
}else if($read=="cek_nikSF"){
$nik = $_POST['nik'];
$count = mysqli_num_rows($query);
if($count == 1) {
echo json_encode(array('message'=>'ada'));
}else {
echo json_encode(array('message'=>'kosong'));
}
}else if($read=="tugas_sf_korea"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="tugas_sf_korwil"){
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$lok = $_POST['lok'];
$result = array();
$query = mysqli_query($CON,"SELECT
tb_data_sf_fix.nik,tb_data_sf_fix.nama_lengkap as sf, tb_cabang_fix.nama as
lokasi,status_pengajuan,tb_data_nasabah_fix.nama_lengkap as nasabah from
tb_data_nasabah_fix, tb_data_sf_fix,
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.id='$lok' AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_data_sf_fix.id_sf=tb_pengajuan_fix.id_sf AND
tb_data_nasabah_fix.id_nasabah=tb_pengajuan_fix.id_nasabah");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="tugas_sf_korea_hari"){
$tgl_awal = $_POST['tgl_awal'];
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="tugas_sf_korwil_hari"){
$tgl_awal = $_POST['tgl_awal'];
$lok = $_POST['lok'];
$result = array();
$query = mysqli_query($CON,"SELECT
tb_data_sf_fix.nik,tb_data_sf_fix.nama_lengkap as sf, tb_cabang_fix.nama as
lokasi,status_pengajuan ,tb_data_nasabah_fix.nama_lengkap as nasabah from
tb_data_nasabah_fix, tb_data_sf_fix,
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.id='$lok' AND tgl_pengajuan
= '$tgl_awal' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_data_sf_fix.id_sf=tb_pengajuan_fix.id_sf AND
tb_data_nasabah_fix.id_nasabah=tb_pengajuan_fix.id_nasabah");
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
// KORWIL =================================================================
}else if($read=="nama_korwil_direktur"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nama_korwil_korwil"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nama_korea_direktur"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nama_korea_korwil"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nama_SF_direktur"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
// KOREA ==================================================================
}else if($read=="nama_SF_korwil"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
// KOREA ==================================================================
}else if($read=="nama_SF_korea"){
$lok = $_POST['lok'];
$result = array();
}else if($read=="filter_LokSF"){
$nama_sf = $_POST['nama_sf'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="filter_LokKorea"){
$nama_korea = $_POST['nama_korea'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="filter_LokKorwil"){
$nama_korwil = $_POST['nama_korwil'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="berita_emas"){
$result = array();
}else if($read=="data_lokasi_user"){
$id_user= $_POST['id_user'];
$result = array();
echo json_encode(array('result'=>$result));
//===============================================STRUKTUR EKA==================
else if($read=="nama_korwil_eka"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nama_korea_eka"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nama_sf_eka"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
//===============================================KHUSUS BSM==================
else if($read=="nama_RO"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nama_area"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nama_branch"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}else if($read=="nama_sf"){
$lok = $_POST['lok'];
$result = array();
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
//==========================pengajuan bsm hari=====================
else if($read=="cari_pengajuan_bsm_hari"){
$lok = $_POST['lok'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$result = array();
$sql = "";
//nasional
if($lok=="20191"){
$sql = "SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y') AND status_pengajuan='4' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
}else if($lok=="20192"){
$sql = "SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y') AND status_pengajuan='4' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
}
//wilayah
else if(strlen($lok)<3) {
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.wilayah_bsm_id='$lok' AND
tgl_pengajuan ='$tgl_awal' AND status_pengajuan='4' AND id_jenis_produk!='$jenis'
AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//area
else if(strlen($lok)>3 && strlen($lok)<6){
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from tb_user_fix,tb_area_eka,tb_area_bsm, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix where tb_area_bsm.id='$lok' AND
tb_area_bsm.wilayah_eka_id=tb_area_eka.area_bsm_id AND tgl_pengajuan ='$tgl_awal'
AND status_pengajuan='4' AND id_jenis_produk!='$jenis' AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//branch
else if(strlen($lok)>6){
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from tb_user_fix, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix,tb_data_sf_fix where tgl_pengajuan ='$tgl_awal' AND
status_pengajuan='4' AND id_jenis_produk!='$jenis' AND tb_cabang_fix.id='$lok' AND
tb_cabang_fix.id=tb_detail_lokasi.lokasi_user AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_data_sf_fix.id_user=tb_user_fix.id_user AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok order by nama_lengkap asc";
}
$query = mysqli_query($CON,$sql);
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
//==========================persetujuan bsm=====================
else if($read=="cari_persetujuan_bsm_hari"){
$lok = $_POST['lok'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$result = array();
$sql = "";
//nasional
if($lok=="20191"){
$sql = "SELECT COUNT(tb_persetujuan.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from tb_persetujuan,
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y') AND tb_persetujuan.check_data='2'
AND id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user
AND tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan";
}
else if($lok=="20192"){
$sql = "SELECT COUNT(tb_persetujuan.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from
tb_persetujuan,tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,t
b_pengajuan_fix,tb_wilayah, tb_wilayah_pusat where
tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND tb_area_bsm.id=tb_area_eka.area_bsm_id
AND tb_wilayah_pusat.id='$lok' AND tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id
AND str_to_date(tgl_pengajuan,'%d-%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y')
AND tb_persetujuan.check_data='2' AND id_jenis_produk!='$jenis' AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan";
//wilayah
else if(strlen($lok)<3) {
$sql="SELECT COUNT(tb_persetujuan.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from tb_persetujuan,
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.wilayah_bsm_id='$lok' AND
tgl_pengajuan ='$tgl_awal' AND tb_persetujuan.check_data='2' AND id_jenis_produk!
='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan";
}
//area
else if(strlen($lok)>3 && strlen($lok)<6){
$sql="SELECT COUNT(tb_persetujuan.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from tb_persetujuan,
tb_user_fix,tb_area_eka,tb_area_bsm, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix where tb_area_bsm.id='$lok' AND
tb_area_bsm.wilayah_eka_id=tb_area_eka.area_bsm_id AND tgl_pengajuan ='$tgl_awal'
AND tb_persetujuan.check_data='2' AND id_jenis_produk!='$jenis' AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan";
}
//branch
else if(strlen($lok)>6){
$sql="SELECT COUNT(tb_persetujuan.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from tb_persetujuan, tb_user_fix,
tb_detail_lokasi, tb_cabang_fix,tb_pengajuan_fix,tb_data_sf_fix where tgl_pengajuan
='$tgl_awal' AND tb_persetujuan.check_data='2' AND id_jenis_produk!='$jenis' AND
tb_cabang_fix.id='$lok' AND tb_cabang_fix.id=tb_detail_lokasi.lokasi_user AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_data_sf_fix.id_user=tb_user_fix.id_user AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok order by nama_lengkap asc AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan";
}
$query = mysqli_query($CON,$sql);
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result,'sql'=>$sql));
}
//==========================pencairan bsm=====================
else if($read=="cari_pencairan_bsm_hari"){
$lok = $_POST['lok'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$result = array();
$sql = "";
//nasional
if($lok=="20191"){
$sql = "SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y') AND check_data='3' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
}else if($lok=="20192"){
$sql = "SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y') AND check_data='3' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
//wilayah
else if(strlen($lok)<3) {
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.wilayah_bsm_id='$lok' AND
tgl_pengajuan ='$tgl_awal' AND check_data='3' AND id_jenis_produk!='$jenis' AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//area
else if(strlen($lok)>3 && strlen($lok)<6){
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from tb_user_fix,tb_area_eka,tb_area_bsm, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix where tb_area_bsm.id='$lok' AND
tb_area_bsm.wilayah_eka_id=tb_area_eka.area_bsm_id AND tgl_pengajuan ='$tgl_awal'
AND check_data='3' AND id_jenis_produk!='$jenis' AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//branch
else if(strlen($lok)>6){
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from tb_user_fix, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix,tb_data_sf_fix where tgl_pengajuan ='$tgl_awal' AND
check_data='3' AND id_jenis_produk!='$jenis' AND tb_cabang_fix.id='$lok' AND
tb_cabang_fix.id=tb_detail_lokasi.lokasi_user AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_data_sf_fix.id_user=tb_user_fix.id_user AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok order by nama_lengkap asc";
}
$query = mysqli_query($CON,$sql);
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
$lok = $_POST['lok'];
$tgl_awal = $_POST['tgl_awal'];
$jenis = $_POST['jenis'];
$cek = $_POST['cek'];
$result = array();
$sql = "";
//nasional
if($lok=="20191"){
$sql = "SELECT COUNT(nomor_pengajuan) as status from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y') AND status_pengajuan='$cek' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
}else if($lok=="20192"){
$sql = "SELECT COUNT(nomor_pengajuan) as status from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') = str_to_date('$tgl_awal','%d-%m-%Y') AND status_pengajuan='$cek' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
//wilayah
else if(strlen($lok)<3) {
$sql="SELECT COUNT(nomor_pengajuan) as status from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.wilayah_bsm_id='$lok' AND
tgl_pengajuan ='$tgl_awal' AND status_pengajuan='$cek' AND id_jenis_produk!
='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//area
else if(strlen($lok)>3 && strlen($lok)<6){
$sql="SELECT COUNT(nomor_pengajuan) as status from
tb_user_fix,tb_area_eka,tb_area_bsm, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix where tb_area_bsm.id='$lok' AND
tb_area_bsm.wilayah_eka_id=tb_area_eka.area_bsm_id AND tgl_pengajuan ='$tgl_awal'
AND status_pengajuan='$cek' AND id_jenis_produk!='$jenis' AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//branch
else if(strlen($lok)>6){
$sql="SELECT COUNT(nomor_pengajuan) as status from tb_user_fix,
tb_detail_lokasi, tb_cabang_fix,tb_pengajuan_fix,tb_data_sf_fix where tgl_pengajuan
='$tgl_awal' AND status_pengajuan='$cek' AND id_jenis_produk!='$jenis' AND
tb_cabang_fix.id='$lok' AND tb_cabang_fix.id=tb_detail_lokasi.lokasi_user AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_data_sf_fix.id_user=tb_user_fix.id_user AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok order by nama_lengkap asc";
}
$query = mysqli_query($CON,$sql);
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
//==========================pengajuan bsm=====================
else if($read=="cari_pengajuan_bsm"){
$lok = $_POST['lok'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$result = array();
$sql = "";
//nasional
if($lok=="20191"){
$sql = "SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='4' AND id_jenis_produk!
='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
}else if($lok=="20192"){
$sql = "SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='4' AND id_jenis_produk!
='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
}
//wilayah
else if(strlen($lok)<3) {
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.wilayah_bsm_id='$lok' AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='4' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//area
else if(strlen($lok)>3 && strlen($lok)<6){
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from tb_user_fix,tb_area_eka,tb_area_bsm, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix where tb_area_bsm.id='$lok' AND
tb_area_bsm.wilayah_eka_id=tb_area_eka.area_bsm_id AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='4' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//branch
else if(strlen($lok)>6){
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from tb_user_fix, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix,tb_data_sf_fix where str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='4' AND id_jenis_produk!
='$jenis' AND tb_cabang_fix.id='$lok' AND
tb_cabang_fix.id=tb_detail_lokasi.lokasi_user AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_data_sf_fix.id_user=tb_user_fix.id_user AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok order by nama_lengkap asc";
}
$query = mysqli_query($CON,$sql);
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result));
}
//==========================persetujuan bsm=====================
else if($read=="cari_persetujuan_bsm"){
$lok = $_POST['lok'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$result = array();
$sql = "";
//nasional
if($lok=="20191"){
$sql = "SELECT COUNT(tb_pengajuan_fix.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from tb_persetujuan,
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND tb_persetujuan.check_data!='' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan";
}else if($lok=="20192"){
$sql = "SELECT COUNT(tb_persetujuan.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from tb_persetujuan,
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND tb_persetujuan.check_data='2' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan";
//wilayah
else if(strlen($lok)<3) {
$sql="SELECT COUNT(tb_persetujuan.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from tb_persetujuan,
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.wilayah_bsm_id='$lok' AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND tb_persetujuan.check_data='2' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan";
}
//area
else if(strlen($lok)>3 && strlen($lok)<6){
$sql="SELECT COUNT(tb_persetujuan.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from tb_persetujuan,
tb_user_fix,tb_area_eka,tb_area_bsm, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix where tb_area_bsm.id='$lok' AND
tb_area_bsm.wilayah_eka_id=tb_area_eka.area_bsm_id AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND tb_persetujuan.check_data='2' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan";
}
//branch
else if(strlen($lok)>6){
$sql="SELECT COUNT(tb_persetujuan.nomor_pengajuan) as acc,
SUM(nominal_pengajuan) as nominal from tb_persetujuan, tb_user_fix,
tb_detail_lokasi, tb_cabang_fix,tb_pengajuan_fix,tb_data_sf_fix where
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND tb_persetujuan.check_data='2' AND
id_jenis_produk!='$jenis' AND tb_cabang_fix.id='$lok' AND
tb_cabang_fix.id=tb_detail_lokasi.lokasi_user AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_data_sf_fix.id_user=tb_user_fix.id_user AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok AND
tb_pengajuan_fix.nomor_pengajuan = tb_persetujuan.nomor_pengajuan order by
nama_lengkap asc ";
}
$query = mysqli_query($CON,$sql);
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result,'sql'=>$sql));
}
//==========================pencairan bsm=====================
else if($read=="cari_pencairan_bsm"){
$lok = $_POST['lok'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$result = array();
$sql = "";
//nasional
if($lok=="20191"){
$sql = "SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND check_data='3' AND id_jenis_produk!
='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
}else if($lok=="20192"){
$sql = "SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND check_data='3' AND id_jenis_produk!
='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
//wilayah
else if(strlen($lok)<3) {
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.wilayah_bsm_id='$lok' AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND check_data='3' AND id_jenis_produk!
='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//area
else if(strlen($lok)>3 && strlen($lok)<6){
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from tb_user_fix,tb_area_eka,tb_area_bsm, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix where tb_area_bsm.id='$lok' AND
tb_area_bsm.wilayah_eka_id=tb_area_eka.area_bsm_id AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND check_data='3' AND id_jenis_produk!
='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//branch
else if(strlen($lok)>6){
$sql="SELECT COUNT(nomor_pengajuan) as acc, SUM(nominal_pengajuan) as
nominal from tb_user_fix, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix,tb_data_sf_fix where str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND check_data='3' AND id_jenis_produk!
='$jenis' AND tb_cabang_fix.id='$lok' AND
tb_cabang_fix.id=tb_detail_lokasi.lokasi_user AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_data_sf_fix.id_user=tb_user_fix.id_user AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok order by nama_lengkap asc";
}
$query = mysqli_query($CON,$sql);
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result,'sql'=>$sql));
}
$lok = $_POST['lok'];
$tgl_awal = $_POST['tgl_awal'];
$tgl_akhir = $_POST['tgl_akhir'];
$jenis = $_POST['jenis'];
$cek = $_POST['cek'];
$result = array();
$sql = "";
//nasional
if($lok=="20191"){
$sql = "SELECT COUNT(nomor_pengajuan) as status from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='$cek' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
}
else if($lok=="20191"){
$sql = "SELECT COUNT(nomor_pengajuan) as status from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah, tb_wilayah_pusat where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah_pusat.id='$lok' AND
tb_wilayah.id_wilayah_pusat=tb_wilayah_pusat.id AND str_to_date(tgl_pengajuan,'%d-
%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y') AND
str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='$cek' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok";
//wilayah
else if(strlen($lok)<3) {
$sql="SELECT COUNT(nomor_pengajuan) as status from
tb_user_fix,tb_detail_lokasi,tb_area_eka,tb_area_bsm,tb_cabang_fix,tb_pengajuan_fix
,tb_wilayah where tb_wilayah.id=tb_area_bsm.wilayah_eka_id AND
tb_area_bsm.id=tb_area_eka.area_bsm_id AND tb_wilayah.wilayah_bsm_id='$lok' AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='$cek' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//area
else if(strlen($lok)>3 && strlen($lok)<6){
$sql="SELECT COUNT(nomor_pengajuan) as status from
tb_user_fix,tb_area_eka,tb_area_bsm, tb_detail_lokasi,
tb_cabang_fix,tb_pengajuan_fix where tb_area_bsm.id='$lok' AND
tb_area_bsm.wilayah_eka_id=tb_area_eka.area_bsm_id AND
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='$cek' AND
id_jenis_produk!='$jenis' AND tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_detail_lokasi.lokasi_user=tb_cabang_fix.id AND
tb_area_eka.id=tb_cabang_fix.area_id AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok ";
}
//branch
else if(strlen($lok)>6){
$sql="SELECT COUNT(nomor_pengajuan) as status from tb_user_fix,
tb_detail_lokasi, tb_cabang_fix,tb_pengajuan_fix,tb_data_sf_fix where
str_to_date(tgl_pengajuan,'%d-%m-%Y') BETWEEN str_to_date('$tgl_awal','%d-%m-%Y')
AND str_to_date('$tgl_akhir','%d-%m-%Y') AND status_pengajuan='$cek' AND
id_jenis_produk!='$jenis' AND tb_cabang_fix.id='$lok' AND
tb_cabang_fix.id=tb_detail_lokasi.lokasi_user AND
tb_user_fix.id_user=tb_detail_lokasi.id_user AND
tb_data_sf_fix.id_user=tb_user_fix.id_user AND
tb_pengajuan_fix.id_lok=tb_detail_lokasi.id_lok order by nama_lengkap asc";
}
$query = mysqli_query($CON,$sql);
while($row = mysqli_fetch_assoc($query)){
$result[] = $row;
}
echo json_encode(array('result'=>$result,'sql'=>$sql));
}
?>