checkLevelModal(10); // Delete 기능 제한 (Admin : 1, Staff : 5, Accounting : 6 만 가능) $permit = array("1", "5", "6"); if (in_array($_SESSION['ss_LEVEL'], $permit)) { $setTag = "ENABLED"; } else $setTag = "DISABLED"; // Admin 만 사용하는 기능을 위해 $permitAdm = array("1"); if (in_array($_SESSION['ss_LEVEL'], $permitAdm)) { $setTagAdm = "ENABLED"; } else $setTagAdm = "DISABLED"; $goStr = "switched=$switched&page=$page&key_word=$key_word&column=$column&sorting_type=$sorting_type&switch=$switch&cstatus=$cstatus"; // if ($mode == "create" || $mode == "") { $btnName = "CREATE"; $mode = "create"; $status = "1"; } else if ($mode == "update") { $btnName = "UPDATE"; //$admTag = "DISABLED"; } // User data query if ($mode == "update") { // [추가] 포털(ERP)에서 c_uid 없이 c_accountno(= crm.customer.cus_no)로 들어온 경우 c_uid 해석 if (trim($c_uid) == "" && isset($c_accountno) && trim($c_accountno) != "") { $accNo = preg_replace('/[^A-Za-z0-9\-]/', '', trim($c_accountno)); // 화이트리스트 sanitize $rowAcc = $jdb->fQuery( "SELECT c_uid FROM tbl_customer WHERE c_accountno = '".addslashes($accNo)."' LIMIT 1", "account lookup error" ); if (!empty($rowAcc['c_uid'])) { $c_uid = $rowAcc['c_uid']; } } if($c_uid == "") { $msg = "Invalid data. Please try again."; $func -> modalMsg ($msg, "/index_intranet.php?view=customer_list&$goStr"); exit(); } $query = "SELECT * FROM tbl_customer WHERE c_uid = '$c_uid'"; $result = $jdb->fQuery($query, "query error"); // No data if ($result[0] =="") { $msg = "Invalid data. Please try again."; $func -> modalMsg ($msg, "/index_intranet.php?view=customer_list&$goStr"); exit(); } //echo "[$query]"; for($i=0; $i $value ) $$key = $value; } $c_nameSTR = str_replace("\\", "", $c_name); $c_payabletoSTR = str_replace("\\", "", $c_payableto); $c_mailingaddrSTR = str_replace("\\", "", $c_mailingaddr); $c_containerSTR = str_replace("\\", "", $c_container); $c_locationSTR = str_replace("\\", "", $c_location); //echo "




