sozsoft-platform/configs/seeds/sql/object/Prc_T_PurchaseOrder.sql
2026-10-12 13:27:54 +03:00

45 lines
2 KiB
Transact-SQL

IF OBJECT_ID(N'[dbo].[Prc_T_PurchaseOrder]', 'U') IS NULL
BEGIN
CREATE TABLE [dbo].[Prc_T_PurchaseOrder]
(
[Id] uniqueidentifier NOT NULL DEFAULT NEWID(),
[TenantId] uniqueidentifier NULL,
[OrderNo] nvarchar(32) NOT NULL,
[PurchaseRfqId] uniqueidentifier NULL,
[SupplierId] uniqueidentifier NOT NULL,
[SupplierReference] nvarchar(64) NULL,
[AgreementId] uniqueidentifier NULL,
[BranchId] uniqueidentifier NOT NULL,
[OperationTypeId] uniqueidentifier NOT NULL,
[WarehouseId] uniqueidentifier NOT NULL,
[CurrencyId] nvarchar(8) NOT NULL DEFAULT 'TRY',
[ExpectedArrival] datetime NULL,
[ConfirmDate] datetime NULL,
[ArrivalDate] datetime 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,
[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_PurchaseOrder] 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