Ejemplo n.º 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);
 }
Ejemplo n.º 2
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');
     }
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
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');
 }
Ejemplo n.º 5
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);
 }
Ejemplo n.º 6
0
 public function post_delkso()
 {
     $id = Input::get('id');
     if (!$id) {
         return false;
     }
     $kso = Kso::find($id);
     $kso->delete();
     return Redirect::to('ksos');
 }