public function getDriver($id)
 {
     $driver = Driver::find($id);
     if ($driver == null) {
         return Error::make("No Driver Found");
     } else {
         return Error::success("Driver found", $driver->toArray());
     }
 }
예제 #2
0
 private function update($tabla)
 {
     switch ($tabla) {
         case 'Service':
             $service = Service::update($service_id, array('driver_id' => $driver_id, 'status_id' => "2", 'car_id' => $driver_tmp->car_id));
             $this->servicio = Service::find($this->servicio_id);
             $this->validar($service);
             break;
         case 'Driver':
             $driver = Driver::update($this->driver_id, array("available" => "0"));
             $this->conductor = Driver::find($this->conductor_id);
             $this->validar($driver);
             break;
     }
 }
 public function deleteDriver()
 {
     $driverId = Input::get('driver_id');
     try {
         $driver = Driver::find($driverId);
         $userId = $driver->user_id;
         $driver->delete();
         $user = Users::find($userId)->delete();
         $results = array('success' => true, 'message' => 'deletion requested');
     } catch (Exception $ex) {
         \Log::error(__METHOD__ . ' | error :' . print_r($ex, 1));
         $results = array('success' => false, 'message' => 'an error occurred');
     }
     return $results;
 }
예제 #4
0
 public function get_delete($id = false)
 {
     if (!$id) {
         return Redirect::to('drivers');
     }
     $driver = Driver::find($id);
     $driver->delete();
     return Redirect::to('drivers');
 }
예제 #5
0
                </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)
                 {{ $fl->taxi_number }} 
                 @endif  </span></td>
              <td>( {{$bravo->nip}} ) {{$bravo->name}} </td>
              <td>@if($charlie)
                        ( {{$charlie->nip}} ) {{$charlie->name}} </td>
                      @else
                        Tidak Ada Charlie
예제 #6
0
  border-bottom:0.3mm solid #000;
  padding-right: 5mm;
}
h3 {
  font-size: 13pt;
}

</style>

</head>
<body>

<div id="content">

<?php 
$driver = Driver::find($bap->driver_id);
$fleet = Fleet::find($bap->fleet_id);
?>
<table width="100%"  cellpadding="0" cellspacing="0" id="header">
  <tr>
    <td rowspan="3">{{ HTML::image('img/diantaksi.png','',array('id' => 'logo')) }}</td>
    <td>PT DHARMA INDAH AGUNG METROPOLITAN</td>
  </tr>
  <tr>
    <td><strong><u><h3>BERITA ACARA PROSES PENGEMUDI</h3></u></strong></td>
  </tr>
  <tr>
    <td> NO  :  {{ $bap->bap_number }} </td>
  </tr>
</table>
									</li>
								-->
								<ul id="topMain" class="nav nav-pills nav-main">
									<li><!-- HOME -->
										<a  href="{{URL::Route('home')}}">
											HOME
										</a>
										
									</li>
									@if(Auth::check())
									<?php 
$data = array("first_name" => "User");
$id = Auth::user()->id;
switch (Auth::user()->type) {
    case 'driver':
        $data = Driver::find($id)->toArray();
        break;
    case 'customer':
        $data = Customer::find($id)->toArray();
        break;
    case 'business':
        $data = Business::find($id)->toArray();
        break;
}
?>
									<li><!-- HOME -->
										<a  href="{{URL::Route('edit')}}">
											Edit
										</a>
										
									</li>
예제 #8
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');
     }
 }
예제 #9
0
                <th>Shift</th>
                <th>Status OPS</th>
                <th>Action</th>
              </tr>
            
            </thead>
            <?php 
$no = 1;
?>
              <tbody>
                @foreach($checkout as $out)
                <?php 
$fleet = Fleet::find($out->fleet_id);
?>
                <?php 
$driver = Driver::find($out->driver_id);
?>
                <tr>
                  <td>{{ $no }}</td>
                  <td>@if($fleet) {{ $fleet->taxi_number }} @endif</td>
                  <td>@if($driver) {{ $driver->nip }} @endif</td>
                  <td>@if($driver) {{ $driver->name }} @endif</td>
                  <td>{{ $out->printspj_time }}</td>
                  <td>{{ $out->checkout_time }}</td>
                  <td>
                    <?php 
