public function __invoke(array $input) { $employeeId = $input['employeeId']; $startTime = Carbon::now()->startOfYear(); $endTime = Carbon::now()->endOfYear(); if (!empty($input['startTime'])) { $startTime = $input['startTime']; } if (!empty($input['endTime'])) { $endTime = $input['endTime']; } $Employee = new Employee(); if (!$Employee->load($employeeId)) { return (new Payload())->withStatus(Payload::ERROR)->withOutput(['data' => json_encode(['error' => 'Employee not found'])]); } // limit filtered results to this employee and within the start/end times $filters = []; $filters[] = ['key' => 'employee_id', 'value' => $employeeId]; $filters[] = ['key' => 'start_time', 'operator' => '>=', 'value' => $startTime]; $filters[] = ['key' => 'end_time', 'operator' => '>=', 'value' => $endTime]; $summary = []; $Shift = new Shift(); if ($Shifts = $Shift->filter($startTime, $endTime, $filters)) { foreach ($Shifts as $Shift) { $startTime = Carbon::createFromFormat('Y-m-d H:i:s', $Shift['start_time']); $endTime = Carbon::createFromFormat('Y-m-d H:i:s', $Shift['end_time']); $weekNumber = $startTime->weekOfYear; $diff = $endTime->diff($startTime); $timeWorked = $diff->day * 12 + $diff->hour + $diff->minute / 60 + $diff->second / 3600; $timeWorked = $timeWorked - $Shift['break']; $summary["Week #{$weekNumber}"] += $timeWorked; } } return (new Payload())->withStatus(Payload::ERROR)->withOutput(['data' => json_encode($summary)]); }
function insert_dbShifts(Shift $s) { connect(); $query = 'SELECT * FROM SHIFT WHERE SHIFTID ="' . $s->get_id() . '"'; error_log('in insert_dbShifts, query is ' . $query); $result = mysql_query($query); if (mysql_num_rows($result) != 0) { delete_dbShifts($s); connect(); } $query = "INSERT INTO SHIFT VALUES ('" . $s->get_id() . "','" . $s->get_date() . "','" . $s->get_start_time() . "','" . $s->get_end_time() . "','" . $s->get_venue() . "','" . $s->num_vacancies() . "','" . implode("*", $s->get_persons()) . "','" . implode("*", $s->get_removed_persons()) . "','" . $s->get_notes() . "');"; error_log('in insert_dbShifts, query is ' . $query); $result = mysql_query($query); if (!$result) { echo "unable to insert into SHIFT " . $s->get_id() . mysql_error(); mysql_close(); return false; } mysql_close(); return true; }
public function create() { if (isset($_POST['token'])) { if (Token::check($_POST['token'])) { $title = $_POST['title']; //dodawanie pauzy w mijsce spacji i astapywanie pauz tyldami $title = Shift::add($title); $article = $_POST['article']; $DB = new DB(); $DB->insert("INSERT INTO article VALUES(NULL,'{$title}','{$article}',NOW(),0)"); $this->index(null); } else { $this->view('pages/Portfolio/create'); } } else { $this->view('pages/Portfolio/create'); } }
private static function loadItems() { self::$_items = array(); $models = self::model()->findAll(); foreach ($models as $model) { self::$_items[$model->shift_id] = $model->shift_type; } }
} else { echo $form->dropDownList($model, 'student_transaction_batch_id', array('empty' => '-----------Select---------'), array('tabindex' => 13)); } ?> <span class="status"> </span> <?php echo $form->error($model, 'student_transaction_batch_id'); ?> </div> <div class="row-right"> <?php echo $form->labelEx($model, 'student_transaction_shift_id'); ?> <?php echo $form->dropDownList($model, 'student_transaction_shift_id', Shift::items(), array('empty' => '-----------Select---------', 'tabindex' => 14)); ?> <span class="status"> </span> <?php echo $form->error($model, 'student_transaction_shift_id'); ?> </div> </div> <div class="row"> <?php echo $form->labelEx($photo, 'student_photos_path'); ?> <?php CHtml::form('', 'post', array('enctype' => 'multipart/form-data'));
public function get_rekapsetoran() { $shifts = Shift::all(); $pool_id = Auth::user()->pool_id; $shiftoption = Koki::to_dropdown($shifts, 'id', 'shift'); $this->data['shifts'] = $shiftoption + array('all' => 'Gabungan'); $this->data['fleets'] = Kso::join('fleets', 'fleets.id', '=', 'ksos.fleet_id')->where('ksos.pool_id', '=', $pool_id)->where('ksos.actived', '=', 1)->get(array('ksos.id', 'ksos.fleet_id', 'fleets.taxi_number')); return View::make('themes.modul.' . $this->views . '.rekapsetoranarmada', $this->data); }
public function getShifts() { //get pay period $day = date('w'); $startofweeks = strtotime('2015-01-05 00:00:00'); $today = strtotime(date('m/d/Y h:m:s')); $weeknum = floor(($today - $startofweeks) / (60 * 60 * 24 * 7)); if ($weeknum % 2 == 0) { //even week = first week of pay period if ($day == 0) { $payPeriodStart = date('m/d/Y', strtotime('-6 days')); $payPeriodEnd = date('m/d/Y', strtotime('+7 days')); } else { $payPeriodStart = date('m/d/Y', strtotime('-' . ($day - 1) . ' days')); $payPeriodEnd = date('m/d/Y', strtotime('+' . (14 - $day) . ' days')); } } else { if ($day == 0) { $payPeriodStart = date('m/d/Y', strtotime('-13 days')); $payPeriodEnd = date('m/d/Y', strtotime('+0 days')); } else { $payPeriodStart = date('m/d/Y', strtotime('-' . ($day + 6) . ' days')); $payPeriodEnd = date('m/d/Y', strtotime('+' . (7 - $day) . ' days')); } } //set query values to either defaulting pay period range or input filter range $start = Input::get('start', $payPeriodStart); $end = Input::get('end', $payPeriodEnd); //sets the start and end date differently since Firefox wouldn't recognize some strings $start = date('Y-m-d', strtotime($start)); $end = date('Y-m-d', strtotime($end)); $end = date('Y-m-d', strtotime($end . ' + 1 day')); //used to set the shift number for easy css coloring and formatting $shiftNumber = 1; //defines how to sort the shifts, defaulting to order them first by user, then by clockin time. $sortBy = Input::get('sort', 'default'); //will pull shifts in a certain manner depending on how its sorted switch ($sortBy) { //sorts by the user name in ascending order case 'nameAsc': $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->get(); $shifts = $this->setProperties($shifts); $shifts = $shifts->sortBy(function ($shift) { return $shift->name . $shift->clockIn; }); //when sortBy() is called, it adds element numbers to all the objects which backbone collection wont recognize. //This is why you have to call values(), to remove the element numbers from the objects. $shifts->values(); break; //sorts by the user name in ascending order //sorts by the user name in ascending order case 'nameDes': $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->get(); $shifts = $this->setProperties($shifts); $shifts = $shifts->sortBy(function ($shift) { return $shift->name . $shift->clockIn; }); //this will reverse the order to get the collection in descending order $shifts = $shifts->reverse(); //when sortBy() is called, it adds element numbers to all the objects which backbone collection wont recognize. //This is why you have to call values(), to remove the element numbers from the objects. $shifts->values(); break; //sorts by clock in with the most recent on top //sorts by clock in with the most recent on top case "timeInAsc": $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->orderBy('clockIn')->get(); $shifts = $this->setProperties($shifts); break; //sorts by clocked in with the most recent at the bottom //sorts by clocked in with the most recent at the bottom case "timeInDes": $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->orderBy('clockIn', 'DESC')->get(); $shifts = $this->setProperties($shifts); break; //sorts by clocked out with the most recent at the top //sorts by clocked out with the most recent at the top case "timeOutAsc": $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->orderBy('clockOut')->get(); $shifts = $this->setProperties($shifts); break; //sorts by clocked out with the most recent at the bottom //sorts by clocked out with the most recent at the bottom case "timeOutDes": $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->orderBy('clockOut', 'DESC')->get(); $shifts = $this->setProperties($shifts); break; //sorts by time recorded with the longest at the top //sorts by time recorded with the longest at the top case "timeRecAsc": $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->get(); $shifts = $this->setProperties($shifts); $shifts = $shifts->sortBy(function ($shift) { return $shift->timeRec; }); //when sortBy() is called, it adds element numbers to all the objects which backbone collection wont recognize. //This is why you have to call values(), to remove the element numbers from the objects. $shifts->values(); break; //sorts by time recorded with the longest at the bottom //sorts by time recorded with the longest at the bottom case "timeRecDes": $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->get(); $shifts = $this->setProperties($shifts); $shifts = $shifts->sortBy(function ($shift) { return $shift->timeRec; }); //this will reverse the order to get the collection in descending order $shifts = $shifts->reverse(); //when sortBy() is called, it adds element numbers to all the objects which backbone collection wont recognize. //This is why you have to call values(), to remove the element numbers from the objects. $shifts->values(); break; //gets all the shifts that are clocked out first then appends the shifts that are still clocked in //gets all the shifts that are clocked out first then appends the shifts that are still clocked in case "clockedInAsc": $shifts1 = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->where('clockOut', '=', '0000-00-00 00:00:00')->orderBy('eid')->orderBy('clockIn')->get(); $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->where('clockOut', '!=', '0000-00-00 00:00:00')->orderBy('eid')->orderBy('clockIn')->get(); foreach ($shifts1 as $shift) { $shifts->push($shift); } $shifts = $this->setProperties($shifts); break; //gets all the shifts that are clocked in first then appends the shifts that are clocked out //gets all the shifts that are clocked in first then appends the shifts that are clocked out case "clockedInDes": $shifts1 = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->where('clockOut', '!=', '0000-00-00 00:00:00')->orderBy('eid')->orderBy('clockIn')->get(); $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->where('clockOut', '=', '0000-00-00 00:00:00')->orderBy('eid')->orderBy('clockIn')->get(); foreach ($shifts1 as $shift) { $shifts->push($shift); } $shifts = $this->setProperties($shifts); break; //default sorting, order them first by user, then by clockin time. //default sorting, order them first by user, then by clockin time. case "default": $shifts = Shift::where('clockIn', '<=', $end)->where('clockIn', '>=', $start)->orderBy('eid')->orderBy('clockIn')->get(); $shifts = $this->setProperties($shifts); break; } //if a search criteria is passed in, it sets $search to that string or a blank string $search = Input::get('search', ''); //if search isn't empty if ($search != '') { //for each shift, it the shift contains the string, then it adds the shiftNum to it foreach ($shifts as $shift) { if (stripos($shift->name, $search) !== false || stripos($shift->clockIn, $search) !== false || stripos($shift->clockOut, $search) !== false || stripos($shift->timeRec, $search !== false)) { //sets the shift number $shift->shiftNum = $shiftNumber; //increments the shift number $shiftNumber += 1; } else { $shifts->forget($shiftNumber - 1); $shifts->values(); } } } else { //adds shiftNum to each shift foreach ($shifts as $shift) { //sets the shift number $shift->shiftNum = $shiftNumber; //increments the shift number $shiftNumber += 1; } } //returns shifts, even if empty return $shifts->toJSON(); }
} ?> <span class="status"> </span> <?php echo $form->error($model, 'student_transaction_batch_id'); ?> </div> </div> <div class="row"> <div class="row-left"> <?php echo $form->labelEx($model, 'student_transaction_shift_id'); ?> <?php echo $form->dropDownList($model, 'student_transaction_shift_id', Shift::items(), array('empty' => 'Select Shift')); ?> <span class="status"> </span> <?php echo $form->error($model, 'student_transaction_shift_id'); ?> </div> </div> <?php if (Yii::app()->user->checkAccess('StudentTransaction.UpdateStudentData') || Yii::app()->user->checkAccess('StudentTransaction.*')) { ?> <div class="row buttons"> <?php echo CHtml::button('Save', array('submit' => $this->createUrl('updateprofiletab1', array('id' => $_REQUEST['id'])), 'class' => 'submit', 'id' => 'submitbut1'));
public function actiongettransferempdata() { $des = array(); $dep = array(); $shf = array(); $org_id = $_REQUEST['EmployeeTransaction']['employee_transaction_organization_id']; $data1 = EmployeeDesignation::model()->findAll(array('condition' => 'employee_designation_organization_id=' . (int) $org_id)); $data2 = Department::model()->findAll(array('condition' => 'department_organization_id=' . (int) $org_id)); $data3 = Shift::model()->findAll(array('condition' => 'shift_organization_id=' . (int) $org_id)); $data1 = CHtml::listData($data1, 'employee_designation_id', 'employee_designation_name'); $data2 = CHtml::listData($data2, 'department_id', 'department_name'); $data3 = CHtml::listData($data3, 'shift_id', 'shift_type'); foreach ($data1 as $value1 => $name1) { $des .= CHtml::tag('option', array('value' => $value1), CHtml::encode($name1), true); } foreach ($data2 as $value2 => $name2) { $dep .= CHtml::tag('option', array('value' => $value2), CHtml::encode($name2), true); } foreach ($data3 as $value3 => $name3) { $shf .= CHtml::tag('option', array('value' => $value3), CHtml::encode($name3), true); } echo CJSON::encode(array('des' => $des, 'dep' => $dep, 'shf' => $shf)); }
<td> <?php echo EmployeeDesignation::model()->findByPk($v['employee_transaction_designation_id'])->employee_designation_name; ?> </td> <td> <?php echo Department::model()->findByPk($v['employee_transaction_department_id'])->department_name; ?> </td> <td> <?php echo Shift::model()->findByPk($v['employee_transaction_shift_id'])->shift_type; ?> </td> <td> <?php echo Organization::model()->findByPk($v['employee_transaction_organization_id'])->organization_name; ?> </td> </tr> <?php } // end if } // end for loop
$Nationality = Nationality::model()->findByPk($student_transaction[0]->student_transaction_nationality_id); } else { $Nationality = new Nationality(); } if ($student_transaction[0]->student_transaction_quota_id != null) { $Quota = Quota::model()->findByPk($student_transaction[0]->student_transaction_quota_id); } else { $Quota = new Quota(); } if ($student_transaction[0]->student_transaction_religion_id != null) { $Religion = Religion::model()->findByPk($student_transaction[0]->student_transaction_religion_id); } else { $Religion = new Religion(); } $Branch = Branch::model()->findByPk($student_transaction[0]->student_transaction_branch_id); $Shift = Shift::model()->findByPk($student_transaction[0]->student_transaction_shift_id); $Division = Division::model()->findByPk($student_transaction[0]->student_transaction_division_id); $Batch = Batch::model()->findByPk($student_transaction[0]->student_transaction_batch_id); $Organization = Organization::model()->findByPk($student_transaction[0]->student_transaction_organization_id); if ($student_transaction[0]->student_transaction_languages_known_id != null) { $LanguagesKnown = LanguagesKnown::model()->findByPk($student_transaction[0]->student_transaction_languages_known_id); } else { $LanguagesKnown = new $LanguagesKnown(); } if ($student_transaction[0]->student_transaction_languages_known_id != null) { $StudentAddress = StudentAddress::model()->findByPk($student_transaction[0]->student_transaction_student_address_id); } else { $StudentAddress = new $StudentAddress(); } ?> <h3>Student Detail</h3>
function new_shift() { global $alerts; $act = true; $start = sprintf('%02u:%02u', (int) $_POST['starth'], (int) $_POST['startm']); $end = sprintf('%02u:%02u', (int) $_POST['endh'], (int) $_POST['endm']); $shift = new Shift($start, $end, $_POST['day'], $_SESSION['user']); if ($shift->collides()) { $alerts[] = "Die Schicht ueberschneidet sich."; $act = false; } if ($start == $end) { $alerts[] = "Die Schicht ist 0 Minuten lang."; $act = false; } if ((int) $_POST['starth'] > $_POST['endh']) { $alerts[] = "Die Schicht endet, bevor sie angefangen hat."; $act = false; } if ((int) $_POST['starth'] == (int) $_POST['endh'] && (int) $_POST['startm'] > (int) $_POST['endm']) { $alerts[] = "Die Schicht endet, bevor sie angefangen hat."; $act = false; } if ($act) { if ($shift->insert()) { $notifs[] = "Schicht hinuzgefuegt."; } else { $alerts[] = "Unbekannter Fehler, bitte Jan Bescheid geben!"; } } }
function shiftscreateAction() { $session = SessionWrapper::getInstance(); $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); // parent::createAction(); $formvalues = $this->_getAllParams(); // debugMessage($formvalues); exit(); $formvalues['id'] = $id = decode($formvalues['id']); $shift = new Shift(); if (!isArrayKeyAnEmptyString('id', $formvalues)) { $shift->populate($id); $formvalues['lastupdatedby'] = $session->getVar('userid'); } else { $formvalues['createdby'] = $session->getVar('userid'); } $shift->processPost($formvalues); debugMessage($shift->toArray()); if ($shift->hasError()) { // debugMessage('errors are '.$shift->getErrorStackAsString()); exit(); $session->setVar(ERROR_MESSAGE, $shift->getErrorStackAsString()); $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE))); } // exit; try { $shift->save(); //debugMessage($leave->toArray()); $session->setVar(SUCCESS_MESSAGE, $this->_getParam('successmessage')); $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_SUCCESS))); } catch (Exception $e) { $session->setVar(ERROR_MESSAGE, $e->getMessage()); //debugMessage('save error '.$e->getMessage()); $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE))); } }
<th>Waktu Operasi</th> <th>Status Operasi</th> </tr> </thead> <tbody> <?php $i = 1; ?> @forelse($scheduleday as $sch) <tr> <td>{{ $i }}</td> <td>{{ $sch->taxi_number; }}</td> <td>{{ ($driver = Driver::find($sch->driver_id))? $driver->nip : ' ' }}</td> <td><a class="change_toggler" rel="{{$sch->id}}">{{ ($driver)? $driver->name: 'pengemudi terdelete'; }}</a></td> <td><?php $shift = Shift::find($sch->shift_id); ?> @if($shift) {{ $shift->shift }} @endif</td> <td>{{ ($sch->fg_check == 1) ? 'Sudah Print SPJ' : 'Belum Print SPJ' ; }}</td> </tr> <?php $i++; ?> @empty <tr> <td colspan="5"> is empty</td> </tr> @endforelse </tbody> </table> </div>
'filter' =>CHtml::listData(EmployeeDesignation::model()->findAll(), 'employee_designation_id','employee_designation_name'), ), array( 'header' => 'Department', 'name'=>'employee_transaction_department_id', 'value'=>'Department::model()->findByPk($data->employee_transaction_department_id)->department_name', 'filter' =>CHtml::listData(Department::model()->findAll(),'department_id','department_name'), ), array( 'header' => 'Shift', 'name'=>'employee_transaction_shift_id', 'value'=>'Shift::model()->findByPk($data->employee_transaction_shift_id)->shift_type', 'filter' =>CHtml::listData(Shift::model()->findAll(),'shift_id','shift_type'), ), array('header'=>'Resign Application Date', 'value'=>'date_format(new DateTime(EmployeeExitDetails::model()->findByAttributes(array("employee_exit_details_employee_id"=>$data->employee_transaction_id,"reporting_employee_review_status"=>2))->employee_resign_approve_date),"d-m-Y")', 'filter' =>false, ), array('header'=>'Resign Approve Date', 'value'=>'date_format(new DateTime($data->Rel_Emp_Info->employee_left_transfer_date),"d-m-Y")', 'filter' =>false, ), ),
public function post_loaddatadaily() { $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', 'id'); $sord = Input::get('sord'); //$count = Driver::count(); $count = DB::table('financial_report_daily')->where('shift_id', '=', $shift_id)->where('operasi_time', '=', $date)->where_pool_id(Auth::user()->pool_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; } $financials = DB::table('financial_report_daily')->where('shift_id', '=', $shift_id)->where('operasi_time', '=', $date)->where_pool_id(Auth::user()->pool_id)->order_by($sidx, $sord)->skip($start)->take($limit)->get(); $responce['page'] = $page; $responce['total'] = $total_pages; $responce['records'] = $count; $no = $start + 0; foreach ($financials as $finan) { $no++; $responce['rows'][] = array('no' => $no, 'taxi_number' => $finan->taxi_number, 'nip' => $finan->nip, 'name' => $finan->name, 'checkin_time' => $finan->checkin_time, 'shift_id' => Shift::find($finan->shift_id)->shift, 'setoran_cash' => $finan->setoran_cash, 'setoran_wajib' => $finan->setoran_wajib, 'tabungan_sparepart' => $finan->tabungan_sparepart, 'denda' => $finan->denda, 'potongan' => $finan->potongan, 'cicilan_sparepart' => $finan->cicilan_sparepart, 'cicilan_ks' => $finan->cicilan_ks, 'biaya_cuci' => $finan->biaya_cuci, 'iuran_laka' => $finan->iuran_laka, 'cicilan_dp_kso' => $finan->cicilan_dp_kso, 'cicilan_hutang_lama' => $finan->cicilan_hutang_lama, 'ks' => $finan->setoran_cash - ($finan->setoran_wajib + $finan->tabungan_sparepart + $finan->denda + $finan->cicilan_sparepart + $finan->cicilan_ks + $finan->biaya_cuci + $finan->iuran_laka + $finan->cicilan_dp_kso + $finan->cicilan_hutang_lama + $finan->cicilan_lain + $finan->hutang_dp_sparepart - $finan->potongan), 'cicilan_lain' => $finan->cicilan_lain, 'hutang_dp_sparepart' => $finan->hutang_dp_sparepart, 'operasi_status_id' => $finan->kode, 'total' => $finan->setoran_wajib + $finan->tabungan_sparepart + $finan->denda + $finan->cicilan_sparepart + $finan->cicilan_ks + $finan->biaya_cuci + $finan->iuran_laka + $finan->cicilan_dp_kso + $finan->cicilan_hutang_lama + $finan->cicilan_lain + $finan->hutang_dp_sparepart, 'setoranops' => $finan->setoran_cash - ($finan->biaya_cuci + $finan->iuran_laka)); } return json_encode($responce); /**/ }
</div> <div class = "row_all_v"> <div class="rowv"> <?php echo '<lable><b>Shift :</b></lable>'; ?> <div class="rown"> <?php //echo $model->Rel_Shift->shift_type .'<br>'; ?> <?php $shiftid = StudentTransaction::model()->findByPk($model->student_archive_stud_tran_id)->student_transaction_shift_id; ?> <?php echo Shift::model()->findByPk($shiftid)->shift_type; ?> </div> </div> <div class="rowv"> <?php echo '<lable><b>Division :</b></lable>'; ?> <div class="rown"> <?php //if(isset($model->Rel_Division->division_name)) echo $model->Rel_Division->division_name .'<br>'; //else echo "N/A"; ?> <?php
/* $this->breadcrumbs=array( 'Employee Transactions'=>array('admin'), 'Manage', );*/ $this->menu = array(); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('employee-transaction-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Reset Employee Password</h1> <?php //echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); $dataProvider = $model->search(); if (Yii::app()->user->getState("pageSize", @$_GET["pageSize"])) { $pageSize = Yii::app()->user->getState("pageSize", @$_GET["pageSize"]); } else { $pageSize = Yii::app()->params['pageSize']; } $dataProvider->getPagination()->setPageSize($pageSize); ?> <div class="block-error"> <?php echo Yii::app()->user->getFlash('resetemppassword'); ?> </div> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'employee-transaction-grid', 'dataProvider' => $dataProvider, 'filter' => $model, 'columns' => array(array('header' => 'SI No', 'class' => 'IndexColumn'), array('name' => 'employee_no', 'value' => '$data->Rel_Emp_Info->employee_no'), array('name' => 'employee_attendance_card_id', 'value' => '$data->Rel_Emp_Info->employee_attendance_card_id'), array('name' => 'employee_first_name', 'value' => '$data->Rel_Emp_Info->employee_first_name'), array('name' => 'category_name', 'value' => '($data->category_name == 0)? "Not Set" :$data->Rel_Category->category_name'), array('name' => 'employee_transaction_department_id', 'value' => 'Department::model()->findByPk($data->employee_transaction_department_id)->department_name', 'filter' => CHtml::listData(Department::model()->findAll(array('condition' => ' department_organization_id=' . Yii::app()->user->getState('org_id'))), 'department_id', 'department_name')), array('name' => 'employee_transaction_shift_id', 'value' => 'Shift::model()->findByPk($data->employee_transaction_shift_id)->shift_type', 'filter' => CHtml::listData(Shift::model()->findAll(array('condition' => ' shift_organization_id=' . Yii::app()->user->getState('org_id'))), 'shift_id', 'shift_type')), array('name' => 'user_organization_email_id', 'value' => '$data->Rel_user1->user_organization_email_id'), array('class' => 'CButtonColumn', 'template' => '{Reset Password}', 'buttons' => array('Reset Password' => array('label' => 'Reset Password', 'url' => 'Yii::app()->createUrl("user/update_emp_password", array("id"=>$data->employee_transaction_user_id))', 'imageUrl' => Yii::app()->baseUrl . '/images/Reset Password.png')))), 'pager' => array('class' => 'AjaxList', 'maxButtonCount' => $model->count(), 'header' => '')));
public function getAllShifts() { //get pay period $day = date('w'); $startofweeks = strtotime('2015-01-05 00:00:00'); $today = strtotime(date('m/d/Y h:m:s')); $weeknum = floor(($today - $startofweeks) / (60 * 60 * 24 * 7)); if ($weeknum % 2 == 0) { //even week = first week of pay period if ($day == 0) { $payPeriodStart = date('m/d/Y', strtotime('-6 days')); $payPeriodEnd = date('m/d/Y', strtotime('+7 days')); } else { $payPeriodStart = date('m/d/Y', strtotime('-' . ($day - 1) . ' days')); $payPeriodEnd = date('m/d/Y', strtotime('+' . (14 - $day) . ' days')); } } else { if ($day == 0) { $payPeriodStart = date('m/d/Y', strtotime('-13 days')); $payPeriodEnd = date('m/d/Y', strtotime('+0 days')); } else { $payPeriodStart = date('m/d/Y', strtotime('-' . ($day + 6) . ' days')); $payPeriodEnd = date('m/d/Y', strtotime('+' . (7 - $day) . ' days')); } } //set query values to either defaulting pay period range or input filter range $start = Input::get('start', $payPeriodStart); $end = Input::get('end', $payPeriodEnd); //sets the start and end date differently since Firefox wouldn't recognize some strings $start = date('Y-m-d', strtotime($start)); $end = date('Y-m-d', strtotime($end)); $end = date('Y-m-d', strtotime($end . ' + 1 day')); $end = new DateTime($end); //this will make the clockout time anything before 2:30 am on Monday. $end->add(new DateInterval('PT2H30M')); //get shifts in specified range $shifts = Shift::where('clockOut', '<=', $end)->where('clockIn', '>=', $start)->get(); //adds the user's name to each shift foreach ($shifts as $shift) { $shift->name = User::where('id', '=', $shift->eid)->pluck('fullname'); } //sorts the shifts first by user's last name then by clockin $shifts = $shifts->sortBy(function ($shift) { //gets the number of names-1. E.g. if the user has first, middle, and last names, it will be 2 //if the user has two last names it will be 3 $names = substr_count($shift->name, ' '); switch ($names) { case 1: //pos is the position of the space before the last name $pos = strpos($shift->name, ' '); break; case 2: case 3: //has to offset by the index of the first space +1 $pos = strpos($shift->name, ' ', strpos($shift->name, ' ') + 1); break; default: //if someone has more than names, it will just sort by the second name $pos = strpos($shift->name, ' '); break; } //this will return the last name concatinated with the clockin. This is the string that its sorted by return substr($shift->name, $pos) . $shift->clockIn; }); //removes the index values from each item. If left, Backbone wont recognize it properly $shifts->values(); //returns the shifts return $shifts->toJSON(); }
foreach($resign_emp_data as $list) { $emp_info = EmployeeInfo::model()->resetScope()->findByAttributes(array('employee_info_transaction_id'=>$list['employee_transaction_id'])); $emp_level_max = Yii::app()->db->createCommand() ->select('MAX(reporting_priority),employee_exit_reporting_employee_id') ->from('employee_exit_reporting') ->group('employee_exit_employee_id') ->where('employee_exit_employee_id ='.$list['employee_transaction_id']) ->queryRow(); $max_priority = $emp_level_max['MAX(reporting_priority)']; $reporting_emp_id = EmployeeExitReporting::model()->findByAttributes(array('employee_exit_employee_id'=>$list['employee_transaction_id'],'reporting_priority'=>$max_priority)); $report_emp = $reporting_emp_id['employee_exit_reporting_employee_id']; $exit_details = EmployeeExitDetails::model()->findByAttributes(array('employee_exit_details_employee_id'=>$list['employee_transaction_id'],'reporting_employee_id'=>$report_emp,'reporting_employee_review_status'=>2)); $app_date = $exit_details['employee_resign_application_date']; ?> <tr> <td><?php echo $emp_info['employee_first_name']?></td> <td><?php echo $emp_info['employee_last_name']?></td> <td><?php echo $emp_info['employee_attendance_card_id']?></td> <td><?php echo EmployeeDesignation::model()->findByPk($list['employee_transaction_designation_id'])->employee_designation_name;?></td> <td><?php echo Department::model()->findByPk($list['employee_transaction_department_id'])->department_name;?></td> <td><?php echo Shift::model()->findByPk($list['employee_transaction_shift_id'])->shift_type;?></td> <td><?php echo $emp_info['employee_left_transfer_date'];?></td> <td><?php echo $app_date;?></td> </tr> <?php } ?> </table>
public function parseShift($acceptDate) { echo $acceptDate."<br>"; try { Shift::create(array('shiftDate'=>$acceptDate)); } catch (\exception $e) { echo "Exception of create order in Shifts <br>"; } /*foreach ($shifts as $shift) { try { //Admin::create(array('name'=>$admin)); } catch (\exception $e) { echo "Exception"; } }*/ }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Shift::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Generate array for dropdown list to use in child form. * @return array $_items */ public static function items() { self::$_items = CHtml::listData(self::model()->findAll(), 'shift_id', 'shift_type'); return self::$_items; }
public function get_detail($id = false, $id_group = false) { if (!$id || !$id_group) { return false; } $group = Schedulegroup::find($id_group); $interval = Schedulemaster::find($group->schedule_master_id); $dayofmonth = array(); $optionsmonth = array(); $optionsyears = array(); for ($i = 1; $i <= $interval->bravo_interval + 1; $i++) { $dayofmonth[$i] = $i; } for ($month = 1; $month <= 12; $month++) { $optionsmonth[$month] = Myfungsi::bulan($month); } for ($year = date('Y'); $year < date('Y') + 3; $year++) { $optionsyears[$year] = $year; } $this->data['fleets'] = Schedulefleetgroup::where('schedule_group_id', '=', $id_group)->get(); $this->data['group'] = Schedulegroup::find($id_group); $this->data['dayofmonth'] = $dayofmonth; $this->data['months'] = $optionsmonth; $this->data['years'] = $optionsyears; $this->data['shifts'] = Koki::to_dropdown(Shift::all(), 'id', 'shift'); $this->data['fleetinfo'] = Fleet::join('ksos', 'fleets.id', '=', 'ksos.fleet_id')->where('ksos.fleet_id', '=', $id)->where('ksos.actived', '=', 1)->where('fleets.pool_id', '=', Auth::user()->pool_id)->first(); //->get(array('fleets.*','ksos.bravo_driver_id', 'ksos.charlie_driver_id')); return View::make('themes.modul.' . $this->views . '.setholiday', $this->data); }
echo $form->error($model, 'attendence'); ?> </div> --> <div class="row"> <?php echo $form->labelEx($model, 'shift_id'); ?> <?php //echo $form->textField($model,'shift_id'); ?> <?php //echo $form->dropDownList($model,'shift_id', CHtml::listData(Shift::model()->findAll(), 'shift_id', 'shift_type')); ?> <?php echo $form->dropDownList($model, 'shift_id', Shift::items(), array('empty' => '---------------Select-------------', 'tabindex' => 1)); ?> <span class="status"> </span> <?php echo $form->error($model, 'shift_id'); ?> </div> <!-- <div class="row"> <?php echo $form->labelEx($model, 'sem_id'); ?> <?php //echo $form->textField($model,'sem_id'); ?>
<?php $EmployeeInfo = EmployeeInfo::model()->findByPk($employee_transaction[0]->employee_transaction_employee_id); if ($employee_transaction[0]->employee_transaction_category_id != null) { $Category = Category::model()->findByPk($employee_transaction[0]->employee_transaction_category_id); } else { $Category = new Category(); } if ($employee_transaction[0]->employee_transaction_religion_id != null) { $Religion = Religion::model()->findByPk($employee_transaction[0]->employee_transaction_religion_id); } else { $Religion = new Religion(); } $Shift = Shift::model()->findByPk($employee_transaction[0]->employee_transaction_shift_id); $EmployeeDesignation = EmployeeDesignation::model()->findByPk($employee_transaction[0]->employee_transaction_designation_id); if ($employee_transaction[0]->employee_transaction_nationality_id != null) { $Nationality = Nationality::model()->findByPk($employee_transaction[0]->employee_transaction_nationality_id); } else { $Nationality = new Nationality(); } $Department = Department::model()->findByPk($employee_transaction[0]->employee_transaction_department_id); if ($employee_transaction[0]->employee_transaction_languages_known_id != null) { $LanguagesKnown = LanguagesKnown::model()->findByPk($employee_transaction[0]->employee_transaction_languages_known_id); } $Organization = Organization::model()->findByPk($employee_transaction[0]->employee_transaction_organization_id); if ($employee_transaction[0]->employee_transaction_emp_address_id != null) { $EmployeeAddress = EmployeeAddress::model()->findByPk($employee_transaction[0]->employee_transaction_emp_address_id); } else { $EmployeeAddress = new EmployeeAddress(); } ?>
public function newShift() { //gets the input values $eid = Input::get('eid'); $clockin = Input::get('clockin'); $clockout = Input::get('clockout'); // need date time for comparisons $clockinAsDateTime = new DateTime($clockin); $clockoutAsDateTime = new DateTime($clockout); $curDateTime = new DateTime(); // can't clock negative hours if ($clockoutAsDateTime < $clockinAsDateTime) { return json_encode(['error' => 'negative hours', 'info' => 'Clock in time must be before the current time and before the clock out time.']); } // wait til you have worked shift to clock it if ($clockoutAsDateTime > $curDateTime && $clockinAsDateTime > $curDateTime) { return json_encode(['error' => 'future shift', 'info' => 'Please log only shifts that you have worked, not ones that you expect to work.']); } // can't clock more than 24 hours $min_clockin = date_sub($clockoutAsDateTime, date_interval_create_from_date_string('1 day')); if ($clockinAsDateTime < $min_clockin) { return json_encode(['error' => 'too long', 'info' => 'The max shift time is 24 hours']); } // Before saving we should make sure no one is over clocking (i.e., // the new shift times don't overlap with existing shift times); // To do this we query for conflicting shifts and reject if the query // returns shifts. The query is pretty ugly, but it's really not // very complex. 4 steps total: // 1) Get shifts for the user who is updating his/her shifts. // 2) Find any shifts with clockin or clockout times that fall within the // updated shift times. If updated shift time is 2-3pm, this finds any // shift whose clockin or clockout is between 2pm and 3pm. // 3) Find any shifts that extend the updated shift times. If updated // shift time is 2-3pm and another shift is 1:30-3:30pm this finds // it. $conflictingShiftClockInTimes = Shift::where('eid', $eid)->where(function ($query) use($clockin, $clockout) { $query->whereBetween('clockIn', [$clockin, $clockout])->orWhereBetween('clockOut', [$clockin, $clockout])->orWhere(function ($query) use($clockin, $clockout) { $query->where('clockOut', '>', $clockout)->where('clockIn', '<', $clockin); }); })->select('clockIn')->get(); // if there are conflicting shifts return them as a string if (!$conflictingShiftClockInTimes->isEmpty()) { $conflicts = ""; foreach ($conflictingShiftClockInTimes as $time) { $conflicts .= $time->clockIn . "<br>"; } return json_encode(['error' => 'conflict', 'info' => $conflicts]); } $newShift = new Shift(); $newShift->eid = $eid; $newShift->clockIn = $clockin; $newShift->clockout = $clockout; $newShift->save(); return json_encode(['error' => 'none']); }
public function post_loaddatamonthly() { $date = Input::get('dateops', date('Y-m-d')); $startdate = Input::get('startdateops', date('Y-m-01')); $pembagi = Input::get('pembagi', date('t')); $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'); //$count = Driver::count(); if ($shift_id == 'all') { $count = DB::table('financial_report_summary_graf')->where('operasi_time', '>=', $startdate)->where('operasi_time', '<=', $date)->where_pool_id(Auth::user()->pool_id)->count(); } else { $count = DB::table('financial_report_summary')->where('shift_id', '=', $shift_id)->where('operasi_time', '>=', $startdate)->where('operasi_time', '<=', $date)->where_pool_id(Auth::user()->pool_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; } if ($shift_id == 'all') { $financials = DB::table('financial_report_summary_graf')->where('operasi_time', '>=', $startdate)->where('operasi_time', '<=', $date)->where_pool_id(Auth::user()->pool_id)->order_by($sidx, $sord)->skip($start)->take($limit)->get(); } else { $financials = DB::table('financial_report_summary')->where('shift_id', '=', $shift_id)->where('operasi_time', '>=', $startdate)->where('operasi_time', '<=', $date)->where_pool_id(Auth::user()->pool_id)->order_by($sidx, $sord)->skip($start)->take($limit)->get(); } $responce['page'] = $page; $responce['total'] = $total_pages; $responce['records'] = $count; if ($financials) { $no = $start + 0; $ksavr = 0; $selisiavr = 0; $setoranopsavr = 0; $totalavr = 0; $cicilanksavr = 0; $dendaavr = 0; $cicilan_dp_ksoavr = 0; foreach ($financials as $finan) { $no++; $responce['rows'][] = array('no' => $no, 'operasi_time' => $finan->operasi_time, 'shift_id' => Shift::find($finan->shift_id)->shift, 'setoran_cash' => $finan->setoran_cash, 'setoran_wajib' => $finan->setoran_wajib, 'tabungan_sparepart' => $finan->tabungan_sparepart, 'denda' => $finan->denda, 'potongan' => $finan->potongan, 'cicilan_sparepart' => $finan->cicilan_sparepart, 'cicilan_ks' => $finan->cicilan_ks, 'biaya_cuci' => $finan->biaya_cuci, 'iuran_laka' => $finan->iuran_laka, 'cicilan_dp_kso' => $finan->cicilan_dp_kso, 'cicilan_hutang_lama' => $finan->cicilan_hutang_lama, 'ks' => $finan->setoran_cash - ($finan->setoran_wajib + $finan->tabungan_sparepart + $finan->denda + $finan->cicilan_sparepart + $finan->cicilan_ks + $finan->biaya_cuci + $finan->iuran_laka + $finan->cicilan_dp_kso + $finan->cicilan_hutang_lama + $finan->cicilan_lain + $finan->hutang_dp_sparepart - $finan->potongan), 'cicilan_lain' => $finan->cicilan_lain, 'hutang_dp_sparepart' => $finan->hutang_dp_sparepart, 'total' => $finan->setoran_wajib + $finan->tabungan_sparepart + $finan->denda + $finan->cicilan_sparepart + $finan->cicilan_ks + $finan->biaya_cuci + $finan->iuran_laka + $finan->cicilan_dp_kso + $finan->cicilan_hutang_lama + $finan->cicilan_lain + $finan->hutang_dp_sparepart, 'setoranops' => $finan->setoran_cash - ($finan->biaya_cuci + $finan->iuran_laka)); $dendaavr += $finan->denda; $cicilan_dp_ksoavr += $finan->cicilan_dp_kso; $cicilanksavr += $finan->cicilan_ks; $ksavr += $finan->setoran_cash - ($finan->setoran_wajib + $finan->tabungan_sparepart + $finan->denda + $finan->cicilan_sparepart + $finan->cicilan_ks + $finan->biaya_cuci + $finan->iuran_laka + $finan->cicilan_dp_kso + $finan->cicilan_hutang_lama + $finan->cicilan_lain + $finan->hutang_dp_sparepart - $finan->potongan); $selisiavr += $finan->selisi_ks; $setoranopsavr += $finan->setoran_cash - ($finan->biaya_cuci + $finan->iuran_laka); $totalavr += $finan->setoran_wajib + $finan->tabungan_sparepart + $finan->denda + $finan->cicilan_sparepart + $finan->cicilan_ks + $finan->biaya_cuci + $finan->iuran_laka + $finan->cicilan_dp_kso + $finan->cicilan_hutang_lama + $finan->cicilan_lain + $finan->hutang_dp_sparepart; } $responce['userdata']['ks'] = $ksavr / ($count - 2); $responce['userdata']['selisi_ks'] = $selisiavr / ($count - 2); $responce['userdata']['setoranops'] = $setoranopsavr / ($count - 2); $responce['userdata']['total'] = $totalavr / ($count - 2); $responce['userdata']['denda'] = $dendaavr / ($count - 2); $responce['userdata']['cicilan_ks'] = $cicilanksavr / ($count - 2); $responce['userdata']['cicilan_dp_kso'] = $cicilan_dp_ksoavr / ($count - 2); } $responce['userdata']['operasi_time'] = 'Rata-rata:'; return json_encode($responce); /**/ }
echo Shift::remove($value[2]); ?> </h3> <p class="text-muted">We update dependencies to keep things fresh.</p> </div> </div> </a> <a href="<?php echo HOME . '/portfolio/' . $value[3]; ?> "> <div class="col-lg-3 col-md-6 text-center"> <div class="service-box"> <i class="fa fa-4x fa-heart wow bounceIn text-primary" data-wow-delay=".3s"></i> <h3><?php echo Shift::remove($value[3]); ?> </h3> <p class="text-muted">You have to make your websites with love these days!</p> </div> </div> </a> </div> <?php } ?> </div>
function testShiftModule() { $noonshift = new Shift("08-03-28:1-5", "house", 3, array(), array(), "", ""); $this->assertEqual($noonshift->get_hours(), "1-5"); $this->assertTrue($noonshift->get_id() == "08-03-28:1-5:house"); $this->assertEqual($noonshift->get_yy_mm_dd(), "08-03-28"); // Test new function for resetting shift's start/end time $this->assertTrue($noonshift->get_start_time() == 13); $this->assertEqual($noonshift->get_end_time(), 17); // Be sure that invalid times are caught. $this->assertFalse($noonshift->set_start_end_time(13, 12)); $this->assertTrue($noonshift->get_id() == "08-03-28:1-5:house"); $this->assertTrue($noonshift->get_hours() == "1-5"); $this->assertTrue($noonshift->num_vacancies() == 3); $this->assertTrue($noonshift->get_day() == "Fri"); $this->assertFalse($noonshift->has_sub_call_list()); $persons = array(); $persons[] = "alex1234567890+alex+jones"; $noonshift->assign_persons($persons); $noonshift->ignore_vacancy(); $persons[] = "malcom1234567890+malcom+jones"; $noonshift->assign_persons($persons); $noonshift->ignore_vacancy(); $persons[] = "nat1234567890+nat+jones"; $noonshift->assign_persons($persons); $noonshift->ignore_vacancy(); $this->assertTrue($noonshift->num_vacancies() == 0); $noonshift->add_vacancy(); $this->assertTrue($noonshift->num_slots() == 4); $noonshift->ignore_vacancy(); $this->assertTrue($noonshift->num_slots() == 3); $noonshift->set_notes("Hello 1-5 shift!"); $this->assertTrue($noonshift->get_notes() == "Hello 1-5 shift!"); echo "testShift complete"; }