
SET IDENTITY_INSERT [dbo].[AppModule] ON 
INSERT [dbo].[AppModule] ([AppModuleCode], [Name], [Arabic_Name], [IsLicensed], [LicenseNumber]) VALUES (12, N'Inventory', N'المخازن', 1, NULL)
SET IDENTITY_INSERT [dbo].[AppModule] OFF

INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(357,N'Inventory',N'المخازن',NULL,N'',N'','',N'',17,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(357,12)
Go

INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (14010, N'المخازن', N'Inventory', 357, 1)
Go

INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(358,N'Basic Data',N'البيانات الاساسية',357,N'',N'','fa fa-thumb-tack',N'',1,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(358,12)
Go

INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (14011, N'البيانات الاساسية', N'Basic Data', 358, 1)
Go




INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(359,N'Item Categories',N'فئات الاصناف',358,N'/Inventory/ItemCategory',N'Index','fa fa-thumb-tack',N'get',1,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(359,12)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14012,N'فئات الاصناف',N'Item Categories',359,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14013,N'عرض فئات الاصناف',N'View Item Categories',359,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14014,N'إضافة فئات الاصناف',N'Add Item Categories',359,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14015,N'تعديل فئات الاصناف',N'Edit Item Categories',359,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14016,N'حذف فئات الاصناف',N'Delete Item Categories',359,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14017,N'حفظ فئات الاصناف',N'Save Item Categories',359,2)

Go


INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(360,N'Supplier Group',N'مجموعة الموردين',358,N'/Inventory/SupplierGroup',N'Index','fa fa-thumb-tack',N'get',2,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(360,12)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14018,N'مجموعة الموردين',N'Supplier Group',360,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14019,N'عرض مجموعة الموردين',N'View Supplier Group',360,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14020,N'إضافة مجموعة الموردين',N'Add Supplier Group',360,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14021,N'تعديل مجموعة الموردين',N'Edit Supplier Group',360,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14022,N'حذف مجموعة الموردين',N'Delete Supplier Group',360,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14023,N'حفظ مجموعة الموردين',N'Save Supplier Group',360,2)

Go


INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (215, N'Inventory', N'ItemCategory', N'Index', 0, N'get', 14012)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (216, N'Inventory', N'ItemCategory', N'ItemCategory_Read', 0, N'post', 14013)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (217, N'Inventory', N'ItemCategory', N'Save', 1, N'get', 14014)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (218, N'Inventory', N'ItemCategory', N'Save', 2, N'get', 14015)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (219, N'Inventory', N'ItemCategory', N'Delete', 0, N'post', 14016)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (220, N'Inventory', N'ItemCategory', N'Save', 0, N'post', 14017)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (221, N'Inventory', N'SupplierGroup', N'Index', 0, N'get', 14018)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (222, N'Inventory', N'SupplierGroup', N'SupplierGroup_Read', 0, N'post', 14019)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (223, N'Inventory', N'SupplierGroup', N'Save', 1, N'get', 14020)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (224, N'Inventory', N'SupplierGroup', N'Save', 2, N'get', 14021)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (225, N'Inventory', N'SupplierGroup', N'Delete', 0, N'post', 14022)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (226, N'Inventory', N'SupplierGroup', N'Save', 0, N'post', 14023)
Go


------------------------------- End 2020-08-19 --------------------------
------------------------------- Ali 2020-08-23 --------------------------

INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(361,N'Units',N'الوحدات',358,N'/Inventory/ItemUnit',N'Index','fa fa-thumb-tack',N'get',3,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(361,12)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14024,N'الوحدات',N'Units',361,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14025,N'عرض الوحدات',N'View Units',361,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14026,N'إضافة الوحدات',N'Add Units',361,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14027,N'تعديل الوحدات',N'Edit Units',361,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14028,N'حذف الوحدات',N'Delete Units',361,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14029,N'حفظ الوحدات',N'Save Units',361,2)

Go


INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (227, N'Inventory', N'ItemUnit', N'Index', 0, N'get', 14024)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (228, N'Inventory', N'ItemUnit', N'ItemUnit_Read', 0, N'post', 14025)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (229, N'Inventory', N'ItemUnit', N'Save', 1, N'get', 14026)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (230, N'Inventory', N'ItemUnit', N'Save', 2, N'get', 14027)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (231, N'Inventory', N'ItemUnit', N'Delete', 0, N'post', 14028)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (232, N'Inventory', N'ItemUnit', N'Save', 0, N'post', 14029)
Go
------------------------------- End 2020-08-23 --------------------------
------------------------------- Ali 2020-08-24 --------------------------

INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(362,N'Items Group',N'مجموعة الاصناف',358,N'/Inventory/ItemGroup',N'Index','fa fa-thumb-tack',N'get',4,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(362,12)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14030,N'مجموعة الاصناف',N'Items Group',362,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14031,N'عرض مجموعة الاصناف',N'View Items Group',362,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14032,N'إضافة مجموعة الاصناف',N'Add Items Group',362,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14033,N'تعديل مجموعة الاصناف',N'Edit Items Group',362,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14034,N'حذف مجموعة الاصناف',N'Delete Items Group',362,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14035,N'حفظ مجموعة الاصناف',N'Save Items Group',362,2)

Go

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (233, N'Inventory', N'ItemGroup', N'Index', 0, N'get', 14030)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (234, N'Inventory', N'ItemGroup', N'ItemGroup_Read', 0, N'get', 14031)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (235, N'Inventory', N'ItemGroup', N'Save', 1, N'get', 14032)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (236, N'Inventory', N'ItemGroup', N'Save', 2, N'get', 14033)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (237, N'Inventory', N'ItemGroup', N'Delete', 0, N'post', 14034)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (238, N'Inventory', N'ItemGroup', N'Save', 0, N'post', 14035)
Go

  update SystemMenu 
  set Name=N'Items Category',Arabic_Name=N'فئة الاصناف'
  where [SystemMenuCode]=359
  Go
    update SystemMenu 
  set Name=N'Suppliers Group'
  where [SystemMenuCode]=360
  Go


  INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(363,N'Items Type',N'نوع الاصناف',358,N'/Inventory/ItemType',N'Index','fa fa-thumb-tack',N'get',5,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(363,12)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14036,N'نوع الاصناف',N'Items Type',363,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14037,N'عرض نوع الاصناف',N'View Items Type',363,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14038,N'إضافة نوع الاصناف',N'Add Items Type',363,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14039,N'تعديل نوع الاصناف',N'Edit Items Type',363,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14040,N'حذف نوع الاصناف',N'Delete Items Type',363,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14041,N'حفظ نوع الاصناف',N'Save Items Type',363,2)

Go


INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (239, N'Inventory', N'ItemType', N'Index', 0, N'get', 14036)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (240, N'Inventory', N'ItemType', N'ItemType_Read', 0, N'get', 14037)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (241, N'Inventory', N'ItemType', N'Save', 1, N'get', 14038)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (242, N'Inventory', N'ItemType', N'Save', 2, N'get', 14039)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (243, N'Inventory', N'ItemType', N'Delete', 0, N'post', 14040)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (244, N'Inventory', N'ItemType', N'Save', 0, N'post', 14041)
Go

------------------------------- End 2020-08-24 --------------------------
------------------------------- Ali 2020-08-24 --------------------------
  update  [SystemMenu]
  set Arabic_Name=N'إعدادات الاجازات',Name=N'Vacation Configuration',ShowInPrivilegePage=1
  where SystemMenuCode= 215
  Go

  INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (3545, N'عرض إعدادات الاجازات', N'View Vacation Configuration', 215, 2)
  Go

  ALTER TABLE dbo.WF_OvertimeType ADD
	OverTimeLateBand int NULL
GO
  ------------------------------- End 2020-08-24 --------------------------
  ------------------------------- A.Khaled 2020-08-25 --------------------------    
UPDATE SystemMenu SET ControllerName='/'+ControllerName WHERE Charindex('/',ControllerName)<>1
UPDATE SystemMenu SET ControllerName=NULL, ActionName=NULL WHERE SystemMenuCode=116
GO
------------------------------- End 2020-08-25 --------------------------
------------------------------- Hammad 2020-08-27 -----------------------


create PROCEDURE [dbo].[GetItemTypeLevels]
    @id [int]
  
AS
BEGIN
    
   declare @tblitemTypeLevels table(
    		ItemTypeCode int
    			
    	);
    
    	             with itemTypeLevels as(
    	             	select ItemTypeCode from [Inv].[ItemType] where ItemTypeCode = @id
    	             	union all
    	             	select org2.ItemTypeCode from [Inv].[ItemType]  org2, itemTypeLevels  
    	             	where org2.ParentId = itemTypeLevels.ItemTypeCode
    	             ) Insert into @tblitemTypeLevels select * from itemTypeLevels option (maxrecursion 0);

					 select * from @tblitemTypeLevels
    
END


GO




CREATE PROCEDURE [dbo].[GetItemGroupLevels]
    @id [int]
  
AS
BEGIN
    
   declare @tblitemGroupLevels table(
    		ItemGroupCode int
    			
    	);
    
    	             with itemGroupLevels as(
    	             	select ItemGroupCode from [Inv].[ItemGroup] where ItemGroupCode = @id
    	             	union all
    	             	select org2.ItemGroupCode from [Inv].[ItemGroup]  org2, itemGroupLevels  
    	             	where org2.ParentId = itemGroupLevels.ItemGroupCode
    	             ) Insert into @tblitemGroupLevels select * from itemGroupLevels option (maxrecursion 0);

					 select * from @tblitemGroupLevels
    
END


GO



------------------------------- End 2020-08-27 -----------------------
------------------------------- Hammad 2020-08-30 --------------------
CREATE PROCEDURE [dbo].[GetStoreLevels]
    @id [int]
  
AS
BEGIN
    
   declare @tblStoreLevels table(
    		StoreId int
    			
    	);
    
    	             with StoreLevels as(
    	             	select StoreId from [Inv].[Store] where StoreId = @id
    	             	union all
    	             	select store2.StoreId from [Inv].[Store]  store2, StoreLevels  
    	             	where store2.ParentId = StoreLevels.StoreId
    	             ) Insert into @tblStoreLevels select * from StoreLevels option (maxrecursion 0);

					 select * from @tblStoreLevels
    
END


GO

------------------------------- End 2020-08-30 --------------------
------------------------------- Ali 2020-08-31 --------------------
INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(364,N'Item Card',N'كارت الصنف',358,N'/Inventory/ItemCard',N'Index','fa fa-thumb-tack',N'get',6,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(364,12)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14042,N'كارت الصنف',N'Item Card',364,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14043,N'عرض كارت الصنف',N'View Item Card',364,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14044,N'إضافة كارت الصنف',N'Add Item Card',364,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14045,N'تعديل كارت الصنف',N'Edit Item Card',364,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14046,N'حذف كارت الصنف',N'Delete Item Card',364,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14047,N'حفظ كارت الصنف',N'Save Item Card',364,2)

Go


INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (245, N'Inventory', N'ItemCard', N'Index', 0, N'get', 14042)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (246, N'Inventory', N'ItemCard', N'ItemCard_Read', 0, N'post', 14043)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (247, N'Inventory', N'ItemCard', N'Save', 1, N'get', 14044)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (248, N'Inventory', N'ItemCard', N'Save', 2, N'get', 14045)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (249, N'Inventory', N'ItemCard', N'Delete', 0, N'post', 14046)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (250, N'Inventory', N'ItemCard', N'Save', 0, N'post', 14047)
Go


INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(366,N'Bill Material',N'مقايسة الاصناف',358,N'/Inventory/BillMaterial',N'Index','fa fa-thumb-tack',N'get',8,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(366,12)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14054,N'مقايسة الاصناف',N'Bill Material',366,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14055,N'عرض مقايسة الاصناف',N'View Bill Material',366,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14056,N'إضافة مقايسة الاصناف',N'Add Bill Material',366,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14057,N'تعديل مقايسة الاصناف',N'Edit Bill Material',366,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14058,N'حذف مقايسة الاصناف',N'Delete Bill Material',366,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14059,N'حفظ مقايسة الاصناف',N'Save Bill Material',366,2)

Go

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (257, N'Inventory', N'BillMaterial', N'Index', 0, N'get', 14054)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (258, N'Inventory', N'BillMaterial', N'BillMaterial_Read', 0, N'post', 14055)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (259, N'Inventory', N'BillMaterial', N'Save', 1, N'get', 14056)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (260, N'Inventory', N'BillMaterial', N'Save', 2, N'get', 14057)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (261, N'Inventory', N'BillMaterial', N'Delete', 0, N'post', 14058)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (262, N'Inventory', N'BillMaterial', N'Save', 0, N'post', 14059)
Go

------------------------------- End 2020-08-31 --------------------


------------------------------- Hammad 2020-08-31 --------------------

INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage]) 
VALUES (365, N' Store', N' مخزن', 358, N'/Inventory/Store', N'Index', N'fa fa-thumb-tack', N'get', 7, 1, 1)
Go

