if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcCsD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcCsD
	print 'AcCsD Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcCsM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcCsM
	print 'AcCsM Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcCshCnt]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcCshCnt
	print 'AcCshCnt Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcCshInOut]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcCshInOut
	print 'AcCshInOut Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcCsTempM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcCsTempM
	print 'AcCsTempM Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcCsTempD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcCsTempD
	print 'AcCsTempD Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcSerial]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcSerial
	print 'AcSerial Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcSerialCrd]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcSerialCrd
	print 'AcSerialCrd Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcSerialCrdTemp]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcSerialCrdTemp
	print 'AcSerialCrdTemp Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcStkQtyD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcStkQtyD
	print 'AcStkQtyD Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcStkQtyDownLoad]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcStkQtyDownLoad
	print 'AcStkQtyDownLoad Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SysDocNo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Update SysDocNo Set LastNumber = '10001'
	print 'SysDocNo Last Number Updated back to 10001'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SysLogTrxErr]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table SysLogTrxErr
	print 'SysLogTrxErr Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SysLogUserActivity]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table SysLogUserActivity
	print 'SysLogUserActivity Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SysLogUserLogin]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table SysLogUserLogin
	print 'SysLogUserLogin Transactions Deleted'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcCardDump]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcCardDump
	print 'AcCardDump Truncated'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcSerialDump]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcSerialDump
	print 'AcSerialDump Truncated'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcStkDump]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcStkDump
	print 'AcStkDump Truncated'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcAuditTrailM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcAuditTrailM
	print 'AcAuditTrailM Truncated'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].AcAuditTrailD') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcAuditTrailD
	print 'AcAuditTrailD Truncated'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcOutOfStock]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcOutOfStock
	print 'AcOutOfStock Truncated'
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AcWaitLstProgress]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
	Truncate Table AcWaitLstProgress
	print 'AcWaitLstProgress Truncated'
GO


If 1 Not In (Select Code From AcMultiPrinter) Begin
	Insert Into AcMultiPrinter
	Values (1, NULL, 'Printer 1')
End
GO

If 2 Not In (Select Code From AcMultiPrinter) Begin
	Insert Into AcMultiPrinter
	Values (2, NULL, 'Printer 2')
End
GO

If 3 Not In (Select Code From AcMultiPrinter) Begin
	Insert Into AcMultiPrinter
	Values (3, NULL, 'Printer 3')
End
GO

If 4 Not In (Select Code From AcMultiPrinter) Begin
	Insert Into AcMultiPrinter
	Values (4, NULL, 'Printer 4')
End
GO

If 5 Not In (Select Code From AcMultiPrinter) Begin
	Insert Into AcMultiPrinter
	Values (5, NULL, 'Printer 5')
End
GO



delete AcStkAdjD
delete AcStkAdjM
delete AcStkCrd



exec pfvalidcalstockbalanceqty