0172fc4e01
Added Nc Option in settlement Merged Vouchers and SaleVoucher table. Need to update the Sql Schema
61 lines
2.1 KiB
SQL
61 lines
2.1 KiB
SQL
BEGIN TRANSACTION
|
|
SET QUOTED_IDENTIFIER ON
|
|
SET ARITHABORT ON
|
|
SET NUMERIC_ROUNDABORT OFF
|
|
SET CONCAT_NULL_YIELDS_NULL ON
|
|
SET ANSI_NULLS ON
|
|
SET ANSI_PADDING ON
|
|
SET ANSI_WARNINGS ON
|
|
ALTER TABLE dbo.Vouchers DROP CONSTRAINT FK_BasicTransactions_Users_UserID;
|
|
ALTER TABLE dbo.Vouchers DROP CONSTRAINT DF_BasicTransactions_CreationDate;
|
|
ALTER TABLE dbo.Vouchers DROP CONSTRAINT DF_BasicTransactions_LastEditDate;
|
|
CREATE TABLE dbo.Tmp_Vouchers
|
|
(
|
|
VoucherID uniqueidentifier NOT NULL PRIMARY KEY,
|
|
Date datetime NOT NULL,
|
|
Narration nvarchar(200) NULL,
|
|
UserID uniqueidentifier NOT NULL,
|
|
CreationDate datetime NOT NULL,
|
|
LastEditDate datetime NOT NULL,
|
|
Floor int NOT NULL,
|
|
BillID nvarchar(10) NOT NULL,
|
|
KotID nvarchar(10) NOT NULL,
|
|
TableID nvarchar(10) NOT NULL,
|
|
WaiterID uniqueidentifier NOT NULL,
|
|
CustomerID uniqueidentifier NOT NULL,
|
|
AdvanceID uniqueidentifier NULL,
|
|
PaidStatus int NOT NULL,
|
|
VoidReason nvarchar(50) NULL,
|
|
Printed bit NOT NULL,
|
|
Alarm datetime NULL
|
|
) ON [PRIMARY]
|
|
INSERT INTO dbo.Tmp_Vouchers (VoucherID, Date, Narration, UserID, CreationDate, LastEditDate, Floor, BillID, KotID, TableID, WaiterID, CustomerID, AdvanceId, PaidStatus, VoidReason, Printed, Alarm)
|
|
SELECT v.VoucherID, v.Date, v.Narration, v.UserID, v.CreationDate, v.LastEditDate, s.Floor, s.BillID, s.KotID, s.TableID, s.WaiterID, s.CustomerID, s.AdvanceId, s.PaidStatus, s.VoidReason, s.Printed, s.Alarm
|
|
FROM dbo.Vouchers v INNER JOIN dbo.SaleVoucher s ON v.VoucherID = s.VoucherID;
|
|
ALTER TABLE dbo.SaleVoucher DROP CONSTRAINT FK_SaleVoucher_Vouchers;
|
|
ALTER TABLE dbo.Inventory DROP CONSTRAINT FK_Inventory_Vouchers;
|
|
DROP TABLE dbo.SaleVoucher;
|
|
DROP TABLE dbo.Vouchers;
|
|
EXECUTE sp_rename N'dbo.Tmp_Vouchers', N'Vouchers', 'OBJECT';
|
|
ALTER TABLE dbo.Vouchers ADD CONSTRAINT
|
|
FK_Vouchers_Users FOREIGN KEY
|
|
(
|
|
UserID
|
|
) REFERENCES dbo.Users
|
|
(
|
|
UserID
|
|
) ON UPDATE NO ACTION
|
|
ON DELETE NO ACTION
|
|
|
|
ALTER TABLE dbo.Inventory ADD CONSTRAINT
|
|
FK_Inventory_Vouchers FOREIGN KEY
|
|
(
|
|
VoucherID
|
|
) REFERENCES dbo.Vouchers
|
|
(
|
|
VoucherID
|
|
) ON UPDATE NO ACTION
|
|
ON DELETE NO ACTION
|
|
ALTER TABLE dbo.ProductGroups DROP COLUMN IsForSale, IsForPurchase;
|
|
COMMIT
|