summaryrefslogtreecommitdiff
path: root/db/schema
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-09-03 10:35:57 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-09-03 10:35:57 +0000
commita2bc455f654e011c53968b0d3a14389d7259847e (patch)
tree6ff60b8ef0880aaa4cf2c9d4f234772fb0a74537 /db/schema
parentbfe354f7633f62350e61eb784cbf1926079339d1 (diff)
(최겸) 구매 입찰 개발(벤더 응찰 개발 및 기본계약 요청 개발 필)
Diffstat (limited to 'db/schema')
-rw-r--r--db/schema/bidding.ts63
1 files changed, 62 insertions, 1 deletions
diff --git a/db/schema/bidding.ts b/db/schema/bidding.ts
index 723bee32..710fb60d 100644
--- a/db/schema/bidding.ts
+++ b/db/schema/bidding.ts
@@ -256,7 +256,7 @@ export const prItemsForBidding = pgTable('pr_items_for_bidding', {
// 12. 입찰 조건 테이블 (SHI 구매자가 제시하는 조건들)
export const biddingConditions = pgTable('bidding_conditions', {
id: serial('id').primaryKey(),
- biddingCompanyId: integer('bidding_company_id').references(() => biddingCompanies.id).notNull(),
+ biddingId: integer('bidding_id').references(() => biddings.id).notNull(),
// 지급조건
paymentTerms: text('payment_terms'), // 지급조건 옵션들 (JSON 배열)
@@ -347,6 +347,7 @@ export const companyConditionResponses = pgTable('company_condition_responses',
// 계약 및 납기 응답
proposedContractDeliveryDate: date('proposed_contract_delivery_date'), // 제안 계약납기일
priceAdjustmentResponse: boolean('price_adjustment_response'), // 연동제적용 응답
+ isInitialResponse: boolean('is_initial_response'), // 초도여부 응답
// 무역조건 응답
incotermsResponse: varchar('incoterms_response', { length: 100 }), // 선택된 Incoterms
@@ -416,6 +417,63 @@ export const vendorSelectionResults = pgTable('vendor_selection_results', {
updatedAt: timestamp('updated_at').defaultNow().notNull(),
})
+// 19. 하도급대금 등 연동표 테이블
+export const priceAdjustmentForms = pgTable('price_adjustment_forms', {
+ id: serial('id').primaryKey(),
+
+ // companyConditionResponses 테이블과 외래 키로 연결
+ companyConditionResponsesId: integer('company_condition_responses_id')
+ .notNull()
+ .references(() => companyConditionResponses.id),
+
+ // 품목등의 명칭
+ itemName: varchar('item_name', { length: 255 }),
+
+ // 조정대금 반영시점
+ adjustmentReflectionPoint: varchar('adjustment_reflection_point', { length: 255 }),
+
+ // 연동대상 주요 원재료
+ majorApplicableRawMaterial: text('major_applicable_raw_material'),
+
+ // 하도급대금등 연동 산식
+ adjustmentFormula: text('adjustment_formula'),
+
+ // 원재료 가격 기준지표
+ rawMaterialPriceIndex: text('raw_material_price_index'),
+
+ // 기준시점 및 비교시점
+ referenceDate: date('reference_date'), // 기준시점
+ comparisonDate: date('comparison_date'), // 비교시점
+
+ // 연동 비율
+ adjustmentRatio: decimal('adjustment_ratio', { precision: 5, scale: 2 }), // 소수점 2자리까지
+
+ // 기타 사항
+ notes: text('notes'),
+
+ // 조정요건
+ adjustmentConditions: text('adjustment_conditions'),
+
+ // 연동 미적용 주요 원재료
+ majorNonApplicableRawMaterial: text('major_non_applicable_raw_material'),
+
+ // 조정주기
+ adjustmentPeriod: varchar('adjustment_period', { length: 100 }),
+
+ // 수탁기업(협력사) 작성자
+ contractorWriter: varchar('contractor_writer', { length: 100 }),
+
+ // 조정일
+ adjustmentDate: date('adjustment_date'),
+
+ // 연동 미적용 사유
+ nonApplicableReason: text('non_applicable_reason'),
+
+ // 메타 정보
+ createdAt: timestamp('created_at').defaultNow().notNull(),
+ updatedAt: timestamp('updated_at').defaultNow().notNull(),
+});
+
// 타입 정의
export type Bidding = typeof biddings.$inferSelect
export type NewBidding = typeof biddings.$inferInsert
@@ -447,6 +505,9 @@ export type NewBiddingDocument = typeof biddingDocuments.$inferInsert
export type VendorSelectionResult = typeof vendorSelectionResults.$inferSelect
export type NewVendorSelectionResult = typeof vendorSelectionResults.$inferInsert
+export type PriceAdjustmentForm = typeof priceAdjustmentForms.$inferSelect
+export type NewPriceAdjustmentForm = typeof priceAdjustmentForms.$inferInsert
+
// 조인 타입 정의 (자주 사용될 것들)
export type BiddingWithDetails = Bidding & {
specificationMeeting?: SpecificationMeeting