SHARE
TWEET

contoh kode

a guest Oct 12th, 2017 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //controller
  2. public function cetak_laporan()
  3.     {
  4.         $awal=Input::get('tgl_awal');
  5.         $akhir=Input::get('tgl_akhir');
  6.         if ($awal==null||$awal=="") {
  7.             $data=Record::where('date',date('Y-m-d'))->orderBy('scheduled_record','asc')->get();
  8.             $tanggal="Cetak Laporan Monitoring Bagasi Tanggal ".Fungsi::tanggal(date("Y-m-d"));
  9.             $tanggal2=Fungsi::tanggal(date("Y-m-d"));
  10.         }
  11.         else
  12.         {
  13.             $data=Record::whereBetween('date',[$awal,$akhir])->orderBy('scheduled_record','asc')->get();
  14.             $tanggal="Cetak Laporan Monitoring Bagasi Tanggal ".Fungsi::tanggal($awal)." - ".Fungsi::tanggal($akhir);
  15.             $tanggal2=Fungsi::tanggal($awal)." - ".Fungsi::tanggal($akhir);
  16.         }
  17.         $pdf = PDF::loadView('menu.cetaklaporan',['datas'=>$data,'header'=>$tanggal]);
  18.         $pdf ->setPaper('a4')->setOrientation('landscape')->setWarnings(false);
  19.         return $pdf->download('laporan '.$tanggal2.'.pdf');
  20.         //return View::make('menu.cetaklaporan')->with(['datas'=>$data,'header'=>$tanggal]);
  21.     }
  22. //template laporan
  23. <table border="1" cellpadding="5">
  24.   <thead>
  25.   <tr style="background-color:#34495e;color:white">
  26.     <th width="2%">No</th><th width="8%">Nomor Penerbangan</th><th width="8%">Maskapai</th><th width="5%">Asal</th>
  27.     <th width="7%">Terjadwal</th><th width="7%">Block On</th><th width="5%">Conveyor</th><th width="7%">Durasi Bagasi Pertama</th>
  28.     <th width="7%">Durasi Bagasi Terakhir</th><th width="7%">Massa Bagasi</th><th>Keterangan</th>
  29.   </tr>
  30.   </thead>
  31.   <tbody>
  32.   @foreach($datas as $k =>$v)
  33.     <tr>
  34.       <td>{{$k+1}}</td>
  35.     <td>{{$v->arrival->airlines->iata." ".$v->arrival->flight_code}}</td>
  36.     <td>{{$v->arrival->airlines->airlines_name}}</td>
  37.     <td>{{$v->arrival->flight_orign}}</td>
  38.     <td>{{$v->scheduled_record}}</td>
  39.  
  40.     <td>{{$v->block_on}}</td>
  41.     <td>{{$v->conveyor->conveyor_code}}</td>
  42.  
  43.     <td class="{{Fungsi::cek_telat($v->id,'first_baggage')}}">{{$v->first_baggage}}</td>
  44.  
  45.     <td class="{{Fungsi::cek_telat($v->id,'last_baggage')}}">{{$v->last_baggage}}</td>
  46.  
  47.    
  48.     <td>{{$v->massa_bagasi}} Kg</td>
  49.     <td>{{$v->expl_first_baggage}} <br> {{$v->expl_last_baggage}}</td>
  50.     </tr>
  51.   @endforeach
  52.   </tbody>
  53. </table>
RAW Paste Data
Top