[".utf8_encode($c_phone)."]"; $c_phone = str_replace("\\", "", trim($c_phone)); $c_phone = preg_replace('/[^A-Za-z0-9\-]/', '', $c_phone); $c_phoneSTR = substr ($c_phone, 0, 3)."-".substr ($c_phone, 3, 3)."-".substr ($c_phone, 6, 4); $c_phoneextSTR = str_replace("\\", "", $c_phoneext); $c_cellSTR = str_replace("\\", "", $c_cell); $c_emailSTR = str_replace("\\", "", $c_email); $c_addressSTR = str_replace("\\", "", $c_address); $c_postalSTR = str_replace("\\", "", $c_postal); $c_postalSTR = preg_replace('/[^A-Za-z0-9\-]/', '', $c_postalSTR); $c_contractbySTR = str_replace("\\", "", $c_contractby); $c_hstnoSTR = str_replace("\\", "", $c_hstno); $c_identcodeSTR = str_replace("\\", "", $c_identcode); $c_comment_riSTR = str_replace("\\", "", $c_comment_ri); $c_comment_ciSTR = str_replace("\\", "", $c_comment_ci); $c_form_euSTR = $func -> convertFormat ($c_form_eu, 3); $c_form_corsiaSTR = $func -> convertFormat ($c_form_corsia, 3); $c_contractdateSTR = $func -> convertFormat ($c_contractdate, 3); $c_schedulebasicSTR = $func -> convertFormat ($c_schedulebasic, 3); $c_fpickupSTR = $func -> convertFormat ($c_fpickup, 3); $c_lastpickupdateSTR = $func -> convertFormat ($c_lastpickupdate, 3); if ($c_inactivedate != "N/A") $c_inactivedateSTR = $func -> convertFormat ($c_inactivedate, 3); else $c_inactivedateSTR = "N/A"; if ($c_inactivedateSTR == "-") $c_inactivedateSTR = str_replace("-", "", $c_inactivedateSTR); if ($c_installdate != "N/A") $c_installdateSTR = $func -> convertFormat ($c_installdate, 3); else $c_installdateSTR = "N/A"; if ($c_removaldate != "N/A") $c_removaldateSTR = $func -> convertFormat ($c_removaldate, 3); else $c_removaldateSTR = "N/A"; if ($c_exchangedate != "N/A") $c_exchangedateSTR = $func -> convertFormat ($c_exchangedate, 3); else $c_exchangedateSTR = "N/A"; // function safeDate($val) { if (!$val || $val === 'N/A') return null; if (!preg_match('/^\d{8}$/', $val)) return null; return $val; } $dates = []; $d1 = safeDate($c_installdate); $d2 = safeDate($c_exchangedate); $d3 = safeDate($c_removaldate); if ($d1) $dates[] = $d1; if ($d2) $dates[] = $d2; if ($d3) $dates[] = $d3; $lastWork = !empty($dates) ? max($dates) : null; $lastWorkSTR = $lastWork ? $func->convertFormat($lastWork, 3): 'N/A'; // if ($c_switchformdate != "N/A") $c_switchformdateSTR = $func -> convertFormat ($c_switchformdate, 3); else $c_switchformdateSTR = "N/A"; if (is_numeric($c_salescommissiondate)) $c_salescommissiondateSTR = $func -> convertFormat ($c_salescommissiondate, 7); else $c_salescommissiondateSTR = $c_salescommissiondate; // =============================== // Customer Containers // =============================== $isManualChecked = ($c_manualvolume == 'Y') ? 'checked' : ''; $containerList = []; $q2 = " SELECT * FROM tbl_customer_container WHERE cc_customer_uid = '{$c_uid}' ORDER BY cc_status, cc_uid DESC "; $rlt = mysqli_query($jdb->DBConn, $q2); while ($row = mysqli_fetch_array($rlt, MYSQLI_ASSOC)) { $containerList[] = $row; } // } else { $c_salescommissiondateSTR = "NOT YET"; $c_fullcycle = 0; } // Get Status Info foreach ($arrStatus AS $key=>$value) { if ($key == $c_status) $selectStr = "selected"; else $selectStr = ""; $c_statusSTR .= " "; } // Get Payment Info foreach ($arrPaymenttype AS $key=>$value) { if ($key == $c_paymenttype) $selectStr = "selected"; else $selectStr = ""; $c_paymenttypeSTR .= ""; } // Get Bin (Main Container) Info foreach ($arrBin AS $key=>$value) { if ($key == $c_maincontainer) $selectStr = "selected"; else $selectStr = ""; $c_maincontainerSTR .= ""; } // Get Pickup Schedule foreach ($arrSchedule AS $key=>$value) { if ($key == $c_schedule) $selectStr = "selected"; else $selectStr = ""; $c_scheduleSTR .= ""; } // Get Driver Info => Region $curDR = ""; $qry_driver = "SELECT * FROM tbl_member WHERE m_level = 9 AND m_region != '' 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'] == $c_driveruid) { $selectStr = "selected"; $curDR = $lt_driver['m_currentdriver']; } else $selectStr = ""; $c_driveruidSTR .= ""; } // Get Driver Info (Request) $qry_dr = "SELECT * FROM tbl_driver WHERE dr_status = 'A' ORDER by dr_initial ASC "; $rt_dr = $jdb->nQuery($qry_dr, "list error"); while($lt_dr=mysqli_fetch_array($rt_dr, MYSQLI_ASSOC)) { if ($lt_dr['dr_uid'] == $curDR) $selectStr = "selected"; else $selectStr = ""; $c_driveruidSTRRQ .= ""; } // Get City Info $qry_city = "SELECT * FROM tbl_area WHERE a_status = 'A' ORDER by a_city ASC "; $rt_city = $jdb->nQuery($qry_city, "list error"); while($lt_city=mysqli_fetch_array($rt_city, MYSQLI_ASSOC)) { if ($lt_city['a_city'] == $c_city) { $selectStr = "selected"; $a_textSTR = $lt_city['a_text']; } else { $selectStr = ""; } $c_citySTR .= ""; } // get scheduled day info $c_scheduledayTMP = explode('|', $c_scheduleday); for ($i=0; $i < count($c_scheduledayTMP); $i++) { if ($c_scheduledayTMP[$i] == "MON") $c_scheduledayMON = "checked"; if ($c_scheduledayTMP[$i] == "TUE") $c_scheduledayTUE = "checked"; if ($c_scheduledayTMP[$i] == "WED") $c_scheduledayWED = "checked"; if ($c_scheduledayTMP[$i] == "THU") $c_scheduledayTHU = "checked"; if ($c_scheduledayTMP[$i] == "FRI") $c_scheduledayFRI = "checked"; if ($c_scheduledayTMP[$i] == "SAT") $c_scheduledaySAT = "checked"; } // Get Sale Person $qry_sp = "SELECT * FROM tbl_salesperson WHERE s_status = 'A' ORDER by s_name ASC "; $rt_sp = $jdb->nQuery($qry_sp, "list error"); while($lt_sp=mysqli_fetch_array($rt_sp, MYSQLI_ASSOC)) { if ($lt_sp['s_name'] == $c_salesperson) $selectStr = "selected"; else $selectStr = ""; $c_salespersonSTR .= ""; } // Get Form info foreach ($arrForm AS $key=>$value) { if ($key == $c_form_new) $selectStr = "selected"; else $selectStr = ""; $c_form_newSTR .= ""; } // Get Sales Method info foreach ($arrSalesMethod AS $key=>$value) { if ($key == $c_salesmethod) $selectStr = "selected"; else $selectStr = ""; $c_salesmethodSTR .= ""; } // Get Form info foreach ($arrPaymentCycle AS $key=>$value) { //echo "[$key][$value]"; => [0][Waiting][1][Confirmed][E][Declined]... if ($key == $c_paymentcycle) $selectStr = "selected"; else $selectStr = ""; $c_paymentcycleSTR .= ""; } // 오늘 날짜의 오더장이 있는지 확인 // 있으면 정보를 가져와서 아래 조건 확인, 없는 경우 새로 생성 $qry_cnt_d = "SELECT COUNT(*) FROM tbl_daily WHERE d_customeruid = '$c_uid' AND d_orderdate = '".date("Ymd")."'"; $totcnt_d=$jdb->rQuery($qry_cnt_d, "record query error"); // $pickupButtonHtml = ""; $PICKUPstr = ""; $add_qry = ($_SESSION['ss_LEVEL'] == 9) ? " AND dr_uid = '".$_SESSION['ss_DRUID']."' " : ""; // display 기본값 $setDisplayNEWStr = " DISPLAY:none; "; $setDisplayBTNStr = " DISPLAY:block; "; $setDisplaySIGNYESStr = " DISPLAY:none; "; $setDisplaySIGNNEWStr = " DISPLAY:inline; "; if ($mode == "update") { if ($totcnt_d == 0) { // 신규 pickup 입력 상태 $PICKUPstr = $pickupButtonHtml; $d_orderdateSTR = date("Y-m-d"); $d_paymenttype = $c_paymenttype; $d_customeruid = $c_uid; } else { // 기존 daily 정보 조회 $query = "SELECT * FROM tbl_daily WHERE d_customeruid = '$c_uid' AND d_orderdate = '".date("Ymd")."'"; $result = $jdb->fQuery($query, "fetch query error"); if (is_array($result)) { foreach ($result as $key => $value) { $$key = $value; } } // update 모드 강제 $d_mode = "update"; $d_orderdateSTR = $func->convertFormat($d_orderdate, 3); // pickup 버튼 노출 조건 $canInputPickup = ( ($d_orderdate == date("Ymd") && $d_status != "F") || $_SESSION['ss_LEVEL'] == "1" ); if ($canInputPickup) { $PICKUPstr = $pickupButtonHtml; } // signature 처리 $d_payeenameSTR = str_replace("\\", "", $d_payeename); $folderPath = getenv("DOCUMENT_ROOT")."/upload_sign/".$d_customeruid; $signFilePath = $folderPath."/".trim($d_payeesign); if (is_file($signFilePath)) { $d_payeesignSTR = ""; $setDisplayNEWStr = " DISPLAY:inline; "; $setDisplayBTNStr = " DISPLAY:none; "; $setDisplaySIGNYESStr = " DISPLAY:inline; "; $setDisplaySIGNNEWStr = " DISPLAY:none; "; } // note 조회 $qry_note = "SELECT * FROM tbl_note WHERE n_dailyuid = '$d_uid'"; $rt_note = $jdb->fQuery($qry_note, "fetch query error"); $n_noteSTRM = str_replace("\\", "", $rt_note['n_note']); } } // Level 7, 8 은 pickup 버튼 숨김 if ($_SESSION['ss_LEVEL'] == 7 || $_SESSION['ss_LEVEL'] == 8) { $PICKUPstr = ""; } if ($mode == "update") { // 현재 고객의 드라이버 정보 $qry_rg = "SELECT * FROM tbl_member WHERE m_uid = ".$c_driveruid; $rt_rg = $jdb->fQuery($qry_rg, "list error"); // 활성 드라이버 목록 $qry_driver = "SELECT * FROM tbl_driver WHERE dr_uid >= 1 AND dr_status = 'A' $add_qry ORDER BY dr_initial ASC"; $rt_driver = $jdb->nQuery($qry_driver, "list error"); $c_driveruidSTRM = ""; while ($lt_driver = mysqli_fetch_array($rt_driver, MYSQLI_ASSOC)) { $selected = ""; // 기본 선택값: member 의 current driver if ($lt_driver['dr_uid'] == $rt_rg['m_currentdriver']) { $selected = "selected"; } // update 상태면 daily 의 d_druid 가 우선 if ($d_mode == "update") { $selected = ($lt_driver['dr_uid'] == $d_druid) ? "selected" : ""; } $c_driveruidSTRM .= ""; } // --- 슬러지 기본값 설정 로직 추가 시작 --- // d_sludge(오늘 입력값)가 없으면 고객 정보의 c_sludge를 기본값으로 사용 if (!isset($d_sludge) || trim((string)$d_sludge) === '') { $display_sludge = $c_sludge; } else { $display_sludge = $d_sludge; } // --- 로직 추가 끝 --- } addLog ("add", "CUSTOMER DETAIL", "VIEW", $lguserid, $query, $c_uid); ?>

