<?

// Level 9 이하만 사용 가능
$func->checkLevelModal(9);

/*
for($i=0; $i<sizeof($_POST); $i++) {
	list($key, $value) = each($_POST);
	$$key = $value;

	if(is_array($value))
	{
		$count = 10;
		for($i = 0; $i < $count; $i ++) {
			if ($value[$i]) echo "ARRAY[$key][$value[$i]]<br>";
		}
	}
	else 	echo "[$key][$value]<br>";
	//print_r($_POST);
}

exit;
*/

// Download 기능 제한 (Admin : 1, Manager : 3, Staff : 5 만 가능)
$permit = array("1", "5", "6", "7", "9");
if (in_array($_SESSION['ss_LEVEL'], $permit)) {
    $setTag = "ENABLED";
}
else $setTag = "DISABLED";	

$time_start = microtime(true);

//$add_query .= "tbl_groups   INNER JOIN naloxca_bbs.tbl_customer ON (tbl_groups.g_uid = tbl_customer.m_gid) ";
$add_srchquery = "";
$add_query = "";


// searching
if($searchtype == "R" && $key_word) {

	$key_wordStr = urldecode(trim($key_word));
	$add_srchquery .= " AND  ((d.d_name LIKE '%$key_wordStr%') OR (d.d_accountno LIKE '%$key_wordStr%') OR (d.d_address LIKE '%$key_wordStr%'))";
}
else if ($searchtype == "D" && $searchDriver) {
	//$add_srchquery .= " AND  d.d_driveruid = '$searchDriver' ";
}

// sorting
if($switch) {
	$switched = $func -> switchOrder($switch, $switched);
	$add_query .= " ORDER BY $switch $switched ";
	$switched = $switch . "^" . $switched;
}else if($switched) {
	$switched1 = explode("^", $switched);
	$add_query .= " ORDER BY $switched1[0] $switched1[1] ";
} else {
	$add_query .= " ORDER BY MAX(d.d_visitdate) DESC, d.d_accountno DESC ";
}

$getSWHStr = $switched;

// $query = "SELECT * FROM tbl_sampletypes 
// INNER JOIN tbl_members ON (tbl_sampletypes.t_uid = tbl_members.m_gid) 
// where tbl_members.m_uid != ''  
// ORDER BY tbl_members.m_uid DESC ";

if ($searchtype == "D" && $searchDriver) {
	$qrySTR = " (c.c_driveruid = '".$searchDriver."') ";
}
else $qrySTR = " (c.c_uid = d.d_customeruid) ";

if ($_SESSION['ss_LEVEL'] == 9) {
	$qrySTR = " (c.c_driveruid = '".$_SESSION['ss_UID']."') ";
}


// Account Status
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') ";
}



//total record
$query = "SELECT count(distinct d.d_accountno) 
					FROM tbl_daily d
					WHERE d.d_customeruid != '' AND d.d_status = 'F' 
						AND d.d_customeruid IN (SELECT c.c_uid FROM tbl_customer c WHERE ".$qrySTR. $status_query. ") " . $add_allquery . $add_srchquery . $add_query;

/*
SELECT count(distinct d.d_accountno) 
FROM tbl_daily d
INNER join tbl_customer c ON (d.d_customeruid = c.c_uid)
WHERE d.d_customeruid != '' AND d.d_status = 'F' 
ORDER BY MAX(d.d_visitdate) DESC, d.d_accountno DESC 

SELECT count(distinct d.d_accountno) 
FROM tbl_daily d
INNER join tbl_customer c ON (d.d_driveruid = c.c_driveruid)
WHERE d.d_customeruid != '' AND d.d_status = 'F' AND d.d_driveruid = '17' 
ORDER BY MAX(d.d_visitdate) DESC, d.d_accountno DESC 
*/

$total_count=$jdb->rQuery($query, "record query error");
//echo "<br><br><br><br><br>[$total_count][$query]<br>";

//페이징변수설정
if(!$page) $page = 1;

