diff --git a/app/Controllers/Admin/BagPrice.php b/app/Controllers/Admin/BagPrice.php index 4d484a4..38c1023 100644 --- a/app/Controllers/Admin/BagPrice.php +++ b/app/Controllers/Admin/BagPrice.php @@ -3,10 +3,10 @@ namespace App\Controllers\Admin; use App\Controllers\BaseController; -use App\Models\BagPriceModel; use App\Models\BagPriceHistoryModel; -use App\Models\CodeKindModel; +use App\Models\BagPriceModel; use App\Models\CodeDetailModel; +use App\Models\CodeKindModel; class BagPrice extends BaseController { @@ -23,36 +23,18 @@ class BagPrice extends BaseController { helper('admin'); $lgIdx = admin_effective_lg_idx(); - if (!$lgIdx) { - return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.'); + if ($lgIdx === null) { + return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.'); } - $builder = $this->priceModel->where('bp_lg_idx', $lgIdx); + $list = $this->priceModel->where('bp_lg_idx', $lgIdx) + ->orderBy('bp_bag_code', 'ASC') + ->orderBy('bp_start_date', 'DESC') + ->paginate(20); - // 기간 필터 (P2-04) - $startDate = $this->request->getGet('start_date'); - $endDate = $this->request->getGet('end_date'); - if ($startDate) { - $builder->where('bp_start_date >=', $startDate); - } - if ($endDate) { - $builder->groupStart() - ->where('bp_end_date IS NULL') - ->orWhere('bp_end_date <=', $endDate) - ->groupEnd(); - } - - $list = $builder->orderBy('bp_bag_code', 'ASC')->orderBy('bp_start_date', 'DESC')->paginate(20); - $pager = $this->priceModel->pager; - - return view('admin/layout', [ - 'title' => '봉투 단가 관리', - 'content' => view('admin/bag_price/index', [ - 'list' => $list, - 'startDate' => $startDate, - 'endDate' => $endDate, - 'pager' => $pager, - ]), + return $this->renderWorkPage('봉투 단가 관리', 'admin/bag_price/index', [ + 'list' => $list, + 'pager' => $this->priceModel->pager, ]); } @@ -60,22 +42,18 @@ class BagPrice extends BaseController { helper('admin'); $lgIdx = admin_effective_lg_idx(); - if (!$lgIdx) { - return redirect()->to(site_url('admin/bag-prices'))->with('error', '지자체를 선택해 주세요.'); + if (! $lgIdx) { + return redirect()->to(mgmt_url('bag-prices'))->with('error', '지자체를 선택해 주세요.'); } - // 봉투명 코드(O) 목록 $kindModel = model(CodeKindModel::class); - $kind = $kindModel->where('ck_code', 'O')->first(); - $bagCodes = []; + $kind = $kindModel->where('ck_code', 'O')->first(); + $bagCodes = []; if ($kind) { - $bagCodes = model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true); + $bagCodes = model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx); } - return view('admin/layout', [ - 'title' => '봉투 단가 등록', - 'content' => view('admin/bag_price/create', ['bagCodes' => $bagCodes]), - ]); + return $this->renderWorkPage('봉투 단가 등록', 'admin/bag_price/create', ['bagCodes' => $bagCodes]); } public function store() @@ -96,13 +74,12 @@ class BagPrice extends BaseController return redirect()->back()->withInput()->with('errors', $this->validator->getErrors()); } - // 봉투명 스냅샷 - $bagCode = $this->request->getPost('bp_bag_code'); + $bagCode = $this->request->getPost('bp_bag_code'); $kindModel = model(CodeKindModel::class); - $kind = $kindModel->where('ck_code', 'O')->first(); - $bagName = ''; + $kind = $kindModel->where('ck_code', 'O')->first(); + $bagName = ''; if ($kind) { - $detail = model(CodeDetailModel::class)->where('cd_ck_idx', $kind->ck_idx)->where('cd_code', $bagCode)->first(); + $detail = model(CodeDetailModel::class)->findResolvedByKindAndCode((int) $kind->ck_idx, (string) $bagCode, $lgIdx); $bagName = $detail ? $detail->cd_name : ''; } @@ -120,36 +97,34 @@ class BagPrice extends BaseController 'bp_reg_mb_idx' => session()->get('mb_idx'), ]); - return redirect()->to(site_url('admin/bag-prices'))->with('success', '봉투 단가가 등록되었습니다.'); + return redirect()->to(mgmt_url('bag-prices'))->with('success', '봉투 단가가 등록되었습니다.'); } public function edit(int $id) { helper('admin'); - $item = $this->priceModel->find($id); - if (!$item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.'); + $lgIdx = admin_effective_lg_idx(); + $item = $this->priceModel->find($id); + if (! $item || (int) $item->bp_lg_idx !== $lgIdx) { + return redirect()->to(mgmt_url('bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.'); } $kindModel = model(CodeKindModel::class); - $kind = $kindModel->where('ck_code', 'O')->first(); - $bagCodes = []; + $kind = $kindModel->where('ck_code', 'O')->first(); + $bagCodes = []; if ($kind) { - $bagCodes = model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true); + $bagCodes = model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx); } - return view('admin/layout', [ - 'title' => '봉투 단가 수정', - 'content' => view('admin/bag_price/edit', ['item' => $item, 'bagCodes' => $bagCodes]), - ]); + return $this->renderWorkPage('봉투 단가 수정', 'admin/bag_price/edit', ['item' => $item, 'bagCodes' => $bagCodes]); } public function update(int $id) { helper('admin'); $item = $this->priceModel->find($id); - if (!$item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.'); + if (! $item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.'); } $rules = [ @@ -165,7 +140,6 @@ class BagPrice extends BaseController return redirect()->back()->withInput()->with('errors', $this->validator->getErrors()); } - // 이력 기록 $db = \Config\Database::connect(); $db->transStart(); @@ -175,12 +149,12 @@ class BagPrice extends BaseController $newVal = (string) $this->request->getPost($field); if ($oldVal !== $newVal) { $this->historyModel->insert([ - 'bph_bp_idx' => $id, - 'bph_field' => $field, - 'bph_old_value' => $oldVal, - 'bph_new_value' => $newVal, - 'bph_changed_at'=> date('Y-m-d H:i:s'), - 'bph_changed_by'=> session()->get('mb_idx'), + 'bph_bp_idx' => $id, + 'bph_field' => $field, + 'bph_old_value' => $oldVal, + 'bph_new_value' => $newVal, + 'bph_changed_at' => date('Y-m-d H:i:s'), + 'bph_changed_by' => session()->get('mb_idx'), ]); } } @@ -197,34 +171,32 @@ class BagPrice extends BaseController $db->transComplete(); - return redirect()->to(site_url('admin/bag-prices'))->with('success', '봉투 단가가 수정되었습니다.'); + return redirect()->to(mgmt_url('bag-prices'))->with('success', '봉투 단가가 수정되었습니다.'); } public function delete(int $id) { helper('admin'); $item = $this->priceModel->find($id); - if (!$item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.'); + if (! $item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.'); } $this->priceModel->delete($id); - return redirect()->to(site_url('admin/bag-prices'))->with('success', '봉투 단가가 삭제되었습니다.'); + + return redirect()->to(mgmt_url('bag-prices'))->with('success', '봉투 단가가 삭제되었습니다.'); } public function history(int $bpIdx) { helper('admin'); $item = $this->priceModel->find($bpIdx); - if (!$item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.'); + if (! $item || (int) $item->bp_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('bag-prices'))->with('error', '단가 정보를 찾을 수 없습니다.'); } $list = $this->historyModel->where('bph_bp_idx', $bpIdx)->orderBy('bph_changed_at', 'DESC')->findAll(); - return view('admin/layout', [ - 'title' => '단가 변경 이력 — ' . $item->bp_bag_name, - 'content' => view('admin/bag_price/history', ['item' => $item, 'list' => $list]), - ]); + return $this->renderWorkPage('단가 변경 이력 — ' . $item->bp_bag_name, 'admin/bag_price/history', ['item' => $item, 'list' => $list]); } } diff --git a/app/Controllers/Admin/PackagingUnit.php b/app/Controllers/Admin/PackagingUnit.php index a8db13e..ae7314f 100644 --- a/app/Controllers/Admin/PackagingUnit.php +++ b/app/Controllers/Admin/PackagingUnit.php @@ -23,8 +23,8 @@ class PackagingUnit extends BaseController { helper('admin'); $lgIdx = admin_effective_lg_idx(); - if (!$lgIdx) { - return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.'); + if (! $lgIdx) { + return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.'); } $builder = $this->unitModel->where('pu_lg_idx', $lgIdx); @@ -38,31 +38,26 @@ class PackagingUnit extends BaseController $builder->groupStart()->where('pu_end_date IS NULL')->orWhere('pu_end_date <=', $endDate)->groupEnd(); } - $list = $builder->orderBy('pu_bag_code', 'ASC')->orderBy('pu_start_date', 'DESC')->paginate(20); + $list = $builder->orderBy('pu_bag_code', 'ASC')->orderBy('pu_start_date', 'DESC')->paginate(20); $pager = $this->unitModel->pager; - return view('admin/layout', [ - 'title' => '포장 단위 관리', - 'content' => view('admin/packaging_unit/index', [ - 'list' => $list, 'startDate' => $startDate, 'endDate' => $endDate, 'pager' => $pager, - ]), + return $this->renderWorkPage('포장 단위 관리', 'admin/packaging_unit/index', [ + 'list' => $list, 'startDate' => $startDate, 'endDate' => $endDate, 'pager' => $pager, ]); } public function create() { helper('admin'); - if (!admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/packaging-units'))->with('error', '지자체를 선택해 주세요.'); + if (! admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('packaging-units'))->with('error', '지자체를 선택해 주세요.'); } - $kind = model(CodeKindModel::class)->where('ck_code', 'O')->first(); - $bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : []; + $lgIdx = admin_effective_lg_idx(); + $kind = model(CodeKindModel::class)->where('ck_code', 'O')->first(); + $bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : []; - return view('admin/layout', [ - 'title' => '포장 단위 등록', - 'content' => view('admin/packaging_unit/create', ['bagCodes' => $bagCodes]), - ]); + return $this->renderWorkPage('포장 단위 등록', 'admin/packaging_unit/create', ['bagCodes' => $bagCodes]); } public function store() @@ -83,10 +78,10 @@ class PackagingUnit extends BaseController } $bagCode = $this->request->getPost('pu_bag_code'); - $kind = model(CodeKindModel::class)->where('ck_code', 'O')->first(); + $kind = model(CodeKindModel::class)->where('ck_code', 'O')->first(); $bagName = ''; if ($kind) { - $detail = model(CodeDetailModel::class)->where('cd_ck_idx', $kind->ck_idx)->where('cd_code', $bagCode)->first(); + $detail = model(CodeDetailModel::class)->findResolvedByKindAndCode((int) $kind->ck_idx, (string) $bagCode, $lgIdx); $bagName = $detail ? $detail->cd_name : ''; } @@ -107,32 +102,30 @@ class PackagingUnit extends BaseController 'pu_reg_mb_idx' => session()->get('mb_idx'), ]); - return redirect()->to(site_url('admin/packaging-units'))->with('success', '포장 단위가 등록되었습니다.'); + return redirect()->to(mgmt_url('packaging-units'))->with('success', '포장 단위가 등록되었습니다.'); } public function edit(int $id) { helper('admin'); $item = $this->unitModel->find($id); - if (!$item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.'); + if (! $item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.'); } - $kind = model(CodeKindModel::class)->where('ck_code', 'O')->first(); - $bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : []; + $lgIdx = admin_effective_lg_idx(); + $kind = model(CodeKindModel::class)->where('ck_code', 'O')->first(); + $bagCodes = $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : []; - return view('admin/layout', [ - 'title' => '포장 단위 수정', - 'content' => view('admin/packaging_unit/edit', ['item' => $item, 'bagCodes' => $bagCodes]), - ]); + return $this->renderWorkPage('포장 단위 수정', 'admin/packaging_unit/edit', ['item' => $item, 'bagCodes' => $bagCodes]); } public function update(int $id) { helper('admin'); $item = $this->unitModel->find($id); - if (!$item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.'); + if (! $item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.'); } $rules = [ @@ -156,12 +149,12 @@ class PackagingUnit extends BaseController $newVal = (string) $this->request->getPost($field); if ($oldVal !== $newVal) { $this->historyModel->insert([ - 'puh_pu_idx' => $id, - 'puh_field' => $field, - 'puh_old_value' => $oldVal, - 'puh_new_value' => $newVal, - 'puh_changed_at'=> date('Y-m-d H:i:s'), - 'puh_changed_by'=> session()->get('mb_idx'), + 'puh_pu_idx' => $id, + 'puh_field' => $field, + 'puh_old_value' => $oldVal, + 'puh_new_value' => $newVal, + 'puh_changed_at' => date('Y-m-d H:i:s'), + 'puh_changed_by' => session()->get('mb_idx'), ]); } } @@ -180,34 +173,33 @@ class PackagingUnit extends BaseController ]); $db->transComplete(); - return redirect()->to(site_url('admin/packaging-units'))->with('success', '포장 단위가 수정되었습니다.'); + + return redirect()->to(mgmt_url('packaging-units'))->with('success', '포장 단위가 수정되었습니다.'); } public function delete(int $id) { helper('admin'); $item = $this->unitModel->find($id); - if (!$item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.'); + if (! $item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.'); } $this->unitModel->delete($id); - return redirect()->to(site_url('admin/packaging-units'))->with('success', '포장 단위가 삭제되었습니다.'); + + return redirect()->to(mgmt_url('packaging-units'))->with('success', '포장 단위가 삭제되었습니다.'); } public function history(int $puIdx) { helper('admin'); $item = $this->unitModel->find($puIdx); - if (!$item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.'); + if (! $item || (int) $item->pu_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('packaging-units'))->with('error', '포장 단위를 찾을 수 없습니다.'); } $list = $this->historyModel->where('puh_pu_idx', $puIdx)->orderBy('puh_changed_at', 'DESC')->findAll(); - return view('admin/layout', [ - 'title' => '포장 단위 변경 이력 — ' . $item->pu_bag_name, - 'content' => view('admin/packaging_unit/history', ['item' => $item, 'list' => $list]), - ]); + return $this->renderWorkPage('포장 단위 변경 이력 — ' . $item->pu_bag_name, 'admin/packaging_unit/history', ['item' => $item, 'list' => $list]); } } diff --git a/app/Controllers/Admin/PasswordChange.php b/app/Controllers/Admin/PasswordChange.php index 6bf6638..fee33aa 100644 --- a/app/Controllers/Admin/PasswordChange.php +++ b/app/Controllers/Admin/PasswordChange.php @@ -9,14 +9,14 @@ class PasswordChange extends BaseController { public function index() { - return view('admin/layout', [ - 'title' => '비밀번호 변경', - 'content' => view('admin/password_change/index'), - ]); + helper('admin'); + + return $this->renderWorkPage('비밀번호 변경', 'admin/password_change/index'); } public function update() { + helper('admin'); $rules = [ 'current_password' => 'required', 'new_password' => 'required|min_length[4]|max_length[255]', @@ -50,6 +50,6 @@ class PasswordChange extends BaseController 'mb_passwd' => password_hash($this->request->getPost('new_password'), PASSWORD_DEFAULT), ]); - return redirect()->to(site_url('admin/password-change'))->with('success', '비밀번호가 변경되었습니다.'); + return redirect()->to(mgmt_url('password-change'))->with('success', '비밀번호가 변경되었습니다.'); } } diff --git a/app/Views/admin/bag_price/create.php b/app/Views/admin/bag_price/create.php index 6e74c20..1c35e04 100644 --- a/app/Views/admin/bag_price/create.php +++ b/app/Views/admin/bag_price/create.php @@ -2,7 +2,7 @@ 봉투 단가 등록
-
+
@@ -48,7 +48,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/bag_price/edit.php b/app/Views/admin/bag_price/edit.php index 3f1181a..94bb456 100644 --- a/app/Views/admin/bag_price/edit.php +++ b/app/Views/admin/bag_price/edit.php @@ -2,7 +2,7 @@ 봉투 단가 수정
-
+
@@ -49,7 +49,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/bag_price/history.php b/app/Views/admin/bag_price/history.php index 9d92f10..9c5007a 100644 --- a/app/Views/admin/bag_price/history.php +++ b/app/Views/admin/bag_price/history.php @@ -1,6 +1,6 @@
- ← 단가 목록 + ← 단가 목록 | 단가 변경 이력 — bp_bag_name) ?> (bp_bag_code) ?>)
diff --git a/app/Views/admin/bag_price/index.php b/app/Views/admin/bag_price/index.php index bc04761..86468cb 100644 --- a/app/Views/admin/bag_price/index.php +++ b/app/Views/admin/bag_price/index.php @@ -1,23 +1,20 @@ '봉투 단가 관리']) ?> +
봉투 단가 관리 -
-
-
- - - - - - 초기화 -
-
+

