Exemple #1
0
 public function get_formbap($id = false)
 {
     Log::write('info', Request::ip() . ' User : '******' Event: Open Form BAP', true);
     if (!$id) {
         return false;
     }
     $checkout = Checkout::find($id);
     //membuat tidak tapil form jika belum waktunya
     $time = Myfungsi::sysdate();
     //date ajustment
     $t = strtotime($checkout->operasi_time . " 7 hours 0 seconds");
     if ($time <= $t) {
         return false;
     }
     $financial_fleet = DB::table('financial_report_bykso')->where('kso_id', '=', $checkout->kso_id)->first();
     $financial_fleet_part = DB::table('wo_financial_report_bykso')->where('kso_id', '=', $checkout->kso_id)->first();
     $kso = Kso::find($checkout->kso_id);
     $driver_status = 'Bravo';
     if ($kso->bravo_driver_id !== $checkout->driver_id) {
         $driver_status = 'Charlie';
     }
     $fleet_ks = 0;
     $fleet_cicilan_ks = 0;
     $fleet_tabungan_sparepart = 0;
     $fleet_cicilan_db_kso = 0;
     $fleet_cicilan_sparepart = 0;
     $fleet_dp_sparepart = 0;
     if ($financial_fleet) {
         $fleet_ks = $financial_fleet->ks;
         $fleet_cicilan_ks = $financial_fleet->cicilan_ks;
         $fleet_tabungan_sparepart = $financial_fleet->tabungan_sparepart;
         $fleet_cicilan_db_kso = $financial_fleet->cicilan_dp_kso;
         $fleet_cicilan_sparepart = $financial_fleet->cicilan_sparepart;
         $fleet_dp_sparepart = $financial_fleet->hutang_dp_sparepart;
     }
     $total_pemakaian_part = 0;
     if ($financial_fleet_part) {
         $total_pemakaian_part = $financial_fleet_part->pemakaian_part;
     }
     $maxno = Bap::max('id');
     //MyFungsi::numberComplate($maxno,5)
     $nosurat = 'DT-xxxxxx/BAP/' . Fleet::find($checkout->fleet_id)->taxi_number . '/' . date('m') . '/' . date('Y');
     $this->data['saldo_sparepart'] = $fleet_tabungan_sparepart + $fleet_cicilan_sparepart + $fleet_dp_sparepart - $total_pemakaian_part;
     $this->data['saldo_ks'] = $fleet_ks - $fleet_cicilan_ks;
     $this->data['saldo_unit'] = $fleet_ks - $fleet_cicilan_ks + ($fleet_tabungan_sparepart + $fleet_cicilan_sparepart + $fleet_dp_sparepart - $total_pemakaian_part);
     $this->data['nosurat'] = $nosurat;
     $this->data['checkout'] = $checkout;
     $this->data['listpelanggaran'] = Stdbap::all();
     $this->data['options'] = array('6' => 'Cicilan KS');
     $this->data['infodriver'] = Driver::find($checkout->driver_id);
     $this->data['listkewajibans'] = Kewajiban::join('financial_types as ft', 'ft.id', '=', 'kewajibans.financial_type_id')->where_fleet_id($checkout->fleet_id)->where_driver_id($checkout->driver_id)->get();
     $this->data['status_pengemudi'] = $driver_status;
     $kep = Keputusanbap::all();
     $pelanggaran = Blocked::where_driver_id($checkout->driver_id)->where_fleet_id($checkout->fleet_id)->where_proses(0)->get();
     $pel_id = array();
     foreach ($pelanggaran as $pel) {
         array_push($pel_id, $pel->std_bap_id);
     }
     $optionskeputusan = array();
     foreach ($kep as $v) {
         $optionskeputusan[$v->id] = $v->keputusan;
     }
     $this->data['keputusans'] = $optionskeputusan;
     $this->data['checklistpelanggaran'] = $pel_id;
     //return View::make('themes.modul.'.$this->views.'.formbap',$this->data);
     return View::make('themes.modul.' . $this->views . '.suratbap', $this->data);
 }
        <thead>
                <tr>
                  <th>No</th>
                  <th>Nomor Body</th>
                  <th>Bravo</th>
                  <th>Charlie</th>
                  <th>Actions</th>
                </tr>
        </thead>
        <tbody>
          <?php 
$no = 1;
?>
          @foreach($listanakasuh as $fleet)
          <?php 
$infokso = Kso::where('fleet_id', '=', $fleet->fleet_id)->where('actived', '=', 1)->first();
?>
          @if($infokso)
          <?php 
$bravo = Driver::find($infokso->bravo_driver_id);
?>
          <?php 
$charlie = Driver::find($infokso->charlie_driver_id);
?>
            <tr>
              <td>{{ $no }}</td>
              <td><span class="label label-success"> <?php 
$fl = Fleet::find($fleet->fleet_id);
?>
 
                @if($fl)