if(!$list_count) $list_count = $INIT_PAGECNT; //출력리스트 갯수
if(!$page_count) $page_count = $INIT_PAGEVIEWCNT; //출력페이지 갯수

$list_number = $total_count - (($page-1)*$list_count);
$start_number = $list_count * ($page-1);

$add_query .= " LIMIT $start_number, $INIT_PAGECNT";
$query = "SELECT *, MAX(d.d_uid) as maxuid
					FROM  tbl_daily d
					WHERE d.d_customeruid != '' AND d.d_status = 'F' 
					AND d.d_customeruid IN (SELECT c.c_uid FROM tbl_customer c WHERE ".$qrySTR.$status_query. ") ". $add_srchquery ."
					GROUP BY d.d_accountno " . $add_query;
//echo "<br><br><br><br>[$query]<br><br>";

$result=$jdb->nQuery($query, "list error");

while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
	for($i=0; $i<sizeof($list); $i++) {
		//list($key, $value) = each($list);
		foreach ( (Array) $list as $key => $value )
		$$key = $value;
	}

	//$logindateStr = $func -> convertFormat ($MLOGINDATE, 1);
	//$signupdateStr = $func -> convertFormat ($MSIGNUPDATE, 1);
		
	//$qry = "SELECT CNAME  FROM tbl_company WHERE CUID = '$MCOMPANY' ";
	//$rtd=$jdb->fQuery($qry, "fetch query error"); 
	//if ($MCOMPANY == "0" || $MCOMPANY == "") $companyStr = "-";
	//else $companyStr = $rtd[CNAME];

	/*
	$qry_maxuid = "SELECT * FROM tbl_daily WHERE d_uid = '$maxuid' ";
	$rt_maxuid = $jdb->fQuery($qry_maxuid, "fetch query error");
	//echo "<br><br><br><br><br>[$qry_maxuid]";
	
	$max_sludgeSTR = preg_replace('/[^A-Za-z0-9\-]/', '', $rt_maxuid['d_sludge']);
	if ($max_sludgeSTR != "") $max_sludgeSTR = $max_sludgeSTR;
	else $max_sludgeSTR = "";
	
	$max_nameSTR = str_replace("\\", "", $rt_maxuid['d_name']);
	$max_addressSTR = str_replace("\\", "", $rt_maxuid['d_address']);
	$max_accountnoSTR = str_replace("\\", "", $rt_maxuid['d_accountno']);

	$max_cycle = str_replace("\\", "", $rt_maxuid['d_cycle']);
	$max_paymenttype = str_replace("\\", "", $rt_maxuid['d_paymenttype']);
	*/

	$qry_maxuid = "SELECT * FROM tbl_customer WHERE c_uid = '$d_customeruid' ";
	$rt_maxuid = $jdb->fQuery($qry_maxuid, "fetch query error");
	//echo "<br><br><br><br><br>[$qry_maxuid]";
	
	$max_sludgeSTR = preg_replace('/[^A-Za-z0-9\-]/', '', $rt_maxuid['c_sludge']);
	if ($max_sludgeSTR != "") $max_sludgeSTR = $max_sludgeSTR;
	else $max_sludgeSTR = "";
	
	$max_nameSTR = str_replace("\\", "", $rt_maxuid['c_name']);
	$max_addressSTR = str_replace("\\", "", $rt_maxuid['c_address']);
	$max_accountnoSTR = str_replace("\\", "", $rt_maxuid['c_accountno']);

	$max_cycle = $arrPaymentCycle[str_replace("\\", "", $rt_maxuid['c_paymentcycle'])];
	$max_paymenttype = str_replace("\\", "", $rt_maxuid['c_paymenttype']);
	
	$qry_dvr = "SELECT m_initial FROM tbl_member WHERE m_uid = '".$rt_maxuid['c_driveruid']."' ";
	$rt_dvr = $jdb->fQuery($qry_dvr, "fetch query error");

	//$qry_eu = "SELECT c_form_eu FROM tbl_customer WHERE c_driveruid = '".$rt_maxuid['d_driveruid']."' ";
	//$rt_eu = $jdb->fQuery($qry_eu, "fetch query error");
	
	///////////////////////
	// Get Monthly Quantity
	///////////////////////
	$get1Mon = date("Ym");
	//$get2Mon = date("Ym", strtotime('-1 month -2 day'));
	//$get3Mon = date("Ym", strtotime('-2 month'));
	//$get4Mon = date("Ym", strtotime('-3 month'));
	$get1_12Mon = date("Y");

	$dt = new DateTime();
	$day = $dt->format('j');
	$dt->modify('first day of -1 month');
	$dt->modify('+' . (min($day, $dt->format('t')) - 1) . ' days');
	$get2Mon = $dt->format('Ym');

	$dt = new DateTime();
	$day = $dt->format('j');
	$dt->modify('first day of -2 month');
	$dt->modify('+' . (min($day, $dt->format('t')) - 1) . ' days');
	$get3Mon = $dt->format('Ym');

	$dt = new DateTime();
	$day = $dt->format('j');
	$dt->modify('first day of -3 month');
	$dt->modify('+' . (min($day, $dt->format('t')) - 1) . ' days');
	$get4Mon = $dt->format('Ym');

	//echo "<br><br><br><br>[$get1Mon][$get2Mon][$get3Mon][$ttt1][$ttt2][$ttt3]<br>";
	
	$qry_sum = "SELECT 
								SUM(CASE WHEN d_visitdate like '".$get1Mon."%' THEN d_quantity ELSE 0 END) AS MON_1, 
								SUM(CASE WHEN d_visitdate like '".$get2Mon."%' THEN d_quantity ELSE 0 END) AS MON_2,
								SUM(CASE WHEN d_visitdate like '".$get3Mon."%' THEN d_quantity ELSE 0 END) AS MON_3,
								SUM(CASE WHEN d_visitdate like '".$get4Mon."%' THEN d_quantity ELSE 0 END) AS MON_4,
								SUM(CASE WHEN d_visitdate like '".$get1_12Mon."%' THEN d_quantity ELSE 0 END) AS YEAR_1
							FROM  tbl_daily 
							WHERE d_customeruid = '".$rt_maxuid['c_uid']."' AND d_status = 'F'
							ORDER BY d_visitdate DESC ";
