$queryArgs[] = "pay_period_hours"; $pay_period_hours = $bootstrap->mysqliHandler->getArray($queryArgs); $x = 0; foreach ($pay_period_hours as $a_key => $data) { echo '<tr>'; foreach ($data as $key => $value) { if ($key == 'id') { echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?id=' . $value . '" class="ui-btn ui-icon-edit ui-btn-icon-notext ui-corner-all ui-mini-icon"></a></td>'; } elseif ($key == 'name') { echo '<td class="ui-vertical-middle" >'; echo $value; echo '</td>'; } } $pay_period_options = $bootstrap->get_pay_period_options($data['meta_value']); $date_range = x_week_range($pay_period_options['nu']['date_hours'][0], "m/d/Y"); echo '<td class="ui-vertical-middle" >'; echo $pay_period_options['nu']['date_hours'][0] != "default" ? $date_range[0] . " to " . $date_range[1] : "All Pay Periods"; echo '</td>'; echo '<td class="ui-vertical-middle" >'; print_r($pay_period_options['u']['date_hours'][1]); echo '</td>'; echo '<td class="ui-vertical-middle" >'; print_r($pay_period_options['nu']['date_hours'][1]); echo '</td>'; echo '</tr>'; $x++; } ?> </table> <?php
x_month_range($start_date, $end_date, $date); $query = $query . " and post_date BETWEEN '" . date("Y-m-d", strtotime($start_date)) . "' AND '" . date("Y-m-d", strtotime($end_date) + 86400) . "'"; } else { $query = $query . " and post_date like '%" . date("Y-m-d", strtotime($date)) . "%'"; $end_date = $date; } } else { $query = $query . " and post_date like '%" . date("Y-m-d", strtotime($date)) . "%'"; } //echo $query."<br>"; //$last_date=$date; if (isset($_GET['sectionby'])) { if ($_GET['sectionby'] == 'd') { $previousdate = date('d-m-Y', strtotime('-1 days', strtotime($date))); } elseif ($_GET['sectionby'] == 'w') { x_week_range($pre_start_date, $pre_end_date, date('d-m-Y', strtotime('-7 days', strtotime($date)))); $previousdate = $pre_end_date; } elseif ($_GET['sectionby'] == 'm') { $previousdate = date('d-m-Y', strtotime('-1 month', strtotime($date))); } else { $previousdate = date('d-m-Y', strtotime('-1 days', strtotime($date))); } } else { $previousdate = date('d-m-Y', strtotime('-1 days', strtotime($date))); } //echo $query; $rs = $wpdb->get_results($query); /* echo '<pre>'; print_r($rs);
<div class="container cf"> <div class="box-left main-content"> <?php $menu_newsevent = 2; include ('inc/inc-left-content-newsevent.php'); include ('inc/inc-left-content-calendar.php'); ?> </div> <div class="box-right main-content"> <hr class="line-red"/> <div class="box-title-system cf"> <h1><?=$weeklyCap ?></h1> </div> <?php list($start_date, $end_date) = x_week_range(date('Y-m-d')); if ($_SESSION['LANG'] == 'TH'){ $LANG_SQL = 'SUB_CONTENT_CAT_DESC_LOC AS CONTENT_CAT_LOC'; }else if ($_SESSION['LANG'] == 'EN'){ $LANG_SQL = 'SUB_CONTENT_CAT_DESC_ENG AS CONTENT_CAT_LOC'; } $sql = "SELECT SUB_CONTENT_CAT_ID , CONTENT_CAT_ID , "; $sql .= $LANG_SQL; $sql .= " FROM trn_content_sub_category WHERE CONTENT_CAT_ID = ".$all_event_cat_id." AND FLAG = 0 ORDER BY ORDER_DATA DESC"; $querySUB_CAT = mysql_query($sql, $conn); while($rowSUB_CAT = mysql_fetch_array($querySUB_CAT)) { ?> <div class="box-category-main news"> <div class="box-title cf">
?> <table data-role="table" id="employee-table" data-filter="true" data-filter-reveal="false" data-input="#filterTable-input" data-mode="reflow" class="ui-responsive ui-employee-table"> <thead> <tr class="ui-table-thead"> <th >Edit</th> <th data-priority="persist">Full Name</th> <th data-priority="1">Emp. Code</th> <th data-priority="2">Job ID</th> <th>Hours</th> <th data-priority="3">Date</th> <th>Created On</th> </tr> </thead> <?php $last_week = x_week_range($last_week[0], 'Y-m-d'); $queryArgs[0] = "id, CONCAT(firstname,' ', lastname) AS `full_name`, employee_code, job_id, hours, date, createdon"; $queryArgs[1] = "vwTimeEntries"; $queryArgs[2] = ""; $queryArgs[3] = ""; if ($from_date || $to_date) { $queryArgs[4] = " WHERE date >= '" . $from_date . "' AND date <= '" . $to_date . "' ORDER BY job_id, date DESC"; } else { $queryArgs[4] = " WHERE date >= '" . $last_week[0] . "' AND date <= '" . $last_week[1] . "' ORDER BY job_id, date DESC"; } //.$set_start.", ".$records_per_set.""; $records = $bootstrap->mysqliHandler->getArray($queryArgs); $x = 0; foreach ($records as $a_key => $data) { echo '<tr>'; foreach ($data as $key => $value) {
function doTopBreakersOfWeek() { $JSONData = json_decode(file_get_contents('php://input')); $currentUserFBID = $JSONData->fb_id; $showAll = $JSONData->show_all; $lang = $JSONData->lang; $limit = " limit 0,10"; $detailsJSON = array(); $sourceImageFolderPath = UPLOAD_SERVER . "/resources/images/uploads/"; //source image of break $textImageFolderPath = UPLOAD_SERVER . "/resources/images/gallery/"; //with text image of break $dbase = new MyDatabase(DBNAME, DBHOST, DBUSER, DBPASS); $week = x_week_range(date("d F Y 00:00", time())); $startDate = strtotime($week); $endDate = strtotime(date("d F Y 00:00", strtotime("+1 day", strtotime($week["end"])))); if ($showAll == "1") { $limit = ""; } if ($lang == "ar") { $query = "SELECT B.id as break_id,\n B.pid as breaker_id,\n BR.name as breaker_name,\n BR.email as breaker_email,\n BR.profileimage as profileimage,\n BR.socialid as fb_id,\n B.breakid as break_category_id,\n BC.name_ar as break_category_name,\n B.registration_top as upper_text,\n B.registration_bottom as lower_text,\n B.registrationimage as text_image,\n B.imagesource as plain_image,\n (SELECT count(id) FROM likes WHERE registrationid=B.id AND fbid='" . $currentUserFBID . "') as like_status,\n (SELECT COUNT(fbid) FROM likes L WHERE L.registrationid = B.id AND L.datestamp>='{$startDate}' AND L.datestamp<'{$endDate}') AS total_likes FROM breaks B, breakers BR, breakcategory BC \n WHERE B.pid = BR.id and BC.id = B.breakid ORDER BY total_likes DESC " . $limit; } else { $query = "SELECT B.id as break_id,\n B.pid as breaker_id,\n BR.name as breaker_name,\n BR.email as breaker_email,\n BR.profileimage as profileimage,\n BR.socialid as fb_id,\n B.breakid as break_category_id,\n BC.name_en as break_category_name,\n B.registration_top as upper_text,\n B.registration_bottom as lower_text,\n B.registrationimage as text_image,\n B.imagesource as plain_image,\n (SELECT count(id) FROM likes WHERE registrationid=B.id AND fbid='" . $currentUserFBID . "') as like_status,\n (SELECT COUNT(fbid) FROM likes L WHERE L.registrationid = B.id AND L.datestamp>='{$startDate}' AND L.datestamp<'{$endDate}') AS total_likes FROM breaks B, breakers BR, breakcategory BC \n WHERE B.pid = BR.id and BC.id = B.breakid ORDER BY total_likes DESC " . $limit; } $result = $dbase->_query($query); while ($row = mysql_fetch_assoc($result)) { $breakID = $row['break_id']; $breakerID = $row['breaker_id']; $breakerName = $row['breaker_name']; $breakerEmail = $row['breaker_email']; $profileimage = $row['profileimage']; $fbID = $row['fb_id']; $breakCategoryID = $row['break_category_id']; $breakCategoryName = str_replace("<br>", "\n", $row['break_category_name']); $upperText = $row['upper_text']; $lowerText = $row['lower_text']; $textImageName = $row['text_image']; $plainImageName = $row['plain_image']; $tIFullPatth = UPLOAD_SERVER . "/resources/images/gallery/" . $textImageName; $pIFullPatth = UPLOAD_SERVER . "/resources/images/uploads/" . $plainImageName; $like_status = $row['like_status']; $totalLikes = $row['total_likes']; $currentUserLikeStatus = getCurrentUserLikeStatus($breakID, $currentUserFBID); if ($profileimage != "") { $profile_image = UPLOAD_SERVER . "/resources/images/profile/" . $profileimage; } else { $profile_image = ""; } $details = array("break_id" => $breakID, "breaker_id" => $breakerID, "breaker_name" => $breakerName, "breaker_email" => $breakerEmail, "profile_image" => $profile_image, "fb_id" => $fbID, "break_category_id" => $breakCategoryID, "break_category_name" => $breakCategoryName, "upper_text" => $upperText, "lower_text" => $lowerText, "text_image_url" => $textImageURL, "source_image_url" => $sourceImageURL, "like_status" => $like_status, "total_likes" => $totalLikes, "text_image_path" => $tIFullPatth, "plain_image_path" => $pIFullPatth, "current_user_like_status" => $currentUserLikeStatus); $detailsJSON[] = $details; } giveResponseToApp($detailsJSON); }
//echo $query; $rs = $wpdb->get_results($query); $last_date = mysql2date('d-m-Y', $rs[0]->post_date); $date = date('d-m-Y'); $i = 0; while (strtotime($last_date) <= strtotime($date) && $i < 20) { $i++; $query = "SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON wp_posts.ID=wp_postmeta.post_id WHERE post_type='publishment'"; //////////////////////////////////sectionby////////////////////////////////////////// if (isset($_GET['sectionby'])) { if ($_GET['sectionby'] == 'd') { $query = $query . " and post_date like '%" . date("Y-m-d", strtotime($date)) . "%'"; } elseif ($_GET['sectionby'] == 'w') { $start_date; $end_date; x_week_range($start_date, $end_date, $date); $query = $query . " and post_date BETWEEN '" . date("Y-m-d", strtotime($start_date)) . "' AND '" . date("Y-m-d", strtotime($end_date)) . "'"; } elseif ($_GET['sectionby'] == 'm') { x_month_range($start_date, $end_date, $date); $query = $query . " and post_date BETWEEN '" . date("Y-m-d", strtotime($start_date)) . "' AND '" . date("Y-m-d", strtotime($end_date)) . "'"; } else { $query = $query . " and post_date like '%" . date("Y-m-d", strtotime($date)) . "%'"; } } else { $query = $query . " and post_date like '%" . date("Y-m-d", strtotime($date)) . "%'"; } $query = $query . "and meta_value=" . $_GET['moca'] . " group by wp_posts.ID"; //echo $query."<br>"; //$last_date=$date; if (isset($_GET['sectionby'])) { if ($_GET['sectionby'] == 'd') {
public function get_inactiveemployeesreport($date) { $format = 'Y-m-d'; $date_range = x_week_range($date, $format); $week_days = week_dates($date, $format); // Get union data $this->get_union_data(); include 'db.config.php'; $mysqli = new mysqli($operations_dbhost, $operations_dbuser, $operations_dbpass, $operations_dbname); // check connection if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit; } // Employees with time entries for the specified week $query = ' SELECT distinct id, employee_code, firstname, lastname FROM ' . $system_dbname . '.vwEmployeesAndTimeEntries WHERE ( ((date >= "' . $date_range[0] . '") and (date <= "' . $date_range[1] . '")) and (NOT isnull(hours) and (hours > "0" )) and (disabled = "N")) order by employee_code '; $result = $mysqli->query($query); while ($row_data = $result->fetch_assoc()) { $employees_with_time[] = $row_data; $employees_with_time_id[] = $row_data['id']; } // All employees $query = ' SELECT distinct id, employee_code, code, firstname, lastname, title, union_code, issalaried FROM ' . $system_dbname . '.user WHERE disabled = "N" AND employee_code > "0" '; $result = $mysqli->query($query); while ($row_data = $result->fetch_assoc()) { $employees[] = $row_data; $employees_ids[] = $row_data['id']; } foreach ($employees_ids as $key => $employee_id) { foreach ($employees_with_time_id as $employee_with_time) { if ($employee_with_time == $employee_id) { unset($employees[$key]); } } } $report .= '<div class="report-wrapper" ><span><strong>Weekly Inactive Employees</strong><br /> </span><span><strong>Pay Period: ' . $date_range[0] . ' - ' . $date_range[1] . '</strong></span>'; $report .= '<table cellspacing="5" cellpadding="0" >'; $report .= '<thead><tr>'; $report .= '<th>Emp #</th>'; $report .= '<th>Code</th>'; $report .= '<th>Emp Name</th>'; $report .= '<th>Title</th>'; $report .= '<th>Union</th>'; $report .= '<th>Salaried</th>'; $report .= '</tr></thead>'; foreach ($employees as $employee) { $employee['union_code'] = $employee['union_code'] != 0 || $employee['union_code'] == NULL ? substr($employee['union_code'], 0, 3) : ""; // Report Line Items $report .= '<tr>'; $report .= '<td>' . $employee['employee_code'] . '</td>'; $report .= '<td>' . $employee['code'] . '</td>'; $report .= '<td style="white-space:nowrap;">'; $report .= $this->get_user_role() < 2 ? '<a href="employees.php?id=' . $employee['id'] . '" target="_blank" >' . ucwords(strtolower(trim($employee['firstname'] . ' ' . $employee['lastname']))) . '</a>' : '<strong>' . ucwords(strtolower(trim($employee['firstname'] . ' ' . $employee['lastname']))) . '</strong>'; $report .= '</td>'; $report .= '<td style="white-space:nowrap;">' . $employee['title'] . '</td>'; $report .= '<td>' . substr($employee['union_code'], 0, 3) . '</td>'; $report .= '<td>' . $employee['issalaried'] . '</td>'; $report .= '</tr>'; } $report .= '</table></div>'; $mysqli->close(); return $report; }