$last_operasi = date('Y-m-d', strtotime($out->operasi_time . ' -1 days'));
$last_checkin = Checkin::where_fleet_id($out->fleet_id)->where_operasi_time($last_operasi)->first();
if ($last_checkin) {
    echo $last_checkin->km_fleet;
}
예제 #10
0
 public function get_findbyidCheckins($id = false)
 {
     if (!$id) {
         return false;
     }
     $checkin = Checkin::find($id);
     $fleetinfo = Fleet::find($checkin->fleet_id);
     $driverinfo = Driver::find($checkin->driver_id);
     if ($checkin) {
         $checkin_documents = Checkindocument::where_checkin_id($checkin->id)->first();
         $cpy = Checkinphysic::where_checkin_id($checkin->id)->first();
         $sp_pyss = array();
         if ($cpy) {
             $sp_pys = explode(',', $cpy->sparepart_id);
             $ket_pys = explode(',', $cpy->ket);
             foreach ($sp_pys as $k => $v) {
                 $sp_pyss[$v] = $ket_pys[$k];
             }
         }
         $std_doc = explode(',', $checkin_documents->std_document_id);
         $ket_doc = explode(',', $checkin_documents->ket);
         $std_equip = explode(',', $checkin_documents->std_equip_id);
         $std_neat = explode(',', $checkin_documents->std_neats_id);
         $std_docs = array();
         $std_equips = array();
         $std_neats = array();
         foreach ($std_doc as $k => $v) {
             $std_docs[$v] = $ket_doc[$k];
         }
         foreach ($std_equip as $k => $v) {
             $std_equips[$v] = $v;
         }
         foreach ($std_neat as $k => $v) {
             $std_neats[$v] = $v;
         }
         $returndata = array('id' => $checkin->id, 'nip' => $driverinfo->nip, 'name' => $driverinfo->name, 'taxi_number' => $fleetinfo->taxi_number, 'police_number' => $fleetinfo->police_number, 'pool_id' => $checkin->pool_id, 'pool' => Pool::find($checkin->pool_id)->pool_name, 'status' => Checkinstep::find($checkin->checkin_step_id)->checkin_step, 'km_fleet' => $checkin->km_fleet, 'rit' => $checkin->rit, 'incomekm' => $checkin->incomekm, 'checkin_time' => $checkin->checkin_time, 'std_doc_id' => $std_docs, 'std_equip_id' => $std_equips, 'std_neat_id' => $std_neats, 'psy_check' => $sp_pyss, 'checkin' => true, 'checkinid' => $checkin->id, 'operasi_status_id' => $checkin->operasi_status_id, 'fg_bengkel' => $fleetinfo->fg_bengkel);
     } else {
         $returndata = array('id' => $checkin->id, 'nip' => $driverinfo->nip, 'name' => $driverinfo->name, 'taxi_number' => $fleetinfo->taxi_number, 'police_number' => $fleetinfo->police_number, 'pool_id' => $checkin->pool_id, 'pool' => Pool::find($checkin->pool_id)->pool_name, 'status' => Checkinstep::find(1)->checkin_step, 'checkin' => false);
     }
     return json_encode($returndata);
 }
예제 #11
0
                    <td>Tanggal KSO </td>
                    <td>Mulai Beroperasi </td>
                    <td>Selesai Beroperasi </td>
                    <td>Status</td>
                    <td>Options</td>
                </tr>
                <?php 
$no = 0;
?>
                @foreach($fleetkso as $fkso)
                <?php 
$no++;
?>
                <?php 
$bravo = Driver::find($fkso->bravo_driver_id);
$charlie = Driver::find($fkso->charlie_driver_id);
?>
                <tr>
                    <td>{{$no}}</td>
                    <td>{{ $fkso->kso_number }}</td>
                    <td>
                        @if($bravo)
                            {{ '('. $bravo->nip .') '. $bravo->name }} 
                        @endif
                        
                        @if($charlie) 
                            {{ '('. $charlie->nip .') '. $charlie->name }} 
                        @endif
                    </td>
                    <td>{{ $fkso->last_update }}</td>
                    <td>{{ Myfungsi::fulldate(strtotime($fkso->ops_start)) }}</td>
예제 #12
0
 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);
         } else {
             echo '<td style="background-color: #dff0d8">';
         }
     }
     echo '</td>';
 }
 public function edit_pic_api($id)
 {
     $user = User::find($id);
     if (is_null($user)) {
         return Error::make("Invalid User");
     }
     if ($user->type != "driver") {
         return Error::make("User is not Driver");
     }
     $this->edit_pic_helper($user);
     $data = Driver::find($id)->toArray();
     return Error::success("Successfully Uploaded pictures", $data);
 }
예제 #14
0
                      <td rowspan="2">Denda</td>
                      <td colspan="4">Pembayaran</td>
                      <td rowspan="2">KS</td>
                      <td rowspan="2">Ket. OPS</td>
                    </tr>
                    <tr>
                      <td>KS</td>
                      <td>SP</td>
                      <td>DP KSO</td>
                      <td>DP SP</td>
                    </tr>
              </thead>
              <tbody>
                @foreach($reports as $report)
                <?php 
$driver = Driver::find($report->driver_id);
?>
                <tr>
                  <td>{{ $report->operasi_time }}</td>
                  <td>'{{ $driver->nip }}</td>
                  <td>{{ $driver->name }}</td>
                  <td class="text-right">{{ number_format($report->setoran_cash, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->denda, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->cicilan_ks, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->cicilan_sparepart, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->cicilan_dp_kso, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->hutang_dp_sparepart, 2, ',', '.') }}</td>
                  <td class="text-right">{{ number_format($report->ks, 2, ',', '.') }}</td>
                  <td class="text-right">{{ Statusoperasi::find($report->operasi_status_id)->kode }}</td>
                </tr>
                <?php 
예제 #15
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');
 }
예제 #16
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);
 }
예제 #17
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);
 }
예제 #18
0
	border: 1px solid #000;
	font-size: .8em;
	font-family:Tahoma, Geneva, sans-serif;
	position: fixed;
}
#content {
	padding: 10px 10px 10px 10px;
}
h1 {
	font-size: 1.4em;
}
</style>
</head>
<body>
<?php 
$driver = Driver::find($wo->driver_id);
$fleet = Fleet::find($wo->fleet_id);
?>
<div id="KERTASSEDANG">
	<div id="content">
<table cellspacing="0" cellpadding="0" width="100%">
			  <tr>
			    <td colspan="4" align="center">BUKTI KELUAR BARANG</td>
			  </tr>
			  <tr>
			    <td colspan="4" align="center">PT. DHARMA INDAH AGUNG METROPOLITAN</td>
			  </tr>
			  <tr>
			    <td>&nbsp;</td>
			    <td></td>
			    <td></td>