Restaurant Information

Account No Status
Restaurant Name Inactive Date
Init
Address Region (Default Driver)
City Rate
Postal Code Payment
Phone Area
Cell Ext
Cycle Pickup Schedule
Forced Cycle Pickup Weekday
Expected Oil Volume Per Month Pickup Schedule Start at
First Pickup
Init
Last Pickup
Comment

Container Information

Main Container Main Volume
Manual >
First Install Date
Init
Removal Date
Init
Last Container Work Date
Init
Container Location
Container
Show Inactive
No containers found.
Used O
Inactive
Capacity:
Installed: ()
Picked Up: ()

Contact Information

Contract Date Sales Person
Form Sales Method
US Sale Commission Date
EU Date Payable To
CORSIA Date Payment Cycle
Switch Form Date
Init
Mailing Address
Contact By HST No
Email Identification Code
Comment
modalMsg ($msg, "/index_intranet.php?view=customer_list&$goStr"); exit(); } //total record $query = "SELECT COUNT(n_uid) FROM tbl_note WHERE n_uid <> '' AND n_status != 'D' AND n_customeruid = '$c_uid' " . $add_query; $total_count=$jdb->rQuery($query, "record query error"); //echo "[$total_count][$query]
"; //페이징변수설정 if(!$pageqna) $pageqna = 1; if ($pageflag != "note") $pageqna = 1; if(!$list_count) $list_count = $INIT_PAGECNT_NOTE; //출력리스트 갯수 if(!$page_count) $page_count = $INIT_PAGEVIEWCNT; //출력페이지 갯수 $list_number = $total_count - (($pageqna-1)*$list_count); $start_number = $list_count * ($pageqna-1); $add_query .= " LIMIT $start_number, $INIT_PAGECNT_NOTE"; $query_note = "SELECT * FROM tbl_note where n_uid <> '' AND n_status != 'D' AND n_customeruid = '$c_uid' " . $add_query; $result_note=$jdb->nQuery($query_note, "list error"); while($list_note=mysqli_fetch_array($result_note, MYSQLI_ASSOC)) { for($i=0; $i $value ) $$key = $value; } $n_noteSTR = str_replace("\\", "", $n_note); $n_createddateSTR = $func -> convertFormat ($n_createddate, 1); $qry_writer = "SELECT m_firstname, m_lastname FROM tbl_member WHERE m_uid = '$n_memberuid' "; $rt_writer = $jdb->fQuery($qry_writer, "fetch query error"); if ($setTagAdm == "ENABLED") { $OPTIONstr = ""; //$OPTIONTITLEstr = "OPTION"; } else { $OPTIONstr = ""; //$OPTIONTITLEstr = ""; } $strList .= " $list_number $n_createddateSTR ".$rt_writer['m_firstname']." ".$rt_writer['m_lastname']." $n_noteSTR $OPTIONstr "; $list_number--; } if( $total_count < 1 ) { $strList = "No Data"; } ?>

