public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Summary::create([]); } }
/** * Verify basic behavior of fromArray(). * * @test * * @return void */ public function fromArray() { $input = ['resourceURI' => 'a resource url', 'name' => 'a name', 'type' => 'a type', 'role' => 'a role']; $summary = Summary::fromArray($input); $this->assertSame($input['resourceURI'], $summary->getResourceURI()); $this->assertSame($input['name'], $summary->getName()); $this->assertSame($input['type'], $summary->getType()); $this->assertSame($input['role'], $summary->getRole()); }
$overTime2 = '01:00:00'; $nightDiff['startTime'] = '22:00:00'; //10PM or 22:00 hrs $nightDiff['endTime'] = '06:00:00'; //6AM or 6:00 hrs //Find the employee timesheet record for this day $employeeClocking = Timesheet::where('employee_id', '=', $data['employeeno'])->where('daydate', '=', date('Y-m-d'))->first(); //Todo: Simplify and refactoring the code $otherDayDate = date("Y-m-d", strtotime('-2 days')); $getOtherDayDate = DB::table('employee_timesheet')->where('employee_id', $data['employeeno'])->where('daydate', $otherDayDate)->get(); $yesterDayDate = date("Y-m-d", strtotime('yesterday')); $getYesterDayDate = DB::table('employee_timesheet')->where('employee_id', $data['employeeno'])->where('daydate', $yesterDayDate)->get(); $employeeNightDiffClocking = Timesheet::where('employee_id', '=', $data['employeeno'])->where('daydate', '=', $yesterDayDate)->first(); //Summary $employeeSummary = Summary::where('employee_id', '=', $data['employeeno'])->where('daydate', '=', date('Y-m-d'))->first(); $employeeSummaryNightDiffClocking = Summary::where('employee_id', '=', $data['employeeno'])->where('daydate', '=', $yesterDayDate)->first(); //$getworkShiftYesterDayDate = DB::table('work_shift')->where('employee_id', $employeeId)->get(); //Get Other day clocking $otherday['time_in_1'] = $getOtherDayDate[0]->time_in_1; $otherday['time_in_2'] = $getOtherDayDate[0]->time_in_2; $otherday['time_in_3'] = $getOtherDayDate[0]->time_in_3; $otherday['time_out_1'] = $getOtherDayDate[0]->time_out_1; $otherday['time_out_2'] = $getOtherDayDate[0]->time_out_2; $otherday['time_out_3'] = $getOtherDayDate[0]->time_out_3; //Get Yesterday clocking $yesterday['time_in_1'] = $getYesterDayDate[0]->time_in_1; $yesterday['time_in_2'] = $getYesterDayDate[0]->time_in_2; $yesterday['time_in_3'] = $getYesterDayDate[0]->time_in_3; $yesterday['time_out_1'] = $getYesterDayDate[0]->time_out_1; $yesterday['time_out_2'] = $getYesterDayDate[0]->time_out_2; $yesterday['time_out_3'] = $getYesterDayDate[0]->time_out_3;
/** * Writes out the reservation cell * @param int $colspan column span of this reservation * @param string $color_select array identifier for which color to use * @param string $mod_view indentifying character for javascript reserve function to mod or view reservation * @param string $resid id of this reservation * @param Summary $summary summary for this reservation * @param string $viewable whether the user can click on this reservation and bring up a details box * @param int $read_only whether this is a read only schedule * @param boolean $pending is this reservation pending approval */ function write_reservation($colspan, $color_select, $mod_view, $resid, $summary = '', $viewable = false, $read_only = false, $pending = 0) { global $conf; $js = ''; $color = '#' . $conf['ui'][$color_select][0]['color']; $hover = '#' . $conf['ui'][$color_select][0]['hover']; $text = '#' . $conf['ui'][$color_select][0]['text']; $image = $conf['ui'][$color_select][0]['image']; $chars = $colspan > 1 ? 4 * $colspan : 0; $read_only = intval($read_only); /*AK: $mod_view work around. This is required to make reservations of other users not clickable*/ $mod_view_wa = false; if ($mod_view == 'm') { $mod_view_wa = true; } /*--------------------------------------------------------------------------------------------*/ if ($viewable && $mod_view_wa) { $js = "onclick=\"reserve('{$mod_view}','','','{$resid}','','0','{$read_only}','{$pending}');\" "; if ($summary->isVisible()) { $js .= "onmouseover=\"showDescription('timeslotinfo', '{$color_select}'); resOver(this, '{$hover}'); showsummary('summary', event, '" . preg_replace("/[\n\r]+/", '<br/>', addslashes($summary->toScheduleHover())) . "');\" onmouseout=\"hideDescription('timeslotinfo'); resOut(this, '{$color}', '{$image}'); hideSummary('summary');\" onmousemove=\"moveSummary('summary', event);\""; } else { $js .= "onmouseover=\"showDescription('timeslotinfo', '{$color_select}'); resOver(this, '{$hover}');\" onmouseout=\"hideDescription('timeslotinfo'); resOut(this, '{$color}', '{$image}');\""; } } else { if ($summary->isVisible()) { $js = "onmouseover=\"showsummary('summary', event, '" . preg_replace("/[\n\r]+/", '<br/>', addslashes($summary->toScheduleHover())) . "');\" onmouseout=\"hideSummary('summary');\" onmousemove=\"moveSummary('summary', event);\""; } else { $js .= "onmouseover=\"showDescription('timeslotinfo', '{$color_select}'); resOver(this, '{$hover}');\" onmouseout=\"hideDescription('timeslotinfo'); resOut(this, '{$color}', '{$image}');\""; } } $summary_text = $summary->toScheduleCell(); switch ($color_select) { case "my_res": $boxed_summary_text = "Your current reservation."; break; case "my_past_res": $boxed_summary_text = "Your past reservation."; break; case "other_past_res": $boxed_summary_text = "Past reservation of another person."; break; case "other_res": $boxed_summary_text = "Reservation of another person."; } echo "<td colspan=\"{$colspan}\" style=\"color: {$text}; background-color: {$color}; background-image: \n\turl({$image}); background-repeat: repeat\" {$js}><div class=\"boxedSummary\"><div class=\"inlineSummary\">{$summary_text}</div></div></td>"; }
public function testToOptionArray() { $expectedResult = array(array('value' => 0, 'label' => __('Display number of items in cart')), array('value' => 1, 'label' => __('Display item quantities'))); $this->assertEquals($expectedResult, $this->model->toOptionArray()); }
<?php $numDays = 7; $campaign = Db::queryRow('select * from zz_campaigns where uri = :uri', array(':uri' => $uri), 1); if ($campaign == null) { $app->redirect('/', 302); } $title = 'Campaign: ' . $campaign['title']; $subTitle = $campaign['subTitle']; $p = json_decode($campaign['definition'], true); $summary = Summary::getSummary('system', 'solarSystemID', $p, 30000142, $p, true); $topPoints = array(); $topPods = array(); $top = array(); $top[] = Info::doMakeCommon('Top Characters', 'characterID', Stats::getTopPilots($p, true)); $top[] = Info::doMakeCommon('Top Corporations', 'corporationID', Stats::getTopCorps($p, true)); $top[] = Info::doMakeCommon('Top Alliances', 'allianceID', Stats::getTopAllis($p, true)); $top[] = Info::doMakeCommon('Top Ships', 'shipTypeID', Stats::getTopShips($p, true)); $top[] = Info::doMakeCommon('Top Systems', 'solarSystemID', Stats::getTopSystems($p, true)); $p['pastSeconds'] = $numDays * 86400; $p['limit'] = 5; $topIsk = Stats::getTopIsk($p, true); $topIsk['title'] = 'Most Valuable Kills'; unset($p['pastSeconds']); // get latest kills $killsLimit = 50; $p['limit'] = $killsLimit; if (isset($page) && $page > 0 && $page < 100) { $p['page'] = $page; } else { $page = 1;
* it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ $systemID = (int) $system; $relatedTime = (int) $time; $systemName = Info::getSystemName($systemID); $regionName = Info::getRegionName(Info::getRegionIDFromSystemID($systemID)); $unixTime = strtotime($relatedTime); $time = date("Y-m-d H:i", $unixTime); if ((int) $exHours < 1 || (int) $exHours > 12) { $exHours = 1; } $key = "{$systemID}:{$relatedTime}:{$exHours}"; $mc = Cache::get($key); if (!$mc) { $parameters = array("solarSystemID" => $systemID, "relatedTime" => $relatedTime, "exHours" => $exHours); $kills = Kills::getKills($parameters); $summary = Summary::buildSummary($kills, $parameters, "{$systemName}:{$time}:{$exHours}"); $mc = array("summary" => $summary, "systemName" => $systemName, "regionName" => $regionName, "time" => $time, "exHours" => $exHours); Cache::set($key, $mc, 900); } $app->render("related.html", $mc);
function clockingStatusClockIn3Out($clockingDateTime) { $employeeId = Session::get('userEmployeeId'); $userId = Session::get('userId'); $dayOfTheWeek = date('l'); $currentDate = date('Y-m-d'); $schedule = new Schedule(); $getSchedule = $schedule->getSchedule($employeeId, date('Y-m-d')); $workShift = new Workshift(); //$getWorkShiftByEmployeeId = $workShift->getWorkShiftByEmployeeId($employeeId); $getWorkShiftByDayOfTheWeek = $workShift->getWorkShiftByDayOfTheWeek($employeeId, $dayOfTheWeek, 2); //return dd($getWorkShiftByDayOfTheWeek); //break; $holiday = new Holiday(); $getHolidayByDate = $holiday->getHolidayByDate($currentDate); $timesheet = new Timesheet(); $employeeClocking = $timesheet->getEmployeeByEmployeeIdandDate($employeeId, date('Y-m-d')); $summary = new Summary(); $employeeSummary = $summary->getEmployeeSummaryByEmployeeIdandDate($employeeId, date('Y-m-d')); $setting = new Setting(); $employeeSetting = $setting->getEmployeeSettingByEmployeeId($employeeId); if (!empty($getSchedule)) { //echo 'getSchedule'; $scheduled['start_time'] = $getSchedule[0]->start_time; $scheduled['end_time'] = $getSchedule[0]->end_time; $scheduled['rest_day'] = $getSchedule[0]->rest_day; } elseif (!empty($getWorkShiftByDayOfTheWeek)) { //echo 'getWorkShiftByDayOfTheWeek'; // From 01:00:00 change to 2015-04-30 09:00:00 $scheduled['start_time'] = date('Y-m-d', strtotime($employeeClocking->time_in_3)) . ' ' . $getWorkShiftByDayOfTheWeek[0]->start_time; // From 01:00:00 change to 2015-04-30 01:00:00 $scheduled['end_time'] = date('Y-m-d', strtotime($clockingDateTime)) . ' ' . $getWorkShiftByDayOfTheWeek[0]->end_time; $scheduled['rest_day'] = $getWorkShiftByDayOfTheWeek[0]->rest_day; } $employeeClocking->time_out_3 = $clockingDateTime; $employeeClocking->clocking_status = 'clock_out_3'; // From 2015-04-30 08:36:16 change to 08:36:16 $clockingIn = date('H:i:s', strtotime($employeeClocking->time_in_3)); // From 2015-04-30 08:36:16 change to 08:36:16 $clockingOut = date('H:i:s', strtotime($clockingDateTime)); //SCHEDULED : TRUE if ((!empty($scheduled['start_time']) || $scheduled['start_time'] !== '00:00:00' || $scheduled['start_time'] !== '') && (!empty($scheduled['end_time']) || $scheduled['end_time'] !== '00:00:00' || $scheduled['end_time'] !== '')) { echo "SCHEDULED : TRUE \n"; //REST DAY: FALSE if ($scheduled['rest_day'] !== 1) { echo "REST DAY: FALSE \n"; //LATE/TARDINESS: TRUE if (!empty($employeeClocking->tardiness_3)) { echo "LATE/TARDINESS: TRUE \n"; //TODO: check employee setting if has_break is true and break time is set. - function getWorkHours $employeeClocking->work_hours_3 = getWorkHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); //TODO: Compute total hours with out overtime - getTotalHours $employeeClocking->total_hours_3 = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); //LATE/TARDINESS: FALSE } else { echo "LATE/TARDINESS: FALSE \n"; //TODO: check employee setting if has_break is true and break time is set. - function getWorkHours $employeeClocking->work_hours_3 = getWorkHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); //TODO: Compute total hours with overtime - getTotalHours $employeeClocking->total_hours_3 = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); } //UNDERTIME: TRUE if (strtotime($clockingDateTime) < strtotime($scheduled['end_time'])) { echo "UNDERTIME: TRUE \n"; echo $employeeClocking->undertime_3 = getUnderTimeHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['start_time'], $scheduled['end_time']); } //OVERTIME: TRUE $isOvertime = false; if (date('H:i', strtotime($employeeClocking->time_in_3)) <= date('H:i', strtotime($scheduled['start_time'])) && date('H:i', strtotime($clockingDateTime)) > date('H:i', strtotime($scheduled['end_time']))) { echo "OVERTIME: TRUE \n"; $isOvertime = true; $employeeClocking->total_overtime_3 = getOvertimeHours($clockingDateTime, $scheduled['end_time']); } //HOLIDAY: TRUE if (hasHoliday($currentDate)) { echo "HOLIDAY: TRUE \n"; if ('Regular holiday' === $getHolidayByDate[0]->holiday_type) { //Regular holiday echo "Regular holiday \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $employeeSummary->legal_holiday = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); } else { //ISOVERTIME: TRUE $employeeSummary->legal_holiday_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); } } elseif ('Special non-working day' === $getHolidayByDate[0]->holiday_type) { //Special non-working day echo "Special non-working day \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $employeeSummary->special_holiday = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); } else { //ISOVERTIME: TRUE $employeeSummary->special_holiday_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); } } //HOLIDAY: FALSE } else { //Regular Day echo "HOLIDAY: FALSE \n"; echo "Regular Day \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $employeeSummary->regular = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); } else { //ISOVERTIME: TRUE $employeeSummary->regular_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); } } if ($employeeClocking->save()) { $employeeSummary->save(); return Redirect::to('/redraw/timesheet'); } //REST DAY: TRUE } elseif ($scheduled['rest_day'] === 1) { echo "REST DAY: TRUE \n"; //TODO RULES: First 8 Hours get the hours_per_day in employee setting //LATE/TARDINESS: TRUE if (!empty($employeeClocking->tardiness_3)) { echo "LATE/TARDINESS: TRUE \n"; //TODO: check employee setting if has_break is true and break time is set. - function getWorkHours $employeeClocking->work_hours_3 = getWorkHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); //TODO: Compute total hours with out overtime - getTotalHours $employeeClocking->total_hours_3 = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); //LATE/TARDINESS: FALSE } else { echo "LATE/TARDINESS: FALSE \n"; //TODO: check employee setting if has_break is true and break time is set. - function getWorkHours $employeeClocking->work_hours_3 = getWorkHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); //TODO: Compute total hours with overtime - getTotalHours $employeeClocking->total_hours_3 = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); } //UNDERTIME: TRUE if (strtotime($clockingDateTime) < strtotime($scheduled['end_time'])) { echo "UNDERTIME: TRUE \n"; echo $employeeClocking->undertime_3 = getUnderTimeHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['start_time'], $scheduled['end_time']); } //OVERTIME: TRUE $isOvertime = false; if (date('H:i', strtotime($employeeClocking->time_in_3)) <= date('H:i', strtotime($scheduled['start_time'])) && date('H:i', strtotime($clockingDateTime)) > date('H:i', strtotime($scheduled['end_time']))) { echo "OVERTIME: TRUE \n"; $isOvertime = true; $employeeClocking->total_overtime_3 = getOvertimeHours($clockingDateTime, $scheduled['end_time']); } //HOLIDAY: TRUE if (hasHoliday($currentDate)) { echo "HOLIDAY: TRUE \n"; if ('Regular holiday' === $getHolidayByDate[0]->holiday_type) { //Regular holiday echo "Regular holiday \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $employeeSummary->rest_day_legal_holiday = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); } else { //ISOVERTIME: TRUE $employeeSummary->rest_day_legal_holiday_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); } } elseif ('Special non-working day' === $getHolidayByDate[0]->holiday_type) { //Special non-working day echo "Special non-working day \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $employeeSummary->rest_day_special_holiday = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); } else { //ISOVERTIME: TRUE $employeeSummary->rest_day_special_holiday_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); } } //HOLIDAY: FALSE } else { //Regular Day echo "HOLIDAY: FALSE \n"; echo "Regular Rest Day \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $employeeSummary->rest_day = getTotalHours($employeeClocking->time_in_3, $clockingDateTime, $scheduled['end_time']); } else { //ISOVERTIME: TRUE $employeeSummary->rest_day_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); } } if ($employeeClocking->save()) { $employeeSummary->save(); return Redirect::to('/redraw/timesheet'); } } //SCHEDULED : FALSE } else { echo "SCHEDULED : FALSE \n"; } }
<?php include_once "../../../../../../libraries/aces/models/summary.php"; // echo json_encode($filter); $_POST['userid'] = $_POST['userid']; $_POST['summary'] = $_POST['summary']; $saum = new Summary(); $data = $saum->update($_POST); echo json_encode($data); // echo json_encode($_POST); // foreach($data as $edudata){ // echo json_encode($edudata); // }
$topLists[] = array("name" => "Top Faction Characters", "type" => "character", "data" => Stats::getTopPilots($topParameters, true)); $topLists[] = array("name" => "Top Faction Corporations", "type" => "corporation", "data" => Stats::getTopCorps($topParameters, true)); $topLists[] = array("name" => "Top Faction Allianes", "type" => "alliance", "data" => Stats::getTopAllis($topParameters, true)); } } $corpList = array(); if ($pageType == "api") { $corpList = Info::getCorps($id); } $corpStats = array(); if ($pageType == "corpstats") { $corpStats = Info::getCorpStats($id, $parameters); } $onlyHistory = array("character", "corporation", "alliance"); if ($pageType == "history" && in_array($key, $onlyHistory)) { $detail["history"] = Summary::getMonthlyHistory($columnName, $id); } else { $detail["history"] = array(); } // Figure out if the character or corporation has any API keys in the database $apiVerified = false; if (in_array($key, array("character", "corporation"))) { if ($key == "character") { $count = Db::queryField("SELECT count(1) count FROM zz_api_characters WHERE characterID = :characterID", "count", array(":characterID" => $id)); $apiVerified = $count > 0 ? 1 : 0; } else { $count = Db::queryField("select count(1) count from zz_api_characters where isDirector = 'T' and corporationID = :corpID", "count", array(":corpID" => $id)); $apiVerified = $count > 0 ? 1 : 0; } } $cnt = 0;
public function updateTimesheetTimeOut3($data = '', $column = NULL) { //Settings $nightDiff['from'] = strtotime('22:00:00'); $nightDiff['to'] = strtotime('06:00:00'); $breakTime = date('H:i:s', strtotime('01:00:00')); $shift = 2; $hasNightDiff = false; $getTimesheet = Timesheet::where('id', (int) trim($data["row_id"]))->first(); $clockingIn = $getTimesheet->time_in_3; $clockingOut = $getTimesheet->time_out_3; $timeInHour = date('G', strtotime($clockingIn)); //24-hour format of an hour without leading zeros $timeOutHour = date('G', strtotime($clockingOut)); //24-hour format of an hour without leading zeros $timesheetId = $getTimesheet->id; $employeeId = $getTimesheet->employee_id; $clockingStatus = $getTimesheet->clocking_status; //$shiftStart = $getTimesheet->schedule_in; //$shiftEnd = $getTimesheet->schedule_out; $dayDate = $getTimesheet->daydate; $tardiness = $getTimesheet->tardiness_3; $dayOfTheWeek = date('l', strtotime($dayDate)); $getSummary = Summary::where('employee_id', $employeeId)->where('daydate', trim($dayDate))->first(); $hourNeedle = date('G', strtotime(trim($data['value']))); $hourHaystack = array(0, 1, 2, 3, 4, 5, 6); if (in_array($hourNeedle, $hourHaystack)) { $nightdiff = true; } else { $nightdiff = false; } $dayDateModify = new DateTime($dayDate); //Todo Add a condition here if (!empty($data['value']) && !empty($getTimesheet->time_in_3)) { if (!$nightdiff) { $clockingDateTime = date('Y-m-d', strtotime($dayDate)) . ' ' . date('H:i:s', strtotime($data['value'])); } else { //$dayDateModify = new DateTime($dayDate); $dayDateModify->modify('+1 day'); //$dayDateModify->format('Y-m-d'); $clockingDateTime = date('Y-m-d', strtotime($dayDateModify->format('Y-m-d'))) . ' ' . date('H:i:s', strtotime($data['value'])); } $getTimesheet->time_out_3 = $clockingDateTime; $getTimesheet->clocking_status = 'clock_out_3'; } elseif (!empty($data['value']) && empty($getTimesheet->time_in_3)) { if (!$nightdiff) { $clockingDateTime = date('Y-m-d', strtotime($dayDate)) . ' ' . date('H:i:s', strtotime($data['value'])); } else { //$dayDateModify = new DateTime($dayDate); $dayDateModify->modify('+1 day'); //$dayDateModify->format('Y-m-d'); $clockingDateTime = date('Y-m-d', strtotime($dayDateModify->format('Y-m-d'))) . ' ' . date('H:i:s', strtotime($data['value'])); } $getTimesheet->time_out_3 = $clockingDateTime; $getTimesheet->clocking_status = 'clock_out_3'; //close } elseif (empty($data['value']) && !empty($getTimesheet->time_in_3)) { $clockingDateTime = ''; $getTimesheet->time_out_3 = $clockingDateTime; $getTimesheet->clocking_status = 'clock_in_3'; } elseif (empty($data['value']) && empty($getTimesheet->time_in_3)) { $clockingDateTime = date('Y-m-d', strtotime($dayDate)) . ' ' . date('H:i:s', strtotime($data['value'])); if (!$nightdiff) { $clockingDateTime = date('Y-m-d', strtotime($dayDate)) . ' ' . date('H:i:s', strtotime($data['value'])); } else { //$dayDateModify = new DateTime($dayDate); $dayDateModify->modify('+1 day'); //$dayDateModify->format('Y-m-d'); $clockingDateTime = date('Y-m-d', strtotime($dayDateModify->format('Y-m-d'))) . ' ' . date('H:i:s', strtotime($data['value'])); } $getTimesheet->time_out_3 = ''; $getTimesheet->clocking_status = 'close'; } $schedule = new Schedule(); $getSchedule = DB::table('employee_schedule')->where('employee_id', $employeeId)->where('schedule_date', trim($dayDate))->first(); $workShift = new Workshift(); $getWorkShiftByDayOfTheWeek = DB::table('work_shift')->where('employee_id', $employeeId)->where('name_of_day', date('l', strtotime($dayDate)))->where('shift', $shift)->first(); $holiday = new Holiday(); $getHolidayByDate = DB::table('holiday')->where('date', trim($dayDate))->first(); if (!empty($getSchedule)) { $scheduled['start_time'] = $getSchedule->start_time; $scheduled['end_time'] = $getSchedule->end_time; $scheduled['rest_day'] = $getSchedule->rest_day; $startTime = date('H:i:s', strtotime($scheduled['start_time'])); } elseif (!empty($getWorkShiftByDayOfTheWeek)) { //$scheduled['start_time'] = $getWorkShiftByDayOfTheWeek->start_time; //$scheduled['end_time'] = $getWorkShiftByDayOfTheWeek->end_time; // From 01:00:00 change to 2015-04-30 09:00:00 $scheduled['start_time'] = date('Y-m-d', strtotime($getTimesheet->time_out_3)) . ' ' . $getWorkShiftByDayOfTheWeek->start_time; // From 01:00:00 change to 2015-04-30 01:00:00 $scheduled['end_time'] = date('Y-m-d', strtotime($clockingDateTime)) . ' ' . $getWorkShiftByDayOfTheWeek->end_time; $scheduled['rest_day'] = $getWorkShiftByDayOfTheWeek->rest_day; $startTime = $scheduled['start_time']; } //return dd($clockingDateTime); //SCHEDULED : TRUE if ((!empty($scheduled['start_time']) || $scheduled['start_time'] !== '00:00:00' || $scheduled['start_time'] !== '') && (!empty($scheduled['end_time']) || $scheduled['end_time'] !== '00:00:00' || $scheduled['end_time'] !== '')) { //REST DAY: FALSE if ($scheduled['rest_day'] !== 1) { $datetime1 = $getTimesheet->time_in_3; $datetime2 = $clockingDateTime; //$interval = getDateTimeDiffInterval($getTimesheet->time_in_3, $getTimesheet->time_out_3) { //Used $datetime1 = new DateTime($datetime1); $datetime2 = new DateTime($datetime2); $interval = $datetime1->diff($datetime2); $hh = $interval->format('%H'); $mm = $interval->format('%I'); $ss = $interval->format('%S'); $overtime = getTimeToDecimalHours($hh, $mm, $ss); //number_format($hours, 2);*/ //OVERTIME: TRUE $isOvertime = true; $getTimesheet->total_overtime_3 = $overtime; $getTimesheet->total_hours_3 = $overtime; /* //echo "LATE/TARDINESS: TRUE \n"; //TODO: check employee setting if has_break is true and break time is set. - function getWorkHours $workHours = $getTimesheet->total_overtime_3; if ( $workHours >= 8 || $workHours >= 8.00 || $workHours >= 8.0 ) { $getTimesheet->work_hours_3 = 8.00; } else { $getTimesheet->work_hours_3 = $workHours; } */ //TODO: Compute total hours with out overtime - getTotalHours $getTimesheet->total_hours_3 = $getTimesheet->total_overtime_3; //GET NIGHTDIFF $timeInArr = array(); $timeOutArr = array(); $timeInArr = explode(' ', $getTimesheet->time_in_3); $timeOutArr = explode(' ', $clockingDateTime); $nightDiff['from'] = strtotime(date('Y-m-d H:i', strtotime($timeInArr[0] . ' ' . '22:00:00'))); $nightDiff['to'] = strtotime(date('Y-m-d H:i', strtotime($timeOutArr[0] . ' ' . '06:00:00'))); $timesheet['timeIn'] = strtotime(date('Y-m-d H:i', strtotime($getTimesheet->time_in_3))); $timesheet['timeOut'] = strtotime(date('Y-m-d H:i', strtotime($clockingDateTime))); if ($timesheet['timeIn'] >= $nightDiff['from'] && $timesheet['timeIn'] <= $nightDiff['to']) { if ($timesheet['timeOut'] >= $nightDiff['to']) { // SET IT TO 8.00 //$getTimesheet->night_differential_3 = 8.00; $getTimesheet->night_differential_3 = ($nightDiff['to'] - $timesheet['timeIn']) / 3600; } else { //$getTimesheet->night_differential_3 = $overtime; $getTimesheet->night_differential_3 = ($timesheet['timeOut'] - $timesheet['timeIn']) / 3600; } } elseif ($timesheet['timeOut'] >= $nightDiff['from'] && $timesheet['timeOut'] <= $nightDiff['to']) { if ($timesheet['timeIn'] <= $nightDiff['from']) { //$getTimesheet->night_differential_3 = 8.00; $getTimesheet->night_differential_3 = ($timesheet['timeOut'] - $nightDiff['from']) / 3600; } else { //$getTimesheet->night_differential_3 = $overtime; $getTimesheet->night_differential_3 = ($timesheet['timeOut'] - $timesheet['timeIn']) / 3600; } } /*else { if($timesheet['timeIn'] < $nightDiff['from'] && $timesheet['timeOut'] > $nightDiff['to']) { //$getTimesheet->night_differential_3 = 8.00; $getTimesheet->night_differential_3 = ($nightDiff['from'] - $nightDiff['to']) / 3600; } }*/ //HOLIDAY: TRUE if (hasHoliday($dayDate)) { ////echo "HOLIDAY: TRUE \n"; if ('Regular holiday' === $getHolidayByDate->holiday_type) { //Regular holiday //echo "Regular holiday \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $getSummary->legal_holiday = getTotalHours($getTimesheet->time_in_3, $clockingDateTime, $scheduled['end_time']); $getSummary->legal_holiday_overtime = ''; } else { //ISOVERTIME: TRUE $getSummary->legal_holiday_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); $getSummary->legal_holiday = ''; } } elseif ('Special non-working day' === $getHolidayByDate->holiday_type) { //Special non-working day //echo "Special non-working day \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $getSummary->special_holiday = getTotalHours($getTimesheet->time_in_3, $clockingDateTime, $scheduled['end_time']); $getSummary->special_holiday_overtime = ''; } else { //ISOVERTIME: TRUE $getSummary->special_holiday_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); $getSummary->special_holiday = ''; } } //HOLIDAY: FALSE } else { //Regular Day //echo "HOLIDAY: FALSE \n"; //echo "Regular Day \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $getSummary->regular = getTotalHours($getTimesheet->time_in_3, $clockingDateTime, $scheduled['end_time']); $getSummary->regular_overtime = ''; $getSummary->legal_holiday = ''; $getSummary->special_holiday = ''; } else { //ISOVERTIME: TRUE $getSummary->regular_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); $getSummary->regular = ''; $getSummary->legal_holiday_overtime = ''; $getSummary->special_holiday_overtime = ''; } } //REST DAY: TRUE } elseif ($scheduled['rest_day'] === 1) { $datetime1 = $getTimesheet->time_in_3; $datetime2 = $clockingDateTime; //$interval = getDateTimeDiffInterval($getTimesheet->time_in_3, $getTimesheet->time_out_3) { //Used $datetime1 = new DateTime($datetime1); $datetime2 = new DateTime($datetime2); $interval = $datetime1->diff($datetime2); $hh = $interval->format('%H'); $mm = $interval->format('%I'); $ss = $interval->format('%S'); $overtime = getTimeToDecimalHours($hh, $mm, $ss); //number_format($hours, 2);*/ //OVERTIME: TRUE $isOvertime = true; $getTimesheet->total_overtime_3 = $overtime; $getTimesheet->total_hours_3 = $overtime; /* //echo "LATE/TARDINESS: TRUE \n"; //TODO: check employee setting if has_break is true and break time is set. - function getWorkHours $workHours = $getTimesheet->total_overtime_3; if ( $workHours >= 8 || $workHours >= 8.00 || $workHours >= 8.0 ) { $getTimesheet->work_hours_3 = 8.00; } else { $getTimesheet->work_hours_3 = $workHours; } */ //TODO: Compute total hours with out overtime - getTotalHours $getTimesheet->total_hours_3 = $getTimesheet->total_overtime_3; //GET NIGHTDIFF $timeInArr = array(); $timeOutArr = array(); $timeInArr = explode(' ', $getTimesheet->time_in_3); $timeOutArr = explode(' ', $clockingDateTime); $nightDiff['from'] = strtotime(date('Y-m-d H:i', strtotime($timeInArr[0] . ' ' . '22:00:00'))); $nightDiff['to'] = strtotime(date('Y-m-d H:i', strtotime($timeOutArr[0] . ' ' . '06:00:00'))); $timesheet['timeIn'] = strtotime(date('Y-m-d H:i', strtotime($getTimesheet->time_in_3))); $timesheet['timeOut'] = strtotime(date('Y-m-d H:i', strtotime($clockingDateTime))); if ($timesheet['timeIn'] >= $nightDiff['from'] && $timesheet['timeIn'] <= $nightDiff['to']) { if ($timesheet['timeOut'] >= $nightDiff['to']) { // SET IT TO 8.00 $getTimesheet->night_differential_3 = 8.0; } else { $getTimesheet->night_differential_3 = $overtime; } } elseif ($timesheet['timeOut'] >= $nightDiff['from'] && $timesheet['timeOut'] <= $nightDiff['to']) { if ($timesheet['timeIn'] <= $nightDiff['from']) { $getTimesheet->night_differential_3 = 8.0; } else { $getTimesheet->night_differential_3 = $overtime; } } /*else { if($timesheet['timeIn'] < $nightDiff['from'] && $timesheet['timeOut'] > $nightDiff['to']) { $getTimesheet->night_differential_3 = 8.00; } }*/ //HOLIDAY: TRUE if (hasHoliday($dayDate)) { ////echo "HOLIDAY: TRUE \n"; if ('Regular holiday' === $getHolidayByDate->holiday_type) { //Regular holiday //echo "Regular holiday \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $getSummary->rest_day_legal_holiday = getTotalHours($getTimesheet->time_in_3, $clockingDateTime, $scheduled['end_time']); $getSummary->rest_day_legal_holiday_overtime = ''; } else { //ISOVERTIME: TRUE $getSummary->rest_day_legal_holiday_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); $getSummary->rest_day_legal_holiday = ''; } } elseif ('Special non-working day' === $getHolidayByDate->holiday_type) { //Special non-working day //echo "Special non-working day \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $getSummary->rest_day_special_holiday = getTotalHours($getTimesheet->time_in_3, $clockingDateTime, $scheduled['end_time']); $getSummary->rest_day_special_holiday_overtime = ''; } else { //ISOVERTIME: TRUE $getSummary->rest_day_special_holiday_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); $getSummary->rest_day_special_holiday = ''; } } //HOLIDAY: FALSE } else { //Regular Day //echo "HOLIDAY: FALSE \n"; //echo "Regular Day \n"; if (!$isOvertime) { //ISOVERTIME: FALSE $getSummary->rest_day = getTotalHours($getTimesheet->time_in_3, $clockingDateTime, $scheduled['end_time']); $getSummary->rest_day_overtime = ''; $getSummary->rest_day_legal_holiday = ''; $getSummary->rest_day_special_holiday = ''; } else { //ISOVERTIME: TRUE $getSummary->rest_day_overtime = getOvertimeHours($clockingDateTime, $scheduled['end_time']); $getSummary->rest_day = ''; $getSummary->rest_day_legal_holiday_overtime = ''; $getSummary->rest_day_special_holiday_overtime = ''; } } } } if ($getTimesheet->save()) { $getSummary->save(); return Redirect::to('/redraw/timesheet'); } //} }
/** * 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 = Summary::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * [getShipDetails description]. * * @param int $id * * @return array */ public static function getShipDetails($id) { $data = array('shipTypeID' => $id); self::addInfo($data); $data['shipTypeName'] = $data['shipName']; return Summary::getShipSummary($data, $id); }
public function getNetBalance() { $summary = new Summary(); return $summary->getNetBalance(); }
public function summary() { $userid = self::get_user(); $summary = new Summary($userid); $sumdata = $summary->currentsummary(); $this->summarydata = $sumdata->fetch_object(); // echo "<pre>"; // print_r($this->mobiledata);exit; }
public function redrawSearchEmployeeSummary() { //$employeeId = (int) Session::get("searchEmployeeId"); //$currentDate = date('Y-m-d'); if (Request::ajax()) { //$employeeId = Session::get('userEmployeeId'); //$employeeId = Auth::user()->employee_id; $summary = new Summary(); $summaryPerMonth = $summary->getSearchSummaryCutoff(Session::get('searchEmployeeId'), Session::get('dayDateArr')); //var_dump($summaryPerMonth); return $summaryPerMonth; } }
$employeeClocking = Timesheet::where('id', $overtimeById->timesheet_id)->first(); $schedule = new Schedule(); //$getSchedule = $schedule->getSchedule($employeeId, $employeeClocking->daydate); $getSchedule = DB::table('employee_schedule')->where('employee_id', $employeeId)->where('schedule_date', trim($employeeClocking->daydate))->first(); $Workshift = new Workshift(); //$getWorkshiftByDayOfTheWeek = $Workshift->getWorkshiftByDayOfTheWeek($employeeId, date('l', strtotime($employeeClocking->daydate)), $overtime->shift); $getWorkshiftByDayOfTheWeek = DB::table('work_shift')->where('employee_id', $employeeId)->where('name_of_day', date('l', strtotime($employeeClocking->daydate)))->where('shift', $shift)->first(); //return dd($getWorkshiftByDayOfTheWeek); $holiday = new Holiday(); //$getHolidayByDate = $holiday->getHolidayByDate($employeeClocking[0]->daydate); $getHolidayByDate = DB::table('holiday')->where('date', trim($employeeClocking->daydate))->first(); //return dd($getHolidayByDate); //$timesheet = new Timesheet; //$employeeClocking = $timesheet->getEmployeeByEmployeeIdandDate($employeeId, $employeeClocking->daydate); //$employeeClocking = DB::table('employee_timesheet')->where('employee_id', '=', $employeeId)->where('daydate', '=', $employeeClocking->daydate)->first(); $summary = new Summary(); $employeeSummary = $summary->getEmployeeSummaryByEmployeeIdandDate($employeeId, $employeeClocking->daydate); //return dd($employeeSummary); //$setting = new Setting; //$employeeSetting = $setting->getEmployeeSettingByEmployeeId($employeeId); if (!empty($getSchedule)) { //$scheduled['start_time'] = $getSchedule[0]->start_time; //$scheduled['end_time'] = $getSchedule[0]->end_time; $scheduled['rest_day'] = $getSchedule->rest_day; } elseif (!empty($getWorkshiftByDayOfTheWeek)) { // From 01:00:00 change to 2015-04-30 09:00:00 //$scheduled['start_time'] = date( 'Y-m-d', strtotime($employeeClocking[0]->time_in_1) ).' '.$getWorkshiftByDayOfTheWeek[0]->start_time; // From 01:00:00 change to 2015-04-30 01:00:00 //$scheduled['end_time'] = date( 'Y-m-d', strtotime($clockingDateTime) ).' '.$getWorkshiftByDayOfTheWeek[0]->end_time; $scheduled['rest_day'] = $getWorkshiftByDayOfTheWeek->rest_day; }
public static function parse(&$src) { $args = func_get_args(); array_shift($args); $result = array(); \org\rhaco\Xml::set($x, '<:>' . $src . '</:>'); foreach ($x->in('entry') as $in) { $o = new self(); $o->id($in->f('id.value()')); $o->title($in->f('title.value()')); $o->published($in->f('published.value()')); $o->updated($in->f('updated.value()')); $o->issued($in->f('issued.value()')); $value = $in->value(); $o->content = Content::parse($value); $o->summary = Summary::parse($value); $o->link = Link::parse($value); $o->author = Author::parse($value); $result[] = $o; $src = str_replace($in->plain(), '', $src); } return $result; }