예제 #19
0
파일: proses.php 프로젝트: acmadi/diantaksi
 public function get_openlangsung($id = false)
 {
     if (!$id) {
         return Redirect::to('proses/otorisasipusat')->with('status', 'ID tidak valid');
     }
     //if(Auth::user()->admin !== 1 ) return Redirect::to('proses/otorisasipusat')->with('status', 'Anda Bukan Admin');
     $driver = Driver::find($id);
     $driver->fg_super_blocked = 0;
     $driver->save();
     return Redirect::to('proses/otorisasipusat')->with('status', 'Open Block Berhasil');
 }
예제 #20
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);
 }
예제 #21
0
 $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>';
 $driverx = Driver::find($value);
 echo $driverx->name . '(' . $driverx->nip . ')';
 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);
         } else {
             echo '<td style="background-color: #dff0d8">';
         }
     }
     echo '</td>';
예제 #22
0
 public function post_exphutangarmada()
 {
     $input = Input::all();
     $shift = 'all';
     $saldohutangbymonth = $this->allQuery($input['date'], Auth::user()->pool_id, $shift, 0, 1000);
     if ($saldohutangbymonth) {
         $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));
         $sheet_active = 0;
         $objPHPExcel->createSheet(NULL, $sheet_active);
         $objPHPExcel->setActiveSheetIndex($sheet_active);
         //title
         $objPHPExcel->getActiveSheet()->mergeCells('A2:J2');
         $objPHPExcel->getActiveSheet()->setCellValue('A2', 'LAPORAN HUTANG ARMADA PER TANGGAL ' . Myfungsi::fulldate(strtotime($input['date'])));
         $objPHPExcel->getActiveSheet()->getStyle('A2')->applyFromArray($styleArray);
         // Coloum header
         $objPHPExcel->getActiveSheet()->mergeCells('A5:A6');
         $objPHPExcel->getActiveSheet()->mergeCells('B5:B6');
         $objPHPExcel->getActiveSheet()->mergeCells('C5:D5');
         $objPHPExcel->getActiveSheet()->mergeCells('E5:E6');
         $objPHPExcel->getActiveSheet()->mergeCells('F5:I5');
         $objPHPExcel->getActiveSheet()->mergeCells('J5:L5');
         $objPHPExcel->getActiveSheet()->mergeCells('M5:O5');
         $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', 'PEMAKAIAN SPAREPART ARMADA');
         $objPHPExcel->getActiveSheet()->setCellValue('F6', 'PEMAKAIAN');
         $objPHPExcel->getActiveSheet()->setCellValue('G6', 'TABUNGAN');
         $objPHPExcel->getActiveSheet()->setCellValue('H6', 'BAYAR');
         $objPHPExcel->getActiveSheet()->setCellValue('I6', 'SELISIH');
         $objPHPExcel->getActiveSheet()->setCellValue('J5', 'SETORAN ARMADA');
         $objPHPExcel->getActiveSheet()->setCellValue('J6', 'KS');
         $objPHPExcel->getActiveSheet()->setCellValue('K6', 'BAYAR KS');
         $objPHPExcel->getActiveSheet()->setCellValue('L6', 'SELISIH');
         $objPHPExcel->getActiveSheet()->setCellValue('M5', 'SALDO ARMADA');
         $objPHPExcel->getActiveSheet()->setCellValue('M6', 'SALDO SPAREPART');
         $objPHPExcel->getActiveSheet()->setCellValue('N6', 'SALDO KS');
         $objPHPExcel->getActiveSheet()->setCellValue('O6', 'SALDO AKHIR');
         $objPHPExcel->getActiveSheet()->setCellValue('P5', 'SHIFT');
         $no = 1;
         $starline = 8;
         foreach ($saldohutangbymonth as $saldo) {
             $bpkasuh = Anakasuh::where('status', '=', 1)->where('fleet_id', '=', $saldo->fleet_id)->first();
             $bravo = Driver::find($saldo->bravo_driver_id);
             $saldosp = $saldo->tabungan_sparepart + $saldo->hutang_dp_sparepart + $saldo->cicilan_sparepart - $saldo->pemakaian_part;
             $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, $bravo ? $bravo->nip : 'NONE');
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $starline, $bravo ? $bravo->name : 'NONE');
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $starline, $saldo->taxi_number);
             //pemakaikan sp
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $starline, $saldo->pemakaian_part);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $starline, $saldo->tabungan_sparepart);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $starline, $saldo->hutang_dp_sparepart + $saldo->cicilan_sparepart);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $starline, $saldosp);
             //setoran armada
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $starline, $saldo->ks);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $starline, $saldo->cicilan_ks);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(11, $starline, $saldo->selisi_ks);
             //saldo armada
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(12, $starline, $saldosp);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(13, $starline, $saldo->selisi_ks);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(14, $starline, $saldosp + $saldo->selisi_ks);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(15, $starline, $saldo->shift_id);
             $no++;
             $starline++;
         }
         $objPHPExcel->getActiveSheet()->getStyle('A5:O' . ($starline + 1))->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR);
         $objPHPExcel->getActiveSheet()->getStyle('A5:O6')->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
         $objPHPExcel->getActiveSheet()->getStyle('A5:O' . ($starline + 1))->getBorders()->getOutline()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
         $objPHPExcel->getActiveSheet()->getStyle('A' . ($starline + 1) . ':O' . ($starline + 1))->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
         //end
         //SET TANGGAL UNDUH DAN PASSWORD
         $objPHPExcel->getActiveSheet()->setCellValue('B' . ($starline + 10), 'Tanggal Unduh');
         $objPHPExcel->getActiveSheet()->setCellValue('C' . ($starline + 10), ':');
         $objPHPExcel->getActiveSheet()->setCellValue('D' . ($starline + 10), date('Y-m-d H:i:s'));
         $objPHPExcel->getSecurity()->setLockWindows(true);
         $objPHPExcel->getSecurity()->setLockStructure(true);
         $objPHPExcel->getSecurity()->setWorkbookPassword("FreeBlocking");
         $objPHPExcel->getActiveSheet()->getProtection()->setPassword('FreeBlocking');
         $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);
         // This should be enabled in order to enable any of the following!
         //$objPHPExcel->getActiveSheet()->getProtection()->setSort(true);
         $objPHPExcel->getActiveSheet()->getProtection()->setInsertRows(true);
         //END
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
         $objWriter->save(path('public') . 'Laporan-hutang-armada.xls');
         return Response::download(path('public') . 'Laporan-hutang-armada.xls');
     }
     //end if
     //var_dump($saldohutangbymonth);
 }
