feat:테넌트설정 API 및 다수 서비스 개선
- TenantSetting CRUD API 추가 - Calendar, Entertainment, VAT 서비스 개선 - 5130 BOM 계산 로직 수정 - quote_items에 item_type 컬럼 추가 - tenant_settings 테이블 마이그레이션 - Swagger 문서 업데이트
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Services\Quote;
|
||||
|
||||
use App\Models\Bidding\Bidding;
|
||||
use App\Models\Items\Item;
|
||||
use App\Models\Orders\Order;
|
||||
use App\Models\Orders\OrderItem;
|
||||
use App\Models\Quote\Quote;
|
||||
@@ -180,6 +181,7 @@ private function calculateBomMaterials(Quote $quote): array
|
||||
$allMaterials[] = [
|
||||
'item_index' => $index,
|
||||
'finished_goods_code' => $finishedGoodsCode,
|
||||
'item_id' => $material['item_id'] ?? null,
|
||||
'item_code' => $material['item_code'] ?? '',
|
||||
'item_name' => $material['item_name'] ?? '',
|
||||
'item_type' => $material['item_type'] ?? '',
|
||||
@@ -575,10 +577,17 @@ private function createItems(Quote $quote, array $items, int $tenantId): void
|
||||
$unitPrice = (float) ($item['unit_price'] ?? 0);
|
||||
$totalPrice = $quantity * $unitPrice;
|
||||
|
||||
// item_type: 전달된 값 또는 items 테이블에서 조회
|
||||
$itemType = $item['item_type'] ?? null;
|
||||
if ($itemType === null && isset($item['item_id'])) {
|
||||
$itemType = Item::where('id', $item['item_id'])->value('item_type');
|
||||
}
|
||||
|
||||
QuoteItem::create([
|
||||
'quote_id' => $quote->id,
|
||||
'tenant_id' => $tenantId,
|
||||
'item_id' => $item['item_id'] ?? null,
|
||||
'item_type' => $itemType,
|
||||
'item_code' => $item['item_code'] ?? '',
|
||||
'item_name' => $item['item_name'] ?? '',
|
||||
'specification' => $item['specification'] ?? null,
|
||||
|
||||
Reference in New Issue
Block a user