diff --git a/public_html/doc/export_customer.php b/public_html/doc/export_customer.php
index 29704fa..6aa393c 100644
--- a/public_html/doc/export_customer.php
+++ b/public_html/doc/export_customer.php
@@ -36,16 +36,46 @@ $customerSTR .= "";
@@ -82,307 +112,20 @@ $(document).ready(function(){
diff --git a/public_html/doc/export_oilhistory.php b/public_html/doc/export_oilhistory.php
index b3e53db..71a1720 100644
--- a/public_html/doc/export_oilhistory.php
+++ b/public_html/doc/export_oilhistory.php
@@ -9,8 +9,8 @@ $func->checkLevelModal(7);
// EXPORT - OIL HISTORY
//////////////////////////////////
-$oil_cnt = 2;
-//$oilSTR = "";
+$oil_cnt = 1;
+$oilSTR .= "
";
foreach ($oilhistoryArray AS $key=>$value)
{
//echo "[$key][$value]"; => [0][Waiting][1][Confirmed][E][Declined]...
@@ -42,10 +42,34 @@ $thisMonth = date("Y-m")."-01";
@@ -111,132 +136,23 @@ $(document).ready(function(){
~
+ |
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
=$oilSTR?>
-
-
-
-
-
- |
-
-
- |
-
-
-
- |
-
diff --git a/public_html/doc/export_process.php b/public_html/doc/export_process.php
index 0ffb674..3c5ab55 100644
--- a/public_html/doc/export_process.php
+++ b/public_html/doc/export_process.php
@@ -59,16 +59,16 @@ if ($actionStr == "CUSTOMER") {
echo "" . $rt_driver['m_region'] . " | \n";
}
- else if ($col == 'm_currentdriverinitial') {
- if ($list['c_driveruid'] !== null && $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");
- $currentdriverinitialSTR = $rt_driver['m_currentdriverinitial'];
- }else {
- $currentdriverinitialSTR = "";
- }
- echo "" . $currentdriverinitialSTR . " | \n";
- }
+ else if ($col == 'm_currentdriverinitial') {
+ if ($list['c_driveruid'] !== null && $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");
+ $currentdriverinitialSTR = $rt_driver['m_currentdriverinitial'];
+ }else {
+ $currentdriverinitialSTR = "";
+ }
+ echo "" . $currentdriverinitialSTR . " | \n";
+ }
else if ($col == 'c_area') {
$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 씩 출력
}
-} 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
- $query = "SELECT * FROM tbl_customer ORDER BY c_accountno DESC ";
- $result = $jdb->nQuery($query, "list error");
+ /* -------- HEADER ROW -------- */
+ echo "";
+ $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 "| $value | \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 -------- */
- echo "";
- $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 "| $value | \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
+ foreach ($period as $key => $value) {
+ echo "" . $value->format('Y-m-d') . " | \n";
+ if ($sludgeFlag == 1) {
+ echo "" . $value->format('Y-m-d') . " | \n";
+ }
+ }
- // date header
- foreach ($period as $key => $value) {
- echo "" . $value->format('Y-m-d') . " | \n";
- if ($sludgeFlag == 1) {
- echo "" . $value->format('Y-m-d') . " | \n";
- }
- }
+ echo "
\n";
- echo "
\n";
+ /* -------- CUSTOMER LOOP -------- */
+ $oil_period_toTMP = str_replace("-", "", $oil_period_to);
+ $oil_period_fromTMP = str_replace("-", "", $oil_period_from);
- /* -------- CUSTOMER LOOP -------- */
- $oil_period_toTMP = str_replace("-", "", $oil_period_to);
- $oil_period_fromTMP = str_replace("-", "", $oil_period_from);
+ $cnt = 0;
- $cnt = 0;
+ while ($cus = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
- while ($cus = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
+ echo "";
- echo "";
+ /* ===== customer information ===== */
+ foreach ($export_oil as $col) {
- /* ===== customer information ===== */
- foreach ($export_oil as $col) {
+ if ($col == 'c_maincontainer') {
+ echo "| " . $arrBin[$cus[$col]] . " | \n";
+ }
- if ($col == 'c_maincontainer') {
- echo "" . $arrBin[$cus[$col]] . " | \n";
- }
+ else if ($col == 'c_driveruid') {
+ $qry_driver = "SELECT m_region FROM tbl_member WHERE m_uid = " . $cus[$col];
+ $rt_driver = $jdb->fQuery($qry_driver, "query error");
+ echo "" . $rt_driver['m_region'] . " | \n";
+ }
- else if ($col == 'c_driveruid') {
- $qry_driver = "SELECT m_region FROM tbl_member WHERE m_uid = " . $cus[$col];
- $rt_driver = $jdb->fQuery($qry_driver, "query error");
- echo "" . $rt_driver['m_region'] . " | \n";
- }
+ else if ($col == 'm_currentdriverinitial') {
+ $qry_driver = "SELECT m_currentdriverinitial FROM tbl_member WHERE m_uid = " . $cus['c_driveruid'];
+ $rt_driver = $jdb->fQuery($qry_driver, "query error");
+ echo "" . $rt_driver['m_currentdriverinitial'] . " | \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 "" . $rt_city['a_text'] . " | \n";
+ }
- else if ($col == 'm_currentdriverinitial') {
- $qry_driver = "SELECT m_currentdriverinitial FROM tbl_member WHERE m_uid = " . $cus['c_driveruid'];
- $rt_driver = $jdb->fQuery($qry_driver, "query error");
- echo "" . $rt_driver['m_currentdriverinitial'] . " | \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 "" . $rt_city['a_text'] . " | \n";
- }
+ // date format
+ else if (
+ $col == 'c_form_eu' || $col == 'c_form_corsia' || $col == 'c_contractdate' ||
+ $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'
+ ) {
- // date format
- else if (
- $col == 'c_form_eu' || $col == 'c_form_corsia' || $col == 'c_contractdate' ||
- $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];
+ else if (trim($cus[$col]) != "") $toDateStr = $func->convertFormat($cus[$col], 3);
+ else $toDateStr = "";
- if (trim($cus[$col]) == "N/A") $toDateStr = $cus[$col];
- else if (trim($cus[$col]) != "") $toDateStr = $func->convertFormat($cus[$col], 3);
- else $toDateStr = "";
+ echo "" . $toDateStr . " | \n";
+ }
- echo "" . $toDateStr . " | \n";
- }
-
- else if ($col != "d_inputdate" && $col != "d_quantity" && $col != "d_sludge") {
- echo "" . $cus[$col] . " | \n";
- }
- }
+ else if ($col != "d_inputdate" && $col != "d_quantity" && $col != "d_sludge") {
+ echo "" . $cus[$col] . " | \n";
+ }
+ }
- /* ===== Oil History ===== */
- $qry_oil = "SELECT * FROM tbl_daily
- WHERE d_customeruid = '{$cus['c_uid']}' AND d_status = 'F'
- AND (d_orderdate BETWEEN '$oil_period_fromTMP' AND '$oil_period_toTMP')";
+ /* ===== Oil History ===== */
+ $qry_oil = "SELECT * FROM tbl_daily
+ WHERE d_customeruid = '{$cus['c_uid']}' AND d_status = 'F'
+ 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 = [];
- $sludgeData = [];
+ $oilData = [];
+ $sludgeData = [];
- while ($oil = mysqli_fetch_array($rt_oil, MYSQLI_ASSOC)) {
- $oilData[$oil['d_orderdate']] = $oil['d_quantity'];
+ while ($oil = mysqli_fetch_array($rt_oil, MYSQLI_ASSOC)) {
+ $oilData[$oil['d_orderdate']] = $oil['d_quantity'];
- if ($sludgeFlag == 1) {
- $sludgeData[$oil['d_orderdate']] = $oil['d_sludge'];
- }
- }
+ if ($sludgeFlag == 1) {
+ $sludgeData[$oil['d_orderdate']] = $oil['d_sludge'];
+ }
+ }
- /* ===== dialy ===== */
- foreach ($period as $key => $value) {
+ /* ===== dialy ===== */
+ foreach ($period as $key => $value) {
- $d = $value->format('Ymd');
+ $d = $value->format('Ymd');
- if (isset($oilData[$d])) {
- echo "" . $oilData[$d] . " | \n";
- } else {
- echo " | \n";
- }
+ if (isset($oilData[$d])) {
+ echo "" . $oilData[$d] . " | \n";
+ } else {
+ echo " | \n";
+ }
- if ($sludgeFlag == 1) {
- if (isset($sludgeData[$d])) {
- echo "" . $sludgeData[$d] . " | \n";
- } else {
- echo " | \n";
- }
- }
- }
+ if ($sludgeFlag == 1) {
+ if (isset($sludgeData[$d])) {
+ echo "" . $sludgeData[$d] . " | \n";
+ } else {
+ echo " | \n";
+ }
+ }
+ }
- echo "
\n";
+ echo "
\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 "";
+ foreach ($export_oil as $col) {
+ if (isset($oilhistoryArray[$col])) {
+ echo "| ".$oilhistoryArray[$col]." | \n";
+ }
+ }
+ echo "
\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 "";
+ foreach ($export_oil as $col) {
+ echo "| ".$row[$col]." | \n";
+ }
+ echo "
\n";
+
+ if (($cnt++ % 300) == 0) flush();
+ }
+
+
}
-
} else if ($actionStr == "ORDER") {
$d_orderdate = str_replace("-", "", $d_orderdate);
diff --git a/public_html/include/arrayinfo.php b/public_html/include/arrayinfo.php
index 54b9eb8..ffc9335 100644
--- a/public_html/include/arrayinfo.php
+++ b/public_html/include/arrayinfo.php
@@ -57,6 +57,34 @@ $oilhistoryArray = array(
"c_geolat"=>"Latitude", "c_geolon"=>"Longitude",
"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)"
$orderArray = array(
diff --git a/public_html/login_intranet.php b/public_html/login_intranet.php
index 11eeba0..59b4c04 100644
--- a/public_html/login_intranet.php
+++ b/public_html/login_intranet.php
@@ -1,6 +1,7 @@
@@ -107,6 +108,13 @@ if ($_SESSION['ss_LOGIN'] == 1) {
+