SHARE
TWEET

getDataCustomers

a guest Jan 15th, 2020 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function getDataCustomers($cabang, $status, $remark){
  2.         $datacustomer='';
  3.         $urlfile = Parameters::select('value')->where('NAME', 'url.nama.file')->first();
  4.         $datacustomer=DB::table('Customers')->leftJoin('Lock_Excepts', 'Customers.ID', '=', 'Lock_Excepts.CUSTOMER_ID')
  5.                 ->select('Customers.ID AS idcus', 'Customers.LOCAL_CODE', 'Customers.SAP_CODE', 'Customers.NAME', 'Customers.ADDRESS',  'Customers.CITY', 'Customers.BRANCH','Customers.LOCK_STATUS', 'Lock_Excepts.REMARK' )
  6.                 ->get();
  7. return DataTables()->of($datacustomer)
  8.         ->editColumn('lock_status', function($data) use($urlfile) {
  9.             $link="";
  10.             if ($data->lock_status ==1){
  11.                 $link .= '<span class="label label-danger">&nbsp;&nbsp;&nbsp;<b>'."TERKUNCI".'</b></span><br>';
  12.             } else {
  13.                 $link .=  '<span class="label label-success"><b>'."TERBUKA".'</b></span><br>';
  14.             }
  15.  
  16.             if($data->remark==3){
  17.                 $link .= '<span class="label label-warning"><b>'."Range Payment".'</b></span>';
  18.             } else if ($data->remark==2){
  19.                 $link .= '<span class="label label-info"><b>'."Auto/Adv.Payment".'</b></span>';
  20.             } else {
  21.                 $link .= '<span class="label label-primary"><b>'."Normal Payment".'</b></span>';
  22.             }
  23.            
  24.             $file = Lock_logs::select('remark')
  25.             ->where('REMARK', 'like', '%'.$data->local_code.'%')->pluck('remark');
  26.  
  27.             for ($k=0; $k<count($file); $k++){
  28.                 $link .= '<b><a href="'.$urlfile->value.$file[$k].'">Berita Acara '.($k+1).'</a></b><br>';
  29.             }
  30.  
  31.             return $link;
  32.         })
  33.         ->addColumn('detail', function($data){
  34.             $link = '<div class="btn-group"><a href="javascript:void(0);"
  35.              id="detail-customer" data-id="'.$data->local_code.'" class="btn-sm btn-primary">
  36.              <i class="fas fa-align-justify"></i>  Detail  </a>';
  37.             $link .= '&nbsp</div>';
  38.             return $link;
  39.         })
  40.         ->editColumn('aksi', function($data) use($cabang, $remark){
  41.             if ($cabang=='semua'){
  42.             return 'Pilih Cabang Agar Tombol Autocoll Enabled';
  43.             }else{
  44.                 if ($data->remark==2){
  45.                     return '<div style="width:100px">  <select class="custom-select col-12 sap_code_dropdown" name="lockexcept" id="lockexcept" data-id="'.$data->idcus.'" local-code="'.$data->local_code.'" required="">
  46.                     <option value="">--- Pilih  ---</option>
  47.                     <option value="3" local-code="'.$data->local_code.'" >Range Payment</option>
  48.                     <option value="2" selected="">AutoColl / Adv. Payment</option>
  49.                     <option value="1" >Normal</option>
  50.                     </select></div>';
  51.                 } else if ($data->remark==3){
  52.                     return '<div style="width:100px">  <select   class="custom-select col-12 sap_code_dropdown" name="lockexcept" id="lockexcept" data-id="'.$data->idcus.'"  local-code="'.$data->local_code.'"required="">
  53.                     <option value="">--- Pilih  ---</option>
  54.                     <option value="3" local-code="'.$data->local_code.'" selected="">Range Payment</option>
  55.                     <option value="2">AutoColl / Adv. Payment</option>
  56.                     <option value="1">Normal</option>
  57.                     </select></div>';
  58.                 } else {
  59.                     return '<div style="width:100px">  <select   class="custom-select col-12 sap_code_dropdown" name="lockexcept" id="lockexcept" data-id="'.$data->idcus.'" local-code="'.$data->local_code.'"required="">
  60.                     <option value="">--- Pilih  ---</option>
  61.                     <option value="3" local-code="'.$data->local_code.'">Range Payment</option>
  62.                     <option value="2">AutoColl / Adv. Payment</option>
  63.                     <option value="1" selected="">Normal</option>
  64.                     </select></div>';
  65.                 }
  66.             }
  67.         })
  68.         ->rawColumns(['aksi', 'detail', 'lock_status'])
  69.         ->make(true);
  70.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top