﻿ ----------------------------------------Hammad  2025-11-27 ---------
  ALTER TABLE dbo.SecurityUserFavoriteMenu ADD
	IsMobile bit NOT NULL CONSTRAINT DF_SecurityUserFavoriteMenu_IsMobile DEFAULT 0
GO
  ----------------------------------------End  2025-11-27 --------------
  -----------------------------------Sayed 2025-11-27--------------------
  CREATE TABLE [dbo].[PositionsGroups](
	[PositionGroupCode] [int] NOT NULL,
	[Name] [nvarchar](150) NULL,
	[Arabic_Name] [nvarchar](150) NULL,
	[Closed] [bit] NULL,
	[MDT] [datetime] NULL,
 CONSTRAINT [PK_PositionsGroups_PositionGroupCode] PRIMARY KEY CLUSTERED 
(
	[PositionGroupCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[PositionsGroups] ADD  CONSTRAINT [DF_PositionsGroups_Closed]  DEFAULT ((0)) FOR [Closed]
GO
alter table Positions
add PositionGroupCode int null
Go
CREATE TABLE [dbo].[SectionsGroups](
	[SectionGroupCode] [int] NOT NULL,
	[Name] [nvarchar](150) NULL,
	[Arabic_Name] [nvarchar](150) NULL,
	[Closed] [bit] NULL,
	[MDT] [datetime] NULL,
 CONSTRAINT [PK_SectionsGroups_SectionGroupCode] PRIMARY KEY CLUSTERED 
(
	[SectionGroupCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[SectionsGroups] ADD  CONSTRAINT [DF_SectionsGroups_Closed]  DEFAULT ((0)) FOR [Closed]
GO
alter table Sections
add SectionGroupCode int null
Go
---------------------End 2025-11-27-----------------------
----------------------------------------- AK 2025-12-01 --------------------
UPDATE Parameters SET ParameterName='PersonCode' where ParameterCode in (18,19)
GO
INSERT INTO [SystemMenu](SystemMenuCode,Name,Arabic_Name,ParentID,ControllerName,ActionName,ImageURL,HTTPMethod,Sequence,IsVisible,ShowInPrivilegePage) VALUES (1211,N'Reports',N'التقارير',575,N'/',N'NULL',N'fa fa-thumb-tack',N'NULL',4,1,1)
GO
INSERT INTO [SystemMenu](SystemMenuCode,Name,Arabic_Name,ParentID,ControllerName,ActionName,ImageURL,HTTPMethod,Sequence,IsVisible,ShowInPrivilegePage) VALUES (1212,N'Reports Consolidated ',N'التقارير المجمعة',1211,N'/PUR/ReportsConsolidated',N'Index',N'fa fa-thumb-tack',N'get',1,1,1)
GO
INSERT INTO [SystemMenu](SystemMenuCode,Name,Arabic_Name,ParentID,ControllerName,ActionName,ImageURL,HTTPMethod,Sequence,IsVisible,ShowInPrivilegePage) VALUES (1213,N'Reports',N'التقارير',1196,N'/',N'NULL',N'fa fa-thumb-tack',N'NULL',4,1,1)
GO
INSERT INTO [SystemMenu](SystemMenuCode,Name,Arabic_Name,ParentID,ControllerName,ActionName,ImageURL,HTTPMethod,Sequence,IsVisible,ShowInPrivilegePage) VALUES (1214,N'Reports Consolidated ',N'التقارير المجمعة',1213,N'/SAL/ReportsConsolidated',N'Index',N'fa fa-thumb-tack',N'get',1,1,1)
GO
INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(1211,17)
GO
INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(1212,17)
GO
INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(1213,21)
GO
INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(1214,21)
GO
INSERT INTO [SecurityPrivilege](ID,DescriptionAR,DescriptionEN,SystemMenuCode,PrivilegeType) VALUES (22111,N'التقارير',N'Reports',1211,1)
GO
INSERT INTO [SecurityPrivilege](ID,DescriptionAR,DescriptionEN,SystemMenuCode,PrivilegeType) VALUES (22112,N'التقارير المجمعة',N'Reports Consolidated ',1212,1)
GO
INSERT INTO [SecurityPrivilege](ID,DescriptionAR,DescriptionEN,SystemMenuCode,PrivilegeType) VALUES (22113,N'التقارير',N'Reports',1213,1)
GO
INSERT INTO [SecurityPrivilege](ID,DescriptionAR,DescriptionEN,SystemMenuCode,PrivilegeType) VALUES (22114,N'التقارير المجمعة',N'Reports Consolidated ',1214,1)
GO
CREATE TABLE dbo.ReportSecurityUsers
	(
	ReportSecurityUserCode int IDENTITY(1,1) NOT NULL,
	ReportCode int NOT NULL,
	SecurityUserCode int NOT NULL
	)  ON [PRIMARY]
GO
ALTER TABLE dbo.ReportSecurityUsers ADD CONSTRAINT
	PK_ReportSecurityUser PRIMARY KEY CLUSTERED 
	(
	ReportSecurityUserCode
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE dbo.ReportSecurityUsers ADD CONSTRAINT
	FK_ReportSecurityUsers_Reports FOREIGN KEY
	(
	ReportCode
	) REFERENCES dbo.Reports
	(
	ReportCode
	) ON UPDATE  NO ACTION 
	 ON DELETE  NO ACTION 
GO
ALTER TABLE dbo.ReportSecurityUsers ADD CONSTRAINT
	FK_ReportSecurityUsers_SecurityUser FOREIGN KEY
	(
	SecurityUserCode
	) REFERENCES dbo.SecurityUser
	(
	SecurityUserCode
	) ON UPDATE  NO ACTION 
	 ON DELETE  NO ACTION 
GO
ALTER TABLE dbo.ReportSecurityUsers SET (LOCK_ESCALATION = TABLE)
GO

CREATE TABLE dbo.ReportSecurityGroups
	(
	ReportSecurityGroupCode int IDENTITY(1,1) NOT NULL,
	ReportCode int NOT NULL,
	SecurityGroupCode int NOT NULL
	)  ON [PRIMARY]
GO
ALTER TABLE dbo.ReportSecurityGroups ADD CONSTRAINT
	PK_ReportSecurityGroup PRIMARY KEY CLUSTERED 
	(
	ReportSecurityGroupCode
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE dbo.ReportSecurityGroups ADD CONSTRAINT
	FK_ReportSecurityGroups_Reports FOREIGN KEY
	(
	ReportCode
	) REFERENCES dbo.Reports
	(
	ReportCode
	) ON UPDATE  NO ACTION 
	 ON DELETE  NO ACTION 
GO
ALTER TABLE dbo.ReportSecurityGroups ADD CONSTRAINT
	FK_ReportSecurityGroups_SecurityGroup FOREIGN KEY
	(
	SecurityGroupCode
	) REFERENCES dbo.SecurityGroup
	(
	SecurityGroupCode
	) ON UPDATE  NO ACTION 
	 ON DELETE  NO ACTION 
GO
ALTER TABLE dbo.ReportSecurityGroups SET (LOCK_ESCALATION = TABLE)
GO
SET IDENTITY_INSERT [dbo].[LookupTables] ON 
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (40, N'ItemGroup', N'Inventory/ItemGroup', N'GetItemGroup', N'ItemGroupCode', N'Name', N'Arabic_Name')
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (31, N'ItemType', N'Inventory/ItemType', N'GetItemType', N'ItemTypeCode', N'Name', N'Arabic_Name')
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (32, N'NatureItem', N'Inventory/ItemCard', N'GetNatureItem', N'NatureItemCode', N'Name', N'Arabic_Name')
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (33, N'PaymentTerm', N'PUR/PaymentTerm', N'GetPaymentTermList', N'PaymentTermCode', N'Name', N'Arabic_Name')
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (34, N'Store', N'Inventory/Store', N'GetStore', N'StoreCode', N'Name', N'Arabic_Name')
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (35, N'FinancialBranch', N'Inventory/FinancialBranch', N'GetFinancialBranch', N'FinancialBranchesCode', N'Name', N'Arabic_Name')
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (36, N'ItemCategory', N'Inventory/ItemCategory', N'GetItemCategory', N'ItemCategoryCode', N'Name', N'Arabic_Name')
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (37, N'SupplierGroup', N'GenerlLedger/SupplierGroup', N'GetSupplierGroups', N'PersonGroupCode', N'Name', N'Arabic_Name')
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (38, N'CustomerGroup', N'GenerlLedger/CustomerGroup', N'GetCustomerGroups', N'PersonGroupCode', N'Name', N'Arabic_Name')
GO
INSERT [dbo].[LookupTables] ([LookupTableId], [TableName], [ControllerName], [ActionName], [DataValueField], [DataTextFieldEn], [DataTextFieldAr]) VALUES (39, N'DiscountType', N'SAL/DiscountType', N'GetDiscountTypeList', N'DiscountTypeCode', N'Name', N'Arabic_Name')
GO
SET IDENTITY_INSERT [dbo].[LookupTables] OFF
GO
 -----------------------------------------END AK 2025-12-01 --------------------
 -----------------------------------------Hammad 2025-12-02 --------------------
 CREATE TABLE [dbo].[WF_SyncLogException](
	[SyncLogExceptionCode] [int] IDENTITY(1,1) NOT NULL,
	[RequestTypeCode] [int] NOT NULL,
	[RequestId] [float] NOT NULL,
	[Exception] [nvarchar](max) NOT NULL,
	[CreationDate] [datetime] NOT NULL,
 CONSTRAINT [PK_WF_SyncLogException] PRIMARY KEY CLUSTERED 
(
	[SyncLogExceptionCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

 -----------------------------------------End 2025-12-02 --------------------