sozsoft-platform/configs/seeds/sql/object/Prc_T_PurchaseRfq.sql

56 lines
2.4 KiB
MySQL
Raw Normal View History

2026-10-11 19:57:23 +00:00
IF OBJECT_ID(N'[dbo].[Prc_T_PurchaseRfq]', 'U') IS NULL
BEGIN
CREATE TABLE [dbo].[Prc_T_PurchaseRfq]
(
[Id] uniqueidentifier NOT NULL DEFAULT NEWID(),
[TenantId] uniqueidentifier NULL,
[RfqNo] nvarchar(32) NOT NULL,
[TenderGroupId] uniqueidentifier NULL,
[SupplierId] uniqueidentifier NOT NULL,
[SupplierReference] nvarchar(64) NULL,
[AgreementId] uniqueidentifier NULL,
2026-10-12 10:27:54 +00:00
[BranchId] uniqueidentifier NOT NULL,
[OperationTypeId] uniqueidentifier NOT NULL,
[WarehouseId] uniqueidentifier NOT NULL,
2026-10-11 19:57:23 +00:00
[CurrencyId] nvarchar(8) NOT NULL DEFAULT 'TRY',
[OrderDeadline] datetime NULL,
[ExpectedArrival] datetime NULL,
[SupplierResponse] nvarchar(16) NOT NULL DEFAULT 'Waiting',
[QuoteDate] datetime NULL,
[QuoteValidUntil] date NULL,
[BuyerUserId] uniqueidentifier NOT NULL,
[SourceDocument] nvarchar(512) NULL,
[ProjectId] uniqueidentifier NULL,
[IncotermId] uniqueidentifier NULL,
[IncotermLocation] nvarchar(128) NULL,
[PaymentTermId] uniqueidentifier NULL,
[Terms] nvarchar(MAX) NULL,
[PriceWeight] decimal(5, 2) NOT NULL DEFAULT 70,
[DeliveryWeight] decimal(5, 2) NOT NULL DEFAULT 30,
[UntaxedAmount] decimal(18, 4) NOT NULL DEFAULT 0,
[TaxAmount] decimal(18, 4) NOT NULL DEFAULT 0,
[TotalAmount] decimal(18, 4) NOT NULL DEFAULT 0,
[Status] nvarchar(16) NOT NULL DEFAULT 'Draft',
[PendingAction] nvarchar(16) NULL,
[LastSentDate] datetime NULL,
[CreationTime] datetime2 NOT NULL DEFAULT GETUTCDATE(),
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[IsDeleted] bit NOT NULL DEFAULT 0,
[DeletionTime] datetime2 NULL,
[DeleterId] uniqueidentifier NULL,
CONSTRAINT [PK_Prc_T_PurchaseRfq] PRIMARY KEY NONCLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = N'IX_Prc_T_PurchaseRfq_TenderGroupId' AND object_id = OBJECT_ID(N'[dbo].[Prc_T_PurchaseRfq]'))
BEGIN
CREATE INDEX [IX_Prc_T_PurchaseRfq_TenderGroupId] ON [dbo].[Prc_T_PurchaseRfq] ([TenderGroupId]);
END
GO