Exemplo n.º 1
0
 public function get_fleetsonnotprintspj()
 {
     $date = Input::get('date', date('Y-m-d'));
     $pool_id = Auth::user()->pool_id;
     $timestamp = strtotime($date);
     /*
     $fleets_on_not_printspj = Scheduledate::join('schedules','schedules.id','=','schedule_dates.schedule_id')
                 ->join('fleets', 'fleets.id', '=', 'schedules.fleet_id' )
                 //->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id' )
                 //->where_in('schedule_dates.schedule_id', $arrayschedule )
                 //->where('ksos.actived','=',1)
                 ->where('schedules.pool_id', '=', $pool_id )
                 ->where('schedule_dates.date', '=', date('j', $timestamp))
                 ->where('schedules.month','=',date('n', $timestamp ))
                 ->where('schedule_dates.fg_check','=',0)                  
                 ->order_by('fleets.taxi_number','asc')
                 ->get(array('schedule_dates.id as id','schedule_dates.driver_id','schedules.fleet_id','fleets.taxi_number'));
     */
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets_on_not_printspj = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets_on_not_printspj = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedule_dates.fg_check', '=', 0)->order_by('fleets.taxi_number', 'asc')->get(array('fleets.taxi_number', 'schedule_dates.id as id'));
     }
     $datas = array_map(function ($object) {
         return $object->to_array();
     }, $fleets_on_not_printspj);
     return Response::json($datas);
 }
Exemplo n.º 2
0
 public function get_checkout()
 {
     $callback = Input::get('callback');
     $id = Input::get('schedule_id');
     $fleets = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->join('drivers', 'drivers.id', '=', 'schedule_dates.driver_id')->where('schedule_dates.id', '=', $id)->first();
     $fleetdatas = $fleets->to_array();
     return Response::jsonp($callback, $fleetdatas);
 }
Exemplo n.º 3
0
 public function post_search()
 {
     $jsondata = Input::json();
     $date = $jsondata->date;
     $timestamp = strtotime($date);
     //list armada on schedule
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedules.month', '=', date('n', $timestamp))->where('ksos.actived', '=', 1)->where('taxi_number', 'LIKE', '%' . $jsondata->taxi_number . '%')->get(array('schedule_dates.id as id', 'schedule_dates.driver_id', 'schedules.fleet_id', 'fleets.taxi_number'));
     }
     $fleetdatas = array_map(function ($object) {
         return $object->to_array();
     }, $fleets);
     $data['fleet'] = $fleetdatas;
     return json_encode($data);
 }
Exemplo n.º 4
0
 public function post_toolspj()
 {
     $date = Input::get('tanggal', date('Y-m-d'));
     ini_set('max_execution_time', 120);
     $timestamp = strtotime($date);
     //list armada on schedule
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedules.month', '=', date('n', $timestamp))->where('schedule_dates.shift_id', '=', 1)->where('ksos.actived', '=', 1)->order_by('fleets.taxi_number', 'asc')->get(array('schedule_dates.id as id', 'schedule_dates.driver_id', 'schedules.fleet_id', 'fleets.taxi_number'));
     }
     if ($fleets) {
         foreach ($fleets as $f) {
             $scheduledate = Scheduledate::find($f->id);
             $scheduledate->fg_check = 1;
             $scheduledate->save();
             $schedule = Schedule::find($scheduledate->schedule_id);
             //$driverinfo = Driver::find($scheduledate->driver_id);
             //$fleetinfo = Fleet::find($schedule->fleet_id);
             $ksoinfo = Kso::where_fleet_id($schedule->fleet_id)->where_actived(1)->first();
             $dateopertion = mktime(0, 0, 0, $schedule->month, $scheduledate->date, $schedule->year);
             $checkouts = Checkout::where_fleet_id($schedule->fleet_id)->where_operasi_time(date('Y-m-d', $dateopertion))->first();
             //delete checkouts
             if ($checkouts) {
                 $checkouts->delete();
             }
             $codeops = 1;
             $status = 7;
             $keterangan = 'Print SPJ melalui Tools';
             if (!$checkouts) {
                 //insert into to checkouts step
                 $checkouts = new Checkout();
                 $checkouts->kso_id = $ksoinfo->id;
                 $checkouts->operasi_time = date('Y-m-d', $dateopertion);
                 $checkouts->fleet_id = $schedule->fleet_id;
                 $checkouts->driver_id = $scheduledate->driver_id;
                 $checkouts->checkout_step_id = $status;
                 $checkouts->shift_id = $scheduledate->shift_id;
                 $checkouts->user_id = Auth::user()->id;
                 $checkouts->pool_id = Auth::user()->pool_id;
                 $checkouts->printspj_time = date('Y-m-d H:i:s', Myfungsi::sysdate());
                 $checkouts->operasi_status_id = $codeops;
                 $checkouts->keterangan = $keterangan;
                 $checkouts->save();
                 $cinada = Checkin::where('operasi_time', '=', date('Y-m-d', $dateopertion))->where('fleet_id', '=', $schedule->fleet_id)->first();
                 if ($cinada) {
                     $cinada->delete();
                 }
                 if (!$cinada) {
                     $cin = Checkin::create(array('kso_id' => $ksoinfo->id, 'fleet_id' => $schedule->fleet_id, 'driver_id' => $scheduledate->driver_id, 'checkin_time' => date('Y-m-d H:i:s', Myfungsi::sysdate()), 'shift_id' => $scheduledate->shift_id, 'km_fleet' => 0, 'rit' => 0, 'incomekm' => 0, 'operasi_time' => date('Y-m-d', $dateopertion), 'pool_id' => Auth::user()->pool_id, 'operasi_status_id' => $codeops, 'fg_late' => '', 'checkin_step_id' => 2, 'document_check_user_id' => Auth::user()->id, 'physic_check_user_id' => '', 'bengkel_check_user_id' => '', 'finance_check_user_id' => '', 'keterangan' => $keterangan));
                     if ($cin) {
                         $docs = new Checkindocument();
                         $docs->checkin_id = $cin->id;
                         $docs->save();
                         //return Redirect::to('schedule');
                     }
                     //
                 }
             }
         }
         return Redirect::to('schedule');
     }
 }
