checkLevelModal(9); // 기능 제한 (Admin : 1, Staff : 5, Accounting : 6, Driver : 9 만 가능) $permit = array("1", "3", "5", "6", "7", "9"); if (in_array($_SESSION['ss_LEVEL'], $permit)) { $setTag = "ENABLED"; } else { $setTag = "DISABLED"; $msg = "Sorry, You don't have permission. Please contact Administrator."; $func -> modalMsg ($msg, "/index_intranet.php"); exit(); } //echo "





[$startYearMonth][$tmp]"; $startYearMonth = str_replace("-", "", trim($startYearMonth)); if ($startYearMonth =="") { //$startYearMonth = date("Ym"); $date = new DateTime('PREVIOUS MONTH'); $startYearMonth = $date->format('Ym'); } //total record $query = "SELECT COUNT(m_uid) FROM tbl_member WHERE m_level = 9 AND m_status = 'A' "; $driver_cnt=$jdb->rQuery($query, "record query error"); // Get Driver Info $qry_driver = "SELECT * FROM tbl_member WHERE m_level = 9 AND m_status = 'A' ORDER by m_initial ASC "; $rt_driver = $jdb->nQuery($qry_driver, "list error"); $driverArray = array(); $driverCnt = 0; $weekly_data = array(); $getLastday = date('t', strtotime($startYearMonth."10")); //echo "[$startYearMonth][$getLastday]
"; // Get Driver with Title $titleSTR = " "; while($lt_driver=mysqli_fetch_array($rt_driver, MYSQLI_ASSOC)) { $driverArrayTmp = array($lt_driver['m_uid'] => $lt_driver['m_initial']); $driverArray += $driverArrayTmp; $titleSTR .= "".$lt_driver['m_initial'].""; } $titleSTR .= "\n"; // Get Oil Quantity $rowOilSTR = " Oil Pickup Volumes(L)"; $rowOilTonSTR = " (Mton)"; $rowVisitSTR = " # of Account Visits"; $rowAccountSTR = " Total Accounts"; $EUDataSTR = " ISCC Oil Volumes"; $rowNewSTR = " Total Contracts"; $colorArray = array("#3366CC","#DC3912"); // Account Status // cstatus => A : Active, I : Inactive, T : Total $cstatus = 'T'; if ($cstatus == 'T') $status_query = " AND (c.c_status = 'A' OR c.c_status = 'I') "; else if ($cstatus == 'I') $status_query = " AND (c.c_status = 'I') "; else { $cstatus = 'A'; $status_query = " AND (c.c_status = 'A') "; } foreach ($driverArray as $kkey => $vvalue) { // ISCC Oil Volumes => 새로운 메뉴로 이동 (2025.06.12) /* $qry_eu = "SELECT SUM(CASE WHEN d_visitdate like '".$startYearMonth."%' THEN d_quantity ELSE 0 END) AS EUDATA FROM tbl_daily WHERE d_customeruid != '' AND d_status = 'F' AND (d_customeruid IN (SELECT c.c_uid FROM tbl_customer c WHERE c.c_driveruid = '".$kkey."' ". $status_query. ")) AND d_form_eu != '' AND d_form_eu <= d_orderdate "; //echo "




EU[$qry_eu]
"; $rt_eu = $jdb->fQuery($qry_eu, "fetch query error"); $EUDataSTR .= "".number_format(floatval($rt_eu['EUDATA'])).""; */ $qry_sum = "select sum(rd_quantity) AS quantity, sum(rd_visit) AS visitno FROM tbl_report_daily WHERE rd_driveruid = '".$kkey."' AND rd_orderdate LIKE '".$startYearMonth."%' "; $rt_sum = $jdb->fQuery($qry_sum, "list error"); //echo "[$qry_sum]
"; $rowOilSTR .= "".number_format(floatval($rt_sum['quantity'])).""; $rowOilTonSTR .= "".number_format(floatval($rt_sum['quantity'])*0.00091068,1).""; $rowVisitSTR .= "".(int)$rt_sum['visitno'].""; $colorSTR = $colorArray[$driverCnt%2]; $graphOilTonSTR .= "['".$vvalue."' ,".number_format(floatval($rt_sum['quantity'])*0.00091068,1).", '".$colorSTR."'],"; $graphVisitSTR .= "['".$vvalue."' ,".(int)$rt_sum['visitno'].", '".$colorSTR."'],"; $qry_acc = "select sum(ra_account) AS accountno, sum(ra_accountnew) AS newaccount FROM tbl_report_account WHERE ra_driveruid = '".$kkey."' AND ra_month ='".$startYearMonth."' "; $rt_acc = $jdb->fQuery($qry_acc, "list error"); //echo "[$qry_acc]
"; $rowAccountSTR .= "".(int)$rt_acc['accountno'].""; $rowNewSTR .= "".(int)$rt_acc['newaccount'].""; $driverCnt++; } $rowOilSTR .= "\n"; $rowOilTonSTR .= "\n"; $EUDataSTR .= "\n"; $rowVisitSTR .= "\n"; $rowAccountSTR .= "\n"; $rowNewSTR .= "\n"; $startYearMonthTmp = substr($startYearMonth,0,4)."-".substr($startYearMonth,4,2); ?>

Monthly Drivers Report ()




Oil Pickup Volume (Mton)


Total Visits