Esempio n. 1
0
 public function get_clonejho()
 {
     $checkouts = Checkin::all();
     foreach ($checkouts as $a) {
         $chk = Checkin::where('fleet_id', '=', $a->fleet_id)->where('operasi_time', '=', $a->operasi_time)->first();
         $chk->jho_id = $a->jho_id;
     }
 }
    /**
     * Check-in a new device and add it to the user.
     *
     * @param string $device_type
     *  The device type name as in /devices (ex. galaxy-nexus).
     *
     * @param string $device_name
     *  A human readable name of the device, so that the user can identify his device.
     *
     * @param string $device_local
     *  The value to set local to.
     *
     * @throws DeviceManagerException
     *  If inserting a record for the new device fails.
     */
    public function checkinNewDevice($device_type, $device_name, $device_local)
    {
        // Check-in new device.
        $checkin = new Checkin($this->login);
        $checkin->changeDevice($device_type);
        $checkin->local = $device_local;
        $deviceid = $checkin->checkin();
        $sql = <<<'EOF'
INSERT INTO devices(owner, name, deviceid)
VALUES(:uid, :name, :deviceid)
EOF;
        $db = DB::getInstance()->db;
        $sth = $db->prepare($sql);
        $sth->bindValue(':uid', $this->user->uid, SQLITE3_INTEGER);
        $sth->bindValue(':name', $device_name, SQLITE3_TEXT);
        $sth->bindValue(':deviceid', $deviceid, SQLITE3_TEXT);
        if ($status = $sth->execute() === FALSE) {
            throw new DeviceManagerException(_('Could not create a record for the new device in the DB.'));
        }
    }
Esempio n. 3
0
 public function post_reporthutang()
 {
     $msg = null;
     $pool_id = Auth::user()->pool_id;
     $date = Input::get('dateops', date('Y-m-d'));
     $shift_id = Input::get('shift_id');
     $page = Input::get('page');
     $limit = Input::get('rows');
     $sidx = Input::get('sidx', 'operasi_time');
     $sord = Input::get('sord', 'asc');
     if ($shift_id == 'all') {
         $count = Checkin::join('ksos', 'ksos.id', '=', 'kso_id')->where('checkins.operasi_time', '<=', $date)->where('ksos.pool_id', '=', Auth::user()->pool_id)->where('ksos.actived', '=', 1)->group_by('kso_id')->count();
     } else {
         $count = Checkin::join('ksos', 'ksos.id', '=', 'kso_id')->where('checkins.operasi_time', '<=', $date)->where('checkins.shift_id', '=', $shift_id)->where('ksos.pool_id', '=', Auth::user()->pool_id)->where('ksos.actived', '=', 1)->group_by('kso_id')->count();
     }
     if ($count > 0) {
         $total_pages = ceil($count / $limit);
     } else {
         $total_pages = 0;
     }
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $start = $limit * $page - $limit;
     if ($start < 0) {
         $start = 0;
     }
     $saldohutangbymonth = $this->sqlData($date, $pool_id, $shift_id, $start, $limit);
     $responce['page'] = $page;
     $responce['total'] = $total_pages;
     $responce['records'] = $count;
     if ($saldohutangbymonth) {
         $no = $start + 1;
         $ksavr = 0;
         $selisiavr = 0;
         $setoranopsavr = 0;
         $totalavr = 0;
         $cicilanksavr = 0;
         $dendaavr = 0;
         $cicilan_dp_ksoavr = 0;
         foreach ($saldohutangbymonth as $finan) {
             $saldosp = $finan->tabungan_sparepart + $finan->hutang_dp_sparepart + $finan->cicilan_sparepart - $finan->pemakaian_part;
             $responce['rows'][] = array('no' => $no++, 'taxi_number' => ($c = Fleet::find($finan->fleet_id)) ? $c->taxi_number : 'Body Error', 'bravo' => ($b = Driver::find($finan->bravo_driver_id)) ? $b->name : 'Bravo Error', 'shift_id' => Shift::find($finan->shift_id)->shift, 'pemakaian_sp' => $finan->pemakaian_part, 'tabungan_sp' => $finan->tabungan_sparepart, 'bayar_sp' => $finan->hutang_dp_sparepart + $finan->cicilan_sparepart, 'saldo_sp' => $saldosp, 'ks' => $finan->ks, 'bayar_ks' => $finan->cicilan_ks, 'selisi_ks' => $finan->selisi_ks, 'saldo_armada' => $saldosp + $finan->selisi_ks);
         }
     }
     return json_encode($responce);
 }
