Наследование: extends Eloquent
Пример #1
0
     httpResponse($friends->delete((int) $params[1]));
     break;
 case validateRoute('PATCH', 'friends/\\d+'):
     $friends = new Friends($db, $user);
     httpResponse($friends->update((int) $params[1]), $postdata);
     break;
 case validateRoute('GET', 'blocked'):
     $blocked = new Blocked($db, $user);
     httpResponse($blocked->query());
     break;
 case validateRoute('POST', 'blocked'):
     $blocked = new Blocked($db, $user);
     httpResponse($blocked->create($postdata));
     break;
 case validateRoute('DELETE', 'blocked/\\d+'):
     $blocked = new Blocked($db, $user);
     httpResponse($blocked->delete((int) $params[1]));
     break;
 case validateRoute('GET', 'bookmarks'):
     $bookmarks = new Bookmarks($db, $user);
     httpResponse($bookmarks->query(null));
     break;
 case validateRoute('POST', 'bookmarks'):
     $bookmarks = new Bookmarks($db, $user);
     httpResponse($bookmarks->create($postdata));
     break;
 case validateRoute('DELETE', 'bookmarks/\\d+'):
     $bookmarks = new Bookmarks($db, $user);
     httpResponse($bookmarks->delete((int) $params[1]));
     break;
 case validateRoute('GET', 'subtitles'):
Пример #2
0
 public function get_formbap($id = false)
 {
     Log::write('info', Request::ip() . ' User : '******' Event: Open Form BAP', true);
     if (!$id) {
         return false;
     }
     $checkout = Checkout::find($id);
     //membuat tidak tapil form jika belum waktunya
     $time = Myfungsi::sysdate();
     //date ajustment
     $t = strtotime($checkout->operasi_time . " 7 hours 0 seconds");
     if ($time <= $t) {
         return false;
     }
     $financial_fleet = DB::table('financial_report_bykso')->where('kso_id', '=', $checkout->kso_id)->first();
     $financial_fleet_part = DB::table('wo_financial_report_bykso')->where('kso_id', '=', $checkout->kso_id)->first();
     $kso = Kso::find($checkout->kso_id);
     $driver_status = 'Bravo';
     if ($kso->bravo_driver_id !== $checkout->driver_id) {
         $driver_status = 'Charlie';
     }
     $fleet_ks = 0;
     $fleet_cicilan_ks = 0;
     $fleet_tabungan_sparepart = 0;
     $fleet_cicilan_db_kso = 0;
     $fleet_cicilan_sparepart = 0;
     $fleet_dp_sparepart = 0;
     if ($financial_fleet) {
         $fleet_ks = $financial_fleet->ks;
         $fleet_cicilan_ks = $financial_fleet->cicilan_ks;
         $fleet_tabungan_sparepart = $financial_fleet->tabungan_sparepart;
         $fleet_cicilan_db_kso = $financial_fleet->cicilan_dp_kso;
         $fleet_cicilan_sparepart = $financial_fleet->cicilan_sparepart;
         $fleet_dp_sparepart = $financial_fleet->hutang_dp_sparepart;
     }
     $total_pemakaian_part = 0;
     if ($financial_fleet_part) {
         $total_pemakaian_part = $financial_fleet_part->pemakaian_part;
     }
     $maxno = Bap::max('id');
     //MyFungsi::numberComplate($maxno,5)
     $nosurat = 'DT-xxxxxx/BAP/' . Fleet::find($checkout->fleet_id)->taxi_number . '/' . date('m') . '/' . date('Y');
     $this->data['saldo_sparepart'] = $fleet_tabungan_sparepart + $fleet_cicilan_sparepart + $fleet_dp_sparepart - $total_pemakaian_part;
     $this->data['saldo_ks'] = $fleet_ks - $fleet_cicilan_ks;
     $this->data['saldo_unit'] = $fleet_ks - $fleet_cicilan_ks + ($fleet_tabungan_sparepart + $fleet_cicilan_sparepart + $fleet_dp_sparepart - $total_pemakaian_part);
     $this->data['nosurat'] = $nosurat;
     $this->data['checkout'] = $checkout;
     $this->data['listpelanggaran'] = Stdbap::all();
     $this->data['options'] = array('6' => 'Cicilan KS');
     $this->data['infodriver'] = Driver::find($checkout->driver_id);
     $this->data['listkewajibans'] = Kewajiban::join('financial_types as ft', 'ft.id', '=', 'kewajibans.financial_type_id')->where_fleet_id($checkout->fleet_id)->where_driver_id($checkout->driver_id)->get();
     $this->data['status_pengemudi'] = $driver_status;
     $kep = Keputusanbap::all();
     $pelanggaran = Blocked::where_driver_id($checkout->driver_id)->where_fleet_id($checkout->fleet_id)->where_proses(0)->get();
     $pel_id = array();
     foreach ($pelanggaran as $pel) {
         array_push($pel_id, $pel->std_bap_id);
     }
     $optionskeputusan = array();
     foreach ($kep as $v) {
         $optionskeputusan[$v->id] = $v->keputusan;
     }
     $this->data['keputusans'] = $optionskeputusan;
     $this->data['checklistpelanggaran'] = $pel_id;
     //return View::make('themes.modul.'.$this->views.'.formbap',$this->data);
     return View::make('themes.modul.' . $this->views . '.suratbap', $this->data);
 }