Exemplo n.º 5
0
 public function get_ExportJhoHarianPdf($date = false)
 {
     if (!$date) {
         $date = date('Y-m-d');
     }
     $timestamp = strtotime($date);
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $this->data['scheduleday'] = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $this->data['scheduleday'] = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->get(array('schedule_dates.id as id', 'schedule_dates.driver_id', 'schedules.fleet_id', 'schedule_dates.fg_check'));
     }
     $this->data['tanggal'] = Myfungsi::fulldate($timestamp);
     /*
     ob_start();
       echo View::make('themes.modul.'.$this->report.'.scheduleharian',$this->data);
     $content = ob_get_clean();
     
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'en');
         $html2pdf->pdf->SetDisplayMode('fullpage');
         //$html2pdf->pdf->SetProtection(array('print'), 'spipu');
         $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
         return Response::make($html2pdf->Output(), 200, array('Content-type' => 'application/pdf'));
     }
     catch(HTML2PDF_exception $e) {
         echo $e;
         exit;
     }
     */
     return View::make('themes.modul.' . $this->report . '.scheduleharian', $this->data);
 }
Exemplo n.º 6
0
     foreach ($scdul as $as) {
         // loop schedule date / driver
         $scheduledate = Scheduledate::where('schedule_id', '=', $as->id)->group_by('driver_id')->get(array('driver_id'));
         foreach ($scheduledate as $gdriver) {
             if (!in_array($gdriver->driver_id, $driver_ar)) {
                 array_push($driver_ar, $gdriver->driver_id);
             }
         }
     }
 }
 /********************************/
 /* Proses Pembuatan Jadwal View */
 /********************************/
 if (is_array($driver_ar) && !empty($driver_ar)) {
     foreach ($driver_ar as $key => $value) {
         $a = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->where('schedules.month', '=', date('n', $timestamp))->where('schedules.year', '=', date('Y', $timestamp))->where('pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.driver_id', '=', $value)->get();
         $free = array();
         // prosess pembentukan jadwal per pengemudi dalam group
         foreach ($a as $aa) {
             //echo 'Tanggal '. $aa->date .' di bawa pengemudi ' . $aa->driver_id ;
             //echo '<br>';
             array_push($free, $aa->date);
         }
         // DISPLY PENGEMUDI
         echo '<tr>';
         echo '<td>';
         echo 'Driv ' . $value;
         //$kso = Kso::where_bravo_driver_id($value)->where_actived(1)->first();
         //if($kso) echo Fleet::find($kso->fleet_id)->taxi_number;
         echo '</td>';
         echo '<td>';