예제 #23
0
	                <td>Bravo</td>
	                <td>
                    @if($bravo)
                    ( {{$bravo->nip}} ) {{$bravo->name}} <input type="hidden" id="bravo_id" value="{{$bravo->id}}">
                    @else
                      Tidak Ada Bravo
                    @endif
                  </td>
	                <td>

                  {{ Form::select('day', $dayofmonth,'' , array('required','id'=>'day')) }} Tanggal Awal Libur

                  </td>
	            </tr>
              <?php 
$charlie = Driver::find($fleetinfo->charlie_driver_id);
?>
              <tr>
	                <td>Charlie</td>
	                <td>
                      @if($charlie)
                        ( {{$charlie->nip}} ) {{$charlie->name}} <input type="hidden" id="charlie_id" value="{{$charlie->id}}"></td>
	                    @else
                        Tidak Ada Charlie
                      @endif
                  <td>
                    <input name="sisaopscharlie" id="sisaopscharlie" type="text" value="0" >Sisa Operasi Charlie Bulan Lalu
                  </td>
	            </tr>
              <tr>
                  <td>Waktu Operasi</td>
예제 #24
0
 public function post_otorisasi()
 {
     $input = Input::json();
     $username = $input->username;
     $password = $input->password;
     $bap_id = $input->bap_id;
     $ver2 = User::where('username', '=', $username)->first();
     if ($ver2) {
         if (Hash::check($password, $ver2->password)) {
             if ($ver2->id !== Auth::user()->id) {
                 //melihat driver_id dan fleet_id pada bap
                 $bap = Bap::find($bap_id);
                 //create log open block
                 try {
                     $open = Openblocking::create(array('bap_id' => $bap_id, 'tanggal' => date('Y-m-d H:i:s'), 'otorisasi1_id' => Auth::user()->id, 'otorisasi2_id' => $ver2->id));
                     if ($open) {
                         $driver = Driver::find($bap->driver_id);
                         $driver->fg_blocked = 0;
                         $driver->save();
                         $setor = Fleet::find($bap->fleet_id);
                         $setor->fg_setor = 0;
                         $setor->save();
                         return json_encode(array('status' => true, 'msg' => 'Otorisasi open block berhasil!'));
                     }
                 } catch (Exception $e) {
                     return json_encode(array('status' => true, 'msg' => 'Otorisasi sudah dilakukan!'));
                 }
             } else {
                 return json_encode(array('status' => false, 'msg' => 'Otorisasi harus orang yang berbeda!'));
             }
         }
     }
     return json_encode(array('status' => false, 'msg' => 'Otorisasi kedua gagal!'));
 }
