From 7977ffff1957e29c0ae5a196f8c27af3ca53ae60 Mon Sep 17 00:00:00 2001 From: chpark Date: Thu, 14 May 2026 15:08:18 +0900 Subject: [PATCH] =?UTF-8?q?fix(branch-fee):=20=EB=B3=B8=EC=82=AC(HQ)=20?= =?UTF-8?q?=EC=A0=9C=EC=99=B8=20+=20=EA=B3=84=EC=82=B0=EC=84=9C=20?= =?UTF-8?q?=EB=B0=9C=ED=96=89=20=EB=AA=85=EC=9D=98(supplier=5Fbranch)=20?= =?UTF-8?q?=EA=B8=B0=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 지사관리: - WHERE COALESCE(supplier_branch, statement_branch, 'HQ') != 'HQ' → 본사 발주 완전 제외, 김포 등 지사 명의 계산서만 - snapshot 우선 (supplier_branch) → 옛 발주 폴백 (user_info.statement_branch) - UI: 본사 row 표시 분기 제거, '본사 외' 명시 창고이동 통계: - 본사 계열(HQ_*) → 김포 계열(KIMPO_*) 이동만 필터링 - 같은 본사 내 이동, 같은 김포 내 이동, 김포→본사 역방향 모두 제외 --- src/app/(main)/m/admin/transfers/page.tsx | 4 ++-- src/app/api/m/admin/transfers/route.ts | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/(main)/m/admin/transfers/page.tsx b/src/app/(main)/m/admin/transfers/page.tsx index 9594f95..4b72c1f 100644 --- a/src/app/(main)/m/admin/transfers/page.tsx +++ b/src/app/(main)/m/admin/transfers/page.tsx @@ -63,10 +63,10 @@ export default function TransfersPage() {

- 창고 이동 통계 + 창고 이동 통계 (본사 → 김포)

- 창고 간 이동 이력 (TRANSFER). 수량 × 단가(cost_price) = 이동 금액. 이동자/날짜/시간 포함. + 본사 창고 계열에서 김포 창고 계열(김포지사/창고/용차/시장) 로 이동한 건만 표시. 수량 × 단가(cost_price) = 이동 금액.

diff --git a/src/app/api/m/admin/transfers/route.ts b/src/app/api/m/admin/transfers/route.ts index 428bcf4..382aed6 100644 --- a/src/app/api/m/admin/transfers/route.ts +++ b/src/app/api/m/admin/transfers/route.ts @@ -11,7 +11,13 @@ export async function POST(req: NextRequest) { const dateFrom = body.dateFrom as string | undefined; const dateTo = body.dateTo as string | undefined; - const conditions: string[] = ["SM.ref_type = 'TRANSFER'", "SM.move_type = 'OUT'"]; + // 본사(HQ_*) → 김포(KIMPO_*) 이동만 합산 — 사용자 요구 + const conditions: string[] = [ + "SM.ref_type = 'TRANSFER'", + "SM.move_type = 'OUT'", + "SW.wh_type LIKE 'HQ_%'", + "TW.wh_type LIKE 'KIMPO_%'", + ]; const params: unknown[] = []; let i = 1; if (dateFrom) { conditions.push(`SM.regdate >= $${i++}::date`); params.push(dateFrom); }