<?php
$dt=ricar();
echo json_encode($dt);
function ricar() {
  global $db,$ar;
  $dt=array();
  $dt1=array();
  $dt2=array();
  $dt3=array();
  $dt4=array();
  $today=time();

  $sql1="SELECT noken,model,tipe,merk,cylinder,sumbu,warna,bbm,th_rakit,tax_exp,stnk_exp,total,spionam_st,cid from `car_tax` where cid=167 or cid=217 or cid=802 order by noken";
  $res1=mysqli_query($db,$sql1);
  while($r1=mysqli_fetch_assoc($res1)) {
    $str_stnk=strtotime($r1['stnk_exp']);
    $str_tax =strtotime($r1['tax_exp']);

    $dt1[$r1['noken']]=$r1;
    $dt1[$r1['noken']]['total_rp']=ang2($r1['total']);
    if($today<$str_tax) {
      $dt1[$r1['noken']]['stnk_st']='lunas';
    } else {
      $dt1[$r1['noken']]['stnk_st']='terlambat';      
    }
  }  

  $sql2="SELECT noken,jenis_angkutan,kps_no,kps_masa,trayek_kendaraan,jenis_layanan,seat,uji_berkala_no,uji_berkala_masa,nomor_rangka,nomor_mesin,nomor_srut,armada,spionam_st,update_at from `car` where company_id=167 or company_id=217 or company_id=802 order by noken";
  $res2=mysqli_query($db,$sql2);
  //$dt['count']=mysqli_num_rows($res2);
  if(mysqli_num_rows($res2)>0) {
    $a=0;
    while($r2=mysqli_fetch_assoc($res2)) {
      $dt2[$r2['noken']]=$r2;
      $dt2[$r2['noken']]['update_at']=date("Y-m-d H:i:s",$r2['update_at']);
      $dt2[$r2['noken']]['kps_end']=date("Y-m-d",$r2['kps_masa']);
      $dt2[$r2['noken']]['uji_berkala_end']=date("Y-m-d",$r2['uji_berkala_masa']);
      if($today<$r2['kps_masa']) {
        $dt2[$r2['noken']]['kps_st']='aktif/berlaku';
      } else {
        $dt2[$r2['noken']]['kps_st']='terlambat';      
      }
      $a++;
    }
  } 

  $sql4="SELECT id,noken,spionam_id,no_uji,masa_berlaku,jenis_kendaraan,merk,srut_no,kps_no,srut_tgl,kps_exp_tgl,pelaksana,spionam_st,cid from `blue` where cid=167 or cid=217 or cid=802 order by noken";
  $res4=mysqli_query($db,$sql4);
  while($r4=mysqli_fetch_assoc($res4)) {
    $str_uji=strtotime($r4['masa_berlaku']);
    $dt4[$r4['noken']]=$r4;
    if($today<$str_uji) {
      $dt4[$r4['noken']]['uji_st']='aktif/berlaku';
    } else {
      $dt4[$r4['noken']]['uji_st']='terlambat';      
    }
  }  


  $sql3="SELECT lambung from `armada_v2` where `lambung`>0  group by lambung order by lambung";
  //echo $sql.";<br>";
  $res3=mysqli_query($db,$sql3);
  $dt['count']['all']=mysqli_num_rows($res3);
  while($r3=mysqli_fetch_assoc($res3)) {
    $sql4="SELECT noken from `armada_v2` where lambung=".$r3['lambung']." and `noken`!='' order by tgl_last desc limit 1";
    //echo $sql.";<br>";
    $res4=mysqli_query($db,$sql4);
    $r4=mysqli_fetch_assoc($res4);
    $dt['bynl'][$r3['lambung']]['noken']=$r4['noken'];
    $dt['bynl'][$r3['lambung']]['tax']=$dt1[$r4['noken']];
    $dt['bynl'][$r3['lambung']]['spionam']=$dt2[$r4['noken']];
    $dt['bynl'][$r3['lambung']]['blue']=$dt4[$r4['noken']];
  }
  file_put_contents($ar['app_path']."js/ricar.json", json_encode($dt)); 
  //echo json_encode($dt);
return $dt;
$db->close();
} 
?>
/home/u902783705/domains/azkapersada.com/public_html/sub/
rs2/api/v2/php/ricar.php
si/common.function
si/dom/get.img
si/api/post_location
si/api/post_loc_v3
si/api/post_tag_v2
si/api/post_tag_v3
common.function
common.function-
footer
header
inc.app.function
inc.ar.app
index
tes_curl
ucol
api/v2/api.function
api/v2/inc.mail
api/v2/index
api/v2/php/agen
api/v2/php/armada_jalan_byday
api/v2/php/armada_perpal_byday
api/v2/php/armada_perpal_byday-
api/v2/php/beda_byday
api/v2/php/cek_rute_baru
api/v2/php/cek_rute_time
api/v2/php/cek_rute_time_v1
api/v2/php/cek_rute_time_v2
api/v2/php/city
api/v2/php/dr_time_byday
api/v2/php/dr_time_jalan_byday
api/v2/php/email_cek
api/v2/php/get_nl_byday
api/v2/php/get_nl_kelas_armada
api/v2/php/js_armada_tax_expire
api/v2/php/js_blue_armada
api/v2/php/js_blue_expire
api/v2/php/js_car_srut_blank
api/v2/php/js_img_todl
api/v2/php/js_jalurnew
api/v2/php/js_kebid
api/v2/php/js_nl_latest
api/v2/php/js_nl_min
api/v2/php/js_noken
api/v2/php/js_noken_mesin_blank
api/v2/php/js_noken_no_lambung
api/v2/php/js_noken_spionam_cek
api/v2/php/js_noken_tax_cek
api/v2/php/js_rute
api/v2/php/js_rute_bycity
api/v2/php/js_rute_min
api/v2/php/js_spionam_id
api/v2/php/js_spionam_kps
api/v2/php/kd_armada
api/v2/php/kd_armada_dr_time
api/v2/php/kd_armada_to_time
api/v2/php/naik_byday
api/v2/php/nk_pilih
api/v2/php/nl_noken_bytgl
api/v2/php/nl_pilih
api/v2/php/nl_reset
api/v2/php/noken_koreksi
api/v2/php/otw
api/v2/php/otw_not_full
api/v2/php/password_forgot
api/v2/php/post_1naik
api/v2/php/post_1turun
api/v2/php/post_blue
api/v2/php/post_dr_time_byday_local
api/v2/php/post_kebid_byday
api/v2/php/post_noken_mesin
api/v2/php/post_noken_no_lambung
api/v2/php/post_sakpol
api/v2/php/post_spionam
api/v2/php/post_spionam_cek
api/v2/php/post_spionam_update
api/v2/php/post_spnm_noken
api/v2/php/ricar
api/v2/php/rute_price
api/v2/php/selisih_bagasi
api/v2/php/signin
api/v2/php/tool
api/v2/php/tool_armada
api/v2/php/tool_lambung
api/v2/php/tool_noken
api/v2/php/turun_byday
api/v2/php/ucol
api/v2/php/uji_no
api/v2/php/update_agen
api/v2/php/update_armada_byday
api/v2/php/update_armada_v2_byday
api/v2/php/update_bagasi_byday
api/v2/php/update_bagasi_city
api/v2/php/update_jalan_byday
api/v2/php/update_penumpang_byday
api/v2/php/update_trayek_dr_time
api/v2/php/update_trayek_to_time
daily/10_tool_seq
daily/14_update_kd_armada
daily/15_update_rute_dr_to_ccd
daily/16_kdagen_to_id
daily/16_kdagen_to_id-
daily/17_update_dr_to_time
inc/inc.cp_sphp
inc/inc.filephp
inc/inc.job_kebid
inc/inc.js_pergi
inc/inc.rs4_css
inc/inc.rs4_html
inc/inc.rs4_h_page
inc/inc.rs4_h_tab
inc/inc.rs4_js
inc/inc.rs4_jsf
inc/inc.t1_css
inc/inc.t1_html
inc/inc.t1_h_page
inc/inc.t1_h_tab
inc/inc.t1_js
inc/inc.t1_jsf
xhr/inc.xhr