단가 기간이 겹칠 때 최신 등록 단가를 우선 적용한다.

단가 조회 공통 로직을 모델로 통합하고 발주·판매·주문·사이트 화면의 단가 계산이 모두 최신 등록 순서(bp_regdate, bp_idx DESC)를 따르도록 맞춘다.

Made-with: Cursor
This commit is contained in:
taekyoungc
2026-04-22 15:35:36 +09:00
parent 05c479397b
commit 5c89c963ee
5 changed files with 1988 additions and 110 deletions

View File

@@ -105,7 +105,7 @@ class ShopOrder extends BaseController
}
$qty = (int) $qtys[$i];
$price = model(BagPriceModel::class)->where('bp_lg_idx', $lgIdx)->where('bp_bag_code', $code)->where('bp_state', 1)->first();
$price = model(BagPriceModel::class)->latestActiveByBagCode($lgIdx, (string) $code);
$unitPrice = $price ? (float) $price->bp_consumer : 0;
$amount = $unitPrice * $qty;