//echo "LIST_TOT[$qry_sum]<br>";							
	$rt_sum = $jdb->fQuery($qry_sum, "fetch query error");
	
	$get1MonQ = number_format(floatval($rt_sum['MON_1']));
	$get2MonQ = number_format(floatval($rt_sum['MON_2']));
	$get3MonQ = number_format(floatval($rt_sum['MON_3']));
	$get4MonQ = number_format(floatval($rt_sum['MON_4']));
	$get2_4MonQ = number_format(floatval($rt_sum['MON_2'] + $rt_sum['MON_3'] + $rt_sum['MON_4']));
	$get1_12MonQ = number_format(floatval($rt_sum['YEAR_1']));


	$strList .= "
            <tr>
              <td>$list_number</td>
							<td onclick=\"location.href='/index_intranet.php?view=oilhistory_detail&d_customeruid=".$rt_maxuid['c_uid']."&searchtype=$searchtype&searchDriver=$searchDriver&page=$page&key_word=$key_word&column=$column&switched=$getSWHStr&sorting_type=$sorting_type&switch=$switch&mode=$mode&cstatus=$cstatus'\" style='cursor:pointer;cursor:hand;'><b class='customer-info-detail'>$max_nameSTR</b></td>
              <td>$max_accountnoSTR </td>
              <td>$max_paymenttype </td>
              <td>".$rt_maxuid['c_rate']." </td>
              <td>$max_sludgeSTR </td>
              <td>$max_cycle </td>
              <td>$max_addressSTR </td>
              <td>".$rt_dvr['m_initial']."</td>
              <td style=\"text-align: right;margin-right: 20px;\">$get1MonQ </td>
              <td style=\"text-align: right;margin-right: 20px;\">$get2MonQ </td>
              <td style=\"text-align: right;margin-right: 20px;\">$get3MonQ </td>
              <td style=\"text-align: right;margin-right: 20px;\">$get4MonQ </td>
              <td style=\"text-align: right;margin-right: 20px;\">$get2_4MonQ </td>
              <td style=\"text-align: right;margin-right: 20px;\">$get1_12MonQ </td>
            </tr>
	";

	$list_number--;
}