목록·등록·수정·삭제는 이 화면에서, 기간·봉투별 조회·인쇄봉투 단가(조회)에서 이용하세요.

@@ -31,7 +28,7 @@ - + @@ -46,10 +43,10 @@ -
적용시작 적용종료 상태작업작업
bp_start_date) ?> bp_end_date ?? '현재') ?> bp_state === 1 ? '사용' : '미사용' ?> - 이력 - 수정 -
+
+ 이력 + 수정 + @@ -62,4 +59,4 @@
-
links() ?>
+
links() ?>
diff --git a/app/Views/admin/packaging_unit/create.php b/app/Views/admin/packaging_unit/create.php index b632691..14346ca 100644 --- a/app/Views/admin/packaging_unit/create.php +++ b/app/Views/admin/packaging_unit/create.php @@ -2,7 +2,7 @@ 포장 단위 등록
-
+
@@ -42,7 +42,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/packaging_unit/edit.php b/app/Views/admin/packaging_unit/edit.php index e88ee1f..61aae90 100644 --- a/app/Views/admin/packaging_unit/edit.php +++ b/app/Views/admin/packaging_unit/edit.php @@ -2,7 +2,7 @@ 포장 단위 수정
-
+
@@ -43,7 +43,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/packaging_unit/history.php b/app/Views/admin/packaging_unit/history.php index 3348d03..d893148 100644 --- a/app/Views/admin/packaging_unit/history.php +++ b/app/Views/admin/packaging_unit/history.php @@ -1,6 +1,6 @@
- ← 포장 단위 목록 + ← 포장 단위 목록 | 변경 이력 — pu_bag_name) ?> (pu_bag_code) ?>)
diff --git a/app/Views/admin/packaging_unit/index.php b/app/Views/admin/packaging_unit/index.php index 8a0ba84..da8c064 100644 --- a/app/Views/admin/packaging_unit/index.php +++ b/app/Views/admin/packaging_unit/index.php @@ -4,18 +4,18 @@ 포장 단위 관리
-
+ - 초기화 + 초기화
@@ -47,9 +47,9 @@ pu_end_date ?? '현재') ?> pu_state === 1 ? '사용' : '미사용' ?> - 이력 - 수정 -
+ 이력 + 수정 +
diff --git a/app/Views/admin/password_change/index.php b/app/Views/admin/password_change/index.php index 5e90f7f..7407b55 100644 --- a/app/Views/admin/password_change/index.php +++ b/app/Views/admin/password_change/index.php @@ -2,7 +2,7 @@ 비밀번호 변경
-
+
diff --git a/app/Views/bag/packaging_units.php b/app/Views/bag/packaging_units.php new file mode 100644 index 0000000..23e325b --- /dev/null +++ b/app/Views/bag/packaging_units.php @@ -0,0 +1,37 @@ +
+