예제 #25
0
 /**
  * GET ASSOCIATED PENDING FINES MESSAGES OF VEHICLE
  * @param  int $id ID OF VEHICLE
  * @return html     FINES MESSAGES
  */
 public static function getVehiclePendingFinesMessage($id)
 {
     $vehicle = Vehicle::find($id);
     $voilationsCount = $vehicle->voilationsPending->count();
     $msg = "";
     // PENDING VEHICLE VOILATIONS EXISTS
     if ($voilationsCount > 0) {
         $vehicle_voilations_unique_id_ar = $vehicle->voilationsPending->lists('vehicle_fine_unique_id');
         $vehicle_ids = implode(", ", $vehicle_voilations_unique_id_ar);
         $msg .= "<div class='row'><div class='col-md-12'>This Vehicle has {$voilationsCount} pending fines ({$vehicle_ids})</div></div>";
         // BEGIN VEHICLE OWNERS FINE
         $vehicleOwners = $vehicle->owners;
         foreach ($vehicleOwners as $vehicleOwner) {
             if ($vehicleOwner->voilationsPending->count() > 0) {
                 $vehicleOwnerFinesIds[$vehicleOwner->id] = $vehicleOwner->voilationsPending->lists('driver_fine_unique_id');
             }
         }
         // IF VEHICLE OWNER FINES EXISTS
         if (isset($vehicleOwnerFinesIds) && count($vehicleOwnerFinesIds) > 0) {
             foreach ($vehicleOwnerFinesIds as $ownerId => $vehicleOwnerFinesId) {
                 $owner = Driver::find($ownerId);
                 $ownerName = $owner->drivers_fname . " " . $owner->drivers_mname . " " . $owner->drivers_lname;
                 // FINES ID IS IN ARRAY, SO IMPLODE IT
                 $finesIdStr = implode(',', $vehicleOwnerFinesId);
                 $msg .= "<div class='row'><div class='col-md-12'>Owner ({$ownerName}) has " . count($vehicleOwnerFinesId) . " pending fines ({$finesIdStr})</div></div>";
             }
         }
         // END VEHICLE OWNERS FINE
         // BEGIN VEHICLE AUTHORIZED DRIVERS FINE
         $vehicleAuthorized = $vehicle->authorizedDrivers;
         foreach ($vehicleAuthorized as $vehicleAuthorized) {
             if ($vehicleAuthorized->voilationsPending->count() > 0) {
                 $vehicleAuthorizedFinesIds[$vehicleAuthorized->id] = $vehicleAuthorized->voilationsPending->lists('driver_fine_unique_id');
             }
         }
         if (isset($vehicleAuthorizedFinesIds) && count($vehicleAuthorizedFinesIds) > 0) {
             foreach ($vehicleAuthorizedFinesIds as $authorizedId => $vehicleAuthorizedFinesId) {
                 $authorized = Driver::find($authorizedId);
                 $authorizedName = $authorized->drivers_fname . " " . $authorized->drivers_mname . " " . $authorized->drivers_lname;
                 // FINES ID IS IN ARRAY, SO IMPLODE IT
                 $finesIdStrAuthorized = implode(',', $vehicleAuthorizedFinesId);
                 $msg .= "<div class='row'><div class='col-md-12'>Authorized Driver ({$authorizedName}) has " . count($vehicleAuthorizedFinesId) . " pending fines ({$finesIdStrAuthorized})</div></div>";
             }
         }
         // END VEHICLE AUTHORIZED DRIVER FINE
         if (!empty($msg)) {
             return $msg;
         }
     } else {
         // BEGIN VEHICLE OWNERS FINE
         $vehicleOwners = $vehicle->owners;
         foreach ($vehicleOwners as $vehicleOwner) {
             if ($vehicleOwner->voilationsPending->count() > 0) {
                 $vehicleOwnerFinesIds[$vehicleOwner->id] = $vehicleOwner->voilationsPending->lists('driver_fine_unique_id');
             }
         }
         // IF VEHICLE OWNER FINES EXISTS
         if (isset($vehicleOwnerFinesIds) && count($vehicleOwnerFinesIds) > 0) {
             foreach ($vehicleOwnerFinesIds as $ownerId => $vehicleOwnerFinesId) {
                 $owner = Driver::find($ownerId);
                 $ownerName = $owner->drivers_fname . " " . $owner->drivers_mname . " " . $owner->drivers_lname;
                 // FINES ID IS IN ARRAY, SO IMPLODE IT
                 $finesIdStr = implode(',', $vehicleOwnerFinesId);
                 $msg .= "<div class='row'><div class='col-md-12'>Owner ({$ownerName}) has " . count($vehicleOwnerFinesId) . " pending fines ({$finesIdStr})</div></div>";
             }
         }
         // END VEHICLE OWNERS FINE
         // BEGIN VEHICLE AUTHORIZED DRIVERS FINE
         $vehicleAuthorized = $vehicle->authorizedDrivers;
         foreach ($vehicleAuthorized as $vehicleAuthorized) {
             if ($vehicleAuthorized->voilationsPending->count() > 0) {
                 $vehicleAuthorizedFinesIds[$vehicleAuthorized->id] = $vehicleAuthorized->voilationsPending->lists('driver_fine_unique_id');
             }
         }
         if (isset($vehicleAuthorizedFinesIds) && count($vehicleAuthorizedFinesIds) > 0) {
             foreach ($vehicleAuthorizedFinesIds as $authorizedId => $vehicleAuthorizedFinesId) {
                 $authorized = Driver::find($authorizedId);
                 $authorizedName = $authorized->drivers_fname . " " . $authorized->drivers_mname . " " . $authorized->drivers_lname;
                 // FINES ID IS IN ARRAY, SO IMPLODE IT
                 $finesIdStrAuthorized = implode(',', $vehicleAuthorizedFinesId);
                 $msg .= "<div class='row'><div class='col-md-12'>Authorized Driver ({$authorizedName}) has " . count($vehicleAuthorizedFinesId) . " pending fines ({$finesIdStrAuthorized})</div></div>";
             }
         }
         // END VEHICLE AUTHORIZED DRIVER FINE
         if (!empty($msg)) {
             return $msg;
         }
     }
 }