if( $total_count < 1 ) {
	$strList = "
		<tr><td colspan='15' align=center height='30'><B>No Data</B></td></tr>
		";
}


/////////////////////////////////
// Get TOTAL / EU Pickup Quantity
/////////////////////////////////

if (($searchtype == "D" && $searchDriver && $setTag == "ENABLED") || ($_SESSION['ss_LEVEL'] == 9)) {
			if ($_SESSION['ss_LEVEL'] == 9 ) $searchDriver = $_SESSION['ss_UID'];
			// EU Pickup
			$qry_eu = "SELECT 
										SUM(CASE WHEN d_visitdate like '".$get1Mon."%' THEN d_quantity ELSE 0 END) AS MON_1, 
										SUM(CASE WHEN d_visitdate like '".$get2Mon."%' THEN d_quantity ELSE 0 END) AS MON_2,
										SUM(CASE WHEN d_visitdate like '".$get3Mon."%' THEN d_quantity ELSE 0 END) AS MON_3,
										SUM(CASE WHEN d_visitdate like '".$get4Mon."%' THEN d_quantity ELSE 0 END) AS MON_4,
										SUM(CASE WHEN d_visitdate like '".$get1_12Mon."%' THEN d_quantity ELSE 0 END) AS YEAR_1
									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 = '".$searchDriver."' ". $status_query. "))
										AND d_form_eu != '' AND d_form_eu <= d_orderdate ";
//echo "<br><br><br><br><br>EU[$qry_eu]<br>";			
			$rt_eu = $jdb->fQuery($qry_eu, "fetch query error");
			
			$get1MonEU = number_format(floatval($rt_eu['MON_1']));
			$get2MonEU = number_format(floatval($rt_eu['MON_2']));
			$get3MonEU = number_format(floatval($rt_eu['MON_3']));
			$get4MonEU = number_format(floatval($rt_eu['MON_4']));
			$get1_12MonEU = number_format(floatval($rt_eu['YEAR_1']));

			// Total
			$qry_tot = "SELECT 
										SUM(CASE WHEN d_visitdate like '".$get1Mon."%' THEN d_quantity ELSE 0 END) AS MON_T1, 
										SUM(CASE WHEN d_visitdate like '".$get2Mon."%' THEN d_quantity ELSE 0 END) AS MON_T2,
										SUM(CASE WHEN d_visitdate like '".$get3Mon."%' THEN d_quantity ELSE 0 END) AS MON_T3,
										SUM(CASE WHEN d_visitdate like '".$get4Mon."%' THEN d_quantity ELSE 0 END) AS MON_T4,
										SUM(CASE WHEN d_visitdate like '".$get1_12Mon."%' THEN d_quantity ELSE 0 END) AS YEAR_T1
									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 = '".$searchDriver."' ". $status_query. "))";
//echo "TOT[$qry_tot]<br>";													
			$rt_tot = $jdb->fQuery($qry_tot, "fetch query error");
			
			$get1MonTOT = number_format(floatval($rt_tot['MON_T1']));
			$get2MonTOT = number_format(floatval($rt_tot['MON_T2']));
			$get3MonTOT = number_format(floatval($rt_tot['MON_T3']));
			$get4MonTOT = number_format(floatval($rt_tot['MON_T4']));
			$get1_12MonTOT = number_format(floatval($rt_tot['YEAR_T1']));				
}
	


// 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"); 

while($lt_driver=mysqli_fetch_array($rt_driver, MYSQLI_ASSOC)) {

	if ($lt_driver['m_uid'] == $searchDriver) $selectStr = "selected";
	else $selectStr = "";
	
	$c_driveruidSTR .= "
								<option value='".$lt_driver['m_uid']."' $selectStr>".$lt_driver['m_initial']."</option>";
								
}