Exemple #3
0
 public function get_findbyIdFleet($id = false)
 {
     if (!$id) {
         return false;
     }
     $fleet = Fleet::find($id);
     $kso = Kso::where_fleet_id($fleet->id)->first();
     $financial_fleet = DB::table('financial_report_bykso')->where('kso_id', '=', $kso->id)->first();
     $financial_fleet_part = DB::table('wo_financial_report_bykso')->where('kso_id', '=', $kso->id)->first();
     $fleet_ks = 0;
     $fleet_cicilan_ks = 0;
     $fleet_tabungan_sparepart = 0;
     $fleet_cicilan_db_kso = 0;
     $fleet_cicilan_sparepart = 0;
     $fleet_dp_sparepart = 0;
     if ($financial_fleet) {
         $fleet_ks = $financial_fleet->ks;
         $fleet_cicilan_ks = $financial_fleet->cicilan_ks;
         $fleet_tabungan_sparepart = $financial_fleet->tabungan_sparepart;
         $fleet_cicilan_db_kso = $financial_fleet->cicilan_dp_kso;
         $fleet_cicilan_sparepart = $financial_fleet->cicilan_sparepart;
         $fleet_dp_sparepart = $financial_fleet->hutang_dp_sparepart;
     }
     $total_pemakaian_part = 0;
     if ($financial_fleet_part) {
         $total_pemakaian_part = $financial_fleet_part->pemakaian_part;
     }
     $fleetinfo = array('id' => $fleet->id, 'police_number' => $fleet->police_number, 'bravo' => Driver::find($kso->bravo_driver_id)->name, 'taxi_number' => $fleet->taxi_number, 'total_ks' => number_format($fleet_ks, 2, ',', '.'), 'pembayaran_ks' => number_format($fleet_cicilan_ks, 2, ',', '.'), 'tab_sparepart' => number_format($fleet_tabungan_sparepart, 2, ',', '.'), 'dp_kso' => number_format($kso->dp, 2, ',', '.'), 'hutang_dp_kso' => number_format($kso->sisa_dp, 2, ',', '.'), 'pem_hutang_dp_kso' => number_format($fleet_cicilan_db_kso, 2, ',', '.'), 'pem_sparepart' => number_format($total_pemakaian_part, 2, ',', '.'), 'saldo_unit' => number_format($fleet_cicilan_ks + $fleet_cicilan_db_kso + $kso->dp - ($fleet_ks + $kso->sisa_dp) + ($fleet_tabungan_sparepart + $fleet_cicilan_sparepart + $fleet_dp_sparepart - $total_pemakaian_part), 2, ',', '.'), 'pembayaran_sparepart' => $fleet_cicilan_sparepart + $fleet_dp_sparepart, 'status' => $fleet->fg_blocked == 1 || $fleet->fg_bengkel == 1 ? 'Blocked' : 'Ready');
     $returndata = array('fleetinfo' => $fleetinfo);
     return json_encode($returndata);
 }
Exemple #4
0
 public function post_expreportsetoran()
 {
     //var_dump(Input::all());
     $mic_time = microtime();
     $mic_time = explode(" ", $mic_time);
     $mic_time = $mic_time[1] + $mic_time[0];
     $start_time = $mic_time;
     $date = Input::get('date');
     $shift = Input::get('shift_id');
     $all = Input::get('allbody', false);
     $fleets = Input::get('bodylist', array());
     $subdate = explode('/', $date);
     $month = $subdate[0];
     $year = $subdate[1];
     $newdate = date("Y-m-t", strtotime($year . '-' . $month . '-01'));
     $pool_id = Auth::user()->pool_id;
     if ($all) {
         $fleets = array();
         $fleetsobj = Kso::where('pool_id', '=', $pool_id)->where('actived', '=', 1)->get(array('id', 'fleet_id'));
         foreach ($fleetsobj as $sc) {
             $fleets[] = $sc->id;
         }
     }
     /*
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setCreator(Auth::user()->fullname)
              ->setLastModifiedBy(Auth::user()->fullname)
              ->setTitle("Laporan Harian ".Pool::find(Auth::user()->pool_id)->pool_name. '-'.date('Y-m-d'))
              ->setSubject("Laporan Harian ".Pool::find(Auth::user()->pool_id)->pool_name. '-'.date('Y-m-d'))
              ->setDescription("Laporan harian operasi pool")
              ->setKeywords("Laporan Harian")
              ->setCategory("");
     
     $styleArray = array(
         'font'  => array(
             'bold'  => true,
             'color' => array('rgb' => 'FF0000'),
             'size'  => 16,
             //'name'  => 'Verdana'
     ));
     */
     $sheet_active = 0;
     $no = 1;
     $starline = 8;
     foreach ($fleets as $key => $kso_id) {
         /*
         $objPHPExcel->createSheet(NULL, $sheet_active);
         $objPHPExcel->setActiveSheetIndex($sheet_active);
         */
         $reports = DB::table('financial_report_daily')->where('kso_id', '=', $kso_id)->where('operasi_time', '>=', date("Y-m-01", strtotime($year . '-' . $month . '-01')))->where('operasi_time', '<=', date("Y-m-t", strtotime($year . '-' . $month . '-01')))->order_by('operasi_time', 'asc')->get();
         $data = $this->infoSaldo($kso_id, $newdate);
         /*
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $starline,  $data->saldoks );
         
         $objPHPExcel->getActiveSheet()->setTitle($data->taxi_number);
         $sheet_active++;
         */
     }
     /*
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save(path('public').'x.xls');
     */
     $mic_time = microtime();
     $mic_time = explode(" ", $mic_time);
     $mic_time = $mic_time[1] + $mic_time[0];
     $endtime = $mic_time;
     $total_execution_time = $endtime - $start_time;
     return "Total Executaion Time " . $total_execution_time . " seconds";
     //return Response::download(path('public').'x.xls', 'x.xls');
 }
Exemple #5
0
 public function post_exppemakaianunit()
 {
     $input = Input::all();
     $wolist = DB::table('wo_listparts')->where('month', '=', date('n', strtotime($input['date'])))->where('year', '=', date('Y', strtotime($input['date'])))->where('kso_id', '=', $input['kso_id'])->order_by('inserted_date_set', 'asc')->get();
     $kso = Kso::find($input['kso_id']);
     if ($wolist && $kso) {
         $objPHPExcel = new PHPExcel();
         $objReader = PHPExcel_IOFactory::createReader('Excel5');
         $objPHPExcel = $objReader->load(path('public') . 'template/rekapbonpengemuditemplate.xls');
         $no = 1;
         $startline = 11;
         $objPHPExcel->getActiveSheet()->setCellValue('A4', 'PERIODE ' . Myfungsi::periode(strtotime($input['date'])));
         $objPHPExcel->getActiveSheet()->setCellValue('B6', Fleet::find($kso->fleet_id)->taxi_number);
         $objPHPExcel->getActiveSheet()->setCellValue('B7', Driver::find($kso->bravo_driver_id)->nip);
         $objPHPExcel->getActiveSheet()->setCellValue('B8', Driver::find($kso->bravo_driver_id)->name);
         foreach ($wolist as $bon) {
             $row = $startline + 2;
             $objPHPExcel->getActiveSheet()->insertNewRowBefore($row - 1, 1);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, $no++);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $row, $bon->inserted_date_set);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $row, $bon->wo_number);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $row, $bon->part_number);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $row, $bon->name_sparepart);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $row, $bon->qty);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $row, $bon->satuan);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $row, $bon->price);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $row, '=F' . $row . '*H' . $row);
         }
         $objPHPExcel->getActiveSheet()->removeRow($row - 1, 1);
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
         $objWriter->save(path('public') . 'Laporan-hutang-armada.xls');
         return Response::download(path('public') . 'Laporan-hutang-armada.xls');
     }
 }
