[LOGIN] Added version info.
[EXPORT] Added oil history daily download button. Applied team using checkbox.
This commit is contained in:
Hyojin Ahn 2026-03-26 11:03:12 -04:00
parent 4d3804dbdb
commit 95cdc81b15
5 changed files with 315 additions and 563 deletions

View File

@ -36,16 +36,46 @@ $customerSTR .= "</tr>";
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$('input[name="columnPreset"]').change(function(){
$("#checkboxallcustomer").click(function () { let type = $(this).val();
$('#checkboxcustomer input:checkbox:not(:disabled)').not('this').prop('checked', this.checked);
});
$("#exportcustomer").submit(function() { $('#checkboxcustomer input:checkbox:not(:disabled)').prop('checked', false);
$("input").removeAttr("disabled");
}); if(type == "CS"){
presetCS.forEach(col => $('#customer_'+col).prop('checked', true));
}
if(type == "PL"){
presetPL.forEach(col => $('#customer_'+col).prop('checked', true));
}
if(type == "ALL"){
$('#checkboxcustomer input:checkbox:not(:disabled)').prop('checked', true);
}
if(type == "CLEAR"){
$('#checkboxcustomer input:checkbox:not(:disabled)').prop('checked', false);
}
});
$('#checkboxcustomer input[type=checkbox]').change(function(){
$('input[name="columnPreset"]').prop('checked', false);
});
$("#checkboxallcustomer").click(function () {
$('#checkboxcustomer input:checkbox:not(:disabled)').not('this').prop('checked', this.checked);
});
$("#exportcustomer").submit(function() {
$("input").removeAttr("disabled");
});
}); });
const presetCS = <?=json_encode(array_keys($customerArray_cs))?>;
const presetPL = <?=json_encode(array_keys($customerArray_pl))?>;
</script> </script>
@ -82,307 +112,20 @@ $(document).ready(function(){
<input type=hidden name=actionStr value="CUSTOMER"> <input type=hidden name=actionStr value="CUSTOMER">
<table id="checkboxcustomer" class="td-search"> <table id="checkboxcustomer" class="td-search">
<tr>
<td>
<div class="radio-segment" style="margin:4px;">
<label><input type="radio" name="columnPreset" value="CS"><span>CS</span></label>
<label><input type="radio" name="columnPreset" value="PL"><span>PL</span></label>
<label><input type="radio" name="columnPreset" value="ALL" checked><span>ALL</span></label>
<label><input type="radio" name="columnPreset" value="CLEAR"><span>Clear</span></label>
</div>
</td>
<td>
<div class="text-center" style="margin:4px;"><button class="btn-sub" type="submit">CSV DOWNLOAD</button></div>
</td>
</tr>
<?=$customerSTR ?> <?=$customerSTR ?>
<!--
<tr>
<td>
<label class="container-chk">Account No
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Account Status
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Restaurant Name
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Driver
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Address
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">City
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Postal Code
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Area
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Phone
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Ext
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Cell
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Rate
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Payment
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Main Container
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Container Detail
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Container Location
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Pickup Schedule
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Pickup Weekday
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Main Container
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Cycle
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Forced Cycle
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Sludge
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Comment
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Contract Date
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Form
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">US
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">EU Date
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Contact By
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Email
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Removal Date
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Sales Person
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Sales Method
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Sale Commission Date
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Install Date
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">First Pickup Date
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Payable To
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Payment Cycle
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Mailing Address
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Comment
<input type="checkbox" name="export_customer[]" value="c_accountno" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
-->
<tr>
<td colspan="2"></td>
<td>
<label class="container-chk">Select All
<input type="checkbox" name="checkboxallcustomer" id="checkboxallcustomer" checked="checked" value="1">
<span class="checkmark"></span>
</label>
</td>
<td>
<div class="text-center"><button class="btn-sub" type="submit">CSV DOWNLOAD</button></div>
</td>
</tr>
</table> </table>

View File

@ -9,8 +9,8 @@ $func->checkLevelModal(7);
// EXPORT - OIL HISTORY // EXPORT - OIL HISTORY
////////////////////////////////// //////////////////////////////////
$oil_cnt = 2; $oil_cnt = 1;
//$oilSTR = "<tr>"; $oilSTR .= "<tr>";
foreach ($oilhistoryArray AS $key=>$value) foreach ($oilhistoryArray AS $key=>$value)
{ {
//echo "[$key][$value]"; => [0][Waiting][1][Confirmed][E][Declined]... //echo "[$key][$value]"; => [0][Waiting][1][Confirmed][E][Declined]...
@ -42,10 +42,34 @@ $thisMonth = date("Y-m")."-01";
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$("#checkboxalloil").click(function () { $('input[name="columnPreset"]').change(function(){
$('#checkboxoil input:checkbox:not(:disabled)').not('this').prop('checked', this.checked);
}); let type = $(this).val();
$('#checkboxoil input:checkbox:not(:disabled)').prop('checked', false);
if(type == "ACC"){
presetACC.forEach(col => $('#oil_'+col).prop('checked', true));
}
if(type == "MKT"){
presetMKT.forEach(col => $('#oil_'+col).prop('checked', true));
}
if(type == "ALL"){
$('#checkboxoil input:checkbox:not(:disabled)').prop('checked', true);
}
if(type == "CLEAR"){
$('#checkboxoil input:checkbox:not(:disabled)').prop('checked', false);
}
});
$('#checkboxoil input[type=checkbox]').change(function(){
$('input[name="columnPreset"]').prop('checked', false);
});
$('#oil_period_from, #oil_period_to').datepicker({ $('#oil_period_from, #oil_period_to').datepicker({
dateFormat: 'yy-mm-dd', dateFormat: 'yy-mm-dd',
@ -66,10 +90,11 @@ $(document).ready(function(){
$("#exportoil").submit(function() { $("#exportoil").submit(function() {
$("input").removeAttr("disabled"); $("input").removeAttr("disabled");
}); });
}); });
const presetACC = <?=json_encode(array_keys($oilhistoryArray_acc))?>;
const presetMKT = <?=json_encode(array_keys($oilhistoryArray_mkt))?>;
</script> </script>
@ -111,132 +136,23 @@ $(document).ready(function(){
<input class="txt-first-period-input" type="text" id="oil_period_from" name="oil_period_from" value="<?=$thisMonth?>" placeholder="2023-04-01" readonly> ~ <input class="txt-first-period-input" type="text" id="oil_period_from" name="oil_period_from" value="<?=$thisMonth?>" placeholder="2023-04-01" readonly> ~
<input type="text" id="oil_period_to" name="oil_period_to" value="<?=$todayDate?>" placeholder="2023-04-31" readonly> <input type="text" id="oil_period_to" name="oil_period_to" value="<?=$todayDate?>" placeholder="2023-04-31" readonly>
</td> </td>
<td>
<div class="radio-segment" style="margin:4px;">
<label><input type="radio" name="columnPreset" value="ACC"><span>ACC</span></label>
<label><input type="radio" name="columnPreset" value="MKT"><span>MKT</span></label>
<label><input type="radio" name="columnPreset" value="ALL" checked><span>ALL</span></label>
<label><input type="radio" name="columnPreset" value="CLEAR"><span>Clear</span></label>
</div>
</td>
<td>
<div class="text-center" style="margin:4px;"><button class="btn-sub" type="submit" name="downloadType" value="daily">Daily DOWNLOAD</button></div>
</td>
<td>
<div class="text-center" style="margin:4px;"><button class="btn-sub" type="submit" name="downloadType" value="calendar">Calendar DOWNLOAD</button></div>
</td>
</tr>
<?=$oilSTR?> <?=$oilSTR?>
<!--
<td>
<label class="container-chk">Account No
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Account Status
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Restaurant Name
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Driver
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Address
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Payment
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Payment Cycle
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Payable To
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Mailing Address
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Pickup Date
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
<label class="container-chk">Oil Quantity
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td>
<label class="container-chk">Paid (Cash)
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
-->
<tr>
<td colspan="2"></td>
<td>
<label class="container-chk">Select All
<input type="checkbox" name="checkboxalloil" id="checkboxalloil" checked="checked" value="1">
<span class="checkmark"></span>
</label>
</td>
<td>
<div class="text-center"><button class="btn-sub" type="submit">CSV DOWNLOAD</button></div>
</td>
</tr>
</table> </table>

View File

@ -59,16 +59,16 @@ if ($actionStr == "CUSTOMER") {
echo "<Cell><Data ss:Type=\"String\">" . $rt_driver['m_region'] . "</Data></Cell>\n"; echo "<Cell><Data ss:Type=\"String\">" . $rt_driver['m_region'] . "</Data></Cell>\n";
} }
else if ($col == 'm_currentdriverinitial') { else if ($col == 'm_currentdriverinitial') {
if ($list['c_driveruid'] !== null && $list['c_driveruid'] !== "") { if ($list['c_driveruid'] !== null && $list['c_driveruid'] !== "") {
$qry_driver = "SELECT m_currentdriverinitial FROM tbl_member WHERE m_uid = " . $list['c_driveruid']; $qry_driver = "SELECT m_currentdriverinitial FROM tbl_member WHERE m_uid = " . $list['c_driveruid'];
$rt_driver = $jdb->fQuery($qry_driver, "query error"); $rt_driver = $jdb->fQuery($qry_driver, "query error");
$currentdriverinitialSTR = $rt_driver['m_currentdriverinitial']; $currentdriverinitialSTR = $rt_driver['m_currentdriverinitial'];
}else { }else {
$currentdriverinitialSTR = ""; $currentdriverinitialSTR = "";
} }
echo "<Cell><Data ss:Type=\"String\">" . $currentdriverinitialSTR . "</Data></Cell>\n"; echo "<Cell><Data ss:Type=\"String\">" . $currentdriverinitialSTR . "</Data></Cell>\n";
} }
else if ($col == 'c_area') { else if ($col == 'c_area') {
$qry_city = "SELECT a_text FROM tbl_area WHERE a_city = '" . $list['c_city'] . "'"; $qry_city = "SELECT a_text FROM tbl_area WHERE a_city = '" . $list['c_city'] . "'";
@ -138,151 +138,208 @@ if ($actionStr == "CUSTOMER") {
if (($cnt++ % 300) == 0) flush(); // 300 raw 씩 출력 if (($cnt++ % 300) == 0) flush(); // 300 raw 씩 출력
} }
} else if ($actionStr == "OILHISTORY") { } else if ($actionStr == "OILHISTORY") {
$downloadType = $_POST['downloadType'];
if ($downloadType == "calendar") {
// customer
$query = "SELECT * FROM tbl_customer ORDER BY c_accountno DESC ";
$result = $jdb->nQuery($query, "list error");
// customer /* -------- HEADER ROW -------- */
$query = "SELECT * FROM tbl_customer ORDER BY c_accountno DESC "; echo "<Row>";
$result = $jdb->nQuery($query, "list error"); $sludgeFlag = 0;
// column header
for ($ii = 0; $ii < sizeof($export_oil); $ii++) {
foreach ($oilhistoryArray as $key => $value) {
if ($key == $export_oil[$ii]) {
if ($key != "d_inputdate" && $key != "d_quantity" && $key != "d_sludge") {
echo "<Cell><Data ss:Type=\"String\">$value</Data></Cell>\n";
}
if ($key == "d_sludge") $sludgeFlag = 1;
}
}
}
// date repeat
$oil_period_toSTR = $oil_period_to . " 23:59:59";
$period = new DatePeriod(
new DateTime($oil_period_from),
new DateInterval('P1D'),
new DateTime($oil_period_toSTR)
);
/* -------- HEADER ROW -------- */ // date header
echo "<Row>"; foreach ($period as $key => $value) {
$sludgeFlag = 0; echo "<Cell><Data ss:Type=\"String\">" . $value->format('Y-m-d') . "</Data></Cell>\n";
if ($sludgeFlag == 1) {
// column header echo "<Cell><Data ss:Type=\"String\">" . $value->format('Y-m-d') . "</Data></Cell>\n";
for ($ii = 0; $ii < sizeof($export_oil); $ii++) { }
foreach ($oilhistoryArray as $key => $value) { }
if ($key == $export_oil[$ii]) {
if ($key != "d_inputdate" && $key != "d_quantity" && $key != "d_sludge") {
echo "<Cell><Data ss:Type=\"String\">$value</Data></Cell>\n";
}
if ($key == "d_sludge") $sludgeFlag = 1;
}
}
}
// date repeat
$oil_period_toSTR = $oil_period_to . " 23:59:59";
$period = new DatePeriod(
new DateTime($oil_period_from),
new DateInterval('P1D'),
new DateTime($oil_period_toSTR)
);
// date header echo "</Row>\n";
foreach ($period as $key => $value) {
echo "<Cell><Data ss:Type=\"String\">" . $value->format('Y-m-d') . "</Data></Cell>\n";
if ($sludgeFlag == 1) {
echo "<Cell><Data ss:Type=\"String\">" . $value->format('Y-m-d') . "</Data></Cell>\n";
}
}
echo "</Row>\n"; /* -------- CUSTOMER LOOP -------- */
$oil_period_toTMP = str_replace("-", "", $oil_period_to);
$oil_period_fromTMP = str_replace("-", "", $oil_period_from);
/* -------- CUSTOMER LOOP -------- */ $cnt = 0;
$oil_period_toTMP = str_replace("-", "", $oil_period_to);
$oil_period_fromTMP = str_replace("-", "", $oil_period_from);
$cnt = 0; while ($cus = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
while ($cus = mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo "<Row>";
echo "<Row>"; /* ===== customer information ===== */
foreach ($export_oil as $col) {
/* ===== customer information ===== */ if ($col == 'c_maincontainer') {
foreach ($export_oil as $col) { echo "<Cell><Data ss:Type=\"String\">" . $arrBin[$cus[$col]] . "</Data></Cell>\n";
}
if ($col == 'c_maincontainer') { else if ($col == 'c_driveruid') {
echo "<Cell><Data ss:Type=\"String\">" . $arrBin[$cus[$col]] . "</Data></Cell>\n"; $qry_driver = "SELECT m_region FROM tbl_member WHERE m_uid = " . $cus[$col];
} $rt_driver = $jdb->fQuery($qry_driver, "query error");
echo "<Cell><Data ss:Type=\"String\">" . $rt_driver['m_region'] . "</Data></Cell>\n";
}
else if ($col == 'c_driveruid') { else if ($col == 'm_currentdriverinitial') {
$qry_driver = "SELECT m_region FROM tbl_member WHERE m_uid = " . $cus[$col]; $qry_driver = "SELECT m_currentdriverinitial FROM tbl_member WHERE m_uid = " . $cus['c_driveruid'];
$rt_driver = $jdb->fQuery($qry_driver, "query error"); $rt_driver = $jdb->fQuery($qry_driver, "query error");
echo "<Cell><Data ss:Type=\"String\">" . $rt_driver['m_region'] . "</Data></Cell>\n"; echo "<Cell><Data ss:Type=\"String\">" . $rt_driver['m_currentdriverinitial'] . "</Data></Cell>\n";
} }
else if ($col == 'c_area') {
$qry_city = "SELECT a_text FROM tbl_area WHERE a_city = '" . $cus['c_city'] . "'";
$rt_city = $jdb->fQuery($qry_city, "query error");
echo "<Cell><Data ss:Type=\"String\">" . $rt_city['a_text'] . "</Data></Cell>\n";
}
else if ($col == 'm_currentdriverinitial') { // date format
$qry_driver = "SELECT m_currentdriverinitial FROM tbl_member WHERE m_uid = " . $cus['c_driveruid']; else if (
$rt_driver = $jdb->fQuery($qry_driver, "query error"); $col == 'c_form_eu' || $col == 'c_form_corsia' || $col == 'c_contractdate' ||
echo "<Cell><Data ss:Type=\"String\">" . $rt_driver['m_currentdriverinitial'] . "</Data></Cell>\n"; $col == 'c_installdate' || $col == 'c_schedulebasic' || $col == 'c_fpickup' ||
} $col == 'c_removaldate' || $col == 'c_createddate' || $col == 'c_deleteddate' ||
$col == 'c_forceddate' || $col == 'c_fullquantitydate' ||
else if ($col == 'c_area') { $col == 'c_lastpickupdate' || $col == 'c_lastpaiddate' ||
$qry_city = "SELECT a_text FROM tbl_area WHERE a_city = '" . $cus['c_city'] . "'"; $col == 'c_orderdate' || $col == 'c_inactivedate' ||
$rt_city = $jdb->fQuery($qry_city, "query error"); $col == 'c_exchangedate' || $col == 'c_switchformdate'
echo "<Cell><Data ss:Type=\"String\">" . $rt_city['a_text'] . "</Data></Cell>\n"; ) {
}
// date format if (trim($cus[$col]) == "N/A") $toDateStr = $cus[$col];
else if ( else if (trim($cus[$col]) != "") $toDateStr = $func->convertFormat($cus[$col], 3);
$col == 'c_form_eu' || $col == 'c_form_corsia' || $col == 'c_contractdate' || else $toDateStr = "";
$col == 'c_installdate' || $col == 'c_schedulebasic' || $col == 'c_fpickup' ||
$col == 'c_removaldate' || $col == 'c_createddate' || $col == 'c_deleteddate' ||
$col == 'c_forceddate' || $col == 'c_fullquantitydate' ||
$col == 'c_lastpickupdate' || $col == 'c_lastpaiddate' ||
$col == 'c_orderdate' || $col == 'c_inactivedate' ||
$col == 'c_exchangedate' || $col == 'c_switchformdate'
) {
if (trim($cus[$col]) == "N/A") $toDateStr = $cus[$col]; echo "<Cell><Data ss:Type=\"String\">" . $toDateStr . "</Data></Cell>\n";
else if (trim($cus[$col]) != "") $toDateStr = $func->convertFormat($cus[$col], 3); }
else $toDateStr = "";
echo "<Cell><Data ss:Type=\"String\">" . $toDateStr . "</Data></Cell>\n"; else if ($col != "d_inputdate" && $col != "d_quantity" && $col != "d_sludge") {
} echo "<Cell><Data ss:Type=\"String\">" . $cus[$col] . "</Data></Cell>\n";
}
else if ($col != "d_inputdate" && $col != "d_quantity" && $col != "d_sludge") { }
echo "<Cell><Data ss:Type=\"String\">" . $cus[$col] . "</Data></Cell>\n";
}
}
/* ===== Oil History ===== */ /* ===== Oil History ===== */
$qry_oil = "SELECT * FROM tbl_daily $qry_oil = "SELECT * FROM tbl_daily
WHERE d_customeruid = '{$cus['c_uid']}' AND d_status = 'F' WHERE d_customeruid = '{$cus['c_uid']}' AND d_status = 'F'
AND (d_orderdate BETWEEN '$oil_period_fromTMP' AND '$oil_period_toTMP')"; AND (d_orderdate BETWEEN '$oil_period_fromTMP' AND '$oil_period_toTMP')";
$rt_oil = $jdb->nQuery($qry_oil, "list error"); $rt_oil = $jdb->nQuery($qry_oil, "list error");
$oilData = []; $oilData = [];
$sludgeData = []; $sludgeData = [];
while ($oil = mysqli_fetch_array($rt_oil, MYSQLI_ASSOC)) { while ($oil = mysqli_fetch_array($rt_oil, MYSQLI_ASSOC)) {
$oilData[$oil['d_orderdate']] = $oil['d_quantity']; $oilData[$oil['d_orderdate']] = $oil['d_quantity'];
if ($sludgeFlag == 1) { if ($sludgeFlag == 1) {
$sludgeData[$oil['d_orderdate']] = $oil['d_sludge']; $sludgeData[$oil['d_orderdate']] = $oil['d_sludge'];
} }
} }
/* ===== dialy ===== */ /* ===== dialy ===== */
foreach ($period as $key => $value) { foreach ($period as $key => $value) {
$d = $value->format('Ymd'); $d = $value->format('Ymd');
if (isset($oilData[$d])) { if (isset($oilData[$d])) {
echo "<Cell><Data ss:Type=\"Number\">" . $oilData[$d] . "</Data></Cell>\n"; echo "<Cell><Data ss:Type=\"Number\">" . $oilData[$d] . "</Data></Cell>\n";
} else { } else {
echo "<Cell><Data ss:Type=\"String\"></Data></Cell>\n"; echo "<Cell><Data ss:Type=\"String\"></Data></Cell>\n";
} }
if ($sludgeFlag == 1) { if ($sludgeFlag == 1) {
if (isset($sludgeData[$d])) { if (isset($sludgeData[$d])) {
echo "<Cell><Data ss:Type=\"String\">" . $sludgeData[$d] . "</Data></Cell>\n"; echo "<Cell><Data ss:Type=\"String\">" . $sludgeData[$d] . "</Data></Cell>\n";
} else { } else {
echo "<Cell><Data ss:Type=\"String\"></Data></Cell>\n"; echo "<Cell><Data ss:Type=\"String\"></Data></Cell>\n";
} }
} }
} }
echo "</Row>\n"; echo "</Row>\n";
if (($cnt++ % 300) == 0) flush(); // 300 raw 씩 출력 if (($cnt++ % 300) == 0) flush(); // 300 raw 씩 출력
}
} else if ($downloadType == "daily") {
$oil_period_toTMP = str_replace("-", "", $oil_period_to);
$oil_period_fromTMP = str_replace("-", "", $oil_period_from);
/* -------- HEADER ROW -------- */
echo "<Row>";
foreach ($export_oil as $col) {
if (isset($oilhistoryArray[$col])) {
echo "<Cell><Data ss:Type=\"String\">".$oilhistoryArray[$col]."</Data></Cell>\n";
}
}
echo "</Row>\n";
/* -------- DATA QUERY -------- */
$qry = "
SELECT d_accountno as c_accountno, c_status, d_name as c_name, m_region as c_driveruid, m.m_currentdriverinitial as m_currentdriverinitial
, d_address as c_address, d_city as c_city, d_postal as c_postal, d_area as c_area
, d_phone as c_phone, c_phoneext, c_cell, d_rate as c_rate, d_paymenttype as c_paymenttype
, d_maincontainer as c_maincontainer, d_container as c_container, d_location as c_location, c_schedule
, c_scheduleday, d_fullcycle as c_fullcycle, d_fullcycleforced as c_fullcycleforced, c_comment_ri
, c_contractdate, c_form_new, c_form_us, c_form_eu
, c_form_corsia, c_contractby, c_email, c_removaldate
, c_salesperson, c_salesmethod, c_salescommissiondate, c_installdate
, c_fpickup, c_payableto, c_paymentcycle, c_mailingaddr
, c_comment_ci, c_expoilmonth, c_hstno, c_identcode
, c_geolat, c_geolon
, CONCAT(
SUBSTRING(d_orderdate,1,4),'-',
SUBSTRING(d_orderdate,5,2),'-',
SUBSTRING(d_orderdate,7,2)
) as d_inputdate
, d_quantity
, d_sludge
FROM tbl_daily d
JOIN tbl_customer c
ON d.d_customeruid = c.c_uid
JOIN tbl_member m
ON d.d_driveruid = m.m_uid
WHERE d.d_status = 'F'
AND d.d_orderdate BETWEEN '$oil_period_fromTMP' AND '$oil_period_toTMP'
ORDER BY d.d_orderdate, c.c_accountno
";
$result = $jdb->nQuery($qry, "daily export error");
$cnt = 0;
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo "<Row>";
foreach ($export_oil as $col) {
echo "<Cell><Data ss:Type=\"String\">".$row[$col]."</Data></Cell>\n";
}
echo "</Row>\n";
if (($cnt++ % 300) == 0) flush();
}
} }
} else if ($actionStr == "ORDER") { } else if ($actionStr == "ORDER") {
$d_orderdate = str_replace("-", "", $d_orderdate); $d_orderdate = str_replace("-", "", $d_orderdate);

View File

@ -57,6 +57,34 @@ $oilhistoryArray = array(
"c_geolat"=>"Latitude", "c_geolon"=>"Longitude", "c_geolat"=>"Latitude", "c_geolon"=>"Longitude",
"d_inputdate"=>"Pickup Date","d_quantity"=>"Oil Quantity", "d_sludge"=>"Sludge" "d_inputdate"=>"Pickup Date","d_quantity"=>"Oil Quantity", "d_sludge"=>"Sludge"
); );
$customerArray_cs = array(
"c_accountno"=>"Account No", "c_status"=>"Account Status", "c_name"=>"Restaurant Name",
"c_address"=>"Address", "c_rate"=>"Rate", "c_container"=>"Container Detail", "c_contractdate"=>"Contract Date",
"c_form_us"=>"US", "c_form_eu"=>"EU Date", "c_salesperson"=>"Sales Person", "c_salesmethod"=>"Sales Method", "c_salescommissiondate"=>"Sale Commission Date",
"c_installdate"=>"Install Date", "c_fpickup"=>"First Pickup Date", "c_exchangedate"=>"Container Exc. Date"
);
$customerArray_pl = array(
"c_accountno"=>"Account No", "c_status"=>"Account Status", "c_name"=>"Restaurant Name",
"m_currentdriverinitial"=>"Current Driver", "c_address"=>"Address", "c_city"=>"City", "c_rate"=>"Rate",
"c_contractdate"=>"Contract Date", "c_form_us"=>"US", "c_form_eu"=>"EU Date", "c_form_corsia"=>"CORSIA Date",
"c_email"=>"Email", "c_geolat"=>"Latitude", "c_geolon"=>"Longitude"
);
$oilhistoryArray_acc = array(
"d_inputdate"=>"Pickup Date", "c_accountno"=>"Account No", "c_name"=>"Restaurant Name", "d_quantity"=>"Oil Quantity", "d_sludge"=>"Sludge",
"c_rate"=>"Rate", "c_status"=>"Account Status", "c_paymentcycle"=>"Payment Cycle", "c_driveruid"=>"Region", "m_currentdriverinitial"=>"Current Driver",
"c_paymenttype"=>"Payment", "c_address"=>"Address", "c_city"=>"City", "c_postal"=>"Postal Code", "c_phone"=>"Phone",
"c_payableto"=>"Payable To", "c_mailingaddr"=>"Mailing Address", "c_comment_ci"=>"Comment2"
);
$oilhistoryArray_mkt = array(
"c_accountno"=>"Account No", "c_status"=>"Account Status", "c_name"=>"Restaurant Name", "c_driveruid"=>"Region", "m_currentdriverinitial"=>"Current Driver",
"c_address"=>"Address", "c_city"=>"City", "c_rate"=>"Rate", "c_container"=>"Container Detail", "c_schedule"=>"Pickup Schedule",
"c_contractdate"=>"Contract Date", "c_removaldate"=>"Removal Date", "c_salesperson"=>"Sales Person", "c_installdate"=>"Install Date",
"c_fpickup"=>"First Pickup Date", "c_expoilmonth"=>"Expected Oil Vol per Month", "d_inputdate"=>"Pickup Date","d_quantity"=>"Oil Quantity", "d_sludge"=>"Sludge"
);
// "d_payamount"=>"Paid (Cash)" // "d_payamount"=>"Paid (Cash)"
$orderArray = array( $orderArray = array(

View File

@ -1,6 +1,7 @@
<?php <?php
$destination = isset($_GET['destination']) ? $_GET['destination'] : ''; $destination = isset($_GET['destination']) ? $_GET['destination'] : '';
$mode = isset($_GET['mode']) ? $_GET['mode'] : ''; $mode = isset($_GET['mode']) ? $_GET['mode'] : '';
$appVersion = 'v1.1.1';
?> ?>
<? <?
@ -107,6 +108,13 @@ if ($_SESSION['ss_LOGIN'] == 1) {
<label><div class="g-recaptcha" id="RecaptchaField1" required="required" required ></div></label> <label><div class="g-recaptcha" id="RecaptchaField1" required="required" required ></div></label>
<div class="text-center"><button class="btn-primary" type="submit">LOGIN</button></div> <div class="text-center"><button class="btn-primary" type="submit">LOGIN</button></div>
</form> </form>
<div class="text-center mt-3">
<small class="text-muted">
<a href="https://docs.google.com/spreadsheets/d/1PsjWNuUNyjZv7AuFSJwm5m_rsj36d9q19r27PhZp43M/edit?usp=sharing" target="_blank">
<?=$appVersion?>
</a>
</small>
</div>
</div><!-- End login Form --> </div><!-- End login Form -->