// 검색시 조건 유지를 위해
if ($searchtype == 'D') $setDisplayRStr = " style='DISPLAY:none'";
else if ($searchtype == 'R' || $searchtype == '') $setDisplayDStr = " style='DISPLAY:none'";

$time_end = microtime(true);
$timeStr = " [".round(($time_end - $time_start),2)."]";

//addLog ("add", "OIL HISTORY LIST".$timeStr, "VIEW", $lguserid, $query, $lgno);

?>


	
<SCRIPT language=javascript>
		
function viewCont(){
	  obj = document.getElementById("searchtype").value; 
	  
	//ttt= obj.checked;
	//alert(obj);

	if (obj == 'R') {
		//document.memberInfo.partnerfnc.style.display = "none";
		document.getElementById("driverfnc").style.display="none";
		document.getElementById("restnamefnc").style.display="inline";
		//alert('0');
	}	
	else if ((obj == 'D')) {
		//document.memberInfo.partnerfnc.style.display = "inline";
		document.getElementById("driverfnc").style.display="inline";
		document.getElementById("restnamefnc").style.display="none";
		//alert('4');
	}

}

</SCRIPT>


<SCRIPT TYPE="TEXT/JAVASCRIPT">
$(document).ready(function(){


    $("#form_cstatus").change(function(){
        //$(this).css("background-color", "#FFD2A6");
        document.getElementById("searchtypeaccount").value = document.getElementById("searchtype").value; 
        $('#form_cstatus').submit();
    }); 
		
});

</SCRIPT>
  <main id="main" class="main">

    <!-- ======= Breadcrumbs ======= -->
    <div class="breadcrumbs">
      <div class="container">

        <div class="d-flex justify-content-between align-items-center">
          <h2>OIL HISTORY</h2>
          <ol>
            <li><a href="index.html">HOME</a></li>
            <li>OIL HISTORY</li>
          </ol>
        </div>

      </div>
    </div><!-- End Breadcrumbs -->

    <section class="page">


      <div class="container" data-aos="fade-up">
        <div class="wrap-border">
						
						<FORM METHOD=POST NAME=form2 action='<?=$_SERVER["PHP_SELF"]?>' class="form-customer">
						<INPUT TYPE=HIDDEN NAME=view VALUE='oilhistory_list'>
						<input type=hidden name=cstatus value="<?=$cstatus?>">
						
            <table class="table-search-customer">
              <tr>
                <td class="td-title">

                  <select name="searchtype" id="searchtype" class="custom-select" onChange="viewCont();">
                    <option value="R" <?=($searchtype=="R" || $searchtype=="")?"selected":"";?>>Restaurant</option>