예제 #26
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $vehicle = Vehicle::find($id);
     // LOGS
     $oldVehiclesStatus = $vehicle->vehicles_status;
     $newVehiclesStatus = Input::get('vehicles_status');
     $oldvehicleColor = $vehicle->color->id;
     $newVehicleColor = Input::get('vehicles_color');
     $oldVehicleUseType = $vehicle->vehicles_use_type;
     $newVehicleUseType = Input::get('vehicles_use_type');
     $vehicles_class = Input::get('vehicles_class');
     $oldVehiclesRegistrationNo = $vehicle->registration->registrations_no;
     $newVehiclesRegistrationNo = Input::get('registrations_no');
     $oldOdometer = $vehicle->vehicles_odometer;
     $newOdometer = Input::get('vehicles_odometer');
     // IF VEHICLE STATUS IS CHANGED, ADD LOG
     if ($oldVehiclesStatus != $newVehiclesStatus) {
         LogVehicleStatus::create(['log_vehicle_status_vehicle_id' => $id, 'log_vehicle_status_vehicle_status_id' => $newVehiclesStatus]);
     }
     // IF VEHICLE COLOR IS CHANGED, ADD LOG
     if ($oldvehicleColor != $newVehicleColor) {
         LogVehicleColor::create(['log_vehicle_color_vehicle_id' => $id, 'log_vehicle_color_color_id' => $newVehicleColor]);
     }
     // IF VEHICLE USE TYPE IS CHANGED, TAKE LOG (ALSO TAKING LOG OF ODOMETER AND INCREMENT SEQUENCE)
     if ($oldVehicleUseType != $newVehicleUseType) {
         LogVehicleUseType::create(['log_vehicle_use_type_vehicle_id' => $id, 'log_vehicle_use_type_use_type' => $newVehicleUseType, 'log_vehicle_use_type_registration_no' => $newVehiclesRegistrationNo]);
         // INCREMENTING SEQUENCE
         $vehicles_use_type_table_name = VehicleUseType::find($newVehicleUseType)->vehicle_use_types_table_name;
         $vehicles_sequence_col_name = $vehicles_use_type_table_name . '_sequence';
         $currentSequence = DB::table($vehicles_use_type_table_name)->find($vehicles_class)->{$vehicles_sequence_col_name};
         $newSequence = $currentSequence + 1;
         DB::table($vehicles_use_type_table_name)->where('id', $vehicles_class)->update([$vehicles_sequence_col_name => $newSequence]);
         // TAKING LOG OF ODOMETER
         $vehicles_odometer = Input::get('vehicles_odometer');
         LogVehicleOdometer::create(['log_vehicle_odometer_vehicle_id' => $id, 'log_vehicle_odometer_old_odometer' => $vehicles_odometer, 'log_vehicle_odometer_status' => 2]);
     } elseif ($oldOdometer != $newOdometer) {
         LogVehicleOdometer::create(['log_vehicle_odometer_vehicle_id' => $id, 'log_vehicle_odometer_old_odometer' => $newOdometer, 'log_vehicle_odometer_status' => 4]);
     }
     // BEGIN UPDATE VEHICLE DATA
     $vehicle = Input::only(['vehicles_use_type', 'vehicles_class', 'vehicles_color', 'vehicles_status', 'vehicles_odometer']);
     Vehicle::where('id', $id)->update($vehicle);
     // END UPDATE VEHICLE DATA
     // BEGIN OWNERS
     //OLD OWNERS
     $old_owners = Vehicle::find($id)->owners->lists('id');
     //UPDATED OLD OWNERS
     $updated_old_owners_index = Input::get('old_owners_index');
     $updated_owners_index_arr = array_filter(explode(',', $updated_old_owners_index));
     //DELETED OWNERS
     $deleted_owners = array_diff($old_owners, $updated_owners_index_arr);
     // DELETE EACH DELETED OWNER FROM DATABASE
     foreach ($deleted_owners as $deleted_owner_id) {
         VehicleDriverOwner::where('vehicle_driver_owners_vehicle_id', $id)->where('vehicle_driver_owners_driver_id', $deleted_owner_id)->delete();
     }
     //RETAINED OWNERS
     $retained_owners = array_intersect($old_owners, $updated_owners_index_arr);
     // UPDATE RETAINED OWNERS
     foreach ($retained_owners as $retained_owner) {
         $retained_owner_info['drivers_fname'] = Input::get('drivers_fname' . $retained_owner);
         $retained_owner_info['drivers_mname'] = Input::get('drivers_mname' . $retained_owner);
         $retained_owner_info['drivers_lname'] = Input::get('drivers_lname' . $retained_owner);
         $retained_owner_info['drivers_nin'] = Input::get('drivers_nin' . $retained_owner);
         $retained_owner_info['drivers_license_no'] = Input::get('drivers_license_no' . $retained_owner);
         $retained_owner_info['drivers_street'] = Input::get('drivers_street' . $retained_owner);
         $retained_owner_info['drivers_city'] = Input::get('drivers_city' . $retained_owner);
         $retained_owner_info['drivers_po_box'] = Input::get('drivers_po_box' . $retained_owner);
         $retained_owner_info['drivers_country'] = Input::get('drivers_country' . $retained_owner);
         $retained_owner_info['drivers_cell1'] = Input::get('drivers_cell1' . $retained_owner);
         $retained_owner_info['drivers_cell2'] = Input::get('drivers_cell2' . $retained_owner);
         $retained_owner_info['drivers_email'] = Input::get('drivers_email' . $retained_owner);
         $retained_owner_info['drivers_driving_status'] = Input::get('drivers_driving_status' . $retained_owner);
         Driver::find($retained_owner)->update($retained_owner_info);
     }
     // END OWNERS
     //BEGIN AUTHORIZED DRIVERS
     $old_authorized = Vehicle::find($id)->authorizedDrivers->lists('id');
     //UPDATED OLD AUTHORIZED DRIVERS
     $updated_old_authorized_index = Input::get('old_authorized_index');
     $updated_authorized_index_arr = array_filter(explode(',', $updated_old_authorized_index));
     //DELETED AUTHORIZED DRIVERS
     $deleted_authorized = array_diff($old_authorized, $updated_authorized_index_arr);
     //DELETE EACH DELETED AUTHORIZED DRIVER FROM DATABASE
     foreach ($deleted_authorized as $deleted_authorized_id) {
         VehicleDriverAuthorized::where('vehicle_driver_authorized_vehicle_id', $id)->where('vehicle_driver_authorized_driver_id', $deleted_authorized_id)->delete();
     }
     //RETAINED AUTHORIZED DRIVERS
     $retained_authorized = array_intersect($old_authorized, $updated_authorized_index_arr);
     // UPDATE RETAINED AUTHORIZED DRIVERS
     foreach ($retained_authorized as $retained_authorize) {
         $retained_authorized_info['drivers_fname'] = Input::get('authorized_fname' . $retained_authorize);
         $retained_authorized_info['drivers_mname'] = Input::get('authorized_mname' . $retained_authorize);
         $retained_authorized_info['drivers_lname'] = Input::get('authorized_lname' . $retained_authorize);
         $retained_authorized_info['drivers_nin'] = Input::get('authorized_nin' . $retained_authorize);
         $retained_authorized_info['drivers_license_no'] = Input::get('authorized_license_no' . $retained_authorize);
         $retained_authorized_info['drivers_street'] = Input::get('authorized_street' . $retained_authorize);
         $retained_authorized_info['drivers_city'] = Input::get('authorized_city' . $retained_authorize);
         $retained_authorized_info['drivers_po_box'] = Input::get('authorized_po_box' . $retained_authorize);
         $retained_authorized_info['drivers_country'] = Input::get('authorized_country' . $retained_authorize);
         $retained_authorized_info['drivers_cell1'] = Input::get('authorized_cell1' . $retained_authorize);
         $retained_authorized_info['drivers_cell2'] = Input::get('authorized_cell2' . $retained_authorize);
         $retained_authorized_info['drivers_email'] = Input::get('authorized_email' . $retained_authorize);
         $retained_authorized_info['drivers_driving_status'] = Input::get('authorized_driving_status' . $retained_authorize);
         Driver::find($retained_authorize)->update($retained_authorized_info);
     }
     //END AUTHORIZED DRIVERS
     // BEGIN NEW OWNERS
     $owners_index = Input::get('owners_index');
     $owners_index_arr = array_filter(explode(',', $owners_index));
     // LOOP THROUGH EACH OWNER AND ASSOCIATE WITH DRIVERS
     foreach ($owners_index_arr as $owners_index_id) {
         $drivers_license_no = Input::get('drivers_license_no' . $owners_index_id);
         if (trim($drivers_license_no) != "") {
             $drivers_status = Driver::where('drivers_license_no', $drivers_license_no)->first();
             // IF DRIVER DOESN'T EXISTS, CREATE DRIVER
             if ($drivers_status == NULL) {
                 $owner_info['drivers_fname'] = Input::get('drivers_fname' . $owners_index_id);
                 $owner_info['drivers_mname'] = Input::get('drivers_mname' . $owners_index_id);
                 $owner_info['drivers_lname'] = Input::get('drivers_lname' . $owners_index_id);
                 $owner_info['drivers_nin'] = Input::get('drivers_nin' . $owners_index_id);
                 $owner_info['drivers_license_no'] = Input::get('drivers_license_no' . $owners_index_id);
                 $owner_info['drivers_street'] = Input::get('drivers_street' . $owners_index_id);
                 $owner_info['drivers_city'] = Input::get('drivers_city' . $owners_index_id);
                 $owner_info['drivers_po_box'] = Input::get('drivers_po_box' . $owners_index_id);
                 $owner_info['drivers_country'] = Input::get('drivers_country' . $owners_index_id);
                 $owner_info['drivers_cell1'] = Input::get('drivers_cell1' . $owners_index_id);
                 $owner_info['drivers_cell2'] = Input::get('drivers_cell2' . $owners_index_id);
                 $owner_info['drivers_email'] = Input::get('drivers_email' . $owners_index_id);
                 $owner_info['drivers_driving_status'] = Input::get('drivers_driving_status' . $owners_index_id);
                 $insert_owner_into_driver_table = Driver::create($owner_info);
                 $owner_ids[] = $insert_owner_into_driver_table->id;
             } else {
                 $owner_ids[] = Driver::where('drivers_license_no', $drivers_license_no)->first()->id;
             }
         }
     }
     // LINK VEHICLE WITH NEW OWNERS
     if (!empty($owner_ids)) {
         foreach ($owner_ids as $owner_ids_fet) {
             $owner_ids_fet = (int) $owner_ids_fet;
             //VehicleDriverOwner::create(['vehicle_driver_owners_vehicle_id' => $id, 'vehicle_driver_owners_driver_id' => $owner_ids_fet]);
             Vehicle::find($id)->owners()->attach($owner_ids_fet);
         }
     }
     // END NEW OWNERS
     //BEGIN NEW AUTHORIZED DRIVERS
     $authorized_index = Input::get('authorized_index');
     // IF AUTHORIZED DRIVERS EXIST, ASSOCIATE WITH DRIVERS.(CHECKING USING LICENSE)
     if ($authorized_index != "") {
         $authorized_index_arr = explode(',', $authorized_index);
         foreach ($authorized_index_arr as $authorized_index_id) {
             $authorized_license_no = Input::get('authorized_license_no' . $authorized_index_id);
             $authorized_status = Driver::where('drivers_license_no', $authorized_license_no)->first();
             //IF DRIVER DOESN'T EXISTS, CREATE DRIVER
             if ($authorized_status == NULL) {
                 $authorized_info['drivers_fname'] = Input::get('authorized_fname' . $authorized_index_id);
                 $authorized_info['drivers_mname'] = Input::get('authorized_mname' . $authorized_index_id);
                 $authorized_info['drivers_lname'] = Input::get('authorized_lname' . $authorized_index_id);
                 $authorized_info['drivers_nin'] = Input::get('authorized_nin' . $authorized_index_id);
                 $authorized_info['drivers_license_no'] = Input::get('authorized_license_no' . $authorized_index_id);
                 $authorized_info['drivers_street'] = Input::get('authorized_street' . $authorized_index_id);
                 $authorized_info['drivers_city'] = Input::get('authorized_city' . $authorized_index_id);
                 $authorized_info['drivers_po_box'] = Input::get('authorized_po_box' . $authorized_index_id);
                 $authorized_info['drivers_country'] = Input::get('authorized_country' . $authorized_index_id);
                 $authorized_info['drivers_cell1'] = Input::get('authorized_cell1' . $authorized_index_id);
                 $authorized_info['drivers_cell2'] = Input::get('authorized_cell2' . $authorized_index_id);
                 $authorized_info['drivers_email'] = Input::get('authorized_email' . $authorized_index_id);
                 $authorized_info['drivers_driving_status'] = Input::get('authorized_driving_status' . $authorized_index_id);
                 $insert_authorized_into_driver_table = Driver::create($authorized_info);
                 $authorized_ids[] = $insert_authorized_into_driver_table->id;
             } else {
                 $authorized_ids[] = Driver::where('drivers_license_no', $authorized_license_no)->first()->id;
             }
         }
         // LINK VEHICLE WITH AUTHORIZED DRIVERS
         foreach ($authorized_ids as $authorized_ids_fet) {
             $authorized_ids_fet = (int) $authorized_ids_fet;
             //VehicleDriverAuthorized::create(['vehicle_driver_authorized_vehicle_id' => $id, 'vehicle_driver_authorized_driver_id' => $authorized_ids_fet]);
             Vehicle::find($id)->authorizedDrivers()->attach($authorized_ids_fet);
         }
     }
     // END NEW AUTHORIZED DRIVERS
     // BEGIN INSURANCE
     if (Input::get('insurances_company') != "") {
         $insurance_arr = Input::only('insurances_company', 'insurances_policy_no', 'insurances_exp_date', 'insurances_agent_fname', 'insurances_agent_lname', 'insurances_agent_cell', 'insurances_agent_city', 'insurances_agent_email');
         if (Insurance::where('insurances_vehicle_id', $id)->first()->id) {
             Insurance::where('insurances_vehicle_id', $id)->update($insurance_arr);
         } else {
             //$insurance_arr['insurances_vehicle_id'] = $id;
             //Insurance::create($insurance_arr);
             Vehicle::find($id)->insurance()->save($insurance_arr);
         }
     }
     // END INSURANCE
     // BEGIN LIEN HOLDER
     if (Input::get('lien_index')) {
         $lien_arr = Input::only('liens_collateral_id', 'liens_collateral_value', 'liens_bank_name', 'liens_bank_branch', 'liens_bank_street', 'liens_bank_city');
         if (Lien::where('liens_vehicle_id', $id)->first()->id) {
             Lien::where('liens_vehicle_id', $id)->update($lien_arr);
         } else {
             //$lien_arr['liens_vehicle_id'] = $id;
             //Lien::create($lien_arr);
             Vehicle::find($id)->lien()->save($lien_arr);
         }
     }
     // END LIEN HOLDER
     // BEGIN OLD FILES
     $old_documents_index = Vehicle::find($id)->documents->lists('id');
     $documents_index = explode(',', Input::get('documents_index'));
     $deleted_documents = array_diff($old_documents_index, $documents_index);
     if (!empty($deleted_documents)) {
         foreach ($deleted_documents as $deleted_document) {
             Document::find($deleted_document)->delete();
         }
     }
     // END OLD FILES
     // BEGIN NEW FILES
     $files_col = Input::file();
     $files_count = count(array_filter($files_col['files']));
     // IF FILES EXISTS
     if ($files_count) {
         foreach ($files_col['files'] as $files) {
             $filename_ar = explode('.', $files->getClientOriginalName());
             $document_ext = end($filename_ar);
             $path = public_path() . '/vehicledata/documents';
             // GENERATE RANDOM FILE NAME AND ADD EXTENSION
             $randName = md5(rand() * time());
             $document_name = $randName . '.' . $document_ext;
             // MOVE FILE AND ENTRY INTO DATABASE
             if ($files->move($path, $document_name)) {
                 //Document::create(['documents_vehicle_id' => $id, 'documents_name' => $document_name]);
                 Vehicle::find($id)->documents()->save(new Document(['documents_name' => $document_name]));
             }
         }
     }
     // END NEW FILES
     // BEGIN REGISTRATION
     if (isset($id) && $id != "") {
         $registrations_vehicle_id = $id;
         $registrations_no = Input::get('registrations_no');
         $registrations_licence_plate_no = Input::get('registrations_licence_plate_no');
         if ($registrations_no != "" && $registrations_licence_plate_no != "" && $registrations_vehicle_id != "") {
             $vehicles_use_type = Input::get('vehicles_use_type');
             $vehicles_class = Input::get('vehicles_class');
             if ($vehicles_use_type != "" && $vehicles_class != "") {
                 $vehicles_use_type_table_name = VehicleUseType::find($vehicles_use_type)->vehicle_use_types_table_name;
                 //REGISTRATION FEES
                 $vehicles_class_col_name = $vehicles_use_type_table_name . '_total';
                 $registrations_fees = DB::table($vehicles_use_type_table_name)->find($vehicles_class)->{$vehicles_class_col_name};
                 $registration_ar = compact('registrations_vehicle_id', 'registrations_no', 'registrations_licence_plate_no', 'registrations_fees');
                 Registration::where('registrations_vehicle_id', $id)->update($registration_ar);
                 return Redirect::route('vehicle.print', [$registrations_vehicle_id]);
             }
         }
     } else {
         echo "Nothing is saved because fields are not filled";
         die;
     }
     // END REGISTRATION
 }
예제 #27
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));
         }
     }
 }