INSERT [dbo].[SystemMenuModule] ( [SystemMenuCode], [AppModuleCode]) VALUES (365, 12)
Go

INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (14048, N'مخزن', N'Store', 365, 1)
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (14049, N'عرض مخزن', N'View Store', 365, 2)
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (14050, N'إضافة مخزن', N'Add Store', 365, 2)
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (14051, N'تعديل مخزن', N'Edit Store', 365, 2)
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (14052, N'حذف مخزن', N'Delete Store', 365, 2)
INSERT [dbo].[SecurityPrivilege] ([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES (14053, N'حفظ مخزن', N'Save Store', 365, 2)
Go



INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (251, N'Inventory', N'Store', N'Index', 0, N'get', 14048)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (252, N'Inventory', N'Store', N'Store_Read', 0, N'get', 14049)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (253, N'Inventory', N'Store', N'Save', 1, N'get', 14050)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (254, N'Inventory', N'Store', N'Save', 2, N'get', 14051)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (255, N'Inventory', N'Store', N'Delete', 0, N'post', 14052)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (256, N'Inventory', N'Store', N'Save', 0, N'post', 14053)
Go

Alter PROCEDURE [dbo].[GetStoreLevels]
    @id [int]
  
AS
BEGIN
    
   declare @tblStoreLevels table(
    		StoreId int
    			
    	);
    
    	             with StoreLevels as(
    	             	select StoreId from [Inv].[Store] where StoreId = @id
    	             	union all
    	             	select store2.StoreId from [Inv].[Store]  store2, StoreLevels  
    	             	where store2.ParentId = StoreLevels.StoreId
    	             ) Insert into @tblStoreLevels select * from StoreLevels option (maxrecursion 0);

					 select * from @tblStoreLevels
    
END



GO
------------------------------- End 2020-08-31 --------------------
------------------------------- Ali 2020-09-01 --------------------

INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(367,N'Suppliers',N'الموردين',358,N'/Inventory/Supplier',N'Index','fa fa-thumb-tack',N'get',9,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(367,12)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14060,N'الموردين',N'Suppliers',367,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14061,N'عرض الموردين',N'View Suppliers',367,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14062,N'إضافة الموردين',N'Add Suppliers',367,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14063,N'تعديل الموردين',N'Edit Suppliers',367,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14064,N'حذف الموردين',N'Delete Suppliers',367,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(14065,N'حفظ الموردين',N'Save Suppliers',367,2)

Go



INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (263, N'Inventory', N'Supplier', N'Index', 0, N'get', 14060)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (264, N'Inventory', N'Supplier', N'Supplier_Read', 0, N'post', 14061)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (265, N'Inventory', N'Supplier', N'Save', 1, N'get', 14062)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (266, N'Inventory', N'Supplier', N'Save', 2, N'get', 14063)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (267, N'Inventory', N'Supplier', N'Delete', 0, N'post', 14064)
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES (268, N'Inventory', N'Supplier', N'Save', 0, N'post', 14065)
Go
------------------------------- End 2020-09-01 --------------------
------------------------------- Ali 2020-09-03 --------------------

INSERT [dbo].[ConfigParameter] ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId]) VALUES (N'WfShiftInDayOfRest', N'Shift In Day Of Rest', N'الدوام فى يوم الراحة', N'0', 2, 1, 2, 1, NULL, NULL, 21)
Go

Alter PROCEDURE [dbo].[GetStoreLevels]
    @id [int]
  
AS
BEGIN
    
   declare @tblStoreLevels table(
    		StoreId int
    			
    	);
    
    	             with StoreLevels as(
    	             	select StoreCode from [Inv].[Store] where StoreCode = @id
    	             	union all
    	             	select store2.StoreCode from [Inv].[Store]  store2, StoreLevels  
    	             	where store2.ParentId = StoreLevels.StoreCode
    	             ) Insert into @tblStoreLevels select * from StoreLevels option (maxrecursion 0);

					 select * from @tblStoreLevels
    
END



GO

------------------------------- End 2020-09-03 --------------------