<? if ($_SESSION['ss_LEVEL'] != 9) { ?>
                    <option value="D" <?=($searchtype=="D")?"selected":"";?>>Driver</option>
<? } ?>

                  </select>

                </td>
                <td class="td-title">

										<div id="restnamefnc" <?=$setDisplayRStr?>>
		                    <div class="search-container">
		                        <input name="key_word" id="key_word" class="" type="text" placeholder="Search..">
		                        <button type="submit"><i class="bi-search"></i></button>
		                    </div>
										</div>
    
          </FORM>

										<div id="driverfnc" <?=$setDisplayDStr?>>
													<FORM METHOD=POST NAME=form2 action='<?=$_SERVER["PHP_SELF"]?>'>
													<INPUT TYPE=HIDDEN NAME=view VALUE='oilhistory_list'>
													<input type=hidden name=cstatus value="<?=$cstatus?>">
													<INPUT TYPE=HIDDEN NAME=searchtype VALUE='D'>
																<select name="searchDriver" id="searchDriver" class="custom-select" onChange="this.form.submit()">
																<option value=''>Select</option>
																<?=$c_driveruidSTR?>
																</select>		
													</FORM>	
										</div>

                </td>
                
                <td style="text-align:left;padding-right:20px;">

                    <div class="search-container">
            <FORM method=post id="form_cstatus" name="form_cstatus" action='<?=$_SERVER["PHP_SELF"]?>' class="form-forecast-search">
            	<input type=hidden name=view value='oilhistory_list'>
							<input type=hidden name=switched value="<?=$getSWHStr?>">
							<input type=hidden name=page value="<?=$page?>">
							<input type=hidden name=key_word value="<?=$key_word?>">
							<input type=hidden name=column value="<?=$column?>">
							<input type=hidden name=sorting_type value="<?=$sorting_type?>">
							<input type=hidden name=switch value="<?=$switch?>">
							<INPUT TYPE=HIDDEN NAME=searchtype id=searchtypeaccount VALUE='<?=$searchtype?>'>
							<input TYPE=hidden NAME=searchDriver VALUE="<?=$searchDriver?>">
                <select name="cstatus" id="cstatus" class="custom-select1" required='required'>
                  <option value='A' <?=($cstatus == "A")?"selected":"";?>>Active Account</option>
                  <option value='I' <?=($cstatus == "I")?"selected":"";?>>Inactive Account</option>
                  <option value='T' <?=($cstatus == "T")?"selected":"";?>>All Account</option>
                </select>    
                <!--label class='container-chk'>Include Inactive Account
                    <input type='checkbox' name='cstatus' id='cstatus' value="1" <? if($cstatus==1)echo"checked";?>>
                    <span class='checkmark'></span>
                </label-->    
            </FORM>    
											</div>                        
                </td>
                
                                
<? if ($ddddd == 1) { ?>
                <td class="td-title">

											  	<!--DIV id="monthfnc" <?=$setDisplayYMDStr?>> 
														Year<?=$strYear?>
													</DIV>
													<DIV id="periodfnc" <?=$setDisplayYMStr?>>   
														Year<?=$strYear?>
														Month<?=$strMonth?>-->
                    <!--div class="search-container">
                        <input class="" type="text" placeholder="Search.." name="search">
                        <button type="submit"><i class="bi-search"></i></button>
                    </div-->

                </td>
<? } ?>                
                <td align="right">

<? if ($_SESSION['ss_LEVEL'] < 7) { ?>
<FORM NAME=exportorder id=exportorder METHOD=POST ACTION=/doc/export_process.php >
<input type=hidden name=mode value="export">
<input type=hidden name=actionStr value="OILHISTORYSUM">
<input TYPE=hidden NAME=searchtype VALUE="<?=$searchtype?>">
<input TYPE=hidden NAME=searchDriver VALUE="<?=$searchDriver?>">
<input type=hidden name=cstatus value="<?=$cstatus?>">
										<button type='submit' href="#" class="btn-add text-center">DOWNLOAD</button>
</FORM>
<? } ?>

                </td>
              </tr>
            </table>

        </div><!--wrap-border-->
  
