------------------------------------------------------------------------------
-- ADVANTAGE 2004.4.5
-- DB OBJECT CHANGES SINCE ADVANTAGE 2004.4.4
-- 04/08/2009
------------------------------------------------------------------------------



-------------------------------------------------------------------------------
-- INSERT DEFAULT VALUES for NEWLY CREATED COLUMN in 0.sql !!! Cannot do it there !!!
-------------------------------------------------------------------------------

IF EXISTS
    (
        SELECT * FROM SysObjects O
            INNER JOIN SysColumns C
                ON O.ID = C.ID
        WHERE ObjectProperty(O.ID,'IsUserTable') = 1 AND
              O.Name='AW_User_Companies' AND
              C.Name='Sp_Sales_File_Count'
    ) 
    BEGIN
        UPDATE AW_User_Companies
        SET Sp_Sales_File_Count = 0
    END

-------------------------------------------------------

IF EXISTS
    (
        SELECT * FROM SysObjects O
            INNER JOIN SysColumns C
                ON O.ID=C.ID
        WHERE ObjectProperty(O.ID,'IsUserTable') = 1 AND
              O.Name='AC_Customers' AND
              C.Name='AW_YesNo_Override_Credit_Limit'
    ) 
    BEGIN
        UPDATE AC_Customers
        SET AW_YesNo_Override_Credit_Limit = 0
    END

-------------------------------------------------------

IF EXISTS
    (
        SELECT * FROM SysObjects O
            INNER JOIN SysColumns C
                ON O.ID=C.ID
        WHERE ObjectProperty(O.ID,'IsUserTable') = 1 AND
              O.Name='AC_Customers' AND
              C.Name='AW_YesNo_Override_Overdue'
    ) 
    BEGIN
        UPDATE AC_Customers
        SET AW_YesNo_Override_Overdue = 0
    END

-------------------------------------------------------


-------------------------------------------------------------------------------
-- NEW TABLES
-------------------------------------------------------------------------------


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Sys_AW_Reports]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Sys_AW_Reports]
GO

CREATE TABLE [dbo].[Sys_AW_Reports] (
	[Sys_AW_Reports_ID] [smallint] IDENTITY (1, 1) NOT NULL ,
	[Sys_AW_Modules_ID] [tinyint] NOT NULL ,
	[Type_ID] [tinyint] NOT NULL ,
	[Location] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Report_No] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Report_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Description] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Object_DLL] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Class_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Method_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Date_Captured] [datetime] NULL ,
	[User_ID] [int] NULL ,
	[Touched] [timestamp] NULL ,
	[Slu_AW_Active_ID] [int] NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Sys_AW_Reports] WITH NOCHECK ADD 
	CONSTRAINT [PK_Sys_AW_Reports] PRIMARY KEY  CLUSTERED 
	(
		[Sys_AW_Reports_ID]
	)  ON [PRIMARY] 
GO

setuser
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Sys_AW_Reports].[Class_Name]'
GO

EXEC sp_bindefault N'[dbo].[df_Date_Captured]', N'[Sys_AW_Reports].[Date_Captured]'
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Sys_AW_Reports].[Description]'
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Sys_AW_Reports].[Method_Name]'
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Sys_AW_Reports].[Object_DLL]'
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Sys_AW_Reports].[Location]'
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Sys_AW_Reports].[Report_Name]'
GO

EXEC sp_bindefault N'[dbo].[df_Numeric_One]', N'[Sys_AW_Reports].[Report_No]'
GO

EXEC sp_bindefault N'[dbo].[df_Active]', N'[Sys_AW_Reports].[Slu_AW_Active_ID]'
GO

EXEC sp_bindefault N'[dbo].[df_Numeric_One]', N'[Sys_AW_Reports].[Sys_AW_Modules_ID]'
GO

EXEC sp_bindefault N'[dbo].[df_Numeric_Zero]', N'[Sys_AW_Reports].[Type_ID]'
GO

EXEC sp_bindefault N'[dbo].[df_User_ID]', N'[Sys_AW_Reports].[User_ID]'
GO

setuser
GO