Exemple #6
0
 public function post_toolspj()
 {
     $date = Input::get('tanggal', date('Y-m-d'));
     ini_set('max_execution_time', 120);
     $timestamp = strtotime($date);
     //list armada on schedule
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedules.month', '=', date('n', $timestamp))->where('schedule_dates.shift_id', '=', 1)->where('ksos.actived', '=', 1)->order_by('fleets.taxi_number', 'asc')->get(array('schedule_dates.id as id', 'schedule_dates.driver_id', 'schedules.fleet_id', 'fleets.taxi_number'));
     }
     if ($fleets) {
         foreach ($fleets as $f) {
             $scheduledate = Scheduledate::find($f->id);
             $scheduledate->fg_check = 1;
             $scheduledate->save();
             $schedule = Schedule::find($scheduledate->schedule_id);
             //$driverinfo = Driver::find($scheduledate->driver_id);
             //$fleetinfo = Fleet::find($schedule->fleet_id);
             $ksoinfo = Kso::where_fleet_id($schedule->fleet_id)->where_actived(1)->first();
             $dateopertion = mktime(0, 0, 0, $schedule->month, $scheduledate->date, $schedule->year);
             $checkouts = Checkout::where_fleet_id($schedule->fleet_id)->where_operasi_time(date('Y-m-d', $dateopertion))->first();
             //delete checkouts
             if ($checkouts) {
                 $checkouts->delete();
             }
             $codeops = 1;
             $status = 7;
             $keterangan = 'Print SPJ melalui Tools';
             if (!$checkouts) {
                 //insert into to checkouts step
                 $checkouts = new Checkout();
                 $checkouts->kso_id = $ksoinfo->id;
                 $checkouts->operasi_time = date('Y-m-d', $dateopertion);
                 $checkouts->fleet_id = $schedule->fleet_id;
                 $checkouts->driver_id = $scheduledate->driver_id;
                 $checkouts->checkout_step_id = $status;
                 $checkouts->shift_id = $scheduledate->shift_id;
                 $checkouts->user_id = Auth::user()->id;
                 $checkouts->pool_id = Auth::user()->pool_id;
                 $checkouts->printspj_time = date('Y-m-d H:i:s', Myfungsi::sysdate());
                 $checkouts->operasi_status_id = $codeops;
                 $checkouts->keterangan = $keterangan;
                 $checkouts->save();
                 $cinada = Checkin::where('operasi_time', '=', date('Y-m-d', $dateopertion))->where('fleet_id', '=', $schedule->fleet_id)->first();
                 if ($cinada) {
                     $cinada->delete();
                 }
                 if (!$cinada) {
                     $cin = Checkin::create(array('kso_id' => $ksoinfo->id, 'fleet_id' => $schedule->fleet_id, 'driver_id' => $scheduledate->driver_id, 'checkin_time' => date('Y-m-d H:i:s', Myfungsi::sysdate()), 'shift_id' => $scheduledate->shift_id, 'km_fleet' => 0, 'rit' => 0, 'incomekm' => 0, 'operasi_time' => date('Y-m-d', $dateopertion), 'pool_id' => Auth::user()->pool_id, 'operasi_status_id' => $codeops, 'fg_late' => '', 'checkin_step_id' => 2, 'document_check_user_id' => Auth::user()->id, 'physic_check_user_id' => '', 'bengkel_check_user_id' => '', 'finance_check_user_id' => '', 'keterangan' => $keterangan));
                     if ($cin) {
                         $docs = new Checkindocument();
                         $docs->checkin_id = $cin->id;
                         $docs->save();
                         //return Redirect::to('schedule');
                     }
                     //
                 }
             }
         }
         return Redirect::to('schedule');
     }
 }
