コード例 #1
0
ファイル: CheckoutTest.php プロジェクト: jlbethel/Library
 function test_find()
 {
     //Arrange
     $due_date = "0001-01-01";
     $test_checkout = new Checkout($due_date);
     $test_checkout->save();
     $due_date2 = "2020-01-01";
     $test_checkout2 = new Checkout($due_date2);
     $test_checkout2->save();
     //Act
     $result = Checkout::find($test_checkout->getId());
     //Assert
     $this->assertEquals($test_checkout, $result);
 }
コード例 #2
0
ファイル: proses-ss.php プロジェクト: acmadi/diantaksi
 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
 function testFind()
 {
     //Arrange
     $id = null;
     $patron_id = 1;
     $copy_id = 1;
     $due_date = "2012-12-12";
     $test_checkout = new Checkout($id, $patron_id, $copy_id, $due_date);
     $test_checkout->save();
     $patron_id2 = 1;
     $copy_id2 = 1;
     $due_date2 = "1989-09-04";
     $test_checkout2 = new Checkout($id, $patron_id2, $copy_id2, $due_date2);
     $test_checkout2->save();
     //Act
     $result = Checkout::find($test_checkout->getId());
     //Assert
     $this->assertEquals($test_checkout, $result);
 }
コード例 #4
0
ファイル: checkins.php プロジェクト: acmadi/diantaksi
 public function post_checkinstep1()
 {
     Log::write('info', Request::ip() . ' User : '******' Event: Checkin Step 1', true);
     $jsondata = Input::json();
     $checkout = Checkout::find($jsondata->id);
     if (!$checkout) {
         return false;
     }
     $checkout->checkout_step_id = 7;
     $checkout->save();
     $statusops = $checkout->operasi_status_id;
     if ((int) $jsondata->status_ops == 3) {
         $statusops = 3;
     }
     $cin = Checkin::create(array('kso_id' => $checkout->kso_id, 'fleet_id' => $checkout->fleet_id, 'driver_id' => $checkout->driver_id, 'checkin_time' => date('Y-m-d H:i:s', Myfungsi::sysdate()), 'shift_id' => $checkout->shift_id, 'km_fleet' => $jsondata->km_fleet, 'rit' => $jsondata->rit, 'incomekm' => $jsondata->incomekm, 'operasi_time' => $checkout->operasi_time, 'pool_id' => $checkout->pool_id, 'operasi_status_id' => $statusops, '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' => ''));
     if ($cin) {
         $docs = new Checkindocument();
         $docs->checkin_id = $cin->id;
         $docs->save();
         $fl = Fleet::find($checkout->fleet_id);
         $fl->last_km = $jsondata->km_fleet;
         $fl->save();
         $datax['checkin'] = array('checkoutid' => $jsondata->id, 'message' => 'Next to step 2');
     } else {
         $datax['checkin'] = array('message' => 'Error Step 1');
     }
     return json_encode($datax);
 }
コード例 #5
0
ファイル: CheckoutTest.php プロジェクト: r-hills/library-1
 function test_find()
 {
     //Arrange
     $copy_id = 1;
     $patron_id = 4;
     $due_date = "2015-09-03";
     $test_checkout = new Checkout($copy_id, $patron_id, $due_date);
     $test_checkout->save();
     $copy_id2 = 2;
     $patron_id2 = 1;
     $due_date2 = "2015-10-05";
     $test_checkout2 = new Checkout($copy_id2, $patron_id2, $due_date2);
     $test_checkout2->save();
     //Act
     $result = Checkout::find($test_checkout2->getId());
     //Assert
     $this->assertEquals($test_checkout2, $result);
 }
コード例 #6
0
ファイル: checkouts.php プロジェクト: acmadi/diantaksi
 public function post_saveCheck()
 {
     Log::write('info', Request::ip() . ' User : '******' Event: Save Checkout Checklist', true);
     $data = Input::json();
     $id = $data->id;
     $docs_ket = $data->std_docs;
     $neats = $data->std_neats;
     $equips = $data->std_equips;
     //$timeout = $data->checkout_time;
     $docs = array();
     foreach (Stddoc::all() as $doc) {
         array_push($docs, $doc->id);
     }
     $c = Checkout::find($id);
     $setor = Fleet::find($c->fleet_id);
     $setor->fg_setor = 1;
     $setor->save();
     /*
         if($c->operasi_time < date('Y-m-d',Myfungsi::sysdate()) )
         {
     $datax['message'] = array('id'=> $id, 'message'=>'Invalide Date');
         }else{
     */
     if ($c->checkout_step_id == 3) {
         $c->checkout_time = date('Y-m-d H:i:s', Myfungsi::sysdate());
     }
     $c->std_neat_id = implode(",", $neats);
     $c->std_doc_id = implode(",", $docs);
     $c->std_doc_ket = implode(",", $docs_ket);
     $c->std_equip_id = implode(",", $equips);
     $c->checkout_step_id = 4;
     $c->save();
     $datax['message'] = array('id' => $id, 'message' => 'Data Saved');
     //}
     return json_encode($datax);
 }