ALTER TABLE [dbo].[Sys_AW_Reports] ADD 
	CONSTRAINT [FK_Sys_AW_Reports_Sys_AW_Modules] FOREIGN KEY 
	(
		[Sys_AW_Modules_ID]
	) REFERENCES [dbo].[Sys_AW_Modules] (
		[Sys_AW_Modules_ID]
	)
GO


-------------------------------------------


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Sys_AW_Options_Log]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Sys_AW_Options_Log]
GO

CREATE TABLE [dbo].[Sys_AW_Options_Log] (
	[Sys_AW_Options_Log_ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Control_Type] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Control_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Control_Index] [smallint] NULL ,
	[Control_Value] [varchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Date_Captured] [datetime] NULL ,
	[User_ID] [int] NULL ,
	[AW_User_Companies_ID] [int] NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Sys_AW_Options_Log] WITH NOCHECK ADD 
	CONSTRAINT [PK_Sys_AW_Options_Log] PRIMARY KEY  CLUSTERED 
	(
		[Sys_AW_Options_Log_ID]
	)  ON [PRIMARY] 
GO

setuser
GO

EXEC sp_bindefault N'[dbo].[df_User_Companies]', N'[Sys_AW_Options_Log].[AW_User_Companies_ID]'
GO

EXEC sp_bindefault N'[dbo].[df_Date_Captured]', N'[Sys_AW_Options_Log].[Date_Captured]'
GO

EXEC sp_bindefault N'[dbo].[df_User_ID]', N'[Sys_AW_Options_Log].[User_ID]'
GO

setuser
GO


-------------------------------------------


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Lup_AS_Procurement_Providers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Lup_AS_Procurement_Providers]
GO

CREATE TABLE [dbo].[Lup_AS_Procurement_Providers] (
	[Lup_AS_Procurement_Providers_ID] [smallint] IDENTITY (1, 1) NOT NULL ,
	[Description] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Server_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Login_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Login_Password] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Folder] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Date_Captured] [datetime] NULL ,
	[User_ID] [int] NULL ,
	[AW_User_Companies_ID] [int] NULL ,
	[Touched] [timestamp] NULL ,
	[Slu_AW_Active_ID] [tinyint] NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Lup_AS_Procurement_Providers] WITH NOCHECK ADD 
	CONSTRAINT [PK_Lup_AS_Procurement_Providers] PRIMARY KEY  CLUSTERED 
	(
		[Lup_AS_Procurement_Providers_ID]
	)  ON [PRIMARY] 
GO

setuser
GO

EXEC sp_bindefault N'[dbo].[df_User_Companies]', N'[Lup_AS_Procurement_Providers].[AW_User_Companies_ID]'
GO

EXEC sp_bindefault N'[dbo].[df_Date_Captured]', N'[Lup_AS_Procurement_Providers].[Date_Captured]'
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Lup_AS_Procurement_Providers].[Login_Name]'
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Lup_AS_Procurement_Providers].[Login_Password]'
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Lup_AS_Procurement_Providers].[Folder]'
GO

EXEC sp_bindefault N'[dbo].[df_Nullstring]', N'[Lup_AS_Procurement_Providers].[Server_Name]'
GO

EXEC sp_bindefault N'[dbo].[df_Active]', N'[Lup_AS_Procurement_Providers].[Slu_AW_Active_ID]'
GO

EXEC sp_bindefault N'[dbo].[df_User_ID]', N'[Lup_AS_Procurement_Providers].[User_ID]'
GO

setuser
GO


-----------------------------------


INSERT Lup_AS_Procurement_Providers
    (
        Description,
        Server_Name,
        Login_Name,
        Login_Password,
        Folder
    )
VALUES
    (
        '3Sigma Logistics',
        '196.211.107.202',
        'FTP3Sigma',
        'Spiralsoft',
        '/sigma1/'
    )


UPDATE Lup_AS_CBilling_Providers
SET Server_Name = '196.211.107.202',
    Login_Name = 'FTP3Sigma',
    Login_Password = 'Spiralsoft',
    Folder = '/spiralsoft/'
WHERE Description = '3Sigma'


-------------------------------------------


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AP_Enterprise_Stock_Replenish_Max]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[AP_Enterprise_Stock_Replenish_Max]
GO