Пример #3
0
 public function post_savePayment()
 {
     Log::write('info', Request::ip() . ' User : '******' Event: Save Setoran', true);
     $jsondata = Input::json();
     //lihat KS
     $tabungan_pengemudi = 0;
     $ks_pengemudi = 0;
     if ((int) $jsondata->ks > 0) {
         $tabungan_pengemudi = (int) $jsondata->ks;
     } else {
         $ks_pengemudi = abs((int) $jsondata->ks);
     }
     $setoran = array();
     $setoran['1'] = (int) $jsondata->setoran_wajib;
     $setoran['2'] = (int) $jsondata->tab_sp;
     $setoran['3'] = (int) $jsondata->denda;
     $setoran['4'] = (int) $jsondata->pot;
     $setoran['5'] = (int) $jsondata->tag_spart;
     $setoran['6'] = (int) $jsondata->tag_ks;
     $setoran['7'] = (int) $jsondata->biaya_tc;
     $setoran['8'] = (int) $jsondata->iuran_laka;
     $setoran['9'] = (int) $jsondata->tag_cicilan_dp;
     $setoran['10'] = (int) $jsondata->tag_hut_lama;
     $setoran['11'] = (int) $ks_pengemudi;
     $setoran['12'] = (int) $jsondata->tag_other;
     $setoran['13'] = (int) $jsondata->tag_dp_spart;
     $setoran['20'] = (int) $jsondata->setoran_cash;
     $setoran['21'] = (int) $tabungan_pengemudi;
     try {
         foreach ($setoran as $key => $value) {
             $payment = Checkinfinancial::create(array('checkin_id' => $jsondata->checkin_id, 'financial_type_id' => $key, 'amount' => $value));
         }
         $checkin = Checkin::find($jsondata->checkin_id);
         /*
         /* membuat super block berdasarkan parameter ini
         /* 1. KS Pengemudi Melebihi atau sama dengan 500.000,- dalam bulan berjalan
         /* 2. Belum di devinisikan ( besar akumulasi batas KS ) 
         */
         $finandriver = DB::table('financial_report_monthly_driver_status')->where('month', '=', date('n', strtotime($checkin->operasi_time)))->where('year', '=', date('Y', strtotime($checkin->operasi_time)))->where('driver_id', '=', $checkin->driver_id)->where('operasi_status_id', '=', 1)->order_by('id', 'desc')->first();
         if ($setoran['11'] > 0) {
             Blocked::create(array('driver_id' => $checkin->driver_id, 'fleet_id' => $checkin->fleet_id, 'std_bap_id' => 4, 'checkin_id' => $checkin->id, 'date' => date('Y-m-d H:i:s', Myfungsi::sysdate())));
             $block = Driver::find($checkin->driver_id);
             $block->fg_blocked = 1;
             /*super block melebihi ks 500000*/
             if ($finandriver) {
                 if ($finandriver->selisi_ks < -500000) {
                     //$block->fg_super_blocked = 1;
                 }
             }
             $block->save();
         }
         //update status checkin
         //informasi siapa yang menerima setoran dan waktu setoran
         $checkin->checkin_step_id = 3;
         $checkin->finance_check_user_id = Auth::user()->id;
         $checkin->finance_time = date('Y-m-d H:i:s', Myfungsi::sysdate());
         $checkin->save();
         $pothutanglama = Driverfinancial::where_driver_id($checkin->driver_id)->where_financial_type_id(18)->first();
         if ($pothutanglama) {
             $pothutanglama->amount = $pothutanglama->amount - $jsondata->tag_hut_lama;
         }
         $tabunganpengemudi = Driverfinancial::where_driver_id($checkin->driver_id)->where_financial_type_id(21)->first();
         if ($tabunganpengemudi) {
             $tabunganpengemudi->amount = $tabunganpengemudi->amount + $tabungan_pengemudi;
         } else {
             Driverfinancial::create(array('driver_id' => $checkin->driver_id, 'financial_type_id' => 21, 'amount' => $tabungan_pengemudi));
         }
         $ks = Kewajiban::where_fleet_id($checkin->fleet_id)->where_driver_id($checkin->driver_id)->where_financial_type_id(6)->first();
         if ($ks) {
             $ks->total_amount = $ks->total_amount + $setoran['11'] - $setoran['6'];
         } else {
             Kewajiban::create(array('fleet_id' => $checkin->fleet_id, 'driver_id' => $checkin->driver_id, 'financial_type_id' => 6, 'amount' => 0, 'total_amount' => $setoran['11']));
         }
         $setor = Fleet::find($checkin->fleet_id);
         $setor->fg_setor = 0;
         $setor->save();
         /*
         if((int)$jsondata->denda > 10000)
         {
           Blocked::create(array(
                               'driver_id'=>$checkin->driver_id, 
                               'fleet_id' => $checkin->fleet_id , 
                               'blocked_status_id' => 6,
                               'checkin_id' => $checkin->id,  
                               'date'=> date('Y-m-d H:i:s') ));
         
           $block = Driver::find($checkin->driver_id);
           $block->fg_blocked = 1;
           $block->save();
         }
         */
         return json_encode(array('id' => $jsondata->checkin_id, 'msg' => 'Setoran berhasil di simpan'));
     } catch (Exception $e) {
         return json_encode(array('id' => $jsondata->checkin_id, 'msg' => 'Setoran Sudah pernah di input'));
     }
 }
Пример #4
0
 /**
  * Add or update blocked items 
  *
  * @param string $type - e.g. url, email, ip
  * @param string $value - item to block
  * @param bool $msg - show a success/failure message on Maintenance page
  * @return bool
  */
 public function addToBlockedList($type = '', $value = 0, $msg = false)
 {
     $blocked = Blocked::instance();
     return $blocked->addToBlockedList($this, $type, $value, $msg);
 }
Пример #5
0
 /**
  * Determine and respond to actions from the Blocked list
  */
 public function blocked($h)
 {
     require_once LIBS . 'Blocked.php';
     $blocked = new Blocked();
     $blocked_items = $blocked->buildBlockedList($h);
     return $blocked_items;
 }
Пример #6
0
 /**
  * Add or update blocked items 
  *
  * @param string $type - e.g. url, email, ip
  * @param string $value - item to block
  * @param bool $msg - show a success/failure message on Maintenance page
  * @return bool
  */
 public function addToBlockedList($type = '', $value = 0, $msg = false)
 {
     require_once LIBS . 'Blocked.php';
     $blocked = new Blocked();
     return $blocked->addToBlockedList($this, $type, $value, $msg);
 }