Exemple #7
0
 public function get_downloadreportbs($date = false)
 {
     if (!$date) {
         $date = date('Y-m-d');
     }
     $ksos = Kso::where('pool_id', '=', Auth::user()->pool_id)->where('actived', '=', 1)->get();
     $ksoaktif = array();
     foreach ($ksos as $xkso) {
         $ksoaktif[] = $xkso->id;
     }
     $financials = DB::table('financial_report_monthly_bykso')->where('month', '=', date('n', strtotime($date)))->where('year', '=', date('Y', strtotime($date)))->where_pool_id(Auth::user()->pool_id)->where_in('kso_id', $ksoaktif)->order_by('taxi_number', 'asc')->get();
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setCreator(Auth::user()->fullname)->setLastModifiedBy(Auth::user()->fullname)->setTitle("Laporan Harian " . Pool::find(Auth::user()->pool_id)->pool_name . '-' . date('Y-m-d'))->setSubject("Laporan Harian " . Pool::find(Auth::user()->pool_id)->pool_name . '-' . date('Y-m-d'))->setDescription("Laporan harian operasi pool")->setKeywords("Laporan Harian")->setCategory("");
     $objPHPExcel->createSheet(NULL, 0);
     $objPHPExcel->setActiveSheetIndex(0);
     //$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false);
     //$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false);
     $objPHPExcel->getActiveSheet()->mergeCells('A5:A6');
     $objPHPExcel->getActiveSheet()->mergeCells('B5:B6');
     $objPHPExcel->getActiveSheet()->mergeCells('C5:D5');
     $objPHPExcel->getActiveSheet()->mergeCells('E5:E6');
     $objPHPExcel->getActiveSheet()->mergeCells('F5:G5');
     $objPHPExcel->getActiveSheet()->mergeCells('H5:H6');
     $objPHPExcel->getActiveSheet()->mergeCells('I5:I6');
     $objPHPExcel->getActiveSheet()->mergeCells('J5:J6');
     $objPHPExcel->getActiveSheet()->mergeCells('K5:K6');
     $objPHPExcel->getActiveSheet()->mergeCells('L5:O5');
     $objPHPExcel->getActiveSheet()->mergeCells('P5:R5');
     //$objPHPExcel->getActiveSheet()->mergeCells('R5:R6');
     $objPHPExcel->getActiveSheet()->mergeCells('S5:S6');
     $objPHPExcel->getActiveSheet()->mergeCells('T5:T6');
     $objPHPExcel->getActiveSheet()->mergeCells('U5:U6');
     $objPHPExcel->getActiveSheet()->mergeCells('V5:V6');
     $objPHPExcel->getActiveSheet()->mergeCells('W5:W6');
     $objPHPExcel->getActiveSheet()->mergeCells('X5:X6');
     $objPHPExcel->getActiveSheet()->setCellValue('A5', 'NO');
     $objPHPExcel->getActiveSheet()->setCellValue('B5', 'BAPAK ASUH');
     $objPHPExcel->getActiveSheet()->setCellValue('C5', 'PENGEMUDI');
     $objPHPExcel->getActiveSheet()->setCellValue('C6', 'NIP');
     $objPHPExcel->getActiveSheet()->setCellValue('D6', 'NAMA');
     $objPHPExcel->getActiveSheet()->setCellValue('E5', 'BODY');
     $objPHPExcel->getActiveSheet()->setCellValue('F5', 'STATUS');
     $objPHPExcel->getActiveSheet()->setCellValue('F6', 'OPS');
     $objPHPExcel->getActiveSheet()->setCellValue('G6', 'BS');
     $objPHPExcel->getActiveSheet()->setCellValue('H5', 'SETORAN MURNI');
     $objPHPExcel->getActiveSheet()->setCellValue('I5', 'TAB SPAREPART');
     $objPHPExcel->getActiveSheet()->setCellValue('J5', 'DENDA JAM');
     $objPHPExcel->getActiveSheet()->setCellValue('K5', 'DP SPAREPART');
     $objPHPExcel->getActiveSheet()->setCellValue('L5', 'BAYAR  CICILAN');
     $objPHPExcel->getActiveSheet()->setCellValue('L6', 'KS');
     $objPHPExcel->getActiveSheet()->setCellValue('M6', 'S-PART');
     $objPHPExcel->getActiveSheet()->setCellValue('N6', 'DP-KSO');
     $objPHPExcel->getActiveSheet()->setCellValue('O6', 'HUT-LAMA');
     $objPHPExcel->getActiveSheet()->setCellValue('P5', 'BAYAR');
     $objPHPExcel->getActiveSheet()->setCellValue('P6', 'STIKER BANDARA & KEAMANAN');
     $objPHPExcel->getActiveSheet()->setCellValue('Q6', 'CUCI');
     $objPHPExcel->getActiveSheet()->setCellValue('R6', 'LAKA');
     $objPHPExcel->getActiveSheet()->setCellValue('S5', 'HARUS SETOR');
     $objPHPExcel->getActiveSheet()->setCellValue('T5', 'POTONGAN');
     $objPHPExcel->getActiveSheet()->setCellValue('U5', 'SETOR CASH');
     $objPHPExcel->getActiveSheet()->setCellValue('V5', 'KETEKORAN');
     $objPHPExcel->getActiveSheet()->setCellValue('W5', 'SETORAN OPS');
     $objPHPExcel->getActiveSheet()->setCellValue('X5', 'SELISIH');
     $no = 1;
     $starline = 8;
     foreach ($financials as $finan) {
         $ks = abs($finan->setoran_cash - ($finan->setoran_wajib + $finan->tabungan_sparepart + $finan->denda + $finan->cicilan_sparepart + $finan->cicilan_ks + $finan->biaya_cuci + $finan->iuran_laka + $finan->cicilan_dp_kso + $finan->cicilan_hutang_lama + $finan->cicilan_lain + $finan->hutang_dp_sparepart - $finan->potongan));
         $bs = 'Tidak';
         if ($ks <= $finan->cicilan_ks) {
             $bs = 'Ya';
         }
         $bpkasuh = Anakasuh::where('status', '=', 1)->where('fleet_id', '=', $finan->fleet_id)->first();
         $bravo = Kso::find($finan->kso_id);
         $nip = 'NN';
         $bravonama = 'NN';
         if ($bravo) {
             $oxx = Driver::find($bravo->bravo_driver_id);
             if ($oxx) {
                 $nip = $oxx->nip;
                 $bravonama = $oxx->name;
             }
         }
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $starline, $no);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $starline, $bpkasuh ? User::find($bpkasuh->user_id)->fullname : 'TIDAK ADA BAPAK ASUH');
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $starline, $nip);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $starline, $bravonama);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $starline, $finan->taxi_number);
         //$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $starline, $finan->kode);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $starline, $bs);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $starline, $finan->setoran_wajib);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $starline, $finan->tabungan_sparepart);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $starline, $finan->denda);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $starline, $finan->hutang_dp_sparepart);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(11, $starline, $finan->cicilan_ks);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(12, $starline, $finan->cicilan_sparepart);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(13, $starline, $finan->cicilan_dp_kso);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(14, $starline, $finan->cicilan_hutang_lama);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(15, $starline, $finan->cicilan_lain);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(16, $starline, $finan->biaya_cuci);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(17, $starline, $finan->iuran_laka);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(18, $starline, '=SUM(H' . $starline . ':R' . $starline . ')');
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(19, $starline, $finan->potongan);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(20, $starline, $finan->setoran_cash);
         //$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(20, $starline, $finan->ks);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(21, $starline, '=(U' . $starline . '-(S' . $starline . '-T' . $starline . '))');
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(22, $starline, '=(U' . $starline . '-(Q' . $starline . '+R' . $starline . '))');
         //$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(23, $starline,  $finan->shift); //col X
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(23, $starline, '=V' . $starline . '+ L' . $starline);
         //$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(14, $starline, $finan->cicilan_lain);
         //hidden coloumn status operasi
         //$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(25, $starline,  $finan->operasi_status_id); //col Z
         $no++;
         $starline++;
     }
     $objPHPExcel->getActiveSheet()->mergeCells('A' . ($starline + 1) . ':G' . ($starline + 1) . '');
     $objPHPExcel->getActiveSheet()->setCellValue('A' . ($starline + 1), 'TOTAL SETORAN ');
     $objPHPExcel->getActiveSheet()->setCellValue('H' . ($starline + 1), '=SUM(H8:H' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('I' . ($starline + 1), '=SUM(I8:I' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('J' . ($starline + 1), '=SUM(J8:J' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('K' . ($starline + 1), '=SUM(K8:K' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('L' . ($starline + 1), '=SUM(L8:L' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('M' . ($starline + 1), '=SUM(M8:M' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('N' . ($starline + 1), '=SUM(N8:N' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('O' . ($starline + 1), '=SUM(O8:O' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('P' . ($starline + 1), '=SUM(P8:P' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('Q' . ($starline + 1), '=SUM(Q8:Q' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('R' . ($starline + 1), '=SUM(R8:R' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('S' . ($starline + 1), '=SUM(S8:S' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('T' . ($starline + 1), '=SUM(T8:T' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('U' . ($starline + 1), '=SUM(U8:U' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('V' . ($starline + 1), '=SUM(V8:V' . $starline . ')');
     $objPHPExcel->getActiveSheet()->setCellValue('W' . ($starline + 1), '=SUM(W8:W' . $starline . ')');
     $objPHPExcel->getActiveSheet()->getStyle('A5:X' . ($starline + 1))->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR);
     $objPHPExcel->getActiveSheet()->getStyle('A5:X6')->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
     $objPHPExcel->getActiveSheet()->getStyle('A5:X' . ($starline + 1))->getBorders()->getOutline()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
     $objPHPExcel->getActiveSheet()->getStyle('A' . ($starline + 1) . ':X' . ($starline + 1))->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
     $objPHPExcel->getActiveSheet()->setTitle('Laporan BS ' . $date);
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save(path('public') . 'Laporan-BS-' . Pool::find(Auth::user()->pool_id)->pool_name . '.xls');
     return Response::download(path('public') . 'Laporan-BS-' . Pool::find(Auth::user()->pool_id)->pool_name . '.xls', 'Laporan-BS-' . Pool::find(Auth::user()->pool_id)->pool_name . '.xls');
 }
Exemple #8
0
 public function post_findbyidafterpay()
 {
     $jsondata = Input::json();
     $checkin = Checkin::find($jsondata->id);
     $driverinfo = Driver::find($checkin->driver_id);
     $fleetinfo = Fleet::find($checkin->fleet_id);
     $kso = Kso::find($checkin->kso_id);
     $payment = Checkinfinancial::where_checkin_id($checkin->id)->get();
     $datapayment = array();
     foreach ($payment as $pay) {
         $datapayment[$pay->financial_type_id] = $pay->amount;
     }
     //km tempuh operasi
     $last_operasi = date('Y-m-d', strtotime($checkin->operasi_time . ' -1 days'));
     $last_checkin = Checkin::where_fleet_id($checkin->fleet_id)->where_operasi_time($last_operasi)->first();
     $km_tempuh = $checkin->km_fleet;
     if ($last_checkin) {
         $km_tempuh = $checkin->km_fleet - $last_checkin->km_fleet;
     }
     $returndata = array('id' => $checkin->id, 'nip' => $driverinfo->nip, 'name' => $driverinfo->name, 'taxi_number' => $fleetinfo->taxi_number, 'police_number' => $fleetinfo->police_number, 'pool_id' => $fleetinfo->pool_id, 'pool' => Pool::find($fleetinfo->pool_id)->pool_name, 'operasi_status_id' => $checkin->operasi_status_id, 'shift_id' => $checkin->shift_id, 'setoran_wajib' => $datapayment[1], 'tab_sp' => $datapayment[2], 'pot' => $datapayment[4], 'denda' => $datapayment[3], 'iuran_laka' => $datapayment[8], 'biaya_tc' => $datapayment[7], 'tag_spart' => $datapayment[5], 'tag_ks' => $datapayment[6], 'tag_cicilan_dp' => $datapayment[9], 'tag_dp_spart' => $datapayment[13], 'tag_hut_lama' => $datapayment[10], 'tag_other' => $datapayment[12], 'ks' => $datapayment[20] - ($datapayment[1] + $datapayment[2] + $datapayment[3] + $datapayment[8] + $datapayment[7] + $datapayment[5] + $datapayment[6] + $datapayment[9] + $datapayment[13] + $datapayment[10] + $datapayment[12] - $datapayment[4]), 'cash' => $datapayment[20], 'in_time' => $checkin->checkin_time, 'km_tempuh' => $km_tempuh, 'total' => $datapayment[1] + $datapayment[2] + $datapayment[3] + $datapayment[8] + $datapayment[7] + $datapayment[5] + $datapayment[6] + $datapayment[9] + $datapayment[13] + $datapayment[10] + $datapayment[12] - $datapayment[4]);
     return json_encode($returndata);
 }
Exemple #9
0
                                    @endforeach
                                </td>
                            </tr>

                            <tr>
                                <td><span class="label label-important">KSO GUGUR</span></td>
                            </tr>
                            <tr>
                                <td>
                               <?php 
$ksos = Fleet::join('ksos', 'fleets.id', '=', 'ksos.fleet_id')->where('ksos.actived', '=', 2)->where('ksos.pool_id', '=', $pool->id)->group_by('fleets.id')->order_by('fleets.taxi_number', 'asc')->get(array('ksos.id', 'fleets.taxi_number', 'fleets.id as fleet_id'));
?>
                                @foreach($ksos as $kso)
                                    <?php 
//membuat yang aktif tidak ada tapi yang gugur ada
$active = Kso::where('fleet_id', '=', $kso->fleet_id)->where('actived', '=', 1)->get();
?>
                                    @if(!$active)
                                        {{ HTML::link('ksos/ksofleet/'.$kso->fleet_id ,$kso->taxi_number,array('class'=>'btn btn-mini btn-success')) }}
                                    @endif
                                @endforeach
                                </td>
                            </tr>
                            <tr>
                                <td><span class="label label-important">KSO SELESAI</span></td>
                            </tr>
                            <tr>
                                <td>
                               <?php 
$ksos = Fleet::join('ksos', 'fleets.id', '=', 'ksos.fleet_id')->where('ksos.actived', '=', 3)->where('ksos.pool_id', '=', $pool->id)->group_by('fleets.id')->order_by('fleets.taxi_number', 'asc')->get(array('ksos.id', 'fleets.taxi_number', 'fleets.id as fleet_id'));
?>
Exemple #10
0
 public function get_editscheduleonmaster($scheduledate_id = false)
 {
     if (!$scheduledate_id) {
         return false;
     }
     $schd = Scheduledate::find($scheduledate_id);
     $schm = Schedule::find($schd->schedule_id);
     $stmp = mktime(0, 0, 0, $schm->month, $schd->date, $schm->year);
     $this->data['date'] = Myfungsi::fulldate($stmp);
     $this->data['schd'] = $schd;
     $this->data['schm'] = $schm;
     $this->data['month'] = date('n', $stmp);
     $this->data['year'] = date('Y', $stmp);
     $this->data['bckso'] = Kso::where('fleet_id', '=', $schm->fleet_id)->where('actived', '=', 1)->first();
     return View::make('themes.modul.' . $this->views . '.editscheduleonmaster', $this->data);
 }
Exemple #11
0
 public function getCountAll()
 {
     $pool_id = Auth::user()->pool_id;
     return Kso::where('actived', '=', 1)->where('pool_id', '=', $pool_id)->count();
 }
Exemple #12
0
 public function get_kartukontrolarmadakso($id = false)
 {
     $startdate = Input::get('datestart', false);
     $enddate = Input::get('dateend', false);
     $cont = Input::get('con', false);
     if (!$id) {
         return false;
     }
     if (!$startdate) {
         $startdate = date('Y-m-d', mktime(0, 0, 0, (int) strtotime('m', $startdate), 1, (int) strtotime('Y', $enddate)));
     }
     if (!$enddate) {
         $enddate = date('Y-m-d', (int) mktime(0, 0, 0, strtotime('m', $enddate), (int) strtotime('j', $enddate), (int) strtotime('Y', $enddate)));
     }
     //$kso = Kso::where_fleet_id($id)->where_actived(1)->first();
     $kso = Kso::find($id);
     $fleet = Fleet::find($kso->fleet_id);
     $financial_fleet = DB::table('financial_report_bykso')->where('kso_id', '=', $kso->id)->first();
     $financial_fleet_part = DB::table('wo_financial_report_bykso')->where('kso_id', '=', $kso->id)->first();
     $fleet_ks = 0;
     $fleet_cicilan_ks = 0;
     $fleet_tabungan_sparepart = 0;
     $fleet_cicilan_dp_kso = 0;
     $fleet_cicilan_sparepart = 0;
     $fleet_dp_sparepart = 0;
     if ($financial_fleet) {
         $fleet_ks = $financial_fleet->ks;
         $fleet_cicilan_ks = $financial_fleet->cicilan_ks;
         $fleet_tabungan_sparepart = $financial_fleet->tabungan_sparepart;
         $fleet_cicilan_dp_kso = $financial_fleet->cicilan_dp_kso;
         $fleet_cicilan_sparepart = $financial_fleet->cicilan_sparepart;
         $fleet_dp_sparepart = $financial_fleet->hutang_dp_sparepart;
     }
     $total_pemakaian_part = 0;
     if ($financial_fleet_part) {
         $total_pemakaian_part = $financial_fleet_part->pemakaian_part;
     }
     $fleetinfo = array('id' => $fleet->id, 'police_number' => $fleet->police_number, 'nip' => Driver::find($kso->bravo_driver_id)->nip, 'bravo' => Driver::find($kso->bravo_driver_id)->name, 'taxi_number' => $fleet->taxi_number, 'total_ks' => number_format($fleet_ks, 0, ',', '.'), 'pembayaran_ks' => number_format($fleet_cicilan_ks, 0, ',', '.'), 'tab_sparepart' => number_format($fleet_tabungan_sparepart, 0, ',', '.'), 'dp_kso' => number_format($kso->dp, 0, ',', '.'), 'hutang_dp_kso' => number_format($kso->sisa_dp, 0, ',', '.'), 'pem_hutang_dp_kso' => number_format($fleet_cicilan_dp_kso, 0, ',', '.'), 'pem_sparepart' => number_format($total_pemakaian_part, 0, ',', '.'), 'saldo_unit' => number_format($fleet_cicilan_ks - $fleet_ks + ($fleet_tabungan_sparepart + $fleet_cicilan_sparepart + $fleet_dp_sparepart - $total_pemakaian_part), 0, ',', '.'), 'pembayaran_sparepart' => number_format($fleet_cicilan_sparepart + $fleet_dp_sparepart, 0, ',', '.'), 'status' => $fleet->fg_blocked == 1 || $fleet->fg_bengkel == 1 ? 'Blocked' : 'Ready', 'saldo_dp' => $kso->sisa_dp - $fleet_cicilan_dp_kso);
     $reports = DB::table('financial_report_daily')->where('kso_id', '=', $kso->id)->where('operasi_time', '>=', $startdate)->where('operasi_time', '<=', $enddate)->order_by('operasi_time', 'asc')->get();
     $this->data['reports'] = $reports;
     $this->data['detailarmada'] = $fleetinfo;
     if ($cont == 'tampil') {
         return View::make('themes.modul.' . $this->views . '.kartukontrolarmada', $this->data);
     } else {
         if ($cont == 'download') {
             return View::make('themes.modul.' . $this->report . '.printkartukontrol', $this->data);
         }
     }
     return View::make('themes.modul.' . $this->views . '.kartukontrolarmada', $this->data);
 }
Exemple #13
0
 /**
  * @doc
  * 
  */
 public function get_downloadksoactive()
 {
     $pool_id = Auth::user()->pool_id;
     $this->data['ksos'] = Kso::join('fleets as f', 'f.id', '=', 'ksos.fleet_id')->join('drivers as d', 'd.id', '=', 'ksos.bravo_driver_id')->where('ksos.pool_id', '=', Auth::user()->pool_id)->where('ksos.actived', '=', 1)->order_by('f.taxi_number', 'asc')->get();
     return View::make('themes.modul.' . $this->report . '.listksoactive', $this->data);
 }
 /********************************/
 if (is_array($driver_ar) && !empty($driver_ar)) {
     foreach ($driver_ar as $key => $value) {
         $a = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->where('schedules.month', '=', date('n', $timestamp))->where('schedules.year', '=', date('Y', $timestamp))->where('pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.driver_id', '=', $value)->get();
         $free = array();
         // prosess pembentukan jadwal per pengemudi dalam group
         foreach ($a as $aa) {
             //echo 'Tanggal '. $aa->date .' di bawa pengemudi ' . $aa->driver_id ;
             //echo '<br>';
             array_push($free, $aa->date);
         }
         // DISPLY PENGEMUDI
         echo '<tr>';
         echo '<td>';
         //echo 'Driv ' . $value ;
         $kso = Kso::where_bravo_driver_id($value)->where_actived(1)->first();
         if ($kso) {
             echo Fleet::find($kso->fleet_id)->taxi_number;
         }
         echo '</td>';
         echo '<td>';
         echo Driver::find($value)->name;
         echo '</td>';
         $holiday = array();
         for ($i = 1; $i <= date('t', $timestamp); $i++) {
             if (is_array($free) && !empty($free)) {
                 if (!in_array($i, $free)) {
                     echo '<td style="background-color: #fcf8e3">';
                     // Set Libur symbol
                     echo ' L ';
                     array_push($holiday, $i);
Exemple #15
0
 public function post_qzotorisasicetak()
 {
     $data = Input::json();
     $username = $data->username;
     $password = $data->password;
     $ver2 = User::where('username', '=', $username)->first();
     if ($ver2) {
         if (Hash::check($password, $ver2->password)) {
             Log::write('info', Request::ip() . ' User : '******' Event: Print SPJ otoritas', true);
             $scheduledate = Scheduledate::find($data->id);
             $schedule = Schedule::find($scheduledate->schedule_id);
             $scheduledate->fg_check = 1;
             $scheduledate->save();
             $driverinfo = Driver::find($scheduledate->driver_id);
             $fleetinfo = Fleet::find($schedule->fleet_id);
             $ksoinfo = Kso::where_fleet_id($schedule->fleet_id)->where_actived(1)->first();
             $this->data['driverinfo'] = $driverinfo;
             $this->data['fleetinfo'] = $fleetinfo;
             $this->data['pool'] = Pool::find($schedule->pool_id);
             $codeops = $data->statusops;
             $keterangan = $data->keterangan;
             if ((int) $codeops == 1) {
                 if ($driverinfo->fg_blocked == 1) {
                     $status = 5;
                     $codeops = 7;
                 } else {
                     if ($driverinfo->fg_super_blocked == 1) {
                         $status = 5;
                         $codeops = 7;
                     } else {
                         if ($fleetinfo->fg_blocked == 1) {
                             $status = 5;
                             $codeops = 7;
                         } else {
                             if ($fleetinfo->fg_bengkel == 1) {
                                 $status = 6;
                                 $codeops = 4;
                             } else {
                                 if ($fleetinfo->fg_super_blocked == 1) {
                                     $status = 5;
                                     $codeops = 7;
                                 } else {
                                     $status = 3;
                                     $codeops = $codeops;
                                 }
                             }
                         }
                     }
                 }
             } else {
                 $status = 3;
             }
             $dateopertion = mktime(0, 0, 0, $schedule->month, $scheduledate->date, $schedule->year);
             $checkouts = Checkout::where_fleet_id($schedule->fleet_id)->where_operasi_time(date('Y-m-d', $dateopertion))->first();
             if (!$checkouts) {
                 //insert into to checkouts step
                 $checkouts = new Checkout();
                 $checkouts->kso_id = $ksoinfo->id;
                 $checkouts->operasi_time = date('Y-m-d', $dateopertion);
                 $checkouts->fleet_id = $fleetinfo->id;
                 $checkouts->driver_id = $driverinfo->id;
                 $checkouts->checkout_step_id = $status;
                 $checkouts->shift_id = $scheduledate->shift_id;
                 $checkouts->user_id = Auth::user()->id;
                 $checkouts->pool_id = Auth::user()->pool_id;
                 $checkouts->printspj_time = date('Y-m-d H:i:s', Myfungsi::sysdate());
                 $checkouts->operasi_status_id = $codeops;
                 $checkouts->keterangan = $keterangan;
                 $checkouts->print_out_time = 1;
                 $checkouts->otorisasi_user_id = $ver2->id;
                 $checkouts->save();
                 if ((int) $codeops == 1) {
                     $scheduledate->fg_check = 1;
                     $scheduledate->save();
                 }
                 if ((int) $codeops !== 1) {
                     $cin = Checkin::create(array('kso_id' => $ksoinfo->id, 'fleet_id' => $fleetinfo->id, 'driver_id' => $driverinfo->id, 'checkin_time' => date('Y-m-d H:i:s', Myfungsi::sysdate()), 'shift_id' => $scheduledate->shift_id, 'km_fleet' => 0, 'rit' => 0, 'incomekm' => 0, 'operasi_time' => date('Y-m-d', $dateopertion), 'pool_id' => Auth::user()->pool_id, 'operasi_status_id' => $codeops, 'fg_late' => '', 'checkin_step_id' => 12, 'document_check_user_id' => Auth::user()->id, 'physic_check_user_id' => '', 'bengkel_check_user_id' => '', 'finance_check_user_id' => '', 'keterangan' => $keterangan));
                     if ($cin) {
                         $docs = new Checkindocument();
                         $docs->checkin_id = $cin->id;
                         $docs->save();
                     }
                     //make can't print before setoran
                     $setor = Fleet::find($fleetinfo->id);
                     $setor->fg_setor = 1;
                     $setor->save();
                 }
             } else {
                 if ((int) $codeops !== 1) {
                     $checkinstatus = Checkin::where_fleet_id($schedule->fleet_id)->where_operasi_time(date('Y-m-d', $dateopertion))->first();
                     if (!$checkinstatus) {
                         $cin = Checkin::create(array('kso_id' => $ksoinfo->id, 'fleet_id' => $fleetinfo->id, 'driver_id' => $driverinfo->id, 'checkin_time' => date('Y-m-d H:i:s', Myfungsi::sysdate()), 'shift_id' => $scheduledate->shift_id, 'km_fleet' => 0, 'rit' => 0, 'incomekm' => 0, 'operasi_time' => date('Y-m-d', $dateopertion), 'pool_id' => Auth::user()->pool_id, 'operasi_status_id' => $codeops, 'fg_late' => '', 'checkin_step_id' => 12, 'document_check_user_id' => Auth::user()->id, 'physic_check_user_id' => '', 'bengkel_check_user_id' => '', 'finance_check_user_id' => '', 'keterangan' => $keterangan));
                         if ($cin) {
                             $docs = new Checkindocument();
                             $docs->checkin_id = $cin->id;
                             $docs->save();
                         }
                     }
                 }
                 //reprint after open blocking
                 if ((int) $codeops == 1) {
                     $checkinremove = Checkin::where_fleet_id($schedule->fleet_id)->where_operasi_time(date('Y-m-d', $dateopertion))->where_in('operasi_status_id', array(2, 3, 4, 5, 6, 7))->first();
                     if ($checkinremove) {
                         $checkinremove->delete();
                         //make can print before setoran becouse update set on checkout step
                         $setor = Fleet::find($schedule->fleet_id);
                         $setor->fg_setor = 0;
                         $setor->save();
                     }
                 }
                 if ((int) $codeops == 1) {
                     $scheduledate->fg_check = 1;
                     $scheduledate->save();
                 }
                 $checkouts->kso_id = $ksoinfo->id;
                 $checkouts->operasi_time = date('Y-m-d', $dateopertion);
                 $checkouts->fleet_id = $fleetinfo->id;
                 $checkouts->driver_id = $driverinfo->id;
                 $checkouts->checkout_step_id = $status;
                 $checkouts->shift_id = $scheduledate->shift_id;
                 $checkouts->user_id = Auth::user()->id;
                 $checkouts->pool_id = Auth::user()->pool_id;
                 $checkouts->operasi_status_id = $codeops;
                 $checkouts->printspj_time = date('Y-m-d H:i:s', Myfungsi::sysdate());
                 $checkouts->keterangan = $keterangan;
                 $checkouts->print_out_time = 1;
                 $checkouts->otorisasi_user_id = $ver2->id;
                 $checkouts->save();
             }
             $content = "";
             if ($checkouts->operasi_status_id == 1) {
                 $kopsurat = 'SURAT PERINTAH JALAN';
                 $content .= "Nama dan kendaraan yang tercantum diatas";
                 $content .= "DI IZINKAN untuk mengoprasikan kendaraan";
                 $content .= "PT.DIAN TAKSI sesuai dengan tanggal yang";
                 $content .= "tercantum diatas\r\n";
                 $content .= "--------------------------------------- \r\n";
                 $content .= "a";
                 // 1 SET CENTER PAGE
                 $content .= "Tanda Tangan \r\n";
                 $content .= "a";
                 // 1 SET LEFT PAGE
                 $content .= "--------------------------------------- \r\n";
                 $content .= "  Bag. Operasi               Security \r\n";
                 $content .= "\r\n \r\n \r\n";
             } else {
                 $kopsurat = 'SURAT PENGANTAR PROSES BAP';
                 $content .= "Nama dan kendaraan yang tercantum diatas";
                 $content .= "TIDAK DI IZINKAN mengoprasikan kendaraan";
                 $content .= "PT.DIAN TAKSI sesuai dengan tanggal yang";
                 $content .= "tercantum diatas\r\n";
             }
             $headerPrint = "";
             for ($j = 1; $j < 2; $j++) {
                 $headerPrint .= "@";
                 $headerPrint .= "a";
                 // 1 SET CENTER PAGE
                 $headerPrint .= "!";
                 $headerPrint .= $kopsurat . " \r\n";
                 $headerPrint .= "!";
                 $headerPrint .= "@";
                 // 1 RESET
                 $headerPrint .= "a";
                 // 1 SET CENTER PAGE
                 $headerPrint .= "PT. DHARMA INDAH AGUNG METROPOLITAN \r\n";
                 $headerPrint .= "POOL " . Pool::find($checkouts->pool_id)->pool_name . " \r\n";
                 $headerPrint .= "======================================= \r\n";
                 $headerPrint .= "a";
                 // 1 SET LEFT PAGE
                 //content printer
                 $headerPrint .= "Nama        : " . substr($driverinfo->name, 0, 25) . " \r\n";
                 $headerPrint .= "Nip         : " . $driverinfo->nip . " \r\n";
                 $headerPrint .= "Body        : " . $fleetinfo->taxi_number . " \r\n";
                 $headerPrint .= "Tgl Operasi : " . date('d/m/Y', strtotime($checkouts->operasi_time)) . " \r\n";
                 $headerPrint .= "--------------------------------------- \r\n";
                 $headerPrint .= $content;
                 $headerPrint .= "======================================= \r\n";
                 $headerPrint .= "Tanggal Cetak " . date('d/m/Y H:i:s', MyFungsi::sysdate(date('Y-m-d H:i:s'))) . " \r\n";
                 $headerPrint .= "Lembar ke - " . $j . " \r\n";
                 $headerPrint .= "\f";
                 // 5 FF
                 $headerPrint .= "VA";
                 // 4 motong kertas
                 $headerPrint .= "@";
                 // 5 END
             }
             //create temp file
             $file = 'dataprintspj' . $checkouts->pool_id . '.txt';
             $myFile = path('public') . '/qzprint/templatedata/' . $file;
             $fh = fopen($myFile, 'w') or die("can't open file");
             $resetPrint = "";
             fwrite($fh, $resetPrint);
             $dataPrint = $headerPrint;
             fwrite($fh, $dataPrint);
             fclose($fh);
             return json_encode(array('status' => 1, 'urlfile' => $file));
         }
     }
 }