[FORECAST] Added excel download
This commit is contained in:
parent
d639a9dbec
commit
1fdf7074a5
|
|
@ -13,7 +13,7 @@ echo"<?xml version='1.0' encoding='utf-8'?>";
|
||||||
|
|
||||||
//include getenv("DOCUMENT_ROOT")."/include/session_include.php";
|
//include getenv("DOCUMENT_ROOT")."/include/session_include.php";
|
||||||
|
|
||||||
// Level 6 이하만 사용 가능
|
// Level 6 ÀÌÇϸ¸ »ç¿ë °¡´É
|
||||||
$func->checkLevelModal(7);
|
$func->checkLevelModal(7);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ if ($actionStr == "CUSTOMER") {
|
||||||
|
|
||||||
$strData .= "<Cell><Data ss:Type=\"String\">".$rt_city['a_text']."</Data></Cell>\n";
|
$strData .= "<Cell><Data ss:Type=\"String\">".$rt_city['a_text']."</Data></Cell>\n";
|
||||||
}
|
}
|
||||||
else if /* 2025.06.11 날짜 관련 컬럼 YYYY-MM-DD 로 변경 */
|
else if /* 2025.06.11 ³¯Â¥ °ü·Ã Ä÷³ YYYY-MM-DD ·Î º¯°æ */
|
||||||
(($export_customer[$ii] == 'c_form_eu') ||
|
(($export_customer[$ii] == 'c_form_eu') ||
|
||||||
($export_customer[$ii] == 'c_form_corsia') ||
|
($export_customer[$ii] == 'c_form_corsia') ||
|
||||||
($export_customer[$ii] == 'c_contractdate') ||
|
($export_customer[$ii] == 'c_contractdate') ||
|
||||||
|
|
@ -120,7 +120,7 @@ if ($actionStr == "CUSTOMER") {
|
||||||
|
|
||||||
$strData .= "<Cell><Data ss:Type=\"String\">".$toDateStr."</Data></Cell>\n";
|
$strData .= "<Cell><Data ss:Type=\"String\">".$toDateStr."</Data></Cell>\n";
|
||||||
}
|
}
|
||||||
// 2025.06.11 Note 추가
|
// 2025.06.11 Note Ãß°¡
|
||||||
else if ($export_customer[$ii] == 'n_customeruid') {
|
else if ($export_customer[$ii] == 'n_customeruid') {
|
||||||
|
|
||||||
$query_note = "SELECT * FROM tbl_note
|
$query_note = "SELECT * FROM tbl_note
|
||||||
|
|
@ -162,7 +162,7 @@ if ($actionStr == "CUSTOMER") {
|
||||||
}
|
}
|
||||||
} else if ($actionStr == "OILHISTORY") {
|
} else if ($actionStr == "OILHISTORY") {
|
||||||
|
|
||||||
// Inactive Accounts 도 다운받도록 요청받음 (2024.04.19)
|
// Inactive Accounts µµ ´Ù¿î¹Þµµ·Ï ¿äû¹ÞÀ½ (2024.04.19)
|
||||||
//$query = "SELECT * FROM tbl_customer
|
//$query = "SELECT * FROM tbl_customer
|
||||||
// WHERE c_status = 'A'
|
// WHERE c_status = 'A'
|
||||||
// ORDER BY c_accountno DESC ";
|
// ORDER BY c_accountno DESC ";
|
||||||
|
|
@ -241,7 +241,7 @@ if ($actionStr == "CUSTOMER") {
|
||||||
$strData .= "<Cell><Data ss:Type=\"String\">".$rt_city['a_text']."</Data></Cell>\n";
|
$strData .= "<Cell><Data ss:Type=\"String\">".$rt_city['a_text']."</Data></Cell>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if /* 2025.06.11 날짜 관련 컬럼 YYYY-MM-DD 로 변경 */
|
else if /* 2025.06.11 ³¯Â¥ °ü·Ã Ä÷³ YYYY-MM-DD ·Î º¯°æ */
|
||||||
(($export_oil[$ii] == 'c_form_eu') ||
|
(($export_oil[$ii] == 'c_form_eu') ||
|
||||||
($export_oil[$ii] == 'c_form_corsia') ||
|
($export_oil[$ii] == 'c_form_corsia') ||
|
||||||
($export_oil[$ii] == 'c_contractdate') ||
|
($export_oil[$ii] == 'c_contractdate') ||
|
||||||
|
|
@ -649,6 +649,187 @@ if ($actionStr == "CUSTOMER") {
|
||||||
$list_number++;
|
$list_number++;
|
||||||
//if ($list_number == 100) break;
|
//if ($list_number == 100) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else if ($actionStr == "FORECAST") {
|
||||||
|
$list_number = 1;
|
||||||
|
// For Excel Variable
|
||||||
|
$strData .= "<Row>";
|
||||||
|
foreach ($forecastArray AS $key=>$value)
|
||||||
|
{
|
||||||
|
$strData .= "<Cell><Data ss:Type=\"String\">$value</Data></Cell>\n";
|
||||||
|
}
|
||||||
|
$strData .= "</Row>\n";
|
||||||
|
|
||||||
|
if ($c_type_r == 'R') {
|
||||||
|
$orderdate = str_replace("-", "", $orderdate);
|
||||||
|
$qry_r = "SELECT * FROM tbl_request
|
||||||
|
WHERE r_driveruid ='$org_driveruid' AND r_status = 'A' AND r_requestdate = '$orderdate'
|
||||||
|
ORDER BY r_uid DESC";
|
||||||
|
|
||||||
|
$rt_r=$jdb->nQuery($qry_r, "list error");
|
||||||
|
|
||||||
|
while($list=mysqli_fetch_array($rt_r, MYSQLI_ASSOC)) {
|
||||||
|
for($i=0; $i<sizeof($list); $i++) {
|
||||||
|
//list($key, $value) = each($list);
|
||||||
|
foreach ( (Array) $list as $key => $value )
|
||||||
|
$$key = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$qry_rc = "SELECT * FROM tbl_customer WHERE c_uid = '$r_customeruid'";
|
||||||
|
$rt_rc = $jdb->fQuery($qry_rc, "query error");
|
||||||
|
|
||||||
|
//echo "[$qry_rc]";
|
||||||
|
for($i=0; $i<sizeof($rt_rc); $i++) {
|
||||||
|
//list($key, $value) = each($result);
|
||||||
|
foreach ( (Array) $rt_rc as $key => $value )
|
||||||
|
$$key = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$list_numberSTR = "R";
|
||||||
|
$c_nameSTR = str_replace("\\", "", $c_name);
|
||||||
|
$c_addressSTR = str_replace("\\", "", $c_address);
|
||||||
|
$c_containerSTR = str_replace("\\", "", $c_container);
|
||||||
|
$c_lastpickupdateSTR = $func -> convertFormat ($c_lastpickupdate, 3);
|
||||||
|
$c_fullquantitydateSTR = $func -> convertFormat ($c_fullquantitydate, 3);
|
||||||
|
$c_fullquantityActual = round(floatval($c_fullquantity + ($dDiff * $c_fullquantitydaily)));
|
||||||
|
$c_fullquantitySTR = number_format($c_fullquantityActual);
|
||||||
|
$c_fullcycleSTR = $c_fullcycle;
|
||||||
|
$getThisYear = date("Y");
|
||||||
|
$getLastYear = date("Y", strtotime('last year'));
|
||||||
|
|
||||||
|
$qry_sum = "SELECT
|
||||||
|
SUM(CASE WHEN d_visitdate like '".$getThisYear."%' THEN d_quantity ELSE 0 END) AS THISYEAR,
|
||||||
|
SUM(CASE WHEN d_visitdate like '".$getLastYear."%' THEN d_quantity ELSE 0 END) AS LASTYEAR
|
||||||
|
FROM tbl_daily
|
||||||
|
WHERE d_customeruid = '".$r_customeruid."' AND d_status = 'F' ";
|
||||||
|
$rt_sum = $jdb->fQuery($qry_sum, "fetch query error");
|
||||||
|
|
||||||
|
$getThisYearQ = number_format(floatval($rt_sum['THISYEAR']));
|
||||||
|
$getLastYearQ = number_format(floatval($rt_sum['LASTYEAR']));
|
||||||
|
|
||||||
|
// For Excel Data
|
||||||
|
$strData .= "<Row>";
|
||||||
|
|
||||||
|
foreach ($forecastArray AS $key=>$value) {
|
||||||
|
$strData .= "<Cell><Data ss:Type=\"String\">".$$key."</Data></Cell>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$strData .= "</Row>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($c_type_p == 'P') {
|
||||||
|
$getWeekDay = strtoupper(date('D', strtotime($orderdate)));
|
||||||
|
$orderdate = str_replace("-", "", $orderdate);
|
||||||
|
|
||||||
|
$qry_s = "SELECT * FROM tbl_customer
|
||||||
|
WHERE c_driveruid ='$org_driveruid' AND c_status = 'A'
|
||||||
|
AND (c_schedulebasic = '$orderdate' OR (c_schedule = '1W' AND c_scheduleday LIKE '%".$getWeekDay."%'))
|
||||||
|
ORDER BY c_uid DESC";
|
||||||
|
|
||||||
|
$rt_s=$jdb->nQuery($qry_s, "list error");
|
||||||
|
|
||||||
|
while($list=mysqli_fetch_array($rt_s, MYSQLI_ASSOC)) {
|
||||||
|
for($i=0; $i<sizeof($list); $i++) {
|
||||||
|
//list($key, $value) = each($list);
|
||||||
|
foreach ( (Array) $list as $key => $value )
|
||||||
|
$$key = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$list_numberSTR = "S";
|
||||||
|
$c_nameSTR = str_replace("\\", "", $c_name);
|
||||||
|
$c_addressSTR = str_replace("\\", "", $c_address);
|
||||||
|
$c_containerSTR = str_replace("\\", "", $c_container);
|
||||||
|
$c_lastpickupdateSTR = $func -> convertFormat ($c_lastpickupdate, 3);
|
||||||
|
$c_fullquantitydateSTR = $func -> convertFormat ($c_fullquantitydate, 3);
|
||||||
|
$c_fullquantityActual = round(floatval($c_fullquantity + ($dDiff * $c_fullquantitydaily)));
|
||||||
|
$c_fullquantitySTR = number_format($c_fullquantityActual);
|
||||||
|
$c_fullcycleSTR = $c_fullcycle;
|
||||||
|
$getThisYear = date("Y");
|
||||||
|
$getLastYear = date("Y", strtotime('last year'));
|
||||||
|
|
||||||
|
$qry_sum = "SELECT
|
||||||
|
SUM(CASE WHEN d_visitdate like '".$getThisYear."%' THEN d_quantity ELSE 0 END) AS THISYEAR,
|
||||||
|
SUM(CASE WHEN d_visitdate like '".$getLastYear."%' THEN d_quantity ELSE 0 END) AS LASTYEAR
|
||||||
|
FROM tbl_daily
|
||||||
|
WHERE d_customeruid = '".$c_uid."' AND d_status = 'F' ";
|
||||||
|
$rt_sum = $jdb->fQuery($qry_sum, "fetch query error");
|
||||||
|
|
||||||
|
$getThisYearQ = number_format(floatval($rt_sum['THISYEAR']));
|
||||||
|
$getLastYearQ = number_format(floatval($rt_sum['LASTYEAR']));
|
||||||
|
|
||||||
|
// For Excel Data
|
||||||
|
$strData .= "<Row>";
|
||||||
|
|
||||||
|
foreach ($forecastArray AS $key=>$value) {
|
||||||
|
$strData .= "<Cell><Data ss:Type=\"String\">".$$key."</Data></Cell>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$strData .= "</Row>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// query
|
||||||
|
$query = "SELECT * FROM tbl_customer
|
||||||
|
WHERE c_uid <> '' AND c_status = 'A' " . $orderflagQRY. $driveruidQRY . $typeQRY . $add_srchquery . $newaccountQRY . $dormantaccountQRY . $fullcycleQRY . $fullquantityQRY . $containerQRY . $areaQRY .
|
||||||
|
$add_query_order . $add_query;
|
||||||
|
|
||||||
|
$result=$jdb->nQuery($query, "list error");
|
||||||
|
|
||||||
|
while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
|
||||||
|
for($i=0; $i<sizeof($list); $i++) {
|
||||||
|
foreach ( (Array) $list as $key => $value )
|
||||||
|
$$key = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($c_schedule == 'Will Call') {
|
||||||
|
$list_numberSTR = "W";
|
||||||
|
}
|
||||||
|
else if ($c_schedule != 'Will Call' && $c_schedule != 'None' ) {
|
||||||
|
$list_numberSTR = "S";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$list_numberSTR = $list_number;
|
||||||
|
}
|
||||||
|
$c_nameSTR = str_replace("\\", "", $c_name);
|
||||||
|
$c_addressSTR = str_replace("\\", "", $c_address);
|
||||||
|
$c_containerSTR = str_replace("\\", "", $c_container);
|
||||||
|
$c_lastpickupdateSTR = $func -> convertFormat ($c_lastpickupdate, 3);
|
||||||
|
$c_fullquantitydateSTR = $func -> convertFormat ($c_fullquantitydate, 3);
|
||||||
|
$c_fullquantityActual = round(floatval($c_fullquantity + ($dDiff * $c_fullquantitydaily)));
|
||||||
|
$c_fullquantitySTR = number_format($c_fullquantityActual);
|
||||||
|
if ($c_fullcycleflag == 1) {
|
||||||
|
$c_fullcycleSTR = $c_fullcycleforced;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$c_fullcycleSTR = $c_fullcycle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// year sum
|
||||||
|
$qry_sum = "SELECT
|
||||||
|
SUM(CASE WHEN d_visitdate like '".$getThisYear."%' THEN d_quantity ELSE 0 END) AS THISYEAR,
|
||||||
|
SUM(CASE WHEN d_visitdate like '".$getLastYear."%' THEN d_quantity ELSE 0 END) AS LASTYEAR
|
||||||
|
FROM tbl_daily
|
||||||
|
WHERE d_customeruid = '".$c_uid."' AND d_status = 'F' ";
|
||||||
|
$rt_sum = $jdb->fQuery($qry_sum, "fetch query error");
|
||||||
|
|
||||||
|
$getThisYearQ = number_format(floatval($rt_sum['THISYEAR']));
|
||||||
|
$getLastYearQ = number_format(floatval($rt_sum['LASTYEAR']));
|
||||||
|
|
||||||
|
// For Excel Data
|
||||||
|
$strData .= "<Row>";
|
||||||
|
|
||||||
|
foreach ($forecastArray AS $key=>$value) {
|
||||||
|
$strData .= "<Cell><Data ss:Type=\"String\">".$$key."</Data></Cell>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$strData .= "</Row>\n";
|
||||||
|
$list_number++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addLog ("add", "EXPORT", $actionStr, $_SESSION['ss_ID'], $query, "");
|
addLog ("add", "EXPORT", $actionStr, $_SESSION['ss_ID'], $query, "");
|
||||||
|
|
|
||||||
|
|
@ -921,10 +921,45 @@ $(document).ready(function(){
|
||||||
|
|
||||||
<!-- New -->
|
<!-- New -->
|
||||||
<div class="wrap-border">
|
<div class="wrap-border">
|
||||||
<div style="text-align: right;">
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
<span class="box-will-call">Will Call</span>
|
<div style="text-align: left; width: 220px">
|
||||||
<span class="box-period">Scheduled</span>
|
<? if ($_SESSION['ss_LEVEL'] < 7) { ?>
|
||||||
<span class="box-request">Request</span>
|
<form name="exportorder" id="exportorder" method="POST" action="/doc/export_process.php" style="margin: 0;">
|
||||||
|
<input type="hidden" name="mode" value="export">
|
||||||
|
<input type="hidden" name="actionStr" value="FORECAST">
|
||||||
|
|
||||||
|
<input type="hidden" name="listCnt" value="<?=$listCnt?>">
|
||||||
|
<input type="hidden" name="orderflagQRY" value="<?=$orderflagQRY?>">
|
||||||
|
<input type="hidden" name="driveruidQRY" value="<?=$driveruidQRY?>">
|
||||||
|
<input type="hidden" name="typeQRY" value="<?=$typeQRY?>">
|
||||||
|
<input type="hidden" name="add_srchquery" value="<?=$add_srchquery?>">
|
||||||
|
<input type="hidden" name="newaccountQRY" value="<?=$newaccountQRY?>">
|
||||||
|
<input type="hidden" name="dormantaccountQRY" value="<?=$dormantaccountQRY?>">
|
||||||
|
<input type="hidden" name="dormantaccountQRY" value="<?=$dormantaccountQRY?>">
|
||||||
|
<input type="hidden" name="fullcycleQRY" value="<?=$fullcycleQRY?>">
|
||||||
|
<input type="hidden" name="fullquantityQRY" value="<?=$fullquantityQRY?>">
|
||||||
|
<input type="hidden" name="containerQRY" value="<?=$containerQRY?>">
|
||||||
|
<input type="hidden" name="areaQRY" value="<?=$areaQRY?>">
|
||||||
|
<input type="hidden" name="add_query_order" value="<?=$add_query_order?>">
|
||||||
|
<input type="hidden" name="add_query" value="<?=$add_query?>">
|
||||||
|
<input type="hidden" name="getThisYear" value="<?=$getThisYear?>">
|
||||||
|
<input type="hidden" name="getLastYear" value="<?=$getLastYear?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="c_type_r" value="<?=$c_type_r?>">
|
||||||
|
<input type="hidden" name="c_type_p" value="<?=$c_type_p?>">
|
||||||
|
<input type="hidden" name="c_type_w" value="<?=$c_type_w?>">
|
||||||
|
<input type="hidden" name="org_driveruid" value="<?=$org_driveruid?>">
|
||||||
|
<input type="hidden" name="orderdate" value="<?=$orderdate?>">
|
||||||
|
|
||||||
|
<button type="submit" class="btn-add text-center">DOWNLOAD</button>
|
||||||
|
</form>
|
||||||
|
<? } ?>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<span class="box-will-call">Will Call</span>
|
||||||
|
<span class="box-period">Scheduled</span>
|
||||||
|
<span class="box-request">Request</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><!--wrap-border-->
|
</div><!--wrap-border-->
|
||||||
<!-- New -->
|
<!-- New -->
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<?
|
<?
|
||||||
|
$yearNow = date('Y');
|
||||||
|
$yearLast = $yearNow - 1;
|
||||||
// Array
|
// Array
|
||||||
$arrStatus = array ('I' => 'Inactive', 'A' => 'Active', 'H' => 'Hold', 'D' => 'Delete', 'F' => 'Finish' );
|
$arrStatus = array ('I' => 'Inactive', 'A' => 'Active', 'H' => 'Hold', 'D' => 'Delete', 'F' => 'Finish' );
|
||||||
$arrPaymenttype = array ('CA' => 'Cash', 'CHQ' => 'Cheque', 'DIRECT' => 'Direct Deposit', 'DONATION' => 'Donation', 'EFT' => 'EFT',
|
$arrPaymenttype = array ('CA' => 'Cash', 'CHQ' => 'Cheque', 'DIRECT' => 'Direct Deposit', 'DONATION' => 'Donation', 'EFT' => 'EFT',
|
||||||
|
|
@ -78,4 +79,22 @@ $receiptArray = array(
|
||||||
"d_visitdateSTR"=>"Date", "d_nameSTR"=>"Restaurant Name", "d_accountnoSTR"=>"Account No", "d_addressSTR"=>"Address",
|
"d_visitdateSTR"=>"Date", "d_nameSTR"=>"Restaurant Name", "d_accountnoSTR"=>"Account No", "d_addressSTR"=>"Address",
|
||||||
"d_driverSTR"=>"Driver", "d_quantity"=>"Oil Quantity", "d_payamount"=>"Paid"
|
"d_driverSTR"=>"Driver", "d_quantity"=>"Oil Quantity", "d_payamount"=>"Paid"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$forecastArray = array(
|
||||||
|
"list_numberSTR"=>"No"
|
||||||
|
, "c_nameSTR"=>"Restaurant Name"
|
||||||
|
, "c_accountno"=>"Account"
|
||||||
|
, "c_maincontainer"=>"Container"
|
||||||
|
, "c_containerSTR"=>"Detail"
|
||||||
|
, "c_paymenttype"=>"Payment"
|
||||||
|
, "c_rate"=>"Rate"
|
||||||
|
, "c_addressSTR"=>"Address"
|
||||||
|
, "c_city"=>"City"
|
||||||
|
, "getLastYearQ"=>$yearLast
|
||||||
|
, "getThisYearQ"=>$yearNow
|
||||||
|
, "c_fullcycleSTR"=>"Cycle"
|
||||||
|
, "c_mainvolume"=>"Main Vol."
|
||||||
|
, "c_lastpickupdateSTR"=>"Last PU"
|
||||||
|
, "c_fullquantitySTR"=>"Liter"
|
||||||
|
);
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue