- [MAP] 컨테이너 사진 올린 사람을 member uid으로 수정.
- [INSTALL ORDER] removal date 로직 변경.
This commit is contained in:
Hyojin Ahn 2026-04-27 16:21:07 -04:00
parent 6211afe6e4
commit 12dd0516b1
2 changed files with 44 additions and 9 deletions

View File

@ -1122,7 +1122,7 @@ trait InstallAPI {
qry($sql); qry($sql);
} }
// // 최초 install
if ($install_date) { if ($install_date) {
$install_yyyymmdd = str_replace('-', '', $install_date); $install_yyyymmdd = str_replace('-', '', $install_date);
@ -1142,22 +1142,57 @@ trait InstallAPI {
} }
} }
// c_exchangedate: 최신 install_date 또는 pickup_date
$exchangeDates = [];
if ($install_date) {
$exchangeDates[] = str_replace('-', '', $install_date);
}
if ($pickup_date) { if ($pickup_date) {
$exchangeDates[] = str_replace('-', '', $pickup_date);
}
$pickup_yyyymmdd = str_replace('-', '', $pickup_date); if (!empty($exchangeDates)) {
rsort($exchangeDates);
$r = qry("SELECT c_removaldate FROM tbl_customer WHERE c_uid='{$c_uid}'"); $latestExchangeDate = $exchangeDates[0];
$row = mysqli_fetch_assoc($r);
$current = $row['c_removaldate'];
if (!$current || $current === 'N/A' || $pickup_yyyymmdd > $current) {
qry(" qry("
UPDATE tbl_customer UPDATE tbl_customer
SET c_removaldate='{$pickup_yyyymmdd}' SET c_exchangedate = '{$latestExchangeDate}'
WHERE c_uid='{$c_uid}' WHERE c_uid = '{$c_uid}'
"); ");
} }
// c_removaldate: 작업 후 active container가 하나도 없으면 최종 수거일 업데이트
// 반대로 active container가 있으면 c_removaldate 초기화
$r = qry("
SELECT COUNT(*) AS active_cnt
FROM tbl_customer_container
WHERE cc_customer_uid = '{$c_uid}'
AND cc_status = 'A'
");
$row = mysqli_fetch_assoc($r);
$activeCnt = (int)($row['active_cnt'] ?? 0);
if ($activeCnt === 0) {
if ($pickup_date) {
$pickup_yyyymmdd = str_replace('-', '', $pickup_date);
qry("
UPDATE tbl_customer
SET c_removaldate = '{$pickup_yyyymmdd}'
WHERE c_uid = '{$c_uid}'
");
}
} else {
qry("
UPDATE tbl_customer
SET c_removaldate = ''
WHERE c_uid = '{$c_uid}'
and c_removaldate <> ''
");
} }

View File

@ -2608,7 +2608,7 @@ function popup(){
fd.append('actionStr', 'ADDIMAGE'); fd.append('actionStr', 'ADDIMAGE');
fd.append('i_type', 'install_order'); fd.append('i_type', 'install_order');
fd.append('i_customeruid', SimpleInstall.customer_uid); fd.append('i_customeruid', SimpleInstall.customer_uid);
fd.append('i_memberuid', SimpleInstall.driver_uid); fd.append('i_memberuid', SimpleInstall.member_uid);
fd.append('i_note', $installNote); fd.append('i_note', $installNote);
fd.append('i_sourceuid', iw_uid); fd.append('i_sourceuid', iw_uid);