Exemple #1
0
	                <td class="span2"><span class="label">Group #{{ $group->group }} </span> <a class="delete_toggler btn btn-mini btn-danger" rel="{{ $group->id }}"> Delete </a></td>
	                <td class="span8">
	                	{{-- loop fleet in group --}}
	                	@foreach(Schedulefleetgroup::where('schedule_group_id','=', $group->id )->get() as $fleet)
                    <?php 
$fleetz = Fleet::find($fleet->fleet_id);
?>
	
                      @if($fleetz)
  	                		<span class="label label-info">{{ $fleetz->taxi_number }}</span> 
                        <?php 
$x = Schedule::where('fleet_id', '=', $fleet->fleet_id)->where('year', '=', date('Y', time()))->order_by('month', 'desc')->first();
if ($x) {
    echo 'Last Generate: ';
    echo '<span class="label label-info">';
    echo MyFungsi::bulan($x->month);
    echo '</span>';
}
?>
                      @endif
	                	@endforeach
	                </td>
	                <td class="span2"><a class="label label-info" href="{{URL::to('schedule/create')}}?id={{$group->id}}"> Create Jadwal </a></td>
            	</tr>
            	@empty

            	<tr> <td> Tidak ada armada di master kepang ini </td> </tr>

            	@endforelse

            </table>
Exemple #2
0
 public function get_cetak2($id = false)
 {
     if (!$id) {
         return false;
     }
     $checkin = Checkin::find($id);
     $payment = Checkinfinancial::where_checkin_id($checkin->id)->get();
     $datapayment = array();
     for ($f = 1; $f < 22; $f++) {
         $datapayment[$f] = 0;
     }
     foreach ($payment as $pay) {
         $datapayment[$pay->financial_type_id] = $pay->amount;
     }
     $driverinfo = Driver::find($checkin->driver_id);
     $fleetinfo = Fleet::find($checkin->fleet_id);
     $kso = Kso::find($checkin->kso_id);
     //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;
     }
     */
     $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;
     }
     $datasaldo = array('Saldo KS' => $fleet_cicilan_ks - $fleet_ks, 'Saldo Sparepart' => $fleet_tabungan_sparepart + $fleet_cicilan_sparepart + $fleet_dp_sparepart - $total_pemakaian_part, '------------' => '--------------------------', 'Saldo Unit' => $fleet_cicilan_ks - $fleet_ks + ($fleet_tabungan_sparepart + $fleet_cicilan_sparepart + $fleet_dp_sparepart - $total_pemakaian_part));
     $datatagihan = array('Setoran Wajib' => $datapayment[1], 'Tabungan Sparepart' => $datapayment[2], 'Denda Keterlambatan' => $datapayment[3], 'Bayar KS' => $datapayment[6], 'Bayar DP KSO' => $datapayment[9], 'Bayar DP SP' => $datapayment[13], 'Cicilan Hut. SP' => $datapayment[5], 'Cicilan Hut. Lama *' => $datapayment[10], 'Stkr. Bandara & Keamanan' => $datapayment[12], 'Bayar TC' => $datapayment[7], 'Iuran LAKA' => $datapayment[8]);
     $datapembayaran = array('TOTAL' => $datapayment[1] + $datapayment[2] + $datapayment[3] + $datapayment[8] + $datapayment[7] + $datapayment[5] + $datapayment[6] + $datapayment[9] + $datapayment[13] + $datapayment[10] + $datapayment[12], 'POTONGAN' => $datapayment[4], '------------' => '--------------------------', 'DI BAYAR' => $datapayment[20], '-----------' => '---------------------------', 'KS PENGEMUDI' => $datapayment[11]);
     $a = strtotime($checkin->operasi_time);
     $headerPrint = "";
     for ($j = 1; $j < 2; $j++) {
         $headerPrint .= "@";
         $headerPrint .= "a";
         // 1 SET CENTER PAGE
         $headerPrint .= "!";
         $headerPrint .= "TANDA TERIMA SETORAN \r\n";
         $headerPrint .= "!";
         $headerPrint .= "@";
         // 1 RESET
         $headerPrint .= "a";
         // 1 SET CENTER PAGE
         $headerPrint .= "PT. DHARMA INDAH AGUNG METROPOLITAN \r\n";
         $headerPrint .= "POOL " . Pool::find($checkin->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', $a) . " \r\n";
         $headerPrint .= "--------------------------------------- \r\n";
         $headerPrint .= "INFORMASI SALDO PER TGL " . date('d/m/Y') . "\r\n";
         $headerPrint .= "--------------------------------------- \r\n";
         $headerPrint .= "" . $this->textFormat($datasaldo, 39) . "";
         $headerPrint .= "--------------------------------------- \r\n";
         $headerPrint .= "TAGIHAN HARI INI \r\n";
         $headerPrint .= "--------------------------------------- \r\n";
         $headerPrint .= "" . $this->textFormat($datatagihan, 39) . "";
         $headerPrint .= "--------------------------------------- \r\n";
         $headerPrint .= "" . $this->textFormat($datapembayaran, 39) . "";
         $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 = 'dataprintnota' . $checkin->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));
 }
Exemple #3
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));
         }
     }
 }