CREATE TABLE [dbo].[AP_Enterprise_Stock_Replenish_Max] (
	[AP_Enterprise_Stock_Replenish_Max_ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Description] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Product_Code] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Pack_Size] [decimal](9, 3) NULL ,
	[Total] [decimal](12, 3) NULL ,
	[Filter] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE  CLUSTERED  INDEX [IX_AP_Enterprise_Stock_Replenish_Max_Search] ON [dbo].[AP_Enterprise_Stock_Replenish_Max]([Filter], [Product_Code], [Pack_Size]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[AP_Enterprise_Stock_Replenish_Max] ADD 
	CONSTRAINT [PK_AP_Enterprise_Stock_Replenish_Max] PRIMARY KEY  NONCLUSTERED 
	(
		[AP_Enterprise_Stock_Replenish_Max_ID]
	)  ON [PRIMARY] 
GO


-------------------------------------------------------------------------------



-------------------------------------------------------------------------------
-- TABLE MODS
-------------------------------------------------------------------------------

SET NOCOUNT ON

INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','101','Sales by Salesperson','SpSSalesReports','CInterface','Show_DayEndRepSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','102','Sales by Floor Salesperson','SpSSalesReports','CInterface','Show_DayEndFloorRepSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','103','Sales by Customer','SpSSalesReports','CInterface','Show_DayEndCustomerSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','104','Sales by Filter by Customer','SpSSalesReports','CInterface','Show_DayEndSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','105','Sales by Customer Type','SpSSalesReports','CInterface','Show_DayEndCustTypeSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','106','Product Sales Analysis','SpSSalesReports','CInterface','Show_DayEndProductSalesAnalysis')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','107','Sales by Cashier','SpSSalesReports','CInterface','Show_DayEndCashierSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','108','Jobcards by Cashier','SpSSalesReports','CInterface','Show_DayEndCashierJobcards')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','109','Zero VAT Sales by Customer','SpSSalesReports','CInterface','Show_DayEndZeroVATSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','110','Sales Profitability by Filter by Customer','SpSSalesReports','CInterface','Show_DayEndProfitSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','111','Sales Profitability by Filter by Product','SpSSalesReports','CInterface','Show_DayEndProfitSalesProduct')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','112','Low Gross Profit Sales by Filter by Product','SpSSalesReports','CInterface','Show_DayEndLowGPSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Reports','113','Sales Promotions','SpSSalesReports','CInterface','Show_SalesPromotions')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,1,'Enterprise Sales Reports','191','Enterprise Sales Filter','SpSSalesReports','CInterface','Show_frmSalesEnterpriseFilter')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,1,'Enterprise Sales Reports','192','Enterprise Customer Sales Filter','SpSSalesReports','CInterface','Show_frmSalesEnterpriseCustomerFilter')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Day-End Reports','141','Cash-Up Audit Trail','SpSSalesAdminReports','CInterface','Show_CashUpAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Day-End Reports','142','Cash-Up Audit Trail by Cashier','SpSSalesAdminReports','CInterface','Show_CashUpCashiers')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Day-End Reports','143','Day-End Sales','SpSSalesAdminReports','CInterface','Show_DayEnd')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Day-End Reports','144','Open Job Cards','SpSSalesDayEndReports','CInterface','Show_OpenJobs')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Day-End Reports','145','Stock Take','SpSProductReports','CInterface','Show_StockTake')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Day-End Reports','146','Stock Take Filtered','SpSProductReports','CInterface','Show_StockTakeFiltered')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Day-End Reports','147','Customer Transaction Types Audit Trail','SpSCustomerReports','CInterface','Show_TranTypeAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','161','Cash-Up Audit Trail','SpSSalesAdminReports','CInterface','Show_CashUpAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','162','Cash-Up Audit Trail by Cashier','SpSSalesAdminReports','CInterface','Show_CashUpCashiers')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','163','Day-End Sales','SpSSalesAdminReports','CInterface','Show_DayEnd')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','164','Zero Cost (100% GP) Sales Audit Trail','SpSSalesAdminReports','CInterface','Show_ZeroCostSales')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','165','Invoice/Jobcard Cross-Reference','SpSSalesAdminReports','CInterface','Show_SalesXref')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','166','Uninvoiced Job Cards','SpSSalesAdminReports','CInterface','Show_UninvoicedJobCards')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','167','Gross Profit Audit Trail','SpSSalesAdminReports','CInterface','Show_GPAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','168','Sales Performance','SpSSalesAdminReports','CInterface','Show_SalesPerformance')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','169','Sales Performance with Sales Quantity','SpSSalesAdminReports','CInterface','Show_SalesPerformance2')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','170','Sales Analysis','SpSSalesAdminReports','CInterface','Show_SalesAnalysis')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (1,0,'Sales Admin Reports','171','Centralised Billing Audit Trail','SpSSalesAdminReports','CInterface','Show_CBillingAudit')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','201','Inventory Analysis','SpSProductReports','CInterface','Show_InventoryAnalysis')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','202','Stock Replenishment','SpSProductReports','CInterface','Show_InventoryReplenishment')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','203','Surplus Stock','SpSProductReports','CInterface','Show_SurplusInventory')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','204','Slow Moving Stock','SpSProductReports','CInterface','Show_SlowMovingInventory')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','205','Product Price List','SpSProductReports','CInterface','Show_ProductPriceList')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','206','Product Price List 2','SpSProductReports','CInterface','Show_ProductPriceList2')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','207','Stock Movement Audit Trail','SpSProductReports','CInterface','Show_InventoryAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','208','Stock Adjustments Audit Trail','SpSProductReports','CInterface','Show_InventoryAdjustments')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','209','Disabled Products','SpSProductReports','CInterface','Show_DisabledProducts')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','210','Stock Take','SpSProductReports','CInterface','Show_StockTake')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','211','Stock Take Filtered','SpSProductReports','CInterface','Show_StockTakeFiltered')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','212','Standard Gross Profit Analysis','SpSProductReports','CInterface','Show_GPAnalysis')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','213','Top 20% Bestsellers','SpSProductReports','CInterface','Show_TopsellerPareto')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','214','Topseller Analysis','SpSProductReports','CInterface','Show_TopsellerAnalysis')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','215','Stock Valuation','SpSProductReports','CInterface','Show_InventoryValuation')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','216','Stock Valuation Movement','SpSProductReports','CInterface','Show_InventoryValuationMovement')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','217','Stock Reconcilliation','SpSProductReports','CInterface','Show_StockRecon')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,0,'Product Reports','218','Product Barcode Labels','SpSProductReports','CInterface','Show_frmProductBarcodes')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,1,'Enterprise Product Reports','291','Enterprise Stock','SpSProductReports','CInterface','Show_frmStockEnterprise')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,1,'Enterprise Product Reports','292','Enterprise Stock Filter','SpSProductReports','CInterface','Show_frmStockEnterpriseFilter')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,1,'Enterprise Product Reports','293','Enterprise Stock Valuation','SpSProductReports','CInterface','Show_frmStockEnterpriseValuation')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,1,'Enterprise Product Reports','294','Enterprise Slow Moving Stock','SpSProductReports','CInterface','Show_frmStockEnterpriseSlowMove')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,1,'Enterprise Product Reports','295','Enterprise Stock MSL','SpSProductReports','CInterface','Show_frmStockEnterpriseMSL')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,1,'Enterprise Product Reports','296','Enterprise Stock Replenishment','SpSProductReports','CInterface','Show_frmStockEnterpriseReplenish')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (2,1,'Enterprise Product Reports','297','Enterprise Stock Replenishment Max Order Qty','SpSProductReports','CInterface','Show_frmStockEnterpriseReplenishMax')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','301','Customer Statements - Cut Sheet Blank A4','SpSCustomerReports','CInterface','Show_CustomerStatementsCutA4')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','302','Customer Age Analysis','SpSCustomerReports','CInterface','Show_CustomerAgeing')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','303','Customer Age Analysis - Condensed','SpSCustomerReports','CInterface','Show_CustomerAgeing2')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','304','Customer Listing','SpSCustomerReports','CInterface','Show_CustomerList')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','305','Customer Audit Trail','SpSCustomerReports','CInterface','Show_CustomerAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','306','Customer Transactions Audit Trail','SpSCustomerReports','CInterface','Show_TransactionAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','307','Customer Ledger','SpSCustomerReports','CInterface','Show_CustomerLedger')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','308','Customer Payment Allocations','SpSCustomerReports','CInterface','Show_PaymentAllocations')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','309','Customer Transaction Types Audit Trail','SpSCustomerReports','CInterface','Show_TranTypeAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','310','Customer Journal GL Allocations','SpSCustomerReports','CInterface','Show_CustomerJournalGL')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','311','Customer Sales Analysis','SpSCustomerReports','CInterface','Show_CustomerSalesAnalysis')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','312','Customer Labels','SpSCustomerReports','CInterface','Show_CustomerLabels')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','313','Top 20% Customers','SpSCustomerReports','CInterface','Show_TopCustomers')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','314','Customer Age Analysis by Salesperson','SpSCustomerReports','CInterface','Show_CustomerAgeingRep')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','315','Customer Age Analysis by Filter','SpSCustomerReports','CInterface','Show_CustomerAgeingFilter')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','316','Nedbank Corporate Invoice Discounting','SpSCustomerReports','CInterface','Show_NedbankInvoiceDiscount')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','317','Unallocated Payment Allocations','SpSCustomerReports','CInterface','Show_UnallocatedPayments')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','318','Customer Listing - Condensed','SpSCustomerReports','CInterface','Show_CustomerListing2')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','319','Inactive Customer Listing','SpSCustomerReports','CInterface','Show_InactiveCustomers')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','320','Customer Transaction Listing','SpSCustomerReports','CInterface','Show_CustTranList')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Reports','321','Customer Contract Pricing','SpSCustomerReports','CInterface','Show_CustContract')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,1,'Enterprise Customer Reports','391','Enterprise Customer Ageing Filter','SpSCustomerReports','CInterface','Show_CustomerEnterpriseAgeing')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Admin Reports','361','Customers Exceeding Cash Terms','SpSCustomerAdminReports','CInterface','Show_CustomerCashTerms')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Admin Reports','362','Customers Exceeding Credit Terms','SpSCustomerAdminReports','CInterface','Show_CustomerCreditTerms')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Admin Reports','363','Customers Exceeding Credit Limit','SpSCustomerAdminReports','CInterface','Show_CustomerCreditLimit')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Admin Reports','364','Customers Payments Received','SpSCustomerAdminReports','CInterface','Show_CustomerPayments')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Admin Reports','365','Customer Performance Statistics','SpSCustomerAdminReports','CInterface','Show_CustomerStats')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (3,0,'Customer Admin Reports','366','Customer History','SpSCustomerAdminReports','CInterface','Show_CustomerHistory')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','401','Supplier Remittance Advices','SpSSupplierReports','CInterface','Show_SupplierRemittance')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','402','Supplier Age Analysis','SpSSupplierReports','CInterface','Show_SupplierAgeing')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','403','Supplier Age Analysis - Period Procedure','SpSSupplierReports','CInterface','Show_SupplierAgeing2')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','404','Supplier Age Analysis - Historical','SpSSupplierReports','CInterface','Show_SupplierAgeingPeriod')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','405','Supplier List','SpSSupplierReports','CInterface','Show_SupplierList')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','406','Supplier Purchase Journal','SpSSupplierReports','CInterface','Show_PurchaseJournal')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','407','Supplier Purchases - Non-GRV and Multi-Split','SpSSupplierReports','CInterface','Show_PurchasesNonGRV')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','408','Purchases by Department','SpSSupplierReports','CInterface','Show_DepartmentPurchases')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','409','Supplier Audit Trail','SpSSupplierReports','CInterface','Show_SupplierAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','410','Supplier Ledger','SpSSupplierReports','CInterface','Show_SupplierLedger')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','411','Outstanding Orders','SpSSupplierReports','CInterface','Show_OutstandingOrders')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','412','Supplier Journal GL Allocations','SpSSupplierReports','CInterface','Show_SupplierJournalGL')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','413','Supplier Payment Allocations','SpSSupplierReports','CInterface','Show_SupplierPaymentGL')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','414','Purchases by Product by Supplier','SpSSupplierReports','CInterface','Show_SupplierProducts')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','415','Purchases by Supplier by Product','SpSSupplierReports','CInterface','Show_ProductSuppliers')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','416','Supplier Payments','SpSSupplierReports','CInterface','Show_SupplierPayments')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','417','Supplier Purchases - CR1','SpSSupplierReports','CInterface','Show_PurchasesCR1')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','418','Supplier Purchase Categories Summary - CR3','SpSSupplierReports','CInterface','Show_PurchasesCR3')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','419','Supplier Purchase Price Variance','SpSSupplierReports','CInterface','Show_PurchaseVariance')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,0,'Supplier Reports','420','Supplier Remittance Advice Summary','SpSSupplierReports','CInterface','Show_RemittanceSummary')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (4,1,'Enterprise Supplier Reports','491','Enterprise Supplier Ageing Filter','SpSSupplierReports','CInterface','Show_frmSupplierEnterpriseAgeing')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','501','Trial Balance','SpSGLReports','CInterface','Show_TrialBalance')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','502','Chart of Accounts','SpSGLReports','CInterface','Show_ChartOfAccounts')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','503','General Ledger Account Listing','SpSGLReports','CInterface','Show_GLListing')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','504','General Ledger Account Listing - BFWD','SpSGLReports','CInterface','Show_GLListingBFWD')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','505','General Ledger Audit Trail','SpSGLReports','CInterface','Show_GLAuditTrail')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','506','General Journals Listing','SpSGLReports','CInterface','Show_GeneralJournals')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','507','Recurring Journals Listing','SpSGLReports','CInterface','Show_RecurringJournals')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','508','V.A.T. Report','SpSGLReports','CInterface','Show_VATReport')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','509','GL Account Transaction Type Summary','SpSGLReports','CInterface','Show_GLTranTypeSummary')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','510','GL Account Transaction Type Listing','SpSGLReports','CInterface','Show_GLTransactions')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','511','Cashbook Listing','SpSCashBookReports','CInterface','Show_CashbookListing')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Accountant Reports','512','Bank Reconciliation','SpSCashBookReports','CInterface','Show_BankRecon')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,1,'Enterprise Financial Reports','591','Enterprise Trial Balance','SpSGLReports','CInterface','Show_frmGLEnterpriseTB')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Financial Reports','541','Balance Sheet','SpSFinancialReports','CInterface','Show_BalanceSheet')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Financial Reports','542','Comparative Balance Sheet','SpSFinancialReports','CInterface','Show_BalanceSheet2')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Financial Reports','543','Income Statement','SpSFinancialReports','CInterface','Show_IncomeStatement')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Financial Reports','544','Comparative Income Statement','SpSFinancialReports','CInterface','Show_IncomeStatement2')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Financial Reports','545','Management Accounts','SpSFinancialReports','CInterface','Show_ManAcct')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Financial Reports','546','Management Accounts - Extended','SpSFinancialReports','CInterface','Show_ManAcct2')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Financial Reports','547','Management Accounts - GL Groups','SpSFinancialReports','CInterface','Show_ManAcct3')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,0,'Financial Reports','548','Annual Operating Budget','SpSFinancialReports','CInterface','Show_AnnualBudget')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,1,'Enterprise Financial Reports','592','Enterprise Balance Sheet','SpSFinancialReports','CInterface','Show_frmGLEnterpriseBS')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (5,1,'Enterprise Financial Reports','593','Enterprise Income Statement','SpSFinancialReports','CInterface','Show_frmGLEnterpriseIS')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (6,0,'Manager Reports','601','Controllable Management Accounts','SpSManagerReports','CInterface','Show_ManAcctControl')
GO
INSERT Sys_AW_Reports (Sys_AW_Modules_ID,Type_ID,Location,Report_No,Report_Name,Object_DLL,Class_Name,Method_Name)
 VALUES (6,0,'Manager Reports','602','Management Accounts - GL Groups','SpSFinancialReports','CInterface','Show_ManAcct3')