+ ← 기본정보관리 + | + 봉투 단가 +

+
+
+

포장 단위

+ 관리 → +
+ + + + + + + $row): ?> + + + + + + + + + + + + + + + + +
번호봉투코드봉투명박스당 팩 수팩당 낱장 수1박스 총 낱장적용시작적용종료상태
pu_bag_code) ?>pu_bag_name ?? '') ?>pu_box_per_pack ?? 0)) ?>pu_pack_per_sheet ?? 0)) ?>pu_total_per_box ?? 0)) ?>pu_start_date ?? '') ?>pu_end_date ?? '') !== '' && $row->pu_end_date !== null ? esc((string) $row->pu_end_date) : '현재' ?>pu_state ?? 1) === 1 ? '사용' : '만료' ?>
등록된 포장 단위가 없습니다.
+
+
diff --git a/app/Views/bag/prices.php b/app/Views/bag/prices.php new file mode 100644 index 0000000..2768837 --- /dev/null +++ b/app/Views/bag/prices.php @@ -0,0 +1,144 @@ + '봉투 단가 조회', 'printExtraLines' => $printExtraLines ?? []]; +if (($printLgName ?? '') !== '') { + $_ph['printLgName'] = $printLgName; +} +echo view('components/print_header', $_ph); +unset($_ph); +?> + +
+