Esempio 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');
     }
 }
<?php

require_once 'DrSlump/Protobuf.php';
\DrSlump\Protobuf::autoload();
require_once __DIR__ . '/../inc/functions.php';
require_once __DIR__ . '/../classes/GoogleAccount.class.php';
require_once __DIR__ . '/../classes/Checkin.class.php';
$google_account = new GoogleAccount('USER_EMAIL', 'USER_PASSWORD');
$checkin = new Checkin($google_account);
$checkin->changeDevice('nexus-5');
echo 'AID: ' . $checkin->checkin() . "\n";
Esempio n. 6
0
$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;
}
?>
                  </td>
                  <td>{{ $out->checkin_time }}</td>
                  <td>{{ $out->km_fleet }}</td>
                  <td>{{ Shift::find($out->shift_id)->shift }}</td>
                  <td>{{ Statusoperasi::find($out->operasi_status_id)->kode }}</td>
                  <td>Lihat Data Cheklist</td>
                </tr>
                <?php 
$no++;
?>
                @endforeach
Esempio n. 7
0
 public function post_afterpaysave()
 {
     Log::write('info', Request::ip() . ' User : '******' Event: Save Edit 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;
     //Edit Status Operasi
     //End Status Operasi
     try {
         foreach ($setoran as $key => $value) {
             /*
                           $payment = Checkinfinancial::create(array(
             'checkin_id'=>$jsondata->checkin_id, 
             'financial_type_id'=> $key, 
             'amount'=> $value));
             */
             $payment = Checkinfinancial::where_checkin_id($jsondata->checkin_id)->where_financial_type_id($key)->first();
             if ($payment) {
                 $payment->amount = $value;
                 $payment->save();
             } else {
                 $payment = Checkinfinancial::create(array('checkin_id' => $jsondata->checkin_id, 'financial_type_id' => $key, 'amount' => $value));
             }
         }
         $checkin = Checkin::find($jsondata->checkin_id);
         $checkin->checkin_step_id = 3;
         $checkin->operasi_status_id = $jsondata->operasi_status_id;
         $checkin->shift_id = $jsondata->shift_id;
         $checkin->save();
         /*
                     if($setoran['11'] > 0)
                     {
                       Blocked::create(array(
                                           'driver_id'=> $checkin->driver_id, 
                                           'fleet_id' => $checkin->fleet_id , 
                                           'blocked_status_id' => 1,
                                           'checkin_id' => $checkin->id,  
                                           'date'=> date('Y-m-d H:i:s') ));
         
                       $block = Driver::find($checkin->driver_id);
                       $block->fg_blocked = 1;
                       $block->save();
                     }*/
         //update status checkin
         /*
         $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'],
             ));
         }
         
         
         
         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('msg' => 'Setoran berhasil di ubah'));
     } catch (Exception $e) {
         return json_encode(array('msg' => 'Edit Setoran Gagal'));
     }
 }
Esempio n. 8
0
 public function post_deleteops()
 {
     Log::write('info', Request::ip() . ' User : '******' Event: Mengapus histori setoran', true);
     $data = Input::json();
     $checkin = Checkin::find($data->checkin_id);
     Checkout::where('operasi_time', '=', $checkin->operasi_time)->where('fleet_id', '=', $checkin->fleet_id)->first()->delete();
     $checkin->delete();
     return json_encode(array('status' => 1));
 }
 public function execute(CommandContext $context)
 {
     // Check permissions
     if (!Current_User::allow('hms', 'checkin')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to checkin students.');
     }
     $bannerId = $context->get('bannerId');
     $hallId = $context->get('hallId');
     // Check for key code
     $keyCode = $context->get('key_code');
     if (!isset($keyCode) || $keyCode == '') {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Please enter a key code.');
         $errorCmd = CommandFactory::getCommand('ShowCheckinForm');
         $errorCmd->setBannerId($bannerId);
         $errorCmd->setHallId($hallId);
         $errorCmd->redirect();
     }
     $term = Term::getSelectedTerm();
     // Lookup the student
     $student = StudentFactory::getStudentByBannerId($bannerId, $term);
     // Get the student's current assignment
     $assignment = HMS_Assignment::getAssignmentByBannerId($bannerId, $term);
     $bed = $assignment->get_parent();
     // Get the currently logged in user
     $currUser = Current_User::getUsername();
     // Check for an existing Check-in
     $checkin = CheckinFactory::getCheckinByBed($student, $bed);
     // If there's not already a checkin for this bed, create a new one
     if (is_null($checkin)) {
         $checkin = new Checkin($student, $bed, $term, $currUser, $keyCode);
     } else {
         if ($checkin->getBedId() == $bed->getId() && time() - $checkin->getCheckinDate() < Checkin::CHECKIN_TIMEOUT) {
             // Check-in already exists, and it's within the timout window, so we'll overwrite the existing checkin
             $updatedCheckin = new Checkin($student, $bed, $term, $currUser, $keyCode);
             $updatedCheckin->substitueForExistingCheckin($checkin);
             // Use the old checkin to replace this one
             $checkin = $updatedCheckin;
         } else {
             // There's an existing checkin, but it's after the timeout, so we need to make a new checkin
             $checkin = new Checkin($student, $bed, $term, $currUser, $keyCode);
         }
     }
     $checkin->save();
     // Add this to the activity log
     HMS_Activity_Log::log_activity($student->getUsername(), ACTIVITY_CHECK_IN, UserStatus::getUsername(), $assignment->where_am_i());
     // Generate the RIC
     PHPWS_Core::initModClass('hms', 'InfoCard.php');
     PHPWS_Core::initModClass('hms', 'InfoCardPdfView.php');
     $infoCard = new InfoCard($checkin);
     $infoCardView = new InfoCardPdfView();
     $infoCardView->addInfoCard($infoCard);
     // Send confirmation Email with the RIC form to the student
     PHPWS_Core::initModClass('hms', 'HMS_Email.php');
     HMS_Email::sendCheckinConfirmation($student, $infoCard, $infoCardView);
     NQ::simple('hms', hms\NotificationView::SUCCESS, 'Checkin successful.');
     // Redirect to success page with option to print check-in document.
     $cmd = CommandFactory::getCommand('ShowCheckinDocument');
     $cmd->setBannerId($student->getBannerId());
     $cmd->setCheckinId($checkin->getId());
     $cmd->redirect();
 }
Esempio n. 10
0
 public function get_fleetsonbeforepay()
 {
     $date = Input::get('date', date('Y-m-d'));
     $pool_id = Auth::user()->pool_id;
     $fleets_on_before_pay = Checkin::join('fleets as f', 'f.id', '=', 'checkins.fleet_id')->where_operasi_time($date)->where('checkins.pool_id', '=', $pool_id)->where('checkins.checkin_step_id', '=', 11)->where('checkins.operasi_status_id', '=', 1)->order_by('f.taxi_number', 'asc')->get(array('f.taxi_number', 'checkins.id'));
     $datas = array_map(function ($object) {
         return $object->to_array();
     }, $fleets_on_before_pay);
     return Response::json($datas);
 }
Esempio n. 11
0
 public function post_saveCheckFisik()
 {
     Log::write('info', Request::ip() . ' User : '******' Event: Save Checkin', true);
     $data = Input::json();
     $id = $data->id;
     $docs_ket = $data->std_docs;
     $neats = $data->std_neats;
     $equips = $data->std_equips;
     $sp_kets = $data->ket_sp;
     $checkin = Checkin::find($id);
     //$checkin->operasi_status_id = $data->status_ops;
     $checkin->save();
     $docs = array();
     foreach (Stddoc::all() as $doc) {
         array_push($docs, $doc->id);
     }
     $sps = array();
     foreach (Stdfleet::all() as $sp) {
         array_push($sps, $sp->id);
     }
     $fg_bengkel = $data->hasilcheckfisik == 2 ? 1 : 0;
     $cin = Checkindocument::where_checkin_id($id)->first();
     $cpy = Checkinphysic::where_checkin_id($id)->first();
     if (!$cpy) {
         $cpy = Checkinphysic::create(array('checkin_id' => $id));
     }
     if ($cin->operasi_time > date('Y-m-d', Myfungsi::sysdate())) {
         $datax['message'] = 'invalide time';
     } else {
         $cin->std_neats_id = implode(",", $neats);
         $cin->std_document_id = implode(",", $docs);
         $cin->ket = implode(",", $docs_ket);
         $cin->std_equip_id = implode(",", $equips);
         $cin->save();
         //save pysicly
         $cpy->sparepart_id = implode(",", $sps);
         $cpy->ket = implode(",", $sp_kets);
         $cpy->save();
         //update jika perlu berbaikan
         $fl = Fleet::find($checkin->fleet_id);
         $fl->fg_bengkel = $fg_bengkel;
         $fl->save();
         $datax['message'] = 'Data Saved';
     }
     return json_encode($datax);
 }
Esempio n. 12
0
 public function getReason()
 {
     static $reasons = null;
     if (empty($reasons)) {
         $reasons = Checkin::getReasons();
     }
     if (isset($reasons[$this->reason])) {
         return $reasons[$this->reason];
     } else {
         return dgettext('checkin', 'Reason unknown');
     }
 }
Esempio n. 13
0
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once 'bookingclass.inc.php';
include_once 'calendarclass.inc.php';
include_once 'roomclass.inc.php';
include_once 'bookingcategoryclass.inc.php';
include_once 'guestclass.inc.php';
include_once 'checkinclass.inc.php';
include_once 'checkoutclass.inc.php';
$cal = new Calendar();
$room = new Room();
$bcat = new BookingCategory();
$guest = new Guest();
$booking = new Booking();
$checkin = new Checkin();
$checkout = new Checkout();
$firstpage = false;
// select Countries
$smarty->assign("tpl_countries", $guest->GetCountries());
$smarty->assign('tpl_children0_field', $request->GetVar('children0', 'session'));
$smarty->assign('tpl_children1_field', $request->GetVar('children1', 'session'));
$smarty->assign('tpl_children2_field', $request->GetVar('children2', 'session'));
$smarty->assign('tpl_children3_field', $request->GetVar('children3', 'session'));
$navmonth = $request->GetVar('month', 'get');
$navyear = $request->GetVar('year', 'get');
$navstep = $request->GetVar('navstep', 'get');
$bookid = $request->GetVar('bookid', 'get');
$bookingdetailid = $request->GetVar('bookingdetailid', 'get');
if ($request->GetVar('checkin', 'get') !== $request->undefined) {
    $smarty->assign('tpl_checkin', $request->GetVar('checkin', 'get'));
Esempio n. 14
0
 private function summaryReport()
 {
     javascript('datepicker');
     $form = new PHPWS_Form('report-date');
     $form->setMethod('get');
     $form->addHidden('module', 'checkin');
     $form->addHidden('aop', 'report');
     $form->addHidden('summary_report', 1);
     $form->addText('start_date', $_GET['start_date']);
     $form->setLabel('start_date', 'Start date');
     $form->setSize('start_date', 10);
     $form->setExtra('start_date', 'class="datepicker"');
     $form->addText('end_date', $_GET['end_date']);
     $form->setLabel('end_date', 'End date');
     $form->setSize('end_date', 10);
     $form->setExtra('end_date', 'class="datepicker"');
     if (!empty($_GET['visitor_name'])) {
         $name = trim(strip_tags($_GET['visitor_name']));
     } else {
         $name = null;
     }
     $form->addText('visitor_name', $name);
     $form->setLabel('visitor_name', 'Visitor name');
     $form->addSubmit(dgettext('checkin', 'Summary report'));
     $db = new PHPWS_DB('checkin_staff');
     $db->addColumn('checkin_staff.id');
     $db->addColumn('users.display_name');
     $db->addWhere('checkin_staff.user_id', 'users.id');
     $db->setIndexBy('id');
     $db->addOrder('users.display_name desc');
     $assigned = $db->select('col');
     $assigned[0] = dgettext('checkin', 'Show all');
     $assigned = array_reverse($assigned, true);
     $form->addSelect('assigned', $assigned);
     $form->setLabel('assigned', 'By staff');
     if (isset($_GET['assigned'])) {
         $staff_id = (int) $_GET['assigned'];
         $form->setMatch('assigned', $staff_id);
     } else {
         $staff_id = 0;
     }
     $tpl = $form->getTemplate();
     $start_date = strtotime($_GET['start_date']);
     $end_date = strtotime($_GET['end_date']);
     if (empty($start_date) || empty($end_date) || $start_date > $end_date) {
         $tpl['EMPTY'] = 'Please enter your date range again.';
     } else {
         $this->title = 'Visitors from ' . $_GET['start_date'] . ' to ' . $_GET['end_date'];
         $db = new PHPWS_DB('checkin_visitor');
         $db->addWhere('arrival_time', $start_date, '>=');
         $db->addWhere('arrival_time', $end_date, '<=');
         $db->addColumn('id');
         $db->addColumn('arrival_time');
         $db->addColumn('firstname');
         $db->addColumn('lastname');
         $db->addColumn('start_meeting');
         $db->addColumn('end_meeting');
         if ($staff_id) {
             $db->addWhere('assigned', $staff_id);
         }
         if (!empty($name)) {
             $name = strtolower($name);
             if (strlen($name) == 1) {
                 $db->addWhere('firstname', "{$name}%", 'like', 'and', 'name');
                 $db->addWhere('lastname', "{$name}%", 'like', 'or', 'name');
             } else {
                 $db->addWhere('firstname', "%{$name}%", 'like', 'and', 'name');
                 $db->addWhere('lastname', "%{$name}%", 'like', 'or', 'name');
             }
         }
         $result = $db->select();
         $total_visits = 0;
         $total_wait = 0;
         $total_meeting = 0;
         $total_days = 0;
         $incomplete_visits = 0;
         $current_day = null;
         foreach ($result as $visit) {
             extract($visit);
             $arrival_day = date('MdY', $arrival_time);
             if ($current_day != $arrival_day) {
                 $current_day = $arrival_day;
                 $total_days++;
             }
             $row = array();
             if (!$start_meeting || !$end_meeting) {
                 $incomplete_visits++;
                 continue;
             }
             $total_visits++;
             $twaited = $start_meeting - $arrival_time;
             $waited = Checkin::timeWaiting($twaited);
             if ($end_meeting) {
                 $tmeeting = $end_meeting - $start_meeting;
             }
             $meeting = Checkin::timeWaiting($tmeeting);
             $row['VISIT'] = $total_visits;
             $row['VISITOR'] = "{$firstname} {$lastname}";
             $row['DATE'] = date('g:ia m.d.Y', $arrival_time);
             $row['WAITED'] = $waited;
             $row['MEETING'] = $meeting;
             $tpl['rows'][] = $row;
             $total_wait += $twaited;
             $total_meeting += $tmeeting;
         }
         if ($total_visits) {
             $tpl['TOTAL_DAYS'] = $total_days;
             $tpl['TOTAL_VISITS'] = $total_visits;
             $tpl['AVG_VISITS'] = round($total_visits / $total_days, 1);
             $tpl['TOTAL_WAIT'] = Checkin::timeWaiting($total_wait);
             $tpl['TOTAL_MEETING'] = Checkin::timeWaiting($total_meeting);
             $tpl['AVG_WAIT'] = Checkin::timeWaiting(round($total_wait / $total_visits));
             $tpl['AVG_MEETING'] = Checkin::timeWaiting(round($total_meeting / $total_visits));
             $tpl['INCOMPLETE_MEETINGS'] = $incomplete_visits;
         } else {
             $tpl['EMPTY'] = 'No visits made in this date range.';
         }
     }
     $this->content = PHPWS_Template::process($tpl, 'checkin', 'summary_report.tpl');
 }
Esempio n. 15
0
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*  A copy is found in the textfile GPL.txt and important notices to the license 
*  from the author is found in LICENSE.txt distributed with these scripts.
*
* 
*  This script is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* List of checked in guests
* 
* calendar
* 
* @since 2004-09-02
* @author Christian Ehret <*****@*****.**> 
*/
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once 'checkinclass.inc.php';
$smarty->assign("tpl_title", "Checkin");
$smarty->assign('tpl_nav', 'calendar');
$smarty->assign('tpl_subnav', 'checkin');
$checkin = new Checkin();
$smarty->assign('tpl_guests', $checkin->get());
$smarty->display('checkinlist.tpl');
Esempio n. 16
0
 /**
  * Causes this check-in to take the ID of the passed-in checkin.
  * When saved,
  * this will effectively overwrite the passed in checkin.
  *
  * @param Checkin $checkin
  */
 public function substitueForExistingCheckin(Checkin $checkin)
 {
     $this->setId($checkin->getId());
 }
Esempio n. 17
0
Route::get('/', 'SessionsController@create');
Route::post('store', 'SessionsController@store');
Route::get('logout', 'SessionsController@destroy');
Route::get('assistance', function () {
    return View::make('assistance.index');
})->before('auth');
Route::get('crear', function () {
    $user = new User();
    $user->user = "******";
    $user->password = Hash::make('Fernando2014');
    $user->save();
    return "Usuario Creado";
});
Route::get('test', function () {
    $checkin = new Checkin();
    $checkin->user_id = 1;
    $checkin->fecha = date('1994-04-26');
    $checkin->save();
});
Route::get('test2', function () {
    $user = User::find(1);
    $checkins = $user->checkins;
    $checkouts = $user->checkouts;
    $lista = '<div style="display:inline-block"><h2>Checkins</h2><ul>';
    foreach ($checkins as $item) {
        $lista .= '<li>';
        $lista .= '<h2 style="display:inline-block;">' . $item['fecha'] . '</h2>' . "-----";
        $lista .= '</li>';
    }
    $lista .= '</ul></div>';
Esempio n. 18
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));
         }
     }
 }