GO

-------------------------------------------------------------------------------

UPDATE Sys_AW_Reports
SET Description = Report_Name
GO

-------------------------------------------------------------------------------
-- Create Supplier Numbers table
-------------------------------------------------------------------------------

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Suppliers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Suppliers]
GO

CREATE TABLE [dbo].[Suppliers] (
	[AO_Suppliers_ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Supplier_Name] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[Supplier_Number] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'A.R.T.', 'ART0010' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Armstrong', 'ARM0020' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Autoquip', 'AUT0030' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Autozone', 'AUT0040' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Bosal', 'BOS0050' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Bridgestone', 'BRI0060' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Continental', 'CON0070' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Diesel Electric', 'DIE0080' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Dunlop', 'DUN0090' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Gabriel', 'GAB0100' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'General', 'GEN0110' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Goodyear', 'GOO0120' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Cowley', 'COW0130' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Cooper', 'COO0140' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Maxiprest', 'MAX0150' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Megacage', 'MEG0160' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Michelin', 'MIC0170' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Midas', 'MID0180' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Monroe', 'MON0190' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'De Graaf', 'DEG0200' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Pirelli', 'PIR0210' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Furious Wheel', 'FUR0220' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Smith Wheels', 'SMI0230' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Towmaster', 'TOW0240' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Trade Africa', 'TRA0250' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Trentyre', 'TRE0260' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Valitrade', 'VAL0270' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Venter trailers', 'VEN0280' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Sabat', 'SAB0290' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Yokohama', 'YOK0300' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Alfa', 'ALF0310' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'ATE', 'ATE0320' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Ferodo', 'FER0330' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Power', 'POW0340' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Safeline', 'SAF0350' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'BFGoodrich', 'BFG0360' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Kelly', 'KEL0370' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'India', 'IND0380' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Nankang', 'NAN0390' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Tuffex', 'TUF0400' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'FNB', 'FNB0410' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Barum', 'BAR0420' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Maxe', 'MAX0430' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Merit', 'MER0440' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Hankook', 'HAN0460' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Kumho', 'KUM0470' ) 
INSERT Suppliers ( Supplier_Name, Supplier_Number ) VALUES ( 'Willard', 'WIL0480' ) 

-------------------------------------------------------------------------------
-- Update Supplier Numbers
-------------------------------------------------------------------------------

DECLARE @SuppName varchar(40),
        @SuppNo varchar(10)


SET NOCOUNT ON


DECLARE Select_Suppliers CURSOR FOR
    (
        SELECT ISNULL(Supplier_Name, ''),
               ISNULL(Supplier_Number, '')
        FROM Suppliers
    )

OPEN Select_Suppliers

	FETCH NEXT FROM Select_Suppliers 
	INTO
        @SuppName,
        @SuppNo

	WHILE @@FETCH_STATUS = 0
	BEGIN
        UPDATE AO_Suppliers
        SET Supplier_Number = @SuppNo
        WHERE (PATINDEX('%' + RTRIM(LTRIM(@SuppName)), Supplier_Name) <> 0 OR
               PATINDEX(RTRIM(LTRIM(@SuppName)) + '%', Supplier_Name) <> 0)

    	FETCH NEXT FROM Select_Suppliers 
    	INTO
            @SuppName,
            @SuppNo
    END

CLOSE Select_Suppliers

DEALLOCATE Select_Suppliers


-------------------------------------------------------------------------------
-- DROP Suppliers TABLE
-------------------------------------------------------------------------------

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Suppliers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Suppliers]
GO


-------------------------------------------------------------------------------
-- DELETE REDUNDANT TABLES
-------------------------------------------------------------------------------


----------------------------------------------------
--> NEW INDEXES
----------------------------------------------------

IF EXISTS
    (
        SELECT name FROM sysindexes
        WHERE name = 'IX_AS_Transaction_Date_Type'
    )
    BEGIN
        DROP INDEX AS_Transactions.IX_AS_Transaction_Date_Type
    END
GO

----------------------------

CREATE INDEX [IX_AS_Transaction_Date_Type]
    ON [dbo].[AS_Transactions] ([Transaction_Date], [Sys_AW_Transaction_Types_ID], [AW_User_Companies_ID])
GO

-- SELECT name, rowcnt, rows
-- FROM sysindexes
-- WHERE left(name, 3) = 'IX_'
-- ORDER BY name


-------------------------------------------------------------------------------