+ ← 기본정보관리 + | + 포장 단위 + | + 단가 관리(CRUD) +

+ + +

작업 지자체가 선택되지 않았습니다. 관리자는 지자체 선택 후 단가를 조회할 수 있습니다.

+ + +
+ + +
+ + +
+
+ + +
+
+ + '', 'm' => '', 'd' => '']; + $ep = $endParts ?? ['y' => '', 'm' => '', 'd' => '']; + $ymin = (int) ($dateYearMin ?? ((int) date('Y') - 12)); + $ymax = (int) ($dateYearMax ?? ((int) date('Y') + 2)); + ?> +
+ 시작 + + + + ~ + 종료 + + + +
+
+
+ + 초기화 + +
+ +
+ +
+
+

봉투 단가

+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
번호봉투코드봉투명발주단가도매가소비자가적용시작적용종료상태
bp_idx) ?>bp_bag_code) ?>bp_bag_name ?? '') ?>bp_order_price ?? 0)) ?>bp_wholesale ?? 0)) ?>bp_consumer ?? 0)) ?>bp_start_date ?? '') ?>bp_end_date ?? '') !== '' && $row->bp_end_date !== null ? esc((string) $row->bp_end_date) : '현재' ?>bp_state ?? 1) === 1 ? '사용' : '만료' ?>
등록된 단가 정보가 없습니다.
+
+ +
links() ?>
+ +
+
diff --git a/writable/database/bag_price_test_seed.sql b/writable/database/bag_price_test_seed.sql new file mode 100644 index 0000000..0b52a9f --- /dev/null +++ b/writable/database/bag_price_test_seed.sql @@ -0,0 +1,49 @@ +-- 봉투 단가 테스트 데이터 (/bag/bag-prices — 적용 시작·종료 다양) +-- 전제: bag_price 테이블 존재, code_master O종 봉투코드와 맞춤(화면에서 선택 가능한 코드) +-- 대상 지자체: 활성 지자체 중 최소 lg_idx + lg_code 110204(남구), UNION 중복 제거 +-- 재실행: 동일 (지자체, 봉투코드, 적용시작일) 이 이미 있으면 삽입 안 함 + +SET NAMES utf8mb4; + +INSERT INTO `bag_price` (`bp_lg_idx`, `bp_bag_code`, `bp_bag_name`, `bp_order_price`, `bp_wholesale`, `bp_consumer`, `bp_start_date`, `bp_end_date`, `bp_state`, `bp_regdate`) +WITH `target_lg` AS ( + (SELECT `lg_idx` FROM `local_government` WHERE `lg_state` = 1 ORDER BY `lg_idx` ASC LIMIT 1) + UNION + (SELECT `lg_idx` FROM `local_government` WHERE `lg_code` = '110204' LIMIT 1) +) +SELECT + t.`lg_idx`, + v.`c`, + v.`n`, + v.`o`, + v.`w`, + v.`co`, + v.`s`, + v.`e`, + v.`st`, + NOW() +FROM `target_lg` t +CROSS JOIN ( + SELECT '10112' AS c, '일반용 3L' AS n, 22.00 AS o, 58.00 AS w, 78.00 AS co, DATE '2023-01-01' AS s, DATE '2023-12-31' AS e, 0 AS st + UNION ALL SELECT '10112', '일반용 3L', 24.00, 59.00, 79.00, '2024-07-01', '2024-12-31', 0 + UNION ALL SELECT '10122', '일반용 5L', 33.00, 98.00, 128.00, '2024-01-01', '2024-08-31', 0 + UNION ALL SELECT '10122', '일반용 5L', 36.00, 102.00, 132.00, '2025-09-01', NULL, 1 + UNION ALL SELECT '10132', '일반용 10L', 55.00, 180.00, 240.00, '2025-11-01', '2025-12-31', 1 + UNION ALL SELECT '10132', '일반용 10L', 62.00, 192.00, 252.00, '2026-01-15', NULL, 1 + UNION ALL SELECT '10152', '일반용 20L', 88.00, 340.00, 450.00, '2022-05-01', '2022-12-31', 0 + UNION ALL SELECT '10152', '일반용 20L', 102.00, 375.00, 495.00, '2026-04-01', NULL, 1 + UNION ALL SELECT '60102', '음식물 2L', 17.00, 48.00, 58.00, '2025-01-01', NULL, 1 + UNION ALL SELECT '60132', '음식물 10L', 68.00, 205.00, 275.00, '2025-06-01', '2025-12-31', 0 + UNION ALL SELECT '60132', '음식물 10L', 72.00, 212.00, 282.00, '2026-03-01', NULL, 1 + UNION ALL SELECT '20172', '공공용 50L', 175.00, 680.00, 0.00, '2020-01-01', '2020-12-31', 0 + UNION ALL SELECT '40152', '공동주택용 20L', 85.00, 330.00, 440.00, '2025-12-01', '2026-02-28', 1 + UNION ALL SELECT '10172', '일반용 50L', 205.00, 850.00, 1120.00, '2026-06-01', NULL, 1 + UNION ALL SELECT '10192', '일반용 75L', 295.00, 1260.00, 1660.00, '2026-12-01', NULL, 1 +) v +WHERE NOT EXISTS ( + SELECT 1 FROM `bag_price` b + WHERE b.`bp_lg_idx` = t.`lg_idx` AND b.`bp_bag_code` = v.`c` AND b.`bp_start_date` = v.`s` +); + +-- bp_state: 0=미사용(과거 단가 등), 1=사용 +-- bp_end_date NULL = 현재 적용 중(또는 종료일 미정) diff --git a/writable/database/menu_site_fix_unit_price_mgmt_link.sql b/writable/database/menu_site_fix_unit_price_mgmt_link.sql new file mode 100644 index 0000000..37b3c67 --- /dev/null +++ b/writable/database/menu_site_fix_unit_price_mgmt_link.sql @@ -0,0 +1,11 @@ +-- site 메뉴: "단가 관리" 가 조회 전용(bag/prices)으로 잘못 연결된 경우 → CRUD(bag/bag-prices)로 수정 +-- UTF-8: +-- mysql --default-character-set=utf8mb4 -u ... -p DBNAME < writable/database/menu_site_fix_unit_price_mgmt_link.sql + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci; + +UPDATE `menu` m +INNER JOIN `menu_type` t ON t.mt_idx = m.mt_idx AND t.mt_code = 'site' +SET m.mm_link = 'bag/bag-prices' +WHERE m.mm_name = '단가 관리' + AND m.mm_link = 'bag/prices';