diff --git a/app/Services/Quote/Handlers/KyungdongFormulaHandler.php b/app/Services/Quote/Handlers/KyungdongFormulaHandler.php index 47034ad..2239b6d 100644 --- a/app/Services/Quote/Handlers/KyungdongFormulaHandler.php +++ b/app/Services/Quote/Handlers/KyungdongFormulaHandler.php @@ -604,21 +604,21 @@ private function calculateGuideRails( $wallSpec = $specs['wall']; $sideSpec = $specs['side']; - // 5130: round(단가 × 길이m) × QTY (단건 반올림 후 QTY 곱셈) + // 5130: 세트가격(단가×2 또는 wall+side) → round(세트가격 × 길이m) × QTY switch ($guideType) { case '벽면형': $price = $this->priceService->getGuideRailPrice($modelName, $finishingType, $wallSpec); if ($price > 0) { - $guideQty = 2 * $quantity; - $perUnitGuide = round($price * $guideLength); + $setPrice = $price * 2; // 5130: 2개 세트 가격 + $perSetTotal = round($setPrice * $guideLength); $items[] = [ 'category' => 'steel', 'item_name' => '가이드레일', 'specification' => "{$modelName} {$finishingType} {$wallSpec} {$guideLength}m × 2", 'unit' => 'm', - 'quantity' => $guideLength * $guideQty, + 'quantity' => $guideLength * 2 * $quantity, 'unit_price' => $price, - 'total_price' => $perUnitGuide * $guideQty, + 'total_price' => $perSetTotal * $quantity, ]; } break; @@ -626,16 +626,16 @@ private function calculateGuideRails( case '측면형': $price = $this->priceService->getGuideRailPrice($modelName, $finishingType, $sideSpec); if ($price > 0) { - $guideQty = 2 * $quantity; - $perUnitGuide = round($price * $guideLength); + $setPrice = $price * 2; // 5130: 2개 세트 가격 + $perSetTotal = round($setPrice * $guideLength); $items[] = [ 'category' => 'steel', 'item_name' => '가이드레일', 'specification' => "{$modelName} {$finishingType} {$sideSpec} {$guideLength}m × 2", 'unit' => 'm', - 'quantity' => $guideLength * $guideQty, + 'quantity' => $guideLength * 2 * $quantity, 'unit_price' => $price, - 'total_price' => $perUnitGuide * $guideQty, + 'total_price' => $perSetTotal * $quantity, ]; } break; @@ -644,28 +644,19 @@ private function calculateGuideRails( $priceWall = $this->priceService->getGuideRailPrice($modelName, $finishingType, $wallSpec); $priceSide = $this->priceService->getGuideRailPrice($modelName, $finishingType, $sideSpec); - if ($priceWall > 0) { - $perUnitWall = round($priceWall * $guideLength); + // 5130: (wallPrice + sidePrice) → round(합산가격 × 길이m) × QTY (단일 항목) + $setPrice = ($priceWall ?: 0) + ($priceSide ?: 0); + if ($setPrice > 0) { + $perSetTotal = round($setPrice * $guideLength); + $spec = "{$modelName} {$finishingType} {$wallSpec}/{$sideSpec} {$guideLength}m"; $items[] = [ 'category' => 'steel', 'item_name' => '가이드레일', - 'specification' => "{$modelName} {$finishingType} {$wallSpec} {$guideLength}m", + 'specification' => $spec, 'unit' => 'm', - 'quantity' => $guideLength * $quantity, - 'unit_price' => $priceWall, - 'total_price' => $perUnitWall * $quantity, - ]; - } - if ($priceSide > 0) { - $perUnitSide = round($priceSide * $guideLength); - $items[] = [ - 'category' => 'steel', - 'item_name' => '가이드레일', - 'specification' => "{$modelName} {$finishingType} {$sideSpec} {$guideLength}m", - 'unit' => 'm', - 'quantity' => $guideLength * $quantity, - 'unit_price' => $priceSide, - 'total_price' => $perUnitSide * $quantity, + 'quantity' => $guideLength * 2 * $quantity, + 'unit_price' => $setPrice, + 'total_price' => $perSetTotal * $quantity, ]; } break;