// Level 9 이하만 사용 가능
$func->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 " [$startYear][$tmp]";
$startYear = str_replace("-", "", trim($startYear));
if ($startYear =="") {
$startYear = date("Y");
//$date = new DateTime('PREVIOUS MONTH');
//$startYear = $date->format('Y');
}
for($ii=2025; $ii<= date("Y"); $ii++) {
if ($ii == $startYear) $selectedTag = "selected";
else $selectedTag = "";
$yearSTR .= "$ii ";
}
//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 = "
".$monthArray[$mmonth]." ";
$startYearMonth = $startYear.sprintf("%02d", $mmonth);
foreach ($driverArray as $kkey => $vvalue) {
/////////////////
// ISCC Data
/////////////////
$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_iscc) AS quantity_iscc, sum(rd_quantity_corsia) AS quantity_corsia
FROM tbl_report_daily WHERE rd_driveruid = '".$kkey."' AND rd_orderdate LIKE '".$startYearMonth."%' ";
$rt_sum = $jdb->fQuery($qry_sum, "list error");
//echo "[$qry_sum] ";
$rowISCCSTR .= "".number_format(floatval($rt_sum['quantity_iscc']))." ";
$rowCORSIASTR .= "".number_format(floatval($rt_sum['quantity_corsia']))." ";
$rowSubTOTALSTR .= "".number_format(floatval($rt_sum['quantity_iscc'])+floatval($rt_sum['quantity_corsia']))." ";
$rowSubISCC += floatval($rt_sum['quantity_iscc']);
$rowSubCORSIA += floatval($rt_sum['quantity_corsia']);
$driverCnt++;
}
$rowSub = $rowSubISCC + $rowSubCORSIA;
if ($rowSub != 0) {
$rowPercentISCC = (floatval($rowSubISCC)/($rowSub))*100;
$rowPercentCORSIA = (floatval($rowSubCORSIA)/($rowSub))*100;
}
else {
$rowPercentISCC = 0;
$rowPercentCORSIA = 0;
}
//echo "[$rowPercentISCC][$rowPercentCORSIA][$rowSub][$rowSubISCC][$rowSubCORSIA] ";
$rowMonthSTR .= $rowISCCSTR."".number_format(floatval($rowSubISCC))." ".$rowPercentISCC."% \n";
$rowMonthSTR .= "
ISCC/CORSIA REPORT
HOME
REPORT
ISCC/CORSIA REPORT
ISCC/CORSIA Report (=$startYear?>)
Yearly ISCC/CORSIA Volumes (L)
ISCC
=number_format(floatval($rowYearISCC))?>
=$rowPercentYearISCC?>%
CORSIA
=number_format(floatval($rowYearCORSIA))?>
=$rowPercentYearCORSIA?>%
TOTAL
=number_format(floatval($rowYear))?>
=$titleSTR?>
=$rowMonthSTR?>