<? if (($searchtype == "D" && $setTag == "ENABLED") || ($_SESSION['ss_LEVEL'] == 9 && $key_word =="")) { ?>
        <div class="container section-oil-history-details" data-aos="fade-up">
          <h5 class="h5-title">Driver : <span><?=$rt_dvr['m_initial']?></span></h5>
          <table class="tb-info-box oil-qty-tb">
            <tr>
              <td class="td-title-info">Period</td>
              <td class="td-title-info">1M</td>
              <td class="td-title-info">2M</td>
              <td class="td-title-info">3M</td>
              <td class="td-title-info">4M</td>
              <td class="td-title-info">Yearly</td>
            </tr>
            <tr>
              <td class="td-text-info">ISCC Oil Quantity</td>
              <td class="td-text-info"><span><?=$get1MonTOT?></span> / <span class="sp-oil"><?=$get1MonEU?></span></td>
              <td class="td-text-info"><span><?=$get2MonTOT?></span> / <span class="sp-oil"><?=$get2MonEU?></span></td>
              <td class="td-text-info"><span><?=$get3MonTOT?></span> / <span class="sp-oil"><?=$get3MonEU?></span></td>
              <td class="td-text-info"><span><?=$get4MonTOT?></span> / <span class="sp-oil"><?=$get4MonEU?></span></td>
              <td class="td-text-info"><span><?=$get1_12MonTOT?></span> / <span class="sp-oil"><?=$get1_12MonEU?></span></td>
            </tr>
          </table>
        </div>
<? } ?>


        <div class="wrap-overflow forecast-info">
          <table class="tb-list">
            <tr>
                <th>No</th>
                <th class="td-restaurant">Restaurant Name</th>
                <th class="oil-account">Account</th>
                <th class="oil-payment">Payment</th>
                <th class="oil-rate">Rate</th>
                <th class="oil-sludge">Sludge</th>
                <th class="oil-pcycle">P. Cycle</th>
                <th class="td-address">Address</th>
                <th class="oil-driver">Driver</th>
                <th class="oil-1m">1M</th>
                <th class="oil-2m">2M</th>
                <th class="oil-3m">3M</th>
                <th class="oil-4m">4M</th>
                <th class="oil-2m4m">2-4M</th>
                <th class="oil-yearly">Yearly</th>
            </tr>

<?=$strList?>

<!--
            <tr>
              <td>1</td>
              <td>Restaurant Name</td>
              <td>GD221150</td>
              <td>CHQ</td>
              <td>20%</td>
              <td>A</td>
              <td>145 Kingston Rd. Nork Yorth, ON M1K 7Y8</td>
              <td>D.S</td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
            </tr>

            
            <tr>
              <td>2</td>
              <td>Restaurant Name</td>
              <td>GD221150</td>
              <td>CHQ</td>
              <td>10%</td>
              <td>A</td>
              <td>145 Kingston Rd. Nork Yorth, ON M1K 7Y8</td>
              <td>D.S</td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
            </tr>
            
            <tr>
              <td>3</td>
              <td>Restaurant Name</td>
              <td>GD221150</td>
              <td>CHQ</td>
              <td>-</td>
              <td>A</td>
              <td>145 Kingston Rd. Nork Yorth, ON M1K 7Y8</td>
              <td>D.S</td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
            </tr>
            
            <tr>
              <td>4</td>
              <td>Restaurant Name</td>
              <td>GD221150</td>
              <td>CHQ</td>
              <td>10%</td>
              <td>A</td>
              <td>145 Kingston Rd. Nork Yorth, ON M1K 7Y8</td>
              <td>D.S</td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
              <td>400 </td>
            </tr>
-->

          </table>
        </div>


        <div class="container-inner">
          <div class="pagination">
            <!--a href="#" ><i class="bi bi-arrow-left"></i></a>
            <a href="#"class="active">1</a>
            <a href="#">2</a>
            <a href="#">3</a>
            <a href="#">4</a>
            <a href="#">5</a>
            <a href="#">6</a>
            <a href="#"><i class="bi bi-arrow-right"></i></a-->
					<?

					$page_string = "view=$view&searchtype=$searchtype&searchDriver=$searchDriver&key_word=$key_word&key_CTGSEQ=$key_CTGSEQ&column=$column&mode=$mode&cstatus=$cstatus&switched=$getSWHStr";
					$paging = new PAGE('page',$total_count,$list_count,$page_count,$page,$page_string,'#c71930','','','#c71930','');

					?>
            
          </div>
        </div>
        

        <!--div class="row text-center">
          <div class="col-sm-4 item-inner">
          <a class="btn-sub" href="#">LIST</a>
         </div>
        </div-->


      </div>

        

    </section>



</div><!--container Ends-->
    </section>

  </main><!-- End #main -->
  
  
  
<?

$time_htmlend = microtime(true);
$timehtmlStr = " [".round(($time_htmlend - $time_start),2)."]";

addLog ("add", "OIL HISTORY LIST".$timeStr.$timehtmlStr, "VIEW", $lguserid, $query, $lgno);

?>  