Note

No Date Creator Note Option

Image

nQuery($qry_img, "image list error"); function getImageTypeLabel($type) { switch ($type) { case 'install': return 'Install Image'; case 'install_order': return 'Container Request Image'; case 'clean_before': return 'Before Clean'; case 'clean_after': return 'After Clean'; default: return ucfirst(str_replace('_', ' ', $type)); } } if (mysqli_num_rows($rt_img) == 0) { echo "

No images found.

"; } else { echo '
'; while ($img = mysqli_fetch_array($rt_img, MYSQLI_ASSOC)) { echo '
'; echo ' '; // 이미지 영역 (위) echo '
'; $files = explode(",", $img['i_filename']); foreach ($files as $f) { $f = trim($f); if (!$f) continue; $imgPath = $img['i_filepath'] . $f; echo ''; } echo '
'; // 설명 영역 (아래) echo '
'; echo '
'.htmlspecialchars(getImageTypeLabel($img['i_type'])).'
Note: '.nl2br(htmlspecialchars($img['i_note'])).'
Created: '.date("Y-m-d H:i", strtotime($img['i_createddate'])).'
By: ' . htmlspecialchars($img['m_firstname'] ?? '') . ' ' . htmlspecialchars($img['m_lastname'] ?? '') .'
'; echo '
'; echo '
'; // card end } echo '
'; // wrapper end } ?>