--fiesGO
GO
--Script for TABLES
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aaaa]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aaaa](
[8-9 am] [numeric] (18,0) NULL,
[9-10 am] [numeric] (18,0) NULL,
[10-11 am] [numeric] (18,0) NULL,
[11-12 am] [numeric] (18,0) NULL,
[12-1 Pm] [numeric] (18,0) NULL,
[1-2 Pm] [numeric] (18,0) NULL,
[2-3 Pm] [numeric] (18,0) NULL,
[3-4 Pm] [numeric] (18,0) NULL,
[4-5 Pm] [numeric] (18,0) NULL,
[5-6 Pm] [numeric] (18,0) NULL,
[6-7 Pm] [numeric] (18,0) NULL,
[7-8 Pm] [numeric] (18,0) NULL,
[8-9 Pm] [numeric] (18,0) NULL,
[9-10 Pm] [numeric] (18,0) NULL,
[10-11 Pm] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aAccountFinYearOpening]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aAccountFinYearOpening](
[Companyid] [int] NOT NULL,
[Accountid] [int] NOT NULL,
[Financialid] [int] NOT NULL,
[departmentid] [int] NOT NULL,
[Openingamount] [numeric] (18,2) NULL,
[Openingactualamount] [numeric] (18,2) NULL,
[openingdepamount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aAccountMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aAccountMaster](
[AccountID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[AccountCode] [varchar] (50) NOT NULL,
[Active] [bit] NOT NULL,
[GroupID] [int] NOT NULL,
[AccountDesc] [varchar] (250) NOT NULL,
[ControlledAccount] [varchar] (50) NULL,
[BudgetAmount] [numeric] (18,2) NULL,
[openingamount] [numeric] (18,2) NULL,
[openingactualamount] [numeric] (18,2) NULL,
[openingdepamount] [numeric] (18,2) NULL,
[OrderNo] [int] NOT NULL,
[CurrencyID] [int] NULL,
[Misc] [varchar] (50) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aAccountMasterBackup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aAccountMasterBackup](
[AccountID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[GroupID] [int] NOT NULL,
[FinancialID] [int] NOT NULL,
[OpeningCreditBalance] [numeric] (18,2) NULL,
[OpeningDebitBalance] [numeric] (18,2) NULL,
[BudgetAMount] [numeric] (18,2) NULL,
[CurrencyID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AAccRatioEntitiesAccounts]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AAccRatioEntitiesAccounts](
[CompanyID] [int] NOT NULL,
[EntityID] [int] NOT NULL,
[AccountID] [int] NOT NULL,
[CalcType] [smallint] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AAccRatioEntitiesMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AAccRatioEntitiesMaster](
[CompanyID] [int] NOT NULL,
[EntityId] [int] NOT NULL,
[GroupID] [int] NOT NULL,
[EntityDesc] [varchar] (250) NOT NULL,
[Numerator] [bit] NOT NULL,
[GetAverageFigure] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aAccRatioGroupMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aAccRatioGroupMaster](
[CompanyID] [int] NOT NULL,
[GroupID] [int] NOT NULL,
[GroupDesc] [varchar] (250) NULL,
[ParentGroupId] [int] NULL,
[LevelCode] [int] NULL,
[Active] [bit] NOT NULL,
[RatioType] [char] (1) NOT NULL,
[Multiplier] [numeric] (18,8) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aaccrepformat]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aaccrepformat](
[companyid] [int] NOT NULL,
[formatid] [int] NOT NULL,
[Type] [char] (5) NULL,
[Partionchar] [char] (5) NULL,
[FormatName] [varchar] (50) NULL,
[UserCreated] [varchar] (50) NULL,
[DefaultFormat] [bit] NOT NULL,
[NetCarriedForward] [bit] NOT NULL,
[departmentid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aaccrepgroup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aaccrepgroup](
[companyid] [int] NOT NULL,
[Groupid] [int] NOT NULL,
[GroupName] [varchar] (100) NULL,
[Displayorderid] [int] NULL,
[formatid] [int] NULL,
[iscaption] [char] (5) NOT NULL,
[groupcode] [varchar] (50) NULL,
[Departmentwise] [char] (5) NULL,
[Inflow] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aAlias]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aAlias](
[CompanyId] [int] NOT NULL,
[AliasId] [int] NOT NULL,
[Name] [nvarchar] (50) NOT NULL,
[Alias] [nvarchar] (50) NOT NULL,
[Description] [nvarchar] (500) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aAnalysedPOItems]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aAnalysedPOItems](
[alid] [int] NOT NULL,
[alitemid] [int] NULL,
[almoveperiod] [int] NULL,
[almovedqty] [decimal] (18,0) NULL,
[alimportperiod] [int] NULL,
[alimportqty] [decimal] (18,0) NULL,
[alDate] [datetime] NULL,
[alvendorid] [int] NULL,
[updatetime] [datetime] NOT NULL,
[alfromdate] [datetime] NULL,
[altodate] [datetime] NULL
)
END
GO
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aAtollMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aAtollMaster](
[AtollID] [int] NOT NULL,
[AtollName] [nvarchar] (50) NOT NULL,
[DevAtollName] [nvarchar] (50) NULL,
[companyid] [int] NULL,
[CountryID] [int] NULL,
[rowguid] [uniqueidentifier] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aAutoGenerateBillRiminder]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aAutoGenerateBillRiminder](
[VendorID] [int] NULL,
[BillID] [int] NULL,
[BillDate] [datetime] NULL,
[DepartmentID] [int] NULL,
[Generated] [bit] NULL,
[RemainderID] [int] NULL,
[amount] [numeric] (18,2) NULL,
[BillsNo] [varchar] (50) NULL,
[RecurrenceDate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aAutoGenerateInvoiceRiminder]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aAutoGenerateInvoiceRiminder](
[ReminderGroupID] [int] NULL,
[CustomerID] [int] NULL,
[InvoiceID] [int] NULL,
[InvoiceDate] [datetime] NULL,
[DepartmentID] [int] NULL,
[generated] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aBackground]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aBackground](
[BgID] [int] NOT NULL,
[BgName] [varchar] (50) NOT NULL,
[BgColor] [varchar] (50) NOT NULL,
[BgFileName] [varchar] (50) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aBackgroundUsers]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aBackgroundUsers](
[UserID] [int] NULL,
[Location] [char] (10) NULL,
[BgID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aBankMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aBankMaster](
[BankID] [int] NOT NULL,
[BankName] [varchar] (100) NOT NULL,
[Address1] [varchar] (100) NULL,
[Address2] [varchar] (100) NULL,
[Address3] [varchar] (100) NULL,
[BankCode] [varchar] (100) NULL,
[BankLocation] [varchar] (100) NULL,
[PhoneNumber] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[abarcodetype]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[abarcodetype](
[barcodetype] [smallint] NOT NULL,
[filename] [varchar] (50) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aBouncedChequeDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aBouncedChequeDetails](
[BcCompanyID] [int] NOT NULL,
[BcDepartmentID] [int] NOT NULL,
[BcID] [int] NOT NULL,
[BcDate] [datetime] NOT NULL,
[BcCustomerID] [int] NULL,
[BcBankAccName] [varchar] (100) NOT NULL,
[BcReturnedDate] [datetime] NOT NULL,
[BcCollectionDate] [datetime] NOT NULL,
[BcAmount] [numeric] (18,2) NOT NULL,
[BcChequeNo] [varchar] (250) NOT NULL,
[BcReference] [varchar] (250) NULL,
[BcUsername] [varchar] (250) NOT NULL,
[BcUpdatedUsername] [varchar] (250) NULL,
[BcCancel] [int] NOT NULL,
[BcCancelRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aBrandMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aBrandMaster](
[BrandID] [int] NULL,
[BrandName] [varchar] (100) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aBrandMergeDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aBrandMergeDetails](
[CompanyID] [int] NOT NULL,
[MergeID] [int] NOT NULL,
[MergeDate] [datetime] NOT NULL,
[OldBrandID] [int] NOT NULL,
[NewBrandID] [int] NOT NULL,
[Cancelled] [int] NOT NULL,
[CancelledRemarks] [nvarchar] (250) NULL,
[Remarks] [nvarchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[UserName] [nvarchar] (50) NOT NULL,
[UpdateDate] [nvarchar] (50) NULL,
[UpdateUsername] [nvarchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AccountsInvoiceHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AccountsInvoiceHeader](
[InvoiceID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[InvoiceNo] [varchar] (50) NOT NULL,
[InvoiceDate] [datetime] NOT NULL,
[OrderNo] [varchar] (100) NULL,
[CustomerID] [int] NULL,
[Proforma] [bit] NOT NULL,
[CashInvoice] [bit] NOT NULL,
[BankCashID] [int] NULL,
[ChequeNo] [varchar] (50) NULL,
[DuePeriod] [smallint] NULL,
[Remarks] [varchar] (250) NULL,
[Posted] [bit] NOT NULL,
[DepartmentID] [int] NULL,
[Product] [bit] NOT NULL,
[Discount] [numeric] (18,2) NULL,
[DiscountAccountID] [int] NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (250) NULL,
[FinancialID] [int] NULL,
[ExchangeNature] [varchar] (5) NULL,
[SalesAccID] [int] NULL,
[ExchangeRate] [numeric] (18,8) NULL,
[Referenceno] [varchar] (100) NULL,
[updatetime] [datetime] NOT NULL,
[Futurevc] [varchar] (250) NOT NULL,
[depexrate] [numeric] (18,8) NULL,
[exchangerates] [varchar] (250) NULL,
[dueDate] [datetime] NULL,
[RefJournalID] [int] NULL,
[SubDepartmentID] [int] NULL,
[AutoGenerate] [bit] NULL,
[ReminderID] [int] NULL,
[DummyAdvance] [numeric] (18,2) NULL,
[Pono] [varchar] (60) NULL,
[RegNo] [varchar] (60) NULL,
[Details] [varchar] (1000) NULL,
[UserID] [int] NULL,
[TaxPercentage] [numeric] (18,2) NULL,
[TaxAmount] [numeric] (18,2) NULL,
[ItemTaxCategory] [int] NULL,
[ExcludeGST] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aChequeReportDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aChequeReportDetails](
[CompanyID] [int] NOT NULL,
[ChequeID] [int] NOT NULL,
[AccountID] [int] NOT NULL,
[ReportName] [varchar] (250) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCity]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCity](
[CityID] [int] NOT NULL,
[CountryID] [int] NOT NULL,
[CityCode] [varchar] (50) NOT NULL,
[CityName] [varchar] (250) NULL,
[AreaCode] [varchar] (50) NULL,
[ZipCodeFrom] [varchar] (50) NULL,
[ZipCodeTo] [varchar] (50) NULL,
[CompanyID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aColor]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aColor](
[ColorID] [int] NOT NULL,
[ColorCode] [varchar] (50) NOT NULL,
[ColorName] [varchar] (50) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aComboItemDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aComboItemDetail](
[ComboId] [int] NOT NULL,
[ItemId] [int] NOT NULL,
[PackingTypeId] [int] NOT NULL,
[UnitId] [int] NOT NULL,
[PackingTypeQty] [numeric] (18,2) NOT NULL,
[Qty] [numeric] (18,2) NOT NULL,
[Price] [numeric] (18,3) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aComboItemMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aComboItemMaster](
[ComboID] [int] NOT NULL,
[ComboCode] [varchar] (50) NOT NULL,
[ComboName] [varchar] (50) NOT NULL,
[PackingTypeID] [int] NOT NULL,
[SellingPrice] [numeric] (18,2) NOT NULL,
[Active] [bit] NOT NULL,
[Barcode] [varchar] (50) NULL,
[UnitID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCompanyImageMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCompanyImageMaster](
[CompanyID] [int] NOT NULL,
[CompImage] [image] NULL,
[type] [varchar] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCompanyMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCompanyMaster](
[CompanyID] [int] NOT NULL,
[Name] [varchar] (250) NOT NULL,
[Address1] [varchar] (250) NULL,
[Address2] [varchar] (250) NULL,
[Address3] [varchar] (250) NULL,
[CityID] [int] NULL,
[CountryID] [int] NULL,
[PhoneNo] [varchar] (50) NULL,
[FaxNo] [varchar] (50) NULL,
[EmailID] [varchar] (50) NULL,
[CurrencyID] [int] NULL,
[FinancialID] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[CompanyTIN] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aContact]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aContact](
[CompanyID] [int] NOT NULL,
[ContactID] [int] NOT NULL,
[Salutation] [varchar] (50) NULL,
[Name] [varchar] (50) NOT NULL,
[Address1] [varchar] (250) NOT NULL,
[Address2] [varchar] (250) NULL,
[Address3] [varchar] (250) NULL,
[CardNo] [varchar] (50) NOT NULL,
[ExpiryDate] [datetime] NOT NULL,
[Email] [varchar] (50) NULL,
[PhoneNo] [varchar] (50) NULL,
[CountryId] [int] NOT NULL,
[CityId] [int] NOT NULL,
[CurrencyId] [int] NOT NULL,
[DateofBirth] [datetime] NULL,
[Anniversary] [datetime] NULL,
[Profession] [varchar] (50) NULL,
[SpouseName] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aContainerMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aContainerMaster](
[CompanyID] [int] NOT NULL,
[ContainerID] [int] NOT NULL,
[ContainerCode] [varchar] (50) NOT NULL,
[ContainerDesc] [varchar] (100) NOT NULL,
[CountryID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCounterMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCounterMaster](
[CounterId] [int] NULL,
[CounterName] [varchar] (50) NULL,
[LoggedOn] [smallint] NULL,
[CounterUser] [int] NULL,
[CounterShopId] [int] NULL,
[NextBillId] [numeric] (18,0) NULL,
[NextBillNo] [numeric] (18,0) NULL,
[TouchScreen] [int] NULL,
[cid] [int] IDENTITY(1,1) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCountryMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCountryMaster](
[CountryID] [int] NOT NULL,
[CountryName] [varchar] (50) NOT NULL,
[CompanyID] [int] NOT NULL,
[Nationality] [varchar] (50) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCreditChasing]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCreditChasing](
[CompanyID] [int] NOT NULL,
[DepartmentID] [int] NOT NULL,
[InvoiceNo] [varchar] (250) NOT NULL,
[CommittedDate] [datetime] NOT NULL,
[Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCurrencyMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCurrencyMaster](
[CurrencyID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[CurrencyName] [varchar] (50) NOT NULL,
[Symbol] [varchar] (50) NOT NULL,
[CountryID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCustomerGroup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCustomerGroup](
[CompanyID] [int] NOT NULL,
[CusGroupId] [int] NOT NULL,
[CusGroupName] [varchar] (50) NOT NULL,
[ParentGroupID] [int] NOT NULL,
[LevelCode] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[Prefix] [varchar] (25) NULL,
[PrefixActive] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCustomerMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCustomerMaster](
[CustomerID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[CustomerName] [varchar] (100) NOT NULL,
[Active] [bit] NOT NULL,
[Address1] [varchar] (250) NULL,
[Address2] [varchar] (250) NULL,
[Address3] [varchar] (250) NULL,
[CityID] [int] NOT NULL,
[ContactName] [varchar] (250) NULL,
[PhoneNo] [varchar] (50) NULL,
[FaxNo] [varchar] (50) NULL,
[EmailID] [varchar] (100) NULL,
[CreditLimit] [numeric] (18,2) NULL,
[Comments] [varchar] (750) NULL,
[CurrencyID] [int] NULL,
[CountryID] [int] NULL,
[OpeningCreditBalance] [numeric] (18,2) NULL,
[OpeningDebitBalance] [numeric] (18,2) NULL,
[CustomerCode] [varchar] (50) NULL,
[CustomerCategory] [varchar] (100) NOT NULL,
[Dueperiod] [int] NOT NULL,
[Nationality] [varchar] (50) NULL,
[CustomerCardNo] [varchar] (100) NULL,
[custdob] [datetime] NULL,
[registerdate] [datetime] NULL,
[discperc] [numeric] (18,0) NULL,
[Futureint] [int] NULL,
[futurevc] [varchar] (250) NULL,
[customertype] [char] (1) NULL,
[permitno] [varchar] (50) NULL,
[permitexpirydate] [datetime] NULL,
[avgsalesmargin] [numeric] (5,2) NULL,
[debtoraccid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[segmentid] [int] NULL,
[custgroupname] [varchar] (100) NULL,
[ContactName1] [varchar] (250) NULL,
[ContactName2] [varchar] (250) NULL,
[ContactDesig] [varchar] (100) NULL,
[ContactDesig1] [varchar] (100) NULL,
[ContactDesig2] [varchar] (100) NULL,
[webadd] [varchar] (50) NULL,
[ContactEmail] [varchar] (50) NULL,
[ContactEmail1] [varchar] (50) NULL,
[ContactEmail2] [varchar] (50) NULL,
[ContactPhone] [varchar] (20) NULL,
[ContactPhone1] [varchar] (20) NULL,
[ContactPhone2] [varchar] (20) NULL,
[ContactDOB] [datetime] NULL,
[ContactDOB1] [datetime] NULL,
[ContactDOB2] [datetime] NULL,
[ContactAnn] [datetime] NULL,
[ContactAnn1] [datetime] NULL,
[ContactAnn2] [datetime] NULL,
[cusGroupID] [int] NULL,
[MonthlyInvoiceCredit] [bit] NULL,
[CreditAllowed] [bit] NULL,
[CUSTOMERTIN] [varchar] (50) NULL,
[NICNO] [varchar] (100) NULL,
[ExcludeGST] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCustomerMasterBackUp]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCustomerMasterBackUp](
[CustomerID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[FinancialID] [int] NOT NULL,
[OpeningCreditBalance] [numeric] (18,2) NOT NULL,
[OpeningDebitBalance] [numeric] (18,2) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ACustomerSalesPerson]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ACustomerSalesPerson](
[salespersonid] [int] NOT NULL,
[customerid] [int] NOT NULL,
[shopid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aCustomsMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aCustomsMaster](
[CustomID] [int] NOT NULL,
[CustomCategoryCode] [varchar] (50) NOT NULL,
[CustomCategoryPercent] [numeric] (5,2) NULL,
[Remarks] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aDepartmentMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aDepartmentMaster](
[DepartmentID] [int] NOT NULL,
[DepartmentName] [varchar] (50) NOT NULL,
[CompanyID] [int] NOT NULL,
[BudgetedAmount] [numeric] (18,2) NULL,
[ParentDepId] [int] NULL,
[LevelCode] [int] NULL,
[Selected] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[depcurrencyid] [int] NULL,
[address1] [varchar] (250) NULL,
[address2] [varchar] (250) NULL,
[payablealertbeforedays] [int] NULL,
[InchargeEmail] [varchar] (50) NULL,
[InchargeName] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[adepcontrolaccounts]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[adepcontrolaccounts](
[companyid] [int] NOT NULL,
[maindepid] [int] NOT NULL,
[otherdepid] [int] NOT NULL,
[controlaccid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aDeptAccounts]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aDeptAccounts](
[daCompanyID] [int] NULL,
[daDepartmentID] [int] NULL,
[daAccountID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aDeptImageMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aDeptImageMaster](
[CompanyID] [int] NOT NULL,
[DeptID] [int] NOT NULL,
[DepImage] [image] NULL,
[type] [varchar] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[adistributormaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[adistributormaster](
[did] [int] NOT NULL,
[dcode] [varchar] (50) NOT NULL,
[dname] [varchar] (250) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AdjustmentDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AdjustmentDetails](
[AdjustmentDetailID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[AdjustmentID] [int] NOT NULL,
[JournalCredit] [bit] NOT NULL,
[AccountID] [int] NULL,
[CustomerID] [int] NULL,
[VendorID] [int] NULL,
[Amount] [numeric] (18,2) NULL,
[ActualAmount] [numeric] (18,2) NULL,
[ConsAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AdjustmentHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AdjustmentHeader](
[AdjustmentID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[AdjustmentDate] [smalldatetime] NOT NULL,
[Remarks] [varchar] (1000) NULL,
[AdjustmentNo] [varchar] (50) NULL,
[AdjustmentType] [varchar] (2) NULL,
[ExchangeGain] [char] (1) NOT NULL,
[Accountid] [int] NULL,
[Exchangerate] [numeric] (18,8) NULL,
[Amount] [numeric] (18,2) NULL,
[FinancialID] [int] NULL,
[Departmentid] [int] NULL,
[Cancelled] [bit] NOT NULL,
[Posted] [bit] NOT NULL,
[CancelledRemarks] [varchar] (250) NULL,
[DepExchangerate] [numeric] (18,8) NULL,
[Exchangerates] [varchar] (250) NULL,
[SubDepartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aDocumentTypeMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aDocumentTypeMaster](
[DocTypeCompanyId] [int] NOT NULL,
[DocTypeID] [int] NOT NULL,
[DocTypeCode] [varchar] (50) NOT NULL,
[DocTypeName] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aDummyReports]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aDummyReports](
[ReportID] [int] NOT NULL,
[ReportName] [varchar] (100) NULL,
[Reportconst] [varchar] (20) NULL,
[ReportCatId] [int] NULL,
[ReportDetailId] [int] NULL,
[repModuleCode] [varchar] (10) NULL,
[Ported] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aFeeMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aFeeMaster](
[FeeID] [int] NOT NULL,
[FeeName] [char] (50) NULL,
[HasExpiry] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aFinancialYear]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aFinancialYear](
[FinancialID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[StartMonth] [int] NOT NULL,
[StartYear] [int] NOT NULL,
[NoOfPeriod] [int] NOT NULL,
[CurFinancialYear] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aFineDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aFineDetail](
[fdFineID] [int] NOT NULL,
[fdFineDetailID] [int] NOT NULL,
[fdFineDate] [datetime] NOT NULL,
[fdFineAmount] [numeric] (18,2) NOT NULL,
[fdPosted] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aFineHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aFineHeader](
[fhCompanyID] [int] NOT NULL,
[fhDepartmentID] [int] NOT NULL,
[fhShopID] [int] NOT NULL,
[fhFinancialID] [int] NOT NULL,
[fhFineID] [int] NOT NULL,
[fhFineNo] [varchar] (50) NOT NULL,
[fhTransactionType] [varchar] (50) NOT NULL,
[fhInvoiceID] [int] NOT NULL,
[fhInvoiceNo] [varchar] (50) NOT NULL,
[fhInvoiceDate] [datetime] NOT NULL,
[fhCustomerID] [int] NOT NULL,
[fhDueDate] [datetime] NOT NULL,
[fhLastFineCalDate] [datetime] NOT NULL,
[fhRespExchangeRate] [numeric] (18,2) NULL,
[fhDepExchangeRate] [numeric] (18,2) NULL,
[fhComExchangeRate] [numeric] (18,2) NULL,
[fhInvoiceCancelled] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aFineSetting]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aFineSetting](
[FineAmount] [numeric] (18,2) NULL,
[FineCalculatingPeriod] [int] NOT NULL,
[Departments] [nvarchar] (100) NOT NULL,
[FineAccountID] [int] NOT NULL,
[AccotableDate] [datetime] NULL,
[FineProcessingTime] [datetime] NULL,
[FinePercentage] [numeric] (18,2) NULL,
[FineCalculationMethod] [varchar] (2) NULL,
[DiscountAccountID] [int] NULL,
[DiscountPercentage] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aGlobalUsers]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aGlobalUsers](
[UserID] [int] NOT NULL,
[FullName] [varchar] (100) NULL,
[LoginName] [varchar] (50) NULL,
[Password] [varchar] (50) NULL,
[phone] [varchar] (50) NULL,
[fax] [varchar] (50) NULL,
[Address] [varchar] (250) NULL,
[email] [varchar] (50) NULL,
[logedon] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aGodown]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aGodown](
[GodownID] [int] NOT NULL,
[GodownName] [varchar] (250) NOT NULL,
[GodownLocation] [varchar] (250) NOT NULL,
[GodownSqqFeet] [numeric] (18,3) NULL,
[GodownIncharge] [varchar] (250) NOT NULL,
[GodownTelephoneNo] [varchar] (50) NULL,
[GodownFaxNo] [varchar] (50) NOT NULL,
[GodownActive] [bit] NOT NULL,
[Remarks] [varchar] (250) NOT NULL,
[CityID] [int] NULL,
[CountryID] [int] NULL,
[Address] [varchar] (250) NULL,
[OwnerName] [varchar] (50) NULL,
[OwnerAddress] [varchar] (250) NULL,
[OwnerTelephone] [varchar] (50) NULL,
[CompanyID] [int] NOT NULL,
[LocationArrangement] [bit] NOT NULL,
[Fifo] [bit] NOT NULL,
[selected] [bit] NULL,
[ipaddress] [varchar] (50) NULL,
[stockwriteoffaccid] [int] NULL,
[DepartmentId] [int] NULL,
[futureint] [int] NULL,
[futurevarchar] [varchar] (250) NULL,
[futuredatetime] [datetime] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[Accountable] [datetime] NULL,
[SubDePartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aGodownDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aGodownDetail](
[GodownID] [int] NOT NULL,
[ItemID] [int] NOT NULL,
[ItemReorderLevel] [numeric] (18,3) NULL,
[ReorderQuantity] [numeric] (18,3) NULL,
[OrderRaised] [bit] NOT NULL,
[QuotationRaised] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aGodownItemCategory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aGodownItemCategory](
[Godownid] [int] NOT NULL,
[categoryID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AgreementContents]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AgreementContents](
[agcagreementid] [int] NOT NULL,
[agcDepartmentid] [int] NOT NULL,
[agcDetailid] [int] NOT NULL,
[agcContentdesc] [varchar] (100) NULL,
[agcRemark] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AgreementDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AgreementDetails](
[agdAgreementid] [int] NOT NULL,
[agdDepartmentid] [int] NOT NULL,
[agdDetailid] [int] NOT NULL,
[agdDetails] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AgreementFinancialDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AgreementFinancialDetails](
[agfAgreementid] [int] NOT NULL,
[agfDepartmentId] [int] NOT NULL,
[agffinanceDetailid] [int] NOT NULL,
[agffinanceDetail] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AgreementRegister]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AgreementRegister](
[agragreementid] [int] NOT NULL,
[agrDepartmentid] [int] NOT NULL,
[agragreementNo] [varchar] (50) NULL,
[agragreementdate] [datetime] NULL,
[agragreementdesc] [varchar] (100) NULL,
[agragreementtype] [varchar] (100) NULL,
[agrapplicableshopid] [int] NULL,
[agrapplicablegodownid] [int] NULL,
[agrapplicableTo] [varchar] (100) NULL,
[agrValidFromdate] [datetime] NULL,
[agrValidTodate] [datetime] NULL,
[agrSigneddate] [datetime] NULL,
[agrwithCustomerid] [int] NULL,
[agrwithsupplierid] [int] NULL,
[agragreementwith] [varchar] (100) NULL,
[agrAgencyHOaddress] [varchar] (250) NULL,
[agrAgencyContactNo] [varchar] (50) NULL,
[agrAgencyEmailid] [varchar] (50) NULL,
[agragencyfindepaddress] [varchar] (250) NULL,
[agrfinancecontactNo] [varchar] (50) NULL,
[agrfinanceEmailid] [varchar] (50) NULL,
[agrLawyer] [varchar] (100) NULL,
[agrPhysicalfileLOC] [varchar] (50) NULL,
[agrReferenceNo] [varchar] (50) NULL,
[agrNoofPages] [int] NULL,
[agrPointofContact] [varchar] (100) NULL,
[agrPOCaddress] [varchar] (250) NULL,
[agrPOCcontactNo] [varchar] (50) NULL,
[agrPOCdesignation] [varchar] (100) NULL,
[agrAlertdays] [int] NULL,
[agrcancelled] [bit] NOT NULL,
[agrPOCemailid] [varchar] (50) NULL,
[alertnoofdays] [int] NULL,
[alertremarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AgreementScanCopyDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AgreementScanCopyDetails](
[agsCompanyID] [int] NOT NULL,
[agsAgreementID] [int] NOT NULL,
[agsDepartmentID] [int] NOT NULL,
[agsDetailID] [int] NOT NULL,
[agsAgreementName] [varchar] (50) NOT NULL,
[agsDocuments] [image] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AgreementSignedDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AgreementSignedDetails](
[agsagreementid] [int] NOT NULL,
[agsDepartmentid] [int] NOT NULL,
[agsDetailid] [int] NOT NULL,
[agsSignedBy] [varchar] (50) NULL,
[agsPosition] [varchar] (50) NULL,
[agsSignedDate] [datetime] NULL,
[agsAgency] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AgreementWitnessDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AgreementWitnessDetails](
[agwAgreementid] [int] NOT NULL,
[agwDepartmentid] [int] NOT NULL,
[agwDetailid] [int] NOT NULL,
[agwSignedBy] [varchar] (50) NULL,
[agwPostion] [varchar] (50) NULL,
[agwSignedDate] [datetime] NULL,
[agwWitenessAddress] [varchar] (250) NULL,
[agwAgency] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aGroupMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aGroupMaster](
[GroupID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[GroupDesc] [varchar] (250) NOT NULL,
[AccountType] [varchar] (50) NOT NULL,
[ParentGroupID] [int] NULL,
[LevelCode] [int] NOT NULL,
[OrderNo] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHPAccountsSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHPAccountsSettings](
[CompanyID] [int] NOT NULL,
[DebtorAcc] [int] NOT NULL,
[SuspenseAcc] [int] NOT NULL,
[InterestAcc] [int] NOT NULL,
[SalesAcc] [int] NOT NULL,
[COGSAcc] [int] NOT NULL,
[AdjustmentAcc] [int] NOT NULL,
[CashControlAcc] [int] NOT NULL,
[RepossessionInvAcc] [int] NULL,
[SalesReturnAcc] [int] NULL,
[wchUnitSerial] [varchar] (50) NULL,
[wchLabourCost] [numeric] (12,2) NULL,
[wchpartCostSupplier] [numeric] (12,2) NULL,
[wchLabourCostSupplier] [numeric] (12,2) NULL,
[wchCreditDate] [datetime] NULL,
[GracePeriod] [int] NULL,
[FineCharge] [numeric] (18,2) NULL,
[ManualOrAutomatic] [char] (1) NULL,
[DueAlertBlock] [int] NULL,
[DefaultChargeAcc] [int] NULL,
[AdjustmentCarryingAcc] [int] NULL,
[posAlertBlock] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ahpAgreementDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ahpAgreementDetail](
[hpCompanyID] [int] NOT NULL,
[hpDepartmentID] [int] NOT NULL,
[hpFinancialID] [int] NOT NULL,
[hpAgreementID] [int] NOT NULL,
[hpAgreementNO] [nvarchar] (50) NOT NULL,
[hpAgreementDate] [datetime] NULL,
[hpDeliveryDate] [datetime] NULL,
[hpItemRegID] [int] NOT NULL,
[hpQuotationID] [int] NULL,
[hpCustID] [int] NULL,
[HPofficialName] [nvarchar] (50) NULL,
[HpDeOfficialName] [nvarchar] (50) NULL,
[HpDesignation] [nvarchar] (50) NULL,
[HpDeDesignation] [nvarchar] (50) NULL,
[hpWitnessName] [nvarchar] (50) NULL,
[hpDeWitnessName] [nvarchar] (50) NULL,
[hpWitnessAddress] [nvarchar] (250) NULL,
[hpDeWitnessAddress] [nvarchar] (50) NULL,
[hpWitnessNIC] [nvarchar] (50) NULL,
[hpWitnessName2] [nvarchar] (50) NULL,
[hpDeWitnessName2] [nvarchar] (50) NULL,
[hpWitnessAddress2] [nvarchar] (50) NULL,
[hpDeWitnessAddress2] [nvarchar] (50) NULL,
[hpWitnessNIC2] [nvarchar] (50) NULL,
[hpDevVehicleDescription] [nvarchar] (50) NULL,
[hpDevSoldColor] [nvarchar] (50) NULL,
[hpCancelRemarks] [nvarchar] (250) NULL,
[hpDevInstAmount] [nvarchar] (250) NULL,
[hpDevDownPayment] [nvarchar] (250) NULL,
[hpDevBalAmt] [nvarchar] (250) NULL,
[hpDevMonthlyPay] [nvarchar] (250) NULL,
[hpCancel] [int] NOT NULL,
[hpConfirmed] [int] NOT NULL,
[hpRemarks] [nvarchar] (150) NULL,
[hpUser] [nvarchar] (50) NOT NULL,
[hpModifiedUser] [nvarchar] (50) NULL,
[hpModifiedDate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHPCustomerMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHPCustomerMaster](
[hpCompanyID] [int] NOT NULL,
[hpCustomerID] [int] NOT NULL,
[hpSalutation] [varchar] (50) NULL,
[hpCustomerName] [varchar] (50) NOT NULL,
[hpAddress1] [varchar] (50) NOT NULL,
[hpAddress2] [varchar] (50) NULL,
[hpAddress3] [varchar] (50) NULL,
[hpPhoneNo] [varchar] (50) NOT NULL,
[hpEmailID] [varchar] (50) NULL,
[hpCountryID] [int] NOT NULL,
[hpCityID] [int] NOT NULL,
[hpCurrencyID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHpFeePaymentDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHpFeePaymentDetail](
[HpDCompanyID] [int] NOT NULL,
[HpDDepartmentID] [int] NOT NULL,
[HpDPaymentID] [int] NOT NULL,
[HpDDetailID] [int] NOT NULL,
[HpDDebitAccountID] [int] NULL,
[HpDExRate] [numeric] (18,2) NULL,
[HpDAmount] [numeric] (18,2) NULL,
[HpDItemID] [int] NULL,
[HpDRegID] [int] NULL,
[HpDExpiry] [datetime] NULL,
[HPFeeID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHpFeePaymentHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHpFeePaymentHeader](
[HpHCompanyID] [int] NOT NULL,
[HpHDepartmentID] [int] NOT NULL,
[HpHPaymentID] [int] NOT NULL,
[HphPaymentNo] [nvarchar] (50) NOT NULL,
[HpHReferenceNo] [nvarchar] (50) NULL,
[HpHPaymentDate] [datetime] NULL,
[HpHAccountID] [int] NOT NULL,
[HpHPayee] [nvarchar] (50) NULL,
[HpHAmount] [numeric] (18,0) NULL,
[HpHFinancialID] [int] NULL,
[HpHCancel] [int] NULL,
[HpHPosted] [int] NULL,
[HpHExRate] [numeric] (18,2) NULL,
[HpHComExRate] [numeric] (18,2) NULL,
[HpHDepExRate] [numeric] (18,2) NULL,
[HpHUsers] [nvarchar] (50) NULL,
[HpHUpdateUserName] [nvarchar] (50) NULL,
[HpHUpdateTime] [datetime] NULL,
[HpHRemarks] [nvarchar] (500) NULL,
[HpHCancelRemarks] [nvarchar] (500) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHpItemDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHpItemDetails](
[ItemID] [int] NOT NULL,
[SellingPrice] [numeric] (18,2) NULL,
[CCashAllowence] [numeric] (18,2) NULL,
[SCashAllowence] [numeric] (18,2) NULL,
[CSurCharge] [numeric] (18,2) NULL,
[SSurCharge] [numeric] (18,2) NULL,
[COnInstallment] [int] NULL,
[SOnInstallment] [int] NULL,
[CMaxMonths] [numeric] (18,0) NULL,
[SMaxMonths] [numeric] (18,0) NULL,
[CInflation] [numeric] (18,2) NULL,
[SInflation] [numeric] (18,2) NULL,
[CDownPayment] [numeric] (18,2) NULL,
[SDownPayment] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHPItemTransferDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHPItemTransferDetail](
[itdCompanyID] [int] NOT NULL,
[itdFinancialID] [int] NOT NULL,
[itdTransferID] [int] NOT NULL,
[itdTransferDetailID] [int] NOT NULL,
[itdItemRegID] [int] NOT NULL,
[itdCurrentLocation] [nvarchar] (50) NULL,
[itdTransLocation] [nvarchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHPItemTransferHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHPItemTransferHeader](
[ithCompanyID] [int] NOT NULL,
[ithFinancialID] [int] NOT NULL,
[ithTransferID] [int] NOT NULL,
[ithTransferNO] [nvarchar] (50) NOT NULL,
[ithTransferDate] [datetime] NOT NULL,
[ithCancel] [char] (10) NULL,
[ithUser] [nvarchar] (50) NULL,
[ithModifiedUser] [nvarchar] (50) NULL,
[ithModifiedTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ahpPaymentDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ahpPaymentDetail](
[hpdCompanyID] [int] NOT NULL,
[hpdDepartmentID] [int] NOT NULL,
[hpdPaymentID] [int] NOT NULL,
[hpdDetailID] [int] NOT NULL,
[hpdReceiptID] [int] NOT NULL,
[hpdProcessingDetailID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ahpPaymentHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ahpPaymentHeader](
[hphCompanyID] [int] NOT NULL,
[hphDepartmentID] [int] NOT NULL,
[hphPaymentID] [int] NOT NULL,
[hphPaymentNo] [varchar] (50) NOT NULL,
[hphRefNo] [nvarchar] (50) NOT NULL,
[hphPaymentDate] [datetime] NOT NULL,
[hphFinancialID] [int] NOT NULL,
[hphCustomerID] [int] NOT NULL,
[hphAccountID] [int] NOT NULL,
[hphRemarks] [nvarchar] (250) NOT NULL,
[hphPaymentAmount] [numeric] (18,2) NOT NULL,
[hphCancel] [int] NULL,
[hphCancelRemarks] [nvarchar] (250) NULL,
[hphPosted] [int] NOT NULL,
[hphUserName] [varchar] (50) NULL,
[hphUpdateUserName] [varchar] (50) NULL,
[hphUpdateTime] [datetime] NULL,
[hphBankExchangeRate] [numeric] (18,2) NULL,
[hphCusExchangeRate] [numeric] (18,2) NULL,
[hphDepExchangeRate] [numeric] (18,2) NULL,
[hphComExchangeRate] [numeric] (18,2) NULL,
[hprhCreditAccID] [int] NULL,
[hprhCreditExRate] [numeric] (18,2) NULL,
[hprhCreditAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ahpProcessingCashFlowDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ahpProcessingCashFlowDetail](
[hpcComapnyID] [int] NOT NULL,
[hpcDepartmentID] [int] NOT NULL,
[hpcProcessingID] [int] NOT NULL,
[hpcDetailID] [int] NOT NULL,
[hpcDiscountFactor] [numeric] (18,16) NULL,
[hpcRental] [numeric] (18,2) NULL,
[hpcDiscountCashFlow] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHpProcessingDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHpProcessingDetail](
[hpdCompanyID] [int] NOT NULL,
[hpdDepartmentID] [int] NOT NULL,
[hpdProcessingId] [int] NOT NULL,
[hpdDetailID] [int] NOT NULL,
[hpdChequeDate] [datetime] NOT NULL,
[hpdCapital] [numeric] (18,2) NOT NULL,
[hpdRental] [numeric] (18,2) NOT NULL,
[hpdInterest] [numeric] (18,2) NOT NULL,
[hpdCapitalRepayment] [numeric] (18,2) NOT NULL,
[hpdCapitalBalance] [numeric] (18,2) NOT NULL,
[hpdBankName] [nvarchar] (50) NULL,
[hpdChequeNo] [nvarchar] (50) NULL,
[hpdAmount] [numeric] (18,2) NULL,
[hpdSettlementAmount] [numeric] (18,2) NULL,
[hpdInterestRate] [numeric] (18,2) NULL,
[hpdPosted] [int] NULL,
[hpdChequeStatus] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHpProcessingDetailOthers]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHpProcessingDetailOthers](
[hpdCompanyID] [int] NOT NULL,
[hpdDepartmentID] [int] NOT NULL,
[hpdProcessingId] [int] NOT NULL,
[hpddetailIDBT] [int] NOT NULL,
[hpdChequeDateBT] [datetime] NOT NULL,
[hpdCapitalBT] [numeric] (18,2) NOT NULL,
[hpdRentalBT] [numeric] (18,2) NOT NULL,
[hpdInterestBT] [numeric] (18,2) NOT NULL,
[hpdcapitalRepaymentBT] [numeric] (18,2) NOT NULL,
[hpdCapitalBalanceBT] [numeric] (18,2) NOT NULL,
[hpdBankNameBT] [nvarchar] (50) NULL,
[hpdChequeNoBT] [nvarchar] (50) NULL,
[hpdAmountBT] [numeric] (18,2) NULL,
[hpdSettlementAmountBT] [numeric] (18,2) NULL,
[hpdInterestRateBT] [numeric] (18,2) NULL,
[hpdPosted] [int] NULL,
[hpdChequeStatus] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHpProcessingHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHpProcessingHeader](
[hphCompanyID] [int] NOT NULL,
[hphDepartmentID] [int] NOT NULL,
[hphProcessingID] [int] NOT NULL,
[hphProcessingNo] [nvarchar] (50) NOT NULL,
[hphProcessingDate] [datetime] NOT NULL,
[hphCustomerID] [int] NULL,
[hphInvoiceID] [int] NOT NULL,
[hphUsed] [int] NOT NULL,
[hphFinancialID] [int] NOT NULL,
[hphCancel] [int] NOT NULL,
[hphcancelRemarks] [nvarchar] (50) NULL,
[hphCashPrice] [numeric] (18,2) NOT NULL,
[hphDownPayment] [numeric] (18,2) NOT NULL,
[hphBalance] [numeric] (18,2) NOT NULL,
[hphNoOfRentals] [int] NOT NULL,
[hphInterestRate] [numeric] (18,2) NOT NULL,
[hphInstallmentPrice] [numeric] (18,2) NOT NULL,
[hphRentalAmount] [numeric] (18,2) NULL,
[hphAdjustmentAmount] [numeric] (18,2) NULL,
[hphAmended] [int] NULL,
[hphRemarks] [nvarchar] (250) NULL,
[hphuserName] [nvarchar] (50) NULL,
[hphUpdateUserName] [nvarchar] (50) NULL,
[hphUpdateTime] [datetime] NULL,
[hphReprocessingType] [char] (7) NULL,
[hphReferenceID] [int] NULL,
[hphBalanceInterest] [numeric] (18,2) NULL,
[hphreprocessaftersettlement] [bit] NULL,
[hphAdjustmentPosted] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ahpReceiptDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ahpReceiptDetail](
[hprdCompanyID] [int] NOT NULL,
[hprdDepartmentID] [int] NOT NULL,
[hprdReceiptID] [int] NOT NULL,
[hprdDetailID] [int] NOT NULL,
[hprdPaymentID] [int] NOT NULL,
[hprdProcDetailId] [int] NULL,
[hprdPaymentAmnt] [numeric] (18,2) NULL,
[hprdSettledAmnt] [numeric] (18,2) NULL,
[hprdCashSettledAmnt] [numeric] (18,2) NULL,
[hprdChqSettledAmnt] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ahpReceiptHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ahpReceiptHeader](
[hprhCompanyId] [int] NOT NULL,
[hprhDepartmentID] [int] NOT NULL,
[hprhReceiptID] [int] NOT NULL,
[hprhReceiptNo] [nvarchar] (50) NOT NULL,
[hprhReceiptDate] [datetime] NOT NULL,
[hprhRefNo] [nvarchar] (50) NULL,
[hprhFinancialID] [int] NOT NULL,
[hprhCustomerID] [int] NOT NULL,
[hprhAccountID] [int] NOT NULL,
[hprhAmount] [numeric] (18,2) NOT NULL,
[hprhRemarks] [nvarchar] (250) NOT NULL,
[hprhChequeNo] [nvarchar] (50) NULL,
[hprhBankName] [nvarchar] (50) NULL,
[hprhCancel] [int] NOT NULL,
[hprhCancelRemarks] [nvarchar] (50) NULL,
[hprhPosted] [int] NOT NULL,
[hprhBankExRate] [numeric] (18,2) NOT NULL,
[hprhCusExRate] [numeric] (18,2) NOT NULL,
[hprhDepExRate] [numeric] (18,2) NOT NULL,
[hprhComExRate] [numeric] (18,2) NOT NULL,
[hprhUserName] [nvarchar] (50) NOT NULL,
[hprhUpdatedUserName] [nvarchar] (50) NULL,
[hprhUpdatedTime] [datetime] NULL,
[hprhCreditAccID] [int] NULL,
[hprhCreditExRate] [numeric] (18,2) NULL,
[hprhCreditAmount] [numeric] (18,2) NULL,
[hprhtype] [char] (2) NULL,
[hprhnewcheque] [bit] NULL,
[hprhNewChequeNo] [nvarchar] (100) NULL,
[hprhNewBankName] [nvarchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHpReceiptVoucherHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHpReceiptVoucherHeader](
[hprhCompanyID] [int] NOT NULL,
[hprhShopID] [int] NOT NULL,
[hprhReceiptID] [int] NOT NULL,
[hprhInvoiceNo] [int] NOT NULL,
[hprhInvoiceDate] [datetime] NOT NULL,
[hprhCustomerID] [int] NOT NULL,
[hprhCancel] [int] NOT NULL,
[hprhCancelledRemarks] [nvarchar] (50) NULL,
[hprhPosted] [int] NOT NULL,
[hprhBankName] [nvarchar] (50) NULL,
[hprhRemarks] [nvarchar] (250) NULL,
[hprhChequeNo] [nvarchar] (50) NULL,
[hprhChequeDate] [datetime] NULL,
[hprhAmount] [numeric] (18,0) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQBackground]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQBackground](
[ShopId] [int] NOT NULL,
[Message] [nvarchar] (1000) NULL,
[Background] [int] NULL,
[BackServer] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQDespatchNoteDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQDespatchNoteDetails](
[ddDespatchnoteID] [int] NOT NULL,
[ddItemID] [int] NOT NULL,
[ddGodownid] [int] NULL,
[ddDetailID] [int] NOT NULL,
[ddShopID] [int] NULL,
[ddPackingTypeID] [int] NULL,
[ddQty] [numeric] (18,3) NULL,
[ddCostPrice] [numeric] (18,2) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQDespatchnoteHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQDespatchnoteHeader](
[dhDespatchNoteMainID] [int] NOT NULL,
[dhDespatchnoteID] [int] NOT NULL,
[dhDespatchnoteNo] [varchar] (250) NOT NULL,
[dhGodownID] [int] NULL,
[dhCancelled] [bit] NOT NULL,
[dhShipmentID] [int] NULL,
[dhSelected] [bit] NOT NULL,
[barcodegenerated] [bit] NOT NULL,
[dhTransFinished] [bit] NOT NULL,
[dhNoofDetails] [int] NULL,
[Futurevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[dhshopid] [int] NULL,
[dhShopReqId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQDespatchNoteMain]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQDespatchNoteMain](
[dnmDespatchNoteID] [int] NOT NULL,
[dnmDespatchNoteNo] [varchar] (50) NULL,
[dnmDespatchNoteDate] [datetime] NULL,
[dnmBillID] [int] NOT NULL,
[dnmCostPriceFixed] [bit] NOT NULL,
[dnmRemarks] [varchar] (250) NULL,
[dnmCancelled] [bit] NOT NULL,
[dnmCancelledRemarks] [varchar] (250) NULL,
[dnmrecAddUser] [varchar] (250) NULL,
[dnmrecModifyUser] [varchar] (250) NULL,
[Futurevc] [varchar] (250) NOT NULL,
[departmentid] [int] NULL,
[companyid] [int] NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[dntime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQIssuenoteDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQIssuenoteDetail](
[INDIssuenoteID] [int] NOT NULL,
[INDGodownid] [int] NOT NULL,
[INDLocationID] [int] NOT NULL,
[INDShipmentID] [int] NOT NULL,
[INDItemID] [int] NOT NULL,
[INDQty] [numeric] (18,3) NULL,
[INDBadQty] [numeric] (18,3) NULL,
[INDBadQtyRequested] [numeric] (18,3) NULL,
[INDgoodQtyRequested] [numeric] (18,3) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQIssuenoteHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQIssuenoteHeader](
[INHIssuenoteID] [int] NOT NULL,
[INHissuenoteNO] [varchar] (50) NULL,
[INHIssuedate] [datetime] NULL,
[INHGodownID] [int] NOT NULL,
[INHCancelled] [bit] NOT NULL,
[INHToshopID] [int] NULL,
[INHTogodownID] [int] NULL,
[INHUsed] [bit] NOT NULL,
[INHIssuenotemainID] [int] NOT NULL,
[INHTransFinished] [bit] NOT NULL,
[INHNoofDetails] [int] NULL,
[futurevc] [varchar] (250) NOT NULL,
[INHShopReqId] [int] NULL,
[updatetime] [datetime] NOT NULL,
[inhshopreqno] [varchar] (100) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[INHIssuetime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQIssueNoteMain]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQIssueNoteMain](
[INMIssuenoteID] [int] NOT NULL,
[INMIssuenoteNO] [varchar] (50) NULL,
[INMIssuedate] [datetime] NOT NULL,
[INMCancelledremarks] [varchar] (250) NULL,
[INMRemarks] [varchar] (250) NULL,
[INMRecadduser] [varchar] (250) NULL,
[INMModifyuser] [varchar] (250) NULL,
[INMCancel] [bit] NOT NULL,
[INMRequestID] [int] NULL,
[INMShopID] [int] NOT NULL,
[futurevc] [varchar] (250) NOT NULL,
[departmentid] [int] NULL,
[companyid] [int] NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[INMTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHqMergingDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHqMergingDetails](
[mgdId] [int] NOT NULL,
[mgdCompanyID] [int] NOT NULL,
[mgdItemId] [int] NOT NULL,
[mgdCostPrice] [numeric] (18,2) NULL,
[mgdDetailID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHqMergingHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHqMergingHeader](
[mghId] [int] NOT NULL,
[mghCompanyId] [int] NOT NULL,
[mghNo] [varchar] (50) NULL,
[mghDate] [datetime] NULL,
[mghItemId] [int] NULL,
[mghAddUser] [varchar] (50) NULL,
[mghModUser] [varchar] (50) NULL,
[mghTransFinished] [bit] NULL,
[mghCostPriceFixed] [char] (1) NULL,
[mghRemarks] [varchar] (250) NULL,
[mghCancelledRemarks] [varchar] (250) NULL,
[mghCancelled] [bit] NULL,
[mghItemCostPrice] [numeric] (18,2) NULL,
[mghNoOfRec] [int] NULL,
[mghOldCostPrice] [numeric] (18,2) NULL,
[mghQty] [numeric] (18,3) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[mghtime] [datetime] NULL,
[MghDepartmentId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQPaymentVoucherDebitDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQPaymentVoucherDebitDetails](
[pddPaymentDebitID] [int] NOT NULL,
[pddPaymentID] [int] NOT NULL,
[pddCompanyID] [int] NULL,
[pddAccountID] [int] NULL,
[pddAmount] [numeric] (18,2) NULL,
[pddhqpoid] [int] NULL,
[pdddescription] [varchar] (250) NULL,
[pddcustomeramount] [numeric] (18,2) NULL,
[pddAccountAmount] [numeric] (18,2) NULL,
[pddVendorExchangeDifference] [numeric] (18,2) NULL,
[pddpaylinktransid] [int] NULL,
[pddAgrrementtransID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQPaymentVoucherDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQPaymentVoucherDetails](
[pdPaymentVoucherID] [int] NOT NULL,
[pdPaymentID] [int] NOT NULL,
[pdCompanyID] [int] NULL,
[pdBillsID] [int] NULL,
[pdAccBillsID] [int] NULL,
[pdHQPOID] [int] NULL,
[pdshopid] [int] NULL,
[pdposlpbillid] [int] NULL,
[pddcnid] [int] NULL,
[pdPaidAmount] [numeric] (18,2) NULL,
[pdDuePeriod] [smallint] NULL,
[pdreceiptid] [int] NULL,
[shopdcnid] [int] NULL,
[pdIndevBillsID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQPaymentVoucherHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQPaymentVoucherHeader](
[phPaymentID] [int] NOT NULL,
[phCompanyID] [int] NULL,
[phPaymentNo] [varchar] (50) NOT NULL,
[phPaymentDate] [datetime] NOT NULL,
[phRemarks] [varchar] (1000) NULL,
[phBankCashID] [int] NULL,
[phPayee] [varchar] (100) NULL,
[phVendorID] [int] NULL,
[phDepartmentID] [int] NULL,
[phCustomerID] [int] NULL,
[phChequeDetails] [varchar] (50) NULL,
[phAmount] [numeric] (18,2) NULL,
[phFinancialID] [int] NULL,
[phExchangeNature] [varchar] (5) NULL,
[phExchangeRate] [numeric] (18,8) NULL,
[phcbreferenceno] [varchar] (50) NULL,
[phCustomeramount] [numeric] (18,2) NULL,
[phdebitaccountid] [int] NULL,
[phdebitamount] [numeric] (18,2) NULL,
[phchequedate] [datetime] NULL,
[phPosted] [bit] NOT NULL,
[phlcpayment] [varchar] (5) NOT NULL,
[phGoodsinTransitaccid] [int] NULL,
[phCancelled] [bit] NOT NULL,
[phCancelledRemarks] [varchar] (250) NULL,
[phfutureint] [int] NULL,
[phfuturevarchar] [varchar] (250) NULL,
[phfuturenumeric] [numeric] (18,2) NULL,
[updatetime] [datetime] NOT NULL,
[phpohid] [int] NULL,
[refjournalid] [int] NULL,
[phallowblancheque] [bit] NULL,
[phdepexrate] [numeric] (18,8) NULL,
[phpaidbyvendorid] [int] NULL,
[phexchangerates] [varchar] (250) NULL,
[refreceiptid] [int] NULL,
[refdcnid] [int] NULL,
[LastModified] [varchar] (50) NULL,
[refpaymentid] [int] NULL,
[otherdeppaymentid] [int] NULL,
[vencusaccexrate] [numeric] (18,8) NULL,
[phSubDepartmentID] [int] NULL,
[phPaymentVoucherNo] [varchar] (50) NULL,
[phTracked] [int] NULL,
[phconfirmed] [bit] NULL,
[phuserid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQPaymentVoucherRebateDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQPaymentVoucherRebateDetails](
[CompanyID] [int] NOT NULL,
[PaymentID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[ShopID] [int] NULL,
[RebateApprovalID] [int] NULL,
[CustomerID] [int] NULL,
[RebateAmt] [numeric] (18,4) NULL,
[SettleAmt] [numeric] (18,4) NULL,
[CustEquivalentAmount] [numeric] (18,4) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQPaymentVoucherSCDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQPaymentVoucherSCDetails](
[CompanyID] [int] NOT NULL,
[PaymentID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[SalesCommID] [int] NULL,
[SalesCommAmt] [numeric] (18,2) NULL,
[SettledAmt] [numeric] (18,2) NULL,
[DeptEquiAmt] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQPaymentVoucherSPDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQPaymentVoucherSPDetails](
[CompanyID] [int] NOT NULL,
[PaymentID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[PromotionID] [int] NULL,
[PromotionDetailID] [int] NULL,
[PromotionAmt] [numeric] (18,2) NULL,
[SettledAmt] [numeric] (18,2) NULL,
[DeptEquiAmt] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQPaymentVoucherVendorDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQPaymentVoucherVendorDetails](
[pvdcompanyid] [int] NOT NULL,
[pvdPaymentid] [int] NOT NULL,
[pvdDetailid] [int] NOT NULL,
[pvdVendorid] [int] NOT NULL,
[pvdAmount] [numeric] (18,2) NOT NULL,
[pvdVendorAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQPDChequeProcessing]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQPDChequeProcessing](
[PDTransId] [int] NOT NULL,
[PDChequeid] [int] NOT NULL,
[PDChequeDepartmentid] [int] NOT NULL,
[PDChequeShopid] [int] NOT NULL,
[PDChequeEntryDate] [datetime] NOT NULL,
[PDChequeDebitAccid] [int] NOT NULL,
[PDChequeCreditAccid] [int] NOT NULL,
[PDChequeRemarks] [varchar] (200) NOT NULL,
[PDChequePosted] [bit] NOT NULL,
[PDChequeDtlPrefix] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHqPettyCashPaymentDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHqPettyCashPaymentDetails](
[pdCompanyID] [int] NOT NULL,
[pdDepartmentID] [int] NOT NULL,
[pdPaymentID] [int] NOT NULL,
[pdDetailID] [int] NOT NULL,
[pdDebitAccountID] [int] NOT NULL,
[pdDescription] [varchar] (250) NOT NULL,
[pdExRate] [numeric] (18,2) NOT NULL,
[pdAmount] [numeric] (18,2) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHqPettyCashPaymentHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHqPettyCashPaymentHeader](
[phCompanyID] [int] NOT NULL,
[phDepartmentID] [int] NOT NULL,
[phPaymentID] [int] NOT NULL,
[phPaymentNo] [varchar] (50) NOT NULL,
[phPaymentDate] [datetime] NOT NULL,
[phAccountID] [int] NOT NULL,
[phReferenceno] [varchar] (50) NOT NULL,
[phPayee] [varchar] (150) NOT NULL,
[phRemarks] [varchar] (250) NOT NULL,
[phAmount] [numeric] (18,2) NOT NULL,
[phFinancialID] [int] NOT NULL,
[phCancel] [int] NOT NULL,
[phCancelRemarks] [varchar] (50) NULL,
[phPosted] [int] NOT NULL,
[phExRate] [numeric] (18,2) NOT NULL,
[phComExRate] [numeric] (18,2) NOT NULL,
[phDepExRate] [numeric] (18,2) NOT NULL,
[phUserName] [varchar] (50) NOT NULL,
[phUpdateUserName] [varchar] (50) NULL,
[phUpdateTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ahqPostDatedChequeDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ahqPostDatedChequeDetails](
[CompanyID] [int] NOT NULL,
[TransID] [int] NOT NULL,
[DepartmentID] [int] NULL,
[TransNo] [varchar] (50) NOT NULL,
[ChDate] [datetime] NOT NULL,
[CustomerID] [int] NULL,
[BankName] [varchar] (50) NULL,
[ChequeNo] [varchar] (50) NOT NULL,
[Amount] [numeric] (18,2) NOT NULL,
[ChequeDate] [datetime] NOT NULL,
[ShopID] [int] NOT NULL,
[Status] [varchar] (100) NOT NULL,
[Remarks] [varchar] (550) NOT NULL,
[Cancel] [int] NULL,
[CustomerName] [varchar] (50) NULL,
[PoshBillID] [int] NULL,
[FinancialID] [int] NULL,
[exchangerate] [numeric] (18,8) NULL,
[depexchangerates] [varchar] (250) NULL,
[updatetime] [datetime] NOT NULL,
[exchangerates] [varchar] (250) NULL,
[Bankid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aHQPurchaseOrderStatus]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aHQPurchaseOrderStatus](
[CompanyID] [int] NULL,
[StatusID] [int] NULL,
[PoID] [int] NULL,
[VesselID] [int] NULL,
[ContainerID] [int] NULL,
[StatusDate] [datetime] NULL,
[UserName] [varchar] (50) NULL,
[UpdateUserName] [varchar] (50) NULL,
[UpdateDate] [datetime] NULL,
[CountryID] [int] NULL,
[StatusType] [int] NULL,
[Remarks] [varchar] (1000) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aInterface]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aInterface](
[InterfaceID] [int] NOT NULL,
[InterfaceName] [varchar] (50) NULL,
[ModuleCode] [varchar] (25) NULL,
[PrefixNeeded] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[menuname] [varchar] (50) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[customize] [varchar] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aIslandMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aIslandMaster](
[IslandID] [int] NOT NULL,
[CompanyiD] [int] NULL,
[AtollID] [char] (10) NULL,
[IslandName] [nvarchar] (50) NULL,
[DevIslandName] [nvarchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aItem]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aItem](
[ItemID] [int] NOT NULL,
[ItemCode] [varchar] (50) NOT NULL,
[ItemDescription] [varchar] (250) NOT NULL,
[ItemCategoryID] [int] NOT NULL,
[ColorID] [int] NULL,
[SizeID] [int] NULL,
[Active] [bit] NOT NULL,
[ItemRate] [numeric] (18,2) NULL,
[ReorderQuantity] [numeric] (18,3) NULL,
[ReorderLevel] [numeric] (18,3) NULL,
[CustomID] [int] NULL,
[CostingValue] [numeric] (18,2) NULL,
[MarginPercent] [numeric] (5,2) NULL,
[DPMargin] [numeric] (18,2) NULL,
[WPMargin] [numeric] (18,2) NULL,
[DPQty] [numeric] (18,3) NULL,
[WPQty] [numeric] (18,3) NULL,
[UnitsID] [int] NULL,
[barcode] [varchar] (50) NULL,
[onetimeshipment] [bit] NOT NULL,
[pricefixedathq] [bit] NOT NULL,
[GenerateBC] [bit] NOT NULL,
[ExpiryNoofDays] [int] NULL,
[brand] [varchar] (50) NULL,
[ModelNo] [varchar] (50) NULL,
[Notes] [varchar] (2000) NULL,
[Vendors] [varchar] (500) NOT NULL,
[QuantityDecimal] [varchar] (5) NOT NULL,
[forsales] [bit] NOT NULL,
[did] [int] NULL,
[Part_code] [varchar] (100) NULL,
[bitf1] [bit] NOT NULL,
[bitf2] [bit] NOT NULL,
[bitf3] [bit] NOT NULL,
[intf1] [int] NULL,
[intf2] [int] NULL,
[intf3] [int] NULL,
[varcharf1] [varchar] (250) NULL,
[itemtype] [char] (1) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[OrginCountryID] [int] NULL,
[ConsignmentCountryID] [int] NULL,
[Volume] [numeric] (18,3) NULL,
[LimitToBeEligibleForFree] [numeric] (18,3) NULL,
[FreeNos] [numeric] (18,3) NULL,
[compvarflag] [bit] NOT NULL,
[itemvarflag] [bit] NOT NULL,
[Attribute1] [varchar] (250) NULL,
[Attribute2] [varchar] (250) NULL,
[RateSelEnabled] [bit] NULL,
[customcode] [varchar] (250) NULL,
[specification] [nvarchar] (500) NULL,
[carddiscount] [numeric] (18,0) NULL,
[ImageActive] [int] NULL,
[marketrate] [numeric] (9,0) NULL,
[LoyaltyAvailable] [int] NULL,
[SerialNoActive] [bit] NULL,
[SerialNoDupli] [bit] NOT NULL,
[HirePurchase] [int] NULL,
[AddedDate] [datetime] NULL,
[InhouseConsAccnt] [int] NULL,
[ItemDescDhivehi] [varchar] (250) NULL,
[servWarrantyPeriod] [int] NULL,
[partsWarrantyPeriod] [int] NULL,
[TaxCategoryId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aItemCategory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aItemCategory](
[ItemCategoryID] [int] NOT NULL,
[ItemCategoryCode] [varchar] (4) NOT NULL,
[CategoryNameDescription] [varchar] (250) NOT NULL,
[SPDefMargin] [numeric] (18,2) NULL,
[DPDefMargin] [numeric] (18,2) NULL,
[WPDefMargin] [numeric] (18,2) NULL,
[DPDefQty] [numeric] (18,3) NULL,
[WPDefQty] [numeric] (18,3) NULL,
[SalesValue] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[PItemCategoryId] [int] NULL,
[InHouseconsumptionAccnt] [int] NULL,
[CategoryDetail] [varchar] (100) NULL,
[TaxCategoryId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aItemCategoryMergingDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aItemCategoryMergingDetails](
[CompanyID] [int] NOT NULL,
[MergeID] [int] NOT NULL,
[MergeDate] [datetime] NOT NULL,
[OldCategoryID] [int] NOT NULL,
[NewCategoryID] [int] NOT NULL,
[Cancelled] [int] NULL,
[CancelledRemarks] [nvarchar] (250) NULL,
[Remarks] [nvarchar] (250) NULL,
[UserName] [nvarchar] (50) NOT NULL,
[UpdateDate] [datetime] NOT NULL,
[UpdateUserName] [nvarchar] (50) NULL,
[Rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aItemImage]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aItemImage](
[CompanyID] [int] NOT NULL,
[ItemID] [int] NOT NULL,
[ItemImage1] [image] NULL,
[ItemImage2] [image] NULL,
[ItemImage3] [image] NULL,
[ItemImage4] [image] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aItemKitHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aItemKitHeader](
[ItemKitId] [int] NOT NULL,
[ItemKitCode] [varchar] (50) NOT NULL,
[ItemKitDesc] [varchar] (200) NULL,
[ItemKitRate] [numeric] (18,3) NULL,
[CustomId] [int] NULL,
[CostingValue] [numeric] (18,2) NULL,
[Active] [bit] NOT NULL,
[ForSales] [bit] NULL,
[PriceFixedatHQ] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aItemPackingDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aItemPackingDetail](
[ItemID] [int] NOT NULL,
[PackingTypeID] [int] NOT NULL,
[PackingSlNo] [int] NOT NULL,
[PackingBarCode] [varchar] (25) NULL,
[active] [bit] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aKitItemDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aKitItemDetail](
[KitId] [int] NOT NULL,
[ItemId] [int] NOT NULL,
[PackingTypeId] [int] NOT NULL,
[UnitId] [int] NOT NULL,
[PackingTypeQty] [numeric] (18,2) NOT NULL,
[Qty] [numeric] (18,2) NOT NULL,
[Price] [numeric] (18,3) NOT NULL,
[KitDetailId] [int] NOT NULL,
[KitItemTax] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aKitItemMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aKitItemMaster](
[KitID] [int] NOT NULL,
[KitCode] [varchar] (50) NOT NULL,
[KitName] [varchar] (50) NOT NULL,
[PackingTypeID] [int] NOT NULL,
[SellingPrice] [numeric] (18,2) NOT NULL,
[Active] [bit] NOT NULL,
[Barcode] [varchar] (50) NULL,
[UnitID] [int] NULL,
[GenerateBarcode] [bit] NULL,
[KitTax] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aLCRegisterDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aLCRegisterDetails](
[LcCompanyID] [int] NOT NULL,
[LcDepartmentID] [int] NOT NULL,
[LcID] [int] NOT NULL,
[LcNo] [varchar] (100) NOT NULL,
[LcDate] [datetime] NOT NULL,
[LcFinancialid] [int] NOT NULL,
[LcVendorID] [int] NULL,
[LcVendorName] [varchar] (250) NULL,
[LcVendorCurrId] [int] NULL,
[LcBankName] [varchar] (100) NOT NULL,
[LcBankAccName] [int] NOT NULL,
[LcShipmentDetails] [varchar] (250) NULL,
[LcShipmentTermsDetails] [varchar] (250) NULL,
[LcPaymentTerms] [varchar] (250) NULL,
[LcReference] [varchar] (250) NULL,
[LcUsername] [varchar] (250) NOT NULL,
[LcUpdatedUsername] [varchar] (250) NULL,
[LcCancel] [int] NOT NULL,
[LcCancelRemarks] [varchar] (250) NULL,
[LcEstDate] [datetime] NOT NULL,
[LcDueDate] [datetime] NOT NULL,
[LcAmount] [numeric] (18,2) NOT NULL,
[LcMargin] [numeric] (18,2) NOT NULL,
[LcBalance] [numeric] (18,2) NULL,
[LcExchangeRates] [varchar] (100) NOT NULL,
[LcComExchangeRate] [numeric] (18,2) NOT NULL,
[LcDepExchangeRate] [numeric] (18,2) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aletterformat]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aletterformat](
[letterid] [int] NOT NULL,
[companyid] [int] NOT NULL,
[lettercode] [varchar] (50) NULL,
[lettername] [varchar] (100) NULL,
[details] [varchar] (2000) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aListItemDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aListItemDetails](
[ListID] [int] NOT NULL,
[ItemID] [int] NOT NULL,
[Qty] [numeric] (18,2) NOT NULL,
[PackingTypeID] [int] NOT NULL,
[PQty] [numeric] (18,2) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aListItemMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aListItemMaster](
[Listid] [int] NOT NULL,
[ListCode] [varchar] (50) NOT NULL,
[ListDescription] [varchar] (50) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aListViewDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aListViewDetails](
[lvwdid] [int] NOT NULL,
[lvwcolid] [int] NOT NULL,
[lvwdcolname] [varchar] (50) NULL,
[lvwdcolwidth] [int] NOT NULL,
[lvwdcolalign] [int] NOT NULL,
[lvwdlistcoltype] [numeric] (18,0) NULL,
[lvwdcolprec] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aListViewHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aListViewHeader](
[lvwid] [int] NOT NULL,
[lvwtransname] [varchar] (50) NULL,
[lvwmodulename] [varchar] (50) NULL,
[lvwname] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[alocationdsn]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[alocationdsn](
[LocationID] [int] NOT NULL,
[LocationType] [varchar] (10) NOT NULL,
[ServerName] [varchar] (100) NULL,
[DsnName] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aloGroupreportrights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aloGroupreportrights](
[userGroupid] [int] NOT NULL,
[reportid] [int] NOT NULL,
[modulecode] [varchar] (50) NULL,
[Companyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aloreportrights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aloreportrights](
[userid] [int] NOT NULL,
[reportid] [int] NOT NULL,
[modulecode] [varchar] (50) NULL,
[Companyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aLoyaltyCardContactDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aLoyaltyCardContactDetails](
[CompanyID] [int] NOT NULL,
[ID] [int] NOT NULL,
[CardID] [int] NOT NULL,
[ContactID] [int] NOT NULL,
[UserName] [varchar] (50) NOT NULL,
[ExpiryDate] [datetime] NOT NULL,
[CardNo] [varchar] (50) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aLoyaltyCardMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aLoyaltyCardMaster](
[CompanyID] [int] NOT NULL,
[CardID] [int] NOT NULL,
[CardDesc] [varchar] (50) NOT NULL,
[Amount] [numeric] (18,2) NOT NULL,
[Points] [int] NOT NULL,
[PointsValue] [int] NOT NULL,
[UserName] [varchar] (50) NOT NULL,
[MinimumPoints] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[amarketrates]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[amarketrates](
[itemid] [int] NOT NULL,
[marketone] [varchar] (50) NULL,
[markettwo] [varchar] (50) NULL,
[priceone] [numeric] (18,0) NULL,
[pricetwo] [numeric] (18,0) NULL,
[remarks] [nvarchar] (500) NULL,
[username] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[amisUserRights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[amisUserRights](
[UserID] [int] NULL,
[MenuID] [int] NULL,
[CompanyID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aPAckageSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aPAckageSettings](
[PAckageDate] [datetime] NULL,
[BackNoOfDays] [int] NULL,
[HQSalesAccID] [int] NULL,
[HQPurchaseAccID] [int] NULL,
[customsaccid] [int] NULL,
[GoodsInTransitID] [int] NULL,
[LCGroupID] [int] NULL,
[companyid] [int] NULL,
[servername] [varchar] (50) NULL,
[CostingMethod] [varchar] (5) NULL,
[DayClosed] [varchar] (5) NULL,
[defaultAgeRange] [int] NULL,
[defaultGodownID] [int] NULL,
[defaultShopID] [int] NULL,
[defaultRepRangeStart] [datetime] NULL,
[defaultRepRangeEnd] [datetime] NULL,
[InventoryID] [int] NULL,
[CostofGoodsid] [int] NULL,
[LcMarginGroupID] [int] NULL,
[futureint] [int] NULL,
[futurevc] [varchar] (250) NULL,
[futurenum] [numeric] (18,2) NULL,
[movementperiod] [int] NULL,
[importperiod] [int] NULL,
[analysisperiod] [char] (10) NULL,
[shipmentfixedandactualvaluediff] [int] NULL,
[compprofitshareacc] [int] NULL,
[stocktransfercontrolacc] [int] NULL,
[companydepartment] [int] NULL,
[profittransfercontrolacc] [int] NULL,
[mainservername] [varchar] (50) NULL,
[AllowItemCodeDuplication] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[Returnadjustmentaccid] [int] NULL,
[PurchaseRtnAccID] [int] NULL,
[POGITAccountid] [int] NULL,
[costofsalesid] [int] NULL,
[AssetConversionAccid] [int] NULL,
[interdepsalescntrlaccid] [int] NULL,
[instdate] [varchar] (250) NULL,
[lockdate] [varchar] (250) NULL,
[extensionno] [varchar] (250) NULL,
[tempchar] [varchar] (250) NULL,
[spcheck] [smallint] NULL,
[EnableCRMContacts] [int] NULL,
[CompanyLogin] [int] NULL,
[hirepurchase] [int] NULL,
[Payrollneeded] [int] NULL,
[DisableDataFiltersForCustomers] [int] NULL,
[DisableDataFiltersForVendors] [int] NULL,
[BusinessPromotionAcc] [int] NULL,
[WarrentyClaimAcc] [int] NULL,
[MailBasedOnReorderLevel] [bit] NULL,
[HQLocalPurchaseConfirmation] [int] NULL,
[BlockAddingNewItemToShops] [int] NULL,
[FineEnabled] [int] NULL,
[IntegerQuantity] [int] NULL,
[Alias] [bit] NOT NULL,
[ActiveDirectoryLogin] [bit] NULL,
[AllowEnteringSlNoInSplInvoice] [bit] NULL,
[AllowDirectPurchaseBill] [int] NULL,
[ShowCollectFromInDeliveryNote] [bit] NULL,
[ReorderLevelMandatory] [bit] NULL,
[ItemwiseAccountinginInHousecon] [bit] NULL,
[DefaultPurRequestVendor] [int] NULL,
[TransactionsSummaryDate] [datetime] NULL,
[AllowDirectLocalPurchaseCosting] [bit] NOT NULL,
[TransactionsSummary] [bit] NULL,
[DeliveryItemsVerificationUrl] [varchar] (500) NULL,
[VisibleDepartmentPurReq] [bit] NULL,
[AllowMultipleQuotations] [bit] NULL,
[EnableRemainderAccBills] [bit] NOT NULL,
[AutoConfirmAccTrans] [bit] NOT NULL,
[SellingPriceBelowCostPrice] [bit] NOT NULL,
[CreditLimitType] [char] (1) NULL,
[ReportServerName] [varchar] (100) NULL,
[PPandEAccid] [int] NULL,
[CustomerGroupIdForEmployees] [int] NULL,
[NoCreditForOverdueCustomers] [bit] NOT NULL,
[ReportLogo] [int] NULL,
[postdatedcheque] [bit] NOT NULL,
[AutomateSegmentwisePrice] [bit] NULL,
[QuickItemFetchInLoginDepartmentOnly] [bit] NULL,
[EnableGST] [bit] NULL,
[TaxCategoryforServices] [int] NULL,
[EnableGSTinForeignPurchase] [bit] NULL,
[CustomerGroupIdForManagement] [int] NULL,
[CustomerGroupIdForStaff] [int] NULL,
[TaxCategoryforInstallmentSales] [bit] NULL,
[NeedApproval] [bit] NOT NULL,
[ProjectWiseDespatch] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aPackingType]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aPackingType](
[PackingTypeID] [int] NOT NULL,
[PackingTypeCode] [varchar] (50) NOT NULL,
[PackingTypeName] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aPackingTypeCapacityDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aPackingTypeCapacityDetail](
[PackingTypeID] [int] NOT NULL,
[UnitsID] [int] NOT NULL,
[Quantity] [numeric] (18,5) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aparentCategoryMergingDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aparentCategoryMergingDetails](
[CompanyID] [int] NOT NULL,
[MergeID] [int] NOT NULL,
[MergeDate] [datetime] NOT NULL,
[OldParentCategoryID] [int] NOT NULL,
[NewParentCategoryID] [int] NOT NULL,
[Cancelled] [int] NULL,
[CancelledRemarks] [nvarchar] (250) NULL,
[Remarks] [nvarchar] (50) NULL,
[UserName] [nvarchar] (50) NOT NULL,
[UpdateUserName] [nvarchar] (50) NULL,
[UpdateDateTime] [datetime] NULL,
[Rowguid] [uniqueidentifier] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aParentItemCategory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aParentItemCategory](
[PItemCategoryID] [int] NOT NULL,
[PItemCategoryCode] [varchar] (4) NOT NULL,
[PCategoryDescription] [varchar] (250) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aPrefix]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aPrefix](
[CompanyID] [int] NOT NULL,
[InterfaceID] [int] NOT NULL,
[shopid] [int] NULL,
[godownid] [int] NULL,
[Prefix] [varchar] (25) NOT NULL,
[ModuleCode] [varchar] (50) NULL,
[departmentid] [int] NULL,
[Financialid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aproductconditionmaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aproductconditionmaster](
[prodcndcompanyid] [int] NOT NULL,
[prodcndid] [int] NOT NULL,
[prodcndsercatid] [int] NOT NULL,
[prodcndcode] [varchar] (50) NULL,
[prodcndname] [varchar] (100) NULL,
[prodcnddetails] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aPurchasePriceRange]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aPurchasePriceRange](
[CompanyId] [int] NOT NULL,
[ItemId] [int] NOT NULL,
[MinPrice] [numeric] (18,2) NOT NULL,
[MaxPrice] [numeric] (18,2) NOT NULL,
[CurrencyId] [int] NOT NULL,
[UpdateTime] [datetime] NULL,
[UpdateUser] [nvarchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aPurchasePriceRangeHistory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aPurchasePriceRangeHistory](
[SlNo] [int] NOT NULL,
[CompanyId] [int] NOT NULL,
[ItemId] [int] NOT NULL,
[MinPrice] [numeric] (18,2) NOT NULL,
[MaxPrice] [numeric] (18,2) NOT NULL,
[CurrencyId] [int] NOT NULL,
[UpdateTime] [datetime] NULL,
[UpdateUser] [nvarchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aRateEditingDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aRateEditingDetails](
[redID] [int] NOT NULL,
[redDate] [datetime] NOT NULL,
[reditemid] [int] NOT NULL,
[reduserid] [int] NOT NULL,
[redcompanyid] [int] NOT NULL,
[redoldcostprice] [numeric] (18,8) NOT NULL,
[redcostprice] [numeric] (18,8) NOT NULL,
[UpdateDateTime] [datetime] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aReccuringPaymentDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aReccuringPaymentDetails](
[CompanyID] [int] NOT NULL,
[DepartmentID] [int] NOT NULL,
[ReccuringID] [varchar] (50) NOT NULL,
[ReccuringNo] [varchar] (50) NOT NULL,
[ReccuringDate] [datetime] NOT NULL,
[PaymentName] [varchar] (50) NOT NULL,
[PaymentDate] [datetime] NOT NULL,
[Amount] [numeric] (18,2) NOT NULL,
[Type] [varchar] (50) NOT NULL,
[Remarks] [varchar] (250) NULL,
[Cancel] [int] NULL,
[CancelRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[arecentmenu]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[arecentmenu](
[interfaceid] [int] NULL,
[userid] [int] NULL,
[usertype] [int] NULL,
[recentid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aRepFormatAccounts]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aRepFormatAccounts](
[CompanyId] [int] NOT NULL,
[FormatId] [int] NOT NULL,
[GroupId] [int] NOT NULL,
[Mode] [char] (1) NULL,
[Accountid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[areportrights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[areportrights](
[userid] [int] NOT NULL,
[reportid] [int] NOT NULL,
[modulecode] [varchar] (20) NULL,
[Companyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aReports]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aReports](
[ReportID] [int] NOT NULL,
[ReportName] [varchar] (100) NULL,
[Reportconst] [varchar] (20) NULL,
[ReportCatId] [int] NULL,
[ReportDetailId] [int] NULL,
[repModuleCode] [varchar] (10) NULL,
[ReportActive] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[areprecvendordetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[areprecvendordetail](
[rrvdcompanyid] [int] NOT NULL,
[rrvdreceiveid] [int] NOT NULL,
[rrvddetailid] [int] NOT NULL,
[rrvdshopid] [int] NULL,
[rrvdrepreqid] [int] NULL,
[rrvdbookingid] [int] NULL,
[rrvditemid] [int] NULL,
[rrvdqty] [numeric] (18,3) NULL,
[rrvdtochargeprice] [numeric] (18,2) NULL,
[rrvdselected] [bit] NOT NULL,
[rrvdshopcount] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[areprecvendorheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[areprecvendorheader](
[rrvhcompanyid] [int] NOT NULL,
[rrvhreceiveid] [int] NOT NULL,
[rrvhreceiveno] [varchar] (50) NULL,
[rrvhreceivedate] [datetime] NULL,
[rrvhvendorid] [int] NULL,
[rrvhvendorrefno] [varchar] (50) NULL,
[rrvhremarks] [varchar] (250) NULL,
[rrvhtransfinished] [bit] NOT NULL,
[rrvhcancelled] [bit] NOT NULL,
[rrvhcancelledremarks] [varchar] (250) NULL,
[rrvhTime] [datetime] NULL,
[rrvhcreated] [varchar] (20) NULL,
[rrvhModified] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ASalesPersonCommisionDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ASalesPersonCommisionDetail](
[salespersonid] [int] NOT NULL,
[detailid] [int] NOT NULL,
[FromRange] [numeric] (18,2) NULL,
[ToRange] [numeric] (18,2) NULL,
[percentage] [numeric] (5,2) NULL,
[phPercentage] [numeric] (5,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AsalesPersonmaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AsalesPersonmaster](
[Sperid] [int] NOT NULL,
[Spername] [varchar] (50) NULL,
[Sperqualification] [varchar] (100) NULL,
[Sperage] [int] NULL,
[SperJoindate] [datetime] NULL,
[SperDOB] [datetime] NULL,
[SperSex] [bit] NOT NULL,
[Speraddress] [varchar] (250) NULL,
[SperPhone] [varchar] (100) NULL,
[SperEmail] [varchar] (100) NULL,
[Companyid] [int] NOT NULL,
[sperperhrsal] [numeric] (18,2) NULL,
[targettype] [char] (1) NULL,
[targetamount] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[active] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ASegmentMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ASegmentMaster](
[companyid] [int] NOT NULL,
[Segmentid] [int] NOT NULL,
[SegmentName] [varchar] (100) NULL,
[Createddate] [datetime] NULL,
[Remarks] [varchar] (250) NULL,
[Percentage] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aServiceCategory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aServiceCategory](
[sercategid] [int] NOT NULL,
[sercatcompanyid] [int] NOT NULL,
[sercatcode] [varchar] (50) NOT NULL,
[sercatname] [varchar] (250) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aserviceitemdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aserviceitemdetails](
[ServiceId] [int] NULL,
[ItemId] [int] NULL,
[Detailid] [int] NULL,
[Quantity] [numeric] (18,3) NULL,
[PackId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aservicelocations]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aservicelocations](
[serlocid] [int] NOT NULL,
[serlocname] [varchar] (100) NULL,
[serlocaddress] [varchar] (250) NULL,
[serlocphone] [varchar] (100) NULL,
[serloccomments] [varchar] (250) NULL,
[serloctype] [varchar] (5) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aservicemaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aservicemaster](
[serid] [int] NOT NULL,
[sercompanyid] [int] NOT NULL,
[sercategid] [int] NULL,
[sercode] [varchar] (50) NOT NULL,
[sername] [varchar] (250) NOT NULL,
[sercharge] [numeric] (18,8) NOT NULL,
[serdetails] [varchar] (250) NULL,
[serfutureint] [int] NULL,
[serfururevc] [varchar] (250) NULL,
[serfuturenum] [numeric] (18,8) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[serservicetype] [char] (5) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aservicestatus]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aservicestatus](
[serstatuscompanyid] [int] NOT NULL,
[serStatusID] [int] NOT NULL,
[serStatusName] [varchar] (50) NULL,
[serStatusDesc] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aSettings](
[SettingID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[NoOfPreviousDays] [smallint] NULL,
[InvoicePeriod] [smallint] NULL,
[FinancialYearPeriod] [smallint] NULL,
[FixedAssetGroupID] [int] NOT NULL,
[CashGroupID] [int] NULL,
[BankGroupID] [int] NOT NULL,
[TradeDebtorAcID] [int] NOT NULL,
[TradeCreditorAcID] [int] NOT NULL,
[SalesGroupID] [int] NOT NULL,
[PurchaseGroupID] [int] NOT NULL,
[SepProformaInvoiceNo] [bit] NOT NULL,
[SepProductServiceNo] [bit] NOT NULL,
[AverageRate] [bit] NOT NULL,
[EnableTargetCheck] [bit] NOT NULL,
[EnableBudgetCheck] [bit] NOT NULL,
[ExchangeDiffAcID] [int] NULL,
[Retainedearningsacc] [int] NULL,
[openingfreezed] [bit] NOT NULL,
[BackDay] [datetime] NULL,
[depreciationid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[autogenerateasstcode] [bit] NULL,
[debtorsaccid] [varchar] (250) NULL,
[creditorsaccid] [varchar] (250) NULL,
[payablealertbeforedays] [int] NULL,
[alertbeforedays] [int] NULL,
[depriciationexpaccid] [int] NULL,
[disposalaccount] [int] NULL,
[transferaccount] [int] NULL,
[astopendate] [datetime] NULL,
[RefBillId] [int] NULL,
[CurrentAssetGroupId] [int] NULL,
[CurrentLiabilityGroupId] [int] NULL,
[CurrentShareCapitalGroupId] [int] NULL,
[GainOrLossOnAssetDisposal] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShiftMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShiftMaster](
[ShiftId] [int] NULL,
[ShiftName] [varchar] (50) NULL,
[ShopId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShipment]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShipment](
[sShipmentID] [int] NOT NULL,
[sShipmentNO] [varchar] (50) NULL,
[sBillID] [int] NULL,
[sShipmentDate] [datetime] NOT NULL,
[sCostingDone] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ashopcashaccountdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ashopcashaccountdetails](
[shopID] [int] NOT NULL,
[CashAccountID] [int] NOT NULL,
[CompanyID] [int] NULL,
[futurevc] [varchar] (250) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShopChequeAccountDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShopChequeAccountDetails](
[shopID] [int] NOT NULL,
[ChequeAccountID] [int] NOT NULL,
[CompanyID] [int] NULL,
[futurevc] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShopCustomerDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShopCustomerDetails](
[ShopID] [int] NOT NULL,
[CustomerID] [int] NOT NULL,
[creditlimit] [numeric] (18,2) NULL,
[custdiscperc] [numeric] (18,2) NULL,
[futurevc] [varchar] (250) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[DuePeriod] [numeric] (18,2) NULL,
[segmentid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShopCustomerSetting]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShopCustomerSetting](
[ShopID] [int] NOT NULL,
[CompanyID] [int] NULL,
[GroupID] [int] NULL,
[CatID] [int] NULL,
[CurrencyID] [int] NULL,
[CountryID] [int] NULL,
[AccBit] [bit] NULL,
[AccID] [int] NULL,
[CityID] [int] NULL,
[DuePeriod] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShopitemCategory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShopitemCategory](
[shopid] [int] NOT NULL,
[itemcategoryid] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShopItemDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShopItemDetail](
[ShopID] [int] NOT NULL,
[ItemID] [int] NOT NULL,
[ItemReorderLevel] [numeric] (18,3) NULL,
[RequestRaised] [bit] NOT NULL,
[ReorderQuantity] [numeric] (18,3) NULL,
[ShortcutNo] [int] NULL,
[orderraised] [bit] NOT NULL,
[quotationraised] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ashopprintmessages]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ashopprintmessages](
[shopid] [int] NOT NULL,
[transtype] [varchar] (50) NOT NULL,
[messageid] [int] NOT NULL,
[message] [varchar] (500) NULL,
[allignment] [char] (1) NULL,
[futureint] [int] NULL,
[futurevarchar] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShops]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShops](
[ShopID] [int] NOT NULL,
[ShopName] [varchar] (250) NOT NULL,
[ShopLocation] [varchar] (250) NOT NULL,
[ShopRegNo] [varchar] (50) NOT NULL,
[ShopIECode] [varchar] (50) NOT NULL,
[InCharge] [varchar] (250) NOT NULL,
[JobTitle] [varchar] (250) NULL,
[TelephoneNo] [varchar] (100) NULL,
[OpenedDate] [datetime] NULL,
[Address] [varchar] (250) NULL,
[CityID] [int] NULL,
[FaxNo] [varchar] (100) NULL,
[BillMessage] [varchar] (250) NULL,
[Remarks] [varchar] (250) NULL,
[OwnerName] [varchar] (250) NULL,
[OwnerAddress] [varchar] (250) NULL,
[OwnerTelephone] [varchar] (50) NULL,
[ActiveShop] [bit] NOT NULL,
[Ipaddress] [varchar] (50) NOT NULL,
[CompanyID] [int] NOT NULL,
[Countryid] [int] NULL,
[Selected] [bit] NOT NULL,
[TruncateCheck] [bit] NOT NULL,
[FIFO] [bit] NOT NULL,
[DepartmentID] [int] NULL,
[DefaultCashaccountID] [int] NULL,
[ShopSalesaccountID] [int] NULL,
[ShopPurchaseAcID] [int] NULL,
[ShopGoodsReturnNoteAccID] [int] NULL,
[diffinCashBoxAcc] [int] NULL,
[ExpenseAccount] [int] NULL,
[maxPaymentAmount] [numeric] (18,2) NULL,
[maxdiscountpercent] [numeric] (18,2) NULL,
[dayClosed] [bit] NOT NULL,
[stockWriteoffAccID] [int] NULL,
[wholesaleallowed] [bit] NOT NULL,
[MaxRequestItemsToHQ] [int] NULL,
[futureint] [int] NULL,
[futurevarchar] [varchar] (250) NULL,
[futuredatetime] [datetime] NULL,
[discountaccountid] [int] NULL,
[miscsettings13] [varchar] (50) NULL,
[allowblockprice] [bit] NOT NULL,
[showcostpriceinsales] [bit] NULL,
[RevisedCostPricePercent] [numeric] (18,2) NULL,
[shopdebitcreditacc] [int] NULL,
[gstno] [varchar] (50) NULL,
[gstpercent] [numeric] (5,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[locationarrangement] [bit] NULL,
[costofsalespercent] [numeric] (5,2) NULL,
[segmentid] [int] NULL,
[Accountable] [datetime] NULL,
[DeliveryMust] [bit] NULL,
[interdepsalesaccid] [int] NULL,
[interdeppurchaseaccid] [int] NULL,
[otherShopDebitAccId] [int] NULL,
[SalesCommMarginPer] [numeric] (6,2) NULL,
[ShopOtherChargesAccID] [int] NULL,
[ShopCustomsDutyAccID] [int] NULL,
[utilityaccountID] [int] NULL,
[CounterLogin] [smallint] NULL,
[DefaultSave] [int] NULL,
[RateEditingonDirectCashInv] [int] NOT NULL,
[RateEditingonDirectCreditInv] [int] NOT NULL,
[SubDepartmentID] [int] NULL,
[LoyaltyAccID] [int] NULL,
[AutoGenerateDeliveryNote] [int] NULL,
[ShowSellingPriceInItemFetch] [int] NULL,
[AddCustomDutyToCostPrice] [int] NULL,
[SeparateRateCheckCreditSales] [int] NULL,
[InvoicePreviewCurrency] [int] NULL,
[ShipmentDetails] [int] NULL,
[showbinlocation] [bit] NULL,
[RequestForNonShopItem] [bit] NULL,
[ShowRecentlySavedContactDetails] [bit] NULL,
[AllowNewCustAndItemCreateServ] [bit] NULL,
[ShowStockInItemFetch] [bit] NULL,
[InhouseConAccnt] [int] NULL,
[AllowDateEditInTrans] [bit] NULL,
[CustomerNeededForPos] [bit] NULL,
[PreserveItemDetails] [bit] NULL,
[ShowStockInTransOnlyOnDemand] [int] NULL,
[AllowRateEditForFreeItem] [bit] NULL,
[DefaultChequeaccountID] [int] NULL,
[ShowDefaultSP] [bit] NULL,
[RegisteredCustomer] [bit] NULL,
[UnRegisteredCustomer] [bit] NULL,
[SHOPTIN] [varchar] (50) NULL,
[activateGST] [bit] NULL,
[ServiceTaxCategoryId] [int] NULL,
[printKOTseperatly] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Ashopsalespersondetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Ashopsalespersondetails](
[SperShopid] [int] NOT NULL,
[SperID] [int] NOT NULL,
[sptype] [bit] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[userId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ashopsercategory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ashopsercategory](
[ssercategid] [int] NOT NULL,
[ssercatcompanyid] [int] NOT NULL,
[sshopid] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShopServiceCharges]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShopServiceCharges](
[serid] [int] NOT NULL,
[sercompanyid] [int] NOT NULL,
[serShopID] [int] NOT NULL,
[sercharge] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShopToolsDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShopToolsDetails](
[companyid] [int] NOT NULL,
[shopid] [int] NOT NULL,
[toolsastid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aShopVendorDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aShopVendorDetails](
[ShopID] [int] NOT NULL,
[VendorID] [int] NOT NULL,
[futurevc] [varchar] (250) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aSize]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aSize](
[SizeID] [int] NOT NULL,
[SizeCode] [varchar] (50) NOT NULL,
[SizeName] [varchar] (250) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[assetdisposaldetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[assetdisposaldetail](
[dispdcompanyid] [int] NOT NULL,
[dispID] [int] NOT NULL,
[dispdid] [int] NOT NULL,
[dispdasstid] [int] NULL,
[dispdaccid] [int] NULL,
[dispdcredit] [bit] NULL,
[dispcancelledremarks] [varchar] (250) NULL,
[dispdamount] [numeric] (18,2) NULL,
[dispdtype] [char] (1) NULL,
[DisAstSaleValue] [numeric] (18,2) NULL,
[disdepeBalamt] [numeric] (18,2) NULL,
[disUptoDepAmt] [numeric] (19,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[assetdisposalheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[assetdisposalheader](
[disphcompanyid] [int] NOT NULL,
[disphid] [int] NOT NULL,
[disphno] [varchar] (50) NULL,
[disphdate] [datetime] NULL,
[disphremarks] [varchar] (250) NULL,
[disphposted] [bit] NULL,
[disphcancelled] [bit] NULL,
[disphcancelledremarks] [varchar] (250) NULL,
[disphauthorisedby] [varchar] (100) NULL,
[disphdepartmentid] [int] NULL,
[disphexrate] [numeric] (18,8) NULL,
[disphexchangerates] [varchar] (250) NULL,
[disphdepexrate] [numeric] (18,8) NULL,
[financialid] [int] NULL,
[updatetime] [datetime] NULL,
[disphSubdepartmentid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[assetexpensetrackingdetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[assetexpensetrackingdetail](
[aexcompanyid] [int] NULL,
[aexpaymentid] [int] NULL,
[aexpaymentno] [varchar] (50) NULL,
[aexassetid] [int] NULL,
[aexpaymentdate] [datetime] NULL,
[aexpaymentamount] [numeric] (18,2) NULL,
[aexcurrencyid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[assettransfer]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[assettransfer](
[asttransid] [int] NOT NULL,
[asttranscompanyid] [int] NOT NULL,
[asttrransno] [varchar] (50) NOT NULL,
[asttransdate] [datetime] NOT NULL,
[asttransassetid] [int] NOT NULL,
[asttransfromdepid] [int] NOT NULL,
[asttranstodepid] [int] NULL,
[asttransvalue] [numeric] (18,2) NOT NULL,
[asttransposted] [bit] NULL,
[asttransremarks] [varchar] (250) NOT NULL,
[asttranscancelled] [bit] NULL,
[asttranscancelledremarks] [varchar] (250) NULL,
[exchangerates] [varchar] (250) NULL,
[financialid] [int] NULL,
[consexrate] [numeric] (18,8) NULL,
[fromdepexrate] [numeric] (18,8) NULL,
[todepexrate] [numeric] (18,8) NULL,
[Updatetime] [datetime] NULL,
[FromAssetAccId] [int] NULL,
[ToAssetAccID] [int] NULL,
[FromDeprAccId] [int] NULL,
[ToDeprAccId] [int] NULL,
[FromACCDeprAccId] [int] NULL,
[ToACCDeprAccId] [int] NULL,
[astDeprValue] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aSSRSReportInterface]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aSSRSReportInterface](
[IntrefaceId] [int] NOT NULL,
[ReportUrl] [varchar] (4000) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aStatus]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aStatus](
[CompanyId] [int] NOT NULL,
[StatusId] [int] NOT NULL,
[StatusName] [nvarchar] (50) NOT NULL,
[StatusDesc] [nvarchar] (500) NULL,
[StatusGroupId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aStatusGroup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aStatusGroup](
[CompanyId] [int] NOT NULL,
[StatusGroupId] [int] NOT NULL,
[StatusGroupName] [nvarchar] (50) NOT NULL,
[StatusGroupDesc] [nvarchar] (500) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aSubDepartmentMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aSubDepartmentMaster](
[SubDepartmentID] [int] NOT NULL,
[SubDepartmentName] [varchar] (50) NOT NULL,
[CompanyID] [int] NOT NULL,
[BudgetedAmount] [numeric] (18,2) NULL,
[ParentDepId] [int] NULL,
[LevelCode] [int] NULL,
[Selected] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[Subdepcurrencyid] [int] NULL,
[address1] [varchar] (250) NULL,
[address2] [varchar] (250) NULL,
[payablealertbeforedays] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aSubItemDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aSubItemDetails](
[ItemID] [int] NOT NULL,
[SubItemID] [int] NOT NULL,
[PackingTypeID] [int] NULL,
[UnitsID] [int] NULL,
[Quantity] [numeric] (18,3) NULL,
[SubItemRate] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aTableColumns]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aTableColumns](
[TableID] [int] NOT NULL,
[ColumnID] [int] NOT NULL,
[ColumnName] [varchar] (50) NOT NULL,
[ColumnDescription] [varchar] (250) NULL,
[ColumnHeader] [varchar] (50) NULL,
[ColumnType] [varchar] (50) NULL,
[ColumnLength] [smallint] NULL,
[ColumnDecimals] [tinyint] NULL,
[Mandatory] [bit] NOT NULL,
[Version1] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aTables]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aTables](
[TableID] [int] NOT NULL,
[TableName] [varchar] (250) NOT NULL,
[Description] [varchar] (250) NULL,
[Comments] [varchar] (250) NULL,
[Version1] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aTaxCategoryMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aTaxCategoryMaster](
[TaxCompanyId] [int] NOT NULL,
[TaxId] [int] NOT NULL,
[TaxCategoryCode] [varchar] (25) NOT NULL,
[TaxDescription] [varchar] (250) NOT NULL,
[TaxPercentage] [numeric] (18,2) NULL,
[TaxAccountable] [bit] NOT NULL,
[TaxCancelled] [int] NOT NULL,
[TaxType] [int] NULL,
[TaxAccountId] [int] NULL,
[TaxInputAccountId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aTechnicianServiceDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aTechnicianServiceDetails](
[serid] [int] NOT NULL,
[orderId] [int] NULL,
[serTechnicianID] [int] NOT NULL,
[serTimeReqInMins] [int] NULL,
[sercompanyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUnit]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUnit](
[UnitID] [int] NOT NULL,
[UnitCode] [varchar] (50) NOT NULL,
[UnitName] [varchar] (250) NOT NULL,
[Counts] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserAuditDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserAuditDetail](
[dCompanyId] [int] NOT NULL,
[dAuditId] [int] NOT NULL,
[dDetailId] [int] NOT NULL,
[dAuditControlName] [varchar] (250) NOT NULL,
[dAuditControlType] [varchar] (50) NULL,
[dOldValue] [varchar] (8000) NOT NULL,
[dNewValue] [varchar] (8000) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserAuditHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserAuditHeader](
[hCompanyId] [int] NOT NULL,
[hAuditId] [int] NOT NULL,
[hTransId] [int] NULL,
[hTransNo] [varchar] (8000) NULL,
[hUserFullName] [varchar] (250) NOT NULL,
[hLoggedDateTime] [datetime] NOT NULL,
[hExitedDateTime] [datetime] NOT NULL,
[hInterfaceId] [int] NULL,
[hMode] [char] (1) NOT NULL,
[hSaved] [bit] NOT NULL,
[hDepartmentId] [int] NULL,
[hMachineName] [varchar] (50) NULL,
[hWindowsUserName] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserDeptDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserDeptDetails](
[companyid] [int] NULL,
[userid] [int] NULL,
[deptid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ausergroupAccGroupDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ausergroupAccGroupDetails](
[CompanyID] [int] NOT NULL,
[UserGroupID] [int] NOT NULL,
[AccGroupID] [int] NOT NULL,
[Rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupBrandDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupBrandDetails](
[CompanyID] [int] NOT NULL,
[UserGroupID] [int] NOT NULL,
[BrandID] [int] NOT NULL,
[rowguiD] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupCusGroupDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupCusGroupDetails](
[CompanyID] [int] NOT NULL,
[UserGroupID] [int] NOT NULL,
[CusGroupID] [int] NOT NULL,
[Rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupDeptDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupDeptDetails](
[companyid] [int] NULL,
[userGroupid] [int] NULL,
[deptid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupGodownDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupGodownDetails](
[CompanyId] [int] NOT NULL,
[UserGroupID] [int] NOT NULL,
[GodownID] [int] NOT NULL,
[rowguID] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupItemCategoryDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupItemCategoryDetails](
[CompanyID] [int] NOT NULL,
[UserGroupID] [int] NOT NULL,
[ItemCategoryID] [int] NOT NULL,
[rowguID] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupmisUserRights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupmisUserRights](
[UserGroupID] [int] NULL,
[MenuID] [int] NULL,
[CompanyID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupreportrights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupreportrights](
[userGroupid] [int] NOT NULL,
[reportid] [int] NOT NULL,
[modulecode] [varchar] (20) NULL,
[Companyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupRights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupRights](
[UsergroupID] [int] NOT NULL,
[ModuleCode] [varchar] (10) NULL,
[InterfaceID] [int] NOT NULL,
[FunctionRights] [varchar] (10) NULL,
[CompanyID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUsergroups]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUsergroups](
[UserGroupID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[UserGroupName] [varchar] (250) NULL,
[Description] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupShopDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupShopDetails](
[CompanyID] [int] NOT NULL,
[UserGroupID] [int] NOT NULL,
[ShopID] [int] NOT NULL,
[rowguID] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserGroupVenGroupDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserGroupVenGroupDetails](
[CompanyID] [int] NOT NULL,
[UserGroupID] [int] NOT NULL,
[VenGroupID] [int] NOT NULL,
[Rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AUserMasterGridSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[AUserMasterGridSettings](
[CompanyID] [int] NOT NULL,
[UserID] [int] NOT NULL,
[BackColor] [varchar] (50) NOT NULL,
[ForeColor] [varchar] (50) NOT NULL,
[GridColor] [varchar] (50) NOT NULL,
[HeaderColor] [varchar] (50) NOT NULL,
[FontName] [varchar] (50) NOT NULL,
[FontSize] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUserRights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUserRights](
[UserID] [int] NOT NULL,
[ModuleCode] [varchar] (10) NULL,
[InterfaceID] [int] NOT NULL,
[FunctionRights] [varchar] (10) NULL,
[CompanyID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aUsers]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aUsers](
[UserID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[UserName] [varchar] (250) NULL,
[UserPwd] [varchar] (50) NULL,
[FullName] [varchar] (250) NULL,
[ShopID] [int] NULL,
[GodownID] [int] NULL,
[logedon] [bit] NULL,
[GlobalUserID] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[UserGroupID] [int] NULL,
[EmailID] [varchar] (50) NULL,
[usersignature] [image] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aVendorGroup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aVendorGroup](
[CompanyID] [int] NOT NULL,
[VenGroupId] [int] NOT NULL,
[VenGroupName] [varchar] (50) NOT NULL,
[ParentGroupID] [int] NOT NULL,
[LevelCode] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aVendorItem]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aVendorItem](
[itemid] [int] NOT NULL,
[vendorid] [int] NOT NULL,
[vendoritemcode] [varchar] (50) NULL,
[vendoritemdesc] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aVendorMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aVendorMaster](
[VendorID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[VendorName] [varchar] (250) NOT NULL,
[Address1] [varchar] (250) NULL,
[Address2] [varchar] (250) NULL,
[Address3] [varchar] (250) NULL,
[CityID] [int] NOT NULL,
[ContactName] [varchar] (250) NULL,
[PhoneNo] [varchar] (250) NULL,
[FaxNo] [varchar] (250) NULL,
[EmailID] [varchar] (50) NULL,
[Local] [bit] NOT NULL,
[DuePeriod] [smallint] NULL,
[Comments] [varchar] (250) NULL,
[Active] [bit] NOT NULL,
[CurrencyID] [int] NULL,
[CountryID] [int] NULL,
[OpeningCreditBalance] [numeric] (18,2) NULL,
[OpeningDebitBalance] [numeric] (18,2) NULL,
[VendorCode] [varchar] (50) NULL,
[Initial] [varchar] (5) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[allowblankcheque] [bit] NOT NULL,
[creditoraccid] [int] NULL,
[VenGroupId] [int] NULL,
[VendorCategory] [varchar] (250) NULL,
[VendorTIN] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aVendorMasterBackUp]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aVendorMasterBackUp](
[VendorID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[FinancialID] [int] NOT NULL,
[OpeningCreditBalance] [numeric] (18,2) NOT NULL,
[OpeningDebitBalance] [numeric] (18,2) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aVesselMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aVesselMaster](
[CompanyId] [int] NOT NULL,
[VesselID] [int] NOT NULL,
[VesselCode] [varchar] (50) NOT NULL,
[VesselDes] [varchar] (100) NOT NULL,
[CountryID] [int] NOT NULL,
[VesselOperatorName] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aYearEndTemp]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[aYearEndTemp](
[companyid] [int] NULL,
[accountid] [int] NULL,
[acctype] [char] (1) NULL,
[financialid] [int] NULL,
[openingamount] [numeric] (18,2) NULL,
[openingdepamount] [numeric] (18,2) NULL,
[openingactualamount] [numeric] (18,2) NULL,
[accountcode] [varchar] (50) NULL,
[accountdesc] [varchar] (250) NULL,
[departmentid] [int] NULL,
[DepartmentName] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bak_odatestock]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[bak_odatestock](
[COMPANYID] [int] NULL,
[SHOPID] [int] NULL,
[GODOWNID] [int] NULL,
[TRDATE] [datetime] NULL,
[ITEMID] [int] NULL,
[STOCK] [numeric] (18,3) NULL,
[DEPCOSTPRICE] [numeric] (18,3) NULL,
[DEPSTOCKVALUE] [numeric] (18,3) NULL,
[COMCOSTPRICE] [numeric] (18,3) NULL,
[COMSTOCKVALUE] [numeric] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[billdate]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[billdate](
[billdate] [datetime] NULL,
[cntdate] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Bills]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Bills](
[BillsID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[BillsNo] [varchar] (50) NOT NULL,
[BillDate] [datetime] NOT NULL,
[VendorID] [int] NULL,
[BillAmount] [numeric] (18,2) NULL,
[ReferenceNo] [varchar] (250) NULL,
[DuePeriod] [smallint] NULL,
[Discount] [numeric] (18,2) NULL,
[DiscountAccountID] [int] NULL,
[FinancialID] [int] NULL,
[CashPurchase] [bit] NOT NULL,
[BankCashAccID] [int] NULL,
[ChequeNo] [varchar] (50) NULL,
[ExchangeNature] [varchar] (5) NULL,
[Remarks] [varchar] (250) NULL,
[departmentid] [int] NULL,
[Posted] [bit] NOT NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (250) NULL,
[exchangerate] [numeric] (18,8) NULL,
[vreferenceno] [varchar] (250) NULL,
[updatetime] [datetime] NOT NULL,
[depexrate] [numeric] (18,8) NULL,
[exchangerates] [varchar] (250) NULL,
[RefJournalID] [int] NULL,
[subdepartmentid] [int] NULL,
[RecurrenceDuePeriod] [int] NULL,
[AutoGenerate] [bit] NOT NULL,
[RemainderID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BillsDebitDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BillsDebitDetails](
[BillsID] [int] NOT NULL,
[BillsDebitID] [int] NOT NULL,
[AccountID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[Amount] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bincardstock]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[bincardstock](
[locationid] [int] NULL,
[itemdesc] [varchar] (250) NULL,
[itemid] [int] NULL,
[curstock] [numeric] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetAccountsLink]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetAccountsLink](
[bacCompanyID] [int] NOT NULL,
[bacBudgetID] [int] NOT NULL,
[bacDetailID] [int] NOT NULL,
[bacAccountID] [int] NULL,
[bacDepartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetAllocationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetAllocationDetail](
[badCompanyID] [int] NOT NULL,
[badBudgetAllocID] [int] NOT NULL,
[badDetailID] [int] NOT NULL,
[badBudgetHeadID] [int] NULL,
[badFromDate] [datetime] NULL,
[badToDate] [datetime] NULL,
[badAmount] [numeric] (18,2) NULL,
[badMonthNo] [int] NOT NULL,
[badRevised] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetAllocationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetAllocationHeader](
[bahCompanyID] [int] NOT NULL,
[bahBudgetAllocID] [int] NOT NULL,
[bahBudgetNo] [varchar] (50) NULL,
[bahBudgetDate] [datetime] NULL,
[bahFromdate] [datetime] NULL,
[bahToDate] [datetime] NULL,
[bahBudgetPanel] [varchar] (250) NULL,
[bahReviewPanel] [varchar] (250) NULL,
[bahReviewDate] [datetime] NULL,
[bahSanctionedBy] [varchar] (100) NULL,
[bahSanctionedDate] [datetime] NULL,
[bahRemarks] [varchar] (250) NULL,
[bahCancelled] [bit] NULL,
[bahCancelledRemarks] [varchar] (250) NULL,
[bahDepartmentId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetCheckDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetCheckDetail](
[bcdCompanyID] [int] NOT NULL,
[bcdCheckID] [int] NOT NULL,
[bcdDetailID] [int] NOT NULL,
[bcdBudgetAllocID] [int] NULL,
[bcdBudgetAllocDetailID] [int] NULL,
[bcdActualAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetCheckHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetCheckHeader](
[bchCompanyId] [int] NOT NULL,
[bchCheckID] [int] NOT NULL,
[bchCheckNo] [varchar] (50) NULL,
[bchCheckDate] [datetime] NULL,
[bchBudgetAllocID] [int] NULL,
[bchActualAsonDate] [datetime] NULL,
[bchCheckedBy] [varchar] (250) NULL,
[bchRemarks] [varchar] (250) NULL,
[bchCancelled] [bit] NULL,
[bchCancelledRemarks] [varchar] (250) NULL,
[bchexchagerate] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetitemPlanDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetitemPlanDetail](
[bpdICompanyID] [int] NOT NULL,
[bpdIBudgetPlanID] [int] NOT NULL,
[bpdIDetailID] [int] NOT NULL,
[bpdIBudgetItemID] [int] NULL,
[bpdIMonthNo] [int] NULL,
[bpdIPurchaseAmt] [numeric] (18,2) NULL,
[bpdISalesAmt] [numeric] (18,2) NULL,
[bpdICostAmt] [numeric] (18,2) NULL,
[bpditemcategory] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetMaster](
[CompanyID] [int] NOT NULL,
[BudgetID] [int] NOT NULL,
[BudgetCode] [varchar] (50) NULL,
[BudgetHead] [varchar] (100) NULL,
[budcurid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetPlanDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetPlanDetail](
[bpdCompanyID] [int] NOT NULL,
[bpdBudgetPlanID] [int] NOT NULL,
[bpdDetailID] [int] NOT NULL,
[bpdBudgetHeadID] [int] NULL,
[bpdMonthNo] [int] NULL,
[bpdAmount] [numeric] (18,2) NULL,
[bpdRevised] [bit] NULL,
[bpdReviseDetailId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetPlanHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetPlanHeader](
[bphCompanyID] [int] NOT NULL,
[bphBudgetPlanID] [int] NOT NULL,
[bphBudgetNo] [varchar] (50) NULL,
[bphBudgetDate] [datetime] NULL,
[bphBudgetPanel] [varchar] (250) NULL,
[bphReviewPanel] [varchar] (250) NULL,
[bphReviewDate] [datetime] NULL,
[bphSanctionedBy] [varchar] (100) NULL,
[bphSanctionedDate] [datetime] NULL,
[bphRemarks] [varchar] (250) NULL,
[bphCancelled] [bit] NULL,
[bphCancelledRemarks] [varchar] (250) NULL,
[bphDepartmentId] [int] NULL,
[bphBudgetName] [varchar] (100) NULL,
[bphConfirmed] [bit] NULL,
[bphPlanYear] [varchar] (4) NULL,
[bphtype] [varchar] (4) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BudgetPlanReviseDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[BudgetPlanReviseDetail](
[brdCompanyID] [int] NOT NULL,
[brdBudgetPlanID] [int] NOT NULL,
[brdDetailID] [int] NOT NULL,
[brdDate] [datetime] NULL,
[brdRevisedBy] [varchar] (250) NULL,
[brdApprovedBy] [varchar] (250) NULL,
[brdRemarks] [varchar] (250) NULL,
[brdConfirmed] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Build]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Build](
[Build] [decimal] (18,0) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CashBox]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CashBox](
[CBID] [int] NOT NULL,
[CBMode] [char] (10) NULL,
[CBUserID] [int] NOT NULL,
[CBShopID] [int] NOT NULL,
[CBAmount] [numeric] (18,2) NULL,
[CBVerifiedAmount] [numeric] (18,2) NULL,
[CBDate] [datetime] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CashFlowOpenings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CashFlowOpenings](
[accountid] [int] NOT NULL,
[amount] [numeric] (18,2) NULL,
[financialyearid] [int] NOT NULL,
[companyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ClearenceRequestDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ClearenceRequestDetail](
[ShopID] [int] NOT NULL,
[ClearenceReqID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[ItemDescription] [varchar] (250) NULL,
[Packing] [varchar] (50) NULL,
[Unit] [varchar] (25) NULL,
[Qty] [numeric] (18,3) NULL,
[Amount] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ClearenceRequestHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ClearenceRequestHeader](
[ShopID] [int] NOT NULL,
[ClearenceReqID] [int] NOT NULL,
[ClearenceReqNo] [varchar] (50) NOT NULL,
[ClearenceReqDate] [datetime] NULL,
[CustomerID] [int] NULL,
[CompanyID] [int] NULL,
[POCurrencyID] [int] NULL,
[VendorName] [varchar] (250) NULL,
[VendorAddress] [varchar] (250) NULL,
[PONo] [varchar] (50) NULL,
[PODate] [datetime] NULL,
[DeliveryTo] [varchar] (250) NULL,
[DeliveryDate] [datetime] NULL,
[ExpectedArrivalDate] [datetime] NULL,
[EnteredBy] [varchar] (50) NULL,
[Remarks] [varchar] (250) NULL,
[Cancelled] [bit] NULL,
[CancelledRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CompleteItemlist]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CompleteItemlist](
[temp_ID] [int] NULL,
[CODE] [nvarchar] (255) NULL,
[BrandName] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Contra]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Contra](
[ContraID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[ContraNo] [varchar] (50) NOT NULL,
[ContraDate] [smalldatetime] NOT NULL,
[ContraType] [varchar] (3) NULL,
[FromAccountID] [int] NOT NULL,
[ToAccountID] [int] NOT NULL,
[ChargeAccountID] [int] NULL,
[ContraAmount] [numeric] (18,2) NULL,
[ContraChargeAmount] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (250) NULL,
[Posted] [bit] NOT NULL,
[FinancialID] [int] NULL,
[ExchangeNature] [varchar] (5) NULL,
[DepartmentID] [int] NULL,
[ExchangeRate] [numeric] (18,8) NULL,
[updatetime] [datetime] NOT NULL,
[depexrate] [numeric] (18,8) NULL,
[exchangerates] [varchar] (250) NULL,
[Chequeno] [varchar] (50) NULL,
[SubDepartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CostPriceUpdations]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CostPriceUpdations](
[pkCol1Value] [int] NOT NULL,
[pkCol2Value] [int] NOT NULL,
[pkCol3Value] [int] NULL,
[DetailTableName] [varchar] (250) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CreditInvoiceUpdates_20030805]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CreditInvoiceUpdates_20030805](
[ShopID] [int] NULL,
[InvoiceID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmAgreement]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmAgreement](
[AgreementId] [int] NOT NULL,
[QuotationID] [int] NULL,
[AccountId] [int] NULL,
[UserId] [int] NULL,
[AgreementSubject] [varchar] (50) NULL,
[Document] [image] NULL,
[Extension] [varchar] (50) NULL,
[AgreementDate] [datetime] NULL,
[CreateDate] [datetime] NULL,
[Deleted] [int] NULL,
[IsTemplate] [int] NULL,
[ProposalId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Crmauserreportrights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Crmauserreportrights](
[userid] [int] NOT NULL,
[reportid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmCase]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmCase](
[CaseId] [int] NOT NULL,
[Prority] [varchar] (50) NULL,
[Status] [varchar] (50) NULL,
[UserId] [int] NOT NULL,
[ClientId] [int] NOT NULL,
[Subject] [varchar] (50) NULL,
[Description] [varchar] (250) NULL,
[Resolution] [varchar] (250) NULL,
[CreateDate] [datetime] NOT NULL,
[CompanyId] [int] NOT NULL,
[Deleted] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmClient]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmClient](
[CompanyID] [int] NOT NULL,
[ClientId] [int] NOT NULL,
[ClientName] [varchar] (50) NOT NULL,
[WebSite] [varchar] (50) NULL,
[TickerSymbol] [varchar] (50) NULL,
[Industry] [varchar] (50) NULL,
[Type] [varchar] (50) NULL,
[AssignedTo] [int] NULL,
[Phone] [varchar] (50) NULL,
[Fax] [varchar] (50) NULL,
[Other] [varchar] (50) NULL,
[Email] [varchar] (50) NULL,
[AnnualRevenue] [varchar] (50) NULL,
[Rating] [varchar] (50) NULL,
[BillingAddress] [varchar] (50) NULL,
[BCityID] [int] NULL,
[BCountryID] [int] NULL,
[BPostalCode] [varchar] (50) NULL,
[ShoppingAddress] [varchar] (50) NULL,
[SCityID] [int] NULL,
[SCountryID] [int] NULL,
[SPostalCode] [varchar] (50) NULL,
[Description] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmContact]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmContact](
[ContactID] [int] NOT NULL,
[ClientId] [int] NOT NULL,
[CompanyId] [int] NOT NULL,
[FirstName] [varchar] (50) NOT NULL,
[LastName] [varchar] (50) NULL,
[Sex] [varchar] (50) NULL,
[Address] [varchar] (250) NULL,
[Email] [varchar] (50) NULL,
[CityId] [int] NULL,
[CountryId] [int] NULL,
[DateofBirth] [datetime] NULL,
[MartialStatus] [varchar] (50) NULL,
[Anniversary] [datetime] NULL,
[Profession] [varchar] (50) NULL,
[PointId] [int] NULL,
[Phone] [varchar] (50) NULL,
[OfficeNo] [varchar] (50) NULL,
[MobileNumber] [varchar] (50) NULL,
[UserId] [int] NOT NULL,
[username] [varchar] (50) NULL,
[password] [varchar] (50) NULL,
[Deleted] [int] NOT NULL,
[CreateDate] [datetime] NOT NULL,
[FaxNo] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmCustomerMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmCustomerMaster](
[CustomerID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[CustomerName] [varchar] (100) NOT NULL,
[Active] [bit] NOT NULL,
[Address1] [varchar] (250) NULL,
[Address2] [varchar] (250) NULL,
[Address3] [varchar] (250) NULL,
[CityID] [int] NOT NULL,
[PhoneNo] [varchar] (50) NULL,
[FaxNo] [varchar] (50) NULL,
[EmailID] [varchar] (100) NULL,
[CurrencyID] [int] NULL,
[CountryID] [int] NULL,
[custdob] [datetime] NULL,
[webadd] [varchar] (20) NULL,
[CreditLimit] [numeric] (18,2) NULL,
[registerdate] [datetime] NULL,
[CusGroupId] [int] NULL,
[MasterApllicationCustomerId] [int] NULL,
[Deleted] [int] NOT NULL,
[CustomerCategory] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmEmail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmEmail](
[Emailid] [int] NOT NULL,
[SendDate] [datetime] NOT NULL,
[ToEmail] [varchar] (MAX) NULL,
[CCC] [varchar] (500) NULL,
[BCCC] [varchar] (500) NULL,
[Subject] [nvarchar] (500) NOT NULL,
[Body] [nvarchar] (4000) NOT NULL,
[Send] [bit] NULL,
[RelatedTo] [varchar] (50) NULL,
[RelatedToId] [int] NULL,
[CompanyId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmEmailRecepients]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmEmailRecepients](
[EmailId] [int] NOT NULL,
[ContactId] [int] NOT NULL,
[Type] [nchar] (2) NULL,
[CompanyId] [int] NULL,
[Sent] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[crmItem]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[crmItem](
[ItemID] [int] NULL,
[ItemCode] [varchar] (50) NULL,
[ItemDescription] [varchar] (250) NULL,
[ItemPrice] [numeric] (18,2) NULL,
[ItemImage] [image] NULL,
[Extension] [char] (4) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmLeadMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmLeadMaster](
[LeadId] [int] NOT NULL,
[LeadSource] [varchar] (50) NOT NULL,
[Discription] [varchar] (1000) NOT NULL,
[CompanyId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmLeads]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmLeads](
[LeadId] [int] NOT NULL,
[LeadSource] [varchar] (50) NULL,
[LeadSourceDescription] [varchar] (250) NULL,
[ReferredBy] [varchar] (50) NULL,
[FirstName] [varchar] (50) NULL,
[LastName] [varchar] (50) NULL,
[ClientId] [int] NULL,
[UserId] [int] NULL,
[Status] [varchar] (50) NULL,
[OfficePhone] [varchar] (50) NULL,
[Mobile] [varchar] (50) NULL,
[Fax] [varchar] (50) NULL,
[Email] [varchar] (50) NULL,
[PrimaryAddress] [varchar] (50) NULL,
[PCity] [int] NULL,
[PCountry] [int] NULL,
[PPostalCode] [varchar] (50) NULL,
[OtherAddress] [varchar] (50) NULL,
[OCity] [int] NULL,
[OCountry] [int] NULL,
[OPostalCode] [varchar] (50) NULL,
[Descriptions] [varchar] (250) NULL,
[Tittle] [varchar] (50) NULL,
[Department] [varchar] (50) NULL,
[DonotCall] [bit] NULL,
[StatusDescription] [varchar] (250) NULL,
[Salutation] [varchar] (5) NULL,
[PState] [varchar] (50) NULL,
[OState] [varchar] (50) NULL,
[OtherPhno] [varchar] (50) NULL,
[HomePhno] [varchar] (50) NULL,
[CompanyId] [int] NOT NULL,
[CreateDate] [datetime] NOT NULL,
[Deleted] [bit] NOT NULL,
[LeadTypeId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmOppertunityType]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmOppertunityType](
[TypeId] [int] NOT NULL,
[Type] [varchar] (50) NOT NULL,
[Discription] [varchar] (1000) NOT NULL,
[CompanyId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmOpportunity]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmOpportunity](
[OppertunityId] [int] NOT NULL,
[ClientId] [int] NULL,
[OpportunitName] [varchar] (50) NOT NULL,
[Type] [varchar] (50) NULL,
[LeadSource] [varchar] (50) NULL,
[UserId] [int] NULL,
[Description] [varchar] (250) NULL,
[Currencyid] [int] NULL,
[Amount] [numeric] (18,2) NULL,
[ExpectedCloseDate] [datetime] NULL,
[NextStep] [varchar] (50) NULL,
[SalesStage] [varchar] (50) NULL,
[Probability] [int] NULL,
[Active] [int] NULL,
[CreateDate] [datetime] NOT NULL,
[ExchangeRate] [varchar] (50) NULL,
[CompanyAmount] [numeric] (18,2) NULL,
[Deleted] [bit] NOT NULL,
[CompanyId] [int] NOT NULL,
[LeadTypeId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmProposal]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmProposal](
[ProposalId] [int] NOT NULL,
[QuotationId] [int] NULL,
[AccountId] [int] NULL,
[UserId] [int] NULL,
[ProposalSubject] [varchar] (50) NULL,
[Document] [image] NULL,
[Extension] [varchar] (50) NULL,
[ProposalDate] [datetime] NULL,
[CreateDate] [datetime] NULL,
[Deleted] [int] NULL,
[IsTemplate] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmQuotation]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmQuotation](
[QutotationId] [int] NOT NULL,
[QutotationSubject] [varchar] (50) NOT NULL,
[PurchaseOrederNo] [varchar] (50) NULL,
[PaymentTerms] [varchar] (15) NULL,
[OpertunityId] [int] NULL,
[Quotestage] [varchar] (15) NULL,
[ValidUntil] [datetime] NULL,
[OrginalPoDate] [datetime] NULL,
[billAccountId] [int] NOT NULL,
[billContactId] [int] NULL,
[BillAddress] [varchar] (250) NULL,
[BillState] [varchar] (50) NULL,
[BillCity] [int] NULL,
[BillPostalCode] [char] (20) NULL,
[BillCountry] [int] NULL,
[ShipAddress] [varchar] (250) NULL,
[ShipState] [varchar] (50) NULL,
[ShipCity] [int] NULL,
[ShipPostalCode] [char] (20) NULL,
[ShipCountry] [int] NULL,
[Description] [varchar] (1000) NULL,
[Userid] [int] NOT NULL,
[Amount] [numeric] (18,2) NULL,
[shipAccountId] [int] NULL,
[shipContactId] [int] NULL,
[ShipAmount] [numeric] (18,2) NULL,
[ShipProvider] [varchar] (50) NULL,
[CurrencyID] [int] NULL,
[ExchangeRate] [varchar] (50) NULL,
[CompanyAmount] [numeric] (18,2) NULL,
[CompanyId] [int] NOT NULL,
[Deleted] [bit] NOT NULL,
[CreateDate] [datetime] NOT NULL,
[QuotationNo] [varchar] (50) NULL,
[FinancialYearId] [int] NULL,
[ShopId] [int] NULL,
[Id] [int] NULL,
[Clid] [int] NULL,
[Item] [varchar] (100) NULL,
[Qty] [int] NULL,
[Cofirm] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmQuotationDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmQuotationDetails](
[Quotationid] [int] NOT NULL,
[SlOrder] [int] NOT NULL,
[ItemId] [int] NOT NULL,
[ItemDescription] [varchar] (250) NOT NULL,
[Qty] [numeric] (18,2) NOT NULL,
[Price] [numeric] (18,2) NOT NULL,
[PackingtypeId] [int] NULL,
[IsCrmItem] [bit] NULL,
[MappedItemID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Crmreportgroup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Crmreportgroup](
[reportgroupid] [int] NULL,
[groupname] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Crmreports]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Crmreports](
[reportid] [int] NOT NULL,
[reportname] [varchar] (50) NULL,
[groupid] [int] NULL,
[modulecode] [char] (10) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[crmSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[crmSettings](
[ShopId] [int] NOT NULL,
[EmailFooter] [varchar] (250) NULL,
[EmailLimit] [int] NULL,
[CompanyId] [int] NULL,
[ShowUsersInAccountsMaster] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmSupportrequest]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmSupportrequest](
[RequerstId] [int] NOT NULL,
[Priority] [varchar] (50) NULL,
[Status] [varchar] (50) NULL,
[Type] [varchar] (50) NULL,
[Source] [varchar] (50) NULL,
[Category] [varchar] (50) NULL,
[UserId] [int] NULL,
[FixedinRelease] [varchar] (50) NULL,
[Subject] [varchar] (50) NULL,
[Description] [varchar] (50) NULL,
[WorkLog] [varchar] (50) NULL,
[Resolution] [varchar] (50) NULL,
[Activie] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmTask]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmTask](
[TaskId] [int] NOT NULL,
[Type] [varchar] (50) NOT NULL,
[Subject] [varchar] (50) NULL,
[StartDate] [datetime] NULL,
[StartHour] [char] (2) NULL,
[StartMinute] [char] (2) NULL,
[DurationHour] [char] (2) NULL,
[DurationMinitue] [char] (2) NULL,
[Status] [varchar] (50) NULL,
[Direction] [varchar] (50) NULL,
[UserId] [int] NOT NULL,
[Description] [text] NULL,
[ContactId] [int] NULL,
[Active] [bit] NULL,
[RelatedTo] [varchar] (50) NULL,
[Deleted] [bit] NOT NULL,
[CreateDate] [datetime] NOT NULL,
[CompanyId] [int] NOT NULL,
[ModifiedUser] [int] NULL,
[ModifiedDate] [datetime] NULL,
[Reminder] [bit] NULL,
[UserGroupId] [int] NULL,
[TransGroupId] [int] NULL,
[UserType] [char] (2) NULL,
[Priority] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmUserHirarchey]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmUserHirarchey](
[UserHirarcheyId] [int] NOT NULL,
[MasterUserId] [int] NOT NULL,
[UserGroupID] [int] NULL,
[Description] [varchar] (50) NOT NULL,
[Deleted] [bit] NOT NULL,
[CreateDate] [datetime] NOT NULL,
[DeleteDate] [datetime] NULL,
[CompanyId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmUserLastVisited]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmUserLastVisited](
[UserId] [int] NOT NULL,
[SaveOrder] [int] NOT NULL,
[Link] [varchar] (500) NOT NULL,
[Module] [varchar] (50) NOT NULL,
[DisplayText] [varchar] (250) NOT NULL,
[CompanyId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CrmUserPreference]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CrmUserPreference](
[UserId] [int] NOT NULL,
[Theme] [varchar] (50) NOT NULL,
[Appstyle] [varchar] (50) NOT NULL,
[GridWidth] [int] NOT NULL,
[LastSelectCountry] [int] NULL,
[LastSelectCity] [int] NULL,
[ActivityTaskFilter] [varchar] (50) NULL,
[UserFilter] [varchar] (50) NULL,
[ProbablityFilter] [varchar] (50) NULL,
[LeasSourceFilter] [varchar] (50) NULL,
[SalesStageFilter] [varchar] (50) NULL,
[ReportFromdate] [varchar] (50) NULL,
[ReportTodate] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CRMVersion]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CRMVersion](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Version] [varchar] (50) NOT NULL,
[Release] [int] NOT NULL,
[UpdatedDate] [datetime] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CustomerSettlementDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CustomerSettlementDetail](
[CSID] [int] NOT NULL,
[CSDetailID] [int] NOT NULL,
[CompanyID] [int] NULL,
[AccInvoiceID] [int] NULL,
[dcnid] [int] NULL,
[shopid] [int] NULL,
[LosAccInvoiceID] [int] NULL,
[losSpInvoiceId] [int] NULL,
[losinvoiceid] [int] NULL,
[losdcnid] [int] NULL,
[losserinvoiceid] [int] NULL,
[InvoiceAmount] [numeric] (18,2) NULL,
[SettlementAmount] [numeric] (18,2) NULL,
[paymentid] [int] NULL,
[losexportid] [int] NULL,
[RoomBillID] [int] NULL,
[UtilityBillID] [int] NULL,
[fineid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CustomerSettlementHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[CustomerSettlementHeader](
[CSID] [int] NOT NULL,
[CompanyID] [int] NULL,
[CSNO] [varchar] (50) NULL,
[CSDATE] [datetime] NULL,
[DepartmentID] [int] NULL,
[ReceiptID] [int] NULL,
[dcnid] [int] NULL,
[shopid] [int] NULL,
[losReceiptID] [int] NULL,
[losdcnid] [int] NULL,
[losGoodsreturnnoteID] [int] NULL,
[CustomerID] [int] NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (250) NULL,
[FinancialID] [int] NOT NULL,
[Amount] [numeric] (18,2) NULL,
[updatetime] [datetime] NOT NULL,
[losshopdcnid] [int] NULL,
[SubDepartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DebitCreditNote]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[DebitCreditNote](
[DCNId] [int] NOT NULL,
[DCNNo] [varchar] (50) NULL,
[DCNDate] [datetime] NULL,
[DCNCustomerID] [int] NULL,
[DCNVendorId] [int] NULL,
[DCNDebit] [bit] NOT NULL,
[DCNOtherAccId] [int] NULL,
[DCNReferenceNo] [varchar] (100) NULL,
[DCNBillId] [int] NULL,
[DCNInvoiceId] [int] NULL,
[DCNAmount] [numeric] (18,2) NULL,
[DCNDetails] [varchar] (1000) NULL,
[DCNRemarks] [varchar] (250) NULL,
[DCNCompanyid] [int] NULL,
[DCNExchangerate] [numeric] (18,8) NULL,
[DCNRefNo] [varchar] (50) NULL,
[DCNCusvenRefNo] [varchar] (250) NULL,
[Dcnfinancialid] [int] NULL,
[DCNCancelled] [bit] NOT NULL,
[DCNCancelledRemarks] [varchar] (250) NULL,
[DCNPosted] [bit] NOT NULL,
[dcndepartmentid] [int] NULL,
[DCNRecAddUser] [varchar] (50) NULL,
[DCNRecModifyUser] [varchar] (50) NULL,
[updatetime] [datetime] NULL,
[parentdcnid] [int] NULL,
[childdcnid] [int] NULL,
[dcndepexrate] [numeric] (18,8) NULL,
[dcnexchangerates] [varchar] (250) NULL,
[debitaccount1] [int] NULL,
[debitaccount2] [int] NULL,
[parentpaymentid] [int] NULL,
[parentreceiptid] [int] NULL,
[debitamt1] [numeric] (18,2) NULL,
[debitamt2] [numeric] (18,2) NULL,
[otheraccamt] [numeric] (18,2) NULL,
[dcnSalesPromotionID] [int] NULL,
[dcnSalesPromotionDetID] [int] NULL,
[DcnSubDepartmentID] [int] NULL,
[DCNConfirmed] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DebtorAgeSum]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[DebtorAgeSum](
[InvAmt] [numeric] (18,2) NULL,
[SettleAmt] [numeric] (18,2) NULL,
[InvoiceID] [int] NULL,
[CustomerID] [int] NULL,
[ShopID] [int] NULL,
[Due] [nvarchar] (50) NULL,
[InvoiceDate] [datetime] NULL,
[InvoiceNo] [varchar] (50) NULL,
[Type] [varchar] (50) NULL,
[Remarks] [varchar] (500) NULL,
[CustomerName] [varchar] (250) NULL,
[CurrencyName] [varchar] (50) NULL,
[Symbol] [varchar] (50) NULL,
[DueDate] [datetime] NULL,
[OverDueDays] [int] NULL,
[Address1] [varchar] (50) NULL,
[Address2] [varchar] (50) NULL,
[Address3] [varchar] (50) NULL,
[DebtoAccID] [int] NULL,
[AccountDesc] [varchar] (50) NULL,
[Currencyid] [int] NULL,
[ReferenceNo] [varchar] (500) NULL,
[CustomerCategory] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DenominationChequeDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[DenominationChequeDetails](
[dcdShopId] [int] NOT NULL,
[dcdDenomId] [int] NOT NULL,
[dcdDetailId] [int] NOT NULL,
[dcdCurrId] [int] NULL,
[dcdChequeDetails] [varchar] (250) NULL,
[dcdAmount] [numeric] (18,2) NULL,
[dcdDepAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[denominationdetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[denominationdetail](
[dshopid] [int] NOT NULL,
[ddenominationid] [int] NOT NULL,
[dcurrencyid] [int] NULL,
[ddenominationtype] [numeric] (18,2) NULL,
[ddenominationcount] [numeric] (18,0) NULL,
[damount] [numeric] (18,4) NULL,
[ddepamount] [numeric] (18,4) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[denominationheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[denominationheader](
[companyid] [int] NOT NULL,
[shopid] [int] NOT NULL,
[denominationid] [int] NOT NULL,
[denominationno] [varchar] (50) NOT NULL,
[denomdate] [datetime] NULL,
[remarks] [varchar] (250) NULL,
[cancelled] [bit] NULL,
[cancelledremarks] [varchar] (50) NULL,
[denoUserID] [int] NULL,
[tillid] [int] NULL,
[tillHistoryid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DepreciationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[DepreciationDetail](
[CompanyID] [int] NULL,
[DepreciationID] [int] NULL,
[DetailID] [int] NULL,
[FixedAssetID] [int] NULL,
[DepreciationAmount] [numeric] (18,2) NULL,
[DepreciationAccountID] [int] NULL,
[assetaccountid] [int] NULL,
[Depexpaccid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DepreciationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[DepreciationHeader](
[DepreciationID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[DepreciationDate] [smalldatetime] NOT NULL,
[DeprAccountID] [int] NULL,
[Amount] [numeric] (18,2) NULL,
[Remarks] [varchar] (100) NULL,
[DepartmentID] [int] NULL,
[DepreciationNo] [varchar] (50) NOT NULL,
[Cancelled] [bit] NOT NULL,
[cancelledremarks] [varchar] (250) NULL,
[Posted] [bit] NOT NULL,
[FinancialID] [int] NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[depexrate] [numeric] (18,8) NULL,
[consexrate] [numeric] (18,8) NULL,
[exChangeRates] [varchar] (250) NULL,
[SubDepartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Discountdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Discountdetails](
[Companyid] [int] NOT NULL,
[Discountid] [int] NOT NULL,
[Outletid] [int] NOT NULL,
[Startdatetime] [datetime] NULL,
[enddatetime] [datetime] NULL,
[discountper] [decimal] (18,2) NULL,
[dailytrue] [bit] NULL,
[alldishtrue] [bit] NULL,
[discountaccid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[discountdishdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[discountdishdetails](
[companyid] [int] NOT NULL,
[discountid] [int] NOT NULL,
[Outletid] [int] NOT NULL,
[dishid] [int] NOT NULL,
[discountper] [decimal] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Discountheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Discountheader](
[Companyid] [int] NOT NULL,
[Discountid] [int] NOT NULL,
[DiscountCode] [varchar] (50) NULL,
[DiscountName] [varchar] (250) NULL,
[Discountper] [decimal] (18,2) NULL,
[staff] [bit] NULL,
[Customer] [bit] NULL,
[Guest] [bit] NULL,
[Startdatetime] [datetime] NULL,
[enddatetime] [datetime] NULL,
[dailytrue] [bit] NULL,
[Mealid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DishSegmentDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[DishSegmentDetail](
[seg_detail_id] [int] NOT NULL,
[seg_detail_header_id] [int] NOT NULL,
[seg_detail_dishid] [int] NOT NULL,
[seg_detail_outletid] [int] NULL,
[seg_detail_companyid] [int] NOT NULL,
[Seg_Detail_UpdateTime] [datetime] NOT NULL,
[Seg_Detail_UserID] [int] NULL,
[seg_detail_dish_cp] [decimal] (18,3) NULL,
[seg_detail_dish_sp_fig] [decimal] (18,3) NULL,
[seg_detail_dish_sp_per] [decimal] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DishSegmentHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[DishSegmentHeader](
[seg_header_id] [int] NOT NULL,
[seg_header_name] [varchar] (50) NOT NULL,
[seg_header_companyID] [int] NOT NULL,
[seg_header_remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EmailList]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[EmailList](
[CustomerId] [int] NOT NULL,
[DepartmentID] [int] NULL,
[DepartmentName] [varchar] (50) NULL,
[InvocieId] [nchar] (10) NOT NULL,
[InvAmount] [numeric] (18,2) NOT NULL,
[SettledAmt] [numeric] (18,2) NOT NULL,
[BalanceAmt] [numeric] (18,2) NOT NULL,
[Age] [int] NOT NULL,
[Due] [char] (10) NOT NULL,
[Processed] [bit] NULL,
[CurrencyName] [nvarchar] (20) NULL,
[Symbol] [nvarchar] (20) NULL,
[Invoicedate] [datetime] NULL,
[Invoiceno] [varchar] (50) NULL,
[Referenceno] [varchar] (100) NULL,
[remarks] [varchar] (1000) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EmailRecipients]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[EmailRecipients](
[MailType] [varchar] (50) NULL,
[Recipients] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EmailSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[EmailSettings](
[SMTPHost] [varchar] (50) NULL,
[SMTPPort] [int] NULL,
[DisplayName] [varchar] (50) NULL,
[EMail] [varchar] (50) NULL,
[Password] [varchar] (50) NULL,
[TimerInterval] [varchar] (50) NULL,
[ForecastingDays] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ExchangeRate]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ExchangeRate](
[ExchangeID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[ExchangeDate] [smalldatetime] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ExchangeRateDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ExchangeRateDetail](
[ExchangeID] [int] NOT NULL,
[CurrencyID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[BuyingRate] [numeric] (18,2) NULL,
[SellingRate] [numeric] (18,2) NULL,
[AverageRate] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ExchangeRateHistoryDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ExchangeRateHistoryDetails](
[ExchangeID] [int] NOT NULL,
[CurrencyID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[BuyingRate] [numeric] (18,2) NOT NULL,
[SellingRate] [numeric] (18,2) NOT NULL,
[AverageRate] [numeric] (18,2) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ExchangeRateHistoryHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ExchangeRateHistoryHeader](
[ExchangeID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[ExchangeDate] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ExpiryEmailSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ExpiryEmailSettings](
[DSN] [varchar] (50) NULL,
[DbName] [varchar] (50) NULL,
[OdbcUser] [varchar] (50) NULL,
[OdbcPassword] [varchar] (50) NULL,
[SMTPhost] [varchar] (50) NULL,
[Port] [int] NULL,
[UserName] [varchar] (50) NULL,
[DisplayName] [varchar] (50) NULL,
[EmailID] [varchar] (50) NULL,
[Password] [varchar] (50) NULL,
[GracePeriod] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fb_Alternate]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[fb_Alternate](
[fb_kotID] [int] NOT NULL,
[fb_dishID] [int] NOT NULL,
[fb_ItemID] [int] NOT NULL,
[fb_row] [char] (10) NOT NULL,
[KotOrder] [decimal] (18,3) NOT NULL,
[Fb_outletid] [int] NOT NULL,
[fb_costprice] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_botdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_botdetails](
[Fb_bd_Companyid] [int] NOT NULL,
[fb_bd_Outletid] [int] NOT NULL,
[Fb_bd_botid] [int] NOT NULL,
[Fb_bd_Botdetailid] [int] NOT NULL,
[fb_bd_dishid] [int] NOT NULL,
[Fb_bd_botquantity] [decimal] (18,2) NULL,
[Fb_bd_rate] [decimal] (18,2) NULL,
[Fb_bd_Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_botheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_botheader](
[Fb_bh_Companyid] [int] NOT NULL,
[Fb_bh_outletid] [int] NOT NULL,
[Fb_bh_botid] [int] NOT NULL,
[Fb_bh_botno] [varchar] (50) NULL,
[Fb_bh_botdatetime] [datetime] NULL,
[Fb_bh_registrationid] [int] NULL,
[Fb_bh_Employeeid] [int] NULL,
[Fb_bh_Tableid] [int] NULL,
[Fb_bh_ordertakenid] [int] NULL,
[Fb_bh_Remarks] [varchar] (250) NULL,
[Fb_bh_cancelled] [bit] NOT NULL,
[Fb_bh_CancelledRemarks] [varchar] (250) NULL,
[Fb_bh_Complimentaryid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_DishAdds]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_DishAdds](
[Fb_da_Companyid] [int] NOT NULL,
[Fb_da_dishid] [int] NOT NULL,
[Fb_da_dishaddsid] [int] NOT NULL,
[Fb_da_itemid] [int] NOT NULL,
[fb_da_quantity] [decimal] (20,5) NULL,
[fb_da_packingtypeid] [int] NULL,
[fb_da_packingqty] [decimal] (18,5) NULL,
[fb_da_dishaddschoiceid] [varchar] (250) NULL,
[Fb_da_Futureint] [int] NULL,
[Fb_da_Futurevarchar] [varchar] (250) NULL,
[Fb_da_Futurebit] [bit] NULL,
[Fb_da_YieldPer] [decimal] (9,2) NULL,
[fb_da_costprice] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FB_Dishdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[FB_Dishdetails](
[fb_dd_companyid] [int] NOT NULL,
[fb_dd_dishid] [int] NOT NULL,
[fb_dd_dishsubgroupid] [int] NOT NULL,
[fb_dd_dishcode] [varchar] (50) NULL,
[fb_dd_dishname] [varchar] (250) NULL,
[fb_dd_processingdur] [int] NULL,
[fb_dd_roombarrestmenu] [varchar] (5) NULL,
[fb_dd_remarks] [varchar] (250) NULL,
[fb_dd_yield] [bit] NOT NULL,
[fb_dd_Futureint] [int] NULL,
[fb_dd_Futurevarchar] [varchar] (250) NULL,
[fb_dd_Futurebit] [bit] NULL,
[fb_dd_preparations] [varchar] (5000) NULL,
[EditDate] [datetime] NULL,
[UserID] [int] NULL,
[fb_dd_imagepath] [varchar] (500) NULL,
[fb_dd_dishcp] [decimal] (18,3) NULL,
[Fb_dd_TaxCategoryId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FB_Dishgroup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[FB_Dishgroup](
[FB_dg_companyid] [int] NOT NULL,
[FB_dg_Dishgroupid] [int] NOT NULL,
[FB_dg_Dishgroupcode] [varchar] (50) NULL,
[FB_dg_Dishgroupname] [varchar] (250) NULL,
[fb_dg_foodbeverage] [bit] NULL,
[FB_dg_futureint] [int] NULL,
[FB_dg_futurevarchar] [varchar] (250) NULL,
[FB_dg_Futurebit] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FB_Dishsubgroup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[FB_Dishsubgroup](
[Fb_Ds_CompanyID] [int] NOT NULL,
[Fb_Ds_DishSubGroupID] [int] NOT NULL,
[Fb_Ds_DishGroupID] [int] NOT NULL,
[Fb_Ds_DishSubGroupcode] [varchar] (50) NULL,
[Fb_Ds_DishSubGroupName] [varchar] (250) NULL,
[Fb_Ds_FutureInt] [int] NULL,
[Fb_Ds_FutureVarChar] [varchar] (250) NULL,
[Fb_Ds_FutureBit] [bit] NOT NULL,
[Fb_Ds_ProfitPer] [decimal] (9,2) NULL,
[fb_ds_printerpath] [varchar] (250) NULL,
[fb_ds_imagepath] [varchar] (500) NULL,
[Fb_Ds_TaxCategoryId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FB_dishsubgroupshopdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[FB_dishsubgroupshopdetails](
[fb_Ds_companyid] [int] NOT NULL,
[Fb_Ds_Outletid] [int] NOT NULL,
[Fb_Ds_Subgroupid] [int] NOT NULL,
[Fb_Ds_Futureint] [int] NULL,
[Fb_Ds_Futurevarchar] [varchar] (250) NULL,
[Fb_Ds_Futurebit] [bit] NULL,
[fb_Ds_CntrTaxper] [decimal] (18,0) NULL,
[fb_Ds_StateTaxper] [decimal] (18,0) NULL,
[Fb_Ds_Printerpath] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_kotdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_kotdetails](
[fb_kd_Companyid] [int] NOT NULL,
[fb_kd_Outletid] [int] NOT NULL,
[fb_kd_kotid] [int] NOT NULL,
[fb_kd_kotdetailid] [int] NOT NULL,
[fb_kd_dishid] [int] NOT NULL,
[fb_kd_kotquantity] [decimal] (18,2) NULL,
[fb_kd_rate] [decimal] (18,2) NULL,
[fb_kd_processed] [bit] NOT NULL,
[fb_kd_remarks] [varchar] (250) NULL,
[fb_kd_Setteled] [int] NULL,
[fb_kd_AddedItemtype] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_kotheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_kotheader](
[Fb_kh_Companyid] [int] NOT NULL,
[Fb_kh_outletid] [int] NOT NULL,
[Fb_kh_kotid] [int] NOT NULL,
[Fb_kh_kotno] [varchar] (50) NULL,
[Fb_kh_kotdatetime] [datetime] NULL,
[Fb_kh_expecteddatetime] [datetime] NULL,
[Fb_kh_registrationid] [int] NULL,
[Fb_kh_Employeeid] [int] NULL,
[Fb_kh_Tableid] [int] NULL,
[Fb_kh_ordertakenid] [int] NULL,
[Fb_kh_Remarks] [varchar] (250) NULL,
[Fb_kh_noofperson] [int] NULL,
[Fb_kh_cancelled] [bit] NOT NULL,
[Fb_Kh_Cancelledremarks] [varchar] (250) NULL,
[fb_kh_mealplanid] [int] NULL,
[Fb_kh_Complimentaryid] [int] NULL,
[fb_kh_userid] [int] NULL,
[fb_kh_currencyid] [int] NOT NULL,
[fb_exchangerates] [varchar] (250) NOT NULL,
[fb_depexrate] [numeric] (18,8) NOT NULL,
[fb_ExchangeRate] [numeric] (28,8) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fb_kotHistory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[fb_kotHistory](
[fb_kd_Companyid] [int] NOT NULL,
[fb_kd_Outletid] [int] NOT NULL,
[fb_kd_kotid] [int] NOT NULL,
[fb_kd_kotdetailid] [int] NOT NULL,
[fb_kd_dishid] [int] NOT NULL,
[fb_kd_kotquantity] [decimal] (18,2) NULL,
[fb_kd_rate] [decimal] (18,2) NULL,
[fb_kd_processed] [bit] NOT NULL,
[fb_kd_remarks] [varchar] (250) NULL,
[fb_kd_Setteled] [int] NULL,
[fb_kd_AddedItemtype] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_processdetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_processdetail](
[fb_pd_companyid] [int] NOT NULL,
[fb_pd_outletid] [int] NOT NULL,
[fb_pd_processid] [int] NOT NULL,
[fb_pd_processdetailid] [int] NOT NULL,
[fb_pd_kotid] [int] NULL,
[fb_pd_botid] [int] NULL,
[fb_pd_dishid] [int] NOT NULL,
[fb_pd_reusedqty] [decimal] (18,2) NULL,
[fb_pd_Rate] [decimal] (18,2) NULL,
[fb_pd_cost] [decimal] (18,2) NULL,
[fb_pd_Actualrate] [decimal] (18,2) NULL,
[fb_pd_discountper] [decimal] (18,2) NULL,
[fb_pd_centraltaxper] [decimal] (18,2) NULL,
[fb_pd_statetaxper] [decimal] (18,2) NULL,
[fb_pd_usedqty] [decimal] (18,2) NULL,
[fd_pd_discountid] [int] NULL,
[fb_pd_AddedItemtype] [int] NULL,
[fb_pd_DishTaxPercentage] [numeric] (18,2) NULL,
[fb_pd_DishTaxAmount] [numeric] (18,2) NULL,
[fb_pd_DishTaxCategoryId] [int] NULL,
[fb_pd_packingtypeid] [int] NULL,
[fb_pd_dishidofextra] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_processrecipedetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_processrecipedetail](
[fb_pr_companyid] [int] NOT NULL,
[fb_pr_outletid] [int] NOT NULL,
[fb_pr_Processid] [int] NOT NULL,
[fb_pr_processdetailid] [int] NOT NULL,
[fb_pr_processrecdetailid] [int] NOT NULL,
[fb_pr_recipeitemid] [int] NOT NULL,
[fb_pr_quantity] [decimal] (18,2) NULL,
[fb_pr_yieldqtyper] [decimal] (18,0) NULL,
[fb_pr_recipedishid] [int] NULL,
[fb_pr_recipedishqty] [decimal] (9,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_recipedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_recipedetails](
[Fb_rd_Companyid] [int] NOT NULL,
[Fb_rd_dishid] [int] NOT NULL,
[Fb_rd_recipedetailid] [int] NOT NULL,
[Fb_rd_itemid] [int] NOT NULL,
[fb_rd_quantity] [decimal] (20,5) NULL,
[fb_rd_packingtypeid] [int] NULL,
[fb_rd_packingqty] [decimal] (18,5) NULL,
[fb_rd_recipechoiceid] [varchar] (250) NULL,
[Fb_rd_Futureint] [int] NULL,
[Fb_rd_Futurevarchar] [varchar] (250) NULL,
[Fb_rd_Futurebit] [bit] NULL,
[Fb_rd_YieldPer] [decimal] (9,2) NULL,
[Fb_rd_costprice] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_resttable]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_resttable](
[Fb_rt_companyid] [int] NOT NULL,
[Fb_rt_outletid] [int] NOT NULL,
[fb_rt_tablemasterid] [int] NOT NULL,
[Fb_rt_tableid] [int] NOT NULL,
[Fb_rt_tablecode] [varchar] (50) NULL,
[Fb_rt_tablename] [varchar] (250) NULL,
[Fb_rt_Futureint] [int] NULL,
[Fb_rt_Futurevarchar] [varchar] (250) NULL,
[Fb_rt_Futurebit] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fb_resttablemaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[fb_resttablemaster](
[fb_rm_companyid] [int] NOT NULL,
[fb_rm_outletid] [int] NOT NULL,
[fb_rm_tablemasterid] [int] NOT NULL,
[fb_rm_tablemastercode] [varchar] (50) NULL,
[fb_rm_tablemastername] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fb_Shopdishdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Fb_Shopdishdetails](
[Fb_Sd_Companyid] [int] NOT NULL,
[Fb_Sd_Outletid] [int] NOT NULL,
[Fb_Sd_Dishid] [int] NOT NULL,
[Fb_Sd_Dishamt] [decimal] (18,2) NULL,
[Fb_Sd_Starttime] [datetime] NULL,
[Fb_Sd_Endtime] [datetime] NULL,
[fb_sd_processingdur] [int] NULL,
[Fb_Sd_Futureint] [int] NULL,
[Fb_Sd_Futurevarchar] [varchar] (250) NULL,
[Fb_Sd_Futurebit] [bit] NULL,
[fb_sd_dishamtdisc] [decimal] (18,2) NULL,
[fb_sd_dishamtdlyflght] [decimal] (18,2) NULL,
[fb_sd_dishamtstaff] [decimal] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fb_Tableoccupancy]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[fb_Tableoccupancy](
[Fb_to_companyid] [int] NOT NULL,
[fb_to_Outletid] [int] NOT NULL,
[fb_to_Kotbotid] [int] NOT NULL,
[fb_to_tableid] [int] NOT NULL,
[fb_to_coverid] [int] NOT NULL,
[fb_to_billcoverid] [int] NULL,
[fb_to_billroomid] [int] NULL,
[fb_to_billempid] [int] NULL,
[fb_to_kotbotdatetime] [datetime] NULL,
[fb_to_billdatetime] [datetime] NULL,
[fb_to_kottrue] [bit] NOT NULL,
[fb_to_cashreceived] [bit] NOT NULL,
[fb_to_cashdatetime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FixedAsset]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[FixedAsset](
[FixedAssetID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[FixedAssetDate] [datetime] NULL,
[PurchaseDate] [datetime] NULL,
[InsPolicyNo] [varchar] (50) NULL,
[Location] [varchar] (50) NULL,
[VendorID] [int] NULL,
[CostPrice] [numeric] (18,2) NULL,
[Remarks] [varchar] (1000) NULL,
[DepartmentID] [int] NULL,
[Insured] [char] (1) NULL,
[InsuredAmount] [numeric] (18,2) NULL,
[Premium] [numeric] (18,2) NULL,
[DepreciatedValue] [numeric] (18,2) NULL,
[DepType] [char] (1) NULL,
[DepreciationAccId] [int] NULL,
[FixedAssetAccID] [int] NULL,
[depreciationperiod] [char] (1) NULL,
[depreciationpercent] [numeric] (5,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[initialDepreciatedValue] [numeric] (18,2) NULL,
[billsrefid] [int] NULL,
[assetcode] [varchar] (50) NULL,
[assetname] [varchar] (100) NULL,
[writeoffrefid] [int] NULL,
[godownrefid] [int] NULL,
[conversiondiffaccid] [int] NULL,
[conversiondiff] [numeric] (18,2) NULL,
[disposed] [bit] NULL,
[FAGroup] [varchar] (100) NULL,
[Quantity] [int] NULL,
[depcalcstartdate] [datetime] NULL,
[FAType] [varchar] (10) NULL,
[exrate] [numeric] (18,8) NULL,
[depexrate] [numeric] (18,8) NULL,
[exchangerates] [varchar] (250) NULL,
[actrefamount] [numeric] (18,2) NULL,
[posted] [bit] NULL,
[financialid] [int] NULL,
[FixedAssetNo] [varchar] (50) NULL,
[depriciationexpaccid] [int] NULL,
[Cancelled] [bit] NULL,
[CurrentDepartmentId] [int] NULL,
[lasttoaccid] [int] NULL,
[ExcludeFirstPeriodDep] [bit] NULL,
[InsuranceRenewalDate] [datetime] NULL,
[CurrDeprecExpAccID] [int] NULL,
[CurrAccDepExpAccID] [int] NULL,
[SubDepartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FlightOperatorMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[FlightOperatorMaster](
[companyid] [int] NOT NULL,
[FlghtOpid] [int] NOT NULL,
[FlghtOpName] [varchar] (100) NOT NULL,
[FlghtSegID] [int] NOT NULL,
[Createddate] [datetime] NOT NULL,
[Remarks] [varchar] (250) NULL,
[Active] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Flights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Flights](
[companyid] [int] NOT NULL,
[FlightID] [int] NOT NULL,
[FlightOpid] [int] NOT NULL,
[FlightNo] [varchar] (50) NOT NULL,
[FlightDepDay] [int] NULL,
[FlightDepTime] [datetime] NULL,
[Remarks] [varchar] (250) NULL,
[Active] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Forex]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Forex](
[companyid] [int] NOT NULL,
[forexid] [int] NOT NULL,
[forexno] [varchar] (50) NULL,
[forexdate] [datetime] NULL,
[type] [char] (1) NULL,
[salesorpurchaseaccid] [int] NULL,
[otheraccid] [int] NULL,
[forexgainlossaccid] [int] NULL,
[salesorpurchaseamt] [numeric] (18,2) NULL,
[otheramount] [numeric] (18,2) NULL,
[forexgainlossamt] [numeric] (18,2) NULL,
[chequeno] [varchar] (50) NULL,
[paymentmode] [varchar] (50) NULL,
[customerid] [int] NULL,
[vendorid] [int] NULL,
[personname] [varchar] (250) NULL,
[passportno] [varchar] (50) NULL,
[nationalityid] [int] NULL,
[remarks] [varchar] (250) NULL,
[posted] [bit] NOT NULL,
[cancelled] [bit] NOT NULL,
[financialid] [int] NULL,
[departmentid] [int] NULL,
[cancelledremarks] [varchar] (250) NULL,
[exchangerate] [numeric] (18,8) NULL,
[depexrate] [numeric] (18,8) NULL,
[exchangerates] [varchar] (250) NULL,
[subdepartmentid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GovernLoan]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[GovernLoan](
[Trloanid] [numeric] (18,0) NOT NULL,
[companyid] [int] NOT NULL,
[departmentid] [int] NOT NULL,
[TrNo] [varchar] (50) NULL,
[Trdate] [datetime] NULL,
[LoanName] [varchar] (250) NULL,
[customerid] [numeric] (18,0) NULL,
[vendorid] [numeric] (18,0) NULL,
[Bankid] [numeric] (18,0) NULL,
[RangeFrom] [datetime] NULL,
[RangeTo] [datetime] NULL,
[PeriodicCharge] [numeric] (18,0) NULL,
[LoanAmount] [numeric] (18,0) NULL,
[AlertDays] [int] NULL,
[NextPaymentDate] [datetime] NULL,
[TrRemarks] [varchar] (250) NULL,
[TrCancelled] [bit] NULL,
[TrCancelledRemarks] [varchar] (250) NULL,
[trcusvendesc] [varchar] (250) NULL,
[subdepartmentid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[HPpostDatedCheqReg]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[HPpostDatedCheqReg](
[RegID] [int] NOT NULL,
[TranId] [int] NULL,
[Date] [datetime] NULL,
[BankId] [int] NULL,
[CheqDate] [datetime] NULL,
[CheqNo] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[hqInhousePurchaseBillingDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[hqInhousePurchaseBillingDetails](
[ipbdBillId] [int] NULL,
[ipbdBillDetailId] [int] NULL,
[ipbdInhousePurchaseId] [int] NULL,
[ipbdBilledAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[hqSalesCommisiondetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[hqSalesCommisiondetail](
[scdCommisionID] [int] NULL,
[scdDetailID] [int] NULL,
[scdInterfaceID] [int] NULL,
[scdShopID] [int] NULL,
[scdtransactionID] [int] NULL,
[scdCommisionAmount] [numeric] (18,2) NULL,
[scdcompanyid] [int] NULL,
[scdEligiblePer] [numeric] (5,2) NULL,
[scdCommissionPer] [numeric] (5,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[hqSalesCommisionHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[hqSalesCommisionHeader](
[schCommisionid] [int] NOT NULL,
[schSalesCommisionNo] [varchar] (50) NULL,
[schSalesCommisionDate] [datetime] NULL,
[schApprovedBy] [varchar] (50) NULL,
[schCancelled] [bit] NULL,
[schCancelledRemarks] [varchar] (250) NULL,
[schcompanyid] [int] NOT NULL,
[schdepartmentid] [int] NULL,
[schsalespersonid] [int] NULL,
[schfinancialid] [int] NULL,
[schFromDate] [datetime] NULL,
[schToDate] [datetime] NULL,
[schAfterSales] [bit] NULL,
[schTargetAmount] [numeric] (18,0) NULL,
[schTargetType] [char] (1) NULL,
[schRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[HQSalesPromotionDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[HQSalesPromotionDetail](
[spdCompanyID] [int] NOT NULL,
[spdpromotionID] [int] NOT NULL,
[spdDetailID] [int] NOT NULL,
[spdCustomerID] [int] NULL,
[spdSalesAmt] [numeric] (18,2) NULL,
[spdSalesPer] [numeric] (5,2) NULL,
[spdProfitAmt] [numeric] (18,2) NULL,
[spdProfitPer] [numeric] (5,2) NULL,
[spdPromotionAmt] [numeric] (18,2) NULL,
[spdToBePaid] [bit] NOT NULL,
[spdRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[HQSalesPromotionHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[HQSalesPromotionHeader](
[sphCompanyID] [int] NOT NULL,
[sphPromotionID] [int] NOT NULL,
[sphPromotionNo] [varchar] (250) NULL,
[sphPromotionDate] [datetime] NULL,
[sphFromDate] [datetime] NULL,
[sphToDate] [datetime] NULL,
[sphApprovedBy] [varchar] (100) NULL,
[sphDepartmentID] [int] NULL,
[sphTotSalesAmt] [numeric] (18,2) NULL,
[sphTotprofitAmt] [numeric] (18,2) NULL,
[sphRemarks] [varchar] (250) NULL,
[sphCancelled] [bit] NULL,
[sphCancelledRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[InhouseConsumptionReqDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[InhouseConsumptionReqDetail](
[StoreRequestId] [int] NOT NULL,
[Slno] [int] NOT NULL,
[ItemId] [int] NOT NULL,
[Qty] [numeric] (18,2) NOT NULL,
[PackingTypeId] [int] NOT NULL,
[Pqty] [numeric] (18,2) NOT NULL,
[FinancialYearId] [int] NOT NULL,
[CompanyId] [int] NOT NULL,
[ApprQty] [numeric] (18,0) NULL,
[ApprPackingTypeId] [int] NULL,
[ApprPqty] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[InhouseConsumptionReqHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[InhouseConsumptionReqHeader](
[StoreRequestId] [int] NOT NULL,
[StoreRequestNo] [varchar] (50) NOT NULL,
[RequestDate] [datetime] NOT NULL,
[DepartmentId] [int] NOT NULL,
[ShopId] [int] NULL,
[Deleted] [bit] NOT NULL,
[DeletedReason] [nvarchar] (250) NULL,
[FinancialYearId] [int] NOT NULL,
[CompanyId] [int] NOT NULL,
[AppovalStatus] [char] (2) NOT NULL,
[RejectionReason] [nvarchar] (500) NULL,
[Remarks] [nvarchar] (500) NULL,
[ReqUserId] [int] NOT NULL,
[DelUserId] [int] NULL,
[LastModUserId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[InterDivisionBillsDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[InterDivisionBillsDetails](
[BillsID] [int] NOT NULL,
[BillsDetailID] [int] NOT NULL,
[AccountID] [int] NOT NULL,
[DepartmentId] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[Amount] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[InterDivisionBillsHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[InterDivisionBillsHeader](
[BillsID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[BillsNo] [varchar] (50) NOT NULL,
[BillDate] [datetime] NOT NULL,
[VendorID] [int] NULL,
[BillAmount] [numeric] (18,2) NULL,
[ReferenceNo] [varchar] (250) NULL,
[DuePeriod] [smallint] NULL,
[Discount] [numeric] (18,2) NULL,
[DiscountAccountID] [int] NULL,
[FinancialID] [int] NULL,
[CashPurchase] [bit] NOT NULL,
[BankCashAccID] [int] NULL,
[ChequeNo] [varchar] (50) NULL,
[ExchangeNature] [varchar] (5) NULL,
[Remarks] [varchar] (250) NULL,
[departmentid] [int] NULL,
[Posted] [bit] NOT NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (250) NULL,
[exchangerate] [numeric] (18,8) NULL,
[vreferenceno] [varchar] (250) NULL,
[updatetime] [datetime] NOT NULL,
[depexrate] [numeric] (18,8) NULL,
[exchangerates] [varchar] (250) NULL,
[RefJournalID] [int] NULL,
[subdepartmentid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[InterDivisionJournalTransDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[InterDivisionJournalTransDetails](
[JournalTransID] [int] NOT NULL,
[JournalTransDetailID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[AccountID] [int] NOT NULL,
[JournalTransCredit] [bit] NOT NULL,
[departmentid] [int] NULL,
[Amount] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL,
[depexrates] [numeric] (18,8) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[InterDivisionJournalTransHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[InterDivisionJournalTransHeader](
[JournalTransID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[JournalNo] [varchar] (50) NULL,
[JournalTransDate] [smalldatetime] NOT NULL,
[Remarks] [varchar] (100) NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (100) NULL,
[Posted] [bit] NOT NULL,
[FinancialID] [int] NULL,
[parentjournalid] [int] NULL,
[childjournalid] [int] NULL,
[updatetime] [datetime] NOT NULL,
[exchangerate] [numeric] (18,8) NULL,
[exchangerates] [varchar] (250) NULL,
[Type] [char] (2) NULL,
[Confirm] [bit] NULL,
[TypeSeriallNO] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[IODocuments]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[IODocuments](
[DocID] [int] NOT NULL,
[DepID] [int] NOT NULL,
[DocDate] [datetime] NULL,
[DocNo] [varchar] (50) NULL,
[ReferenceNo] [varchar] (50) NULL,
[External] [bit] NULL,
[Sender] [varchar] (250) NULL,
[AddressedTo] [varchar] (250) NULL,
[AddressedDate] [datetime] NULL,
[Receiver] [varchar] (100) NULL,
[Description] [varchar] (250) NULL,
[Remark] [varchar] (250) NULL,
[Physicalfilename] [varchar] (250) NULL,
[Doctype] [char] (1) NOT NULL,
[Cancelled] [bit] NULL,
[CancelledRemarks] [varchar] (100) NULL,
[Type] [varchar] (100) NULL,
[PhysicalDepid] [int] NULL,
[alertdate] [datetime] NULL,
[alertnoofdays] [int] NULL,
[alertremarks] [varchar] (250) NULL,
[DocTypeID] [int] NULL,
[physicalloc] [varchar] (200) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ItemPriceHistory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ItemPriceHistory](
[ItemPriceId] [int] IDENTITY(1,1) NOT NULL,
[ItemId] [int] NOT NULL,
[PackId] [int] NOT NULL,
[ShopId] [int] NULL,
[SegmentId] [int] NULL,
[CurrencyId] [int] NULL,
[SellingPrice] [numeric] (18,2) NULL,
[DiscountPrice] [numeric] (18,2) NULL,
[WholesalePrice] [numeric] (18,2) NULL,
[CreditSP] [numeric] (18,2) NULL,
[CreditDP] [numeric] (18,2) NULL,
[CreditWP] [numeric] (18,2) NULL,
[FixDate] [datetime] NULL,
[UpdateTime] [datetime] NULL,
[UserId] [int] NULL,
[CompanyId] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[JournalDetailBackup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[JournalDetailBackup](
[JournalID] [int] NOT NULL,
[JournalDetailID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[FinancialId] [int] NOT NULL,
[JournalCredit] [bit] NOT NULL,
[AccountID] [int] NULL,
[CustomerID] [int] NULL,
[VendorID] [int] NULL,
[Amount] [numeric] (18,2) NULL,
[ActualAmount] [numeric] (18,2) NULL,
[DepartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[JournalHeaderBackup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[JournalHeaderBackup](
[JournalID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[FinancialID] [int] NOT NULL,
[JournalDate] [smalldatetime] NOT NULL,
[Remarks] [varchar] (250) NULL,
[ReferenceNo] [varchar] (50) NULL,
[Type] [varchar] (5) NULL,
[CurrencyId] [int] NULL,
[chequedate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[JournalTransDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[JournalTransDetails](
[JournalTransID] [int] NOT NULL,
[JournalTransDetailID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[AccountID] [int] NOT NULL,
[JournalTransCredit] [bit] NOT NULL,
[Amount] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL,
[PayrollLinktransId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[JournalTransHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[JournalTransHeader](
[JournalTransID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[JournalNo] [varchar] (50) NULL,
[JournalTransDate] [smalldatetime] NOT NULL,
[Remarks] [varchar] (100) NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (100) NULL,
[Posted] [bit] NOT NULL,
[FinancialID] [int] NULL,
[parentjournalid] [int] NULL,
[childjournalid] [int] NULL,
[receiptid] [int] NULL,
[paymentid] [int] NULL,
[departmentid] [int] NULL,
[updatetime] [datetime] NOT NULL,
[exchangerate] [numeric] (18,8) NULL,
[exchangerates] [varchar] (250) NULL,
[depexrates] [numeric] (18,8) NULL,
[InvoiceID] [int] NULL,
[BillID] [int] NULL,
[subdepartmentid] [int] NULL,
[Confirmed] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LeadTimeDivision]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LeadTimeDivision](
[Ldivisionid] [int] NOT NULL,
[LdivisionName] [varchar] (50) NOT NULL,
[LDivisionCompanyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LeadTimeStage]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LeadTimeStage](
[Lstageid] [int] NOT NULL,
[LstageName] [varchar] (50) NOT NULL,
[Lstagedivisionid] [int] NOT NULL,
[LStageCompanyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LMSCardRegistration]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LMSCardRegistration](
[CompanyID] [int] NULL,
[CardRegistrationID] [int] NULL,
[CardNumber] [varchar] (50) NULL,
[RegistrationDate] [datetime] NULL,
[CustmerId] [int] NULL,
[UserName] [varchar] (50) NULL,
[TypeID] [int] NULL,
[ExpairyDate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[lmsPoint]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[lmsPoint](
[CompanyID] [int] NOT NULL,
[PointsID] [int] NOT NULL,
[PointDesc] [varchar] (50) NULL,
[PointCategory] [int] NULL,
[MinimumPoints] [int] NULL,
[CurrencyID] [int] NULL,
[PointValue] [int] NULL,
[UserName] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LMSReward]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LMSReward](
[CompanyID] [int] NULL,
[RewardId] [int] NULL,
[CardId] [int] NULL,
[Dr] [int] NULL,
[Type] [varchar] (50) NULL,
[Points] [int] NULL,
[PointDate] [datetime] NULL,
[Description] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOaCostingAccountDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOaCostingAccountDetails](
[cadCostingID] [int] NOT NULL,
[cadAccountID] [int] NOT NULL,
[cadDetailID] [int] NOT NULL,
[cadDescription] [varchar] (250) NULL,
[cadAmount] [numeric] (18,2) NOT NULL,
[cadBankCashAccID] [int] NULL,
[cadChequeNo] [varchar] (50) NULL,
[cadChequeDate] [datetime] NULL,
[cadCompanyID] [int] NULL,
[cadDistribution] [varchar] (4000) NULL,
[cadOtherCharges] [bit] NOT NULL,
[cadCostingType] [varchar] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOaCostingDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOaCostingDetail](
[cdCostingID] [int] NOT NULL,
[cdItemID] [int] NOT NULL,
[cdCostingValue] [numeric] (18,2) NOT NULL,
[cdCostingPrice] [numeric] (28,16) NULL,
[cdItemQuantity] [numeric] (18,3) NULL,
[cdBillUnitPrice] [numeric] (28,16) NULL,
[cdCustomsUnitPrice] [numeric] (18,8) NULL,
[cdCustomDutyAmount] [numeric] (18,2) NULL,
[cdOCPerItem] [numeric] (28,22) NULL,
[cdOldItemCostPrice] [numeric] (18,8) NULL,
[cdNewItemCostPrice] [numeric] (18,8) NULL,
[cdcustcategoryperc] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOaCostingHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOaCostingHeader](
[chCostingID] [int] NOT NULL,
[chCostingNo] [varchar] (50) NOT NULL,
[chCostingDate] [datetime] NULL,
[chBillID] [int] NOT NULL,
[chRemarks] [varchar] (250) NULL,
[chCostingDone] [bit] NOT NULL,
[chCostingDoneBy] [varchar] (100) NULL,
[chInventoryaccid] [int] NULL,
[chGoodsinTransitaccid] [int] NULL,
[chPosted] [bit] NOT NULL,
[chCancelled] [bit] NOT NULL,
[chCancelledRemarks] [varchar] (250) NULL,
[chRecAddUser] [varchar] (50) NULL,
[chRecModifyUser] [varchar] (50) NULL,
[chDepartmentID] [int] NULL,
[chCompanyID] [int] NULL,
[updatetime] [datetime] NOT NULL,
[chSubDepartmentID] [int] NULL,
[chtime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LoaEoqProcessDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LoaEoqProcessDetail](
[EoqDProcessid] [int] NULL,
[EoqDItemCategoryId] [int] NULL,
[EodItemId] [int] NULL,
[EoqdFixedCost] [numeric] (18,4) NULL,
[EoqdReorderQty] [numeric] (18,4) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LoaEoqProcessHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LoaEoqProcessHeader](
[EoqProcessid] [int] NULL,
[EoqProcessDate] [datetime] NULL,
[EoqProcessNo] [varchar] (25) NULL,
[EoqProcessedBy] [varchar] (100) NULL,
[EoqSalesFDate] [datetime] NULL,
[EoqSalesTDate] [datetime] NULL,
[EoqPurchaseFDate] [datetime] NULL,
[EoqPurchaseTDate] [datetime] NULL,
[EoqProcessRemarks] [varchar] (250) NULL,
[EoqProcessDepartmentId] [int] NULL,
[EoqProcessCompanyid] [int] NULL,
[EoqCategoryid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loaFixedCostDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loaFixedCostDetail](
[dFixedCostId] [int] NOT NULL,
[dFixedCostDetailId] [int] NOT NULL,
[dFixedCostItemId] [int] NULL,
[dFixedCostCategoryId] [int] NULL,
[dFixedCostValue] [numeric] (18,4) NULL,
[dfixedcompanyid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loaFixedCostHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loaFixedCostHeader](
[FixedCostId] [int] NOT NULL,
[FixedCostNo] [varchar] (25) NULL,
[FixedCostDate] [datetime] NULL,
[FixedCostEnteredby] [varchar] (100) NULL,
[FixedCostRemarks] [varchar] (250) NULL,
[FixedCostDepartmentid] [int] NOT NULL,
[FixedCostUpdate] [datetime] NULL,
[fixedcostCompanyid] [int] NULL,
[FixedCostTime] [datetime] NULL,
[FixedCostCreated] [varchar] (250) NULL,
[FixedCostModified] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loaInhousePurchaseDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loaInhousePurchaseDetail](
[ipdid] [int] NOT NULL,
[ipddetailId] [int] NOT NULL,
[ipdItemCode] [varchar] (50) NULL,
[ipdItemDescription] [varchar] (250) NULL,
[ipdQuantity] [numeric] (18,3) NOT NULL,
[ipdRate] [numeric] (18,2) NOT NULL,
[ipdDiscountAmount] [numeric] (18,2) NOT NULL,
[ipdAmount] [numeric] (18,2) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loaInhousePurchaseHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loaInhousePurchaseHeader](
[iphCompanyId] [int] NOT NULL,
[iphDepartmentId] [int] NOT NULL,
[iphFinancialId] [int] NOT NULL,
[iphForShopId] [int] NULL,
[iphForGodownid] [int] NULL,
[iphId] [int] NOT NULL,
[iphNo] [varchar] (50) NOT NULL,
[iphDate] [datetime] NOT NULL,
[iphVendorId] [int] NULL,
[iphVendorName] [varchar] (100) NULL,
[iphVendorAddress] [varchar] (250) NULL,
[iphRemarks] [nvarchar] (250) NULL,
[iphCancelRemark] [nvarchar] (250) NULL,
[iphUpdateTime] [datetime] NULL,
[iphUserName] [varchar] (50) NULL,
[iphUpdatedUserName] [varchar] (50) NULL,
[iphCancel] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loaItemSplitCostingDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loaItemSplitCostingDetail](
[scfdid] [int] NOT NULL,
[scfddetailid] [int] NOT NULL,
[scfdItemid] [int] NULL,
[scfdQuantity] [numeric] (18,3) NULL,
[scfdCostprice] [numeric] (18,2) NULL,
[scfdFixedPrice] [numeric] (18,2) NULL,
[scfdOldItemRate] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loaItemsplitcostingHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loaItemsplitcostingHeader](
[scfhcompanyid] [int] NOT NULL,
[scfhid] [int] NOT NULL,
[scfhNo] [varchar] (50) NOT NULL,
[scfhDate] [datetime] NULL,
[scfhCostingId] [int] NULL,
[scfhGodownid] [int] NULL,
[scfhItemSplitId] [int] NULL,
[scfhShipmentid] [int] NULL,
[scfhQuantity] [numeric] (18,3) NULL,
[scfhCostedPrice] [numeric] (18,2) NULL,
[scfhRemarks] [varchar] (250) NULL,
[scfhCostFixed] [bit] NOT NULL,
[scfhCancelled] [bit] NOT NULL,
[scfhCancelledRemarks] [varchar] (250) NULL,
[scfhdepartmentid] [int] NULL,
[scfhCreated] [varchar] (250) NULL,
[scfhModified] [varchar] (250) NULL,
[scfhTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loalocalpurchasecostingdetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loalocalpurchasecostingdetail](
[lpcdcostingid] [int] NOT NULL,
[lpcddetailid] [int] NOT NULL,
[lpcditemid] [int] NULL,
[lpcdcostedprice] [numeric] (28,16) NULL,
[lpcditemqty] [numeric] (18,3) NULL,
[lpcdbillunitprice] [numeric] (28,16) NULL,
[lpcdolditemcostprice] [numeric] (18,2) NULL,
[lpcdnewitemcostprice] [numeric] (28,16) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loalocalpurchaseCostingheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loalocalpurchaseCostingheader](
[lpchCostingid] [int] NOT NULL,
[lpchCostingNo] [varchar] (50) NULL,
[lpchDate] [datetime] NULL,
[lpchBillid] [int] NULL,
[lpchShopid] [int] NULL,
[lpchOtherCharges] [numeric] (18,2) NULL,
[lpchRemarks] [varchar] (250) NULL,
[lpchCostingDone] [bit] NOT NULL,
[lpchCostingDoneBy] [varchar] (50) NULL,
[lpchInventoryaccid] [int] NULL,
[lpchGoodsinTransitaccid] [int] NULL,
[lpchDepartmentid] [int] NULL,
[lpchCompanyid] [int] NULL,
[lpchposted] [bit] NOT NULL,
[lpchCancelled] [bit] NOT NULL,
[lpchcancelledremarks] [varchar] (250) NULL,
[lpchrecadduser] [varchar] (50) NULL,
[lpchrecmodifiyuser] [varchar] (50) NULL,
[updatetime] [datetime] NULL,
[lpchSubDepartmentID] [int] NULL,
[lpchTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiArrivalDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiArrivalDetail](
[adArrivalID] [int] NOT NULL,
[adItemID] [int] NOT NULL,
[adPackingTypeID] [int] NULL,
[adDespatchedQty] [numeric] (18,3) NULL,
[adReceivedQty] [numeric] (18,3) NULL,
[adCostPrice] [numeric] (18,2) NOT NULL,
[adGodownID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiArrivalHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiArrivalHeader](
[ahArrivalID] [int] NOT NULL,
[ahArrivalNo] [varchar] (50) NOT NULL,
[ahArrivalDate] [datetime] NULL,
[ahDespatchNoteID] [int] NOT NULL,
[ahGodownID] [int] NULL,
[ahShopID] [int] NULL,
[ahShipmentID] [int] NULL,
[ahCancelled] [bit] NOT NULL,
[ahCancelledRemarks] [varchar] (250) NULL,
[ahRemarks] [varchar] (250) NULL,
[ahRecaddUser] [varchar] (250) NULL,
[ahRecmodifyUser] [varchar] (250) NULL,
[ahArrivalType] [char] (1) NULL,
[ahCostPriceFixed] [bit] NOT NULL,
[ahLocalGodownID] [int] NOT NULL,
[ahTransFinished] [bit] NOT NULL,
[ahfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[ahposted] [bit] NOT NULL,
[ahdepartmentid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ahconexrate] [numeric] (18,8) NULL,
[ahdepexrate] [numeric] (18,8) NULL,
[ahexchangerates] [varchar] (250) NULL,
[ahcreatedtime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiArrivalShipmentDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiArrivalShipmentDetail](
[asdArrivalID] [int] NOT NULL,
[asdItemID] [int] NOT NULL,
[asdShipmentID] [int] NOT NULL,
[asdDespatchedGoodQty] [numeric] (18,3) NULL,
[asdDespatchedBadQty] [numeric] (18,3) NULL,
[asdReceivedGoodQty] [numeric] (18,3) NULL,
[asdReceivedBadQty] [numeric] (18,3) NULL,
[asdcostprice] [numeric] (18,2) NULL,
[asdGodownID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiArrivaltoLocation]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiArrivaltoLocation](
[alArrivalID] [int] NOT NULL,
[alLocationID] [int] NOT NULL,
[alItemID] [int] NOT NULL,
[alQty] [numeric] (18,3) NULL,
[alGodownID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiDamageClearingDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiDamageClearingDetails](
[dcdClearingID] [int] NOT NULL,
[dcdLocationID] [int] NULL,
[dcdShipmentID] [int] NOT NULL,
[dcdItemID] [int] NOT NULL,
[dcdAvailableQty] [numeric] (18,3) NULL,
[dcdWriteOffQty] [numeric] (18,3) NULL,
[dcdGodownid] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiDamageClearingHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiDamageClearingHeader](
[dchClearingID] [int] NOT NULL,
[dchGodownid] [int] NOT NULL,
[dchClearingNO] [varchar] (50) NOT NULL,
[dchClearingDate] [datetime] NULL,
[dchClearingDoneBY] [varchar] (50) NULL,
[dchRemarks] [varchar] (250) NULL,
[dchCancelled] [bit] NOT NULL,
[dchCancelledRemarks] [varchar] (250) NULL,
[dchRecAddUser] [varchar] (50) NULL,
[dchRecModifyUser] [varchar] (50) NULL,
[dchfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[dchconexrate] [numeric] (18,8) NULL,
[dchdepexrate] [numeric] (18,8) NULL,
[dchexchangerates] [varchar] (250) NULL,
[dchcreatetime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiexpiryarrivaldetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiexpiryarrivaldetails](
[eadinterfaceid] [int] NOT NULL,
[eadgodownid] [int] NOT NULL,
[eadtransactionid] [int] NOT NULL,
[eaddetailid] [int] NOT NULL,
[eadexpirydate] [datetime] NULL,
[eaditemid] [int] NULL,
[eaditemqty] [numeric] (18,3) NULL,
[eadpackingtypeid] [int] NULL,
[eadpackingqty] [numeric] (18,2) NULL,
[eadcancel] [bit] NOT NULL,
[eadAdjustment] [bit] NOT NULL,
[eadbatchno] [varchar] (20) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiexpiryissuedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiexpiryissuedetails](
[eidinterfaceid] [int] NOT NULL,
[eidgodownid] [int] NOT NULL,
[eidtransactionid] [int] NOT NULL,
[eiddetailid] [int] NOT NULL,
[eidexpirydate] [datetime] NULL,
[eiditemid] [int] NULL,
[eiditemqty] [numeric] (18,3) NULL,
[eidpackingtypeid] [int] NULL,
[eidpackingqty] [numeric] (18,2) NULL,
[eidcancel] [bit] NOT NULL,
[eidAdjustment] [bit] NOT NULL,
[eidbatchno] [varchar] (20) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiExpiryVerificationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiExpiryVerificationDetail](
[evdId] [int] NOT NULL,
[evdShipmentId] [int] NOT NULL,
[evdItemId] [int] NOT NULL,
[evdGodownId] [int] NOT NULL,
[evdAvailStock] [numeric] (18,3) NULL,
[evdVerifiedStock] [numeric] (18,3) NULL,
[evdCostPrice] [numeric] (18,3) NULL,
[evdPrevExpiryDate] [datetime] NULL,
[evdVerifiedExpiryDate] [datetime] NOT NULL,
[evdPrevBatchNo] [varchar] (20) NOT NULL,
[evdBatchNo] [varchar] (20) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiExpiryVerificationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiExpiryVerificationHeader](
[evhId] [int] NOT NULL,
[evhGodownId] [int] NOT NULL,
[evhNo] [varchar] (50) NOT NULL,
[evhDate] [datetime] NOT NULL,
[evhRemarks] [varchar] (250) NULL,
[evhCancelled] [bit] NULL,
[evhVerifiedBy] [varchar] (100) NULL,
[evhCancelRemarks] [varchar] (50) NULL,
[evhFutureVc] [varchar] (250) NULL,
[evhPosted] [bit] NULL,
[UpdateTime] [datetime] NULL,
[evhDepartmentId] [int] NULL,
[evhConExRate] [numeric] (18,8) NULL,
[evhDepExRate] [numeric] (18,8) NULL,
[evhExchangeRates] [varchar] (250) NULL,
[evhcreatedtime] [datetime] NULL,
[evhmodifieduser] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiGodownShopArrivalToLocation]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiGodownShopArrivalToLocation](
[gsalArrivalID] [int] NOT NULL,
[gsalShipmentID] [int] NOT NULL,
[gsalItemID] [int] NOT NULL,
[gsalLocationID] [int] NOT NULL,
[gsalGoodQty] [numeric] (18,3) NULL,
[gsalBadQty] [numeric] (18,3) NULL,
[gsalGodownID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiGodownTransactionsSummary]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiGodownTransactionsSummary](
[SummaryDate] [datetime] NOT NULL,
[GodownId] [int] NOT NULL,
[ItemId] [int] NOT NULL,
[Stock] [numeric] (18,3) NULL,
[BadStock] [numeric] (18,3) NULL,
[OpeningStock] [numeric] (18,3) NULL,
[OpeningBadStock] [numeric] (18,3) NULL,
[ShipmentId] [int] NULL,
[ItemCostPrice] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LoiItemSplitDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LoiItemSplitDetail](
[isdgodownid] [int] NOT NULL,
[isdid] [int] NOT NULL,
[isditemid] [int] NOT NULL,
[isdqty] [numeric] (18,3) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LoiItemSplitHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LoiItemSplitHeader](
[ishgodownid] [int] NOT NULL,
[ishid] [int] NOT NULL,
[ishno] [varchar] (50) NULL,
[ishdate] [datetime] NULL,
[ishremarks] [varchar] (250) NULL,
[ishSplititemid] [int] NULL,
[ishsplititemqty] [numeric] (18,3) NULL,
[ishshipmentid] [int] NULL,
[ishactualqty] [numeric] (18,3) NULL,
[ishCostPriceFixed] [bit] NOT NULL,
[ishcancelled] [bit] NOT NULL,
[ishcancelledremarks] [varchar] (250) NULL,
[ishRecAddUser] [varchar] (250) NULL,
[ishRecModifyUser] [varchar] (250) NULL,
[ishExpiryDate] [datetime] NULL,
[ishfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[ishArrivalID] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ishconexrate] [numeric] (18,8) NULL,
[ishdepexrate] [numeric] (18,8) NULL,
[ishexchangerates] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiLocation]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiLocation](
[lGodownID] [int] NOT NULL,
[lLocationID] [int] NOT NULL,
[lLocationCode] [varchar] (50) NOT NULL,
[lLocationName] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[lgroupid] [int] NULL,
[lcompanyid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loilocationarrivaldetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loilocationarrivaldetails](
[ladinterfaceid] [int] NOT NULL,
[ladgodownid] [int] NOT NULL,
[ladtransid] [int] NOT NULL,
[laddetailid] [int] NOT NULL,
[ladlocationid] [int] NULL,
[laditemid] [int] NULL,
[laditemqty] [numeric] (18,3) NULL,
[ladpackingtypeid] [int] NULL,
[ladpakingqty] [numeric] (18,3) NULL,
[ladcancel] [bit] NOT NULL,
[ladadjustment] [bit] NOT NULL,
[ladconfirmed] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LoilocationGroup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LoilocationGroup](
[Lgcompanyid] [int] NOT NULL,
[Lggroupid] [int] NOT NULL,
[Lggodownid] [int] NOT NULL,
[LgGroupName] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loilocationissuedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loilocationissuedetails](
[lidinterfaceid] [int] NOT NULL,
[lidgodownid] [int] NOT NULL,
[lidtransactionid] [int] NOT NULL,
[liddetailid] [int] NOT NULL,
[lidlocationid] [int] NULL,
[liditemid] [int] NULL,
[liditemqty] [numeric] (18,3) NULL,
[lidpackingtypeid] [int] NULL,
[lidpakingqty] [numeric] (18,3) NULL,
[lidcancel] [bit] NOT NULL,
[lidadjustment] [bit] NOT NULL,
[lidconfirmed] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiLocationVerificationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiLocationVerificationDetail](
[lvdId] [int] NOT NULL,
[lvdShipmentId] [int] NOT NULL,
[lvdItemId] [int] NOT NULL,
[lvdGodownId] [int] NOT NULL,
[lvdAvailStock] [numeric] (18,3) NULL,
[lvdVerifiedStock] [numeric] (18,3) NULL,
[lvdCostPrice] [numeric] (18,3) NULL,
[lvdPrevLocationId] [int] NULL,
[lvdVerifiedLocationId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiLocationVerificationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiLocationVerificationHeader](
[lvhId] [int] NOT NULL,
[lvhGodownId] [int] NOT NULL,
[lvhNo] [varchar] (50) NULL,
[lvhDate] [datetime] NULL,
[lvhRemarks] [varchar] (250) NULL,
[lvhVerifiedBy] [varchar] (100) NULL,
[lvhCancelled] [bit] NOT NULL,
[lvhCancelRemarks] [varchar] (100) NULL,
[lvhFutureVc] [varchar] (250) NULL,
[lvhPosted] [bit] NOT NULL,
[UpdateTime] [datetime] NULL,
[lvhDepartmentId] [int] NULL,
[lvhConExRate] [numeric] (18,8) NULL,
[lvhDepExRate] [numeric] (18,8) NULL,
[lvhExchangeRates] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LoiMergeDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LoiMergeDetails](
[lgdID] [int] NOT NULL,
[lgdCompanyID] [int] NOT NULL,
[lgdGodownID] [int] NOT NULL,
[lgdItemID] [int] NULL,
[lgsdQty] [numeric] (18,3) NULL,
[lgdDetailID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LoiMergeHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LoiMergeHeader](
[lghID] [int] NOT NULL,
[lghCompanyID] [int] NOT NULL,
[lghGodownID] [int] NOT NULL,
[lghNo] [varchar] (50) NULL,
[lghDate] [datetime] NULL,
[lghRefMergeID] [int] NULL,
[lghItemID] [int] NULL,
[lghTransFinished] [bit] NULL,
[lghCancelled] [bit] NULL,
[lghUpdatetime] [datetime] NULL,
[lghQty] [numeric] (18,3) NULL,
[lghNoofRec] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiSerialArrivalDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiSerialArrivalDetails](
[sadInterfaceID] [int] NOT NULL,
[sadGodownID] [int] NOT NULL,
[sadTransactionID] [int] NOT NULL,
[sadDetailID] [int] NOT NULL,
[sadSerialNo] [nvarchar] (50) NOT NULL,
[sadItemID] [int] NOT NULL,
[sadItemQty] [numeric] (10,2) NOT NULL,
[sadPackingQty] [numeric] (10,2) NOT NULL,
[sadCancel] [int] NOT NULL,
[sadAdjustment] [int] NOT NULL,
[sadFreeQty] [int] NOT NULL,
[sadSavedByShopId] [int] NULL,
[sadPackingTypeID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiSerialIssueDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiSerialIssueDetails](
[sidInterfaceID] [int] NOT NULL,
[sidGodownID] [int] NOT NULL,
[sidTransactionID] [int] NOT NULL,
[sidDetailID] [int] NOT NULL,
[sidSerialNo] [nvarchar] (50) NOT NULL,
[sidItemID] [int] NOT NULL,
[sidItemQty] [numeric] (10,2) NOT NULL,
[sidPackingQty] [numeric] (10,2) NOT NULL,
[sidCancel] [int] NOT NULL,
[sidAdjustment] [int] NOT NULL,
[sidPackingTypeID] [int] NOT NULL,
[sidFreeQty] [int] NOT NULL,
[sidSavedByShopId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiSerialNoVerificationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiSerialNoVerificationDetail](
[svdGodownID] [int] NULL,
[svdID] [int] NOT NULL,
[svdShipMentID] [int] NOT NULL,
[svdItemID] [int] NULL,
[svdAvlStock] [numeric] (18,0) NULL,
[svdVerifiedStock] [numeric] (18,0) NULL,
[svdCostPrice] [numeric] (18,0) NULL,
[svdPreSerialNo] [nvarchar] (50) NULL,
[svdNewSerialNo] [nvarchar] (50) NULL,
[svdDeleted] [varchar] (4) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiSerialNoVerificationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiSerialNoVerificationHeader](
[svhCompanyID] [int] NOT NULL,
[svhGodownID] [int] NOT NULL,
[svhID] [int] NOT NULL,
[svhNo] [nvarchar] (50) NOT NULL,
[svhDate] [datetime] NOT NULL,
[svhVerifiedBy] [char] (10) NULL,
[svhRemarks] [nvarchar] (150) NULL,
[svhCancel] [int] NOT NULL,
[svhCancellRemarks] [nvarchar] (150) NULL,
[svhFutureVC] [char] (10) NULL,
[svhUser] [varchar] (50) NULL,
[svhUpdateUser] [char] (10) NULL,
[svhUpdateTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiSettings](
[Godownid] [int] NOT NULL,
[sNoBackDays] [int] NOT NULL,
[OpeningStockDate] [datetime] NULL,
[barcodetype] [smallint] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[defaultfetch] [varchar] (100) NULL,
[reportsetting] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiStockRecovery]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiStockRecovery](
[srID] [int] NOT NULL,
[srGodownID] [int] NOT NULL,
[srDate] [datetime] NULL,
[srItemID] [int] NULL,
[srcostprice] [numeric] (18,2) NULL,
[srAddStock] [numeric] (18,3) NULL,
[srDedStock] [numeric] (18,3) NULL,
[srUserName] [varchar] (50) NULL,
[srposted] [bit] NOT NULL,
[srfutureint] [int] NULL,
[updatetime] [datetime] NOT NULL,
[srtransno] [varchar] (50) NULL,
[srlocid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[srConExRate] [numeric] (18,8) NULL,
[srDepExRate] [numeric] (18,8) NULL,
[srExchangeRates] [varchar] (250) NULL,
[srTransDate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiStockVerificationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiStockVerificationDetail](
[svdid] [int] NOT NULL,
[svdGodownID] [int] NOT NULL,
[svdLocationid] [int] NULL,
[svdShipmentID] [int] NOT NULL,
[svdItemID] [int] NOT NULL,
[svdAvailStock] [numeric] (18,3) NULL,
[svdVerifiedStock] [numeric] (18,3) NULL,
[svdAvailBadStock] [numeric] (18,3) NULL,
[svdVerifiedBadStock] [numeric] (18,3) NULL,
[svdcostprice] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiStockVerificationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiStockVerificationHeader](
[svhid] [int] NOT NULL,
[svhGodownid] [int] NOT NULL,
[svhNo] [varchar] (50) NOT NULL,
[svhDate] [datetime] NULL,
[svhVerificationby] [varchar] (250) NULL,
[svhCancelled] [bit] NOT NULL,
[svhCancelledRemarks] [varchar] (50) NULL,
[svhRecAddUser] [varchar] (50) NULL,
[svhRecModUser] [varchar] (50) NULL,
[svhRemarks] [varchar] (250) NULL,
[svhfuturevc] [varchar] (250) NOT NULL,
[svhposted] [bit] NOT NULL,
[updatetime] [datetime] NOT NULL,
[svhdepartmentid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[svhdepexrate] [numeric] (18,8) NULL,
[svhconexrate] [numeric] (18,8) NULL,
[svhexchangerates] [varchar] (250) NULL,
[svhcreatedtime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiUserAuditDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiUserAuditDetail](
[gdCompanyId] [int] NOT NULL,
[gdAuditId] [int] NOT NULL,
[gdGodownId] [int] NOT NULL,
[gdDetailId] [int] NOT NULL,
[gdAuditControlName] [varchar] (250) NOT NULL,
[gdAuditControlType] [varchar] (25) NOT NULL,
[gdOldValue] [varchar] (4000) NOT NULL,
[gdNewValue] [varchar] (4000) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loiUserAuditHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loiUserAuditHeader](
[ghCompanyId] [int] NOT NULL,
[ghAuditId] [int] NOT NULL,
[ghGodownId] [int] NOT NULL,
[ghInterfaceId] [int] NOT NULL,
[ghTransId] [int] NOT NULL,
[ghTransNo] [varchar] (250) NULL,
[ghUserFullName] [varchar] (250) NOT NULL,
[ghLoggedDateTime] [datetime] NOT NULL,
[ghExitedDateTime] [datetime] NOT NULL,
[ghMode] [char] (1) NOT NULL,
[ghSaved] [bit] NOT NULL,
[ghMachineName] [varchar] (50) NULL,
[ghWindowsUserName] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiWriteOffDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiWriteOffDetail](
[wdID] [int] NOT NULL,
[wdGodownID] [int] NOT NULL,
[wdLocationID] [int] NULL,
[wdShipmentID] [int] NOT NULL,
[wdItemID] [int] NOT NULL,
[wdAvailableQty] [numeric] (18,3) NULL,
[wdWriteoffQty] [numeric] (18,3) NULL,
[wdcostprice] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOiWriteOffHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOiWriteOffHeader](
[whGodownID] [int] NOT NULL,
[whID] [int] NOT NULL,
[whNo] [varchar] (50) NULL,
[whDate] [datetime] NULL,
[whUserName] [varchar] (250) NULL,
[whCancelled] [bit] NOT NULL,
[whCancelledRemarks] [varchar] (250) NULL,
[whRemarks] [varchar] (250) NOT NULL,
[whRecaddUser] [varchar] (250) NULL,
[whRecmodifyUser] [varchar] (250) NULL,
[whposted] [bit] NOT NULL,
[whfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[whdepartmentid] [int] NULL,
[whSelected] [bit] NULL,
[whtransfinished] [bit] NULL,
[whNoofDetails] [int] NULL,
[whtype] [char] (1) NULL,
[whconexrate] [numeric] (18,8) NULL,
[whdepexrate] [numeric] (18,8) NULL,
[whexchangerates] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[whTime] [datetime] NULL,
[whcreatedtime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[lopackagetype]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[lopackagetype](
[loctype] [char] (10) NULL,
[locid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPrePurchaseOrderDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPrePurchaseOrderDetail](
[podPoid] [int] NOT NULL,
[poditemid] [int] NOT NULL,
[podDetailID] [int] NOT NULL,
[podpackingtypeID] [int] NULL,
[podQty] [numeric] (18,3) NULL,
[podUnitPrice] [numeric] (18,8) NULL,
[poddescription] [varchar] (250) NULL,
[podstatus] [char] (1) NULL,
[podstatusinfo] [varchar] (100) NULL,
[podlastbillrate] [numeric] (18,2) NULL,
[podcostingvalue] [int] NULL,
[podcostingprice] [numeric] (18,2) NULL,
[podbillunitprice] [numeric] (18,2) NULL,
[podcustomdutyamount] [numeric] (18,2) NULL,
[podocperitem] [numeric] (28,22) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[poddiscount] [numeric] (18,2) NULL,
[poddiscountprice] [numeric] (18,2) NULL,
[podsellingprice] [numeric] (18,2) NULL,
[podRoyalty] [numeric] (18,2) NULL,
[podLstCustRate] [numeric] (18,0) NULL,
[podItemTaxPercentage] [numeric] (18,2) NULL,
[podtemTaxAmount] [numeric] (18,2) NULL,
[podItemTaxCategory] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPrePurchaseOrderHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPrePurchaseOrderHeader](
[pohPoid] [int] NOT NULL,
[pohpono] [varchar] (50) NOT NULL,
[pohnoSupwise] [varchar] (50) NULL,
[pohPodate] [datetime] NULL,
[pohVendorID] [int] NULL,
[pohSupAddr] [varchar] (250) NULL,
[pohdueDate] [datetime] NULL,
[pohdeliveryaddr] [varchar] (250) NULL,
[pohRefNo] [varchar] (50) NULL,
[pohcancel] [bit] NOT NULL,
[pohcancelremarks] [varchar] (250) NULL,
[pohPosted] [bit] NOT NULL,
[pohrecadduser] [varchar] (50) NULL,
[pohrecmoduser] [varchar] (50) NULL,
[pohbillgenerated] [bit] NOT NULL,
[pohremarks] [varchar] (250) NULL,
[pohtype] [char] (2) NULL,
[pohValue] [numeric] (18,2) NULL,
[pogenerated] [bit] NOT NULL,
[pohpogenerated] [bit] NOT NULL,
[pohQuotationid] [int] NULL,
[pohUsedinPayments] [bit] NOT NULL,
[pohLCopened] [bit] NOT NULL,
[pohDepartmentid] [int] NULL,
[pohLCAccountid] [int] NULL,
[pohPurchaseAccountid] [int] NULL,
[pohLCdueon] [datetime] NULL,
[pohLCAmount] [numeric] (18,2) NULL,
[pohLCNumber] [varchar] (50) NULL,
[pohLCRemarks] [varchar] (250) NULL,
[pohcompanyid] [int] NULL,
[pohLcMarginOpened] [bit] NOT NULL,
[pohCostingDone] [char] (1) NULL,
[pohDeliveryTerms] [varchar] (500) NULL,
[pohppconfirmed] [bit] NOT NULL,
[pohpoonhold] [bit] NULL,
[pohfuturevc] [varchar] (250) NOT NULL,
[pohshipmentmode] [varchar] (50) NULL,
[pohpaymentmode] [varchar] (50) NULL,
[pohpurpose] [varchar] (50) NULL,
[pohshopid] [int] NULL,
[pohrequestid] [int] NULL,
[updatetime] [datetime] NOT NULL,
[pohbofladno] [varchar] (50) NULL,
[Pohbofladdate] [datetime] NULL,
[Pohbofladdetails] [varchar] (250) NULL,
[pohexchangerates] [varchar] (250) NULL,
[pohcmpexrate] [numeric] (18,8) NULL,
[pohdepexrate] [numeric] (18,8) NULL,
[pohfinancialid] [int] NULL,
[pohProjectStartDate] [datetime] NULL,
[pohProjectEndDate] [datetime] NULL,
[pohProjectOtherInfo] [varchar] (1000) NULL,
[pohCustomDutyByCustomer] [bit] NULL,
[pohTransportation] [varchar] (50) NULL,
[pohPotime] [datetime] NULL,
[pohSubDepartmentID] [int] NULL,
[PohAuthorized] [int] NULL,
[pohVerified] [int] NULL,
[pohSingleItemCatChecked] [bit] NULL,
[pohSingleItemCatId] [int] NULL,
[pohuserid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[lopurchasecostingaccountdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[lopurchasecostingaccountdetails](
[poadPOID] [int] NOT NULL,
[poadAccountID] [int] NOT NULL,
[poadDetailID] [int] NOT NULL,
[poadDescription] [varchar] (250) NULL,
[poadAmount] [numeric] (18,2) NOT NULL,
[poadCompanyID] [int] NULL,
[poadDistribution] [varchar] (1500) NULL,
[poadOtherCharges] [bit] NOT NULL,
[poadCostingType] [varchar] (5) NULL,
[poaddToLandPrice] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPurchaseOrderDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPurchaseOrderDetail](
[podPoid] [int] NOT NULL,
[poditemid] [int] NOT NULL,
[podDetailID] [int] NOT NULL,
[podpackingtypeID] [int] NULL,
[podQty] [numeric] (18,3) NULL,
[podUnitPrice] [numeric] (25,8) NULL,
[poddescription] [varchar] (250) NULL,
[podstatus] [char] (1) NULL,
[podstatusinfo] [varchar] (100) NULL,
[podlastbillrate] [numeric] (18,2) NULL,
[podcostingvalue] [int] NULL,
[podcostingprice] [numeric] (18,2) NULL,
[podbillunitprice] [numeric] (18,2) NULL,
[podcustomdutyamount] [numeric] (18,2) NULL,
[podocperitem] [numeric] (28,22) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[poddiscount] [numeric] (18,2) NULL,
[poddiscountprice] [numeric] (18,2) NULL,
[podsellingprice] [numeric] (18,2) NULL,
[podRoyalty] [numeric] (18,2) NULL,
[podLstCustRate] [numeric] (18,0) NULL,
[podItemTaxPercentage] [numeric] (18,2) NULL,
[podItemTaxAmount] [numeric] (18,2) NULL,
[podItemTaxCategory] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPurchaseOrderHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPurchaseOrderHeader](
[pohPoid] [int] NOT NULL,
[pohpono] [varchar] (50) NOT NULL,
[pohnoSupwise] [varchar] (50) NULL,
[pohPodate] [datetime] NULL,
[pohVendorID] [int] NULL,
[pohSupAddr] [varchar] (250) NULL,
[pohdueDate] [datetime] NULL,
[pohdeliveryaddr] [varchar] (250) NULL,
[pohRefNo] [varchar] (50) NULL,
[pohcancel] [bit] NOT NULL,
[pohcancelremarks] [varchar] (250) NULL,
[pohPosted] [bit] NOT NULL,
[pohrecadduser] [varchar] (50) NULL,
[pohrecmoduser] [varchar] (50) NULL,
[pohbillgenerated] [bit] NOT NULL,
[pohremarks] [varchar] (250) NULL,
[pohtype] [char] (2) NULL,
[pohValue] [numeric] (28,2) NULL,
[pogenerated] [bit] NOT NULL,
[pohpogenerated] [bit] NOT NULL,
[pohQuotationid] [int] NULL,
[pohUsedinPayments] [bit] NOT NULL,
[pohLCopened] [bit] NOT NULL,
[pohDepartmentid] [int] NULL,
[pohLCAccountid] [int] NULL,
[pohPurchaseAccountid] [int] NULL,
[pohLCdueon] [datetime] NULL,
[pohLCAmount] [numeric] (18,2) NULL,
[pohLCNumber] [varchar] (50) NULL,
[pohLCRemarks] [varchar] (250) NULL,
[pohcompanyid] [int] NULL,
[pohLcMarginOpened] [bit] NOT NULL,
[pohCostingDone] [char] (1) NULL,
[pohDeliveryTerms] [varchar] (500) NULL,
[pohquotconfirmed] [bit] NOT NULL,
[pohpoonhold] [bit] NULL,
[pohfuturevc] [varchar] (250) NOT NULL,
[pohshipmentmode] [varchar] (50) NULL,
[pohpaymentmode] [varchar] (50) NULL,
[pohpurpose] [varchar] (50) NULL,
[pohshopid] [int] NULL,
[pohrequestid] [int] NULL,
[updatetime] [datetime] NOT NULL,
[pohbofladno] [varchar] (50) NULL,
[Pohbofladdate] [datetime] NULL,
[Pohbofladdetails] [varchar] (250) NULL,
[pohexchangerates] [varchar] (250) NULL,
[pohcmpexrate] [numeric] (18,8) NULL,
[pohdepexrate] [numeric] (18,8) NULL,
[pohfinancialid] [int] NULL,
[pohProjectStartDate] [datetime] NULL,
[pohProjectEndDate] [datetime] NULL,
[pohProjectOtherInfo] [varchar] (1000) NULL,
[pohCustomDutyByCustomer] [bit] NULL,
[pohTransportation] [varchar] (50) NULL,
[pohPotime] [datetime] NULL,
[pohSubDepartmentID] [int] NULL,
[PohAuthorized] [int] NULL,
[pohVerified] [int] NULL,
[pohprepurchaseid] [int] NULL,
[pohApproved] [int] NULL,
[pohPriorityid] [int] NULL,
[pohPurRequestedBy] [varchar] (30) NULL,
[pohReqApprovedBy] [varchar] (30) NULL,
[pohTypeid] [int] NULL,
[pohPurRequestClosed] [bit] NULL,
[pohRequestDepartment] [int] NULL,
[pohSingleItemCatChecked] [bit] NULL,
[pohSingleItemCatId] [int] NULL,
[pohUserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPurchaseOrderItemSplitDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPurchaseOrderItemSplitDetails](
[podID] [int] NOT NULL,
[VendorID] [int] NOT NULL,
[ItemID] [int] NOT NULL,
[PoDetailID] [int] NOT NULL,
[VendorItemDesc] [nvarchar] (50) NULL,
[VendorPackingType] [nvarchar] (50) NULL,
[VendorQty] [numeric] (18,2) NULL,
[VendorUnitPrice] [numeric] (18,2) NULL,
[VendorAmount] [numeric] (18,2) NULL,
[CustomItemDesc] [nvarchar] (50) NULL,
[CustomPackingType] [nvarchar] (50) NULL,
[CustomQty] [numeric] (18,2) NULL,
[CustomUnitPrice] [numeric] (18,2) NULL,
[CustomAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPurchaseOrderOC]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPurchaseOrderOC](
[podOthPoId] [int] NOT NULL,
[podOthDetailId] [int] NOT NULL,
[podOthDesc] [varchar] (250) NULL,
[podOthAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPurchaseOrderOthCharge]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPurchaseOrderOthCharge](
[POorderID] [int] NOT NULL,
[POOCdetailID] [int] NOT NULL,
[POAccID] [int] NOT NULL,
[PODescription] [varchar] (100) NULL,
[POAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPurchaseOrderQuatationDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPurchaseOrderQuatationDetails](
[CompanyID] [int] NULL,
[DeptID] [int] NULL,
[pohPOID] [int] NULL,
[QuatationID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPurchasereturndetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPurchasereturndetail](
[prdcompanyid] [int] NOT NULL,
[prdreturnid] [int] NOT NULL,
[prddetailid] [int] NOT NULL,
[prditemid] [int] NULL,
[prdqty] [numeric] (18,3) NULL,
[prdcostprice] [numeric] (18,2) NULL,
[prdsuppamount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loPurchasereturnheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loPurchasereturnheader](
[prhcompanyid] [int] NOT NULL,
[prhreturnid] [int] NOT NULL,
[prhreturnno] [varchar] (50) NULL,
[prhreturndate] [datetime] NULL,
[prhvendorid] [int] NULL,
[prhgodownid] [int] NULL,
[prhwriteoffid] [int] NULL,
[prhremarks] [varchar] (250) NULL,
[prhadjaccountid] [int] NULL,
[prhcancelled] [bit] NOT NULL,
[prhcancelledremarks] [varchar] (250) NULL,
[prhposted] [bit] NOT NULL,
[prhupdatetime] [datetime] NULL,
[prhexrate] [numeric] (18,8) NULL,
[prhdepexrate] [numeric] (18,8) NULL,
[prhexchangerates] [varchar] (250) NULL,
[prhinvexrate] [numeric] (18,8) NULL,
[prhFinancialID] [int] NULL,
[prhdepartmentid] [int] NULL,
[prhSubDepartmentID] [int] NULL,
[prhreturntime] [datetime] NULL,
[prhreturnupdatetime] [datetime] NULL,
[prhTime] [datetime] NULL,
[prhModified] [varchar] (250) NULL,
[prhCreated] [varchar] (250) NULL,
[prhShopID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loreplacereqtovendorheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loreplacereqtovendorheader](
[rrvcompanyid] [int] NOT NULL,
[rrvrequestid] [int] NOT NULL,
[rrvrequestno] [varchar] (50) NULL,
[rrvrequestdate] [datetime] NULL,
[rrvvendorid] [int] NULL,
[rrvshopid] [int] NULL,
[rrvrepreqid] [int] NULL,
[rrvremarks] [varchar] (250) NULL,
[rrvcancelled] [bit] NOT NULL,
[rrvcancelledremarks] [varchar] (250) NULL,
[rrvTime] [datetime] NULL,
[rrvCreated] [varchar] (250) NULL,
[rrvModified] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOs_InHouseCons_ReturnDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOs_InHouseCons_ReturnDetail](
[IHRDShopID] [int] NOT NULL,
[IHRDID] [int] NOT NULL,
[IHRDDetailid] [int] NOT NULL,
[IHRDItemID] [int] NOT NULL,
[IHRDShipmentID] [int] NOT NULL,
[IHRDArrivedQty] [numeric] (18,3) NOT NULL,
[IHRDArrivedPQty] [numeric] (18,3) NOT NULL,
[IHRDPackID] [int] NULL,
[IHRDunitID] [int] NULL,
[IHRDReturnedPqty] [numeric] (18,2) NOT NULL,
[IHRDReturnedQty] [numeric] (18,2) NOT NULL,
[IHRDcostprice] [numeric] (18,2) NULL,
[IHRDInhouseConsAccnt] [int] NULL,
[IHRDRetrnOrExch] [varchar] (1) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOs_InHouseCons_ReturnHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOs_InHouseCons_ReturnHeader](
[IHRHShopID] [int] NOT NULL,
[IHRHID] [int] NOT NULL,
[IHRHNo] [varchar] (50) NULL,
[IHRHDate] [datetime] NULL,
[IHRHReferenceid] [int] NOT NULL,
[IHRHRemarks] [varchar] (250) NULL,
[IHRHCancelled] [bit] NOT NULL,
[IHRHCancelledRemarks] [varchar] (250) NULL,
[IHRHposted] [bit] NOT NULL,
[updatetime] [datetime] NOT NULL,
[IHRHdepartmentid] [int] NULL,
[IHRHconexrate] [numeric] (18,8) NULL,
[IHRHdepexrate] [numeric] (18,8) NULL,
[IHRHexchangerates] [varchar] (250) NULL,
[IHRHotherdepid] [int] NULL,
[IHRHtodepexrate] [numeric] (18,9) NULL,
[IHRHexpenseaccid] [int] NULL,
[IHRHapartmentid] [int] NULL,
[IHRHUserId] [int] NOT NULL,
[IHRHModifiedUserId] [int] NULL,
[IHRHConfirmed] [bit] NULL,
[IHRHConfirmedUSerID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsAccountsInvoiceHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsAccountsInvoiceHeader](
[aiShopID] [int] NOT NULL,
[aiInvoiceID] [int] NOT NULL,
[aiCompanyID] [int] NOT NULL,
[aiInvoiceNo] [varchar] (50) NOT NULL,
[aiInvoiceDate] [datetime] NOT NULL,
[aiOrderNo] [varchar] (50) NULL,
[aiCustomerID] [int] NULL,
[aiProforma] [bit] NOT NULL,
[aiCashInvoice] [bit] NOT NULL,
[aiBankCashID] [int] NULL,
[aiChequeNo] [varchar] (50) NULL,
[aiDuePeriod] [smallint] NULL,
[aiRemarks] [varchar] (250) NULL,
[aiPosted] [bit] NOT NULL,
[aiDepartmentID] [int] NULL,
[aiProduct] [bit] NOT NULL,
[aiDiscount] [numeric] (18,2) NULL,
[aiDiscountAccountID] [int] NULL,
[aiCancelled] [bit] NOT NULL,
[aiCancelledRemarks] [varchar] (250) NULL,
[aiFinancialID] [int] NULL,
[aiExchangeNature] [varchar] (50) NULL,
[aiSalesAccID] [int] NULL,
[aiSettled] [bit] NOT NULL,
[aiExchangeRate] [numeric] (28,8) NOT NULL,
[aiReferenceno] [varchar] (50) NULL,
[aiSettledamount] [numeric] (18,2) NULL,
[aicbid] [int] NULL,
[aicfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[aiAddress] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[aidepexrate] [numeric] (18,8) NULL,
[aidexchangerates] [varchar] (250) NULL,
[aiClearingComPerc] [numeric] (18,2) NULL,
[aiInvoiceType] [varchar] (5) NULL,
[aiCashPaidByshop] [bit] NULL,
[aiPOCommPer] [numeric] (18,2) NULL,
[aiBoatnoteid] [int] NULL,
[aiCreated] [varchar] (250) NULL,
[aiModified] [varchar] (250) NULL,
[aiTime] [datetime] NULL,
[aiUserId] [int] NULL,
[aiModifyUserId] [int] NULL,
[aiTaxCategory] [int] NULL,
[aiTaxAmount] [numeric] (18,2) NULL,
[aiTaxPercentage] [numeric] (18,2) NULL,
[ExcludeGST] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losApartmentAgreementDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losApartmentAgreementDetails](
[mgdcompanyid] [int] NOT NULL,
[mgdshopid] [int] NOT NULL,
[mgdAgreementId] [int] NOT NULL,
[mgdAgreementDetailID] [int] NOT NULL,
[mgdPersonName] [varchar] (100) NULL,
[mgdcheckintime] [datetime] NULL,
[mgdcheckouttime] [datetime] NULL,
[mgdPassPortNo] [varchar] (100) NULL,
[mgdWorkPermitVisaNo] [varchar] (100) NULL,
[mgdPPExpiryDate] [datetime] NULL,
[mgdVisaExpiryDate] [datetime] NULL,
[mgdstatus] [varchar] (100) NULL,
[mgdremarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losApartmentAgreementHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losApartmentAgreementHeader](
[mghCompanyId] [int] NOT NULL,
[mghShopId] [int] NOT NULL,
[mghAgreementid] [int] NOT NULL,
[mghAgreementno] [varchar] (50) NULL,
[mghAgreementDate] [datetime] NULL,
[mghApartmentId] [int] NOT NULL,
[mghApartmentIncharge] [int] NOT NULL,
[mghcontactpersonname] [varchar] (250) NULL,
[mghcontactphoneno] [varchar] (100) NULL,
[mghleaseendingdate] [datetime] NULL,
[mghleasecommencingdate] [datetime] NULL,
[mghrentlastdate] [datetime] NULL,
[mghleasestatus] [char] (1) NULL,
[mghelectricityreadingstart] [numeric] (18,3) NULL,
[mghelectricityreadingend] [numeric] (18,3) NULL,
[mghwaterreadingstart] [numeric] (18,3) NULL,
[mghwaterreadingend] [numeric] (18,3) NULL,
[mghsecurittyamount] [numeric] (18,2) NULL,
[mghdiscount] [numeric] (18,2) NULL,
[mghmodeofpayment] [char] (1) NULL,
[mghRemarks] [varchar] (250) NULL,
[mghCancelled] [bit] NULL,
[mghCancelledRemarks] [varchar] (250) NULL,
[mghUpdateTime] [datetime] NULL,
[mghDepartmentid] [int] NULL,
[mghReservationID] [int] NULL,
[mghExchangeRate] [numeric] (18,8) NULL,
[mghDepExRate] [numeric] (18,8) NULL,
[mghAccountId] [int] NULL,
[mghNoOfDetails] [int] NULL,
[mghPosted] [bit] NOT NULL,
[mghChequeNo] [varchar] (50) NULL,
[mghChequeDate] [datetime] NULL,
[mghExchangeRates] [varchar] (250) NULL,
[mghAdavanceAccID] [int] NULL,
[mghRateDetailId] [int] NULL,
[mghApartmentRate] [numeric] (18,2) NULL,
[mghadvdate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosApartmentAssets]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosApartmentAssets](
[aacompanyid] [int] NOT NULL,
[aashopid] [int] NOT NULL,
[aaapartmentid] [int] NOT NULL,
[aadetailid] [int] NOT NULL,
[aaremarks] [varchar] (250) NULL,
[AaItemName] [varchar] (100) NULL,
[aaassetid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losApartmentBillHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losApartmentBillHeader](
[abhBillId] [int] NOT NULL,
[abhSHopID] [int] NOT NULL,
[abhCompanyid] [int] NOT NULL,
[abhBillNo] [varchar] (50) NULL,
[abhApartmentId] [int] NULL,
[abhAgreementId] [int] NULL,
[abhCustomerId] [int] NULL,
[abhCashAccId] [int] NULL,
[abhFromDate] [datetime] NULL,
[abhToDate] [datetime] NULL,
[abhRate] [numeric] (18,2) NULL,
[abhAmount] [numeric] (18,2) NULL,
[abhOtherCharges] [numeric] (18,2) NULL,
[abhTax] [numeric] (18,2) NULL,
[abdDepositReturn] [numeric] (18,2) NULL,
[abhDepExRate] [numeric] (18,8) NULL,
[abhExRate] [numeric] (18,8) NULL,
[abhRemarks] [varchar] (250) NULL,
[abhCancelledRemarks] [varchar] (250) NULL,
[abhCancelled] [bit] NULL,
[abhPosted] [bit] NULL,
[abhDepartmentid] [int] NOT NULL,
[abhUpdateTime] [datetime] NULL,
[abhBillDate] [datetime] NULL,
[abhSalesAccID] [int] NULL,
[abhOCAccID] [int] NULL,
[abhExRates] [varchar] (250) NULL,
[abhDueDate] [datetime] NULL,
[abhReferenceNo] [varchar] (50) NULL,
[abhSettledAmount] [numeric] (18,2) NULL,
[abhSettled] [bit] NOT NULL,
[abhPeriod] [numeric] (18,2) NULL,
[abhUserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosApartmentcategory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosApartmentcategory](
[rccompanyid] [int] NOT NULL,
[rcshopid] [int] NOT NULL,
[rcapartmentcategoryid] [int] NOT NULL,
[rcapartmentcategorycode] [varchar] (25) NULL,
[rcapartmentcategorydescription] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losApartmentCheckOut]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losApartmentCheckOut](
[chID] [int] NOT NULL,
[chShopID] [int] NOT NULL,
[chCompanyId] [int] NOT NULL,
[chNo] [varchar] (50) NULL,
[chDate] [datetime] NULL,
[chApartmentId] [int] NULL,
[chAgreementID] [int] NULL,
[chEnteredBy] [int] NULL,
[chCheckoutTime] [datetime] NULL,
[chDepositReturned] [numeric] (18,2) NULL,
[chDepositAmount] [numeric] (18,2) NULL,
[chCashAccId] [int] NULL,
[chRemarks] [varchar] (250) NULL,
[chPosted] [bit] NULL,
[chCancelled] [bit] NULL,
[chCancelledRemarks] [varchar] (250) NULL,
[ChDepartmentID] [int] NOT NULL,
[chUpdateTime] [datetime] NULL,
[chExRate] [numeric] (18,8) NULL,
[chDepExRate] [numeric] (18,8) NULL,
[chExRates] [varchar] (250) NULL,
[chWriteOffAccID] [int] NULL,
[chAvaliedAmount] [numeric] (18,2) NULL,
[chCustomerID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOSApartmentDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOSApartmentDetail](
[apdcompanyid] [int] NOT NULL,
[apdApartmentid] [int] NOT NULL,
[apdShopid] [int] NOT NULL,
[apdApartmentcategoryid] [int] NOT NULL,
[apdApartmentno] [varchar] (50) NULL,
[apdremarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losApartmentRatesDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losApartmentRatesDetail](
[rdcompanyid] [int] NOT NULL,
[rdshopid] [int] NOT NULL,
[rdRoomRateTypeId] [int] NOT NULL,
[rdapartmentcategoryid] [int] NOT NULL,
[rdroomratedetailid] [int] NOT NULL,
[rdApartmentRate] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosApprovedby]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosApprovedby](
[Approvedid] [int] NULL,
[approvedby] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losBoatNoteConfirmHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losBoatNoteConfirmHeader](
[ShopID] [int] NOT NULL,
[ConfirmID] [int] NOT NULL,
[ConfirmNO] [varchar] (50) NULL,
[ConfirmDate] [datetime] NULL,
[BoatNoteID] [int] NULL,
[InformedTime] [datetime] NULL,
[InformedBy] [varchar] (100) NULL,
[Remarks] [varchar] (250) NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (250) NULL,
[DetailIDs] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losbookingcancellation]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losbookingcancellation](
[bkcancellId] [int] NOT NULL,
[bkcancellshopid] [int] NOT NULL,
[bkcancellcomapnyid] [int] NOT NULL,
[bkcancellno] [varchar] (50) NULL,
[bkcancelldate] [datetime] NULL,
[bkcancellbookingId] [int] NULL,
[bkcancellperson] [varchar] (50) NULL,
[bkcancelldetails] [varchar] (250) NULL,
[bkcancellcancelled] [bit] NOT NULL,
[bkcancellRemarks] [varchar] (250) NULL,
[bkcancellposted] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losbookpartsreplacedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losbookpartsreplacedetails](
[repbkdsercompanyid] [int] NOT NULL,
[repbkdserpartsid] [int] NOT NULL,
[repbkdshopid] [int] NOT NULL,
[repbkdserbookid] [int] NOT NULL,
[repbkdrate] [numeric] (18,8) NULL,
[repbkdsellrate] [numeric] (18,8) NULL,
[repbkdqty] [numeric] (18,3) NULL,
[repbkdfromsupp] [bit] NULL,
[repbkdguarantee] [bit] NULL,
[repbkdcomments] [varchar] (250) NULL,
[repbkdcostprice] [numeric] (18,8) NULL,
[repbkdpackid] [int] NULL,
[repbkdpackqty] [numeric] (18,8) NULL,
[repbkddetailid] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[repbkinvhSerialNumber] [varchar] (100) NULL,
[repbkinvhTaxCateID] [int] NULL,
[repbkinvhTaxPercentage] [numeric] (18,2) NULL,
[repbkinvhTaxamount] [numeric] (18,8) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losbookservicedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losbookservicedetails](
[serbkdcompanyid] [int] NOT NULL,
[serbkdbookid] [int] NOT NULL,
[serbkdshopid] [int] NOT NULL,
[serbkdserviceid] [int] NOT NULL,
[serbkdcharge] [numeric] (18,8) NULL,
[serbkdchargetaken] [numeric] (18,8) NULL,
[serbkdcomments] [varchar] (250) NULL,
[serbkdserviceqty] [numeric] (18,2) NULL,
[serbkdserdetailid] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[serinvhTaxCateID] [int] NULL,
[serinvhTaxPercentage] [numeric] (18,2) NULL,
[serinvhTaxamount] [numeric] (18,8) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losbookservtechniciandetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losbookservtechniciandetails](
[sertechcompanyid] [int] NOT NULL,
[sertechbookid] [int] NOT NULL,
[sertechshopid] [int] NOT NULL,
[sertechdetailid] [int] NOT NULL,
[sertechid] [int] NULL,
[sertechstarttime] [datetime] NULL,
[sertechendtime] [datetime] NULL,
[sertechcostperhr] [int] NULL,
[sertechservicetype] [char] (10) NULL,
[sertechcomments] [varchar] (250) NULL,
[sertechstatus] [char] (10) NULL,
[sertechfuturevc] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[sertechServiceID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losCallBookingHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losCallBookingHeader](
[serCallBkhid] [int] NOT NULL,
[serCallBkhno] [varchar] (50) NULL,
[serCallBkhshopid] [int] NOT NULL,
[serCallBkhslno] [varchar] (50) NULL,
[serCallBkhdate] [datetime] NULL,
[serCallBkhitemid] [int] NULL,
[serCallBkpartcode] [varchar] (50) NULL,
[serCallBkrefno] [varchar] (50) NULL,
[serCallBkhaddress] [varchar] (250) NULL,
[serCallBkhMaintenanceContractID] [int] NULL,
[serCallBkhtelephone] [varchar] (50) NULL,
[serCallBkhrecvdfrom] [varchar] (100) NULL,
[serCallBkhCallClass] [varchar] (50) NULL,
[serCallBkhCallShopID] [int] NULL,
[serCallBkhCallType] [varchar] (250) NULL,
[serCallBkhcancelled] [bit] NULL,
[serCallBkhcategid] [int] NULL,
[serCallBkhcompanyid] [int] NOT NULL,
[serCallBkhcustomerid] [int] NULL,
[serCallBkhdepartmentid] [int] NULL,
[serCallBkhenteredby] [varchar] (100) NULL,
[serCallBkhFaxInTime] [datetime] NULL,
[serCallBkhfuturevc] [varchar] (250) NULL,
[serCallBkhguarentee] [bit] NULL,
[serCallBkhinformedby] [varchar] (50) NULL,
[serCallBkhpurchdate] [datetime] NULL,
[serCallBkhremarks] [varchar] (250) NULL,
[serCallBkhtime] [datetime] NULL,
[serCallBkhupdatetime] [datetime] NULL,
[serCallBkcancelremarks] [varchar] (250) NULL,
[serCallBkhinstallation] [bit] NULL,
[sercallbkhstatus] [varchar] (50) NULL,
[serCallBkhStatusId] [int] NULL,
[sercallbkhwarrantyfrom] [datetime] NULL,
[sercallbkhwarrantyto] [datetime] NULL,
[serCallBkhRegID] [int] NULL,
[serCallBkhMileage] [nvarchar] (30) NULL,
[serCallBkhcustomerName] [nvarchar] (200) NULL,
[serCallBkhServWarrantyUpto] [datetime] NULL,
[serCallBkhPartsWarrantyUpto] [datetime] NULL,
[serCallBkhSerialNo] [nvarchar] (200) NULL,
[sercallbkhonsite] [bit] NULL,
[serCallBkhExcludeGST] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loscomplaints]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loscomplaints](
[cmpid] [int] NOT NULL,
[cmpshopid] [int] NOT NULL,
[cmpcompanyid] [int] NOT NULL,
[cmpno] [varchar] (50) NOT NULL,
[cmpdate] [datetime] NULL,
[cmpcustomerid] [int] NULL,
[cmpbookingid] [int] NULL,
[cmpcustomername] [varchar] (100) NULL,
[cmpcustomercardno] [varchar] (50) NULL,
[cmpcustomeraddress] [varchar] (250) NULL,
[cmpcustomeremail] [varchar] (100) NULL,
[cmpcustomerpagermobile] [varchar] (50) NULL,
[cmpcomplaintdetails] [varchar] (250) NULL,
[cmptype] [varchar] (50) NULL,
[cmpcancelled] [bit] NULL,
[cmpcancelledremarks] [varchar] (250) NULL,
[cmpupdatetime] [datetime] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[cmpItemid] [int] NULL,
[cmpItemDesc] [varchar] (250) NULL,
[cmpEnterby] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losCosAvlStock]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losCosAvlStock](
[CompanyId] [int] NULL,
[CostingID] [int] NULL,
[ItemID] [int] NULL,
[OldStock] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDebitCreditNote]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDebitCreditNote](
[losDCNShopid] [int] NOT NULL,
[losDCNId] [int] NOT NULL,
[losDCNNo] [varchar] (50) NULL,
[losDCNDate] [datetime] NULL,
[losDCNCustomerID] [int] NULL,
[losDCNVendorId] [int] NULL,
[losDCNDebit] [bit] NOT NULL,
[losDCNOtherAccId] [int] NULL,
[losDCNBillId] [int] NULL,
[losDCNInvoiceId] [int] NULL,
[losDCNAmount] [numeric] (18,2) NULL,
[losDCNDetails] [varchar] (1000) NULL,
[losDCNRemarks] [varchar] (250) NULL,
[losDCNCompanyid] [int] NULL,
[losDCNCancelled] [bit] NOT NULL,
[losDCNCancelledRemarks] [varchar] (250) NULL,
[losDCNPosted] [bit] NOT NULL,
[losDCNRecAddUser] [varchar] (250) NULL,
[losDCNRecModifyUser] [varchar] (250) NULL,
[losReferenceno] [varchar] (100) NULL,
[losrefno] [varchar] (50) NULL,
[loscusvenrefno] [varchar] (50) NULL,
[losfinancialid] [int] NULL,
[losexchangerate] [numeric] (18,8) NULL,
[updatetime] [datetime] NOT NULL,
[losdcndepartmentid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[losdepexrate] [numeric] (18,8) NULL,
[losdexchangerates] [varchar] (250) NULL,
[losDCNtype] [char] (1) NULL,
[losDCNDuePeriod] [int] NULL,
[losDCNUserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDebitCreditNoteDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDebitCreditNoteDetail](
[DCNID] [int] NOT NULL,
[ShopID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[ClearenceID] [int] NULL,
[POID] [int] NULL,
[Amount] [numeric] (18,2) NULL,
[ResAmount] [numeric] (18,2) NULL,
[BoatNoteID] [int] NULL,
[ClearenceDetID] [int] NULL,
[BoatNoteDetID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDeliveryDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDeliveryDetails](
[CompanyId] [int] NOT NULL,
[ShopId] [int] NOT NULL,
[CashInvoiceId] [int] NULL,
[CreditInvoiceId] [int] NULL,
[CustomerName] [nvarchar] (200) NULL,
[ContactNumber] [nvarchar] (100) NULL,
[CustomerAddress1] [nvarchar] (200) NULL,
[CustomerAddress2] [nvarchar] (200) NULL,
[CustomerAddress3] [nvarchar] (200) NULL,
[DeliveryAddress1] [nvarchar] (200) NULL,
[DeliveryAddress2] [nvarchar] (200) NULL,
[DeliveryAddress3] [nvarchar] (200) NULL,
[DeliveryDate] [datetime] NULL,
[DeliveryTime] [datetime] NULL,
[DeliveryRemarks] [nvarchar] (500) NULL,
[DeliveryAddressIsSame] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosDeliveryNoteDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosDeliveryNoteDetail](
[DnDShopid] [int] NOT NULL,
[DnDdnId] [int] NOT NULL,
[DnDetailId] [int] NOT NULL,
[DnDinvoiceId] [int] NULL,
[dndBillID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosDeliveryNoteHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosDeliveryNoteHeader](
[DnShopid] [int] NOT NULL,
[DndnId] [int] NOT NULL,
[DndnNo] [varchar] (50) NULL,
[DndnDate] [datetime] NULL,
[DnCustomerID] [int] NULL,
[DnDeliveredBy] [varchar] (100) NULL,
[DnVesselName] [varchar] (100) NULL,
[DnRegistryNo] [varchar] (50) NULL,
[DnReceivedBY] [varchar] (100) NULL,
[DnRemarks] [varchar] (500) NULL,
[Dncancelled] [bit] NOT NULL,
[DnCancelledRemarks] [varchar] (250) NULL,
[DnDeliveryTime] [datetime] NULL,
[dnCustomerName] [nvarchar] (100) NULL,
[dnContactNumber] [nvarchar] (50) NULL,
[dnCustomerAddress1] [nvarchar] (100) NULL,
[dnCustomerAddress2] [nvarchar] (100) NULL,
[dnCustomerAddress3] [nvarchar] (100) NULL,
[dnDeliveryAddress1] [nvarchar] (100) NULL,
[dnDeliveryAddress2] [nvarchar] (100) NULL,
[dnDeliveryAddress3] [nvarchar] (100) NULL,
[dnCompanyId] [int] NULL,
[dnStatus] [int] NULL,
[dnConfirmed] [bit] NULL,
[DnDeliveryType] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDeliveryNoteImage]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDeliveryNoteImage](
[CompanyId] [int] NOT NULL,
[ShopId] [int] NOT NULL,
[DeliveryNoteId] [int] NOT NULL,
[DeliveryNoteImage] [image] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDeliveryNoteItemDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDeliveryNoteItemDetails](
[dndShopID] [int] NOT NULL,
[dndId] [int] NOT NULL,
[dndDetailID] [int] NOT NULL,
[dndItemID] [int] NOT NULL,
[dndQty] [numeric] (18,2) NULL,
[dndItemType] [varchar] (10) NULL,
[dndKitID] [int] NOT NULL,
[dndKitQuantity] [numeric] (18,2) NULL,
[issueQty] [numeric] (18,2) NULL,
[dndItemRemarks] [nvarchar] (500) NULL,
[dndCollectFromGodownId] [int] NULL,
[dndPackingTypeID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDeliveryVerificationDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDeliveryVerificationDetails](
[CompanyId] [int] NOT NULL,
[ShopId] [int] NOT NULL,
[DeliveryVerificationId] [int] NOT NULL,
[SlNo] [int] NULL,
[BillId] [int] NULL,
[InvoiceId] [int] NULL,
[ItemId] [int] NOT NULL,
[PackId] [int] NOT NULL,
[PackQty] [numeric] (18,3) NOT NULL,
[Qty] [numeric] (18,3) NOT NULL,
[FinancialYearId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDeliveryVerificationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDeliveryVerificationHeader](
[CompanyId] [int] NOT NULL,
[ShopId] [int] NOT NULL,
[DeliveryVerificationId] [int] NOT NULL,
[DeliveryVerificationNo] [nvarchar] (50) NULL,
[DeliveryDate] [datetime] NULL,
[Cancelled] [bit] NULL,
[AddUserId] [int] NULL,
[ModifyUserId] [int] NULL,
[DeleteUserId] [int] NULL,
[DeletionReason] [nvarchar] (500) NULL,
[UpdateTime] [datetime] NULL,
[FinancialYearId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Losdisplaylayer]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Losdisplaylayer](
[Displayerid] [int] NULL,
[DispLayerName] [varchar] (100) NULL,
[DispLayerValue] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Losdisplaymode]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Losdisplaymode](
[Dispmodeid] [int] NULL,
[Dispmodename] [varchar] (100) NULL,
[Dispmodevalue] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDocument]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDocument](
[ShopID] [int] NOT NULL,
[DocID] [int] NOT NULL,
[DocType] [char] (2) NOT NULL,
[DocNo] [varchar] (50) NULL,
[DocDate] [datetime] NULL,
[CustomerID] [int] NULL,
[CurrencyID] [int] NULL,
[CompanyID] [int] NOT NULL,
[EmpName] [varchar] (100) NULL,
[PPassportNo] [varchar] (100) NULL,
[PIssueDate] [datetime] NULL,
[PExpireyDate] [datetime] NULL,
[PNationality] [varchar] (100) NULL,
[WWorkPermitNo] [varchar] (100) NULL,
[WIssueDate] [datetime] NULL,
[WExpireyDate] [datetime] NULL,
[WNoofDays] [int] NULL,
[WFeeType] [varchar] (50) NULL,
[WFeeExpireyDate] [datetime] NULL,
[MLastMedicalReportDate] [datetime] NULL,
[CoMailIn] [bit] NULL,
[CoMailHandledBy] [varchar] (50) NULL,
[RequestedBy] [varchar] (100) NULL,
[Remarks] [varchar] (250) NULL,
[AlertBeforeDays] [int] NULL,
[Active] [bit] NULL,
[Cancelled] [bit] NULL,
[CancelledRemarks] [varchar] (250) NULL,
[ArrangementDoneDate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDocumentaccom]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDocumentaccom](
[ShopID] [int] NOT NULL,
[DocId] [int] NOT NULL,
[DetailId] [int] NOT NULL,
[PaxName] [varchar] (50) NULL,
[Hotelname] [varchar] (50) NULL,
[BedNights] [int] NULL,
[RoomRate] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDocumentDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDocumentDetail](
[ShopID] [int] NOT NULL,
[DocID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[Particulars] [varchar] (250) NULL,
[FromDetails] [varchar] (50) NULL,
[ToDetails] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDocumentoc]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDocumentoc](
[ShopID] [int] NOT NULL,
[DocID] [int] NOT NULL,
[DetailID] [char] (10) NOT NULL,
[OtherCharge] [varchar] (100) NULL,
[Amount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDocumenttravel]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDocumenttravel](
[ShopID] [int] NOT NULL,
[DocId] [int] NOT NULL,
[DetailId] [int] NOT NULL,
[TravellerName] [varchar] (50) NULL,
[Department] [varchar] (50) NULL,
[Designation] [varchar] (50) NULL,
[TravelDate] [datetime] NULL,
[Remark] [varchar] (100) NULL,
[TravelMode] [varchar] (50) NULL,
[Route] [varchar] (50) NULL,
[Travelclass] [varchar] (50) NULL,
[Travelcost] [varchar] (50) NULL,
[arrivaldate] [datetime] NULL,
[alertdays] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosDummyReceiptDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosDummyReceiptDetail](
[drdShopID] [int] NOT NULL,
[drdid] [int] NOT NULL,
[drdDetailid] [int] NOT NULL,
[drdcompanyid] [int] NULL,
[drdinvoiceid] [int] NULL,
[drdsplinvoiceid] [int] NULL,
[drdserviceinvoiceid] [int] NULL,
[drdbookserinvoiceid] [int] NULL,
[drddcnid] [int] NULL,
[drdinvoiceamount] [numeric] (18,2) NULL,
[drdsettledamount] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[drdUtilityBillID] [int] NULL,
[drdRoomBillID] [int] NULL,
[drdaccInvoiceID] [int] NULL,
[drdFineid] [int] NULL,
[drdfandbInvoiceID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losDummyReceiptHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losDummyReceiptHeader](
[drShopid] [int] NOT NULL,
[drId] [int] NOT NULL,
[drCompanyid] [int] NULL,
[drNo] [varchar] (50) NULL,
[DrDate] [datetime] NULL,
[drcustomerid] [int] NULL,
[drbankname] [varchar] (100) NULL,
[drremarks] [varchar] (250) NULL,
[drchequeno] [varchar] (50) NULL,
[drchequedate] [datetime] NULL,
[drAmount] [numeric] (18,2) NULL,
[drcbid] [int] NULL,
[drrecadduser] [varchar] (50) NULL,
[drrecmodifyuser] [varchar] (50) NULL,
[drcancelled] [bit] NOT NULL,
[drcancelledremarks] [varchar] (250) NULL,
[drfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[drdepartmentid] [int] NULL,
[drBankExchangeRate] [numeric] (28,8) NULL,
[drExchangeRate] [numeric] (28,8) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[drdepexRate] [numeric] (18,8) NULL,
[drexchangerates] [varchar] (250) NULL,
[drreccurrencyid] [int] NULL,
[drrecamount] [numeric] (18,2) NULL,
[drTime] [datetime] NULL,
[drCounterID] [int] NULL,
[drUserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losEDIConfirmation]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losEDIConfirmation](
[ecshopid] [int] NOT NULL,
[ecconfirmid] [int] NOT NULL,
[ecconfirmno] [varchar] (50) NULL,
[ecconfirmdate] [datetime] NULL,
[ecediid] [int] NULL,
[ecrefno] [varchar] (100) NULL,
[ecstatus] [char] (1) NULL,
[ecconfirmedby] [varchar] (100) NULL,
[eccancelled] [bit] NOT NULL,
[eccancelledremarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losEDIRequest]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losEDIRequest](
[ershopid] [int] NOT NULL,
[erediid] [int] NOT NULL,
[eredino] [varchar] (50) NULL,
[eredidate] [datetime] NULL,
[erreferenceno] [varchar] (50) NULL,
[erpoid] [int] NULL,
[ersentby] [varchar] (100) NULL,
[erremarks] [varchar] (250) NULL,
[ercancelled] [bit] NOT NULL,
[ercancelledremarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losexpiryarrivaldetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losexpiryarrivaldetails](
[eadInterfaceID] [int] NULL,
[eadShopID] [int] NULL,
[eadTransactionID] [int] NULL,
[eadDetailID] [int] NULL,
[eadExpiryDate] [datetime] NULL,
[eadItemID] [int] NULL,
[eadItemQty] [numeric] (18,3) NULL,
[eadPackingtypeID] [int] NULL,
[eadPackingQty] [numeric] (18,3) NULL,
[eadCancel] [bit] NOT NULL,
[eadAdjustment] [bit] NOT NULL,
[eadfreeqty] [numeric] (18,3) NULL,
[eadbatchno] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losexpiryissuedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losexpiryissuedetails](
[eidInterfaceID] [int] NULL,
[eidShopID] [int] NULL,
[eidTransactionID] [int] NULL,
[eidDetailID] [int] NULL,
[eidExpiryDate] [datetime] NULL,
[eidItemID] [int] NULL,
[eidItemQty] [numeric] (18,3) NULL,
[eidPackingtypeID] [int] NULL,
[eidPackingQty] [numeric] (18,3) NULL,
[eidCancel] [bit] NOT NULL,
[eidAdjustment] [bit] NOT NULL,
[eidfreeqty] [numeric] (18,0) NULL,
[eidbatchno] [varchar] (20) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losExpiryVerificationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losExpiryVerificationDetail](
[evdId] [int] NOT NULL,
[evdShipmentId] [int] NOT NULL,
[evdItemId] [int] NOT NULL,
[evdShopId] [int] NOT NULL,
[evdAvailStock] [numeric] (18,3) NULL,
[evdVerifiedStock] [numeric] (18,3) NULL,
[evdCostPrice] [numeric] (18,3) NULL,
[evdPrevExpiryDate] [datetime] NULL,
[evdVerifiedExpiryDate] [datetime] NOT NULL,
[evdPrevBatchNo] [varchar] (20) NOT NULL,
[evdBatchNo] [varchar] (20) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losExpiryVerificationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losExpiryVerificationHeader](
[evhId] [int] NOT NULL,
[evhShopId] [int] NOT NULL,
[evhNo] [varchar] (50) NOT NULL,
[evhDate] [datetime] NOT NULL,
[evhRemarks] [varchar] (250) NULL,
[evhCancelled] [bit] NULL,
[evhVerifiedBy] [varchar] (100) NULL,
[evhCancelRemarks] [varchar] (50) NULL,
[evhFutureVc] [varchar] (250) NULL,
[evhPosted] [bit] NULL,
[UpdateTime] [datetime] NULL,
[evhDepartmentId] [int] NULL,
[evhConExRate] [numeric] (18,0) NULL,
[evhDepExRate] [numeric] (18,0) NULL,
[evhExchangeRates] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losExportDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losExportDetail](
[redShopID] [int] NOT NULL,
[redExportID] [int] NOT NULL,
[redItemID] [int] NOT NULL,
[redPckingTypeID] [int] NOT NULL,
[redPUnitID] [int] NOT NULL,
[redQuantity] [numeric] (18,2) NULL,
[redUnitPrice] [numeric] (20,4) NULL,
[redRateType] [numeric] (18,2) NULL,
[redActualUnitPrice] [numeric] (20,4) NULL,
[redCostPrice] [numeric] (20,4) NULL,
[redDescription] [varchar] (250) NULL,
[redbLockPrice] [numeric] (20,4) NULL,
[redguarantee] [varchar] (250) NULL,
[redrebateamount] [numeric] (20,4) NULL,
[redcorgin] [int] NULL,
[redcconsignment] [int] NULL,
[redcdcomcur] [numeric] (20,4) NULL,
[redcdcustcur] [numeric] (20,4) NULL,
[redcdcomcurtocustoms] [numeric] (20,4) NULL,
[redcdcustcurtocustoms] [numeric] (20,4) NULL,
[redPQuantity] [numeric] (18,0) NULL,
[redroyaltyamt] [numeric] (18,2) NULL,
[redRoyalty] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losExportHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losExportHeader](
[rehExportID] [int] NOT NULL,
[rehShopID] [int] NOT NULL,
[rehExportNo] [varchar] (50) NULL,
[rehExportDate] [datetime] NULL,
[rehReferenceNo] [varchar] (50) NULL,
[rehVendorID] [int] NULL,
[rehcustomerid] [int] NULL,
[rehProforma] [bit] NULL,
[rehCashInvoice] [bit] NULL,
[rehBankCashAccID] [int] NULL,
[rehChequeNo] [varchar] (10) NULL,
[rehDueDate] [datetime] NULL,
[rehRemarks] [varchar] (250) NULL,
[rehExportAmount] [numeric] (20,4) NULL,
[rehDiscount] [numeric] (20,4) NULL,
[rehDiscountAccID] [int] NULL,
[rehDepartmentID] [int] NULL,
[rehFinancialID] [int] NULL,
[rehCancelled] [bit] NULL,
[rehCancelledRemarks] [varchar] (250) NULL,
[rehExchangeNature] [varchar] (50) NULL,
[rehCompanyID] [int] NULL,
[rehPosted] [bit] NULL,
[rehProformaID] [int] NULL,
[rehSalesAccID] [int] NULL,
[rehSettled] [bit] NULL,
[rehExchangeRate] [numeric] (18,8) NULL,
[rehSettledAmount] [numeric] (20,4) NULL,
[rehWholeSale] [bit] NULL,
[rehFutureVC] [varchar] (250) NULL,
[rehUpdatetime] [datetime] NULL,
[rehSalesPersonID] [int] NULL,
[rehShip] [varchar] (50) NULL,
[rehPortofLoading] [varchar] (50) NULL,
[rehShipDepDate] [datetime] NULL,
[rehShipDischarge] [varchar] (50) NULL,
[rehShipArrivalDate] [datetime] NULL,
[rehFinalDestination] [varchar] (50) NULL,
[rehDeliveryDate] [datetime] NULL,
[rehgstpercentage] [numeric] (18,0) NULL,
[rehPaymentterm] [varchar] (250) NULL,
[updatetime] [datetime] NULL,
[rehDepExRate] [numeric] (18,8) NULL,
[rehtype] [char] (2) NULL,
[rehcustomsformno] [varchar] (100) NULL,
[rehexchangerates] [varchar] (250) NULL,
[rehBuyerPoNo] [varchar] (50) NULL,
[rehBuyerName] [varchar] (50) NULL,
[rehBuyerAddress] [varchar] (250) NULL,
[rehLoadedDate] [datetime] NULL,
[rehDetailsOfShipment] [varchar] (250) NULL,
[rehConsigneeName] [varchar] (250) NULL,
[rehNameOfVessel] [varchar] (100) NULL,
[rehShipmentDepartureDate] [datetime] NULL,
[rehCustomerFormRegNo] [varchar] (50) NULL,
[rehBlOrAwbNo] [varchar] (50) NULL,
[rehMissingOrDamagedItems] [varchar] (250) NULL,
[rehInsuranceCertificateNo] [varchar] (50) NULL,
[rehDemurrageRemarkds] [varchar] (250) NULL,
[rehContainerNo] [varchar] (50) NULL,
[rehTerminate] [bit] NULL,
[rehTerminateRemarks] [varchar] (250) NULL,
[rehBankName] [varchar] (100) NULL,
[rehBankaddress] [varchar] (250) NULL,
[rehSwiftaddress] [varchar] (250) NULL,
[rehAdvanceAmt] [numeric] (18,2) NULL,
[rehPriceType] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsExportOC]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsExportOC](
[ioShopID] [int] NULL,
[ioInvoiceID] [int] NULL,
[ioAccID] [int] NULL,
[ioDescription] [varchar] (100) NULL,
[ioAmount] [numeric] (18,2) NULL,
[ioCompanyid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losFacilityBookingDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losFacilityBookingDetail](
[ftShopid] [int] NULL,
[ftCompanyId] [int] NOT NULL,
[ftBookingId] [int] NOT NULL,
[ftBookingDetailId] [int] NOT NULL,
[ftFaclityID] [int] NOT NULL,
[ftCheckInTime] [datetime] NULL,
[ftCheckOutTime] [datetime] NULL,
[ftnoofunit] [int] NULL,
[ftweekdays] [int] NULL,
[ftRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losFacilityBookingHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losFacilityBookingHeader](
[fbhcompanyid] [int] NOT NULL,
[fbhshopid] [int] NOT NULL,
[fphbookingid] [int] NOT NULL,
[fbhbookingdate] [datetime] NULL,
[fbhbookingno] [varchar] (100) NOT NULL,
[fbhregistrationid] [int] NULL,
[fbhremarks] [varchar] (250) NULL,
[fbhcancelled] [bit] NULL,
[fbhcancelledremarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosFacilityTracking]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosFacilityTracking](
[ftShopid] [int] NOT NULL,
[ftCompanyId] [int] NOT NULL,
[ftTrackId] [int] NOT NULL,
[ftTrackNo] [varchar] (50) NULL,
[ftTrackDate] [datetime] NULL,
[ftAgreementid] [int] NOT NULL,
[ftBookingId] [int] NOT NULL,
[ftBookingDetailId] [int] NULL,
[ftFaclityID] [int] NOT NULL,
[ftCheckInTime] [datetime] NULL,
[ftCheckOutTime] [datetime] NULL,
[ftChectoutdate] [datetime] NULL,
[ftcheckinEnteredBy] [int] NULL,
[ftcheckoutEnteredBy] [int] NULL,
[ftcheckinCancelled] [bit] NOT NULL,
[ftcheckinRemark] [varchar] (250) NULL,
[ftcheckoutRemark] [varchar] (250) NULL,
[ftcheckincancellremark] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losfuture]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losfuture](
[futureint] [int] NOT NULL,
[futuredatetime] [datetime] NULL,
[futurevarchar] [varchar] (250) NULL,
[futurenumeric] [numeric] (18,3) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losfuturetabdetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losfuturetabdetail](
[futdid] [int] NOT NULL,
[futdcompanyid] [int] NOT NULL,
[futdshopid] [int] NOT NULL,
[futdref1id] [int] NOT NULL,
[futdref2id] [int] NULL,
[futdref3id] [int] NULL,
[futdrefnum1] [numeric] (18,8) NULL,
[futdrefnum2] [numeric] (18,8) NULL,
[futdrefnum3] [numeric] (18,8) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losfuturetabheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losfuturetabheader](
[futheadid] [int] NOT NULL,
[futhcompanyid] [int] NOT NULL,
[futhshopid] [int] NOT NULL,
[futhno] [varchar] (50) NULL,
[futhdate] [datetime] NULL,
[futhremarks] [varchar] (250) NULL,
[futhcancelledremarks] [varchar] (250) NULL,
[futhcancelled] [bit] NULL,
[futhposted] [bit] NULL,
[futhtransidentifier] [char] (5) NULL,
[futhupdatetime] [datetime] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsGoodsArrivaltoShopDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsGoodsArrivaltoShopDetail](
[gadArrivalID] [int] NOT NULL,
[gadShopid] [int] NOT NULL,
[gadShipmentID] [int] NOT NULL,
[gadItemID] [int] NOT NULL,
[gadItemGoodQuantity] [numeric] (18,3) NULL,
[gadItemBAdQuantity] [numeric] (18,3) NULL,
[gadItemGoodQuantityArrived] [numeric] (18,3) NULL,
[gadItemBadQuantityArrived] [numeric] (18,3) NULL,
[gadcostprice] [numeric] (18,2) NULL,
[gadpackingtypeid] [int] NULL,
[gadpackqty] [numeric] (18,3) NULL,
[gadreceivepackqty] [numeric] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsGoodsArrivaltoShopHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsGoodsArrivaltoShopHeader](
[gahArrivalID] [int] NOT NULL,
[gahShopid] [int] NOT NULL,
[gahArrivalNo] [varchar] (50) NULL,
[gahArrivalDate] [datetime] NULL,
[gahGodownDespatchID] [int] NULL,
[gahDespatchedGodownID] [int] NULL,
[gahCancelled] [bit] NOT NULL,
[gahCancelledRemarks] [varchar] (50) NULL,
[gahRecAddUser] [varchar] (250) NULL,
[gahRecModifyUser] [varchar] (250) NULL,
[gahremarks] [varchar] (250) NULL,
[gahTransFinished] [bit] NOT NULL,
[gahfuturevc] [varchar] (250) NOT NULL,
[gahshopreqid] [int] NULL,
[gahposted] [bit] NOT NULL,
[updatetime] [datetime] NOT NULL,
[gahdepartmentid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[gahhqdespatchid] [int] NULL,
[gahconexrate] [numeric] (18,8) NULL,
[gahdepexrate] [numeric] (18,8) NULL,
[gahexchangerates] [varchar] (250) NULL,
[gahTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosGoodsReturnNoteDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosGoodsReturnNoteDetail](
[GRNDReturnNoteID] [int] NOT NULL,
[GRNDItemID] [int] NOT NULL,
[GRNDShopid] [int] NOT NULL,
[GRNDQuantity] [numeric] (18,5) NULL,
[GRNDunitprice] [numeric] (18,8) NULL,
[GRNDDamaged] [bit] NOT NULL,
[GRNDRemarks] [varchar] (250) NULL,
[grncostprice] [numeric] (18,2) NULL,
[grndFreeQuantity] [numeric] (18,0) NULL,
[grndPackTypeId] [int] NOT NULL,
[idItemTaxPercentage] [numeric] (18,2) NULL,
[idItemTaxAmount] [numeric] (18,8) NULL,
[idItemTaxCategory] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosGoodsReturnNoteHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosGoodsReturnNoteHeader](
[grnhShopid] [int] NOT NULL,
[GrnhGoodsreturnnoteID] [int] NOT NULL,
[GrnhGoodsreturnnoteNO] [varchar] (50) NOT NULL,
[GrnhGoodsreturnnoteDate] [datetime] NOT NULL,
[GrnhCustomerID] [int] NOT NULL,
[GrnhInvoiceID] [int] NULL,
[GrnhRecommendedby] [varchar] (250) NULL,
[GrnhCancel] [bit] NOT NULL,
[GrnhCancelledRemarks] [varchar] (250) NULL,
[GrnhRecAdduser] [varchar] (250) NULL,
[GrnhRecModifyuser] [varchar] (250) NULL,
[GrnhPosted] [bit] NOT NULL,
[GrnReturnAccID] [int] NULL,
[GrnCompanyID] [int] NULL,
[grnhExchangeRate] [numeric] (18,8) NULL,
[grnfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[grnhDepartmentid] [int] NULL,
[grnhfinancialid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[grnhdepExRate] [numeric] (18,8) NULL,
[grnexchangerates] [varchar] (250) NULL,
[grnhTime] [datetime] NULL,
[grnUserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loshpApplication]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loshpApplication](
[hpAppCompanyID] [int] NOT NULL,
[hpAppShopID] [int] NOT NULL,
[hpAppID] [int] NOT NULL,
[hpAppDate] [datetime] NULL,
[hpAppNO] [nvarchar] (50) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHPChequeRegisterDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHPChequeRegisterDetail](
[HpdCompanyID] [int] NOT NULL,
[HpdShopID] [int] NOT NULL,
[HpdChqRegID] [int] NOT NULL,
[HpdChqdetailID] [int] NOT NULL,
[HpdChqNo] [nvarchar] (50) NULL,
[HpdBankName] [nvarchar] (50) NULL,
[HpdChqDate] [datetime] NULL,
[HpdChqAmount] [numeric] (18,2) NULL,
[hpdActualChqAmount] [numeric] (18,2) NULL,
[HpdAccountNo] [varchar] (50) NULL,
[hpdchequeStatus] [nvarchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHPChequeRegisterHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHPChequeRegisterHeader](
[HphCompanyID] [int] NOT NULL,
[HPhShopID] [int] NOT NULL,
[HphChqRegID] [int] NOT NULL,
[HphChqRegNO] [nvarchar] (50) NOT NULL,
[HphDate] [datetime] NOT NULL,
[hphAgreementID] [int] NULL,
[hphInvoiceID] [int] NULL,
[hphCustID] [int] NULL,
[HPhfinancialid] [int] NOT NULL,
[HphPeriod] [numeric] (18,0) NULL,
[HphInstMonthlyPay] [numeric] (18,2) NULL,
[hphCancel] [int] NULL,
[hphCancelRemarks] [nvarchar] (100) NULL,
[hphShopverify] [int] NULL,
[HphUser] [nvarchar] (50) NULL,
[HphModifiedUser] [nvarchar] (50) NULL,
[HphModifiedDate] [nvarchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHPCustomerDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHPCustomerDetails](
[hpCompanyID] [int] NOT NULL,
[hpDepartmentID] [int] NULL,
[hpCustID] [int] NOT NULL,
[hpCustName] [nvarchar] (150) NULL,
[hpCustcommenName] [nvarchar] (150) NULL,
[hpNCCNO] [nvarchar] (50) NULL,
[hpCustDOB] [datetime] NULL,
[hpCustBornIn] [nvarchar] (50) NULL,
[hpMobNo] [nvarchar] (50) NULL,
[hpAccountNo] [varchar] (50) NULL,
[hpCustPermanentadd] [nvarchar] (250) NULL,
[hpCustPermAtoll] [nvarchar] (50) NULL,
[hpCustPermIsland] [nvarchar] (50) NULL,
[hpCustPremPhno] [nvarchar] (50) NULL,
[hpCustPresentAdd] [nvarchar] (250) NULL,
[hpCustPresAtoll] [nvarchar] (50) NULL,
[hpCustpresIsland] [nvarchar] (50) NULL,
[hpCustPresPhno] [nvarchar] (50) NULL,
[hpDeCustName] [nvarchar] (50) NULL,
[hpDeCustAddress] [nvarchar] (50) NULL,
[hpDeCustAtoll] [nvarchar] (50) NULL,
[hpDeCustIsland] [nvarchar] (50) NULL,
[hpCustPreAgreement] [nvarchar] (50) NULL,
[IslandtoUseMC] [nvarchar] (50) NULL,
[hpCustMCNO] [nvarchar] (50) NULL,
[hpEmployedAt] [nvarchar] (50) NULL,
[hpOfficePH] [nvarchar] (50) NULL,
[hpDesignation] [nvarchar] (50) NULL,
[hpSalary] [nvarchar] (50) NULL,
[hpDuration] [nvarchar] (50) NULL,
[hpOfficeAdd] [nvarchar] (250) NULL,
[hpRefName] [nvarchar] (50) NULL,
[hpRefRelation] [nvarchar] (50) NULL,
[hpRefPermanentAdd] [nvarchar] (120) NULL,
[hpRefPermAtoll] [nvarchar] (50) NULL,
[hpRefPermIsland] [nvarchar] (50) NULL,
[hpRefPermPHNO] [nvarchar] (50) NULL,
[hpRefPresentAdd] [nvarchar] (250) NULL,
[hpRefPresAtoll] [nvarchar] (50) NULL,
[hpRefPresIsland] [nvarchar] (50) NULL,
[hpRefPresPHNo] [nvarchar] (50) NULL,
[hpRefMob] [nvarchar] (50) NULL,
[hpGaName] [nvarchar] (50) NULL,
[hpGaNICNO] [nvarchar] (50) NULL,
[hpGaPermanentAdd] [nvarchar] (250) NULL,
[hpGaPermAtoll] [nvarchar] (50) NULL,
[hpGaPermIsland] [nvarchar] (50) NULL,
[hpGaPermPHNO] [nvarchar] (50) NULL,
[hpGaPresentAdd] [nvarchar] (120) NULL,
[hpGaPresAtoll] [nvarchar] (50) NULL,
[hpGaPresIsland] [nvarchar] (50) NULL,
[hpGaPresPHNO] [nvarchar] (50) NULL,
[hpGaMOB] [nvarchar] (50) NULL,
[hpDeGaName] [nvarchar] (50) NULL,
[hpDeGaAddress] [nvarchar] (50) NULL,
[hpGaRelation] [nvarchar] (50) NULL,
[hpVerified] [int] NULL,
[hpuser] [nvarchar] (50) NULL,
[hpdate] [datetime] NULL,
[hpupdateduser] [nvarchar] (50) NULL,
[hpUpdatedTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHPCustomerQuotationDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHPCustomerQuotationDetails](
[HpCustID] [int] NULL,
[HPQuotationID] [int] NULL,
[HPItemId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpDummyQuotationDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpDummyQuotationDetails](
[hpqdCompanyID] [int] NULL,
[hpqdShopId] [int] NULL,
[hpqdQuotationID] [int] NULL,
[hpqdDetailID] [int] NOT NULL,
[hpqdItemID] [int] NOT NULL,
[hpqdItemRegistrationId] [int] NULL,
[hpqdFrameNo] [nvarchar] (50) NULL,
[hpqdSellingPrice] [numeric] (18,2) NOT NULL,
[hpqdCostPrice] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpDummyQuotationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpDummyQuotationHeader](
[hpqhCompanyID] [int] NULL,
[hpqhShopID] [int] NULL,
[hpqhQuotationID] [int] NOT NULL,
[hpqhQuotationNo] [varchar] (50) NOT NULL,
[hpqhQuotationDate] [datetime] NOT NULL,
[hpqhAmount] [numeric] (18,0) NOT NULL,
[hpqhScheme] [nvarchar] (50) NULL,
[hpqhType] [char] (10) NOT NULL,
[hpqhCancel] [int] NULL,
[hpqhCancelRemarks] [nvarchar] (50) NULL,
[hpqhPosted] [int] NOT NULL,
[hpqhCustomerID] [int] NULL,
[hpqhCustName] [nvarchar] (50) NOT NULL,
[hpqhCustAddress] [nvarchar] (250) NOT NULL,
[hpqhFirstInstAmt] [numeric] (18,2) NOT NULL,
[hpqhBalAmt] [numeric] (18,2) NOT NULL,
[hpqhInstPeriod] [int] NOT NULL,
[hpqhCashAllowance] [numeric] (18,0) NULL,
[hpqhInstPerc] [numeric] (18,2) NOT NULL,
[hpqhInstCharge] [numeric] (18,2) NOT NULL,
[hpqhSurcharge] [numeric] (18,2) NULL,
[hpqhTotAdditional] [numeric] (18,2) NULL,
[hpqhInstPrice] [numeric] (18,2) NULL,
[hpqhMonthilyPay] [numeric] (18,2) NULL,
[hpqhConfirmed] [int] NULL,
[hpqhUserName] [nvarchar] (50) NULL,
[hpqhFinancialID] [int] NULL,
[hpqhRemarks] [nvarchar] (250) NULL,
[hpqhModifiedUser] [nvarchar] (50) NULL,
[hpqhUpdateTime] [datetime] NULL,
[hpqhDownPaid] [int] NOT NULL,
[hpqhProcessed] [int] NOT NULL,
[hpqhFinished] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpInvoiceDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpInvoiceDetail](
[hpqdCompanyID] [int] NOT NULL,
[hpqdShopId] [int] NOT NULL,
[hpqdQuotationID] [int] NOT NULL,
[hpqdDetailID] [int] NOT NULL,
[hpqdItemID] [int] NOT NULL,
[hpqdItemRegistrationId] [int] NULL,
[hpqdFrameNo] [nvarchar] (50) NULL,
[hpqdSellingPrice] [numeric] (18,2) NULL,
[hpqdCostPrice] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpInvoiceDetailOthers]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpInvoiceDetailOthers](
[hpqdCompanyID] [int] NOT NULL,
[hpqdShopId] [int] NOT NULL,
[hpqdQuotationID] [int] NOT NULL,
[hpqdActSellingPrice] [numeric] (18,2) NULL,
[hpqdActInterest] [numeric] (18,2) NULL,
[hpqdActDP] [numeric] (18,2) NULL,
[hpqdActSurcharge] [numeric] (18,2) NULL,
[hpqdActInstallmentPrice] [numeric] (18,2) NULL,
[hpqdActMonthlyPayment] [numeric] (18,2) NULL,
[hpqdTotalTax] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpInvoiceHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpInvoiceHeader](
[hpqhCompanyID] [int] NOT NULL,
[hpqhShopID] [int] NOT NULL,
[hpqhQuotationID] [int] NOT NULL,
[hpqhQuotationNo] [varchar] (50) NOT NULL,
[hpqhQuotationDate] [datetime] NOT NULL,
[hpqhDelivaryDate] [datetime] NULL,
[hpqhScheme] [nvarchar] (50) NULL,
[hpqhType] [char] (10) NOT NULL,
[hpqhReferenceid] [int] NULL,
[hpqhCancel] [int] NULL,
[hpqhCancelRemarks] [varchar] (250) NULL,
[hpqhPosted] [int] NOT NULL,
[hpqhCustomerID] [int] NULL,
[hpqhCustName] [nvarchar] (250) NOT NULL,
[hpqhCustAddress] [nvarchar] (250) NOT NULL,
[hpqhFirstInstAmt] [numeric] (18,2) NOT NULL,
[hpqhBalAmt] [numeric] (18,2) NOT NULL,
[hpqhInstPeriod] [int] NOT NULL,
[hpqhCashAllowance] [numeric] (18,0) NULL,
[hpqhInstPerc] [numeric] (18,2) NOT NULL,
[hpqhInstCharge] [numeric] (18,2) NOT NULL,
[hpqhSurcharge] [numeric] (18,2) NULL,
[hpqhTotAdditional] [numeric] (18,2) NULL,
[hpqhInstPrice] [numeric] (18,2) NULL,
[hpqhMonthilyPay] [numeric] (18,2) NULL,
[hpqhConfirmed] [int] NULL,
[hpqhUserName] [nvarchar] (50) NULL,
[hpqhFinancialID] [int] NULL,
[hpqhRemarks] [nvarchar] (250) NULL,
[hpqhModifiedUser] [nvarchar] (50) NULL,
[hpqhUpdateTime] [datetime] NULL,
[hpqhDownPaid] [int] NOT NULL,
[hpqhProcessed] [int] NOT NULL,
[hpqhInvoiced] [int] NULL,
[hpqhChqReg] [int] NULL,
[hpqhDidAgreement] [int] NULL,
[hpqhServTaxPerc] [numeric] (18,2) NULL,
[hpqhServTaxAmount] [numeric] (18,2) NULL,
[hpqhServTaxCateId] [int] NULL,
[hpqhRepossessionID] [int] NULL,
[hpqhAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpItemRegistrationDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpItemRegistrationDetails](
[IRCompanyID] [int] NOT NULL,
[IRShopID] [char] (10) NOT NULL,
[IRRegistrationID] [int] NOT NULL,
[IRRegistrationNo] [nvarchar] (50) NOT NULL,
[IRRegistrationDate] [datetime] NOT NULL,
[IRFinancialID] [int] NOT NULL,
[IRShipment] [nvarchar] (50) NULL,
[IRMode] [nvarchar] (50) NULL,
[IRItemID] [int] NOT NULL,
[IRColorID] [int] NULL,
[IRCancel] [int] NULL,
[IRCancelRemarks] [nvarchar] (50) NULL,
[IRForSales] [int] NULL,
[IRModelNo] [nvarchar] (50) NULL,
[IRFrameNo] [nvarchar] (50) NULL,
[IREngineNo] [nvarchar] (50) NULL,
[IRProduction] [nvarchar] (50) NULL,
[IRLocation] [nvarchar] (50) NULL,
[IRCustomerID] [int] NULL,
[IRRegNo] [nvarchar] (50) NULL,
[IRRoadWorthiness] [nvarchar] (50) NULL,
[IRSold] [nvarchar] (50) NULL,
[IRSoldColor] [int] NULL,
[IRRemarks] [nvarchar] (250) NULL,
[IRUserName] [nvarchar] (50) NULL,
[IRUpdateUser] [nvarchar] (50) NULL,
[IRUpdateTime] [datetime] NULL,
[IrInterfaceID] [int] NULL,
[IRTransactionID] [int] NULL,
[IREngineCapacity] [numeric] (18,2) NULL,
[IRSeatingCapacity] [int] NULL,
[IRManufactureYear] [int] NULL,
[IRImportYear] [int] NULL,
[IRTypeofVehicle] [varchar] (50) NULL,
[IRCase] [nvarchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpReceiptDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpReceiptDetail](
[hprdCompanyID] [int] NOT NULL,
[hprdShopId] [int] NOT NULL,
[hprdReceiptID] [int] NOT NULL,
[hprdDetailId] [int] NOT NULL,
[hprdInvoiceID] [int] NULL,
[hprdProcessingId] [int] NULL,
[hprdProcessingDetailId] [int] NULL,
[hprdRentalAmount] [numeric] (18,2) NULL,
[hprdSettelmentAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpReceiptHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpReceiptHeader](
[hprhCompanyID] [int] NOT NULL,
[hprhShopID] [int] NOT NULL,
[hprhReceiptID] [int] NOT NULL,
[hprhReceiptNo] [nvarchar] (50) NOT NULL,
[hprhReceiptDate] [datetime] NOT NULL,
[hprhReceiptType] [varchar] (50) NOT NULL,
[hprhinvBal] [numeric] (18,0) NULL,
[hprhReceiptAmount] [numeric] (18,2) NOT NULL,
[hprhCustomerID] [int] NOT NULL,
[hprhHPQuotationID] [int] NULL,
[hprhFinancialID] [int] NULL,
[hprhCancel] [int] NOT NULL,
[hprhCancelRemarks] [nvarchar] (250) NULL,
[hprhPosted] [int] NULL,
[hprhBankName] [nvarchar] (50) NULL,
[hprhRemarks] [nvarchar] (250) NULL,
[hprhChequeNo] [nvarchar] (50) NULL,
[hprhChequeDate] [datetime] NULL,
[hprhUsed] [int] NULL,
[hprhUserName] [nvarchar] (50) NOT NULL,
[hprhUpdateUserName] [nvarchar] (50) NULL,
[hprhupdateTime] [datetime] NULL,
[hprhCounterID] [int] NULL,
[hprhTaxPercentage] [numeric] (18,9) NULL,
[hprhTaxCateID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpRepossessionDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpRepossessionDetail](
[hprdCompanyId] [int] NOT NULL,
[hprdShopID] [int] NOT NULL,
[hprdRepossessionID] [int] NOT NULL,
[hprdDetailID] [int] NOT NULL,
[hprdItemID] [int] NOT NULL,
[hprdFairValue] [numeric] (18,2) NOT NULL,
[hprdCostValue] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHpRepossessionHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHpRepossessionHeader](
[hprhCompanyID] [int] NOT NULL,
[hprhShopID] [int] NOT NULL,
[hprhRepossessionID] [int] NOT NULL,
[hprhRepossessionNo] [nvarchar] (50) NOT NULL,
[hprhRepossessionDate] [datetime] NOT NULL,
[hprhCustomerID] [int] NOT NULL,
[hprhAgreementID] [int] NOT NULL,
[hprhRemarks] [nvarchar] (500) NOT NULL,
[hprhFinancialID] [int] NOT NULL,
[hprhCancel] [int] NOT NULL,
[hprhCancelRemarks] [nvarchar] (250) NULL,
[hprhPosted] [int] NOT NULL,
[hprhUser] [nvarchar] (50) NULL,
[hprhUpdatedUser] [nvarchar] (50) NULL,
[hprhUpdatedTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHPResaleDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHPResaleDetail](
[hpdCompanyID] [int] NOT NULL,
[hpdShopID] [int] NOT NULL,
[hpdResaleID] [int] NOT NULL,
[hpdResaleDetailID] [int] NULL,
[hpdItemID] [int] NOT NULL,
[hpdRepossessionID] [int] NOT NULL,
[hpdFairValue] [numeric] (18,2) NULL,
[hpdSellingPrice] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losHPResaleHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losHPResaleHeader](
[hphCompanyID] [int] NOT NULL,
[hphShopID] [int] NOT NULL,
[hphResaleID] [int] NOT NULL,
[hphResaleNo] [varchar] (50) NOT NULL,
[hphFinancialID] [int] NOT NULL,
[hphResaleDate] [datetime] NOT NULL,
[hphCustomerID] [int] NOT NULL,
[hphCustomerName] [varchar] (150) NULL,
[hphCancel] [int] NOT NULL,
[hphCancelRemarks] [nvarchar] (250) NULL,
[hphPosted] [int] NOT NULL,
[hphUser] [varchar] (50) NULL,
[hphUpdatedUser] [varchar] (50) NULL,
[hphUpdatedTime] [datetime] NULL,
[hphCashAccID] [int] NULL,
[hphRemarks] [nvarchar] (250) NOT NULL,
[hphCustomerAddress] [varchar] (1) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losInhouseExchangeDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losInhouseExchangeDetail](
[sedShopID] [int] NOT NULL,
[sedExchangeID] [int] NOT NULL,
[sedExchangedetailID] [int] NOT NULL,
[sedItemID] [int] NOT NULL,
[sedPackingTypeID] [int] NOT NULL,
[sedPUnitID] [int] NULL,
[sedPQuantity] [numeric] (18,3) NULL,
[sedQuantity] [numeric] (18,3) NULL,
[sedUnitPrice] [numeric] (18,2) NULL,
[sedActualUnitPrice] [numeric] (18,2) NULL,
[sedExchangePQty] [numeric] (18,2) NULL,
[sedExchangeQty] [numeric] (18,2) NULL,
[sedRateType] [int] NOT NULL,
[sedBillorExchange] [char] (1) NULL,
[sedcostprice] [numeric] (18,2) NULL,
[sedblockprice] [numeric] (18,2) NULL,
[sedguarantee] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NULL,
[sedSerialNo] [varchar] (50) NULL,
[sedFreeQty] [numeric] (18,3) NULL,
[sedExcFreeQty] [numeric] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losinquirydetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losinquirydetail](
[idcompanyid] [int] NOT NULL,
[idshopid] [int] NOT NULL,
[idid] [int] NOT NULL,
[iddetailid] [int] NOT NULL,
[iditemid] [int] NULL,
[iditemname] [varchar] (100) NULL,
[idcomments] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losInquiryHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losInquiryHeader](
[ihcompanyid] [int] NOT NULL,
[ihshopid] [int] NOT NULL,
[ihid] [int] NOT NULL,
[ihno] [varchar] (50) NULL,
[ihdate] [datetime] NULL,
[ihcustid] [int] NULL,
[ihcustname] [varchar] (100) NULL,
[ihcustaddress] [varchar] (250) NULL,
[ihcusttele] [varchar] (50) NULL,
[ihremarks] [varchar] (250) NULL,
[ihupdatetime] [datetime] NOT NULL,
[ihcancelled] [bit] NOT NULL,
[ihcancelledremarks] [varchar] (250) NULL,
[ihCreated] [varchar] (250) NULL,
[ihModified] [varchar] (250) NULL,
[ihTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsInvoiceDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsInvoiceDetail](
[idShopID] [int] NOT NULL,
[idInvoiceID] [int] NOT NULL,
[idItemID] [int] NOT NULL,
[idPackingTypeID] [int] NOT NULL,
[idPUnitID] [int] NULL,
[idPQuantity] [numeric] (18,3) NULL,
[idQuantity] [numeric] (18,3) NULL,
[idUnitPrice] [numeric] (18,8) NULL,
[idRateType] [numeric] (18,3) NULL,
[idActualUnitPrice] [numeric] (18,2) NULL,
[idcostprice] [numeric] (18,2) NULL,
[iddescription] [varchar] (1000) NULL,
[idblockprice] [numeric] (18,2) NULL,
[idguarantee] [varchar] (1000) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[idrebateamount] [numeric] (18,2) NULL,
[idcorgin] [int] NULL,
[idcconsignment] [int] NULL,
[idcdcomcur] [numeric] (18,2) NULL,
[idcdcustcur] [numeric] (18,2) NULL,
[idcdcomcurtocustoms] [numeric] (18,2) NULL,
[idcdcustcurtocustoms] [numeric] (18,2) NULL,
[idDeclaredPrice] [numeric] (20,4) NULL,
[idFreeQuantity] [numeric] (18,3) NULL,
[idType] [varchar] (5) NULL,
[idSerialNo] [varchar] (250) NULL,
[idStatus] [varchar] (250) NULL,
[idItemType] [varchar] (10) NULL,
[idKitID] [int] NOT NULL,
[idKitQuantity] [numeric] (18,2) NULL,
[idKitActualPrice] [numeric] (18,2) NULL,
[idCustomPrice] [numeric] (18,2) NULL,
[idServWarrantyUpto] [datetime] NULL,
[idPartsWarrantyUpto] [datetime] NULL,
[idItemTaxPercentage] [numeric] (18,2) NULL,
[idItemTaxAmount] [numeric] (18,8) NULL,
[idItemTaxCategory] [int] NULL,
[idBillDetailID] [int] NULL,
[idBillID] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losInvoicedPartsReplacedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losInvoicedPartsReplacedetails](
[repinvcompanyid] [int] NOT NULL,
[repinvdpartsid] [int] NOT NULL,
[repinvdshopid] [int] NOT NULL,
[repinvinvoiceid] [int] NOT NULL,
[repinvdrate] [numeric] (18,8) NULL,
[repinvdsellrate] [numeric] (18,8) NULL,
[repinvdqty] [numeric] (18,3) NULL,
[repinvreplfromsupp] [bit] NULL,
[repinvdguarantee] [bit] NULL,
[repinvdcostprice] [numeric] (18,8) NULL,
[repinvdcomments] [varchar] (250) NULL,
[repinvpackid] [int] NULL,
[repinvpackqty] [numeric] (18,8) NULL,
[repinvdetailid] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[repinvdType] [varchar] (10) NULL,
[repinvdSerialNo] [varchar] (100) NULL,
[repinvdItemTaxPercentage] [numeric] (18,2) NULL,
[repinvdItemTaxAmount] [numeric] (18,8) NULL,
[repinvdItemTaxCategory] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losInvoicedServiceDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losInvoicedServiceDetails](
[serinvdcompanyid] [int] NOT NULL,
[serinvdinvoiceid] [int] NOT NULL,
[serinvdshopid] [int] NOT NULL,
[serinvdserviceid] [int] NOT NULL,
[serinvdcharge] [numeric] (18,8) NULL,
[serinvdchargetaken] [numeric] (18,8) NULL,
[serinvdcomments] [varchar] (250) NULL,
[serinvdqty] [numeric] (18,2) NULL,
[serinvddetailid] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[serinvdType] [char] (10) NULL,
[serinvdItemTaxPercentage] [numeric] (18,2) NULL,
[serinvdItemTaxAmount] [numeric] (18,8) NULL,
[serinvdItemTaxCategory] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsInvoiceHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsInvoiceHeader](
[ihShopID] [int] NOT NULL,
[ihInvoiceID] [int] NOT NULL,
[ihInvoiceNo] [varchar] (50) NULL,
[ihInvoiceDate] [datetime] NULL,
[ihReferenceNo] [varchar] (50) NULL,
[ihCustomerID] [int] NULL,
[ihProforma] [bit] NOT NULL,
[ihCashInvoice] [bit] NOT NULL,
[ihBankcashAccID] [int] NULL,
[ihChequeNo] [varchar] (25) NULL,
[ihDueDate] [datetime] NULL,
[ihRemarks] [varchar] (250) NULL,
[ihInvoiceAmount] [numeric] (18,2) NULL,
[ihDiscount] [numeric] (18,2) NULL,
[ihDiscountAccID] [int] NULL,
[ihDepartmentID] [int] NULL,
[ihFinancialID] [int] NULL,
[ihCancelled] [bit] NOT NULL,
[ihCancelledRemarks] [varchar] (250) NULL,
[ihExchangeNature] [varchar] (5) NULL,
[ihCompanyId] [int] NULL,
[ihPosted] [bit] NOT NULL,
[ihProformaID] [int] NULL,
[ihRecAddUser] [varchar] (250) NULL,
[ihRecModifyUser] [varchar] (250) NULL,
[ihGoodsReturned] [bit] NOT NULL,
[ihSalesAccID] [int] NULL,
[ihAdjustmentAmount] [numeric] (18,2) NULL,
[ihSettled] [bit] NOT NULL,
[ihexchangerate] [numeric] (28,8) NOT NULL,
[ihsettledamount] [numeric] (18,2) NULL,
[ihwholesale] [bit] NOT NULL,
[ihfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[ihsalespersonid] [int] NULL,
[ihCustomerCardNo] [varchar] (100) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ihgstpercentage] [numeric] (18,0) NULL,
[ihdutypaidby] [char] (1) NULL,
[ihType] [char] (2) NULL,
[ihdepexrate] [numeric] (18,8) NULL,
[ihcustomsformno] [varchar] (100) NULL,
[ihexchangerates] [varchar] (250) NULL,
[ihtransfinished] [bit] NULL,
[ihCustomsDutyAccID] [int] NULL,
[ihOptedVendorId] [int] NULL,
[ihReferred] [varchar] (10) NULL,
[ihDeliveryDate] [datetime] NULL,
[ihInvoiceTime] [datetime] NULL,
[ContactCardNo] [varchar] (50) NULL,
[ihDeliveryNeeded] [bit] NULL,
[ihuserid] [int] NULL,
[ihModifyUserId] [int] NULL,
[ihRefNo] [varchar] (50) NULL,
[ihCRMQuotationId] [int] NULL,
[ExcludeGST] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsInvoiceOC]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsInvoiceOC](
[ioShopID] [int] NOT NULL,
[ioInvoiceID] [int] NOT NULL,
[ioAccID] [int] NULL,
[ioDescription] [varchar] (250) NOT NULL,
[ioAmount] [numeric] (18,2) NULL,
[ioCompanyid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ioServTaxCateID] [int] NULL,
[ioServTaxPerc] [numeric] (18,2) NULL,
[ioServTaxRate] [numeric] (18,2) NULL,
[ioServTaxAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losInvoiceProjectRequestDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losInvoiceProjectRequestDetails](
[idrInvoiceId] [int] NOT NULL,
[idrShopId] [int] NOT NULL,
[idrCompanyId] [int] NOT NULL,
[idrPlanNo] [varchar] (100) NULL,
[idrRefNo] [varchar] (100) NULL,
[idrNature] [varchar] (50) NULL,
[idrProjectStartDate] [datetime] NULL,
[idrProjectEndDate] [datetime] NULL,
[idrOtherInfo] [varchar] (1000) NULL,
[idrCustomDutyByCustomer] [bit] NULL,
[idrTransportation] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosInvoiceST]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosInvoiceST](
[ioSTShopID] [int] NOT NULL,
[ioSTInvoiceID] [int] NOT NULL,
[ioSTCompanyID] [int] NOT NULL,
[ioSTLocation] [varchar] (250) NULL,
[ioSTShippingService] [varchar] (250) NULL,
[ioSTETA] [varchar] (250) NULL,
[ioSTUSAForwarding] [numeric] (18,2) NULL,
[ioSTFreightAndHandling] [numeric] (18,2) NULL,
[ioSTInsurance] [numeric] (18,2) NULL,
[ioSTCustomDuty] [numeric] (18,2) NULL,
[ioSTHandling] [numeric] (18,2) NULL,
[ioSTServiceCharge] [numeric] (18,2) NULL,
[ioSTCustomPer] [numeric] (18,2) NULL,
[ioSTServicePer] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsInvoiceSubItemDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsInvoiceSubItemDetail](
[isdShopid] [int] NOT NULL,
[isdinvoiceid] [int] NOT NULL,
[isditemid] [int] NOT NULL,
[isdsubitemid] [int] NOT NULL,
[isdpackingtypeid] [int] NOT NULL,
[isdpquantity] [numeric] (18,3) NULL,
[isdquantity] [numeric] (18,3) NULL,
[isdunitprice] [numeric] (18,2) NULL,
[isdamount] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losinvpartsreplacedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losinvpartsreplacedetails](
[repinvcompanyid] [int] NOT NULL,
[repinvdpartsid] [int] NOT NULL,
[repinvdshopid] [int] NOT NULL,
[repinvinvoiceid] [int] NOT NULL,
[repinvdrate] [numeric] (18,8) NULL,
[repinvdsellrate] [numeric] (18,8) NULL,
[repinvdqty] [numeric] (18,3) NULL,
[repinvreplfromsupp] [bit] NULL,
[repinvdguarantee] [bit] NULL,
[repinvdcostprice] [numeric] (18,8) NULL,
[repinvdcomments] [varchar] (250) NULL,
[repinvpackid] [int] NULL,
[repinvpackqty] [numeric] (18,8) NULL,
[repinvdetailid] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[repinvdType] [varchar] (10) NULL,
[repinvdSerialNo] [varchar] (100) NULL,
[repinvdItemTaxPercentage] [numeric] (18,2) NULL,
[repinvdItemTaxAmount] [numeric] (18,8) NULL,
[repinvdItemTaxCategory] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losinvservicedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losinvservicedetails](
[serinvdcompanyid] [int] NOT NULL,
[serinvdinvoiceid] [int] NOT NULL,
[serinvdshopid] [int] NOT NULL,
[serinvdserviceid] [int] NOT NULL,
[serinvdcharge] [numeric] (18,8) NULL,
[serinvdchargetaken] [numeric] (18,8) NULL,
[serinvdcomments] [varchar] (250) NULL,
[serinvdqty] [numeric] (18,2) NULL,
[serinvddetailid] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[serinvdType] [char] (2) NULL,
[serinvdItemTaxPercentage] [numeric] (18,2) NULL,
[serinvdItemTaxAmount] [numeric] (18,8) NULL,
[serinvdItemTaxCategory] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosIssuedby]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosIssuedby](
[Issuedid] [int] NULL,
[Issuedby] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losJobType]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losJobType](
[TypeId] [int] NOT NULL,
[TypeName] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosKegReturnDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosKegReturnDetail](
[krDReturnNoteID] [int] NOT NULL,
[krDItemID] [int] NOT NULL,
[krDShopid] [int] NOT NULL,
[krDInvoiceId] [int] NOT NULL,
[krDQuantity] [numeric] (18,3) NULL,
[krDDamaged] [bit] NOT NULL,
[krDRemarks] [varchar] (250) NULL,
[krdCostPrice] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosKegReturnHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosKegReturnHeader](
[krhShopid] [int] NOT NULL,
[krhKegReturnID] [int] NOT NULL,
[krhKegReturnNO] [varchar] (50) NOT NULL,
[krhKegReturnDate] [datetime] NOT NULL,
[krhCustomerID] [int] NOT NULL,
[krhRemarks] [varchar] (250) NULL,
[krhCancel] [bit] NOT NULL,
[krhCancelledRemarks] [varchar] (250) NULL,
[krCompanyID] [int] NULL,
[krhDepartmentid] [int] NULL,
[updatetime] [datetime] NOT NULL,
[krhExchangeRates] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losLocalClearenceRequestDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losLocalClearenceRequestDetail](
[ShopID] [int] NOT NULL,
[ClearenceReqID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[ItemDescription] [varchar] (250) NULL,
[Unit] [varchar] (25) NULL,
[Qty] [numeric] (18,3) NULL,
[Amount] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL,
[NoofPackages] [numeric] (18,2) NULL,
[Packing] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losLocalClearenceRequestHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losLocalClearenceRequestHeader](
[ShopID] [int] NOT NULL,
[ClearenceReqID] [int] NOT NULL,
[ClearenceReqNo] [varchar] (50) NOT NULL,
[ClearenceReqDate] [datetime] NULL,
[CustomerID] [int] NULL,
[VendorID] [int] NULL,
[PONo] [varchar] (50) NULL,
[PODate] [datetime] NULL,
[DeliveryTo] [varchar] (250) NULL,
[DeliveryDate] [datetime] NULL,
[EnteredBy] [varchar] (50) NULL,
[Remarks] [varchar] (250) NULL,
[CashorCredit] [bit] NOT NULL,
[CashPaidByShop] [bit] NOT NULL,
[Cancelled] [bit] NULL,
[CancelledRemarks] [varchar] (250) NULL,
[VendorName] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosLocalPurchaseDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosLocalPurchaseDetail](
[lpdShopID] [int] NOT NULL,
[lpdBillID] [int] NOT NULL,
[lpdItemID] [int] NOT NULL,
[lpdPOQuantity] [numeric] (18,3) NULL,
[lpdPOUnitPrice] [numeric] (18,8) NULL,
[lpdItemQuantity] [numeric] (18,3) NULL,
[lpdItemUnitPrice] [numeric] (18,8) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[lpdItemActualAmount] [numeric] (18,8) NULL,
[lpdItemTaxPercentage] [numeric] (18,2) NULL,
[lpdItemTaxAmount] [numeric] (18,8) NULL,
[lpdItemTaxCategory] [int] NULL,
[lpdpackid] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosLocalPurchaseHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosLocalPurchaseHeader](
[lphShopID] [int] NOT NULL,
[lphBillID] [int] NOT NULL,
[lphBillNo] [varchar] (50) NULL,
[lphVendorBillNo] [varchar] (50) NULL,
[lphBillDate] [datetime] NULL,
[lphPOID] [int] NULL,
[lphBillAmount] [numeric] (18,2) NULL,
[lphDiscount] [numeric] (18,2) NULL,
[lphDiscountAccID] [int] NULL,
[lphDueDateforPayment] [datetime] NULL,
[lphBankcashAccID] [int] NULL,
[lphChequeNo] [varchar] (25) NULL,
[lphFinancialID] [int] NULL,
[lphDepartmentID] [int] NULL,
[lphRemarks] [varchar] (100) NULL,
[lphCashPurchase] [bit] NOT NULL,
[lphExchangeNature] [varchar] (5) NULL,
[lphCancelled] [bit] NOT NULL,
[lphCancelledRemarks] [varchar] (250) NULL,
[lphPosted] [bit] NOT NULL,
[lphRecAddUser] [varchar] (50) NULL,
[lphRecModifyUser] [varchar] (50) NULL,
[lphCompanyID] [int] NULL,
[lphUsed] [bit] NOT NULL,
[lphVendorID] [int] NULL,
[lphPurchaseAccID] [int] NULL,
[lphAdjustmentAmount] [numeric] (18,2) NULL,
[lphSettled] [bit] NOT NULL,
[lphexchangerate] [numeric] (18,8) NULL,
[lphcbid] [int] NULL,
[lphcosted] [bit] NOT NULL,
[lphfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[lphdepexrate] [numeric] (18,8) NULL,
[lphexchangerates] [varchar] (250) NULL,
[lphBillTime] [datetime] NULL,
[lphVendorInvoiceNo] [varchar] (50) NULL,
[lphConfirmed] [bit] NOT NULL,
[lphUserID] [int] NULL,
[lphExcludeGST] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsLocalPurchaseOC]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsLocalPurchaseOC](
[lpoShopID] [int] NOT NULL,
[lpoBillID] [int] NOT NULL,
[lpoAccID] [int] NOT NULL,
[lpoDescription] [varchar] (50) NULL,
[lpoAmount] [numeric] (18,2) NULL,
[lpoCompanyID] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loslocation]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loslocation](
[lshopiD] [int] NOT NULL,
[lLocationID] [int] NOT NULL,
[lLocationCode] [varchar] (50) NULL,
[lLocationName] [varchar] (250) NULL,
[lgroupid] [int] NOT NULL,
[lcompanyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loslocationarrivaldetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loslocationarrivaldetails](
[ladinterfaceid] [int] NOT NULL,
[ladshopid] [int] NOT NULL,
[ladtransid] [int] NOT NULL,
[laddetailid] [int] NOT NULL,
[ladlocationid] [int] NULL,
[laditemid] [int] NULL,
[laditemqty] [numeric] (18,3) NULL,
[ladpackingtypeid] [int] NULL,
[ladpakingqty] [numeric] (18,3) NULL,
[ladcancel] [bit] NOT NULL,
[ladadjustment] [bit] NOT NULL,
[ladfreeqty] [numeric] (18,3) NULL,
[ladconfirmed] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LoslocationGroup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LoslocationGroup](
[Lgcompanyid] [int] NOT NULL,
[Lggroupid] [int] NOT NULL,
[Lgshopid] [int] NOT NULL,
[LgGroupName] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loslocationissuedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[loslocationissuedetails](
[lidinterfaceid] [int] NOT NULL,
[lidshopid] [int] NOT NULL,
[lidtransid] [int] NOT NULL,
[liddetailid] [int] NOT NULL,
[lidlocationid] [int] NULL,
[liditemid] [int] NULL,
[liditemqty] [numeric] (18,3) NULL,
[lidpackingtypeid] [int] NULL,
[lidpakingqty] [numeric] (18,3) NULL,
[lidcancel] [bit] NOT NULL,
[lidadjustment] [bit] NOT NULL,
[lidfreeqty] [numeric] (18,3) NULL,
[lidconfirmed] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losLocationVerificationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losLocationVerificationDetail](
[lvdid] [int] NOT NULL,
[lvdShipmentID] [int] NOT NULL,
[lvditemid] [int] NOT NULL,
[lvdShopid] [int] NOT NULL,
[lvdAvailStock] [numeric] (18,3) NULL,
[lvdVerifiedStock] [numeric] (18,3) NULL,
[lvdcostprice] [numeric] (18,3) NULL,
[lvdPrevLocationID] [int] NULL,
[lvdVerifiedLocationID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losLocationVerificationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losLocationVerificationHeader](
[lvhID] [int] NOT NULL,
[lvhShopID] [int] NOT NULL,
[lvhNo] [varchar] (50) NULL,
[lvhDate] [datetime] NULL,
[lvhRemarks] [varchar] (250) NULL,
[lvhVerifiedBy] [varchar] (100) NULL,
[lvhCancelled] [bit] NOT NULL,
[lvhCancelRemarks] [varchar] (100) NULL,
[lvhfuturevc] [varchar] (250) NULL,
[lvhposted] [bit] NOT NULL,
[updatetime] [datetime] NULL,
[lvhdepartmentid] [int] NULL,
[lvhconexrate] [numeric] (18,8) NULL,
[lvhdepexrate] [numeric] (18,8) NULL,
[lvhexchangerates] [varchar] (250) NULL,
[lvhrecaddUser] [varchar] (250) NULL,
[lvhrecmodUser] [varchar] (250) NULL,
[lvhTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losLPDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losLPDetail](
[ShopID] [int] NOT NULL,
[POID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[ItemDescription] [varchar] (250) NULL,
[Unit] [varchar] (25) NULL,
[Qty] [numeric] (18,3) NULL,
[Amount] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL,
[Packing] [varchar] (50) NULL,
[NoofPackages] [numeric] (18,2) NULL,
[ClrReqDetID] [int] NULL,
[status] [char] (1) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losLPHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losLPHeader](
[ShopID] [int] NOT NULL,
[POID] [int] NOT NULL,
[PONo] [varchar] (50) NOT NULL,
[PODate] [datetime] NULL,
[CustomerID] [int] NULL,
[VendorID] [int] NULL,
[ClearenceReqID] [int] NULL,
[EnteredBy] [varchar] (50) NULL,
[Remarks] [varchar] (250) NULL,
[CashorCredit] [bit] NOT NULL,
[CashPaidByShop] [bit] NOT NULL,
[Cancelled] [bit] NULL,
[CancelledRemarks] [varchar] (250) NULL,
[vendorname] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosMergeDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosMergeDetails](
[lsdID] [int] NOT NULL,
[lsdCompanyID] [int] NOT NULL,
[lsdShopID] [int] NOT NULL,
[lsdItemID] [int] NULL,
[lsdQty] [numeric] (18,3) NULL,
[lsdDetailID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosMergeHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosMergeHeader](
[lshID] [int] NOT NULL,
[lshCompanyID] [int] NOT NULL,
[lshShopID] [int] NOT NULL,
[lshNo] [varchar] (50) NULL,
[lshDate] [datetime] NULL,
[lshRefMergeID] [int] NULL,
[lshItemID] [int] NULL,
[lshTransFinished] [bit] NULL,
[lshCancelled] [bit] NULL,
[lshUpdatetime] [datetime] NULL,
[lshNoofRec] [int] NULL,
[lshQty] [numeric] (18,3) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losNonRestrictedItems]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losNonRestrictedItems](
[NorItemID] [int] NOT NULL,
[Norshopid] [int] NOT NULL,
[nortype] [char] (1) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosPackingListDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosPackingListDetail](
[PldShopId] [int] NULL,
[PldId] [int] NULL,
[PldDetailId] [int] NULL,
[PldMarks] [varchar] (50) NULL,
[PldPacking] [varchar] (50) NULL,
[PldDescription] [varchar] (250) NULL,
[PldSize] [varchar] (50) NULL,
[PldWeight] [varchar] (50) NULL,
[PldQty] [varchar] (50) NULL,
[PldOrgin] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosPackingListHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosPackingListHeader](
[plhShopId] [int] NOT NULL,
[plhPackListId] [int] NOT NULL,
[plhNo] [varchar] (50) NULL,
[plhDate] [datetime] NULL,
[plhExportId] [int] NULL,
[plhConsigneeAdress] [varchar] (250) NULL,
[plhOtherRefNo] [varchar] (50) NULL,
[plhExporterRefNo] [varchar] (50) NULL,
[plhPreCarriageBy] [varchar] (50) NULL,
[plhPlaceofReceipt] [varchar] (50) NULL,
[plhVessalNo] [varchar] (50) NULL,
[plhVoyageNo] [varchar] (50) NULL,
[plhPortOfLoading] [varchar] (50) NULL,
[plhPortOfDisCharge] [varchar] (50) NULL,
[plhFinalDest] [varchar] (50) NULL,
[plhTotalPacks] [varchar] (50) NULL,
[plhTotalVolume] [varchar] (50) NULL,
[plhTotalWeight] [varchar] (50) NULL,
[plhTerms] [varchar] (50) NULL,
[plhRemarks] [varchar] (250) NULL,
[plhCancelled] [int] NULL,
[plhCancelledRemarks] [varchar] (250) NULL,
[plhExporterAddress] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPaymentVoucherDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPaymentVoucherDetails](
[pdPaymentVoucherID] [int] NOT NULL,
[pdPaymentID] [int] NOT NULL,
[pdShopID] [int] NOT NULL,
[pdBillsID] [int] NOT NULL,
[pdPaidAmount] [numeric] (18,2) NULL,
[pdDuePeriod] [smallint] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPaymentVoucherHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPaymentVoucherHeader](
[phPaymentID] [int] NOT NULL,
[phShopID] [int] NOT NULL,
[phCompanyID] [int] NOT NULL,
[phPaymentNo] [varchar] (50) NOT NULL,
[phPaymentDate] [datetime] NOT NULL,
[phRemarks] [varchar] (250) NULL,
[phBankCashID] [int] NULL,
[phPayee] [varchar] (50) NULL,
[phVendorID] [int] NULL,
[phDepartmentID] [int] NULL,
[phCustomerID] [int] NULL,
[phChequeDetails] [varchar] (50) NULL,
[phPosted] [bit] NOT NULL,
[phCancelled] [bit] NOT NULL,
[phCancelledRemarks] [varchar] (250) NULL,
[phAmount] [numeric] (18,2) NULL,
[phFinancialID] [int] NULL,
[phExchangeNature] [varchar] (50) NULL,
[phcbreferenceno] [varchar] (50) NULL,
[phExchangeRate] [numeric] (18,8) NULL,
[phcustomeramount] [numeric] (18,2) NULL,
[phdebitaccountid] [int] NULL,
[phdebitamount] [numeric] (18,2) NULL,
[phchequedate] [datetime] NULL,
[phcbid] [int] NULL,
[phfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[phdepexrate] [numeric] (18,8) NULL,
[phexchangerates] [varchar] (250) NULL,
[phUserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losPosChequeDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losPosChequeDetails](
[PosChequeId] [int] NOT NULL,
[PoshBillID] [int] NOT NULL,
[PoshShopID] [int] NOT NULL,
[PosBankId] [int] NOT NULL,
[PosBankChequeNo] [varchar] (50) NULL,
[PosBankChequeDate] [datetime] NOT NULL,
[PosBankAmount] [numeric] (18,2) NOT NULL,
[PosChequeUsed] [bit] NOT NULL,
[posCompExRate] [numeric] (18,0) NULL,
[posDeptExRate] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPosDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPosDetail](
[posdShopID] [int] NOT NULL,
[posdBillID] [int] NOT NULL,
[posdItemID] [int] NOT NULL,
[posdPackingTypeID] [int] NOT NULL,
[posdPUnitID] [int] NULL,
[posdPQuantity] [numeric] (18,3) NULL,
[posdQuantity] [numeric] (18,3) NULL,
[posdUnitPrice] [numeric] (18,8) NULL,
[posdRateType] [int] NOT NULL,
[posdActualUnitPrice] [numeric] (18,2) NULL,
[posdcostprice] [numeric] (18,2) NULL,
[posddescription] [varchar] (250) NULL,
[posdblockprice] [numeric] (18,2) NULL,
[posdguarantee] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[posdSerialNo] [varchar] (250) NULL,
[posdFreeQuantity] [numeric] (18,3) NULL,
[posdItemSerialNo] [int] NULL,
[posdKitID] [int] NOT NULL,
[posdKitQuantity] [numeric] (18,2) NULL,
[posdKitActualPrice] [numeric] (18,2) NULL,
[posdServWarrantyUpto] [datetime] NULL,
[posdPartsWarrantyUpto] [datetime] NULL,
[posdItemTaxPercentage] [numeric] (18,2) NULL,
[posdItemTaxAmount] [numeric] (18,8) NULL,
[posdItemTaxCategory] [int] NULL,
[posdBillDetailID] [int] NULL,
[posdItemType] [varchar] (10) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPosdummyDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPosdummyDetail](
[posdShopID] [int] NOT NULL,
[posdBillID] [int] NOT NULL,
[posdItemID] [int] NOT NULL,
[posdPackingTypeID] [int] NOT NULL,
[posdPUnitID] [int] NULL,
[posdPQuantity] [numeric] (18,3) NULL,
[posdQuantity] [numeric] (18,3) NULL,
[posdUnitPrice] [numeric] (18,8) NULL,
[posdRateType] [int] NOT NULL,
[posdActualUnitPrice] [numeric] (18,2) NULL,
[posdcostprice] [numeric] (18,2) NULL,
[posddescription] [varchar] (250) NULL,
[posdblockprice] [numeric] (18,2) NULL,
[posdguarantee] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[posdSerialNo] [varchar] (250) NULL,
[posdFreeQuantity] [numeric] (18,3) NULL,
[posdItemSerialNo] [int] NULL,
[posdItemTaxPercentage] [numeric] (18,8) NULL,
[posdItemTaxAmount] [numeric] (18,8) NULL,
[posdItemTaxCategory] [int] NULL,
[posdBillDetailID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPosdummyHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPosdummyHeader](
[poshShopID] [int] NOT NULL,
[poshBillID] [int] NOT NULL,
[poshBillNo] [varchar] (50) NULL,
[poshBillDate] [datetime] NULL,
[poshCustomerName] [varchar] (100) NULL,
[poshCancelled] [bit] NOT NULL,
[poshCancelledRemarks] [varchar] (250) NULL,
[poshRecAddUser] [varchar] (50) NULL,
[poshRecModifyUser] [varchar] (50) NULL,
[poshPosted] [bit] NOT NULL,
[poshDiscount] [numeric] (18,2) NULL,
[poshBillAmount] [numeric] (18,2) NULL,
[poshCashAccID] [int] NULL,
[poshSalesAccID] [int] NULL,
[poshCompanyID] [int] NULL,
[poshReturned] [bit] NOT NULL,
[poshWholesale] [bit] NOT NULL,
[poshcbid] [int] NULL,
[poshExchangeRate] [numeric] (28,8) NOT NULL,
[poshfuturevc] [varchar] (250) NULL,
[updatetime] [datetime] NOT NULL,
[poshDepartmentid] [int] NULL,
[poshsalespersonid] [int] NULL,
[poshcustomerid] [int] NULL,
[poshCustomerCardNo] [varchar] (100) NULL,
[poshfutureint] [int] NULL,
[poshcurexrates] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[poshdepexrate] [numeric] (18,8) NULL,
[poshexchangerates] [varchar] (250) NULL,
[poshUserId] [int] NULL,
[poshCounterId] [int] NULL,
[ContactCardNo] [varchar] (50) NULL,
[poshDiscountAmt] [numeric] (18,2) NULL,
[poshBalance] [numeric] (18,2) NULL,
[poshBillTime] [datetime] NULL,
[poshbilled] [int] NULL,
[poshconfirmed] [int] NULL,
[poshBilledId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losposExchangeDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losposExchangeDetail](
[sedShopID] [int] NOT NULL,
[sedExchangeID] [int] NOT NULL,
[sedExchangedetailID] [int] NOT NULL,
[sedItemID] [int] NOT NULL,
[sedPackingTypeID] [int] NOT NULL,
[sedPUnitID] [int] NULL,
[sedPQuantity] [numeric] (18,3) NULL,
[sedQuantity] [numeric] (18,3) NULL,
[sedUnitPrice] [numeric] (18,2) NULL,
[sedActualUnitPrice] [numeric] (18,2) NULL,
[sedExchangePQty] [numeric] (18,2) NULL,
[sedExchangeQty] [numeric] (18,2) NULL,
[sedRateType] [int] NOT NULL,
[sedBillorExchange] [char] (1) NULL,
[sedcostprice] [numeric] (18,2) NULL,
[sedblockprice] [numeric] (18,2) NULL,
[sedguarantee] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[sedSerialNo] [varchar] (50) NULL,
[sedFreeQty] [numeric] (18,3) NULL,
[sedExcFreeQty] [numeric] (18,3) NULL,
[sedItemTaxPercentage] [numeric] (18,2) NULL,
[sedItemTaxAmount] [numeric] (18,2) NULL,
[sedItemTaxCategory] [int] NULL,
[SedServWarrantyUpto] [datetime] NULL,
[SedPartsWarrantyUpto] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losposExchangeHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losposExchangeHeader](
[sehShopID] [int] NOT NULL,
[sehExchangeID] [int] NOT NULL,
[sehExchangeNo] [varchar] (50) NULL,
[sehExchangeDate] [datetime] NULL,
[sehExchangerName] [varchar] (100) NULL,
[sehBillID] [int] NULL,
[sehDiscount] [numeric] (18,2) NULL,
[sehBillAmount] [numeric] (18,2) NULL,
[sehExchangeBillAmount] [numeric] (18,2) NULL,
[sehRemarks] [varchar] (250) NULL,
[sehCancelled] [bit] NOT NULL,
[sehCancelledRemarks] [varchar] (250) NULL,
[sehPosted] [bit] NOT NULL,
[sehRecAddUser] [varchar] (50) NULL,
[sehRecModifyUser] [varchar] (50) NULL,
[sehCashAccID] [int] NULL,
[sehSalesAccID] [int] NULL,
[sehCompanyID] [int] NULL,
[sehFullyReturned] [bit] NOT NULL,
[sehwholesale] [bit] NOT NULL,
[sehcbid] [int] NULL,
[sehExchangeRate] [numeric] (28,8) NOT NULL,
[sehfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[sehExchangedBillID] [int] NULL,
[sehDepartmentID] [int] NULL,
[sehsalespersonid] [int] NULL,
[sehCustomerCardNo] [varchar] (100) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[sehdepexrate] [numeric] (18,8) NULL,
[sehexchangerates] [varchar] (250) NULL,
[sehTime] [datetime] NULL,
[sehUserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losposExchangeOtherCharges]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losposExchangeOtherCharges](
[seoShopID] [int] NOT NULL,
[seoExchangeID] [int] NOT NULL,
[seoAccID] [int] NOT NULL,
[seoDescription] [varchar] (250) NULL,
[seoAmount] [numeric] (18,2) NULL,
[seoCompanyID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losposExchangeSubItemDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losposExchangeSubItemDetails](
[seidShopID] [int] NOT NULL,
[seidExchangeID] [int] NOT NULL,
[seidExchangeDetailID] [int] NOT NULL,
[seidItemID] [int] NOT NULL,
[seidSubItemID] [int] NOT NULL,
[seidPackingTypeID] [int] NOT NULL,
[seidPQuantity] [numeric] (18,3) NULL,
[seidQuantity] [numeric] (18,3) NULL,
[seidUnitPrice] [numeric] (18,2) NULL,
[seidAmount] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosPosFAndBHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosPosFAndBHeader](
[poshShopID] [int] NOT NULL,
[poshBillID] [int] NOT NULL,
[poshBillNo] [varchar] (50) NULL,
[poshBillDate] [datetime] NULL,
[poshCustomerName] [varchar] (100) NULL,
[poshCancelled] [bit] NOT NULL,
[poshCancelledRemarks] [varchar] (250) NULL,
[poshRecAddUser] [varchar] (50) NULL,
[poshRecModifyUser] [varchar] (50) NULL,
[poshPosted] [bit] NOT NULL,
[poshDiscount] [decimal] (18,2) NULL,
[poshBillAmount] [decimal] (18,4) NULL,
[poshCashAccID] [int] NULL,
[poshSalesAccID] [int] NULL,
[poshCompanyID] [int] NULL,
[poshReturned] [bit] NOT NULL,
[poshWholesale] [bit] NOT NULL,
[poshcbid] [int] NULL,
[poshExchangeRate] [decimal] (28,8) NOT NULL,
[poshfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[poshDepartmentid] [int] NULL,
[poshsalespersonid] [int] NULL,
[poshCustomerCardNo] [varchar] (100) NULL,
[poshbillorprocess] [char] (5) NULL,
[poshfutureint] [int] NULL,
[poshtableid] [int] NULL,
[poshemployeeid] [int] NULL,
[poshdiscid] [int] NULL,
[poshdiscper] [decimal] (18,2) NULL,
[poshservicechargeid] [int] NULL,
[poshservicechargeper] [decimal] (18,2) NULL,
[poshtaxaccid] [int] NULL,
[poshcentraltaxaccid] [int] NULL,
[poshtaxper] [decimal] (18,2) NULL,
[poshcustomerid] [int] NULL,
[poshcustdiscount] [decimal] (18,2) NULL,
[roomdetailid] [int] NULL,
[poshgbillno] [varchar] (50) NULL,
[poshgbilldate] [datetime] NULL,
[Billedto] [varchar] (250) NULL,
[receipted] [bit] NOT NULL,
[poshfolioid] [int] NULL,
[salesbillbit] [bit] NOT NULL,
[poshremarks] [varchar] (250) NULL,
[poshcash] [bit] NOT NULL,
[complimentary] [int] NULL,
[poshCreditCardNo] [varchar] (100) NULL,
[PoshBuffetBit] [bit] NULL,
[PoshMealnameid] [int] NULL,
[poshgBillUser] [varchar] (50) NULL,
[poshtelephone] [bit] NULL,
[cashreceiptid] [int] NULL,
[poshmiscbillrefno] [int] NULL,
[closebill] [bit] NULL,
[poshservicecharge] [numeric] (18,2) NULL,
[poshAccAuditid] [int] NULL,
[poshSettled] [int] NULL,
[PoshStatus] [varchar] (50) NULL,
[poshtips] [decimal] (8,2) NULL,
[poshBillType] [varchar] (50) NULL,
[PoshBillCount] [int] NULL,
[poshGrossTotal] [numeric] (8,2) NULL,
[poshServiceID] [int] NULL,
[poshDishTakenPax] [int] NULL,
[poshCashSale] [int] NULL,
[poshexchangerates] [varchar] (250) NOT NULL,
[poshdepexrate] [numeric] (18,8) NOT NULL,
[poshvoucherid] [int] NULL,
[poshCurrencyID] [int] NULL,
[poshRateType] [int] NULL,
[poshFinancialId] [int] NULL,
[poshFlightID] [int] NULL,
[poshTillID] [int] NULL,
[poshFlightOpID] [int] NULL,
[poshTillHistID] [int] NULL,
[poshUserID] [int] NULL,
[poshVoucherAmt] [decimal] (18,2) NULL,
[PoshCounterID] [int] NULL,
[poshSegID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPosHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPosHeader](
[poshShopID] [int] NOT NULL,
[poshBillID] [int] NOT NULL,
[poshBillNo] [varchar] (50) NULL,
[poshBillDate] [datetime] NULL,
[poshCustomerName] [varchar] (100) NULL,
[poshCancelled] [bit] NOT NULL,
[poshCancelledRemarks] [varchar] (250) NULL,
[poshRecAddUser] [varchar] (50) NULL,
[poshRecModifyUser] [varchar] (50) NULL,
[poshPosted] [bit] NOT NULL,
[poshDiscount] [numeric] (18,2) NULL,
[poshBillAmount] [numeric] (18,2) NULL,
[poshCashAccID] [int] NULL,
[poshSalesAccID] [int] NULL,
[poshCompanyID] [int] NULL,
[poshReturned] [bit] NOT NULL,
[poshWholesale] [bit] NOT NULL,
[poshcbid] [int] NULL,
[poshExchangeRate] [numeric] (28,8) NOT NULL,
[poshfuturevc] [varchar] (250) NULL,
[updatetime] [datetime] NOT NULL,
[poshDepartmentid] [int] NULL,
[poshsalespersonid] [int] NULL,
[poshcustomerid] [int] NULL,
[poshCustomerCardNo] [varchar] (100) NULL,
[poshfutureint] [int] NULL,
[poshcurexrates] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[poshdepexrate] [numeric] (18,8) NULL,
[poshexchangerates] [varchar] (250) NULL,
[poshUserId] [int] NULL,
[poshCounterId] [int] NULL,
[ContactCardNo] [varchar] (50) NULL,
[poshDiscountAmt] [numeric] (18,2) NULL,
[poshBalance] [numeric] (18,2) NULL,
[poshBillTime] [datetime] NULL,
[poshDeliveryNeeded] [int] NULL,
[poshChequeAccID] [int] NULL,
[PosPostDate] [bit] NULL,
[poshModifyUserId] [int] NULL,
[poshCustomerTIN] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losPosHeaderLastBillNo]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losPosHeaderLastBillNo](
[ShopId] [int] NULL,
[LastBillNo] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPosOthercharges]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPosOthercharges](
[posoShopID] [int] NOT NULL,
[posoBillID] [int] NOT NULL,
[posoAccID] [int] NOT NULL,
[posoDescription] [varchar] (250) NULL,
[posoAmount] [numeric] (18,2) NULL,
[posoCompanyID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPosSubItemDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPosSubItemDetail](
[posidshopid] [int] NOT NULL,
[posidbillid] [int] NOT NULL,
[posiditemid] [int] NOT NULL,
[posidsubitemid] [int] NOT NULL,
[posidpackingtypeid] [int] NOT NULL,
[posidpquantity] [numeric] (18,3) NULL,
[posidquantity] [numeric] (18,3) NULL,
[posidunitprice] [numeric] (18,2) NULL,
[posidamount] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losposWarDet]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losposWarDet](
[WDCompanyID] [int] NOT NULL,
[WDShopID] [int] NOT NULL,
[WDBillId] [int] NOT NULL,
[WDItemId] [int] NOT NULL,
[WDSerialNo] [varchar] (100) NOT NULL,
[WDSerMonths] [int] NOT NULL,
[WDPartMonths] [int] NOT NULL,
[WDDesc] [varchar] (100) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOspPurchaseBillDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOspPurchaseBillDetail](
[pbdBillID] [int] NOT NULL,
[pbdItemID] [int] NOT NULL,
[pbdDetailID] [int] NOT NULL,
[pbdPackingTypeID] [int] NULL,
[pbdPOQuantity] [numeric] (18,3) NULL,
[pbdPOUnitPrice] [numeric] (18,8) NULL,
[pbdItemQuantity] [numeric] (18,3) NULL,
[pbdItemUnitPrice] [numeric] (28,16) NULL,
[pbdDummyUnitPrice] [numeric] (28,16) NULL,
[pbdItemCostedPrice] [numeric] (18,8) NULL,
[pbdItemFixedPrice] [numeric] (18,8) NULL,
[pbddiscount] [numeric] (18,2) NULL,
[pbdpoid] [int] NULL,
[pbdsellingprice] [numeric] (18,2) NULL,
[pbdwholesaleprice] [numeric] (18,2) NULL,
[pbddiscountprice] [numeric] (18,2) NULL,
[pbdbatchno] [varchar] (50) NULL,
[pbdItemTaxPercentage] [numeric] (18,2) NULL,
[pbdItemTaxAmount] [numeric] (18,2) NULL,
[pbdItemTaxCategory] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOspPurchaseBillHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOspPurchaseBillHeader](
[pbhBillID] [int] NOT NULL,
[pbhBillNo] [varchar] (50) NULL,
[pbhVendorBillNo] [varchar] (50) NULL,
[pbhBillDate] [datetime] NULL,
[pbhVendorID] [int] NULL,
[pbhPOID] [int] NULL,
[pbhBillAmount] [numeric] (18,2) NULL,
[pbhDiscount] [numeric] (18,2) NULL,
[pbhDiscountAccID] [int] NULL,
[pbhAdjustmentAmount] [numeric] (18,2) NULL,
[pbhDueDateforPayment] [datetime] NULL,
[pbhBankCashAccID] [int] NULL,
[pbhChequeNo] [varchar] (25) NULL,
[pbhFinancialID] [int] NULL,
[pbhDepartmentID] [int] NULL,
[pbhRemarks] [varchar] (100) NULL,
[pbhTobeDespatched] [bit] NOT NULL,
[pbhDespatched] [bit] NOT NULL,
[pbhCashPurchase] [bit] NOT NULL,
[pbhExchangeNature] [varchar] (5) NULL,
[pbhCancelled] [bit] NOT NULL,
[pbhCancelledRemarks] [varchar] (250) NULL,
[pbhPosted] [bit] NOT NULL,
[pbhRecAddUser] [varchar] (50) NULL,
[pbhRecModifyUser] [varchar] (50) NULL,
[pbhCompanyID] [int] NULL,
[pbhUsed] [bit] NOT NULL,
[pbhvendorRefNo] [varchar] (50) NULL,
[pbhdummyICost] [numeric] (18,2) NULL,
[pbhdummyFCharge] [numeric] (18,2) NULL,
[pbhdummyOCharge] [numeric] (18,2) NULL,
[pbhCustomExchangeRate] [numeric] (18,8) NULL,
[pbhPurchaseAccID] [int] NULL,
[pbhSettled] [bit] NOT NULL,
[pbhexchangerate] [numeric] (28,22) NULL,
[pbhship] [varchar] (50) NULL,
[pbhportoflading] [varchar] (50) NULL,
[pbhshipdepdate] [datetime] NULL,
[pbhshipdischarge] [varchar] (50) NULL,
[pbhshiparrivaldate] [datetime] NULL,
[pbhfinaldestination] [varchar] (50) NULL,
[updatetime] [datetime] NOT NULL,
[pbhdepexrate] [numeric] (18,8) NULL,
[pbhinvaccexrate] [numeric] (18,8) NULL,
[pbhslndcertno] [varchar] (50) NULL,
[pbhslndcertdate] [varchar] (50) NULL,
[pbhComments] [varchar] (250) NULL,
[pbhexchangerates] [varchar] (250) NULL,
[pbhLcAmount] [numeric] (18,8) NULL,
[pbhBillTime] [datetime] NULL,
[pbhSubDepartmentID] [int] NULL,
[pbhusername] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOspPurchaseBillOC]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOspPurchaseBillOC](
[pboBillID] [int] NOT NULL,
[pboAccID] [int] NOT NULL,
[pboDescription] [varchar] (50) NULL,
[pboCompanyID] [int] NULL,
[pboAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosPriority]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosPriority](
[Priorityid] [int] NOT NULL,
[Priority] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losPurchaseOrderDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losPurchaseOrderDetail](
[podPoid] [int] NOT NULL,
[poditemid] [int] NOT NULL,
[podShopid] [int] NOT NULL,
[podQty] [numeric] (18,3) NULL,
[podUnitPrice] [numeric] (18,8) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[podActualAmt] [numeric] (18,8) NULL,
[podpackid] [int] NULL,
[podItemTaxPercentage] [numeric] (18,2) NULL,
[podItemTaxAmount] [numeric] (18,8) NULL,
[podItemTaxCategory] [int] NULL,
[podpackqty] [numeric] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losPurchaseOrderHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losPurchaseOrderHeader](
[pohPoid] [int] NOT NULL,
[pohShopid] [int] NOT NULL,
[pohpono] [varchar] (50) NOT NULL,
[pohnoSupwise] [varchar] (50) NULL,
[pohPodate] [datetime] NULL,
[pohVendorID] [int] NULL,
[pohSupAddr] [varchar] (250) NULL,
[pohdueDate] [datetime] NULL,
[pohdeliveryaddr] [varchar] (250) NULL,
[pohcancel] [bit] NOT NULL,
[pohcancelremarks] [varchar] (250) NULL,
[pohrecadduser] [varchar] (50) NULL,
[pohrecmoduser] [varchar] (50) NULL,
[pohbillgenerated] [bit] NOT NULL,
[pohremarks] [varchar] (250) NULL,
[pohQuotation] [bit] NOT NULL,
[pohValue] [numeric] (18,2) NULL,
[pogenerated] [bit] NOT NULL,
[pohpogenerated] [bit] NOT NULL,
[pohQuotationid] [int] NULL,
[pohCompanyID] [int] NULL,
[pohExchangeRate] [int] NULL,
[pohfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[pohdepexrate] [numeric] (18,8) NULL,
[pohexchangerates] [varchar] (250) NULL,
[pohdiscount] [numeric] (18,2) NULL,
[pohmodepayment] [varchar] (50) NULL,
[pohTime] [datetime] NULL,
[pohPOclosed] [bit] NOT NULL,
[poHQConfirmed] [int] NOT NULL,
[pohExcludeGST] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPurchaseReturnDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPurchaseReturnDetail](
[wdShopID] [int] NOT NULL,
[WdID] [int] NOT NULL,
[WdItemID] [int] NOT NULL,
[WdShipmentID] [int] NOT NULL,
[WdAvailableQty] [numeric] (18,3) NULL,
[WdPurchaseReturnQty] [numeric] (18,3) NULL,
[wdcostprice] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsPurchaseReturnHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsPurchaseReturnHeader](
[whShopID] [int] NOT NULL,
[WhID] [int] NOT NULL,
[WhNo] [varchar] (50) NULL,
[WhDate] [datetime] NULL,
[WhUserName] [varchar] (50) NULL,
[WhCancelled] [bit] NOT NULL,
[WhCancelledRemarks] [varchar] (250) NULL,
[WhRemarks] [varchar] (250) NULL,
[WhRecAddUser] [varchar] (250) NULL,
[WhRecModifyUser] [varchar] (250) NULL,
[Whfuturevc] [varchar] (250) NOT NULL,
[whposted] [bit] NOT NULL,
[updatetime] [datetime] NOT NULL,
[whdepartmentid] [int] NULL,
[whconexrate] [numeric] (18,8) NULL,
[whdepexrate] [numeric] (18,8) NULL,
[whexchangerates] [varchar] (250) NULL,
[whotherdepid] [int] NULL,
[whreceivedby] [varchar] (100) NULL,
[whauthorisedby] [varchar] (100) NULL,
[whtype] [char] (1) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[whexpenseaccid] [int] NULL,
[whapartmentid] [int] NULL,
[whdoneby] [varchar] (150) NULL,
[whtransfinished] [bit] NULL,
[whselected] [int] NULL,
[whtime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losrebateconfirmdetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losrebateconfirmdetail](
[rcdshopid] [int] NOT NULL,
[rcdapprovedid] [int] NOT NULL,
[rcddetailid] [int] NOT NULL,
[rcditemid] [int] NULL,
[rcdrebateamount] [numeric] (18,2) NULL,
[rcdCostPrice] [numeric] (18,4) NULL,
[rcdQuantity] [numeric] (18,3) NULL,
[rcdUnitPrice] [numeric] (18,4) NULL,
[rcdRebatePer] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losrebateconfirmheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losrebateconfirmheader](
[rcshopid] [int] NOT NULL,
[rcapprovedid] [int] NOT NULL,
[rcapprovedno] [varchar] (50) NULL,
[rcapproveddate] [datetime] NULL,
[rcreqid] [int] NULL,
[rcapprovedby] [varchar] (50) NULL,
[rcremarks] [varchar] (250) NULL,
[rccancelled] [bit] NOT NULL,
[rccancelledremarks] [varchar] (250) NULL,
[rcCustomerSalesMargin] [numeric] (18,2) NULL,
[rcRebatePerson] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losrebaterequest]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losrebaterequest](
[rrshopid] [int] NOT NULL,
[rrreqid] [int] NOT NULL,
[rrreqno] [varchar] (50) NULL,
[rrreqdate] [datetime] NULL,
[rrpoid] [int] NULL,
[rrsalespersonid] [int] NULL,
[rrremarks] [varchar] (250) NULL,
[rrtoapprovebefore] [datetime] NULL,
[rrcancelled] [bit] NOT NULL,
[rrcancelledremarks] [varchar] (250) NULL,
[rrRebatePerson] [varchar] (100) NULL,
[rrreqTIME] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsReceiptVoucherDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsReceiptVoucherDetails](
[rdReceiptDetailID] [int] NOT NULL,
[rdReceiptID] [int] NOT NULL,
[rdShopID] [int] NOT NULL,
[rdAccountsInvoiceID] [int] NULL,
[rdInvoiceID] [int] NULL,
[rdSpecialInvoiceID] [int] NULL,
[rdAmountReceived] [numeric] (18,2) NULL,
[rdDuePeriod] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsReceiptVoucherHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsReceiptVoucherHeader](
[rhReceiptID] [int] NOT NULL,
[rhShopID] [int] NOT NULL,
[rhReceiptNo] [varchar] (50) NOT NULL,
[rhReceiptDate] [datetime] NOT NULL,
[rhCustomerID] [int] NULL,
[rhVendorID] [int] NULL,
[rhDepartmentID] [int] NULL,
[rhBankCashAccountID] [int] NOT NULL,
[rhReceivedFrom] [varchar] (50) NULL,
[rhRemarks] [varchar] (250) NULL,
[rhChequeDetails] [varchar] (250) NULL,
[rhReferenceNo] [varchar] (50) NULL,
[rhReferenceDate] [datetime] NULL,
[rhPosted] [bit] NOT NULL,
[rhCancelled] [bit] NOT NULL,
[rhCancelledRemarks] [varchar] (250) NULL,
[rhAmount] [numeric] (18,2) NULL,
[rhFinancialID] [int] NULL,
[rhExchangeNature] [varchar] (50) NULL,
[rhRecAddUser] [varchar] (50) NULL,
[rhRecModifyUser] [varchar] (50) NULL,
[rhCompanyID] [int] NULL,
[rhcbreferenceno] [varchar] (50) NULL,
[rhExchangeRate] [numeric] (18,8) NULL,
[rhReceiptType] [varchar] (50) NULL,
[rhcustomeramount] [numeric] (18,2) NULL,
[rhdebitaccountid] [int] NULL,
[rhdebitamount] [numeric] (18,2) NULL,
[rhchequedate] [datetime] NULL,
[rhfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosReceivedby]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosReceivedby](
[Receivedid] [int] NULL,
[Receivedby] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losreplacereceivedetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losreplacereceivedetails](
[reprecdid] [int] NOT NULL,
[reprecdcompanyid] [int] NOT NULL,
[reprecdshopid] [int] NOT NULL,
[reprecditemid] [int] NOT NULL,
[reprecdbookid] [int] NOT NULL,
[repRepReqID] [int] NOT NULL,
[reprecqty] [numeric] (18,8) NULL,
[reprecdtagno] [varchar] (50) NULL,
[reprecdcomments] [varchar] (250) NULL,
[repreqdfutureint] [int] NULL,
[repreqdfuturevc] [varchar] (250) NULL,
[repreqdfuturenum] [numeric] (18,8) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losreplacereceiveheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losreplacereceiveheader](
[reprechid] [int] NOT NULL,
[reprechcompanyid] [int] NOT NULL,
[reprechshopid] [int] NOT NULL,
[reprechno] [varchar] (50) NULL,
[reprechdate] [datetime] NULL,
[reprechremarks] [varchar] (250) NULL,
[reprechcancelled] [bit] NOT NULL,
[repreccancelremarks] [varchar] (250) NULL,
[reprecfutureint] [int] NULL,
[reprecfuturevc] [varchar] (250) NULL,
[reprecfuturenum] [numeric] (18,8) NULL,
[reprechupdatetime] [datetime] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[reprechqreceiveid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losreplacerequestdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losreplacerequestdetails](
[repreqdid] [int] NOT NULL,
[repreqdcompanyid] [int] NOT NULL,
[repreqdshopid] [int] NOT NULL,
[repreqditemid] [int] NOT NULL,
[repreqdbookid] [int] NOT NULL,
[repreqqty] [numeric] (18,8) NULL,
[repreqdtagno] [varchar] (50) NULL,
[repreqdcomments] [varchar] (250) NULL,
[repreqdfutureint] [int] NULL,
[repreqdfuturevc] [varchar] (250) NULL,
[repreqdfuturenum] [numeric] (18,8) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losreplacerequestheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losreplacerequestheader](
[repreqhid] [int] NOT NULL,
[repreqhcompanyid] [int] NOT NULL,
[repreqshopid] [int] NOT NULL,
[repreqno] [varchar] (50) NULL,
[repreqhdate] [datetime] NULL,
[repreqhvendorid] [int] NULL,
[repreqhremarks] [varchar] (250) NULL,
[repreqhcancelled] [bit] NOT NULL,
[repreqhdoneby] [varchar] (50) NULL,
[repreqcancelremarks] [varchar] (250) NULL,
[repreqhreceived] [bit] NOT NULL,
[repreqhfutureint] [int] NULL,
[repreqhfuturevc] [varchar] (250) NULL,
[repreqhfuturenum] [numeric] (18,8) NULL,
[repreqhupdatetime] [datetime] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[repreqhtransfinished] [bit] NULL,
[repreqhnoofdetails] [int] NOT NULL,
[repreqhdepartmentid] [int] NULL,
[repreqhTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosReservationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosReservationHeader](
[rhcompanyid] [int] NOT NULL,
[rhshopid] [int] NOT NULL,
[rhreservationid] [int] NOT NULL,
[rhreservationno] [varchar] (50) NULL,
[rhreservationdate] [datetime] NULL,
[rhcustomerid] [int] NULL,
[rhcustomerfirstname] [varchar] (100) NULL,
[rhcustomerlastname] [varchar] (100) NULL,
[rhcustomeraddress1] [varchar] (250) NULL,
[rhcustomeraddress2] [varchar] (250) NULL,
[rhcityid] [int] NULL,
[rhcountryid] [int] NULL,
[rhpassportno] [varchar] (50) NULL,
[rhworkpermitvisano] [varchar] (50) NULL,
[rhvisaexpirydate] [datetime] NULL,
[rharrivaldate] [datetime] NULL,
[rhdeparturedate] [datetime] NULL,
[rhreservationstatus] [char] (1) NULL,
[rhrhreservationconfirmbit] [bit] NULL,
[rhreservationconfirmdate] [datetime] NULL,
[rhcancellationcheck] [bit] NULL,
[rhcancellationdate] [datetime] NULL,
[rhApartmentTypeID] [int] NULL,
[rhNoOFBeds] [int] NULL,
[rhBookingType] [varchar] (50) NULL,
[rhCallAttendedBy] [int] NOT NULL,
[rhExpRent] [numeric] (18,2) NULL,
[rhStayType] [varchar] (50) NULL,
[rhRemarks] [varchar] (250) NULL,
[rhCancelledRemarks] [varchar] (250) NULL,
[rhPPExpiryDate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosReserveItem]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosReserveItem](
[godownid] [int] NOT NULL,
[itemid] [int] NOT NULL,
[locationid] [int] NOT NULL,
[shipmentid] [int] NOT NULL,
[qty] [numeric] (18,3) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losroomdetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losroomdetail](
[rdcompanyid] [int] NOT NULL,
[rdapartmentid] [int] NOT NULL,
[rdshopid] [int] NOT NULL,
[rdroomdetailid] [int] NOT NULL,
[rdroomno] [varchar] (50) NULL,
[rdCapacity] [int] NULL,
[rdremarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerCallBconditiondetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerCallBconditiondetails](
[CallBcndserbookdid] [int] NULL,
[CallBcndserid] [int] NULL,
[CallBcndserdcompanyid] [int] NULL,
[CallBcndserdshopid] [int] NULL,
[CallBcndcomments] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losserconditiondetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losserconditiondetails](
[cndserbookdid] [int] NOT NULL,
[cndserid] [int] NOT NULL,
[cndserdcompanyid] [int] NOT NULL,
[cndserdshopid] [int] NOT NULL,
[cndserbookdcomments] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerestimateapproval]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerestimateapproval](
[seaAppShopId] [int] NOT NULL,
[seaAppId] [int] NOT NULL,
[seaAppcompanyID] [int] NOT NULL,
[seaAppDate] [datetime] NULL,
[seaAppNo] [varchar] (50) NULL,
[seaAppCustomerId] [int] NULL,
[seaAppSershopID] [int] NULL,
[seaAppbookingId] [int] NULL,
[seaApprovedBy] [varchar] (50) NULL,
[seaApporRejected] [bit] NOT NULL,
[seaAppremarks] [varchar] (250) NULL,
[seaAppusername] [varchar] (50) NULL,
[seaAppCancelled] [bit] NOT NULL,
[seaAppCancelremarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerialArrivalDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerialArrivalDetails](
[sadInterfaceID] [int] NOT NULL,
[sadShopID] [int] NOT NULL,
[sadTransactionID] [int] NOT NULL,
[sadDetailID] [int] NOT NULL,
[sadSerialNo] [nvarchar] (50) NOT NULL,
[sadItemID] [int] NOT NULL,
[sadItemQty] [numeric] (10,2) NOT NULL,
[sadPackingTypeID] [int] NOT NULL,
[sadPackingQty] [numeric] (10,2) NOT NULL,
[sadCancel] [int] NOT NULL,
[sadAdjustment] [int] NOT NULL,
[sadFreeQty] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerialIssueDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerialIssueDetails](
[sidInterfaceID] [int] NOT NULL,
[sidShopID] [int] NOT NULL,
[sidTransactionID] [int] NOT NULL,
[sidDetailID] [int] NOT NULL,
[sidSerialNo] [nvarchar] (50) NOT NULL,
[sidItemID] [int] NOT NULL,
[sidItemQty] [numeric] (10,2) NOT NULL,
[sidPackingTypeID] [int] NOT NULL,
[sidPackingQty] [numeric] (10,2) NOT NULL,
[sidCancel] [int] NOT NULL,
[sidAdjustment] [int] NOT NULL,
[sidFreeQty] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerialNoVerificationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerialNoVerificationDetail](
[svdShopID] [int] NULL,
[svdID] [int] NOT NULL,
[svdShipMentID] [int] NOT NULL,
[svdItemID] [int] NULL,
[svdAvlStock] [numeric] (18,0) NULL,
[svdVerifiedStock] [numeric] (18,0) NULL,
[svdCostPrice] [numeric] (18,0) NULL,
[svdPreSerialNo] [nvarchar] (50) NULL,
[svdNewSerialNo] [nvarchar] (50) NULL,
[svdDeleted] [varchar] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerialNoVerificationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerialNoVerificationHeader](
[svhCompanyID] [int] NOT NULL,
[svhShopID] [int] NOT NULL,
[svhID] [int] NOT NULL,
[svhNo] [nvarchar] (50) NOT NULL,
[svhDate] [datetime] NOT NULL,
[svhVerifiedBy] [char] (10) NULL,
[svhRemarks] [nvarchar] (150) NULL,
[svhCancel] [int] NOT NULL,
[svhCancellRemarks] [nvarchar] (150) NULL,
[svhFutureVC] [char] (10) NULL,
[svhUser] [varchar] (50) NULL,
[svhUpdateUser] [char] (10) NULL,
[svhUpdateTime] [datetime] NULL,
[cofirmed] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerMaintenanceContractDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerMaintenanceContractDetail](
[mcdCompanyID] [int] NOT NULL,
[mcdID] [int] NOT NULL,
[mcdShopID] [int] NOT NULL,
[mcdPeriodDetailID] [int] NOT NULL,
[mcdFromDate] [datetime] NOT NULL,
[mcdToDate] [datetime] NOT NULL,
[mcdPrepByID] [int] NOT NULL,
[mcdAmount] [numeric] (18,2) NOT NULL,
[mcdRemarks] [varchar] (250) NULL,
[mcdAlertdays] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerMaintenanceContractHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerMaintenanceContractHeader](
[mchCompanyID] [int] NOT NULL,
[mchID] [int] NOT NULL,
[mchShopID] [int] NOT NULL,
[mchCustomerID] [int] NOT NULL,
[mchNo] [varchar] (50) NOT NULL,
[mchContractRefNo] [varchar] (50) NOT NULL,
[mchCancelled] [bit] NOT NULL,
[mchCancelledDate] [datetime] NULL,
[mchCancelledRemarks] [varchar] (50) NULL,
[mchAccID] [int] NULL,
[mchRemarks] [varchar] (250) NULL,
[mchFuture] [varchar] (250) NULL,
[mchdate] [datetime] NULL,
[mchguarantee] [bit] NULL,
[mchExchangeRates] [varchar] (250) NULL,
[mchDepExrate] [numeric] (18,8) NULL,
[mchExchangeRate] [numeric] (18,8) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerMaintenanceMachineDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerMaintenanceMachineDetail](
[mmdCompanyID] [int] NOT NULL,
[mmdMCID] [int] NOT NULL,
[mmdShopID] [int] NOT NULL,
[mmdDetailID] [int] NOT NULL,
[mmdMachineID] [int] NOT NULL,
[mmdRemarks] [varchar] (250) NOT NULL,
[mmdSerShopid] [int] NULL,
[mmdSerProcessid] [int] NULL,
[mmdSerProcessType] [char] (2) NULL,
[mmdAlertdays] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerMaintenanceServiceDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerMaintenanceServiceDetail](
[msdCompanyID] [int] NOT NULL,
[msdMCID] [int] NOT NULL,
[msdShopID] [int] NOT NULL,
[msdDetailID] [int] NOT NULL,
[msdMachineID] [int] NOT NULL,
[msdServiceID] [int] NOT NULL,
[msdSerPeriod] [int] NULL,
[msdSerRemarks] [varchar] (250) NOT NULL,
[msdSerPeriodType] [char] (1) NULL,
[msdAlertdays] [int] NULL,
[msdAlerttype] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losserpartsfromcustomer]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losserpartsfromcustomer](
[custprodcompanyid] [int] NOT NULL,
[custprodshopid] [int] NOT NULL,
[custprodbookingid] [int] NOT NULL,
[custprodproductid] [int] NOT NULL,
[custprodname] [varchar] (50) NULL,
[custprodqty] [numeric] (18,3) NULL,
[custprodcomments] [varchar] (250) NULL,
[custprodusedqty] [numeric] (18,3) NULL,
[custprodusecomments] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerStandByIssueDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerStandByIssueDetail](
[isdCompanyID] [int] NOT NULL,
[isdIssueID] [int] NOT NULL,
[isdShopID] [int] NOT NULL,
[isdDetailID] [int] NOT NULL,
[isdMachineID] [int] NOT NULL,
[isdQuantity] [numeric] (18,2) NOT NULL,
[isdRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerStandByIssueHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerStandByIssueHeader](
[ishCompanyID] [int] NOT NULL,
[ishIssueID] [int] NOT NULL,
[ishShopID] [int] NOT NULL,
[ishRequestID] [int] NOT NULL,
[ishIssueNo] [varchar] (50) NOT NULL,
[ishDate] [datetime] NOT NULL,
[ishIssuedByID] [int] NOT NULL,
[ishInstallDate] [datetime] NOT NULL,
[ishTechnicianID] [int] NOT NULL,
[ishConfirmed] [char] (10) NOT NULL,
[ishUpdateTime] [datetime] NULL,
[ishCancelled] [bit] NOT NULL,
[ishCancelledRemarks] [varchar] (250) NULL,
[ishRemarks] [varchar] (250) NOT NULL,
[ishFuture] [varchar] (250) NULL,
[ishType] [char] (1) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerStandByReceiptDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerStandByReceiptDetail](
[rdCompanyID] [int] NOT NULL,
[rdReceiptID] [int] NOT NULL,
[rdShopID] [int] NOT NULL,
[rdDetailID] [int] NOT NULL,
[rdMachineID] [int] NOT NULL,
[rdQuantity] [numeric] (18,2) NOT NULL,
[rdRemarks] [varchar] (250) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerStandByReceiptHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerStandByReceiptHeader](
[rhCompanyID] [int] NOT NULL,
[rhShopID] [int] NOT NULL,
[rhReceiptID] [int] NOT NULL,
[rhReceiptNo] [varchar] (50) NOT NULL,
[rhDate] [datetime] NOT NULL,
[rhIssueID] [int] NOT NULL,
[rhReceivedByID] [int] NOT NULL,
[rhCancelled] [bit] NOT NULL,
[rhCancelledRemarks] [varchar] (250) NOT NULL,
[rhRemarks] [varchar] (250) NOT NULL,
[rhUpdateTime] [datetime] NOT NULL,
[rhFuture] [varchar] (250) NULL,
[rhType] [char] (1) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerStandByRequestDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerStandByRequestDetail](
[reqdCompanyID] [int] NOT NULL,
[reqdShopID] [int] NOT NULL,
[reqdRequestID] [int] NOT NULL,
[reqdDetailID] [int] NOT NULL,
[reqdMachineID] [int] NOT NULL,
[reqdQuantity] [numeric] (18,2) NOT NULL,
[reqdRemarks] [varchar] (250) NULL,
[reqdslno] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerStandByRequestHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerStandByRequestHeader](
[reqhCompanyID] [int] NOT NULL,
[reqhRequestID] [int] NOT NULL,
[reqhShopID] [int] NOT NULL,
[reqhNo] [varchar] (50) NOT NULL,
[reqhDate] [datetime] NOT NULL,
[reqhCustomerID] [int] NOT NULL,
[reqhProcessedDate] [datetime] NULL,
[reqhApprovedByID] [int] NULL,
[reqhCancelled] [bit] NOT NULL,
[reqhCancelledRemarks] [varchar] (250) NULL,
[reqhRemarks] [varchar] (250) NOT NULL,
[reqhFuture] [varchar] (250) NULL,
[reqhUpdateTime] [datetime] NOT NULL,
[reqhType] [char] (1) NULL,
[reqhCustomerName] [varchar] (250) NULL,
[reqhContactNo] [varchar] (100) NULL,
[reqhContactName] [varchar] (250) NULL,
[reqhtime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerToolsAllocationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerToolsAllocationDetail](
[alcdCompanyId] [int] NOT NULL,
[alcdShopid] [int] NOT NULL,
[alcdid] [int] NOT NULL,
[alcdtoolsid] [int] NOT NULL,
[alcddetailid] [int] NOT NULL,
[alcdtechnicianid] [int] NOT NULL,
[alcdreturned] [char] (1) NOT NULL,
[alcdfrom] [datetime] NULL,
[alcdto] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSerToolsAllocationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSerToolsAllocationHeader](
[alchCompanyId] [int] NOT NULL,
[alchShopid] [int] NOT NULL,
[alchid] [int] NOT NULL,
[alchno] [varchar] (50) NOT NULL,
[alchdate] [datetime] NULL,
[alchtechnicianid] [int] NOT NULL,
[alchRemarks] [varchar] (50) NULL,
[alchCancelled] [bit] NULL,
[alchCancelledremarks] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosserToolsReturnDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosserToolsReturnDetail](
[tlretdCompanyId] [int] NOT NULL,
[tlretdShopid] [int] NOT NULL,
[tlretdid] [int] NOT NULL,
[tlretdetailid] [int] NOT NULL,
[tlretdtoolsid] [int] NULL,
[tlretdcomments] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosserToolsReturnHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosserToolsReturnHeader](
[tlrethCompanyId] [int] NOT NULL,
[tlrethShopid] [int] NOT NULL,
[tlrethid] [int] NOT NULL,
[tlrethno] [varchar] (50) NULL,
[tlrethdate] [datetime] NULL,
[tlrethtechnicianid] [int] NULL,
[tlrethRemarks] [varchar] (250) NULL,
[tlrethCancelled] [bit] NULL,
[tlrethCancelledRemarks] [varchar] (250) NULL,
[tlrethallocid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losServiceBookingHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losServiceBookingHeader](
[serbookhid] [int] NOT NULL,
[serbookhshopid] [int] NOT NULL,
[serbookhcompanyid] [int] NOT NULL,
[serbookhpreparedby] [varchar] (50) NULL,
[serbookhdeldate] [datetime] NULL,
[serbookadvanceamount] [numeric] (18,2) NULL,
[serbookhserviceamt] [numeric] (18,2) NULL,
[serbookhpartscost] [numeric] (18,2) NULL,
[serbookhdepartmentid] [int] NULL,
[serbookhposted] [bit] NOT NULL,
[serbookhinvoiced] [bit] NOT NULL,
[serbookhcashacc] [int] NULL,
[serbookadvanceacc] [int] NULL,
[serbookhcmpexrate] [numeric] (18,8) NULL,
[serbookhresexrate] [numeric] (18,8) NULL,
[serbookhbaserate] [numeric] (18,8) NULL,
[serbookconfirmed] [bit] NOT NULL,
[serbooksermode] [bit] NOT NULL,
[serbookhfutureint] [int] NULL,
[serbookhfuturenumer] [numeric] (18,8) NULL,
[serbookhstatus] [char] (10) NULL,
[serbookhpriority] [int] NULL,
[serbookhInspectionNo] [varchar] (50) NULL,
[serbookhInspectionDate] [datetime] NULL,
[serbookhEstExpiryDate] [datetime] NULL,
[serbookhApprovedDate] [datetime] NULL,
[serbookhFaxOutTime] [datetime] NULL,
[serbookhdepexrate] [numeric] (18,8) NULL,
[serbookhexchangerates] [varchar] (250) NULL,
[serbookhinspectiontime] [datetime] NULL,
[serbookhinpcancelled] [bit] NULL,
[serbookhinpstatus] [varchar] (1) NULL,
[serbookadvancedate] [datetime] NULL,
[serbookhRemarks] [varchar] (250) NULL,
[serbookhinpCancelledRemarks] [varchar] (250) NULL,
[serbookhRefId] [int] NULL,
[serbookhUpdateTime] [datetime] NOT NULL,
[serccallbkhrecvdfrom] [varchar] (100) NULL,
[serWarranyFrom] [datetime] NULL,
[serWarrantyTo] [datetime] NULL,
[serbookhUserid] [int] NULL,
[serbookhTerms] [varchar] (250) NULL,
[serbookhSerialNumber] [varchar] (100) NULL,
[serserbookhExcludeGST] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losServiceHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losServiceHeader](
[serinvhid] [int] NOT NULL,
[serinvhcompanyid] [int] NOT NULL,
[serinvhbookingid] [int] NULL,
[serinvhshopid] [int] NOT NULL,
[serinvhpreparedby] [varchar] (50) NULL,
[serinvhserviceamt] [numeric] (18,2) NULL,
[serinvhpartsamt] [numeric] (18,2) NULL,
[serinvhamount] [numeric] (18,2) NULL,
[serinvhdepartmentid] [int] NULL,
[serinvhitemname] [varchar] (250) NULL,
[serinvhitemid] [int] NULL,
[serinvhcustname] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[serinvhJobCardNo] [varchar] (50) NULL,
[serinvhPaceofWork] [varchar] (250) NULL,
[serinvhmetereading] [varchar] (100) NULL,
[serinvhrefno] [int] NULL,
[serinvhprocno] [varchar] (50) NULL,
[serinvhprocdate] [datetime] NULL,
[serinvhremarks] [varchar] (500) NULL,
[serinvhjobinvcancelledremarks] [varchar] (250) NULL,
[serinvhjobinvcancelled] [bit] NULL,
[serinvhcompleted] [bit] NULL,
[serinvhToInvoice] [bit] NULL,
[itemDespatch] [bit] NULL,
[serinvhdespdate] [datetime] NULL,
[serinvhnotes] [varchar] (4000) NULL,
[serTypeId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosServiceInvHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosServiceInvHeader](
[serinvhid] [int] NOT NULL,
[serinvhcompanyid] [int] NOT NULL,
[serinvhshopid] [int] NOT NULL,
[serinvhjobcardid] [int] NULL,
[serinvno] [varchar] (50) NULL,
[serinvhrefno] [varchar] (50) NULL,
[serinvhdate] [datetime] NULL,
[serinvhduedate] [datetime] NULL,
[serinvhpreparedby] [varchar] (50) NULL,
[serinvhcancelled] [bit] NULL,
[serinvhserviceamt] [numeric] (18,2) NULL,
[serinvhpartsamt] [numeric] (18,2) NULL,
[serinvhamount] [numeric] (18,2) NULL,
[serinvhposted] [bit] NULL,
[serinvhdepartmentid] [int] NULL,
[serinvhcashacc] [int] NULL,
[serinvhsalesacc] [int] NULL,
[serinvhservacc] [int] NULL,
[serinvhcmpexrate] [numeric] (18,8) NULL,
[serinvhresexrate] [numeric] (18,8) NULL,
[serinvhbaserate] [numeric] (18,8) NULL,
[serinvhsettled] [numeric] (18,2) NULL,
[serinvhremarks] [varchar] (250) NULL,
[serinvcancelremarks] [varchar] (250) NULL,
[serinvhupdatetime] [datetime] NULL,
[serinvhlocid] [int] NULL,
[serinvhitemname] [varchar] (250) NULL,
[serinvhitemid] [int] NULL,
[serinvhDiscount] [numeric] (18,2) NULL,
[serinvhfutureint] [int] NULL,
[serinvhfuturevc] [varchar] (250) NULL,
[serinvhfuturenumuric] [numeric] (18,18) NULL,
[serinvfinancialid] [int] NULL,
[seinvhdepexrate] [numeric] (9,2) NULL,
[serinvhfree] [bit] NULL,
[serinvhexchangerates] [varchar] (250) NULL,
[serinvhcustname] [varchar] (250) NULL,
[serinvhcategid] [int] NULL,
[serinvhmetereading] [varchar] (100) NULL,
[serinvhCustomerId] [int] NULL,
[serinvhCashInv] [bit] NULL,
[serinvhuserid] [int] NULL,
[serinvhRegID] [int] NULL,
[serinvhTaxCateID] [int] NULL,
[serinvhTaxPercentage] [numeric] (18,2) NULL,
[serinvhTaxamount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsServiceInvoiceDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsServiceInvoiceDetails](
[siInvoiceDetailID] [int] NOT NULL,
[siCompanyID] [int] NOT NULL,
[siInvoiceID] [int] NOT NULL,
[siServiceName] [varchar] (250) NULL,
[siServiceTerm] [varchar] (100) NULL,
[siServiceQty] [int] NULL,
[siAmount] [numeric] (18,2) NULL,
[siAccountid] [int] NULL,
[siShopID] [int] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[siclearingReqId] [int] NULL,
[siClearingOCAmt] [numeric] (18,2) NULL,
[siClearingCommAmt] [numeric] (18,2) NULL,
[siLocalPOId] [int] NULL,
[siUserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losservinvoicetechniciandetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losservinvoicetechniciandetails](
[serinvtechcompanyid] [int] NOT NULL,
[sertechinvid] [int] NOT NULL,
[serinvtechshopid] [int] NOT NULL,
[serinvtechdetailid] [int] NOT NULL,
[serinvtechid] [int] NULL,
[serinvtechstarttime] [datetime] NULL,
[serinvtechendtime] [datetime] NULL,
[serinvtechcostperhr] [int] NULL,
[serinvtechservicetype] [char] (10) NULL,
[serinvtechcomments] [varchar] (100) NULL,
[serinvtechstatus] [char] (10) NULL,
[serinvhfuturevc] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[serinvTechServiceID] [int] NOT NULL,
[serinvTechEstStartDate] [datetime] NOT NULL,
[serinvTechEstEndDate] [datetime] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsSettings](
[ShopId] [int] NOT NULL,
[sNoofBackDays] [int] NULL,
[sGoodsReturnPeriod] [int] NULL,
[OpeningStockDate] [datetime] NULL,
[CBUserID] [int] NULL,
[barcodetype] [smallint] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[reportsetting] [varchar] (50) NULL,
[defaultfetch] [varchar] (100) NULL,
[ClearingCOMPerc] [numeric] (18,2) NULL,
[HandlingPer] [numeric] (18,2) NULL,
[HandlingAndPaymentPer] [numeric] (18,2) NULL,
[allshops] [bit] NULL,
[PopulateDateWise] [bit] NULL,
[QuickItemFetch] [bit] NULL,
[BlockAboveSP] [bit] NULL,
[ShopActiveDirectoryLogin] [bit] NOT NULL,
[DirectLocalPurchaseCosting] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosShipmentbndetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosShipmentbndetail](
[bndShopId] [int] NOT NULL,
[bndboatnoteId] [int] NOT NULL,
[bnddetailId] [int] NOT NULL,
[bndclearanceId] [int] NULL,
[bndclearanceDetailId] [int] NULL,
[bndPacking] [varchar] (250) NULL,
[bndqty] [numeric] (10,0) NULL,
[bndunit] [varchar] (25) NULL,
[bndnoofpackage] [numeric] (10,0) NULL,
[bndremarks] [varchar] (100) NULL,
[bndlppoid] [int] NULL,
[bndlpdetailid] [int] NULL,
[bndStatus] [char] (1) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosShipmentbnheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosShipmentbnheader](
[bnhShopId] [int] NOT NULL,
[bnhboatnoteId] [int] NOT NULL,
[bnhboateNoteNo] [varchar] (50) NULL,
[bnhboatenotedate] [datetime] NULL,
[bnhCustomerId] [int] NULL,
[bnhRemark] [varchar] (250) NULL,
[bnhsentBy] [varchar] (100) NULL,
[bnhcancelled] [bit] NOT NULL,
[bnhcancelledRemarks] [varchar] (250) NULL,
[bnhBoatNoteRecTime] [datetime] NULL,
[bnhPersonReceived] [varchar] (50) NULL,
[bnhattento] [varchar] (100) NULL,
[bnhboatname] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losShipmentBNOCDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losShipmentBNOCDetail](
[ShopID] [int] NOT NULL,
[BoatNoteID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[OCDesc] [varchar] (250) NULL,
[Remarks] [varchar] (250) NULL,
[Amount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsShopDamageClearingDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsShopDamageClearingDetails](
[dcdClearingID] [int] NOT NULL,
[dcdShipmentID] [int] NOT NULL,
[dcdItemID] [int] NOT NULL,
[dcdShopid] [int] NOT NULL,
[dcdAvailableQty] [numeric] (18,3) NULL,
[dcdWriteOffQty] [numeric] (18,3) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsShopDamageClearingHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsShopDamageClearingHeader](
[dchClearingID] [int] NOT NULL,
[dchShopid] [int] NOT NULL,
[dchClearingNo] [varchar] (50) NOT NULL,
[dchClearingDate] [datetime] NULL,
[dchClearingDoneBy] [varchar] (50) NULL,
[dchRemarks] [varchar] (250) NULL,
[dchCancelled] [bit] NOT NULL,
[dchCancelledRemarks] [varchar] (250) NULL,
[dchRecAddUser] [varchar] (50) NULL,
[dchRecModifyUser] [varchar] (50) NULL,
[dchfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[dchconexrate] [numeric] (18,8) NULL,
[dchdepexrate] [numeric] (18,8) NULL,
[dchexchangerates] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losShopItemDiffPriceLevels]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losShopItemDiffPriceLevels](
[IpID] [int] IDENTITY(1,1) NOT NULL,
[ItemID] [int] NOT NULL,
[ShopID] [int] NOT NULL,
[CurrencyID] [int] NOT NULL,
[PackingTypeID] [int] NOT NULL,
[SegmentID] [int] NULL,
[SellingPrice] [numeric] (18,2) NOT NULL,
[PriceDescription] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losShopItemShipmentDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losShopItemShipmentDetail](
[ipid] [int] IDENTITY(1,1) NOT NULL,
[shipmentid] [int] NOT NULL,
[itemid] [int] NOT NULL,
[shopid] [int] NULL,
[PackingTypeid] [int] NOT NULL,
[spFixdate] [datetime] NULL,
[sellingPrice] [numeric] (18,2) NULL,
[WholesalePrice] [numeric] (18,2) NULL,
[DiscountPrice] [numeric] (18,2) NULL,
[Pricechanged] [bit] NOT NULL,
[currencyid] [int] NULL,
[companyid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[segmentid] [int] NULL,
[CreditSP] [numeric] (18,2) NULL,
[CreditDP] [numeric] (18,2) NULL,
[CreditWP] [numeric] (18,2) NULL,
[Userid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losShopTransactionsSummary]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losShopTransactionsSummary](
[SummaryDate] [datetime] NOT NULL,
[ShopId] [int] NOT NULL,
[ItemId] [int] NOT NULL,
[Stock] [numeric] (18,3) NULL,
[BadStock] [numeric] (18,3) NULL,
[OpeningStock] [numeric] (18,3) NULL,
[OpeningBadStock] [numeric] (18,3) NULL,
[ShipmentId] [int] NULL,
[ItemCostPrice] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSIQuotationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSIQuotationDetail](
[idInvoiceId] [int] NOT NULL,
[idGodownID] [int] NOT NULL,
[idItemid] [int] NOT NULL,
[idShopid] [int] NOT NULL,
[locationid] [int] NOT NULL,
[shipmentid] [int] NOT NULL,
[idPackingTypeid] [int] NOT NULL,
[idPunitID] [int] NULL,
[IDPquantity] [numeric] (18,3) NULL,
[idQuantity] [numeric] (18,3) NULL,
[idUnitPrice] [numeric] (18,2) NULL,
[idRateType] [int] NULL,
[idActualUnitPrice] [numeric] (18,2) NULL,
[reqqty] [numeric] (18,3) NULL,
[despatch] [bit] NOT NULL,
[idcostprice] [numeric] (18,2) NULL,
[iddescription] [varchar] (250) NULL,
[idblockprice] [numeric] (18,2) NULL,
[idguarantee] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[idFreeQuantity] [numeric] (18,3) NULL,
[idSerialNo] [varchar] (50) NULL,
[idItemTaxPercentage] [numeric] (18,2) NULL,
[idItemTaxAmount] [numeric] (18,2) NULL,
[idItemTaxCategory] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSIQuotationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSIQuotationHeader](
[IhInvoiceID] [int] NOT NULL,
[IhShopID] [int] NOT NULL,
[IhInvoiceNo] [varchar] (50) NULL,
[IhInvoiceDate] [datetime] NULL,
[IhReferenceNo] [varchar] (50) NULL,
[IhCustomerID] [int] NULL,
[IhProforma] [bit] NOT NULL,
[IhCashInvoice] [bit] NOT NULL,
[IhBankcashAccID] [int] NULL,
[IhChequeNo] [varchar] (50) NULL,
[IhDueDate] [datetime] NULL,
[IhRemarks] [varchar] (250) NULL,
[IhInvoiceAmount] [numeric] (18,2) NULL,
[IhDiscount] [numeric] (18,2) NULL,
[IhDiscountAccID] [int] NULL,
[IhDepartmentID] [int] NULL,
[IhFinancialID] [int] NULL,
[IhCancelled] [bit] NOT NULL,
[IhCancelledRemarks] [varchar] (250) NULL,
[IhExchangeNature] [varchar] (50) NULL,
[IhCompanyId] [int] NULL,
[IhPosted] [bit] NOT NULL,
[IhProformaID] [int] NULL,
[ihRecAddUser] [varchar] (250) NULL,
[ihRecModifyUser] [varchar] (250) NULL,
[ihGoodsReturned] [bit] NOT NULL,
[ihUsed] [bit] NOT NULL,
[IhSalesAccID] [int] NULL,
[IhSettled] [bit] NOT NULL,
[ihTransFinished] [bit] NOT NULL,
[ihNoofDetails] [int] NOT NULL,
[ihNoofOCDetails] [int] NOT NULL,
[ihexchangerate] [numeric] (28,8) NOT NULL,
[ihsettledamount] [numeric] (18,2) NULL,
[ihcbid] [int] NULL,
[ihfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[ihsalespersonid] [int] NULL,
[ihCustomerCardNo] [varchar] (100) NULL,
[ihfutureint] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ihdepexrate] [numeric] (18,8) NULL,
[ihexchangerates] [varchar] (250) NULL,
[ihcreatedtime] [datetime] NULL,
[ihInvoiced] [int] NULL,
[ihAddress] [varchar] (250) NULL,
[ihCustomerName] [varchar] (50) NULL,
[ihUserId] [int] NULL,
[ihModifyUserId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSpecialInvoiceDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSpecialInvoiceDetail](
[idInvoiceId] [int] NOT NULL,
[idGodownID] [int] NOT NULL,
[idItemid] [int] NOT NULL,
[idShopid] [int] NOT NULL,
[locationid] [int] NOT NULL,
[shipmentid] [int] NOT NULL,
[idPackingTypeid] [int] NOT NULL,
[idPunitID] [int] NULL,
[IDPquantity] [numeric] (18,3) NULL,
[idQuantity] [numeric] (18,3) NULL,
[idUnitPrice] [numeric] (18,8) NULL,
[idRateType] [int] NULL,
[idActualUnitPrice] [numeric] (18,2) NULL,
[reqqty] [numeric] (18,3) NULL,
[despatch] [bit] NOT NULL,
[idcostprice] [numeric] (18,2) NULL,
[iddescription] [varchar] (250) NULL,
[idblockprice] [numeric] (18,2) NULL,
[idguarantee] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[idFreeQuantity] [numeric] (18,3) NULL,
[idSerialNo] [varchar] (50) NULL,
[idItemType] [varchar] (10) NULL,
[idKitID] [int] NOT NULL,
[idKitQuantity] [numeric] (18,2) NULL,
[idKitActualPrice] [numeric] (18,2) NULL,
[idServWarrantyUpto] [datetime] NULL,
[idPartsWarrantyUpto] [datetime] NULL,
[idItemTaxPercentage] [numeric] (18,2) NULL,
[idItemTaxAmount] [numeric] (18,8) NULL,
[idItemTaxCategory] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSpecialInvoiceHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSpecialInvoiceHeader](
[IhInvoiceID] [int] NOT NULL,
[IhShopID] [int] NOT NULL,
[IhInvoiceNo] [varchar] (50) NULL,
[IhInvoiceDate] [datetime] NULL,
[IhReferenceNo] [varchar] (50) NULL,
[IhCustomerID] [int] NULL,
[IhProforma] [bit] NOT NULL,
[IhCashInvoice] [bit] NOT NULL,
[IhBankcashAccID] [int] NULL,
[IhChequeNo] [varchar] (50) NULL,
[IhDueDate] [datetime] NULL,
[IhRemarks] [varchar] (250) NULL,
[IhInvoiceAmount] [numeric] (18,2) NULL,
[IhDiscount] [numeric] (18,2) NULL,
[IhDiscountAccID] [int] NULL,
[IhDepartmentID] [int] NULL,
[IhFinancialID] [int] NULL,
[IhCancelled] [bit] NOT NULL,
[IhCancelledRemarks] [varchar] (250) NULL,
[IhExchangeNature] [varchar] (50) NULL,
[IhCompanyId] [int] NULL,
[IhPosted] [bit] NOT NULL,
[IhProformaID] [int] NULL,
[ihRecAddUser] [varchar] (250) NULL,
[ihRecModifyUser] [varchar] (250) NULL,
[ihGoodsReturned] [bit] NOT NULL,
[ihUsed] [bit] NOT NULL,
[IhSalesAccID] [int] NULL,
[IhSettled] [bit] NOT NULL,
[ihTransFinished] [bit] NOT NULL,
[ihNoofDetails] [int] NOT NULL,
[ihNoofOCDetails] [int] NOT NULL,
[ihexchangerate] [numeric] (28,8) NOT NULL,
[ihsettledamount] [numeric] (18,2) NULL,
[ihcbid] [int] NULL,
[ihfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[ihsalespersonid] [int] NULL,
[ihCustomerCardNo] [varchar] (100) NULL,
[ihfutureint] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ihdepexrate] [numeric] (18,8) NULL,
[ihexchangerates] [varchar] (250) NULL,
[ihcreatedtime] [datetime] NULL,
[ihQuotationID] [int] NULL,
[ihDespachID] [int] NULL,
[ihReturnBeforeDesID] [int] NULL,
[ihUserId] [int] NULL,
[ihModifyUserId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losSpecialOC]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losSpecialOC](
[ioShopid] [int] NOT NULL,
[ioInvoiceID] [int] NOT NULL,
[ioAccid] [int] NOT NULL,
[ioDescription] [varchar] (100) NULL,
[ioAmount] [numeric] (18,2) NULL,
[ioCompanyID] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losStockRecovery]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losStockRecovery](
[srID] [int] NOT NULL,
[srShopID] [int] NOT NULL,
[srDate] [datetime] NULL,
[srItemID] [int] NULL,
[srAddStock] [numeric] (18,3) NULL,
[srDedStock] [numeric] (18,3) NULL,
[srcostprice] [numeric] (18,2) NULL,
[srUserName] [varchar] (50) NULL,
[srposted] [bit] NOT NULL,
[srfutureint] [int] NULL,
[updatetime] [datetime] NOT NULL,
[srdepartmentid] [int] NULL,
[srlocid] [int] NULL,
[srtransno] [varchar] (50) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[srConExRate] [numeric] (18,8) NULL,
[srDepExRate] [numeric] (18,8) NULL,
[srExchangeRates] [varchar] (250) NULL,
[srTransDate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losStockVerificationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losStockVerificationDetail](
[svdid] [int] NOT NULL,
[svdShipmentID] [int] NOT NULL,
[svditemid] [int] NOT NULL,
[svdShopid] [int] NOT NULL,
[svdAvailStock] [numeric] (18,3) NULL,
[svdVerifiedStock] [numeric] (18,3) NULL,
[svdAvailBadStock] [numeric] (18,3) NULL,
[svdVerifiedBadStock] [numeric] (18,3) NULL,
[svdcostprice] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losStockVerificationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losStockVerificationHeader](
[svhid] [int] NOT NULL,
[svhShopId] [int] NOT NULL,
[svhno] [varchar] (50) NULL,
[svhdate] [datetime] NULL,
[svhverificationby] [varchar] (250) NULL,
[svhremarks] [varchar] (250) NULL,
[svhcancelled] [bit] NOT NULL,
[svhcancelremarks] [varchar] (250) NULL,
[svhrecmoduser] [varchar] (250) NULL,
[svhrecadduser] [varchar] (250) NULL,
[svhfuturevc] [varchar] (250) NOT NULL,
[svhposted] [bit] NOT NULL,
[updatetime] [datetime] NOT NULL,
[svhdepartmentid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[svhconexrate] [numeric] (18,8) NULL,
[svhdepexrate] [numeric] (18,8) NULL,
[svhexchangerates] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losTenantServiceBillDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losTenantServiceBillDetail](
[tbdBillId] [int] NOT NULL,
[tbdShopId] [int] NOT NULL,
[tbdCompanyId] [int] NOT NULL,
[tbdUtilityTransID] [int] NOT NULL,
[tbddetailid] [int] NOT NULL,
[tbdAmount] [numeric] (18,2) NULL,
[tbdRefAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losTenantServiceBillHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losTenantServiceBillHeader](
[tbhBillId] [int] NOT NULL,
[tbhShopId] [int] NOT NULL,
[tbhCompanyId] [int] NOT NULL,
[tbhAgreementId] [int] NULL,
[tbhCustomerId] [int] NULL,
[tbhBillNo] [varchar] (50) NULL,
[tbhBillDate] [datetime] NULL,
[tbhCancelled] [bit] NULL,
[tbhRemarks] [varchar] (250) NULL,
[tbhCancelledRemarks] [varchar] (250) NULL,
[tbhDepExRate] [numeric] (18,8) NULL,
[tbhExRate] [numeric] (18,8) NULL,
[tbhExchangeRates] [varchar] (250) NULL,
[tbhDepartmentID] [int] NULL,
[tbhBankCashID] [int] NULL,
[tbhServiceAccid] [int] NULL,
[tbhPosted] [bit] NULL,
[tbhAmount] [numeric] (18,2) NULL,
[tbhDueDate] [datetime] NULL,
[tbhReferenceNo] [varchar] (50) NULL,
[tbhUpdateTime] [datetime] NULL,
[tbhSettledAmount] [numeric] (18,2) NULL,
[tbhSettled] [bit] NULL,
[tbhutilityAccid] [int] NULL,
[tbhUserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losTenantServiceRegisterDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losTenantServiceRegisterDetail](
[trdTransID] [int] NULL,
[trdTransShopid] [int] NULL,
[trdTransCompanyId] [int] NULL,
[trdTransDetailId] [int] NULL,
[trdServiceId] [int] NULL,
[trdServiceQty] [numeric] (18,3) NULL,
[trdServiceActualRate] [numeric] (18,2) NULL,
[trdServiceRate] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losTenantServiceRegisterHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losTenantServiceRegisterHeader](
[trhTransId] [int] NULL,
[trhTransShopId] [int] NULL,
[trhTransCompanyid] [int] NULL,
[trhTransNo] [varchar] (50) NULL,
[trhDate] [datetime] NULL,
[trhApartmentId] [int] NULL,
[trhAgreementID] [int] NULL,
[trhEnteredBy] [int] NULL,
[trhRemarks] [varchar] (250) NULL,
[trhCancelled] [bit] NULL,
[trhCancelledRemarks] [varchar] (250) NULL,
[trhStatus] [char] (1) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losTenantUtilityBillDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losTenantUtilityBillDetail](
[utdBillId] [int] NOT NULL,
[utdShopId] [int] NOT NULL,
[utdCompanyId] [int] NOT NULL,
[utdServiceId] [int] NOT NULL,
[utdFromDate] [datetime] NULL,
[utdToDate] [datetime] NULL,
[utdMeterReading] [numeric] (28,8) NULL,
[utdUnits] [numeric] (18,8) NULL,
[utdRate] [numeric] (18,2) NULL,
[utdAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOSTransferindetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOSTransferindetail](
[TIDID] [int] NOT NULL,
[TIDshopid] [int] NOT NULL,
[TIDshipmentID] [int] NOT NULL,
[TIDitemID] [int] NOT NULL,
[TIDtransfergoodqty] [numeric] (18,3) NULL,
[TIDtransferbadqty] [numeric] (18,3) NULL,
[TIDrecievedgoodqty] [numeric] (18,3) NULL,
[TIDrecievedbadqty] [numeric] (18,3) NULL,
[TIDCostprice] [numeric] (20,4) NULL,
[TIDSellingPrice] [numeric] (20,4) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOSTransferinheader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOSTransferinheader](
[TIHShopid] [int] NOT NULL,
[TIHID] [int] NOT NULL,
[TIHNO] [varchar] (50) NOT NULL,
[TIHDate] [datetime] NOT NULL,
[TIHfromshopID] [int] NOT NULL,
[TIHdespatchID] [int] NOT NULL,
[TIHremarks] [varchar] (250) NULL,
[TIHcancel] [bit] NOT NULL,
[TIHcancelledremarks] [varchar] (250) NULL,
[TIHDoneBy] [varchar] (100) NULL,
[TIHTransFinished] [bit] NOT NULL,
[TIHPosted] [bit] NOT NULL,
[TIHfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[tihdepartmentid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[tihconexrate] [numeric] (18,8) NULL,
[tihdepexrate] [numeric] (18,8) NULL,
[tihexchangerates] [varchar] (250) NULL,
[TIHType] [char] (2) NULL,
[tihrecadduser] [varchar] (250) NULL,
[tihrecmodifyuser] [varchar] (250) NULL,
[tihTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losType]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losType](
[Typeid] [int] NOT NULL,
[Type] [varchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losUserAuditDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losUserAuditDetail](
[sdCompanyId] [int] NULL,
[sdAuditId] [int] NULL,
[sdShopId] [int] NULL,
[sdDetailId] [int] NULL,
[sdAuditControlName] [varchar] (250) NULL,
[sdAuditControlType] [varchar] (50) NULL,
[sdOldValue] [varchar] (4000) NULL,
[sdNewValue] [varchar] (4000) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losUserAuditHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losUserAuditHeader](
[shCompanyId] [int] NULL,
[shAuditId] [int] NULL,
[shShopId] [int] NULL,
[shInterfaceId] [int] NULL,
[shTransId] [int] NULL,
[shTransNo] [varchar] (50) NULL,
[shUserFullName] [varchar] (250) NULL,
[shLoggedDateTime] [datetime] NULL,
[shExitedDateTime] [datetime] NULL,
[shMode] [char] (1) NULL,
[shSaved] [bit] NULL,
[shMachineName] [varchar] (50) NULL,
[shWindowsUserName] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosVerifiedby]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosVerifiedby](
[verifiedid] [int] NULL,
[verifiedby] [varchar] (20) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LosVrRegistartionReceiveDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LosVrRegistartionReceiveDetail](
[RegistartionReceiveId] [int] NOT NULL,
[RegistartionReceiveDtlId] [int] NOT NULL,
[RegistartionSubConfId] [int] NOT NULL,
[InvoiceId] [int] NULL,
[PosId] [int] NULL,
[SpInvoice] [int] NULL,
[RegistrationID] [int] NOT NULL,
[RegistryNoShort] [nvarchar] (150) NOT NULL,
[RegistryNoLong] [nvarchar] (150) NOT NULL,
[RegistrationDate] [datetime] NOT NULL,
[Companyid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losWarrentyClaimDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losWarrentyClaimDetail](
[wcdCompanyID] [int] NOT NULL,
[wcdShopID] [int] NOT NULL,
[wcdID] [int] NOT NULL,
[wcdDetailID] [int] NOT NULL,
[wcdItemID] [int] NOT NULL,
[wcdPackingTypeID] [int] NOT NULL,
[wcdPQty] [numeric] (18,2) NOT NULL,
[wcdQty] [numeric] (18,0) NOT NULL,
[wcdAvailQty] [numeric] (18,0) NOT NULL,
[wcdCostPrice] [numeric] (18,4) NOT NULL,
[wcdSerialNo] [varchar] (50) NULL,
[wcdcustomprice] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[losWarrentyClaimHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[losWarrentyClaimHeader](
[wchCompanyID] [int] NOT NULL,
[wchShopID] [int] NOT NULL,
[wchID] [int] NOT NULL,
[wchDate] [datetime] NOT NULL,
[wchNo] [varchar] (50) NOT NULL,
[wchCustomerID] [int] NULL,
[wchRemarks] [varchar] (500) NULL,
[wchType] [varchar] (50) NOT NULL,
[wchCancelled] [int] NULL,
[wchCancelRemarks] [nvarchar] (250) NULL,
[wchPosted] [int] NOT NULL,
[wchUser] [varchar] (25) NOT NULL,
[wchUpdatedUser] [varchar] (25) NULL,
[wchUpdatedTime] [datetime] NULL,
[wchFinancialID] [int] NOT NULL,
[wchAmount] [numeric] (18,2) NULL,
[wchExchangeRate] [varchar] (250) NULL,
[wchcomexrate] [numeric] (18,0) NULL,
[wchdepexrate] [numeric] (18,0) NULL,
[wchModel] [nvarchar] (300) NULL,
[wchUnitSerial] [nvarchar] (300) NULL,
[wchLabourCost] [numeric] (12,2) NULL,
[wchpartCostSupplier] [numeric] (12,2) NULL,
[wchLabourCostSupplier] [numeric] (12,2) NULL,
[wchCreditDate] [datetime] NULL,
[wchRefNo] [varchar] (200) NULL,
[wchConfirmed] [bit] NULL,
[wchCustomerName] [varchar] (500) NULL,
[wchCustomerAddress] [varchar] (500) NULL,
[whVerified] [bit] NULL,
[whApprovedby] [varchar] (20) NULL,
[whIhCRequestID] [int] NULL,
[whApprovedid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsWriteOffDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsWriteOffDetail](
[wdShopID] [int] NOT NULL,
[WdID] [int] NOT NULL,
[WdItemID] [int] NOT NULL,
[WdShipmentID] [int] NOT NULL,
[WdAvailableQty] [numeric] (18,3) NULL,
[WdWriteoffQty] [numeric] (18,3) NULL,
[wdcostprice] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[WdPackID] [int] NULL,
[WdunitID] [int] NULL,
[WdPqty] [numeric] (18,2) NULL,
[WdInhouseConsAccnt] [int] NULL,
[wdDetailid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOsWriteOffHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOsWriteOffHeader](
[whShopID] [int] NOT NULL,
[WhID] [int] NOT NULL,
[WhNo] [varchar] (50) NULL,
[WhDate] [datetime] NULL,
[WhUserName] [varchar] (50) NULL,
[WhCancelled] [bit] NOT NULL,
[WhCancelledRemarks] [varchar] (250) NULL,
[WhRemarks] [varchar] (250) NULL,
[WhRecAddUser] [varchar] (250) NULL,
[WhRecModifyUser] [varchar] (250) NULL,
[Whfuturevc] [varchar] (250) NOT NULL,
[whposted] [bit] NOT NULL,
[updatetime] [datetime] NOT NULL,
[whdepartmentid] [int] NULL,
[whconexrate] [numeric] (18,8) NULL,
[whdepexrate] [numeric] (18,8) NULL,
[whexchangerates] [varchar] (250) NULL,
[whotherdepid] [int] NULL,
[whreceivedby] [varchar] (100) NULL,
[whauthorisedby] [varchar] (100) NULL,
[whtype] [char] (1) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[whexpenseaccid] [int] NULL,
[whapartmentid] [int] NULL,
[whdoneby] [varchar] (150) NULL,
[whApprovedby] [varchar] (20) NULL,
[whApprovedid] [int] NULL,
[whIhCRequestID] [int] NULL,
[whIssuedby] [varchar] (150) NULL,
[whIssuedid] [int] NULL,
[whReceivedid] [int] NULL,
[whtodepexrate] [numeric] (18,9) NULL,
[whVerifiedby] [varchar] (20) NULL,
[whverifiedid] [int] NULL,
[whVerified] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOUserGroupRights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOUserGroupRights](
[UserGroupID] [int] NOT NULL,
[ModuleCode] [varchar] (10) NOT NULL,
[InterfaceID] [int] NOT NULL,
[FunctionRights] [varchar] (10) NOT NULL,
[CompanyID] [int] NOT NULL,
[userid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOUserGroups]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOUserGroups](
[UserGroupID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[UserGroupName] [varchar] (250) NOT NULL,
[GroupDesc] [varchar] (250) NOT NULL,
[LOcation] [varchar] (250) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOUserMasterGridSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOUserMasterGridSettings](
[CompanyID] [int] NOT NULL,
[UserID] [int] NOT NULL,
[BackColor] [varchar] (50) NOT NULL,
[ForeColor] [varchar] (50) NOT NULL,
[GridColor] [varchar] (50) NOT NULL,
[HeaderColor] [varchar] (50) NOT NULL,
[FontName] [varchar] (50) NOT NULL,
[FontSize] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOUserRights]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOUserRights](
[UserID] [int] NOT NULL,
[ModuleCode] [varchar] (10) NULL,
[InterfaceID] [int] NOT NULL,
[FunctionRights] [varchar] (10) NULL,
[CompanyID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LOUsers]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LOUsers](
[UserID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[UserName] [varchar] (250) NULL,
[UserPwd] [varchar] (50) NULL,
[FullName] [varchar] (250) NULL,
[ShopID] [int] NULL,
[GodownID] [int] NULL,
[logedon] [bit] NULL,
[GlobalUserID] [int] NULL,
[ShiftId] [int] NULL,
[userGroupId] [int] NULL,
[EmailID] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LtimeDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LtimeDetail](
[Ltimeid] [int] NOT NULL,
[LtimeCompanyid] [int] NOT NULL,
[Ltimestageid] [int] NOT NULL,
[LtimeDivisionId] [int] NOT NULL,
[LtimeNoofDays] [int] NOT NULL,
[LtimeDetailNo] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LtimeHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[LtimeHeader](
[LtimeID] [int] NOT NULL,
[LtimeDate] [datetime] NOT NULL,
[LtimeCompanyid] [int] NOT NULL,
[LtimeSupplierId] [int] NULL,
[LtimeItemid] [numeric] (18,0) NOT NULL,
[LtimeDepartmentid] [int] NOT NULL,
[LtimeRemarks] [varchar] (50) NULL,
[LtimePreparedBy] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mealname]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mealname](
[companyid] [int] NOT NULL,
[mealnameid] [int] NOT NULL,
[mealnamecode] [varchar] (50) NULL,
[mealname] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MEDifferenceinStock]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MEDifferenceinStock](
[dstransid] [int] NULL,
[dstranscode] [varchar] (50) NULL,
[dsItemid] [int] NOT NULL,
[dsToAdd] [numeric] (18,2) NOT NULL,
[dsToDeduct] [numeric] (18,2) NOT NULL,
[dsFromGodownID] [int] NOT NULL,
[dsToGodownID] [int] NOT NULL,
[dsFromShopID] [int] NOT NULL,
[dsToShopID] [int] NOT NULL,
[dsFutureint] [int] NULL,
[dsFutureVC] [varchar] (50) NULL,
[dsCostPrice] [numeric] (18,2) NULL,
[dsTransDate] [datetime] NULL,
[dsDate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MEiDespatchToShopDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MEiDespatchToShopDetail](
[ddDespatchID] [int] NOT NULL,
[ddLocationId] [int] NULL,
[ddGodownID] [int] NOT NULL,
[ddShipmentID] [int] NOT NULL,
[ddItemID] [int] NOT NULL,
[ddShopId] [int] NULL,
[ddItemBadQty] [numeric] (18,3) NULL,
[ddItemGoodQty] [numeric] (18,3) NULL,
[ddcostedprice] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ddpackingtypeid] [int] NULL,
[ddpackqty] [numeric] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MEiDespatchToShopHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MEiDespatchToShopHeader](
[dhDespatchID] [int] NOT NULL,
[dhDespatchNo] [varchar] (50) NULL,
[dhGodownID] [int] NOT NULL,
[dhDespatchDate] [datetime] NULL,
[dhShopID] [int] NULL,
[dhCarrier] [varchar] (250) NULL,
[dhIssueNoteID] [int] NULL,
[dhVehicleNo] [varchar] (50) NULL,
[dhCancelled] [bit] NOT NULL,
[dhCancelledRemarks] [varchar] (250) NULL,
[dhRemarks] [varchar] (500) NULL,
[dhRecaddUser] [varchar] (250) NULL,
[dhRecmodifyUser] [varchar] (250) NULL,
[dhSelected] [bit] NOT NULL,
[dhTransFinished] [bit] NOT NULL,
[dhNoofDetails] [int] NOT NULL,
[dhShopReqid] [int] NULL,
[dhfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[dhshopreqno] [varchar] (100) NULL,
[dhdepartmentid] [int] NULL,
[dhposted] [bit] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[dhconexrate] [numeric] (18,8) NULL,
[dhdepexrate] [numeric] (18,8) NULL,
[dhexchangerates] [varchar] (250) NULL,
[dhDespatchTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MeiGodownRequestDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MeiGodownRequestDetail](
[GRDRequestId] [int] NOT NULL,
[GRDDetailId] [int] NOT NULL,
[GRDGodownId] [int] NOT NULL,
[GRDItemId] [int] NOT NULL,
[GRDReqQty] [numeric] (18,3) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MeiGodownRequestHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MeiGodownRequestHeader](
[GRHRequestId] [int] NOT NULL,
[GRHGodownId] [int] NOT NULL,
[GRHRequestNo] [varchar] (50) NOT NULL,
[GRHRequestDate] [datetime] NULL,
[GRHRemarks] [varchar] (250) NULL,
[GRHCancelled] [bit] NOT NULL,
[GRHCancelledRemarks] [varchar] (250) NULL,
[GRHRecAddUserId] [int] NOT NULL,
[GRHRecModUserId] [int] NULL,
[GRHToShopId] [int] NULL,
[GRHToGodownId] [int] NULL,
[GRHTransfinished] [bit] NOT NULL,
[GRHNoofDetails] [int] NOT NULL,
[GRHType] [varchar] (5) NULL,
[GRHUsed] [bit] NOT NULL,
[UpdateTime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MEiGodownTransferDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MEiGodownTransferDetail](
[gtdDespatchID] [int] NOT NULL,
[gtdGodownID] [int] NOT NULL,
[gtdLocationID] [int] NULL,
[gtdShipmentID] [int] NOT NULL,
[gtdItemID] [int] NOT NULL,
[gtdToGodownid] [int] NULL,
[gtdItemBadQty] [numeric] (18,3) NULL,
[gtdItemGoodQty] [numeric] (18,3) NULL,
[gtdcostprice] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MEiGodownTransferHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MEiGodownTransferHeader](
[gthDespatchID] [int] NOT NULL,
[gthDespatchNo] [varchar] (50) NOT NULL,
[gthFromGodownID] [int] NOT NULL,
[gthToGodownID] [int] NOT NULL,
[gthDespatchDate] [datetime] NOT NULL,
[gthCarrier] [varchar] (250) NULL,
[gthIssueNoteID] [int] NULL,
[gthVehicleNo] [varchar] (50) NULL,
[gthCancelled] [bit] NOT NULL,
[gthCancelledRemarks] [varchar] (250) NULL,
[gthRemarks] [varchar] (250) NULL,
[gthRecAddUser] [varchar] (250) NULL,
[gthRecModifyUser] [varchar] (250) NULL,
[gthSelected] [bit] NOT NULL,
[gthTransFinished] [bit] NOT NULL,
[gthNoofDetails] [int] NOT NULL,
[gthfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[gthdepartmentid] [int] NULL,
[gthposted] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[gthconexrate] [numeric] (18,8) NULL,
[gthdepexrate] [numeric] (18,8) NULL,
[gthexchangerates] [varchar] (250) NULL,
[gthDespatchtime] [datetime] NULL,
[gthGdnReqId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[meiRQtoHQforItem]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[meiRQtoHQforItem](
[GodownID] [int] NOT NULL,
[RequestID] [int] NOT NULL,
[ItemCode] [varchar] (50) NULL,
[ItemDescription] [varchar] (250) NULL,
[Barcode] [varchar] (50) NULL,
[UnitID] [int] NULL,
[PackingTypeID] [int] NULL,
[ColorID] [int] NULL,
[SizeID] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[meiSpecialDespatchtoShopDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[meiSpecialDespatchtoShopDetail](
[ddDespatchid] [int] NOT NULL,
[ddlocationid] [int] NULL,
[ddGodownid] [int] NOT NULL,
[ddShipmentid] [int] NOT NULL,
[ddItemid] [int] NOT NULL,
[ddShopid] [int] NULL,
[ddItemBadQty] [numeric] (18,3) NULL,
[ddItemGoodQty] [numeric] (18,3) NULL,
[ddCostedPrice] [numeric] (18,2) NULL,
[ddinvqty] [numeric] (18,3) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ddPackingTypeID] [int] NULL,
[ddPackQty] [numeric] (18,5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[meiSpecialDespatchtoshopHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[meiSpecialDespatchtoshopHeader](
[dhdespatchid] [int] NOT NULL,
[dhdespatchno] [varchar] (50) NULL,
[dhgodownid] [int] NOT NULL,
[dhdespatchdate] [datetime] NULL,
[dhShopID] [int] NULL,
[dhCarrier] [varchar] (250) NULL,
[dhIssueNoteID] [int] NULL,
[dhVehicleno] [varchar] (50) NULL,
[dhCancelled] [bit] NOT NULL,
[dhCancelledRemarks] [varchar] (250) NULL,
[dhRemarks] [varchar] (250) NULL,
[dhRecAddUser] [varchar] (250) NULL,
[dhRecModifyUser] [varchar] (250) NULL,
[dhSelected] [bit] NOT NULL,
[dhFuture] [varchar] (250) NULL,
[dhposted] [bit] NOT NULL,
[updatetime] [datetime] NOT NULL,
[dhdepartmentid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[dhconexrate] [numeric] (18,8) NULL,
[dhdepexrate] [numeric] (18,8) NULL,
[dhexchangerates] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MEmessages]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MEmessages](
[fromUserID] [int] NULL,
[toUserID] [int] NULL,
[msgDateTime] [datetime] NULL,
[Subject] [varchar] (500) NULL,
[Body] [varchar] (1000) NULL,
[unread] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MEsDespatchtoGodownDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MEsDespatchtoGodownDetail](
[dgdID] [int] NOT NULL,
[dgdShipmentID] [int] NOT NULL,
[dgdItemID] [int] NOT NULL,
[dgdShopID] [int] NOT NULL,
[dgdGodownid] [int] NULL,
[dgdAvailableGoodQty] [numeric] (18,3) NULL,
[dgdAvailableBadQty] [numeric] (18,3) NULL,
[dgdDespatchedGoodQty] [numeric] (18,3) NULL,
[dgdDespatchedBadQty] [numeric] (18,3) NULL,
[dgdcostprice] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MEsDespatchtoGodownHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MEsDespatchtoGodownHeader](
[dghID] [int] NOT NULL,
[dghShopID] [int] NOT NULL,
[dghNo] [varchar] (50) NULL,
[dghDate] [datetime] NULL,
[dghGodownID] [int] NULL,
[dghRemarks] [varchar] (100) NULL,
[dghCancelled] [bit] NOT NULL,
[dghCancelledRemarks] [varchar] (250) NULL,
[dghRecAddUser] [varchar] (50) NULL,
[dghRecModifyUser] [varchar] (50) NULL,
[dghUsed] [bit] NOT NULL,
[dghTransFinished] [bit] NOT NULL,
[dghNoofDetails] [int] NOT NULL,
[dghfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[dghposted] [bit] NULL,
[dghdepartmentid] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[dghconexrate] [numeric] (18,8) NULL,
[dghdepexrate] [numeric] (18,8) NULL,
[dghexchangerates] [varchar] (250) NULL,
[dghtime] [datetime] NULL,
[dghGdnReqId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mesfuture]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mesfuture](
[futureint] [int] NOT NULL,
[futuredatetime] [datetime] NULL,
[futurevarchar] [varchar] (250) NULL,
[futurenumeric] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mesRequesttoShopDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mesRequesttoShopDetail](
[SRDrequestid] [int] NOT NULL,
[srdshopid] [int] NOT NULL,
[srditemid] [int] NOT NULL,
[srdToShopid] [int] NULL,
[srdgoodqty] [numeric] (18,3) NULL,
[srdbadqty] [numeric] (18,3) NULL,
[srdSellingPrice] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mesRequesttoShopHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mesRequesttoShopHeader](
[SRHshopid] [int] NOT NULL,
[SRHrequestID] [int] NOT NULL,
[SRHrequestNO] [varchar] (50) NOT NULL,
[SRHrequestdate] [datetime] NOT NULL,
[SRHremarks] [varchar] (250) NULL,
[SRHcancelled] [bit] NOT NULL,
[SRHcancelledRemarks] [varchar] (250) NULL,
[SRHrecadduser] [varchar] (250) NULL,
[SRHrecmoduser] [varchar] (250) NULL,
[SRHtoShopid] [int] NOT NULL,
[SRHUsed] [bit] NOT NULL,
[SRHTransfinished] [bit] NOT NULL,
[SRHNoofDetails] [int] NOT NULL,
[SRHfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[srhType] [varchar] (5) NULL,
[SRHrequestTime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mesRQtoHQforItem]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mesRQtoHQforItem](
[ShopID] [int] NOT NULL,
[RequestID] [int] NOT NULL,
[ItemCode] [varchar] (50) NULL,
[ItemDescription] [varchar] (250) NULL,
[Barcode] [varchar] (50) NULL,
[UnitID] [int] NULL,
[PackingTypeID] [int] NULL,
[ColorID] [int] NULL,
[SizeID] [int] NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mesTransferOutArrivalDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mesTransferOutArrivalDetail](
[toaShopid] [int] NOT NULL,
[toaTransOutId] [int] NOT NULL,
[toaArrivalId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mesTransferoutDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mesTransferoutDetail](
[TODid] [int] NOT NULL,
[TODshopid] [int] NOT NULL,
[TODitemid] [int] NOT NULL,
[TODshipmentid] [int] NOT NULL,
[TODtoShopid] [int] NULL,
[TODrequestedGoodqty] [numeric] (18,3) NULL,
[TODissuedGoodQty] [numeric] (18,3) NULL,
[TODrequestedBadQty] [numeric] (18,3) NULL,
[TODissuedBadQty] [numeric] (18,3) NULL,
[TODcostprice] [numeric] (18,2) NULL,
[todSellingPrice] [numeric] (18,2) NULL,
[packid] [int] NULL,
[packqty] [numeric] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mesTransferOutHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mesTransferOutHeader](
[TOHid] [int] NOT NULL,
[TOHShopid] [int] NOT NULL,
[TOHtoShopid] [int] NULL,
[TOHno] [varchar] (50) NULL,
[TOHdate] [datetime] NULL,
[TOHremarks] [varchar] (250) NULL,
[TOHCancelled] [bit] NOT NULL,
[TOHCancelledRemarks] [varchar] (250) NULL,
[TOHDoneby] [varchar] (100) NULL,
[TOHrequestid] [int] NULL,
[TOhUsed] [bit] NOT NULL,
[TOHTransfinished] [bit] NOT NULL,
[TOHNoofDetails] [int] NOT NULL,
[TOHfuturevc] [varchar] (250) NOT NULL,
[updatetime] [datetime] NOT NULL,
[tohdepartmentid] [int] NULL,
[tohposted] [bit] NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[tohconexrate] [numeric] (18,8) NULL,
[tohdepexrate] [numeric] (18,8) NULL,
[tohexchangerates] [varchar] (250) NULL,
[tohType] [char] (2) NULL,
[TOHtime] [datetime] NULL,
[tohrecadduser] [varchar] (250) NULL,
[tohrecmodifyuser] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MEsTransLog]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MEsTransLog](
[TransLogID] [int] NOT NULL,
[LogDateTime] [datetime] NULL,
[InterfaceName] [varchar] (250) NULL,
[UserName] [varchar] (250) NULL,
[Function] [varchar] (10) NULL,
[ShopID] [int] NULL,
[GodownID] [int] NULL,
[Comment] [varchar] (1000) NULL,
[systemlog] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[misCategoryDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[misCategoryDetail](
[mcdDetailID] [int] NOT NULL,
[mcdId] [int] NOT NULL,
[mcdName] [varchar] (100) NULL,
[CompanyID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[misCategoryHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[misCategoryHeader](
[mcID] [int] NOT NULL,
[mcName] [varchar] (100) NULL,
[mcSystem] [bit] NULL,
[CompanyID] [int] NOT NULL,
[modulecode] [char] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MiscInquiry]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MiscInquiry](
[QueryID] [int] NOT NULL,
[QueryName] [varchar] (250) NOT NULL,
[Comments] [varchar] (1000) NULL,
[Query] [varchar] (5000) NOT NULL,
[ReportName] [varchar] (50) NULL,
[CompanyId] [int] NULL,
[Active] [bit] NULL,
[Type] [char] (1) NULL,
[Modulecode] [varchar] (10) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MiscSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MiscSettings](
[ItemCodeAutoGen] [bit] NOT NULL,
[SupplierCodeAutoGen] [bit] NOT NULL,
[CustomerCodeAutoGen] [bit] NOT NULL,
[showavailableqtyinTrOut] [bit] NULL,
[showavailableqtyinGReq] [bit] NULL,
[backdateprocess] [bit] NULL,
[lastdatatransfercheckdate] [datetime] NULL,
[showlocationswitch] [bit] NOT NULL,
[freezbalanceday] [int] NULL,
[Docomparebcandstock] [bit] NULL,
[setcom] [varchar] (25) NULL,
[AllowItemCodeDuplication] [bit] NOT NULL,
[allowlocalpurchhq] [bit] NULL,
[fixsellingpriceaftercosting] [bit] NULL,
[allowoldporefinpurchasebill] [bit] NULL,
[customertoshoponcreation] [bit] NULL,
[openingbalancenottallying] [bit] NOT NULL,
[moduleextended] [char] (10) NULL,
[defaultfetch] [varchar] (100) NULL,
[ReportSorting] [bit] NULL,
[AccountsFreezeDate] [datetime] NULL,
[Lctoaccount] [bit] NULL,
[AllowZeroLcMargin] [bit] NULL,
[CustomisedFor] [varchar] (10) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[misMenu]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[misMenu](
[MenuID] [int] NOT NULL,
[MenuName] [varchar] (50) NULL,
[mcID] [int] NOT NULL,
[mcDetailID] [int] NOT NULL,
[MenuShortcutShift] [smallint] NULL,
[MenuShortcutKeycode] [smallint] NULL,
[CompanyID] [int] NOT NULL,
[CategoryId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[misReportMenu]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[misReportMenu](
[ReportID] [int] NOT NULL,
[MenuID] [int] NOT NULL,
[MenuName] [varchar] (100) NULL,
[CompanyID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[misReports]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[misReports](
[ReportID] [int] NOT NULL,
[ReportName] [varchar] (100) NULL,
[CompanyID] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[moafuture]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[moafuture](
[futureint] [int] NOT NULL,
[futurevarchar] [varchar] (250) NULL,
[futuredatetime] [datetime] NULL,
[futurenumeric] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MOaJournalDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MOaJournalDetails](
[JournalDetailID] [int] NOT NULL,
[JournalID] [int] NOT NULL,
[JournalCredit] [bit] NOT NULL,
[AccountID] [int] NULL,
[CustomerID] [int] NULL,
[VendorID] [int] NULL,
[Amount] [numeric] (18,9) NULL,
[ActualAmount] [numeric] (18,9) NULL,
[CompanyID] [int] NOT NULL,
[DepartmentID] [int] NULL,
[depamount] [numeric] (18,9) NULL,
[PostGroup] [int] NULL,
[SubDepartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MOaJournalHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MOaJournalHeader](
[JournalID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[JournalDate] [smalldatetime] NOT NULL,
[ReferenceNo] [varchar] (50) NULL,
[Remarks] [varchar] (1000) NULL,
[Type] [varchar] (10) NULL,
[Cancel] [bit] NOT NULL,
[Realised] [bit] NOT NULL,
[CurrencyId] [int] NULL,
[FinancialID] [int] NULL,
[chequedate] [datetime] NULL,
[updatetime] [datetime] NULL,
[bankdate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[moapoitems]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[moapoitems](
[shopid] [int] NOT NULL,
[itemid] [int] NOT NULL,
[quantity] [numeric] (18,3) NULL,
[remarks] [varchar] (250) NULL,
[username] [varchar] (100) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mocostpreviewtemp]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mocostpreviewtemp](
[slno] [int] NULL,
[Itemname] [varchar] (250) NULL,
[itemqty] [numeric] (18,3) NULL,
[BillUp] [numeric] (28,22) NULL,
[Itemid] [int] NULL,
[customsup] [numeric] (18,2) NULL,
[customsduty] [numeric] (18,2) NULL,
[ocperitem] [numeric] (28,22) NULL,
[custompercent] [numeric] (18,2) NULL,
[dutyperitem] [numeric] (18,2) NULL,
[billid] [int] NULL,
[Billno] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MOiGodownStock]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MOiGodownStock](
[gsGodownID] [int] NOT NULL,
[gsLocationID] [int] NULL,
[gsStockDate] [datetime] NOT NULL,
[gsShipmentID] [int] NOT NULL,
[gsItemID] [int] NOT NULL,
[gsOpeningStock] [numeric] (18,3) NULL,
[gsStock] [numeric] (18,3) NULL,
[gsOpeningBadStock] [numeric] (18,3) NULL,
[gsBadStock] [numeric] (18,3) NULL,
[gsItemCost] [numeric] (18,2) NULL,
[futureint] [int] NULL,
[futuredate] [datetime] NULL,
[futurevarchar] [varchar] (50) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MOiGodownStockBackup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MOiGodownStockBackup](
[gsGodownID] [int] NOT NULL,
[gsLocationID] [int] NOT NULL,
[gsStockDate] [datetime] NOT NULL,
[gsShipmentID] [int] NOT NULL,
[gsItemID] [int] NOT NULL,
[gsOpeningStock] [numeric] (18,3) NULL,
[gsStock] [numeric] (18,3) NULL,
[gsOpeningBadStock] [numeric] (18,3) NULL,
[gsBadStock] [numeric] (18,3) NULL,
[gsItemCost] [numeric] (18,2) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mosGoodsRequestDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mosGoodsRequestDetail](
[GRDrequestID] [int] NOT NULL,
[GRDshopID] [int] NOT NULL,
[GRDitemID] [int] NOT NULL,
[GRDgoodQty] [numeric] (18,3) NULL,
[GRDbadQty] [numeric] (18,3) NULL,
[grdreqcomments] [varchar] (250) NULL,
[grdReqorderstat] [char] (10) NULL,
[grdexpectremarks] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[GRDDetailID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mosGoodsRequestHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mosGoodsRequestHeader](
[GRHrequestID] [int] NOT NULL,
[GRHshopID] [int] NOT NULL,
[GRHrequestNO] [varchar] (50) NOT NULL,
[GRHrequestDate] [datetime] NOT NULL,
[GRHcancel] [bit] NOT NULL,
[GRHcancelRemarks] [varchar] (250) NULL,
[GRHrecAddUser] [varchar] (50) NULL,
[GRHrecModUser] [varchar] (50) NULL,
[GRHremarks] [varchar] (250) NULL,
[GRHIssuenotegenerated] [bit] NOT NULL,
[grhSpecialRequest] [bit] NOT NULL,
[grhTransFinished] [bit] NOT NULL,
[grhNoofDetails] [int] NOT NULL,
[grhfuturevc] [varchar] (250) NOT NULL,
[grhrequesttype] [char] (10) NULL,
[updatetime] [datetime] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[GRHrequestTime] [datetime] NULL,
[grhhqrequestgenerated] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mosrequestinvdetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mosrequestinvdetail](
[reqcompanyid] [int] NOT NULL,
[reqdid] [int] NOT NULL,
[reqinvdshopid] [int] NOT NULL,
[reqinvdinvoiceid] [int] NULL,
[reqddetailid] [int] NULL,
[reqReexportID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mosshopservicestock]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[mosshopservicestock](
[serstkshopid] [int] NOT NULL,
[serstkcompanyid] [int] NOT NULL,
[serstkitemid] [int] NOT NULL,
[serstkstock] [numeric] (18,3) NOT NULL,
[serstkcost] [numeric] (18,8) NULL,
[serstkfutureint] [int] NULL,
[serstkfuturevc] [varchar] (250) NULL,
[serstkfuturebit] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MOsShopStock]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MOsShopStock](
[ShopID] [int] NOT NULL,
[StockDate] [datetime] NOT NULL,
[ShipmentID] [int] NOT NULL,
[ItemID] [int] NOT NULL,
[OpeningStock] [numeric] (18,3) NULL,
[Stock] [numeric] (18,3) NULL,
[OpeningBadStock] [numeric] (18,3) NULL,
[BadStock] [numeric] (18,3) NULL,
[ItemCostPrice] [numeric] (18,3) NULL,
[futureint] [int] NULL,
[futuredate] [datetime] NULL,
[futurevarchar] [varchar] (50) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MOsShopStockBackup]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[MOsShopStockBackup](
[ShopID] [int] NOT NULL,
[StockDate] [datetime] NOT NULL,
[ShipmentID] [int] NOT NULL,
[ItemID] [int] NOT NULL,
[OpeningStock] [numeric] (18,3) NULL,
[Stock] [numeric] (18,3) NULL,
[OpeningBadStock] [numeric] (18,3) NULL,
[BadStock] [numeric] (18,3) NULL,
[ItemCostPrice] [numeric] (18,3) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[moStockWriteOffHQ]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[moStockWriteOffHQ](
[swID] [int] NOT NULL,
[swShopID] [int] NULL,
[swGodownID] [int] NULL,
[swDate] [datetime] NULL,
[swItemID] [int] NULL,
[swCostPrice] [numeric] (18,2) NULL,
[swAddStock] [numeric] (18,3) NULL,
[swDedStock] [numeric] (18,3) NULL,
[swUserName] [varchar] (50) NULL,
[swposted] [bit] NOT NULL,
[updatetime] [datetime] NOT NULL,
[swTransId] [int] NULL,
[swTransCode] [varchar] (50) NULL,
[swWriteOffType] [bit] NULL,
[swdepExRate] [numeric] (18,8) NULL,
[swdConExRate] [numeric] (18,8) NULL,
[swExchangeRates] [varchar] (250) NULL,
[swTranDate] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nid]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[nid](
[poshShopID] [int] NOT NULL,
[poshBillID] [int] NOT NULL,
[poshBillNo] [varchar] (50) NULL,
[poshBillDate] [datetime] NULL,
[poshCustomerName] [varchar] (100) NULL,
[poshCancelled] [bit] NOT NULL,
[poshCancelledRemarks] [varchar] (250) NULL,
[poshRecAddUser] [varchar] (50) NULL,
[poshRecModifyUser] [varchar] (50) NULL,
[poshPosted] [bit] NOT NULL,
[poshDiscount] [numeric] (18,2) NULL,
[poshBillAmount] [numeric] (18,2) NULL,
[poshCashAccID] [int] NULL,
[poshSalesAccID] [int] NULL,
[poshCompanyID] [int] NULL,
[poshReturned] [bit] NOT NULL,
[poshWholesale] [bit] NOT NULL,
[poshcbid] [int] NULL,
[poshExchangeRate] [numeric] (28,8) NOT NULL,
[poshfuturevc] [varchar] (250) NULL,
[updatetime] [datetime] NOT NULL,
[poshDepartmentid] [int] NULL,
[poshsalespersonid] [int] NULL,
[poshcustomerid] [int] NULL,
[poshCustomerCardNo] [varchar] (100) NULL,
[poshfutureint] [int] NULL,
[poshcurexrates] [varchar] (250) NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[poshdepexrate] [numeric] (18,8) NULL,
[poshexchangerates] [varchar] (250) NULL,
[poshUserId] [int] NULL,
[poshCounterId] [int] NULL,
[ContactCardNo] [varchar] (50) NULL,
[poshDiscountAmt] [numeric] (18,2) NULL,
[poshBalance] [numeric] (18,2) NULL,
[poshBillTime] [datetime] NULL,
[poshDeliveryNeeded] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nidd]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[nidd](
[id] [int] NULL,
[name] [varchar] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ol1]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ol1](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ol2]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ol2](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ol3]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ol3](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[paPayAccLinkDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[paPayAccLinkDetails](
[CompanyID] [int] NOT NULL,
[TransID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[DepartmentID] [int] NOT NULL,
[RefTransID] [int] NOT NULL,
[RefTransNo] [varchar] (50) NOT NULL,
[RefTransType] [varchar] (25) NOT NULL,
[RefTransDate] [datetime] NOT NULL,
[EmpID] [int] NOT NULL,
[EmpName] [varchar] (100) NOT NULL,
[EmpNo] [varchar] (100) NOT NULL,
[AccountID] [int] NOT NULL,
[AccountDesc] [varchar] (250) NOT NULL,
[TransCurrSymbol] [varchar] (25) NOT NULL,
[AccCurrSymbol] [varchar] (25) NOT NULL,
[TransCurrID] [varchar] (25) NOT NULL,
[AccCurrID] [varchar] (25) NOT NULL,
[RefTransAmount] [numeric] (18,2) NOT NULL,
[AccountAmount] [numeric] (18,2) NOT NULL,
[DeptAmount] [numeric] (18,2) NOT NULL,
[CompAmount] [numeric] (18,2) NOT NULL,
[Credit] [tinyint] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[paPayAccLinkHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[paPayAccLinkHeader](
[CompanyID] [int] NOT NULL,
[TransID] [int] NOT NULL,
[DepartmentID] [int] NOT NULL,
[TransNo] [varchar] (50) NOT NULL,
[TransDate] [datetime] NOT NULL,
[TransType] [char] (1) NOT NULL,
[Remarks] [varchar] (250) NOT NULL,
[Cancelled] [bit] NOT NULL,
[CancelRemarks] [varchar] (250) NULL,
[Posted] [bit] NOT NULL,
[UpdateTime] [datetime] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[paPayAccLinkPostingDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[paPayAccLinkPostingDetails](
[CompanyID] [int] NOT NULL,
[TransID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[DepartmentID] [int] NOT NULL,
[AccountID] [int] NOT NULL,
[AccountDesc] [varchar] (250) NOT NULL,
[Description] [varchar] (250) NOT NULL,
[AccCurrID] [int] NOT NULL,
[AccCurrSymbol] [varchar] (25) NOT NULL,
[RefCurrID] [int] NOT NULL,
[RefCurrSymbol] [varchar] (25) NOT NULL,
[DebitAmount] [numeric] (18,2) NOT NULL,
[CreditAmount] [numeric] (18,2) NOT NULL,
[RefTransAmount] [numeric] (18,2) NOT NULL,
[DeptAmount] [numeric] (18,2) NOT NULL,
[CompAmount] [numeric] (18,2) NOT NULL,
[Editable] [char] (1) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PIS_EmailScheduler]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[PIS_EmailScheduler](
[ReportId] [int] NOT NULL,
[Discription] [nvarchar] (50) NOT NULL,
[ReportPath] [varchar] (50) NOT NULL,
[SendTime] [datetime] NOT NULL,
[Interval] [char] (10) NOT NULL,
[MonthInterval] [char] (10) NULL,
[WeekInterval] [int] NULL,
[Subject] [nvarchar] (500) NULL,
[Message] [nvarchar] (1000) NULL,
[CompanyId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PIS_EmailSchedulerRecepients]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[PIS_EmailSchedulerRecepients](
[ReportId] [int] NOT NULL,
[UserId] [int] NOT NULL,
[CompanyId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PIS_EmailSchedulerReportParameter]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[PIS_EmailSchedulerReportParameter](
[ReportId] [int] NOT NULL,
[ParameterOrder] [int] NOT NULL,
[ParameterValue] [varchar] (50) NOT NULL,
[CompanyId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PIS_EmailSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[PIS_EmailSettings](
[SMTP] [varchar] (50) NOT NULL,
[Password] [varchar] (50) NOT NULL,
[Port] [nchar] (10) NOT NULL,
[Fromaddress] [varchar] (50) NOT NULL,
[OdbcName] [varchar] (50) NULL,
[OdbcUser] [varchar] (50) NULL,
[OdbcPassword] [varchar] (50) NULL,
[DatabaseName] [varchar] (50) NULL,
[CompanyId] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[posShortCut]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[posShortCut](
[ShortCut] [int] NOT NULL,
[ItemId] [numeric] (18,0) NOT NULL,
[Barcode] [varchar] (30) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Product]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[Product](
[Cust] [varchar] (25) NULL,
[Product] [varchar] (20) NULL,
[QTY] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PurchaseBilldetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[PurchaseBilldetail](
[pbdBillID] [int] NULL,
[pbdItemID] [int] NULL,
[pbdDetailID] [int] NULL,
[pbdPackingTypeID] [int] NULL,
[pbdPOQuantity] [numeric] (18,3) NULL,
[pbdPOUnitPrice] [numeric] (18,8) NULL,
[pbdItemQuantity] [numeric] (18,3) NULL,
[pbdItemUnitPrice] [numeric] (18,8) NULL,
[pbdDummyUnitPrice] [numeric] (18,8) NULL,
[pbdItemCostedPrice] [numeric] (18,8) NULL,
[pbdItemFixedPrice] [numeric] (18,8) NULL,
[pbddiscount] [numeric] (18,2) NULL,
[pbdpoid] [nvarchar] (50) NULL,
[pbdsellingprice] [nvarchar] (50) NULL,
[pbdwholesaleprice] [nvarchar] (50) NULL,
[pbddiscountprice] [nvarchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PurchaseBillHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[PurchaseBillHeader](
[pbhBillID] [int] NULL,
[pbhBillNo] [varchar] (50) NULL,
[pbhVendorBillNo] [varchar] (50) NULL,
[pbhBillDate] [datetime] NULL,
[pbhVendorID] [int] NULL,
[pbhPOID] [int] NULL,
[pbhBillAmount] [numeric] (18,8) NULL,
[pbhDiscount] [numeric] (18,2) NULL,
[pbhDiscountAccID] [int] NULL,
[pbhAdjustmentAmount] [numeric] (18,2) NULL,
[pbhDueDateforPayment] [datetime] NULL,
[pbhBankCashAccID] [int] NULL,
[pbhChequeNo] [varchar] (50) NULL,
[pbhFinancialID] [int] NULL,
[pbhDepartmentID] [int] NULL,
[pbhRemarks] [varchar] (50) NULL,
[pbhTobeDespatched] [bit] NULL,
[pbhDespatched] [bit] NULL,
[pbhCashPurchase] [bit] NULL,
[pbhExchangeNature] [varchar] (50) NULL,
[pbhCancelled] [bit] NULL,
[pbhCancelledRemarks] [varchar] (50) NULL,
[pbhPosted] [bit] NULL,
[pbhRecAddUser] [varchar] (50) NULL,
[pbhRecModifyUser] [varchar] (50) NULL,
[pbhCompanyID] [int] NULL,
[pbhUsed] [bit] NULL,
[pbhvendorRefNo] [varchar] (50) NULL,
[pbhdummyICost] [numeric] (18,2) NULL,
[pbhdummyFCharge] [numeric] (18,2) NULL,
[pbhdummyOCharge] [numeric] (18,2) NULL,
[pbhCustomExchangeRate] [numeric] (18,8) NULL,
[pbhPurchaseAccID] [int] NULL,
[pbhSettled] [bit] NULL,
[pbhexchangerate] [numeric] (18,8) NULL,
[updatetime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RamzanSales]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[RamzanSales](
[SNO] [int] NULL,
[ItemCode] [nvarchar] (255) NULL,
[ ] [nvarchar] (255) NULL,
[CostPrice] [float] NULL,
[SellingPrice] [float] NULL,
[SalePrice] [float] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ReceiptVoucherCreditDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ReceiptVoucherCreditDetails](
[ReceiptDebitID] [int] NOT NULL,
[ReceiptID] [int] NOT NULL,
[CompanyID] [int] NULL,
[AccountID] [int] NULL,
[Amount] [numeric] (18,2) NULL,
[AccountDescription] [nvarchar] (100) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ReceiptVoucherCustomerDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ReceiptVoucherCustomerDetails](
[Companyid] [int] NOT NULL,
[ReceiptId] [int] NOT NULL,
[Detailid] [int] NOT NULL,
[CustomerId] [int] NULL,
[Amount] [numeric] (18,2) NULL,
[CustomerAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ReceiptVoucherDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ReceiptVoucherDetails](
[ReceiptID] [int] NOT NULL,
[ReceiptDetailID] [int] NOT NULL,
[CompanyID] [int] NULL,
[hqAccountsInvoiceID] [int] NULL,
[shopid] [int] NULL,
[posaccountsInvoiceID] [int] NULL,
[posinvoiceid] [int] NULL,
[posspinvoiceid] [int] NULL,
[Posserviceinvoiceid] [int] NULL,
[AmountReceived] [numeric] (18,2) NULL,
[dcnid] [int] NULL,
[dueperiod] [smallint] NULL,
[phpaymentid] [int] NULL,
[losdcnid] [int] NULL,
[posexportid] [int] NULL,
[RoomBillID] [int] NULL,
[UtilityBillID] [int] NULL,
[AccInvoiceID] [int] NULL,
[fineid] [int] NULL,
[fandbInvoiceID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ReceiptVoucherHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ReceiptVoucherHeader](
[ReceiptID] [int] NOT NULL,
[CompanyID] [int] NULL,
[ReceiptNo] [varchar] (50) NULL,
[ReceiptDate] [datetime] NULL,
[CustomerID] [int] NULL,
[VendorID] [int] NULL,
[BankCashAccountID] [int] NOT NULL,
[ReceivedFrom] [varchar] (250) NULL,
[Remarks] [varchar] (250) NULL,
[DepartmentID] [int] NULL,
[ChequeDetails] [varchar] (50) NULL,
[ReferenceNo] [varchar] (50) NULL,
[ReferenceDate] [datetime] NULL,
[Amount] [numeric] (18,2) NULL,
[FinancialID] [int] NULL,
[ExchangeNature] [varchar] (5) NULL,
[cbreferenceno] [varchar] (50) NULL,
[exchangerate] [numeric] (18,8) NULL,
[receipttype] [varchar] (50) NULL,
[customeramount] [numeric] (18,2) NULL,
[debitaccountid] [int] NULL,
[debitamount] [numeric] (18,2) NULL,
[chequedate] [datetime] NULL,
[Posted] [bit] NOT NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (250) NULL,
[dummyreceiptid] [int] NULL,
[recshopid] [int] NULL,
[updatetime] [datetime] NOT NULL,
[creditaccountid] [int] NULL,
[creditamount] [numeric] (18,2) NULL,
[refjournalid] [int] NULL,
[depexrate] [numeric] (18,8) NULL,
[receiptcustomerid] [int] NULL,
[exchangerates] [varchar] (250) NULL,
[paymentid] [int] NULL,
[refdcnid] [int] NULL,
[LastModified] [varchar] (50) NULL,
[cusvenaccexrate] [numeric] (18,8) NULL,
[SubDepartmentID] [int] NULL,
[Discountaccountid] [int] NULL,
[DiscountAmount] [numeric] (18,2) NULL,
[Confirmed] [bit] NOT NULL,
[UserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ReportCategoryDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ReportCategoryDetail](
[RepDetailId] [int] NULL,
[RepCatId] [int] NULL,
[RepDetailName] [varchar] (100) NULL,
[RepConstant] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ReportCategoryHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ReportCategoryHeader](
[repCatId] [int] NOT NULL,
[repCatName] [varchar] (100) NULL,
[repCatModCode] [varchar] (10) NULL,
[Type] [char] (1) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ReportNames]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ReportNames](
[ReportID] [int] NOT NULL,
[ReportName] [varchar] (200) NOT NULL,
[ReportFileName] [varchar] (200) NULL,
[FrameID] [smallint] NULL,
[Criterias] [varchar] (250) NULL,
[ReportTitle] [varchar] (100) NULL,
[BackendType] [varchar] (1) NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[REPORTOUT]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[REPORTOUT](
[RDATE] [datetime] NULL,
[rreceipt] [varchar] (50) NULL,
[rtype] [varchar] (5) NULL,
[rledgername] [varchar] (250) NULL,
[ldebitamt] [varchar] (50) NULL,
[lcreditamt] [varchar] (50) NULL,
[rbalance] [varchar] (50) NULL,
[rcnt] [int] NULL,
[rremarks] [varchar] (1000) NULL,
[rjournalid] [int] NULL,
[rreferenceid] [int] NULL,
[rdiff] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[reportrangevalues]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[reportrangevalues](
[Rangeid] [int] NULL,
[RangeDetailid] [int] NULL,
[Reportid] [int] NULL,
[FromRange] [numeric] (18,2) NULL,
[ToRange] [numeric] (18,2) NULL,
[rangename] [varchar] (250) NULL,
[rangecode] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[restbotkotdetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[restbotkotdetails](
[companyid] [int] NULL,
[Outletid] [int] NULL,
[restno] [int] NULL,
[botid] [int] NULL,
[kotid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SCHEDULEDETAIL]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[SCHEDULEDETAIL](
[scdid] [int] NULL,
[scdjobid] [varchar] (100) NOT NULL,
[scdjobname] [varchar] (250) NOT NULL,
[scdlaststarttime] [datetime] NOT NULL,
[scdlastexecutedtime] [datetime] NOT NULL,
[scdskipno] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ScheduleHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ScheduleHeader](
[schid] [int] NOT NULL,
[schinterval] [int] NOT NULL,
[schstarttime] [datetime] NULL,
[schuptime] [datetime] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ServiceInvoiceDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ServiceInvoiceDetails](
[InvoiceID] [int] NOT NULL,
[InvoiceDetailID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[ServiceName] [varchar] (100) NULL,
[ServiceTerm] [varchar] (50) NULL,
[ServiceQty] [int] NOT NULL,
[Amount] [numeric] (18,2) NULL,
[Accountid] [int] NULL,
[clearingReqId] [int] NULL,
[ClearingOCAmt] [numeric] (18,2) NULL,
[ClearingCommAmt] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL,
[UserID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ShipmentClearenceChequeDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ShipmentClearenceChequeDetails](
[ShopID] [int] NOT NULL,
[ClearenceID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[ChequeNo] [varchar] (50) NULL,
[ChequeAmt] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ShipmentClearenceHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ShipmentClearenceHeader](
[ShopID] [int] NOT NULL,
[ClearenceID] [int] NOT NULL,
[ClearenceNo] [varchar] (50) NULL,
[ClearenceDate] [datetime] NULL,
[ClearedBy] [varchar] (50) NULL,
[ActualClearenceDate] [datetime] NULL,
[Remarks] [varchar] (250) NULL,
[Cancelled] [bit] NULL,
[CancelledRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ShipmentClearenceItemDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ShipmentClearenceItemDetails](
[ShopID] [int] NOT NULL,
[ClearenceID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[ClearenceReqID] [int] NULL,
[ClearenceDetailID] [int] NULL,
[ItemDescription] [varchar] (250) NULL,
[Packing] [varchar] (50) NULL,
[Unit] [varchar] (25) NULL,
[Qty] [numeric] (18,3) NULL,
[Amount] [numeric] (18,2) NULL,
[NoofPackages] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ShipmentClearenceOCDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ShipmentClearenceOCDetails](
[ShopID] [int] NOT NULL,
[ClearenceID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[ClearenceReqID] [int] NULL,
[OCDescription] [varchar] (250) NULL,
[OCAmt] [numeric] (18,2) NULL,
[Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ShipmentClearenceRequestDetails]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ShipmentClearenceRequestDetails](
[ShopID] [int] NOT NULL,
[ClearenceID] [int] NOT NULL,
[DetailID] [int] NOT NULL,
[ClearenceReqID] [int] NULL,
[ArrivalDate] [datetime] NULL,
[BLorAWNo] [varchar] (50) NULL,
[BLorAWDate] [datetime] NULL,
[NoofPackages] [int] NULL,
[GrossWeight] [numeric] (18,3) NULL,
[NameofVessel] [varchar] (250) NULL,
[Remarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ShopbfMealplan]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ShopbfMealplan](
[Companyid] [int] NOT NULL,
[Outletid] [int] NOT NULL,
[Mealnameid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ShopFooterImage]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ShopFooterImage](
[CompanyID] [int] NOT NULL,
[ShopID] [int] NOT NULL,
[FooterImage] [image] NULL,
[type] [varchar] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ShopHeaderImage]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ShopHeaderImage](
[CompanyID] [int] NOT NULL,
[ShopID] [int] NOT NULL,
[HeaderImage] [image] NULL,
[type] [varchar] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[shopstockcheck]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[shopstockcheck](
[locid] [int] NULL,
[loctype] [char] (1) NULL,
[itemid] [int] NULL,
[sdate] [datetime] NULL,
[Transno] [varchar] (100) NULL,
[TransID] [int] NULL,
[Transqty] [numeric] (18,3) NULL,
[Type] [varchar] (50) NULL,
[mode] [int] NULL,
[updatetime] [datetime] NULL,
[oldstock] [numeric] (18,3) NULL,
[newstock] [numeric] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[shopWallpaper]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[shopWallpaper](
[CompanyID] [int] NULL,
[ShopID] [int] NULL,
[WallpaperImage] [image] NULL,
[types] [varchar] (5) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SpecialPriceSettings]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[SpecialPriceSettings](
[IsSPApplied] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SpecialPricing]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[SpecialPricing](
[SPItemId] [int] NULL,
[SPItemCode] [nvarchar] (255) NULL,
[SPPackingTypeId] [int] NULL,
[SPItemCostPrice] [float] NULL,
[SPItemSellingPrice] [float] NULL,
[SPNewPrice] [float] NULL,
[SPPriceChanged] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ss]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[ss](
[t1] [char] (10) NULL,
[t2] [char] (10) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TargetAccountsLink]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TargetAccountsLink](
[tacCompanyID] [int] NOT NULL,
[tacTargetID] [int] NOT NULL,
[tacDetailID] [int] NOT NULL,
[tacAccountID] [int] NULL,
[tacDepartmentID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TargetCheckDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TargetCheckDetail](
[tcdCompanyID] [int] NOT NULL,
[tcdCheckID] [int] NOT NULL,
[tcdDetailId] [int] NOT NULL,
[tcdFixationID] [int] NULL,
[tcdFixationDetailID] [int] NULL,
[tcdActualAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TargetCheckHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TargetCheckHeader](
[tchCompanyID] [int] NOT NULL,
[tchCheckID] [int] NOT NULL,
[tchCheckNo] [varchar] (50) NULL,
[tchCheckDate] [datetime] NULL,
[tchFixationID] [int] NULL,
[tchActualAsonDate] [datetime] NULL,
[tchCheckedBy] [varchar] (250) NULL,
[tchRemarks] [varchar] (250) NULL,
[tchCancelled] [bit] NULL,
[tchCancelledRemarks] [varchar] (250) NULL,
[tchexchagerate] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TargetFixationDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TargetFixationDetail](
[tfdCompanyID] [int] NOT NULL,
[tfdFixationID] [int] NOT NULL,
[tfdDetailID] [int] NOT NULL,
[tfdTargetID] [int] NULL,
[tfdFromDate] [datetime] NULL,
[tfdToDate] [datetime] NULL,
[tfdAmount] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TargetFixationHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TargetFixationHeader](
[tfhCompanyID] [int] NOT NULL,
[tfhFixationID] [int] NOT NULL,
[tfhFixationNo] [varchar] (50) NULL,
[tfhFixationDate] [datetime] NULL,
[tfhFromDate] [datetime] NULL,
[tfhToDate] [datetime] NULL,
[tfhFixationPanel] [varchar] (250) NULL,
[tfhReviewPanel] [varchar] (250) NULL,
[tfhReviewDate] [datetime] NULL,
[tfhSanctionedBy] [varchar] (100) NULL,
[tfhSanctionedDate] [datetime] NULL,
[tfhRemarks] [varchar] (250) NULL,
[tfhCancelled] [bit] NULL,
[tfhCancelledRemarks] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TargetMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TargetMaster](
[CompanyID] [int] NOT NULL,
[TargetID] [int] NOT NULL,
[TargetCode] [varchar] (50) NULL,
[TargetHead] [varchar] (100) NULL,
[tarcurid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tbTest]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[tbTest](
[itemid] [int] NULL,
[value] [varchar] (10) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tempCost]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[tempCost](
[lpchCostingid] [int] NOT NULL,
[lpchDate] [datetime] NULL,
[lpchBillid] [int] NULL,
[lpchShopid] [int] NULL,
[lpcditemid] [int] NULL,
[lpcdcostedprice] [numeric] (28,16) NULL,
[lpcditemqty] [numeric] (18,3) NULL,
[lpcdbillunitprice] [numeric] (28,16) NULL,
[lpcdolditemcostprice] [numeric] (18,2) NULL,
[lpcdnewitemcostprice] [numeric] (28,16) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TempDishCost]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TempDishCost](
[DishID] [numeric] (18,0) NULL,
[DishCostAmt] [decimal] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TempDishSegmentDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TempDishSegmentDetail](
[seg_detail_Tid] [int] NOT NULL,
[seg_detail_Theader_id] [int] NOT NULL,
[seg_detail_Tdishid] [int] NOT NULL,
[seg_detail_Toutletid] [int] NULL,
[seg_detail_Tcompanyid] [int] NOT NULL,
[seg_detail_TUpdateTime] [datetime] NOT NULL,
[seg_detail_TUserID] [int] NULL,
[seg_detail_TLatestID] [int] NOT NULL,
[seg_detail_Tdish_cp] [decimal] (18,3) NULL,
[seg_detail_Tdish_sp_fig] [decimal] (18,3) NULL,
[seg_detail_Tdish_sp_per] [decimal] (18,3) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TempItem]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TempItem](
[Itemid] [int] NULL,
[VendorId] [int] NULL,
[VendorName] [varchar] (250) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TempItemPriceList]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TempItemPriceList](
[ItemPriceId] [int] NOT NULL,
[ItemId] [int] NOT NULL,
[PackingTypeId] [int] NOT NULL,
[ShopId] [int] NULL,
[CostPrice] [numeric] (18,2) NOT NULL,
[SellingPrice] [numeric] (18,2) NOT NULL,
[DiscountPrice] [numeric] (18,2) NOT NULL,
[WholeSalePrice] [numeric] (18,2) NOT NULL,
[UserId] [int] NULL,
[FixDate] [datetime] NULL,
[CompanyId] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TempItemSaleBal]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TempItemSaleBal](
[ItemId] [int] NULL,
[BAlQty] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tempqtywisegrouped]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[tempqtywisegrouped](
[soldyeargrp] [int] NULL,
[soldmonthgrp] [int] NULL,
[rangedetail] [int] NULL,
[rangeqtygrp] [numeric] (18,2) NULL,
[avgmonth] [int] NULL,
[currentstock] [numeric] (18,2) NULL,
[stockvalue] [numeric] (18,2) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tempvaluewise]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[tempvaluewise](
[soldyear] [int] NULL,
[soldmonth] [int] NULL,
[qty] [int] NULL,
[cog] [numeric] (18,2) NULL,
[sales] [numeric] (18,2) NULL,
[avgnoofmonth] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TempVendor]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TempVendor](
[VendorId] [int] NULL,
[VendorName] [varchar] (500) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TempVendorCom]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TempVendorCom](
[CountryId] [int] NULL,
[VendorId] [int] NULL,
[VendorName] [varchar] (500) NULL,
[CountryName] [varchar] (500) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TillBalanceHistory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TillBalanceHistory](
[till_hist_id] [int] NOT NULL,
[till_currencyid] [int] NOT NULL,
[till_amount] [numeric] (18,2) NOT NULL,
[till_outletid] [int] NOT NULL,
[till_companyid] [int] NOT NULL,
[till_status] [bit] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TillClosingstock]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TillClosingstock](
[companyid] [int] NULL,
[tillHistId] [int] NULL,
[tillid] [int] NULL,
[tillNo] [int] NULL,
[shopid] [int] NULL,
[itemid] [int] NULL,
[availablestock] [numeric] (17,3) NULL,
[physicalstock] [numeric] (17,3) NULL,
[packingTypeId] [int] NULL,
[allReceivedStock] [numeric] (18,0) NULL,
[allUsedStock] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TillDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TillDetail](
[till_td_detailid] [int] NOT NULL,
[till_td_tillid] [int] NOT NULL,
[till_td_currencyid] [int] NOT NULL,
[till_td_amount] [numeric] (18,2) NOT NULL,
[till_td_companyid] [int] NOT NULL,
[till_td_outletid] [int] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TillHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TillHeader](
[till_th_tillid] [int] NOT NULL,
[till_th_tillname] [varchar] (50) NOT NULL,
[till_th_outletid] [int] NOT NULL,
[till_th_companyid] [int] NOT NULL,
[till_th_statusid] [int] NULL,
[till_th_remarks] [varchar] (250) NULL,
[till_th_active] [bit] NULL,
[till_th_starttime] [datetime] NULL,
[till_th_endtime] [datetime] NULL,
[till_th_cashierid] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TillHistory]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TillHistory](
[till_hist_id] [int] NOT NULL,
[till_id] [int] NOT NULL,
[till_cashierid] [int] NULL,
[till_starttime] [datetime] NULL,
[till_endtime] [datetime] NULL,
[till_outletid] [int] NOT NULL,
[till_statusid] [int] NOT NULL,
[till_companyid] [int] NOT NULL,
[till_updatettime] [datetime] NOT NULL,
[till_statusremarks] [varchar] (2000) NOT NULL,
[till_managerid] [int] NULL,
[till_createmodify_user] [int] NULL,
[till_no] [int] NULL,
[till_fandbbillno] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TillOpeningstock]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TillOpeningstock](
[companyid] [int] NOT NULL,
[tillHistId] [int] NOT NULL,
[tillid] [int] NOT NULL,
[tillNo] [int] NULL,
[shopid] [int] NOT NULL,
[itemid] [int] NOT NULL,
[openstock] [numeric] (17,3) NULL,
[allReceivedStock] [numeric] (18,0) NULL,
[allUsedStock] [numeric] (18,0) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TillStatusMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TillStatusMaster](
[tillstatus_id] [int] NOT NULL,
[tillstatus_name] [varchar] (50) NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tmpBills]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[tmpBills](
[CompanyID] [int] NULL,
[shopid] [int] NULL,
[DepartmentID] [int] NULL,
[billsid] [int] NULL,
[pbhVendorID] [int] NULL,
[Billsno] [varchar] (50) NULL,
[pbhremarks] [varchar] (1000) NULL,
[Referenceno] [varchar] (100) NULL,
[pbhBilldate] [datetime] NULL,
[duedate] [datetime] NULL,
[pbhBillAmount] [numeric] (18,2) NULL,
[Due] [varchar] (7) NULL,
[Type] [varchar] (4) NULL,
[updatetime] [datetime] NULL,
[age] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TmpInvHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TmpInvHeader](
[serinvhid] [float] NULL,
[serinvhamount] [float] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TmpInvoice]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TmpInvoice](
[serinvhid] [float] NULL,
[serinvhshopid] [float] NULL,
[serinvhamount] [float] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TmpLosServiceInvHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[TmpLosServiceInvHeader](
[serinvhid] [int] NOT NULL,
[serinvhcompanyid] [int] NOT NULL,
[serinvhshopid] [int] NOT NULL,
[serinvhjobcardid] [int] NULL,
[serinvno] [varchar] (50) NULL,
[serinvhrefno] [varchar] (50) NULL,
[serinvhdate] [datetime] NULL,
[serinvhduedate] [datetime] NULL,
[serinvhpreparedby] [varchar] (50) NULL,
[serinvhcancelled] [bit] NULL,
[serinvhserviceamt] [numeric] (18,2) NULL,
[serinvhpartsamt] [numeric] (18,2) NULL,
[serinvhamount] [numeric] (18,2) NULL,
[serinvhposted] [bit] NULL,
[serinvhdepartmentid] [int] NULL,
[serinvhcashacc] [int] NULL,
[serinvhsalesacc] [int] NULL,
[serinvhservacc] [int] NULL,
[serinvhcmpexrate] [numeric] (18,8) NULL,
[serinvhresexrate] [numeric] (18,8) NULL,
[serinvhbaserate] [numeric] (18,8) NULL,
[serinvhsettled] [numeric] (18,2) NULL,
[serinvhremarks] [varchar] (250) NULL,
[serinvcancelremarks] [varchar] (250) NULL,
[serinvhupdatetime] [datetime] NULL,
[serinvhlocid] [int] NULL,
[serinvhitemname] [varchar] (250) NULL,
[serinvhitemid] [int] NULL,
[serinvhDiscount] [numeric] (18,2) NULL,
[serinvhfutureint] [int] NULL,
[serinvhfuturevc] [varchar] (250) NULL,
[serinvhfuturenumuric] [numeric] (18,18) NULL,
[serinvfinancialid] [int] NULL,
[seinvhdepexrate] [numeric] (9,2) NULL,
[serinvhfree] [bit] NULL,
[serinvhexchangerates] [varchar] (250) NULL,
[serinvhcustname] [varchar] (250) NULL,
[serinvhcategid] [int] NULL,
[serinvhmetereading] [varchar] (100) NULL,
[serinvhCustomerId] [int] NULL,
[serinvhCashInv] [bit] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tmpSettlements]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[tmpSettlements](
[companyid] [int] NULL,
[departmentid] [int] NULL,
[billsid] [int] NULL,
[settleddate] [datetime] NULL,
[paidamount] [numeric] (18,2) NULL,
[vendorid] [int] NULL,
[shopid] [int] NULL,
[Type] [varchar] (50) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VendorSettlementDetail]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[VendorSettlementDetail](
[VSID] [int] NOT NULL,
[VSDetailID] [int] NOT NULL,
[CompanyID] [int] NULL,
[BillID] [int] NULL,
[pbhbillid] [int] NULL,
[dcnid] [int] NULL,
[shopid] [int] NULL,
[lphbillid] [int] NULL,
[losdcnid] [int] NULL,
[BillAmount] [numeric] (18,2) NULL,
[SettlementAmount] [numeric] (18,2) NULL,
[receiptid] [int] NULL,
[InterdivBillID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VendorSettlementHeader]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[VendorSettlementHeader](
[VSID] [int] NOT NULL,
[CompanyID] [int] NULL,
[VSNO] [varchar] (50) NULL,
[VSDate] [datetime] NULL,
[DepartmentID] [int] NULL,
[VendorID] [int] NULL,
[PaymentID] [int] NULL,
[dcnid] [int] NULL,
[shopid] [int] NULL,
[lospaymentid] [int] NULL,
[losdcnid] [int] NULL,
[Cancelled] [bit] NOT NULL,
[CancelledRemarks] [varchar] (250) NULL,
[FinancialID] [int] NOT NULL,
[Amount] [numeric] (18,2) NULL,
[updatetime] [datetime] NOT NULL,
[losshopdcnid] [int] NULL,
[losexportid] [int] NULL,
[SubDepartmentID] [int] NULL,
[PReturnID] [int] NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VoucherMaster]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[VoucherMaster](
[VoucherID] [int] NOT NULL,
[VoucherName] [varchar] (50) NOT NULL,
[VoucherAmount] [decimal] (18,2) NOT NULL,
[VoucherCurrencyID] [int] NOT NULL,
[VoucherCompanyID] [int] NOT NULL,
[VoucherActive] [bit] NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[w01]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[w01](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[w02]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[w02](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[w03]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[w03](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[w04]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[w04](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[w05]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[w05](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[w06]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[w06](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[w07]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[w07](
[code_no] [nvarchar] (255) NULL,
[on_hand] [float] NULL,
[code_part] [nvarchar] (255) NULL,
[brand] [nvarchar] (255) NULL,
[size] [nvarchar] (255) NULL,
[cost] [float] NULL,
[selling] [float] NULL,
[cnt_dte] [nvarchar] (255) NULL
)
END
GO
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WeekDays]') AND type in (N'U'))
BEGIN 
CREATE TABLE [dbo].[WeekDays](
[week_id] [int] NOT NULL,
[week_days] [varchar] (10) NOT NULL
)
END
GO
--Script for TABLE FIELDS
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='8-9 am')
BEGIN
	ALTER TABLE [aaaa] ADD [8-9 am] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='9-10 am')
BEGIN
	ALTER TABLE [aaaa] ADD [9-10 am] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='10-11 am')
BEGIN
	ALTER TABLE [aaaa] ADD [10-11 am] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='11-12 am')
BEGIN
	ALTER TABLE [aaaa] ADD [11-12 am] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='12-1 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [12-1 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='1-2 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [1-2 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='2-3 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [2-3 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='3-4 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [3-4 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='4-5 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [4-5 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='5-6 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [5-6 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='6-7 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [6-7 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='7-8 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [7-8 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='8-9 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [8-9 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='9-10 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [9-10 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaaa' AND COLUMN_NAME='10-11 Pm')
BEGIN
	ALTER TABLE [aaaa] ADD [10-11 Pm] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountFinYearOpening' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountFinYearOpening' AND COLUMN_NAME='Accountid')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] ADD [Accountid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountFinYearOpening' AND COLUMN_NAME='Financialid')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] ADD [Financialid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountFinYearOpening' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] ADD [departmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountFinYearOpening' AND COLUMN_NAME='Openingamount')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] ADD [Openingamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountFinYearOpening' AND COLUMN_NAME='Openingactualamount')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] ADD [Openingactualamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountFinYearOpening' AND COLUMN_NAME='openingdepamount')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] ADD [openingdepamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='AccountCode')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [AccountCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [Active] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='GroupID')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [GroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='AccountDesc')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [AccountDesc] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='ControlledAccount')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [ControlledAccount] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='BudgetAmount')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [BudgetAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='openingamount')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [openingamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='openingactualamount')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [openingactualamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='openingdepamount')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [openingdepamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='OrderNo')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [OrderNo] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='Misc')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [Misc] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aAccountMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aAccountM__rowgu__7B5CE8F9] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMasterBackup' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [aAccountMasterBackup] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMasterBackup' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aAccountMasterBackup] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMasterBackup' AND COLUMN_NAME='GroupID')
BEGIN
	ALTER TABLE [aAccountMasterBackup] ADD [GroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMasterBackup' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [aAccountMasterBackup] ADD [FinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMasterBackup' AND COLUMN_NAME='OpeningCreditBalance')
BEGIN
	ALTER TABLE [aAccountMasterBackup] ADD [OpeningCreditBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMasterBackup' AND COLUMN_NAME='OpeningDebitBalance')
BEGIN
	ALTER TABLE [aAccountMasterBackup] ADD [OpeningDebitBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMasterBackup' AND COLUMN_NAME='BudgetAMount')
BEGIN
	ALTER TABLE [aAccountMasterBackup] ADD [BudgetAMount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMasterBackup' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [aAccountMasterBackup] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesAccounts' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [AAccRatioEntitiesAccounts] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesAccounts' AND COLUMN_NAME='EntityID')
BEGIN
	ALTER TABLE [AAccRatioEntitiesAccounts] ADD [EntityID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesAccounts' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [AAccRatioEntitiesAccounts] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesAccounts' AND COLUMN_NAME='CalcType')
BEGIN
	ALTER TABLE [AAccRatioEntitiesAccounts] ADD [CalcType] smallint CONSTRAINT [DF__AAccRatio__CalcT__77816B1D] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [AAccRatioEntitiesMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesMaster' AND COLUMN_NAME='EntityId')
BEGIN
	ALTER TABLE [AAccRatioEntitiesMaster] ADD [EntityId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesMaster' AND COLUMN_NAME='GroupID')
BEGIN
	ALTER TABLE [AAccRatioEntitiesMaster] ADD [GroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesMaster' AND COLUMN_NAME='EntityDesc')
BEGIN
	ALTER TABLE [AAccRatioEntitiesMaster] ADD [EntityDesc] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesMaster' AND COLUMN_NAME='Numerator')
BEGIN
	ALTER TABLE [AAccRatioEntitiesMaster] ADD [Numerator] bit CONSTRAINT [DF__AAccRatio__Numer__71C891C7] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesMaster' AND COLUMN_NAME='GetAverageFigure')
BEGIN
	ALTER TABLE [AAccRatioEntitiesMaster] ADD [GetAverageFigure] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME='GroupID')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD [GroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME='GroupDesc')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD [GroupDesc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME='ParentGroupId')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD [ParentGroupId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME='LevelCode')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD [LevelCode] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD [Active] bit CONSTRAINT [DF__aAccRatio__Activ__4401C717] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME='RatioType')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD [RatioType] [char] (1) CONSTRAINT [DF__aAccRatio__Ratio__74A4FE72] DEFAULT ('P') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME='Multiplier')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD [Multiplier] [numeric] (18,8) CONSTRAINT [DF__aAccRatio__Multi__759922AB] DEFAULT ((1.00)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepformat' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aaccrepformat] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepformat' AND COLUMN_NAME='formatid')
BEGIN
	ALTER TABLE [aaccrepformat] ADD [formatid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepformat' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [aaccrepformat] ADD [Type] [char] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepformat' AND COLUMN_NAME='Partionchar')
BEGIN
	ALTER TABLE [aaccrepformat] ADD [Partionchar] [char] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepformat' AND COLUMN_NAME='FormatName')
BEGIN
	ALTER TABLE [aaccrepformat] ADD [FormatName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepformat' AND COLUMN_NAME='UserCreated')
BEGIN
	ALTER TABLE [aaccrepformat] ADD [UserCreated] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepformat' AND COLUMN_NAME='DefaultFormat')
BEGIN
	ALTER TABLE [aaccrepformat] ADD [DefaultFormat] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepformat' AND COLUMN_NAME='NetCarriedForward')
BEGIN
	ALTER TABLE [aaccrepformat] ADD [NetCarriedForward] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepformat' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [aaccrepformat] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepgroup' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aaccrepgroup] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepgroup' AND COLUMN_NAME='Groupid')
BEGIN
	ALTER TABLE [aaccrepgroup] ADD [Groupid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepgroup' AND COLUMN_NAME='GroupName')
BEGIN
	ALTER TABLE [aaccrepgroup] ADD [GroupName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepgroup' AND COLUMN_NAME='Displayorderid')
BEGIN
	ALTER TABLE [aaccrepgroup] ADD [Displayorderid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepgroup' AND COLUMN_NAME='formatid')
BEGIN
	ALTER TABLE [aaccrepgroup] ADD [formatid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepgroup' AND COLUMN_NAME='iscaption')
BEGIN
	ALTER TABLE [aaccrepgroup] ADD [iscaption] [char] (5) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepgroup' AND COLUMN_NAME='groupcode')
BEGIN
	ALTER TABLE [aaccrepgroup] ADD [groupcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepgroup' AND COLUMN_NAME='Departmentwise')
BEGIN
	ALTER TABLE [aaccrepgroup] ADD [Departmentwise] [char] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aaccrepgroup' AND COLUMN_NAME='Inflow')
BEGIN
	ALTER TABLE [aaccrepgroup] ADD [Inflow] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAlias' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [aAlias] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAlias' AND COLUMN_NAME='AliasId')
BEGIN
	ALTER TABLE [aAlias] ADD [AliasId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAlias' AND COLUMN_NAME='Name')
BEGIN
	ALTER TABLE [aAlias] ADD [Name] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAlias' AND COLUMN_NAME='Alias')
BEGIN
	ALTER TABLE [aAlias] ADD [Alias] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAlias' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [aAlias] ADD [Description] [nvarchar] (500) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='alid')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [alid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='alitemid')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [alitemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='almoveperiod')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [almoveperiod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='almovedqty')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [almovedqty] [decimal] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='alimportperiod')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [alimportperiod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='alimportqty')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [alimportqty] [decimal] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='alDate')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [alDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='alvendorid')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [alvendorid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [updatetime] datetime CONSTRAINT [DF_aAnalysedPOItems_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='alfromdate')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [alfromdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME='altodate')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD [altodate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAtollMaster' AND COLUMN_NAME='AtollID')
BEGIN
	ALTER TABLE [aAtollMaster] ADD [AtollID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAtollMaster' AND COLUMN_NAME='AtollName')
BEGIN
	ALTER TABLE [aAtollMaster] ADD [AtollName] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAtollMaster' AND COLUMN_NAME='DevAtollName')
BEGIN
	ALTER TABLE [aAtollMaster] ADD [DevAtollName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAtollMaster' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aAtollMaster] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAtollMaster' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aAtollMaster] ADD [CountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAtollMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aAtollMaster] ADD [rowguid] uniqueidentifier  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME='BillID')
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD [BillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME='BillDate')
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD [BillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME='Generated')
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD [Generated] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME='RemainderID')
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD [RemainderID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME='amount')
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD [amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME='BillsNo')
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD [BillsNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME='RecurrenceDate')
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD [RecurrenceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateInvoiceRiminder' AND COLUMN_NAME='ReminderGroupID')
BEGIN
	ALTER TABLE [aAutoGenerateInvoiceRiminder] ADD [ReminderGroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateInvoiceRiminder' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [aAutoGenerateInvoiceRiminder] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateInvoiceRiminder' AND COLUMN_NAME='InvoiceID')
BEGIN
	ALTER TABLE [aAutoGenerateInvoiceRiminder] ADD [InvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateInvoiceRiminder' AND COLUMN_NAME='InvoiceDate')
BEGIN
	ALTER TABLE [aAutoGenerateInvoiceRiminder] ADD [InvoiceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateInvoiceRiminder' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [aAutoGenerateInvoiceRiminder] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateInvoiceRiminder' AND COLUMN_NAME='generated')
BEGIN
	ALTER TABLE [aAutoGenerateInvoiceRiminder] ADD [generated] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBackground' AND COLUMN_NAME='BgID')
BEGIN
	ALTER TABLE [aBackground] ADD [BgID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBackground' AND COLUMN_NAME='BgName')
BEGIN
	ALTER TABLE [aBackground] ADD [BgName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBackground' AND COLUMN_NAME='BgColor')
BEGIN
	ALTER TABLE [aBackground] ADD [BgColor] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBackground' AND COLUMN_NAME='BgFileName')
BEGIN
	ALTER TABLE [aBackground] ADD [BgFileName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBackgroundUsers' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [aBackgroundUsers] ADD [UserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBackgroundUsers' AND COLUMN_NAME='Location')
BEGIN
	ALTER TABLE [aBackgroundUsers] ADD [Location] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBackgroundUsers' AND COLUMN_NAME='BgID')
BEGIN
	ALTER TABLE [aBackgroundUsers] ADD [BgID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBankMaster' AND COLUMN_NAME='BankID')
BEGIN
	ALTER TABLE [aBankMaster] ADD [BankID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBankMaster' AND COLUMN_NAME='BankName')
BEGIN
	ALTER TABLE [aBankMaster] ADD [BankName] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBankMaster' AND COLUMN_NAME='Address1')
BEGIN
	ALTER TABLE [aBankMaster] ADD [Address1] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBankMaster' AND COLUMN_NAME='Address2')
BEGIN
	ALTER TABLE [aBankMaster] ADD [Address2] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBankMaster' AND COLUMN_NAME='Address3')
BEGIN
	ALTER TABLE [aBankMaster] ADD [Address3] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBankMaster' AND COLUMN_NAME='BankCode')
BEGIN
	ALTER TABLE [aBankMaster] ADD [BankCode] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBankMaster' AND COLUMN_NAME='BankLocation')
BEGIN
	ALTER TABLE [aBankMaster] ADD [BankLocation] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBankMaster' AND COLUMN_NAME='PhoneNumber')
BEGIN
	ALTER TABLE [aBankMaster] ADD [PhoneNumber] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='abarcodetype' AND COLUMN_NAME='barcodetype')
BEGIN
	ALTER TABLE [abarcodetype] ADD [barcodetype] smallint  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='abarcodetype' AND COLUMN_NAME='filename')
BEGIN
	ALTER TABLE [abarcodetype] ADD [filename] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='abarcodetype' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [abarcodetype] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__abarcodet__rowgu__699C94C3] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcCompanyID')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcDepartmentID')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcID')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcDate')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcCustomerID')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcBankAccName')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcBankAccName] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcReturnedDate')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcReturnedDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcCollectionDate')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcCollectionDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcAmount')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcChequeNo')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcChequeNo] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcReference')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcReference] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcUsername')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcUsername] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcUpdatedUsername')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcUpdatedUsername] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcCancel')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBouncedChequeDetails' AND COLUMN_NAME='BcCancelRemarks')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ADD [BcCancelRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMaster' AND COLUMN_NAME='BrandID')
BEGIN
	ALTER TABLE [aBrandMaster] ADD [BrandID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMaster' AND COLUMN_NAME='BrandName')
BEGIN
	ALTER TABLE [aBrandMaster] ADD [BrandName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aBrandMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aBrandMas__rowgu__38102627] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='MergeID')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [MergeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='MergeDate')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [MergeDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='OldBrandID')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [OldBrandID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='NewBrandID')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [NewBrandID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [Cancelled] int CONSTRAINT [DF_aBrandMergeDetails_Cancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [CancelledRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [Remarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_aBrandMergeDetails_rowguid] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [UserName] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='UpdateDate')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [UpdateDate] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME='UpdateUsername')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD [UpdateUsername] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='InvoiceID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [InvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='InvoiceNo')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [InvoiceNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='InvoiceDate')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [InvoiceDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='OrderNo')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [OrderNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Proforma')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Proforma] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='CashInvoice')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [CashInvoice] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='BankCashID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [BankCashID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='ChequeNo')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [ChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='DuePeriod')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [DuePeriod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Posted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Product')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Product] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Discount')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Discount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='DiscountAccountID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [DiscountAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Cancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='ExchangeNature')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [ExchangeNature] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='SalesAccID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [SalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='ExchangeRate')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [ExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Referenceno')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Referenceno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [updatetime] datetime CONSTRAINT [DF_AccountsInvoiceHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Futurevc')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Futurevc] [varchar] (250) CONSTRAINT [DF_AccountsInvoiceHeader_Futurevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='depexrate')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [depexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='dueDate')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [dueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='RefJournalID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [RefJournalID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='AutoGenerate')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [AutoGenerate] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='ReminderID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [ReminderID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='DummyAdvance')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [DummyAdvance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Pono')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Pono] [varchar] (60) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='RegNo')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [RegNo] [varchar] (60) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='Details')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [Details] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [UserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='TaxPercentage')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [TaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='TaxAmount')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [TaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='ItemTaxCategory')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [ItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME='ExcludeGST')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD [ExcludeGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aChequeReportDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aChequeReportDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aChequeReportDetails' AND COLUMN_NAME='ChequeID')
BEGIN
	ALTER TABLE [aChequeReportDetails] ADD [ChequeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aChequeReportDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [aChequeReportDetails] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aChequeReportDetails' AND COLUMN_NAME='ReportName')
BEGIN
	ALTER TABLE [aChequeReportDetails] ADD [ReportName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME='CityID')
BEGIN
	ALTER TABLE [aCity] ADD [CityID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aCity] ADD [CountryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME='CityCode')
BEGIN
	ALTER TABLE [aCity] ADD [CityCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME='CityName')
BEGIN
	ALTER TABLE [aCity] ADD [CityName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME='AreaCode')
BEGIN
	ALTER TABLE [aCity] ADD [AreaCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME='ZipCodeFrom')
BEGIN
	ALTER TABLE [aCity] ADD [ZipCodeFrom] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME='ZipCodeTo')
BEGIN
	ALTER TABLE [aCity] ADD [ZipCodeTo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aCity] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aCity] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aCity__rowguid__5E3FF0B0] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aColor' AND COLUMN_NAME='ColorID')
BEGIN
	ALTER TABLE [aColor] ADD [ColorID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aColor' AND COLUMN_NAME='ColorCode')
BEGIN
	ALTER TABLE [aColor] ADD [ColorCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aColor' AND COLUMN_NAME='ColorName')
BEGIN
	ALTER TABLE [aColor] ADD [ColorName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aColor' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aColor] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aColor__rowguid__37B03374] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemDetail' AND COLUMN_NAME='ComboId')
BEGIN
	ALTER TABLE [aComboItemDetail] ADD [ComboId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemDetail' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [aComboItemDetail] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemDetail' AND COLUMN_NAME='PackingTypeId')
BEGIN
	ALTER TABLE [aComboItemDetail] ADD [PackingTypeId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemDetail' AND COLUMN_NAME='UnitId')
BEGIN
	ALTER TABLE [aComboItemDetail] ADD [UnitId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemDetail' AND COLUMN_NAME='PackingTypeQty')
BEGIN
	ALTER TABLE [aComboItemDetail] ADD [PackingTypeQty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemDetail' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [aComboItemDetail] ADD [Qty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemDetail' AND COLUMN_NAME='Price')
BEGIN
	ALTER TABLE [aComboItemDetail] ADD [Price] [numeric] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemMaster' AND COLUMN_NAME='ComboID')
BEGIN
	ALTER TABLE [aComboItemMaster] ADD [ComboID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemMaster' AND COLUMN_NAME='ComboCode')
BEGIN
	ALTER TABLE [aComboItemMaster] ADD [ComboCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemMaster' AND COLUMN_NAME='ComboName')
BEGIN
	ALTER TABLE [aComboItemMaster] ADD [ComboName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemMaster' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [aComboItemMaster] ADD [PackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemMaster' AND COLUMN_NAME='SellingPrice')
BEGIN
	ALTER TABLE [aComboItemMaster] ADD [SellingPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemMaster' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [aComboItemMaster] ADD [Active] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemMaster' AND COLUMN_NAME='Barcode')
BEGIN
	ALTER TABLE [aComboItemMaster] ADD [Barcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aComboItemMaster' AND COLUMN_NAME='UnitID')
BEGIN
	ALTER TABLE [aComboItemMaster] ADD [UnitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyImageMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aCompanyImageMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyImageMaster' AND COLUMN_NAME='CompImage')
BEGIN
	ALTER TABLE [aCompanyImageMaster] ADD [CompImage] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyImageMaster' AND COLUMN_NAME='type')
BEGIN
	ALTER TABLE [aCompanyImageMaster] ADD [type] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='Name')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [Name] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='Address1')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [Address1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='Address2')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [Address2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='Address3')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [Address3] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='CityID')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [CityID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [CountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='PhoneNo')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [PhoneNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='FaxNo')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [FaxNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='EmailID')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [EmailID] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aCompanyM__rowgu__41A3B202] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME='CompanyTIN')
BEGIN
	ALTER TABLE [aCompanyMaster] ADD [CompanyTIN] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aContact] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='ContactID')
BEGIN
	ALTER TABLE [aContact] ADD [ContactID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='Salutation')
BEGIN
	ALTER TABLE [aContact] ADD [Salutation] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='Name')
BEGIN
	ALTER TABLE [aContact] ADD [Name] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='Address1')
BEGIN
	ALTER TABLE [aContact] ADD [Address1] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='Address2')
BEGIN
	ALTER TABLE [aContact] ADD [Address2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='Address3')
BEGIN
	ALTER TABLE [aContact] ADD [Address3] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='CardNo')
BEGIN
	ALTER TABLE [aContact] ADD [CardNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='ExpiryDate')
BEGIN
	ALTER TABLE [aContact] ADD [ExpiryDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='Email')
BEGIN
	ALTER TABLE [aContact] ADD [Email] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='PhoneNo')
BEGIN
	ALTER TABLE [aContact] ADD [PhoneNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='CountryId')
BEGIN
	ALTER TABLE [aContact] ADD [CountryId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='CityId')
BEGIN
	ALTER TABLE [aContact] ADD [CityId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='CurrencyId')
BEGIN
	ALTER TABLE [aContact] ADD [CurrencyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='DateofBirth')
BEGIN
	ALTER TABLE [aContact] ADD [DateofBirth] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='Anniversary')
BEGIN
	ALTER TABLE [aContact] ADD [Anniversary] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='Profession')
BEGIN
	ALTER TABLE [aContact] ADD [Profession] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContact' AND COLUMN_NAME='SpouseName')
BEGIN
	ALTER TABLE [aContact] ADD [SpouseName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContainerMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aContainerMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContainerMaster' AND COLUMN_NAME='ContainerID')
BEGIN
	ALTER TABLE [aContainerMaster] ADD [ContainerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContainerMaster' AND COLUMN_NAME='ContainerCode')
BEGIN
	ALTER TABLE [aContainerMaster] ADD [ContainerCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContainerMaster' AND COLUMN_NAME='ContainerDesc')
BEGIN
	ALTER TABLE [aContainerMaster] ADD [ContainerDesc] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aContainerMaster' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aContainerMaster] ADD [CountryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCounterMaster' AND COLUMN_NAME='CounterId')
BEGIN
	ALTER TABLE [aCounterMaster] ADD [CounterId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCounterMaster' AND COLUMN_NAME='CounterName')
BEGIN
	ALTER TABLE [aCounterMaster] ADD [CounterName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCounterMaster' AND COLUMN_NAME='LoggedOn')
BEGIN
	ALTER TABLE [aCounterMaster] ADD [LoggedOn] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCounterMaster' AND COLUMN_NAME='CounterUser')
BEGIN
	ALTER TABLE [aCounterMaster] ADD [CounterUser] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCounterMaster' AND COLUMN_NAME='CounterShopId')
BEGIN
	ALTER TABLE [aCounterMaster] ADD [CounterShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCounterMaster' AND COLUMN_NAME='NextBillId')
BEGIN
	ALTER TABLE [aCounterMaster] ADD [NextBillId] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCounterMaster' AND COLUMN_NAME='NextBillNo')
BEGIN
	ALTER TABLE [aCounterMaster] ADD [NextBillNo] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCounterMaster' AND COLUMN_NAME='TouchScreen')
BEGIN
	ALTER TABLE [aCounterMaster] ADD [TouchScreen] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCounterMaster' AND COLUMN_NAME='cid')
BEGIN
	ALTER TABLE [aCounterMaster] ADD [cid] int IDENTITY(1,1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCountryMaster' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aCountryMaster] ADD [CountryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCountryMaster' AND COLUMN_NAME='CountryName')
BEGIN
	ALTER TABLE [aCountryMaster] ADD [CountryName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCountryMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aCountryMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCountryMaster' AND COLUMN_NAME='Nationality')
BEGIN
	ALTER TABLE [aCountryMaster] ADD [Nationality] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCountryMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aCountryMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aCountryM__rowgu__3D690CCA] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCreditChasing' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aCreditChasing] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCreditChasing' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [aCreditChasing] ADD [DepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCreditChasing' AND COLUMN_NAME='InvoiceNo')
BEGIN
	ALTER TABLE [aCreditChasing] ADD [InvoiceNo] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCreditChasing' AND COLUMN_NAME='CommittedDate')
BEGIN
	ALTER TABLE [aCreditChasing] ADD [CommittedDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCreditChasing' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [aCreditChasing] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCurrencyMaster' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [aCurrencyMaster] ADD [CurrencyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCurrencyMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aCurrencyMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCurrencyMaster' AND COLUMN_NAME='CurrencyName')
BEGIN
	ALTER TABLE [aCurrencyMaster] ADD [CurrencyName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCurrencyMaster' AND COLUMN_NAME='Symbol')
BEGIN
	ALTER TABLE [aCurrencyMaster] ADD [Symbol] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCurrencyMaster' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aCurrencyMaster] ADD [CountryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCurrencyMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aCurrencyMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aCurrency__rowgu__63F8CA06] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aCustomerGroup] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME='CusGroupId')
BEGIN
	ALTER TABLE [aCustomerGroup] ADD [CusGroupId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME='CusGroupName')
BEGIN
	ALTER TABLE [aCustomerGroup] ADD [CusGroupName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME='ParentGroupID')
BEGIN
	ALTER TABLE [aCustomerGroup] ADD [ParentGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME='LevelCode')
BEGIN
	ALTER TABLE [aCustomerGroup] ADD [LevelCode] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aCustomerGroup] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_aCustomerGroup_rowguid] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME='Prefix')
BEGIN
	ALTER TABLE [aCustomerGroup] ADD [Prefix] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME='PrefixActive')
BEGIN
	ALTER TABLE [aCustomerGroup] ADD [PrefixActive] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CustomerName')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CustomerName] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [Active] bit CONSTRAINT [DF_aCustomerMaster_Active] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='Address1')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [Address1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='Address2')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [Address2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='Address3')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [Address3] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CityID')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CityID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactName')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='PhoneNo')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [PhoneNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='FaxNo')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [FaxNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='EmailID')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [EmailID] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CreditLimit')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CreditLimit] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='Comments')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [Comments] [varchar] (750) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='OpeningCreditBalance')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [OpeningCreditBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='OpeningDebitBalance')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [OpeningDebitBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CustomerCode')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CustomerCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CustomerCategory')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CustomerCategory] [varchar] (100) CONSTRAINT [DF_aCustomerMaster_CustomerCategory] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='Dueperiod')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [Dueperiod] int CONSTRAINT [DF_aCustomerMaster_Dueperiod] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='Nationality')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [Nationality] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CustomerCardNo')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CustomerCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='custdob')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [custdob] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='registerdate')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [registerdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='discperc')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [discperc] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='Futureint')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [Futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='futurevc')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [futurevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='customertype')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [customertype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='permitno')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [permitno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='permitexpirydate')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [permitexpirydate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='avgsalesmargin')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [avgsalesmargin] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='debtoraccid')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [debtoraccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aCustomer__rowgu__1F4E99FE] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='segmentid')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [segmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='custgroupname')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [custgroupname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactName1')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactName1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactName2')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactName2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactDesig')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactDesig] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactDesig1')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactDesig1] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactDesig2')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactDesig2] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='webadd')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [webadd] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactEmail')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactEmail] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactEmail1')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactEmail1] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactEmail2')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactEmail2] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactPhone')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactPhone] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactPhone1')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactPhone1] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactPhone2')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactPhone2] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactDOB')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactDOB] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactDOB1')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactDOB1] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactDOB2')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactDOB2] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactAnn')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactAnn] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactAnn1')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactAnn1] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ContactAnn2')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ContactAnn2] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='cusGroupID')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [cusGroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='MonthlyInvoiceCredit')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [MonthlyInvoiceCredit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CreditAllowed')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CreditAllowed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='CUSTOMERTIN')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [CUSTOMERTIN] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='NICNO')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [NICNO] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME='ExcludeGST')
BEGIN
	ALTER TABLE [aCustomerMaster] ADD [ExcludeGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMasterBackUp' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [aCustomerMasterBackUp] ADD [CustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMasterBackUp' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aCustomerMasterBackUp] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMasterBackUp' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [aCustomerMasterBackUp] ADD [FinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMasterBackUp' AND COLUMN_NAME='OpeningCreditBalance')
BEGIN
	ALTER TABLE [aCustomerMasterBackUp] ADD [OpeningCreditBalance] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMasterBackUp' AND COLUMN_NAME='OpeningDebitBalance')
BEGIN
	ALTER TABLE [aCustomerMasterBackUp] ADD [OpeningDebitBalance] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMasterBackUp' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aCustomerMasterBackUp] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aCustomer__rowgu__4321E620] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ACustomerSalesPerson' AND COLUMN_NAME='salespersonid')
BEGIN
	ALTER TABLE [ACustomerSalesPerson] ADD [salespersonid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ACustomerSalesPerson' AND COLUMN_NAME='customerid')
BEGIN
	ALTER TABLE [ACustomerSalesPerson] ADD [customerid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ACustomerSalesPerson' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [ACustomerSalesPerson] ADD [shopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomsMaster' AND COLUMN_NAME='CustomID')
BEGIN
	ALTER TABLE [aCustomsMaster] ADD [CustomID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomsMaster' AND COLUMN_NAME='CustomCategoryCode')
BEGIN
	ALTER TABLE [aCustomsMaster] ADD [CustomCategoryCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomsMaster' AND COLUMN_NAME='CustomCategoryPercent')
BEGIN
	ALTER TABLE [aCustomsMaster] ADD [CustomCategoryPercent] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomsMaster' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [aCustomsMaster] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomsMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aCustomsMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aCustomsM__rowgu__48DABF76] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [DepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='DepartmentName')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [DepartmentName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='BudgetedAmount')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [BudgetedAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='ParentDepId')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [ParentDepId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='LevelCode')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [LevelCode] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='Selected')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [Selected] bit CONSTRAINT [DF_aDepartmentMaster_Selected] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aDepartme__rowgu__271AA44F] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='depcurrencyid')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [depcurrencyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='address1')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [address1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='address2')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [address2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='payablealertbeforedays')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [payablealertbeforedays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='InchargeEmail')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [InchargeEmail] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME='InchargeName')
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD [InchargeName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='adepcontrolaccounts' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [adepcontrolaccounts] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='adepcontrolaccounts' AND COLUMN_NAME='maindepid')
BEGIN
	ALTER TABLE [adepcontrolaccounts] ADD [maindepid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='adepcontrolaccounts' AND COLUMN_NAME='otherdepid')
BEGIN
	ALTER TABLE [adepcontrolaccounts] ADD [otherdepid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='adepcontrolaccounts' AND COLUMN_NAME='controlaccid')
BEGIN
	ALTER TABLE [adepcontrolaccounts] ADD [controlaccid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDeptAccounts' AND COLUMN_NAME='daCompanyID')
BEGIN
	ALTER TABLE [aDeptAccounts] ADD [daCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDeptAccounts' AND COLUMN_NAME='daDepartmentID')
BEGIN
	ALTER TABLE [aDeptAccounts] ADD [daDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDeptAccounts' AND COLUMN_NAME='daAccountID')
BEGIN
	ALTER TABLE [aDeptAccounts] ADD [daAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDeptImageMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aDeptImageMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDeptImageMaster' AND COLUMN_NAME='DeptID')
BEGIN
	ALTER TABLE [aDeptImageMaster] ADD [DeptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDeptImageMaster' AND COLUMN_NAME='DepImage')
BEGIN
	ALTER TABLE [aDeptImageMaster] ADD [DepImage] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDeptImageMaster' AND COLUMN_NAME='type')
BEGIN
	ALTER TABLE [aDeptImageMaster] ADD [type] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='adistributormaster' AND COLUMN_NAME='did')
BEGIN
	ALTER TABLE [adistributormaster] ADD [did] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='adistributormaster' AND COLUMN_NAME='dcode')
BEGIN
	ALTER TABLE [adistributormaster] ADD [dcode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='adistributormaster' AND COLUMN_NAME='dname')
BEGIN
	ALTER TABLE [adistributormaster] ADD [dname] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='adistributormaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [adistributormaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__adistribu__rowgu__5F35AB97] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='AdjustmentDetailID')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [AdjustmentDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='AdjustmentID')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [AdjustmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='JournalCredit')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [JournalCredit] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [AccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='ActualAmount')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [ActualAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentDetails' AND COLUMN_NAME='ConsAmount')
BEGIN
	ALTER TABLE [AdjustmentDetails] ADD [ConsAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='AdjustmentID')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [AdjustmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='AdjustmentDate')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [AdjustmentDate] smalldatetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [Remarks] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='AdjustmentNo')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [AdjustmentNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='AdjustmentType')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [AdjustmentType] [varchar] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='ExchangeGain')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [ExchangeGain] [char] (1) CONSTRAINT [DF_AdjustmentHeader_ExchangeGain] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='Accountid')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [Accountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='Exchangerate')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [Exchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='Departmentid')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [Departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [Cancelled] bit CONSTRAINT [DF_AdjustmentHeader_Cancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [Posted] bit CONSTRAINT [DF_AdjustmentHeader_Posted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='DepExchangerate')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [DepExchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='Exchangerates')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [Exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDocumentTypeMaster' AND COLUMN_NAME='DocTypeCompanyId')
BEGIN
	ALTER TABLE [aDocumentTypeMaster] ADD [DocTypeCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDocumentTypeMaster' AND COLUMN_NAME='DocTypeID')
BEGIN
	ALTER TABLE [aDocumentTypeMaster] ADD [DocTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDocumentTypeMaster' AND COLUMN_NAME='DocTypeCode')
BEGIN
	ALTER TABLE [aDocumentTypeMaster] ADD [DocTypeCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDocumentTypeMaster' AND COLUMN_NAME='DocTypeName')
BEGIN
	ALTER TABLE [aDocumentTypeMaster] ADD [DocTypeName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDummyReports' AND COLUMN_NAME='ReportID')
BEGIN
	ALTER TABLE [aDummyReports] ADD [ReportID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDummyReports' AND COLUMN_NAME='ReportName')
BEGIN
	ALTER TABLE [aDummyReports] ADD [ReportName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDummyReports' AND COLUMN_NAME='Reportconst')
BEGIN
	ALTER TABLE [aDummyReports] ADD [Reportconst] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDummyReports' AND COLUMN_NAME='ReportCatId')
BEGIN
	ALTER TABLE [aDummyReports] ADD [ReportCatId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDummyReports' AND COLUMN_NAME='ReportDetailId')
BEGIN
	ALTER TABLE [aDummyReports] ADD [ReportDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDummyReports' AND COLUMN_NAME='repModuleCode')
BEGIN
	ALTER TABLE [aDummyReports] ADD [repModuleCode] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDummyReports' AND COLUMN_NAME='Ported')
BEGIN
	ALTER TABLE [aDummyReports] ADD [Ported] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFeeMaster' AND COLUMN_NAME='FeeID')
BEGIN
	ALTER TABLE [aFeeMaster] ADD [FeeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFeeMaster' AND COLUMN_NAME='FeeName')
BEGIN
	ALTER TABLE [aFeeMaster] ADD [FeeName] [char] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFeeMaster' AND COLUMN_NAME='HasExpiry')
BEGIN
	ALTER TABLE [aFeeMaster] ADD [HasExpiry] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFinancialYear' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [aFinancialYear] ADD [FinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFinancialYear' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aFinancialYear] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFinancialYear' AND COLUMN_NAME='StartMonth')
BEGIN
	ALTER TABLE [aFinancialYear] ADD [StartMonth] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFinancialYear' AND COLUMN_NAME='StartYear')
BEGIN
	ALTER TABLE [aFinancialYear] ADD [StartYear] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFinancialYear' AND COLUMN_NAME='NoOfPeriod')
BEGIN
	ALTER TABLE [aFinancialYear] ADD [NoOfPeriod] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFinancialYear' AND COLUMN_NAME='CurFinancialYear')
BEGIN
	ALTER TABLE [aFinancialYear] ADD [CurFinancialYear] bit CONSTRAINT [DF_aFinancialYear_CurFinancialYear] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFinancialYear' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aFinancialYear] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aFinancia__rowgu__4E9398CC] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineDetail' AND COLUMN_NAME='fdFineID')
BEGIN
	ALTER TABLE [aFineDetail] ADD [fdFineID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineDetail' AND COLUMN_NAME='fdFineDetailID')
BEGIN
	ALTER TABLE [aFineDetail] ADD [fdFineDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineDetail' AND COLUMN_NAME='fdFineDate')
BEGIN
	ALTER TABLE [aFineDetail] ADD [fdFineDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineDetail' AND COLUMN_NAME='fdFineAmount')
BEGIN
	ALTER TABLE [aFineDetail] ADD [fdFineAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineDetail' AND COLUMN_NAME='fdPosted')
BEGIN
	ALTER TABLE [aFineDetail] ADD [fdPosted] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhCompanyID')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhDepartmentID')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhShopID')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhFinancialID')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhFineID')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhFineID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhFineNo')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhFineNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhTransactionType')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhTransactionType] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhInvoiceID')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhInvoiceNo')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhInvoiceNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhInvoiceDate')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhInvoiceDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhCustomerID')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhDueDate')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhDueDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhLastFineCalDate')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhLastFineCalDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhRespExchangeRate')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhRespExchangeRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhDepExchangeRate')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhDepExchangeRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhComExchangeRate')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhComExchangeRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME='fhInvoiceCancelled')
BEGIN
	ALTER TABLE [aFineHeader] ADD [fhInvoiceCancelled] bit CONSTRAINT [DF__aFineHead__fhInv__2D0887CF] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='FineAmount')
BEGIN
	ALTER TABLE [aFineSetting] ADD [FineAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='FineCalculatingPeriod')
BEGIN
	ALTER TABLE [aFineSetting] ADD [FineCalculatingPeriod] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='Departments')
BEGIN
	ALTER TABLE [aFineSetting] ADD [Departments] [nvarchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='FineAccountID')
BEGIN
	ALTER TABLE [aFineSetting] ADD [FineAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='AccotableDate')
BEGIN
	ALTER TABLE [aFineSetting] ADD [AccotableDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='FineProcessingTime')
BEGIN
	ALTER TABLE [aFineSetting] ADD [FineProcessingTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='FinePercentage')
BEGIN
	ALTER TABLE [aFineSetting] ADD [FinePercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='FineCalculationMethod')
BEGIN
	ALTER TABLE [aFineSetting] ADD [FineCalculationMethod] [varchar] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='DiscountAccountID')
BEGIN
	ALTER TABLE [aFineSetting] ADD [DiscountAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineSetting' AND COLUMN_NAME='DiscountPercentage')
BEGIN
	ALTER TABLE [aFineSetting] ADD [DiscountPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [UserID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='FullName')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [FullName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='LoginName')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [LoginName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='Password')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [Password] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='phone')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [phone] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='fax')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [fax] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='Address')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [Address] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='email')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [email] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='logedon')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [logedon] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aGlobalUsers] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aGlobalUs__rowgu__63E3BB6D] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='GodownID')
BEGIN
	ALTER TABLE [aGodown] ADD [GodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='GodownName')
BEGIN
	ALTER TABLE [aGodown] ADD [GodownName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='GodownLocation')
BEGIN
	ALTER TABLE [aGodown] ADD [GodownLocation] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='GodownSqqFeet')
BEGIN
	ALTER TABLE [aGodown] ADD [GodownSqqFeet] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='GodownIncharge')
BEGIN
	ALTER TABLE [aGodown] ADD [GodownIncharge] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='GodownTelephoneNo')
BEGIN
	ALTER TABLE [aGodown] ADD [GodownTelephoneNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='GodownFaxNo')
BEGIN
	ALTER TABLE [aGodown] ADD [GodownFaxNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='GodownActive')
BEGIN
	ALTER TABLE [aGodown] ADD [GodownActive] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [aGodown] ADD [Remarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='CityID')
BEGIN
	ALTER TABLE [aGodown] ADD [CityID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aGodown] ADD [CountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='Address')
BEGIN
	ALTER TABLE [aGodown] ADD [Address] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='OwnerName')
BEGIN
	ALTER TABLE [aGodown] ADD [OwnerName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='OwnerAddress')
BEGIN
	ALTER TABLE [aGodown] ADD [OwnerAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='OwnerTelephone')
BEGIN
	ALTER TABLE [aGodown] ADD [OwnerTelephone] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aGodown] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='LocationArrangement')
BEGIN
	ALTER TABLE [aGodown] ADD [LocationArrangement] bit CONSTRAINT [DF_aGodown_LocationArrangement] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='Fifo')
BEGIN
	ALTER TABLE [aGodown] ADD [Fifo] bit CONSTRAINT [DF_aGodown_Fifo] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='selected')
BEGIN
	ALTER TABLE [aGodown] ADD [selected] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='ipaddress')
BEGIN
	ALTER TABLE [aGodown] ADD [ipaddress] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='stockwriteoffaccid')
BEGIN
	ALTER TABLE [aGodown] ADD [stockwriteoffaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='DepartmentId')
BEGIN
	ALTER TABLE [aGodown] ADD [DepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='futureint')
BEGIN
	ALTER TABLE [aGodown] ADD [futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='futurevarchar')
BEGIN
	ALTER TABLE [aGodown] ADD [futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='futuredatetime')
BEGIN
	ALTER TABLE [aGodown] ADD [futuredatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aGodown] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aGodown__rowguid__31CED39A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='Accountable')
BEGIN
	ALTER TABLE [aGodown] ADD [Accountable] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME='SubDePartmentID')
BEGIN
	ALTER TABLE [aGodown] ADD [SubDePartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME='GodownID')
BEGIN
	ALTER TABLE [aGodownDetail] ADD [GodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [aGodownDetail] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME='ItemReorderLevel')
BEGIN
	ALTER TABLE [aGodownDetail] ADD [ItemReorderLevel] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME='ReorderQuantity')
BEGIN
	ALTER TABLE [aGodownDetail] ADD [ReorderQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME='OrderRaised')
BEGIN
	ALTER TABLE [aGodownDetail] ADD [OrderRaised] bit CONSTRAINT [DF_aGodownDetail_OrderRaised] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME='QuotationRaised')
BEGIN
	ALTER TABLE [aGodownDetail] ADD [QuotationRaised] bit CONSTRAINT [DF_aGodownDetail_QuotationRaised] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aGodownDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aGodownDe__rowgu__40257DE4] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownItemCategory' AND COLUMN_NAME='Godownid')
BEGIN
	ALTER TABLE [aGodownItemCategory] ADD [Godownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownItemCategory' AND COLUMN_NAME='categoryID')
BEGIN
	ALTER TABLE [aGodownItemCategory] ADD [categoryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownItemCategory' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aGodownItemCategory] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aGodownIt__rowgu__13FCE2E3] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementContents' AND COLUMN_NAME='agcagreementid')
BEGIN
	ALTER TABLE [AgreementContents] ADD [agcagreementid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementContents' AND COLUMN_NAME='agcDepartmentid')
BEGIN
	ALTER TABLE [AgreementContents] ADD [agcDepartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementContents' AND COLUMN_NAME='agcDetailid')
BEGIN
	ALTER TABLE [AgreementContents] ADD [agcDetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementContents' AND COLUMN_NAME='agcContentdesc')
BEGIN
	ALTER TABLE [AgreementContents] ADD [agcContentdesc] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementContents' AND COLUMN_NAME='agcRemark')
BEGIN
	ALTER TABLE [AgreementContents] ADD [agcRemark] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementDetails' AND COLUMN_NAME='agdAgreementid')
BEGIN
	ALTER TABLE [AgreementDetails] ADD [agdAgreementid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementDetails' AND COLUMN_NAME='agdDepartmentid')
BEGIN
	ALTER TABLE [AgreementDetails] ADD [agdDepartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementDetails' AND COLUMN_NAME='agdDetailid')
BEGIN
	ALTER TABLE [AgreementDetails] ADD [agdDetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementDetails' AND COLUMN_NAME='agdDetails')
BEGIN
	ALTER TABLE [AgreementDetails] ADD [agdDetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementFinancialDetails' AND COLUMN_NAME='agfAgreementid')
BEGIN
	ALTER TABLE [AgreementFinancialDetails] ADD [agfAgreementid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementFinancialDetails' AND COLUMN_NAME='agfDepartmentId')
BEGIN
	ALTER TABLE [AgreementFinancialDetails] ADD [agfDepartmentId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementFinancialDetails' AND COLUMN_NAME='agffinanceDetailid')
BEGIN
	ALTER TABLE [AgreementFinancialDetails] ADD [agffinanceDetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementFinancialDetails' AND COLUMN_NAME='agffinanceDetail')
BEGIN
	ALTER TABLE [AgreementFinancialDetails] ADD [agffinanceDetail] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agragreementid')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agragreementid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrDepartmentid')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrDepartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agragreementNo')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agragreementNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agragreementdate')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agragreementdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agragreementdesc')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agragreementdesc] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agragreementtype')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agragreementtype] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrapplicableshopid')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrapplicableshopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrapplicablegodownid')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrapplicablegodownid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrapplicableTo')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrapplicableTo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrValidFromdate')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrValidFromdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrValidTodate')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrValidTodate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrSigneddate')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrSigneddate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrwithCustomerid')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrwithCustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrwithsupplierid')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrwithsupplierid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agragreementwith')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agragreementwith] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrAgencyHOaddress')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrAgencyHOaddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrAgencyContactNo')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrAgencyContactNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrAgencyEmailid')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrAgencyEmailid] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agragencyfindepaddress')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agragencyfindepaddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrfinancecontactNo')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrfinancecontactNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrfinanceEmailid')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrfinanceEmailid] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrLawyer')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrLawyer] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrPhysicalfileLOC')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrPhysicalfileLOC] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrReferenceNo')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrNoofPages')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrNoofPages] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrPointofContact')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrPointofContact] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrPOCaddress')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrPOCaddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrPOCcontactNo')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrPOCcontactNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrPOCdesignation')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrPOCdesignation] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrAlertdays')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrAlertdays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrcancelled')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrcancelled] bit CONSTRAINT [DF_AgreementRegister_agrcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='agrPOCemailid')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [agrPOCemailid] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='alertnoofdays')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [alertnoofdays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME='alertremarks')
BEGIN
	ALTER TABLE [AgreementRegister] ADD [alertremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementScanCopyDetails' AND COLUMN_NAME='agsCompanyID')
BEGIN
	ALTER TABLE [AgreementScanCopyDetails] ADD [agsCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementScanCopyDetails' AND COLUMN_NAME='agsAgreementID')
BEGIN
	ALTER TABLE [AgreementScanCopyDetails] ADD [agsAgreementID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementScanCopyDetails' AND COLUMN_NAME='agsDepartmentID')
BEGIN
	ALTER TABLE [AgreementScanCopyDetails] ADD [agsDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementScanCopyDetails' AND COLUMN_NAME='agsDetailID')
BEGIN
	ALTER TABLE [AgreementScanCopyDetails] ADD [agsDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementScanCopyDetails' AND COLUMN_NAME='agsAgreementName')
BEGIN
	ALTER TABLE [AgreementScanCopyDetails] ADD [agsAgreementName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementScanCopyDetails' AND COLUMN_NAME='agsDocuments')
BEGIN
	ALTER TABLE [AgreementScanCopyDetails] ADD [agsDocuments] image  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementSignedDetails' AND COLUMN_NAME='agsagreementid')
BEGIN
	ALTER TABLE [AgreementSignedDetails] ADD [agsagreementid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementSignedDetails' AND COLUMN_NAME='agsDepartmentid')
BEGIN
	ALTER TABLE [AgreementSignedDetails] ADD [agsDepartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementSignedDetails' AND COLUMN_NAME='agsDetailid')
BEGIN
	ALTER TABLE [AgreementSignedDetails] ADD [agsDetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementSignedDetails' AND COLUMN_NAME='agsSignedBy')
BEGIN
	ALTER TABLE [AgreementSignedDetails] ADD [agsSignedBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementSignedDetails' AND COLUMN_NAME='agsPosition')
BEGIN
	ALTER TABLE [AgreementSignedDetails] ADD [agsPosition] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementSignedDetails' AND COLUMN_NAME='agsSignedDate')
BEGIN
	ALTER TABLE [AgreementSignedDetails] ADD [agsSignedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementSignedDetails' AND COLUMN_NAME='agsAgency')
BEGIN
	ALTER TABLE [AgreementSignedDetails] ADD [agsAgency] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementWitnessDetails' AND COLUMN_NAME='agwAgreementid')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ADD [agwAgreementid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementWitnessDetails' AND COLUMN_NAME='agwDepartmentid')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ADD [agwDepartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementWitnessDetails' AND COLUMN_NAME='agwDetailid')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ADD [agwDetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementWitnessDetails' AND COLUMN_NAME='agwSignedBy')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ADD [agwSignedBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementWitnessDetails' AND COLUMN_NAME='agwPostion')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ADD [agwPostion] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementWitnessDetails' AND COLUMN_NAME='agwSignedDate')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ADD [agwSignedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementWitnessDetails' AND COLUMN_NAME='agwWitenessAddress')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ADD [agwWitenessAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementWitnessDetails' AND COLUMN_NAME='agwAgency')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ADD [agwAgency] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGroupMaster' AND COLUMN_NAME='GroupID')
BEGIN
	ALTER TABLE [aGroupMaster] ADD [GroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGroupMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aGroupMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGroupMaster' AND COLUMN_NAME='GroupDesc')
BEGIN
	ALTER TABLE [aGroupMaster] ADD [GroupDesc] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGroupMaster' AND COLUMN_NAME='AccountType')
BEGIN
	ALTER TABLE [aGroupMaster] ADD [AccountType] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGroupMaster' AND COLUMN_NAME='ParentGroupID')
BEGIN
	ALTER TABLE [aGroupMaster] ADD [ParentGroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGroupMaster' AND COLUMN_NAME='LevelCode')
BEGIN
	ALTER TABLE [aGroupMaster] ADD [LevelCode] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGroupMaster' AND COLUMN_NAME='OrderNo')
BEGIN
	ALTER TABLE [aGroupMaster] ADD [OrderNo] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGroupMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aGroupMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aGroupMas__rowgu__30792600] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='DebtorAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [DebtorAcc] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='SuspenseAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [SuspenseAcc] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='InterestAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [InterestAcc] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='SalesAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [SalesAcc] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='COGSAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [COGSAcc] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='AdjustmentAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [AdjustmentAcc] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='CashControlAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [CashControlAcc] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='RepossessionInvAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [RepossessionInvAcc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='SalesReturnAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [SalesReturnAcc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='wchUnitSerial')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [wchUnitSerial] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='wchLabourCost')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [wchLabourCost] [numeric] (12,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='wchpartCostSupplier')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [wchpartCostSupplier] [numeric] (12,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='wchLabourCostSupplier')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [wchLabourCostSupplier] [numeric] (12,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='wchCreditDate')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [wchCreditDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='GracePeriod')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [GracePeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='FineCharge')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [FineCharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='ManualOrAutomatic')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [ManualOrAutomatic] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='DueAlertBlock')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [DueAlertBlock] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='DefaultChargeAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [DefaultChargeAcc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='AdjustmentCarryingAcc')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [AdjustmentCarryingAcc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPAccountsSettings' AND COLUMN_NAME='posAlertBlock')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ADD [posAlertBlock] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpCompanyID')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDepartmentID')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpFinancialID')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpAgreementID')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpAgreementID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpAgreementNO')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpAgreementNO] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpAgreementDate')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpAgreementDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDeliveryDate')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDeliveryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpItemRegID')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpItemRegID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpQuotationID')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpQuotationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpCustID')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpCustID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='HPofficialName')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [HPofficialName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='HpDeOfficialName')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [HpDeOfficialName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='HpDesignation')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [HpDesignation] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='HpDeDesignation')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [HpDeDesignation] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpWitnessName')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpWitnessName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDeWitnessName')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDeWitnessName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpWitnessAddress')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpWitnessAddress] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDeWitnessAddress')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDeWitnessAddress] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpWitnessNIC')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpWitnessNIC] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpWitnessName2')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpWitnessName2] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDeWitnessName2')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDeWitnessName2] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpWitnessAddress2')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpWitnessAddress2] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDeWitnessAddress2')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDeWitnessAddress2] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpWitnessNIC2')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpWitnessNIC2] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDevVehicleDescription')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDevVehicleDescription] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDevSoldColor')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDevSoldColor] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpCancelRemarks')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpCancelRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDevInstAmount')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDevInstAmount] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDevDownPayment')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDevDownPayment] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDevBalAmt')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDevBalAmt] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpDevMonthlyPay')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpDevMonthlyPay] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpCancel')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpConfirmed')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpConfirmed] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpRemarks')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpRemarks] [nvarchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpUser')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpUser] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpModifiedUser')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpModifiedUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpAgreementDetail' AND COLUMN_NAME='hpModifiedDate')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ADD [hpModifiedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpCompanyID')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpCustomerID')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpSalutation')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpSalutation] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpCustomerName')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpCustomerName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpAddress1')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpAddress1] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpAddress2')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpAddress2] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpAddress3')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpAddress3] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpPhoneNo')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpPhoneNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpEmailID')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpEmailID] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpCountryID')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpCountryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpCityID')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpCityID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPCustomerMaster' AND COLUMN_NAME='hpCurrencyID')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ADD [hpCurrencyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDCompanyID')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDDepartmentID')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDPaymentID')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDDetailID')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDDebitAccountID')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDDebitAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDExRate')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDExRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDAmount')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDItemID')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDRegID')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDRegID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HpDExpiry')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HpDExpiry] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentDetail' AND COLUMN_NAME='HPFeeID')
BEGIN
	ALTER TABLE [aHpFeePaymentDetail] ADD [HPFeeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHCompanyID')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHDepartmentID')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHPaymentID')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HphPaymentNo')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HphPaymentNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHReferenceNo')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHReferenceNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHPaymentDate')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHPaymentDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHAccountID')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHPayee')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHPayee] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHAmount')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHAmount] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHFinancialID')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHCancel')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHCancel] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHPosted')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHPosted] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHExRate')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHExRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHComExRate')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHComExRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHDepExRate')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHDepExRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHUsers')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHUsers] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHUpdateUserName')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHUpdateUserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHUpdateTime')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHRemarks')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHRemarks] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpFeePaymentHeader' AND COLUMN_NAME='HpHCancelRemarks')
BEGIN
	ALTER TABLE [aHpFeePaymentHeader] ADD [HpHCancelRemarks] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='SellingPrice')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [SellingPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='CCashAllowence')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [CCashAllowence] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='SCashAllowence')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [SCashAllowence] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='CSurCharge')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [CSurCharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='SSurCharge')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [SSurCharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='COnInstallment')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [COnInstallment] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='SOnInstallment')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [SOnInstallment] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='CMaxMonths')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [CMaxMonths] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='SMaxMonths')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [SMaxMonths] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='CInflation')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [CInflation] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='SInflation')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [SInflation] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='CDownPayment')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [CDownPayment] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpItemDetails' AND COLUMN_NAME='SDownPayment')
BEGIN
	ALTER TABLE [aHpItemDetails] ADD [SDownPayment] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferDetail' AND COLUMN_NAME='itdCompanyID')
BEGIN
	ALTER TABLE [aHPItemTransferDetail] ADD [itdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferDetail' AND COLUMN_NAME='itdFinancialID')
BEGIN
	ALTER TABLE [aHPItemTransferDetail] ADD [itdFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferDetail' AND COLUMN_NAME='itdTransferID')
BEGIN
	ALTER TABLE [aHPItemTransferDetail] ADD [itdTransferID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferDetail' AND COLUMN_NAME='itdTransferDetailID')
BEGIN
	ALTER TABLE [aHPItemTransferDetail] ADD [itdTransferDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferDetail' AND COLUMN_NAME='itdItemRegID')
BEGIN
	ALTER TABLE [aHPItemTransferDetail] ADD [itdItemRegID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferDetail' AND COLUMN_NAME='itdCurrentLocation')
BEGIN
	ALTER TABLE [aHPItemTransferDetail] ADD [itdCurrentLocation] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferDetail' AND COLUMN_NAME='itdTransLocation')
BEGIN
	ALTER TABLE [aHPItemTransferDetail] ADD [itdTransLocation] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferHeader' AND COLUMN_NAME='ithCompanyID')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ADD [ithCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferHeader' AND COLUMN_NAME='ithFinancialID')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ADD [ithFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferHeader' AND COLUMN_NAME='ithTransferID')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ADD [ithTransferID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferHeader' AND COLUMN_NAME='ithTransferNO')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ADD [ithTransferNO] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferHeader' AND COLUMN_NAME='ithTransferDate')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ADD [ithTransferDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferHeader' AND COLUMN_NAME='ithCancel')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ADD [ithCancel] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferHeader' AND COLUMN_NAME='ithUser')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ADD [ithUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferHeader' AND COLUMN_NAME='ithModifiedUser')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ADD [ithModifiedUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHPItemTransferHeader' AND COLUMN_NAME='ithModifiedTime')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ADD [ithModifiedTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentDetail' AND COLUMN_NAME='hpdCompanyID')
BEGIN
	ALTER TABLE [ahpPaymentDetail] ADD [hpdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentDetail' AND COLUMN_NAME='hpdDepartmentID')
BEGIN
	ALTER TABLE [ahpPaymentDetail] ADD [hpdDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentDetail' AND COLUMN_NAME='hpdPaymentID')
BEGIN
	ALTER TABLE [ahpPaymentDetail] ADD [hpdPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentDetail' AND COLUMN_NAME='hpdDetailID')
BEGIN
	ALTER TABLE [ahpPaymentDetail] ADD [hpdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentDetail' AND COLUMN_NAME='hpdReceiptID')
BEGIN
	ALTER TABLE [ahpPaymentDetail] ADD [hpdReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentDetail' AND COLUMN_NAME='hpdProcessingDetailID')
BEGIN
	ALTER TABLE [ahpPaymentDetail] ADD [hpdProcessingDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphCompanyID')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphDepartmentID')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphPaymentID')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphPaymentNo')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphPaymentNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphRefNo')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphRefNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphPaymentDate')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphPaymentDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphFinancialID')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphCustomerID')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphAccountID')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphRemarks')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphRemarks] [nvarchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphPaymentAmount')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphPaymentAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphCancel')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphCancel] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphCancelRemarks')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphCancelRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphPosted')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphPosted] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphUserName')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphUpdateUserName')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphUpdateUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphUpdateTime')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphBankExchangeRate')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphBankExchangeRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphCusExchangeRate')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphCusExchangeRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphDepExchangeRate')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphDepExchangeRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hphComExchangeRate')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hphComExchangeRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hprhCreditAccID')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hprhCreditAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hprhCreditExRate')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hprhCreditExRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpPaymentHeader' AND COLUMN_NAME='hprhCreditAmount')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ADD [hprhCreditAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpProcessingCashFlowDetail' AND COLUMN_NAME='hpcComapnyID')
BEGIN
	ALTER TABLE [ahpProcessingCashFlowDetail] ADD [hpcComapnyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpProcessingCashFlowDetail' AND COLUMN_NAME='hpcDepartmentID')
BEGIN
	ALTER TABLE [ahpProcessingCashFlowDetail] ADD [hpcDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpProcessingCashFlowDetail' AND COLUMN_NAME='hpcProcessingID')
BEGIN
	ALTER TABLE [ahpProcessingCashFlowDetail] ADD [hpcProcessingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpProcessingCashFlowDetail' AND COLUMN_NAME='hpcDetailID')
BEGIN
	ALTER TABLE [ahpProcessingCashFlowDetail] ADD [hpcDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpProcessingCashFlowDetail' AND COLUMN_NAME='hpcDiscountFactor')
BEGIN
	ALTER TABLE [ahpProcessingCashFlowDetail] ADD [hpcDiscountFactor] [numeric] (18,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpProcessingCashFlowDetail' AND COLUMN_NAME='hpcRental')
BEGIN
	ALTER TABLE [ahpProcessingCashFlowDetail] ADD [hpcRental] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpProcessingCashFlowDetail' AND COLUMN_NAME='hpcDiscountCashFlow')
BEGIN
	ALTER TABLE [ahpProcessingCashFlowDetail] ADD [hpcDiscountCashFlow] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdCompanyID')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdDepartmentID')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdProcessingId')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdProcessingId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdDetailID')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdChequeDate')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdChequeDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdCapital')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdCapital] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdRental')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdRental] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdInterest')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdInterest] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdCapitalRepayment')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdCapitalRepayment] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdCapitalBalance')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdCapitalBalance] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdBankName')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdBankName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdChequeNo')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdChequeNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdAmount')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdSettlementAmount')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdSettlementAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdInterestRate')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdInterestRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdPosted')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdPosted] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetail' AND COLUMN_NAME='hpdChequeStatus')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ADD [hpdChequeStatus] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdCompanyID')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdDepartmentID')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdProcessingId')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdProcessingId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpddetailIDBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpddetailIDBT] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdChequeDateBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdChequeDateBT] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdCapitalBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdCapitalBT] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdRentalBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdRentalBT] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdInterestBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdInterestBT] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdcapitalRepaymentBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdcapitalRepaymentBT] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdCapitalBalanceBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdCapitalBalanceBT] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdBankNameBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdBankNameBT] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdChequeNoBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdChequeNoBT] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdAmountBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdAmountBT] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdSettlementAmountBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdSettlementAmountBT] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdInterestRateBT')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdInterestRateBT] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdPosted')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdPosted] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND COLUMN_NAME='hpdChequeStatus')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ADD [hpdChequeStatus] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphCompanyID')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphDepartmentID')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphProcessingID')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphProcessingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphProcessingNo')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphProcessingNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphProcessingDate')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphProcessingDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphCustomerID')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphInvoiceID')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphUsed')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphUsed] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphFinancialID')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphCancel')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphcancelRemarks')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphcancelRemarks] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphCashPrice')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphCashPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphDownPayment')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphDownPayment] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphBalance')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphBalance] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphNoOfRentals')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphNoOfRentals] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphInterestRate')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphInterestRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphInstallmentPrice')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphInstallmentPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphRentalAmount')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphRentalAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphAdjustmentAmount')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphAdjustmentAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphAmended')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphAmended] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphRemarks')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphuserName')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphuserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphUpdateUserName')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphUpdateUserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphUpdateTime')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphReprocessingType')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphReprocessingType] [char] (7) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphReferenceID')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphReferenceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphBalanceInterest')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphBalanceInterest] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphreprocessaftersettlement')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphreprocessaftersettlement] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpProcessingHeader' AND COLUMN_NAME='hphAdjustmentPosted')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ADD [hphAdjustmentPosted] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdCompanyID')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdDepartmentID')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdReceiptID')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdDetailID')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdPaymentID')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdProcDetailId')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdProcDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdPaymentAmnt')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdPaymentAmnt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdSettledAmnt')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdSettledAmnt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdCashSettledAmnt')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdCashSettledAmnt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptDetail' AND COLUMN_NAME='hprdChqSettledAmnt')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ADD [hprdChqSettledAmnt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhCompanyId')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhDepartmentID')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhReceiptID')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhReceiptNo')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhReceiptNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhReceiptDate')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhReceiptDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhRefNo')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhRefNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhFinancialID')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhCustomerID')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhAccountID')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhAmount')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhRemarks')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhRemarks] [nvarchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhChequeNo')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhChequeNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhBankName')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhBankName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhCancel')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhCancelRemarks')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhCancelRemarks] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhPosted')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhPosted] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhBankExRate')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhBankExRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhCusExRate')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhCusExRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhDepExRate')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhDepExRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhComExRate')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhComExRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhUserName')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhUserName] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhUpdatedUserName')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhUpdatedUserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhUpdatedTime')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhUpdatedTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhCreditAccID')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhCreditAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhCreditExRate')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhCreditExRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhCreditAmount')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhCreditAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhtype')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhtype] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhnewcheque')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhnewcheque] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhNewChequeNo')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhNewChequeNo] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahpReceiptHeader' AND COLUMN_NAME='hprhNewBankName')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ADD [hprhNewBankName] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhCompanyID')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhShopID')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhReceiptID')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhInvoiceNo')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhInvoiceNo] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhInvoiceDate')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhInvoiceDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhCustomerID')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhCancel')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhCancelledRemarks')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhCancelledRemarks] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhPosted')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhPosted] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhBankName')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhBankName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhRemarks')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhChequeNo')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhChequeNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhChequeDate')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhChequeDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND COLUMN_NAME='hprhAmount')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ADD [hprhAmount] [numeric] (18,0) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQBackground' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [aHQBackground] ADD [ShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQBackground' AND COLUMN_NAME='Message')
BEGIN
	ALTER TABLE [aHQBackground] ADD [Message] [nvarchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQBackground' AND COLUMN_NAME='Background')
BEGIN
	ALTER TABLE [aHQBackground] ADD [Background] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQBackground' AND COLUMN_NAME='BackServer')
BEGIN
	ALTER TABLE [aHQBackground] ADD [BackServer] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME='ddDespatchnoteID')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD [ddDespatchnoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME='ddItemID')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD [ddItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME='ddGodownid')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD [ddGodownid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME='ddDetailID')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD [ddDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME='ddShopID')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD [ddShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME='ddPackingTypeID')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD [ddPackingTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME='ddQty')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD [ddQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME='ddCostPrice')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD [ddCostPrice] [numeric] (18,2) CONSTRAINT [DF_aHQDespatchNoteDetails_ddCostPrice] DEFAULT ((0)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aHQDespat__rowgu__62720AF5] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhDespatchNoteMainID')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhDespatchNoteMainID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhDespatchnoteID')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhDespatchnoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhDespatchnoteNo')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhDespatchnoteNo] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhGodownID')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhGodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhCancelled')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhCancelled] bit CONSTRAINT [DF_aHQDespatchnoteHeader_dhCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhShipmentID')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhShipmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhSelected')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhSelected] bit CONSTRAINT [DF_aHQDespatchnoteHeader_dhSelected] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='barcodegenerated')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [barcodegenerated] bit CONSTRAINT [DF_aHQDespatchnoteHeader_barcodegenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhTransFinished')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhTransFinished] bit CONSTRAINT [DF_aHQDespatchnoteHeader_dhTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhNoofDetails')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhNoofDetails] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='Futurevc')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [Futurevc] [varchar] (250) CONSTRAINT [DF_aHQDespatchnoteHeader_Futurevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [updatetime] datetime CONSTRAINT [DF_aHQDespatchnoteHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aHQDespat__rowgu__2942188C] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhshopid')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhshopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME='dhShopReqId')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD [dhShopReqId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmDespatchNoteID')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmDespatchNoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmDespatchNoteNo')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmDespatchNoteNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmDespatchNoteDate')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmDespatchNoteDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmBillID')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmCostPriceFixed')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmCostPriceFixed] bit CONSTRAINT [DF_aHQDespatchNoteMain_dnmCostPriceFixed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmRemarks')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmCancelled')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmCancelled] bit CONSTRAINT [DF_aHQDespatchNoteMain_dnmCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmCancelledRemarks')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmrecAddUser')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmrecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dnmrecModifyUser')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dnmrecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='Futurevc')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [Futurevc] [varchar] (250) CONSTRAINT [DF_aHQDespatchNoteMain_Futurevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [updatetime] datetime CONSTRAINT [DF_aHQDespatchNoteMain_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aHQDespat__rowgu__45DE573A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME='dntime')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD [dntime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='INDIssuenoteID')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [INDIssuenoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='INDGodownid')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [INDGodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='INDLocationID')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [INDLocationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='INDShipmentID')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [INDShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='INDItemID')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [INDItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='INDQty')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [INDQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='INDBadQty')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [INDBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='INDBadQtyRequested')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [INDBadQtyRequested] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='INDgoodQtyRequested')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [INDgoodQtyRequested] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aHQIssuen__rowgu__544C7222] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHIssuenoteID')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHIssuenoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHissuenoteNO')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHissuenoteNO] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHIssuedate')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHIssuedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHGodownID')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHCancelled')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHCancelled] bit CONSTRAINT [DF_aHQIssuenoteHeader_INHCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHToshopID')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHToshopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHTogodownID')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHTogodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHUsed')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHUsed] bit CONSTRAINT [DF_aHQIssuenoteHeader_INHUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHIssuenotemainID')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHIssuenotemainID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHTransFinished')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHTransFinished] bit CONSTRAINT [DF_aHQIssuenoteHeader_INHTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHNoofDetails')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHNoofDetails] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='futurevc')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [futurevc] [varchar] (250) CONSTRAINT [DF_aHQIssuenoteHeader_futurevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHShopReqId')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHShopReqId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [updatetime] datetime CONSTRAINT [DF_aHQIssuenoteHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='inhshopreqno')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [inhshopreqno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aHQIssuen__rowgu__216BEC9A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME='INHIssuetime')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD [INHIssuetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMIssuenoteID')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMIssuenoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMIssuenoteNO')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMIssuenoteNO] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMIssuedate')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMIssuedate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMCancelledremarks')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMCancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMRemarks')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMRecadduser')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMRecadduser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMModifyuser')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMModifyuser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMCancel')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMCancel] bit CONSTRAINT [DF_aHQIssueNoteMain_INMCancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMRequestID')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMRequestID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMShopID')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='futurevc')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [futurevc] [varchar] (250) CONSTRAINT [DF_aHQIssueNoteMain_futurevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [updatetime] datetime CONSTRAINT [DF_aHQIssueNoteMain_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aHQIssueN__rowgu__69B1A35C] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME='INMTime')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD [INMTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingDetails' AND COLUMN_NAME='mgdId')
BEGIN
	ALTER TABLE [aHqMergingDetails] ADD [mgdId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingDetails' AND COLUMN_NAME='mgdCompanyID')
BEGIN
	ALTER TABLE [aHqMergingDetails] ADD [mgdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingDetails' AND COLUMN_NAME='mgdItemId')
BEGIN
	ALTER TABLE [aHqMergingDetails] ADD [mgdItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingDetails' AND COLUMN_NAME='mgdCostPrice')
BEGIN
	ALTER TABLE [aHqMergingDetails] ADD [mgdCostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingDetails' AND COLUMN_NAME='mgdDetailID')
BEGIN
	ALTER TABLE [aHqMergingDetails] ADD [mgdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aHqMergingDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_aHqMergingDetails_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghId')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghCompanyId')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghNo')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghDate')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghItemId')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghItemId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghAddUser')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghModUser')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghModUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghTransFinished')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghTransFinished] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghCostPriceFixed')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghCostPriceFixed] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghRemarks')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghCancelledRemarks')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghCancelled')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghItemCostPrice')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghItemCostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghNoOfRec')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghNoOfRec] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghOldCostPrice')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghOldCostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghQty')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_aHqMergingHeader_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='mghtime')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [mghtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME='MghDepartmentId')
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD [MghDepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddPaymentDebitID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddPaymentDebitID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddPaymentID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddCompanyID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddAccountID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddAmount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddhqpoid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddhqpoid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pdddescription')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pdddescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddcustomeramount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddcustomeramount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddAccountAmount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddAccountAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddVendorExchangeDifference')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddVendorExchangeDifference] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddpaylinktransid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddpaylinktransid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME='pddAgrrementtransID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD [pddAgrrementtransID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdPaymentVoucherID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdPaymentVoucherID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdPaymentID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdCompanyID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdBillsID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdBillsID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdAccBillsID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdAccBillsID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdHQPOID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdHQPOID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdshopid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdshopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdposlpbillid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdposlpbillid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pddcnid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pddcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdPaidAmount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdPaidAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdDuePeriod')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdDuePeriod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdreceiptid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdreceiptid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='shopdcnid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [shopdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND COLUMN_NAME='pdIndevBillsID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ADD [pdIndevBillsID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phPaymentID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phCompanyID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phPaymentNo')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phPaymentNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phPaymentDate')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phPaymentDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phRemarks')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phRemarks] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phBankCashID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phBankCashID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phPayee')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phPayee] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phVendorID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phDepartmentID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phCustomerID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phChequeDetails')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phChequeDetails] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phAmount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phFinancialID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phExchangeNature')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phExchangeNature] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phExchangeRate')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phcbreferenceno')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phcbreferenceno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phCustomeramount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phCustomeramount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phdebitaccountid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phdebitaccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phdebitamount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phdebitamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phchequedate')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phchequedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phPosted')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phlcpayment')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phlcpayment] [varchar] (5) CONSTRAINT [DF_aHQPaymentVoucherHeader_phlcpayment] DEFAULT ('OP') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phGoodsinTransitaccid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phGoodsinTransitaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phCancelled')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phCancelledRemarks')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phfutureint')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phfuturevarchar')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phfuturevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phfuturenumeric')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phfuturenumeric] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [updatetime] datetime CONSTRAINT [DF_aHQPaymentVoucherHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phpohid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phpohid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='refjournalid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [refjournalid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phallowblancheque')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phallowblancheque] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phdepexrate')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phpaidbyvendorid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phpaidbyvendorid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phexchangerates')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='refreceiptid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [refreceiptid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='refdcnid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [refdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='LastModified')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [LastModified] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='refpaymentid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [refpaymentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='otherdeppaymentid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [otherdeppaymentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='vencusaccexrate')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [vencusaccexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phSubDepartmentID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phSubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phPaymentVoucherNo')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phPaymentVoucherNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phTracked')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phTracked] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phconfirmed')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phconfirmed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME='phuserid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD [phuserid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND COLUMN_NAME='PaymentID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD [PaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD [ShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND COLUMN_NAME='RebateApprovalID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD [RebateApprovalID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND COLUMN_NAME='RebateAmt')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD [RebateAmt] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND COLUMN_NAME='SettleAmt')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD [SettleAmt] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND COLUMN_NAME='CustEquivalentAmount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD [CustEquivalentAmount] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND COLUMN_NAME='PaymentID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] ADD [PaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND COLUMN_NAME='SalesCommID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] ADD [SalesCommID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND COLUMN_NAME='SalesCommAmt')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] ADD [SalesCommAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND COLUMN_NAME='SettledAmt')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] ADD [SettledAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND COLUMN_NAME='DeptEquiAmt')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] ADD [DeptEquiAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND COLUMN_NAME='PaymentID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] ADD [PaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND COLUMN_NAME='PromotionID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] ADD [PromotionID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND COLUMN_NAME='PromotionDetailID')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] ADD [PromotionDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND COLUMN_NAME='PromotionAmt')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] ADD [PromotionAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND COLUMN_NAME='SettledAmt')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] ADD [SettledAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND COLUMN_NAME='DeptEquiAmt')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] ADD [DeptEquiAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherVendorDetails' AND COLUMN_NAME='pvdcompanyid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ADD [pvdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherVendorDetails' AND COLUMN_NAME='pvdPaymentid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ADD [pvdPaymentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherVendorDetails' AND COLUMN_NAME='pvdDetailid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ADD [pvdDetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherVendorDetails' AND COLUMN_NAME='pvdVendorid')
BEGIN
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ADD [pvdVendorid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherVendorDetails' AND COLUMN_NAME='pvdAmount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ADD [pvdAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherVendorDetails' AND COLUMN_NAME='pvdVendorAmount')
BEGIN
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ADD [pvdVendorAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDTransId')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDTransId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDChequeid')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDChequeid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDChequeDepartmentid')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDChequeDepartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDChequeShopid')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDChequeShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDChequeEntryDate')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDChequeEntryDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDChequeDebitAccid')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDChequeDebitAccid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDChequeCreditAccid')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDChequeCreditAccid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDChequeRemarks')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDChequeRemarks] [varchar] (200) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDChequePosted')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDChequePosted] bit CONSTRAINT [DF__aHQPDCheq__PDChe__19018F22] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME='PDChequeDtlPrefix')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD [PDChequeDtlPrefix] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentDetails' AND COLUMN_NAME='pdCompanyID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentDetails] ADD [pdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentDetails' AND COLUMN_NAME='pdDepartmentID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentDetails] ADD [pdDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentDetails' AND COLUMN_NAME='pdPaymentID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentDetails] ADD [pdPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentDetails' AND COLUMN_NAME='pdDetailID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentDetails] ADD [pdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentDetails' AND COLUMN_NAME='pdDebitAccountID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentDetails] ADD [pdDebitAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentDetails' AND COLUMN_NAME='pdDescription')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentDetails] ADD [pdDescription] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentDetails' AND COLUMN_NAME='pdExRate')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentDetails] ADD [pdExRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentDetails' AND COLUMN_NAME='pdAmount')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentDetails] ADD [pdAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phCompanyID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phDepartmentID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phPaymentID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phPaymentNo')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phPaymentNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phPaymentDate')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phPaymentDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phAccountID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phReferenceno')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phReferenceno] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phPayee')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phPayee] [varchar] (150) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phRemarks')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phRemarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phAmount')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phFinancialID')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phCancel')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phCancelRemarks')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phCancelRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phPosted')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phPosted] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phExRate')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phExRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phComExRate')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phComExRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phDepExRate')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phDepExRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phUserName')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phUserName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phUpdateUserName')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phUpdateUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqPettyCashPaymentHeader' AND COLUMN_NAME='phUpdateTime')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentHeader] ADD [phUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='TransID')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [TransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='TransNo')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [TransNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='ChDate')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [ChDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='BankName')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [BankName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='ChequeNo')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [ChequeNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [Amount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='ChequeDate')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [ChequeDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='Status')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [Status] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [Remarks] [varchar] (550) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='Cancel')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [Cancel] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='CustomerName')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [CustomerName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='PoshBillID')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [PoshBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='exchangerate')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [exchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='depexchangerates')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [depexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [updatetime] datetime CONSTRAINT [DF__ahqPostDa__updat__11606D5A] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME='Bankid')
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD [Bankid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='StatusID')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [StatusID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='PoID')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [PoID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='VesselID')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [VesselID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='ContainerID')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [ContainerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='StatusDate')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [StatusDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [UserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='UpdateUserName')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [UpdateUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='UpdateDate')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [UpdateDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [CountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='StatusType')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [StatusType] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPurchaseOrderStatus' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [aHQPurchaseOrderStatus] ADD [Remarks] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME='InterfaceID')
BEGIN
	ALTER TABLE [aInterface] ADD [InterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME='InterfaceName')
BEGIN
	ALTER TABLE [aInterface] ADD [InterfaceName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME='ModuleCode')
BEGIN
	ALTER TABLE [aInterface] ADD [ModuleCode] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME='PrefixNeeded')
BEGIN
	ALTER TABLE [aInterface] ADD [PrefixNeeded] int CONSTRAINT [DF_aInterface_PrefixNeeded] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aInterface] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME='menuname')
BEGIN
	ALTER TABLE [aInterface] ADD [menuname] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aInterface] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aInterfac__rowgu__3631FF56] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME='customize')
BEGIN
	ALTER TABLE [aInterface] ADD [customize] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aIslandMaster' AND COLUMN_NAME='IslandID')
BEGIN
	ALTER TABLE [aIslandMaster] ADD [IslandID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aIslandMaster' AND COLUMN_NAME='CompanyiD')
BEGIN
	ALTER TABLE [aIslandMaster] ADD [CompanyiD] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aIslandMaster' AND COLUMN_NAME='AtollID')
BEGIN
	ALTER TABLE [aIslandMaster] ADD [AtollID] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aIslandMaster' AND COLUMN_NAME='IslandName')
BEGIN
	ALTER TABLE [aIslandMaster] ADD [IslandName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aIslandMaster' AND COLUMN_NAME='DevIslandName')
BEGIN
	ALTER TABLE [aIslandMaster] ADD [DevIslandName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [aItem] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ItemCode')
BEGIN
	ALTER TABLE [aItem] ADD [ItemCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ItemDescription')
BEGIN
	ALTER TABLE [aItem] ADD [ItemDescription] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ItemCategoryID')
BEGIN
	ALTER TABLE [aItem] ADD [ItemCategoryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ColorID')
BEGIN
	ALTER TABLE [aItem] ADD [ColorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='SizeID')
BEGIN
	ALTER TABLE [aItem] ADD [SizeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [aItem] ADD [Active] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ItemRate')
BEGIN
	ALTER TABLE [aItem] ADD [ItemRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ReorderQuantity')
BEGIN
	ALTER TABLE [aItem] ADD [ReorderQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ReorderLevel')
BEGIN
	ALTER TABLE [aItem] ADD [ReorderLevel] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='CustomID')
BEGIN
	ALTER TABLE [aItem] ADD [CustomID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='CostingValue')
BEGIN
	ALTER TABLE [aItem] ADD [CostingValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='MarginPercent')
BEGIN
	ALTER TABLE [aItem] ADD [MarginPercent] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='DPMargin')
BEGIN
	ALTER TABLE [aItem] ADD [DPMargin] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='WPMargin')
BEGIN
	ALTER TABLE [aItem] ADD [WPMargin] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='DPQty')
BEGIN
	ALTER TABLE [aItem] ADD [DPQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='WPQty')
BEGIN
	ALTER TABLE [aItem] ADD [WPQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='UnitsID')
BEGIN
	ALTER TABLE [aItem] ADD [UnitsID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='barcode')
BEGIN
	ALTER TABLE [aItem] ADD [barcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='onetimeshipment')
BEGIN
	ALTER TABLE [aItem] ADD [onetimeshipment] bit CONSTRAINT [DF_aItem_onetimeshipment] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='pricefixedathq')
BEGIN
	ALTER TABLE [aItem] ADD [pricefixedathq] bit CONSTRAINT [DF_aItem_pricefixedathq] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='GenerateBC')
BEGIN
	ALTER TABLE [aItem] ADD [GenerateBC] bit CONSTRAINT [DF_aItem_GenerateBC] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ExpiryNoofDays')
BEGIN
	ALTER TABLE [aItem] ADD [ExpiryNoofDays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [aItem] ADD [brand] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ModelNo')
BEGIN
	ALTER TABLE [aItem] ADD [ModelNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='Notes')
BEGIN
	ALTER TABLE [aItem] ADD [Notes] [varchar] (2000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='Vendors')
BEGIN
	ALTER TABLE [aItem] ADD [Vendors] [varchar] (500) CONSTRAINT [DF_aItem_Vendors] DEFAULT ('0') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='QuantityDecimal')
BEGIN
	ALTER TABLE [aItem] ADD [QuantityDecimal] [varchar] (5) CONSTRAINT [DF_aItem_QuantityDecimal] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='forsales')
BEGIN
	ALTER TABLE [aItem] ADD [forsales] bit CONSTRAINT [DF_aItem_itemforsale] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='did')
BEGIN
	ALTER TABLE [aItem] ADD [did] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='Part_code')
BEGIN
	ALTER TABLE [aItem] ADD [Part_code] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='bitf1')
BEGIN
	ALTER TABLE [aItem] ADD [bitf1] bit CONSTRAINT [DF_aItem_bitf1] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='bitf2')
BEGIN
	ALTER TABLE [aItem] ADD [bitf2] bit CONSTRAINT [DF_aItem_bitf2] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='bitf3')
BEGIN
	ALTER TABLE [aItem] ADD [bitf3] bit CONSTRAINT [DF_aItem_bitf3] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='intf1')
BEGIN
	ALTER TABLE [aItem] ADD [intf1] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='intf2')
BEGIN
	ALTER TABLE [aItem] ADD [intf2] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='intf3')
BEGIN
	ALTER TABLE [aItem] ADD [intf3] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='varcharf1')
BEGIN
	ALTER TABLE [aItem] ADD [varcharf1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='itemtype')
BEGIN
	ALTER TABLE [aItem] ADD [itemtype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aItem] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aItem__rowguid__5CECA51B] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='OrginCountryID')
BEGIN
	ALTER TABLE [aItem] ADD [OrginCountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ConsignmentCountryID')
BEGIN
	ALTER TABLE [aItem] ADD [ConsignmentCountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='Volume')
BEGIN
	ALTER TABLE [aItem] ADD [Volume] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='LimitToBeEligibleForFree')
BEGIN
	ALTER TABLE [aItem] ADD [LimitToBeEligibleForFree] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='FreeNos')
BEGIN
	ALTER TABLE [aItem] ADD [FreeNos] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='compvarflag')
BEGIN
	ALTER TABLE [aItem] ADD [compvarflag] bit CONSTRAINT [df_aitem_compvarflag] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='itemvarflag')
BEGIN
	ALTER TABLE [aItem] ADD [itemvarflag] bit CONSTRAINT [df_aitem_itemvarflag] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='Attribute1')
BEGIN
	ALTER TABLE [aItem] ADD [Attribute1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='Attribute2')
BEGIN
	ALTER TABLE [aItem] ADD [Attribute2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='RateSelEnabled')
BEGIN
	ALTER TABLE [aItem] ADD [RateSelEnabled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='customcode')
BEGIN
	ALTER TABLE [aItem] ADD [customcode] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='specification')
BEGIN
	ALTER TABLE [aItem] ADD [specification] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='carddiscount')
BEGIN
	ALTER TABLE [aItem] ADD [carddiscount] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ImageActive')
BEGIN
	ALTER TABLE [aItem] ADD [ImageActive] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='marketrate')
BEGIN
	ALTER TABLE [aItem] ADD [marketrate] [numeric] (9,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='LoyaltyAvailable')
BEGIN
	ALTER TABLE [aItem] ADD [LoyaltyAvailable] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='SerialNoActive')
BEGIN
	ALTER TABLE [aItem] ADD [SerialNoActive] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='SerialNoDupli')
BEGIN
	ALTER TABLE [aItem] ADD [SerialNoDupli] bit CONSTRAINT [DF__aitem__SerialNoD__59B43E70] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='HirePurchase')
BEGIN
	ALTER TABLE [aItem] ADD [HirePurchase] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='AddedDate')
BEGIN
	ALTER TABLE [aItem] ADD [AddedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='InhouseConsAccnt')
BEGIN
	ALTER TABLE [aItem] ADD [InhouseConsAccnt] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='ItemDescDhivehi')
BEGIN
	ALTER TABLE [aItem] ADD [ItemDescDhivehi] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='servWarrantyPeriod')
BEGIN
	ALTER TABLE [aItem] ADD [servWarrantyPeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='partsWarrantyPeriod')
BEGIN
	ALTER TABLE [aItem] ADD [partsWarrantyPeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME='TaxCategoryId')
BEGIN
	ALTER TABLE [aItem] ADD [TaxCategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='ItemCategoryID')
BEGIN
	ALTER TABLE [aItemCategory] ADD [ItemCategoryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='ItemCategoryCode')
BEGIN
	ALTER TABLE [aItemCategory] ADD [ItemCategoryCode] [varchar] (4) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='CategoryNameDescription')
BEGIN
	ALTER TABLE [aItemCategory] ADD [CategoryNameDescription] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='SPDefMargin')
BEGIN
	ALTER TABLE [aItemCategory] ADD [SPDefMargin] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='DPDefMargin')
BEGIN
	ALTER TABLE [aItemCategory] ADD [DPDefMargin] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='WPDefMargin')
BEGIN
	ALTER TABLE [aItemCategory] ADD [WPDefMargin] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='DPDefQty')
BEGIN
	ALTER TABLE [aItemCategory] ADD [DPDefQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='WPDefQty')
BEGIN
	ALTER TABLE [aItemCategory] ADD [WPDefQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='SalesValue')
BEGIN
	ALTER TABLE [aItemCategory] ADD [SalesValue] bit CONSTRAINT [DF_aItemCategory_SalesValue_1] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aItemCategory] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aItemCate__rowgu__5A054B78] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='PItemCategoryId')
BEGIN
	ALTER TABLE [aItemCategory] ADD [PItemCategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='InHouseconsumptionAccnt')
BEGIN
	ALTER TABLE [aItemCategory] ADD [InHouseconsumptionAccnt] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='CategoryDetail')
BEGIN
	ALTER TABLE [aItemCategory] ADD [CategoryDetail] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME='TaxCategoryId')
BEGIN
	ALTER TABLE [aItemCategory] ADD [TaxCategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='MergeID')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [MergeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='MergeDate')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [MergeDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='OldCategoryID')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [OldCategoryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='NewCategoryID')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [NewCategoryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [Cancelled] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [CancelledRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [Remarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [UserName] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='UpdateDate')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [UpdateDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='UpdateUserName')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [UpdateUserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME='Rowguid')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD [Rowguid] uniqueidentifier CONSTRAINT [DF_aItemCategoryMergingDetails_Rowguid] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemImage' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aItemImage] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemImage' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [aItemImage] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemImage' AND COLUMN_NAME='ItemImage1')
BEGIN
	ALTER TABLE [aItemImage] ADD [ItemImage1] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemImage' AND COLUMN_NAME='ItemImage2')
BEGIN
	ALTER TABLE [aItemImage] ADD [ItemImage2] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemImage' AND COLUMN_NAME='ItemImage3')
BEGIN
	ALTER TABLE [aItemImage] ADD [ItemImage3] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemImage' AND COLUMN_NAME='ItemImage4')
BEGIN
	ALTER TABLE [aItemImage] ADD [ItemImage4] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemKitHeader' AND COLUMN_NAME='ItemKitId')
BEGIN
	ALTER TABLE [aItemKitHeader] ADD [ItemKitId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemKitHeader' AND COLUMN_NAME='ItemKitCode')
BEGIN
	ALTER TABLE [aItemKitHeader] ADD [ItemKitCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemKitHeader' AND COLUMN_NAME='ItemKitDesc')
BEGIN
	ALTER TABLE [aItemKitHeader] ADD [ItemKitDesc] [varchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemKitHeader' AND COLUMN_NAME='ItemKitRate')
BEGIN
	ALTER TABLE [aItemKitHeader] ADD [ItemKitRate] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemKitHeader' AND COLUMN_NAME='CustomId')
BEGIN
	ALTER TABLE [aItemKitHeader] ADD [CustomId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemKitHeader' AND COLUMN_NAME='CostingValue')
BEGIN
	ALTER TABLE [aItemKitHeader] ADD [CostingValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemKitHeader' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [aItemKitHeader] ADD [Active] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemKitHeader' AND COLUMN_NAME='ForSales')
BEGIN
	ALTER TABLE [aItemKitHeader] ADD [ForSales] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemKitHeader' AND COLUMN_NAME='PriceFixedatHQ')
BEGIN
	ALTER TABLE [aItemKitHeader] ADD [PriceFixedatHQ] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemPackingDetail' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [aItemPackingDetail] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemPackingDetail' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [aItemPackingDetail] ADD [PackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemPackingDetail' AND COLUMN_NAME='PackingSlNo')
BEGIN
	ALTER TABLE [aItemPackingDetail] ADD [PackingSlNo] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemPackingDetail' AND COLUMN_NAME='PackingBarCode')
BEGIN
	ALTER TABLE [aItemPackingDetail] ADD [PackingBarCode] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemPackingDetail' AND COLUMN_NAME='active')
BEGIN
	ALTER TABLE [aItemPackingDetail] ADD [active] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemPackingDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aItemPackingDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aItemPack__rowgu__66161CA2] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME='KitId')
BEGIN
	ALTER TABLE [aKitItemDetail] ADD [KitId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [aKitItemDetail] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME='PackingTypeId')
BEGIN
	ALTER TABLE [aKitItemDetail] ADD [PackingTypeId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME='UnitId')
BEGIN
	ALTER TABLE [aKitItemDetail] ADD [UnitId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME='PackingTypeQty')
BEGIN
	ALTER TABLE [aKitItemDetail] ADD [PackingTypeQty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [aKitItemDetail] ADD [Qty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME='Price')
BEGIN
	ALTER TABLE [aKitItemDetail] ADD [Price] [numeric] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME='KitDetailId')
BEGIN
	ALTER TABLE [aKitItemDetail] ADD [KitDetailId] int CONSTRAINT [DF__aKitItemD__KitDe__2C146396] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME='KitItemTax')
BEGIN
	ALTER TABLE [aKitItemDetail] ADD [KitItemTax] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='KitID')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [KitID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='KitCode')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [KitCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='KitName')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [KitName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [PackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='SellingPrice')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [SellingPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [Active] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='Barcode')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [Barcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='UnitID')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [UnitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='GenerateBarcode')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [GenerateBarcode] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME='KitTax')
BEGIN
	ALTER TABLE [aKitItemMaster] ADD [KitTax] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcCompanyID')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcDepartmentID')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcID')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcNo')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcNo] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcDate')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcFinancialid')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcFinancialid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcVendorID')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcVendorName')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcVendorName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcVendorCurrId')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcVendorCurrId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcBankName')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcBankName] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcBankAccName')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcBankAccName] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcShipmentDetails')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcShipmentDetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcShipmentTermsDetails')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcShipmentTermsDetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcPaymentTerms')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcPaymentTerms] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcReference')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcReference] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcUsername')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcUsername] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcUpdatedUsername')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcUpdatedUsername] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcCancel')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcCancelRemarks')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcCancelRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcEstDate')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcEstDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcDueDate')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcDueDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcAmount')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcMargin')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcMargin] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcBalance')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcExchangeRates')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcExchangeRates] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcComExchangeRate')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcComExchangeRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLCRegisterDetails' AND COLUMN_NAME='LcDepExchangeRate')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ADD [LcDepExchangeRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aletterformat' AND COLUMN_NAME='letterid')
BEGIN
	ALTER TABLE [aletterformat] ADD [letterid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aletterformat' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aletterformat] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aletterformat' AND COLUMN_NAME='lettercode')
BEGIN
	ALTER TABLE [aletterformat] ADD [lettercode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aletterformat' AND COLUMN_NAME='lettername')
BEGIN
	ALTER TABLE [aletterformat] ADD [lettername] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aletterformat' AND COLUMN_NAME='details')
BEGIN
	ALTER TABLE [aletterformat] ADD [details] [varchar] (2000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListItemDetails' AND COLUMN_NAME='ListID')
BEGIN
	ALTER TABLE [aListItemDetails] ADD [ListID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListItemDetails' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [aListItemDetails] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListItemDetails' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [aListItemDetails] ADD [Qty] [numeric] (18,2) CONSTRAINT [DF_aListItemDetails_Qty] DEFAULT ((1)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListItemDetails' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [aListItemDetails] ADD [PackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListItemDetails' AND COLUMN_NAME='PQty')
BEGIN
	ALTER TABLE [aListItemDetails] ADD [PQty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListItemMaster' AND COLUMN_NAME='Listid')
BEGIN
	ALTER TABLE [aListItemMaster] ADD [Listid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListItemMaster' AND COLUMN_NAME='ListCode')
BEGIN
	ALTER TABLE [aListItemMaster] ADD [ListCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListItemMaster' AND COLUMN_NAME='ListDescription')
BEGIN
	ALTER TABLE [aListItemMaster] ADD [ListDescription] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewDetails' AND COLUMN_NAME='lvwdid')
BEGIN
	ALTER TABLE [aListViewDetails] ADD [lvwdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewDetails' AND COLUMN_NAME='lvwcolid')
BEGIN
	ALTER TABLE [aListViewDetails] ADD [lvwcolid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewDetails' AND COLUMN_NAME='lvwdcolname')
BEGIN
	ALTER TABLE [aListViewDetails] ADD [lvwdcolname] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewDetails' AND COLUMN_NAME='lvwdcolwidth')
BEGIN
	ALTER TABLE [aListViewDetails] ADD [lvwdcolwidth] int CONSTRAINT [DF_aListViewDetails_lvwdcolwidth] DEFAULT ((1500))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewDetails' AND COLUMN_NAME='lvwdcolalign')
BEGIN
	ALTER TABLE [aListViewDetails] ADD [lvwdcolalign] int CONSTRAINT [DF_aListViewDetails_lvwdcolalign] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewDetails' AND COLUMN_NAME='lvwdlistcoltype')
BEGIN
	ALTER TABLE [aListViewDetails] ADD [lvwdlistcoltype] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewDetails' AND COLUMN_NAME='lvwdcolprec')
BEGIN
	ALTER TABLE [aListViewDetails] ADD [lvwdcolprec] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewHeader' AND COLUMN_NAME='lvwid')
BEGIN
	ALTER TABLE [aListViewHeader] ADD [lvwid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewHeader' AND COLUMN_NAME='lvwtransname')
BEGIN
	ALTER TABLE [aListViewHeader] ADD [lvwtransname] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewHeader' AND COLUMN_NAME='lvwmodulename')
BEGIN
	ALTER TABLE [aListViewHeader] ADD [lvwmodulename] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewHeader' AND COLUMN_NAME='lvwname')
BEGIN
	ALTER TABLE [aListViewHeader] ADD [lvwname] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='alocationdsn' AND COLUMN_NAME='LocationID')
BEGIN
	ALTER TABLE [alocationdsn] ADD [LocationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='alocationdsn' AND COLUMN_NAME='LocationType')
BEGIN
	ALTER TABLE [alocationdsn] ADD [LocationType] [varchar] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='alocationdsn' AND COLUMN_NAME='ServerName')
BEGIN
	ALTER TABLE [alocationdsn] ADD [ServerName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='alocationdsn' AND COLUMN_NAME='DsnName')
BEGIN
	ALTER TABLE [alocationdsn] ADD [DsnName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aloGroupreportrights' AND COLUMN_NAME='userGroupid')
BEGIN
	ALTER TABLE [aloGroupreportrights] ADD [userGroupid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aloGroupreportrights' AND COLUMN_NAME='reportid')
BEGIN
	ALTER TABLE [aloGroupreportrights] ADD [reportid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aloGroupreportrights' AND COLUMN_NAME='modulecode')
BEGIN
	ALTER TABLE [aloGroupreportrights] ADD [modulecode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aloGroupreportrights' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [aloGroupreportrights] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aloreportrights' AND COLUMN_NAME='userid')
BEGIN
	ALTER TABLE [aloreportrights] ADD [userid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aloreportrights' AND COLUMN_NAME='reportid')
BEGIN
	ALTER TABLE [aloreportrights] ADD [reportid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aloreportrights' AND COLUMN_NAME='modulecode')
BEGIN
	ALTER TABLE [aloreportrights] ADD [modulecode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aloreportrights' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [aloreportrights] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardContactDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aLoyaltyCardContactDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardContactDetails' AND COLUMN_NAME='ID')
BEGIN
	ALTER TABLE [aLoyaltyCardContactDetails] ADD [ID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardContactDetails' AND COLUMN_NAME='CardID')
BEGIN
	ALTER TABLE [aLoyaltyCardContactDetails] ADD [CardID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardContactDetails' AND COLUMN_NAME='ContactID')
BEGIN
	ALTER TABLE [aLoyaltyCardContactDetails] ADD [ContactID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardContactDetails' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [aLoyaltyCardContactDetails] ADD [UserName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardContactDetails' AND COLUMN_NAME='ExpiryDate')
BEGIN
	ALTER TABLE [aLoyaltyCardContactDetails] ADD [ExpiryDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardContactDetails' AND COLUMN_NAME='CardNo')
BEGIN
	ALTER TABLE [aLoyaltyCardContactDetails] ADD [CardNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aLoyaltyCardMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardMaster' AND COLUMN_NAME='CardID')
BEGIN
	ALTER TABLE [aLoyaltyCardMaster] ADD [CardID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardMaster' AND COLUMN_NAME='CardDesc')
BEGIN
	ALTER TABLE [aLoyaltyCardMaster] ADD [CardDesc] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardMaster' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [aLoyaltyCardMaster] ADD [Amount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardMaster' AND COLUMN_NAME='Points')
BEGIN
	ALTER TABLE [aLoyaltyCardMaster] ADD [Points] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardMaster' AND COLUMN_NAME='PointsValue')
BEGIN
	ALTER TABLE [aLoyaltyCardMaster] ADD [PointsValue] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardMaster' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [aLoyaltyCardMaster] ADD [UserName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aLoyaltyCardMaster' AND COLUMN_NAME='MinimumPoints')
BEGIN
	ALTER TABLE [aLoyaltyCardMaster] ADD [MinimumPoints] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amarketrates' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [amarketrates] ADD [itemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amarketrates' AND COLUMN_NAME='marketone')
BEGIN
	ALTER TABLE [amarketrates] ADD [marketone] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amarketrates' AND COLUMN_NAME='markettwo')
BEGIN
	ALTER TABLE [amarketrates] ADD [markettwo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amarketrates' AND COLUMN_NAME='priceone')
BEGIN
	ALTER TABLE [amarketrates] ADD [priceone] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amarketrates' AND COLUMN_NAME='pricetwo')
BEGIN
	ALTER TABLE [amarketrates] ADD [pricetwo] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amarketrates' AND COLUMN_NAME='remarks')
BEGIN
	ALTER TABLE [amarketrates] ADD [remarks] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amarketrates' AND COLUMN_NAME='username')
BEGIN
	ALTER TABLE [amarketrates] ADD [username] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amisUserRights' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [amisUserRights] ADD [UserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amisUserRights' AND COLUMN_NAME='MenuID')
BEGIN
	ALTER TABLE [amisUserRights] ADD [MenuID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='amisUserRights' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [amisUserRights] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='PAckageDate')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [PAckageDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='BackNoOfDays')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [BackNoOfDays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='HQSalesAccID')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [HQSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='HQPurchaseAccID')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [HQPurchaseAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='customsaccid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [customsaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='GoodsInTransitID')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [GoodsInTransitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='LCGroupID')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [LCGroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='servername')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [servername] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='CostingMethod')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [CostingMethod] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='DayClosed')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [DayClosed] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='defaultAgeRange')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [defaultAgeRange] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='defaultGodownID')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [defaultGodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='defaultShopID')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [defaultShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='defaultRepRangeStart')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [defaultRepRangeStart] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='defaultRepRangeEnd')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [defaultRepRangeEnd] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='InventoryID')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [InventoryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='CostofGoodsid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [CostofGoodsid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='LcMarginGroupID')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [LcMarginGroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='futureint')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='futurevc')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [futurevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='futurenum')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [futurenum] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='movementperiod')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [movementperiod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='importperiod')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [importperiod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='analysisperiod')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [analysisperiod] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='shipmentfixedandactualvaluediff')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [shipmentfixedandactualvaluediff] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='compprofitshareacc')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [compprofitshareacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='stocktransfercontrolacc')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [stocktransfercontrolacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='companydepartment')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [companydepartment] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='profittransfercontrolacc')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [profittransfercontrolacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='mainservername')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [mainservername] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='AllowItemCodeDuplication')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [AllowItemCodeDuplication] bit CONSTRAINT [DF__apackages__Allow__4615C369] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aPAckageS__rowgu__5FBE24CE] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='Returnadjustmentaccid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [Returnadjustmentaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='PurchaseRtnAccID')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [PurchaseRtnAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='POGITAccountid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [POGITAccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='costofsalesid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [costofsalesid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='AssetConversionAccid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [AssetConversionAccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='interdepsalescntrlaccid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [interdepsalescntrlaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='instdate')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [instdate] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='lockdate')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [lockdate] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='extensionno')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [extensionno] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='tempchar')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [tempchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='spcheck')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [spcheck] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='EnableCRMContacts')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [EnableCRMContacts] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='CompanyLogin')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [CompanyLogin] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='hirepurchase')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [hirepurchase] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='Payrollneeded')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [Payrollneeded] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='DisableDataFiltersForCustomers')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [DisableDataFiltersForCustomers] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='DisableDataFiltersForVendors')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [DisableDataFiltersForVendors] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='BusinessPromotionAcc')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [BusinessPromotionAcc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='WarrentyClaimAcc')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [WarrentyClaimAcc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='MailBasedOnReorderLevel')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [MailBasedOnReorderLevel] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='HQLocalPurchaseConfirmation')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [HQLocalPurchaseConfirmation] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='BlockAddingNewItemToShops')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [BlockAddingNewItemToShops] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='FineEnabled')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [FineEnabled] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='IntegerQuantity')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [IntegerQuantity] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='Alias')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [Alias] bit CONSTRAINT [DF__aPAckageS__Alias__33807B34] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='ActiveDirectoryLogin')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [ActiveDirectoryLogin] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='AllowEnteringSlNoInSplInvoice')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [AllowEnteringSlNoInSplInvoice] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='AllowDirectPurchaseBill')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [AllowDirectPurchaseBill] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='ShowCollectFromInDeliveryNote')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [ShowCollectFromInDeliveryNote] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='ReorderLevelMandatory')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [ReorderLevelMandatory] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='ItemwiseAccountinginInHousecon')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [ItemwiseAccountinginInHousecon] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='DefaultPurRequestVendor')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [DefaultPurRequestVendor] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='TransactionsSummaryDate')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [TransactionsSummaryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='AllowDirectLocalPurchaseCosting')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [AllowDirectLocalPurchaseCosting] bit CONSTRAINT [DF__aPAckageS__Allow__34749F6D] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='TransactionsSummary')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [TransactionsSummary] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='DeliveryItemsVerificationUrl')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [DeliveryItemsVerificationUrl] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='VisibleDepartmentPurReq')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [VisibleDepartmentPurReq] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='AllowMultipleQuotations')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [AllowMultipleQuotations] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='EnableRemainderAccBills')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [EnableRemainderAccBills] bit CONSTRAINT [DF__aPAckageS__Enabl__3568C3A6] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='AutoConfirmAccTrans')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [AutoConfirmAccTrans] bit CONSTRAINT [DF__aPAckageS__AutoC__365CE7DF] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='SellingPriceBelowCostPrice')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [SellingPriceBelowCostPrice] bit CONSTRAINT [DF__aPAckageS__Selli__37510C18] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='CreditLimitType')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [CreditLimitType] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='ReportServerName')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [ReportServerName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='PPandEAccid')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [PPandEAccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='CustomerGroupIdForEmployees')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [CustomerGroupIdForEmployees] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='NoCreditForOverdueCustomers')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [NoCreditForOverdueCustomers] bit CONSTRAINT [DF__aPAckageS__NoCre__38453051] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='ReportLogo')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [ReportLogo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='postdatedcheque')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [postdatedcheque] bit CONSTRAINT [DF__aPAckageS__postd__3939548A] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='AutomateSegmentwisePrice')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [AutomateSegmentwisePrice] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='QuickItemFetchInLoginDepartmentOnly')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [QuickItemFetchInLoginDepartmentOnly] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='EnableGST')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [EnableGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='TaxCategoryforServices')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [TaxCategoryforServices] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='EnableGSTinForeignPurchase')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [EnableGSTinForeignPurchase] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='CustomerGroupIdForManagement')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [CustomerGroupIdForManagement] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='CustomerGroupIdForStaff')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [CustomerGroupIdForStaff] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='TaxCategoryforInstallmentSales')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [TaxCategoryforInstallmentSales] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='NeedApproval')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [NeedApproval] bit CONSTRAINT [DF__aPAckageS__NeedA__6E0D0F7C] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME='ProjectWiseDespatch')
BEGIN
	ALTER TABLE [aPAckageSettings] ADD [ProjectWiseDespatch] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingType' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [aPackingType] ADD [PackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingType' AND COLUMN_NAME='PackingTypeCode')
BEGIN
	ALTER TABLE [aPackingType] ADD [PackingTypeCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingType' AND COLUMN_NAME='PackingTypeName')
BEGIN
	ALTER TABLE [aPackingType] ADD [PackingTypeName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingType' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aPackingType] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aPackingT__rowgu__6576FE24] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingTypeCapacityDetail' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [aPackingTypeCapacityDetail] ADD [PackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingTypeCapacityDetail' AND COLUMN_NAME='UnitsID')
BEGIN
	ALTER TABLE [aPackingTypeCapacityDetail] ADD [UnitsID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingTypeCapacityDetail' AND COLUMN_NAME='Quantity')
BEGIN
	ALTER TABLE [aPackingTypeCapacityDetail] ADD [Quantity] [numeric] (18,5) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingTypeCapacityDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aPackingTypeCapacityDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aPackingT__rowgu__475C8B58] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='MergeID')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [MergeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='MergeDate')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [MergeDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='OldParentCategoryID')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [OldParentCategoryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='NewParentCategoryID')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [NewParentCategoryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [Cancelled] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [CancelledRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [Remarks] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [UserName] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='UpdateUserName')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [UpdateUserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='UpdateDateTime')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [UpdateDateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME='Rowguid')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD [Rowguid] uniqueidentifier  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aParentItemCategory' AND COLUMN_NAME='PItemCategoryID')
BEGIN
	ALTER TABLE [aParentItemCategory] ADD [PItemCategoryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aParentItemCategory' AND COLUMN_NAME='PItemCategoryCode')
BEGIN
	ALTER TABLE [aParentItemCategory] ADD [PItemCategoryCode] [varchar] (4) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aParentItemCategory' AND COLUMN_NAME='PCategoryDescription')
BEGIN
	ALTER TABLE [aParentItemCategory] ADD [PCategoryDescription] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPrefix' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aPrefix] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPrefix' AND COLUMN_NAME='InterfaceID')
BEGIN
	ALTER TABLE [aPrefix] ADD [InterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPrefix' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [aPrefix] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPrefix' AND COLUMN_NAME='godownid')
BEGIN
	ALTER TABLE [aPrefix] ADD [godownid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPrefix' AND COLUMN_NAME='Prefix')
BEGIN
	ALTER TABLE [aPrefix] ADD [Prefix] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPrefix' AND COLUMN_NAME='ModuleCode')
BEGIN
	ALTER TABLE [aPrefix] ADD [ModuleCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPrefix' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [aPrefix] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPrefix' AND COLUMN_NAME='Financialid')
BEGIN
	ALTER TABLE [aPrefix] ADD [Financialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aproductconditionmaster' AND COLUMN_NAME='prodcndcompanyid')
BEGIN
	ALTER TABLE [aproductconditionmaster] ADD [prodcndcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aproductconditionmaster' AND COLUMN_NAME='prodcndid')
BEGIN
	ALTER TABLE [aproductconditionmaster] ADD [prodcndid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aproductconditionmaster' AND COLUMN_NAME='prodcndsercatid')
BEGIN
	ALTER TABLE [aproductconditionmaster] ADD [prodcndsercatid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aproductconditionmaster' AND COLUMN_NAME='prodcndcode')
BEGIN
	ALTER TABLE [aproductconditionmaster] ADD [prodcndcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aproductconditionmaster' AND COLUMN_NAME='prodcndname')
BEGIN
	ALTER TABLE [aproductconditionmaster] ADD [prodcndname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aproductconditionmaster' AND COLUMN_NAME='prodcnddetails')
BEGIN
	ALTER TABLE [aproductconditionmaster] ADD [prodcnddetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aproductconditionmaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aproductconditionmaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aproductc__rowgu__3C15C135] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRange' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [aPurchasePriceRange] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRange' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [aPurchasePriceRange] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRange' AND COLUMN_NAME='MinPrice')
BEGIN
	ALTER TABLE [aPurchasePriceRange] ADD [MinPrice] [numeric] (18,2) CONSTRAINT [DF_aPurchasePriceRange_MinPrice] DEFAULT ((0)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRange' AND COLUMN_NAME='MaxPrice')
BEGIN
	ALTER TABLE [aPurchasePriceRange] ADD [MaxPrice] [numeric] (18,2) CONSTRAINT [DF_aPurchasePriceRange_MaxPrice] DEFAULT ((0)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRange' AND COLUMN_NAME='CurrencyId')
BEGIN
	ALTER TABLE [aPurchasePriceRange] ADD [CurrencyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRange' AND COLUMN_NAME='UpdateTime')
BEGIN
	ALTER TABLE [aPurchasePriceRange] ADD [UpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRange' AND COLUMN_NAME='UpdateUser')
BEGIN
	ALTER TABLE [aPurchasePriceRange] ADD [UpdateUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND COLUMN_NAME='SlNo')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] ADD [SlNo] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND COLUMN_NAME='MinPrice')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] ADD [MinPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND COLUMN_NAME='MaxPrice')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] ADD [MaxPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND COLUMN_NAME='CurrencyId')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] ADD [CurrencyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND COLUMN_NAME='UpdateTime')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] ADD [UpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND COLUMN_NAME='UpdateUser')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] ADD [UpdateUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRateEditingDetails' AND COLUMN_NAME='redID')
BEGIN
	ALTER TABLE [aRateEditingDetails] ADD [redID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRateEditingDetails' AND COLUMN_NAME='redDate')
BEGIN
	ALTER TABLE [aRateEditingDetails] ADD [redDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRateEditingDetails' AND COLUMN_NAME='reditemid')
BEGIN
	ALTER TABLE [aRateEditingDetails] ADD [reditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRateEditingDetails' AND COLUMN_NAME='reduserid')
BEGIN
	ALTER TABLE [aRateEditingDetails] ADD [reduserid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRateEditingDetails' AND COLUMN_NAME='redcompanyid')
BEGIN
	ALTER TABLE [aRateEditingDetails] ADD [redcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRateEditingDetails' AND COLUMN_NAME='redoldcostprice')
BEGIN
	ALTER TABLE [aRateEditingDetails] ADD [redoldcostprice] [numeric] (18,8) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRateEditingDetails' AND COLUMN_NAME='redcostprice')
BEGIN
	ALTER TABLE [aRateEditingDetails] ADD [redcostprice] [numeric] (18,8) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRateEditingDetails' AND COLUMN_NAME='UpdateDateTime')
BEGIN
	ALTER TABLE [aRateEditingDetails] ADD [UpdateDateTime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [DepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='ReccuringID')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [ReccuringID] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='ReccuringNo')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [ReccuringNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='ReccuringDate')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [ReccuringDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='PaymentName')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [PaymentName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='PaymentDate')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [PaymentDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [Amount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [Type] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='Cancel')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [Cancel] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND COLUMN_NAME='CancelRemarks')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ADD [CancelRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='arecentmenu' AND COLUMN_NAME='interfaceid')
BEGIN
	ALTER TABLE [arecentmenu] ADD [interfaceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='arecentmenu' AND COLUMN_NAME='userid')
BEGIN
	ALTER TABLE [arecentmenu] ADD [userid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='arecentmenu' AND COLUMN_NAME='usertype')
BEGIN
	ALTER TABLE [arecentmenu] ADD [usertype] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='arecentmenu' AND COLUMN_NAME='recentid')
BEGIN
	ALTER TABLE [arecentmenu] ADD [recentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRepFormatAccounts' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [aRepFormatAccounts] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRepFormatAccounts' AND COLUMN_NAME='FormatId')
BEGIN
	ALTER TABLE [aRepFormatAccounts] ADD [FormatId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRepFormatAccounts' AND COLUMN_NAME='GroupId')
BEGIN
	ALTER TABLE [aRepFormatAccounts] ADD [GroupId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRepFormatAccounts' AND COLUMN_NAME='Mode')
BEGIN
	ALTER TABLE [aRepFormatAccounts] ADD [Mode] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aRepFormatAccounts' AND COLUMN_NAME='Accountid')
BEGIN
	ALTER TABLE [aRepFormatAccounts] ADD [Accountid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areportrights' AND COLUMN_NAME='userid')
BEGIN
	ALTER TABLE [areportrights] ADD [userid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areportrights' AND COLUMN_NAME='reportid')
BEGIN
	ALTER TABLE [areportrights] ADD [reportid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areportrights' AND COLUMN_NAME='modulecode')
BEGIN
	ALTER TABLE [areportrights] ADD [modulecode] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areportrights' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [areportrights] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReports' AND COLUMN_NAME='ReportID')
BEGIN
	ALTER TABLE [aReports] ADD [ReportID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReports' AND COLUMN_NAME='ReportName')
BEGIN
	ALTER TABLE [aReports] ADD [ReportName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReports' AND COLUMN_NAME='Reportconst')
BEGIN
	ALTER TABLE [aReports] ADD [Reportconst] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReports' AND COLUMN_NAME='ReportCatId')
BEGIN
	ALTER TABLE [aReports] ADD [ReportCatId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReports' AND COLUMN_NAME='ReportDetailId')
BEGIN
	ALTER TABLE [aReports] ADD [ReportDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReports' AND COLUMN_NAME='repModuleCode')
BEGIN
	ALTER TABLE [aReports] ADD [repModuleCode] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReports' AND COLUMN_NAME='ReportActive')
BEGIN
	ALTER TABLE [aReports] ADD [ReportActive] bit CONSTRAINT [DF__aReports__Report__1CD22006] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvdcompanyid')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvdreceiveid')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvdreceiveid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvddetailid')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvdshopid')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvdshopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvdrepreqid')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvdrepreqid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvdbookingid')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvdbookingid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvditemid')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvdqty')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvdqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvdtochargeprice')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvdtochargeprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvdselected')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvdselected] bit CONSTRAINT [DF_areprerecvendordetail_rrvdselected] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME='rrvdshopcount')
BEGIN
	ALTER TABLE [areprecvendordetail] ADD [rrvdshopcount] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhcompanyid')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhreceiveid')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhreceiveid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhreceiveno')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhreceiveno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhreceivedate')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhreceivedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhvendorid')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhvendorid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhvendorrefno')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhvendorrefno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhremarks')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhtransfinished')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhtransfinished] bit CONSTRAINT [DF_areprecvendorheader_rrvhtransfinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhcancelled')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhcancelled] bit CONSTRAINT [DF_areprecvendorheader_rrvhposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhcancelledremarks')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhTime')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhcreated')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhcreated] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME='rrvhModified')
BEGIN
	ALTER TABLE [areprecvendorheader] ADD [rrvhModified] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASalesPersonCommisionDetail' AND COLUMN_NAME='salespersonid')
BEGIN
	ALTER TABLE [ASalesPersonCommisionDetail] ADD [salespersonid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASalesPersonCommisionDetail' AND COLUMN_NAME='detailid')
BEGIN
	ALTER TABLE [ASalesPersonCommisionDetail] ADD [detailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASalesPersonCommisionDetail' AND COLUMN_NAME='FromRange')
BEGIN
	ALTER TABLE [ASalesPersonCommisionDetail] ADD [FromRange] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASalesPersonCommisionDetail' AND COLUMN_NAME='ToRange')
BEGIN
	ALTER TABLE [ASalesPersonCommisionDetail] ADD [ToRange] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASalesPersonCommisionDetail' AND COLUMN_NAME='percentage')
BEGIN
	ALTER TABLE [ASalesPersonCommisionDetail] ADD [percentage] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASalesPersonCommisionDetail' AND COLUMN_NAME='phPercentage')
BEGIN
	ALTER TABLE [ASalesPersonCommisionDetail] ADD [phPercentage] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='Sperid')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [Sperid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='Spername')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [Spername] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='Sperqualification')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [Sperqualification] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='Sperage')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [Sperage] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='SperJoindate')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [SperJoindate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='SperDOB')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [SperDOB] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='SperSex')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [SperSex] bit CONSTRAINT [DF_AsalesPersonmaster_SperSex] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='Speraddress')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [Speraddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='SperPhone')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [SperPhone] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='SperEmail')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [SperEmail] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='sperperhrsal')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [sperperhrsal] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='targettype')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [targettype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='targetamount')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [targetamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__AsalesPer__rowgu__23150941] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME='active')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD [active] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASegmentMaster' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [ASegmentMaster] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASegmentMaster' AND COLUMN_NAME='Segmentid')
BEGIN
	ALTER TABLE [ASegmentMaster] ADD [Segmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASegmentMaster' AND COLUMN_NAME='SegmentName')
BEGIN
	ALTER TABLE [ASegmentMaster] ADD [SegmentName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASegmentMaster' AND COLUMN_NAME='Createddate')
BEGIN
	ALTER TABLE [ASegmentMaster] ADD [Createddate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASegmentMaster' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ASegmentMaster] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ASegmentMaster' AND COLUMN_NAME='Percentage')
BEGIN
	ALTER TABLE [ASegmentMaster] ADD [Percentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aServiceCategory' AND COLUMN_NAME='sercategid')
BEGIN
	ALTER TABLE [aServiceCategory] ADD [sercategid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aServiceCategory' AND COLUMN_NAME='sercatcompanyid')
BEGIN
	ALTER TABLE [aServiceCategory] ADD [sercatcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aServiceCategory' AND COLUMN_NAME='sercatcode')
BEGIN
	ALTER TABLE [aServiceCategory] ADD [sercatcode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aServiceCategory' AND COLUMN_NAME='sercatname')
BEGIN
	ALTER TABLE [aServiceCategory] ADD [sercatname] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aServiceCategory' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aServiceCategory] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aservicec__rowgu__12DEA178] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aserviceitemdetails' AND COLUMN_NAME='ServiceId')
BEGIN
	ALTER TABLE [aserviceitemdetails] ADD [ServiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aserviceitemdetails' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [aserviceitemdetails] ADD [ItemId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aserviceitemdetails' AND COLUMN_NAME='Detailid')
BEGIN
	ALTER TABLE [aserviceitemdetails] ADD [Detailid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aserviceitemdetails' AND COLUMN_NAME='Quantity')
BEGIN
	ALTER TABLE [aserviceitemdetails] ADD [Quantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aserviceitemdetails' AND COLUMN_NAME='PackId')
BEGIN
	ALTER TABLE [aserviceitemdetails] ADD [PackId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicelocations' AND COLUMN_NAME='serlocid')
BEGIN
	ALTER TABLE [aservicelocations] ADD [serlocid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicelocations' AND COLUMN_NAME='serlocname')
BEGIN
	ALTER TABLE [aservicelocations] ADD [serlocname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicelocations' AND COLUMN_NAME='serlocaddress')
BEGIN
	ALTER TABLE [aservicelocations] ADD [serlocaddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicelocations' AND COLUMN_NAME='serlocphone')
BEGIN
	ALTER TABLE [aservicelocations] ADD [serlocphone] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicelocations' AND COLUMN_NAME='serloccomments')
BEGIN
	ALTER TABLE [aservicelocations] ADD [serloccomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicelocations' AND COLUMN_NAME='serloctype')
BEGIN
	ALTER TABLE [aservicelocations] ADD [serloctype] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicelocations' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aservicelocations] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aservicel__rowgu__18977ACE] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='serid')
BEGIN
	ALTER TABLE [aservicemaster] ADD [serid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='sercompanyid')
BEGIN
	ALTER TABLE [aservicemaster] ADD [sercompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='sercategid')
BEGIN
	ALTER TABLE [aservicemaster] ADD [sercategid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='sercode')
BEGIN
	ALTER TABLE [aservicemaster] ADD [sercode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='sername')
BEGIN
	ALTER TABLE [aservicemaster] ADD [sername] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='sercharge')
BEGIN
	ALTER TABLE [aservicemaster] ADD [sercharge] [numeric] (18,8) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='serdetails')
BEGIN
	ALTER TABLE [aservicemaster] ADD [serdetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='serfutureint')
BEGIN
	ALTER TABLE [aservicemaster] ADD [serfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='serfururevc')
BEGIN
	ALTER TABLE [aservicemaster] ADD [serfururevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='serfuturenum')
BEGIN
	ALTER TABLE [aservicemaster] ADD [serfuturenum] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aservicemaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aservicem__rowgu__365CE7DF] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME='serservicetype')
BEGIN
	ALTER TABLE [aservicemaster] ADD [serservicetype] [char] (5) CONSTRAINT [DF__aServiceM__serse__387018DA] DEFAULT ('S') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicestatus' AND COLUMN_NAME='serstatuscompanyid')
BEGIN
	ALTER TABLE [aservicestatus] ADD [serstatuscompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicestatus' AND COLUMN_NAME='serStatusID')
BEGIN
	ALTER TABLE [aservicestatus] ADD [serStatusID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicestatus' AND COLUMN_NAME='serStatusName')
BEGIN
	ALTER TABLE [aservicestatus] ADD [serStatusName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicestatus' AND COLUMN_NAME='serStatusDesc')
BEGIN
	ALTER TABLE [aservicestatus] ADD [serStatusDesc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='SettingID')
BEGIN
	ALTER TABLE [aSettings] ADD [SettingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aSettings] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='NoOfPreviousDays')
BEGIN
	ALTER TABLE [aSettings] ADD [NoOfPreviousDays] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='InvoicePeriod')
BEGIN
	ALTER TABLE [aSettings] ADD [InvoicePeriod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='FinancialYearPeriod')
BEGIN
	ALTER TABLE [aSettings] ADD [FinancialYearPeriod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='FixedAssetGroupID')
BEGIN
	ALTER TABLE [aSettings] ADD [FixedAssetGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='CashGroupID')
BEGIN
	ALTER TABLE [aSettings] ADD [CashGroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='BankGroupID')
BEGIN
	ALTER TABLE [aSettings] ADD [BankGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='TradeDebtorAcID')
BEGIN
	ALTER TABLE [aSettings] ADD [TradeDebtorAcID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='TradeCreditorAcID')
BEGIN
	ALTER TABLE [aSettings] ADD [TradeCreditorAcID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='SalesGroupID')
BEGIN
	ALTER TABLE [aSettings] ADD [SalesGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='PurchaseGroupID')
BEGIN
	ALTER TABLE [aSettings] ADD [PurchaseGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='SepProformaInvoiceNo')
BEGIN
	ALTER TABLE [aSettings] ADD [SepProformaInvoiceNo] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='SepProductServiceNo')
BEGIN
	ALTER TABLE [aSettings] ADD [SepProductServiceNo] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='AverageRate')
BEGIN
	ALTER TABLE [aSettings] ADD [AverageRate] bit CONSTRAINT [DF_aSettings_Averagerate] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='EnableTargetCheck')
BEGIN
	ALTER TABLE [aSettings] ADD [EnableTargetCheck] bit CONSTRAINT [DF_aSettings_EnableTargetCheck] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='EnableBudgetCheck')
BEGIN
	ALTER TABLE [aSettings] ADD [EnableBudgetCheck] bit CONSTRAINT [DF_aSettings_EnableBudgetCheck] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='ExchangeDiffAcID')
BEGIN
	ALTER TABLE [aSettings] ADD [ExchangeDiffAcID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='Retainedearningsacc')
BEGIN
	ALTER TABLE [aSettings] ADD [Retainedearningsacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='openingfreezed')
BEGIN
	ALTER TABLE [aSettings] ADD [openingfreezed] bit CONSTRAINT [DF_aSettings_openingfreezed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='BackDay')
BEGIN
	ALTER TABLE [aSettings] ADD [BackDay] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='depreciationid')
BEGIN
	ALTER TABLE [aSettings] ADD [depreciationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aSettings] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aSettings__rowgu__7CF981FA] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='autogenerateasstcode')
BEGIN
	ALTER TABLE [aSettings] ADD [autogenerateasstcode] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='debtorsaccid')
BEGIN
	ALTER TABLE [aSettings] ADD [debtorsaccid] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='creditorsaccid')
BEGIN
	ALTER TABLE [aSettings] ADD [creditorsaccid] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='payablealertbeforedays')
BEGIN
	ALTER TABLE [aSettings] ADD [payablealertbeforedays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='alertbeforedays')
BEGIN
	ALTER TABLE [aSettings] ADD [alertbeforedays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='depriciationexpaccid')
BEGIN
	ALTER TABLE [aSettings] ADD [depriciationexpaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='disposalaccount')
BEGIN
	ALTER TABLE [aSettings] ADD [disposalaccount] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='transferaccount')
BEGIN
	ALTER TABLE [aSettings] ADD [transferaccount] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='astopendate')
BEGIN
	ALTER TABLE [aSettings] ADD [astopendate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='RefBillId')
BEGIN
	ALTER TABLE [aSettings] ADD [RefBillId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='CurrentAssetGroupId')
BEGIN
	ALTER TABLE [aSettings] ADD [CurrentAssetGroupId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='CurrentLiabilityGroupId')
BEGIN
	ALTER TABLE [aSettings] ADD [CurrentLiabilityGroupId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='CurrentShareCapitalGroupId')
BEGIN
	ALTER TABLE [aSettings] ADD [CurrentShareCapitalGroupId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME='GainOrLossOnAssetDisposal')
BEGIN
	ALTER TABLE [aSettings] ADD [GainOrLossOnAssetDisposal] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShiftMaster' AND COLUMN_NAME='ShiftId')
BEGIN
	ALTER TABLE [aShiftMaster] ADD [ShiftId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShiftMaster' AND COLUMN_NAME='ShiftName')
BEGIN
	ALTER TABLE [aShiftMaster] ADD [ShiftName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShiftMaster' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [aShiftMaster] ADD [ShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShipment' AND COLUMN_NAME='sShipmentID')
BEGIN
	ALTER TABLE [aShipment] ADD [sShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShipment' AND COLUMN_NAME='sShipmentNO')
BEGIN
	ALTER TABLE [aShipment] ADD [sShipmentNO] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShipment' AND COLUMN_NAME='sBillID')
BEGIN
	ALTER TABLE [aShipment] ADD [sBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShipment' AND COLUMN_NAME='sShipmentDate')
BEGIN
	ALTER TABLE [aShipment] ADD [sShipmentDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShipment' AND COLUMN_NAME='sCostingDone')
BEGIN
	ALTER TABLE [aShipment] ADD [sCostingDone] bit CONSTRAINT [DF_aShipment_sCostingDone] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShipment' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aShipment] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aShipment__rowgu__70E8B0D0] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopcashaccountdetails' AND COLUMN_NAME='shopID')
BEGIN
	ALTER TABLE [ashopcashaccountdetails] ADD [shopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopcashaccountdetails' AND COLUMN_NAME='CashAccountID')
BEGIN
	ALTER TABLE [ashopcashaccountdetails] ADD [CashAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopcashaccountdetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ashopcashaccountdetails] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopcashaccountdetails' AND COLUMN_NAME='futurevc')
BEGIN
	ALTER TABLE [ashopcashaccountdetails] ADD [futurevc] [varchar] (250) CONSTRAINT [DF_ashopcashaccountdetails_futurevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopcashaccountdetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [ashopcashaccountdetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__ashopcash__rowgu__7E97B1A9] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopChequeAccountDetails' AND COLUMN_NAME='shopID')
BEGIN
	ALTER TABLE [aShopChequeAccountDetails] ADD [shopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopChequeAccountDetails' AND COLUMN_NAME='ChequeAccountID')
BEGIN
	ALTER TABLE [aShopChequeAccountDetails] ADD [ChequeAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopChequeAccountDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aShopChequeAccountDetails] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopChequeAccountDetails' AND COLUMN_NAME='futurevc')
BEGIN
	ALTER TABLE [aShopChequeAccountDetails] ADD [futurevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopChequeAccountDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aShopChequeAccountDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aShopCheq__rowgu__0C9BB83D] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD [CustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME='creditlimit')
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD [creditlimit] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME='custdiscperc')
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD [custdiscperc] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME='futurevc')
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD [futurevc] [varchar] (250) CONSTRAINT [DF_aShopCustomerDetails_futurevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aShopCust__rowgu__76A18A26] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME='DuePeriod')
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD [DuePeriod] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME='segmentid')
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD [segmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='GroupID')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [GroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='CatID')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [CatID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [CountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='AccBit')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [AccBit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='AccID')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [AccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='CityID')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [CityID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerSetting' AND COLUMN_NAME='DuePeriod')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ADD [DuePeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopitemCategory' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [aShopitemCategory] ADD [shopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopitemCategory' AND COLUMN_NAME='itemcategoryid')
BEGIN
	ALTER TABLE [aShopitemCategory] ADD [itemcategoryid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopitemCategory' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aShopitemCategory] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aShopitem__rowgu__4964CF5B] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [aShopItemDetail] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [aShopItemDetail] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME='ItemReorderLevel')
BEGIN
	ALTER TABLE [aShopItemDetail] ADD [ItemReorderLevel] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME='RequestRaised')
BEGIN
	ALTER TABLE [aShopItemDetail] ADD [RequestRaised] bit CONSTRAINT [DF_aShopItemDetail_RequestRaised] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME='ReorderQuantity')
BEGIN
	ALTER TABLE [aShopItemDetail] ADD [ReorderQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME='ShortcutNo')
BEGIN
	ALTER TABLE [aShopItemDetail] ADD [ShortcutNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME='orderraised')
BEGIN
	ALTER TABLE [aShopItemDetail] ADD [orderraised] bit CONSTRAINT [DF_aShopItemDetail_orderraised] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME='quotationraised')
BEGIN
	ALTER TABLE [aShopItemDetail] ADD [quotationraised] bit CONSTRAINT [DF_aShopItemDetail_quotationraised] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aShopItemDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aShopItem__rowgu__4F32B74A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopprintmessages' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [ashopprintmessages] ADD [shopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopprintmessages' AND COLUMN_NAME='transtype')
BEGIN
	ALTER TABLE [ashopprintmessages] ADD [transtype] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopprintmessages' AND COLUMN_NAME='messageid')
BEGIN
	ALTER TABLE [ashopprintmessages] ADD [messageid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopprintmessages' AND COLUMN_NAME='message')
BEGIN
	ALTER TABLE [ashopprintmessages] ADD [message] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopprintmessages' AND COLUMN_NAME='allignment')
BEGIN
	ALTER TABLE [ashopprintmessages] ADD [allignment] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopprintmessages' AND COLUMN_NAME='futureint')
BEGIN
	ALTER TABLE [ashopprintmessages] ADD [futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopprintmessages' AND COLUMN_NAME='futurevarchar')
BEGIN
	ALTER TABLE [ashopprintmessages] ADD [futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopprintmessages' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [ashopprintmessages] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__ashopprin__rowgu__1EA62536] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [aShops] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopName')
BEGIN
	ALTER TABLE [aShops] ADD [ShopName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopLocation')
BEGIN
	ALTER TABLE [aShops] ADD [ShopLocation] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopRegNo')
BEGIN
	ALTER TABLE [aShops] ADD [ShopRegNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopIECode')
BEGIN
	ALTER TABLE [aShops] ADD [ShopIECode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='InCharge')
BEGIN
	ALTER TABLE [aShops] ADD [InCharge] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='JobTitle')
BEGIN
	ALTER TABLE [aShops] ADD [JobTitle] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='TelephoneNo')
BEGIN
	ALTER TABLE [aShops] ADD [TelephoneNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='OpenedDate')
BEGIN
	ALTER TABLE [aShops] ADD [OpenedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='Address')
BEGIN
	ALTER TABLE [aShops] ADD [Address] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='CityID')
BEGIN
	ALTER TABLE [aShops] ADD [CityID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='FaxNo')
BEGIN
	ALTER TABLE [aShops] ADD [FaxNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='BillMessage')
BEGIN
	ALTER TABLE [aShops] ADD [BillMessage] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [aShops] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='OwnerName')
BEGIN
	ALTER TABLE [aShops] ADD [OwnerName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='OwnerAddress')
BEGIN
	ALTER TABLE [aShops] ADD [OwnerAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='OwnerTelephone')
BEGIN
	ALTER TABLE [aShops] ADD [OwnerTelephone] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ActiveShop')
BEGIN
	ALTER TABLE [aShops] ADD [ActiveShop] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='Ipaddress')
BEGIN
	ALTER TABLE [aShops] ADD [Ipaddress] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aShops] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='Countryid')
BEGIN
	ALTER TABLE [aShops] ADD [Countryid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='Selected')
BEGIN
	ALTER TABLE [aShops] ADD [Selected] bit CONSTRAINT [DF_aShops_Selected] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='TruncateCheck')
BEGIN
	ALTER TABLE [aShops] ADD [TruncateCheck] bit CONSTRAINT [DF_aShops_Truncate] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='FIFO')
BEGIN
	ALTER TABLE [aShops] ADD [FIFO] bit CONSTRAINT [DF_aShops_FIFO] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [aShops] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='DefaultCashaccountID')
BEGIN
	ALTER TABLE [aShops] ADD [DefaultCashaccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopSalesaccountID')
BEGIN
	ALTER TABLE [aShops] ADD [ShopSalesaccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopPurchaseAcID')
BEGIN
	ALTER TABLE [aShops] ADD [ShopPurchaseAcID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopGoodsReturnNoteAccID')
BEGIN
	ALTER TABLE [aShops] ADD [ShopGoodsReturnNoteAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='diffinCashBoxAcc')
BEGIN
	ALTER TABLE [aShops] ADD [diffinCashBoxAcc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ExpenseAccount')
BEGIN
	ALTER TABLE [aShops] ADD [ExpenseAccount] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='maxPaymentAmount')
BEGIN
	ALTER TABLE [aShops] ADD [maxPaymentAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='maxdiscountpercent')
BEGIN
	ALTER TABLE [aShops] ADD [maxdiscountpercent] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='dayClosed')
BEGIN
	ALTER TABLE [aShops] ADD [dayClosed] bit CONSTRAINT [DF_aShops_dayClosed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='stockWriteoffAccID')
BEGIN
	ALTER TABLE [aShops] ADD [stockWriteoffAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='wholesaleallowed')
BEGIN
	ALTER TABLE [aShops] ADD [wholesaleallowed] bit CONSTRAINT [DF_aShops_wholesaleallowed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='MaxRequestItemsToHQ')
BEGIN
	ALTER TABLE [aShops] ADD [MaxRequestItemsToHQ] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='futureint')
BEGIN
	ALTER TABLE [aShops] ADD [futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='futurevarchar')
BEGIN
	ALTER TABLE [aShops] ADD [futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='futuredatetime')
BEGIN
	ALTER TABLE [aShops] ADD [futuredatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='discountaccountid')
BEGIN
	ALTER TABLE [aShops] ADD [discountaccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='miscsettings13')
BEGIN
	ALTER TABLE [aShops] ADD [miscsettings13] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='allowblockprice')
BEGIN
	ALTER TABLE [aShops] ADD [allowblockprice] bit CONSTRAINT [DF_aShops_allowblockprice] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='showcostpriceinsales')
BEGIN
	ALTER TABLE [aShops] ADD [showcostpriceinsales] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='RevisedCostPricePercent')
BEGIN
	ALTER TABLE [aShops] ADD [RevisedCostPricePercent] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='shopdebitcreditacc')
BEGIN
	ALTER TABLE [aShops] ADD [shopdebitcreditacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='gstno')
BEGIN
	ALTER TABLE [aShops] ADD [gstno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='gstpercent')
BEGIN
	ALTER TABLE [aShops] ADD [gstpercent] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aShops] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aShops__rowguid__319832C2] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='locationarrangement')
BEGIN
	ALTER TABLE [aShops] ADD [locationarrangement] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='costofsalespercent')
BEGIN
	ALTER TABLE [aShops] ADD [costofsalespercent] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='segmentid')
BEGIN
	ALTER TABLE [aShops] ADD [segmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='Accountable')
BEGIN
	ALTER TABLE [aShops] ADD [Accountable] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='DeliveryMust')
BEGIN
	ALTER TABLE [aShops] ADD [DeliveryMust] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='interdepsalesaccid')
BEGIN
	ALTER TABLE [aShops] ADD [interdepsalesaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='interdeppurchaseaccid')
BEGIN
	ALTER TABLE [aShops] ADD [interdeppurchaseaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='otherShopDebitAccId')
BEGIN
	ALTER TABLE [aShops] ADD [otherShopDebitAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='SalesCommMarginPer')
BEGIN
	ALTER TABLE [aShops] ADD [SalesCommMarginPer] [numeric] (6,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopOtherChargesAccID')
BEGIN
	ALTER TABLE [aShops] ADD [ShopOtherChargesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShopCustomsDutyAccID')
BEGIN
	ALTER TABLE [aShops] ADD [ShopCustomsDutyAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='utilityaccountID')
BEGIN
	ALTER TABLE [aShops] ADD [utilityaccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='CounterLogin')
BEGIN
	ALTER TABLE [aShops] ADD [CounterLogin] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='DefaultSave')
BEGIN
	ALTER TABLE [aShops] ADD [DefaultSave] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='RateEditingonDirectCashInv')
BEGIN
	ALTER TABLE [aShops] ADD [RateEditingonDirectCashInv] int CONSTRAINT [DF__aShops__RateEdit__07C1F487] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='RateEditingonDirectCreditInv')
BEGIN
	ALTER TABLE [aShops] ADD [RateEditingonDirectCreditInv] int CONSTRAINT [DF__aShops__RateEdit__08B618C0] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [aShops] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='LoyaltyAccID')
BEGIN
	ALTER TABLE [aShops] ADD [LoyaltyAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='AutoGenerateDeliveryNote')
BEGIN
	ALTER TABLE [aShops] ADD [AutoGenerateDeliveryNote] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShowSellingPriceInItemFetch')
BEGIN
	ALTER TABLE [aShops] ADD [ShowSellingPriceInItemFetch] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='AddCustomDutyToCostPrice')
BEGIN
	ALTER TABLE [aShops] ADD [AddCustomDutyToCostPrice] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='SeparateRateCheckCreditSales')
BEGIN
	ALTER TABLE [aShops] ADD [SeparateRateCheckCreditSales] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='InvoicePreviewCurrency')
BEGIN
	ALTER TABLE [aShops] ADD [InvoicePreviewCurrency] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShipmentDetails')
BEGIN
	ALTER TABLE [aShops] ADD [ShipmentDetails] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='showbinlocation')
BEGIN
	ALTER TABLE [aShops] ADD [showbinlocation] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='RequestForNonShopItem')
BEGIN
	ALTER TABLE [aShops] ADD [RequestForNonShopItem] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShowRecentlySavedContactDetails')
BEGIN
	ALTER TABLE [aShops] ADD [ShowRecentlySavedContactDetails] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='AllowNewCustAndItemCreateServ')
BEGIN
	ALTER TABLE [aShops] ADD [AllowNewCustAndItemCreateServ] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShowStockInItemFetch')
BEGIN
	ALTER TABLE [aShops] ADD [ShowStockInItemFetch] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='InhouseConAccnt')
BEGIN
	ALTER TABLE [aShops] ADD [InhouseConAccnt] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='AllowDateEditInTrans')
BEGIN
	ALTER TABLE [aShops] ADD [AllowDateEditInTrans] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='CustomerNeededForPos')
BEGIN
	ALTER TABLE [aShops] ADD [CustomerNeededForPos] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='PreserveItemDetails')
BEGIN
	ALTER TABLE [aShops] ADD [PreserveItemDetails] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShowStockInTransOnlyOnDemand')
BEGIN
	ALTER TABLE [aShops] ADD [ShowStockInTransOnlyOnDemand] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='AllowRateEditForFreeItem')
BEGIN
	ALTER TABLE [aShops] ADD [AllowRateEditForFreeItem] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='DefaultChequeaccountID')
BEGIN
	ALTER TABLE [aShops] ADD [DefaultChequeaccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ShowDefaultSP')
BEGIN
	ALTER TABLE [aShops] ADD [ShowDefaultSP] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='RegisteredCustomer')
BEGIN
	ALTER TABLE [aShops] ADD [RegisteredCustomer] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='UnRegisteredCustomer')
BEGIN
	ALTER TABLE [aShops] ADD [UnRegisteredCustomer] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='SHOPTIN')
BEGIN
	ALTER TABLE [aShops] ADD [SHOPTIN] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='activateGST')
BEGIN
	ALTER TABLE [aShops] ADD [activateGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='ServiceTaxCategoryId')
BEGIN
	ALTER TABLE [aShops] ADD [ServiceTaxCategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME='printKOTseperatly')
BEGIN
	ALTER TABLE [aShops] ADD [printKOTseperatly] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Ashopsalespersondetails' AND COLUMN_NAME='SperShopid')
BEGIN
	ALTER TABLE [Ashopsalespersondetails] ADD [SperShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Ashopsalespersondetails' AND COLUMN_NAME='SperID')
BEGIN
	ALTER TABLE [Ashopsalespersondetails] ADD [SperID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Ashopsalespersondetails' AND COLUMN_NAME='sptype')
BEGIN
	ALTER TABLE [Ashopsalespersondetails] ADD [sptype] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Ashopsalespersondetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [Ashopsalespersondetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__Ashopsale__rowgu__12549193] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Ashopsalespersondetails' AND COLUMN_NAME='userId')
BEGIN
	ALTER TABLE [Ashopsalespersondetails] ADD [userId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopsercategory' AND COLUMN_NAME='ssercategid')
BEGIN
	ALTER TABLE [ashopsercategory] ADD [ssercategid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopsercategory' AND COLUMN_NAME='ssercatcompanyid')
BEGIN
	ALTER TABLE [ashopsercategory] ADD [ssercatcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopsercategory' AND COLUMN_NAME='sshopid')
BEGIN
	ALTER TABLE [ashopsercategory] ADD [sshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopsercategory' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [ashopsercategory] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__ashopserc__rowgu__08CB2759] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopServiceCharges' AND COLUMN_NAME='serid')
BEGIN
	ALTER TABLE [aShopServiceCharges] ADD [serid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopServiceCharges' AND COLUMN_NAME='sercompanyid')
BEGIN
	ALTER TABLE [aShopServiceCharges] ADD [sercompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopServiceCharges' AND COLUMN_NAME='serShopID')
BEGIN
	ALTER TABLE [aShopServiceCharges] ADD [serShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopServiceCharges' AND COLUMN_NAME='sercharge')
BEGIN
	ALTER TABLE [aShopServiceCharges] ADD [sercharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopToolsDetails' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aShopToolsDetails] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopToolsDetails' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [aShopToolsDetails] ADD [shopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopToolsDetails' AND COLUMN_NAME='toolsastid')
BEGIN
	ALTER TABLE [aShopToolsDetails] ADD [toolsastid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopVendorDetails' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [aShopVendorDetails] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopVendorDetails' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [aShopVendorDetails] ADD [VendorID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopVendorDetails' AND COLUMN_NAME='futurevc')
BEGIN
	ALTER TABLE [aShopVendorDetails] ADD [futurevc] [varchar] (250) CONSTRAINT [DF_aShopVendorDetails_futurevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopVendorDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aShopVendorDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aShopVend__rowgu__54EB90A0] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSize' AND COLUMN_NAME='SizeID')
BEGIN
	ALTER TABLE [aSize] ADD [SizeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSize' AND COLUMN_NAME='SizeCode')
BEGIN
	ALTER TABLE [aSize] ADD [SizeCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSize' AND COLUMN_NAME='SizeName')
BEGIN
	ALTER TABLE [aSize] ADD [SizeName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSize' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aSize] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aSize__rowguid__7C5A637C] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='dispdcompanyid')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [dispdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='dispID')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [dispID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='dispdid')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [dispdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='dispdasstid')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [dispdasstid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='dispdaccid')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [dispdaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='dispdcredit')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [dispdcredit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='dispcancelledremarks')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [dispcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='dispdamount')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [dispdamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='dispdtype')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [dispdtype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='DisAstSaleValue')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [DisAstSaleValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='disdepeBalamt')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [disdepeBalamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME='disUptoDepAmt')
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD [disUptoDepAmt] [numeric] (19,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphcompanyid')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphid')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphno')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphdate')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphremarks')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphposted')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphposted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphcancelled')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphcancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphcancelledremarks')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphauthorisedby')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphauthorisedby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphdepartmentid')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphexrate')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphexchangerates')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphdepexrate')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='financialid')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [financialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME='disphSubdepartmentid')
BEGIN
	ALTER TABLE [assetdisposalheader] ADD [disphSubdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetexpensetrackingdetail' AND COLUMN_NAME='aexcompanyid')
BEGIN
	ALTER TABLE [assetexpensetrackingdetail] ADD [aexcompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetexpensetrackingdetail' AND COLUMN_NAME='aexpaymentid')
BEGIN
	ALTER TABLE [assetexpensetrackingdetail] ADD [aexpaymentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetexpensetrackingdetail' AND COLUMN_NAME='aexpaymentno')
BEGIN
	ALTER TABLE [assetexpensetrackingdetail] ADD [aexpaymentno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetexpensetrackingdetail' AND COLUMN_NAME='aexassetid')
BEGIN
	ALTER TABLE [assetexpensetrackingdetail] ADD [aexassetid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetexpensetrackingdetail' AND COLUMN_NAME='aexpaymentdate')
BEGIN
	ALTER TABLE [assetexpensetrackingdetail] ADD [aexpaymentdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetexpensetrackingdetail' AND COLUMN_NAME='aexpaymentamount')
BEGIN
	ALTER TABLE [assetexpensetrackingdetail] ADD [aexpaymentamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetexpensetrackingdetail' AND COLUMN_NAME='aexcurrencyid')
BEGIN
	ALTER TABLE [assetexpensetrackingdetail] ADD [aexcurrencyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttransid')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttransid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttranscompanyid')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttranscompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttrransno')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttrransno] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttransdate')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttransdate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttransassetid')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttransassetid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttransfromdepid')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttransfromdepid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttranstodepid')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttranstodepid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttransvalue')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttransvalue] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttransposted')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttransposted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttransremarks')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttransremarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttranscancelled')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttranscancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='asttranscancelledremarks')
BEGIN
	ALTER TABLE [assettransfer] ADD [asttranscancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [assettransfer] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='financialid')
BEGIN
	ALTER TABLE [assettransfer] ADD [financialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='consexrate')
BEGIN
	ALTER TABLE [assettransfer] ADD [consexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='fromdepexrate')
BEGIN
	ALTER TABLE [assettransfer] ADD [fromdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='todepexrate')
BEGIN
	ALTER TABLE [assettransfer] ADD [todepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='Updatetime')
BEGIN
	ALTER TABLE [assettransfer] ADD [Updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='FromAssetAccId')
BEGIN
	ALTER TABLE [assettransfer] ADD [FromAssetAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='ToAssetAccID')
BEGIN
	ALTER TABLE [assettransfer] ADD [ToAssetAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='FromDeprAccId')
BEGIN
	ALTER TABLE [assettransfer] ADD [FromDeprAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='ToDeprAccId')
BEGIN
	ALTER TABLE [assettransfer] ADD [ToDeprAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='FromACCDeprAccId')
BEGIN
	ALTER TABLE [assettransfer] ADD [FromACCDeprAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='ToACCDeprAccId')
BEGIN
	ALTER TABLE [assettransfer] ADD [ToACCDeprAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME='astDeprValue')
BEGIN
	ALTER TABLE [assettransfer] ADD [astDeprValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSSRSReportInterface' AND COLUMN_NAME='IntrefaceId')
BEGIN
	ALTER TABLE [aSSRSReportInterface] ADD [IntrefaceId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSSRSReportInterface' AND COLUMN_NAME='ReportUrl')
BEGIN
	ALTER TABLE [aSSRSReportInterface] ADD [ReportUrl] [varchar] (4000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aStatus' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [aStatus] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aStatus' AND COLUMN_NAME='StatusId')
BEGIN
	ALTER TABLE [aStatus] ADD [StatusId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aStatus' AND COLUMN_NAME='StatusName')
BEGIN
	ALTER TABLE [aStatus] ADD [StatusName] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aStatus' AND COLUMN_NAME='StatusDesc')
BEGIN
	ALTER TABLE [aStatus] ADD [StatusDesc] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aStatus' AND COLUMN_NAME='StatusGroupId')
BEGIN
	ALTER TABLE [aStatus] ADD [StatusGroupId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aStatusGroup' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [aStatusGroup] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aStatusGroup' AND COLUMN_NAME='StatusGroupId')
BEGIN
	ALTER TABLE [aStatusGroup] ADD [StatusGroupId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aStatusGroup' AND COLUMN_NAME='StatusGroupName')
BEGIN
	ALTER TABLE [aStatusGroup] ADD [StatusGroupName] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aStatusGroup' AND COLUMN_NAME='StatusGroupDesc')
BEGIN
	ALTER TABLE [aStatusGroup] ADD [StatusGroupDesc] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [SubDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='SubDepartmentName')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [SubDepartmentName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='BudgetedAmount')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [BudgetedAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='ParentDepId')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [ParentDepId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='LevelCode')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [LevelCode] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='Selected')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [Selected] bit CONSTRAINT [DF_aSubDepartmentMaster_Selected] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_aSubDepartmentMaster_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='Subdepcurrencyid')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [Subdepcurrencyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='address1')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [address1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='address2')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [address2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME='payablealertbeforedays')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD [payablealertbeforedays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubItemDetails' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [aSubItemDetails] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubItemDetails' AND COLUMN_NAME='SubItemID')
BEGIN
	ALTER TABLE [aSubItemDetails] ADD [SubItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubItemDetails' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [aSubItemDetails] ADD [PackingTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubItemDetails' AND COLUMN_NAME='UnitsID')
BEGIN
	ALTER TABLE [aSubItemDetails] ADD [UnitsID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubItemDetails' AND COLUMN_NAME='Quantity')
BEGIN
	ALTER TABLE [aSubItemDetails] ADD [Quantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubItemDetails' AND COLUMN_NAME='SubItemRate')
BEGIN
	ALTER TABLE [aSubItemDetails] ADD [SubItemRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubItemDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aSubItemDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aSubItemD__rowgu__7187CF4E] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='TableID')
BEGIN
	ALTER TABLE [aTableColumns] ADD [TableID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='ColumnID')
BEGIN
	ALTER TABLE [aTableColumns] ADD [ColumnID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='ColumnName')
BEGIN
	ALTER TABLE [aTableColumns] ADD [ColumnName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='ColumnDescription')
BEGIN
	ALTER TABLE [aTableColumns] ADD [ColumnDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='ColumnHeader')
BEGIN
	ALTER TABLE [aTableColumns] ADD [ColumnHeader] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='ColumnType')
BEGIN
	ALTER TABLE [aTableColumns] ADD [ColumnType] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='ColumnLength')
BEGIN
	ALTER TABLE [aTableColumns] ADD [ColumnLength] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='ColumnDecimals')
BEGIN
	ALTER TABLE [aTableColumns] ADD [ColumnDecimals] tinyint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='Mandatory')
BEGIN
	ALTER TABLE [aTableColumns] ADD [Mandatory] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='Version1')
BEGIN
	ALTER TABLE [aTableColumns] ADD [Version1] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aTableColumns] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aTableCol__rowgu__6F6A7CB2] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTables' AND COLUMN_NAME='TableID')
BEGIN
	ALTER TABLE [aTables] ADD [TableID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTables' AND COLUMN_NAME='TableName')
BEGIN
	ALTER TABLE [aTables] ADD [TableName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTables' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [aTables] ADD [Description] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTables' AND COLUMN_NAME='Comments')
BEGIN
	ALTER TABLE [aTables] ADD [Comments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTables' AND COLUMN_NAME='Version1')
BEGIN
	ALTER TABLE [aTables] ADD [Version1] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTables' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aTables] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aTables__rowguid__02133CD2] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxCompanyId')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxId')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxCategoryCode')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxCategoryCode] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxDescription')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxDescription] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxPercentage')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxAccountable')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxAccountable] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxCancelled')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxCancelled] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxType')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxType] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxAccountId')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxAccountId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTaxCategoryMaster' AND COLUMN_NAME='TaxInputAccountId')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ADD [TaxInputAccountId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTechnicianServiceDetails' AND COLUMN_NAME='serid')
BEGIN
	ALTER TABLE [aTechnicianServiceDetails] ADD [serid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTechnicianServiceDetails' AND COLUMN_NAME='orderId')
BEGIN
	ALTER TABLE [aTechnicianServiceDetails] ADD [orderId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTechnicianServiceDetails' AND COLUMN_NAME='serTechnicianID')
BEGIN
	ALTER TABLE [aTechnicianServiceDetails] ADD [serTechnicianID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTechnicianServiceDetails' AND COLUMN_NAME='serTimeReqInMins')
BEGIN
	ALTER TABLE [aTechnicianServiceDetails] ADD [serTimeReqInMins] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTechnicianServiceDetails' AND COLUMN_NAME='sercompanyid')
BEGIN
	ALTER TABLE [aTechnicianServiceDetails] ADD [sercompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUnit' AND COLUMN_NAME='UnitID')
BEGIN
	ALTER TABLE [aUnit] ADD [UnitID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUnit' AND COLUMN_NAME='UnitCode')
BEGIN
	ALTER TABLE [aUnit] ADD [UnitCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUnit' AND COLUMN_NAME='UnitName')
BEGIN
	ALTER TABLE [aUnit] ADD [UnitName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUnit' AND COLUMN_NAME='Counts')
BEGIN
	ALTER TABLE [aUnit] ADD [Counts] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUnit' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aUnit] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aUnit__rowguid__07CC1628] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditDetail' AND COLUMN_NAME='dCompanyId')
BEGIN
	ALTER TABLE [aUserAuditDetail] ADD [dCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditDetail' AND COLUMN_NAME='dAuditId')
BEGIN
	ALTER TABLE [aUserAuditDetail] ADD [dAuditId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditDetail' AND COLUMN_NAME='dDetailId')
BEGIN
	ALTER TABLE [aUserAuditDetail] ADD [dDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditDetail' AND COLUMN_NAME='dAuditControlName')
BEGIN
	ALTER TABLE [aUserAuditDetail] ADD [dAuditControlName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditDetail' AND COLUMN_NAME='dAuditControlType')
BEGIN
	ALTER TABLE [aUserAuditDetail] ADD [dAuditControlType] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditDetail' AND COLUMN_NAME='dOldValue')
BEGIN
	ALTER TABLE [aUserAuditDetail] ADD [dOldValue] [varchar] (8000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditDetail' AND COLUMN_NAME='dNewValue')
BEGIN
	ALTER TABLE [aUserAuditDetail] ADD [dNewValue] [varchar] (8000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hCompanyId')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hAuditId')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hAuditId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hTransId')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hTransId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hTransNo')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hTransNo] [varchar] (8000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hUserFullName')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hUserFullName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hLoggedDateTime')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hLoggedDateTime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hExitedDateTime')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hExitedDateTime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hInterfaceId')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hInterfaceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hMode')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hMode] [char] (1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hSaved')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hSaved] bit CONSTRAINT [DF_aUserAuditHeader_hSaved] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hDepartmentId')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hDepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hMachineName')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hMachineName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME='hWindowsUserName')
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD [hWindowsUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserDeptDetails' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aUserDeptDetails] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserDeptDetails' AND COLUMN_NAME='userid')
BEGIN
	ALTER TABLE [aUserDeptDetails] ADD [userid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserDeptDetails' AND COLUMN_NAME='deptid')
BEGIN
	ALTER TABLE [aUserDeptDetails] ADD [deptid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ausergroupAccGroupDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ausergroupAccGroupDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ausergroupAccGroupDetails' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [ausergroupAccGroupDetails] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ausergroupAccGroupDetails' AND COLUMN_NAME='AccGroupID')
BEGIN
	ALTER TABLE [ausergroupAccGroupDetails] ADD [AccGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ausergroupAccGroupDetails' AND COLUMN_NAME='Rowguid')
BEGIN
	ALTER TABLE [ausergroupAccGroupDetails] ADD [Rowguid] uniqueidentifier CONSTRAINT [DF_ausergroupAccDetails_Rowguid] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupBrandDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUserGroupBrandDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupBrandDetails' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [aUserGroupBrandDetails] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupBrandDetails' AND COLUMN_NAME='BrandID')
BEGIN
	ALTER TABLE [aUserGroupBrandDetails] ADD [BrandID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupBrandDetails' AND COLUMN_NAME='rowguiD')
BEGIN
	ALTER TABLE [aUserGroupBrandDetails] ADD [rowguiD] uniqueidentifier CONSTRAINT [DF_aUserGroupBrandDetails_rowguiD] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupCusGroupDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUserGroupCusGroupDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupCusGroupDetails' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [aUserGroupCusGroupDetails] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupCusGroupDetails' AND COLUMN_NAME='CusGroupID')
BEGIN
	ALTER TABLE [aUserGroupCusGroupDetails] ADD [CusGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupCusGroupDetails' AND COLUMN_NAME='Rowguid')
BEGIN
	ALTER TABLE [aUserGroupCusGroupDetails] ADD [Rowguid] uniqueidentifier CONSTRAINT [DF_aUserGroupCusGroupDetails_Rowguid] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupDeptDetails' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aUserGroupDeptDetails] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupDeptDetails' AND COLUMN_NAME='userGroupid')
BEGIN
	ALTER TABLE [aUserGroupDeptDetails] ADD [userGroupid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupDeptDetails' AND COLUMN_NAME='deptid')
BEGIN
	ALTER TABLE [aUserGroupDeptDetails] ADD [deptid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupGodownDetails' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [aUserGroupGodownDetails] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupGodownDetails' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [aUserGroupGodownDetails] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupGodownDetails' AND COLUMN_NAME='GodownID')
BEGIN
	ALTER TABLE [aUserGroupGodownDetails] ADD [GodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupGodownDetails' AND COLUMN_NAME='rowguID')
BEGIN
	ALTER TABLE [aUserGroupGodownDetails] ADD [rowguID] uniqueidentifier CONSTRAINT [DF_aUserGroupGodownDetails_rowguID] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupItemCategoryDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUserGroupItemCategoryDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupItemCategoryDetails' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [aUserGroupItemCategoryDetails] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupItemCategoryDetails' AND COLUMN_NAME='ItemCategoryID')
BEGIN
	ALTER TABLE [aUserGroupItemCategoryDetails] ADD [ItemCategoryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupItemCategoryDetails' AND COLUMN_NAME='rowguID')
BEGIN
	ALTER TABLE [aUserGroupItemCategoryDetails] ADD [rowguID] uniqueidentifier CONSTRAINT [DF_aUserGroupItemCategoryDetails_rowguID] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupmisUserRights' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [aUserGroupmisUserRights] ADD [UserGroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupmisUserRights' AND COLUMN_NAME='MenuID')
BEGIN
	ALTER TABLE [aUserGroupmisUserRights] ADD [MenuID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupmisUserRights' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUserGroupmisUserRights] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupreportrights' AND COLUMN_NAME='userGroupid')
BEGIN
	ALTER TABLE [aUserGroupreportrights] ADD [userGroupid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupreportrights' AND COLUMN_NAME='reportid')
BEGIN
	ALTER TABLE [aUserGroupreportrights] ADD [reportid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupreportrights' AND COLUMN_NAME='modulecode')
BEGIN
	ALTER TABLE [aUserGroupreportrights] ADD [modulecode] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupreportrights' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [aUserGroupreportrights] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupRights' AND COLUMN_NAME='UsergroupID')
BEGIN
	ALTER TABLE [aUserGroupRights] ADD [UsergroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupRights' AND COLUMN_NAME='ModuleCode')
BEGIN
	ALTER TABLE [aUserGroupRights] ADD [ModuleCode] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupRights' AND COLUMN_NAME='InterfaceID')
BEGIN
	ALTER TABLE [aUserGroupRights] ADD [InterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupRights' AND COLUMN_NAME='FunctionRights')
BEGIN
	ALTER TABLE [aUserGroupRights] ADD [FunctionRights] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupRights' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUserGroupRights] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupRights' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aUserGroupRights] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aUserGrou__rowgu__03F163A3] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsergroups' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [aUsergroups] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsergroups' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUsergroups] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsergroups' AND COLUMN_NAME='UserGroupName')
BEGIN
	ALTER TABLE [aUsergroups] ADD [UserGroupName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsergroups' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [aUsergroups] ADD [Description] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsergroups' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aUsergroups] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_aUsergroups_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupShopDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUserGroupShopDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupShopDetails' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [aUserGroupShopDetails] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupShopDetails' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [aUserGroupShopDetails] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupShopDetails' AND COLUMN_NAME='rowguID')
BEGIN
	ALTER TABLE [aUserGroupShopDetails] ADD [rowguID] uniqueidentifier CONSTRAINT [DF_aUserGroupShopDetails_rowguID] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupVenGroupDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUserGroupVenGroupDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupVenGroupDetails' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [aUserGroupVenGroupDetails] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupVenGroupDetails' AND COLUMN_NAME='VenGroupID')
BEGIN
	ALTER TABLE [aUserGroupVenGroupDetails] ADD [VenGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupVenGroupDetails' AND COLUMN_NAME='Rowguid')
BEGIN
	ALTER TABLE [aUserGroupVenGroupDetails] ADD [Rowguid] uniqueidentifier CONSTRAINT [DF_aUserGroupVenGroupDetails_Rowguid] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AUserMasterGridSettings' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [AUserMasterGridSettings] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AUserMasterGridSettings' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [AUserMasterGridSettings] ADD [UserID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AUserMasterGridSettings' AND COLUMN_NAME='BackColor')
BEGIN
	ALTER TABLE [AUserMasterGridSettings] ADD [BackColor] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AUserMasterGridSettings' AND COLUMN_NAME='ForeColor')
BEGIN
	ALTER TABLE [AUserMasterGridSettings] ADD [ForeColor] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AUserMasterGridSettings' AND COLUMN_NAME='GridColor')
BEGIN
	ALTER TABLE [AUserMasterGridSettings] ADD [GridColor] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AUserMasterGridSettings' AND COLUMN_NAME='HeaderColor')
BEGIN
	ALTER TABLE [AUserMasterGridSettings] ADD [HeaderColor] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AUserMasterGridSettings' AND COLUMN_NAME='FontName')
BEGIN
	ALTER TABLE [AUserMasterGridSettings] ADD [FontName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AUserMasterGridSettings' AND COLUMN_NAME='FontSize')
BEGIN
	ALTER TABLE [AUserMasterGridSettings] ADD [FontSize] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserRights' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [aUserRights] ADD [UserID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserRights' AND COLUMN_NAME='ModuleCode')
BEGIN
	ALTER TABLE [aUserRights] ADD [ModuleCode] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserRights' AND COLUMN_NAME='InterfaceID')
BEGIN
	ALTER TABLE [aUserRights] ADD [InterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserRights' AND COLUMN_NAME='FunctionRights')
BEGIN
	ALTER TABLE [aUserRights] ADD [FunctionRights] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserRights' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUserRights] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserRights' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aUserRights] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aUserRigh__rowgu__515009E6] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [aUsers] ADD [UserID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aUsers] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [aUsers] ADD [UserName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='UserPwd')
BEGIN
	ALTER TABLE [aUsers] ADD [UserPwd] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='FullName')
BEGIN
	ALTER TABLE [aUsers] ADD [FullName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [aUsers] ADD [ShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='GodownID')
BEGIN
	ALTER TABLE [aUsers] ADD [GodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='logedon')
BEGIN
	ALTER TABLE [aUsers] ADD [logedon] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='GlobalUserID')
BEGIN
	ALTER TABLE [aUsers] ADD [GlobalUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aUsers] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aUsers__rowguid__2724C5F0] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [aUsers] ADD [UserGroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='EmailID')
BEGIN
	ALTER TABLE [aUsers] ADD [EmailID] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME='usersignature')
BEGIN
	ALTER TABLE [aUsers] ADD [usersignature] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorGroup' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aVendorGroup] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorGroup' AND COLUMN_NAME='VenGroupId')
BEGIN
	ALTER TABLE [aVendorGroup] ADD [VenGroupId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorGroup' AND COLUMN_NAME='VenGroupName')
BEGIN
	ALTER TABLE [aVendorGroup] ADD [VenGroupName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorGroup' AND COLUMN_NAME='ParentGroupID')
BEGIN
	ALTER TABLE [aVendorGroup] ADD [ParentGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorGroup' AND COLUMN_NAME='LevelCode')
BEGIN
	ALTER TABLE [aVendorGroup] ADD [LevelCode] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorGroup' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aVendorGroup] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_aVendorGroup_rowguid] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorItem' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [aVendorItem] ADD [itemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorItem' AND COLUMN_NAME='vendorid')
BEGIN
	ALTER TABLE [aVendorItem] ADD [vendorid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorItem' AND COLUMN_NAME='vendoritemcode')
BEGIN
	ALTER TABLE [aVendorItem] ADD [vendoritemcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorItem' AND COLUMN_NAME='vendoritemdesc')
BEGIN
	ALTER TABLE [aVendorItem] ADD [vendoritemdesc] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [VendorID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='VendorName')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [VendorName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='Address1')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [Address1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='Address2')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [Address2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='Address3')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [Address3] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='CityID')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [CityID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='ContactName')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [ContactName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='PhoneNo')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [PhoneNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='FaxNo')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [FaxNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='EmailID')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [EmailID] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='Local')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [Local] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='DuePeriod')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [DuePeriod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='Comments')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [Comments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [Active] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [CountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='OpeningCreditBalance')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [OpeningCreditBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='OpeningDebitBalance')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [OpeningDebitBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='VendorCode')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [VendorCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='Initial')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [Initial] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aVendorMa__rowgu__3BEAD8AC] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='allowblankcheque')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [allowblankcheque] bit CONSTRAINT [DF__avendorma__allow__40B05920] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='creditoraccid')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [creditoraccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='VenGroupId')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [VenGroupId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='VendorCategory')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [VendorCategory] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME='VendorTIN')
BEGIN
	ALTER TABLE [aVendorMaster] ADD [VendorTIN] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMasterBackUp' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [aVendorMasterBackUp] ADD [VendorID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMasterBackUp' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [aVendorMasterBackUp] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMasterBackUp' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [aVendorMasterBackUp] ADD [FinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMasterBackUp' AND COLUMN_NAME='OpeningCreditBalance')
BEGIN
	ALTER TABLE [aVendorMasterBackUp] ADD [OpeningCreditBalance] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMasterBackUp' AND COLUMN_NAME='OpeningDebitBalance')
BEGIN
	ALTER TABLE [aVendorMasterBackUp] ADD [OpeningDebitBalance] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMasterBackUp' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [aVendorMasterBackUp] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__aVendorMa__rowgu__0D84EF7E] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVesselMaster' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [aVesselMaster] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVesselMaster' AND COLUMN_NAME='VesselID')
BEGIN
	ALTER TABLE [aVesselMaster] ADD [VesselID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVesselMaster' AND COLUMN_NAME='VesselCode')
BEGIN
	ALTER TABLE [aVesselMaster] ADD [VesselCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVesselMaster' AND COLUMN_NAME='VesselDes')
BEGIN
	ALTER TABLE [aVesselMaster] ADD [VesselDes] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVesselMaster' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [aVesselMaster] ADD [CountryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVesselMaster' AND COLUMN_NAME='VesselOperatorName')
BEGIN
	ALTER TABLE [aVesselMaster] ADD [VesselOperatorName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='accountid')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [accountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='acctype')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [acctype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='financialid')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [financialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='openingamount')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [openingamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='openingdepamount')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [openingdepamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='openingactualamount')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [openingactualamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='accountcode')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [accountcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='accountdesc')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [accountdesc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aYearEndTemp' AND COLUMN_NAME='DepartmentName')
BEGIN
	ALTER TABLE [aYearEndTemp] ADD [DepartmentName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='COMPANYID')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [COMPANYID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='SHOPID')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [SHOPID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='GODOWNID')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [GODOWNID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='TRDATE')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [TRDATE] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='ITEMID')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [ITEMID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='STOCK')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [STOCK] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='DEPCOSTPRICE')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [DEPCOSTPRICE] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='DEPSTOCKVALUE')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [DEPSTOCKVALUE] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='COMCOSTPRICE')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [COMCOSTPRICE] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bak_odatestock' AND COLUMN_NAME='COMSTOCKVALUE')
BEGIN
	ALTER TABLE [bak_odatestock] ADD [COMSTOCKVALUE] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='billdate' AND COLUMN_NAME='billdate')
BEGIN
	ALTER TABLE [billdate] ADD [billdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='billdate' AND COLUMN_NAME='cntdate')
BEGIN
	ALTER TABLE [billdate] ADD [cntdate] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='BillsID')
BEGIN
	ALTER TABLE [Bills] ADD [BillsID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [Bills] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='BillsNo')
BEGIN
	ALTER TABLE [Bills] ADD [BillsNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='BillDate')
BEGIN
	ALTER TABLE [Bills] ADD [BillDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [Bills] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='BillAmount')
BEGIN
	ALTER TABLE [Bills] ADD [BillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='ReferenceNo')
BEGIN
	ALTER TABLE [Bills] ADD [ReferenceNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='DuePeriod')
BEGIN
	ALTER TABLE [Bills] ADD [DuePeriod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='Discount')
BEGIN
	ALTER TABLE [Bills] ADD [Discount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='DiscountAccountID')
BEGIN
	ALTER TABLE [Bills] ADD [DiscountAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [Bills] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='CashPurchase')
BEGIN
	ALTER TABLE [Bills] ADD [CashPurchase] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='BankCashAccID')
BEGIN
	ALTER TABLE [Bills] ADD [BankCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='ChequeNo')
BEGIN
	ALTER TABLE [Bills] ADD [ChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='ExchangeNature')
BEGIN
	ALTER TABLE [Bills] ADD [ExchangeNature] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [Bills] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [Bills] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [Bills] ADD [Posted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [Bills] ADD [Cancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [Bills] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='exchangerate')
BEGIN
	ALTER TABLE [Bills] ADD [exchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='vreferenceno')
BEGIN
	ALTER TABLE [Bills] ADD [vreferenceno] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [Bills] ADD [updatetime] datetime CONSTRAINT [DF_Bills_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='depexrate')
BEGIN
	ALTER TABLE [Bills] ADD [depexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [Bills] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='RefJournalID')
BEGIN
	ALTER TABLE [Bills] ADD [RefJournalID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='subdepartmentid')
BEGIN
	ALTER TABLE [Bills] ADD [subdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='RecurrenceDuePeriod')
BEGIN
	ALTER TABLE [Bills] ADD [RecurrenceDuePeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='AutoGenerate')
BEGIN
	ALTER TABLE [Bills] ADD [AutoGenerate] bit CONSTRAINT [DF__Bills__AutoGener__2A4C16B5] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME='RemainderID')
BEGIN
	ALTER TABLE [Bills] ADD [RemainderID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BillsDebitDetails' AND COLUMN_NAME='BillsID')
BEGIN
	ALTER TABLE [BillsDebitDetails] ADD [BillsID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BillsDebitDetails' AND COLUMN_NAME='BillsDebitID')
BEGIN
	ALTER TABLE [BillsDebitDetails] ADD [BillsDebitID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BillsDebitDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [BillsDebitDetails] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BillsDebitDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [BillsDebitDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BillsDebitDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [BillsDebitDetails] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BillsDebitDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [BillsDebitDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bincardstock' AND COLUMN_NAME='locationid')
BEGIN
	ALTER TABLE [bincardstock] ADD [locationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bincardstock' AND COLUMN_NAME='itemdesc')
BEGIN
	ALTER TABLE [bincardstock] ADD [itemdesc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bincardstock' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [bincardstock] ADD [itemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='bincardstock' AND COLUMN_NAME='curstock')
BEGIN
	ALTER TABLE [bincardstock] ADD [curstock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAccountsLink' AND COLUMN_NAME='bacCompanyID')
BEGIN
	ALTER TABLE [BudgetAccountsLink] ADD [bacCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAccountsLink' AND COLUMN_NAME='bacBudgetID')
BEGIN
	ALTER TABLE [BudgetAccountsLink] ADD [bacBudgetID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAccountsLink' AND COLUMN_NAME='bacDetailID')
BEGIN
	ALTER TABLE [BudgetAccountsLink] ADD [bacDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAccountsLink' AND COLUMN_NAME='bacAccountID')
BEGIN
	ALTER TABLE [BudgetAccountsLink] ADD [bacAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAccountsLink' AND COLUMN_NAME='bacDepartmentID')
BEGIN
	ALTER TABLE [BudgetAccountsLink] ADD [bacDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME='badCompanyID')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD [badCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME='badBudgetAllocID')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD [badBudgetAllocID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME='badDetailID')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD [badDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME='badBudgetHeadID')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD [badBudgetHeadID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME='badFromDate')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD [badFromDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME='badToDate')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD [badToDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME='badAmount')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD [badAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME='badMonthNo')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD [badMonthNo] int CONSTRAINT [DF__BudgetAll__badMo__6621D4F1] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME='badRevised')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD [badRevised] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahCompanyID')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahBudgetAllocID')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahBudgetAllocID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahBudgetNo')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahBudgetNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahBudgetDate')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahBudgetDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahFromdate')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahFromdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahToDate')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahToDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahBudgetPanel')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahBudgetPanel] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahReviewPanel')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahReviewPanel] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahReviewDate')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahReviewDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahSanctionedBy')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahSanctionedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahSanctionedDate')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahSanctionedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahRemarks')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahCancelled')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahCancelledRemarks')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationHeader' AND COLUMN_NAME='bahDepartmentId')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ADD [bahDepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckDetail' AND COLUMN_NAME='bcdCompanyID')
BEGIN
	ALTER TABLE [BudgetCheckDetail] ADD [bcdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckDetail' AND COLUMN_NAME='bcdCheckID')
BEGIN
	ALTER TABLE [BudgetCheckDetail] ADD [bcdCheckID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckDetail' AND COLUMN_NAME='bcdDetailID')
BEGIN
	ALTER TABLE [BudgetCheckDetail] ADD [bcdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckDetail' AND COLUMN_NAME='bcdBudgetAllocID')
BEGIN
	ALTER TABLE [BudgetCheckDetail] ADD [bcdBudgetAllocID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckDetail' AND COLUMN_NAME='bcdBudgetAllocDetailID')
BEGIN
	ALTER TABLE [BudgetCheckDetail] ADD [bcdBudgetAllocDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckDetail' AND COLUMN_NAME='bcdActualAmount')
BEGIN
	ALTER TABLE [BudgetCheckDetail] ADD [bcdActualAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchCompanyId')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchCheckID')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchCheckID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchCheckNo')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchCheckNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchCheckDate')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchCheckDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchBudgetAllocID')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchBudgetAllocID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchActualAsonDate')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchActualAsonDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchCheckedBy')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchCheckedBy] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchRemarks')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchCancelled')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchCancelledRemarks')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetCheckHeader' AND COLUMN_NAME='bchexchagerate')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ADD [bchexchagerate] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND COLUMN_NAME='bpdICompanyID')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ADD [bpdICompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND COLUMN_NAME='bpdIBudgetPlanID')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ADD [bpdIBudgetPlanID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND COLUMN_NAME='bpdIDetailID')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ADD [bpdIDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND COLUMN_NAME='bpdIBudgetItemID')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ADD [bpdIBudgetItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND COLUMN_NAME='bpdIMonthNo')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ADD [bpdIMonthNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND COLUMN_NAME='bpdIPurchaseAmt')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ADD [bpdIPurchaseAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND COLUMN_NAME='bpdISalesAmt')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ADD [bpdISalesAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND COLUMN_NAME='bpdICostAmt')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ADD [bpdICostAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND COLUMN_NAME='bpditemcategory')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ADD [bpditemcategory] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [BudgetMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetMaster' AND COLUMN_NAME='BudgetID')
BEGIN
	ALTER TABLE [BudgetMaster] ADD [BudgetID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetMaster' AND COLUMN_NAME='BudgetCode')
BEGIN
	ALTER TABLE [BudgetMaster] ADD [BudgetCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetMaster' AND COLUMN_NAME='BudgetHead')
BEGIN
	ALTER TABLE [BudgetMaster] ADD [BudgetHead] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetMaster' AND COLUMN_NAME='budcurid')
BEGIN
	ALTER TABLE [BudgetMaster] ADD [budcurid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanDetail' AND COLUMN_NAME='bpdCompanyID')
BEGIN
	ALTER TABLE [BudgetPlanDetail] ADD [bpdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanDetail' AND COLUMN_NAME='bpdBudgetPlanID')
BEGIN
	ALTER TABLE [BudgetPlanDetail] ADD [bpdBudgetPlanID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanDetail' AND COLUMN_NAME='bpdDetailID')
BEGIN
	ALTER TABLE [BudgetPlanDetail] ADD [bpdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanDetail' AND COLUMN_NAME='bpdBudgetHeadID')
BEGIN
	ALTER TABLE [BudgetPlanDetail] ADD [bpdBudgetHeadID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanDetail' AND COLUMN_NAME='bpdMonthNo')
BEGIN
	ALTER TABLE [BudgetPlanDetail] ADD [bpdMonthNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanDetail' AND COLUMN_NAME='bpdAmount')
BEGIN
	ALTER TABLE [BudgetPlanDetail] ADD [bpdAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanDetail' AND COLUMN_NAME='bpdRevised')
BEGIN
	ALTER TABLE [BudgetPlanDetail] ADD [bpdRevised] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanDetail' AND COLUMN_NAME='bpdReviseDetailId')
BEGIN
	ALTER TABLE [BudgetPlanDetail] ADD [bpdReviseDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphCompanyID')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphBudgetPlanID')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphBudgetPlanID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphBudgetNo')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphBudgetNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphBudgetDate')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphBudgetDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphBudgetPanel')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphBudgetPanel] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphReviewPanel')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphReviewPanel] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphReviewDate')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphReviewDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphSanctionedBy')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphSanctionedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphSanctionedDate')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphSanctionedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphRemarks')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphCancelled')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphCancelledRemarks')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphDepartmentId')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphDepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphBudgetName')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphBudgetName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphConfirmed')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphConfirmed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphPlanYear')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphPlanYear] [varchar] (4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME='bphtype')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD [bphtype] [varchar] (4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND COLUMN_NAME='brdCompanyID')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ADD [brdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND COLUMN_NAME='brdBudgetPlanID')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ADD [brdBudgetPlanID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND COLUMN_NAME='brdDetailID')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ADD [brdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND COLUMN_NAME='brdDate')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ADD [brdDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND COLUMN_NAME='brdRevisedBy')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ADD [brdRevisedBy] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND COLUMN_NAME='brdApprovedBy')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ADD [brdApprovedBy] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND COLUMN_NAME='brdRemarks')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ADD [brdRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND COLUMN_NAME='brdConfirmed')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ADD [brdConfirmed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Build' AND COLUMN_NAME='Build')
BEGIN
	ALTER TABLE [Build] ADD [Build] [decimal] (18,0) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashBox' AND COLUMN_NAME='CBID')
BEGIN
	ALTER TABLE [CashBox] ADD [CBID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashBox' AND COLUMN_NAME='CBMode')
BEGIN
	ALTER TABLE [CashBox] ADD [CBMode] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashBox' AND COLUMN_NAME='CBUserID')
BEGIN
	ALTER TABLE [CashBox] ADD [CBUserID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashBox' AND COLUMN_NAME='CBShopID')
BEGIN
	ALTER TABLE [CashBox] ADD [CBShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashBox' AND COLUMN_NAME='CBAmount')
BEGIN
	ALTER TABLE [CashBox] ADD [CBAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashBox' AND COLUMN_NAME='CBVerifiedAmount')
BEGIN
	ALTER TABLE [CashBox] ADD [CBVerifiedAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashBox' AND COLUMN_NAME='CBDate')
BEGIN
	ALTER TABLE [CashBox] ADD [CBDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashBox' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [CashBox] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__CashBox__rowguid__18ED4BE0] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashFlowOpenings' AND COLUMN_NAME='accountid')
BEGIN
	ALTER TABLE [CashFlowOpenings] ADD [accountid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashFlowOpenings' AND COLUMN_NAME='amount')
BEGIN
	ALTER TABLE [CashFlowOpenings] ADD [amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashFlowOpenings' AND COLUMN_NAME='financialyearid')
BEGIN
	ALTER TABLE [CashFlowOpenings] ADD [financialyearid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashFlowOpenings' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [CashFlowOpenings] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestDetail' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestDetail' AND COLUMN_NAME='ClearenceReqID')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ADD [ClearenceReqID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestDetail' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestDetail' AND COLUMN_NAME='ItemDescription')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ADD [ItemDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestDetail' AND COLUMN_NAME='Packing')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ADD [Packing] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestDetail' AND COLUMN_NAME='Unit')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ADD [Unit] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestDetail' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ADD [Qty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestDetail' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestDetail' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='ClearenceReqID')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [ClearenceReqID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='ClearenceReqNo')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [ClearenceReqNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='ClearenceReqDate')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [ClearenceReqDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='POCurrencyID')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [POCurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='VendorName')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [VendorName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='VendorAddress')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [VendorAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='PONo')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [PONo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='PODate')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [PODate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='DeliveryTo')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [DeliveryTo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='DeliveryDate')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [DeliveryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='ExpectedArrivalDate')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [ExpectedArrivalDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='EnteredBy')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [EnteredBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [Cancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ClearenceRequestHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CompleteItemlist' AND COLUMN_NAME='temp_ID')
BEGIN
	ALTER TABLE [CompleteItemlist] ADD [temp_ID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CompleteItemlist' AND COLUMN_NAME='CODE')
BEGIN
	ALTER TABLE [CompleteItemlist] ADD [CODE] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CompleteItemlist' AND COLUMN_NAME='BrandName')
BEGIN
	ALTER TABLE [CompleteItemlist] ADD [BrandName] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ContraID')
BEGIN
	ALTER TABLE [Contra] ADD [ContraID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [Contra] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ContraNo')
BEGIN
	ALTER TABLE [Contra] ADD [ContraNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ContraDate')
BEGIN
	ALTER TABLE [Contra] ADD [ContraDate] smalldatetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ContraType')
BEGIN
	ALTER TABLE [Contra] ADD [ContraType] [varchar] (3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='FromAccountID')
BEGIN
	ALTER TABLE [Contra] ADD [FromAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ToAccountID')
BEGIN
	ALTER TABLE [Contra] ADD [ToAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ChargeAccountID')
BEGIN
	ALTER TABLE [Contra] ADD [ChargeAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ContraAmount')
BEGIN
	ALTER TABLE [Contra] ADD [ContraAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ContraChargeAmount')
BEGIN
	ALTER TABLE [Contra] ADD [ContraChargeAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [Contra] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [Contra] ADD [Cancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [Contra] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [Contra] ADD [Posted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [Contra] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ExchangeNature')
BEGIN
	ALTER TABLE [Contra] ADD [ExchangeNature] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [Contra] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='ExchangeRate')
BEGIN
	ALTER TABLE [Contra] ADD [ExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [Contra] ADD [updatetime] datetime CONSTRAINT [DF_Contra_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='depexrate')
BEGIN
	ALTER TABLE [Contra] ADD [depexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [Contra] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='Chequeno')
BEGIN
	ALTER TABLE [Contra] ADD [Chequeno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [Contra] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CostPriceUpdations' AND COLUMN_NAME='pkCol1Value')
BEGIN
	ALTER TABLE [CostPriceUpdations] ADD [pkCol1Value] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CostPriceUpdations' AND COLUMN_NAME='pkCol2Value')
BEGIN
	ALTER TABLE [CostPriceUpdations] ADD [pkCol2Value] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CostPriceUpdations' AND COLUMN_NAME='pkCol3Value')
BEGIN
	ALTER TABLE [CostPriceUpdations] ADD [pkCol3Value] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CostPriceUpdations' AND COLUMN_NAME='DetailTableName')
BEGIN
	ALTER TABLE [CostPriceUpdations] ADD [DetailTableName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CreditInvoiceUpdates_20030805' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [CreditInvoiceUpdates_20030805] ADD [ShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CreditInvoiceUpdates_20030805' AND COLUMN_NAME='InvoiceID')
BEGIN
	ALTER TABLE [CreditInvoiceUpdates_20030805] ADD [InvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='AgreementId')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [AgreementId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='QuotationID')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [QuotationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='AccountId')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [AccountId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [UserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='AgreementSubject')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [AgreementSubject] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='Document')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [Document] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='Extension')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [Extension] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='AgreementDate')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [AgreementDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='CreateDate')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [CreateDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [Deleted] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='IsTemplate')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [IsTemplate] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmAgreement' AND COLUMN_NAME='ProposalId')
BEGIN
	ALTER TABLE [CrmAgreement] ADD [ProposalId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Crmauserreportrights' AND COLUMN_NAME='userid')
BEGIN
	ALTER TABLE [Crmauserreportrights] ADD [userid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Crmauserreportrights' AND COLUMN_NAME='reportid')
BEGIN
	ALTER TABLE [Crmauserreportrights] ADD [reportid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='CaseId')
BEGIN
	ALTER TABLE [CrmCase] ADD [CaseId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='Prority')
BEGIN
	ALTER TABLE [CrmCase] ADD [Prority] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='Status')
BEGIN
	ALTER TABLE [CrmCase] ADD [Status] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmCase] ADD [UserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='ClientId')
BEGIN
	ALTER TABLE [CrmCase] ADD [ClientId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='Subject')
BEGIN
	ALTER TABLE [CrmCase] ADD [Subject] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [CrmCase] ADD [Description] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='Resolution')
BEGIN
	ALTER TABLE [CrmCase] ADD [Resolution] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='CreateDate')
BEGIN
	ALTER TABLE [CrmCase] ADD [CreateDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmCase] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCase' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmCase] ADD [Deleted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [CrmClient] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='ClientId')
BEGIN
	ALTER TABLE [CrmClient] ADD [ClientId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='ClientName')
BEGIN
	ALTER TABLE [CrmClient] ADD [ClientName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='WebSite')
BEGIN
	ALTER TABLE [CrmClient] ADD [WebSite] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='TickerSymbol')
BEGIN
	ALTER TABLE [CrmClient] ADD [TickerSymbol] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='Industry')
BEGIN
	ALTER TABLE [CrmClient] ADD [Industry] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [CrmClient] ADD [Type] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='AssignedTo')
BEGIN
	ALTER TABLE [CrmClient] ADD [AssignedTo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='Phone')
BEGIN
	ALTER TABLE [CrmClient] ADD [Phone] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='Fax')
BEGIN
	ALTER TABLE [CrmClient] ADD [Fax] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='Other')
BEGIN
	ALTER TABLE [CrmClient] ADD [Other] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='Email')
BEGIN
	ALTER TABLE [CrmClient] ADD [Email] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='AnnualRevenue')
BEGIN
	ALTER TABLE [CrmClient] ADD [AnnualRevenue] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='Rating')
BEGIN
	ALTER TABLE [CrmClient] ADD [Rating] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='BillingAddress')
BEGIN
	ALTER TABLE [CrmClient] ADD [BillingAddress] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='BCityID')
BEGIN
	ALTER TABLE [CrmClient] ADD [BCityID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='BCountryID')
BEGIN
	ALTER TABLE [CrmClient] ADD [BCountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='BPostalCode')
BEGIN
	ALTER TABLE [CrmClient] ADD [BPostalCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='ShoppingAddress')
BEGIN
	ALTER TABLE [CrmClient] ADD [ShoppingAddress] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='SCityID')
BEGIN
	ALTER TABLE [CrmClient] ADD [SCityID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='SCountryID')
BEGIN
	ALTER TABLE [CrmClient] ADD [SCountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='SPostalCode')
BEGIN
	ALTER TABLE [CrmClient] ADD [SPostalCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmClient' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [CrmClient] ADD [Description] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='ContactID')
BEGIN
	ALTER TABLE [CrmContact] ADD [ContactID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='ClientId')
BEGIN
	ALTER TABLE [CrmContact] ADD [ClientId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmContact] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='FirstName')
BEGIN
	ALTER TABLE [CrmContact] ADD [FirstName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='LastName')
BEGIN
	ALTER TABLE [CrmContact] ADD [LastName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='Sex')
BEGIN
	ALTER TABLE [CrmContact] ADD [Sex] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='Address')
BEGIN
	ALTER TABLE [CrmContact] ADD [Address] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='Email')
BEGIN
	ALTER TABLE [CrmContact] ADD [Email] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='CityId')
BEGIN
	ALTER TABLE [CrmContact] ADD [CityId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='CountryId')
BEGIN
	ALTER TABLE [CrmContact] ADD [CountryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='DateofBirth')
BEGIN
	ALTER TABLE [CrmContact] ADD [DateofBirth] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='MartialStatus')
BEGIN
	ALTER TABLE [CrmContact] ADD [MartialStatus] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='Anniversary')
BEGIN
	ALTER TABLE [CrmContact] ADD [Anniversary] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='Profession')
BEGIN
	ALTER TABLE [CrmContact] ADD [Profession] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='PointId')
BEGIN
	ALTER TABLE [CrmContact] ADD [PointId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='Phone')
BEGIN
	ALTER TABLE [CrmContact] ADD [Phone] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='OfficeNo')
BEGIN
	ALTER TABLE [CrmContact] ADD [OfficeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='MobileNumber')
BEGIN
	ALTER TABLE [CrmContact] ADD [MobileNumber] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmContact] ADD [UserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='username')
BEGIN
	ALTER TABLE [CrmContact] ADD [username] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='password')
BEGIN
	ALTER TABLE [CrmContact] ADD [password] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmContact] ADD [Deleted] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='CreateDate')
BEGIN
	ALTER TABLE [CrmContact] ADD [CreateDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmContact' AND COLUMN_NAME='FaxNo')
BEGIN
	ALTER TABLE [CrmContact] ADD [FaxNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [CustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='CustomerName')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [CustomerName] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [Active] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='Address1')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [Address1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='Address2')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [Address2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='Address3')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [Address3] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='CityID')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [CityID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='PhoneNo')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [PhoneNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='FaxNo')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [FaxNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='EmailID')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [EmailID] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='CountryID')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [CountryID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='custdob')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [custdob] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='webadd')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [webadd] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='CreditLimit')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [CreditLimit] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='registerdate')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [registerdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='CusGroupId')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [CusGroupId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='MasterApllicationCustomerId')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [MasterApllicationCustomerId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [Deleted] int CONSTRAINT [DF__CrmCustom__Delet__19C0A931] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME='CustomerCategory')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD [CustomerCategory] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='Emailid')
BEGIN
	ALTER TABLE [CrmEmail] ADD [Emailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='SendDate')
BEGIN
	ALTER TABLE [CrmEmail] ADD [SendDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='ToEmail')
BEGIN
	ALTER TABLE [CrmEmail] ADD [ToEmail] [varchar] (MAX) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='CCC')
BEGIN
	ALTER TABLE [CrmEmail] ADD [CCC] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='BCCC')
BEGIN
	ALTER TABLE [CrmEmail] ADD [BCCC] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='Subject')
BEGIN
	ALTER TABLE [CrmEmail] ADD [Subject] [nvarchar] (500) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='Body')
BEGIN
	ALTER TABLE [CrmEmail] ADD [Body] [nvarchar] (4000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='Send')
BEGIN
	ALTER TABLE [CrmEmail] ADD [Send] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='RelatedTo')
BEGIN
	ALTER TABLE [CrmEmail] ADD [RelatedTo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='RelatedToId')
BEGIN
	ALTER TABLE [CrmEmail] ADD [RelatedToId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmail' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmEmail] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmailRecepients' AND COLUMN_NAME='EmailId')
BEGIN
	ALTER TABLE [CrmEmailRecepients] ADD [EmailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmailRecepients' AND COLUMN_NAME='ContactId')
BEGIN
	ALTER TABLE [CrmEmailRecepients] ADD [ContactId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmailRecepients' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [CrmEmailRecepients] ADD [Type] [nchar] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmailRecepients' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmEmailRecepients] ADD [CompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmailRecepients' AND COLUMN_NAME='Sent')
BEGIN
	ALTER TABLE [CrmEmailRecepients] ADD [Sent] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmItem' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [crmItem] ADD [ItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmItem' AND COLUMN_NAME='ItemCode')
BEGIN
	ALTER TABLE [crmItem] ADD [ItemCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmItem' AND COLUMN_NAME='ItemDescription')
BEGIN
	ALTER TABLE [crmItem] ADD [ItemDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmItem' AND COLUMN_NAME='ItemPrice')
BEGIN
	ALTER TABLE [crmItem] ADD [ItemPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmItem' AND COLUMN_NAME='ItemImage')
BEGIN
	ALTER TABLE [crmItem] ADD [ItemImage] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmItem' AND COLUMN_NAME='Extension')
BEGIN
	ALTER TABLE [crmItem] ADD [Extension] [char] (4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeadMaster' AND COLUMN_NAME='LeadId')
BEGIN
	ALTER TABLE [CrmLeadMaster] ADD [LeadId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeadMaster' AND COLUMN_NAME='LeadSource')
BEGIN
	ALTER TABLE [CrmLeadMaster] ADD [LeadSource] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeadMaster' AND COLUMN_NAME='Discription')
BEGIN
	ALTER TABLE [CrmLeadMaster] ADD [Discription] [varchar] (1000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeadMaster' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmLeadMaster] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='LeadId')
BEGIN
	ALTER TABLE [CrmLeads] ADD [LeadId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='LeadSource')
BEGIN
	ALTER TABLE [CrmLeads] ADD [LeadSource] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='LeadSourceDescription')
BEGIN
	ALTER TABLE [CrmLeads] ADD [LeadSourceDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='ReferredBy')
BEGIN
	ALTER TABLE [CrmLeads] ADD [ReferredBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='FirstName')
BEGIN
	ALTER TABLE [CrmLeads] ADD [FirstName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='LastName')
BEGIN
	ALTER TABLE [CrmLeads] ADD [LastName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='ClientId')
BEGIN
	ALTER TABLE [CrmLeads] ADD [ClientId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmLeads] ADD [UserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='Status')
BEGIN
	ALTER TABLE [CrmLeads] ADD [Status] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='OfficePhone')
BEGIN
	ALTER TABLE [CrmLeads] ADD [OfficePhone] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='Mobile')
BEGIN
	ALTER TABLE [CrmLeads] ADD [Mobile] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='Fax')
BEGIN
	ALTER TABLE [CrmLeads] ADD [Fax] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='Email')
BEGIN
	ALTER TABLE [CrmLeads] ADD [Email] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='PrimaryAddress')
BEGIN
	ALTER TABLE [CrmLeads] ADD [PrimaryAddress] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='PCity')
BEGIN
	ALTER TABLE [CrmLeads] ADD [PCity] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='PCountry')
BEGIN
	ALTER TABLE [CrmLeads] ADD [PCountry] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='PPostalCode')
BEGIN
	ALTER TABLE [CrmLeads] ADD [PPostalCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='OtherAddress')
BEGIN
	ALTER TABLE [CrmLeads] ADD [OtherAddress] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='OCity')
BEGIN
	ALTER TABLE [CrmLeads] ADD [OCity] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='OCountry')
BEGIN
	ALTER TABLE [CrmLeads] ADD [OCountry] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='OPostalCode')
BEGIN
	ALTER TABLE [CrmLeads] ADD [OPostalCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='Descriptions')
BEGIN
	ALTER TABLE [CrmLeads] ADD [Descriptions] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='Tittle')
BEGIN
	ALTER TABLE [CrmLeads] ADD [Tittle] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='Department')
BEGIN
	ALTER TABLE [CrmLeads] ADD [Department] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='DonotCall')
BEGIN
	ALTER TABLE [CrmLeads] ADD [DonotCall] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='StatusDescription')
BEGIN
	ALTER TABLE [CrmLeads] ADD [StatusDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='Salutation')
BEGIN
	ALTER TABLE [CrmLeads] ADD [Salutation] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='PState')
BEGIN
	ALTER TABLE [CrmLeads] ADD [PState] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='OState')
BEGIN
	ALTER TABLE [CrmLeads] ADD [OState] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='OtherPhno')
BEGIN
	ALTER TABLE [CrmLeads] ADD [OtherPhno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='HomePhno')
BEGIN
	ALTER TABLE [CrmLeads] ADD [HomePhno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmLeads] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='CreateDate')
BEGIN
	ALTER TABLE [CrmLeads] ADD [CreateDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmLeads] ADD [Deleted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmLeads' AND COLUMN_NAME='LeadTypeId')
BEGIN
	ALTER TABLE [CrmLeads] ADD [LeadTypeId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOppertunityType' AND COLUMN_NAME='TypeId')
BEGIN
	ALTER TABLE [CrmOppertunityType] ADD [TypeId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOppertunityType' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [CrmOppertunityType] ADD [Type] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOppertunityType' AND COLUMN_NAME='Discription')
BEGIN
	ALTER TABLE [CrmOppertunityType] ADD [Discription] [varchar] (1000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOppertunityType' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmOppertunityType] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='OppertunityId')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [OppertunityId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='ClientId')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [ClientId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='OpportunitName')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [OpportunitName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [Type] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='LeadSource')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [LeadSource] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [UserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [Description] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='Currencyid')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [Currencyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='ExpectedCloseDate')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [ExpectedCloseDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='NextStep')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [NextStep] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='SalesStage')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [SalesStage] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='Probability')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [Probability] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [Active] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='CreateDate')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [CreateDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='ExchangeRate')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [ExchangeRate] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='CompanyAmount')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [CompanyAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [Deleted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmOpportunity' AND COLUMN_NAME='LeadTypeId')
BEGIN
	ALTER TABLE [CrmOpportunity] ADD [LeadTypeId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='ProposalId')
BEGIN
	ALTER TABLE [CrmProposal] ADD [ProposalId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='QuotationId')
BEGIN
	ALTER TABLE [CrmProposal] ADD [QuotationId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='AccountId')
BEGIN
	ALTER TABLE [CrmProposal] ADD [AccountId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmProposal] ADD [UserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='ProposalSubject')
BEGIN
	ALTER TABLE [CrmProposal] ADD [ProposalSubject] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='Document')
BEGIN
	ALTER TABLE [CrmProposal] ADD [Document] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='Extension')
BEGIN
	ALTER TABLE [CrmProposal] ADD [Extension] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='ProposalDate')
BEGIN
	ALTER TABLE [CrmProposal] ADD [ProposalDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='CreateDate')
BEGIN
	ALTER TABLE [CrmProposal] ADD [CreateDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmProposal] ADD [Deleted] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmProposal' AND COLUMN_NAME='IsTemplate')
BEGIN
	ALTER TABLE [CrmProposal] ADD [IsTemplate] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='QutotationId')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [QutotationId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='QutotationSubject')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [QutotationSubject] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='PurchaseOrederNo')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [PurchaseOrederNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='PaymentTerms')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [PaymentTerms] [varchar] (15) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='OpertunityId')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [OpertunityId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Quotestage')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Quotestage] [varchar] (15) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ValidUntil')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ValidUntil] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='OrginalPoDate')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [OrginalPoDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='billAccountId')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [billAccountId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='billContactId')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [billContactId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='BillAddress')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [BillAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='BillState')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [BillState] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='BillCity')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [BillCity] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='BillPostalCode')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [BillPostalCode] [char] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='BillCountry')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [BillCountry] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ShipAddress')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ShipAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ShipState')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ShipState] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ShipCity')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ShipCity] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ShipPostalCode')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ShipPostalCode] [char] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ShipCountry')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ShipCountry] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Description] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Userid')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Userid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='shipAccountId')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [shipAccountId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='shipContactId')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [shipContactId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ShipAmount')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ShipAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ShipProvider')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ShipProvider] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ExchangeRate')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ExchangeRate] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='CompanyAmount')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [CompanyAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Deleted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='CreateDate')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [CreateDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='QuotationNo')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [QuotationNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='FinancialYearId')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [FinancialYearId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [ShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Id')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Id] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Clid')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Clid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Item')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Item] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Qty] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotation' AND COLUMN_NAME='Cofirm')
BEGIN
	ALTER TABLE [CrmQuotation] ADD [Cofirm] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotationDetails' AND COLUMN_NAME='Quotationid')
BEGIN
	ALTER TABLE [CrmQuotationDetails] ADD [Quotationid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotationDetails' AND COLUMN_NAME='SlOrder')
BEGIN
	ALTER TABLE [CrmQuotationDetails] ADD [SlOrder] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotationDetails' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [CrmQuotationDetails] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotationDetails' AND COLUMN_NAME='ItemDescription')
BEGIN
	ALTER TABLE [CrmQuotationDetails] ADD [ItemDescription] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotationDetails' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [CrmQuotationDetails] ADD [Qty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotationDetails' AND COLUMN_NAME='Price')
BEGIN
	ALTER TABLE [CrmQuotationDetails] ADD [Price] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotationDetails' AND COLUMN_NAME='PackingtypeId')
BEGIN
	ALTER TABLE [CrmQuotationDetails] ADD [PackingtypeId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotationDetails' AND COLUMN_NAME='IsCrmItem')
BEGIN
	ALTER TABLE [CrmQuotationDetails] ADD [IsCrmItem] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmQuotationDetails' AND COLUMN_NAME='MappedItemID')
BEGIN
	ALTER TABLE [CrmQuotationDetails] ADD [MappedItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Crmreportgroup' AND COLUMN_NAME='reportgroupid')
BEGIN
	ALTER TABLE [Crmreportgroup] ADD [reportgroupid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Crmreportgroup' AND COLUMN_NAME='groupname')
BEGIN
	ALTER TABLE [Crmreportgroup] ADD [groupname] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Crmreports' AND COLUMN_NAME='reportid')
BEGIN
	ALTER TABLE [Crmreports] ADD [reportid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Crmreports' AND COLUMN_NAME='reportname')
BEGIN
	ALTER TABLE [Crmreports] ADD [reportname] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Crmreports' AND COLUMN_NAME='groupid')
BEGIN
	ALTER TABLE [Crmreports] ADD [groupid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Crmreports' AND COLUMN_NAME='modulecode')
BEGIN
	ALTER TABLE [Crmreports] ADD [modulecode] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmSettings' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [crmSettings] ADD [ShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmSettings' AND COLUMN_NAME='EmailFooter')
BEGIN
	ALTER TABLE [crmSettings] ADD [EmailFooter] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmSettings' AND COLUMN_NAME='EmailLimit')
BEGIN
	ALTER TABLE [crmSettings] ADD [EmailLimit] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmSettings' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [crmSettings] ADD [CompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='crmSettings' AND COLUMN_NAME='ShowUsersInAccountsMaster')
BEGIN
	ALTER TABLE [crmSettings] ADD [ShowUsersInAccountsMaster] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='RequerstId')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [RequerstId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='Priority')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [Priority] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='Status')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [Status] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [Type] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='Source')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [Source] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='Category')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [Category] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [UserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='FixedinRelease')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [FixedinRelease] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='Subject')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [Subject] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [Description] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='WorkLog')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [WorkLog] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='Resolution')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [Resolution] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmSupportrequest' AND COLUMN_NAME='Activie')
BEGIN
	ALTER TABLE [CrmSupportrequest] ADD [Activie] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='TaskId')
BEGIN
	ALTER TABLE [CrmTask] ADD [TaskId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [CrmTask] ADD [Type] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='Subject')
BEGIN
	ALTER TABLE [CrmTask] ADD [Subject] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='StartDate')
BEGIN
	ALTER TABLE [CrmTask] ADD [StartDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='StartHour')
BEGIN
	ALTER TABLE [CrmTask] ADD [StartHour] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='StartMinute')
BEGIN
	ALTER TABLE [CrmTask] ADD [StartMinute] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='DurationHour')
BEGIN
	ALTER TABLE [CrmTask] ADD [DurationHour] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='DurationMinitue')
BEGIN
	ALTER TABLE [CrmTask] ADD [DurationMinitue] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='Status')
BEGIN
	ALTER TABLE [CrmTask] ADD [Status] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='Direction')
BEGIN
	ALTER TABLE [CrmTask] ADD [Direction] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmTask] ADD [UserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [CrmTask] ADD [Description] text  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='ContactId')
BEGIN
	ALTER TABLE [CrmTask] ADD [ContactId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [CrmTask] ADD [Active] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='RelatedTo')
BEGIN
	ALTER TABLE [CrmTask] ADD [RelatedTo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmTask] ADD [Deleted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='CreateDate')
BEGIN
	ALTER TABLE [CrmTask] ADD [CreateDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmTask] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='ModifiedUser')
BEGIN
	ALTER TABLE [CrmTask] ADD [ModifiedUser] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='ModifiedDate')
BEGIN
	ALTER TABLE [CrmTask] ADD [ModifiedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='Reminder')
BEGIN
	ALTER TABLE [CrmTask] ADD [Reminder] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='UserGroupId')
BEGIN
	ALTER TABLE [CrmTask] ADD [UserGroupId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='TransGroupId')
BEGIN
	ALTER TABLE [CrmTask] ADD [TransGroupId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='UserType')
BEGIN
	ALTER TABLE [CrmTask] ADD [UserType] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmTask' AND COLUMN_NAME='Priority')
BEGIN
	ALTER TABLE [CrmTask] ADD [Priority] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserHirarchey' AND COLUMN_NAME='UserHirarcheyId')
BEGIN
	ALTER TABLE [CrmUserHirarchey] ADD [UserHirarcheyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserHirarchey' AND COLUMN_NAME='MasterUserId')
BEGIN
	ALTER TABLE [CrmUserHirarchey] ADD [MasterUserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserHirarchey' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [CrmUserHirarchey] ADD [UserGroupID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserHirarchey' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [CrmUserHirarchey] ADD [Description] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserHirarchey' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [CrmUserHirarchey] ADD [Deleted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserHirarchey' AND COLUMN_NAME='CreateDate')
BEGIN
	ALTER TABLE [CrmUserHirarchey] ADD [CreateDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserHirarchey' AND COLUMN_NAME='DeleteDate')
BEGIN
	ALTER TABLE [CrmUserHirarchey] ADD [DeleteDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserHirarchey' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmUserHirarchey] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserLastVisited' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmUserLastVisited] ADD [UserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserLastVisited' AND COLUMN_NAME='SaveOrder')
BEGIN
	ALTER TABLE [CrmUserLastVisited] ADD [SaveOrder] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserLastVisited' AND COLUMN_NAME='Link')
BEGIN
	ALTER TABLE [CrmUserLastVisited] ADD [Link] [varchar] (500) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserLastVisited' AND COLUMN_NAME='Module')
BEGIN
	ALTER TABLE [CrmUserLastVisited] ADD [Module] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserLastVisited' AND COLUMN_NAME='DisplayText')
BEGIN
	ALTER TABLE [CrmUserLastVisited] ADD [DisplayText] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserLastVisited' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [CrmUserLastVisited] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [UserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='Theme')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [Theme] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='Appstyle')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [Appstyle] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='GridWidth')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [GridWidth] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='LastSelectCountry')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [LastSelectCountry] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='LastSelectCity')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [LastSelectCity] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='ActivityTaskFilter')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [ActivityTaskFilter] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='UserFilter')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [UserFilter] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='ProbablityFilter')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [ProbablityFilter] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='LeasSourceFilter')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [LeasSourceFilter] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='SalesStageFilter')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [SalesStageFilter] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='ReportFromdate')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [ReportFromdate] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmUserPreference' AND COLUMN_NAME='ReportTodate')
BEGIN
	ALTER TABLE [CrmUserPreference] ADD [ReportTodate] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CRMVersion' AND COLUMN_NAME='Id')
BEGIN
	ALTER TABLE [CRMVersion] ADD [Id] int IDENTITY(1,1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CRMVersion' AND COLUMN_NAME='Version')
BEGIN
	ALTER TABLE [CRMVersion] ADD [Version] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CRMVersion' AND COLUMN_NAME='Release')
BEGIN
	ALTER TABLE [CRMVersion] ADD [Release] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CRMVersion' AND COLUMN_NAME='UpdatedDate')
BEGIN
	ALTER TABLE [CRMVersion] ADD [UpdatedDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='CSID')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [CSID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='CSDetailID')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [CSDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='AccInvoiceID')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [AccInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='dcnid')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [dcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='LosAccInvoiceID')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [LosAccInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='losSpInvoiceId')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [losSpInvoiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='losinvoiceid')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [losinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='losdcnid')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [losdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='losserinvoiceid')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [losserinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='InvoiceAmount')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [InvoiceAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='SettlementAmount')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [SettlementAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='paymentid')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [paymentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='losexportid')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [losexportid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='RoomBillID')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [RoomBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='UtilityBillID')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [UtilityBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementDetail' AND COLUMN_NAME='fineid')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ADD [fineid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='CSID')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [CSID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='CSNO')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [CSNO] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='CSDATE')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [CSDATE] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='ReceiptID')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [ReceiptID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='dcnid')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [dcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='losReceiptID')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [losReceiptID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='losdcnid')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [losdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='losGoodsreturnnoteID')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [losGoodsreturnnoteID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [Cancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [FinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [updatetime] datetime CONSTRAINT [DF_CustomerSettlementHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='losshopdcnid')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [losshopdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNId')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNNo')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNDate')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNCustomerID')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNVendorId')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNVendorId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNDebit')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNDebit] bit CONSTRAINT [DF_DebitCreditNote_DCNDebit] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNOtherAccId')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNOtherAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNReferenceNo')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNReferenceNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNBillId')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNBillId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNInvoiceId')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNInvoiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNAmount')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNDetails')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNDetails] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNRemarks')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNCompanyid')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNCompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNExchangerate')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNExchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNRefNo')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNRefNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNCusvenRefNo')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNCusvenRefNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='Dcnfinancialid')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [Dcnfinancialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNCancelled')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNCancelled] bit CONSTRAINT [DF_DebitCreditNote_DCNCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNCancelledRemarks')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNPosted')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNPosted] bit CONSTRAINT [DF_DebitCreditNote_DCNPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='dcndepartmentid')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [dcndepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNRecAddUser')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNRecModifyUser')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='parentdcnid')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [parentdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='childdcnid')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [childdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='dcndepexrate')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [dcndepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='dcnexchangerates')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [dcnexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='debitaccount1')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [debitaccount1] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='debitaccount2')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [debitaccount2] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='parentpaymentid')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [parentpaymentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='parentreceiptid')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [parentreceiptid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='debitamt1')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [debitamt1] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='debitamt2')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [debitamt2] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='otheraccamt')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [otheraccamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='dcnSalesPromotionID')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [dcnSalesPromotionID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='dcnSalesPromotionDetID')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [dcnSalesPromotionDetID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DcnSubDepartmentID')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DcnSubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME='DCNConfirmed')
BEGIN
	ALTER TABLE [DebitCreditNote] ADD [DCNConfirmed] bit CONSTRAINT [DF__DebitCred__DCNCo__19218AB3] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='InvAmt')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [InvAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='SettleAmt')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [SettleAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='InvoiceID')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [InvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [ShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='Due')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [Due] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='InvoiceDate')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [InvoiceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='InvoiceNo')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [InvoiceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [Type] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [Remarks] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='CustomerName')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [CustomerName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='CurrencyName')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [CurrencyName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='Symbol')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [Symbol] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='DueDate')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [DueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='OverDueDays')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [OverDueDays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='Address1')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [Address1] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='Address2')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [Address2] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='Address3')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [Address3] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='DebtoAccID')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [DebtoAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='AccountDesc')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [AccountDesc] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='Currencyid')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [Currencyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='ReferenceNo')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [ReferenceNo] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebtorAgeSum' AND COLUMN_NAME='CustomerCategory')
BEGIN
	ALTER TABLE [DebtorAgeSum] ADD [CustomerCategory] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DenominationChequeDetails' AND COLUMN_NAME='dcdShopId')
BEGIN
	ALTER TABLE [DenominationChequeDetails] ADD [dcdShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DenominationChequeDetails' AND COLUMN_NAME='dcdDenomId')
BEGIN
	ALTER TABLE [DenominationChequeDetails] ADD [dcdDenomId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DenominationChequeDetails' AND COLUMN_NAME='dcdDetailId')
BEGIN
	ALTER TABLE [DenominationChequeDetails] ADD [dcdDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DenominationChequeDetails' AND COLUMN_NAME='dcdCurrId')
BEGIN
	ALTER TABLE [DenominationChequeDetails] ADD [dcdCurrId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DenominationChequeDetails' AND COLUMN_NAME='dcdChequeDetails')
BEGIN
	ALTER TABLE [DenominationChequeDetails] ADD [dcdChequeDetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DenominationChequeDetails' AND COLUMN_NAME='dcdAmount')
BEGIN
	ALTER TABLE [DenominationChequeDetails] ADD [dcdAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DenominationChequeDetails' AND COLUMN_NAME='dcdDepAmount')
BEGIN
	ALTER TABLE [DenominationChequeDetails] ADD [dcdDepAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationdetail' AND COLUMN_NAME='dshopid')
BEGIN
	ALTER TABLE [denominationdetail] ADD [dshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationdetail' AND COLUMN_NAME='ddenominationid')
BEGIN
	ALTER TABLE [denominationdetail] ADD [ddenominationid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationdetail' AND COLUMN_NAME='dcurrencyid')
BEGIN
	ALTER TABLE [denominationdetail] ADD [dcurrencyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationdetail' AND COLUMN_NAME='ddenominationtype')
BEGIN
	ALTER TABLE [denominationdetail] ADD [ddenominationtype] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationdetail' AND COLUMN_NAME='ddenominationcount')
BEGIN
	ALTER TABLE [denominationdetail] ADD [ddenominationcount] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationdetail' AND COLUMN_NAME='damount')
BEGIN
	ALTER TABLE [denominationdetail] ADD [damount] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationdetail' AND COLUMN_NAME='ddepamount')
BEGIN
	ALTER TABLE [denominationdetail] ADD [ddepamount] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [denominationheader] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [denominationheader] ADD [shopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='denominationid')
BEGIN
	ALTER TABLE [denominationheader] ADD [denominationid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='denominationno')
BEGIN
	ALTER TABLE [denominationheader] ADD [denominationno] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='denomdate')
BEGIN
	ALTER TABLE [denominationheader] ADD [denomdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='remarks')
BEGIN
	ALTER TABLE [denominationheader] ADD [remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='cancelled')
BEGIN
	ALTER TABLE [denominationheader] ADD [cancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='cancelledremarks')
BEGIN
	ALTER TABLE [denominationheader] ADD [cancelledremarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='denoUserID')
BEGIN
	ALTER TABLE [denominationheader] ADD [denoUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='tillid')
BEGIN
	ALTER TABLE [denominationheader] ADD [tillid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='denominationheader' AND COLUMN_NAME='tillHistoryid')
BEGIN
	ALTER TABLE [denominationheader] ADD [tillHistoryid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationDetail' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [DepreciationDetail] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationDetail' AND COLUMN_NAME='DepreciationID')
BEGIN
	ALTER TABLE [DepreciationDetail] ADD [DepreciationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationDetail' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [DepreciationDetail] ADD [DetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationDetail' AND COLUMN_NAME='FixedAssetID')
BEGIN
	ALTER TABLE [DepreciationDetail] ADD [FixedAssetID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationDetail' AND COLUMN_NAME='DepreciationAmount')
BEGIN
	ALTER TABLE [DepreciationDetail] ADD [DepreciationAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationDetail' AND COLUMN_NAME='DepreciationAccountID')
BEGIN
	ALTER TABLE [DepreciationDetail] ADD [DepreciationAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationDetail' AND COLUMN_NAME='assetaccountid')
BEGIN
	ALTER TABLE [DepreciationDetail] ADD [assetaccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationDetail' AND COLUMN_NAME='Depexpaccid')
BEGIN
	ALTER TABLE [DepreciationDetail] ADD [Depexpaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='DepreciationID')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [DepreciationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='DepreciationDate')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [DepreciationDate] smalldatetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='DeprAccountID')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [DeprAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [Remarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='DepreciationNo')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [DepreciationNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [Cancelled] bit CONSTRAINT [DF_Depreciation_Cancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='cancelledremarks')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [cancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [Posted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [updatetime] datetime CONSTRAINT [DF_Depreciation_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__Depreciat__rowgu__17786E0C] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='depexrate')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [depexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='consexrate')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [consexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='exChangeRates')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [exChangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [DepreciationHeader] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [Discountdetails] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME='Discountid')
BEGIN
	ALTER TABLE [Discountdetails] ADD [Discountid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME='Outletid')
BEGIN
	ALTER TABLE [Discountdetails] ADD [Outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME='Startdatetime')
BEGIN
	ALTER TABLE [Discountdetails] ADD [Startdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME='enddatetime')
BEGIN
	ALTER TABLE [Discountdetails] ADD [enddatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME='discountper')
BEGIN
	ALTER TABLE [Discountdetails] ADD [discountper] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME='dailytrue')
BEGIN
	ALTER TABLE [Discountdetails] ADD [dailytrue] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME='alldishtrue')
BEGIN
	ALTER TABLE [Discountdetails] ADD [alldishtrue] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME='discountaccid')
BEGIN
	ALTER TABLE [Discountdetails] ADD [discountaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='discountdishdetails' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [discountdishdetails] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='discountdishdetails' AND COLUMN_NAME='discountid')
BEGIN
	ALTER TABLE [discountdishdetails] ADD [discountid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='discountdishdetails' AND COLUMN_NAME='Outletid')
BEGIN
	ALTER TABLE [discountdishdetails] ADD [Outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='discountdishdetails' AND COLUMN_NAME='dishid')
BEGIN
	ALTER TABLE [discountdishdetails] ADD [dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='discountdishdetails' AND COLUMN_NAME='discountper')
BEGIN
	ALTER TABLE [discountdishdetails] ADD [discountper] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [Discountheader] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='Discountid')
BEGIN
	ALTER TABLE [Discountheader] ADD [Discountid] int CONSTRAINT [DF_Discountheader_Discountid] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='DiscountCode')
BEGIN
	ALTER TABLE [Discountheader] ADD [DiscountCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='DiscountName')
BEGIN
	ALTER TABLE [Discountheader] ADD [DiscountName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='Discountper')
BEGIN
	ALTER TABLE [Discountheader] ADD [Discountper] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='staff')
BEGIN
	ALTER TABLE [Discountheader] ADD [staff] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='Customer')
BEGIN
	ALTER TABLE [Discountheader] ADD [Customer] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='Guest')
BEGIN
	ALTER TABLE [Discountheader] ADD [Guest] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='Startdatetime')
BEGIN
	ALTER TABLE [Discountheader] ADD [Startdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='enddatetime')
BEGIN
	ALTER TABLE [Discountheader] ADD [enddatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='dailytrue')
BEGIN
	ALTER TABLE [Discountheader] ADD [dailytrue] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME='Mealid')
BEGIN
	ALTER TABLE [Discountheader] ADD [Mealid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='seg_detail_id')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [seg_detail_id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='seg_detail_header_id')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [seg_detail_header_id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='seg_detail_dishid')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [seg_detail_dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='seg_detail_outletid')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [seg_detail_outletid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='seg_detail_companyid')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [seg_detail_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='Seg_Detail_UpdateTime')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [Seg_Detail_UpdateTime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='Seg_Detail_UserID')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [Seg_Detail_UserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='seg_detail_dish_cp')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [seg_detail_dish_cp] [decimal] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='seg_detail_dish_sp_fig')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [seg_detail_dish_sp_fig] [decimal] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentDetail' AND COLUMN_NAME='seg_detail_dish_sp_per')
BEGIN
	ALTER TABLE [DishSegmentDetail] ADD [seg_detail_dish_sp_per] [decimal] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentHeader' AND COLUMN_NAME='seg_header_id')
BEGIN
	ALTER TABLE [DishSegmentHeader] ADD [seg_header_id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentHeader' AND COLUMN_NAME='seg_header_name')
BEGIN
	ALTER TABLE [DishSegmentHeader] ADD [seg_header_name] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentHeader' AND COLUMN_NAME='seg_header_companyID')
BEGIN
	ALTER TABLE [DishSegmentHeader] ADD [seg_header_companyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DishSegmentHeader' AND COLUMN_NAME='seg_header_remarks')
BEGIN
	ALTER TABLE [DishSegmentHeader] ADD [seg_header_remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='CustomerId')
BEGIN
	ALTER TABLE [EmailList] ADD [CustomerId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [EmailList] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='DepartmentName')
BEGIN
	ALTER TABLE [EmailList] ADD [DepartmentName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='InvocieId')
BEGIN
	ALTER TABLE [EmailList] ADD [InvocieId] [nchar] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='InvAmount')
BEGIN
	ALTER TABLE [EmailList] ADD [InvAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='SettledAmt')
BEGIN
	ALTER TABLE [EmailList] ADD [SettledAmt] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='BalanceAmt')
BEGIN
	ALTER TABLE [EmailList] ADD [BalanceAmt] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='Age')
BEGIN
	ALTER TABLE [EmailList] ADD [Age] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='Due')
BEGIN
	ALTER TABLE [EmailList] ADD [Due] [char] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='Processed')
BEGIN
	ALTER TABLE [EmailList] ADD [Processed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='CurrencyName')
BEGIN
	ALTER TABLE [EmailList] ADD [CurrencyName] [nvarchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='Symbol')
BEGIN
	ALTER TABLE [EmailList] ADD [Symbol] [nvarchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='Invoicedate')
BEGIN
	ALTER TABLE [EmailList] ADD [Invoicedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='Invoiceno')
BEGIN
	ALTER TABLE [EmailList] ADD [Invoiceno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='Referenceno')
BEGIN
	ALTER TABLE [EmailList] ADD [Referenceno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailList' AND COLUMN_NAME='remarks')
BEGIN
	ALTER TABLE [EmailList] ADD [remarks] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailRecipients' AND COLUMN_NAME='MailType')
BEGIN
	ALTER TABLE [EmailRecipients] ADD [MailType] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailRecipients' AND COLUMN_NAME='Recipients')
BEGIN
	ALTER TABLE [EmailRecipients] ADD [Recipients] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailSettings' AND COLUMN_NAME='SMTPHost')
BEGIN
	ALTER TABLE [EmailSettings] ADD [SMTPHost] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailSettings' AND COLUMN_NAME='SMTPPort')
BEGIN
	ALTER TABLE [EmailSettings] ADD [SMTPPort] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailSettings' AND COLUMN_NAME='DisplayName')
BEGIN
	ALTER TABLE [EmailSettings] ADD [DisplayName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailSettings' AND COLUMN_NAME='EMail')
BEGIN
	ALTER TABLE [EmailSettings] ADD [EMail] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailSettings' AND COLUMN_NAME='Password')
BEGIN
	ALTER TABLE [EmailSettings] ADD [Password] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailSettings' AND COLUMN_NAME='TimerInterval')
BEGIN
	ALTER TABLE [EmailSettings] ADD [TimerInterval] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='EmailSettings' AND COLUMN_NAME='ForecastingDays')
BEGIN
	ALTER TABLE [EmailSettings] ADD [ForecastingDays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRate' AND COLUMN_NAME='ExchangeID')
BEGIN
	ALTER TABLE [ExchangeRate] ADD [ExchangeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRate' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ExchangeRate] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRate' AND COLUMN_NAME='ExchangeDate')
BEGIN
	ALTER TABLE [ExchangeRate] ADD [ExchangeDate] smalldatetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRate' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [ExchangeRate] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__ExchangeR__rowgu__1D314762] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME='ExchangeID')
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD [ExchangeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD [CurrencyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME='BuyingRate')
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD [BuyingRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME='SellingRate')
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD [SellingRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME='AverageRate')
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD [AverageRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__ExchangeR__rowgu__22EA20B8] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryDetails' AND COLUMN_NAME='ExchangeID')
BEGIN
	ALTER TABLE [ExchangeRateHistoryDetails] ADD [ExchangeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryDetails' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [ExchangeRateHistoryDetails] ADD [CurrencyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ExchangeRateHistoryDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryDetails' AND COLUMN_NAME='BuyingRate')
BEGIN
	ALTER TABLE [ExchangeRateHistoryDetails] ADD [BuyingRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryDetails' AND COLUMN_NAME='SellingRate')
BEGIN
	ALTER TABLE [ExchangeRateHistoryDetails] ADD [SellingRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryDetails' AND COLUMN_NAME='AverageRate')
BEGIN
	ALTER TABLE [ExchangeRateHistoryDetails] ADD [AverageRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [ExchangeRateHistoryDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__ExchangeR__rowgu__5AEF4E10] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryHeader' AND COLUMN_NAME='ExchangeID')
BEGIN
	ALTER TABLE [ExchangeRateHistoryHeader] ADD [ExchangeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ExchangeRateHistoryHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryHeader' AND COLUMN_NAME='ExchangeDate')
BEGIN
	ALTER TABLE [ExchangeRateHistoryHeader] ADD [ExchangeDate] datetime CONSTRAINT [DF__ExchangeR__Excha__345F90D4] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [ExchangeRateHistoryHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__ExchangeR__rowgu__3553B50D] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='DSN')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [DSN] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='DbName')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [DbName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='OdbcUser')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [OdbcUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='OdbcPassword')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [OdbcPassword] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='SMTPhost')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [SMTPhost] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='Port')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [Port] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [UserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='DisplayName')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [DisplayName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='EmailID')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [EmailID] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='Password')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [Password] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExpiryEmailSettings' AND COLUMN_NAME='GracePeriod')
BEGIN
	ALTER TABLE [ExpiryEmailSettings] ADD [GracePeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Alternate' AND COLUMN_NAME='fb_kotID')
BEGIN
	ALTER TABLE [fb_Alternate] ADD [fb_kotID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Alternate' AND COLUMN_NAME='fb_dishID')
BEGIN
	ALTER TABLE [fb_Alternate] ADD [fb_dishID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Alternate' AND COLUMN_NAME='fb_ItemID')
BEGIN
	ALTER TABLE [fb_Alternate] ADD [fb_ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Alternate' AND COLUMN_NAME='fb_row')
BEGIN
	ALTER TABLE [fb_Alternate] ADD [fb_row] [char] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Alternate' AND COLUMN_NAME='KotOrder')
BEGIN
	ALTER TABLE [fb_Alternate] ADD [KotOrder] [decimal] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Alternate' AND COLUMN_NAME='Fb_outletid')
BEGIN
	ALTER TABLE [fb_Alternate] ADD [Fb_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Alternate' AND COLUMN_NAME='fb_costprice')
BEGIN
	ALTER TABLE [fb_Alternate] ADD [fb_costprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botdetails' AND COLUMN_NAME='Fb_bd_Companyid')
BEGIN
	ALTER TABLE [Fb_botdetails] ADD [Fb_bd_Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botdetails' AND COLUMN_NAME='fb_bd_Outletid')
BEGIN
	ALTER TABLE [Fb_botdetails] ADD [fb_bd_Outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botdetails' AND COLUMN_NAME='Fb_bd_botid')
BEGIN
	ALTER TABLE [Fb_botdetails] ADD [Fb_bd_botid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botdetails' AND COLUMN_NAME='Fb_bd_Botdetailid')
BEGIN
	ALTER TABLE [Fb_botdetails] ADD [Fb_bd_Botdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botdetails' AND COLUMN_NAME='fb_bd_dishid')
BEGIN
	ALTER TABLE [Fb_botdetails] ADD [fb_bd_dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botdetails' AND COLUMN_NAME='Fb_bd_botquantity')
BEGIN
	ALTER TABLE [Fb_botdetails] ADD [Fb_bd_botquantity] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botdetails' AND COLUMN_NAME='Fb_bd_rate')
BEGIN
	ALTER TABLE [Fb_botdetails] ADD [Fb_bd_rate] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botdetails' AND COLUMN_NAME='Fb_bd_Remarks')
BEGIN
	ALTER TABLE [Fb_botdetails] ADD [Fb_bd_Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_Companyid')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_outletid')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_botid')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_botid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_botno')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_botno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_botdatetime')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_botdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_registrationid')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_registrationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_Employeeid')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_Employeeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_Tableid')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_Tableid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_ordertakenid')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_ordertakenid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_Remarks')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_cancelled')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_cancelled] bit CONSTRAINT [DF_Fb_botheader_Fb_bh_cancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_CancelledRemarks')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME='Fb_bh_Complimentaryid')
BEGIN
	ALTER TABLE [Fb_botheader] ADD [Fb_bh_Complimentaryid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='Fb_da_Companyid')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [Fb_da_Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='Fb_da_dishid')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [Fb_da_dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='Fb_da_dishaddsid')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [Fb_da_dishaddsid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='Fb_da_itemid')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [Fb_da_itemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='fb_da_quantity')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [fb_da_quantity] [decimal] (20,5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='fb_da_packingtypeid')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [fb_da_packingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='fb_da_packingqty')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [fb_da_packingqty] [decimal] (18,5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='fb_da_dishaddschoiceid')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [fb_da_dishaddschoiceid] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='Fb_da_Futureint')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [Fb_da_Futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='Fb_da_Futurevarchar')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [Fb_da_Futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='Fb_da_Futurebit')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [Fb_da_Futurebit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='Fb_da_YieldPer')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [Fb_da_YieldPer] [decimal] (9,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_DishAdds' AND COLUMN_NAME='fb_da_costprice')
BEGIN
	ALTER TABLE [Fb_DishAdds] ADD [fb_da_costprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_companyid')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_dishid')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_dishsubgroupid')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_dishsubgroupid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_dishcode')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_dishcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_dishname')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_dishname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_processingdur')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_processingdur] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_roombarrestmenu')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_roombarrestmenu] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_remarks')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_yield')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_yield] bit CONSTRAINT [DF_FB_Dishdetails_fb_dd_yield] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_Futureint')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_Futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_Futurevarchar')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_Futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_Futurebit')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_Futurebit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_preparations')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_preparations] [varchar] (5000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='EditDate')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [EditDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [UserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_imagepath')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_imagepath] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='fb_dd_dishcp')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [fb_dd_dishcp] [decimal] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME='Fb_dd_TaxCategoryId')
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD [Fb_dd_TaxCategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME='FB_dg_companyid')
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD [FB_dg_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME='FB_dg_Dishgroupid')
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD [FB_dg_Dishgroupid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME='FB_dg_Dishgroupcode')
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD [FB_dg_Dishgroupcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME='FB_dg_Dishgroupname')
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD [FB_dg_Dishgroupname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME='fb_dg_foodbeverage')
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD [fb_dg_foodbeverage] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME='FB_dg_futureint')
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD [FB_dg_futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME='FB_dg_futurevarchar')
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD [FB_dg_futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME='FB_dg_Futurebit')
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD [FB_dg_Futurebit] bit CONSTRAINT [DF_FB_Dishgroup_FB_dg_Futurebit] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_CompanyID')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_DishSubGroupID')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_DishSubGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_DishGroupID')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_DishGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_DishSubGroupcode')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_DishSubGroupcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_DishSubGroupName')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_DishSubGroupName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_FutureInt')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_FutureInt] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_FutureVarChar')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_FutureVarChar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_FutureBit')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_FutureBit] bit CONSTRAINT [DF_FB_Dishsubgroup_Fb_Ds_FutureBit] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_ProfitPer')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_ProfitPer] [decimal] (9,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='fb_ds_printerpath')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [fb_ds_printerpath] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='fb_ds_imagepath')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [fb_ds_imagepath] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME='Fb_Ds_TaxCategoryId')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD [Fb_Ds_TaxCategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND COLUMN_NAME='fb_Ds_companyid')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD [fb_Ds_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND COLUMN_NAME='Fb_Ds_Outletid')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD [Fb_Ds_Outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND COLUMN_NAME='Fb_Ds_Subgroupid')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD [Fb_Ds_Subgroupid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND COLUMN_NAME='Fb_Ds_Futureint')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD [Fb_Ds_Futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND COLUMN_NAME='Fb_Ds_Futurevarchar')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD [Fb_Ds_Futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND COLUMN_NAME='Fb_Ds_Futurebit')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD [Fb_Ds_Futurebit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND COLUMN_NAME='fb_Ds_CntrTaxper')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD [fb_Ds_CntrTaxper] [decimal] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND COLUMN_NAME='fb_Ds_StateTaxper')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD [fb_Ds_StateTaxper] [decimal] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND COLUMN_NAME='Fb_Ds_Printerpath')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD [Fb_Ds_Printerpath] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_Companyid')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_Outletid')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_Outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_kotid')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_kotid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_kotdetailid')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_kotdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_dishid')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_kotquantity')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_kotquantity] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_rate')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_rate] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_processed')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_processed] bit CONSTRAINT [DF__fb_kotdet__fb_kd__5F9EF494] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_remarks')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_Setteled')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_Setteled] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_AddedItemtype')
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD [fb_kd_AddedItemtype] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_Companyid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_outletid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_kotid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_kotid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_kotno')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_kotno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_kotdatetime')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_kotdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_expecteddatetime')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_expecteddatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_registrationid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_registrationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_Employeeid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_Employeeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_Tableid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_Tableid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_ordertakenid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_ordertakenid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_Remarks')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_noofperson')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_noofperson] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_cancelled')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_cancelled] bit CONSTRAINT [DF__fb_kothea__Fb_kd__70C98096] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_Kh_Cancelledremarks')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_Kh_Cancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='fb_kh_mealplanid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [fb_kh_mealplanid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='Fb_kh_Complimentaryid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [Fb_kh_Complimentaryid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='fb_kh_userid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [fb_kh_userid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='fb_kh_currencyid')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [fb_kh_currencyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='fb_exchangerates')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [fb_exchangerates] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='fb_depexrate')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [fb_depexrate] [numeric] (18,8) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME='fb_ExchangeRate')
BEGIN
	ALTER TABLE [Fb_kotheader] ADD [fb_ExchangeRate] [numeric] (28,8) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_Companyid')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_Outletid')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_Outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_kotid')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_kotid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_kotdetailid')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_kotdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_dishid')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_kotquantity')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_kotquantity] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_rate')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_rate] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_processed')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_processed] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_remarks')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_Setteled')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_Setteled] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_AddedItemtype')
BEGIN
	ALTER TABLE [fb_kotHistory] ADD [fb_kd_AddedItemtype] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_companyid')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_outletid')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_processid')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_processid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_processdetailid')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_processdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_kotid')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_kotid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_botid')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_botid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_dishid')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_reusedqty')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_reusedqty] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_Rate')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_Rate] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_cost')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_cost] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_Actualrate')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_Actualrate] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_discountper')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_discountper] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_centraltaxper')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_centraltaxper] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_statetaxper')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_statetaxper] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_usedqty')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_usedqty] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fd_pd_discountid')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fd_pd_discountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_AddedItemtype')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_AddedItemtype] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_DishTaxPercentage')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_DishTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_DishTaxAmount')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_DishTaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_DishTaxCategoryId')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_DishTaxCategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_packingtypeid')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_packingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processdetail' AND COLUMN_NAME='fb_pd_dishidofextra')
BEGIN
	ALTER TABLE [Fb_processdetail] ADD [fb_pd_dishidofextra] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_companyid')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_outletid')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_Processid')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_Processid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_processdetailid')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_processdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_processrecdetailid')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_processrecdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_recipeitemid')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_recipeitemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_quantity')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_quantity] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_yieldqtyper')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_yieldqtyper] [decimal] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_recipedishid')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_recipedishid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_processrecipedetail' AND COLUMN_NAME='fb_pr_recipedishqty')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ADD [fb_pr_recipedishqty] [decimal] (9,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='Fb_rd_Companyid')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [Fb_rd_Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='Fb_rd_dishid')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [Fb_rd_dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='Fb_rd_recipedetailid')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [Fb_rd_recipedetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='Fb_rd_itemid')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [Fb_rd_itemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='fb_rd_quantity')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [fb_rd_quantity] [decimal] (20,5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='fb_rd_packingtypeid')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [fb_rd_packingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='fb_rd_packingqty')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [fb_rd_packingqty] [decimal] (18,5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='fb_rd_recipechoiceid')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [fb_rd_recipechoiceid] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='Fb_rd_Futureint')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [Fb_rd_Futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='Fb_rd_Futurevarchar')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [Fb_rd_Futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='Fb_rd_Futurebit')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [Fb_rd_Futurebit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='Fb_rd_YieldPer')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [Fb_rd_YieldPer] [decimal] (9,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_recipedetails' AND COLUMN_NAME='Fb_rd_costprice')
BEGIN
	ALTER TABLE [Fb_recipedetails] ADD [Fb_rd_costprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_resttable' AND COLUMN_NAME='Fb_rt_companyid')
BEGIN
	ALTER TABLE [Fb_resttable] ADD [Fb_rt_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_resttable' AND COLUMN_NAME='Fb_rt_outletid')
BEGIN
	ALTER TABLE [Fb_resttable] ADD [Fb_rt_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_resttable' AND COLUMN_NAME='fb_rt_tablemasterid')
BEGIN
	ALTER TABLE [Fb_resttable] ADD [fb_rt_tablemasterid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_resttable' AND COLUMN_NAME='Fb_rt_tableid')
BEGIN
	ALTER TABLE [Fb_resttable] ADD [Fb_rt_tableid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_resttable' AND COLUMN_NAME='Fb_rt_tablecode')
BEGIN
	ALTER TABLE [Fb_resttable] ADD [Fb_rt_tablecode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_resttable' AND COLUMN_NAME='Fb_rt_tablename')
BEGIN
	ALTER TABLE [Fb_resttable] ADD [Fb_rt_tablename] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_resttable' AND COLUMN_NAME='Fb_rt_Futureint')
BEGIN
	ALTER TABLE [Fb_resttable] ADD [Fb_rt_Futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_resttable' AND COLUMN_NAME='Fb_rt_Futurevarchar')
BEGIN
	ALTER TABLE [Fb_resttable] ADD [Fb_rt_Futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_resttable' AND COLUMN_NAME='Fb_rt_Futurebit')
BEGIN
	ALTER TABLE [Fb_resttable] ADD [Fb_rt_Futurebit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_resttablemaster' AND COLUMN_NAME='fb_rm_companyid')
BEGIN
	ALTER TABLE [fb_resttablemaster] ADD [fb_rm_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_resttablemaster' AND COLUMN_NAME='fb_rm_outletid')
BEGIN
	ALTER TABLE [fb_resttablemaster] ADD [fb_rm_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_resttablemaster' AND COLUMN_NAME='fb_rm_tablemasterid')
BEGIN
	ALTER TABLE [fb_resttablemaster] ADD [fb_rm_tablemasterid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_resttablemaster' AND COLUMN_NAME='fb_rm_tablemastercode')
BEGIN
	ALTER TABLE [fb_resttablemaster] ADD [fb_rm_tablemastercode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_resttablemaster' AND COLUMN_NAME='fb_rm_tablemastername')
BEGIN
	ALTER TABLE [fb_resttablemaster] ADD [fb_rm_tablemastername] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='Fb_Sd_Companyid')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [Fb_Sd_Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='Fb_Sd_Outletid')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [Fb_Sd_Outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='Fb_Sd_Dishid')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [Fb_Sd_Dishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='Fb_Sd_Dishamt')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [Fb_Sd_Dishamt] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='Fb_Sd_Starttime')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [Fb_Sd_Starttime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='Fb_Sd_Endtime')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [Fb_Sd_Endtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='fb_sd_processingdur')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [fb_sd_processingdur] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='Fb_Sd_Futureint')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [Fb_Sd_Futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='Fb_Sd_Futurevarchar')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [Fb_Sd_Futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='Fb_Sd_Futurebit')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [Fb_Sd_Futurebit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='fb_sd_dishamtdisc')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [fb_sd_dishamtdisc] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='fb_sd_dishamtdlyflght')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [fb_sd_dishamtdlyflght] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND COLUMN_NAME='fb_sd_dishamtstaff')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ADD [fb_sd_dishamtstaff] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='Fb_to_companyid')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [Fb_to_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_Outletid')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_Outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_Kotbotid')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_Kotbotid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_tableid')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_tableid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_coverid')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_coverid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_billcoverid')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_billcoverid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_billroomid')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_billroomid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_billempid')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_billempid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_kotbotdatetime')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_kotbotdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_billdatetime')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_billdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_kottrue')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_kottrue] bit CONSTRAINT [DF_fb_Tableoccupancy_fb_to_kottrue] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_cashreceived')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_cashreceived] bit CONSTRAINT [DF_fb_Tableoccupancy_fb_to_cashreceived] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME='fb_to_cashdatetime')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD [fb_to_cashdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='FixedAssetID')
BEGIN
	ALTER TABLE [FixedAsset] ADD [FixedAssetID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [FixedAsset] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='FixedAssetDate')
BEGIN
	ALTER TABLE [FixedAsset] ADD [FixedAssetDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='PurchaseDate')
BEGIN
	ALTER TABLE [FixedAsset] ADD [PurchaseDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='InsPolicyNo')
BEGIN
	ALTER TABLE [FixedAsset] ADD [InsPolicyNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='Location')
BEGIN
	ALTER TABLE [FixedAsset] ADD [Location] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [FixedAsset] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='CostPrice')
BEGIN
	ALTER TABLE [FixedAsset] ADD [CostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [FixedAsset] ADD [Remarks] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [FixedAsset] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='Insured')
BEGIN
	ALTER TABLE [FixedAsset] ADD [Insured] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='InsuredAmount')
BEGIN
	ALTER TABLE [FixedAsset] ADD [InsuredAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='Premium')
BEGIN
	ALTER TABLE [FixedAsset] ADD [Premium] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='DepreciatedValue')
BEGIN
	ALTER TABLE [FixedAsset] ADD [DepreciatedValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='DepType')
BEGIN
	ALTER TABLE [FixedAsset] ADD [DepType] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='DepreciationAccId')
BEGIN
	ALTER TABLE [FixedAsset] ADD [DepreciationAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='FixedAssetAccID')
BEGIN
	ALTER TABLE [FixedAsset] ADD [FixedAssetAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='depreciationperiod')
BEGIN
	ALTER TABLE [FixedAsset] ADD [depreciationperiod] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='depreciationpercent')
BEGIN
	ALTER TABLE [FixedAsset] ADD [depreciationpercent] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [FixedAsset] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__FixedAsse__rowgu__28A2FA0E] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='initialDepreciatedValue')
BEGIN
	ALTER TABLE [FixedAsset] ADD [initialDepreciatedValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='billsrefid')
BEGIN
	ALTER TABLE [FixedAsset] ADD [billsrefid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='assetcode')
BEGIN
	ALTER TABLE [FixedAsset] ADD [assetcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='assetname')
BEGIN
	ALTER TABLE [FixedAsset] ADD [assetname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='writeoffrefid')
BEGIN
	ALTER TABLE [FixedAsset] ADD [writeoffrefid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='godownrefid')
BEGIN
	ALTER TABLE [FixedAsset] ADD [godownrefid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='conversiondiffaccid')
BEGIN
	ALTER TABLE [FixedAsset] ADD [conversiondiffaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='conversiondiff')
BEGIN
	ALTER TABLE [FixedAsset] ADD [conversiondiff] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='disposed')
BEGIN
	ALTER TABLE [FixedAsset] ADD [disposed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='FAGroup')
BEGIN
	ALTER TABLE [FixedAsset] ADD [FAGroup] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='Quantity')
BEGIN
	ALTER TABLE [FixedAsset] ADD [Quantity] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='depcalcstartdate')
BEGIN
	ALTER TABLE [FixedAsset] ADD [depcalcstartdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='FAType')
BEGIN
	ALTER TABLE [FixedAsset] ADD [FAType] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='exrate')
BEGIN
	ALTER TABLE [FixedAsset] ADD [exrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='depexrate')
BEGIN
	ALTER TABLE [FixedAsset] ADD [depexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [FixedAsset] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='actrefamount')
BEGIN
	ALTER TABLE [FixedAsset] ADD [actrefamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='posted')
BEGIN
	ALTER TABLE [FixedAsset] ADD [posted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='financialid')
BEGIN
	ALTER TABLE [FixedAsset] ADD [financialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='FixedAssetNo')
BEGIN
	ALTER TABLE [FixedAsset] ADD [FixedAssetNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='depriciationexpaccid')
BEGIN
	ALTER TABLE [FixedAsset] ADD [depriciationexpaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [FixedAsset] ADD [Cancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='CurrentDepartmentId')
BEGIN
	ALTER TABLE [FixedAsset] ADD [CurrentDepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='lasttoaccid')
BEGIN
	ALTER TABLE [FixedAsset] ADD [lasttoaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='ExcludeFirstPeriodDep')
BEGIN
	ALTER TABLE [FixedAsset] ADD [ExcludeFirstPeriodDep] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='InsuranceRenewalDate')
BEGIN
	ALTER TABLE [FixedAsset] ADD [InsuranceRenewalDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='CurrDeprecExpAccID')
BEGIN
	ALTER TABLE [FixedAsset] ADD [CurrDeprecExpAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='CurrAccDepExpAccID')
BEGIN
	ALTER TABLE [FixedAsset] ADD [CurrAccDepExpAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [FixedAsset] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FlightOperatorMaster' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [FlightOperatorMaster] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FlightOperatorMaster' AND COLUMN_NAME='FlghtOpid')
BEGIN
	ALTER TABLE [FlightOperatorMaster] ADD [FlghtOpid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FlightOperatorMaster' AND COLUMN_NAME='FlghtOpName')
BEGIN
	ALTER TABLE [FlightOperatorMaster] ADD [FlghtOpName] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FlightOperatorMaster' AND COLUMN_NAME='FlghtSegID')
BEGIN
	ALTER TABLE [FlightOperatorMaster] ADD [FlghtSegID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FlightOperatorMaster' AND COLUMN_NAME='Createddate')
BEGIN
	ALTER TABLE [FlightOperatorMaster] ADD [Createddate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FlightOperatorMaster' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [FlightOperatorMaster] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FlightOperatorMaster' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [FlightOperatorMaster] ADD [Active] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Flights' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [Flights] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Flights' AND COLUMN_NAME='FlightID')
BEGIN
	ALTER TABLE [Flights] ADD [FlightID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Flights' AND COLUMN_NAME='FlightOpid')
BEGIN
	ALTER TABLE [Flights] ADD [FlightOpid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Flights' AND COLUMN_NAME='FlightNo')
BEGIN
	ALTER TABLE [Flights] ADD [FlightNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Flights' AND COLUMN_NAME='FlightDepDay')
BEGIN
	ALTER TABLE [Flights] ADD [FlightDepDay] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Flights' AND COLUMN_NAME='FlightDepTime')
BEGIN
	ALTER TABLE [Flights] ADD [FlightDepTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Flights' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [Flights] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Flights' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [Flights] ADD [Active] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [Forex] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='forexid')
BEGIN
	ALTER TABLE [Forex] ADD [forexid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='forexno')
BEGIN
	ALTER TABLE [Forex] ADD [forexno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='forexdate')
BEGIN
	ALTER TABLE [Forex] ADD [forexdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='type')
BEGIN
	ALTER TABLE [Forex] ADD [type] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='salesorpurchaseaccid')
BEGIN
	ALTER TABLE [Forex] ADD [salesorpurchaseaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='otheraccid')
BEGIN
	ALTER TABLE [Forex] ADD [otheraccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='forexgainlossaccid')
BEGIN
	ALTER TABLE [Forex] ADD [forexgainlossaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='salesorpurchaseamt')
BEGIN
	ALTER TABLE [Forex] ADD [salesorpurchaseamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='otheramount')
BEGIN
	ALTER TABLE [Forex] ADD [otheramount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='forexgainlossamt')
BEGIN
	ALTER TABLE [Forex] ADD [forexgainlossamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='chequeno')
BEGIN
	ALTER TABLE [Forex] ADD [chequeno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='paymentmode')
BEGIN
	ALTER TABLE [Forex] ADD [paymentmode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='customerid')
BEGIN
	ALTER TABLE [Forex] ADD [customerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='vendorid')
BEGIN
	ALTER TABLE [Forex] ADD [vendorid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='personname')
BEGIN
	ALTER TABLE [Forex] ADD [personname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='passportno')
BEGIN
	ALTER TABLE [Forex] ADD [passportno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='nationalityid')
BEGIN
	ALTER TABLE [Forex] ADD [nationalityid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='remarks')
BEGIN
	ALTER TABLE [Forex] ADD [remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='posted')
BEGIN
	ALTER TABLE [Forex] ADD [posted] bit CONSTRAINT [DF_Forex_posted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='cancelled')
BEGIN
	ALTER TABLE [Forex] ADD [cancelled] bit CONSTRAINT [DF_Forex_cancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='financialid')
BEGIN
	ALTER TABLE [Forex] ADD [financialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [Forex] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='cancelledremarks')
BEGIN
	ALTER TABLE [Forex] ADD [cancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='exchangerate')
BEGIN
	ALTER TABLE [Forex] ADD [exchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='depexrate')
BEGIN
	ALTER TABLE [Forex] ADD [depexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [Forex] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME='subdepartmentid')
BEGIN
	ALTER TABLE [Forex] ADD [subdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='Trloanid')
BEGIN
	ALTER TABLE [GovernLoan] ADD [Trloanid] [numeric] (18,0) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [GovernLoan] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [GovernLoan] ADD [departmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='TrNo')
BEGIN
	ALTER TABLE [GovernLoan] ADD [TrNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='Trdate')
BEGIN
	ALTER TABLE [GovernLoan] ADD [Trdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='LoanName')
BEGIN
	ALTER TABLE [GovernLoan] ADD [LoanName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='customerid')
BEGIN
	ALTER TABLE [GovernLoan] ADD [customerid] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='vendorid')
BEGIN
	ALTER TABLE [GovernLoan] ADD [vendorid] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='Bankid')
BEGIN
	ALTER TABLE [GovernLoan] ADD [Bankid] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='RangeFrom')
BEGIN
	ALTER TABLE [GovernLoan] ADD [RangeFrom] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='RangeTo')
BEGIN
	ALTER TABLE [GovernLoan] ADD [RangeTo] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='PeriodicCharge')
BEGIN
	ALTER TABLE [GovernLoan] ADD [PeriodicCharge] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='LoanAmount')
BEGIN
	ALTER TABLE [GovernLoan] ADD [LoanAmount] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='AlertDays')
BEGIN
	ALTER TABLE [GovernLoan] ADD [AlertDays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='NextPaymentDate')
BEGIN
	ALTER TABLE [GovernLoan] ADD [NextPaymentDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='TrRemarks')
BEGIN
	ALTER TABLE [GovernLoan] ADD [TrRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='TrCancelled')
BEGIN
	ALTER TABLE [GovernLoan] ADD [TrCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='TrCancelledRemarks')
BEGIN
	ALTER TABLE [GovernLoan] ADD [TrCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='trcusvendesc')
BEGIN
	ALTER TABLE [GovernLoan] ADD [trcusvendesc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='GovernLoan' AND COLUMN_NAME='subdepartmentid')
BEGIN
	ALTER TABLE [GovernLoan] ADD [subdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HPpostDatedCheqReg' AND COLUMN_NAME='RegID')
BEGIN
	ALTER TABLE [HPpostDatedCheqReg] ADD [RegID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HPpostDatedCheqReg' AND COLUMN_NAME='TranId')
BEGIN
	ALTER TABLE [HPpostDatedCheqReg] ADD [TranId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HPpostDatedCheqReg' AND COLUMN_NAME='Date')
BEGIN
	ALTER TABLE [HPpostDatedCheqReg] ADD [Date] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HPpostDatedCheqReg' AND COLUMN_NAME='BankId')
BEGIN
	ALTER TABLE [HPpostDatedCheqReg] ADD [BankId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HPpostDatedCheqReg' AND COLUMN_NAME='CheqDate')
BEGIN
	ALTER TABLE [HPpostDatedCheqReg] ADD [CheqDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HPpostDatedCheqReg' AND COLUMN_NAME='CheqNo')
BEGIN
	ALTER TABLE [HPpostDatedCheqReg] ADD [CheqNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqInhousePurchaseBillingDetails' AND COLUMN_NAME='ipbdBillId')
BEGIN
	ALTER TABLE [hqInhousePurchaseBillingDetails] ADD [ipbdBillId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqInhousePurchaseBillingDetails' AND COLUMN_NAME='ipbdBillDetailId')
BEGIN
	ALTER TABLE [hqInhousePurchaseBillingDetails] ADD [ipbdBillDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqInhousePurchaseBillingDetails' AND COLUMN_NAME='ipbdInhousePurchaseId')
BEGIN
	ALTER TABLE [hqInhousePurchaseBillingDetails] ADD [ipbdInhousePurchaseId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqInhousePurchaseBillingDetails' AND COLUMN_NAME='ipbdBilledAmount')
BEGIN
	ALTER TABLE [hqInhousePurchaseBillingDetails] ADD [ipbdBilledAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND COLUMN_NAME='scdCommisionID')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] ADD [scdCommisionID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND COLUMN_NAME='scdDetailID')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] ADD [scdDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND COLUMN_NAME='scdInterfaceID')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] ADD [scdInterfaceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND COLUMN_NAME='scdShopID')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] ADD [scdShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND COLUMN_NAME='scdtransactionID')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] ADD [scdtransactionID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND COLUMN_NAME='scdCommisionAmount')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] ADD [scdCommisionAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND COLUMN_NAME='scdcompanyid')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] ADD [scdcompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND COLUMN_NAME='scdEligiblePer')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] ADD [scdEligiblePer] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND COLUMN_NAME='scdCommissionPer')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] ADD [scdCommissionPer] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schCommisionid')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schCommisionid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schSalesCommisionNo')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schSalesCommisionNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schSalesCommisionDate')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schSalesCommisionDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schApprovedBy')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schApprovedBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schCancelled')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schCancelledRemarks')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schcompanyid')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schdepartmentid')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schsalespersonid')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schfinancialid')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schfinancialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schFromDate')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schFromDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schToDate')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schToDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schAfterSales')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schAfterSales] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schTargetAmount')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schTargetAmount] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schTargetType')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schTargetType] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME='schRemarks')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD [schRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdCompanyID')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdpromotionID')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdpromotionID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdDetailID')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdCustomerID')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdSalesAmt')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdSalesAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdSalesPer')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdSalesPer] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdProfitAmt')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdProfitAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdProfitPer')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdProfitPer] [numeric] (5,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdPromotionAmt')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdPromotionAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdToBePaid')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdToBePaid] bit CONSTRAINT [DF__HQSalesPr__spdTo__7B7C1933] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME='spdRemarks')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD [spdRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphCompanyID')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphPromotionID')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphPromotionID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphPromotionNo')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphPromotionNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphPromotionDate')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphPromotionDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphFromDate')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphFromDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphToDate')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphToDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphApprovedBy')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphApprovedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphDepartmentID')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphTotSalesAmt')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphTotSalesAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphTotprofitAmt')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphTotprofitAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphRemarks')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphCancelled')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND COLUMN_NAME='sphCancelledRemarks')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ADD [sphCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='StoreRequestId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [StoreRequestId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='Slno')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [Slno] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [Qty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='PackingTypeId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [PackingTypeId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='Pqty')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [Pqty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='FinancialYearId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [FinancialYearId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='ApprQty')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [ApprQty] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='ApprPackingTypeId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [ApprPackingTypeId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND COLUMN_NAME='ApprPqty')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ADD [ApprPqty] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='StoreRequestId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [StoreRequestId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='StoreRequestNo')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [StoreRequestNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='RequestDate')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [RequestDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='DepartmentId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [DepartmentId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [ShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='Deleted')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [Deleted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='DeletedReason')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [DeletedReason] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='FinancialYearId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [FinancialYearId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='AppovalStatus')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [AppovalStatus] [char] (2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='RejectionReason')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [RejectionReason] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [Remarks] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='ReqUserId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [ReqUserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='DelUserId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [DelUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND COLUMN_NAME='LastModUserId')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ADD [LastModUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND COLUMN_NAME='BillsID')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] ADD [BillsID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND COLUMN_NAME='BillsDetailID')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] ADD [BillsDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND COLUMN_NAME='DepartmentId')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] ADD [DepartmentId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='BillsID')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [BillsID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='BillsNo')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [BillsNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='BillDate')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [BillDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='BillAmount')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [BillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='ReferenceNo')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [ReferenceNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='DuePeriod')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [DuePeriod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='Discount')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [Discount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='DiscountAccountID')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [DiscountAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='CashPurchase')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [CashPurchase] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='BankCashAccID')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [BankCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='ChequeNo')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [ChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='ExchangeNature')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [ExchangeNature] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [Posted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [Cancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='exchangerate')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [exchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='vreferenceno')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [vreferenceno] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [updatetime] datetime CONSTRAINT [DF_InterDivisionBillsHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='depexrate')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [depexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='RefJournalID')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [RefJournalID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME='subdepartmentid')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD [subdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME='JournalTransID')
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD [JournalTransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME='JournalTransDetailID')
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD [JournalTransDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME='JournalTransCredit')
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD [JournalTransCredit] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME='depexrates')
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD [depexrates] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='JournalTransID')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [JournalTransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='JournalNo')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [JournalNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='JournalTransDate')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [JournalTransDate] smalldatetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [Remarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [Cancelled] bit CONSTRAINT [DF__InterDivi__Cance__012A0591] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [CancelledRemarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [Posted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='parentjournalid')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [parentjournalid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='childjournalid')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [childjournalid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [updatetime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='exchangerate')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [exchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [Type] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='Confirm')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [Confirm] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME='TypeSeriallNO')
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD [TypeSeriallNO] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='DocID')
BEGIN
	ALTER TABLE [IODocuments] ADD [DocID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='DepID')
BEGIN
	ALTER TABLE [IODocuments] ADD [DepID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='DocDate')
BEGIN
	ALTER TABLE [IODocuments] ADD [DocDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='DocNo')
BEGIN
	ALTER TABLE [IODocuments] ADD [DocNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='ReferenceNo')
BEGIN
	ALTER TABLE [IODocuments] ADD [ReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='External')
BEGIN
	ALTER TABLE [IODocuments] ADD [External] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='Sender')
BEGIN
	ALTER TABLE [IODocuments] ADD [Sender] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='AddressedTo')
BEGIN
	ALTER TABLE [IODocuments] ADD [AddressedTo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='AddressedDate')
BEGIN
	ALTER TABLE [IODocuments] ADD [AddressedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='Receiver')
BEGIN
	ALTER TABLE [IODocuments] ADD [Receiver] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [IODocuments] ADD [Description] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='Remark')
BEGIN
	ALTER TABLE [IODocuments] ADD [Remark] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='Physicalfilename')
BEGIN
	ALTER TABLE [IODocuments] ADD [Physicalfilename] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='Doctype')
BEGIN
	ALTER TABLE [IODocuments] ADD [Doctype] [char] (1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [IODocuments] ADD [Cancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [IODocuments] ADD [CancelledRemarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [IODocuments] ADD [Type] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='PhysicalDepid')
BEGIN
	ALTER TABLE [IODocuments] ADD [PhysicalDepid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='alertdate')
BEGIN
	ALTER TABLE [IODocuments] ADD [alertdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='alertnoofdays')
BEGIN
	ALTER TABLE [IODocuments] ADD [alertnoofdays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='alertremarks')
BEGIN
	ALTER TABLE [IODocuments] ADD [alertremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='DocTypeID')
BEGIN
	ALTER TABLE [IODocuments] ADD [DocTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='IODocuments' AND COLUMN_NAME='physicalloc')
BEGIN
	ALTER TABLE [IODocuments] ADD [physicalloc] [varchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='ItemPriceId')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [ItemPriceId] int IDENTITY(1,1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='PackId')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [PackId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [ShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='SegmentId')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [SegmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='CurrencyId')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [CurrencyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='SellingPrice')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [SellingPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='DiscountPrice')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [DiscountPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='WholesalePrice')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [WholesalePrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='CreditSP')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [CreditSP] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='CreditDP')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [CreditDP] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='CreditWP')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [CreditWP] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='FixDate')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [FixDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='UpdateTime')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [UpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [UserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [CompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_ItemPriceHistory_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='JournalID')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [JournalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='JournalDetailID')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [JournalDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='FinancialId')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [FinancialId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='JournalCredit')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [JournalCredit] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [AccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='ActualAmount')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [ActualAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalHeaderBackup' AND COLUMN_NAME='JournalID')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ADD [JournalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalHeaderBackup' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalHeaderBackup' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ADD [FinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalHeaderBackup' AND COLUMN_NAME='JournalDate')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ADD [JournalDate] smalldatetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalHeaderBackup' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalHeaderBackup' AND COLUMN_NAME='ReferenceNo')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ADD [ReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalHeaderBackup' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ADD [Type] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalHeaderBackup' AND COLUMN_NAME='CurrencyId')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ADD [CurrencyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalHeaderBackup' AND COLUMN_NAME='chequedate')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ADD [chequedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME='JournalTransID')
BEGIN
	ALTER TABLE [JournalTransDetails] ADD [JournalTransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME='JournalTransDetailID')
BEGIN
	ALTER TABLE [JournalTransDetails] ADD [JournalTransDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [JournalTransDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [JournalTransDetails] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME='JournalTransCredit')
BEGIN
	ALTER TABLE [JournalTransDetails] ADD [JournalTransCredit] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [JournalTransDetails] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [JournalTransDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME='PayrollLinktransId')
BEGIN
	ALTER TABLE [JournalTransDetails] ADD [PayrollLinktransId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='JournalTransID')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [JournalTransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='JournalNo')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [JournalNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='JournalTransDate')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [JournalTransDate] smalldatetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [Remarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [Cancelled] bit CONSTRAINT [DF_JournalTransHeader_Cancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [CancelledRemarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [Posted] bit CONSTRAINT [DF_JournalTransHeader_Posted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='parentjournalid')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [parentjournalid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='childjournalid')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [childjournalid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='receiptid')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [receiptid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='paymentid')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [paymentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [updatetime] datetime CONSTRAINT [DF_JournalTransHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='exchangerate')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [exchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='depexrates')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [depexrates] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='InvoiceID')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [InvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='BillID')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [BillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='subdepartmentid')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [subdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME='Confirmed')
BEGIN
	ALTER TABLE [JournalTransHeader] ADD [Confirmed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LeadTimeDivision' AND COLUMN_NAME='Ldivisionid')
BEGIN
	ALTER TABLE [LeadTimeDivision] ADD [Ldivisionid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LeadTimeDivision' AND COLUMN_NAME='LdivisionName')
BEGIN
	ALTER TABLE [LeadTimeDivision] ADD [LdivisionName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LeadTimeDivision' AND COLUMN_NAME='LDivisionCompanyid')
BEGIN
	ALTER TABLE [LeadTimeDivision] ADD [LDivisionCompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LeadTimeStage' AND COLUMN_NAME='Lstageid')
BEGIN
	ALTER TABLE [LeadTimeStage] ADD [Lstageid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LeadTimeStage' AND COLUMN_NAME='LstageName')
BEGIN
	ALTER TABLE [LeadTimeStage] ADD [LstageName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LeadTimeStage' AND COLUMN_NAME='Lstagedivisionid')
BEGIN
	ALTER TABLE [LeadTimeStage] ADD [Lstagedivisionid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LeadTimeStage' AND COLUMN_NAME='LStageCompanyid')
BEGIN
	ALTER TABLE [LeadTimeStage] ADD [LStageCompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSCardRegistration' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [LMSCardRegistration] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSCardRegistration' AND COLUMN_NAME='CardRegistrationID')
BEGIN
	ALTER TABLE [LMSCardRegistration] ADD [CardRegistrationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSCardRegistration' AND COLUMN_NAME='CardNumber')
BEGIN
	ALTER TABLE [LMSCardRegistration] ADD [CardNumber] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSCardRegistration' AND COLUMN_NAME='RegistrationDate')
BEGIN
	ALTER TABLE [LMSCardRegistration] ADD [RegistrationDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSCardRegistration' AND COLUMN_NAME='CustmerId')
BEGIN
	ALTER TABLE [LMSCardRegistration] ADD [CustmerId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSCardRegistration' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [LMSCardRegistration] ADD [UserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSCardRegistration' AND COLUMN_NAME='TypeID')
BEGIN
	ALTER TABLE [LMSCardRegistration] ADD [TypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSCardRegistration' AND COLUMN_NAME='ExpairyDate')
BEGIN
	ALTER TABLE [LMSCardRegistration] ADD [ExpairyDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lmsPoint' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [lmsPoint] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lmsPoint' AND COLUMN_NAME='PointsID')
BEGIN
	ALTER TABLE [lmsPoint] ADD [PointsID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lmsPoint' AND COLUMN_NAME='PointDesc')
BEGIN
	ALTER TABLE [lmsPoint] ADD [PointDesc] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lmsPoint' AND COLUMN_NAME='PointCategory')
BEGIN
	ALTER TABLE [lmsPoint] ADD [PointCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lmsPoint' AND COLUMN_NAME='MinimumPoints')
BEGIN
	ALTER TABLE [lmsPoint] ADD [MinimumPoints] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lmsPoint' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [lmsPoint] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lmsPoint' AND COLUMN_NAME='PointValue')
BEGIN
	ALTER TABLE [lmsPoint] ADD [PointValue] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lmsPoint' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [lmsPoint] ADD [UserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSReward' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [LMSReward] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSReward' AND COLUMN_NAME='RewardId')
BEGIN
	ALTER TABLE [LMSReward] ADD [RewardId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSReward' AND COLUMN_NAME='CardId')
BEGIN
	ALTER TABLE [LMSReward] ADD [CardId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSReward' AND COLUMN_NAME='Dr')
BEGIN
	ALTER TABLE [LMSReward] ADD [Dr] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSReward' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [LMSReward] ADD [Type] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSReward' AND COLUMN_NAME='Points')
BEGIN
	ALTER TABLE [LMSReward] ADD [Points] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSReward' AND COLUMN_NAME='PointDate')
BEGIN
	ALTER TABLE [LMSReward] ADD [PointDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LMSReward' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [LMSReward] ADD [Description] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadCostingID')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadCostingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadAccountID')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadDetailID')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadDescription')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadAmount')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadBankCashAccID')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadBankCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadChequeNo')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadChequeDate')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadChequeDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadCompanyID')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadDistribution')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadDistribution] [varchar] (4000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadOtherCharges')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadOtherCharges] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND COLUMN_NAME='cadCostingType')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ADD [cadCostingType] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdCostingID')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdCostingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdItemID')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdCostingValue')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdCostingValue] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdCostingPrice')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdCostingPrice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdItemQuantity')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdItemQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdBillUnitPrice')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdBillUnitPrice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdCustomsUnitPrice')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdCustomsUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdCustomDutyAmount')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdCustomDutyAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdOCPerItem')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdOCPerItem] [numeric] (28,22) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdOldItemCostPrice')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdOldItemCostPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdNewItemCostPrice')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdNewItemCostPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingDetail' AND COLUMN_NAME='cdcustcategoryperc')
BEGIN
	ALTER TABLE [LOaCostingDetail] ADD [cdcustcategoryperc] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chCostingID')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chCostingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chCostingNo')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chCostingNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chCostingDate')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chCostingDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chBillID')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chRemarks')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chCostingDone')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chCostingDone] bit CONSTRAINT [DF_LOaCostingHeader_chCostingDone] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chCostingDoneBy')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chCostingDoneBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chInventoryaccid')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chInventoryaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chGoodsinTransitaccid')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chGoodsinTransitaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chPosted')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chPosted] bit CONSTRAINT [DF_LOaCostingHeader_chPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chCancelled')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chCancelled] bit CONSTRAINT [DF_LOaCostingHeader_chCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chCancelledRemarks')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chRecAddUser')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chRecModifyUser')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chDepartmentID')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chCompanyID')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOaCostingHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chSubDepartmentID')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chSubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME='chtime')
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD [chtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessDetail' AND COLUMN_NAME='EoqDProcessid')
BEGIN
	ALTER TABLE [LoaEoqProcessDetail] ADD [EoqDProcessid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessDetail' AND COLUMN_NAME='EoqDItemCategoryId')
BEGIN
	ALTER TABLE [LoaEoqProcessDetail] ADD [EoqDItemCategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessDetail' AND COLUMN_NAME='EodItemId')
BEGIN
	ALTER TABLE [LoaEoqProcessDetail] ADD [EodItemId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessDetail' AND COLUMN_NAME='EoqdFixedCost')
BEGIN
	ALTER TABLE [LoaEoqProcessDetail] ADD [EoqdFixedCost] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessDetail' AND COLUMN_NAME='EoqdReorderQty')
BEGIN
	ALTER TABLE [LoaEoqProcessDetail] ADD [EoqdReorderQty] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqProcessid')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqProcessid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqProcessDate')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqProcessDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqProcessNo')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqProcessNo] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqProcessedBy')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqProcessedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqSalesFDate')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqSalesFDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqSalesTDate')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqSalesTDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqPurchaseFDate')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqPurchaseFDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqPurchaseTDate')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqPurchaseTDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqProcessRemarks')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqProcessRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqProcessDepartmentId')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqProcessDepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqProcessCompanyid')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqProcessCompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoaEoqProcessHeader' AND COLUMN_NAME='EoqCategoryid')
BEGIN
	ALTER TABLE [LoaEoqProcessHeader] ADD [EoqCategoryid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostDetail' AND COLUMN_NAME='dFixedCostId')
BEGIN
	ALTER TABLE [loaFixedCostDetail] ADD [dFixedCostId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostDetail' AND COLUMN_NAME='dFixedCostDetailId')
BEGIN
	ALTER TABLE [loaFixedCostDetail] ADD [dFixedCostDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostDetail' AND COLUMN_NAME='dFixedCostItemId')
BEGIN
	ALTER TABLE [loaFixedCostDetail] ADD [dFixedCostItemId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostDetail' AND COLUMN_NAME='dFixedCostCategoryId')
BEGIN
	ALTER TABLE [loaFixedCostDetail] ADD [dFixedCostCategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostDetail' AND COLUMN_NAME='dFixedCostValue')
BEGIN
	ALTER TABLE [loaFixedCostDetail] ADD [dFixedCostValue] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostDetail' AND COLUMN_NAME='dfixedcompanyid')
BEGIN
	ALTER TABLE [loaFixedCostDetail] ADD [dfixedcompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostId')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostNo')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostNo] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostDate')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostEnteredby')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostEnteredby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostRemarks')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostDepartmentid')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostDepartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostUpdate')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostUpdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='fixedcostCompanyid')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [fixedcostCompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostTime')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostCreated')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostCreated] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaFixedCostHeader' AND COLUMN_NAME='FixedCostModified')
BEGIN
	ALTER TABLE [loaFixedCostHeader] ADD [FixedCostModified] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseDetail' AND COLUMN_NAME='ipdid')
BEGIN
	ALTER TABLE [loaInhousePurchaseDetail] ADD [ipdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseDetail' AND COLUMN_NAME='ipddetailId')
BEGIN
	ALTER TABLE [loaInhousePurchaseDetail] ADD [ipddetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseDetail' AND COLUMN_NAME='ipdItemCode')
BEGIN
	ALTER TABLE [loaInhousePurchaseDetail] ADD [ipdItemCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseDetail' AND COLUMN_NAME='ipdItemDescription')
BEGIN
	ALTER TABLE [loaInhousePurchaseDetail] ADD [ipdItemDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseDetail' AND COLUMN_NAME='ipdQuantity')
BEGIN
	ALTER TABLE [loaInhousePurchaseDetail] ADD [ipdQuantity] [numeric] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseDetail' AND COLUMN_NAME='ipdRate')
BEGIN
	ALTER TABLE [loaInhousePurchaseDetail] ADD [ipdRate] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseDetail' AND COLUMN_NAME='ipdDiscountAmount')
BEGIN
	ALTER TABLE [loaInhousePurchaseDetail] ADD [ipdDiscountAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseDetail' AND COLUMN_NAME='ipdAmount')
BEGIN
	ALTER TABLE [loaInhousePurchaseDetail] ADD [ipdAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphCompanyId')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphDepartmentId')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphDepartmentId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphFinancialId')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphFinancialId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphForShopId')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphForShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphForGodownid')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphForGodownid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphId')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphNo')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphDate')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphVendorId')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphVendorId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphVendorName')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphVendorName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphVendorAddress')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphVendorAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphRemarks')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphCancelRemark')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphCancelRemark] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphUpdateTime')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphUserName')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphUpdatedUserName')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphUpdatedUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND COLUMN_NAME='iphCancel')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ADD [iphCancel] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND COLUMN_NAME='scfdid')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] ADD [scfdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND COLUMN_NAME='scfddetailid')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] ADD [scfddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND COLUMN_NAME='scfdItemid')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] ADD [scfdItemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND COLUMN_NAME='scfdQuantity')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] ADD [scfdQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND COLUMN_NAME='scfdCostprice')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] ADD [scfdCostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND COLUMN_NAME='scfdFixedPrice')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] ADD [scfdFixedPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND COLUMN_NAME='scfdOldItemRate')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] ADD [scfdOldItemRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhcompanyid')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhid')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhNo')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhDate')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhCostingId')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhCostingId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhGodownid')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhGodownid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhItemSplitId')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhItemSplitId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhShipmentid')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhShipmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhQuantity')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhCostedPrice')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhCostedPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhRemarks')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhCostFixed')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhCostFixed] bit CONSTRAINT [DF_loaItemsplitcostingHeader_scfhCostFixed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhCancelled')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhCancelled] bit CONSTRAINT [DF_loaItemsplitcostingHeader_scfhCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhCancelledRemarks')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhdepartmentid')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhCreated')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhCreated] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhModified')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhModified] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME='scfhTime')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD [scfhTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND COLUMN_NAME='lpcdcostingid')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] ADD [lpcdcostingid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND COLUMN_NAME='lpcddetailid')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] ADD [lpcddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND COLUMN_NAME='lpcditemid')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] ADD [lpcditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND COLUMN_NAME='lpcdcostedprice')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] ADD [lpcdcostedprice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND COLUMN_NAME='lpcditemqty')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] ADD [lpcditemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND COLUMN_NAME='lpcdbillunitprice')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] ADD [lpcdbillunitprice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND COLUMN_NAME='lpcdolditemcostprice')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] ADD [lpcdolditemcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND COLUMN_NAME='lpcdnewitemcostprice')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] ADD [lpcdnewitemcostprice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchCostingid')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchCostingid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchCostingNo')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchCostingNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchDate')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchBillid')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchBillid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchShopid')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchShopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchOtherCharges')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchOtherCharges] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchRemarks')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchCostingDone')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchCostingDone] bit CONSTRAINT [DF_loalocalpurchaseCostingheader_lpchCostingDone] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchCostingDoneBy')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchCostingDoneBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchInventoryaccid')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchInventoryaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchGoodsinTransitaccid')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchGoodsinTransitaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchDepartmentid')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchCompanyid')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchCompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchposted')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchposted] bit CONSTRAINT [DF_loalocalpurchaseCostingheader_lpchposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchCancelled')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchCancelled] bit CONSTRAINT [DF_loalocalpurchaseCostingheader_lpchCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchcancelledremarks')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchrecadduser')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchrecadduser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchrecmodifiyuser')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchrecmodifiyuser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchSubDepartmentID')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchSubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME='lpchTime')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD [lpchTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME='adArrivalID')
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD [adArrivalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME='adItemID')
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD [adItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME='adPackingTypeID')
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD [adPackingTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME='adDespatchedQty')
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD [adDespatchedQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME='adReceivedQty')
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD [adReceivedQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME='adCostPrice')
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD [adCostPrice] [numeric] (18,2) CONSTRAINT [DF_LOiArrivalDetail_adCostPrice] DEFAULT ((0)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME='adGodownID')
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD [adGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiArriva__rowgu__1DD065E0] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahArrivalID')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahArrivalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahArrivalNo')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahArrivalNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahArrivalDate')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahArrivalDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahDespatchNoteID')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahDespatchNoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahGodownID')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahGodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahShopID')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahShipmentID')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahShipmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahCancelled')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahCancelledRemarks')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahRemarks')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahRecaddUser')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahRecaddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahRecmodifyUser')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahRecmodifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahArrivalType')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahArrivalType] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahCostPriceFixed')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahCostPriceFixed] bit CONSTRAINT [DF_LOiArrivalHeader_ahCostPriceFixed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahLocalGodownID')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahLocalGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahTransFinished')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahTransFinished] bit CONSTRAINT [DF_LOiArrivalHeader_ahTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahfuturevc')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahfuturevc] [varchar] (250) CONSTRAINT [DF_LOiArrivalHeader_ahfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOiArrivalHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahposted')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahposted] bit CONSTRAINT [DF_LOiArrivalHeader_ahposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahdepartmentid')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiArriva__rowgu__02B25B50] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahconexrate')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahdepexrate')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahexchangerates')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME='ahcreatedtime')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD [ahcreatedtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='asdArrivalID')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [asdArrivalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='asdItemID')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [asdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='asdShipmentID')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [asdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='asdDespatchedGoodQty')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [asdDespatchedGoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='asdDespatchedBadQty')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [asdDespatchedBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='asdReceivedGoodQty')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [asdReceivedGoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='asdReceivedBadQty')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [asdReceivedBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='asdcostprice')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [asdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='asdGodownID')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [asdGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiArriva__rowgu__01342732] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND COLUMN_NAME='alArrivalID')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] ADD [alArrivalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND COLUMN_NAME='alLocationID')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] ADD [alLocationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND COLUMN_NAME='alItemID')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] ADD [alItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND COLUMN_NAME='alQty')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] ADD [alQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND COLUMN_NAME='alGodownID')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] ADD [alGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiArriva__rowgu__06ED0088] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND COLUMN_NAME='dcdClearingID')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ADD [dcdClearingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND COLUMN_NAME='dcdLocationID')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ADD [dcdLocationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND COLUMN_NAME='dcdShipmentID')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ADD [dcdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND COLUMN_NAME='dcdItemID')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ADD [dcdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND COLUMN_NAME='dcdAvailableQty')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ADD [dcdAvailableQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND COLUMN_NAME='dcdWriteOffQty')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ADD [dcdWriteOffQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND COLUMN_NAME='dcdGodownid')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ADD [dcdGodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiDamage__rowgu__7740A8A4] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchClearingID')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchClearingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchGodownid')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchGodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchClearingNO')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchClearingNO] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchClearingDate')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchClearingDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchClearingDoneBY')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchClearingDoneBY] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchRemarks')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchCancelled')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchCancelledRemarks')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchRecAddUser')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchRecModifyUser')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchfuturevc')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchfuturevc] [varchar] (250) CONSTRAINT [DF_LOiDamageClearingHeader_dchfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOiDamageClearingHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiDamage__rowgu__086B34A6] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchconexrate')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchdepexrate')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchexchangerates')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME='dchcreatetime')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD [dchcreatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eadinterfaceid')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eadinterfaceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eadgodownid')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eadgodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eadtransactionid')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eadtransactionid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eaddetailid')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eaddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eadexpirydate')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eadexpirydate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eaditemid')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eaditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eaditemqty')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eaditemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eadpackingtypeid')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eadpackingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eadpackingqty')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eadpackingqty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eadcancel')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eadcancel] bit CONSTRAINT [DF_loiexpiryarrivaldetails_eadcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eadAdjustment')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eadAdjustment] bit CONSTRAINT [DF_loiexpiryarrivaldetails_eadAdjustment] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME='eadbatchno')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD [eadbatchno] [varchar] (20) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eidinterfaceid')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eidinterfaceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eidgodownid')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eidgodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eidtransactionid')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eidtransactionid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eiddetailid')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eiddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eidexpirydate')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eidexpirydate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eiditemid')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eiditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eiditemqty')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eiditemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eidpackingtypeid')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eidpackingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eidpackingqty')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eidpackingqty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eidcancel')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eidcancel] bit CONSTRAINT [DF_loiexpiryissuedetails_eidcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eidAdjustment')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eidAdjustment] bit CONSTRAINT [DF_loiexpiryissuedetails_eidAdjustment] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME='eidbatchno')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD [eidbatchno] [varchar] (20) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdId')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdShipmentId')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdShipmentId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdItemId')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdGodownId')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdGodownId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdAvailStock')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdAvailStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdVerifiedStock')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdVerifiedStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdCostPrice')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdCostPrice] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdPrevExpiryDate')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdPrevExpiryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdVerifiedExpiryDate')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdVerifiedExpiryDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdPrevBatchNo')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdPrevBatchNo] [varchar] (20) CONSTRAINT [DF__loiExpiry__evdPr__033D368C] DEFAULT ('OLDBATCH') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME='evdBatchNo')
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD [evdBatchNo] [varchar] (20) CONSTRAINT [DF__loiExpiry__evdBa__04315AC5] DEFAULT ('OLDBATCH') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhId')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhGodownId')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhGodownId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhNo')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhDate')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhRemarks')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhCancelled')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhVerifiedBy')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhVerifiedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhCancelRemarks')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhCancelRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhFutureVc')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhFutureVc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhPosted')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhPosted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='UpdateTime')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [UpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhDepartmentId')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhDepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhConExRate')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhConExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhDepExRate')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhDepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhExchangeRates')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhcreatedtime')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhcreatedtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationHeader' AND COLUMN_NAME='evhmodifieduser')
BEGIN
	ALTER TABLE [loiExpiryVerificationHeader] ADD [evhmodifieduser] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND COLUMN_NAME='gsalArrivalID')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD [gsalArrivalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND COLUMN_NAME='gsalShipmentID')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD [gsalShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND COLUMN_NAME='gsalItemID')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD [gsalItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND COLUMN_NAME='gsalLocationID')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD [gsalLocationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND COLUMN_NAME='gsalGoodQty')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD [gsalGoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND COLUMN_NAME='gsalBadQty')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD [gsalBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND COLUMN_NAME='gsalGodownID')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD [gsalGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiGodown__rowgu__7B7B4DDC] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND COLUMN_NAME='SummaryDate')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ADD [SummaryDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND COLUMN_NAME='GodownId')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ADD [GodownId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND COLUMN_NAME='Stock')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ADD [Stock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND COLUMN_NAME='BadStock')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ADD [BadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND COLUMN_NAME='OpeningStock')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ADD [OpeningStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND COLUMN_NAME='OpeningBadStock')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ADD [OpeningBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND COLUMN_NAME='ShipmentId')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ADD [ShipmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND COLUMN_NAME='ItemCostPrice')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ADD [ItemCostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitDetail' AND COLUMN_NAME='isdgodownid')
BEGIN
	ALTER TABLE [LoiItemSplitDetail] ADD [isdgodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitDetail' AND COLUMN_NAME='isdid')
BEGIN
	ALTER TABLE [LoiItemSplitDetail] ADD [isdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitDetail' AND COLUMN_NAME='isditemid')
BEGIN
	ALTER TABLE [LoiItemSplitDetail] ADD [isditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitDetail' AND COLUMN_NAME='isdqty')
BEGIN
	ALTER TABLE [LoiItemSplitDetail] ADD [isdqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LoiItemSplitDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LoiItemSp__rowgu__7484378A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishgodownid')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishgodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishid')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishno')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishdate')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishremarks')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishSplititemid')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishSplititemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishsplititemqty')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishsplititemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishshipmentid')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishshipmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishactualqty')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishactualqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishCostPriceFixed')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishCostPriceFixed] bit CONSTRAINT [DF_LoiItemSplitHeader_ishCostPriceFixed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishcancelled')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishcancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishcancelledremarks')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishRecAddUser')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishRecModifyUser')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishExpiryDate')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishExpiryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishfuturevc')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishfuturevc] [varchar] (250) CONSTRAINT [DF_LoiItemSplitHeader_ishfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [updatetime] datetime CONSTRAINT [DF_LoiItemSplitHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishArrivalID')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishArrivalID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LoiItemSp__rowgu__17CD73C7] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishconexrate')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishdepexrate')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME='ishexchangerates')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD [ishexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiLocation' AND COLUMN_NAME='lGodownID')
BEGIN
	ALTER TABLE [LOiLocation] ADD [lGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiLocation' AND COLUMN_NAME='lLocationID')
BEGIN
	ALTER TABLE [LOiLocation] ADD [lLocationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiLocation' AND COLUMN_NAME='lLocationCode')
BEGIN
	ALTER TABLE [LOiLocation] ADD [lLocationCode] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiLocation' AND COLUMN_NAME='lLocationName')
BEGIN
	ALTER TABLE [LOiLocation] ADD [lLocationName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiLocation' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiLocation] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiLocati__rowgu__0E240DFC] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiLocation' AND COLUMN_NAME='lgroupid')
BEGIN
	ALTER TABLE [LOiLocation] ADD [lgroupid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiLocation' AND COLUMN_NAME='lcompanyid')
BEGIN
	ALTER TABLE [LOiLocation] ADD [lcompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='ladinterfaceid')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [ladinterfaceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='ladgodownid')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [ladgodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='ladtransid')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [ladtransid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='laddetailid')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [laddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='ladlocationid')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [ladlocationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='laditemid')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [laditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='laditemqty')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [laditemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='ladpackingtypeid')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [ladpackingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='ladpakingqty')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [ladpakingqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='ladcancel')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [ladcancel] bit CONSTRAINT [DF_loilocationarrivaldetails_ladcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='ladadjustment')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [ladadjustment] bit CONSTRAINT [DF_loilocationarrivaldetails_ladadjustment] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME='ladconfirmed')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD [ladconfirmed] int CONSTRAINT [DF__loilocati__ladco__76184598] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoilocationGroup' AND COLUMN_NAME='Lgcompanyid')
BEGIN
	ALTER TABLE [LoilocationGroup] ADD [Lgcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoilocationGroup' AND COLUMN_NAME='Lggroupid')
BEGIN
	ALTER TABLE [LoilocationGroup] ADD [Lggroupid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoilocationGroup' AND COLUMN_NAME='Lggodownid')
BEGIN
	ALTER TABLE [LoilocationGroup] ADD [Lggodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoilocationGroup' AND COLUMN_NAME='LgGroupName')
BEGIN
	ALTER TABLE [LoilocationGroup] ADD [LgGroupName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='lidinterfaceid')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [lidinterfaceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='lidgodownid')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [lidgodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='lidtransactionid')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [lidtransactionid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='liddetailid')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [liddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='lidlocationid')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [lidlocationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='liditemid')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [liditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='liditemqty')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [liditemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='lidpackingtypeid')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [lidpackingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='lidpakingqty')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [lidpakingqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='lidcancel')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [lidcancel] bit CONSTRAINT [DF_loilocationissuedetails_lidcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='lidadjustment')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [lidadjustment] bit CONSTRAINT [DF_loilocationissuedetails_lidadjustment] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME='lidconfirmed')
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD [lidconfirmed] int CONSTRAINT [DF__loilocati__lidco__770C69D1] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationDetail' AND COLUMN_NAME='lvdId')
BEGIN
	ALTER TABLE [loiLocationVerificationDetail] ADD [lvdId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationDetail' AND COLUMN_NAME='lvdShipmentId')
BEGIN
	ALTER TABLE [loiLocationVerificationDetail] ADD [lvdShipmentId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationDetail' AND COLUMN_NAME='lvdItemId')
BEGIN
	ALTER TABLE [loiLocationVerificationDetail] ADD [lvdItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationDetail' AND COLUMN_NAME='lvdGodownId')
BEGIN
	ALTER TABLE [loiLocationVerificationDetail] ADD [lvdGodownId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationDetail' AND COLUMN_NAME='lvdAvailStock')
BEGIN
	ALTER TABLE [loiLocationVerificationDetail] ADD [lvdAvailStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationDetail' AND COLUMN_NAME='lvdVerifiedStock')
BEGIN
	ALTER TABLE [loiLocationVerificationDetail] ADD [lvdVerifiedStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationDetail' AND COLUMN_NAME='lvdCostPrice')
BEGIN
	ALTER TABLE [loiLocationVerificationDetail] ADD [lvdCostPrice] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationDetail' AND COLUMN_NAME='lvdPrevLocationId')
BEGIN
	ALTER TABLE [loiLocationVerificationDetail] ADD [lvdPrevLocationId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationDetail' AND COLUMN_NAME='lvdVerifiedLocationId')
BEGIN
	ALTER TABLE [loiLocationVerificationDetail] ADD [lvdVerifiedLocationId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhId')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhGodownId')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhGodownId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhNo')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhDate')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhRemarks')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhVerifiedBy')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhVerifiedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhCancelled')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhCancelRemarks')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhCancelRemarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhFutureVc')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhFutureVc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhPosted')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='UpdateTime')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [UpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhDepartmentId')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhDepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhConExRate')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhConExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhDepExRate')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhDepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiLocationVerificationHeader' AND COLUMN_NAME='lvhExchangeRates')
BEGIN
	ALTER TABLE [loiLocationVerificationHeader] ADD [lvhExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeDetails' AND COLUMN_NAME='lgdID')
BEGIN
	ALTER TABLE [LoiMergeDetails] ADD [lgdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeDetails' AND COLUMN_NAME='lgdCompanyID')
BEGIN
	ALTER TABLE [LoiMergeDetails] ADD [lgdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeDetails' AND COLUMN_NAME='lgdGodownID')
BEGIN
	ALTER TABLE [LoiMergeDetails] ADD [lgdGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeDetails' AND COLUMN_NAME='lgdItemID')
BEGIN
	ALTER TABLE [LoiMergeDetails] ADD [lgdItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeDetails' AND COLUMN_NAME='lgsdQty')
BEGIN
	ALTER TABLE [LoiMergeDetails] ADD [lgsdQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeDetails' AND COLUMN_NAME='lgdDetailID')
BEGIN
	ALTER TABLE [LoiMergeDetails] ADD [lgdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LoiMergeDetails] ADD [rowguid] uniqueidentifier ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghID')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghCompanyID')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghGodownID')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghNo')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghDate')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghRefMergeID')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghRefMergeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghItemID')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghTransFinished')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghTransFinished] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghCancelled')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghUpdatetime')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghUpdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghQty')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='lghNoofRec')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [lghNoofRec] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiMergeHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LoiMergeHeader] ADD [rowguid] uniqueidentifier ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadInterfaceID')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadInterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadGodownID')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadTransactionID')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadTransactionID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadDetailID')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadSerialNo')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadSerialNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadItemID')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadItemQty')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadItemQty] [numeric] (10,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadPackingQty')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadPackingQty] [numeric] (10,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadCancel')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadAdjustment')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadAdjustment] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadFreeQty')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadFreeQty] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadSavedByShopId')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadSavedByShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME='sadPackingTypeID')
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD [sadPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidInterfaceID')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidInterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidGodownID')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidTransactionID')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidTransactionID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidDetailID')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidSerialNo')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidSerialNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidItemID')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidItemQty')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidItemQty] [numeric] (10,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidPackingQty')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidPackingQty] [numeric] (10,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidCancel')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidAdjustment')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidAdjustment] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidPackingTypeID')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidFreeQty')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidFreeQty] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME='sidSavedByShopId')
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD [sidSavedByShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdGodownID')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdGodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdID')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdShipMentID')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdShipMentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdItemID')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdAvlStock')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdAvlStock] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdVerifiedStock')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdVerifiedStock] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdCostPrice')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdCostPrice] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdPreSerialNo')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdPreSerialNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdNewSerialNo')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdNewSerialNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationDetail' AND COLUMN_NAME='svdDeleted')
BEGIN
	ALTER TABLE [loiSerialNoVerificationDetail] ADD [svdDeleted] [varchar] (4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhCompanyID')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhGodownID')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhID')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhNo')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhDate')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhVerifiedBy')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhVerifiedBy] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhRemarks')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhRemarks] [nvarchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhCancel')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhCancellRemarks')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhCancellRemarks] [nvarchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhFutureVC')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhFutureVC] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhUser')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhUpdateUser')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhUpdateUser] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND COLUMN_NAME='svhUpdateTime')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ADD [svhUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiSettings' AND COLUMN_NAME='Godownid')
BEGIN
	ALTER TABLE [LOiSettings] ADD [Godownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiSettings' AND COLUMN_NAME='sNoBackDays')
BEGIN
	ALTER TABLE [LOiSettings] ADD [sNoBackDays] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiSettings' AND COLUMN_NAME='OpeningStockDate')
BEGIN
	ALTER TABLE [LOiSettings] ADD [OpeningStockDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiSettings' AND COLUMN_NAME='barcodetype')
BEGIN
	ALTER TABLE [LOiSettings] ADD [barcodetype] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiSettings' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiSettings] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiSettin__rowgu__453F38BC] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiSettings' AND COLUMN_NAME='defaultfetch')
BEGIN
	ALTER TABLE [LOiSettings] ADD [defaultfetch] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiSettings' AND COLUMN_NAME='reportsetting')
BEGIN
	ALTER TABLE [LOiSettings] ADD [reportsetting] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srID')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srGodownID')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srDate')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srItemID')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srcostprice')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srAddStock')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srAddStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srDedStock')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srDedStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srUserName')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srposted')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srposted] bit CONSTRAINT [DF_loiStockRecovery_srposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srfutureint')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [updatetime] datetime CONSTRAINT [DF_loiStockRecovery_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srtransno')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srtransno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srlocid')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srlocid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__loiStockR__rowgu__2BD46C74] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srConExRate')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srConExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srDepExRate')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srDepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srExchangeRates')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME='srTransDate')
BEGIN
	ALTER TABLE [loiStockRecovery] ADD [srTransDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdid')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdGodownID')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdLocationid')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdLocationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdShipmentID')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdItemID')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdAvailStock')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdAvailStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdVerifiedStock')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdVerifiedStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdAvailBadStock')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdAvailBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdVerifiedBadStock')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdVerifiedBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='svdcostprice')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [svdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__loiStockV__rowgu__75235608] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhid')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhGodownid')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhGodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhNo')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhDate')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhVerificationby')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhVerificationby] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhCancelled')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhCancelled] bit CONSTRAINT [DF_loiStockVerificationHeader_svhCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhCancelledRemarks')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhCancelledRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhRecAddUser')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhRecModUser')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhRecModUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhRemarks')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhfuturevc')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhfuturevc] [varchar] (250) CONSTRAINT [DF_loiStockVerificationHeader_svhfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhposted')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhposted] bit CONSTRAINT [DF_loiStockVerificationHeader_svhposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [updatetime] datetime CONSTRAINT [DF_loiStockVerificationHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhdepartmentid')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__loiStockV__rowgu__246854D6] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhdepexrate')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhconexrate')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhexchangerates')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME='svhcreatedtime')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD [svhcreatedtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditDetail' AND COLUMN_NAME='gdCompanyId')
BEGIN
	ALTER TABLE [loiUserAuditDetail] ADD [gdCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditDetail' AND COLUMN_NAME='gdAuditId')
BEGIN
	ALTER TABLE [loiUserAuditDetail] ADD [gdAuditId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditDetail' AND COLUMN_NAME='gdGodownId')
BEGIN
	ALTER TABLE [loiUserAuditDetail] ADD [gdGodownId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditDetail' AND COLUMN_NAME='gdDetailId')
BEGIN
	ALTER TABLE [loiUserAuditDetail] ADD [gdDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditDetail' AND COLUMN_NAME='gdAuditControlName')
BEGIN
	ALTER TABLE [loiUserAuditDetail] ADD [gdAuditControlName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditDetail' AND COLUMN_NAME='gdAuditControlType')
BEGIN
	ALTER TABLE [loiUserAuditDetail] ADD [gdAuditControlType] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditDetail' AND COLUMN_NAME='gdOldValue')
BEGIN
	ALTER TABLE [loiUserAuditDetail] ADD [gdOldValue] [varchar] (4000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditDetail' AND COLUMN_NAME='gdNewValue')
BEGIN
	ALTER TABLE [loiUserAuditDetail] ADD [gdNewValue] [varchar] (4000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghCompanyId')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghAuditId')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghAuditId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghGodownId')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghGodownId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghInterfaceId')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghInterfaceId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghTransId')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghTransId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghTransNo')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghTransNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghUserFullName')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghUserFullName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghLoggedDateTime')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghLoggedDateTime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghExitedDateTime')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghExitedDateTime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghMode')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghMode] [char] (1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghSaved')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghSaved] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghMachineName')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghMachineName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiUserAuditHeader' AND COLUMN_NAME='ghWindowsUserName')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ADD [ghWindowsUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME='wdID')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD [wdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME='wdGodownID')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD [wdGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME='wdLocationID')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD [wdLocationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME='wdShipmentID')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD [wdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME='wdItemID')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD [wdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME='wdAvailableQty')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD [wdAvailableQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME='wdWriteoffQty')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD [wdWriteoffQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME='wdcostprice')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD [wdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiWriteO__rowgu__5AA469F6] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whGodownID')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whID')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whNo')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whDate')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whUserName')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whUserName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whCancelled')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whCancelledRemarks')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whRemarks')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whRemarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whRecaddUser')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whRecaddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whRecmodifyUser')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whRecmodifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whposted')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whposted] bit CONSTRAINT [DF_LOiWriteOffHeader_whposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whfuturevc')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whfuturevc] [varchar] (250) CONSTRAINT [DF_LOiWriteOffHeader_whfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOiWriteOffHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whdepartmentid')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whSelected')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whSelected] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whtransfinished')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whtransfinished] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whNoofDetails')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whNoofDetails] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whtype')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whtype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whconexrate')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whdepexrate')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whexchangerates')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOiWriteO__rowgu__4AF81212] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whTime')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME='whcreatedtime')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD [whcreatedtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopackagetype' AND COLUMN_NAME='loctype')
BEGIN
	ALTER TABLE [lopackagetype] ADD [loctype] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopackagetype' AND COLUMN_NAME='locid')
BEGIN
	ALTER TABLE [lopackagetype] ADD [locid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podPoid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podPoid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='poditemid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [poditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podDetailID')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podpackingtypeID')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podpackingtypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podQty')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podUnitPrice')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='poddescription')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [poddescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podstatus')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podstatus] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podstatusinfo')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podstatusinfo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podlastbillrate')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podlastbillrate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podcostingvalue')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podcostingvalue] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podcostingprice')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podcostingprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podbillunitprice')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podbillunitprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podcustomdutyamount')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podcustomdutyamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podocperitem')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podocperitem] [numeric] (28,22) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__loPrePurchas__rowgu__18F6A22A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='poddiscount')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [poddiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='poddiscountprice')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [poddiscountprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podsellingprice')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podsellingprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podRoyalty')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podRoyalty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podLstCustRate')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podLstCustRate] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podItemTaxPercentage')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podtemTaxAmount')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podtemTaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME='podItemTaxCategory')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD [podItemTaxCategory] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohPoid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohPoid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohpono')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohpono] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohnoSupwise')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohnoSupwise] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohPodate')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohPodate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohVendorID')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohSupAddr')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohSupAddr] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohdueDate')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohdueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohdeliveryaddr')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohdeliveryaddr] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohRefNo')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohRefNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohcancel')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohcancel] bit CONSTRAINT [DF_loPrePurchaseOrderHeader_pohcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohcancelremarks')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohcancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohPosted')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohPosted] bit CONSTRAINT [DF_loPrePurchaseOrderHeader_pohPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohrecadduser')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohrecadduser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohrecmoduser')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohrecmoduser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohbillgenerated')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohbillgenerated] bit CONSTRAINT [DF_loPrePurchaseOrderHeader_pohbillgenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohremarks')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohtype')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohtype] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohValue')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pogenerated')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pogenerated] bit CONSTRAINT [DF_loPrePurchaseOrderHeader_pogenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohpogenerated')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohpogenerated] bit CONSTRAINT [DF_loPrePurchaseOrderHeader_pohpogenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohQuotationid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohQuotationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohUsedinPayments')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohUsedinPayments] bit CONSTRAINT [DF_loPrePurchaseOrderHeader_pohUsedinPayments] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohLCopened')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohLCopened] bit CONSTRAINT [DF_loPrePurchaseOrderHeader_pohLCopened] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohDepartmentid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohLCAccountid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohLCAccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohPurchaseAccountid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohPurchaseAccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohLCdueon')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohLCdueon] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohLCAmount')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohLCAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohLCNumber')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohLCNumber] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohLCRemarks')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohLCRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohcompanyid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohcompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohLcMarginOpened')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohLcMarginOpened] bit CONSTRAINT [DF_loPrePurchaseOrderHeader_pohLcMarginOpened] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohCostingDone')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohCostingDone] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohDeliveryTerms')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohDeliveryTerms] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohppconfirmed')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohppconfirmed] bit CONSTRAINT [DF_loPrePurchaseOrderHeader_pohquotconfirmed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohpoonhold')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohpoonhold] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohfuturevc')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohfuturevc] [varchar] (250) CONSTRAINT [DF_loPrePurchaseOrderHeader_pohfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohshipmentmode')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohshipmentmode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohpaymentmode')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohpaymentmode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohpurpose')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohpurpose] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohshopid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohshopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohrequestid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohrequestid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [updatetime] datetime CONSTRAINT [DF_loPrePurchaseOrderHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohbofladno')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohbofladno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='Pohbofladdate')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [Pohbofladdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='Pohbofladdetails')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [Pohbofladdetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohexchangerates')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohcmpexrate')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohcmpexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohdepexrate')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohfinancialid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohfinancialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohProjectStartDate')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohProjectStartDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohProjectEndDate')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohProjectEndDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohProjectOtherInfo')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohProjectOtherInfo] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohCustomDutyByCustomer')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohCustomDutyByCustomer] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohTransportation')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohTransportation] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohPotime')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohPotime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohSubDepartmentID')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohSubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='PohAuthorized')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [PohAuthorized] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohVerified')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohVerified] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohSingleItemCatChecked')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohSingleItemCatChecked] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohSingleItemCatId')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohSingleItemCatId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME='pohuserid')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD [pohuserid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poadPOID')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poadPOID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poadAccountID')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poadAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poadDetailID')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poadDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poadDescription')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poadDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poadAmount')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poadAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poadCompanyID')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poadCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poadDistribution')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poadDistribution] [varchar] (1500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poadOtherCharges')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poadOtherCharges] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poadCostingType')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poadCostingType] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND COLUMN_NAME='poaddToLandPrice')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ADD [poaddToLandPrice] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podPoid')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podPoid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='poditemid')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [poditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podDetailID')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podpackingtypeID')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podpackingtypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podQty')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podUnitPrice')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podUnitPrice] [numeric] (25,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='poddescription')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [poddescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podstatus')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podstatus] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podstatusinfo')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podstatusinfo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podlastbillrate')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podlastbillrate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podcostingvalue')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podcostingvalue] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podcostingprice')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podcostingprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podbillunitprice')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podbillunitprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podcustomdutyamount')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podcustomdutyamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podocperitem')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podocperitem] [numeric] (28,22) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__loPurchas__rowgu__18F6A22A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='poddiscount')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [poddiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='poddiscountprice')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [poddiscountprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podsellingprice')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podsellingprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podRoyalty')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podRoyalty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podLstCustRate')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podLstCustRate] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podItemTaxPercentage')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podItemTaxAmount')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podItemTaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME='podItemTaxCategory')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD [podItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohPoid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohPoid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohpono')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohpono] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohnoSupwise')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohnoSupwise] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohPodate')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohPodate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohVendorID')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohSupAddr')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohSupAddr] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohdueDate')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohdueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohdeliveryaddr')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohdeliveryaddr] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohRefNo')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohRefNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohcancel')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohcancel] bit CONSTRAINT [DF_loPurchaseOrderHeader_pohcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohcancelremarks')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohcancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohPosted')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohPosted] bit CONSTRAINT [DF_loPurchaseOrderHeader_pohPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohrecadduser')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohrecadduser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohrecmoduser')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohrecmoduser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohbillgenerated')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohbillgenerated] bit CONSTRAINT [DF_loPurchaseOrderHeader_pohbillgenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohremarks')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohtype')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohtype] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohValue')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohValue] [numeric] (28,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pogenerated')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pogenerated] bit CONSTRAINT [DF_loPurchaseOrderHeader_pogenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohpogenerated')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohpogenerated] bit CONSTRAINT [DF_loPurchaseOrderHeader_pohpogenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohQuotationid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohQuotationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohUsedinPayments')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohUsedinPayments] bit CONSTRAINT [DF_loPurchaseOrderHeader_pohUsedinPayments] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohLCopened')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohLCopened] bit CONSTRAINT [DF_loPurchaseOrderHeader_pohLCopened] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohDepartmentid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohLCAccountid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohLCAccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohPurchaseAccountid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohPurchaseAccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohLCdueon')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohLCdueon] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohLCAmount')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohLCAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohLCNumber')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohLCNumber] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohLCRemarks')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohLCRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohcompanyid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohcompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohLcMarginOpened')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohLcMarginOpened] bit CONSTRAINT [DF_loPurchaseOrderHeader_pohLcMarginOpened] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohCostingDone')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohCostingDone] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohDeliveryTerms')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohDeliveryTerms] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohquotconfirmed')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohquotconfirmed] bit CONSTRAINT [DF_loPurchaseOrderHeader_pohquotconfirmed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohpoonhold')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohpoonhold] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohfuturevc')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohfuturevc] [varchar] (250) CONSTRAINT [DF_loPurchaseOrderHeader_pohfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohshipmentmode')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohshipmentmode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohpaymentmode')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohpaymentmode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohpurpose')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohpurpose] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohshopid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohshopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohrequestid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohrequestid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [updatetime] datetime CONSTRAINT [DF_loPurchaseOrderHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohbofladno')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohbofladno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='Pohbofladdate')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [Pohbofladdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='Pohbofladdetails')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [Pohbofladdetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohexchangerates')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohcmpexrate')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohcmpexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohdepexrate')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohfinancialid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohfinancialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohProjectStartDate')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohProjectStartDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohProjectEndDate')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohProjectEndDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohProjectOtherInfo')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohProjectOtherInfo] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohCustomDutyByCustomer')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohCustomDutyByCustomer] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohTransportation')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohTransportation] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohPotime')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohPotime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohSubDepartmentID')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohSubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='PohAuthorized')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [PohAuthorized] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohVerified')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohVerified] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohprepurchaseid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohprepurchaseid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohApproved')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohApproved] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohPriorityid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohPriorityid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohPurRequestedBy')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohPurRequestedBy] [varchar] (30) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohReqApprovedBy')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohReqApprovedBy] [varchar] (30) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohTypeid')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohTypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohPurRequestClosed')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohPurRequestClosed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohRequestDepartment')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohRequestDepartment] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohSingleItemCatChecked')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohSingleItemCatChecked] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohSingleItemCatId')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohSingleItemCatId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME='pohUserID')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD [pohUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='podID')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [podID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [VendorID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='PoDetailID')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [PoDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='VendorItemDesc')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [VendorItemDesc] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='VendorPackingType')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [VendorPackingType] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='VendorQty')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [VendorQty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='VendorUnitPrice')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [VendorUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='VendorAmount')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [VendorAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='CustomItemDesc')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [CustomItemDesc] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='CustomPackingType')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [CustomPackingType] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='CustomQty')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [CustomQty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='CustomUnitPrice')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [CustomUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND COLUMN_NAME='CustomAmount')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD [CustomAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderOC' AND COLUMN_NAME='podOthPoId')
BEGIN
	ALTER TABLE [loPurchaseOrderOC] ADD [podOthPoId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderOC' AND COLUMN_NAME='podOthDetailId')
BEGIN
	ALTER TABLE [loPurchaseOrderOC] ADD [podOthDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderOC' AND COLUMN_NAME='podOthDesc')
BEGIN
	ALTER TABLE [loPurchaseOrderOC] ADD [podOthDesc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderOC' AND COLUMN_NAME='podOthAmount')
BEGIN
	ALTER TABLE [loPurchaseOrderOC] ADD [podOthAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderOthCharge' AND COLUMN_NAME='POorderID')
BEGIN
	ALTER TABLE [loPurchaseOrderOthCharge] ADD [POorderID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderOthCharge' AND COLUMN_NAME='POOCdetailID')
BEGIN
	ALTER TABLE [loPurchaseOrderOthCharge] ADD [POOCdetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderOthCharge' AND COLUMN_NAME='POAccID')
BEGIN
	ALTER TABLE [loPurchaseOrderOthCharge] ADD [POAccID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderOthCharge' AND COLUMN_NAME='PODescription')
BEGIN
	ALTER TABLE [loPurchaseOrderOthCharge] ADD [PODescription] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderOthCharge' AND COLUMN_NAME='POAmount')
BEGIN
	ALTER TABLE [loPurchaseOrderOthCharge] ADD [POAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderQuatationDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [loPurchaseOrderQuatationDetails] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderQuatationDetails' AND COLUMN_NAME='DeptID')
BEGIN
	ALTER TABLE [loPurchaseOrderQuatationDetails] ADD [DeptID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderQuatationDetails' AND COLUMN_NAME='pohPOID')
BEGIN
	ALTER TABLE [loPurchaseOrderQuatationDetails] ADD [pohPOID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderQuatationDetails' AND COLUMN_NAME='QuatationID')
BEGIN
	ALTER TABLE [loPurchaseOrderQuatationDetails] ADD [QuatationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturndetail' AND COLUMN_NAME='prdcompanyid')
BEGIN
	ALTER TABLE [loPurchasereturndetail] ADD [prdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturndetail' AND COLUMN_NAME='prdreturnid')
BEGIN
	ALTER TABLE [loPurchasereturndetail] ADD [prdreturnid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturndetail' AND COLUMN_NAME='prddetailid')
BEGIN
	ALTER TABLE [loPurchasereturndetail] ADD [prddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturndetail' AND COLUMN_NAME='prditemid')
BEGIN
	ALTER TABLE [loPurchasereturndetail] ADD [prditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturndetail' AND COLUMN_NAME='prdqty')
BEGIN
	ALTER TABLE [loPurchasereturndetail] ADD [prdqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturndetail' AND COLUMN_NAME='prdcostprice')
BEGIN
	ALTER TABLE [loPurchasereturndetail] ADD [prdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturndetail' AND COLUMN_NAME='prdsuppamount')
BEGIN
	ALTER TABLE [loPurchasereturndetail] ADD [prdsuppamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhcompanyid')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhreturnid')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhreturnid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhreturnno')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhreturnno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhreturndate')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhreturndate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhvendorid')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhvendorid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhgodownid')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhgodownid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhwriteoffid')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhwriteoffid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhremarks')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhadjaccountid')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhadjaccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhcancelled')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhcancelled] bit CONSTRAINT [DF_loPurchasereturnheader_prhcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhcancelledremarks')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhposted')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhposted] bit CONSTRAINT [DF_loPurchasereturnheader_prhposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhupdatetime')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhupdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhexrate')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhdepexrate')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhexchangerates')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhinvexrate')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhinvexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhFinancialID')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhdepartmentid')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhSubDepartmentID')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhSubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhreturntime')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhreturntime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhreturnupdatetime')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhreturnupdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhTime')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhModified')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhModified] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhCreated')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhCreated] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME='prhShopID')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD [prhShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvcompanyid')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvrequestid')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvrequestid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvrequestno')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvrequestno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvrequestdate')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvrequestdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvvendorid')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvvendorid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvshopid')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvshopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvrepreqid')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvrepreqid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvremarks')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvcancelled')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvcancelled] bit CONSTRAINT [DF_loreplacereqtovendorheader_rrvcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvcancelledremarks')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvTime')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvCreated')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvCreated] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME='rrvModified')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD [rrvModified] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDShopID')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDID')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDDetailid')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDDetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDItemID')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDShipmentID')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDArrivedQty')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDArrivedQty] [numeric] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDArrivedPQty')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDArrivedPQty] [numeric] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDPackID')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDPackID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDunitID')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDunitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDReturnedPqty')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDReturnedPqty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDReturnedQty')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDReturnedQty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDcostprice')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDInhouseConsAccnt')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDInhouseConsAccnt] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME='IHRDRetrnOrExch')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD [IHRDRetrnOrExch] [varchar] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHShopID')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHID')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHNo')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHDate')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHReferenceid')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHReferenceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHRemarks')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHCancelled')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHCancelled] bit CONSTRAINT [DF__LOs_InHou__IHRHC__4DFF6746] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHCancelledRemarks')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHposted')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHposted] bit CONSTRAINT [DF_LOsWriteOffHeader_IHRHposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [updatetime] datetime CONSTRAINT [DF__LOs_InHou__updat__4FE7AFB8] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHdepartmentid')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHconexrate')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHdepexrate')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHexchangerates')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHotherdepid')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHotherdepid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHtodepexrate')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHtodepexrate] [numeric] (18,9) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHexpenseaccid')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHexpenseaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHapartmentid')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHapartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHUserId')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHUserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHModifiedUserId')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHModifiedUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHConfirmed')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHConfirmed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME='IHRHConfirmedUSerID')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD [IHRHConfirmedUSerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiShopID')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiInvoiceID')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiCompanyID')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiInvoiceNo')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiInvoiceNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiInvoiceDate')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiInvoiceDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiOrderNo')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiOrderNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiCustomerID')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiProforma')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiProforma] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiCashInvoice')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiCashInvoice] bit CONSTRAINT [DF_LOsAccountsInvoiceHeader_aiCashInvoice] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiBankCashID')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiBankCashID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiChequeNo')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiDuePeriod')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiDuePeriod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiRemarks')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiPosted')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiDepartmentID')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiProduct')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiProduct] bit CONSTRAINT [DF_LOsAccountsInvoiceHeader_aiProduct] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiDiscount')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiDiscountAccountID')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiDiscountAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiCancelled')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiCancelledRemarks')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiFinancialID')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiExchangeNature')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiExchangeNature] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiSalesAccID')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiSettled')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiSettled] bit CONSTRAINT [DF_LOsAccountsInvoiceHeader_aiSettled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiExchangeRate')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiExchangeRate] [numeric] (28,8) CONSTRAINT [DF_LOsAccountsInvoiceHeader_aiExchangeRate] DEFAULT ((1)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiReferenceno')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiReferenceno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiSettledamount')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiSettledamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aicbid')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aicbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aicfuturevc')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aicfuturevc] [varchar] (250) CONSTRAINT [DF_LOsAccountsInvoiceHeader_aicfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOsAccountsInvoiceHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiAddress')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsAccoun__rowgu__419A5BB8] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aidepexrate')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aidepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aidexchangerates')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aidexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiClearingComPerc')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiClearingComPerc] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiInvoiceType')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiInvoiceType] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiCashPaidByshop')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiCashPaidByshop] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiPOCommPer')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiPOCommPer] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiBoatnoteid')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiBoatnoteid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiCreated')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiCreated] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiModified')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiModified] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiTime')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiUserId')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiModifyUserId')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiModifyUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiTaxCategory')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiTaxAmount')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiTaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='aiTaxPercentage')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [aiTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME='ExcludeGST')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD [ExcludeGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdcompanyid')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdshopid')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdAgreementId')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdAgreementId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdAgreementDetailID')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdAgreementDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdPersonName')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdPersonName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdcheckintime')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdcheckintime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdcheckouttime')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdcheckouttime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdPassPortNo')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdPassPortNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdWorkPermitVisaNo')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdWorkPermitVisaNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdPPExpiryDate')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdPPExpiryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdVisaExpiryDate')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdVisaExpiryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdstatus')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdstatus] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND COLUMN_NAME='mgdremarks')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ADD [mgdremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghCompanyId')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghShopId')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghAgreementid')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghAgreementid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghAgreementno')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghAgreementno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghAgreementDate')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghAgreementDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghApartmentId')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghApartmentId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghApartmentIncharge')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghApartmentIncharge] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghcontactpersonname')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghcontactpersonname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghcontactphoneno')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghcontactphoneno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghleaseendingdate')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghleaseendingdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghleasecommencingdate')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghleasecommencingdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghrentlastdate')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghrentlastdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghleasestatus')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghleasestatus] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghelectricityreadingstart')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghelectricityreadingstart] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghelectricityreadingend')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghelectricityreadingend] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghwaterreadingstart')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghwaterreadingstart] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghwaterreadingend')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghwaterreadingend] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghsecurittyamount')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghsecurittyamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghdiscount')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghdiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghmodeofpayment')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghmodeofpayment] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghRemarks')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghCancelled')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghCancelledRemarks')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghUpdateTime')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghDepartmentid')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghReservationID')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghReservationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghExchangeRate')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghDepExRate')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghDepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghAccountId')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghAccountId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghNoOfDetails')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghNoOfDetails] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghPosted')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghPosted] bit CONSTRAINT [DF__losApartm__mghPo__27CF9CBD] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghChequeNo')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghChequeDate')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghChequeDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghExchangeRates')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghAdavanceAccID')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghAdavanceAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghRateDetailId')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghRateDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghApartmentRate')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghApartmentRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME='mghadvdate')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD [mghadvdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentAssets' AND COLUMN_NAME='aacompanyid')
BEGIN
	ALTER TABLE [LosApartmentAssets] ADD [aacompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentAssets' AND COLUMN_NAME='aashopid')
BEGIN
	ALTER TABLE [LosApartmentAssets] ADD [aashopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentAssets' AND COLUMN_NAME='aaapartmentid')
BEGIN
	ALTER TABLE [LosApartmentAssets] ADD [aaapartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentAssets' AND COLUMN_NAME='aadetailid')
BEGIN
	ALTER TABLE [LosApartmentAssets] ADD [aadetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentAssets' AND COLUMN_NAME='aaremarks')
BEGIN
	ALTER TABLE [LosApartmentAssets] ADD [aaremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentAssets' AND COLUMN_NAME='AaItemName')
BEGIN
	ALTER TABLE [LosApartmentAssets] ADD [AaItemName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentAssets' AND COLUMN_NAME='aaassetid')
BEGIN
	ALTER TABLE [LosApartmentAssets] ADD [aaassetid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhBillId')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhBillId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhSHopID')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhSHopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhCompanyid')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhCompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhBillNo')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhApartmentId')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhApartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhAgreementId')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhAgreementId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhCustomerId')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhCustomerId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhCashAccId')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhCashAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhFromDate')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhFromDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhToDate')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhToDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhRate')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhAmount')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhOtherCharges')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhOtherCharges] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhTax')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhTax] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abdDepositReturn')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abdDepositReturn] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhDepExRate')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhDepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhExRate')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhRemarks')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhCancelledRemarks')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhCancelled')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhPosted')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhPosted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhDepartmentid')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhDepartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhUpdateTime')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhBillDate')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhBillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhSalesAccID')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhOCAccID')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhOCAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhExRates')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhExRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhDueDate')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhDueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhReferenceNo')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhSettledAmount')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhSettledAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhSettled')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhSettled] bit CONSTRAINT [DF_losApartmentBillHeader_abhSettled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhPeriod')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhPeriod] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME='abhUserID')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD [abhUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentcategory' AND COLUMN_NAME='rccompanyid')
BEGIN
	ALTER TABLE [LosApartmentcategory] ADD [rccompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentcategory' AND COLUMN_NAME='rcshopid')
BEGIN
	ALTER TABLE [LosApartmentcategory] ADD [rcshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentcategory' AND COLUMN_NAME='rcapartmentcategoryid')
BEGIN
	ALTER TABLE [LosApartmentcategory] ADD [rcapartmentcategoryid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentcategory' AND COLUMN_NAME='rcapartmentcategorycode')
BEGIN
	ALTER TABLE [LosApartmentcategory] ADD [rcapartmentcategorycode] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApartmentcategory' AND COLUMN_NAME='rcapartmentcategorydescription')
BEGIN
	ALTER TABLE [LosApartmentcategory] ADD [rcapartmentcategorydescription] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chID')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chShopID')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chCompanyId')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chNo')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chDate')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chApartmentId')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chApartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chAgreementID')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chAgreementID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chEnteredBy')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chEnteredBy] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chCheckoutTime')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chCheckoutTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chDepositReturned')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chDepositReturned] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chDepositAmount')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chDepositAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chCashAccId')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chCashAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chRemarks')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chPosted')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chPosted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chCancelled')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chCancelledRemarks')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='ChDepartmentID')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [ChDepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chUpdateTime')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chExRate')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chDepExRate')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chDepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chExRates')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chExRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chWriteOffAccID')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chWriteOffAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chAvaliedAmount')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chAvaliedAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME='chCustomerID')
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD [chCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSApartmentDetail' AND COLUMN_NAME='apdcompanyid')
BEGIN
	ALTER TABLE [LOSApartmentDetail] ADD [apdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSApartmentDetail' AND COLUMN_NAME='apdApartmentid')
BEGIN
	ALTER TABLE [LOSApartmentDetail] ADD [apdApartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSApartmentDetail' AND COLUMN_NAME='apdShopid')
BEGIN
	ALTER TABLE [LOSApartmentDetail] ADD [apdShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSApartmentDetail' AND COLUMN_NAME='apdApartmentcategoryid')
BEGIN
	ALTER TABLE [LOSApartmentDetail] ADD [apdApartmentcategoryid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSApartmentDetail' AND COLUMN_NAME='apdApartmentno')
BEGIN
	ALTER TABLE [LOSApartmentDetail] ADD [apdApartmentno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSApartmentDetail' AND COLUMN_NAME='apdremarks')
BEGIN
	ALTER TABLE [LOSApartmentDetail] ADD [apdremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentRatesDetail' AND COLUMN_NAME='rdcompanyid')
BEGIN
	ALTER TABLE [losApartmentRatesDetail] ADD [rdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentRatesDetail' AND COLUMN_NAME='rdshopid')
BEGIN
	ALTER TABLE [losApartmentRatesDetail] ADD [rdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentRatesDetail' AND COLUMN_NAME='rdRoomRateTypeId')
BEGIN
	ALTER TABLE [losApartmentRatesDetail] ADD [rdRoomRateTypeId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentRatesDetail' AND COLUMN_NAME='rdapartmentcategoryid')
BEGIN
	ALTER TABLE [losApartmentRatesDetail] ADD [rdapartmentcategoryid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentRatesDetail' AND COLUMN_NAME='rdroomratedetailid')
BEGIN
	ALTER TABLE [losApartmentRatesDetail] ADD [rdroomratedetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentRatesDetail' AND COLUMN_NAME='rdApartmentRate')
BEGIN
	ALTER TABLE [losApartmentRatesDetail] ADD [rdApartmentRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApprovedby' AND COLUMN_NAME='Approvedid')
BEGIN
	ALTER TABLE [LosApprovedby] ADD [Approvedid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosApprovedby' AND COLUMN_NAME='approvedby')
BEGIN
	ALTER TABLE [LosApprovedby] ADD [approvedby] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='ConfirmID')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [ConfirmID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='ConfirmNO')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [ConfirmNO] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='ConfirmDate')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [ConfirmDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='BoatNoteID')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [BoatNoteID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='InformedTime')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [InformedTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='InformedBy')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [InformedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [Cancelled] bit CONSTRAINT [DF__losBoatNo__Cance__1CFD088F] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME='DetailIDs')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD [DetailIDs] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancellId')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancellId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancellshopid')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancellshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancellcomapnyid')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancellcomapnyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancellno')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancellno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancelldate')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancelldate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancellbookingId')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancellbookingId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancellperson')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancellperson] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancelldetails')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancelldetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancellcancelled')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancellcancelled] bit CONSTRAINT [DF_losbookingcancellation_bkcancellcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancellRemarks')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancellRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME='bkcancellposted')
BEGIN
	ALTER TABLE [losbookingcancellation] ADD [bkcancellposted] bit CONSTRAINT [DF_losbookingcancellation_bkcancellposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdsercompanyid')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdsercompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdserpartsid')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdserpartsid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdshopid')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdserbookid')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdserbookid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdrate')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdsellrate')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdsellrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdqty')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdfromsupp')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdfromsupp] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdguarantee')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdguarantee] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdcomments')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdcostprice')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdcostprice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdpackid')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdpackid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkdpackqty')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkdpackqty] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkddetailid')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losbookpa__rowgu__752E4300] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkinvhSerialNumber')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkinvhSerialNumber] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkinvhTaxCateID')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkinvhTaxCateID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkinvhTaxPercentage')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkinvhTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME='repbkinvhTaxamount')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD [repbkinvhTaxamount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serbkdcompanyid')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serbkdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serbkdbookid')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serbkdbookid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serbkdshopid')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serbkdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serbkdserviceid')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serbkdserviceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serbkdcharge')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serbkdcharge] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serbkdchargetaken')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serbkdchargetaken] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serbkdcomments')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serbkdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serbkdserviceqty')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serbkdserviceqty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serbkdserdetailid')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serbkdserdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losbookse__rowgu__76E317F6] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serinvhTaxCateID')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serinvhTaxCateID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serinvhTaxPercentage')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serinvhTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME='serinvhTaxamount')
BEGIN
	ALTER TABLE [losbookservicedetails] ADD [serinvhTaxamount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechcompanyid')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechbookid')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechbookid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechshopid')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechdetailid')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechid')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechstarttime')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechstarttime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechendtime')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechendtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechcostperhr')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechcostperhr] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechservicetype')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechservicetype] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechcomments')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechstatus')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechstatus] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechfuturevc')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losbookse__rowgu__4DABF839] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME='sertechServiceID')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD [sertechServiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhid')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhno')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhshopid')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhslno')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhslno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhdate')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhitemid')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhitemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkpartcode')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkpartcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkrefno')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkrefno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhaddress')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhaddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhMaintenanceContractID')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhMaintenanceContractID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhtelephone')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhtelephone] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhrecvdfrom')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhrecvdfrom] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhCallClass')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhCallClass] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhCallShopID')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhCallShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhCallType')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhCallType] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhcancelled')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhcancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhcategid')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhcategid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhcompanyid')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhcustomerid')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhdepartmentid')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhenteredby')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhenteredby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhFaxInTime')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhFaxInTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhfuturevc')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhguarentee')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhguarentee] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhinformedby')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhinformedby] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhpurchdate')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhpurchdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhremarks')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhtime')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhupdatetime')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhupdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkcancelremarks')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkcancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhinstallation')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhinstallation] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='sercallbkhstatus')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [sercallbkhstatus] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhStatusId')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhStatusId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='sercallbkhwarrantyfrom')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [sercallbkhwarrantyfrom] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='sercallbkhwarrantyto')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [sercallbkhwarrantyto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhRegID')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhRegID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhMileage')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhMileage] [nvarchar] (30) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhcustomerName')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhcustomerName] [nvarchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhServWarrantyUpto')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhServWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhPartsWarrantyUpto')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhPartsWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhSerialNo')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhSerialNo] [nvarchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='sercallbkhonsite')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [sercallbkhonsite] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME='serCallBkhExcludeGST')
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD [serCallBkhExcludeGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpid')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpshopid')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcompanyid')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpno')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpno] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpdate')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcustomerid')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpbookingid')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpbookingid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcustomername')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcustomername] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcustomercardno')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcustomercardno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcustomeraddress')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcustomeraddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcustomeremail')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcustomeremail] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcustomerpagermobile')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcustomerpagermobile] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcomplaintdetails')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcomplaintdetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmptype')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmptype] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcancelled')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpcancelledremarks')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpupdatetime')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpupdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [loscomplaints] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__loscompla__rowgu__009FF5AC] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpItemid')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpItemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpItemDesc')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpItemDesc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME='cmpEnterby')
BEGIN
	ALTER TABLE [loscomplaints] ADD [cmpEnterby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCosAvlStock' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [losCosAvlStock] ADD [CompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCosAvlStock' AND COLUMN_NAME='CostingID')
BEGIN
	ALTER TABLE [losCosAvlStock] ADD [CostingID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCosAvlStock' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [losCosAvlStock] ADD [ItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCosAvlStock' AND COLUMN_NAME='OldStock')
BEGIN
	ALTER TABLE [losCosAvlStock] ADD [OldStock] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNShopid')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNId')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNNo')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNDate')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNCustomerID')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNVendorId')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNVendorId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNDebit')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNDebit] bit CONSTRAINT [DF_losDebitCreditNote_DCNDebit] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNOtherAccId')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNOtherAccId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNBillId')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNBillId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNInvoiceId')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNInvoiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNAmount')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNDetails')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNDetails] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNRemarks')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNCompanyid')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNCompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNCancelled')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNCancelled] bit CONSTRAINT [DF_losDebitCreditNote_DCNCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNCancelledRemarks')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNPosted')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNPosted] bit CONSTRAINT [DF_losDebitCreditNote_DCNPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNRecAddUser')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNRecModifyUser')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losReferenceno')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losReferenceno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losrefno')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losrefno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='loscusvenrefno')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [loscusvenrefno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losfinancialid')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losfinancialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losexchangerate')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losexchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [updatetime] datetime CONSTRAINT [DF_losDebitCreditNote_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losdcndepartmentid')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losdcndepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losDebitC__rowgu__271B6FA6] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losdepexrate')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losdexchangerates')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losdexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNtype')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNtype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNDuePeriod')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNDuePeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME='losDCNUserID')
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD [losDCNUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='DCNID')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [DCNID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='ClearenceID')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [ClearenceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='POID')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [POID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='ResAmount')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [ResAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='BoatNoteID')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [BoatNoteID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='ClearenceDetID')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [ClearenceDetID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND COLUMN_NAME='BoatNoteDetID')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ADD [BoatNoteDetID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [ShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='CashInvoiceId')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [CashInvoiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='CreditInvoiceId')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [CreditInvoiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='CustomerName')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [CustomerName] [nvarchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='ContactNumber')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [ContactNumber] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='CustomerAddress1')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [CustomerAddress1] [nvarchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='CustomerAddress2')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [CustomerAddress2] [nvarchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='CustomerAddress3')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [CustomerAddress3] [nvarchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='DeliveryAddress1')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [DeliveryAddress1] [nvarchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='DeliveryAddress2')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [DeliveryAddress2] [nvarchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='DeliveryAddress3')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [DeliveryAddress3] [nvarchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='DeliveryDate')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [DeliveryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='DeliveryTime')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [DeliveryTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='DeliveryRemarks')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [DeliveryRemarks] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryDetails' AND COLUMN_NAME='DeliveryAddressIsSame')
BEGIN
	ALTER TABLE [losDeliveryDetails] ADD [DeliveryAddressIsSame] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteDetail' AND COLUMN_NAME='DnDShopid')
BEGIN
	ALTER TABLE [LosDeliveryNoteDetail] ADD [DnDShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteDetail' AND COLUMN_NAME='DnDdnId')
BEGIN
	ALTER TABLE [LosDeliveryNoteDetail] ADD [DnDdnId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteDetail' AND COLUMN_NAME='DnDetailId')
BEGIN
	ALTER TABLE [LosDeliveryNoteDetail] ADD [DnDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteDetail' AND COLUMN_NAME='DnDinvoiceId')
BEGIN
	ALTER TABLE [LosDeliveryNoteDetail] ADD [DnDinvoiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteDetail' AND COLUMN_NAME='dndBillID')
BEGIN
	ALTER TABLE [LosDeliveryNoteDetail] ADD [dndBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnShopid')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DndnId')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DndnId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DndnNo')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DndnNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DndnDate')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DndnDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnCustomerID')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnDeliveredBy')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnDeliveredBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnVesselName')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnVesselName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnRegistryNo')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnRegistryNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnReceivedBY')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnReceivedBY] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnRemarks')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnRemarks] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='Dncancelled')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [Dncancelled] bit CONSTRAINT [DF_LosDeliveryNoteHeader_Dncancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnCancelledRemarks')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnDeliveryTime')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnDeliveryTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnCustomerName')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnCustomerName] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnContactNumber')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnContactNumber] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnCustomerAddress1')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnCustomerAddress1] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnCustomerAddress2')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnCustomerAddress2] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnCustomerAddress3')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnCustomerAddress3] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnDeliveryAddress1')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnDeliveryAddress1] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnDeliveryAddress2')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnDeliveryAddress2] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnDeliveryAddress3')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnDeliveryAddress3] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnCompanyId')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnCompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnStatus')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnStatus] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='dnConfirmed')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [dnConfirmed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME='DnDeliveryType')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD [DnDeliveryType] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteImage' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [losDeliveryNoteImage] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteImage' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [losDeliveryNoteImage] ADD [ShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteImage' AND COLUMN_NAME='DeliveryNoteId')
BEGIN
	ALTER TABLE [losDeliveryNoteImage] ADD [DeliveryNoteId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteImage' AND COLUMN_NAME='DeliveryNoteImage')
BEGIN
	ALTER TABLE [losDeliveryNoteImage] ADD [DeliveryNoteImage] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndShopID')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndId')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndDetailID')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndItemID')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndQty')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndQty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndItemType')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndItemType] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndKitID')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndKitID] int CONSTRAINT [DF_LosDeliveryNoteItemDetails_dndKitID] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndKitQuantity')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndKitQuantity] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='issueQty')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [issueQty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndItemRemarks')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndItemRemarks] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndCollectFromGodownId')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndCollectFromGodownId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME='dndPackingTypeID')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD [dndPackingTypeID] int CONSTRAINT [DF__losDelive__dndPa__0D45C3B3] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [ShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='DeliveryVerificationId')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [DeliveryVerificationId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='SlNo')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [SlNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='BillId')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [BillId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='InvoiceId')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [InvoiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='PackId')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [PackId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='PackQty')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [PackQty] [numeric] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [Qty] [numeric] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND COLUMN_NAME='FinancialYearId')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] ADD [FinancialYearId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [ShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='DeliveryVerificationId')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [DeliveryVerificationId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='DeliveryVerificationNo')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [DeliveryVerificationNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='DeliveryDate')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [DeliveryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [Cancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='AddUserId')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [AddUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='ModifyUserId')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [ModifyUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='DeleteUserId')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [DeleteUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='DeletionReason')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [DeletionReason] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='UpdateTime')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [UpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND COLUMN_NAME='FinancialYearId')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ADD [FinancialYearId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Losdisplaylayer' AND COLUMN_NAME='Displayerid')
BEGIN
	ALTER TABLE [Losdisplaylayer] ADD [Displayerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Losdisplaylayer' AND COLUMN_NAME='DispLayerName')
BEGIN
	ALTER TABLE [Losdisplaylayer] ADD [DispLayerName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Losdisplaylayer' AND COLUMN_NAME='DispLayerValue')
BEGIN
	ALTER TABLE [Losdisplaylayer] ADD [DispLayerValue] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Losdisplaymode' AND COLUMN_NAME='Dispmodeid')
BEGIN
	ALTER TABLE [Losdisplaymode] ADD [Dispmodeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Losdisplaymode' AND COLUMN_NAME='Dispmodename')
BEGIN
	ALTER TABLE [Losdisplaymode] ADD [Dispmodename] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Losdisplaymode' AND COLUMN_NAME='Dispmodevalue')
BEGIN
	ALTER TABLE [Losdisplaymode] ADD [Dispmodevalue] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losDocument] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='DocID')
BEGIN
	ALTER TABLE [losDocument] ADD [DocID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='DocType')
BEGIN
	ALTER TABLE [losDocument] ADD [DocType] [char] (2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='DocNo')
BEGIN
	ALTER TABLE [losDocument] ADD [DocNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='DocDate')
BEGIN
	ALTER TABLE [losDocument] ADD [DocDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [losDocument] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [losDocument] ADD [CurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [losDocument] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='EmpName')
BEGIN
	ALTER TABLE [losDocument] ADD [EmpName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='PPassportNo')
BEGIN
	ALTER TABLE [losDocument] ADD [PPassportNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='PIssueDate')
BEGIN
	ALTER TABLE [losDocument] ADD [PIssueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='PExpireyDate')
BEGIN
	ALTER TABLE [losDocument] ADD [PExpireyDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='PNationality')
BEGIN
	ALTER TABLE [losDocument] ADD [PNationality] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='WWorkPermitNo')
BEGIN
	ALTER TABLE [losDocument] ADD [WWorkPermitNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='WIssueDate')
BEGIN
	ALTER TABLE [losDocument] ADD [WIssueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='WExpireyDate')
BEGIN
	ALTER TABLE [losDocument] ADD [WExpireyDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='WNoofDays')
BEGIN
	ALTER TABLE [losDocument] ADD [WNoofDays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='WFeeType')
BEGIN
	ALTER TABLE [losDocument] ADD [WFeeType] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='WFeeExpireyDate')
BEGIN
	ALTER TABLE [losDocument] ADD [WFeeExpireyDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='MLastMedicalReportDate')
BEGIN
	ALTER TABLE [losDocument] ADD [MLastMedicalReportDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='CoMailIn')
BEGIN
	ALTER TABLE [losDocument] ADD [CoMailIn] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='CoMailHandledBy')
BEGIN
	ALTER TABLE [losDocument] ADD [CoMailHandledBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='RequestedBy')
BEGIN
	ALTER TABLE [losDocument] ADD [RequestedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [losDocument] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='AlertBeforeDays')
BEGIN
	ALTER TABLE [losDocument] ADD [AlertBeforeDays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [losDocument] ADD [Active] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [losDocument] ADD [Cancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [losDocument] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME='ArrangementDoneDate')
BEGIN
	ALTER TABLE [losDocument] ADD [ArrangementDoneDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentaccom' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losDocumentaccom] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentaccom' AND COLUMN_NAME='DocId')
BEGIN
	ALTER TABLE [losDocumentaccom] ADD [DocId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentaccom' AND COLUMN_NAME='DetailId')
BEGIN
	ALTER TABLE [losDocumentaccom] ADD [DetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentaccom' AND COLUMN_NAME='PaxName')
BEGIN
	ALTER TABLE [losDocumentaccom] ADD [PaxName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentaccom' AND COLUMN_NAME='Hotelname')
BEGIN
	ALTER TABLE [losDocumentaccom] ADD [Hotelname] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentaccom' AND COLUMN_NAME='BedNights')
BEGIN
	ALTER TABLE [losDocumentaccom] ADD [BedNights] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentaccom' AND COLUMN_NAME='RoomRate')
BEGIN
	ALTER TABLE [losDocumentaccom] ADD [RoomRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentaccom' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [losDocumentaccom] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentDetail' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losDocumentDetail] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentDetail' AND COLUMN_NAME='DocID')
BEGIN
	ALTER TABLE [losDocumentDetail] ADD [DocID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentDetail' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [losDocumentDetail] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentDetail' AND COLUMN_NAME='Particulars')
BEGIN
	ALTER TABLE [losDocumentDetail] ADD [Particulars] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentDetail' AND COLUMN_NAME='FromDetails')
BEGIN
	ALTER TABLE [losDocumentDetail] ADD [FromDetails] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentDetail' AND COLUMN_NAME='ToDetails')
BEGIN
	ALTER TABLE [losDocumentDetail] ADD [ToDetails] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentoc' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losDocumentoc] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentoc' AND COLUMN_NAME='DocID')
BEGIN
	ALTER TABLE [losDocumentoc] ADD [DocID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentoc' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [losDocumentoc] ADD [DetailID] [char] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentoc' AND COLUMN_NAME='OtherCharge')
BEGIN
	ALTER TABLE [losDocumentoc] ADD [OtherCharge] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumentoc' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [losDocumentoc] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='DocId')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [DocId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='DetailId')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [DetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='TravellerName')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [TravellerName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='Department')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [Department] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='Designation')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [Designation] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='TravelDate')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [TravelDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='Remark')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [Remark] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='TravelMode')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [TravelMode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='Route')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [Route] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='Travelclass')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [Travelclass] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='Travelcost')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [Travelcost] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='arrivaldate')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [arrivaldate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocumenttravel' AND COLUMN_NAME='alertdays')
BEGIN
	ALTER TABLE [losDocumenttravel] ADD [alertdays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdShopID')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdDetailid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdDetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdcompanyid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdcompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdinvoiceid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdsplinvoiceid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdsplinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdserviceinvoiceid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdserviceinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdbookserinvoiceid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdbookserinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drddcnid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drddcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdinvoiceamount')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdinvoiceamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdsettledamount')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdsettledamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LosDummyR__rowgu__4ACEC037] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdUtilityBillID')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdUtilityBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdRoomBillID')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdRoomBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdaccInvoiceID')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdaccInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdFineid')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdFineid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME='drdfandbInvoiceID')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD [drdfandbInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drShopid')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drId')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drCompanyid')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drCompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drNo')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='DrDate')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [DrDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drcustomerid')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drbankname')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drbankname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drremarks')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drchequeno')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drchequeno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drchequedate')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drchequedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drAmount')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drcbid')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drrecadduser')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drrecadduser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drrecmodifyuser')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drrecmodifyuser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drcancelled')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drcancelled] bit CONSTRAINT [DF_losDummyReceipt_cancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drcancelledremarks')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drfuturevc')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drfuturevc] [varchar] (250) CONSTRAINT [DF_losDummyReceiptHeader_drfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [updatetime] datetime CONSTRAINT [DF_losDummyReceiptHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drdepartmentid')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drBankExchangeRate')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drBankExchangeRate] [numeric] (28,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drExchangeRate')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drExchangeRate] [numeric] (28,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losDummyR__rowgu__5AF01967] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drdepexRate')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drdepexRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drexchangerates')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drreccurrencyid')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drreccurrencyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drrecamount')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drrecamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drTime')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drCounterID')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drCounterID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME='drUserID')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD [drUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='ecshopid')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [ecshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='ecconfirmid')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [ecconfirmid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='ecconfirmno')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [ecconfirmno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='ecconfirmdate')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [ecconfirmdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='ecediid')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [ecediid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='ecrefno')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [ecrefno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='ecstatus')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [ecstatus] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='ecconfirmedby')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [ecconfirmedby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='eccancelled')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [eccancelled] bit CONSTRAINT [DF_losEDIConfirmation_eccancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME='eccancelledremarks')
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD [eccancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='ershopid')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [ershopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='erediid')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [erediid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='eredino')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [eredino] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='eredidate')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [eredidate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='erreferenceno')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [erreferenceno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='erpoid')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [erpoid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='ersentby')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [ersentby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='erremarks')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [erremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='ercancelled')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [ercancelled] bit CONSTRAINT [DF_losEDIRequest_ercancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME='ercancelledremarks')
BEGIN
	ALTER TABLE [losEDIRequest] ADD [ercancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadInterfaceID')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadInterfaceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadShopID')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadTransactionID')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadTransactionID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadDetailID')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadExpiryDate')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadExpiryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadItemID')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadItemQty')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadItemQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadPackingtypeID')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadPackingtypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadPackingQty')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadPackingQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadCancel')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadCancel] bit CONSTRAINT [DF_losexpiryarrivaldetails_eadCancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadAdjustment')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadAdjustment] bit CONSTRAINT [DF_losexpiryarrivaldetails_eadAdjustment] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadfreeqty')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadfreeqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME='eadbatchno')
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD [eadbatchno] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidInterfaceID')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidInterfaceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidShopID')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidTransactionID')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidTransactionID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidDetailID')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidExpiryDate')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidExpiryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidItemID')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidItemQty')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidItemQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidPackingtypeID')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidPackingtypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidPackingQty')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidPackingQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidCancel')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidCancel] bit CONSTRAINT [DF_losexpiryissuedetails_eidCancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidAdjustment')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidAdjustment] bit CONSTRAINT [DF_losexpiryissuedetails_eidAdjustment] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidfreeqty')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidfreeqty] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME='eidbatchno')
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD [eidbatchno] [varchar] (20) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdId')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdShipmentId')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdShipmentId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdItemId')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdShopId')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdAvailStock')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdAvailStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdVerifiedStock')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdVerifiedStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdCostPrice')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdCostPrice] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdPrevExpiryDate')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdPrevExpiryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdVerifiedExpiryDate')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdVerifiedExpiryDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdPrevBatchNo')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdPrevBatchNo] [varchar] (20) CONSTRAINT [DF__losExpiry__evdPr__0154EE1A] DEFAULT ('OLDBATCH') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME='evdBatchNo')
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD [evdBatchNo] [varchar] (20) CONSTRAINT [DF__losExpiry__evdBa__02491253] DEFAULT ('OLDBATCH') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhId')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhShopId')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhNo')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhDate')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhRemarks')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhCancelled')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhVerifiedBy')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhVerifiedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhCancelRemarks')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhCancelRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhFutureVc')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhFutureVc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhPosted')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhPosted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='UpdateTime')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [UpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhDepartmentId')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhDepartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhConExRate')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhConExRate] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhDepExRate')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhDepExRate] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationHeader' AND COLUMN_NAME='evhExchangeRates')
BEGIN
	ALTER TABLE [losExpiryVerificationHeader] ADD [evhExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redShopID')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redExportID')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redExportID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redItemID')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redPckingTypeID')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redPckingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redPUnitID')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redPUnitID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redQuantity')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redQuantity] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redUnitPrice')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redUnitPrice] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redRateType')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redRateType] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redActualUnitPrice')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redActualUnitPrice] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redCostPrice')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redCostPrice] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redDescription')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redbLockPrice')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redbLockPrice] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redguarantee')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redguarantee] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redrebateamount')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redrebateamount] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redcorgin')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redcorgin] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redcconsignment')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redcconsignment] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redcdcomcur')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redcdcomcur] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redcdcustcur')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redcdcustcur] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redcdcomcurtocustoms')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redcdcomcurtocustoms] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redcdcustcurtocustoms')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redcdcustcurtocustoms] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redPQuantity')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redPQuantity] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redroyaltyamt')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redroyaltyamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportDetail' AND COLUMN_NAME='redRoyalty')
BEGIN
	ALTER TABLE [losExportDetail] ADD [redRoyalty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehExportID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehExportID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehShopID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehExportNo')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehExportNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehExportDate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehExportDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehReferenceNo')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehVendorID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehcustomerid')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehProforma')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehProforma] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehCashInvoice')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehCashInvoice] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehBankCashAccID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehBankCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehChequeNo')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehChequeNo] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehDueDate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehDueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehRemarks')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehExportAmount')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehExportAmount] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehDiscount')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehDiscount] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehDiscountAccID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehDiscountAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehDepartmentID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehFinancialID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehCancelled')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehCancelledRemarks')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehExchangeNature')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehExchangeNature] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehCompanyID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehPosted')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehPosted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehProformaID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehProformaID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehSalesAccID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehSettled')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehSettled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehExchangeRate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehSettledAmount')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehSettledAmount] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehWholeSale')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehWholeSale] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehFutureVC')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehFutureVC] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehUpdatetime')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehUpdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehSalesPersonID')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehSalesPersonID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehShip')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehShip] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehPortofLoading')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehPortofLoading] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehShipDepDate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehShipDepDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehShipDischarge')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehShipDischarge] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehShipArrivalDate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehShipArrivalDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehFinalDestination')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehFinalDestination] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehDeliveryDate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehDeliveryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehgstpercentage')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehgstpercentage] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehPaymentterm')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehPaymentterm] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losExportHeader] ADD [updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehDepExRate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehDepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehtype')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehtype] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehcustomsformno')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehcustomsformno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehexchangerates')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehBuyerPoNo')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehBuyerPoNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehBuyerName')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehBuyerName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehBuyerAddress')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehBuyerAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehLoadedDate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehLoadedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehDetailsOfShipment')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehDetailsOfShipment] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehConsigneeName')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehConsigneeName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehNameOfVessel')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehNameOfVessel] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehShipmentDepartureDate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehShipmentDepartureDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehCustomerFormRegNo')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehCustomerFormRegNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehBlOrAwbNo')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehBlOrAwbNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehMissingOrDamagedItems')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehMissingOrDamagedItems] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehInsuranceCertificateNo')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehInsuranceCertificateNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehDemurrageRemarkds')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehDemurrageRemarkds] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehContainerNo')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehContainerNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehTerminate')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehTerminate] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehTerminateRemarks')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehTerminateRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehBankName')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehBankName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehBankaddress')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehBankaddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehSwiftaddress')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehSwiftaddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehAdvanceAmt')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehAdvanceAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME='rehPriceType')
BEGIN
	ALTER TABLE [losExportHeader] ADD [rehPriceType] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsExportOC' AND COLUMN_NAME='ioShopID')
BEGIN
	ALTER TABLE [LOsExportOC] ADD [ioShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsExportOC' AND COLUMN_NAME='ioInvoiceID')
BEGIN
	ALTER TABLE [LOsExportOC] ADD [ioInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsExportOC' AND COLUMN_NAME='ioAccID')
BEGIN
	ALTER TABLE [LOsExportOC] ADD [ioAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsExportOC' AND COLUMN_NAME='ioDescription')
BEGIN
	ALTER TABLE [LOsExportOC] ADD [ioDescription] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsExportOC' AND COLUMN_NAME='ioAmount')
BEGIN
	ALTER TABLE [LOsExportOC] ADD [ioAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsExportOC' AND COLUMN_NAME='ioCompanyid')
BEGIN
	ALTER TABLE [LOsExportOC] ADD [ioCompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftShopid')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftShopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftCompanyId')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftBookingId')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftBookingId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftBookingDetailId')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftBookingDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftFaclityID')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftFaclityID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftCheckInTime')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftCheckInTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftCheckOutTime')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftCheckOutTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftnoofunit')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftnoofunit] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftweekdays')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftweekdays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingDetail' AND COLUMN_NAME='ftRemarks')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] ADD [ftRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingHeader' AND COLUMN_NAME='fbhcompanyid')
BEGIN
	ALTER TABLE [losFacilityBookingHeader] ADD [fbhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingHeader' AND COLUMN_NAME='fbhshopid')
BEGIN
	ALTER TABLE [losFacilityBookingHeader] ADD [fbhshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingHeader' AND COLUMN_NAME='fphbookingid')
BEGIN
	ALTER TABLE [losFacilityBookingHeader] ADD [fphbookingid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingHeader' AND COLUMN_NAME='fbhbookingdate')
BEGIN
	ALTER TABLE [losFacilityBookingHeader] ADD [fbhbookingdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingHeader' AND COLUMN_NAME='fbhbookingno')
BEGIN
	ALTER TABLE [losFacilityBookingHeader] ADD [fbhbookingno] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingHeader' AND COLUMN_NAME='fbhregistrationid')
BEGIN
	ALTER TABLE [losFacilityBookingHeader] ADD [fbhregistrationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingHeader' AND COLUMN_NAME='fbhremarks')
BEGIN
	ALTER TABLE [losFacilityBookingHeader] ADD [fbhremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingHeader' AND COLUMN_NAME='fbhcancelled')
BEGIN
	ALTER TABLE [losFacilityBookingHeader] ADD [fbhcancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losFacilityBookingHeader' AND COLUMN_NAME='fbhcancelledremarks')
BEGIN
	ALTER TABLE [losFacilityBookingHeader] ADD [fbhcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftShopid')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftCompanyId')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftTrackId')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftTrackId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftTrackNo')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftTrackNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftTrackDate')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftTrackDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftAgreementid')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftAgreementid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftBookingId')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftBookingId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftBookingDetailId')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftBookingDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftFaclityID')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftFaclityID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftCheckInTime')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftCheckInTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftCheckOutTime')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftCheckOutTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftChectoutdate')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftChectoutdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftcheckinEnteredBy')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftcheckinEnteredBy] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftcheckoutEnteredBy')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftcheckoutEnteredBy] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftcheckinCancelled')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftcheckinCancelled] bit CONSTRAINT [DF_LosFacilityTracking_ftcheckinCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftcheckinRemark')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftcheckinRemark] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftcheckoutRemark')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftcheckoutRemark] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME='ftcheckincancellremark')
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD [ftcheckincancellremark] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuture' AND COLUMN_NAME='futureint')
BEGIN
	ALTER TABLE [losfuture] ADD [futureint] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuture' AND COLUMN_NAME='futuredatetime')
BEGIN
	ALTER TABLE [losfuture] ADD [futuredatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuture' AND COLUMN_NAME='futurevarchar')
BEGIN
	ALTER TABLE [losfuture] ADD [futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuture' AND COLUMN_NAME='futurenumeric')
BEGIN
	ALTER TABLE [losfuture] ADD [futurenumeric] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuture' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losfuture] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losfuture__rowgu__6FB62C23] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='futdid')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [futdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='futdcompanyid')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [futdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='futdshopid')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [futdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='futdref1id')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [futdref1id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='futdref2id')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [futdref2id] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='futdref3id')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [futdref3id] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='futdrefnum1')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [futdrefnum1] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='futdrefnum2')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [futdrefnum2] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='futdrefnum3')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [futdrefnum3] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losfuture__rowgu__401B5C43] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futheadid')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futheadid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhcompanyid')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhshopid')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhno')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhdate')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhremarks')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhcancelledremarks')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhcancelled')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhcancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhposted')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhposted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhtransidentifier')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhtransidentifier] [char] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='futhupdatetime')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [futhupdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losfuturetabheader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losfuture__rowgu__7B3C2211] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadArrivalID')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadArrivalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadShopid')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadShipmentID')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadItemID')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadItemGoodQuantity')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadItemGoodQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadItemBAdQuantity')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadItemBAdQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadItemGoodQuantityArrived')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadItemGoodQuantityArrived] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadItemBadQuantityArrived')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadItemBadQuantityArrived] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadcostprice')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadpackingtypeid')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadpackingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadpackqty')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadpackqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME='gadreceivepackqty')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD [gadreceivepackqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahArrivalID')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahArrivalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahShopid')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahArrivalNo')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahArrivalNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahArrivalDate')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahArrivalDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahGodownDespatchID')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahGodownDespatchID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahDespatchedGodownID')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahDespatchedGodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahCancelled')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahCancelled] bit CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_gahCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahCancelledRemarks')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahCancelledRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahRecAddUser')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahRecModifyUser')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahremarks')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahTransFinished')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahTransFinished] bit CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_gahTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahfuturevc')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahfuturevc] [varchar] (250) CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_gahfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahshopreqid')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahshopreqid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahposted')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahposted] bit CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_gahposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahdepartmentid')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsGoodsA__rowgu__37BB206C] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahhqdespatchid')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahhqdespatchid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahconexrate')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahdepexrate')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahexchangerates')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME='gahTime')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD [gahTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='GRNDReturnNoteID')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [GRNDReturnNoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='GRNDItemID')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [GRNDItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='GRNDShopid')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [GRNDShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='GRNDQuantity')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [GRNDQuantity] [numeric] (18,5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='GRNDunitprice')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [GRNDunitprice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='GRNDDamaged')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [GRNDDamaged] bit CONSTRAINT [DF_LosGoodsReturnNoteDetail_GRNDDamaged] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='GRNDRemarks')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [GRNDRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='grncostprice')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [grncostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='grndFreeQuantity')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [grndFreeQuantity] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='grndPackTypeId')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [grndPackTypeId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='idItemTaxPercentage')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [idItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='idItemTaxAmount')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [idItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='idItemTaxCategory')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD [idItemTaxCategory] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='grnhShopid')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [grnhShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhGoodsreturnnoteID')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhGoodsreturnnoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhGoodsreturnnoteNO')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhGoodsreturnnoteNO] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhGoodsreturnnoteDate')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhGoodsreturnnoteDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhCustomerID')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhInvoiceID')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhRecommendedby')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhRecommendedby] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhCancel')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhCancel] bit CONSTRAINT [DF_LosGoodsReturnNoteHeader_GrnhCancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhCancelledRemarks')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhRecAdduser')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhRecAdduser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhRecModifyuser')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhRecModifyuser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnhPosted')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnhPosted] bit CONSTRAINT [DF_LosGoodsReturnNoteHeader_GrnhPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnReturnAccID')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnReturnAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='GrnCompanyID')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [GrnCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='grnhExchangeRate')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [grnhExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='grnfuturevc')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [grnfuturevc] [varchar] (250) CONSTRAINT [DF_LosGoodsReturnNoteHeader_grnfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [updatetime] datetime CONSTRAINT [DF_LosGoodsReturnNoteHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='grnhDepartmentid')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [grnhDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='grnhfinancialid')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [grnhfinancialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LosGoodsR__rowgu__10416098] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='grnhdepExRate')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [grnhdepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='grnexchangerates')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [grnexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='grnhTime')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [grnhTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME='grnUserID')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD [grnUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loshpApplication' AND COLUMN_NAME='hpAppCompanyID')
BEGIN
	ALTER TABLE [loshpApplication] ADD [hpAppCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loshpApplication' AND COLUMN_NAME='hpAppShopID')
BEGIN
	ALTER TABLE [loshpApplication] ADD [hpAppShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loshpApplication' AND COLUMN_NAME='hpAppID')
BEGIN
	ALTER TABLE [loshpApplication] ADD [hpAppID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loshpApplication' AND COLUMN_NAME='hpAppDate')
BEGIN
	ALTER TABLE [loshpApplication] ADD [hpAppDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loshpApplication' AND COLUMN_NAME='hpAppNO')
BEGIN
	ALTER TABLE [loshpApplication] ADD [hpAppNO] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='HpdCompanyID')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [HpdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='HpdShopID')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [HpdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='HpdChqRegID')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [HpdChqRegID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='HpdChqdetailID')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [HpdChqdetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='HpdChqNo')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [HpdChqNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='HpdBankName')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [HpdBankName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='HpdChqDate')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [HpdChqDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='HpdChqAmount')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [HpdChqAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='hpdActualChqAmount')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [hpdActualChqAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='HpdAccountNo')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [HpdAccountNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND COLUMN_NAME='hpdchequeStatus')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ADD [hpdchequeStatus] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HphCompanyID')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HphCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HPhShopID')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HPhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HphChqRegID')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HphChqRegID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HphChqRegNO')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HphChqRegNO] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HphDate')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HphDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='hphAgreementID')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [hphAgreementID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='hphInvoiceID')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [hphInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='hphCustID')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [hphCustID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HPhfinancialid')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HPhfinancialid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HphPeriod')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HphPeriod] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HphInstMonthlyPay')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HphInstMonthlyPay] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='hphCancel')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [hphCancel] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='hphCancelRemarks')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [hphCancelRemarks] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='hphShopverify')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [hphShopverify] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HphUser')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HphUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HphModifiedUser')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HphModifiedUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND COLUMN_NAME='HphModifiedDate')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ADD [HphModifiedDate] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCompanyID')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpDepartmentID')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustID')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustName')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustName] [nvarchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustcommenName')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustcommenName] [nvarchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpNCCNO')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpNCCNO] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustDOB')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustDOB] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustBornIn')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustBornIn] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpMobNo')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpMobNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpAccountNo')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpAccountNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustPermanentadd')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustPermanentadd] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustPermAtoll')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustPermAtoll] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustPermIsland')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustPermIsland] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustPremPhno')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustPremPhno] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustPresentAdd')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustPresentAdd] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustPresAtoll')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustPresAtoll] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustpresIsland')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustpresIsland] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustPresPhno')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustPresPhno] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpDeCustName')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpDeCustName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpDeCustAddress')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpDeCustAddress] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpDeCustAtoll')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpDeCustAtoll] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpDeCustIsland')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpDeCustIsland] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustPreAgreement')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustPreAgreement] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='IslandtoUseMC')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [IslandtoUseMC] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpCustMCNO')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpCustMCNO] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpEmployedAt')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpEmployedAt] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpOfficePH')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpOfficePH] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpDesignation')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpDesignation] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpSalary')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpSalary] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpDuration')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpDuration] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpOfficeAdd')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpOfficeAdd] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefName')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefRelation')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefRelation] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefPermanentAdd')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefPermanentAdd] [nvarchar] (120) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefPermAtoll')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefPermAtoll] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefPermIsland')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefPermIsland] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefPermPHNO')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefPermPHNO] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefPresentAdd')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefPresentAdd] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefPresAtoll')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefPresAtoll] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefPresIsland')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefPresIsland] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefPresPHNo')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefPresPHNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpRefMob')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpRefMob] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaName')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaNICNO')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaNICNO] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaPermanentAdd')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaPermanentAdd] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaPermAtoll')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaPermAtoll] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaPermIsland')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaPermIsland] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaPermPHNO')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaPermPHNO] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaPresentAdd')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaPresentAdd] [nvarchar] (120) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaPresAtoll')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaPresAtoll] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaPresIsland')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaPresIsland] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaPresPHNO')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaPresPHNO] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaMOB')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaMOB] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpDeGaName')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpDeGaName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpDeGaAddress')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpDeGaAddress] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpGaRelation')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpGaRelation] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpVerified')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpVerified] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpuser')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpuser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpdate')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpupdateduser')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpupdateduser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerDetails' AND COLUMN_NAME='hpUpdatedTime')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ADD [hpUpdatedTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerQuotationDetails' AND COLUMN_NAME='HpCustID')
BEGIN
	ALTER TABLE [losHPCustomerQuotationDetails] ADD [HpCustID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerQuotationDetails' AND COLUMN_NAME='HPQuotationID')
BEGIN
	ALTER TABLE [losHPCustomerQuotationDetails] ADD [HPQuotationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPCustomerQuotationDetails' AND COLUMN_NAME='HPItemId')
BEGIN
	ALTER TABLE [losHPCustomerQuotationDetails] ADD [HPItemId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND COLUMN_NAME='hpqdCompanyID')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] ADD [hpqdCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND COLUMN_NAME='hpqdShopId')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] ADD [hpqdShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND COLUMN_NAME='hpqdQuotationID')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] ADD [hpqdQuotationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND COLUMN_NAME='hpqdDetailID')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] ADD [hpqdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND COLUMN_NAME='hpqdItemID')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] ADD [hpqdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND COLUMN_NAME='hpqdItemRegistrationId')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] ADD [hpqdItemRegistrationId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND COLUMN_NAME='hpqdFrameNo')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] ADD [hpqdFrameNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND COLUMN_NAME='hpqdSellingPrice')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] ADD [hpqdSellingPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND COLUMN_NAME='hpqdCostPrice')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] ADD [hpqdCostPrice] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhCompanyID')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhShopID')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhQuotationID')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhQuotationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhQuotationNo')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhQuotationNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhQuotationDate')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhQuotationDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhAmount')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhAmount] [numeric] (18,0) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhScheme')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhScheme] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhType')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhType] [char] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhCancel')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhCancel] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhCancelRemarks')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhCancelRemarks] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhPosted')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhPosted] int CONSTRAINT [DF__losHpDumm__hpqhP__1F5292B1] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhCustomerID')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhCustName')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhCustName] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhCustAddress')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhCustAddress] [nvarchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhFirstInstAmt')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhFirstInstAmt] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhBalAmt')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhBalAmt] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhInstPeriod')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhInstPeriod] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhCashAllowance')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhCashAllowance] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhInstPerc')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhInstPerc] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhInstCharge')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhInstCharge] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhSurcharge')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhSurcharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhTotAdditional')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhTotAdditional] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhInstPrice')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhInstPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhMonthilyPay')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhMonthilyPay] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhConfirmed')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhConfirmed] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhUserName')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhUserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhFinancialID')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhRemarks')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhModifiedUser')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhModifiedUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhUpdateTime')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhDownPaid')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhDownPaid] int CONSTRAINT [DF__losHpDumm__hpqhD__2046B6EA] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhProcessed')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhProcessed] int CONSTRAINT [DF__losHpDumm__hpqhP__213ADB23] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME='hpqhFinished')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD [hpqhFinished] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetail' AND COLUMN_NAME='hpqdCompanyID')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] ADD [hpqdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetail' AND COLUMN_NAME='hpqdShopId')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] ADD [hpqdShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetail' AND COLUMN_NAME='hpqdQuotationID')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] ADD [hpqdQuotationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetail' AND COLUMN_NAME='hpqdDetailID')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] ADD [hpqdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetail' AND COLUMN_NAME='hpqdItemID')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] ADD [hpqdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetail' AND COLUMN_NAME='hpqdItemRegistrationId')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] ADD [hpqdItemRegistrationId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetail' AND COLUMN_NAME='hpqdFrameNo')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] ADD [hpqdFrameNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetail' AND COLUMN_NAME='hpqdSellingPrice')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] ADD [hpqdSellingPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetail' AND COLUMN_NAME='hpqdCostPrice')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] ADD [hpqdCostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdCompanyID')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdShopId')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdQuotationID')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdQuotationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdActSellingPrice')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdActSellingPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdActInterest')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdActInterest] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdActDP')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdActDP] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdActSurcharge')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdActSurcharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdActInstallmentPrice')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdActInstallmentPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdActMonthlyPayment')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdActMonthlyPayment] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND COLUMN_NAME='hpqdTotalTax')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] ADD [hpqdTotalTax] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhCompanyID')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhShopID')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhQuotationID')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhQuotationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhQuotationNo')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhQuotationNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhQuotationDate')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhQuotationDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhDelivaryDate')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhDelivaryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhScheme')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhScheme] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhType')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhType] [char] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhReferenceid')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhReferenceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhCancel')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhCancel] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhCancelRemarks')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhCancelRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhPosted')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhPosted] int CONSTRAINT [DF_losHpInvoiceHeader_hpqhPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhCustomerID')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhCustName')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhCustName] [nvarchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhCustAddress')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhCustAddress] [nvarchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhFirstInstAmt')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhFirstInstAmt] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhBalAmt')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhBalAmt] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhInstPeriod')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhInstPeriod] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhCashAllowance')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhCashAllowance] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhInstPerc')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhInstPerc] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhInstCharge')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhInstCharge] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhSurcharge')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhSurcharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhTotAdditional')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhTotAdditional] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhInstPrice')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhInstPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhMonthilyPay')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhMonthilyPay] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhConfirmed')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhConfirmed] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhUserName')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhUserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhFinancialID')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhRemarks')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhModifiedUser')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhModifiedUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhUpdateTime')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhDownPaid')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhDownPaid] int CONSTRAINT [DF_losHpInvoiceHeader_hpqhDownPaid] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhProcessed')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhProcessed] int CONSTRAINT [DF_losHpInvoiceHeader_hpqhProcessed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhInvoiced')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhInvoiced] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhChqReg')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhChqReg] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhDidAgreement')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhDidAgreement] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhServTaxPerc')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhServTaxPerc] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhServTaxAmount')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhServTaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhServTaxCateId')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhServTaxCateId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhRepossessionID')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhRepossessionID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME='hpqhAmount')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD [hpqhAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRCompanyID')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRShopID')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRShopID] [char] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRRegistrationID')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRRegistrationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRRegistrationNo')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRRegistrationNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRRegistrationDate')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRRegistrationDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRFinancialID')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRShipment')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRShipment] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRMode')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRMode] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRItemID')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRColorID')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRColorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRCancel')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRCancel] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRCancelRemarks')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRCancelRemarks] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRForSales')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRForSales] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRModelNo')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRModelNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRFrameNo')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRFrameNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IREngineNo')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IREngineNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRProduction')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRProduction] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRLocation')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRLocation] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRCustomerID')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRRegNo')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRRegNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRRoadWorthiness')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRRoadWorthiness] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRSold')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRSold] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRSoldColor')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRSoldColor] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRRemarks')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRUserName')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRUserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRUpdateUser')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRUpdateUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRUpdateTime')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IrInterfaceID')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IrInterfaceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRTransactionID')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRTransactionID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IREngineCapacity')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IREngineCapacity] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRSeatingCapacity')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRSeatingCapacity] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRManufactureYear')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRManufactureYear] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRImportYear')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRImportYear] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRTypeofVehicle')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRTypeofVehicle] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND COLUMN_NAME='IRCase')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ADD [IRCase] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptDetail' AND COLUMN_NAME='hprdCompanyID')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ADD [hprdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptDetail' AND COLUMN_NAME='hprdShopId')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ADD [hprdShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptDetail' AND COLUMN_NAME='hprdReceiptID')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ADD [hprdReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptDetail' AND COLUMN_NAME='hprdDetailId')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ADD [hprdDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptDetail' AND COLUMN_NAME='hprdInvoiceID')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ADD [hprdInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptDetail' AND COLUMN_NAME='hprdProcessingId')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ADD [hprdProcessingId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptDetail' AND COLUMN_NAME='hprdProcessingDetailId')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ADD [hprdProcessingDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptDetail' AND COLUMN_NAME='hprdRentalAmount')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ADD [hprdRentalAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptDetail' AND COLUMN_NAME='hprdSettelmentAmount')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ADD [hprdSettelmentAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhCompanyID')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhShopID')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhReceiptID')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhReceiptNo')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhReceiptNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhReceiptDate')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhReceiptDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhReceiptType')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhReceiptType] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhinvBal')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhinvBal] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhReceiptAmount')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhReceiptAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhCustomerID')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhHPQuotationID')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhHPQuotationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhFinancialID')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhCancel')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhCancelRemarks')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhCancelRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhPosted')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhPosted] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhBankName')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhBankName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhRemarks')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhChequeNo')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhChequeNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhChequeDate')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhChequeDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhUsed')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhUsed] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhUserName')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhUserName] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhUpdateUserName')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhUpdateUserName] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhupdateTime')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhupdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhCounterID')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhCounterID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhTaxPercentage')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhTaxPercentage] [numeric] (18,9) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpReceiptHeader' AND COLUMN_NAME='hprhTaxCateID')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ADD [hprhTaxCateID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionDetail' AND COLUMN_NAME='hprdCompanyId')
BEGIN
	ALTER TABLE [losHpRepossessionDetail] ADD [hprdCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionDetail' AND COLUMN_NAME='hprdShopID')
BEGIN
	ALTER TABLE [losHpRepossessionDetail] ADD [hprdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionDetail' AND COLUMN_NAME='hprdRepossessionID')
BEGIN
	ALTER TABLE [losHpRepossessionDetail] ADD [hprdRepossessionID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionDetail' AND COLUMN_NAME='hprdDetailID')
BEGIN
	ALTER TABLE [losHpRepossessionDetail] ADD [hprdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionDetail' AND COLUMN_NAME='hprdItemID')
BEGIN
	ALTER TABLE [losHpRepossessionDetail] ADD [hprdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionDetail' AND COLUMN_NAME='hprdFairValue')
BEGIN
	ALTER TABLE [losHpRepossessionDetail] ADD [hprdFairValue] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionDetail' AND COLUMN_NAME='hprdCostValue')
BEGIN
	ALTER TABLE [losHpRepossessionDetail] ADD [hprdCostValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhCompanyID')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhShopID')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhRepossessionID')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhRepossessionID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhRepossessionNo')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhRepossessionNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhRepossessionDate')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhRepossessionDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhCustomerID')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhAgreementID')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhAgreementID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhRemarks')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhRemarks] [nvarchar] (500) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhFinancialID')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhCancel')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhCancelRemarks')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhCancelRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhPosted')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhPosted] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhUser')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhUpdatedUser')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhUpdatedUser] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpRepossessionHeader' AND COLUMN_NAME='hprhUpdatedTime')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ADD [hprhUpdatedTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleDetail' AND COLUMN_NAME='hpdCompanyID')
BEGIN
	ALTER TABLE [losHPResaleDetail] ADD [hpdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleDetail' AND COLUMN_NAME='hpdShopID')
BEGIN
	ALTER TABLE [losHPResaleDetail] ADD [hpdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleDetail' AND COLUMN_NAME='hpdResaleID')
BEGIN
	ALTER TABLE [losHPResaleDetail] ADD [hpdResaleID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleDetail' AND COLUMN_NAME='hpdResaleDetailID')
BEGIN
	ALTER TABLE [losHPResaleDetail] ADD [hpdResaleDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleDetail' AND COLUMN_NAME='hpdItemID')
BEGIN
	ALTER TABLE [losHPResaleDetail] ADD [hpdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleDetail' AND COLUMN_NAME='hpdRepossessionID')
BEGIN
	ALTER TABLE [losHPResaleDetail] ADD [hpdRepossessionID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleDetail' AND COLUMN_NAME='hpdFairValue')
BEGIN
	ALTER TABLE [losHPResaleDetail] ADD [hpdFairValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleDetail' AND COLUMN_NAME='hpdSellingPrice')
BEGIN
	ALTER TABLE [losHPResaleDetail] ADD [hpdSellingPrice] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphCompanyID')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphShopID')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphResaleID')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphResaleID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphResaleNo')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphResaleNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphFinancialID')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphResaleDate')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphResaleDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphCustomerID')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphCustomerName')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphCustomerName] [varchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphCancel')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphCancelRemarks')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphCancelRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphPosted')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphPosted] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphUser')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphUpdatedUser')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphUpdatedUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphUpdatedTime')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphUpdatedTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphCashAccID')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphRemarks')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphRemarks] [nvarchar] (250) CONSTRAINT [DF__losHPResa__hphRe__581DCE5D] DEFAULT ('w') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME='hphCustomerAddress')
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD [hphCustomerAddress] [varchar] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedShopID')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedExchangeID')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedExchangeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedExchangedetailID')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedExchangedetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedItemID')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedPackingTypeID')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedPUnitID')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedPUnitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedPQuantity')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedPQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedQuantity')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedUnitPrice')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedActualUnitPrice')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedActualUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedExchangePQty')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedExchangePQty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedExchangeQty')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedExchangeQty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedRateType')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedRateType] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedBillorExchange')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedBillorExchange] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedcostprice')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedblockprice')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedblockprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedguarantee')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedguarantee] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [rowguid] uniqueidentifier ROWGUIDCOL NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedSerialNo')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedSerialNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedFreeQty')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedFreeQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME='sedExcFreeQty')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD [sedExcFreeQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinquirydetail' AND COLUMN_NAME='idcompanyid')
BEGIN
	ALTER TABLE [losinquirydetail] ADD [idcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinquirydetail' AND COLUMN_NAME='idshopid')
BEGIN
	ALTER TABLE [losinquirydetail] ADD [idshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinquirydetail' AND COLUMN_NAME='idid')
BEGIN
	ALTER TABLE [losinquirydetail] ADD [idid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinquirydetail' AND COLUMN_NAME='iddetailid')
BEGIN
	ALTER TABLE [losinquirydetail] ADD [iddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinquirydetail' AND COLUMN_NAME='iditemid')
BEGIN
	ALTER TABLE [losinquirydetail] ADD [iditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinquirydetail' AND COLUMN_NAME='iditemname')
BEGIN
	ALTER TABLE [losinquirydetail] ADD [iditemname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinquirydetail' AND COLUMN_NAME='idcomments')
BEGIN
	ALTER TABLE [losinquirydetail] ADD [idcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihcompanyid')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihshopid')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihid')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihno')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihdate')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihcustid')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihcustid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihcustname')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihcustname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihcustaddress')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihcustaddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihcusttele')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihcusttele] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihremarks')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihupdatetime')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihupdatetime] datetime CONSTRAINT [DF_losInquiryHeader_ihupdatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihcancelled')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihcancelled] bit CONSTRAINT [DF_losInquiryHeader_ihcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihcancelledremarks')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihCreated')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihCreated] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihModified')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihModified] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME='ihTime')
BEGIN
	ALTER TABLE [losInquiryHeader] ADD [ihTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idShopID')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idInvoiceID')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idItemID')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idPackingTypeID')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idPUnitID')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idPUnitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idPQuantity')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idPQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idQuantity')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idUnitPrice')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idRateType')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idRateType] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idActualUnitPrice')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idActualUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idcostprice')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='iddescription')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [iddescription] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idblockprice')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idblockprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idguarantee')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idguarantee] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsInvoic__rowgu__6497E884] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idrebateamount')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idrebateamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idcorgin')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idcorgin] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idcconsignment')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idcconsignment] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idcdcomcur')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idcdcomcur] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idcdcustcur')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idcdcustcur] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idcdcomcurtocustoms')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idcdcomcurtocustoms] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idcdcustcurtocustoms')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idcdcustcurtocustoms] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idDeclaredPrice')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idDeclaredPrice] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idFreeQuantity')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idFreeQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idType')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idType] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idSerialNo')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idSerialNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idStatus')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idStatus] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idItemType')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idItemType] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idKitID')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idKitID] int CONSTRAINT [DF_losInvoiceDetail_idKitID] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idKitQuantity')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idKitQuantity] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idKitActualPrice')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idKitActualPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idCustomPrice')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idCustomPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idServWarrantyUpto')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idServWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idPartsWarrantyUpto')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idPartsWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idItemTaxPercentage')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idItemTaxAmount')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idItemTaxCategory')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idBillDetailID')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idBillDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME='idBillID')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD [idBillID] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvcompanyid')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdpartsid')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdpartsid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdshopid')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvinvoiceid')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvinvoiceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdrate')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdsellrate')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdsellrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdqty')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvreplfromsupp')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvreplfromsupp] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdguarantee')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdguarantee] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdcostprice')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdcostprice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdcomments')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvpackid')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvpackid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvpackqty')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvpackqty] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdetailid')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_losInvoicedPartsReplacedetails_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdType')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdType] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdSerialNo')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdSerialNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdItemTaxPercentage')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdItemTaxAmount')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME='repinvdItemTaxCategory')
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD [repinvdItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdcompanyid')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdinvoiceid')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdinvoiceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdshopid')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdserviceid')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdserviceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdcharge')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdcharge] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdchargetaken')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdchargetaken] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdcomments')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdqty')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdqty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvddetailid')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_losInvoicedServiceDetails_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdType')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdType] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdItemTaxPercentage')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdItemTaxAmount')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME='serinvdItemTaxCategory')
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD [serinvdItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihShopID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihInvoiceID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihInvoiceNo')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihInvoiceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihInvoiceDate')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihInvoiceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihReferenceNo')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihCustomerID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihProforma')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihProforma] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihCashInvoice')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihCashInvoice] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihBankcashAccID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihBankcashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihChequeNo')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihChequeNo] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihDueDate')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihDueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihRemarks')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihInvoiceAmount')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihInvoiceAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihDiscount')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihDiscountAccID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihDiscountAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihDepartmentID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihFinancialID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihCancelled')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihCancelledRemarks')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihExchangeNature')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihExchangeNature] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihCompanyId')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihCompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihPosted')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihProformaID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihProformaID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihRecAddUser')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihRecModifyUser')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihGoodsReturned')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihGoodsReturned] bit CONSTRAINT [DF_LOsInvoiceHeader_ihGoodsReturned] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihSalesAccID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihAdjustmentAmount')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihAdjustmentAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihSettled')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihSettled] bit CONSTRAINT [DF_LOsInvoiceHeader_ihSettled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihexchangerate')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihexchangerate] [numeric] (28,8) CONSTRAINT [DF_LOsInvoiceHeader_ihexchangerate] DEFAULT ((1)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihsettledamount')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihsettledamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihwholesale')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihwholesale] bit CONSTRAINT [DF_LOsInvoiceHeader_ihwholesale] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihfuturevc')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihfuturevc] [varchar] (250) CONSTRAINT [DF_LOsInvoiceHeader_ihfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOsInvoiceHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihsalespersonid')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihCustomerCardNo')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihCustomerCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsInvoic__rowgu__23D4EEA7] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihgstpercentage')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihgstpercentage] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihdutypaidby')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihdutypaidby] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihType')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihType] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihdepexrate')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihcustomsformno')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihcustomsformno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihexchangerates')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihtransfinished')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihtransfinished] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihCustomsDutyAccID')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihCustomsDutyAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihOptedVendorId')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihOptedVendorId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihReferred')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihReferred] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihDeliveryDate')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihDeliveryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihInvoiceTime')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihInvoiceTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ContactCardNo')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ContactCardNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihDeliveryNeeded')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihDeliveryNeeded] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihuserid')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihuserid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihModifyUserId')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihModifyUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihRefNo')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihRefNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ihCRMQuotationId')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ihCRMQuotationId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME='ExcludeGST')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD [ExcludeGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioShopID')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioInvoiceID')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioAccID')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioDescription')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioDescription] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioAmount')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioCompanyid')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioCompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsInvoic__rowgu__795DFB40] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioServTaxCateID')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioServTaxCateID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioServTaxPerc')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioServTaxPerc] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioServTaxRate')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioServTaxRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME='ioServTaxAmount')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD [ioServTaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrInvoiceId')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrInvoiceId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrShopId')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrCompanyId')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrPlanNo')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrPlanNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrRefNo')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrRefNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrNature')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrNature] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrProjectStartDate')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrProjectStartDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrProjectEndDate')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrProjectEndDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrOtherInfo')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrOtherInfo] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrCustomDutyByCustomer')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrCustomDutyByCustomer] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME='idrTransportation')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD [idrTransportation] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTShopID')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTInvoiceID')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTCompanyID')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTLocation')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTLocation] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTShippingService')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTShippingService] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTETA')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTETA] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTUSAForwarding')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTUSAForwarding] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTFreightAndHandling')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTFreightAndHandling] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTInsurance')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTInsurance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTCustomDuty')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTCustomDuty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTHandling')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTHandling] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTServiceCharge')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTServiceCharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTCustomPer')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTCustomPer] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosInvoiceST' AND COLUMN_NAME='ioSTServicePer')
BEGIN
	ALTER TABLE [LosInvoiceST] ADD [ioSTServicePer] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='isdShopid')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [isdShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='isdinvoiceid')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [isdinvoiceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='isditemid')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [isditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='isdsubitemid')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [isdsubitemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='isdpackingtypeid')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [isdpackingtypeid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='isdpquantity')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [isdpquantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='isdquantity')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [isdquantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='isdunitprice')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [isdunitprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='isdamount')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [isdamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsInvoic__rowgu__426F4FB7] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvcompanyid')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdpartsid')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdpartsid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdshopid')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvinvoiceid')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvinvoiceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdrate')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdsellrate')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdsellrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdqty')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvreplfromsupp')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvreplfromsupp] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdguarantee')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdguarantee] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdcostprice')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdcostprice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdcomments')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvpackid')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvpackid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvpackqty')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvpackqty] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdetailid')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losinvpar__rowgu__0C11A858] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdType')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdType] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdSerialNo')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdSerialNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdItemTaxPercentage')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdItemTaxAmount')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME='repinvdItemTaxCategory')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD [repinvdItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdcompanyid')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdinvoiceid')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdinvoiceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdshopid')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdserviceid')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdserviceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdcharge')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdcharge] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdchargetaken')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdchargetaken] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdcomments')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdqty')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdqty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvddetailid')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losinvser__rowgu__5733CBC5] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdType')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdType] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdItemTaxPercentage')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdItemTaxAmount')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME='serinvdItemTaxCategory')
BEGIN
	ALTER TABLE [losinvservicedetails] ADD [serinvdItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosIssuedby' AND COLUMN_NAME='Issuedid')
BEGIN
	ALTER TABLE [LosIssuedby] ADD [Issuedid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosIssuedby' AND COLUMN_NAME='Issuedby')
BEGIN
	ALTER TABLE [LosIssuedby] ADD [Issuedby] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losJobType' AND COLUMN_NAME='TypeId')
BEGIN
	ALTER TABLE [losJobType] ADD [TypeId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losJobType' AND COLUMN_NAME='TypeName')
BEGIN
	ALTER TABLE [losJobType] ADD [TypeName] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnDetail' AND COLUMN_NAME='krDReturnNoteID')
BEGIN
	ALTER TABLE [LosKegReturnDetail] ADD [krDReturnNoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnDetail' AND COLUMN_NAME='krDItemID')
BEGIN
	ALTER TABLE [LosKegReturnDetail] ADD [krDItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnDetail' AND COLUMN_NAME='krDShopid')
BEGIN
	ALTER TABLE [LosKegReturnDetail] ADD [krDShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnDetail' AND COLUMN_NAME='krDInvoiceId')
BEGIN
	ALTER TABLE [LosKegReturnDetail] ADD [krDInvoiceId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnDetail' AND COLUMN_NAME='krDQuantity')
BEGIN
	ALTER TABLE [LosKegReturnDetail] ADD [krDQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnDetail' AND COLUMN_NAME='krDDamaged')
BEGIN
	ALTER TABLE [LosKegReturnDetail] ADD [krDDamaged] bit CONSTRAINT [DF_LosKegReturnDetail_krDDamaged] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnDetail' AND COLUMN_NAME='krDRemarks')
BEGIN
	ALTER TABLE [LosKegReturnDetail] ADD [krDRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnDetail' AND COLUMN_NAME='krdCostPrice')
BEGIN
	ALTER TABLE [LosKegReturnDetail] ADD [krdCostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhShopid')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhKegReturnID')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhKegReturnID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhKegReturnNO')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhKegReturnNO] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhKegReturnDate')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhKegReturnDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhCustomerID')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhRemarks')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhCancel')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhCancel] bit CONSTRAINT [DF_LosKegReturnHeader_krhCancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhCancelledRemarks')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krCompanyID')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhDepartmentid')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [updatetime] datetime CONSTRAINT [DF_LosKegReturnHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME='krhExchangeRates')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD [krhExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='ClearenceReqID')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [ClearenceReqID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='ItemDescription')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [ItemDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='Unit')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [Unit] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [Qty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='NoofPackages')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [NoofPackages] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND COLUMN_NAME='Packing')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ADD [Packing] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='ClearenceReqID')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [ClearenceReqID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='ClearenceReqNo')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [ClearenceReqNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='ClearenceReqDate')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [ClearenceReqDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='PONo')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [PONo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='PODate')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [PODate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='DeliveryTo')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [DeliveryTo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='DeliveryDate')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [DeliveryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='EnteredBy')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [EnteredBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='CashorCredit')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [CashorCredit] bit CONSTRAINT [DF__losLocalC__Casho__1C3DEE80] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='CashPaidByShop')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [CashPaidByShop] bit CONSTRAINT [DF__losLocalC__CashP__1D3212B9] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [Cancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME='VendorName')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD [VendorName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdShopID')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdBillID')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdItemID')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdPOQuantity')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdPOQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdPOUnitPrice')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdPOUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdItemQuantity')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdItemQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdItemUnitPrice')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdItemUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LosLocalP__rowgu__6A50C1DA] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdItemActualAmount')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdItemActualAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdItemTaxPercentage')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdItemTaxAmount')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdItemTaxCategory')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME='lpdpackid')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD [lpdpackid] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphShopID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphBillID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphBillNo')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphVendorBillNo')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphVendorBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphBillDate')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphBillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphPOID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphPOID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphBillAmount')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphBillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphDiscount')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphDiscountAccID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphDiscountAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphDueDateforPayment')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphDueDateforPayment] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphBankcashAccID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphBankcashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphChequeNo')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphChequeNo] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphFinancialID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphDepartmentID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphRemarks')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphRemarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphCashPurchase')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphCashPurchase] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphExchangeNature')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphExchangeNature] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphCancelled')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphCancelledRemarks')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphPosted')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphRecAddUser')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphRecModifyUser')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphCompanyID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphUsed')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphUsed] bit CONSTRAINT [DF_LosLocalPurchaseHeader_lphUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphVendorID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphPurchaseAccID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphPurchaseAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphAdjustmentAmount')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphAdjustmentAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphSettled')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphSettled] bit CONSTRAINT [DF_LosLocalPurchaseHeader_lphSettled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphexchangerate')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphexchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphcbid')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphcosted')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphcosted] bit CONSTRAINT [DF_LosLocalPurchaseHeader_lphcosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphfuturevc')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphfuturevc] [varchar] (250) CONSTRAINT [DF_LosLocalPurchaseHeader_lphfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [updatetime] datetime CONSTRAINT [DF_LosLocalPurchaseHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LosLocalP__rowgu__67C004A0] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphdepexrate')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphexchangerates')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphBillTime')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphBillTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphVendorInvoiceNo')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphVendorInvoiceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphConfirmed')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphConfirmed] bit CONSTRAINT [DF__LosLocalP__lphCo__039C5DE8] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphUserID')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME='lphExcludeGST')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD [lphExcludeGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND COLUMN_NAME='lpoShopID')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] ADD [lpoShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND COLUMN_NAME='lpoBillID')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] ADD [lpoBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND COLUMN_NAME='lpoAccID')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] ADD [lpoAccID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND COLUMN_NAME='lpoDescription')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] ADD [lpoDescription] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND COLUMN_NAME='lpoAmount')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] ADD [lpoAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND COLUMN_NAME='lpoCompanyID')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] ADD [lpoCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsLocalP__rowgu__5708E33C] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocation' AND COLUMN_NAME='lshopiD')
BEGIN
	ALTER TABLE [loslocation] ADD [lshopiD] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocation' AND COLUMN_NAME='lLocationID')
BEGIN
	ALTER TABLE [loslocation] ADD [lLocationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocation' AND COLUMN_NAME='lLocationCode')
BEGIN
	ALTER TABLE [loslocation] ADD [lLocationCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocation' AND COLUMN_NAME='lLocationName')
BEGIN
	ALTER TABLE [loslocation] ADD [lLocationName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocation' AND COLUMN_NAME='lgroupid')
BEGIN
	ALTER TABLE [loslocation] ADD [lgroupid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocation' AND COLUMN_NAME='lcompanyid')
BEGIN
	ALTER TABLE [loslocation] ADD [lcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladinterfaceid')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladinterfaceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladshopid')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladtransid')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladtransid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='laddetailid')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [laddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladlocationid')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladlocationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='laditemid')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [laditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='laditemqty')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [laditemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladpackingtypeid')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladpackingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladpakingqty')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladpakingqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladcancel')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladcancel] bit CONSTRAINT [DF_loslocationarrivaldetails_ladcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladadjustment')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladadjustment] bit CONSTRAINT [DF_loslocationarrivaldetails_ladadjustment] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladfreeqty')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladfreeqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME='ladconfirmed')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD [ladconfirmed] int CONSTRAINT [DF__loslocati__ladco__78008E0A] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoslocationGroup' AND COLUMN_NAME='Lgcompanyid')
BEGIN
	ALTER TABLE [LoslocationGroup] ADD [Lgcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoslocationGroup' AND COLUMN_NAME='Lggroupid')
BEGIN
	ALTER TABLE [LoslocationGroup] ADD [Lggroupid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoslocationGroup' AND COLUMN_NAME='Lgshopid')
BEGIN
	ALTER TABLE [LoslocationGroup] ADD [Lgshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoslocationGroup' AND COLUMN_NAME='LgGroupName')
BEGIN
	ALTER TABLE [LoslocationGroup] ADD [LgGroupName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidinterfaceid')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidinterfaceid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidshopid')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidtransid')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidtransid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='liddetailid')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [liddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidlocationid')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidlocationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='liditemid')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [liditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='liditemqty')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [liditemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidpackingtypeid')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidpackingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidpakingqty')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidpakingqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidcancel')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidcancel] bit CONSTRAINT [DF_loslocationissuedetails_ladcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidadjustment')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidadjustment] bit CONSTRAINT [DF_loslocationissuedetails_lidadjustment] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidfreeqty')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidfreeqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME='lidconfirmed')
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD [lidconfirmed] int CONSTRAINT [DF__loslocati__lidco__78F4B243] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationDetail' AND COLUMN_NAME='lvdid')
BEGIN
	ALTER TABLE [losLocationVerificationDetail] ADD [lvdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationDetail' AND COLUMN_NAME='lvdShipmentID')
BEGIN
	ALTER TABLE [losLocationVerificationDetail] ADD [lvdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationDetail' AND COLUMN_NAME='lvditemid')
BEGIN
	ALTER TABLE [losLocationVerificationDetail] ADD [lvditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationDetail' AND COLUMN_NAME='lvdShopid')
BEGIN
	ALTER TABLE [losLocationVerificationDetail] ADD [lvdShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationDetail' AND COLUMN_NAME='lvdAvailStock')
BEGIN
	ALTER TABLE [losLocationVerificationDetail] ADD [lvdAvailStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationDetail' AND COLUMN_NAME='lvdVerifiedStock')
BEGIN
	ALTER TABLE [losLocationVerificationDetail] ADD [lvdVerifiedStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationDetail' AND COLUMN_NAME='lvdcostprice')
BEGIN
	ALTER TABLE [losLocationVerificationDetail] ADD [lvdcostprice] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationDetail' AND COLUMN_NAME='lvdPrevLocationID')
BEGIN
	ALTER TABLE [losLocationVerificationDetail] ADD [lvdPrevLocationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationDetail' AND COLUMN_NAME='lvdVerifiedLocationID')
BEGIN
	ALTER TABLE [losLocationVerificationDetail] ADD [lvdVerifiedLocationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhID')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhShopID')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhNo')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhDate')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhRemarks')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhVerifiedBy')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhVerifiedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhCancelled')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhCancelled] bit CONSTRAINT [DF__losLocati__lvhCa__129488B5] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhCancelRemarks')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhCancelRemarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhfuturevc')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhposted')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhposted] bit CONSTRAINT [DF__losLocati__lvhpo__1388ACEE] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhdepartmentid')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhconexrate')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhdepexrate')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhexchangerates')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhrecaddUser')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhrecaddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhrecmodUser')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhrecmodUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME='lvhTime')
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD [lvhTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losLPDetail] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='POID')
BEGIN
	ALTER TABLE [losLPDetail] ADD [POID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [losLPDetail] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='ItemDescription')
BEGIN
	ALTER TABLE [losLPDetail] ADD [ItemDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='Unit')
BEGIN
	ALTER TABLE [losLPDetail] ADD [Unit] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [losLPDetail] ADD [Qty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [losLPDetail] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [losLPDetail] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='Packing')
BEGIN
	ALTER TABLE [losLPDetail] ADD [Packing] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='NoofPackages')
BEGIN
	ALTER TABLE [losLPDetail] ADD [NoofPackages] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='ClrReqDetID')
BEGIN
	ALTER TABLE [losLPDetail] ADD [ClrReqDetID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME='status')
BEGIN
	ALTER TABLE [losLPDetail] ADD [status] [char] (1) CONSTRAINT [DF__losLPDeta__statu__0BD27C8D] DEFAULT ('D') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losLPHeader] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='POID')
BEGIN
	ALTER TABLE [losLPHeader] ADD [POID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='PONo')
BEGIN
	ALTER TABLE [losLPHeader] ADD [PONo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='PODate')
BEGIN
	ALTER TABLE [losLPHeader] ADD [PODate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [losLPHeader] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [losLPHeader] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='ClearenceReqID')
BEGIN
	ALTER TABLE [losLPHeader] ADD [ClearenceReqID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='EnteredBy')
BEGIN
	ALTER TABLE [losLPHeader] ADD [EnteredBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [losLPHeader] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='CashorCredit')
BEGIN
	ALTER TABLE [losLPHeader] ADD [CashorCredit] bit CONSTRAINT [DF__losLPHead__Casho__37E608F5] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='CashPaidByShop')
BEGIN
	ALTER TABLE [losLPHeader] ADD [CashPaidByShop] bit CONSTRAINT [DF__losLPHead__CashP__38DA2D2E] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [losLPHeader] ADD [Cancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [losLPHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME='vendorname')
BEGIN
	ALTER TABLE [losLPHeader] ADD [vendorname] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeDetails' AND COLUMN_NAME='lsdID')
BEGIN
	ALTER TABLE [LosMergeDetails] ADD [lsdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeDetails' AND COLUMN_NAME='lsdCompanyID')
BEGIN
	ALTER TABLE [LosMergeDetails] ADD [lsdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeDetails' AND COLUMN_NAME='lsdShopID')
BEGIN
	ALTER TABLE [LosMergeDetails] ADD [lsdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeDetails' AND COLUMN_NAME='lsdItemID')
BEGIN
	ALTER TABLE [LosMergeDetails] ADD [lsdItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeDetails' AND COLUMN_NAME='lsdQty')
BEGIN
	ALTER TABLE [LosMergeDetails] ADD [lsdQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeDetails' AND COLUMN_NAME='lsdDetailID')
BEGIN
	ALTER TABLE [LosMergeDetails] ADD [lsdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LosMergeDetails] ADD [rowguid] uniqueidentifier ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshID')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshCompanyID')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshShopID')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshNo')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshDate')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshRefMergeID')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshRefMergeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshItemID')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshTransFinished')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshTransFinished] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshCancelled')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshUpdatetime')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshUpdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshNoofRec')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshNoofRec] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='lshQty')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [lshQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosMergeHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LosMergeHeader] ADD [rowguid] uniqueidentifier ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losNonRestrictedItems' AND COLUMN_NAME='NorItemID')
BEGIN
	ALTER TABLE [losNonRestrictedItems] ADD [NorItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losNonRestrictedItems' AND COLUMN_NAME='Norshopid')
BEGIN
	ALTER TABLE [losNonRestrictedItems] ADD [Norshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losNonRestrictedItems' AND COLUMN_NAME='nortype')
BEGIN
	ALTER TABLE [losNonRestrictedItems] ADD [nortype] [char] (1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losNonRestrictedItems' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losNonRestrictedItems] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losNonRes__rowgu__5F29F348] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldShopId')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldId')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldDetailId')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldMarks')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldMarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldPacking')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldPacking] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldDescription')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldSize')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldSize] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldWeight')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldWeight] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldQty')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldQty] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListDetail' AND COLUMN_NAME='PldOrgin')
BEGIN
	ALTER TABLE [LosPackingListDetail] ADD [PldOrgin] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhShopId')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhPackListId')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhPackListId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhNo')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhDate')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhExportId')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhExportId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhConsigneeAdress')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhConsigneeAdress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhOtherRefNo')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhOtherRefNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhExporterRefNo')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhExporterRefNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhPreCarriageBy')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhPreCarriageBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhPlaceofReceipt')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhPlaceofReceipt] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhVessalNo')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhVessalNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhVoyageNo')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhVoyageNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhPortOfLoading')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhPortOfLoading] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhPortOfDisCharge')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhPortOfDisCharge] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhFinalDest')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhFinalDest] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhTotalPacks')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhTotalPacks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhTotalVolume')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhTotalVolume] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhTotalWeight')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhTotalWeight] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhTerms')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhTerms] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhRemarks')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhCancelled')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhCancelled] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhCancelledRemarks')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPackingListHeader' AND COLUMN_NAME='plhExporterAddress')
BEGIN
	ALTER TABLE [LosPackingListHeader] ADD [plhExporterAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND COLUMN_NAME='pdPaymentVoucherID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] ADD [pdPaymentVoucherID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND COLUMN_NAME='pdPaymentID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] ADD [pdPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND COLUMN_NAME='pdShopID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] ADD [pdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND COLUMN_NAME='pdBillsID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] ADD [pdBillsID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND COLUMN_NAME='pdPaidAmount')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] ADD [pdPaidAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND COLUMN_NAME='pdDuePeriod')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] ADD [pdDuePeriod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsPaymen__rowgu__7F16D496] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phPaymentID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phPaymentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phShopID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phCompanyID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phPaymentNo')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phPaymentNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phPaymentDate')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phPaymentDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phRemarks')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phBankCashID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phBankCashID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phPayee')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phPayee] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phVendorID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phDepartmentID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phCustomerID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phChequeDetails')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phChequeDetails] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phPosted')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phCancelled')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phCancelledRemarks')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phAmount')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phFinancialID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phExchangeNature')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phExchangeNature] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phcbreferenceno')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phcbreferenceno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phExchangeRate')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phcustomeramount')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phcustomeramount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phdebitaccountid')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phdebitaccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phdebitamount')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phdebitamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phchequedate')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phchequedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phcbid')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phfuturevc')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phfuturevc] [varchar] (250) CONSTRAINT [DF_LOsPaymentVoucherHeader_phfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOsPaymentVoucherHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsPaymen__rowgu__35F39EE2] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phdepexrate')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phexchangerates')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME='phUserID')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD [phUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='PosChequeId')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [PosChequeId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='PoshBillID')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [PoshBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='PoshShopID')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [PoshShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='PosBankId')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [PosBankId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='PosBankChequeNo')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [PosBankChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='PosBankChequeDate')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [PosBankChequeDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='PosBankAmount')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [PosBankAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='PosChequeUsed')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [PosChequeUsed] bit CONSTRAINT [DF_losPosChequeDetails_PosChequeUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='posCompExRate')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [posCompExRate] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME='posDeptExRate')
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD [posDeptExRate] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdShopID')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdBillID')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdItemID')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdPackingTypeID')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdPUnitID')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdPUnitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdPQuantity')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdPQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdQuantity')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdUnitPrice')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdRateType')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdRateType] int CONSTRAINT [DF_LOsPosDetail_posdRateType] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdActualUnitPrice')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdActualUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdcostprice')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posddescription')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posddescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdblockprice')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdblockprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdguarantee')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdguarantee] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsPosDet__rowgu__384F51F2] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdSerialNo')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdSerialNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdFreeQuantity')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdFreeQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdItemSerialNo')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdItemSerialNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdKitID')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdKitID] int CONSTRAINT [DF_losPosDetail_posdKitID] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdKitQuantity')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdKitQuantity] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdKitActualPrice')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdKitActualPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdServWarrantyUpto')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdServWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdPartsWarrantyUpto')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdPartsWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdItemTaxPercentage')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdItemTaxAmount')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdItemTaxCategory')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdBillDetailID')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdBillDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME='posdItemType')
BEGIN
	ALTER TABLE [LOsPosDetail] ADD [posdItemType] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdShopID')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdBillID')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdItemID')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdPackingTypeID')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdPUnitID')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdPUnitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdPQuantity')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdPQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdQuantity')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdUnitPrice')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdRateType')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdRateType] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdActualUnitPrice')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdActualUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdcostprice')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posddescription')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posddescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdblockprice')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdblockprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdguarantee')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdguarantee] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [rowguid] uniqueidentifier ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdSerialNo')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdSerialNo] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdFreeQuantity')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdFreeQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdItemSerialNo')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdItemSerialNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdItemTaxPercentage')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdItemTaxPercentage] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdItemTaxAmount')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdItemTaxCategory')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME='posdBillDetailID')
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD [posdBillDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshShopID')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshBillID')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshBillNo')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshBillDate')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshBillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshCustomerName')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshCustomerName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshCancelled')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshCancelledRemarks')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshRecAddUser')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshRecModifyUser')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshPosted')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshDiscount')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshBillAmount')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshBillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshCashAccID')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshSalesAccID')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshCompanyID')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshReturned')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshReturned] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshWholesale')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshWholesale] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshcbid')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshExchangeRate')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshExchangeRate] [numeric] (28,8) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshfuturevc')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [updatetime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshDepartmentid')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshsalespersonid')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshcustomerid')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshCustomerCardNo')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshCustomerCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshfutureint')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshcurexrates')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshcurexrates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [rowguid] uniqueidentifier ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshdepexrate')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshexchangerates')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshUserId')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshCounterId')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshCounterId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='ContactCardNo')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [ContactCardNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshDiscountAmt')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshDiscountAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshBalance')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshBillTime')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshBillTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshbilled')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshbilled] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshconfirmed')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshconfirmed] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyHeader' AND COLUMN_NAME='poshBilledId')
BEGIN
	ALTER TABLE [LOsPosdummyHeader] ADD [poshBilledId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedShopID')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedExchangeID')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedExchangeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedExchangedetailID')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedExchangedetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedItemID')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedPackingTypeID')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedPUnitID')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedPUnitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedPQuantity')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedPQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedQuantity')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedUnitPrice')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedActualUnitPrice')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedActualUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedExchangePQty')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedExchangePQty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedExchangeQty')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedExchangeQty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedRateType')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedRateType] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedBillorExchange')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedBillorExchange] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedcostprice')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedblockprice')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedblockprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedguarantee')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedguarantee] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losposExc__rowgu__05306BF6] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedSerialNo')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedSerialNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedFreeQty')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedFreeQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedExcFreeQty')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedExcFreeQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedItemTaxPercentage')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedItemTaxAmount')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedItemTaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='sedItemTaxCategory')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [sedItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='SedServWarrantyUpto')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [SedServWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME='SedPartsWarrantyUpto')
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD [SedPartsWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehShopID')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehExchangeID')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehExchangeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehExchangeNo')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehExchangeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehExchangeDate')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehExchangeDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehExchangerName')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehExchangerName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehBillID')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehDiscount')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehBillAmount')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehBillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehExchangeBillAmount')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehExchangeBillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehRemarks')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehCancelled')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehCancelledRemarks')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehPosted')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehRecAddUser')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehRecModifyUser')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehCashAccID')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehSalesAccID')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehCompanyID')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehFullyReturned')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehFullyReturned] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehwholesale')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehwholesale] bit CONSTRAINT [DF_losposExchangeHeader_sehwholesale] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehcbid')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehExchangeRate')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehExchangeRate] [numeric] (28,8) CONSTRAINT [DF_losposExchangeHeader_sehExchangeRate] DEFAULT ((1)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehfuturevc')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehfuturevc] [varchar] (250) CONSTRAINT [DF_losposExchangeHeader_sehfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [updatetime] datetime CONSTRAINT [DF_losposExchangeHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehExchangedBillID')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehExchangedBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehDepartmentID')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehsalespersonid')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehCustomerCardNo')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehCustomerCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losposExc__rowgu__52C4E7BA] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehdepexrate')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehexchangerates')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehTime')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME='sehUserID')
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD [sehUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND COLUMN_NAME='seoShopID')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] ADD [seoShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND COLUMN_NAME='seoExchangeID')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] ADD [seoExchangeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND COLUMN_NAME='seoAccID')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] ADD [seoAccID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND COLUMN_NAME='seoDescription')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] ADD [seoDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND COLUMN_NAME='seoAmount')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] ADD [seoAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND COLUMN_NAME='seoCompanyID')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] ADD [seoCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losposExc__rowgu__52F9F1E4] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidShopID')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidExchangeID')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidExchangeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidExchangeDetailID')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidExchangeDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidItemID')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidSubItemID')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidSubItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidPackingTypeID')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidPQuantity')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidPQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidQuantity')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidUnitPrice')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='seidAmount')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [seidAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losposExc__rowgu__10A21EA2] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshShopID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshBillID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshBillNo')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshBillDate')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshBillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshCustomerName')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshCustomerName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshCancelled')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshCancelledRemarks')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshRecAddUser')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshRecModifyUser')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshPosted')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshDiscount')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshDiscount] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshBillAmount')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshBillAmount] [decimal] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshCashAccID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshSalesAccID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshCompanyID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshReturned')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshReturned] bit CONSTRAINT [DF_LosPosFAndBHeader_poshReturned] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshWholesale')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshWholesale] bit CONSTRAINT [DF_LosPosFAndBHeader_poshWholesale] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshcbid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshExchangeRate')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshExchangeRate] [decimal] (28,8) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshfuturevc')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshfuturevc] [varchar] (250) CONSTRAINT [DF_LosPosFAndBHeader_poshfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [updatetime] datetime CONSTRAINT [DF_LosPosFAndBHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshDepartmentid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshsalespersonid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshCustomerCardNo')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshCustomerCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshbillorprocess')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshbillorprocess] [char] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshfutureint')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshtableid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshtableid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshemployeeid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshemployeeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshdiscid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshdiscid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshdiscper')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshdiscper] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshservicechargeid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshservicechargeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshservicechargeper')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshservicechargeper] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshtaxaccid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshtaxaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshcentraltaxaccid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshcentraltaxaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshtaxper')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshtaxper] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshcustomerid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshcustdiscount')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshcustdiscount] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='roomdetailid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [roomdetailid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshgbillno')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshgbillno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshgbilldate')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshgbilldate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='Billedto')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [Billedto] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='receipted')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [receipted] bit CONSTRAINT [DF_LosPosFAndBHeader_receipted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshfolioid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshfolioid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='salesbillbit')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [salesbillbit] bit CONSTRAINT [DF_LosPosFAndBHeader_salesbillbit] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshremarks')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshcash')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshcash] bit CONSTRAINT [DF_LosPosFAndBHeader_poshcash] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='complimentary')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [complimentary] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshCreditCardNo')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshCreditCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='PoshBuffetBit')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [PoshBuffetBit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='PoshMealnameid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [PoshMealnameid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshgBillUser')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshgBillUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshtelephone')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshtelephone] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='cashreceiptid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [cashreceiptid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshmiscbillrefno')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshmiscbillrefno] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='closebill')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [closebill] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshservicecharge')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshservicecharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshAccAuditid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshAccAuditid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshSettled')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshSettled] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='PoshStatus')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [PoshStatus] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshtips')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshtips] [decimal] (8,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshBillType')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshBillType] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='PoshBillCount')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [PoshBillCount] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshGrossTotal')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshGrossTotal] [numeric] (8,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshServiceID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshServiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshDishTakenPax')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshDishTakenPax] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshCashSale')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshCashSale] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshexchangerates')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshexchangerates] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshdepexrate')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshdepexrate] [numeric] (18,8) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshvoucherid')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshvoucherid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshCurrencyID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshCurrencyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshRateType')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshRateType] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshFinancialId')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshFinancialId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshFlightID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshFlightID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshTillID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshTillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshFlightOpID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshFlightOpID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshTillHistID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshTillHistID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshUserID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshVoucherAmt')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshVoucherAmt] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='PoshCounterID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [PoshCounterID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshSegID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD [poshSegID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshShopID')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshBillID')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshBillNo')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshBillDate')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshBillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshCustomerName')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshCustomerName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshCancelled')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshCancelledRemarks')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshRecAddUser')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshRecModifyUser')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshPosted')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshDiscount')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshBillAmount')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshBillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshCashAccID')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshSalesAccID')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshCompanyID')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshReturned')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshReturned] bit CONSTRAINT [DF_LOsPosHeader_poshReturned] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshWholesale')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshWholesale] bit CONSTRAINT [DF_LOsPosHeader_poshWholesale] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshcbid')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshExchangeRate')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshExchangeRate] [numeric] (28,8) CONSTRAINT [DF_LOsPosHeader_poshExchangeRate] DEFAULT ((1)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshfuturevc')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOsPosHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshDepartmentid')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshsalespersonid')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshcustomerid')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshCustomerCardNo')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshCustomerCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshfutureint')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshcurexrates')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshcurexrates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsPosHea__rowgu__2937F6EB] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshdepexrate')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshexchangerates')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshUserId')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshCounterId')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshCounterId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='ContactCardNo')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [ContactCardNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshDiscountAmt')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshDiscountAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshBalance')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshBillTime')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshBillTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshDeliveryNeeded')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshDeliveryNeeded] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshChequeAccID')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshChequeAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='PosPostDate')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [PosPostDate] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshModifyUserId')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshModifyUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME='poshCustomerTIN')
BEGIN
	ALTER TABLE [LOsPosHeader] ADD [poshCustomerTIN] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosHeaderLastBillNo' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [losPosHeaderLastBillNo] ADD [ShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosHeaderLastBillNo' AND COLUMN_NAME='LastBillNo')
BEGIN
	ALTER TABLE [losPosHeaderLastBillNo] ADD [LastBillNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosOthercharges' AND COLUMN_NAME='posoShopID')
BEGIN
	ALTER TABLE [LOsPosOthercharges] ADD [posoShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosOthercharges' AND COLUMN_NAME='posoBillID')
BEGIN
	ALTER TABLE [LOsPosOthercharges] ADD [posoBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosOthercharges' AND COLUMN_NAME='posoAccID')
BEGIN
	ALTER TABLE [LOsPosOthercharges] ADD [posoAccID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosOthercharges' AND COLUMN_NAME='posoDescription')
BEGIN
	ALTER TABLE [LOsPosOthercharges] ADD [posoDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosOthercharges' AND COLUMN_NAME='posoAmount')
BEGIN
	ALTER TABLE [LOsPosOthercharges] ADD [posoAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosOthercharges' AND COLUMN_NAME='posoCompanyID')
BEGIN
	ALTER TABLE [LOsPosOthercharges] ADD [posoCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosOthercharges' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPosOthercharges] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsPosOth__rowgu__605D434C] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='posidshopid')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [posidshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='posidbillid')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [posidbillid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='posiditemid')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [posiditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='posidsubitemid')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [posidsubitemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='posidpackingtypeid')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [posidpackingtypeid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='posidpquantity')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [posidpquantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='posidquantity')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [posidquantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='posidunitprice')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [posidunitprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='posidamount')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [posidamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsPosSub__rowgu__070CFC19] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME='WDCompanyID')
BEGIN
	ALTER TABLE [losposWarDet] ADD [WDCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME='WDShopID')
BEGIN
	ALTER TABLE [losposWarDet] ADD [WDShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME='WDBillId')
BEGIN
	ALTER TABLE [losposWarDet] ADD [WDBillId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME='WDItemId')
BEGIN
	ALTER TABLE [losposWarDet] ADD [WDItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME='WDSerialNo')
BEGIN
	ALTER TABLE [losposWarDet] ADD [WDSerialNo] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME='WDSerMonths')
BEGIN
	ALTER TABLE [losposWarDet] ADD [WDSerMonths] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME='WDPartMonths')
BEGIN
	ALTER TABLE [losposWarDet] ADD [WDPartMonths] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME='WDDesc')
BEGIN
	ALTER TABLE [losposWarDet] ADD [WDDesc] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losposWarDet] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losposWarDet__rowgu__2937F6EB] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdBillID')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdItemID')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdDetailID')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdPackingTypeID')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdPackingTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdPOQuantity')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdPOQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdPOUnitPrice')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdPOUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdItemQuantity')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdItemQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdItemUnitPrice')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdItemUnitPrice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdDummyUnitPrice')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdDummyUnitPrice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdItemCostedPrice')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdItemCostedPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdItemFixedPrice')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdItemFixedPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbddiscount')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbddiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdpoid')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdpoid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdsellingprice')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdsellingprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdwholesaleprice')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdwholesaleprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbddiscountprice')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbddiscountprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdbatchno')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdbatchno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdItemTaxPercentage')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdItemTaxAmount')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdItemTaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME='pbdItemTaxCategory')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD [pbdItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhBillID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhBillNo')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhVendorBillNo')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhVendorBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhBillDate')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhBillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhVendorID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhPOID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhPOID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhBillAmount')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhBillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhDiscount')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhDiscountAccID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhDiscountAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhAdjustmentAmount')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhAdjustmentAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhDueDateforPayment')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhDueDateforPayment] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhBankCashAccID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhBankCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhChequeNo')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhChequeNo] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhFinancialID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhDepartmentID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhRemarks')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhRemarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhTobeDespatched')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhTobeDespatched] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhDespatched')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhDespatched] bit CONSTRAINT [DF_LOspPurchaseBillHeader_pbhDespatched] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhCashPurchase')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhCashPurchase] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhExchangeNature')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhExchangeNature] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhCancelled')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhCancelledRemarks')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhPosted')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhRecAddUser')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhRecModifyUser')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhCompanyID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhUsed')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhUsed] bit CONSTRAINT [DF_LOspPurchaseBillHeader_pbhUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhvendorRefNo')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhvendorRefNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhdummyICost')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhdummyICost] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhdummyFCharge')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhdummyFCharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhdummyOCharge')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhdummyOCharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhCustomExchangeRate')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhCustomExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhPurchaseAccID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhPurchaseAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhSettled')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhSettled] bit CONSTRAINT [DF_LOspPurchaseBillHeader_pbhSettled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhexchangerate')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhexchangerate] [numeric] (28,22) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhship')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhship] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhportoflading')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhportoflading] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhshipdepdate')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhshipdepdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhshipdischarge')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhshipdischarge] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhshiparrivaldate')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhshiparrivaldate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhfinaldestination')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhfinaldestination] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOspPurchaseBillHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhdepexrate')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhinvaccexrate')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhinvaccexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhslndcertno')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhslndcertno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhslndcertdate')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhslndcertdate] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhComments')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhComments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhexchangerates')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhLcAmount')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhLcAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhBillTime')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhBillTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhSubDepartmentID')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhSubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME='pbhusername')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD [pbhusername] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillOC' AND COLUMN_NAME='pboBillID')
BEGIN
	ALTER TABLE [LOspPurchaseBillOC] ADD [pboBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillOC' AND COLUMN_NAME='pboAccID')
BEGIN
	ALTER TABLE [LOspPurchaseBillOC] ADD [pboAccID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillOC' AND COLUMN_NAME='pboDescription')
BEGIN
	ALTER TABLE [LOspPurchaseBillOC] ADD [pboDescription] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillOC' AND COLUMN_NAME='pboCompanyID')
BEGIN
	ALTER TABLE [LOspPurchaseBillOC] ADD [pboCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillOC' AND COLUMN_NAME='pboAmount')
BEGIN
	ALTER TABLE [LOspPurchaseBillOC] ADD [pboAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPriority' AND COLUMN_NAME='Priorityid')
BEGIN
	ALTER TABLE [LosPriority] ADD [Priorityid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPriority' AND COLUMN_NAME='Priority')
BEGIN
	ALTER TABLE [LosPriority] ADD [Priority] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podPoid')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podPoid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='poditemid')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [poditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podShopid')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podQty')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podUnitPrice')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losPurcha__rowgu__2A212E2C] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podActualAmt')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podActualAmt] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podpackid')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podpackid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podItemTaxPercentage')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podItemTaxAmount')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podItemTaxCategory')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME='podpackqty')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD [podpackqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohPoid')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohPoid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohShopid')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohpono')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohpono] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohnoSupwise')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohnoSupwise] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohPodate')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohPodate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohVendorID')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohSupAddr')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohSupAddr] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohdueDate')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohdueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohdeliveryaddr')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohdeliveryaddr] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohcancel')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohcancel] bit CONSTRAINT [DF_losPurchaseOrderHeader_pohcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohcancelremarks')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohcancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohrecadduser')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohrecadduser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohrecmoduser')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohrecmoduser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohbillgenerated')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohbillgenerated] bit CONSTRAINT [DF_losPurchaseOrderHeader_pohbillgenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohremarks')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohQuotation')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohQuotation] bit CONSTRAINT [DF_losPurchaseOrderHeader_pohPocheck] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohValue')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohValue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pogenerated')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pogenerated] bit CONSTRAINT [DF_losPurchaseOrderHeader_pogenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohpogenerated')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohpogenerated] bit CONSTRAINT [DF_losPurchaseOrderHeader_pohpogenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohQuotationid')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohQuotationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohCompanyID')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohExchangeRate')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohExchangeRate] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohfuturevc')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohfuturevc] [varchar] (250) CONSTRAINT [DF_losPurchaseOrderHeader_pohfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [updatetime] datetime CONSTRAINT [DF_losPurchaseOrderHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losPurcha__rowgu__2FDA0782] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohdepexrate')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohexchangerates')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohdiscount')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohdiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohmodepayment')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohmodepayment] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohTime')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohPOclosed')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohPOclosed] bit CONSTRAINT [DF__lospurcha__pohPO__71DDA060] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='poHQConfirmed')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [poHQConfirmed] int CONSTRAINT [DF__losPurcha__poHQC__56E9B302] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME='pohExcludeGST')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD [pohExcludeGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnDetail' AND COLUMN_NAME='wdShopID')
BEGIN
	ALTER TABLE [LOsPurchaseReturnDetail] ADD [wdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnDetail' AND COLUMN_NAME='WdID')
BEGIN
	ALTER TABLE [LOsPurchaseReturnDetail] ADD [WdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnDetail' AND COLUMN_NAME='WdItemID')
BEGIN
	ALTER TABLE [LOsPurchaseReturnDetail] ADD [WdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnDetail' AND COLUMN_NAME='WdShipmentID')
BEGIN
	ALTER TABLE [LOsPurchaseReturnDetail] ADD [WdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnDetail' AND COLUMN_NAME='WdAvailableQty')
BEGIN
	ALTER TABLE [LOsPurchaseReturnDetail] ADD [WdAvailableQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnDetail' AND COLUMN_NAME='WdPurchaseReturnQty')
BEGIN
	ALTER TABLE [LOsPurchaseReturnDetail] ADD [WdPurchaseReturnQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnDetail' AND COLUMN_NAME='wdcostprice')
BEGIN
	ALTER TABLE [LOsPurchaseReturnDetail] ADD [wdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPurchaseReturnDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_LOsPurchaseReturnDetail_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whShopID')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='WhID')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [WhID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='WhNo')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [WhNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='WhDate')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [WhDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='WhUserName')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [WhUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='WhCancelled')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [WhCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='WhCancelledRemarks')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [WhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='WhRemarks')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [WhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='WhRecAddUser')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [WhRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='WhRecModifyUser')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [WhRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='Whfuturevc')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [Whfuturevc] [varchar] (250) CONSTRAINT [DF_LOsPurchaseReturnHeader_Whfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whposted')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whposted] bit CONSTRAINT [DF_LOsPurchaseReturnHeader_whposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOsPurchaseReturnHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whdepartmentid')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whconexrate')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whdepexrate')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whexchangerates')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whotherdepid')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whotherdepid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whreceivedby')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whreceivedby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whauthorisedby')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whauthorisedby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whtype')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whtype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_LOsPurchaseReturnHeader_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whexpenseaccid')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whexpenseaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whapartmentid')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whapartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whdoneby')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whdoneby] [varchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whtransfinished')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whtransfinished] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whselected')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whselected] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME='whtime')
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD [whtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmdetail' AND COLUMN_NAME='rcdshopid')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ADD [rcdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmdetail' AND COLUMN_NAME='rcdapprovedid')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ADD [rcdapprovedid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmdetail' AND COLUMN_NAME='rcddetailid')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ADD [rcddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmdetail' AND COLUMN_NAME='rcditemid')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ADD [rcditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmdetail' AND COLUMN_NAME='rcdrebateamount')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ADD [rcdrebateamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmdetail' AND COLUMN_NAME='rcdCostPrice')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ADD [rcdCostPrice] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmdetail' AND COLUMN_NAME='rcdQuantity')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ADD [rcdQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmdetail' AND COLUMN_NAME='rcdUnitPrice')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ADD [rcdUnitPrice] [numeric] (18,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmdetail' AND COLUMN_NAME='rcdRebatePer')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ADD [rcdRebatePer] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rcshopid')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rcshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rcapprovedid')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rcapprovedid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rcapprovedno')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rcapprovedno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rcapproveddate')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rcapproveddate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rcreqid')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rcreqid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rcapprovedby')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rcapprovedby] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rcremarks')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rcremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rccancelled')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rccancelled] bit CONSTRAINT [DF_losrebateconfirmheader_rccancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rccancelledremarks')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rccancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rcCustomerSalesMargin')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rcCustomerSalesMargin] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME='rcRebatePerson')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD [rcRebatePerson] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrshopid')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrreqid')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrreqid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrreqno')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrreqno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrreqdate')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrreqdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrpoid')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrpoid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrsalespersonid')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrremarks')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrtoapprovebefore')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrtoapprovebefore] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrcancelled')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrcancelled] bit CONSTRAINT [DF_losrebaterequest_rrcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrcancelledremarks')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrRebatePerson')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrRebatePerson] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME='rrreqTIME')
BEGIN
	ALTER TABLE [losrebaterequest] ADD [rrreqTIME] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME='rdReceiptDetailID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD [rdReceiptDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME='rdReceiptID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD [rdReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME='rdShopID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD [rdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME='rdAccountsInvoiceID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD [rdAccountsInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME='rdInvoiceID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD [rdInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME='rdSpecialInvoiceID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD [rdSpecialInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME='rdAmountReceived')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD [rdAmountReceived] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME='rdDuePeriod')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD [rdDuePeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsReceip__rowgu__04CFADEC] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhReceiptID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhShopID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhReceiptNo')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhReceiptNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhReceiptDate')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhReceiptDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhCustomerID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhVendorID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhDepartmentID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhBankCashAccountID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhBankCashAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhReceivedFrom')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhReceivedFrom] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhRemarks')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhChequeDetails')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhChequeDetails] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhReferenceNo')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhReferenceDate')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhReferenceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhPosted')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhPosted] bit CONSTRAINT [DF_LOsReceiptVoucherHeader_rhPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhCancelled')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhCancelled] bit CONSTRAINT [DF_LOsReceiptVoucherHeader_rhCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhCancelledRemarks')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhAmount')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhFinancialID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhExchangeNature')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhExchangeNature] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhRecAddUser')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhRecModifyUser')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhCompanyID')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhcbreferenceno')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhcbreferenceno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhExchangeRate')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhReceiptType')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhReceiptType] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhcustomeramount')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhcustomeramount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhdebitaccountid')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhdebitaccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhdebitamount')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhdebitamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhchequedate')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhchequedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rhfuturevc')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rhfuturevc] [varchar] (250) CONSTRAINT [DF_LOsReceiptVoucherHeader_rhfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOsReceiptVoucherHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsReceip__rowgu__08EBEE41] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReceivedby' AND COLUMN_NAME='Receivedid')
BEGIN
	ALTER TABLE [LosReceivedby] ADD [Receivedid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReceivedby' AND COLUMN_NAME='Receivedby')
BEGIN
	ALTER TABLE [LosReceivedby] ADD [Receivedby] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='reprecdid')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [reprecdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='reprecdcompanyid')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [reprecdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='reprecdshopid')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [reprecdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='reprecditemid')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [reprecditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='reprecdbookid')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [reprecdbookid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='repRepReqID')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [repRepReqID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='reprecqty')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [reprecqty] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='reprecdtagno')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [reprecdtagno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='reprecdcomments')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [reprecdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='repreqdfutureint')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [repreqdfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='repreqdfuturevc')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [repreqdfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='repreqdfuturenum')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [repreqdfuturenum] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losreplac__rowgu__0658CF02] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprechid')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprechid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprechcompanyid')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprechcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprechshopid')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprechshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprechno')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprechno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprechdate')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprechdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprechremarks')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprechremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprechcancelled')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprechcancelled] bit CONSTRAINT [DF_losreplacereceiveheader_reprechcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='repreccancelremarks')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [repreccancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprecfutureint')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprecfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprecfuturevc')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprecfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprecfuturenum')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprecfuturenum] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprechupdatetime')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprechupdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losreplac__rowgu__34A9A997] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME='reprechqreceiveid')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD [reprechqreceiveid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqdid')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqdcompanyid')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqdshopid')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqditemid')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqdbookid')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqdbookid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqqty')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqqty] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqdtagno')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqdtagno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqdcomments')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqdfutureint')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqdfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqdfuturevc')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqdfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='repreqdfuturenum')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [repreqdfuturenum] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losreplac__rowgu__5C629536] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhid')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhcompanyid')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqshopid')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqno')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhdate')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhvendorid')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhvendorid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhremarks')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhcancelled')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhcancelled] bit CONSTRAINT [DF_losreplacerequestheader_repreqhcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhdoneby')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhdoneby] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqcancelremarks')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqcancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhreceived')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhreceived] bit CONSTRAINT [DF_losreplacerequestheader_repreqhreceived] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhfutureint')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhfuturevc')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhfuturenum')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhfuturenum] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhupdatetime')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhupdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losreplac__rowgu__758348BB] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhtransfinished')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhtransfinished] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhnoofdetails')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhnoofdetails] int CONSTRAINT [DF__losreplac__repre__387A3A7B] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhdepartmentid')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME='repreqhTime')
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD [repreqhTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcompanyid')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhshopid')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhreservationid')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhreservationid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhreservationno')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhreservationno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhreservationdate')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhreservationdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcustomerid')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcustomerfirstname')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcustomerfirstname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcustomerlastname')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcustomerlastname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcustomeraddress1')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcustomeraddress1] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcustomeraddress2')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcustomeraddress2] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcityid')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcityid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcountryid')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcountryid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhpassportno')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhpassportno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhworkpermitvisano')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhworkpermitvisano] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhvisaexpirydate')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhvisaexpirydate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rharrivaldate')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rharrivaldate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhdeparturedate')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhdeparturedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhreservationstatus')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhreservationstatus] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhrhreservationconfirmbit')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhrhreservationconfirmbit] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhreservationconfirmdate')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhreservationconfirmdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcancellationcheck')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcancellationcheck] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhcancellationdate')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhcancellationdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhApartmentTypeID')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhApartmentTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhNoOFBeds')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhNoOFBeds] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhBookingType')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhBookingType] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhCallAttendedBy')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhCallAttendedBy] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhExpRent')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhExpRent] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhStayType')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhStayType] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhRemarks')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhCancelledRemarks')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReservationHeader' AND COLUMN_NAME='rhPPExpiryDate')
BEGIN
	ALTER TABLE [LosReservationHeader] ADD [rhPPExpiryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReserveItem' AND COLUMN_NAME='godownid')
BEGIN
	ALTER TABLE [LosReserveItem] ADD [godownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReserveItem' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [LosReserveItem] ADD [itemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReserveItem' AND COLUMN_NAME='locationid')
BEGIN
	ALTER TABLE [LosReserveItem] ADD [locationid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReserveItem' AND COLUMN_NAME='shipmentid')
BEGIN
	ALTER TABLE [LosReserveItem] ADD [shipmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReserveItem' AND COLUMN_NAME='qty')
BEGIN
	ALTER TABLE [LosReserveItem] ADD [qty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReserveItem' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LosReserveItem] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LosReserv__rowgu__386F4D83] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losroomdetail' AND COLUMN_NAME='rdcompanyid')
BEGIN
	ALTER TABLE [losroomdetail] ADD [rdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losroomdetail' AND COLUMN_NAME='rdapartmentid')
BEGIN
	ALTER TABLE [losroomdetail] ADD [rdapartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losroomdetail' AND COLUMN_NAME='rdshopid')
BEGIN
	ALTER TABLE [losroomdetail] ADD [rdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losroomdetail' AND COLUMN_NAME='rdroomdetailid')
BEGIN
	ALTER TABLE [losroomdetail] ADD [rdroomdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losroomdetail' AND COLUMN_NAME='rdroomno')
BEGIN
	ALTER TABLE [losroomdetail] ADD [rdroomno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losroomdetail' AND COLUMN_NAME='rdCapacity')
BEGIN
	ALTER TABLE [losroomdetail] ADD [rdCapacity] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losroomdetail' AND COLUMN_NAME='rdremarks')
BEGIN
	ALTER TABLE [losroomdetail] ADD [rdremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerCallBconditiondetails' AND COLUMN_NAME='CallBcndserbookdid')
BEGIN
	ALTER TABLE [losSerCallBconditiondetails] ADD [CallBcndserbookdid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerCallBconditiondetails' AND COLUMN_NAME='CallBcndserid')
BEGIN
	ALTER TABLE [losSerCallBconditiondetails] ADD [CallBcndserid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerCallBconditiondetails' AND COLUMN_NAME='CallBcndserdcompanyid')
BEGIN
	ALTER TABLE [losSerCallBconditiondetails] ADD [CallBcndserdcompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerCallBconditiondetails' AND COLUMN_NAME='CallBcndserdshopid')
BEGIN
	ALTER TABLE [losSerCallBconditiondetails] ADD [CallBcndserdshopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerCallBconditiondetails' AND COLUMN_NAME='CallBcndcomments')
BEGIN
	ALTER TABLE [losSerCallBconditiondetails] ADD [CallBcndcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerCallBconditiondetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losSerCallBconditiondetails] ADD [rowguid] uniqueidentifier  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserconditiondetails' AND COLUMN_NAME='cndserbookdid')
BEGIN
	ALTER TABLE [losserconditiondetails] ADD [cndserbookdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserconditiondetails' AND COLUMN_NAME='cndserid')
BEGIN
	ALTER TABLE [losserconditiondetails] ADD [cndserid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserconditiondetails' AND COLUMN_NAME='cndserdcompanyid')
BEGIN
	ALTER TABLE [losserconditiondetails] ADD [cndserdcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserconditiondetails' AND COLUMN_NAME='cndserdshopid')
BEGIN
	ALTER TABLE [losserconditiondetails] ADD [cndserdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserconditiondetails' AND COLUMN_NAME='cndserbookdcomments')
BEGIN
	ALTER TABLE [losserconditiondetails] ADD [cndserbookdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserconditiondetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losserconditiondetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__lossercon__rowgu__42A2C333] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppShopId')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppId')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppcompanyID')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppcompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppDate')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppNo')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppCustomerId')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppCustomerId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppSershopID')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppSershopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppbookingId')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppbookingId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaApprovedBy')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaApprovedBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaApporRejected')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaApporRejected] bit CONSTRAINT [DF_losSerestimateapproval_seaRejected] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppremarks')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppusername')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppusername] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppCancelled')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppCancelled] bit CONSTRAINT [DF_losSerestimateapproval_seaCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME='seaAppCancelremarks')
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD [seaAppCancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadInterfaceID')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadInterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadShopID')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadTransactionID')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadTransactionID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadDetailID')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadSerialNo')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadSerialNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadItemID')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadItemQty')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadItemQty] [numeric] (10,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadPackingTypeID')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadPackingQty')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadPackingQty] [numeric] (10,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadCancel')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadAdjustment')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadAdjustment] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialArrivalDetails' AND COLUMN_NAME='sadFreeQty')
BEGIN
	ALTER TABLE [losSerialArrivalDetails] ADD [sadFreeQty] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidInterfaceID')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidInterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidShopID')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidTransactionID')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidTransactionID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidDetailID')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidSerialNo')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidSerialNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidItemID')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidItemQty')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidItemQty] [numeric] (10,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidPackingTypeID')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidPackingQty')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidPackingQty] [numeric] (10,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidCancel')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidAdjustment')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidAdjustment] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialIssueDetails' AND COLUMN_NAME='sidFreeQty')
BEGIN
	ALTER TABLE [losSerialIssueDetails] ADD [sidFreeQty] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdShopID')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdID')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdShipMentID')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdShipMentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdItemID')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdAvlStock')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdAvlStock] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdVerifiedStock')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdVerifiedStock] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdCostPrice')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdCostPrice] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdPreSerialNo')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdPreSerialNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdNewSerialNo')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdNewSerialNo] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationDetail' AND COLUMN_NAME='svdDeleted')
BEGIN
	ALTER TABLE [losSerialNoVerificationDetail] ADD [svdDeleted] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhCompanyID')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhShopID')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhID')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhNo')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhNo] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhDate')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhVerifiedBy')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhVerifiedBy] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhRemarks')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhRemarks] [nvarchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhCancel')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhCancel] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhCancellRemarks')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhCancellRemarks] [nvarchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhFutureVC')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhFutureVC] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhUser')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhUpdateUser')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhUpdateUser] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='svhUpdateTime')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [svhUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND COLUMN_NAME='cofirmed')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ADD [cofirmed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdCompanyID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdShopID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdPeriodDetailID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdPeriodDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdFromDate')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdFromDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdToDate')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdToDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdPrepByID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdPrepByID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdAmount')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdRemarks')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND COLUMN_NAME='mcdAlertdays')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ADD [mcdAlertdays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchCompanyID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchShopID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchCustomerID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchNo')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchContractRefNo')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchContractRefNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchCancelled')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchCancelledDate')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchCancelledDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchCancelledRemarks')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchCancelledRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchAccID')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchRemarks')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchFuture')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchFuture] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchdate')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchguarantee')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchguarantee] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchExchangeRates')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchDepExrate')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchDepExrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME='mchExchangeRate')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD [mchExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdCompanyID')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdMCID')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdMCID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdShopID')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdDetailID')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdMachineID')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdMachineID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdRemarks')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdRemarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdSerShopid')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdSerShopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdSerProcessid')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdSerProcessid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdSerProcessType')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdSerProcessType] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND COLUMN_NAME='mmdAlertdays')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD [mmdAlertdays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdCompanyID')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdMCID')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdMCID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdShopID')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdDetailID')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdMachineID')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdMachineID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdServiceID')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdServiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdSerPeriod')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdSerPeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdSerRemarks')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdSerRemarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdSerPeriodType')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdSerPeriodType] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdAlertdays')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdAlertdays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME='msdAlerttype')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD [msdAlerttype] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='custprodcompanyid')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [custprodcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='custprodshopid')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [custprodshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='custprodbookingid')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [custprodbookingid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='custprodproductid')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [custprodproductid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='custprodname')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [custprodname] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='custprodqty')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [custprodqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='custprodcomments')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [custprodcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='custprodusedqty')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [custprodusedqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='custprodusecomments')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [custprodusecomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losserpar__rowgu__7AE71C56] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND COLUMN_NAME='isdCompanyID')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] ADD [isdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND COLUMN_NAME='isdIssueID')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] ADD [isdIssueID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND COLUMN_NAME='isdShopID')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] ADD [isdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND COLUMN_NAME='isdDetailID')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] ADD [isdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND COLUMN_NAME='isdMachineID')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] ADD [isdMachineID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND COLUMN_NAME='isdQuantity')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] ADD [isdQuantity] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND COLUMN_NAME='isdRemarks')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] ADD [isdRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishCompanyID')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishIssueID')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishIssueID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishShopID')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishRequestID')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishRequestID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishIssueNo')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishIssueNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishDate')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishIssuedByID')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishIssuedByID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishInstallDate')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishInstallDate] datetime CONSTRAINT [DF_losSerStandByIssueHeader_ishInstallDate] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishTechnicianID')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishTechnicianID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishConfirmed')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishConfirmed] [char] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishUpdateTime')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishCancelled')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishCancelledRemarks')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishRemarks')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishRemarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishFuture')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishFuture] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME='ishType')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD [ishType] [char] (1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND COLUMN_NAME='rdCompanyID')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] ADD [rdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND COLUMN_NAME='rdReceiptID')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] ADD [rdReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND COLUMN_NAME='rdShopID')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] ADD [rdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND COLUMN_NAME='rdDetailID')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] ADD [rdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND COLUMN_NAME='rdMachineID')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] ADD [rdMachineID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND COLUMN_NAME='rdQuantity')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] ADD [rdQuantity] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND COLUMN_NAME='rdRemarks')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] ADD [rdRemarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhCompanyID')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhShopID')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhReceiptID')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhReceiptNo')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhReceiptNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhDate')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhIssueID')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhIssueID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhReceivedByID')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhReceivedByID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhCancelled')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhCancelledRemarks')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhCancelledRemarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhRemarks')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhRemarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhUpdateTime')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhUpdateTime] datetime CONSTRAINT [DF_losSerStandByReceiptHeader_rhUpdateTime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhFuture')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhFuture] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME='rhType')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD [rhType] [char] (1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND COLUMN_NAME='reqdCompanyID')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] ADD [reqdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND COLUMN_NAME='reqdShopID')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] ADD [reqdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND COLUMN_NAME='reqdRequestID')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] ADD [reqdRequestID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND COLUMN_NAME='reqdDetailID')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] ADD [reqdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND COLUMN_NAME='reqdMachineID')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] ADD [reqdMachineID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND COLUMN_NAME='reqdQuantity')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] ADD [reqdQuantity] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND COLUMN_NAME='reqdRemarks')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] ADD [reqdRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND COLUMN_NAME='reqdslno')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] ADD [reqdslno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhCompanyID')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhRequestID')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhRequestID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhShopID')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhNo')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhDate')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhCustomerID')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhCustomerID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhProcessedDate')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhProcessedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhApprovedByID')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhApprovedByID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhCancelled')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhCancelledRemarks')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhRemarks')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhRemarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhFuture')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhFuture] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhUpdateTime')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhUpdateTime] datetime CONSTRAINT [DF_losSerStandByRequestHeader_reqhUpdateTime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhType')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhType] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhCustomerName')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhCustomerName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhContactNo')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhContactNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhContactName')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhContactName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME='reqhtime')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD [reqhtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND COLUMN_NAME='alcdCompanyId')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ADD [alcdCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND COLUMN_NAME='alcdShopid')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ADD [alcdShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND COLUMN_NAME='alcdid')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ADD [alcdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND COLUMN_NAME='alcdtoolsid')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ADD [alcdtoolsid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND COLUMN_NAME='alcddetailid')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ADD [alcddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND COLUMN_NAME='alcdtechnicianid')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ADD [alcdtechnicianid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND COLUMN_NAME='alcdreturned')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ADD [alcdreturned] [char] (1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND COLUMN_NAME='alcdfrom')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ADD [alcdfrom] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND COLUMN_NAME='alcdto')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ADD [alcdto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND COLUMN_NAME='alchCompanyId')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ADD [alchCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND COLUMN_NAME='alchShopid')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ADD [alchShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND COLUMN_NAME='alchid')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ADD [alchid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND COLUMN_NAME='alchno')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ADD [alchno] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND COLUMN_NAME='alchdate')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ADD [alchdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND COLUMN_NAME='alchtechnicianid')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ADD [alchtechnicianid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND COLUMN_NAME='alchRemarks')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ADD [alchRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND COLUMN_NAME='alchCancelled')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ADD [alchCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND COLUMN_NAME='alchCancelledremarks')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ADD [alchCancelledremarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnDetail' AND COLUMN_NAME='tlretdCompanyId')
BEGIN
	ALTER TABLE [LosserToolsReturnDetail] ADD [tlretdCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnDetail' AND COLUMN_NAME='tlretdShopid')
BEGIN
	ALTER TABLE [LosserToolsReturnDetail] ADD [tlretdShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnDetail' AND COLUMN_NAME='tlretdid')
BEGIN
	ALTER TABLE [LosserToolsReturnDetail] ADD [tlretdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnDetail' AND COLUMN_NAME='tlretdetailid')
BEGIN
	ALTER TABLE [LosserToolsReturnDetail] ADD [tlretdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnDetail' AND COLUMN_NAME='tlretdtoolsid')
BEGIN
	ALTER TABLE [LosserToolsReturnDetail] ADD [tlretdtoolsid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnDetail' AND COLUMN_NAME='tlretdcomments')
BEGIN
	ALTER TABLE [LosserToolsReturnDetail] ADD [tlretdcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethCompanyId')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethShopid')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethid')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethno')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethdate')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethtechnicianid')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethtechnicianid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethRemarks')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethCancelled')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethCancelledRemarks')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND COLUMN_NAME='tlrethallocid')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ADD [tlrethallocid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhid')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhshopid')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhcompanyid')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhpreparedby')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhpreparedby] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhdeldate')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhdeldate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookadvanceamount')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookadvanceamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhserviceamt')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhserviceamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhpartscost')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhpartscost] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhdepartmentid')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhposted')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhposted] bit CONSTRAINT [DF_losservicebookingheader_serbookhposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhinvoiced')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhinvoiced] bit CONSTRAINT [DF_losservicebookingheader_serbookhinvoiced] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhcashacc')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhcashacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookadvanceacc')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookadvanceacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhcmpexrate')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhcmpexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhresexrate')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhresexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhbaserate')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhbaserate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookconfirmed')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookconfirmed] bit CONSTRAINT [DF_losservicebookingheader_serbookconfirmed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbooksermode')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbooksermode] bit CONSTRAINT [DF_losservicebookingheader_serbooksermode] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhfutureint')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhfuturenumer')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhfuturenumer] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhstatus')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhstatus] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhpriority')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhpriority] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhInspectionNo')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhInspectionNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhInspectionDate')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhInspectionDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhEstExpiryDate')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhEstExpiryDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhApprovedDate')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhApprovedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhFaxOutTime')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhFaxOutTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhdepexrate')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhexchangerates')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhinspectiontime')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhinspectiontime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhinpcancelled')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhinpcancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhinpstatus')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhinpstatus] [varchar] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookadvancedate')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookadvancedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhRemarks')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhinpCancelledRemarks')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhinpCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhRefId')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhRefId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhUpdateTime')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhUpdateTime] datetime CONSTRAINT [DF_losServiceBookingHeader_serbookhUpdateTime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serccallbkhrecvdfrom')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serccallbkhrecvdfrom] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serWarranyFrom')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serWarranyFrom] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serWarrantyTo')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serWarrantyTo] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhUserid')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhUserid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhTerms')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhTerms] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serbookhSerialNumber')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serbookhSerialNumber] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME='serserbookhExcludeGST')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD [serserbookhExcludeGST] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhid')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhcompanyid')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhbookingid')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhbookingid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhshopid')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhpreparedby')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhpreparedby] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhserviceamt')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhserviceamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhpartsamt')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhpartsamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhamount')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhdepartmentid')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhitemname')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhitemname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhitemid')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhitemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhcustname')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhcustname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losservic__rowgu__3A6282ED] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhJobCardNo')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhJobCardNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhPaceofWork')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhPaceofWork] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhmetereading')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhmetereading] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhrefno')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhrefno] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhprocno')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhprocno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhprocdate')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhprocdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhremarks')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhremarks] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhjobinvcancelledremarks')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhjobinvcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhjobinvcancelled')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhjobinvcancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhcompleted')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhcompleted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhToInvoice')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhToInvoice] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='itemDespatch')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [itemDespatch] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhdespdate')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhdespdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serinvhnotes')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serinvhnotes] [varchar] (4000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME='serTypeId')
BEGIN
	ALTER TABLE [losServiceHeader] ADD [serTypeId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhcompanyid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhshopid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhjobcardid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhjobcardid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvno')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhrefno')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhrefno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhdate')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhduedate')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhduedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhpreparedby')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhpreparedby] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhcancelled')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhcancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhserviceamt')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhserviceamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhpartsamt')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhpartsamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhamount')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhposted')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhposted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhdepartmentid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhcashacc')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhcashacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhsalesacc')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhsalesacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhservacc')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhservacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhcmpexrate')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhcmpexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhresexrate')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhresexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhbaserate')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhbaserate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhsettled')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhsettled] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhremarks')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvcancelremarks')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvcancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhupdatetime')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhupdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhlocid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhlocid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhitemname')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhitemname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhitemid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhitemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhDiscount')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhfutureint')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhfuturevc')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhfuturenumuric')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhfuturenumuric] [numeric] (18,18) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvfinancialid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvfinancialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='seinvhdepexrate')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [seinvhdepexrate] [numeric] (9,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhfree')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhfree] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhexchangerates')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhcustname')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhcustname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhcategid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhcategid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhmetereading')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhmetereading] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhCustomerId')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhCustomerId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhCashInv')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhCashInv] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhuserid')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhuserid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhRegID')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhRegID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhTaxCateID')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhTaxCateID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhTaxPercentage')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME='serinvhTaxamount')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD [serinvhTaxamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siInvoiceDetailID')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siInvoiceDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siCompanyID')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siInvoiceID')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siServiceName')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siServiceName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siServiceTerm')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siServiceTerm] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siServiceQty')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siServiceQty] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siAmount')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siAccountid')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siAccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siShopID')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsServic__rowgu__5C229E14] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siclearingReqId')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siclearingReqId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siClearingOCAmt')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siClearingOCAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siClearingCommAmt')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siClearingCommAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siLocalPOId')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siLocalPOId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME='siUserID')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD [siUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechcompanyid')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='sertechinvid')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [sertechinvid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechshopid')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechdetailid')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechdetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechid')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechstarttime')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechstarttime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechendtime')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechendtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechcostperhr')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechcostperhr] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechservicetype')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechservicetype] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechcomments')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechcomments] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvtechstatus')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvtechstatus] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvhfuturevc')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvhfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losservin__rowgu__12211E17] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvTechServiceID')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvTechServiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvTechEstStartDate')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvTechEstStartDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME='serinvTechEstEndDate')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD [serinvTechEstEndDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [LOsSettings] ADD [ShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='sNoofBackDays')
BEGIN
	ALTER TABLE [LOsSettings] ADD [sNoofBackDays] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='sGoodsReturnPeriod')
BEGIN
	ALTER TABLE [LOsSettings] ADD [sGoodsReturnPeriod] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='OpeningStockDate')
BEGIN
	ALTER TABLE [LOsSettings] ADD [OpeningStockDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='CBUserID')
BEGIN
	ALTER TABLE [LOsSettings] ADD [CBUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='barcodetype')
BEGIN
	ALTER TABLE [LOsSettings] ADD [barcodetype] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsSettings] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsSettin__rowgu__61DB776A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='reportsetting')
BEGIN
	ALTER TABLE [LOsSettings] ADD [reportsetting] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='defaultfetch')
BEGIN
	ALTER TABLE [LOsSettings] ADD [defaultfetch] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='ClearingCOMPerc')
BEGIN
	ALTER TABLE [LOsSettings] ADD [ClearingCOMPerc] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='HandlingPer')
BEGIN
	ALTER TABLE [LOsSettings] ADD [HandlingPer] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='HandlingAndPaymentPer')
BEGIN
	ALTER TABLE [LOsSettings] ADD [HandlingAndPaymentPer] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='allshops')
BEGIN
	ALTER TABLE [LOsSettings] ADD [allshops] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='PopulateDateWise')
BEGIN
	ALTER TABLE [LOsSettings] ADD [PopulateDateWise] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='QuickItemFetch')
BEGIN
	ALTER TABLE [LOsSettings] ADD [QuickItemFetch] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='BlockAboveSP')
BEGIN
	ALTER TABLE [LOsSettings] ADD [BlockAboveSP] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='ShopActiveDirectoryLogin')
BEGIN
	ALTER TABLE [LOsSettings] ADD [ShopActiveDirectoryLogin] bit CONSTRAINT [DF__LOsSettin__ShopA__32B80ADB] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME='DirectLocalPurchaseCosting')
BEGIN
	ALTER TABLE [LOsSettings] ADD [DirectLocalPurchaseCosting] bit CONSTRAINT [DF__LOsSettin__Direc__308EFFF0] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndShopId')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndboatnoteId')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndboatnoteId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bnddetailId')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bnddetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndclearanceId')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndclearanceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndclearanceDetailId')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndclearanceDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndPacking')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndPacking] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndqty')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndqty] [numeric] (10,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndunit')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndunit] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndnoofpackage')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndnoofpackage] [numeric] (10,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndremarks')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndremarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndlppoid')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndlppoid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndlpdetailid')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndlpdetailid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME='bndStatus')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD [bndStatus] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhShopId')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhboatnoteId')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhboatnoteId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhboateNoteNo')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhboateNoteNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhboatenotedate')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhboatenotedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhCustomerId')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhCustomerId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhRemark')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhRemark] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhsentBy')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhsentBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhcancelled')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhcancelled] bit CONSTRAINT [DF_LosShipmentbhheader_bnhcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhcancelledRemarks')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhcancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhBoatNoteRecTime')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhBoatNoteRecTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhPersonReceived')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhPersonReceived] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhattento')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhattento] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME='bnhboatname')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD [bnhboatname] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShipmentBNOCDetail' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losShipmentBNOCDetail] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShipmentBNOCDetail' AND COLUMN_NAME='BoatNoteID')
BEGIN
	ALTER TABLE [losShipmentBNOCDetail] ADD [BoatNoteID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShipmentBNOCDetail' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [losShipmentBNOCDetail] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShipmentBNOCDetail' AND COLUMN_NAME='OCDesc')
BEGIN
	ALTER TABLE [losShipmentBNOCDetail] ADD [OCDesc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShipmentBNOCDetail' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [losShipmentBNOCDetail] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShipmentBNOCDetail' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [losShipmentBNOCDetail] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND COLUMN_NAME='dcdClearingID')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] ADD [dcdClearingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND COLUMN_NAME='dcdShipmentID')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] ADD [dcdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND COLUMN_NAME='dcdItemID')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] ADD [dcdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND COLUMN_NAME='dcdShopid')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] ADD [dcdShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND COLUMN_NAME='dcdAvailableQty')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] ADD [dcdAvailableQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND COLUMN_NAME='dcdWriteOffQty')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] ADD [dcdWriteOffQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsShopDa__rowgu__0A888742] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchClearingID')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchClearingID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchShopid')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchClearingNo')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchClearingNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchClearingDate')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchClearingDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchClearingDoneBy')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchClearingDoneBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchRemarks')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchCancelled')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchCancelledRemarks')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchRecAddUser')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchRecModifyUser')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchfuturevc')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchfuturevc] [varchar] (250) CONSTRAINT [DF_LOsShopDamageClearingHeader_dchfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOsShopDamageClearingHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsShopDa__rowgu__43C1049E] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchconexrate')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchdepexrate')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME='dchexchangerates')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD [dchexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemDiffPriceLevels' AND COLUMN_NAME='IpID')
BEGIN
	ALTER TABLE [losShopItemDiffPriceLevels] ADD [IpID] int IDENTITY(1,1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemDiffPriceLevels' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [losShopItemDiffPriceLevels] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemDiffPriceLevels' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [losShopItemDiffPriceLevels] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemDiffPriceLevels' AND COLUMN_NAME='CurrencyID')
BEGIN
	ALTER TABLE [losShopItemDiffPriceLevels] ADD [CurrencyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemDiffPriceLevels' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [losShopItemDiffPriceLevels] ADD [PackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemDiffPriceLevels' AND COLUMN_NAME='SegmentID')
BEGIN
	ALTER TABLE [losShopItemDiffPriceLevels] ADD [SegmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemDiffPriceLevels' AND COLUMN_NAME='SellingPrice')
BEGIN
	ALTER TABLE [losShopItemDiffPriceLevels] ADD [SellingPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemDiffPriceLevels' AND COLUMN_NAME='PriceDescription')
BEGIN
	ALTER TABLE [losShopItemDiffPriceLevels] ADD [PriceDescription] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='ipid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [ipid] int IDENTITY(1,1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='shipmentid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [shipmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [itemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='PackingTypeid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [PackingTypeid] int CONSTRAINT [DF_losShopItemShipmentDetail_PackingTypeid] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='spFixdate')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [spFixdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='sellingPrice')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [sellingPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='WholesalePrice')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [WholesalePrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='DiscountPrice')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [DiscountPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='Pricechanged')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [Pricechanged] bit CONSTRAINT [DF_losShopItemShipmentDetail_Pricechanged] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='currencyid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [currencyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losShopIt__rowgu__7ECCBBD3] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='segmentid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [segmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='CreditSP')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [CreditSP] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='CreditDP')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [CreditDP] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='CreditWP')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [CreditWP] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME='Userid')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD [Userid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopTransactionsSummary' AND COLUMN_NAME='SummaryDate')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ADD [SummaryDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopTransactionsSummary' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ADD [ShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopTransactionsSummary' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopTransactionsSummary' AND COLUMN_NAME='Stock')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ADD [Stock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopTransactionsSummary' AND COLUMN_NAME='BadStock')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ADD [BadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopTransactionsSummary' AND COLUMN_NAME='OpeningStock')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ADD [OpeningStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopTransactionsSummary' AND COLUMN_NAME='OpeningBadStock')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ADD [OpeningBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopTransactionsSummary' AND COLUMN_NAME='ShipmentId')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ADD [ShipmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopTransactionsSummary' AND COLUMN_NAME='ItemCostPrice')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ADD [ItemCostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idInvoiceId')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idInvoiceId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idGodownID')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idItemid')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idItemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idShopid')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='locationid')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [locationid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='shipmentid')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [shipmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idPackingTypeid')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idPackingTypeid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idPunitID')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idPunitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='IDPquantity')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [IDPquantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idQuantity')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idUnitPrice')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idRateType')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idRateType] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idActualUnitPrice')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idActualUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='reqqty')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [reqqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='despatch')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [despatch] bit CONSTRAINT [DF_losSIQuotationDetail_despatch] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idcostprice')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='iddescription')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [iddescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idblockprice')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idblockprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idguarantee')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idguarantee] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losSIQuo__rowgu__17D9F76D] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idFreeQuantity')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idFreeQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idSerialNo')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idSerialNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idItemTaxPercentage')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idItemTaxAmount')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idItemTaxAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME='idItemTaxCategory')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD [idItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhInvoiceID')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhShopID')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhInvoiceNo')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhInvoiceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhInvoiceDate')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhInvoiceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhReferenceNo')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhCustomerID')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhProforma')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhProforma] bit CONSTRAINT [DF_losSIQuotationHeader_IhProforma] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhCashInvoice')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhCashInvoice] bit CONSTRAINT [DF_losSIQuotationHeader_IhCashInvoice] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhBankcashAccID')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhBankcashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhChequeNo')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhDueDate')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhDueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhRemarks')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhInvoiceAmount')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhInvoiceAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhDiscount')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhDiscountAccID')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhDiscountAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhDepartmentID')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhFinancialID')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhCancelled')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhCancelled] bit CONSTRAINT [DF_losSIQuotationHeader_IhCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhCancelledRemarks')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhExchangeNature')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhExchangeNature] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhCompanyId')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhCompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhPosted')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhPosted] bit CONSTRAINT [DF_losSIQuotationHeader_IhPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhProformaID')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhProformaID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihRecAddUser')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihRecModifyUser')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihGoodsReturned')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihGoodsReturned] bit CONSTRAINT [DF_losSIQuotationHeader_ihGoodsReturned] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihUsed')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihUsed] bit CONSTRAINT [DF_losSIQuotationHeader_ihUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhSalesAccID')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='IhSettled')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [IhSettled] bit CONSTRAINT [DF_losSIQuotationHeader_IhSettled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihTransFinished')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihTransFinished] bit CONSTRAINT [DF_losSIQuotationHeader_ihTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihNoofDetails')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihNoofDetails] int CONSTRAINT [DF_losSIQuotationHeader_ihNoofDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihNoofOCDetails')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihNoofOCDetails] int CONSTRAINT [DF_losSIQuotationHeader_ihNoofOCDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihexchangerate')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihexchangerate] [numeric] (28,8) CONSTRAINT [DF_losSIQuotationHeader_ihexchangerate] DEFAULT ((1)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihsettledamount')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihsettledamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihcbid')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihfuturevc')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihfuturevc] [varchar] (250) CONSTRAINT [DF_losSIQuotationHeader_ihfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [updatetime] datetime CONSTRAINT [DF_losSIQuotationHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihsalespersonid')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihCustomerCardNo')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihCustomerCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihfutureint')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losQuo__rowgu__318D45CA] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihdepexrate')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihexchangerates')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihcreatedtime')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihcreatedtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihInvoiced')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihInvoiced] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihAddress')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihAddress] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihCustomerName')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihCustomerName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihUserId')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME='ihModifyUserId')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD [ihModifyUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idInvoiceId')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idInvoiceId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idGodownID')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idItemid')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idItemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idShopid')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='locationid')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [locationid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='shipmentid')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [shipmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idPackingTypeid')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idPackingTypeid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idPunitID')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idPunitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='IDPquantity')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [IDPquantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idQuantity')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idUnitPrice')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idRateType')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idRateType] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idActualUnitPrice')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idActualUnitPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='reqqty')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [reqqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='despatch')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [despatch] bit CONSTRAINT [DF_losSpecialInvoiceDetail_despatch] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idcostprice')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='iddescription')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [iddescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idblockprice')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idblockprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idguarantee')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idguarantee] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losSpecia__rowgu__17D9F76D] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idFreeQuantity')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idFreeQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idSerialNo')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idSerialNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idItemType')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idItemType] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idKitID')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idKitID] int CONSTRAINT [DF_losSpecialInvoiceDetail_idKitID] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idKitQuantity')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idKitQuantity] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idKitActualPrice')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idKitActualPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idServWarrantyUpto')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idServWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idPartsWarrantyUpto')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idPartsWarrantyUpto] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idItemTaxPercentage')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idItemTaxPercentage] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idItemTaxAmount')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idItemTaxAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME='idItemTaxCategory')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD [idItemTaxCategory] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhInvoiceID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhShopID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhInvoiceNo')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhInvoiceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhInvoiceDate')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhInvoiceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhReferenceNo')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhCustomerID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhProforma')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhProforma] bit CONSTRAINT [DF_losSpecialInvoiceHeader_IhProforma] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhCashInvoice')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhCashInvoice] bit CONSTRAINT [DF_losSpecialInvoiceHeader_IhCashInvoice] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhBankcashAccID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhBankcashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhChequeNo')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhDueDate')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhDueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhRemarks')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhInvoiceAmount')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhInvoiceAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhDiscount')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhDiscountAccID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhDiscountAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhDepartmentID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhFinancialID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhCancelled')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhCancelled] bit CONSTRAINT [DF_losSpecialInvoiceHeader_IhCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhCancelledRemarks')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhExchangeNature')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhExchangeNature] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhCompanyId')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhCompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhPosted')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhPosted] bit CONSTRAINT [DF_losSpecialInvoiceHeader_IhPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhProformaID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhProformaID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihRecAddUser')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihRecModifyUser')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihGoodsReturned')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihGoodsReturned] bit CONSTRAINT [DF_losSpecialInvoiceHeader_ihGoodsReturned] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihUsed')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihUsed] bit CONSTRAINT [DF_losSpecialInvoiceHeader_ihUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhSalesAccID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='IhSettled')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [IhSettled] bit CONSTRAINT [DF_losSpecialInvoiceHeader_IhSettled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihTransFinished')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihTransFinished] bit CONSTRAINT [DF_losSpecialInvoiceHeader_ihTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihNoofDetails')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihNoofDetails] int CONSTRAINT [DF_losSpecialInvoiceHeader_ihNoofDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihNoofOCDetails')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihNoofOCDetails] int CONSTRAINT [DF_losSpecialInvoiceHeader_ihNoofOCDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihexchangerate')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihexchangerate] [numeric] (28,8) CONSTRAINT [DF_losSpecialInvoiceHeader_ihexchangerate] DEFAULT ((1)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihsettledamount')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihsettledamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihcbid')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihfuturevc')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihfuturevc] [varchar] (250) CONSTRAINT [DF_losSpecialInvoiceHeader_ihfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [updatetime] datetime CONSTRAINT [DF_losSpecialInvoiceHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihsalespersonid')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihCustomerCardNo')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihCustomerCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihfutureint')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losSpecia__rowgu__318D45CA] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihdepexrate')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihexchangerates')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihcreatedtime')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihcreatedtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihQuotationID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihQuotationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihDespachID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihDespachID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihReturnBeforeDesID')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihReturnBeforeDesID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihUserId')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME='ihModifyUserId')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD [ihModifyUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialOC' AND COLUMN_NAME='ioShopid')
BEGIN
	ALTER TABLE [losSpecialOC] ADD [ioShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialOC' AND COLUMN_NAME='ioInvoiceID')
BEGIN
	ALTER TABLE [losSpecialOC] ADD [ioInvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialOC' AND COLUMN_NAME='ioAccid')
BEGIN
	ALTER TABLE [losSpecialOC] ADD [ioAccid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialOC' AND COLUMN_NAME='ioDescription')
BEGIN
	ALTER TABLE [losSpecialOC] ADD [ioDescription] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialOC' AND COLUMN_NAME='ioAmount')
BEGIN
	ALTER TABLE [losSpecialOC] ADD [ioAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialOC' AND COLUMN_NAME='ioCompanyID')
BEGIN
	ALTER TABLE [losSpecialOC] ADD [ioCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialOC' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losSpecialOC] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losSpecia__rowgu__1D92D0C3] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srID')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srShopID')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srDate')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srItemID')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srAddStock')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srAddStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srDedStock')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srDedStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srcostprice')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srUserName')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srposted')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srposted] bit CONSTRAINT [DF_losStockRecovery_srposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srfutureint')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [updatetime] datetime CONSTRAINT [DF_losStockRecovery_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srdepartmentid')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srlocid')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srlocid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srtransno')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srtransno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losStockR__rowgu__306FCFB6] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srConExRate')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srConExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srDepExRate')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srDepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srExchangeRates')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME='srTransDate')
BEGIN
	ALTER TABLE [losStockRecovery] ADD [srTransDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='svdid')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [svdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='svdShipmentID')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [svdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='svditemid')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [svditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='svdShopid')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [svdShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='svdAvailStock')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [svdAvailStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='svdVerifiedStock')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [svdVerifiedStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='svdAvailBadStock')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [svdAvailBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='svdVerifiedBadStock')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [svdVerifiedBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='svdcostprice')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [svdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losStockV__rowgu__7ADC2F5E] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhid')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhShopId')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhno')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhdate')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhverificationby')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhverificationby] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhremarks')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhcancelled')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhcancelled] bit CONSTRAINT [DF_lopStockVerificationHeader_svhcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhcancelremarks')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhcancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhrecmoduser')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhrecmoduser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhrecadduser')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhrecadduser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhfuturevc')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhfuturevc] [varchar] (250) CONSTRAINT [DF_losStockVerificationHeader_svhfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhposted')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhposted] bit CONSTRAINT [DF_losStockVerificationHeader_svhposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [updatetime] datetime CONSTRAINT [DF_losStockVerificationHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhdepartmentid')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__losStockV__rowgu__3592E0D8] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhconexrate')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhdepexrate')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME='svhexchangerates')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD [svhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillDetail' AND COLUMN_NAME='tbdBillId')
BEGIN
	ALTER TABLE [losTenantServiceBillDetail] ADD [tbdBillId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillDetail' AND COLUMN_NAME='tbdShopId')
BEGIN
	ALTER TABLE [losTenantServiceBillDetail] ADD [tbdShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillDetail' AND COLUMN_NAME='tbdCompanyId')
BEGIN
	ALTER TABLE [losTenantServiceBillDetail] ADD [tbdCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillDetail' AND COLUMN_NAME='tbdUtilityTransID')
BEGIN
	ALTER TABLE [losTenantServiceBillDetail] ADD [tbdUtilityTransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillDetail' AND COLUMN_NAME='tbddetailid')
BEGIN
	ALTER TABLE [losTenantServiceBillDetail] ADD [tbddetailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillDetail' AND COLUMN_NAME='tbdAmount')
BEGIN
	ALTER TABLE [losTenantServiceBillDetail] ADD [tbdAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillDetail' AND COLUMN_NAME='tbdRefAmount')
BEGIN
	ALTER TABLE [losTenantServiceBillDetail] ADD [tbdRefAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhBillId')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhBillId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhShopId')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhCompanyId')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhAgreementId')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhAgreementId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhCustomerId')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhCustomerId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhBillNo')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhBillDate')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhBillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhCancelled')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhRemarks')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhCancelledRemarks')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhDepExRate')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhDepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhExRate')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhExchangeRates')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhDepartmentID')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhBankCashID')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhBankCashID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhServiceAccid')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhServiceAccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhPosted')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhPosted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhAmount')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhDueDate')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhDueDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhReferenceNo')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhUpdateTime')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhUpdateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhSettledAmount')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhSettledAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhSettled')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhSettled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhutilityAccid')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhutilityAccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND COLUMN_NAME='tbhUserID')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ADD [tbhUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterDetail' AND COLUMN_NAME='trdTransID')
BEGIN
	ALTER TABLE [losTenantServiceRegisterDetail] ADD [trdTransID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterDetail' AND COLUMN_NAME='trdTransShopid')
BEGIN
	ALTER TABLE [losTenantServiceRegisterDetail] ADD [trdTransShopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterDetail' AND COLUMN_NAME='trdTransCompanyId')
BEGIN
	ALTER TABLE [losTenantServiceRegisterDetail] ADD [trdTransCompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterDetail' AND COLUMN_NAME='trdTransDetailId')
BEGIN
	ALTER TABLE [losTenantServiceRegisterDetail] ADD [trdTransDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterDetail' AND COLUMN_NAME='trdServiceId')
BEGIN
	ALTER TABLE [losTenantServiceRegisterDetail] ADD [trdServiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterDetail' AND COLUMN_NAME='trdServiceQty')
BEGIN
	ALTER TABLE [losTenantServiceRegisterDetail] ADD [trdServiceQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterDetail' AND COLUMN_NAME='trdServiceActualRate')
BEGIN
	ALTER TABLE [losTenantServiceRegisterDetail] ADD [trdServiceActualRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterDetail' AND COLUMN_NAME='trdServiceRate')
BEGIN
	ALTER TABLE [losTenantServiceRegisterDetail] ADD [trdServiceRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhTransId')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhTransId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhTransShopId')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhTransShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhTransCompanyid')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhTransCompanyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhTransNo')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhTransNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhDate')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhApartmentId')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhApartmentId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhAgreementID')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhAgreementID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhEnteredBy')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhEnteredBy] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhRemarks')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhCancelled')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhCancelledRemarks')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantServiceRegisterHeader' AND COLUMN_NAME='trhStatus')
BEGIN
	ALTER TABLE [losTenantServiceRegisterHeader] ADD [trhStatus] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdBillId')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdBillId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdShopId')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdShopId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdCompanyId')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdCompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdServiceId')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdServiceId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdFromDate')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdFromDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdToDate')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdToDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdMeterReading')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdMeterReading] [numeric] (28,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdUnits')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdUnits] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdRate')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdRate] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND COLUMN_NAME='utdAmount')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ADD [utdAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDID')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDshopid')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDshipmentID')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDshipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDitemID')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDitemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDtransfergoodqty')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDtransfergoodqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDtransferbadqty')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDtransferbadqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDrecievedgoodqty')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDrecievedgoodqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDrecievedbadqty')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDrecievedbadqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDCostprice')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDCostprice] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME='TIDSellingPrice')
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD [TIDSellingPrice] [numeric] (20,4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHShopid')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHID')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHNO')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHNO] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHDate')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHfromshopID')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHfromshopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHdespatchID')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHdespatchID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHremarks')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHcancel')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHcancel] bit CONSTRAINT [DF_LOSTransferinheader_TIHcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHcancelledremarks')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHcancelledremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHDoneBy')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHDoneBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHTransFinished')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHTransFinished] bit CONSTRAINT [DF_LOSTransferinheader_TIHTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHPosted')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHPosted] bit CONSTRAINT [DF_LOSTransferinheader_TIHPosted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHfuturevc')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHfuturevc] [varchar] (250) CONSTRAINT [DF_LOSTransferinheader_TIHfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [updatetime] datetime CONSTRAINT [DF_LOSTransferinheader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='tihdepartmentid')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [tihdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOSTransf__rowgu__387A3A7B] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='tihconexrate')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [tihconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='tihdepexrate')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [tihdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='tihexchangerates')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [tihexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='TIHType')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [TIHType] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='tihrecadduser')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [tihrecadduser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='tihrecmodifyuser')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [tihrecmodifyuser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME='tihTime')
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD [tihTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losType' AND COLUMN_NAME='Typeid')
BEGIN
	ALTER TABLE [losType] ADD [Typeid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losType' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [losType] ADD [Type] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditDetail' AND COLUMN_NAME='sdCompanyId')
BEGIN
	ALTER TABLE [losUserAuditDetail] ADD [sdCompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditDetail' AND COLUMN_NAME='sdAuditId')
BEGIN
	ALTER TABLE [losUserAuditDetail] ADD [sdAuditId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditDetail' AND COLUMN_NAME='sdShopId')
BEGIN
	ALTER TABLE [losUserAuditDetail] ADD [sdShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditDetail' AND COLUMN_NAME='sdDetailId')
BEGIN
	ALTER TABLE [losUserAuditDetail] ADD [sdDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditDetail' AND COLUMN_NAME='sdAuditControlName')
BEGIN
	ALTER TABLE [losUserAuditDetail] ADD [sdAuditControlName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditDetail' AND COLUMN_NAME='sdAuditControlType')
BEGIN
	ALTER TABLE [losUserAuditDetail] ADD [sdAuditControlType] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditDetail' AND COLUMN_NAME='sdOldValue')
BEGIN
	ALTER TABLE [losUserAuditDetail] ADD [sdOldValue] [varchar] (4000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditDetail' AND COLUMN_NAME='sdNewValue')
BEGIN
	ALTER TABLE [losUserAuditDetail] ADD [sdNewValue] [varchar] (4000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shCompanyId')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shCompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shAuditId')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shAuditId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shShopId')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shInterfaceId')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shInterfaceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shTransId')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shTransId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shTransNo')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shTransNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shUserFullName')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shUserFullName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shLoggedDateTime')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shLoggedDateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shExitedDateTime')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shExitedDateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shMode')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shMode] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shSaved')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shSaved] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shMachineName')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shMachineName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losUserAuditHeader' AND COLUMN_NAME='shWindowsUserName')
BEGIN
	ALTER TABLE [losUserAuditHeader] ADD [shWindowsUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVerifiedby' AND COLUMN_NAME='verifiedid')
BEGIN
	ALTER TABLE [LosVerifiedby] ADD [verifiedid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVerifiedby' AND COLUMN_NAME='verifiedby')
BEGIN
	ALTER TABLE [LosVerifiedby] ADD [verifiedby] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='RegistartionReceiveId')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [RegistartionReceiveId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='RegistartionReceiveDtlId')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [RegistartionReceiveDtlId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='RegistartionSubConfId')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [RegistartionSubConfId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='InvoiceId')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [InvoiceId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='PosId')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [PosId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='SpInvoice')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [SpInvoice] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='RegistrationID')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [RegistrationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='RegistryNoShort')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [RegistryNoShort] [nvarchar] (150) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='RegistryNoLong')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [RegistryNoLong] [nvarchar] (150) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='RegistrationDate')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [RegistrationDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdCompanyID')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdShopID')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdID')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdDetailID')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdItemID')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdPackingTypeID')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdPackingTypeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdPQty')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdPQty] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdQty')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdQty] [numeric] (18,0) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdAvailQty')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdAvailQty] [numeric] (18,0) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdCostPrice')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdCostPrice] [numeric] (18,4) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdSerialNo')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdSerialNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND COLUMN_NAME='wcdcustomprice')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ADD [wcdcustomprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchCompanyID')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchShopID')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchID')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchDate')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchNo')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchCustomerID')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchCustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchRemarks')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchRemarks] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchType')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchType] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchCancelled')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchCancelled] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchCancelRemarks')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchCancelRemarks] [nvarchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchPosted')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchPosted] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchUser')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchUser] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchUpdatedUser')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchUpdatedUser] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchUpdatedTime')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchUpdatedTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchFinancialID')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchFinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchAmount')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchExchangeRate')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchExchangeRate] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchcomexrate')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchcomexrate] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchdepexrate')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchdepexrate] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchModel')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchModel] [nvarchar] (300) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchUnitSerial')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchUnitSerial] [nvarchar] (300) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchLabourCost')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchLabourCost] [numeric] (12,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchpartCostSupplier')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchpartCostSupplier] [numeric] (12,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchLabourCostSupplier')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchLabourCostSupplier] [numeric] (12,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchCreditDate')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchCreditDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchRefNo')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchRefNo] [varchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchConfirmed')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchConfirmed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchCustomerName')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchCustomerName] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='wchCustomerAddress')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [wchCustomerAddress] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='whVerified')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [whVerified] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='whApprovedby')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [whApprovedby] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='whIhCRequestID')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [whIhCRequestID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND COLUMN_NAME='whApprovedid')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ADD [whApprovedid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='wdShopID')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [wdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='WdID')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [WdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='WdItemID')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [WdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='WdShipmentID')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [WdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='WdAvailableQty')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [WdAvailableQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='WdWriteoffQty')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [WdWriteoffQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='wdcostprice')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [wdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsWriteO__rowgu__52CE3E04] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='WdPackID')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [WdPackID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='WdunitID')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [WdunitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='WdPqty')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [WdPqty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='WdInhouseConsAccnt')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [WdInhouseConsAccnt] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME='wdDetailid')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD [wdDetailid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whShopID')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='WhID')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [WhID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='WhNo')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [WhNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='WhDate')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [WhDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='WhUserName')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [WhUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='WhCancelled')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [WhCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='WhCancelledRemarks')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [WhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='WhRemarks')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [WhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='WhRecAddUser')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [WhRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='WhRecModifyUser')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [WhRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='Whfuturevc')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [Whfuturevc] [varchar] (250) CONSTRAINT [DF_LOsWriteOffHeader_Whfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whposted')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whposted] bit CONSTRAINT [DF_LOsWriteOffHeader_whposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [updatetime] datetime CONSTRAINT [DF_LOsWriteOffHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whdepartmentid')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whconexrate')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whdepexrate')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whexchangerates')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whotherdepid')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whotherdepid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whreceivedby')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whreceivedby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whauthorisedby')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whauthorisedby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whtype')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whtype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__LOsWriteO__rowgu__679450C0] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whexpenseaccid')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whexpenseaccid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whapartmentid')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whapartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whdoneby')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whdoneby] [varchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whApprovedby')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whApprovedby] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whApprovedid')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whApprovedid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whIhCRequestID')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whIhCRequestID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whIssuedby')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whIssuedby] [varchar] (150) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whIssuedid')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whIssuedid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whReceivedid')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whReceivedid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whtodepexrate')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whtodepexrate] [numeric] (18,9) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whVerifiedby')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whVerifiedby] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whverifiedid')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whverifiedid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME='whVerified')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD [whVerified] bit CONSTRAINT [DF__LOsWriteO__whVer__63849411] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroupRights' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [LOUserGroupRights] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroupRights' AND COLUMN_NAME='ModuleCode')
BEGIN
	ALTER TABLE [LOUserGroupRights] ADD [ModuleCode] [varchar] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroupRights' AND COLUMN_NAME='InterfaceID')
BEGIN
	ALTER TABLE [LOUserGroupRights] ADD [InterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroupRights' AND COLUMN_NAME='FunctionRights')
BEGIN
	ALTER TABLE [LOUserGroupRights] ADD [FunctionRights] [varchar] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroupRights' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [LOUserGroupRights] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroupRights' AND COLUMN_NAME='userid')
BEGIN
	ALTER TABLE [LOUserGroupRights] ADD [userid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroups' AND COLUMN_NAME='UserGroupID')
BEGIN
	ALTER TABLE [LOUserGroups] ADD [UserGroupID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroups' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [LOUserGroups] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroups' AND COLUMN_NAME='UserGroupName')
BEGIN
	ALTER TABLE [LOUserGroups] ADD [UserGroupName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroups' AND COLUMN_NAME='GroupDesc')
BEGIN
	ALTER TABLE [LOUserGroups] ADD [GroupDesc] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserGroups' AND COLUMN_NAME='LOcation')
BEGIN
	ALTER TABLE [LOUserGroups] ADD [LOcation] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserMasterGridSettings' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [LOUserMasterGridSettings] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserMasterGridSettings' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [LOUserMasterGridSettings] ADD [UserID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserMasterGridSettings' AND COLUMN_NAME='BackColor')
BEGIN
	ALTER TABLE [LOUserMasterGridSettings] ADD [BackColor] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserMasterGridSettings' AND COLUMN_NAME='ForeColor')
BEGIN
	ALTER TABLE [LOUserMasterGridSettings] ADD [ForeColor] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserMasterGridSettings' AND COLUMN_NAME='GridColor')
BEGIN
	ALTER TABLE [LOUserMasterGridSettings] ADD [GridColor] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserMasterGridSettings' AND COLUMN_NAME='HeaderColor')
BEGIN
	ALTER TABLE [LOUserMasterGridSettings] ADD [HeaderColor] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserMasterGridSettings' AND COLUMN_NAME='FontName')
BEGIN
	ALTER TABLE [LOUserMasterGridSettings] ADD [FontName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserMasterGridSettings' AND COLUMN_NAME='FontSize')
BEGIN
	ALTER TABLE [LOUserMasterGridSettings] ADD [FontSize] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserRights' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [LOUserRights] ADD [UserID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserRights' AND COLUMN_NAME='ModuleCode')
BEGIN
	ALTER TABLE [LOUserRights] ADD [ModuleCode] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserRights' AND COLUMN_NAME='InterfaceID')
BEGIN
	ALTER TABLE [LOUserRights] ADD [InterfaceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserRights' AND COLUMN_NAME='FunctionRights')
BEGIN
	ALTER TABLE [LOUserRights] ADD [FunctionRights] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUserRights' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [LOUserRights] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [LOUsers] ADD [UserID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [LOUsers] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [LOUsers] ADD [UserName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='UserPwd')
BEGIN
	ALTER TABLE [LOUsers] ADD [UserPwd] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='FullName')
BEGIN
	ALTER TABLE [LOUsers] ADD [FullName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [LOUsers] ADD [ShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='GodownID')
BEGIN
	ALTER TABLE [LOUsers] ADD [GodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='logedon')
BEGIN
	ALTER TABLE [LOUsers] ADD [logedon] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='GlobalUserID')
BEGIN
	ALTER TABLE [LOUsers] ADD [GlobalUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='ShiftId')
BEGIN
	ALTER TABLE [LOUsers] ADD [ShiftId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='userGroupId')
BEGIN
	ALTER TABLE [LOUsers] ADD [userGroupId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOUsers' AND COLUMN_NAME='EmailID')
BEGIN
	ALTER TABLE [LOUsers] ADD [EmailID] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeDetail' AND COLUMN_NAME='Ltimeid')
BEGIN
	ALTER TABLE [LtimeDetail] ADD [Ltimeid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeDetail' AND COLUMN_NAME='LtimeCompanyid')
BEGIN
	ALTER TABLE [LtimeDetail] ADD [LtimeCompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeDetail' AND COLUMN_NAME='Ltimestageid')
BEGIN
	ALTER TABLE [LtimeDetail] ADD [Ltimestageid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeDetail' AND COLUMN_NAME='LtimeDivisionId')
BEGIN
	ALTER TABLE [LtimeDetail] ADD [LtimeDivisionId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeDetail' AND COLUMN_NAME='LtimeNoofDays')
BEGIN
	ALTER TABLE [LtimeDetail] ADD [LtimeNoofDays] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeDetail' AND COLUMN_NAME='LtimeDetailNo')
BEGIN
	ALTER TABLE [LtimeDetail] ADD [LtimeDetailNo] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeHeader' AND COLUMN_NAME='LtimeID')
BEGIN
	ALTER TABLE [LtimeHeader] ADD [LtimeID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeHeader' AND COLUMN_NAME='LtimeDate')
BEGIN
	ALTER TABLE [LtimeHeader] ADD [LtimeDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeHeader' AND COLUMN_NAME='LtimeCompanyid')
BEGIN
	ALTER TABLE [LtimeHeader] ADD [LtimeCompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeHeader' AND COLUMN_NAME='LtimeSupplierId')
BEGIN
	ALTER TABLE [LtimeHeader] ADD [LtimeSupplierId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeHeader' AND COLUMN_NAME='LtimeItemid')
BEGIN
	ALTER TABLE [LtimeHeader] ADD [LtimeItemid] [numeric] (18,0) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeHeader' AND COLUMN_NAME='LtimeDepartmentid')
BEGIN
	ALTER TABLE [LtimeHeader] ADD [LtimeDepartmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeHeader' AND COLUMN_NAME='LtimeRemarks')
BEGIN
	ALTER TABLE [LtimeHeader] ADD [LtimeRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LtimeHeader' AND COLUMN_NAME='LtimePreparedBy')
BEGIN
	ALTER TABLE [LtimeHeader] ADD [LtimePreparedBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mealname' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [mealname] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mealname' AND COLUMN_NAME='mealnameid')
BEGIN
	ALTER TABLE [mealname] ADD [mealnameid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mealname' AND COLUMN_NAME='mealnamecode')
BEGIN
	ALTER TABLE [mealname] ADD [mealnamecode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mealname' AND COLUMN_NAME='mealname')
BEGIN
	ALTER TABLE [mealname] ADD [mealname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dstransid')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dstransid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dstranscode')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dstranscode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsItemid')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsItemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsToAdd')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsToAdd] [numeric] (18,2) CONSTRAINT [DF_MEDifferenceinStock_dsToAdd] DEFAULT ((0)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsToDeduct')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsToDeduct] [numeric] (18,2) CONSTRAINT [DF_MEDifferenceinStock_dsToDeduct] DEFAULT ((0)) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsFromGodownID')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsFromGodownID] int CONSTRAINT [DF_MEDifferenceinStock_dsFromGodownID] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsToGodownID')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsToGodownID] int CONSTRAINT [DF_MEDifferenceinStock_dsToGodownID] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsFromShopID')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsFromShopID] int CONSTRAINT [DF_MEDifferenceinStock_dsFromShopID] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsToShopID')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsToShopID] int CONSTRAINT [DF_MEDifferenceinStock_dsToShopID] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsFutureint')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsFutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsFutureVC')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsFutureVC] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsCostPrice')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsCostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsTransDate')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsTransDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME='dsDate')
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD [dsDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddDespatchID')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddDespatchID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddLocationId')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddLocationId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddGodownID')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddShipmentID')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddItemID')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddShopId')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddItemBadQty')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddItemBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddItemGoodQty')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddItemGoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddcostedprice')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddcostedprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MEiDespat__rowgu__6D4D2A16] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddpackingtypeid')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddpackingtypeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME='ddpackqty')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD [ddpackqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhDespatchID')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhDespatchID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhDespatchNo')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhDespatchNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhGodownID')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhDespatchDate')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhDespatchDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhShopID')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhCarrier')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhCarrier] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhIssueNoteID')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhIssueNoteID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhVehicleNo')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhVehicleNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhCancelled')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhCancelledRemarks')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhRemarks')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhRemarks] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhRecaddUser')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhRecaddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhRecmodifyUser')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhRecmodifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhSelected')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhSelected] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhTransFinished')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhTransFinished] bit CONSTRAINT [DF_MEiDespatchToShopHeader_dhTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhNoofDetails')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhNoofDetails] int CONSTRAINT [DF_MEiDespatchToShopHeader_dhNoofDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhShopReqid')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhShopReqid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhfuturevc')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhfuturevc] [varchar] (250) CONSTRAINT [DF_MEiDespatchToShopHeader_dhfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [updatetime] datetime CONSTRAINT [DF_MEiDespatchToShopHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhshopreqno')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhshopreqno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhdepartmentid')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhposted')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhposted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MEiDespat__rowgu__554B8353] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhconexrate')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhdepexrate')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhexchangerates')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME='dhDespatchTime')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD [dhDespatchTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestDetail' AND COLUMN_NAME='GRDRequestId')
BEGIN
	ALTER TABLE [MeiGodownRequestDetail] ADD [GRDRequestId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestDetail' AND COLUMN_NAME='GRDDetailId')
BEGIN
	ALTER TABLE [MeiGodownRequestDetail] ADD [GRDDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestDetail' AND COLUMN_NAME='GRDGodownId')
BEGIN
	ALTER TABLE [MeiGodownRequestDetail] ADD [GRDGodownId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestDetail' AND COLUMN_NAME='GRDItemId')
BEGIN
	ALTER TABLE [MeiGodownRequestDetail] ADD [GRDItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestDetail' AND COLUMN_NAME='GRDReqQty')
BEGIN
	ALTER TABLE [MeiGodownRequestDetail] ADD [GRDReqQty] [numeric] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MeiGodownRequestDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_MeiGodownRequestDetail_rowguid] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHRequestId')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHRequestId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHGodownId')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHGodownId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHRequestNo')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHRequestNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHRequestDate')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHRequestDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHRemarks')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHCancelled')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHCancelled] bit CONSTRAINT [DF_MeiGodownRequestHeader_GRHCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHCancelledRemarks')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHRecAddUserId')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHRecAddUserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHRecModUserId')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHRecModUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHToShopId')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHToShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHToGodownId')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHToGodownId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHTransfinished')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHTransfinished] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHNoofDetails')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHNoofDetails] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHType')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHType] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='GRHUsed')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [GRHUsed] bit CONSTRAINT [DF_MeiGodownRequestHeader_GRHUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='UpdateTime')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [UpdateTime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_MeiGodownRequestHeader_rowguid] DEFAULT (newid())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='gtdDespatchID')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [gtdDespatchID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='gtdGodownID')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [gtdGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='gtdLocationID')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [gtdLocationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='gtdShipmentID')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [gtdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='gtdItemID')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [gtdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='gtdToGodownid')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [gtdToGodownid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='gtdItemBadQty')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [gtdItemBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='gtdItemGoodQty')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [gtdItemGoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='gtdcostprice')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [gtdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MEiGodown__rowgu__4979DDF4] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthDespatchID')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthDespatchID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthDespatchNo')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthDespatchNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthFromGodownID')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthFromGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthToGodownID')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthToGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthDespatchDate')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthDespatchDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthCarrier')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthCarrier] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthIssueNoteID')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthIssueNoteID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthVehicleNo')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthVehicleNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthCancelled')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthCancelledRemarks')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthRemarks')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthRecAddUser')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthRecModifyUser')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthSelected')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthSelected] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthTransFinished')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthTransFinished] bit CONSTRAINT [DF_MEiGodownTransferHeader_gthTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthNoofDetails')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthNoofDetails] int CONSTRAINT [DF_MEiGodownTransferHeader_gthNoofDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthfuturevc')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthfuturevc] [varchar] (250) CONSTRAINT [DF_MEiGodownTransferHeader_gthfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [updatetime] datetime CONSTRAINT [DF_MEiGodownTransferHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthdepartmentid')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthposted')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthposted] bit CONSTRAINT [DF__meigodown__gthpo__23C0AB65] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MEiGodown__rowgu__78BEDCC2] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthconexrate')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthdepexrate')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthexchangerates')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthDespatchtime')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthDespatchtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME='gthGdnReqId')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD [gthGdnReqId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='GodownID')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [GodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='RequestID')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [RequestID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='ItemCode')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [ItemCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='ItemDescription')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [ItemDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='Barcode')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [Barcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='UnitID')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [UnitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [PackingTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='ColorID')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [ColorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='SizeID')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [SizeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__meiRQtoHQ__rowgu__3C0AD43D] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddDespatchid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddDespatchid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddlocationid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddlocationid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddGodownid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddGodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddShipmentid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddShipmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddItemid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddItemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddShopid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddShopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddItemBadQty')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddItemBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddItemGoodQty')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddItemGoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddCostedPrice')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddCostedPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddinvqty')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddinvqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__meiSpecia__rowgu__1A74D648] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddPackingTypeID')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddPackingTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME='ddPackQty')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD [ddPackQty] [numeric] (18,5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhdespatchid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhdespatchid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhdespatchno')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhdespatchno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhgodownid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhgodownid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhdespatchdate')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhdespatchdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhShopID')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhCarrier')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhCarrier] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhIssueNoteID')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhIssueNoteID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhVehicleno')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhVehicleno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhCancelled')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhCancelled] bit CONSTRAINT [DF_meiSpecialDespatchtoshopHeader_dhCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhCancelledRemarks')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhRemarks')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhRecAddUser')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhRecAddUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhRecModifyUser')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhRecModifyUser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhSelected')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhSelected] bit CONSTRAINT [DF_meiSpecialDespatchtoshopHeader_dhSelected] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhFuture')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhFuture] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhposted')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhposted] bit CONSTRAINT [DF_meiSpecialDespatchtoshopHeader_dhposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [updatetime] datetime CONSTRAINT [DF_meiSpecialDespatchtoshopHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhdepartmentid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__meiSpecia__rowgu__1530FE3E] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhconexrate')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhdepexrate')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME='dhexchangerates')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD [dhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEmessages' AND COLUMN_NAME='fromUserID')
BEGIN
	ALTER TABLE [MEmessages] ADD [fromUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEmessages' AND COLUMN_NAME='toUserID')
BEGIN
	ALTER TABLE [MEmessages] ADD [toUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEmessages' AND COLUMN_NAME='msgDateTime')
BEGIN
	ALTER TABLE [MEmessages] ADD [msgDateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEmessages' AND COLUMN_NAME='Subject')
BEGIN
	ALTER TABLE [MEmessages] ADD [Subject] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEmessages' AND COLUMN_NAME='Body')
BEGIN
	ALTER TABLE [MEmessages] ADD [Body] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEmessages' AND COLUMN_NAME='unread')
BEGIN
	ALTER TABLE [MEmessages] ADD [unread] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEmessages' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MEmessages] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MEmessage__rowgu__3FA65AF7] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdID')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdShipmentID')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdItemID')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdShopID')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdGodownid')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdGodownid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdAvailableGoodQty')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdAvailableGoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdAvailableBadQty')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdAvailableBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdDespatchedGoodQty')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdDespatchedGoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdDespatchedBadQty')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdDespatchedBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='dgdcostprice')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [dgdcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MEsDespat__rowgu__70099B30] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghID')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghShopID')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghNo')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghDate')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghGodownID')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghGodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghRemarks')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghRemarks] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghCancelled')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghCancelled] bit CONSTRAINT [DF_MEsDespatchtoGodownHeader_dghCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghCancelledRemarks')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghRecAddUser')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghRecModifyUser')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghUsed')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghUsed] bit CONSTRAINT [DF_MEsDespatchtoGodownHeader_dgUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghTransFinished')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghTransFinished] bit CONSTRAINT [DF_MEsDespatchtoGodownHeader_dghTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghNoofDetails')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghNoofDetails] int CONSTRAINT [DF_MEsDespatchtoGodownHeader_dghNoofDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghfuturevc')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghfuturevc] [varchar] (250) CONSTRAINT [DF_MEsDespatchtoGodownHeader_dghfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [updatetime] datetime CONSTRAINT [DF_MEsDespatchtoGodownHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghposted')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghposted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghdepartmentid')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MEsDespat__rowgu__0F7824E8] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghconexrate')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghdepexrate')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghexchangerates')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghtime')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME='dghGdnReqId')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD [dghGdnReqId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesfuture' AND COLUMN_NAME='futureint')
BEGIN
	ALTER TABLE [mesfuture] ADD [futureint] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesfuture' AND COLUMN_NAME='futuredatetime')
BEGIN
	ALTER TABLE [mesfuture] ADD [futuredatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesfuture' AND COLUMN_NAME='futurevarchar')
BEGIN
	ALTER TABLE [mesfuture] ADD [futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesfuture' AND COLUMN_NAME='futurenumeric')
BEGIN
	ALTER TABLE [mesfuture] ADD [futurenumeric] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesfuture' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [mesfuture] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__mesfuture__rowgu__5E2AE217] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND COLUMN_NAME='SRDrequestid')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] ADD [SRDrequestid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND COLUMN_NAME='srdshopid')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] ADD [srdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND COLUMN_NAME='srditemid')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] ADD [srditemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND COLUMN_NAME='srdToShopid')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] ADD [srdToShopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND COLUMN_NAME='srdgoodqty')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] ADD [srdgoodqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND COLUMN_NAME='srdbadqty')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] ADD [srdbadqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND COLUMN_NAME='srdSellingPrice')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] ADD [srdSellingPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHshopid')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHrequestID')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHrequestID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHrequestNO')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHrequestNO] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHrequestdate')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHrequestdate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHremarks')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHcancelled')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHcancelled] bit CONSTRAINT [DF_mesRequesttoShopHeader_SRHcancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHcancelledRemarks')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHcancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHrecadduser')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHrecadduser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHrecmoduser')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHrecmoduser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHtoShopid')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHtoShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHUsed')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHUsed] bit CONSTRAINT [DF_mesRequesttoShopHeader_SRHUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHTransfinished')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHTransfinished] bit CONSTRAINT [DF_mesRequesttoShopHeader_SRHTransfinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHNoofDetails')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHNoofDetails] int CONSTRAINT [DF_mesRequesttoShopHeader_SRHNoofDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHfuturevc')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHfuturevc] [varchar] (250) CONSTRAINT [DF_mesRequesttoShopHeader_SRHfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [updatetime] datetime CONSTRAINT [DF_mesRequesttoShopHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='srhType')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [srhType] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME='SRHrequestTime')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD [SRHrequestTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='RequestID')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [RequestID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='ItemCode')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [ItemCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='ItemDescription')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [ItemDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='Barcode')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [Barcode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='UnitID')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [UnitID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='PackingTypeID')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [PackingTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='ColorID')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [ColorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='SizeID')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [SizeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__mesRQtoHQ__rowgu__50A7951E] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutArrivalDetail' AND COLUMN_NAME='toaShopid')
BEGIN
	ALTER TABLE [mesTransferOutArrivalDetail] ADD [toaShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutArrivalDetail' AND COLUMN_NAME='toaTransOutId')
BEGIN
	ALTER TABLE [mesTransferOutArrivalDetail] ADD [toaTransOutId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutArrivalDetail' AND COLUMN_NAME='toaArrivalId')
BEGIN
	ALTER TABLE [mesTransferOutArrivalDetail] ADD [toaArrivalId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODid')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODshopid')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODitemid')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODitemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODshipmentid')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODshipmentid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODtoShopid')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODtoShopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODrequestedGoodqty')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODrequestedGoodqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODissuedGoodQty')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODissuedGoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODrequestedBadQty')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODrequestedBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODissuedBadQty')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODissuedBadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='TODcostprice')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [TODcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='todSellingPrice')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [todSellingPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='packid')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [packid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferoutDetail' AND COLUMN_NAME='packqty')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ADD [packqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHid')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHShopid')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHShopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHtoShopid')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHtoShopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHno')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHdate')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHremarks')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHCancelled')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHCancelled] bit CONSTRAINT [DF_mesTransferOutHeader_TOHCancelled] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHCancelledRemarks')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHDoneby')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHDoneby] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHrequestid')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHrequestid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOhUsed')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOhUsed] bit CONSTRAINT [DF_mesTransferOutHeader_TOhUsed] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHTransfinished')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHTransfinished] bit CONSTRAINT [DF_mesTransferOutHeader_TOHTransfinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHNoofDetails')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHNoofDetails] int CONSTRAINT [DF_mesTransferOutHeader_TOHNoofDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHfuturevc')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHfuturevc] [varchar] (250) CONSTRAINT [DF_mesTransferOutHeader_TOHfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [updatetime] datetime CONSTRAINT [DF_mesTransferOutHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='tohdepartmentid')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [tohdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='tohposted')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [tohposted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__mesTransf__rowgu__5145E845] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='tohconexrate')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [tohconexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='tohdepexrate')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [tohdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='tohexchangerates')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [tohexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='tohType')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [tohType] [char] (2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='TOHtime')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [TOHtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='tohrecadduser')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [tohrecadduser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME='tohrecmodifyuser')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD [tohrecmodifyuser] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='TransLogID')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [TransLogID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='LogDateTime')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [LogDateTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='InterfaceName')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [InterfaceName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='UserName')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [UserName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='Function')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [Function] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [ShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='GodownID')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [GodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='Comment')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [Comment] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='systemlog')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [systemlog] bit CONSTRAINT [DF_METransLog_systemlog] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MEsTransLog] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MEsTransL__rowgu__5F54107A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misCategoryDetail' AND COLUMN_NAME='mcdDetailID')
BEGIN
	ALTER TABLE [misCategoryDetail] ADD [mcdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misCategoryDetail' AND COLUMN_NAME='mcdId')
BEGIN
	ALTER TABLE [misCategoryDetail] ADD [mcdId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misCategoryDetail' AND COLUMN_NAME='mcdName')
BEGIN
	ALTER TABLE [misCategoryDetail] ADD [mcdName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misCategoryDetail' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [misCategoryDetail] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misCategoryHeader' AND COLUMN_NAME='mcID')
BEGIN
	ALTER TABLE [misCategoryHeader] ADD [mcID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misCategoryHeader' AND COLUMN_NAME='mcName')
BEGIN
	ALTER TABLE [misCategoryHeader] ADD [mcName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misCategoryHeader' AND COLUMN_NAME='mcSystem')
BEGIN
	ALTER TABLE [misCategoryHeader] ADD [mcSystem] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misCategoryHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [misCategoryHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misCategoryHeader' AND COLUMN_NAME='modulecode')
BEGIN
	ALTER TABLE [misCategoryHeader] ADD [modulecode] [char] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscInquiry' AND COLUMN_NAME='QueryID')
BEGIN
	ALTER TABLE [MiscInquiry] ADD [QueryID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscInquiry' AND COLUMN_NAME='QueryName')
BEGIN
	ALTER TABLE [MiscInquiry] ADD [QueryName] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscInquiry' AND COLUMN_NAME='Comments')
BEGIN
	ALTER TABLE [MiscInquiry] ADD [Comments] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscInquiry' AND COLUMN_NAME='Query')
BEGIN
	ALTER TABLE [MiscInquiry] ADD [Query] [varchar] (5000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscInquiry' AND COLUMN_NAME='ReportName')
BEGIN
	ALTER TABLE [MiscInquiry] ADD [ReportName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscInquiry' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [MiscInquiry] ADD [CompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscInquiry' AND COLUMN_NAME='Active')
BEGIN
	ALTER TABLE [MiscInquiry] ADD [Active] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscInquiry' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [MiscInquiry] ADD [Type] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscInquiry' AND COLUMN_NAME='Modulecode')
BEGIN
	ALTER TABLE [MiscInquiry] ADD [Modulecode] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='ItemCodeAutoGen')
BEGIN
	ALTER TABLE [MiscSettings] ADD [ItemCodeAutoGen] bit CONSTRAINT [DF_MiscSettings_ItemCodeAutoGen] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='SupplierCodeAutoGen')
BEGIN
	ALTER TABLE [MiscSettings] ADD [SupplierCodeAutoGen] bit CONSTRAINT [DF_MiscSettings_SupplierCodeAutoGen] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='CustomerCodeAutoGen')
BEGIN
	ALTER TABLE [MiscSettings] ADD [CustomerCodeAutoGen] bit CONSTRAINT [DF_MiscSettings_CustomerCodeAutoGen] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='showavailableqtyinTrOut')
BEGIN
	ALTER TABLE [MiscSettings] ADD [showavailableqtyinTrOut] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='showavailableqtyinGReq')
BEGIN
	ALTER TABLE [MiscSettings] ADD [showavailableqtyinGReq] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='backdateprocess')
BEGIN
	ALTER TABLE [MiscSettings] ADD [backdateprocess] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='lastdatatransfercheckdate')
BEGIN
	ALTER TABLE [MiscSettings] ADD [lastdatatransfercheckdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='showlocationswitch')
BEGIN
	ALTER TABLE [MiscSettings] ADD [showlocationswitch] bit CONSTRAINT [DF_MiscSettings_showlocationswitch] DEFAULT ((1))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='freezbalanceday')
BEGIN
	ALTER TABLE [MiscSettings] ADD [freezbalanceday] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='Docomparebcandstock')
BEGIN
	ALTER TABLE [MiscSettings] ADD [Docomparebcandstock] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='setcom')
BEGIN
	ALTER TABLE [MiscSettings] ADD [setcom] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='AllowItemCodeDuplication')
BEGIN
	ALTER TABLE [MiscSettings] ADD [AllowItemCodeDuplication] bit CONSTRAINT [DF_MiscSettings_AllowItemCodeDuplication] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='allowlocalpurchhq')
BEGIN
	ALTER TABLE [MiscSettings] ADD [allowlocalpurchhq] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='fixsellingpriceaftercosting')
BEGIN
	ALTER TABLE [MiscSettings] ADD [fixsellingpriceaftercosting] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='allowoldporefinpurchasebill')
BEGIN
	ALTER TABLE [MiscSettings] ADD [allowoldporefinpurchasebill] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='customertoshoponcreation')
BEGIN
	ALTER TABLE [MiscSettings] ADD [customertoshoponcreation] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='openingbalancenottallying')
BEGIN
	ALTER TABLE [MiscSettings] ADD [openingbalancenottallying] bit CONSTRAINT [DF__miscsetti__openi__01368937] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='moduleextended')
BEGIN
	ALTER TABLE [MiscSettings] ADD [moduleextended] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='defaultfetch')
BEGIN
	ALTER TABLE [MiscSettings] ADD [defaultfetch] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='ReportSorting')
BEGIN
	ALTER TABLE [MiscSettings] ADD [ReportSorting] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='AccountsFreezeDate')
BEGIN
	ALTER TABLE [MiscSettings] ADD [AccountsFreezeDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='Lctoaccount')
BEGIN
	ALTER TABLE [MiscSettings] ADD [Lctoaccount] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='AllowZeroLcMargin')
BEGIN
	ALTER TABLE [MiscSettings] ADD [AllowZeroLcMargin] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME='CustomisedFor')
BEGIN
	ALTER TABLE [MiscSettings] ADD [CustomisedFor] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misMenu' AND COLUMN_NAME='MenuID')
BEGIN
	ALTER TABLE [misMenu] ADD [MenuID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misMenu' AND COLUMN_NAME='MenuName')
BEGIN
	ALTER TABLE [misMenu] ADD [MenuName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misMenu' AND COLUMN_NAME='mcID')
BEGIN
	ALTER TABLE [misMenu] ADD [mcID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misMenu' AND COLUMN_NAME='mcDetailID')
BEGIN
	ALTER TABLE [misMenu] ADD [mcDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misMenu' AND COLUMN_NAME='MenuShortcutShift')
BEGIN
	ALTER TABLE [misMenu] ADD [MenuShortcutShift] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misMenu' AND COLUMN_NAME='MenuShortcutKeycode')
BEGIN
	ALTER TABLE [misMenu] ADD [MenuShortcutKeycode] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misMenu' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [misMenu] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misMenu' AND COLUMN_NAME='CategoryId')
BEGIN
	ALTER TABLE [misMenu] ADD [CategoryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misReportMenu' AND COLUMN_NAME='ReportID')
BEGIN
	ALTER TABLE [misReportMenu] ADD [ReportID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misReportMenu' AND COLUMN_NAME='MenuID')
BEGIN
	ALTER TABLE [misReportMenu] ADD [MenuID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misReportMenu' AND COLUMN_NAME='MenuName')
BEGIN
	ALTER TABLE [misReportMenu] ADD [MenuName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misReportMenu' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [misReportMenu] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misReports' AND COLUMN_NAME='ReportID')
BEGIN
	ALTER TABLE [misReports] ADD [ReportID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misReports' AND COLUMN_NAME='ReportName')
BEGIN
	ALTER TABLE [misReports] ADD [ReportName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='misReports' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [misReports] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moafuture' AND COLUMN_NAME='futureint')
BEGIN
	ALTER TABLE [moafuture] ADD [futureint] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moafuture' AND COLUMN_NAME='futurevarchar')
BEGIN
	ALTER TABLE [moafuture] ADD [futurevarchar] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moafuture' AND COLUMN_NAME='futuredatetime')
BEGIN
	ALTER TABLE [moafuture] ADD [futuredatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moafuture' AND COLUMN_NAME='futurenumeric')
BEGIN
	ALTER TABLE [moafuture] ADD [futurenumeric] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moafuture' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [moafuture] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__moafuture__rowgu__587208C1] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='JournalDetailID')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [JournalDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='JournalID')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [JournalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='JournalCredit')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [JournalCredit] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [AccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [Amount] [numeric] (18,9) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='ActualAmount')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [ActualAmount] [numeric] (18,9) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='depamount')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [depamount] [numeric] (18,9) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='PostGroup')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [PostGroup] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='JournalID')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [JournalID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='JournalDate')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [JournalDate] smalldatetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='ReferenceNo')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [ReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [Remarks] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [Type] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='Cancel')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [Cancel] bit CONSTRAINT [DF_MOaJournalHeader_Cancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='Realised')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [Realised] bit CONSTRAINT [DF_MOaJournalHeader_Realised] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='CurrencyId')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [CurrencyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='chequedate')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [chequedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME='bankdate')
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD [bankdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moapoitems' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [moapoitems] ADD [shopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moapoitems' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [moapoitems] ADD [itemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moapoitems' AND COLUMN_NAME='quantity')
BEGIN
	ALTER TABLE [moapoitems] ADD [quantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moapoitems' AND COLUMN_NAME='remarks')
BEGIN
	ALTER TABLE [moapoitems] ADD [remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moapoitems' AND COLUMN_NAME='username')
BEGIN
	ALTER TABLE [moapoitems] ADD [username] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moapoitems' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [moapoitems] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__moapoitem__rowgu__1F4543B4] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='slno')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [slno] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='Itemname')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [Itemname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='itemqty')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [itemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='BillUp')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [BillUp] [numeric] (28,22) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='Itemid')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [Itemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='customsup')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [customsup] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='customsduty')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [customsduty] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='ocperitem')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [ocperitem] [numeric] (28,22) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='custompercent')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [custompercent] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='dutyperitem')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [dutyperitem] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='billid')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [billid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mocostpreviewtemp' AND COLUMN_NAME='Billno')
BEGIN
	ALTER TABLE [mocostpreviewtemp] ADD [Billno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsGodownID')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsLocationID')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsLocationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsStockDate')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsStockDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsShipmentID')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsItemID')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsOpeningStock')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsOpeningStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsStock')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsOpeningBadStock')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsOpeningBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsBadStock')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='gsItemCost')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [gsItemCost] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='futureint')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='futuredate')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [futuredate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='futurevarchar')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [futurevarchar] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MOiGodownStock] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MOiGodown__rowgu__23893F36] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsGodownID')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsGodownID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsLocationID')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsLocationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsStockDate')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsStockDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsShipmentID')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsItemID')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsOpeningStock')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsOpeningStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsStock')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsOpeningBadStock')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsOpeningBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsBadStock')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='gsItemCost')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [gsItemCost] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MOiGodown__rowgu__0FA2421A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='GRDrequestID')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [GRDrequestID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='GRDshopID')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [GRDshopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='GRDitemID')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [GRDitemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='GRDgoodQty')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [GRDgoodQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='GRDbadQty')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [GRDbadQty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='grdreqcomments')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [grdreqcomments] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='grdReqorderstat')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [grdReqorderstat] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='grdexpectremarks')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [grdexpectremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__mosGoodsR__rowgu__064DE20A] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME='GRDDetailID')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD [GRDDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHrequestID')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHrequestID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHshopID')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHshopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHrequestNO')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHrequestNO] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHrequestDate')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHrequestDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHcancel')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHcancel] bit CONSTRAINT [DF_mosGoodsRequestHeader_GRHcancel] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHcancelRemarks')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHcancelRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHrecAddUser')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHrecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHrecModUser')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHrecModUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHremarks')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHIssuenotegenerated')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHIssuenotegenerated] bit CONSTRAINT [DF_mosGoodsRequestHeader_GRHIssuenotegenerated] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='grhSpecialRequest')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [grhSpecialRequest] bit CONSTRAINT [DF_mosGoodsRequestHeader_grhSpecialRequest] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='grhTransFinished')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [grhTransFinished] bit CONSTRAINT [DF_mosGoodsRequestHeader_grhTransFinished] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='grhNoofDetails')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [grhNoofDetails] int CONSTRAINT [DF_mosGoodsRequestHeader_grhNoofDetails] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='grhfuturevc')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [grhfuturevc] [varchar] (250) CONSTRAINT [DF_mosGoodsRequestHeader_grhfuturevc] DEFAULT ('') NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='grhrequesttype')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [grhrequesttype] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [updatetime] datetime CONSTRAINT [DF_mosGoodsRequestHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__mosGoodsR__rowgu__4C764630] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='GRHrequestTime')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [GRHrequestTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME='grhhqrequestgenerated')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD [grhhqrequestgenerated] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosrequestinvdetail' AND COLUMN_NAME='reqcompanyid')
BEGIN
	ALTER TABLE [mosrequestinvdetail] ADD [reqcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosrequestinvdetail' AND COLUMN_NAME='reqdid')
BEGIN
	ALTER TABLE [mosrequestinvdetail] ADD [reqdid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosrequestinvdetail' AND COLUMN_NAME='reqinvdshopid')
BEGIN
	ALTER TABLE [mosrequestinvdetail] ADD [reqinvdshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosrequestinvdetail' AND COLUMN_NAME='reqinvdinvoiceid')
BEGIN
	ALTER TABLE [mosrequestinvdetail] ADD [reqinvdinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosrequestinvdetail' AND COLUMN_NAME='reqddetailid')
BEGIN
	ALTER TABLE [mosrequestinvdetail] ADD [reqddetailid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosrequestinvdetail' AND COLUMN_NAME='reqReexportID')
BEGIN
	ALTER TABLE [mosrequestinvdetail] ADD [reqReexportID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME='serstkshopid')
BEGIN
	ALTER TABLE [mosshopservicestock] ADD [serstkshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME='serstkcompanyid')
BEGIN
	ALTER TABLE [mosshopservicestock] ADD [serstkcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME='serstkitemid')
BEGIN
	ALTER TABLE [mosshopservicestock] ADD [serstkitemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME='serstkstock')
BEGIN
	ALTER TABLE [mosshopservicestock] ADD [serstkstock] [numeric] (18,3) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME='serstkcost')
BEGIN
	ALTER TABLE [mosshopservicestock] ADD [serstkcost] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME='serstkfutureint')
BEGIN
	ALTER TABLE [mosshopservicestock] ADD [serstkfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME='serstkfuturevc')
BEGIN
	ALTER TABLE [mosshopservicestock] ADD [serstkfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME='serstkfuturebit')
BEGIN
	ALTER TABLE [mosshopservicestock] ADD [serstkfuturebit] bit CONSTRAINT [DF_mosshopservicestock_serstkfuturebit] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [mosshopservicestock] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__mosshopse__rowgu__052FA09F] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='StockDate')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [StockDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='ShipmentID')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [ShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='OpeningStock')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [OpeningStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='Stock')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [Stock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='OpeningBadStock')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [OpeningBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='BadStock')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [BadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='ItemCostPrice')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [ItemCostPrice] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='futureint')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [futureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='futuredate')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [futuredate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='futurevarchar')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [futurevarchar] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MOsShopStock] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MOsShopSt__rowgu__75C27486] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='StockDate')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [StockDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='ShipmentID')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [ShipmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='ItemID')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [ItemID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='OpeningStock')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [OpeningStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='Stock')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [Stock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='OpeningBadStock')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [OpeningBadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='BadStock')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [BadStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='ItemCostPrice')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [ItemCostPrice] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__MOsShopSt__rowgu__155B1B70] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swID')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swShopID')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swGodownID')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swGodownID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swDate')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swItemID')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swCostPrice')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swCostPrice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swAddStock')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swAddStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swDedStock')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swDedStock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swUserName')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swUserName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swposted')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swposted] bit CONSTRAINT [DF_moStockWriteOffHQ_swposted] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [updatetime] datetime CONSTRAINT [DF_moStockWriteOffHQ_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swTransId')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swTransId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swTransCode')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swTransCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swWriteOffType')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swWriteOffType] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swdepExRate')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swdepExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swdConExRate')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swdConExRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swExchangeRates')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swExchangeRates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME='swTranDate')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD [swTranDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshShopID')
BEGIN
	ALTER TABLE [nid] ADD [poshShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshBillID')
BEGIN
	ALTER TABLE [nid] ADD [poshBillID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshBillNo')
BEGIN
	ALTER TABLE [nid] ADD [poshBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshBillDate')
BEGIN
	ALTER TABLE [nid] ADD [poshBillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshCustomerName')
BEGIN
	ALTER TABLE [nid] ADD [poshCustomerName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshCancelled')
BEGIN
	ALTER TABLE [nid] ADD [poshCancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshCancelledRemarks')
BEGIN
	ALTER TABLE [nid] ADD [poshCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshRecAddUser')
BEGIN
	ALTER TABLE [nid] ADD [poshRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshRecModifyUser')
BEGIN
	ALTER TABLE [nid] ADD [poshRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshPosted')
BEGIN
	ALTER TABLE [nid] ADD [poshPosted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshDiscount')
BEGIN
	ALTER TABLE [nid] ADD [poshDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshBillAmount')
BEGIN
	ALTER TABLE [nid] ADD [poshBillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshCashAccID')
BEGIN
	ALTER TABLE [nid] ADD [poshCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshSalesAccID')
BEGIN
	ALTER TABLE [nid] ADD [poshSalesAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshCompanyID')
BEGIN
	ALTER TABLE [nid] ADD [poshCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshReturned')
BEGIN
	ALTER TABLE [nid] ADD [poshReturned] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshWholesale')
BEGIN
	ALTER TABLE [nid] ADD [poshWholesale] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshcbid')
BEGIN
	ALTER TABLE [nid] ADD [poshcbid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshExchangeRate')
BEGIN
	ALTER TABLE [nid] ADD [poshExchangeRate] [numeric] (28,8) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshfuturevc')
BEGIN
	ALTER TABLE [nid] ADD [poshfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [nid] ADD [updatetime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshDepartmentid')
BEGIN
	ALTER TABLE [nid] ADD [poshDepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshsalespersonid')
BEGIN
	ALTER TABLE [nid] ADD [poshsalespersonid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshcustomerid')
BEGIN
	ALTER TABLE [nid] ADD [poshcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshCustomerCardNo')
BEGIN
	ALTER TABLE [nid] ADD [poshCustomerCardNo] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshfutureint')
BEGIN
	ALTER TABLE [nid] ADD [poshfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshcurexrates')
BEGIN
	ALTER TABLE [nid] ADD [poshcurexrates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [nid] ADD [rowguid] uniqueidentifier  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshdepexrate')
BEGIN
	ALTER TABLE [nid] ADD [poshdepexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshexchangerates')
BEGIN
	ALTER TABLE [nid] ADD [poshexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshUserId')
BEGIN
	ALTER TABLE [nid] ADD [poshUserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshCounterId')
BEGIN
	ALTER TABLE [nid] ADD [poshCounterId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='ContactCardNo')
BEGIN
	ALTER TABLE [nid] ADD [ContactCardNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshDiscountAmt')
BEGIN
	ALTER TABLE [nid] ADD [poshDiscountAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshBalance')
BEGIN
	ALTER TABLE [nid] ADD [poshBalance] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshBillTime')
BEGIN
	ALTER TABLE [nid] ADD [poshBillTime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nid' AND COLUMN_NAME='poshDeliveryNeeded')
BEGIN
	ALTER TABLE [nid] ADD [poshDeliveryNeeded] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nidd' AND COLUMN_NAME='id')
BEGIN
	ALTER TABLE [nidd] ADD [id] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='nidd' AND COLUMN_NAME='name')
BEGIN
	ALTER TABLE [nidd] ADD [name] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol1' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [ol1] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol1' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [ol1] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol1' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [ol1] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol1' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [ol1] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol1' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [ol1] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol1' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [ol1] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol1' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [ol1] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol1' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [ol1] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol2' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [ol2] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol2' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [ol2] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol2' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [ol2] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol2' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [ol2] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol2' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [ol2] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol2' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [ol2] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol2' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [ol2] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol2' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [ol2] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol3' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [ol3] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol3' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [ol3] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol3' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [ol3] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol3' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [ol3] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol3' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [ol3] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol3' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [ol3] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol3' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [ol3] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ol3' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [ol3] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='TransID')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [TransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [DepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='RefTransID')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [RefTransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='RefTransNo')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [RefTransNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='RefTransType')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [RefTransType] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='RefTransDate')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [RefTransDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='EmpID')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [EmpID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='EmpName')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [EmpName] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='EmpNo')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [EmpNo] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='AccountDesc')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [AccountDesc] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='TransCurrSymbol')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [TransCurrSymbol] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='AccCurrSymbol')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [AccCurrSymbol] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='TransCurrID')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [TransCurrID] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='AccCurrID')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [AccCurrID] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='RefTransAmount')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [RefTransAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='AccountAmount')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [AccountAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='DeptAmount')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [DeptAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='CompAmount')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [CompAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkDetails' AND COLUMN_NAME='Credit')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ADD [Credit] tinyint  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='TransID')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [TransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [DepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='TransNo')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [TransNo] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='TransDate')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [TransDate] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='TransType')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [TransType] [char] (1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [Remarks] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [Cancelled] bit CONSTRAINT [DF__paPayAccL__Cance__04866080] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='CancelRemarks')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [CancelRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [Posted] bit CONSTRAINT [DF__paPayAccL__Poste__057A84B9] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME='UpdateTime')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD [UpdateTime] datetime CONSTRAINT [DF__paPayAccL__Updat__066EA8F2] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='TransID')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [TransID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [DepartmentID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [AccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='AccountDesc')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [AccountDesc] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='Description')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [Description] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='AccCurrID')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [AccCurrID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='AccCurrSymbol')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [AccCurrSymbol] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='RefCurrID')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [RefCurrID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='RefCurrSymbol')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [RefCurrSymbol] [varchar] (25) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='DebitAmount')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [DebitAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='CreditAmount')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [CreditAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='RefTransAmount')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [RefTransAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='DeptAmount')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [DeptAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='CompAmount')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [CompAmount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND COLUMN_NAME='Editable')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ADD [Editable] [char] (1) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='ReportId')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [ReportId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='Discription')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [Discription] [nvarchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='ReportPath')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [ReportPath] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='SendTime')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [SendTime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='Interval')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [Interval] [char] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='MonthInterval')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [MonthInterval] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='WeekInterval')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [WeekInterval] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='Subject')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [Subject] [nvarchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='Message')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [Message] [nvarchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailScheduler' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [PIS_EmailScheduler] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSchedulerRecepients' AND COLUMN_NAME='ReportId')
BEGIN
	ALTER TABLE [PIS_EmailSchedulerRecepients] ADD [ReportId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSchedulerRecepients' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [PIS_EmailSchedulerRecepients] ADD [UserId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSchedulerRecepients' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [PIS_EmailSchedulerRecepients] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSchedulerReportParameter' AND COLUMN_NAME='ReportId')
BEGIN
	ALTER TABLE [PIS_EmailSchedulerReportParameter] ADD [ReportId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSchedulerReportParameter' AND COLUMN_NAME='ParameterOrder')
BEGIN
	ALTER TABLE [PIS_EmailSchedulerReportParameter] ADD [ParameterOrder] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSchedulerReportParameter' AND COLUMN_NAME='ParameterValue')
BEGIN
	ALTER TABLE [PIS_EmailSchedulerReportParameter] ADD [ParameterValue] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSchedulerReportParameter' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [PIS_EmailSchedulerReportParameter] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSettings' AND COLUMN_NAME='SMTP')
BEGIN
	ALTER TABLE [PIS_EmailSettings] ADD [SMTP] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSettings' AND COLUMN_NAME='Password')
BEGIN
	ALTER TABLE [PIS_EmailSettings] ADD [Password] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSettings' AND COLUMN_NAME='Port')
BEGIN
	ALTER TABLE [PIS_EmailSettings] ADD [Port] [nchar] (10) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSettings' AND COLUMN_NAME='Fromaddress')
BEGIN
	ALTER TABLE [PIS_EmailSettings] ADD [Fromaddress] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSettings' AND COLUMN_NAME='OdbcName')
BEGIN
	ALTER TABLE [PIS_EmailSettings] ADD [OdbcName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSettings' AND COLUMN_NAME='OdbcUser')
BEGIN
	ALTER TABLE [PIS_EmailSettings] ADD [OdbcUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSettings' AND COLUMN_NAME='OdbcPassword')
BEGIN
	ALTER TABLE [PIS_EmailSettings] ADD [OdbcPassword] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSettings' AND COLUMN_NAME='DatabaseName')
BEGIN
	ALTER TABLE [PIS_EmailSettings] ADD [DatabaseName] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PIS_EmailSettings' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [PIS_EmailSettings] ADD [CompanyId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='posShortCut' AND COLUMN_NAME='ShortCut')
BEGIN
	ALTER TABLE [posShortCut] ADD [ShortCut] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='posShortCut' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [posShortCut] ADD [ItemId] [numeric] (18,0) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='posShortCut' AND COLUMN_NAME='Barcode')
BEGIN
	ALTER TABLE [posShortCut] ADD [Barcode] [varchar] (30) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Product' AND COLUMN_NAME='Cust')
BEGIN
	ALTER TABLE [Product] ADD [Cust] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Product' AND COLUMN_NAME='Product')
BEGIN
	ALTER TABLE [Product] ADD [Product] [varchar] (20) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Product' AND COLUMN_NAME='QTY')
BEGIN
	ALTER TABLE [Product] ADD [QTY] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdBillID')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdItemID')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdItemID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdDetailID')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdPackingTypeID')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdPackingTypeID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdPOQuantity')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdPOQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdPOUnitPrice')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdPOUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdItemQuantity')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdItemQuantity] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdItemUnitPrice')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdItemUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdDummyUnitPrice')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdDummyUnitPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdItemCostedPrice')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdItemCostedPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdItemFixedPrice')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdItemFixedPrice] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbddiscount')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbddiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdpoid')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdpoid] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdsellingprice')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdsellingprice] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbdwholesaleprice')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbdwholesaleprice] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBilldetail' AND COLUMN_NAME='pbddiscountprice')
BEGIN
	ALTER TABLE [PurchaseBilldetail] ADD [pbddiscountprice] [nvarchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhBillID')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhBillNo')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhVendorBillNo')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhVendorBillNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhBillDate')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhBillDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhVendorID')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhPOID')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhPOID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhBillAmount')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhBillAmount] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhDiscount')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhDiscountAccID')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhDiscountAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhAdjustmentAmount')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhAdjustmentAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhDueDateforPayment')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhDueDateforPayment] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhBankCashAccID')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhBankCashAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhChequeNo')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhFinancialID')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhFinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhDepartmentID')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhRemarks')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhTobeDespatched')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhTobeDespatched] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhDespatched')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhDespatched] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhCashPurchase')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhCashPurchase] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhExchangeNature')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhExchangeNature] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhCancelled')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhCancelledRemarks')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhCancelledRemarks] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhPosted')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhPosted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhRecAddUser')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhRecAddUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhRecModifyUser')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhRecModifyUser] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhCompanyID')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhCompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhUsed')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhUsed] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhvendorRefNo')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhvendorRefNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhdummyICost')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhdummyICost] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhdummyFCharge')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhdummyFCharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhdummyOCharge')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhdummyOCharge] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhCustomExchangeRate')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhCustomExchangeRate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhPurchaseAccID')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhPurchaseAccID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhSettled')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhSettled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='pbhexchangerate')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [pbhexchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='PurchaseBillHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [PurchaseBillHeader] ADD [updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='RamzanSales' AND COLUMN_NAME='SNO')
BEGIN
	ALTER TABLE [RamzanSales] ADD [SNO] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='RamzanSales' AND COLUMN_NAME='ItemCode')
BEGIN
	ALTER TABLE [RamzanSales] ADD [ItemCode] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='RamzanSales' AND COLUMN_NAME=' ')
BEGIN
	ALTER TABLE [RamzanSales] ADD [ ] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='RamzanSales' AND COLUMN_NAME='CostPrice')
BEGIN
	ALTER TABLE [RamzanSales] ADD [CostPrice] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='RamzanSales' AND COLUMN_NAME='SellingPrice')
BEGIN
	ALTER TABLE [RamzanSales] ADD [SellingPrice] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='RamzanSales' AND COLUMN_NAME='SalePrice')
BEGIN
	ALTER TABLE [RamzanSales] ADD [SalePrice] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCreditDetails' AND COLUMN_NAME='ReceiptDebitID')
BEGIN
	ALTER TABLE [ReceiptVoucherCreditDetails] ADD [ReceiptDebitID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCreditDetails' AND COLUMN_NAME='ReceiptID')
BEGIN
	ALTER TABLE [ReceiptVoucherCreditDetails] ADD [ReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCreditDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ReceiptVoucherCreditDetails] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCreditDetails' AND COLUMN_NAME='AccountID')
BEGIN
	ALTER TABLE [ReceiptVoucherCreditDetails] ADD [AccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCreditDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [ReceiptVoucherCreditDetails] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCreditDetails' AND COLUMN_NAME='AccountDescription')
BEGIN
	ALTER TABLE [ReceiptVoucherCreditDetails] ADD [AccountDescription] [nvarchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCustomerDetails' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [ReceiptVoucherCustomerDetails] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCustomerDetails' AND COLUMN_NAME='ReceiptId')
BEGIN
	ALTER TABLE [ReceiptVoucherCustomerDetails] ADD [ReceiptId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCustomerDetails' AND COLUMN_NAME='Detailid')
BEGIN
	ALTER TABLE [ReceiptVoucherCustomerDetails] ADD [Detailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCustomerDetails' AND COLUMN_NAME='CustomerId')
BEGIN
	ALTER TABLE [ReceiptVoucherCustomerDetails] ADD [CustomerId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCustomerDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [ReceiptVoucherCustomerDetails] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCustomerDetails' AND COLUMN_NAME='CustomerAmount')
BEGIN
	ALTER TABLE [ReceiptVoucherCustomerDetails] ADD [CustomerAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='ReceiptID')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [ReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='ReceiptDetailID')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [ReceiptDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='hqAccountsInvoiceID')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [hqAccountsInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='posaccountsInvoiceID')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [posaccountsInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='posinvoiceid')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [posinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='posspinvoiceid')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [posspinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='Posserviceinvoiceid')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [Posserviceinvoiceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='AmountReceived')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [AmountReceived] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='dcnid')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [dcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='dueperiod')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [dueperiod] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='phpaymentid')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [phpaymentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='losdcnid')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [losdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='posexportid')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [posexportid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='RoomBillID')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [RoomBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='UtilityBillID')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [UtilityBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='AccInvoiceID')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [AccInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='fineid')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [fineid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME='fandbInvoiceID')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD [fandbInvoiceID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='ReceiptID')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [ReceiptID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='ReceiptNo')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [ReceiptNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='ReceiptDate')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [ReceiptDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='CustomerID')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [CustomerID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='BankCashAccountID')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [BankCashAccountID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='ReceivedFrom')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [ReceivedFrom] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='ChequeDetails')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [ChequeDetails] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='ReferenceNo')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [ReferenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='ReferenceDate')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [ReferenceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [FinancialID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='ExchangeNature')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [ExchangeNature] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='cbreferenceno')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [cbreferenceno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='exchangerate')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [exchangerate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='receipttype')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [receipttype] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='customeramount')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [customeramount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='debitaccountid')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [debitaccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='debitamount')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [debitamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='chequedate')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [chequedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='Posted')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [Posted] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [Cancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='dummyreceiptid')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [dummyreceiptid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='recshopid')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [recshopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [updatetime] datetime CONSTRAINT [DF_ReceiptVoucherHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='creditaccountid')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [creditaccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='creditamount')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [creditamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='refjournalid')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [refjournalid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='depexrate')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [depexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='receiptcustomerid')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [receiptcustomerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='exchangerates')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [exchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='paymentid')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [paymentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='refdcnid')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [refdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='LastModified')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [LastModified] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='cusvenaccexrate')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [cusvenaccexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='Discountaccountid')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [Discountaccountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='DiscountAmount')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [DiscountAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='Confirmed')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [Confirmed] bit CONSTRAINT [DF__ReceiptVo__Confi__1DE63FD0] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD [UserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportCategoryDetail' AND COLUMN_NAME='RepDetailId')
BEGIN
	ALTER TABLE [ReportCategoryDetail] ADD [RepDetailId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportCategoryDetail' AND COLUMN_NAME='RepCatId')
BEGIN
	ALTER TABLE [ReportCategoryDetail] ADD [RepCatId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportCategoryDetail' AND COLUMN_NAME='RepDetailName')
BEGIN
	ALTER TABLE [ReportCategoryDetail] ADD [RepDetailName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportCategoryDetail' AND COLUMN_NAME='RepConstant')
BEGIN
	ALTER TABLE [ReportCategoryDetail] ADD [RepConstant] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportCategoryHeader' AND COLUMN_NAME='repCatId')
BEGIN
	ALTER TABLE [ReportCategoryHeader] ADD [repCatId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportCategoryHeader' AND COLUMN_NAME='repCatName')
BEGIN
	ALTER TABLE [ReportCategoryHeader] ADD [repCatName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportCategoryHeader' AND COLUMN_NAME='repCatModCode')
BEGIN
	ALTER TABLE [ReportCategoryHeader] ADD [repCatModCode] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportCategoryHeader' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [ReportCategoryHeader] ADD [Type] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportNames' AND COLUMN_NAME='ReportID')
BEGIN
	ALTER TABLE [ReportNames] ADD [ReportID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportNames' AND COLUMN_NAME='ReportName')
BEGIN
	ALTER TABLE [ReportNames] ADD [ReportName] [varchar] (200) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportNames' AND COLUMN_NAME='ReportFileName')
BEGIN
	ALTER TABLE [ReportNames] ADD [ReportFileName] [varchar] (200) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportNames' AND COLUMN_NAME='FrameID')
BEGIN
	ALTER TABLE [ReportNames] ADD [FrameID] smallint  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportNames' AND COLUMN_NAME='Criterias')
BEGIN
	ALTER TABLE [ReportNames] ADD [Criterias] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportNames' AND COLUMN_NAME='ReportTitle')
BEGIN
	ALTER TABLE [ReportNames] ADD [ReportTitle] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportNames' AND COLUMN_NAME='BackendType')
BEGIN
	ALTER TABLE [ReportNames] ADD [BackendType] [varchar] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportNames' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [ReportNames] ADD [rowguid] uniqueidentifier CONSTRAINT [DF__ReportNam__rowgu__2685A772] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='RDATE')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [RDATE] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='rreceipt')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [rreceipt] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='rtype')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [rtype] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='rledgername')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [rledgername] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='ldebitamt')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [ldebitamt] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='lcreditamt')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [lcreditamt] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='rbalance')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [rbalance] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='rcnt')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [rcnt] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='rremarks')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [rremarks] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='rjournalid')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [rjournalid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='rreferenceid')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [rreferenceid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='REPORTOUT' AND COLUMN_NAME='rdiff')
BEGIN
	ALTER TABLE [REPORTOUT] ADD [rdiff] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='reportrangevalues' AND COLUMN_NAME='Rangeid')
BEGIN
	ALTER TABLE [reportrangevalues] ADD [Rangeid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='reportrangevalues' AND COLUMN_NAME='RangeDetailid')
BEGIN
	ALTER TABLE [reportrangevalues] ADD [RangeDetailid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='reportrangevalues' AND COLUMN_NAME='Reportid')
BEGIN
	ALTER TABLE [reportrangevalues] ADD [Reportid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='reportrangevalues' AND COLUMN_NAME='FromRange')
BEGIN
	ALTER TABLE [reportrangevalues] ADD [FromRange] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='reportrangevalues' AND COLUMN_NAME='ToRange')
BEGIN
	ALTER TABLE [reportrangevalues] ADD [ToRange] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='reportrangevalues' AND COLUMN_NAME='rangename')
BEGIN
	ALTER TABLE [reportrangevalues] ADD [rangename] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='reportrangevalues' AND COLUMN_NAME='rangecode')
BEGIN
	ALTER TABLE [reportrangevalues] ADD [rangecode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='restbotkotdetails' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [restbotkotdetails] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='restbotkotdetails' AND COLUMN_NAME='Outletid')
BEGIN
	ALTER TABLE [restbotkotdetails] ADD [Outletid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='restbotkotdetails' AND COLUMN_NAME='restno')
BEGIN
	ALTER TABLE [restbotkotdetails] ADD [restno] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='restbotkotdetails' AND COLUMN_NAME='botid')
BEGIN
	ALTER TABLE [restbotkotdetails] ADD [botid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='restbotkotdetails' AND COLUMN_NAME='kotid')
BEGIN
	ALTER TABLE [restbotkotdetails] ADD [kotid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SCHEDULEDETAIL' AND COLUMN_NAME='scdid')
BEGIN
	ALTER TABLE [SCHEDULEDETAIL] ADD [scdid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SCHEDULEDETAIL' AND COLUMN_NAME='scdjobid')
BEGIN
	ALTER TABLE [SCHEDULEDETAIL] ADD [scdjobid] [varchar] (100) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SCHEDULEDETAIL' AND COLUMN_NAME='scdjobname')
BEGIN
	ALTER TABLE [SCHEDULEDETAIL] ADD [scdjobname] [varchar] (250) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SCHEDULEDETAIL' AND COLUMN_NAME='scdlaststarttime')
BEGIN
	ALTER TABLE [SCHEDULEDETAIL] ADD [scdlaststarttime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SCHEDULEDETAIL' AND COLUMN_NAME='scdlastexecutedtime')
BEGIN
	ALTER TABLE [SCHEDULEDETAIL] ADD [scdlastexecutedtime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SCHEDULEDETAIL' AND COLUMN_NAME='scdskipno')
BEGIN
	ALTER TABLE [SCHEDULEDETAIL] ADD [scdskipno] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ScheduleHeader' AND COLUMN_NAME='schid')
BEGIN
	ALTER TABLE [ScheduleHeader] ADD [schid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ScheduleHeader' AND COLUMN_NAME='schinterval')
BEGIN
	ALTER TABLE [ScheduleHeader] ADD [schinterval] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ScheduleHeader' AND COLUMN_NAME='schstarttime')
BEGIN
	ALTER TABLE [ScheduleHeader] ADD [schstarttime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ScheduleHeader' AND COLUMN_NAME='schuptime')
BEGIN
	ALTER TABLE [ScheduleHeader] ADD [schuptime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='InvoiceID')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [InvoiceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='InvoiceDetailID')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [InvoiceDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='ServiceName')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [ServiceName] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='ServiceTerm')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [ServiceTerm] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='ServiceQty')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [ServiceQty] int CONSTRAINT [DF_ServiceInvoiceDetails_ServiceQty] DEFAULT ((0))  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='Accountid')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [Accountid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='clearingReqId')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [clearingReqId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='ClearingOCAmt')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [ClearingOCAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='ClearingCommAmt')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [ClearingCommAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME='UserID')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD [UserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceChequeDetails' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ShipmentClearenceChequeDetails] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceChequeDetails' AND COLUMN_NAME='ClearenceID')
BEGIN
	ALTER TABLE [ShipmentClearenceChequeDetails] ADD [ClearenceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceChequeDetails' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [ShipmentClearenceChequeDetails] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceChequeDetails' AND COLUMN_NAME='ChequeNo')
BEGIN
	ALTER TABLE [ShipmentClearenceChequeDetails] ADD [ChequeNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceChequeDetails' AND COLUMN_NAME='ChequeAmt')
BEGIN
	ALTER TABLE [ShipmentClearenceChequeDetails] ADD [ChequeAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceChequeDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ShipmentClearenceChequeDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND COLUMN_NAME='ClearenceID')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ADD [ClearenceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND COLUMN_NAME='ClearenceNo')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ADD [ClearenceNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND COLUMN_NAME='ClearenceDate')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ADD [ClearenceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND COLUMN_NAME='ClearedBy')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ADD [ClearedBy] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND COLUMN_NAME='ActualClearenceDate')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ADD [ActualClearenceDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ADD [Cancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='ClearenceID')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [ClearenceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='ClearenceReqID')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [ClearenceReqID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='ClearenceDetailID')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [ClearenceDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='ItemDescription')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [ItemDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='Packing')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [Packing] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='Unit')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [Unit] [varchar] (25) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='Qty')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [Qty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='NoofPackages')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [NoofPackages] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND COLUMN_NAME='ClearenceID')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] ADD [ClearenceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND COLUMN_NAME='ClearenceReqID')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] ADD [ClearenceReqID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND COLUMN_NAME='OCDescription')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] ADD [OCDescription] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND COLUMN_NAME='OCAmt')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] ADD [OCAmt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='ClearenceID')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [ClearenceID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='DetailID')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [DetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='ClearenceReqID')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [ClearenceReqID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='ArrivalDate')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [ArrivalDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='BLorAWNo')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [BLorAWNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='BLorAWDate')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [BLorAWDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='NoofPackages')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [NoofPackages] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='GrossWeight')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [GrossWeight] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='NameofVessel')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [NameofVessel] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND COLUMN_NAME='Remarks')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD [Remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopbfMealplan' AND COLUMN_NAME='Companyid')
BEGIN
	ALTER TABLE [ShopbfMealplan] ADD [Companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopbfMealplan' AND COLUMN_NAME='Outletid')
BEGIN
	ALTER TABLE [ShopbfMealplan] ADD [Outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopbfMealplan' AND COLUMN_NAME='Mealnameid')
BEGIN
	ALTER TABLE [ShopbfMealplan] ADD [Mealnameid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopFooterImage' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ShopFooterImage] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopFooterImage' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ShopFooterImage] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopFooterImage' AND COLUMN_NAME='FooterImage')
BEGIN
	ALTER TABLE [ShopFooterImage] ADD [FooterImage] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopFooterImage' AND COLUMN_NAME='type')
BEGIN
	ALTER TABLE [ShopFooterImage] ADD [type] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopHeaderImage' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [ShopHeaderImage] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopHeaderImage' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [ShopHeaderImage] ADD [ShopID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopHeaderImage' AND COLUMN_NAME='HeaderImage')
BEGIN
	ALTER TABLE [ShopHeaderImage] ADD [HeaderImage] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ShopHeaderImage' AND COLUMN_NAME='type')
BEGIN
	ALTER TABLE [ShopHeaderImage] ADD [type] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='locid')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [locid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='loctype')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [loctype] [char] (1) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [itemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='sdate')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [sdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='Transno')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [Transno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='TransID')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [TransID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='Transqty')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [Transqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [Type] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='mode')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [mode] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='oldstock')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [oldstock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopstockcheck' AND COLUMN_NAME='newstock')
BEGIN
	ALTER TABLE [shopstockcheck] ADD [newstock] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopWallpaper' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [shopWallpaper] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopWallpaper' AND COLUMN_NAME='ShopID')
BEGIN
	ALTER TABLE [shopWallpaper] ADD [ShopID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopWallpaper' AND COLUMN_NAME='WallpaperImage')
BEGIN
	ALTER TABLE [shopWallpaper] ADD [WallpaperImage] image  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='shopWallpaper' AND COLUMN_NAME='types')
BEGIN
	ALTER TABLE [shopWallpaper] ADD [types] [varchar] (5) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SpecialPriceSettings' AND COLUMN_NAME='IsSPApplied')
BEGIN
	ALTER TABLE [SpecialPriceSettings] ADD [IsSPApplied] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SpecialPricing' AND COLUMN_NAME='SPItemId')
BEGIN
	ALTER TABLE [SpecialPricing] ADD [SPItemId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SpecialPricing' AND COLUMN_NAME='SPItemCode')
BEGIN
	ALTER TABLE [SpecialPricing] ADD [SPItemCode] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SpecialPricing' AND COLUMN_NAME='SPPackingTypeId')
BEGIN
	ALTER TABLE [SpecialPricing] ADD [SPPackingTypeId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SpecialPricing' AND COLUMN_NAME='SPItemCostPrice')
BEGIN
	ALTER TABLE [SpecialPricing] ADD [SPItemCostPrice] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SpecialPricing' AND COLUMN_NAME='SPItemSellingPrice')
BEGIN
	ALTER TABLE [SpecialPricing] ADD [SPItemSellingPrice] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SpecialPricing' AND COLUMN_NAME='SPNewPrice')
BEGIN
	ALTER TABLE [SpecialPricing] ADD [SPNewPrice] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='SpecialPricing' AND COLUMN_NAME='SPPriceChanged')
BEGIN
	ALTER TABLE [SpecialPricing] ADD [SPPriceChanged] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ss' AND COLUMN_NAME='t1')
BEGIN
	ALTER TABLE [ss] ADD [t1] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ss' AND COLUMN_NAME='t2')
BEGIN
	ALTER TABLE [ss] ADD [t2] [char] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetAccountsLink' AND COLUMN_NAME='tacCompanyID')
BEGIN
	ALTER TABLE [TargetAccountsLink] ADD [tacCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetAccountsLink' AND COLUMN_NAME='tacTargetID')
BEGIN
	ALTER TABLE [TargetAccountsLink] ADD [tacTargetID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetAccountsLink' AND COLUMN_NAME='tacDetailID')
BEGIN
	ALTER TABLE [TargetAccountsLink] ADD [tacDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetAccountsLink' AND COLUMN_NAME='tacAccountID')
BEGIN
	ALTER TABLE [TargetAccountsLink] ADD [tacAccountID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetAccountsLink' AND COLUMN_NAME='tacDepartmentID')
BEGIN
	ALTER TABLE [TargetAccountsLink] ADD [tacDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckDetail' AND COLUMN_NAME='tcdCompanyID')
BEGIN
	ALTER TABLE [TargetCheckDetail] ADD [tcdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckDetail' AND COLUMN_NAME='tcdCheckID')
BEGIN
	ALTER TABLE [TargetCheckDetail] ADD [tcdCheckID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckDetail' AND COLUMN_NAME='tcdDetailId')
BEGIN
	ALTER TABLE [TargetCheckDetail] ADD [tcdDetailId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckDetail' AND COLUMN_NAME='tcdFixationID')
BEGIN
	ALTER TABLE [TargetCheckDetail] ADD [tcdFixationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckDetail' AND COLUMN_NAME='tcdFixationDetailID')
BEGIN
	ALTER TABLE [TargetCheckDetail] ADD [tcdFixationDetailID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckDetail' AND COLUMN_NAME='tcdActualAmount')
BEGIN
	ALTER TABLE [TargetCheckDetail] ADD [tcdActualAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchCompanyID')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchCheckID')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchCheckID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchCheckNo')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchCheckNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchCheckDate')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchCheckDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchFixationID')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchFixationID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchActualAsonDate')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchActualAsonDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchCheckedBy')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchCheckedBy] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchRemarks')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchCancelled')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchCancelledRemarks')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetCheckHeader' AND COLUMN_NAME='tchexchagerate')
BEGIN
	ALTER TABLE [TargetCheckHeader] ADD [tchexchagerate] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationDetail' AND COLUMN_NAME='tfdCompanyID')
BEGIN
	ALTER TABLE [TargetFixationDetail] ADD [tfdCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationDetail' AND COLUMN_NAME='tfdFixationID')
BEGIN
	ALTER TABLE [TargetFixationDetail] ADD [tfdFixationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationDetail' AND COLUMN_NAME='tfdDetailID')
BEGIN
	ALTER TABLE [TargetFixationDetail] ADD [tfdDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationDetail' AND COLUMN_NAME='tfdTargetID')
BEGIN
	ALTER TABLE [TargetFixationDetail] ADD [tfdTargetID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationDetail' AND COLUMN_NAME='tfdFromDate')
BEGIN
	ALTER TABLE [TargetFixationDetail] ADD [tfdFromDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationDetail' AND COLUMN_NAME='tfdToDate')
BEGIN
	ALTER TABLE [TargetFixationDetail] ADD [tfdToDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationDetail' AND COLUMN_NAME='tfdAmount')
BEGIN
	ALTER TABLE [TargetFixationDetail] ADD [tfdAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhCompanyID')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhFixationID')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhFixationID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhFixationNo')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhFixationNo] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhFixationDate')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhFixationDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhFromDate')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhFromDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhToDate')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhToDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhFixationPanel')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhFixationPanel] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhReviewPanel')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhReviewPanel] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhReviewDate')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhReviewDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhSanctionedBy')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhSanctionedBy] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhSanctionedDate')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhSanctionedDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhRemarks')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhCancelled')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhCancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetFixationHeader' AND COLUMN_NAME='tfhCancelledRemarks')
BEGIN
	ALTER TABLE [TargetFixationHeader] ADD [tfhCancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetMaster' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [TargetMaster] ADD [CompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetMaster' AND COLUMN_NAME='TargetID')
BEGIN
	ALTER TABLE [TargetMaster] ADD [TargetID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetMaster' AND COLUMN_NAME='TargetCode')
BEGIN
	ALTER TABLE [TargetMaster] ADD [TargetCode] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetMaster' AND COLUMN_NAME='TargetHead')
BEGIN
	ALTER TABLE [TargetMaster] ADD [TargetHead] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TargetMaster' AND COLUMN_NAME='tarcurid')
BEGIN
	ALTER TABLE [TargetMaster] ADD [tarcurid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tbTest' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [tbTest] ADD [itemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tbTest' AND COLUMN_NAME='value')
BEGIN
	ALTER TABLE [tbTest] ADD [value] [varchar] (10) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpchCostingid')
BEGIN
	ALTER TABLE [tempCost] ADD [lpchCostingid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpchDate')
BEGIN
	ALTER TABLE [tempCost] ADD [lpchDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpchBillid')
BEGIN
	ALTER TABLE [tempCost] ADD [lpchBillid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpchShopid')
BEGIN
	ALTER TABLE [tempCost] ADD [lpchShopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpcditemid')
BEGIN
	ALTER TABLE [tempCost] ADD [lpcditemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpcdcostedprice')
BEGIN
	ALTER TABLE [tempCost] ADD [lpcdcostedprice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpcditemqty')
BEGIN
	ALTER TABLE [tempCost] ADD [lpcditemqty] [numeric] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpcdbillunitprice')
BEGIN
	ALTER TABLE [tempCost] ADD [lpcdbillunitprice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpcdolditemcostprice')
BEGIN
	ALTER TABLE [tempCost] ADD [lpcdolditemcostprice] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempCost' AND COLUMN_NAME='lpcdnewitemcostprice')
BEGIN
	ALTER TABLE [tempCost] ADD [lpcdnewitemcostprice] [numeric] (28,16) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishCost' AND COLUMN_NAME='DishID')
BEGIN
	ALTER TABLE [TempDishCost] ADD [DishID] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishCost' AND COLUMN_NAME='DishCostAmt')
BEGIN
	ALTER TABLE [TempDishCost] ADD [DishCostAmt] [decimal] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_Tid')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_Tid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_Theader_id')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_Theader_id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_Tdishid')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_Tdishid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_Toutletid')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_Toutletid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_Tcompanyid')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_Tcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_TUpdateTime')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_TUpdateTime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_TUserID')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_TUserID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_TLatestID')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_TLatestID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_Tdish_cp')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_Tdish_cp] [decimal] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_Tdish_sp_fig')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_Tdish_sp_fig] [decimal] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishSegmentDetail' AND COLUMN_NAME='seg_detail_Tdish_sp_per')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ADD [seg_detail_Tdish_sp_per] [decimal] (18,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItem' AND COLUMN_NAME='Itemid')
BEGIN
	ALTER TABLE [TempItem] ADD [Itemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItem' AND COLUMN_NAME='VendorId')
BEGIN
	ALTER TABLE [TempItem] ADD [VendorId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItem' AND COLUMN_NAME='VendorName')
BEGIN
	ALTER TABLE [TempItem] ADD [VendorName] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='ItemPriceId')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [ItemPriceId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [ItemId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='PackingTypeId')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [PackingTypeId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='ShopId')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [ShopId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='CostPrice')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [CostPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='SellingPrice')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [SellingPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='DiscountPrice')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [DiscountPrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='WholeSalePrice')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [WholeSalePrice] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='UserId')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [UserId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='FixDate')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [FixDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemPriceList' AND COLUMN_NAME='CompanyId')
BEGIN
	ALTER TABLE [TempItemPriceList] ADD [CompanyId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemSaleBal' AND COLUMN_NAME='ItemId')
BEGIN
	ALTER TABLE [TempItemSaleBal] ADD [ItemId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempItemSaleBal' AND COLUMN_NAME='BAlQty')
BEGIN
	ALTER TABLE [TempItemSaleBal] ADD [BAlQty] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempqtywisegrouped' AND COLUMN_NAME='soldyeargrp')
BEGIN
	ALTER TABLE [tempqtywisegrouped] ADD [soldyeargrp] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempqtywisegrouped' AND COLUMN_NAME='soldmonthgrp')
BEGIN
	ALTER TABLE [tempqtywisegrouped] ADD [soldmonthgrp] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempqtywisegrouped' AND COLUMN_NAME='rangedetail')
BEGIN
	ALTER TABLE [tempqtywisegrouped] ADD [rangedetail] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempqtywisegrouped' AND COLUMN_NAME='rangeqtygrp')
BEGIN
	ALTER TABLE [tempqtywisegrouped] ADD [rangeqtygrp] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempqtywisegrouped' AND COLUMN_NAME='avgmonth')
BEGIN
	ALTER TABLE [tempqtywisegrouped] ADD [avgmonth] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempqtywisegrouped' AND COLUMN_NAME='currentstock')
BEGIN
	ALTER TABLE [tempqtywisegrouped] ADD [currentstock] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempqtywisegrouped' AND COLUMN_NAME='stockvalue')
BEGIN
	ALTER TABLE [tempqtywisegrouped] ADD [stockvalue] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempvaluewise' AND COLUMN_NAME='soldyear')
BEGIN
	ALTER TABLE [tempvaluewise] ADD [soldyear] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempvaluewise' AND COLUMN_NAME='soldmonth')
BEGIN
	ALTER TABLE [tempvaluewise] ADD [soldmonth] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempvaluewise' AND COLUMN_NAME='qty')
BEGIN
	ALTER TABLE [tempvaluewise] ADD [qty] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempvaluewise' AND COLUMN_NAME='cog')
BEGIN
	ALTER TABLE [tempvaluewise] ADD [cog] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempvaluewise' AND COLUMN_NAME='sales')
BEGIN
	ALTER TABLE [tempvaluewise] ADD [sales] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tempvaluewise' AND COLUMN_NAME='avgnoofmonth')
BEGIN
	ALTER TABLE [tempvaluewise] ADD [avgnoofmonth] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempVendor' AND COLUMN_NAME='VendorId')
BEGIN
	ALTER TABLE [TempVendor] ADD [VendorId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempVendor' AND COLUMN_NAME='VendorName')
BEGIN
	ALTER TABLE [TempVendor] ADD [VendorName] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempVendorCom' AND COLUMN_NAME='CountryId')
BEGIN
	ALTER TABLE [TempVendorCom] ADD [CountryId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempVendorCom' AND COLUMN_NAME='VendorId')
BEGIN
	ALTER TABLE [TempVendorCom] ADD [VendorId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempVendorCom' AND COLUMN_NAME='VendorName')
BEGIN
	ALTER TABLE [TempVendorCom] ADD [VendorName] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempVendorCom' AND COLUMN_NAME='CountryName')
BEGIN
	ALTER TABLE [TempVendorCom] ADD [CountryName] [varchar] (500) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillBalanceHistory' AND COLUMN_NAME='till_hist_id')
BEGIN
	ALTER TABLE [TillBalanceHistory] ADD [till_hist_id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillBalanceHistory' AND COLUMN_NAME='till_currencyid')
BEGIN
	ALTER TABLE [TillBalanceHistory] ADD [till_currencyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillBalanceHistory' AND COLUMN_NAME='till_amount')
BEGIN
	ALTER TABLE [TillBalanceHistory] ADD [till_amount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillBalanceHistory' AND COLUMN_NAME='till_outletid')
BEGIN
	ALTER TABLE [TillBalanceHistory] ADD [till_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillBalanceHistory' AND COLUMN_NAME='till_companyid')
BEGIN
	ALTER TABLE [TillBalanceHistory] ADD [till_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillBalanceHistory' AND COLUMN_NAME='till_status')
BEGIN
	ALTER TABLE [TillBalanceHistory] ADD [till_status] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='tillHistId')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [tillHistId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='tillid')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [tillid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='tillNo')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [tillNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [itemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='availablestock')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [availablestock] [numeric] (17,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='physicalstock')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [physicalstock] [numeric] (17,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='packingTypeId')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [packingTypeId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='allReceivedStock')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [allReceivedStock] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillClosingstock' AND COLUMN_NAME='allUsedStock')
BEGIN
	ALTER TABLE [TillClosingstock] ADD [allUsedStock] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillDetail' AND COLUMN_NAME='till_td_detailid')
BEGIN
	ALTER TABLE [TillDetail] ADD [till_td_detailid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillDetail' AND COLUMN_NAME='till_td_tillid')
BEGIN
	ALTER TABLE [TillDetail] ADD [till_td_tillid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillDetail' AND COLUMN_NAME='till_td_currencyid')
BEGIN
	ALTER TABLE [TillDetail] ADD [till_td_currencyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillDetail' AND COLUMN_NAME='till_td_amount')
BEGIN
	ALTER TABLE [TillDetail] ADD [till_td_amount] [numeric] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillDetail' AND COLUMN_NAME='till_td_companyid')
BEGIN
	ALTER TABLE [TillDetail] ADD [till_td_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillDetail' AND COLUMN_NAME='till_td_outletid')
BEGIN
	ALTER TABLE [TillDetail] ADD [till_td_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_tillid')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_tillid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_tillname')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_tillname] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_outletid')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_companyid')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_statusid')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_statusid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_remarks')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_remarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_active')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_active] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_starttime')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_starttime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_endtime')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_endtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHeader' AND COLUMN_NAME='till_th_cashierid')
BEGIN
	ALTER TABLE [TillHeader] ADD [till_th_cashierid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_hist_id')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_hist_id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_id')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_cashierid')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_cashierid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_starttime')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_starttime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_endtime')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_endtime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_outletid')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_outletid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_statusid')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_statusid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_companyid')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_updatettime')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_updatettime] datetime  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_statusremarks')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_statusremarks] [varchar] (2000) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_managerid')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_managerid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_createmodify_user')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_createmodify_user] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_no')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_no] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillHistory' AND COLUMN_NAME='till_fandbbillno')
BEGIN
	ALTER TABLE [TillHistory] ADD [till_fandbbillno] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillOpeningstock' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [TillOpeningstock] ADD [companyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillOpeningstock' AND COLUMN_NAME='tillHistId')
BEGIN
	ALTER TABLE [TillOpeningstock] ADD [tillHistId] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillOpeningstock' AND COLUMN_NAME='tillid')
BEGIN
	ALTER TABLE [TillOpeningstock] ADD [tillid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillOpeningstock' AND COLUMN_NAME='tillNo')
BEGIN
	ALTER TABLE [TillOpeningstock] ADD [tillNo] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillOpeningstock' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [TillOpeningstock] ADD [shopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillOpeningstock' AND COLUMN_NAME='itemid')
BEGIN
	ALTER TABLE [TillOpeningstock] ADD [itemid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillOpeningstock' AND COLUMN_NAME='openstock')
BEGIN
	ALTER TABLE [TillOpeningstock] ADD [openstock] [numeric] (17,3) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillOpeningstock' AND COLUMN_NAME='allReceivedStock')
BEGIN
	ALTER TABLE [TillOpeningstock] ADD [allReceivedStock] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillOpeningstock' AND COLUMN_NAME='allUsedStock')
BEGIN
	ALTER TABLE [TillOpeningstock] ADD [allUsedStock] [numeric] (18,0) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillStatusMaster' AND COLUMN_NAME='tillstatus_id')
BEGIN
	ALTER TABLE [TillStatusMaster] ADD [tillstatus_id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillStatusMaster' AND COLUMN_NAME='tillstatus_name')
BEGIN
	ALTER TABLE [TillStatusMaster] ADD [tillstatus_name] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [tmpBills] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [tmpBills] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [tmpBills] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='billsid')
BEGIN
	ALTER TABLE [tmpBills] ADD [billsid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='pbhVendorID')
BEGIN
	ALTER TABLE [tmpBills] ADD [pbhVendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='Billsno')
BEGIN
	ALTER TABLE [tmpBills] ADD [Billsno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='pbhremarks')
BEGIN
	ALTER TABLE [tmpBills] ADD [pbhremarks] [varchar] (1000) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='Referenceno')
BEGIN
	ALTER TABLE [tmpBills] ADD [Referenceno] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='pbhBilldate')
BEGIN
	ALTER TABLE [tmpBills] ADD [pbhBilldate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='duedate')
BEGIN
	ALTER TABLE [tmpBills] ADD [duedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='pbhBillAmount')
BEGIN
	ALTER TABLE [tmpBills] ADD [pbhBillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='Due')
BEGIN
	ALTER TABLE [tmpBills] ADD [Due] [varchar] (7) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [tmpBills] ADD [Type] [varchar] (4) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [tmpBills] ADD [updatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpBills' AND COLUMN_NAME='age')
BEGIN
	ALTER TABLE [tmpBills] ADD [age] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpInvHeader' AND COLUMN_NAME='serinvhid')
BEGIN
	ALTER TABLE [TmpInvHeader] ADD [serinvhid] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpInvHeader' AND COLUMN_NAME='serinvhamount')
BEGIN
	ALTER TABLE [TmpInvHeader] ADD [serinvhamount] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpInvoice' AND COLUMN_NAME='serinvhid')
BEGIN
	ALTER TABLE [TmpInvoice] ADD [serinvhid] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpInvoice' AND COLUMN_NAME='serinvhshopid')
BEGIN
	ALTER TABLE [TmpInvoice] ADD [serinvhshopid] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpInvoice' AND COLUMN_NAME='serinvhamount')
BEGIN
	ALTER TABLE [TmpInvoice] ADD [serinvhamount] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhid')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhcompanyid')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhcompanyid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhshopid')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhshopid] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhjobcardid')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhjobcardid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvno')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhrefno')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhrefno] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhdate')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhdate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhduedate')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhduedate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhpreparedby')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhpreparedby] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhcancelled')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhcancelled] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhserviceamt')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhserviceamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhpartsamt')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhpartsamt] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhamount')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhposted')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhposted] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhdepartmentid')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhdepartmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhcashacc')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhcashacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhsalesacc')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhsalesacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhservacc')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhservacc] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhcmpexrate')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhcmpexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhresexrate')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhresexrate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhbaserate')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhbaserate] [numeric] (18,8) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhsettled')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhsettled] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhremarks')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvcancelremarks')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvcancelremarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhupdatetime')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhupdatetime] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhlocid')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhlocid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhitemname')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhitemname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhitemid')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhitemid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhDiscount')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhDiscount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhfutureint')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhfutureint] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhfuturevc')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhfuturevc] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhfuturenumuric')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhfuturenumuric] [numeric] (18,18) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvfinancialid')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvfinancialid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='seinvhdepexrate')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [seinvhdepexrate] [numeric] (9,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhfree')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhfree] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhexchangerates')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhexchangerates] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhcustname')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhcustname] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhcategid')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhcategid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhmetereading')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhmetereading] [varchar] (100) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhCustomerId')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhCustomerId] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TmpLosServiceInvHeader' AND COLUMN_NAME='serinvhCashInv')
BEGIN
	ALTER TABLE [TmpLosServiceInvHeader] ADD [serinvhCashInv] bit  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpSettlements' AND COLUMN_NAME='companyid')
BEGIN
	ALTER TABLE [tmpSettlements] ADD [companyid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpSettlements' AND COLUMN_NAME='departmentid')
BEGIN
	ALTER TABLE [tmpSettlements] ADD [departmentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpSettlements' AND COLUMN_NAME='billsid')
BEGIN
	ALTER TABLE [tmpSettlements] ADD [billsid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpSettlements' AND COLUMN_NAME='settleddate')
BEGIN
	ALTER TABLE [tmpSettlements] ADD [settleddate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpSettlements' AND COLUMN_NAME='paidamount')
BEGIN
	ALTER TABLE [tmpSettlements] ADD [paidamount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpSettlements' AND COLUMN_NAME='vendorid')
BEGIN
	ALTER TABLE [tmpSettlements] ADD [vendorid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpSettlements' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [tmpSettlements] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='tmpSettlements' AND COLUMN_NAME='Type')
BEGIN
	ALTER TABLE [tmpSettlements] ADD [Type] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='VSID')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [VSID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='VSDetailID')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [VSDetailID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='BillID')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [BillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='pbhbillid')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [pbhbillid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='dcnid')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [dcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='lphbillid')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [lphbillid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='losdcnid')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [losdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='BillAmount')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [BillAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='SettlementAmount')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [SettlementAmount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='receiptid')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [receiptid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementDetail' AND COLUMN_NAME='InterdivBillID')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ADD [InterdivBillID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='VSID')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [VSID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='CompanyID')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [CompanyID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='VSNO')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [VSNO] [varchar] (50) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='VSDate')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [VSDate] datetime  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='DepartmentID')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [DepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='VendorID')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [VendorID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='PaymentID')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [PaymentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='dcnid')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [dcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='shopid')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [shopid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='lospaymentid')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [lospaymentid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='losdcnid')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [losdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='Cancelled')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [Cancelled] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='CancelledRemarks')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [CancelledRemarks] [varchar] (250) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='FinancialID')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [FinancialID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='Amount')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [Amount] [numeric] (18,2) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='updatetime')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [updatetime] datetime CONSTRAINT [DF_VendorSettlementHeader_updatetime] DEFAULT (getdate())  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='losshopdcnid')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [losshopdcnid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='losexportid')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [losexportid] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='SubDepartmentID')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [SubDepartmentID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME='PReturnID')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD [PReturnID] int  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VoucherMaster' AND COLUMN_NAME='VoucherID')
BEGIN
	ALTER TABLE [VoucherMaster] ADD [VoucherID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VoucherMaster' AND COLUMN_NAME='VoucherName')
BEGIN
	ALTER TABLE [VoucherMaster] ADD [VoucherName] [varchar] (50) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VoucherMaster' AND COLUMN_NAME='VoucherAmount')
BEGIN
	ALTER TABLE [VoucherMaster] ADD [VoucherAmount] [decimal] (18,2) NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VoucherMaster' AND COLUMN_NAME='VoucherCurrencyID')
BEGIN
	ALTER TABLE [VoucherMaster] ADD [VoucherCurrencyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VoucherMaster' AND COLUMN_NAME='VoucherCompanyID')
BEGIN
	ALTER TABLE [VoucherMaster] ADD [VoucherCompanyID] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VoucherMaster' AND COLUMN_NAME='VoucherActive')
BEGIN
	ALTER TABLE [VoucherMaster] ADD [VoucherActive] bit  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VoucherMaster' AND COLUMN_NAME='rowguid')
BEGIN
	ALTER TABLE [VoucherMaster] ADD [rowguid] uniqueidentifier CONSTRAINT [DF_VoucherMaster_rowguid] DEFAULT (newid()) ROWGUIDCOL NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w01' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [w01] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w01' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [w01] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w01' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [w01] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w01' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [w01] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w01' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [w01] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w01' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [w01] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w01' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [w01] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w01' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [w01] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w02' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [w02] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w02' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [w02] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w02' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [w02] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w02' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [w02] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w02' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [w02] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w02' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [w02] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w02' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [w02] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w02' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [w02] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w03' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [w03] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w03' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [w03] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w03' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [w03] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w03' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [w03] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w03' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [w03] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w03' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [w03] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w03' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [w03] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w03' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [w03] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w04' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [w04] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w04' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [w04] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w04' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [w04] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w04' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [w04] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w04' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [w04] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w04' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [w04] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w04' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [w04] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w04' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [w04] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w05' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [w05] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w05' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [w05] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w05' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [w05] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w05' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [w05] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w05' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [w05] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w05' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [w05] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w05' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [w05] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w05' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [w05] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w06' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [w06] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w06' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [w06] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w06' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [w06] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w06' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [w06] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w06' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [w06] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w06' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [w06] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w06' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [w06] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w06' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [w06] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w07' AND COLUMN_NAME='code_no')
BEGIN
	ALTER TABLE [w07] ADD [code_no] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w07' AND COLUMN_NAME='on_hand')
BEGIN
	ALTER TABLE [w07] ADD [on_hand] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w07' AND COLUMN_NAME='code_part')
BEGIN
	ALTER TABLE [w07] ADD [code_part] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w07' AND COLUMN_NAME='brand')
BEGIN
	ALTER TABLE [w07] ADD [brand] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w07' AND COLUMN_NAME='size')
BEGIN
	ALTER TABLE [w07] ADD [size] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w07' AND COLUMN_NAME='cost')
BEGIN
	ALTER TABLE [w07] ADD [cost] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w07' AND COLUMN_NAME='selling')
BEGIN
	ALTER TABLE [w07] ADD [selling] float  NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='w07' AND COLUMN_NAME='cnt_dte')
BEGIN
	ALTER TABLE [w07] ADD [cnt_dte] [nvarchar] (255) NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='WeekDays' AND COLUMN_NAME='week_id')
BEGIN
	ALTER TABLE [WeekDays] ADD [week_id] int  NOT NULL
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='WeekDays' AND COLUMN_NAME='week_days')
BEGIN
	ALTER TABLE [WeekDays] ADD [week_days] [varchar] (10) NOT NULL
END
GO
 CREATE PROCEDURE DropFK
 AS
 BEGIN
 --Script for Drop All Foreign Key Constraints
 CREATE TABLE  #sqlDeleteAllFK
 (
		ConstraintID INT IDENTITY(1,1) NOT NULL,  
		SqlStatement VARCHAR(4000) 
 )
 INSERT INTO #sqlDeleteAllFK 
 SELECT 'ALTER TABLE ' + TABLE_SCHEMA + '.' + TABLE_NAME + 
 ' DROP CONSTRAINT ' + CONSTRAINT_NAME 
 FROM information_schema.table_constraints 
 WHERE CONSTRAINT_TYPE = 'FOREIGN KEY' 
 DECLARE @intID INT 
 DECLARE @intCount INT 
 SET @intID = 1 
 SELECT @intCount= COUNT(*) 
 FROM #sqlDeleteAllFK 
 DECLARE @SqlStatement NVARCHAR(4000) 
 WHILE @intID <= @intCount 
 BEGIN 
	SELECT @SqlStatement = SqlStatement 
	FROM #sqlDeleteAllFK 
	WHERE ConstraintID = @intID 
	execute sp_executesql @SqlStatement 
	SET @intID = @intID + 1 
 END 
 DROP TABLE #sqlDeleteAllFK 
 END 
 GO 
 EXEC  DropFK
 GO 
 DROP PROCEDURE  DropFK
 GO 
 CREATE PROCEDURE DropPK
 AS
 BEGIN
--Script for Drop All Primary Key Constraints
CREATE TABLE #sqlDeleteAllPK
(
ConstraintID INT IDENTITY(1,1) NOT NULL,
SqlStatement VARCHAR(4000)
)
INSERT INTO #sqlDeleteAllPK
SELECT 'ALTER TABLE ' + TABLE_SCHEMA + '.' + TABLE_NAME + 
' DROP CONSTRAINT ' + CONSTRAINT_NAME 
 FROM information_schema.table_constraints 
 WHERE CONSTRAINT_TYPE = 'PRIMARY KEY' 
 DECLARE @intID INT 
 DECLARE @intCount INT 
 SET @intID = 1 
 SELECT @intCount= COUNT(*) 
 FROM #sqlDeleteAllPK 
 DECLARE @SqlStatement NVARCHAR(4000) 
 WHILE @intID <= @intCount  
 BEGIN 
 SELECT @SqlStatement = SqlStatement 
 FROM #sqlDeleteAllPK 
 WHERE ConstraintID = @intID 
	execute sp_executesql @SqlStatement 
 SET @intID = @intID + 1 
 END 
 DROP TABLE #sqlDeleteAllPK 
 END 
 GO 
 EXEC  DropPK
 GO 
 DROP PROCEDURE  DropPK
 GO 
--Script for Primary Key Constraints
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccountFinYearOpening' AND CONSTRAINT_NAME= 'PK_aAccountFinYearOpening')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] ALTER COLUMN  [Companyid] int NOT NULL 
	ALTER TABLE [aAccountFinYearOpening] ALTER COLUMN  [Accountid] int NOT NULL 
	ALTER TABLE [aAccountFinYearOpening] ALTER COLUMN  [Financialid] int NOT NULL 
	ALTER TABLE [aAccountFinYearOpening] ALTER COLUMN  [departmentid] int NOT NULL 
	ALTER TABLE [aAccountFinYearOpening] ADD  CONSTRAINT [PK_aAccountFinYearOpening] PRIMARY KEY NONCLUSTERED ([Companyid],[Accountid],[Financialid],[departmentid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccountMaster' AND CONSTRAINT_NAME= 'PK_aAccountMaster')
BEGIN
	ALTER TABLE [aAccountMaster] ALTER COLUMN  [AccountID] int NOT NULL 
	ALTER TABLE [aAccountMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aAccountMaster] ADD  CONSTRAINT [PK_aAccountMaster] PRIMARY KEY NONCLUSTERED ([AccountID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccountMasterBackup' AND CONSTRAINT_NAME= 'PK_aAccountMasterBackup')
BEGIN
	ALTER TABLE [aAccountMasterBackup] ALTER COLUMN  [AccountID] int NOT NULL 
	ALTER TABLE [aAccountMasterBackup] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aAccountMasterBackup] ADD  CONSTRAINT [PK_aAccountMasterBackup] PRIMARY KEY NONCLUSTERED ([AccountID],[CompanyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AAccRatioEntitiesAccounts' AND CONSTRAINT_NAME= 'PK_AAccRatioEntitiesAccounts')
BEGIN
	ALTER TABLE [AAccRatioEntitiesAccounts] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [AAccRatioEntitiesAccounts] ALTER COLUMN  [EntityID] int NOT NULL 
	ALTER TABLE [AAccRatioEntitiesAccounts] ALTER COLUMN  [AccountID] int NOT NULL 
	ALTER TABLE [AAccRatioEntitiesAccounts] ADD  CONSTRAINT [PK_AAccRatioEntitiesAccounts] PRIMARY KEY CLUSTERED ([CompanyID],[EntityID],[AccountID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AAccRatioEntitiesMaster' AND CONSTRAINT_NAME= 'PK_AAccRatioEntitiesMaster')
BEGIN
	ALTER TABLE [AAccRatioEntitiesMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [AAccRatioEntitiesMaster] ALTER COLUMN  [EntityId] int NOT NULL 
	ALTER TABLE [AAccRatioEntitiesMaster] ADD  CONSTRAINT [PK_AAccRatioEntitiesMaster] PRIMARY KEY CLUSTERED ([CompanyID],[EntityId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND CONSTRAINT_NAME= 'PK_aAccRatioGroupMaster')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aAccRatioGroupMaster] ALTER COLUMN  [GroupID] int NOT NULL 
	ALTER TABLE [aAccRatioGroupMaster] ADD  CONSTRAINT [PK_aAccRatioGroupMaster] PRIMARY KEY CLUSTERED ([CompanyID],[GroupID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aaccrepformat' AND CONSTRAINT_NAME= 'pk_aaccrepformat')
BEGIN
	ALTER TABLE [aaccrepformat] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [aaccrepformat] ALTER COLUMN  [formatid] int NOT NULL 
	ALTER TABLE [aaccrepformat] ADD  CONSTRAINT [pk_aaccrepformat] PRIMARY KEY CLUSTERED ([companyid],[formatid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aaccrepgroup' AND CONSTRAINT_NAME= 'pk_aaccrepgroup')
BEGIN
	ALTER TABLE [aaccrepgroup] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [aaccrepgroup] ALTER COLUMN  [Groupid] int NOT NULL 
	ALTER TABLE [aaccrepgroup] ADD  CONSTRAINT [pk_aaccrepgroup] PRIMARY KEY CLUSTERED ([companyid],[Groupid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAlias' AND CONSTRAINT_NAME= 'PK_aAlias')
BEGIN
	ALTER TABLE [aAlias] ALTER COLUMN  [CompanyId] int NOT NULL 
	ALTER TABLE [aAlias] ALTER COLUMN  [AliasId] int NOT NULL 
	ALTER TABLE [aAlias] ADD  CONSTRAINT [PK_aAlias] PRIMARY KEY CLUSTERED ([CompanyId],[AliasId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAnalysedPOItems' AND CONSTRAINT_NAME= 'PK_aAnalysedPOItems')
BEGIN
	ALTER TABLE [aAnalysedPOItems] ALTER COLUMN  [alid] int NOT NULL 
	ALTER TABLE [aAnalysedPOItems] ADD  CONSTRAINT [PK_aAnalysedPOItems] PRIMARY KEY NONCLUSTERED ([alid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAtollMaster' AND CONSTRAINT_NAME= 'PK_aAtollMaster')
BEGIN
	ALTER TABLE [aAtollMaster] ALTER COLUMN  [AtollID] int NOT NULL 
	ALTER TABLE [aAtollMaster] ADD  CONSTRAINT [PK_aAtollMaster] PRIMARY KEY CLUSTERED ([AtollID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aBackground' AND CONSTRAINT_NAME= 'PK_aBackground')
BEGIN
	ALTER TABLE [aBackground] ALTER COLUMN  [BgID] int NOT NULL 
	ALTER TABLE [aBackground] ADD  CONSTRAINT [PK_aBackground] PRIMARY KEY CLUSTERED ([BgID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aBankMaster' AND CONSTRAINT_NAME= 'PK_aBankMaster')
BEGIN
	ALTER TABLE [aBankMaster] ALTER COLUMN  [BankID] int NOT NULL 
	ALTER TABLE [aBankMaster] ADD  CONSTRAINT [PK_aBankMaster] PRIMARY KEY CLUSTERED ([BankID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='abarcodetype' AND CONSTRAINT_NAME= 'PK_barcodetype')
BEGIN
	ALTER TABLE [abarcodetype] ALTER COLUMN  [barcodetype] smallint NOT NULL 
	ALTER TABLE [abarcodetype] ADD  CONSTRAINT [PK_barcodetype] PRIMARY KEY NONCLUSTERED ([barcodetype])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aBouncedChequeDetails' AND CONSTRAINT_NAME= 'PK__aBounced__4836532051700577')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] ALTER COLUMN  [BcID] int NOT NULL 
	ALTER TABLE [aBouncedChequeDetails] ADD  CONSTRAINT [PK__aBounced__4836532051700577] PRIMARY KEY CLUSTERED ([BcID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aBrandMergeDetails' AND CONSTRAINT_NAME= 'PK_aBrandMergeDetails')
BEGIN
	ALTER TABLE [aBrandMergeDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aBrandMergeDetails] ALTER COLUMN  [MergeID] int NOT NULL 
	ALTER TABLE [aBrandMergeDetails] ADD  CONSTRAINT [PK_aBrandMergeDetails] PRIMARY KEY CLUSTERED ([CompanyID],[MergeID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND CONSTRAINT_NAME= 'PK_AccountsInvoiceHeader')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ALTER COLUMN  [InvoiceID] int NOT NULL 
	ALTER TABLE [AccountsInvoiceHeader] ADD  CONSTRAINT [PK_AccountsInvoiceHeader] PRIMARY KEY NONCLUSTERED ([InvoiceID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aChequeReportDetails' AND CONSTRAINT_NAME= 'PK_aChequeReportDetails')
BEGIN
	ALTER TABLE [aChequeReportDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aChequeReportDetails] ALTER COLUMN  [ChequeID] int NOT NULL 
	ALTER TABLE [aChequeReportDetails] ALTER COLUMN  [AccountID] int NOT NULL 
	ALTER TABLE [aChequeReportDetails] ADD  CONSTRAINT [PK_aChequeReportDetails] PRIMARY KEY CLUSTERED ([CompanyID],[ChequeID],[AccountID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCity' AND CONSTRAINT_NAME= 'PK_aCity')
BEGIN
	ALTER TABLE [aCity] ALTER COLUMN  [CityID] int NOT NULL 
	ALTER TABLE [aCity] ADD  CONSTRAINT [PK_aCity] PRIMARY KEY NONCLUSTERED ([CityID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aColor' AND CONSTRAINT_NAME= 'PK_aColor')
BEGIN
	ALTER TABLE [aColor] ALTER COLUMN  [ColorID] int NOT NULL 
	ALTER TABLE [aColor] ADD  CONSTRAINT [PK_aColor] PRIMARY KEY NONCLUSTERED ([ColorID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCompanyMaster' AND CONSTRAINT_NAME= 'PK_aCompanyMaster')
BEGIN
	ALTER TABLE [aCompanyMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aCompanyMaster] ADD  CONSTRAINT [PK_aCompanyMaster] PRIMARY KEY NONCLUSTERED ([CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aContact' AND CONSTRAINT_NAME= 'PK_aContact')
BEGIN
	ALTER TABLE [aContact] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aContact] ALTER COLUMN  [ContactID] int NOT NULL 
	ALTER TABLE [aContact] ADD  CONSTRAINT [PK_aContact] PRIMARY KEY CLUSTERED ([CompanyID],[ContactID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aContainerMaster' AND CONSTRAINT_NAME= 'PK_acontainermaster')
BEGIN
	ALTER TABLE [aContainerMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aContainerMaster] ALTER COLUMN  [ContainerID] int NOT NULL 
	ALTER TABLE [aContainerMaster] ADD  CONSTRAINT [PK_acontainermaster] PRIMARY KEY CLUSTERED ([CompanyID],[ContainerID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCountryMaster' AND CONSTRAINT_NAME= 'PK_aCountryMaster')
BEGIN
	ALTER TABLE [aCountryMaster] ALTER COLUMN  [CountryID] int NOT NULL 
	ALTER TABLE [aCountryMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aCountryMaster] ADD  CONSTRAINT [PK_aCountryMaster] PRIMARY KEY NONCLUSTERED ([CountryID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCurrencyMaster' AND CONSTRAINT_NAME= 'PK_aCurrencyMaster')
BEGIN
	ALTER TABLE [aCurrencyMaster] ALTER COLUMN  [CurrencyID] int NOT NULL 
	ALTER TABLE [aCurrencyMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aCurrencyMaster] ADD  CONSTRAINT [PK_aCurrencyMaster] PRIMARY KEY NONCLUSTERED ([CurrencyID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCustomerGroup' AND CONSTRAINT_NAME= 'PK_aCustomerGroup')
BEGIN
	ALTER TABLE [aCustomerGroup] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aCustomerGroup] ALTER COLUMN  [CusGroupId] int NOT NULL 
	ALTER TABLE [aCustomerGroup] ADD  CONSTRAINT [PK_aCustomerGroup] PRIMARY KEY CLUSTERED ([CompanyID],[CusGroupId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCustomerMaster' AND CONSTRAINT_NAME= 'PK_aCustomerMaster')
BEGIN
	ALTER TABLE [aCustomerMaster] ALTER COLUMN  [CustomerID] int NOT NULL 
	ALTER TABLE [aCustomerMaster] ADD  CONSTRAINT [PK_aCustomerMaster] PRIMARY KEY NONCLUSTERED ([CustomerID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCustomerMasterBackUp' AND CONSTRAINT_NAME= 'PK_aCustomerMasterBackUp')
BEGIN
	ALTER TABLE [aCustomerMasterBackUp] ALTER COLUMN  [CustomerID] int NOT NULL 
	ALTER TABLE [aCustomerMasterBackUp] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aCustomerMasterBackUp] ADD  CONSTRAINT [PK_aCustomerMasterBackUp] PRIMARY KEY NONCLUSTERED ([CustomerID],[CompanyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCustomsMaster' AND CONSTRAINT_NAME= 'PK_aCustomsCode')
BEGIN
	ALTER TABLE [aCustomsMaster] ALTER COLUMN  [CustomID] int NOT NULL 
	ALTER TABLE [aCustomsMaster] ADD  CONSTRAINT [PK_aCustomsCode] PRIMARY KEY NONCLUSTERED ([CustomID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aDepartmentMaster' AND CONSTRAINT_NAME= 'PK_aDepartmentMaster')
BEGIN
	ALTER TABLE [aDepartmentMaster] ALTER COLUMN  [DepartmentID] int NOT NULL 
	ALTER TABLE [aDepartmentMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aDepartmentMaster] ADD  CONSTRAINT [PK_aDepartmentMaster] PRIMARY KEY NONCLUSTERED ([DepartmentID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='adistributormaster' AND CONSTRAINT_NAME= 'PK_adistributormaster')
BEGIN
	ALTER TABLE [adistributormaster] ALTER COLUMN  [did] int NOT NULL 
	ALTER TABLE [adistributormaster] ADD  CONSTRAINT [PK_adistributormaster] PRIMARY KEY NONCLUSTERED ([did])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentDetails' AND CONSTRAINT_NAME= 'PK_AdjustmentDetails')
BEGIN
	ALTER TABLE [AdjustmentDetails] ALTER COLUMN  [AdjustmentDetailID] int NOT NULL 
	ALTER TABLE [AdjustmentDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [AdjustmentDetails] ALTER COLUMN  [AdjustmentID] int NOT NULL 
	ALTER TABLE [AdjustmentDetails] ADD  CONSTRAINT [PK_AdjustmentDetails] PRIMARY KEY NONCLUSTERED ([AdjustmentDetailID],[CompanyID],[AdjustmentID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentHeader' AND CONSTRAINT_NAME= 'PK_AdjustmentHeader')
BEGIN
	ALTER TABLE [AdjustmentHeader] ALTER COLUMN  [AdjustmentID] int NOT NULL 
	ALTER TABLE [AdjustmentHeader] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [AdjustmentHeader] ADD  CONSTRAINT [PK_AdjustmentHeader] PRIMARY KEY NONCLUSTERED ([AdjustmentID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aFeeMaster' AND CONSTRAINT_NAME= 'PK_aFeeMaster')
BEGIN
	ALTER TABLE [aFeeMaster] ALTER COLUMN  [FeeID] int NOT NULL 
	ALTER TABLE [aFeeMaster] ADD  CONSTRAINT [PK_aFeeMaster] PRIMARY KEY CLUSTERED ([FeeID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aFinancialYear' AND CONSTRAINT_NAME= 'PK_aFinancialYear')
BEGIN
	ALTER TABLE [aFinancialYear] ALTER COLUMN  [FinancialID] int NOT NULL 
	ALTER TABLE [aFinancialYear] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aFinancialYear] ADD  CONSTRAINT [PK_aFinancialYear] PRIMARY KEY NONCLUSTERED ([FinancialID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aFineDetail' AND CONSTRAINT_NAME= 'PK_afineDetail')
BEGIN
	ALTER TABLE [aFineDetail] ALTER COLUMN  [fdFineID] int NOT NULL 
	ALTER TABLE [aFineDetail] ALTER COLUMN  [fdFineDetailID] int NOT NULL 
	ALTER TABLE [aFineDetail] ADD  CONSTRAINT [PK_afineDetail] PRIMARY KEY CLUSTERED ([fdFineID],[fdFineDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aFineHeader' AND CONSTRAINT_NAME= 'PK_aFineHeader')
BEGIN
	ALTER TABLE [aFineHeader] ALTER COLUMN  [fhFineID] int NOT NULL 
	ALTER TABLE [aFineHeader] ADD  CONSTRAINT [PK_aFineHeader] PRIMARY KEY CLUSTERED ([fhFineID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGlobalUsers' AND CONSTRAINT_NAME= 'PK_aGlobalUsers')
BEGIN
	ALTER TABLE [aGlobalUsers] ALTER COLUMN  [UserID] int NOT NULL 
	ALTER TABLE [aGlobalUsers] ADD  CONSTRAINT [PK_aGlobalUsers] PRIMARY KEY NONCLUSTERED ([UserID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodown' AND CONSTRAINT_NAME= 'PK_aGodown')
BEGIN
	ALTER TABLE [aGodown] ALTER COLUMN  [GodownID] int NOT NULL 
	ALTER TABLE [aGodown] ADD  CONSTRAINT [PK_aGodown] PRIMARY KEY NONCLUSTERED ([GodownID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodownDetail' AND CONSTRAINT_NAME= 'PK_aGodownDetail')
BEGIN
	ALTER TABLE [aGodownDetail] ALTER COLUMN  [GodownID] int NOT NULL 
	ALTER TABLE [aGodownDetail] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [aGodownDetail] ADD  CONSTRAINT [PK_aGodownDetail] PRIMARY KEY NONCLUSTERED ([GodownID],[ItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodownItemCategory' AND CONSTRAINT_NAME= 'PK_aGodownItemCategory')
BEGIN
	ALTER TABLE [aGodownItemCategory] ALTER COLUMN  [Godownid] int NOT NULL 
	ALTER TABLE [aGodownItemCategory] ALTER COLUMN  [categoryID] int NOT NULL 
	ALTER TABLE [aGodownItemCategory] ADD  CONSTRAINT [PK_aGodownItemCategory] PRIMARY KEY NONCLUSTERED ([Godownid],[categoryID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementContents' AND CONSTRAINT_NAME= 'PK_AgreementContents')
BEGIN
	ALTER TABLE [AgreementContents] ALTER COLUMN  [agcagreementid] int NOT NULL 
	ALTER TABLE [AgreementContents] ALTER COLUMN  [agcDepartmentid] int NOT NULL 
	ALTER TABLE [AgreementContents] ALTER COLUMN  [agcDetailid] int NOT NULL 
	ALTER TABLE [AgreementContents] ADD  CONSTRAINT [PK_AgreementContents] PRIMARY KEY NONCLUSTERED ([agcagreementid],[agcDepartmentid],[agcDetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementDetails' AND CONSTRAINT_NAME= 'PK_AgreementDetails')
BEGIN
	ALTER TABLE [AgreementDetails] ALTER COLUMN  [agdAgreementid] int NOT NULL 
	ALTER TABLE [AgreementDetails] ALTER COLUMN  [agdDepartmentid] int NOT NULL 
	ALTER TABLE [AgreementDetails] ALTER COLUMN  [agdDetailid] int NOT NULL 
	ALTER TABLE [AgreementDetails] ADD  CONSTRAINT [PK_AgreementDetails] PRIMARY KEY NONCLUSTERED ([agdAgreementid],[agdDepartmentid],[agdDetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementFinancialDetails' AND CONSTRAINT_NAME= 'PK_AgreementFinancialDetails')
BEGIN
	ALTER TABLE [AgreementFinancialDetails] ALTER COLUMN  [agfAgreementid] int NOT NULL 
	ALTER TABLE [AgreementFinancialDetails] ALTER COLUMN  [agfDepartmentId] int NOT NULL 
	ALTER TABLE [AgreementFinancialDetails] ALTER COLUMN  [agffinanceDetailid] int NOT NULL 
	ALTER TABLE [AgreementFinancialDetails] ADD  CONSTRAINT [PK_AgreementFinancialDetails] PRIMARY KEY NONCLUSTERED ([agfAgreementid],[agfDepartmentId],[agffinanceDetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementRegister' AND CONSTRAINT_NAME= 'PK_AgreementRegister')
BEGIN
	ALTER TABLE [AgreementRegister] ALTER COLUMN  [agragreementid] int NOT NULL 
	ALTER TABLE [AgreementRegister] ALTER COLUMN  [agrDepartmentid] int NOT NULL 
	ALTER TABLE [AgreementRegister] ADD  CONSTRAINT [PK_AgreementRegister] PRIMARY KEY NONCLUSTERED ([agragreementid],[agrDepartmentid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementScanCopyDetails' AND CONSTRAINT_NAME= 'PK_AgreementScanCopyDetails')
BEGIN
	ALTER TABLE [AgreementScanCopyDetails] ALTER COLUMN  [agsCompanyID] int NOT NULL 
	ALTER TABLE [AgreementScanCopyDetails] ALTER COLUMN  [agsAgreementID] int NOT NULL 
	ALTER TABLE [AgreementScanCopyDetails] ALTER COLUMN  [agsDepartmentID] int NOT NULL 
	ALTER TABLE [AgreementScanCopyDetails] ALTER COLUMN  [agsDetailID] int NOT NULL 
	ALTER TABLE [AgreementScanCopyDetails] ADD  CONSTRAINT [PK_AgreementScanCopyDetails] PRIMARY KEY CLUSTERED ([agsCompanyID],[agsAgreementID],[agsDepartmentID],[agsDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementSignedDetails' AND CONSTRAINT_NAME= 'PK_AgreementSignedDetails')
BEGIN
	ALTER TABLE [AgreementSignedDetails] ALTER COLUMN  [agsagreementid] int NOT NULL 
	ALTER TABLE [AgreementSignedDetails] ALTER COLUMN  [agsDepartmentid] int NOT NULL 
	ALTER TABLE [AgreementSignedDetails] ALTER COLUMN  [agsDetailid] int NOT NULL 
	ALTER TABLE [AgreementSignedDetails] ADD  CONSTRAINT [PK_AgreementSignedDetails] PRIMARY KEY NONCLUSTERED ([agsagreementid],[agsDepartmentid],[agsDetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementWitnessDetails' AND CONSTRAINT_NAME= 'PK_AgreementWitnessDetails')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ALTER COLUMN  [agwAgreementid] int NOT NULL 
	ALTER TABLE [AgreementWitnessDetails] ALTER COLUMN  [agwDepartmentid] int NOT NULL 
	ALTER TABLE [AgreementWitnessDetails] ALTER COLUMN  [agwDetailid] int NOT NULL 
	ALTER TABLE [AgreementWitnessDetails] ADD  CONSTRAINT [PK_AgreementWitnessDetails] PRIMARY KEY NONCLUSTERED ([agwAgreementid],[agwDepartmentid],[agwDetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGroupMaster' AND CONSTRAINT_NAME= 'PK_aGroupMaster')
BEGIN
	ALTER TABLE [aGroupMaster] ALTER COLUMN  [GroupID] int NOT NULL 
	ALTER TABLE [aGroupMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aGroupMaster] ADD  CONSTRAINT [PK_aGroupMaster] PRIMARY KEY NONCLUSTERED ([GroupID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHPAccountsSettings' AND CONSTRAINT_NAME= 'PK_aHPAccountsSettings')
BEGIN
	ALTER TABLE [aHPAccountsSettings] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aHPAccountsSettings] ADD  CONSTRAINT [PK_aHPAccountsSettings] PRIMARY KEY CLUSTERED ([CompanyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ahpAgreementDetail' AND CONSTRAINT_NAME= 'PK_loshpAgreementDetail')
BEGIN
	ALTER TABLE [ahpAgreementDetail] ALTER COLUMN  [hpAgreementID] int NOT NULL 
	ALTER TABLE [ahpAgreementDetail] ADD  CONSTRAINT [PK_loshpAgreementDetail] PRIMARY KEY CLUSTERED ([hpAgreementID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHPCustomerMaster' AND CONSTRAINT_NAME= 'PK_aHPCustomerMaster')
BEGIN
	ALTER TABLE [aHPCustomerMaster] ALTER COLUMN  [hpCompanyID] int NOT NULL 
	ALTER TABLE [aHPCustomerMaster] ALTER COLUMN  [hpCustomerID] int NOT NULL 
	ALTER TABLE [aHPCustomerMaster] ADD  CONSTRAINT [PK_aHPCustomerMaster] PRIMARY KEY CLUSTERED ([hpCompanyID],[hpCustomerID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHpItemDetails' AND CONSTRAINT_NAME= 'PK_aHpItemDetails')
BEGIN
	ALTER TABLE [aHpItemDetails] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [aHpItemDetails] ADD  CONSTRAINT [PK_aHpItemDetails] PRIMARY KEY CLUSTERED ([ItemID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHPItemTransferHeader' AND CONSTRAINT_NAME= 'PK_aHItemTransferHeader')
BEGIN
	ALTER TABLE [aHPItemTransferHeader] ALTER COLUMN  [ithCompanyID] int NOT NULL 
	ALTER TABLE [aHPItemTransferHeader] ALTER COLUMN  [ithFinancialID] int NOT NULL 
	ALTER TABLE [aHPItemTransferHeader] ALTER COLUMN  [ithTransferID] int NOT NULL 
	ALTER TABLE [aHPItemTransferHeader] ADD  CONSTRAINT [PK_aHItemTransferHeader] PRIMARY KEY CLUSTERED ([ithCompanyID],[ithFinancialID],[ithTransferID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ahpPaymentDetail' AND CONSTRAINT_NAME= 'PK_ahpPaymentDetail')
BEGIN
	ALTER TABLE [ahpPaymentDetail] ALTER COLUMN  [hpdCompanyID] int NOT NULL 
	ALTER TABLE [ahpPaymentDetail] ALTER COLUMN  [hpdDepartmentID] int NOT NULL 
	ALTER TABLE [ahpPaymentDetail] ALTER COLUMN  [hpdPaymentID] int NOT NULL 
	ALTER TABLE [ahpPaymentDetail] ALTER COLUMN  [hpdDetailID] int NOT NULL 
	ALTER TABLE [ahpPaymentDetail] ADD  CONSTRAINT [PK_ahpPaymentDetail] PRIMARY KEY CLUSTERED ([hpdCompanyID],[hpdDepartmentID],[hpdPaymentID],[hpdDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ahpPaymentHeader' AND CONSTRAINT_NAME= 'PK_ahpPaymentHeader')
BEGIN
	ALTER TABLE [ahpPaymentHeader] ALTER COLUMN  [hphCompanyID] int NOT NULL 
	ALTER TABLE [ahpPaymentHeader] ALTER COLUMN  [hphDepartmentID] int NOT NULL 
	ALTER TABLE [ahpPaymentHeader] ALTER COLUMN  [hphPaymentID] int NOT NULL 
	ALTER TABLE [ahpPaymentHeader] ADD  CONSTRAINT [PK_ahpPaymentHeader] PRIMARY KEY CLUSTERED ([hphCompanyID],[hphDepartmentID],[hphPaymentID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ahpProcessingCashFlowDetail' AND CONSTRAINT_NAME= 'PK_ahpProcessingCashFlowDetail')
BEGIN
	ALTER TABLE [ahpProcessingCashFlowDetail] ALTER COLUMN  [hpcComapnyID] int NOT NULL 
	ALTER TABLE [ahpProcessingCashFlowDetail] ALTER COLUMN  [hpcDepartmentID] int NOT NULL 
	ALTER TABLE [ahpProcessingCashFlowDetail] ALTER COLUMN  [hpcProcessingID] int NOT NULL 
	ALTER TABLE [ahpProcessingCashFlowDetail] ALTER COLUMN  [hpcDetailID] int NOT NULL 
	ALTER TABLE [ahpProcessingCashFlowDetail] ADD  CONSTRAINT [PK_ahpProcessingCashFlowDetail] PRIMARY KEY CLUSTERED ([hpcComapnyID],[hpcDepartmentID],[hpcProcessingID],[hpcDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHpProcessingDetail' AND CONSTRAINT_NAME= 'PK_aHpProcessingDetail')
BEGIN
	ALTER TABLE [aHpProcessingDetail] ALTER COLUMN  [hpdCompanyID] int NOT NULL 
	ALTER TABLE [aHpProcessingDetail] ALTER COLUMN  [hpdDepartmentID] int NOT NULL 
	ALTER TABLE [aHpProcessingDetail] ALTER COLUMN  [hpdProcessingId] int NOT NULL 
	ALTER TABLE [aHpProcessingDetail] ALTER COLUMN  [hpdDetailID] int NOT NULL 
	ALTER TABLE [aHpProcessingDetail] ADD  CONSTRAINT [PK_aHpProcessingDetail] PRIMARY KEY CLUSTERED ([hpdCompanyID],[hpdDepartmentID],[hpdProcessingId],[hpdDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHpProcessingDetailOthers' AND CONSTRAINT_NAME= 'PK__aHpProce__CF8590A647FBA9D6')
BEGIN
	ALTER TABLE [aHpProcessingDetailOthers] ALTER COLUMN  [hpdCompanyID] int NOT NULL 
	ALTER TABLE [aHpProcessingDetailOthers] ALTER COLUMN  [hpdDepartmentID] int NOT NULL 
	ALTER TABLE [aHpProcessingDetailOthers] ALTER COLUMN  [hpdProcessingId] int NOT NULL 
	ALTER TABLE [aHpProcessingDetailOthers] ALTER COLUMN  [hpddetailIDBT] int NOT NULL 
	ALTER TABLE [aHpProcessingDetailOthers] ADD  CONSTRAINT [PK__aHpProce__CF8590A647FBA9D6] PRIMARY KEY CLUSTERED ([hpdCompanyID],[hpdDepartmentID],[hpdProcessingId],[hpddetailIDBT])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHpProcessingHeader' AND CONSTRAINT_NAME= 'PK_aHpProcessingHeader')
BEGIN
	ALTER TABLE [aHpProcessingHeader] ALTER COLUMN  [hphCompanyID] int NOT NULL 
	ALTER TABLE [aHpProcessingHeader] ALTER COLUMN  [hphDepartmentID] int NOT NULL 
	ALTER TABLE [aHpProcessingHeader] ALTER COLUMN  [hphProcessingID] int NOT NULL 
	ALTER TABLE [aHpProcessingHeader] ADD  CONSTRAINT [PK_aHpProcessingHeader] PRIMARY KEY CLUSTERED ([hphCompanyID],[hphDepartmentID],[hphProcessingID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ahpReceiptDetail' AND CONSTRAINT_NAME= 'PK_ahpReceiptDetail')
BEGIN
	ALTER TABLE [ahpReceiptDetail] ALTER COLUMN  [hprdCompanyID] int NOT NULL 
	ALTER TABLE [ahpReceiptDetail] ALTER COLUMN  [hprdDepartmentID] int NOT NULL 
	ALTER TABLE [ahpReceiptDetail] ALTER COLUMN  [hprdReceiptID] int NOT NULL 
	ALTER TABLE [ahpReceiptDetail] ALTER COLUMN  [hprdDetailID] int NOT NULL 
	ALTER TABLE [ahpReceiptDetail] ADD  CONSTRAINT [PK_ahpReceiptDetail] PRIMARY KEY CLUSTERED ([hprdCompanyID],[hprdDepartmentID],[hprdReceiptID],[hprdDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ahpReceiptHeader' AND CONSTRAINT_NAME= 'PK_ahpReceiptHeader')
BEGIN
	ALTER TABLE [ahpReceiptHeader] ALTER COLUMN  [hprhCompanyId] int NOT NULL 
	ALTER TABLE [ahpReceiptHeader] ALTER COLUMN  [hprhDepartmentID] int NOT NULL 
	ALTER TABLE [ahpReceiptHeader] ALTER COLUMN  [hprhReceiptID] int NOT NULL 
	ALTER TABLE [ahpReceiptHeader] ADD  CONSTRAINT [PK_ahpReceiptHeader] PRIMARY KEY CLUSTERED ([hprhCompanyId],[hprhDepartmentID],[hprhReceiptID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND CONSTRAINT_NAME= 'PK_aHpReceiptVoucherHeader')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] ALTER COLUMN  [hprhCompanyID] int NOT NULL 
	ALTER TABLE [aHpReceiptVoucherHeader] ALTER COLUMN  [hprhShopID] int NOT NULL 
	ALTER TABLE [aHpReceiptVoucherHeader] ALTER COLUMN  [hprhReceiptID] int NOT NULL 
	ALTER TABLE [aHpReceiptVoucherHeader] ADD  CONSTRAINT [PK_aHpReceiptVoucherHeader] PRIMARY KEY CLUSTERED ([hprhCompanyID],[hprhShopID],[hprhReceiptID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND CONSTRAINT_NAME= 'PK_aHQDespatchNoteDetails')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ALTER COLUMN  [ddDespatchnoteID] int NOT NULL 
	ALTER TABLE [aHQDespatchNoteDetails] ALTER COLUMN  [ddDetailID] int NOT NULL 
	ALTER TABLE [aHQDespatchNoteDetails] ADD  CONSTRAINT [PK_aHQDespatchNoteDetails] PRIMARY KEY NONCLUSTERED ([ddDespatchnoteID],[ddDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND CONSTRAINT_NAME= 'PK_aHQDespatchnoteHeader')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ALTER COLUMN  [dhDespatchnoteID] int NOT NULL 
	ALTER TABLE [aHQDespatchnoteHeader] ADD  CONSTRAINT [PK_aHQDespatchnoteHeader] PRIMARY KEY NONCLUSTERED ([dhDespatchnoteID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND CONSTRAINT_NAME= 'PK_aHQDespatchNoteMain')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ALTER COLUMN  [dnmDespatchNoteID] int NOT NULL 
	ALTER TABLE [aHQDespatchNoteMain] ADD  CONSTRAINT [PK_aHQDespatchNoteMain] PRIMARY KEY NONCLUSTERED ([dnmDespatchNoteID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND CONSTRAINT_NAME= 'PK_aHQIssuenoteDetail')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ALTER COLUMN  [INDIssuenoteID] int NOT NULL 
	ALTER TABLE [aHQIssuenoteDetail] ALTER COLUMN  [INDGodownid] int NOT NULL 
	ALTER TABLE [aHQIssuenoteDetail] ALTER COLUMN  [INDLocationID] int NOT NULL 
	ALTER TABLE [aHQIssuenoteDetail] ALTER COLUMN  [INDShipmentID] int NOT NULL 
	ALTER TABLE [aHQIssuenoteDetail] ALTER COLUMN  [INDItemID] int NOT NULL 
	ALTER TABLE [aHQIssuenoteDetail] ADD  CONSTRAINT [PK_aHQIssuenoteDetail] PRIMARY KEY NONCLUSTERED ([INDIssuenoteID],[INDGodownid],[INDLocationID],[INDShipmentID],[INDItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND CONSTRAINT_NAME= 'PK_aHQIssuenoteHeader')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ALTER COLUMN  [INHIssuenoteID] int NOT NULL 
	ALTER TABLE [aHQIssuenoteHeader] ADD  CONSTRAINT [PK_aHQIssuenoteHeader] PRIMARY KEY NONCLUSTERED ([INHIssuenoteID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssueNoteMain' AND CONSTRAINT_NAME= 'PK_aHQIssueNoteMain')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ALTER COLUMN  [INMIssuenoteID] int NOT NULL 
	ALTER TABLE [aHQIssueNoteMain] ADD  CONSTRAINT [PK_aHQIssueNoteMain] PRIMARY KEY NONCLUSTERED ([INMIssuenoteID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHqMergingDetails' AND CONSTRAINT_NAME= 'PK_aHqMergingDetails')
BEGIN
	ALTER TABLE [aHqMergingDetails] ALTER COLUMN  [mgdId] int NOT NULL 
	ALTER TABLE [aHqMergingDetails] ALTER COLUMN  [mgdCompanyID] int NOT NULL 
	ALTER TABLE [aHqMergingDetails] ALTER COLUMN  [mgdItemId] int NOT NULL 
	ALTER TABLE [aHqMergingDetails] ADD  CONSTRAINT [PK_aHqMergingDetails] PRIMARY KEY CLUSTERED ([mgdId],[mgdCompanyID],[mgdItemId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHqMergingHeader' AND CONSTRAINT_NAME= 'PK_aHqMergingHeader')
BEGIN
	ALTER TABLE [aHqMergingHeader] ALTER COLUMN  [mghId] int NOT NULL 
	ALTER TABLE [aHqMergingHeader] ALTER COLUMN  [mghCompanyId] int NOT NULL 
	ALTER TABLE [aHqMergingHeader] ADD  CONSTRAINT [PK_aHqMergingHeader] PRIMARY KEY CLUSTERED ([mghId],[mghCompanyId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND CONSTRAINT_NAME= 'PK_aHQPaymentVoucherDebitDetails')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ALTER COLUMN  [pddPaymentDebitID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ALTER COLUMN  [pddPaymentID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD  CONSTRAINT [PK_aHQPaymentVoucherDebitDetails] PRIMARY KEY NONCLUSTERED ([pddPaymentDebitID],[pddPaymentID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND CONSTRAINT_NAME= 'PK_aHQPaymentVoucherDetails')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] ALTER COLUMN  [pdPaymentVoucherID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherDetails] ALTER COLUMN  [pdPaymentID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherDetails] ADD  CONSTRAINT [PK_aHQPaymentVoucherDetails] PRIMARY KEY NONCLUSTERED ([pdPaymentVoucherID],[pdPaymentID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'PK_aHQPaymentVoucherHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ALTER COLUMN  [phPaymentID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherHeader] ADD  CONSTRAINT [PK_aHQPaymentVoucherHeader] PRIMARY KEY NONCLUSTERED ([phPaymentID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND CONSTRAINT_NAME= 'pk_aHQPaymentVoucherRebateDetails')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ALTER COLUMN  [PaymentID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherRebateDetails] ADD  CONSTRAINT [pk_aHQPaymentVoucherRebateDetails] PRIMARY KEY CLUSTERED ([CompanyID],[PaymentID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND CONSTRAINT_NAME= 'PK_aHQPaymentVoucherSCDetails')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherSCDetails] ALTER COLUMN  [PaymentID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherSCDetails] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherSCDetails] ADD  CONSTRAINT [PK_aHQPaymentVoucherSCDetails] PRIMARY KEY CLUSTERED ([CompanyID],[PaymentID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND CONSTRAINT_NAME= 'pk_aHQPaymentVoucherSPDetails')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherSPDetails] ALTER COLUMN  [PaymentID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherSPDetails] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherSPDetails] ADD  CONSTRAINT [pk_aHQPaymentVoucherSPDetails] PRIMARY KEY CLUSTERED ([CompanyID],[PaymentID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherVendorDetails' AND CONSTRAINT_NAME= 'PK_aHQPaymentVoucherVendorDetails')
BEGIN
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ALTER COLUMN  [pvdcompanyid] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ALTER COLUMN  [pvdPaymentid] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ALTER COLUMN  [pvdDetailid] int NOT NULL 
	ALTER TABLE [aHQPaymentVoucherVendorDetails] ADD  CONSTRAINT [PK_aHQPaymentVoucherVendorDetails] PRIMARY KEY NONCLUSTERED ([pvdcompanyid],[pvdPaymentid],[pvdDetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND CONSTRAINT_NAME= 'PK_aHQPDChequeProcessing')
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ALTER COLUMN  [PDTransId] int NOT NULL 
	ALTER TABLE [aHQPDChequeProcessing] ALTER COLUMN  [PDChequeid] int NOT NULL 
	ALTER TABLE [aHQPDChequeProcessing] ADD  CONSTRAINT [PK_aHQPDChequeProcessing] PRIMARY KEY CLUSTERED ([PDTransId],[PDChequeid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHqPettyCashPaymentDetails' AND CONSTRAINT_NAME= 'PK_aHqPettyCashPaymentDetails')
BEGIN
	ALTER TABLE [aHqPettyCashPaymentDetails] ALTER COLUMN  [pdCompanyID] int NOT NULL 
	ALTER TABLE [aHqPettyCashPaymentDetails] ALTER COLUMN  [pdDepartmentID] int NOT NULL 
	ALTER TABLE [aHqPettyCashPaymentDetails] ALTER COLUMN  [pdPaymentID] int NOT NULL 
	ALTER TABLE [aHqPettyCashPaymentDetails] ALTER COLUMN  [pdDetailID] int NOT NULL 
	ALTER TABLE [aHqPettyCashPaymentDetails] ADD  CONSTRAINT [PK_aHqPettyCashPaymentDetails] PRIMARY KEY CLUSTERED ([pdCompanyID],[pdDepartmentID],[pdPaymentID],[pdDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aInterface' AND CONSTRAINT_NAME= 'PK_aInterface')
BEGIN
	ALTER TABLE [aInterface] ALTER COLUMN  [InterfaceID] int NOT NULL 
	ALTER TABLE [aInterface] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aInterface] ADD  CONSTRAINT [PK_aInterface] PRIMARY KEY NONCLUSTERED ([InterfaceID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aIslandMaster' AND CONSTRAINT_NAME= 'PK_aIslandMaster')
BEGIN
	ALTER TABLE [aIslandMaster] ALTER COLUMN  [IslandID] int NOT NULL 
	ALTER TABLE [aIslandMaster] ADD  CONSTRAINT [PK_aIslandMaster] PRIMARY KEY CLUSTERED ([IslandID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aItem' AND CONSTRAINT_NAME= 'PK_aItem')
BEGIN
	ALTER TABLE [aItem] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [aItem] ADD  CONSTRAINT [PK_aItem] PRIMARY KEY NONCLUSTERED ([ItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aItemCategory' AND CONSTRAINT_NAME= 'PK_aItemCategory')
BEGIN
	ALTER TABLE [aItemCategory] ALTER COLUMN  [ItemCategoryID] int NOT NULL 
	ALTER TABLE [aItemCategory] ADD  CONSTRAINT [PK_aItemCategory] PRIMARY KEY NONCLUSTERED ([ItemCategoryID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND CONSTRAINT_NAME= 'PK_aItemCategoryMergingDetails')
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aItemCategoryMergingDetails] ALTER COLUMN  [MergeID] int NOT NULL 
	ALTER TABLE [aItemCategoryMergingDetails] ADD  CONSTRAINT [PK_aItemCategoryMergingDetails] PRIMARY KEY CLUSTERED ([CompanyID],[MergeID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aItemImage' AND CONSTRAINT_NAME= 'PK_aItemImage')
BEGIN
	ALTER TABLE [aItemImage] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aItemImage] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [aItemImage] ADD  CONSTRAINT [PK_aItemImage] PRIMARY KEY CLUSTERED ([CompanyID],[ItemID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aItemPackingDetail' AND CONSTRAINT_NAME= 'PK_aItemPackingDetail')
BEGIN
	ALTER TABLE [aItemPackingDetail] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [aItemPackingDetail] ALTER COLUMN  [PackingTypeID] int NOT NULL 
	ALTER TABLE [aItemPackingDetail] ALTER COLUMN  [PackingSlNo] int NOT NULL 
	ALTER TABLE [aItemPackingDetail] ADD  CONSTRAINT [PK_aItemPackingDetail] PRIMARY KEY NONCLUSTERED ([ItemID],[PackingTypeID],[PackingSlNo])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aLCRegisterDetails' AND CONSTRAINT_NAME= 'PK_aLCRegisterDetails')
BEGIN
	ALTER TABLE [aLCRegisterDetails] ALTER COLUMN  [LcID] int NOT NULL 
	ALTER TABLE [aLCRegisterDetails] ADD  CONSTRAINT [PK_aLCRegisterDetails] PRIMARY KEY NONCLUSTERED ([LcID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aletterformat' AND CONSTRAINT_NAME= 'PK_aletterformat')
BEGIN
	ALTER TABLE [aletterformat] ALTER COLUMN  [letterid] int NOT NULL 
	ALTER TABLE [aletterformat] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [aletterformat] ADD  CONSTRAINT [PK_aletterformat] PRIMARY KEY NONCLUSTERED ([letterid],[companyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aListItemDetails' AND CONSTRAINT_NAME= 'PK_aListItemDetails')
BEGIN
	ALTER TABLE [aListItemDetails] ALTER COLUMN  [ListID] int NOT NULL 
	ALTER TABLE [aListItemDetails] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [aListItemDetails] ALTER COLUMN  [PackingTypeID] int NOT NULL 
	ALTER TABLE [aListItemDetails] ADD  CONSTRAINT [PK_aListItemDetails] PRIMARY KEY CLUSTERED ([ListID],[ItemID],[PackingTypeID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aListItemMaster' AND CONSTRAINT_NAME= 'PK_aListItemMaster')
BEGIN
	ALTER TABLE [aListItemMaster] ALTER COLUMN  [Listid] int NOT NULL 
	ALTER TABLE [aListItemMaster] ADD  CONSTRAINT [PK_aListItemMaster] PRIMARY KEY CLUSTERED ([Listid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aListViewDetails' AND CONSTRAINT_NAME= 'PK_aListViewDetails')
BEGIN
	ALTER TABLE [aListViewDetails] ALTER COLUMN  [lvwdid] int NOT NULL 
	ALTER TABLE [aListViewDetails] ALTER COLUMN  [lvwcolid] int NOT NULL 
	ALTER TABLE [aListViewDetails] ADD  CONSTRAINT [PK_aListViewDetails] PRIMARY KEY NONCLUSTERED ([lvwdid],[lvwcolid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aListViewHeader' AND CONSTRAINT_NAME= 'PK_aListViewHeader')
BEGIN
	ALTER TABLE [aListViewHeader] ALTER COLUMN  [lvwid] int NOT NULL 
	ALTER TABLE [aListViewHeader] ADD  CONSTRAINT [PK_aListViewHeader] PRIMARY KEY NONCLUSTERED ([lvwid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aloGroupreportrights' AND CONSTRAINT_NAME= 'PK_aloGroupreportrights')
BEGIN
	ALTER TABLE [aloGroupreportrights] ALTER COLUMN  [userGroupid] int NOT NULL 
	ALTER TABLE [aloGroupreportrights] ALTER COLUMN  [reportid] int NOT NULL 
	ALTER TABLE [aloGroupreportrights] ADD  CONSTRAINT [PK_aloGroupreportrights] PRIMARY KEY CLUSTERED ([userGroupid],[reportid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aLoyaltyCardContactDetails' AND CONSTRAINT_NAME= 'PK_aLoyaltyCardContactDetails')
BEGIN
	ALTER TABLE [aLoyaltyCardContactDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aLoyaltyCardContactDetails] ALTER COLUMN  [ID] int NOT NULL 
	ALTER TABLE [aLoyaltyCardContactDetails] ALTER COLUMN  [CardID] int NOT NULL 
	ALTER TABLE [aLoyaltyCardContactDetails] ALTER COLUMN  [ContactID] int NOT NULL 
	ALTER TABLE [aLoyaltyCardContactDetails] ADD  CONSTRAINT [PK_aLoyaltyCardContactDetails] PRIMARY KEY CLUSTERED ([CompanyID],[ID],[CardID],[ContactID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aLoyaltyCardMaster' AND CONSTRAINT_NAME= 'PK_aLoyaltyCardMaster')
BEGIN
	ALTER TABLE [aLoyaltyCardMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aLoyaltyCardMaster] ALTER COLUMN  [CardID] int NOT NULL 
	ALTER TABLE [aLoyaltyCardMaster] ADD  CONSTRAINT [PK_aLoyaltyCardMaster] PRIMARY KEY CLUSTERED ([CompanyID],[CardID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPackingType' AND CONSTRAINT_NAME= 'PK_aPackingType')
BEGIN
	ALTER TABLE [aPackingType] ALTER COLUMN  [PackingTypeID] int NOT NULL 
	ALTER TABLE [aPackingType] ADD  CONSTRAINT [PK_aPackingType] PRIMARY KEY NONCLUSTERED ([PackingTypeID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPackingTypeCapacityDetail' AND CONSTRAINT_NAME= 'PK_aPackingTypeCapacityDetail')
BEGIN
	ALTER TABLE [aPackingTypeCapacityDetail] ALTER COLUMN  [PackingTypeID] int NOT NULL 
	ALTER TABLE [aPackingTypeCapacityDetail] ALTER COLUMN  [UnitsID] int NOT NULL 
	ALTER TABLE [aPackingTypeCapacityDetail] ADD  CONSTRAINT [PK_aPackingTypeCapacityDetail] PRIMARY KEY NONCLUSTERED ([PackingTypeID],[UnitsID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND CONSTRAINT_NAME= 'PK_aparentCategoryMergingDetails')
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aparentCategoryMergingDetails] ALTER COLUMN  [MergeID] int NOT NULL 
	ALTER TABLE [aparentCategoryMergingDetails] ADD  CONSTRAINT [PK_aparentCategoryMergingDetails] PRIMARY KEY CLUSTERED ([CompanyID],[MergeID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aproductconditionmaster' AND CONSTRAINT_NAME= 'PK_aproductconditionmaster')
BEGIN
	ALTER TABLE [aproductconditionmaster] ALTER COLUMN  [prodcndcompanyid] int NOT NULL 
	ALTER TABLE [aproductconditionmaster] ALTER COLUMN  [prodcndid] int NOT NULL 
	ALTER TABLE [aproductconditionmaster] ADD  CONSTRAINT [PK_aproductconditionmaster] PRIMARY KEY NONCLUSTERED ([prodcndcompanyid],[prodcndid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPurchasePriceRange' AND CONSTRAINT_NAME= 'PK_aPurchasePriceRange')
BEGIN
	ALTER TABLE [aPurchasePriceRange] ALTER COLUMN  [CompanyId] int NOT NULL 
	ALTER TABLE [aPurchasePriceRange] ALTER COLUMN  [ItemId] int NOT NULL 
	ALTER TABLE [aPurchasePriceRange] ADD  CONSTRAINT [PK_aPurchasePriceRange] PRIMARY KEY CLUSTERED ([CompanyId],[ItemId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aRateEditingDetails' AND CONSTRAINT_NAME= 'PK_aRateEditingDetails')
BEGIN
	ALTER TABLE [aRateEditingDetails] ALTER COLUMN  [redID] int NOT NULL 
	ALTER TABLE [aRateEditingDetails] ADD  CONSTRAINT [PK_aRateEditingDetails] PRIMARY KEY CLUSTERED ([redID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aReccuringPaymentDetails' AND CONSTRAINT_NAME= 'PK_aReccuringPaymentDetails')
BEGIN
	ALTER TABLE [aReccuringPaymentDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aReccuringPaymentDetails] ALTER COLUMN  [DepartmentID] int NOT NULL 
	ALTER TABLE [aReccuringPaymentDetails] ALTER COLUMN  [ReccuringID] varchar(50) NOT NULL 
	ALTER TABLE [aReccuringPaymentDetails] ADD  CONSTRAINT [PK_aReccuringPaymentDetails] PRIMARY KEY CLUSTERED ([CompanyID],[DepartmentID],[ReccuringID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aRepFormatAccounts' AND CONSTRAINT_NAME= 'pk_aRepFormatAccounts')
BEGIN
	ALTER TABLE [aRepFormatAccounts] ALTER COLUMN  [CompanyId] int NOT NULL 
	ALTER TABLE [aRepFormatAccounts] ALTER COLUMN  [FormatId] int NOT NULL 
	ALTER TABLE [aRepFormatAccounts] ALTER COLUMN  [GroupId] int NOT NULL 
	ALTER TABLE [aRepFormatAccounts] ALTER COLUMN  [Accountid] int NOT NULL 
	ALTER TABLE [aRepFormatAccounts] ADD  CONSTRAINT [pk_aRepFormatAccounts] PRIMARY KEY CLUSTERED ([CompanyId],[FormatId],[GroupId],[Accountid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aReports' AND CONSTRAINT_NAME= 'pk_aReports')
BEGIN
	ALTER TABLE [aReports] ALTER COLUMN  [ReportID] int NOT NULL 
	ALTER TABLE [aReports] ADD  CONSTRAINT [pk_aReports] PRIMARY KEY CLUSTERED ([ReportID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='areprecvendordetail' AND CONSTRAINT_NAME= 'PK_areprerecvendordetail')
BEGIN
	ALTER TABLE [areprecvendordetail] ALTER COLUMN  [rrvdcompanyid] int NOT NULL 
	ALTER TABLE [areprecvendordetail] ALTER COLUMN  [rrvdreceiveid] int NOT NULL 
	ALTER TABLE [areprecvendordetail] ALTER COLUMN  [rrvddetailid] int NOT NULL 
	ALTER TABLE [areprecvendordetail] ADD  CONSTRAINT [PK_areprerecvendordetail] PRIMARY KEY NONCLUSTERED ([rrvdcompanyid],[rrvdreceiveid],[rrvddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='areprecvendorheader' AND CONSTRAINT_NAME= 'PK_areprecvendorheader')
BEGIN
	ALTER TABLE [areprecvendorheader] ALTER COLUMN  [rrvhcompanyid] int NOT NULL 
	ALTER TABLE [areprecvendorheader] ALTER COLUMN  [rrvhreceiveid] int NOT NULL 
	ALTER TABLE [areprecvendorheader] ADD  CONSTRAINT [PK_areprecvendorheader] PRIMARY KEY NONCLUSTERED ([rrvhcompanyid],[rrvhreceiveid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ASalesPersonCommisionDetail' AND CONSTRAINT_NAME= 'PK_ASalesPersonCommisionDetail')
BEGIN
	ALTER TABLE [ASalesPersonCommisionDetail] ALTER COLUMN  [salespersonid] int NOT NULL 
	ALTER TABLE [ASalesPersonCommisionDetail] ALTER COLUMN  [detailid] int NOT NULL 
	ALTER TABLE [ASalesPersonCommisionDetail] ADD  CONSTRAINT [PK_ASalesPersonCommisionDetail] PRIMARY KEY NONCLUSTERED ([salespersonid],[detailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AsalesPersonmaster' AND CONSTRAINT_NAME= 'PK_AsalesPersonmaster')
BEGIN
	ALTER TABLE [AsalesPersonmaster] ALTER COLUMN  [Sperid] int NOT NULL 
	ALTER TABLE [AsalesPersonmaster] ADD  CONSTRAINT [PK_AsalesPersonmaster] PRIMARY KEY NONCLUSTERED ([Sperid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ASegmentMaster' AND CONSTRAINT_NAME= 'pk_ASegmentMaster')
BEGIN
	ALTER TABLE [ASegmentMaster] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [ASegmentMaster] ALTER COLUMN  [Segmentid] int NOT NULL 
	ALTER TABLE [ASegmentMaster] ADD  CONSTRAINT [pk_ASegmentMaster] PRIMARY KEY CLUSTERED ([companyid],[Segmentid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aServiceCategory' AND CONSTRAINT_NAME= 'PK_ASERVICECATEGORY')
BEGIN
	ALTER TABLE [aServiceCategory] ALTER COLUMN  [sercategid] int NOT NULL 
	ALTER TABLE [aServiceCategory] ALTER COLUMN  [sercatcompanyid] int NOT NULL 
	ALTER TABLE [aServiceCategory] ADD  CONSTRAINT [PK_ASERVICECATEGORY] PRIMARY KEY NONCLUSTERED ([sercategid],[sercatcompanyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aservicelocations' AND CONSTRAINT_NAME= 'PK_aservicelocations')
BEGIN
	ALTER TABLE [aservicelocations] ALTER COLUMN  [serlocid] int NOT NULL 
	ALTER TABLE [aservicelocations] ADD  CONSTRAINT [PK_aservicelocations] PRIMARY KEY NONCLUSTERED ([serlocid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aservicemaster' AND CONSTRAINT_NAME= 'PK_aservicemaster')
BEGIN
	ALTER TABLE [aservicemaster] ALTER COLUMN  [serid] int NOT NULL 
	ALTER TABLE [aservicemaster] ALTER COLUMN  [sercompanyid] int NOT NULL 
	ALTER TABLE [aservicemaster] ADD  CONSTRAINT [PK_aservicemaster] PRIMARY KEY NONCLUSTERED ([serid],[sercompanyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aservicestatus' AND CONSTRAINT_NAME= 'PK__aservicestatus__6E0DDAD3')
BEGIN
	ALTER TABLE [aservicestatus] ALTER COLUMN  [serstatuscompanyid] int NOT NULL 
	ALTER TABLE [aservicestatus] ALTER COLUMN  [serStatusID] int NOT NULL 
	ALTER TABLE [aservicestatus] ADD  CONSTRAINT [PK__aservicestatus__6E0DDAD3] PRIMARY KEY CLUSTERED ([serstatuscompanyid],[serStatusID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSettings' AND CONSTRAINT_NAME= 'PK_aSettings')
BEGIN
	ALTER TABLE [aSettings] ALTER COLUMN  [SettingID] int NOT NULL 
	ALTER TABLE [aSettings] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aSettings] ADD  CONSTRAINT [PK_aSettings] PRIMARY KEY NONCLUSTERED ([SettingID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShipment' AND CONSTRAINT_NAME= 'pk_ashipment')
BEGIN
	ALTER TABLE [aShipment] ALTER COLUMN  [sShipmentID] int NOT NULL 
	ALTER TABLE [aShipment] ADD  CONSTRAINT [pk_ashipment] PRIMARY KEY CLUSTERED ([sShipmentID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ashopcashaccountdetails' AND CONSTRAINT_NAME= 'PK_ashopcashaccountdetails')
BEGIN
	ALTER TABLE [ashopcashaccountdetails] ALTER COLUMN  [shopID] int NOT NULL 
	ALTER TABLE [ashopcashaccountdetails] ALTER COLUMN  [CashAccountID] int NOT NULL 
	ALTER TABLE [ashopcashaccountdetails] ADD  CONSTRAINT [PK_ashopcashaccountdetails] PRIMARY KEY NONCLUSTERED ([shopID],[CashAccountID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopCustomerDetails' AND CONSTRAINT_NAME= 'PK_aShopCustomerDetails')
BEGIN
	ALTER TABLE [aShopCustomerDetails] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [aShopCustomerDetails] ALTER COLUMN  [CustomerID] int NOT NULL 
	ALTER TABLE [aShopCustomerDetails] ADD  CONSTRAINT [PK_aShopCustomerDetails] PRIMARY KEY NONCLUSTERED ([ShopID],[CustomerID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopCustomerSetting' AND CONSTRAINT_NAME= 'PK__aShopCus__67C5562945F365D3')
BEGIN
	ALTER TABLE [aShopCustomerSetting] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [aShopCustomerSetting] ADD  CONSTRAINT [PK__aShopCus__67C5562945F365D3] PRIMARY KEY CLUSTERED ([ShopID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopitemCategory' AND CONSTRAINT_NAME= 'PK_aShopitemCategory')
BEGIN
	ALTER TABLE [aShopitemCategory] ALTER COLUMN  [shopid] int NOT NULL 
	ALTER TABLE [aShopitemCategory] ALTER COLUMN  [itemcategoryid] int NOT NULL 
	ALTER TABLE [aShopitemCategory] ADD  CONSTRAINT [PK_aShopitemCategory] PRIMARY KEY NONCLUSTERED ([shopid],[itemcategoryid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopItemDetail' AND CONSTRAINT_NAME= 'PK_aShopItemDetail')
BEGIN
	ALTER TABLE [aShopItemDetail] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [aShopItemDetail] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [aShopItemDetail] ADD  CONSTRAINT [PK_aShopItemDetail] PRIMARY KEY NONCLUSTERED ([ShopID],[ItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ashopprintmessages' AND CONSTRAINT_NAME= 'PK_ashopprintmessages')
BEGIN
	ALTER TABLE [ashopprintmessages] ALTER COLUMN  [shopid] int NOT NULL 
	ALTER TABLE [ashopprintmessages] ALTER COLUMN  [transtype] varchar(50) NOT NULL 
	ALTER TABLE [ashopprintmessages] ALTER COLUMN  [messageid] int NOT NULL 
	ALTER TABLE [ashopprintmessages] ADD  CONSTRAINT [PK_ashopprintmessages] PRIMARY KEY NONCLUSTERED ([shopid],[transtype],[messageid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'PK_aShops')
BEGIN
	ALTER TABLE [aShops] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [aShops] ADD  CONSTRAINT [PK_aShops] PRIMARY KEY NONCLUSTERED ([ShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Ashopsalespersondetails' AND CONSTRAINT_NAME= 'PK_Ashopsalespersondetails')
BEGIN
	ALTER TABLE [Ashopsalespersondetails] ALTER COLUMN  [SperID] int NOT NULL 
	ALTER TABLE [Ashopsalespersondetails] ALTER COLUMN  [SperShopid] int NOT NULL 
	ALTER TABLE [Ashopsalespersondetails] ADD  CONSTRAINT [PK_Ashopsalespersondetails] PRIMARY KEY NONCLUSTERED ([SperID],[SperShopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ashopsercategory' AND CONSTRAINT_NAME= 'PK_ASHOPSERCATEGORY')
BEGIN
	ALTER TABLE [ashopsercategory] ALTER COLUMN  [ssercategid] int NOT NULL 
	ALTER TABLE [ashopsercategory] ALTER COLUMN  [ssercatcompanyid] int NOT NULL 
	ALTER TABLE [ashopsercategory] ALTER COLUMN  [sshopid] int NOT NULL 
	ALTER TABLE [ashopsercategory] ADD  CONSTRAINT [PK_ASHOPSERCATEGORY] PRIMARY KEY NONCLUSTERED ([ssercategid],[ssercatcompanyid],[sshopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopServiceCharges' AND CONSTRAINT_NAME= 'pk_aShopServiceCharges')
BEGIN
	ALTER TABLE [aShopServiceCharges] ALTER COLUMN  [serid] int NOT NULL 
	ALTER TABLE [aShopServiceCharges] ALTER COLUMN  [sercompanyid] int NOT NULL 
	ALTER TABLE [aShopServiceCharges] ALTER COLUMN  [serShopID] int NOT NULL 
	ALTER TABLE [aShopServiceCharges] ADD  CONSTRAINT [pk_aShopServiceCharges] PRIMARY KEY CLUSTERED ([serid],[sercompanyid],[serShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopToolsDetails' AND CONSTRAINT_NAME= 'pk_ashoptoolsdetails')
BEGIN
	ALTER TABLE [aShopToolsDetails] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [aShopToolsDetails] ALTER COLUMN  [shopid] int NOT NULL 
	ALTER TABLE [aShopToolsDetails] ALTER COLUMN  [toolsastid] int NOT NULL 
	ALTER TABLE [aShopToolsDetails] ADD  CONSTRAINT [pk_ashoptoolsdetails] PRIMARY KEY CLUSTERED ([companyid],[shopid],[toolsastid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopVendorDetails' AND CONSTRAINT_NAME= 'PK_aShopVendorDetails')
BEGIN
	ALTER TABLE [aShopVendorDetails] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [aShopVendorDetails] ALTER COLUMN  [VendorID] int NOT NULL 
	ALTER TABLE [aShopVendorDetails] ADD  CONSTRAINT [PK_aShopVendorDetails] PRIMARY KEY NONCLUSTERED ([ShopID],[VendorID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSize' AND CONSTRAINT_NAME= 'PK_aSize')
BEGIN
	ALTER TABLE [aSize] ALTER COLUMN  [SizeID] int NOT NULL 
	ALTER TABLE [aSize] ADD  CONSTRAINT [PK_aSize] PRIMARY KEY NONCLUSTERED ([SizeID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assetdisposaldetail' AND CONSTRAINT_NAME= 'PK_assetdisposaldetail')
BEGIN
	ALTER TABLE [assetdisposaldetail] ALTER COLUMN  [dispdcompanyid] int NOT NULL 
	ALTER TABLE [assetdisposaldetail] ALTER COLUMN  [dispID] int NOT NULL 
	ALTER TABLE [assetdisposaldetail] ALTER COLUMN  [dispdid] int NOT NULL 
	ALTER TABLE [assetdisposaldetail] ADD  CONSTRAINT [PK_assetdisposaldetail] PRIMARY KEY NONCLUSTERED ([dispdcompanyid],[dispID],[dispdid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assettransfer' AND CONSTRAINT_NAME= 'PK_assettransfer')
BEGIN
	ALTER TABLE [assettransfer] ALTER COLUMN  [asttransid] int NOT NULL 
	ALTER TABLE [assettransfer] ALTER COLUMN  [asttranscompanyid] int NOT NULL 
	ALTER TABLE [assettransfer] ADD  CONSTRAINT [PK_assettransfer] PRIMARY KEY NONCLUSTERED ([asttransid],[asttranscompanyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aStatus' AND CONSTRAINT_NAME= 'PK_aStatus')
BEGIN
	ALTER TABLE [aStatus] ALTER COLUMN  [CompanyId] int NOT NULL 
	ALTER TABLE [aStatus] ALTER COLUMN  [StatusId] int NOT NULL 
	ALTER TABLE [aStatus] ADD  CONSTRAINT [PK_aStatus] PRIMARY KEY CLUSTERED ([CompanyId],[StatusId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aStatusGroup' AND CONSTRAINT_NAME= 'PK_aStatusGroup')
BEGIN
	ALTER TABLE [aStatusGroup] ALTER COLUMN  [CompanyId] int NOT NULL 
	ALTER TABLE [aStatusGroup] ALTER COLUMN  [StatusGroupId] int NOT NULL 
	ALTER TABLE [aStatusGroup] ADD  CONSTRAINT [PK_aStatusGroup] PRIMARY KEY CLUSTERED ([CompanyId],[StatusGroupId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSubDepartmentMaster' AND CONSTRAINT_NAME= 'PK_aSubDepartmentMaster')
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ALTER COLUMN  [SubDepartmentID] int NOT NULL 
	ALTER TABLE [aSubDepartmentMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aSubDepartmentMaster] ADD  CONSTRAINT [PK_aSubDepartmentMaster] PRIMARY KEY CLUSTERED ([SubDepartmentID],[CompanyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSubItemDetails' AND CONSTRAINT_NAME= 'PK_aSubItemDetails')
BEGIN
	ALTER TABLE [aSubItemDetails] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [aSubItemDetails] ALTER COLUMN  [SubItemID] int NOT NULL 
	ALTER TABLE [aSubItemDetails] ADD  CONSTRAINT [PK_aSubItemDetails] PRIMARY KEY NONCLUSTERED ([ItemID],[SubItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aTableColumns' AND CONSTRAINT_NAME= 'PK_TableColumns')
BEGIN
	ALTER TABLE [aTableColumns] ALTER COLUMN  [TableID] int NOT NULL 
	ALTER TABLE [aTableColumns] ALTER COLUMN  [ColumnID] int NOT NULL 
	ALTER TABLE [aTableColumns] ADD  CONSTRAINT [PK_TableColumns] PRIMARY KEY NONCLUSTERED ([TableID],[ColumnID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aTables' AND CONSTRAINT_NAME= 'PK_Tables')
BEGIN
	ALTER TABLE [aTables] ALTER COLUMN  [TableID] int NOT NULL 
	ALTER TABLE [aTables] ADD  CONSTRAINT [PK_Tables] PRIMARY KEY NONCLUSTERED ([TableID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aTaxCategoryMaster' AND CONSTRAINT_NAME= 'PK_aTaxCategoryMaster')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] ALTER COLUMN  [TaxCompanyId] int NOT NULL 
	ALTER TABLE [aTaxCategoryMaster] ALTER COLUMN  [TaxId] int NOT NULL 
	ALTER TABLE [aTaxCategoryMaster] ADD  CONSTRAINT [PK_aTaxCategoryMaster] PRIMARY KEY NONCLUSTERED ([TaxCompanyId],[TaxId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aTechnicianServiceDetails' AND CONSTRAINT_NAME= 'pk_aTechnicianServiceDetails')
BEGIN
	ALTER TABLE [aTechnicianServiceDetails] ALTER COLUMN  [serid] int NOT NULL 
	ALTER TABLE [aTechnicianServiceDetails] ALTER COLUMN  [sercompanyid] int NOT NULL 
	ALTER TABLE [aTechnicianServiceDetails] ALTER COLUMN  [serTechnicianID] int NOT NULL 
	ALTER TABLE [aTechnicianServiceDetails] ADD  CONSTRAINT [pk_aTechnicianServiceDetails] PRIMARY KEY CLUSTERED ([serid],[sercompanyid],[serTechnicianID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUnit' AND CONSTRAINT_NAME= 'aPK_Unit')
BEGIN
	ALTER TABLE [aUnit] ALTER COLUMN  [UnitID] int NOT NULL 
	ALTER TABLE [aUnit] ADD  CONSTRAINT [aPK_Unit] PRIMARY KEY NONCLUSTERED ([UnitID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserAuditDetail' AND CONSTRAINT_NAME= 'PK_aUserAuditDetail')
BEGIN
	ALTER TABLE [aUserAuditDetail] ALTER COLUMN  [dCompanyId] int NOT NULL 
	ALTER TABLE [aUserAuditDetail] ALTER COLUMN  [dAuditId] int NOT NULL 
	ALTER TABLE [aUserAuditDetail] ALTER COLUMN  [dDetailId] int NOT NULL 
	ALTER TABLE [aUserAuditDetail] ADD  CONSTRAINT [PK_aUserAuditDetail] PRIMARY KEY NONCLUSTERED ([dCompanyId],[dAuditId],[dDetailId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserAuditHeader' AND CONSTRAINT_NAME= 'PK_aUserAuditHeader')
BEGIN
	ALTER TABLE [aUserAuditHeader] ALTER COLUMN  [hCompanyId] int NOT NULL 
	ALTER TABLE [aUserAuditHeader] ALTER COLUMN  [hAuditId] int NOT NULL 
	ALTER TABLE [aUserAuditHeader] ADD  CONSTRAINT [PK_aUserAuditHeader] PRIMARY KEY NONCLUSTERED ([hCompanyId],[hAuditId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ausergroupAccGroupDetails' AND CONSTRAINT_NAME= 'PK_ausergroupAccDetails')
BEGIN
	ALTER TABLE [ausergroupAccGroupDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [ausergroupAccGroupDetails] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [ausergroupAccGroupDetails] ALTER COLUMN  [AccGroupID] int NOT NULL 
	ALTER TABLE [ausergroupAccGroupDetails] ADD  CONSTRAINT [PK_ausergroupAccDetails] PRIMARY KEY CLUSTERED ([CompanyID],[UserGroupID],[AccGroupID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserGroupBrandDetails' AND CONSTRAINT_NAME= 'PK_aUserGroupBrandDetails')
BEGIN
	ALTER TABLE [aUserGroupBrandDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aUserGroupBrandDetails] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [aUserGroupBrandDetails] ALTER COLUMN  [BrandID] int NOT NULL 
	ALTER TABLE [aUserGroupBrandDetails] ADD  CONSTRAINT [PK_aUserGroupBrandDetails] PRIMARY KEY CLUSTERED ([CompanyID],[UserGroupID],[BrandID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserGroupCusGroupDetails' AND CONSTRAINT_NAME= 'PK_aUserGroupCusGroupDetails')
BEGIN
	ALTER TABLE [aUserGroupCusGroupDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aUserGroupCusGroupDetails] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [aUserGroupCusGroupDetails] ALTER COLUMN  [CusGroupID] int NOT NULL 
	ALTER TABLE [aUserGroupCusGroupDetails] ADD  CONSTRAINT [PK_aUserGroupCusGroupDetails] PRIMARY KEY CLUSTERED ([CompanyID],[UserGroupID],[CusGroupID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserGroupGodownDetails' AND CONSTRAINT_NAME= 'PK_aUserGroupGodownDetails')
BEGIN
	ALTER TABLE [aUserGroupGodownDetails] ALTER COLUMN  [CompanyId] int NOT NULL 
	ALTER TABLE [aUserGroupGodownDetails] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [aUserGroupGodownDetails] ALTER COLUMN  [GodownID] int NOT NULL 
	ALTER TABLE [aUserGroupGodownDetails] ADD  CONSTRAINT [PK_aUserGroupGodownDetails] PRIMARY KEY CLUSTERED ([CompanyId],[UserGroupID],[GodownID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserGroupItemCategoryDetails' AND CONSTRAINT_NAME= 'PK_aUserGroupItemCategoryDetails')
BEGIN
	ALTER TABLE [aUserGroupItemCategoryDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aUserGroupItemCategoryDetails] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [aUserGroupItemCategoryDetails] ALTER COLUMN  [ItemCategoryID] int NOT NULL 
	ALTER TABLE [aUserGroupItemCategoryDetails] ADD  CONSTRAINT [PK_aUserGroupItemCategoryDetails] PRIMARY KEY CLUSTERED ([CompanyID],[UserGroupID],[ItemCategoryID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUsergroups' AND CONSTRAINT_NAME= 'PK_aUsergroups')
BEGIN
	ALTER TABLE [aUsergroups] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [aUsergroups] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aUsergroups] ADD  CONSTRAINT [PK_aUsergroups] PRIMARY KEY CLUSTERED ([UserGroupID],[CompanyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserGroupShopDetails' AND CONSTRAINT_NAME= 'PK_aUserGroupShopDetails')
BEGIN
	ALTER TABLE [aUserGroupShopDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aUserGroupShopDetails] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [aUserGroupShopDetails] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [aUserGroupShopDetails] ADD  CONSTRAINT [PK_aUserGroupShopDetails] PRIMARY KEY CLUSTERED ([CompanyID],[UserGroupID],[ShopID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserGroupVenGroupDetails' AND CONSTRAINT_NAME= 'PK_aUserGroupVenGroupDetails')
BEGIN
	ALTER TABLE [aUserGroupVenGroupDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aUserGroupVenGroupDetails] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [aUserGroupVenGroupDetails] ALTER COLUMN  [VenGroupID] int NOT NULL 
	ALTER TABLE [aUserGroupVenGroupDetails] ADD  CONSTRAINT [PK_aUserGroupVenGroupDetails] PRIMARY KEY CLUSTERED ([CompanyID],[UserGroupID],[VenGroupID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserRights' AND CONSTRAINT_NAME= 'PK_aUserRights')
BEGIN
	ALTER TABLE [aUserRights] ALTER COLUMN  [UserID] int NOT NULL 
	ALTER TABLE [aUserRights] ALTER COLUMN  [InterfaceID] int NOT NULL 
	ALTER TABLE [aUserRights] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aUserRights] ADD  CONSTRAINT [PK_aUserRights] PRIMARY KEY NONCLUSTERED ([UserID],[InterfaceID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUsers' AND CONSTRAINT_NAME= 'PK_aUsers')
BEGIN
	ALTER TABLE [aUsers] ALTER COLUMN  [UserID] int NOT NULL 
	ALTER TABLE [aUsers] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aUsers] ADD  CONSTRAINT [PK_aUsers] PRIMARY KEY NONCLUSTERED ([UserID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aVendorGroup' AND CONSTRAINT_NAME= 'PK_aVendorGroup')
BEGIN
	ALTER TABLE [aVendorGroup] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aVendorGroup] ALTER COLUMN  [VenGroupId] int NOT NULL 
	ALTER TABLE [aVendorGroup] ADD  CONSTRAINT [PK_aVendorGroup] PRIMARY KEY CLUSTERED ([CompanyID],[VenGroupId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aVendorMaster' AND CONSTRAINT_NAME= 'PK_aVendorMaster')
BEGIN
	ALTER TABLE [aVendorMaster] ALTER COLUMN  [VendorID] int NOT NULL 
	ALTER TABLE [aVendorMaster] ADD  CONSTRAINT [PK_aVendorMaster] PRIMARY KEY NONCLUSTERED ([VendorID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aVendorMasterBackUp' AND CONSTRAINT_NAME= 'PK_aVendorMasterBackUp')
BEGIN
	ALTER TABLE [aVendorMasterBackUp] ALTER COLUMN  [VendorID] int NOT NULL 
	ALTER TABLE [aVendorMasterBackUp] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [aVendorMasterBackUp] ADD  CONSTRAINT [PK_aVendorMasterBackUp] PRIMARY KEY NONCLUSTERED ([VendorID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Bills' AND CONSTRAINT_NAME= 'PK_Bills')
BEGIN
	ALTER TABLE [Bills] ALTER COLUMN  [BillsID] int NOT NULL 
	ALTER TABLE [Bills] ADD  CONSTRAINT [PK_Bills] PRIMARY KEY NONCLUSTERED ([BillsID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BillsDebitDetails' AND CONSTRAINT_NAME= 'PK_BillsDebitDetails')
BEGIN
	ALTER TABLE [BillsDebitDetails] ALTER COLUMN  [BillsID] int NOT NULL 
	ALTER TABLE [BillsDebitDetails] ALTER COLUMN  [BillsDebitID] int NOT NULL 
	ALTER TABLE [BillsDebitDetails] ADD  CONSTRAINT [PK_BillsDebitDetails] PRIMARY KEY NONCLUSTERED ([BillsID],[BillsDebitID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetAccountsLink' AND CONSTRAINT_NAME= 'PK_BudgetAccountsLink')
BEGIN
	ALTER TABLE [BudgetAccountsLink] ALTER COLUMN  [bacCompanyID] int NOT NULL 
	ALTER TABLE [BudgetAccountsLink] ALTER COLUMN  [bacBudgetID] int NOT NULL 
	ALTER TABLE [BudgetAccountsLink] ALTER COLUMN  [bacDetailID] int NOT NULL 
	ALTER TABLE [BudgetAccountsLink] ADD  CONSTRAINT [PK_BudgetAccountsLink] PRIMARY KEY NONCLUSTERED ([bacCompanyID],[bacBudgetID],[bacDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetAllocationDetail' AND CONSTRAINT_NAME= 'PK_BudgetAllocationDetail')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ALTER COLUMN  [badCompanyID] int NOT NULL 
	ALTER TABLE [BudgetAllocationDetail] ALTER COLUMN  [badBudgetAllocID] int NOT NULL 
	ALTER TABLE [BudgetAllocationDetail] ALTER COLUMN  [badDetailID] int NOT NULL 
	ALTER TABLE [BudgetAllocationDetail] ADD  CONSTRAINT [PK_BudgetAllocationDetail] PRIMARY KEY NONCLUSTERED ([badCompanyID],[badBudgetAllocID],[badDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetAllocationHeader' AND CONSTRAINT_NAME= 'PK_BudgetAllocationHeader')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] ALTER COLUMN  [bahCompanyID] int NOT NULL 
	ALTER TABLE [BudgetAllocationHeader] ALTER COLUMN  [bahBudgetAllocID] int NOT NULL 
	ALTER TABLE [BudgetAllocationHeader] ADD  CONSTRAINT [PK_BudgetAllocationHeader] PRIMARY KEY NONCLUSTERED ([bahCompanyID],[bahBudgetAllocID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetCheckDetail' AND CONSTRAINT_NAME= 'PK_BudgetCheckDetail')
BEGIN
	ALTER TABLE [BudgetCheckDetail] ALTER COLUMN  [bcdCompanyID] int NOT NULL 
	ALTER TABLE [BudgetCheckDetail] ALTER COLUMN  [bcdCheckID] int NOT NULL 
	ALTER TABLE [BudgetCheckDetail] ALTER COLUMN  [bcdDetailID] int NOT NULL 
	ALTER TABLE [BudgetCheckDetail] ADD  CONSTRAINT [PK_BudgetCheckDetail] PRIMARY KEY NONCLUSTERED ([bcdCompanyID],[bcdCheckID],[bcdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetCheckHeader' AND CONSTRAINT_NAME= 'PK_BudgetCheckHeader')
BEGIN
	ALTER TABLE [BudgetCheckHeader] ALTER COLUMN  [bchCompanyId] int NOT NULL 
	ALTER TABLE [BudgetCheckHeader] ALTER COLUMN  [bchCheckID] int NOT NULL 
	ALTER TABLE [BudgetCheckHeader] ADD  CONSTRAINT [PK_BudgetCheckHeader] PRIMARY KEY NONCLUSTERED ([bchCompanyId],[bchCheckID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND CONSTRAINT_NAME= 'pk_BudgetitemPlanDetail')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] ALTER COLUMN  [bpdICompanyID] int NOT NULL 
	ALTER TABLE [BudgetitemPlanDetail] ALTER COLUMN  [bpdIBudgetPlanID] int NOT NULL 
	ALTER TABLE [BudgetitemPlanDetail] ALTER COLUMN  [bpdIDetailID] int NOT NULL 
	ALTER TABLE [BudgetitemPlanDetail] ADD  CONSTRAINT [pk_BudgetitemPlanDetail] PRIMARY KEY CLUSTERED ([bpdICompanyID],[bpdIBudgetPlanID],[bpdIDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetMaster' AND CONSTRAINT_NAME= 'PK_BudgetMaster')
BEGIN
	ALTER TABLE [BudgetMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [BudgetMaster] ALTER COLUMN  [BudgetID] int NOT NULL 
	ALTER TABLE [BudgetMaster] ADD  CONSTRAINT [PK_BudgetMaster] PRIMARY KEY NONCLUSTERED ([CompanyID],[BudgetID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetPlanDetail' AND CONSTRAINT_NAME= 'PK_BudgetPlanDetail')
BEGIN
	ALTER TABLE [BudgetPlanDetail] ALTER COLUMN  [bpdCompanyID] int NOT NULL 
	ALTER TABLE [BudgetPlanDetail] ALTER COLUMN  [bpdBudgetPlanID] int NOT NULL 
	ALTER TABLE [BudgetPlanDetail] ALTER COLUMN  [bpdDetailID] int NOT NULL 
	ALTER TABLE [BudgetPlanDetail] ADD  CONSTRAINT [PK_BudgetPlanDetail] PRIMARY KEY CLUSTERED ([bpdCompanyID],[bpdBudgetPlanID],[bpdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetPlanHeader' AND CONSTRAINT_NAME= 'PK_BudgetPlanHeader')
BEGIN
	ALTER TABLE [BudgetPlanHeader] ALTER COLUMN  [bphCompanyID] int NOT NULL 
	ALTER TABLE [BudgetPlanHeader] ALTER COLUMN  [bphBudgetPlanID] int NOT NULL 
	ALTER TABLE [BudgetPlanHeader] ADD  CONSTRAINT [PK_BudgetPlanHeader] PRIMARY KEY CLUSTERED ([bphCompanyID],[bphBudgetPlanID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND CONSTRAINT_NAME= 'PK_BudgetPlanReviseDetail')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ALTER COLUMN  [brdCompanyID] int NOT NULL 
	ALTER TABLE [BudgetPlanReviseDetail] ALTER COLUMN  [brdBudgetPlanID] int NOT NULL 
	ALTER TABLE [BudgetPlanReviseDetail] ALTER COLUMN  [brdDetailID] int NOT NULL 
	ALTER TABLE [BudgetPlanReviseDetail] ADD  CONSTRAINT [PK_BudgetPlanReviseDetail] PRIMARY KEY CLUSTERED ([brdCompanyID],[brdBudgetPlanID],[brdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CashBox' AND CONSTRAINT_NAME= 'PK_CashBox')
BEGIN
	ALTER TABLE [CashBox] ALTER COLUMN  [CBID] int NOT NULL 
	ALTER TABLE [CashBox] ALTER COLUMN  [CBShopID] int NOT NULL 
	ALTER TABLE [CashBox] ADD  CONSTRAINT [PK_CashBox] PRIMARY KEY NONCLUSTERED ([CBID],[CBShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ClearenceRequestDetail' AND CONSTRAINT_NAME= 'pk_ClearenceRequestDetail')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [ClearenceRequestDetail] ALTER COLUMN  [ClearenceReqID] int NOT NULL 
	ALTER TABLE [ClearenceRequestDetail] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [ClearenceRequestDetail] ADD  CONSTRAINT [pk_ClearenceRequestDetail] PRIMARY KEY CLUSTERED ([ShopID],[ClearenceReqID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ClearenceRequestHeader' AND CONSTRAINT_NAME= 'pk_ClearenceRequestHeader')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [ClearenceRequestHeader] ALTER COLUMN  [ClearenceReqID] int NOT NULL 
	ALTER TABLE [ClearenceRequestHeader] ADD  CONSTRAINT [pk_ClearenceRequestHeader] PRIMARY KEY CLUSTERED ([ShopID],[ClearenceReqID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Contra' AND CONSTRAINT_NAME= 'PK_Contra')
BEGIN
	ALTER TABLE [Contra] ALTER COLUMN  [ContraID] int NOT NULL 
	ALTER TABLE [Contra] ADD  CONSTRAINT [PK_Contra] PRIMARY KEY NONCLUSTERED ([ContraID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmClient' AND CONSTRAINT_NAME= 'PK_crmClient')
BEGIN
	ALTER TABLE [CrmClient] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [CrmClient] ALTER COLUMN  [ClientId] int NOT NULL 
	ALTER TABLE [CrmClient] ADD  CONSTRAINT [PK_crmClient] PRIMARY KEY CLUSTERED ([CompanyID],[ClientId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmContact' AND CONSTRAINT_NAME= 'PK_CrmContact')
BEGIN
	ALTER TABLE [CrmContact] ALTER COLUMN  [ContactID] int NOT NULL 
	ALTER TABLE [CrmContact] ADD  CONSTRAINT [PK_CrmContact] PRIMARY KEY CLUSTERED ([ContactID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmCustomerMaster' AND CONSTRAINT_NAME= 'PK_CrmCustomerMaster')
BEGIN
	ALTER TABLE [CrmCustomerMaster] ALTER COLUMN  [CustomerID] int NOT NULL 
	ALTER TABLE [CrmCustomerMaster] ADD  CONSTRAINT [PK_CrmCustomerMaster] PRIMARY KEY CLUSTERED ([CustomerID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmEmail' AND CONSTRAINT_NAME= 'PK_CrmEmail')
BEGIN
	ALTER TABLE [CrmEmail] ALTER COLUMN  [Emailid] int NOT NULL 
	ALTER TABLE [CrmEmail] ADD  CONSTRAINT [PK_CrmEmail] PRIMARY KEY CLUSTERED ([Emailid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmEmailRecepients' AND CONSTRAINT_NAME= 'PK_CrmEmailRecepients')
BEGIN
	ALTER TABLE [CrmEmailRecepients] ALTER COLUMN  [EmailId] int NOT NULL 
	ALTER TABLE [CrmEmailRecepients] ALTER COLUMN  [ContactId] int NOT NULL 
	ALTER TABLE [CrmEmailRecepients] ADD  CONSTRAINT [PK_CrmEmailRecepients] PRIMARY KEY CLUSTERED ([EmailId],[ContactId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmLeadMaster' AND CONSTRAINT_NAME= 'PK_CrmLeadMaster')
BEGIN
	ALTER TABLE [CrmLeadMaster] ALTER COLUMN  [LeadId] int NOT NULL 
	ALTER TABLE [CrmLeadMaster] ADD  CONSTRAINT [PK_CrmLeadMaster] PRIMARY KEY CLUSTERED ([LeadId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmLeads' AND CONSTRAINT_NAME= 'PK_CrmLeads')
BEGIN
	ALTER TABLE [CrmLeads] ALTER COLUMN  [LeadId] int NOT NULL 
	ALTER TABLE [CrmLeads] ADD  CONSTRAINT [PK_CrmLeads] PRIMARY KEY CLUSTERED ([LeadId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmOppertunityType' AND CONSTRAINT_NAME= 'PK_CrmOppertunityType')
BEGIN
	ALTER TABLE [CrmOppertunityType] ALTER COLUMN  [TypeId] int NOT NULL 
	ALTER TABLE [CrmOppertunityType] ADD  CONSTRAINT [PK_CrmOppertunityType] PRIMARY KEY CLUSTERED ([TypeId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmSupportrequest' AND CONSTRAINT_NAME= 'PK_CrmSupportrequest')
BEGIN
	ALTER TABLE [CrmSupportrequest] ALTER COLUMN  [RequerstId] int NOT NULL 
	ALTER TABLE [CrmSupportrequest] ADD  CONSTRAINT [PK_CrmSupportrequest] PRIMARY KEY CLUSTERED ([RequerstId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmUserHirarchey' AND CONSTRAINT_NAME= 'PK_CrmUserHirarchey')
BEGIN
	ALTER TABLE [CrmUserHirarchey] ALTER COLUMN  [UserHirarcheyId] int NOT NULL 
	ALTER TABLE [CrmUserHirarchey] ADD  CONSTRAINT [PK_CrmUserHirarchey] PRIMARY KEY CLUSTERED ([UserHirarcheyId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmUserLastVisited' AND CONSTRAINT_NAME= 'PK_CrmUserLastVisited')
BEGIN
	ALTER TABLE [CrmUserLastVisited] ALTER COLUMN  [UserId] int NOT NULL 
	ALTER TABLE [CrmUserLastVisited] ALTER COLUMN  [SaveOrder] int NOT NULL 
	ALTER TABLE [CrmUserLastVisited] ADD  CONSTRAINT [PK_CrmUserLastVisited] PRIMARY KEY CLUSTERED ([UserId],[SaveOrder])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CRMVersion' AND CONSTRAINT_NAME= 'PK_CRMVersion')
BEGIN
	ALTER TABLE [CRMVersion] ALTER COLUMN  [Id] int NOT NULL 
	ALTER TABLE [CRMVersion] ADD  CONSTRAINT [PK_CRMVersion] PRIMARY KEY CLUSTERED ([Id])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementDetail' AND CONSTRAINT_NAME= 'PK_CustomerSettlementDetail')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] ALTER COLUMN  [CSID] int NOT NULL 
	ALTER TABLE [CustomerSettlementDetail] ALTER COLUMN  [CSDetailID] int NOT NULL 
	ALTER TABLE [CustomerSettlementDetail] ADD  CONSTRAINT [PK_CustomerSettlementDetail] PRIMARY KEY NONCLUSTERED ([CSID],[CSDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementHeader' AND CONSTRAINT_NAME= 'PK_CustomerSettlementHeader')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ALTER COLUMN  [CSID] int NOT NULL 
	ALTER TABLE [CustomerSettlementHeader] ADD  CONSTRAINT [PK_CustomerSettlementHeader] PRIMARY KEY NONCLUSTERED ([CSID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DebitCreditNote' AND CONSTRAINT_NAME= 'PK_DebitCreditNote')
BEGIN
	ALTER TABLE [DebitCreditNote] ALTER COLUMN  [DCNId] int NOT NULL 
	ALTER TABLE [DebitCreditNote] ADD  CONSTRAINT [PK_DebitCreditNote] PRIMARY KEY NONCLUSTERED ([DCNId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DenominationChequeDetails' AND CONSTRAINT_NAME= 'pk_DenominationChequeDetails')
BEGIN
	ALTER TABLE [DenominationChequeDetails] ALTER COLUMN  [dcdShopId] int NOT NULL 
	ALTER TABLE [DenominationChequeDetails] ALTER COLUMN  [dcdDenomId] int NOT NULL 
	ALTER TABLE [DenominationChequeDetails] ALTER COLUMN  [dcdDetailId] int NOT NULL 
	ALTER TABLE [DenominationChequeDetails] ADD  CONSTRAINT [pk_DenominationChequeDetails] PRIMARY KEY CLUSTERED ([dcdShopId],[dcdDenomId],[dcdDetailId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='denominationheader' AND CONSTRAINT_NAME= 'pk_denominationheader')
BEGIN
	ALTER TABLE [denominationheader] ALTER COLUMN  [shopid] int NOT NULL 
	ALTER TABLE [denominationheader] ALTER COLUMN  [denominationid] int NOT NULL 
	ALTER TABLE [denominationheader] ADD  CONSTRAINT [pk_denominationheader] PRIMARY KEY CLUSTERED ([shopid],[denominationid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DepreciationHeader' AND CONSTRAINT_NAME= 'PK_Depreciation')
BEGIN
	ALTER TABLE [DepreciationHeader] ALTER COLUMN  [DepreciationID] int NOT NULL 
	ALTER TABLE [DepreciationHeader] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [DepreciationHeader] ADD  CONSTRAINT [PK_Depreciation] PRIMARY KEY NONCLUSTERED ([DepreciationID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Discountdetails' AND CONSTRAINT_NAME= 'PK_Discountdetails')
BEGIN
	ALTER TABLE [Discountdetails] ALTER COLUMN  [Companyid] int NOT NULL 
	ALTER TABLE [Discountdetails] ALTER COLUMN  [Discountid] int NOT NULL 
	ALTER TABLE [Discountdetails] ALTER COLUMN  [Outletid] int NOT NULL 
	ALTER TABLE [Discountdetails] ADD  CONSTRAINT [PK_Discountdetails] PRIMARY KEY NONCLUSTERED ([Companyid],[Discountid],[Outletid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='discountdishdetails' AND CONSTRAINT_NAME= 'PK_discountdishitemdetails')
BEGIN
	ALTER TABLE [discountdishdetails] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [discountdishdetails] ALTER COLUMN  [discountid] int NOT NULL 
	ALTER TABLE [discountdishdetails] ALTER COLUMN  [Outletid] int NOT NULL 
	ALTER TABLE [discountdishdetails] ALTER COLUMN  [dishid] int NOT NULL 
	ALTER TABLE [discountdishdetails] ADD  CONSTRAINT [PK_discountdishitemdetails] PRIMARY KEY NONCLUSTERED ([companyid],[discountid],[Outletid],[dishid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Discountheader' AND CONSTRAINT_NAME= 'PK_Discountheader')
BEGIN
	ALTER TABLE [Discountheader] ALTER COLUMN  [Companyid] int NOT NULL 
	ALTER TABLE [Discountheader] ALTER COLUMN  [Discountid] int NOT NULL 
	ALTER TABLE [Discountheader] ADD  CONSTRAINT [PK_Discountheader] PRIMARY KEY NONCLUSTERED ([Companyid],[Discountid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DishSegmentDetail' AND CONSTRAINT_NAME= 'PK_segid_segheaderid_segdishid_segcompanyid_SegUpdateTime')
BEGIN
	ALTER TABLE [DishSegmentDetail] ALTER COLUMN  [seg_detail_id] int NOT NULL 
	ALTER TABLE [DishSegmentDetail] ALTER COLUMN  [seg_detail_header_id] int NOT NULL 
	ALTER TABLE [DishSegmentDetail] ALTER COLUMN  [seg_detail_dishid] int NOT NULL 
	ALTER TABLE [DishSegmentDetail] ALTER COLUMN  [seg_detail_companyid] int NOT NULL 
	ALTER TABLE [DishSegmentDetail] ALTER COLUMN  [Seg_Detail_UpdateTime] datetime NOT NULL 
	ALTER TABLE [DishSegmentDetail] ADD  CONSTRAINT [PK_segid_segheaderid_segdishid_segcompanyid_SegUpdateTime] PRIMARY KEY CLUSTERED ([seg_detail_id],[seg_detail_header_id],[seg_detail_dishid],[seg_detail_companyid],[Seg_Detail_UpdateTime])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DishSegmentHeader' AND CONSTRAINT_NAME= 'PK_DishSegment')
BEGIN
	ALTER TABLE [DishSegmentHeader] ALTER COLUMN  [seg_header_id] int NOT NULL 
	ALTER TABLE [DishSegmentHeader] ALTER COLUMN  [seg_header_companyID] int NOT NULL 
	ALTER TABLE [DishSegmentHeader] ADD  CONSTRAINT [PK_DishSegment] PRIMARY KEY CLUSTERED ([seg_header_id],[seg_header_companyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ExchangeRate' AND CONSTRAINT_NAME= 'PK_ExchangeRate')
BEGIN
	ALTER TABLE [ExchangeRate] ALTER COLUMN  [ExchangeID] int NOT NULL 
	ALTER TABLE [ExchangeRate] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [ExchangeRate] ADD  CONSTRAINT [PK_ExchangeRate] PRIMARY KEY NONCLUSTERED ([ExchangeID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ExchangeRateDetail' AND CONSTRAINT_NAME= 'PK_ExchangeRateDetail')
BEGIN
	ALTER TABLE [ExchangeRateDetail] ALTER COLUMN  [ExchangeID] int NOT NULL 
	ALTER TABLE [ExchangeRateDetail] ALTER COLUMN  [CurrencyID] int NOT NULL 
	ALTER TABLE [ExchangeRateDetail] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [ExchangeRateDetail] ADD  CONSTRAINT [PK_ExchangeRateDetail] PRIMARY KEY NONCLUSTERED ([ExchangeID],[CurrencyID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ExchangeRateHistoryHeader' AND CONSTRAINT_NAME= 'PK_ExchangeRateHistoryHeader')
BEGIN
	ALTER TABLE [ExchangeRateHistoryHeader] ALTER COLUMN  [ExchangeID] int NOT NULL 
	ALTER TABLE [ExchangeRateHistoryHeader] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [ExchangeRateHistoryHeader] ADD  CONSTRAINT [PK_ExchangeRateHistoryHeader] PRIMARY KEY CLUSTERED ([ExchangeID],[CompanyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='fb_Alternate' AND CONSTRAINT_NAME= 'PK_fb_Alternate')
BEGIN
	ALTER TABLE [fb_Alternate] ALTER COLUMN  [Fb_outletid] int NOT NULL 
	ALTER TABLE [fb_Alternate] ALTER COLUMN  [fb_kotID] int NOT NULL 
	ALTER TABLE [fb_Alternate] ALTER COLUMN  [fb_dishID] int NOT NULL 
	ALTER TABLE [fb_Alternate] ALTER COLUMN  [fb_ItemID] int NOT NULL 
	ALTER TABLE [fb_Alternate] ALTER COLUMN  [fb_row] char(10) NOT NULL 
	ALTER TABLE [fb_Alternate] ADD  CONSTRAINT [PK_fb_Alternate] PRIMARY KEY CLUSTERED ([Fb_outletid],[fb_kotID],[fb_dishID],[fb_ItemID],[fb_row])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_botdetails' AND CONSTRAINT_NAME= 'PK_Fb_botdetails')
BEGIN
	ALTER TABLE [Fb_botdetails] ALTER COLUMN  [Fb_bd_Companyid] int NOT NULL 
	ALTER TABLE [Fb_botdetails] ALTER COLUMN  [fb_bd_Outletid] int NOT NULL 
	ALTER TABLE [Fb_botdetails] ALTER COLUMN  [Fb_bd_botid] int NOT NULL 
	ALTER TABLE [Fb_botdetails] ALTER COLUMN  [Fb_bd_Botdetailid] int NOT NULL 
	ALTER TABLE [Fb_botdetails] ADD  CONSTRAINT [PK_Fb_botdetails] PRIMARY KEY NONCLUSTERED ([Fb_bd_Companyid],[fb_bd_Outletid],[Fb_bd_botid],[Fb_bd_Botdetailid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_botheader' AND CONSTRAINT_NAME= 'PK_Fb_botheader')
BEGIN
	ALTER TABLE [Fb_botheader] ALTER COLUMN  [Fb_bh_Companyid] int NOT NULL 
	ALTER TABLE [Fb_botheader] ALTER COLUMN  [Fb_bh_outletid] int NOT NULL 
	ALTER TABLE [Fb_botheader] ALTER COLUMN  [Fb_bh_botid] int NOT NULL 
	ALTER TABLE [Fb_botheader] ADD  CONSTRAINT [PK_Fb_botheader] PRIMARY KEY NONCLUSTERED ([Fb_bh_Companyid],[Fb_bh_outletid],[Fb_bh_botid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_DishAdds' AND CONSTRAINT_NAME= 'PK_Fb_dishaddsdetails')
BEGIN
	ALTER TABLE [Fb_DishAdds] ALTER COLUMN  [Fb_da_Companyid] int NOT NULL 
	ALTER TABLE [Fb_DishAdds] ALTER COLUMN  [Fb_da_dishid] int NOT NULL 
	ALTER TABLE [Fb_DishAdds] ALTER COLUMN  [Fb_da_dishaddsid] int NOT NULL 
	ALTER TABLE [Fb_DishAdds] ADD  CONSTRAINT [PK_Fb_dishaddsdetails] PRIMARY KEY NONCLUSTERED ([Fb_da_Companyid],[Fb_da_dishid],[Fb_da_dishaddsid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FB_Dishdetails' AND CONSTRAINT_NAME= 'PK_FB_Dishdetails')
BEGIN
	ALTER TABLE [FB_Dishdetails] ALTER COLUMN  [fb_dd_companyid] int NOT NULL 
	ALTER TABLE [FB_Dishdetails] ALTER COLUMN  [fb_dd_dishid] int NOT NULL 
	ALTER TABLE [FB_Dishdetails] ADD  CONSTRAINT [PK_FB_Dishdetails] PRIMARY KEY NONCLUSTERED ([fb_dd_companyid],[fb_dd_dishid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FB_Dishgroup' AND CONSTRAINT_NAME= 'PK_FB_Dishgroup')
BEGIN
	ALTER TABLE [FB_Dishgroup] ALTER COLUMN  [FB_dg_companyid] int NOT NULL 
	ALTER TABLE [FB_Dishgroup] ALTER COLUMN  [FB_dg_Dishgroupid] int NOT NULL 
	ALTER TABLE [FB_Dishgroup] ADD  CONSTRAINT [PK_FB_Dishgroup] PRIMARY KEY NONCLUSTERED ([FB_dg_companyid],[FB_dg_Dishgroupid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FB_Dishsubgroup' AND CONSTRAINT_NAME= 'PK_FB_Dishsubgroup')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ALTER COLUMN  [Fb_Ds_CompanyID] int NOT NULL 
	ALTER TABLE [FB_Dishsubgroup] ALTER COLUMN  [Fb_Ds_DishSubGroupID] int NOT NULL 
	ALTER TABLE [FB_Dishsubgroup] ALTER COLUMN  [Fb_Ds_DishGroupID] int NOT NULL 
	ALTER TABLE [FB_Dishsubgroup] ADD  CONSTRAINT [PK_FB_Dishsubgroup] PRIMARY KEY NONCLUSTERED ([Fb_Ds_CompanyID],[Fb_Ds_DishSubGroupID],[Fb_Ds_DishGroupID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FB_dishsubgroupshopdetails' AND CONSTRAINT_NAME= 'PK_FB_dishsubgroupshopdetails')
BEGIN
	ALTER TABLE [FB_dishsubgroupshopdetails] ALTER COLUMN  [fb_Ds_companyid] int NOT NULL 
	ALTER TABLE [FB_dishsubgroupshopdetails] ALTER COLUMN  [Fb_Ds_Outletid] int NOT NULL 
	ALTER TABLE [FB_dishsubgroupshopdetails] ALTER COLUMN  [Fb_Ds_Subgroupid] int NOT NULL 
	ALTER TABLE [FB_dishsubgroupshopdetails] ADD  CONSTRAINT [PK_FB_dishsubgroupshopdetails] PRIMARY KEY NONCLUSTERED ([fb_Ds_companyid],[Fb_Ds_Outletid],[Fb_Ds_Subgroupid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_kotdetails' AND CONSTRAINT_NAME= 'PK_Fb_kotdetails')
BEGIN
	ALTER TABLE [Fb_kotdetails] ALTER COLUMN  [fb_kd_Companyid] int NOT NULL 
	ALTER TABLE [Fb_kotdetails] ALTER COLUMN  [fb_kd_Outletid] int NOT NULL 
	ALTER TABLE [Fb_kotdetails] ALTER COLUMN  [fb_kd_kotid] int NOT NULL 
	ALTER TABLE [Fb_kotdetails] ALTER COLUMN  [fb_kd_kotdetailid] int NOT NULL 
	ALTER TABLE [Fb_kotdetails] ADD  CONSTRAINT [PK_Fb_kotdetails] PRIMARY KEY NONCLUSTERED ([fb_kd_Companyid],[fb_kd_Outletid],[fb_kd_kotid],[fb_kd_kotdetailid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_kotheader' AND CONSTRAINT_NAME= 'PK_Fb_kotheader')
BEGIN
	ALTER TABLE [Fb_kotheader] ALTER COLUMN  [Fb_kh_Companyid] int NOT NULL 
	ALTER TABLE [Fb_kotheader] ALTER COLUMN  [Fb_kh_outletid] int NOT NULL 
	ALTER TABLE [Fb_kotheader] ALTER COLUMN  [Fb_kh_kotid] int NOT NULL 
	ALTER TABLE [Fb_kotheader] ADD  CONSTRAINT [PK_Fb_kotheader] PRIMARY KEY NONCLUSTERED ([Fb_kh_Companyid],[Fb_kh_outletid],[Fb_kh_kotid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='fb_kotHistory' AND CONSTRAINT_NAME= 'PK_Fb_fb_kotHistory')
BEGIN
	ALTER TABLE [fb_kotHistory] ALTER COLUMN  [fb_kd_Companyid] int NOT NULL 
	ALTER TABLE [fb_kotHistory] ALTER COLUMN  [fb_kd_Outletid] int NOT NULL 
	ALTER TABLE [fb_kotHistory] ALTER COLUMN  [fb_kd_kotid] int NOT NULL 
	ALTER TABLE [fb_kotHistory] ALTER COLUMN  [fb_kd_kotdetailid] int NOT NULL 
	ALTER TABLE [fb_kotHistory] ADD  CONSTRAINT [PK_Fb_fb_kotHistory] PRIMARY KEY NONCLUSTERED ([fb_kd_Companyid],[fb_kd_Outletid],[fb_kd_kotid],[fb_kd_kotdetailid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_processdetail' AND CONSTRAINT_NAME= 'PK_Fb_processdetail')
BEGIN
	ALTER TABLE [Fb_processdetail] ALTER COLUMN  [fb_pd_companyid] int NOT NULL 
	ALTER TABLE [Fb_processdetail] ALTER COLUMN  [fb_pd_outletid] int NOT NULL 
	ALTER TABLE [Fb_processdetail] ALTER COLUMN  [fb_pd_processid] int NOT NULL 
	ALTER TABLE [Fb_processdetail] ALTER COLUMN  [fb_pd_processdetailid] int NOT NULL 
	ALTER TABLE [Fb_processdetail] ADD  CONSTRAINT [PK_Fb_processdetail] PRIMARY KEY NONCLUSTERED ([fb_pd_companyid],[fb_pd_outletid],[fb_pd_processid],[fb_pd_processdetailid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_processrecipedetail' AND CONSTRAINT_NAME= 'PK_Fb_processrecipedetail')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] ALTER COLUMN  [fb_pr_companyid] int NOT NULL 
	ALTER TABLE [Fb_processrecipedetail] ALTER COLUMN  [fb_pr_outletid] int NOT NULL 
	ALTER TABLE [Fb_processrecipedetail] ALTER COLUMN  [fb_pr_Processid] int NOT NULL 
	ALTER TABLE [Fb_processrecipedetail] ALTER COLUMN  [fb_pr_processdetailid] int NOT NULL 
	ALTER TABLE [Fb_processrecipedetail] ALTER COLUMN  [fb_pr_processrecdetailid] int NOT NULL 
	ALTER TABLE [Fb_processrecipedetail] ADD  CONSTRAINT [PK_Fb_processrecipedetail] PRIMARY KEY NONCLUSTERED ([fb_pr_companyid],[fb_pr_outletid],[fb_pr_Processid],[fb_pr_processdetailid],[fb_pr_processrecdetailid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_recipedetails' AND CONSTRAINT_NAME= 'PK_Fb_recipedetails')
BEGIN
	ALTER TABLE [Fb_recipedetails] ALTER COLUMN  [Fb_rd_Companyid] int NOT NULL 
	ALTER TABLE [Fb_recipedetails] ALTER COLUMN  [Fb_rd_dishid] int NOT NULL 
	ALTER TABLE [Fb_recipedetails] ALTER COLUMN  [Fb_rd_recipedetailid] int NOT NULL 
	ALTER TABLE [Fb_recipedetails] ADD  CONSTRAINT [PK_Fb_recipedetails] PRIMARY KEY NONCLUSTERED ([Fb_rd_Companyid],[Fb_rd_dishid],[Fb_rd_recipedetailid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_resttable' AND CONSTRAINT_NAME= 'PK_Fb_resttable')
BEGIN
	ALTER TABLE [Fb_resttable] ALTER COLUMN  [Fb_rt_companyid] int NOT NULL 
	ALTER TABLE [Fb_resttable] ALTER COLUMN  [Fb_rt_outletid] int NOT NULL 
	ALTER TABLE [Fb_resttable] ALTER COLUMN  [Fb_rt_tableid] int NOT NULL 
	ALTER TABLE [Fb_resttable] ADD  CONSTRAINT [PK_Fb_resttable] PRIMARY KEY NONCLUSTERED ([Fb_rt_companyid],[Fb_rt_outletid],[Fb_rt_tableid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='fb_resttablemaster' AND CONSTRAINT_NAME= 'PK_fb_resttablemaster')
BEGIN
	ALTER TABLE [fb_resttablemaster] ALTER COLUMN  [fb_rm_companyid] int NOT NULL 
	ALTER TABLE [fb_resttablemaster] ALTER COLUMN  [fb_rm_outletid] int NOT NULL 
	ALTER TABLE [fb_resttablemaster] ALTER COLUMN  [fb_rm_tablemasterid] int NOT NULL 
	ALTER TABLE [fb_resttablemaster] ADD  CONSTRAINT [PK_fb_resttablemaster] PRIMARY KEY NONCLUSTERED ([fb_rm_companyid],[fb_rm_outletid],[fb_rm_tablemasterid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_Shopdishdetails' AND CONSTRAINT_NAME= 'PK_Fb_Shopdishdetails')
BEGIN
	ALTER TABLE [Fb_Shopdishdetails] ALTER COLUMN  [Fb_Sd_Companyid] int NOT NULL 
	ALTER TABLE [Fb_Shopdishdetails] ALTER COLUMN  [Fb_Sd_Outletid] int NOT NULL 
	ALTER TABLE [Fb_Shopdishdetails] ALTER COLUMN  [Fb_Sd_Dishid] int NOT NULL 
	ALTER TABLE [Fb_Shopdishdetails] ADD  CONSTRAINT [PK_Fb_Shopdishdetails] PRIMARY KEY NONCLUSTERED ([Fb_Sd_Companyid],[Fb_Sd_Outletid],[Fb_Sd_Dishid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'PK_FixedAsset')
BEGIN
	ALTER TABLE [FixedAsset] ALTER COLUMN  [FixedAssetID] int NOT NULL 
	ALTER TABLE [FixedAsset] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [FixedAsset] ADD  CONSTRAINT [PK_FixedAsset] PRIMARY KEY NONCLUSTERED ([FixedAssetID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FlightOperatorMaster' AND CONSTRAINT_NAME= 'pk_FlghtOpIDMaster')
BEGIN
	ALTER TABLE [FlightOperatorMaster] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [FlightOperatorMaster] ALTER COLUMN  [FlghtOpid] int NOT NULL 
	ALTER TABLE [FlightOperatorMaster] ADD  CONSTRAINT [pk_FlghtOpIDMaster] PRIMARY KEY CLUSTERED ([companyid],[FlghtOpid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Flights' AND CONSTRAINT_NAME= 'PK_Flights_1')
BEGIN
	ALTER TABLE [Flights] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [Flights] ALTER COLUMN  [FlightID] int NOT NULL 
	ALTER TABLE [Flights] ADD  CONSTRAINT [PK_Flights_1] PRIMARY KEY CLUSTERED ([companyid],[FlightID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Forex' AND CONSTRAINT_NAME= 'PK_Forex')
BEGIN
	ALTER TABLE [Forex] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [Forex] ALTER COLUMN  [forexid] int NOT NULL 
	ALTER TABLE [Forex] ADD  CONSTRAINT [PK_Forex] PRIMARY KEY NONCLUSTERED ([companyid],[forexid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='HPpostDatedCheqReg' AND CONSTRAINT_NAME= 'PK_HPpostDatedCheqReg')
BEGIN
	ALTER TABLE [HPpostDatedCheqReg] ALTER COLUMN  [RegID] int NOT NULL 
	ALTER TABLE [HPpostDatedCheqReg] ADD  CONSTRAINT [PK_HPpostDatedCheqReg] PRIMARY KEY CLUSTERED ([RegID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND CONSTRAINT_NAME= 'pk_hqsalescommisionheader')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ALTER COLUMN  [schCommisionid] int NOT NULL 
	ALTER TABLE [hqSalesCommisionHeader] ALTER COLUMN  [schcompanyid] int NOT NULL 
	ALTER TABLE [hqSalesCommisionHeader] ADD  CONSTRAINT [pk_hqsalescommisionheader] PRIMARY KEY CLUSTERED ([schCommisionid],[schcompanyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND CONSTRAINT_NAME= 'pk_HQSalesPromotionDetail')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ALTER COLUMN  [spdCompanyID] int NOT NULL 
	ALTER TABLE [HQSalesPromotionDetail] ALTER COLUMN  [spdpromotionID] int NOT NULL 
	ALTER TABLE [HQSalesPromotionDetail] ALTER COLUMN  [spdDetailID] int NOT NULL 
	ALTER TABLE [HQSalesPromotionDetail] ADD  CONSTRAINT [pk_HQSalesPromotionDetail] PRIMARY KEY CLUSTERED ([spdCompanyID],[spdpromotionID],[spdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='HQSalesPromotionHeader' AND CONSTRAINT_NAME= 'pk_HQSalesPromotionHeader')
BEGIN
	ALTER TABLE [HQSalesPromotionHeader] ALTER COLUMN  [sphCompanyID] int NOT NULL 
	ALTER TABLE [HQSalesPromotionHeader] ALTER COLUMN  [sphPromotionID] int NOT NULL 
	ALTER TABLE [HQSalesPromotionHeader] ADD  CONSTRAINT [pk_HQSalesPromotionHeader] PRIMARY KEY CLUSTERED ([sphCompanyID],[sphPromotionID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InhouseConsumptionReqDetail' AND CONSTRAINT_NAME= 'PK_BMS_FM_StockStoreRequestDetail')
BEGIN
	ALTER TABLE [InhouseConsumptionReqDetail] ALTER COLUMN  [StoreRequestId] int NOT NULL 
	ALTER TABLE [InhouseConsumptionReqDetail] ALTER COLUMN  [Slno] int NOT NULL 
	ALTER TABLE [InhouseConsumptionReqDetail] ADD  CONSTRAINT [PK_BMS_FM_StockStoreRequestDetail] PRIMARY KEY CLUSTERED ([StoreRequestId],[Slno])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InhouseConsumptionReqHeader' AND CONSTRAINT_NAME= 'PK_InHouseConsumtionRequest')
BEGIN
	ALTER TABLE [InhouseConsumptionReqHeader] ALTER COLUMN  [StoreRequestId] int NOT NULL 
	ALTER TABLE [InhouseConsumptionReqHeader] ADD  CONSTRAINT [PK_InHouseConsumtionRequest] PRIMARY KEY CLUSTERED ([StoreRequestId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND CONSTRAINT_NAME= 'PK_InterDivisionBillsDetails')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] ALTER COLUMN  [BillsID] int NOT NULL 
	ALTER TABLE [InterDivisionBillsDetails] ALTER COLUMN  [BillsDetailID] int NOT NULL 
	ALTER TABLE [InterDivisionBillsDetails] ADD  CONSTRAINT [PK_InterDivisionBillsDetails] PRIMARY KEY NONCLUSTERED ([BillsID],[BillsDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND CONSTRAINT_NAME= 'PK_InterDivisionBillsHeader')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ALTER COLUMN  [BillsID] int NOT NULL 
	ALTER TABLE [InterDivisionBillsHeader] ADD  CONSTRAINT [PK_InterDivisionBillsHeader] PRIMARY KEY CLUSTERED ([BillsID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ItemPriceHistory' AND CONSTRAINT_NAME= 'PK_ItemPriceHistory')
BEGIN
	ALTER TABLE [ItemPriceHistory] ALTER COLUMN  [ItemPriceId] int NOT NULL 
	ALTER TABLE [ItemPriceHistory] ADD  CONSTRAINT [PK_ItemPriceHistory] PRIMARY KEY CLUSTERED ([ItemPriceId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='JournalDetailBackup' AND CONSTRAINT_NAME= 'PK_JournalDetailBackup')
BEGIN
	ALTER TABLE [JournalDetailBackup] ALTER COLUMN  [JournalID] int NOT NULL 
	ALTER TABLE [JournalDetailBackup] ALTER COLUMN  [JournalDetailID] int NOT NULL 
	ALTER TABLE [JournalDetailBackup] ADD  CONSTRAINT [PK_JournalDetailBackup] PRIMARY KEY NONCLUSTERED ([JournalID],[JournalDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='JournalHeaderBackup' AND CONSTRAINT_NAME= 'PK_JournalHeaderBackup')
BEGIN
	ALTER TABLE [JournalHeaderBackup] ALTER COLUMN  [JournalID] int NOT NULL 
	ALTER TABLE [JournalHeaderBackup] ADD  CONSTRAINT [PK_JournalHeaderBackup] PRIMARY KEY NONCLUSTERED ([JournalID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='JournalTransDetails' AND CONSTRAINT_NAME= 'PK_JournalTransDetails')
BEGIN
	ALTER TABLE [JournalTransDetails] ALTER COLUMN  [JournalTransID] int NOT NULL 
	ALTER TABLE [JournalTransDetails] ALTER COLUMN  [JournalTransDetailID] int NOT NULL 
	ALTER TABLE [JournalTransDetails] ADD  CONSTRAINT [PK_JournalTransDetails] PRIMARY KEY NONCLUSTERED ([JournalTransID],[JournalTransDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='JournalTransHeader' AND CONSTRAINT_NAME= 'PK_JournalTransHeader')
BEGIN
	ALTER TABLE [JournalTransHeader] ALTER COLUMN  [JournalTransID] int NOT NULL 
	ALTER TABLE [JournalTransHeader] ADD  CONSTRAINT [PK_JournalTransHeader] PRIMARY KEY NONCLUSTERED ([JournalTransID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LeadTimeDivision' AND CONSTRAINT_NAME= 'PK_LeadTimeDivision')
BEGIN
	ALTER TABLE [LeadTimeDivision] ALTER COLUMN  [Ldivisionid] int NOT NULL 
	ALTER TABLE [LeadTimeDivision] ADD  CONSTRAINT [PK_LeadTimeDivision] PRIMARY KEY NONCLUSTERED ([Ldivisionid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LeadTimeStage' AND CONSTRAINT_NAME= 'PK_LeadTimeStage')
BEGIN
	ALTER TABLE [LeadTimeStage] ALTER COLUMN  [Lstageid] int NOT NULL 
	ALTER TABLE [LeadTimeStage] ADD  CONSTRAINT [PK_LeadTimeStage] PRIMARY KEY NONCLUSTERED ([Lstageid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='lmsPoint' AND CONSTRAINT_NAME= 'PK_lmsPoint')
BEGIN
	ALTER TABLE [lmsPoint] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [lmsPoint] ALTER COLUMN  [PointsID] int NOT NULL 
	ALTER TABLE [lmsPoint] ADD  CONSTRAINT [PK_lmsPoint] PRIMARY KEY CLUSTERED ([CompanyID],[PointsID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND CONSTRAINT_NAME= 'PK_LOaCostingAccountDetails')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] ALTER COLUMN  [cadCostingID] int NOT NULL 
	ALTER TABLE [LOaCostingAccountDetails] ALTER COLUMN  [cadAccountID] int NOT NULL 
	ALTER TABLE [LOaCostingAccountDetails] ALTER COLUMN  [cadDetailID] int NOT NULL 
	ALTER TABLE [LOaCostingAccountDetails] ADD  CONSTRAINT [PK_LOaCostingAccountDetails] PRIMARY KEY NONCLUSTERED ([cadCostingID],[cadAccountID],[cadDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingDetail' AND CONSTRAINT_NAME= 'PK_LOaCostingDetail')
BEGIN
	ALTER TABLE [LOaCostingDetail] ALTER COLUMN  [cdCostingID] int NOT NULL 
	ALTER TABLE [LOaCostingDetail] ALTER COLUMN  [cdItemID] int NOT NULL 
	ALTER TABLE [LOaCostingDetail] ADD  CONSTRAINT [PK_LOaCostingDetail] PRIMARY KEY NONCLUSTERED ([cdCostingID],[cdItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingHeader' AND CONSTRAINT_NAME= 'PK_LOaCostingHeader')
BEGIN
	ALTER TABLE [LOaCostingHeader] ALTER COLUMN  [chCostingID] int NOT NULL 
	ALTER TABLE [LOaCostingHeader] ADD  CONSTRAINT [PK_LOaCostingHeader] PRIMARY KEY NONCLUSTERED ([chCostingID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND CONSTRAINT_NAME= 'PK_loaInhousePurchaseHeader')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] ALTER COLUMN  [iphId] int NOT NULL 
	ALTER TABLE [loaInhousePurchaseHeader] ADD  CONSTRAINT [PK_loaInhousePurchaseHeader] PRIMARY KEY CLUSTERED ([iphId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND CONSTRAINT_NAME= 'PK_loaItemSplitCostingDetail')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] ALTER COLUMN  [scfdid] int NOT NULL 
	ALTER TABLE [loaItemSplitCostingDetail] ALTER COLUMN  [scfddetailid] int NOT NULL 
	ALTER TABLE [loaItemSplitCostingDetail] ADD  CONSTRAINT [PK_loaItemSplitCostingDetail] PRIMARY KEY NONCLUSTERED ([scfdid],[scfddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND CONSTRAINT_NAME= 'PK_loaItemsplitcostingHeader')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ALTER COLUMN  [scfhid] int NOT NULL 
	ALTER TABLE [loaItemsplitcostingHeader] ADD  CONSTRAINT [PK_loaItemsplitcostingHeader] PRIMARY KEY NONCLUSTERED ([scfhid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND CONSTRAINT_NAME= 'PK_loalocalpurchasecostingdetail')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] ALTER COLUMN  [lpcdcostingid] int NOT NULL 
	ALTER TABLE [loalocalpurchasecostingdetail] ALTER COLUMN  [lpcddetailid] int NOT NULL 
	ALTER TABLE [loalocalpurchasecostingdetail] ADD  CONSTRAINT [PK_loalocalpurchasecostingdetail] PRIMARY KEY NONCLUSTERED ([lpcdcostingid],[lpcddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND CONSTRAINT_NAME= 'PK_loalocalpurchaseCostingheader')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ALTER COLUMN  [lpchCostingid] int NOT NULL 
	ALTER TABLE [loalocalpurchaseCostingheader] ADD  CONSTRAINT [PK_loalocalpurchaseCostingheader] PRIMARY KEY NONCLUSTERED ([lpchCostingid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalDetail' AND CONSTRAINT_NAME= 'PK_LOiArrivalDetail')
BEGIN
	ALTER TABLE [LOiArrivalDetail] ALTER COLUMN  [adArrivalID] int NOT NULL 
	ALTER TABLE [LOiArrivalDetail] ALTER COLUMN  [adItemID] int NOT NULL 
	ALTER TABLE [LOiArrivalDetail] ALTER COLUMN  [adGodownID] int NOT NULL 
	ALTER TABLE [LOiArrivalDetail] ADD  CONSTRAINT [PK_LOiArrivalDetail] PRIMARY KEY NONCLUSTERED ([adArrivalID],[adItemID],[adGodownID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalHeader' AND CONSTRAINT_NAME= 'PK_LOiArrivalHeader')
BEGIN
	ALTER TABLE [LOiArrivalHeader] ALTER COLUMN  [ahArrivalID] int NOT NULL 
	ALTER TABLE [LOiArrivalHeader] ALTER COLUMN  [ahLocalGodownID] int NOT NULL 
	ALTER TABLE [LOiArrivalHeader] ADD  CONSTRAINT [PK_LOiArrivalHeader] PRIMARY KEY NONCLUSTERED ([ahArrivalID],[ahLocalGodownID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND CONSTRAINT_NAME= 'PK_LOiArrivalShipmentDetail')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ALTER COLUMN  [asdArrivalID] int NOT NULL 
	ALTER TABLE [LOiArrivalShipmentDetail] ALTER COLUMN  [asdItemID] int NOT NULL 
	ALTER TABLE [LOiArrivalShipmentDetail] ALTER COLUMN  [asdShipmentID] int NOT NULL 
	ALTER TABLE [LOiArrivalShipmentDetail] ALTER COLUMN  [asdGodownID] int NOT NULL 
	ALTER TABLE [LOiArrivalShipmentDetail] ADD  CONSTRAINT [PK_LOiArrivalShipmentDetail] PRIMARY KEY NONCLUSTERED ([asdArrivalID],[asdItemID],[asdShipmentID],[asdGodownID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND CONSTRAINT_NAME= 'PK_LOiArrivaltoLocation')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] ALTER COLUMN  [alArrivalID] int NOT NULL 
	ALTER TABLE [LOiArrivaltoLocation] ALTER COLUMN  [alLocationID] int NOT NULL 
	ALTER TABLE [LOiArrivaltoLocation] ALTER COLUMN  [alItemID] int NOT NULL 
	ALTER TABLE [LOiArrivaltoLocation] ALTER COLUMN  [alGodownID] int NOT NULL 
	ALTER TABLE [LOiArrivaltoLocation] ADD  CONSTRAINT [PK_LOiArrivaltoLocation] PRIMARY KEY NONCLUSTERED ([alArrivalID],[alLocationID],[alItemID],[alGodownID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND CONSTRAINT_NAME= 'PK_LOiDamageClearingDetail')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ALTER COLUMN  [dcdClearingID] int NOT NULL 
	ALTER TABLE [LOiDamageClearingDetails] ALTER COLUMN  [dcdShipmentID] int NOT NULL 
	ALTER TABLE [LOiDamageClearingDetails] ALTER COLUMN  [dcdItemID] int NOT NULL 
	ALTER TABLE [LOiDamageClearingDetails] ALTER COLUMN  [dcdGodownid] int NOT NULL 
	ALTER TABLE [LOiDamageClearingDetails] ADD  CONSTRAINT [PK_LOiDamageClearingDetail] PRIMARY KEY CLUSTERED ([dcdClearingID],[dcdShipmentID],[dcdItemID],[dcdGodownid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND CONSTRAINT_NAME= 'PK_LOiDamageClearingHeader')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ALTER COLUMN  [dchClearingID] int NOT NULL 
	ALTER TABLE [LOiDamageClearingHeader] ALTER COLUMN  [dchGodownid] int NOT NULL 
	ALTER TABLE [LOiDamageClearingHeader] ADD  CONSTRAINT [PK_LOiDamageClearingHeader] PRIMARY KEY NONCLUSTERED ([dchClearingID],[dchGodownid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND CONSTRAINT_NAME= 'PK_loiexpiryarrivaldetails')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ALTER COLUMN  [eadinterfaceid] int NOT NULL 
	ALTER TABLE [loiexpiryarrivaldetails] ALTER COLUMN  [eadgodownid] int NOT NULL 
	ALTER TABLE [loiexpiryarrivaldetails] ALTER COLUMN  [eadtransactionid] int NOT NULL 
	ALTER TABLE [loiexpiryarrivaldetails] ALTER COLUMN  [eaddetailid] int NOT NULL 
	ALTER TABLE [loiexpiryarrivaldetails] ADD  CONSTRAINT [PK_loiexpiryarrivaldetails] PRIMARY KEY NONCLUSTERED ([eadinterfaceid],[eadgodownid],[eadtransactionid],[eaddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiexpiryissuedetails' AND CONSTRAINT_NAME= 'PK_loiexpiryissuedetails')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ALTER COLUMN  [eidinterfaceid] int NOT NULL 
	ALTER TABLE [loiexpiryissuedetails] ALTER COLUMN  [eidgodownid] int NOT NULL 
	ALTER TABLE [loiexpiryissuedetails] ALTER COLUMN  [eidtransactionid] int NOT NULL 
	ALTER TABLE [loiexpiryissuedetails] ALTER COLUMN  [eiddetailid] int NOT NULL 
	ALTER TABLE [loiexpiryissuedetails] ADD  CONSTRAINT [PK_loiexpiryissuedetails] PRIMARY KEY NONCLUSTERED ([eidinterfaceid],[eidgodownid],[eidtransactionid],[eiddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND CONSTRAINT_NAME= 'PK_LOiGodownShopArrivalToLocation')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ALTER COLUMN  [gsalArrivalID] int NOT NULL 
	ALTER TABLE [LOiGodownShopArrivalToLocation] ALTER COLUMN  [gsalShipmentID] int NOT NULL 
	ALTER TABLE [LOiGodownShopArrivalToLocation] ALTER COLUMN  [gsalItemID] int NOT NULL 
	ALTER TABLE [LOiGodownShopArrivalToLocation] ALTER COLUMN  [gsalLocationID] int NOT NULL 
	ALTER TABLE [LOiGodownShopArrivalToLocation] ALTER COLUMN  [gsalGodownID] int NOT NULL 
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD  CONSTRAINT [PK_LOiGodownShopArrivalToLocation] PRIMARY KEY NONCLUSTERED ([gsalArrivalID],[gsalShipmentID],[gsalItemID],[gsalLocationID],[gsalGodownID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiGodownTransactionsSummary' AND CONSTRAINT_NAME= 'PK_loiGodownTransactionsSummary')
BEGIN
	ALTER TABLE [loiGodownTransactionsSummary] ALTER COLUMN  [GodownId] int NOT NULL 
	ALTER TABLE [loiGodownTransactionsSummary] ALTER COLUMN  [ItemId] int NOT NULL 
	ALTER TABLE [loiGodownTransactionsSummary] ADD  CONSTRAINT [PK_loiGodownTransactionsSummary] PRIMARY KEY CLUSTERED ([GodownId],[ItemId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoiItemSplitDetail' AND CONSTRAINT_NAME= 'PK_LoiItemSplitDetail')
BEGIN
	ALTER TABLE [LoiItemSplitDetail] ALTER COLUMN  [isdgodownid] int NOT NULL 
	ALTER TABLE [LoiItemSplitDetail] ALTER COLUMN  [isdid] int NOT NULL 
	ALTER TABLE [LoiItemSplitDetail] ALTER COLUMN  [isditemid] int NOT NULL 
	ALTER TABLE [LoiItemSplitDetail] ADD  CONSTRAINT [PK_LoiItemSplitDetail] PRIMARY KEY NONCLUSTERED ([isdgodownid],[isdid],[isditemid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoiItemSplitHeader' AND CONSTRAINT_NAME= 'PK_LoiItemSplitHeader')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ALTER COLUMN  [ishgodownid] int NOT NULL 
	ALTER TABLE [LoiItemSplitHeader] ALTER COLUMN  [ishid] int NOT NULL 
	ALTER TABLE [LoiItemSplitHeader] ADD  CONSTRAINT [PK_LoiItemSplitHeader] PRIMARY KEY NONCLUSTERED ([ishgodownid],[ishid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiLocation' AND CONSTRAINT_NAME= 'PK_iLoacation')
BEGIN
	ALTER TABLE [LOiLocation] ALTER COLUMN  [lGodownID] int NOT NULL 
	ALTER TABLE [LOiLocation] ALTER COLUMN  [lLocationID] int NOT NULL 
	ALTER TABLE [LOiLocation] ADD  CONSTRAINT [PK_iLoacation] PRIMARY KEY NONCLUSTERED ([lGodownID],[lLocationID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loilocationarrivaldetails' AND CONSTRAINT_NAME= 'PK_loilocationarrivaldetails')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ALTER COLUMN  [ladinterfaceid] int NOT NULL 
	ALTER TABLE [loilocationarrivaldetails] ALTER COLUMN  [ladgodownid] int NOT NULL 
	ALTER TABLE [loilocationarrivaldetails] ALTER COLUMN  [ladtransid] int NOT NULL 
	ALTER TABLE [loilocationarrivaldetails] ALTER COLUMN  [laddetailid] int NOT NULL 
	ALTER TABLE [loilocationarrivaldetails] ADD  CONSTRAINT [PK_loilocationarrivaldetails] PRIMARY KEY NONCLUSTERED ([ladinterfaceid],[ladgodownid],[ladtransid],[laddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoilocationGroup' AND CONSTRAINT_NAME= 'pk_loilocationgroup')
BEGIN
	ALTER TABLE [LoilocationGroup] ALTER COLUMN  [Lgcompanyid] int NOT NULL 
	ALTER TABLE [LoilocationGroup] ALTER COLUMN  [Lggroupid] int NOT NULL 
	ALTER TABLE [LoilocationGroup] ALTER COLUMN  [Lggodownid] int NOT NULL 
	ALTER TABLE [LoilocationGroup] ADD  CONSTRAINT [pk_loilocationgroup] PRIMARY KEY CLUSTERED ([Lgcompanyid],[Lggroupid],[Lggodownid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loilocationissuedetails' AND CONSTRAINT_NAME= 'PK_loilocationissuedetails')
BEGIN
	ALTER TABLE [loilocationissuedetails] ALTER COLUMN  [lidinterfaceid] int NOT NULL 
	ALTER TABLE [loilocationissuedetails] ALTER COLUMN  [lidgodownid] int NOT NULL 
	ALTER TABLE [loilocationissuedetails] ALTER COLUMN  [lidtransactionid] int NOT NULL 
	ALTER TABLE [loilocationissuedetails] ALTER COLUMN  [liddetailid] int NOT NULL 
	ALTER TABLE [loilocationissuedetails] ADD  CONSTRAINT [PK_loilocationissuedetails] PRIMARY KEY NONCLUSTERED ([lidinterfaceid],[lidgodownid],[lidtransactionid],[liddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiSerialNoVerificationHeader' AND CONSTRAINT_NAME= 'PK_loiSerialNoVerificationHeader')
BEGIN
	ALTER TABLE [loiSerialNoVerificationHeader] ALTER COLUMN  [svhCompanyID] int NOT NULL 
	ALTER TABLE [loiSerialNoVerificationHeader] ALTER COLUMN  [svhGodownID] int NOT NULL 
	ALTER TABLE [loiSerialNoVerificationHeader] ALTER COLUMN  [svhID] int NOT NULL 
	ALTER TABLE [loiSerialNoVerificationHeader] ADD  CONSTRAINT [PK_loiSerialNoVerificationHeader] PRIMARY KEY CLUSTERED ([svhCompanyID],[svhGodownID],[svhID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiSettings' AND CONSTRAINT_NAME= 'PK_LOiSettings')
BEGIN
	ALTER TABLE [LOiSettings] ALTER COLUMN  [Godownid] int NOT NULL 
	ALTER TABLE [LOiSettings] ADD  CONSTRAINT [PK_LOiSettings] PRIMARY KEY NONCLUSTERED ([Godownid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockRecovery' AND CONSTRAINT_NAME= 'PK_loiStockRecovery')
BEGIN
	ALTER TABLE [loiStockRecovery] ALTER COLUMN  [srID] int NOT NULL 
	ALTER TABLE [loiStockRecovery] ALTER COLUMN  [srGodownID] int NOT NULL 
	ALTER TABLE [loiStockRecovery] ADD  CONSTRAINT [PK_loiStockRecovery] PRIMARY KEY NONCLUSTERED ([srID],[srGodownID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockVerificationDetail' AND CONSTRAINT_NAME= 'PK_loiStockVerificationDetail')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ALTER COLUMN  [svdid] int NOT NULL 
	ALTER TABLE [loiStockVerificationDetail] ALTER COLUMN  [svdGodownID] int NOT NULL 
	ALTER TABLE [loiStockVerificationDetail] ALTER COLUMN  [svdShipmentID] int NOT NULL 
	ALTER TABLE [loiStockVerificationDetail] ALTER COLUMN  [svdItemID] int NOT NULL 
	ALTER TABLE [loiStockVerificationDetail] ADD  CONSTRAINT [PK_loiStockVerificationDetail] PRIMARY KEY CLUSTERED ([svdid],[svdGodownID],[svdShipmentID],[svdItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockVerificationHeader' AND CONSTRAINT_NAME= 'PK_loiStockVerificationHeader')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ALTER COLUMN  [svhid] int NOT NULL 
	ALTER TABLE [loiStockVerificationHeader] ALTER COLUMN  [svhGodownid] int NOT NULL 
	ALTER TABLE [loiStockVerificationHeader] ADD  CONSTRAINT [PK_loiStockVerificationHeader] PRIMARY KEY NONCLUSTERED ([svhid],[svhGodownid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiUserAuditDetail' AND CONSTRAINT_NAME= 'PK_loiUserAuditDetail')
BEGIN
	ALTER TABLE [loiUserAuditDetail] ALTER COLUMN  [gdCompanyId] int NOT NULL 
	ALTER TABLE [loiUserAuditDetail] ALTER COLUMN  [gdAuditId] int NOT NULL 
	ALTER TABLE [loiUserAuditDetail] ALTER COLUMN  [gdGodownId] int NOT NULL 
	ALTER TABLE [loiUserAuditDetail] ALTER COLUMN  [gdDetailId] int NOT NULL 
	ALTER TABLE [loiUserAuditDetail] ADD  CONSTRAINT [PK_loiUserAuditDetail] PRIMARY KEY NONCLUSTERED ([gdCompanyId],[gdAuditId],[gdGodownId],[gdDetailId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiUserAuditHeader' AND CONSTRAINT_NAME= 'PK_loiUserAuditHeader')
BEGIN
	ALTER TABLE [loiUserAuditHeader] ALTER COLUMN  [ghCompanyId] int NOT NULL 
	ALTER TABLE [loiUserAuditHeader] ALTER COLUMN  [ghAuditId] int NOT NULL 
	ALTER TABLE [loiUserAuditHeader] ALTER COLUMN  [ghGodownId] int NOT NULL 
	ALTER TABLE [loiUserAuditHeader] ADD  CONSTRAINT [PK_loiUserAuditHeader] PRIMARY KEY NONCLUSTERED ([ghCompanyId],[ghAuditId],[ghGodownId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiWriteOffDetail' AND CONSTRAINT_NAME= 'PK_LOiWriteOffDetail')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ALTER COLUMN  [wdID] int NOT NULL 
	ALTER TABLE [LOiWriteOffDetail] ALTER COLUMN  [wdGodownID] int NOT NULL 
	ALTER TABLE [LOiWriteOffDetail] ALTER COLUMN  [wdShipmentID] int NOT NULL 
	ALTER TABLE [LOiWriteOffDetail] ALTER COLUMN  [wdItemID] int NOT NULL 
	ALTER TABLE [LOiWriteOffDetail] ADD  CONSTRAINT [PK_LOiWriteOffDetail] PRIMARY KEY CLUSTERED ([wdID],[wdGodownID],[wdShipmentID],[wdItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiWriteOffHeader' AND CONSTRAINT_NAME= 'PK_LOiWriteOffHeader')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ALTER COLUMN  [whGodownID] int NOT NULL 
	ALTER TABLE [LOiWriteOffHeader] ALTER COLUMN  [whID] int NOT NULL 
	ALTER TABLE [LOiWriteOffHeader] ADD  CONSTRAINT [PK_LOiWriteOffHeader] PRIMARY KEY NONCLUSTERED ([whGodownID],[whID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND CONSTRAINT_NAME= 'PK_loPrePurchaseOrderDetail')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ALTER COLUMN  [podPoid] int NOT NULL 
	ALTER TABLE [loPrePurchaseOrderDetail] ALTER COLUMN  [poditemid] int NOT NULL 
	ALTER TABLE [loPrePurchaseOrderDetail] ALTER COLUMN  [podDetailID] int NOT NULL 
	ALTER TABLE [loPrePurchaseOrderDetail] ADD  CONSTRAINT [PK_loPrePurchaseOrderDetail] PRIMARY KEY NONCLUSTERED ([podPoid],[poditemid],[podDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND CONSTRAINT_NAME= 'PK_loPrePurchaseOrderHeader')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ALTER COLUMN  [pohPoid] int NOT NULL 
	ALTER TABLE [loPrePurchaseOrderHeader] ADD  CONSTRAINT [PK_loPrePurchaseOrderHeader] PRIMARY KEY NONCLUSTERED ([pohPoid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='lopurchasecostingaccountdetails' AND CONSTRAINT_NAME= 'PK_LOPOAccountDetails')
BEGIN
	ALTER TABLE [lopurchasecostingaccountdetails] ALTER COLUMN  [poadPOID] int NOT NULL 
	ALTER TABLE [lopurchasecostingaccountdetails] ALTER COLUMN  [poadAccountID] int NOT NULL 
	ALTER TABLE [lopurchasecostingaccountdetails] ALTER COLUMN  [poadDetailID] int NOT NULL 
	ALTER TABLE [lopurchasecostingaccountdetails] ADD  CONSTRAINT [PK_LOPOAccountDetails] PRIMARY KEY NONCLUSTERED ([poadPOID],[poadAccountID],[poadDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND CONSTRAINT_NAME= 'PK_loPurchaseOrderDetail')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ALTER COLUMN  [podPoid] int NOT NULL 
	ALTER TABLE [loPurchaseOrderDetail] ALTER COLUMN  [poditemid] int NOT NULL 
	ALTER TABLE [loPurchaseOrderDetail] ALTER COLUMN  [podDetailID] int NOT NULL 
	ALTER TABLE [loPurchaseOrderDetail] ADD  CONSTRAINT [PK_loPurchaseOrderDetail] PRIMARY KEY NONCLUSTERED ([podPoid],[poditemid],[podDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND CONSTRAINT_NAME= 'PK_loPurchaseOrderHeader')
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ALTER COLUMN  [pohPoid] int NOT NULL 
	ALTER TABLE [loPurchaseOrderHeader] ADD  CONSTRAINT [PK_loPurchaseOrderHeader] PRIMARY KEY NONCLUSTERED ([pohPoid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND CONSTRAINT_NAME= 'PK_loPurchaseOrderItemSplitDetails')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ALTER COLUMN  [podID] int NOT NULL 
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ALTER COLUMN  [VendorID] int NOT NULL 
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ALTER COLUMN  [PoDetailID] int NOT NULL 
	ALTER TABLE [loPurchaseOrderItemSplitDetails] ADD  CONSTRAINT [PK_loPurchaseOrderItemSplitDetails] PRIMARY KEY CLUSTERED ([podID],[VendorID],[ItemID],[PoDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderOC' AND CONSTRAINT_NAME= 'PK_loPurchaseOrderOC')
BEGIN
	ALTER TABLE [loPurchaseOrderOC] ALTER COLUMN  [podOthPoId] int NOT NULL 
	ALTER TABLE [loPurchaseOrderOC] ALTER COLUMN  [podOthDetailId] int NOT NULL 
	ALTER TABLE [loPurchaseOrderOC] ADD  CONSTRAINT [PK_loPurchaseOrderOC] PRIMARY KEY NONCLUSTERED ([podOthPoId],[podOthDetailId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchasereturndetail' AND CONSTRAINT_NAME= 'PK_loPurchasereturndetail')
BEGIN
	ALTER TABLE [loPurchasereturndetail] ALTER COLUMN  [prdcompanyid] int NOT NULL 
	ALTER TABLE [loPurchasereturndetail] ALTER COLUMN  [prdreturnid] int NOT NULL 
	ALTER TABLE [loPurchasereturndetail] ALTER COLUMN  [prddetailid] int NOT NULL 
	ALTER TABLE [loPurchasereturndetail] ADD  CONSTRAINT [PK_loPurchasereturndetail] PRIMARY KEY NONCLUSTERED ([prdcompanyid],[prdreturnid],[prddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchasereturnheader' AND CONSTRAINT_NAME= 'PK_loPurchasereturnheader')
BEGIN
	ALTER TABLE [loPurchasereturnheader] ALTER COLUMN  [prhcompanyid] int NOT NULL 
	ALTER TABLE [loPurchasereturnheader] ALTER COLUMN  [prhreturnid] int NOT NULL 
	ALTER TABLE [loPurchasereturnheader] ADD  CONSTRAINT [PK_loPurchasereturnheader] PRIMARY KEY NONCLUSTERED ([prhcompanyid],[prhreturnid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND CONSTRAINT_NAME= 'PK_loreplacereqtovendorheader')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ALTER COLUMN  [rrvcompanyid] int NOT NULL 
	ALTER TABLE [loreplacereqtovendorheader] ALTER COLUMN  [rrvrequestid] int NOT NULL 
	ALTER TABLE [loreplacereqtovendorheader] ADD  CONSTRAINT [PK_loreplacereqtovendorheader] PRIMARY KEY NONCLUSTERED ([rrvcompanyid],[rrvrequestid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND CONSTRAINT_NAME= 'PK_LOs_InHouseCons_ReturnDetail')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ALTER COLUMN  [IHRDShopID] int NOT NULL 
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ALTER COLUMN  [IHRDID] int NOT NULL 
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ALTER COLUMN  [IHRDDetailid] int NOT NULL 
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD  CONSTRAINT [PK_LOs_InHouseCons_ReturnDetail] PRIMARY KEY CLUSTERED ([IHRDShopID],[IHRDID],[IHRDDetailid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND CONSTRAINT_NAME= 'PK_LOs_InHouseCons_ReturnHeader')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ALTER COLUMN  [IHRHShopID] int NOT NULL 
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ALTER COLUMN  [IHRHID] int NOT NULL 
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD  CONSTRAINT [PK_LOs_InHouseCons_ReturnHeader] PRIMARY KEY CLUSTERED ([IHRHShopID],[IHRHID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND CONSTRAINT_NAME= 'PK_LOsAccountsInvoiceHeader')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ALTER COLUMN  [aiShopID] int NOT NULL 
	ALTER TABLE [LOsAccountsInvoiceHeader] ALTER COLUMN  [aiInvoiceID] int NOT NULL 
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD  CONSTRAINT [PK_LOsAccountsInvoiceHeader] PRIMARY KEY NONCLUSTERED ([aiShopID],[aiInvoiceID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND CONSTRAINT_NAME= 'pk_losApartmentAgreementDetails')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] ALTER COLUMN  [mgdcompanyid] int NOT NULL 
	ALTER TABLE [losApartmentAgreementDetails] ALTER COLUMN  [mgdshopid] int NOT NULL 
	ALTER TABLE [losApartmentAgreementDetails] ALTER COLUMN  [mgdAgreementId] int NOT NULL 
	ALTER TABLE [losApartmentAgreementDetails] ALTER COLUMN  [mgdAgreementDetailID] int NOT NULL 
	ALTER TABLE [losApartmentAgreementDetails] ADD  CONSTRAINT [pk_losApartmentAgreementDetails] PRIMARY KEY CLUSTERED ([mgdcompanyid],[mgdshopid],[mgdAgreementId],[mgdAgreementDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND CONSTRAINT_NAME= 'pk_losApartmentAgreementHeader')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ALTER COLUMN  [mghCompanyId] int NOT NULL 
	ALTER TABLE [losApartmentAgreementHeader] ALTER COLUMN  [mghShopId] int NOT NULL 
	ALTER TABLE [losApartmentAgreementHeader] ALTER COLUMN  [mghAgreementid] int NOT NULL 
	ALTER TABLE [losApartmentAgreementHeader] ADD  CONSTRAINT [pk_losApartmentAgreementHeader] PRIMARY KEY CLUSTERED ([mghCompanyId],[mghShopId],[mghAgreementid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosApartmentAssets' AND CONSTRAINT_NAME= 'pk_LosApartmentAssets')
BEGIN
	ALTER TABLE [LosApartmentAssets] ALTER COLUMN  [aacompanyid] int NOT NULL 
	ALTER TABLE [LosApartmentAssets] ALTER COLUMN  [aashopid] int NOT NULL 
	ALTER TABLE [LosApartmentAssets] ALTER COLUMN  [aaapartmentid] int NOT NULL 
	ALTER TABLE [LosApartmentAssets] ALTER COLUMN  [aadetailid] int NOT NULL 
	ALTER TABLE [LosApartmentAssets] ADD  CONSTRAINT [pk_LosApartmentAssets] PRIMARY KEY CLUSTERED ([aacompanyid],[aashopid],[aaapartmentid],[aadetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentBillHeader' AND CONSTRAINT_NAME= 'pk_losApartmentBillHeader')
BEGIN
	ALTER TABLE [losApartmentBillHeader] ALTER COLUMN  [abhBillId] int NOT NULL 
	ALTER TABLE [losApartmentBillHeader] ALTER COLUMN  [abhSHopID] int NOT NULL 
	ALTER TABLE [losApartmentBillHeader] ALTER COLUMN  [abhCompanyid] int NOT NULL 
	ALTER TABLE [losApartmentBillHeader] ADD  CONSTRAINT [pk_losApartmentBillHeader] PRIMARY KEY CLUSTERED ([abhBillId],[abhSHopID],[abhCompanyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosApartmentcategory' AND CONSTRAINT_NAME= 'pk_LosApartmentcategory')
BEGIN
	ALTER TABLE [LosApartmentcategory] ALTER COLUMN  [rccompanyid] int NOT NULL 
	ALTER TABLE [LosApartmentcategory] ALTER COLUMN  [rcshopid] int NOT NULL 
	ALTER TABLE [LosApartmentcategory] ALTER COLUMN  [rcapartmentcategoryid] int NOT NULL 
	ALTER TABLE [LosApartmentcategory] ADD  CONSTRAINT [pk_LosApartmentcategory] PRIMARY KEY CLUSTERED ([rccompanyid],[rcshopid],[rcapartmentcategoryid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentRatesDetail' AND CONSTRAINT_NAME= 'pk_losApartmentRatesDetail')
BEGIN
	ALTER TABLE [losApartmentRatesDetail] ALTER COLUMN  [rdcompanyid] int NOT NULL 
	ALTER TABLE [losApartmentRatesDetail] ALTER COLUMN  [rdshopid] int NOT NULL 
	ALTER TABLE [losApartmentRatesDetail] ALTER COLUMN  [rdapartmentcategoryid] int NOT NULL 
	ALTER TABLE [losApartmentRatesDetail] ALTER COLUMN  [rdroomratedetailid] int NOT NULL 
	ALTER TABLE [losApartmentRatesDetail] ADD  CONSTRAINT [pk_losApartmentRatesDetail] PRIMARY KEY CLUSTERED ([rdcompanyid],[rdshopid],[rdapartmentcategoryid],[rdroomratedetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND CONSTRAINT_NAME= 'pk_losBoatNoteConfirmHeader')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losBoatNoteConfirmHeader] ALTER COLUMN  [ConfirmID] int NOT NULL 
	ALTER TABLE [losBoatNoteConfirmHeader] ADD  CONSTRAINT [pk_losBoatNoteConfirmHeader] PRIMARY KEY CLUSTERED ([ShopID],[ConfirmID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND CONSTRAINT_NAME= 'PK_losbookpartsreplacedetails')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ALTER COLUMN  [repbkdsercompanyid] int NOT NULL 
	ALTER TABLE [losbookpartsreplacedetails] ALTER COLUMN  [repbkdserbookid] int NOT NULL 
	ALTER TABLE [losbookpartsreplacedetails] ALTER COLUMN  [repbkdshopid] int NOT NULL 
	ALTER TABLE [losbookpartsreplacedetails] ALTER COLUMN  [repbkddetailid] int NOT NULL 
	ALTER TABLE [losbookpartsreplacedetails] ADD  CONSTRAINT [PK_losbookpartsreplacedetails] PRIMARY KEY CLUSTERED ([repbkdsercompanyid],[repbkdserbookid],[repbkdshopid],[repbkddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookservicedetails' AND CONSTRAINT_NAME= 'PK_losbookservicedetails')
BEGIN
	ALTER TABLE [losbookservicedetails] ALTER COLUMN  [serbkdcompanyid] int NOT NULL 
	ALTER TABLE [losbookservicedetails] ALTER COLUMN  [serbkdbookid] int NOT NULL 
	ALTER TABLE [losbookservicedetails] ALTER COLUMN  [serbkdshopid] int NOT NULL 
	ALTER TABLE [losbookservicedetails] ALTER COLUMN  [serbkdserdetailid] int NOT NULL 
	ALTER TABLE [losbookservicedetails] ADD  CONSTRAINT [PK_losbookservicedetails] PRIMARY KEY CLUSTERED ([serbkdcompanyid],[serbkdbookid],[serbkdshopid],[serbkdserdetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookservtechniciandetails' AND CONSTRAINT_NAME= 'PK_losservicetechniciandetails')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ALTER COLUMN  [sertechcompanyid] int NOT NULL 
	ALTER TABLE [losbookservtechniciandetails] ALTER COLUMN  [sertechbookid] int NOT NULL 
	ALTER TABLE [losbookservtechniciandetails] ALTER COLUMN  [sertechshopid] int NOT NULL 
	ALTER TABLE [losbookservtechniciandetails] ALTER COLUMN  [sertechdetailid] int NOT NULL 
	ALTER TABLE [losbookservtechniciandetails] ADD  CONSTRAINT [PK_losservicetechniciandetails] PRIMARY KEY NONCLUSTERED ([sertechcompanyid],[sertechbookid],[sertechshopid],[sertechdetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losCallBookingHeader' AND CONSTRAINT_NAME= 'pk_losCallBookingHeader')
BEGIN
	ALTER TABLE [losCallBookingHeader] ALTER COLUMN  [serCallBkhid] int NOT NULL 
	ALTER TABLE [losCallBookingHeader] ALTER COLUMN  [serCallBkhshopid] int NOT NULL 
	ALTER TABLE [losCallBookingHeader] ALTER COLUMN  [serCallBkhcompanyid] int NOT NULL 
	ALTER TABLE [losCallBookingHeader] ADD  CONSTRAINT [pk_losCallBookingHeader] PRIMARY KEY CLUSTERED ([serCallBkhid],[serCallBkhshopid],[serCallBkhcompanyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loscomplaints' AND CONSTRAINT_NAME= 'PK_loscomplaints')
BEGIN
	ALTER TABLE [loscomplaints] ALTER COLUMN  [cmpid] int NOT NULL 
	ALTER TABLE [loscomplaints] ALTER COLUMN  [cmpshopid] int NOT NULL 
	ALTER TABLE [loscomplaints] ALTER COLUMN  [cmpcompanyid] int NOT NULL 
	ALTER TABLE [loscomplaints] ADD  CONSTRAINT [PK_loscomplaints] PRIMARY KEY NONCLUSTERED ([cmpid],[cmpshopid],[cmpcompanyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNote' AND CONSTRAINT_NAME= 'PK_losDebitCreditNote')
BEGIN
	ALTER TABLE [losDebitCreditNote] ALTER COLUMN  [losDCNShopid] int NOT NULL 
	ALTER TABLE [losDebitCreditNote] ALTER COLUMN  [losDCNId] int NOT NULL 
	ALTER TABLE [losDebitCreditNote] ADD  CONSTRAINT [PK_losDebitCreditNote] PRIMARY KEY NONCLUSTERED ([losDCNShopid],[losDCNId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND CONSTRAINT_NAME= 'pk_LosDebitCreditNoteDetail')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losDebitCreditNoteDetail] ALTER COLUMN  [DCNID] int NOT NULL 
	ALTER TABLE [losDebitCreditNoteDetail] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [losDebitCreditNoteDetail] ADD  CONSTRAINT [pk_LosDebitCreditNoteDetail] PRIMARY KEY CLUSTERED ([ShopID],[DCNID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDeliveryNoteDetail' AND CONSTRAINT_NAME= 'PK_LosDeliveryNoteDetail')
BEGIN
	ALTER TABLE [LosDeliveryNoteDetail] ALTER COLUMN  [DnDShopid] int NOT NULL 
	ALTER TABLE [LosDeliveryNoteDetail] ALTER COLUMN  [DnDdnId] int NOT NULL 
	ALTER TABLE [LosDeliveryNoteDetail] ALTER COLUMN  [DnDetailId] int NOT NULL 
	ALTER TABLE [LosDeliveryNoteDetail] ADD  CONSTRAINT [PK_LosDeliveryNoteDetail] PRIMARY KEY NONCLUSTERED ([DnDShopid],[DnDdnId],[DnDetailId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND CONSTRAINT_NAME= 'PK_LosDeliveryNoteHeader')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ALTER COLUMN  [DnShopid] int NOT NULL 
	ALTER TABLE [LosDeliveryNoteHeader] ALTER COLUMN  [DndnId] int NOT NULL 
	ALTER TABLE [LosDeliveryNoteHeader] ADD  CONSTRAINT [PK_LosDeliveryNoteHeader] PRIMARY KEY NONCLUSTERED ([DnShopid],[DndnId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryNoteImage' AND CONSTRAINT_NAME= 'PK_losDeliveryNoteImage')
BEGIN
	ALTER TABLE [losDeliveryNoteImage] ALTER COLUMN  [CompanyId] int NOT NULL 
	ALTER TABLE [losDeliveryNoteImage] ALTER COLUMN  [ShopId] int NOT NULL 
	ALTER TABLE [losDeliveryNoteImage] ALTER COLUMN  [DeliveryNoteId] int NOT NULL 
	ALTER TABLE [losDeliveryNoteImage] ADD  CONSTRAINT [PK_losDeliveryNoteImage] PRIMARY KEY CLUSTERED ([CompanyId],[ShopId],[DeliveryNoteId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND CONSTRAINT_NAME= 'PK_LosDeliveryNoteItemDetails')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ALTER COLUMN  [dndShopID] int NOT NULL 
	ALTER TABLE [losDeliveryNoteItemDetails] ALTER COLUMN  [dndId] int NOT NULL 
	ALTER TABLE [losDeliveryNoteItemDetails] ALTER COLUMN  [dndDetailID] int NOT NULL 
	ALTER TABLE [losDeliveryNoteItemDetails] ALTER COLUMN  [dndItemID] int NOT NULL 
	ALTER TABLE [losDeliveryNoteItemDetails] ALTER COLUMN  [dndKitID] int NOT NULL 
	ALTER TABLE [losDeliveryNoteItemDetails] ADD  CONSTRAINT [PK_LosDeliveryNoteItemDetails] PRIMARY KEY NONCLUSTERED ([dndShopID],[dndId],[dndDetailID],[dndItemID],[dndKitID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryVerificationHeader' AND CONSTRAINT_NAME= 'PK_losDeliveryItemsVerificationHeader')
BEGIN
	ALTER TABLE [losDeliveryVerificationHeader] ALTER COLUMN  [CompanyId] int NOT NULL 
	ALTER TABLE [losDeliveryVerificationHeader] ALTER COLUMN  [ShopId] int NOT NULL 
	ALTER TABLE [losDeliveryVerificationHeader] ALTER COLUMN  [DeliveryVerificationId] int NOT NULL 
	ALTER TABLE [losDeliveryVerificationHeader] ADD  CONSTRAINT [PK_losDeliveryItemsVerificationHeader] PRIMARY KEY CLUSTERED ([CompanyId],[ShopId],[DeliveryVerificationId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDocument' AND CONSTRAINT_NAME= 'PK_losDocument')
BEGIN
	ALTER TABLE [losDocument] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losDocument] ALTER COLUMN  [DocID] int NOT NULL 
	ALTER TABLE [losDocument] ADD  CONSTRAINT [PK_losDocument] PRIMARY KEY NONCLUSTERED ([ShopID],[DocID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDocumentDetail' AND CONSTRAINT_NAME= 'PK_losDocumentDetail')
BEGIN
	ALTER TABLE [losDocumentDetail] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losDocumentDetail] ALTER COLUMN  [DocID] int NOT NULL 
	ALTER TABLE [losDocumentDetail] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [losDocumentDetail] ADD  CONSTRAINT [PK_losDocumentDetail] PRIMARY KEY NONCLUSTERED ([ShopID],[DocID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDocumenttravel' AND CONSTRAINT_NAME= 'PK_losDocumenttravel')
BEGIN
	ALTER TABLE [losDocumenttravel] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losDocumenttravel] ALTER COLUMN  [DocId] int NOT NULL 
	ALTER TABLE [losDocumenttravel] ALTER COLUMN  [DetailId] int NOT NULL 
	ALTER TABLE [losDocumenttravel] ADD  CONSTRAINT [PK_losDocumenttravel] PRIMARY KEY NONCLUSTERED ([ShopID],[DocId],[DetailId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND CONSTRAINT_NAME= 'PK_LosDummyReceiptDetail')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ALTER COLUMN  [drdShopID] int NOT NULL 
	ALTER TABLE [LosDummyReceiptDetail] ALTER COLUMN  [drdid] int NOT NULL 
	ALTER TABLE [LosDummyReceiptDetail] ALTER COLUMN  [drdDetailid] int NOT NULL 
	ALTER TABLE [LosDummyReceiptDetail] ADD  CONSTRAINT [PK_LosDummyReceiptDetail] PRIMARY KEY NONCLUSTERED ([drdShopID],[drdid],[drdDetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDummyReceiptHeader' AND CONSTRAINT_NAME= 'PK_losDummyReceipt')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ALTER COLUMN  [drShopid] int NOT NULL 
	ALTER TABLE [losDummyReceiptHeader] ALTER COLUMN  [drId] int NOT NULL 
	ALTER TABLE [losDummyReceiptHeader] ADD  CONSTRAINT [PK_losDummyReceipt] PRIMARY KEY NONCLUSTERED ([drShopid],[drId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losEDIConfirmation' AND CONSTRAINT_NAME= 'PK_losEDIConfirmation')
BEGIN
	ALTER TABLE [losEDIConfirmation] ALTER COLUMN  [ecshopid] int NOT NULL 
	ALTER TABLE [losEDIConfirmation] ALTER COLUMN  [ecconfirmid] int NOT NULL 
	ALTER TABLE [losEDIConfirmation] ADD  CONSTRAINT [PK_losEDIConfirmation] PRIMARY KEY NONCLUSTERED ([ecshopid],[ecconfirmid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losEDIRequest' AND CONSTRAINT_NAME= 'PK_losEDIRequest')
BEGIN
	ALTER TABLE [losEDIRequest] ALTER COLUMN  [ershopid] int NOT NULL 
	ALTER TABLE [losEDIRequest] ALTER COLUMN  [erediid] int NOT NULL 
	ALTER TABLE [losEDIRequest] ADD  CONSTRAINT [PK_losEDIRequest] PRIMARY KEY NONCLUSTERED ([ershopid],[erediid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losExportHeader' AND CONSTRAINT_NAME= 'pk_losexportheader')
BEGIN
	ALTER TABLE [losExportHeader] ALTER COLUMN  [rehExportID] int NOT NULL 
	ALTER TABLE [losExportHeader] ALTER COLUMN  [rehShopID] int NOT NULL 
	ALTER TABLE [losExportHeader] ADD  CONSTRAINT [pk_losexportheader] PRIMARY KEY CLUSTERED ([rehExportID],[rehShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosFacilityTracking' AND CONSTRAINT_NAME= 'PK_LosFacilityTracking')
BEGIN
	ALTER TABLE [LosFacilityTracking] ALTER COLUMN  [ftShopid] int NOT NULL 
	ALTER TABLE [LosFacilityTracking] ALTER COLUMN  [ftCompanyId] int NOT NULL 
	ALTER TABLE [LosFacilityTracking] ALTER COLUMN  [ftTrackId] int NOT NULL 
	ALTER TABLE [LosFacilityTracking] ADD  CONSTRAINT [PK_LosFacilityTracking] PRIMARY KEY NONCLUSTERED ([ftShopid],[ftCompanyId],[ftTrackId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losfuture' AND CONSTRAINT_NAME= 'PK_losfuture')
BEGIN
	ALTER TABLE [losfuture] ALTER COLUMN  [futureint] int NOT NULL 
	ALTER TABLE [losfuture] ADD  CONSTRAINT [PK_losfuture] PRIMARY KEY NONCLUSTERED ([futureint])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losfuturetabdetail' AND CONSTRAINT_NAME= 'PK_losfuturetabdetail')
BEGIN
	ALTER TABLE [losfuturetabdetail] ALTER COLUMN  [futdid] int NOT NULL 
	ALTER TABLE [losfuturetabdetail] ALTER COLUMN  [futdcompanyid] int NOT NULL 
	ALTER TABLE [losfuturetabdetail] ALTER COLUMN  [futdshopid] int NOT NULL 
	ALTER TABLE [losfuturetabdetail] ALTER COLUMN  [futdref1id] int NOT NULL 
	ALTER TABLE [losfuturetabdetail] ADD  CONSTRAINT [PK_losfuturetabdetail] PRIMARY KEY NONCLUSTERED ([futdid],[futdcompanyid],[futdshopid],[futdref1id])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losfuturetabheader' AND CONSTRAINT_NAME= 'PK_losfuturetabheader')
BEGIN
	ALTER TABLE [losfuturetabheader] ALTER COLUMN  [futheadid] int NOT NULL 
	ALTER TABLE [losfuturetabheader] ALTER COLUMN  [futhcompanyid] int NOT NULL 
	ALTER TABLE [losfuturetabheader] ALTER COLUMN  [futhshopid] int NOT NULL 
	ALTER TABLE [losfuturetabheader] ADD  CONSTRAINT [PK_losfuturetabheader] PRIMARY KEY NONCLUSTERED ([futheadid],[futhcompanyid],[futhshopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND CONSTRAINT_NAME= 'PK_LOsGoodsArrivaltoShopDetail')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ALTER COLUMN  [gadArrivalID] int NOT NULL 
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ALTER COLUMN  [gadShopid] int NOT NULL 
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ALTER COLUMN  [gadShipmentID] int NOT NULL 
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ALTER COLUMN  [gadItemID] int NOT NULL 
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD  CONSTRAINT [PK_LOsGoodsArrivaltoShopDetail] PRIMARY KEY NONCLUSTERED ([gadArrivalID],[gadShopid],[gadShipmentID],[gadItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND CONSTRAINT_NAME= 'PK_LOsGoodsArrivaltoShopHeader')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ALTER COLUMN  [gahArrivalID] int NOT NULL 
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ALTER COLUMN  [gahShopid] int NOT NULL 
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD  CONSTRAINT [PK_LOsGoodsArrivaltoShopHeader] PRIMARY KEY NONCLUSTERED ([gahArrivalID],[gahShopid])
		WITH  FILLFACTOR = 90
END
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


---Begin:For solving constraint problem in losgoodsreturnnotedetail  added the querry get from bijesh exist in soursesafe
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

GO
update losgoodsreturnnotedetail  set grndPackTypeId=inv.idPackingTypeID   
    from (
			select distinct
			ih.ihInvoiceID,ih.ihShopID,ih.ihDepartmentID,id.idItemID,id.idPackingTypeID,gh.GrnhGoodsreturnnoteID
			from losinvoiceheader  ih                  
			left join losinvoicedetail id                  
			on ih.ihInvoiceid=id.idInvoiceid and ih.ihshopid=id.idshopid                   
			left join ashops s on ih.ihshopid = s.shopid
			left join adepartmentmaster d on ih.ihDepartmentID=  d.departmentid                  

			inner join losgoodsreturnnoteheader  gh
			on gh.GrnhInvoiceID=ih.ihInvoiceID and ih.ihShopID=gh.grnhShopid
					 and ih.ihDepartmentID= gh.grnhDepartmentid
			inner join losgoodsreturnnotedetail gd on gh.GrnhGoodsreturnnoteID = gd.GRNDReturnNoteID 
			and gh.grnhShopid = gd.GRNDShopid
			and id.idItemID=gd.GRNDItemID 

			inner join ashops sh on  gh.grnhshopid = sh.shopid
			inner join adepartmentmaster d1  on grnhdepartmentid = d1.departmentid   
			where    
				ih.ihtype ='i' 
				and ihproforma=0 and ihcashinvoice=0 
				and gd.grndPackTypeId is null
	    ) Inv   
        where 
			losgoodsreturnnotedetail.GRNDItemID=inv.idItemID
		and losgoodsreturnnotedetail.GRNDShopid= inv.ihShopID
		and losgoodsreturnnotedetail.GRNDReturnNoteID = inv.GrnhGoodsreturnnoteID
	
go
		 
 GO
GO
IF  EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME='GRNDPackTypeId' ) 
BEGIN

 alter table LosGoodsReturnNoteDetail alter  COLUMN GRNDPackTypeId INT NOT NULL
end
go

USE [adminv2]
GO

/****** Object:  Index [PK_LosGoodsReturnNoteDetail]    Script Date: 08/13/2012 10:15:54 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[LosGoodsReturnNoteDetail]') AND name = N'PK_LosGoodsReturnNoteDetail')
ALTER TABLE [dbo].[LosGoodsReturnNoteDetail] DROP CONSTRAINT [PK_LosGoodsReturnNoteDetail]
GO

GO

/****** Object:  Index [PK_LosGoodsReturnNoteDetail]    Script Date: 08/13/2012 10:15:54 ******/
ALTER TABLE [dbo].[LosGoodsReturnNoteDetail] ADD  CONSTRAINT [PK_LosGoodsReturnNoteDetail] PRIMARY KEY NONCLUSTERED 
(
	[GRNDReturnNoteID] ASC,
	[GRNDItemID] ASC,
	[GRNDShopid] ASC,
	[GRNDPackTypeId]ASC
	
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----End:For solving constraint problem in losgoodsreturnnotedetail  added the querry get from bijesh exist in soursesafe
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND CONSTRAINT_NAME= 'PK_LosGoodsReturnNoteDetail')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ALTER COLUMN  [GRNDReturnNoteID] int NOT NULL 
	ALTER TABLE [LosGoodsReturnNoteDetail] ALTER COLUMN  [GRNDItemID] int NOT NULL 
	ALTER TABLE [LosGoodsReturnNoteDetail] ALTER COLUMN  [GRNDShopid] int NOT NULL 
	ALTER TABLE [LosGoodsReturnNoteDetail] ALTER COLUMN  [grndPackTypeId] int NOT NULL 
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD  CONSTRAINT [PK_LosGoodsReturnNoteDetail] PRIMARY KEY NONCLUSTERED ([GRNDReturnNoteID],[GRNDItemID],[GRNDShopid],[grndPackTypeId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND CONSTRAINT_NAME= 'PK_LosGoodsReturnNoteHeader')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ALTER COLUMN  [grnhShopid] int NOT NULL 
	ALTER TABLE [LosGoodsReturnNoteHeader] ALTER COLUMN  [GrnhGoodsreturnnoteID] int NOT NULL 
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD  CONSTRAINT [PK_LosGoodsReturnNoteHeader] PRIMARY KEY NONCLUSTERED ([grnhShopid],[GrnhGoodsreturnnoteID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND CONSTRAINT_NAME= 'PK_losHPChequeRegistryDetail')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] ALTER COLUMN  [HpdChqRegID] int NOT NULL 
	ALTER TABLE [losHPChequeRegisterDetail] ALTER COLUMN  [HpdChqdetailID] int NOT NULL 
	ALTER TABLE [losHPChequeRegisterDetail] ADD  CONSTRAINT [PK_losHPChequeRegistryDetail] PRIMARY KEY CLUSTERED ([HpdChqRegID],[HpdChqdetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHPChequeRegisterHeader' AND CONSTRAINT_NAME= 'PK_losHPChequeRegisterHeader')
BEGIN
	ALTER TABLE [losHPChequeRegisterHeader] ALTER COLUMN  [HphChqRegID] int NOT NULL 
	ALTER TABLE [losHPChequeRegisterHeader] ADD  CONSTRAINT [PK_losHPChequeRegisterHeader] PRIMARY KEY CLUSTERED ([HphChqRegID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHPCustomerDetails' AND CONSTRAINT_NAME= 'PK_losHPCustomerDetails')
BEGIN
	ALTER TABLE [losHPCustomerDetails] ALTER COLUMN  [hpCustID] int NOT NULL 
	ALTER TABLE [losHPCustomerDetails] ADD  CONSTRAINT [PK_losHPCustomerDetails] PRIMARY KEY CLUSTERED ([hpCustID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND CONSTRAINT_NAME= 'PK_losHpDummyQuotationHeader')
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ALTER COLUMN  [hpqhQuotationID] int NOT NULL 
	ALTER TABLE [losHpDummyQuotationHeader] ADD  CONSTRAINT [PK_losHpDummyQuotationHeader] PRIMARY KEY CLUSTERED ([hpqhQuotationID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpInvoiceHeader' AND CONSTRAINT_NAME= 'PK_losHpInvoiceHeader')
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ALTER COLUMN  [hpqhQuotationID] int NOT NULL 
	ALTER TABLE [losHpInvoiceHeader] ADD  CONSTRAINT [PK_losHpInvoiceHeader] PRIMARY KEY CLUSTERED ([hpqhQuotationID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpItemRegistrationDetails' AND CONSTRAINT_NAME= 'PK_losHpItemRegistrationDetails')
BEGIN
	ALTER TABLE [losHpItemRegistrationDetails] ALTER COLUMN  [IRCompanyID] int NOT NULL 
	ALTER TABLE [losHpItemRegistrationDetails] ALTER COLUMN  [IRShopID] char(10) NOT NULL 
	ALTER TABLE [losHpItemRegistrationDetails] ALTER COLUMN  [IRRegistrationID] int NOT NULL 
	ALTER TABLE [losHpItemRegistrationDetails] ADD  CONSTRAINT [PK_losHpItemRegistrationDetails] PRIMARY KEY CLUSTERED ([IRCompanyID],[IRShopID],[IRRegistrationID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpReceiptDetail' AND CONSTRAINT_NAME= 'PK_losHpReceiptDetail')
BEGIN
	ALTER TABLE [losHpReceiptDetail] ALTER COLUMN  [hprdCompanyID] int NOT NULL 
	ALTER TABLE [losHpReceiptDetail] ALTER COLUMN  [hprdShopId] int NOT NULL 
	ALTER TABLE [losHpReceiptDetail] ALTER COLUMN  [hprdReceiptID] int NOT NULL 
	ALTER TABLE [losHpReceiptDetail] ALTER COLUMN  [hprdDetailId] int NOT NULL 
	ALTER TABLE [losHpReceiptDetail] ADD  CONSTRAINT [PK_losHpReceiptDetail] PRIMARY KEY CLUSTERED ([hprdCompanyID],[hprdShopId],[hprdReceiptID],[hprdDetailId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpReceiptHeader' AND CONSTRAINT_NAME= 'PK_losHpReceiptHeader')
BEGIN
	ALTER TABLE [losHpReceiptHeader] ALTER COLUMN  [hprhCompanyID] int NOT NULL 
	ALTER TABLE [losHpReceiptHeader] ALTER COLUMN  [hprhShopID] int NOT NULL 
	ALTER TABLE [losHpReceiptHeader] ALTER COLUMN  [hprhReceiptID] int NOT NULL 
	ALTER TABLE [losHpReceiptHeader] ADD  CONSTRAINT [PK_losHpReceiptHeader] PRIMARY KEY CLUSTERED ([hprhCompanyID],[hprhShopID],[hprhReceiptID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpRepossessionDetail' AND CONSTRAINT_NAME= 'PK_losHpRepossessionDetail')
BEGIN
	ALTER TABLE [losHpRepossessionDetail] ALTER COLUMN  [hprdCompanyId] int NOT NULL 
	ALTER TABLE [losHpRepossessionDetail] ALTER COLUMN  [hprdShopID] int NOT NULL 
	ALTER TABLE [losHpRepossessionDetail] ALTER COLUMN  [hprdRepossessionID] int NOT NULL 
	ALTER TABLE [losHpRepossessionDetail] ALTER COLUMN  [hprdDetailID] int NOT NULL 
	ALTER TABLE [losHpRepossessionDetail] ADD  CONSTRAINT [PK_losHpRepossessionDetail] PRIMARY KEY CLUSTERED ([hprdCompanyId],[hprdShopID],[hprdRepossessionID],[hprdDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpRepossessionHeader' AND CONSTRAINT_NAME= 'PK_losHpRepossessionHeader')
BEGIN
	ALTER TABLE [losHpRepossessionHeader] ALTER COLUMN  [hprhCompanyID] int NOT NULL 
	ALTER TABLE [losHpRepossessionHeader] ALTER COLUMN  [hprhShopID] int NOT NULL 
	ALTER TABLE [losHpRepossessionHeader] ALTER COLUMN  [hprhRepossessionID] int NOT NULL 
	ALTER TABLE [losHpRepossessionHeader] ADD  CONSTRAINT [PK_losHpRepossessionHeader] PRIMARY KEY CLUSTERED ([hprhCompanyID],[hprhShopID],[hprhRepossessionID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND CONSTRAINT_NAME= 'PK_losInhouseExchangeDetail')
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ALTER COLUMN  [sedShopID] int NOT NULL 
	ALTER TABLE [losInhouseExchangeDetail] ALTER COLUMN  [sedExchangeID] int NOT NULL 
	ALTER TABLE [losInhouseExchangeDetail] ALTER COLUMN  [sedExchangedetailID] int NOT NULL 
	ALTER TABLE [losInhouseExchangeDetail] ADD  CONSTRAINT [PK_losInhouseExchangeDetail] PRIMARY KEY NONCLUSTERED ([sedShopID],[sedExchangeID],[sedExchangedetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinquirydetail' AND CONSTRAINT_NAME= 'PK_losinquirydetail')
BEGIN
	ALTER TABLE [losinquirydetail] ALTER COLUMN  [idcompanyid] int NOT NULL 
	ALTER TABLE [losinquirydetail] ALTER COLUMN  [idshopid] int NOT NULL 
	ALTER TABLE [losinquirydetail] ALTER COLUMN  [idid] int NOT NULL 
	ALTER TABLE [losinquirydetail] ALTER COLUMN  [iddetailid] int NOT NULL 
	ALTER TABLE [losinquirydetail] ADD  CONSTRAINT [PK_losinquirydetail] PRIMARY KEY NONCLUSTERED ([idcompanyid],[idshopid],[idid],[iddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losInquiryHeader' AND CONSTRAINT_NAME= 'PK_losInquiryHeader')
BEGIN
	ALTER TABLE [losInquiryHeader] ALTER COLUMN  [ihcompanyid] int NOT NULL 
	ALTER TABLE [losInquiryHeader] ALTER COLUMN  [ihshopid] int NOT NULL 
	ALTER TABLE [losInquiryHeader] ALTER COLUMN  [ihid] int NOT NULL 
	ALTER TABLE [losInquiryHeader] ADD  CONSTRAINT [PK_losInquiryHeader] PRIMARY KEY NONCLUSTERED ([ihcompanyid],[ihshopid],[ihid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceDetail' AND CONSTRAINT_NAME= 'PK_losInvoiceDetail')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ALTER COLUMN  [idShopID] int NOT NULL 
	ALTER TABLE [LOsInvoiceDetail] ALTER COLUMN  [idInvoiceID] int NOT NULL 
	ALTER TABLE [LOsInvoiceDetail] ALTER COLUMN  [idItemID] int NOT NULL 
	ALTER TABLE [LOsInvoiceDetail] ALTER COLUMN  [idPackingTypeID] int NOT NULL 
	ALTER TABLE [LOsInvoiceDetail] ALTER COLUMN  [idKitID] int NOT NULL 
	ALTER TABLE [LOsInvoiceDetail] ADD  CONSTRAINT [PK_losInvoiceDetail] PRIMARY KEY NONCLUSTERED ([idShopID],[idInvoiceID],[idItemID],[idPackingTypeID],[idKitID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'PK_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ALTER COLUMN  [ihShopID] int NOT NULL 
	ALTER TABLE [LOsInvoiceHeader] ALTER COLUMN  [ihInvoiceID] int NOT NULL 
	ALTER TABLE [LOsInvoiceHeader] ADD  CONSTRAINT [PK_LOsInvoiceHeader] PRIMARY KEY NONCLUSTERED ([ihShopID],[ihInvoiceID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceOC' AND CONSTRAINT_NAME= 'pk_losInvoiceOC')
BEGIN
	ALTER TABLE [LOsInvoiceOC] ALTER COLUMN  [ioShopID] int NOT NULL 
	ALTER TABLE [LOsInvoiceOC] ALTER COLUMN  [ioInvoiceID] int NOT NULL 
	ALTER TABLE [LOsInvoiceOC] ALTER COLUMN  [ioDescription] varchar(250) NOT NULL 
	ALTER TABLE [LOsInvoiceOC] ADD  CONSTRAINT [pk_losInvoiceOC] PRIMARY KEY CLUSTERED ([ioShopID],[ioInvoiceID],[ioDescription])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND CONSTRAINT_NAME= 'PK_losInvoiceProjectRequestDetails')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ALTER COLUMN  [idrInvoiceId] int NOT NULL 
	ALTER TABLE [losInvoiceProjectRequestDetails] ALTER COLUMN  [idrShopId] int NOT NULL 
	ALTER TABLE [losInvoiceProjectRequestDetails] ALTER COLUMN  [idrCompanyId] int NOT NULL 
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD  CONSTRAINT [PK_losInvoiceProjectRequestDetails] PRIMARY KEY NONCLUSTERED ([idrInvoiceId],[idrShopId],[idrCompanyId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosInvoiceST' AND CONSTRAINT_NAME= 'PK_LosInvoiceST')
BEGIN
	ALTER TABLE [LosInvoiceST] ALTER COLUMN  [ioSTShopID] int NOT NULL 
	ALTER TABLE [LosInvoiceST] ALTER COLUMN  [ioSTInvoiceID] int NOT NULL 
	ALTER TABLE [LosInvoiceST] ADD  CONSTRAINT [PK_LosInvoiceST] PRIMARY KEY CLUSTERED ([ioSTShopID],[ioSTInvoiceID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND CONSTRAINT_NAME= 'PK_LOsInvoiceSubItemDetail')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ALTER COLUMN  [isdShopid] int NOT NULL 
	ALTER TABLE [LOsInvoiceSubItemDetail] ALTER COLUMN  [isdinvoiceid] int NOT NULL 
	ALTER TABLE [LOsInvoiceSubItemDetail] ALTER COLUMN  [isditemid] int NOT NULL 
	ALTER TABLE [LOsInvoiceSubItemDetail] ALTER COLUMN  [isdsubitemid] int NOT NULL 
	ALTER TABLE [LOsInvoiceSubItemDetail] ALTER COLUMN  [isdpackingtypeid] int NOT NULL 
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD  CONSTRAINT [PK_LOsInvoiceSubItemDetail] PRIMARY KEY NONCLUSTERED ([isdShopid],[isdinvoiceid],[isditemid],[isdsubitemid],[isdpackingtypeid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND CONSTRAINT_NAME= 'PK_losinvpartsreplacedetails')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ALTER COLUMN  [repinvcompanyid] int NOT NULL 
	ALTER TABLE [losinvpartsreplacedetails] ALTER COLUMN  [repinvinvoiceid] int NOT NULL 
	ALTER TABLE [losinvpartsreplacedetails] ALTER COLUMN  [repinvdshopid] int NOT NULL 
	ALTER TABLE [losinvpartsreplacedetails] ALTER COLUMN  [repinvdetailid] int NOT NULL 
	ALTER TABLE [losinvpartsreplacedetails] ADD  CONSTRAINT [PK_losinvpartsreplacedetails] PRIMARY KEY CLUSTERED ([repinvcompanyid],[repinvinvoiceid],[repinvdshopid],[repinvdetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinvservicedetails' AND CONSTRAINT_NAME= 'PK_losinvservicedetails')
BEGIN
	ALTER TABLE [losinvservicedetails] ALTER COLUMN  [serinvdcompanyid] int NOT NULL 
	ALTER TABLE [losinvservicedetails] ALTER COLUMN  [serinvdinvoiceid] int NOT NULL 
	ALTER TABLE [losinvservicedetails] ALTER COLUMN  [serinvdshopid] int NOT NULL 
	ALTER TABLE [losinvservicedetails] ALTER COLUMN  [serinvddetailid] int NOT NULL 
	ALTER TABLE [losinvservicedetails] ADD  CONSTRAINT [PK_losinvservicedetails] PRIMARY KEY NONCLUSTERED ([serinvdcompanyid],[serinvdinvoiceid],[serinvdshopid],[serinvddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosKegReturnDetail' AND CONSTRAINT_NAME= 'PK_LosKegReturnDetail')
BEGIN
	ALTER TABLE [LosKegReturnDetail] ALTER COLUMN  [krDReturnNoteID] int NOT NULL 
	ALTER TABLE [LosKegReturnDetail] ALTER COLUMN  [krDItemID] int NOT NULL 
	ALTER TABLE [LosKegReturnDetail] ALTER COLUMN  [krDShopid] int NOT NULL 
	ALTER TABLE [LosKegReturnDetail] ALTER COLUMN  [krDInvoiceId] int NOT NULL 
	ALTER TABLE [LosKegReturnDetail] ADD  CONSTRAINT [PK_LosKegReturnDetail] PRIMARY KEY CLUSTERED ([krDReturnNoteID],[krDItemID],[krDShopid],[krDInvoiceId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosKegReturnHeader' AND CONSTRAINT_NAME= 'PK_LosKegReturnHeader')
BEGIN
	ALTER TABLE [LosKegReturnHeader] ALTER COLUMN  [krhShopid] int NOT NULL 
	ALTER TABLE [LosKegReturnHeader] ALTER COLUMN  [krhKegReturnID] int NOT NULL 
	ALTER TABLE [LosKegReturnHeader] ADD  CONSTRAINT [PK_LosKegReturnHeader] PRIMARY KEY NONCLUSTERED ([krhShopid],[krhKegReturnID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND CONSTRAINT_NAME= 'pk_losLocalClearenceRequestDetail')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losLocalClearenceRequestDetail] ALTER COLUMN  [ClearenceReqID] int NOT NULL 
	ALTER TABLE [losLocalClearenceRequestDetail] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [losLocalClearenceRequestDetail] ADD  CONSTRAINT [pk_losLocalClearenceRequestDetail] PRIMARY KEY CLUSTERED ([ShopID],[ClearenceReqID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND CONSTRAINT_NAME= 'pk_losLocalClearenceRequestHeader')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losLocalClearenceRequestHeader] ALTER COLUMN  [ClearenceReqID] int NOT NULL 
	ALTER TABLE [losLocalClearenceRequestHeader] ADD  CONSTRAINT [pk_losLocalClearenceRequestHeader] PRIMARY KEY CLUSTERED ([ShopID],[ClearenceReqID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND CONSTRAINT_NAME= 'PK_LosLocalPurchaseDetail')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ALTER COLUMN  [lpdShopID] int NOT NULL 
	ALTER TABLE [LosLocalPurchaseDetail] ALTER COLUMN  [lpdBillID] int NOT NULL 
	ALTER TABLE [LosLocalPurchaseDetail] ALTER COLUMN  [lpdItemID] int NOT NULL 
	ALTER TABLE [LosLocalPurchaseDetail] ADD  CONSTRAINT [PK_LosLocalPurchaseDetail] PRIMARY KEY NONCLUSTERED ([lpdShopID],[lpdBillID],[lpdItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'PK_LosLocalPurchaseHeader')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ALTER COLUMN  [lphShopID] int NOT NULL 
	ALTER TABLE [LosLocalPurchaseHeader] ALTER COLUMN  [lphBillID] int NOT NULL 
	ALTER TABLE [LosLocalPurchaseHeader] ADD  CONSTRAINT [PK_LosLocalPurchaseHeader] PRIMARY KEY NONCLUSTERED ([lphShopID],[lphBillID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND CONSTRAINT_NAME= 'PK_LOsLocalPurchaseOC')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] ALTER COLUMN  [lpoShopID] int NOT NULL 
	ALTER TABLE [LOsLocalPurchaseOC] ALTER COLUMN  [lpoBillID] int NOT NULL 
	ALTER TABLE [LOsLocalPurchaseOC] ALTER COLUMN  [lpoAccID] int NOT NULL 
	ALTER TABLE [LOsLocalPurchaseOC] ADD  CONSTRAINT [PK_LOsLocalPurchaseOC] PRIMARY KEY NONCLUSTERED ([lpoShopID],[lpoBillID],[lpoAccID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocation' AND CONSTRAINT_NAME= 'PK_loslocation')
BEGIN
	ALTER TABLE [loslocation] ALTER COLUMN  [lshopiD] int NOT NULL 
	ALTER TABLE [loslocation] ALTER COLUMN  [lLocationID] int NOT NULL 
	ALTER TABLE [loslocation] ADD  CONSTRAINT [PK_loslocation] PRIMARY KEY NONCLUSTERED ([lshopiD],[lLocationID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocationarrivaldetails' AND CONSTRAINT_NAME= 'PK_loslocationarrivaldetails')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ALTER COLUMN  [ladinterfaceid] int NOT NULL 
	ALTER TABLE [loslocationarrivaldetails] ALTER COLUMN  [ladshopid] int NOT NULL 
	ALTER TABLE [loslocationarrivaldetails] ALTER COLUMN  [ladtransid] int NOT NULL 
	ALTER TABLE [loslocationarrivaldetails] ALTER COLUMN  [laddetailid] int NOT NULL 
	ALTER TABLE [loslocationarrivaldetails] ADD  CONSTRAINT [PK_loslocationarrivaldetails] PRIMARY KEY NONCLUSTERED ([ladinterfaceid],[ladshopid],[ladtransid],[laddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoslocationGroup' AND CONSTRAINT_NAME= 'pk_loslocationgroup')
BEGIN
	ALTER TABLE [LoslocationGroup] ALTER COLUMN  [Lgcompanyid] int NOT NULL 
	ALTER TABLE [LoslocationGroup] ALTER COLUMN  [Lggroupid] int NOT NULL 
	ALTER TABLE [LoslocationGroup] ALTER COLUMN  [Lgshopid] int NOT NULL 
	ALTER TABLE [LoslocationGroup] ADD  CONSTRAINT [pk_loslocationgroup] PRIMARY KEY CLUSTERED ([Lgcompanyid],[Lggroupid],[Lgshopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocationissuedetails' AND CONSTRAINT_NAME= 'PK_loslocationissuedetails')
BEGIN
	ALTER TABLE [loslocationissuedetails] ALTER COLUMN  [lidinterfaceid] int NOT NULL 
	ALTER TABLE [loslocationissuedetails] ALTER COLUMN  [lidshopid] int NOT NULL 
	ALTER TABLE [loslocationissuedetails] ALTER COLUMN  [lidtransid] int NOT NULL 
	ALTER TABLE [loslocationissuedetails] ALTER COLUMN  [liddetailid] int NOT NULL 
	ALTER TABLE [loslocationissuedetails] ADD  CONSTRAINT [PK_loslocationissuedetails] PRIMARY KEY NONCLUSTERED ([lidinterfaceid],[lidshopid],[lidtransid],[liddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLPDetail' AND CONSTRAINT_NAME= 'pk_losLPDetail')
BEGIN
	ALTER TABLE [losLPDetail] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losLPDetail] ALTER COLUMN  [POID] int NOT NULL 
	ALTER TABLE [losLPDetail] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [losLPDetail] ADD  CONSTRAINT [pk_losLPDetail] PRIMARY KEY CLUSTERED ([ShopID],[POID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLPHeader' AND CONSTRAINT_NAME= 'pk_losLPHeader')
BEGIN
	ALTER TABLE [losLPHeader] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losLPHeader] ALTER COLUMN  [POID] int NOT NULL 
	ALTER TABLE [losLPHeader] ADD  CONSTRAINT [pk_losLPHeader] PRIMARY KEY CLUSTERED ([ShopID],[POID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losNonRestrictedItems' AND CONSTRAINT_NAME= 'PK_losNonRestrictedItems')
BEGIN
	ALTER TABLE [losNonRestrictedItems] ALTER COLUMN  [NorItemID] int NOT NULL 
	ALTER TABLE [losNonRestrictedItems] ALTER COLUMN  [Norshopid] int NOT NULL 
	ALTER TABLE [losNonRestrictedItems] ALTER COLUMN  [nortype] char(1) NOT NULL 
	ALTER TABLE [losNonRestrictedItems] ADD  CONSTRAINT [PK_losNonRestrictedItems] PRIMARY KEY CLUSTERED ([NorItemID],[Norshopid],[nortype])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPackingListHeader' AND CONSTRAINT_NAME= 'pk_LosPackingListHeader')
BEGIN
	ALTER TABLE [LosPackingListHeader] ALTER COLUMN  [plhShopId] int NOT NULL 
	ALTER TABLE [LosPackingListHeader] ALTER COLUMN  [plhPackListId] int NOT NULL 
	ALTER TABLE [LosPackingListHeader] ADD  CONSTRAINT [pk_LosPackingListHeader] PRIMARY KEY CLUSTERED ([plhShopId],[plhPackListId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND CONSTRAINT_NAME= 'PK_LOsPaymentVoucherDetails')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] ALTER COLUMN  [pdPaymentVoucherID] int NOT NULL 
	ALTER TABLE [LOsPaymentVoucherDetails] ALTER COLUMN  [pdPaymentID] int NOT NULL 
	ALTER TABLE [LOsPaymentVoucherDetails] ALTER COLUMN  [pdShopID] int NOT NULL 
	ALTER TABLE [LOsPaymentVoucherDetails] ADD  CONSTRAINT [PK_LOsPaymentVoucherDetails] PRIMARY KEY NONCLUSTERED ([pdPaymentVoucherID],[pdPaymentID],[pdShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'PK_LOsPaymentVoucherHeader')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ALTER COLUMN  [phPaymentID] int NOT NULL 
	ALTER TABLE [LOsPaymentVoucherHeader] ALTER COLUMN  [phShopID] int NOT NULL 
	ALTER TABLE [LOsPaymentVoucherHeader] ADD  CONSTRAINT [PK_LOsPaymentVoucherHeader] PRIMARY KEY NONCLUSTERED ([phPaymentID],[phShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losPosChequeDetails' AND CONSTRAINT_NAME= 'PK_losPosChequeDetails')
BEGIN
	ALTER TABLE [losPosChequeDetails] ALTER COLUMN  [PosChequeId] int NOT NULL 
	ALTER TABLE [losPosChequeDetails] ALTER COLUMN  [PoshBillID] int NOT NULL 
	ALTER TABLE [losPosChequeDetails] ALTER COLUMN  [PoshShopID] int NOT NULL 
	ALTER TABLE [losPosChequeDetails] ADD  CONSTRAINT [PK_losPosChequeDetails] PRIMARY KEY CLUSTERED ([PosChequeId],[PoshBillID],[PoshShopID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosDetail' AND CONSTRAINT_NAME= 'PK_LOsPosDetail')
BEGIN
	ALTER TABLE [LOsPosDetail] ALTER COLUMN  [posdShopID] int NOT NULL 
	ALTER TABLE [LOsPosDetail] ALTER COLUMN  [posdBillID] int NOT NULL 
	ALTER TABLE [LOsPosDetail] ALTER COLUMN  [posdItemID] int NOT NULL 
	ALTER TABLE [LOsPosDetail] ALTER COLUMN  [posdPackingTypeID] int NOT NULL 
	ALTER TABLE [LOsPosDetail] ALTER COLUMN  [posdKitID] int NOT NULL 
	ALTER TABLE [LOsPosDetail] ADD  CONSTRAINT [PK_LOsPosDetail] PRIMARY KEY NONCLUSTERED ([posdShopID],[posdBillID],[posdItemID],[posdPackingTypeID],[posdKitID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeDetail' AND CONSTRAINT_NAME= 'PK_losposExchangeDetail')
BEGIN
	ALTER TABLE [losposExchangeDetail] ALTER COLUMN  [sedShopID] int NOT NULL 
	ALTER TABLE [losposExchangeDetail] ALTER COLUMN  [sedExchangeID] int NOT NULL 
	ALTER TABLE [losposExchangeDetail] ALTER COLUMN  [sedExchangedetailID] int NOT NULL 
	ALTER TABLE [losposExchangeDetail] ADD  CONSTRAINT [PK_losposExchangeDetail] PRIMARY KEY NONCLUSTERED ([sedShopID],[sedExchangeID],[sedExchangedetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeHeader' AND CONSTRAINT_NAME= 'PK_losposExchangeHeader')
BEGIN
	ALTER TABLE [losposExchangeHeader] ALTER COLUMN  [sehShopID] int NOT NULL 
	ALTER TABLE [losposExchangeHeader] ALTER COLUMN  [sehExchangeID] int NOT NULL 
	ALTER TABLE [losposExchangeHeader] ADD  CONSTRAINT [PK_losposExchangeHeader] PRIMARY KEY NONCLUSTERED ([sehShopID],[sehExchangeID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND CONSTRAINT_NAME= 'PK_losposExchangeOtherCharges')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] ALTER COLUMN  [seoShopID] int NOT NULL 
	ALTER TABLE [losposExchangeOtherCharges] ALTER COLUMN  [seoExchangeID] int NOT NULL 
	ALTER TABLE [losposExchangeOtherCharges] ALTER COLUMN  [seoAccID] int NOT NULL 
	ALTER TABLE [losposExchangeOtherCharges] ADD  CONSTRAINT [PK_losposExchangeOtherCharges] PRIMARY KEY NONCLUSTERED ([seoShopID],[seoExchangeID],[seoAccID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND CONSTRAINT_NAME= 'PK_losposExchangeSubItemDetails')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ALTER COLUMN  [seidShopID] int NOT NULL 
	ALTER TABLE [losposExchangeSubItemDetails] ALTER COLUMN  [seidExchangeID] int NOT NULL 
	ALTER TABLE [losposExchangeSubItemDetails] ALTER COLUMN  [seidExchangeDetailID] int NOT NULL 
	ALTER TABLE [losposExchangeSubItemDetails] ADD  CONSTRAINT [PK_losposExchangeSubItemDetails] PRIMARY KEY NONCLUSTERED ([seidShopID],[seidExchangeID],[seidExchangeDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPosFAndBHeader' AND CONSTRAINT_NAME= 'PK_LosPosFAndBHeader')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ALTER COLUMN  [poshShopID] int NOT NULL 
	ALTER TABLE [LosPosFAndBHeader] ALTER COLUMN  [poshBillID] int NOT NULL 
	ALTER TABLE [LosPosFAndBHeader] ADD  CONSTRAINT [PK_LosPosFAndBHeader] PRIMARY KEY NONCLUSTERED ([poshShopID],[poshBillID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosHeader' AND CONSTRAINT_NAME= 'PK_LOsPosHeader')
BEGIN
	ALTER TABLE [LOsPosHeader] ALTER COLUMN  [poshShopID] int NOT NULL 
	ALTER TABLE [LOsPosHeader] ALTER COLUMN  [poshBillID] int NOT NULL 
	ALTER TABLE [LOsPosHeader] ADD  CONSTRAINT [PK_LOsPosHeader] PRIMARY KEY NONCLUSTERED ([poshShopID],[poshBillID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosOthercharges' AND CONSTRAINT_NAME= 'PK_LOsPosOthercharges')
BEGIN
	ALTER TABLE [LOsPosOthercharges] ALTER COLUMN  [posoShopID] int NOT NULL 
	ALTER TABLE [LOsPosOthercharges] ALTER COLUMN  [posoBillID] int NOT NULL 
	ALTER TABLE [LOsPosOthercharges] ALTER COLUMN  [posoAccID] int NOT NULL 
	ALTER TABLE [LOsPosOthercharges] ADD  CONSTRAINT [PK_LOsPosOthercharges] PRIMARY KEY NONCLUSTERED ([posoShopID],[posoBillID],[posoAccID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND CONSTRAINT_NAME= 'PK_LOsPosSubItemDetail')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ALTER COLUMN  [posidshopid] int NOT NULL 
	ALTER TABLE [LOsPosSubItemDetail] ALTER COLUMN  [posidbillid] int NOT NULL 
	ALTER TABLE [LOsPosSubItemDetail] ALTER COLUMN  [posiditemid] int NOT NULL 
	ALTER TABLE [LOsPosSubItemDetail] ALTER COLUMN  [posidsubitemid] int NOT NULL 
	ALTER TABLE [LOsPosSubItemDetail] ALTER COLUMN  [posidpackingtypeid] int NOT NULL 
	ALTER TABLE [LOsPosSubItemDetail] ADD  CONSTRAINT [PK_LOsPosSubItemDetail] PRIMARY KEY NONCLUSTERED ([posidshopid],[posidbillid],[posiditemid],[posidsubitemid],[posidpackingtypeid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND CONSTRAINT_NAME= 'PK_LOspPurchaseBillDetail')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ALTER COLUMN  [pbdBillID] int NOT NULL 
	ALTER TABLE [LOspPurchaseBillDetail] ALTER COLUMN  [pbdItemID] int NOT NULL 
	ALTER TABLE [LOspPurchaseBillDetail] ALTER COLUMN  [pbdDetailID] int NOT NULL 
	ALTER TABLE [LOspPurchaseBillDetail] ADD  CONSTRAINT [PK_LOspPurchaseBillDetail] PRIMARY KEY NONCLUSTERED ([pbdBillID],[pbdItemID],[pbdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND CONSTRAINT_NAME= 'PK_LOspPurchaseBillHeader')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ALTER COLUMN  [pbhBillID] int NOT NULL 
	ALTER TABLE [LOspPurchaseBillHeader] ADD  CONSTRAINT [PK_LOspPurchaseBillHeader] PRIMARY KEY NONCLUSTERED ([pbhBillID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillOC' AND CONSTRAINT_NAME= 'PK_LOspPurchaseBillOC')
BEGIN
	ALTER TABLE [LOspPurchaseBillOC] ALTER COLUMN  [pboBillID] int NOT NULL 
	ALTER TABLE [LOspPurchaseBillOC] ALTER COLUMN  [pboAccID] int NOT NULL 
	ALTER TABLE [LOspPurchaseBillOC] ADD  CONSTRAINT [PK_LOspPurchaseBillOC] PRIMARY KEY NONCLUSTERED ([pboBillID],[pboAccID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND CONSTRAINT_NAME= 'PK_losPurchaseOrderDetail')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ALTER COLUMN  [podPoid] int NOT NULL 
	ALTER TABLE [losPurchaseOrderDetail] ALTER COLUMN  [poditemid] int NOT NULL 
	ALTER TABLE [losPurchaseOrderDetail] ALTER COLUMN  [podShopid] int NOT NULL 
	ALTER TABLE [losPurchaseOrderDetail] ADD  CONSTRAINT [PK_losPurchaseOrderDetail] PRIMARY KEY NONCLUSTERED ([podPoid],[poditemid],[podShopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND CONSTRAINT_NAME= 'PK_losPurchaseOrderHeader')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ALTER COLUMN  [pohPoid] int NOT NULL 
	ALTER TABLE [losPurchaseOrderHeader] ALTER COLUMN  [pohShopid] int NOT NULL 
	ALTER TABLE [losPurchaseOrderHeader] ADD  CONSTRAINT [PK_losPurchaseOrderHeader] PRIMARY KEY NONCLUSTERED ([pohPoid],[pohShopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losrebateconfirmdetail' AND CONSTRAINT_NAME= 'PK_losrebateconfirmdetail')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] ALTER COLUMN  [rcdshopid] int NOT NULL 
	ALTER TABLE [losrebateconfirmdetail] ALTER COLUMN  [rcdapprovedid] int NOT NULL 
	ALTER TABLE [losrebateconfirmdetail] ALTER COLUMN  [rcddetailid] int NOT NULL 
	ALTER TABLE [losrebateconfirmdetail] ADD  CONSTRAINT [PK_losrebateconfirmdetail] PRIMARY KEY NONCLUSTERED ([rcdshopid],[rcdapprovedid],[rcddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losrebateconfirmheader' AND CONSTRAINT_NAME= 'PK_losrebateconfirmheader')
BEGIN
	ALTER TABLE [losrebateconfirmheader] ALTER COLUMN  [rcshopid] int NOT NULL 
	ALTER TABLE [losrebateconfirmheader] ALTER COLUMN  [rcapprovedid] int NOT NULL 
	ALTER TABLE [losrebateconfirmheader] ADD  CONSTRAINT [PK_losrebateconfirmheader] PRIMARY KEY NONCLUSTERED ([rcshopid],[rcapprovedid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losrebaterequest' AND CONSTRAINT_NAME= 'PK_losrebaterequest')
BEGIN
	ALTER TABLE [losrebaterequest] ALTER COLUMN  [rrshopid] int NOT NULL 
	ALTER TABLE [losrebaterequest] ALTER COLUMN  [rrreqid] int NOT NULL 
	ALTER TABLE [losrebaterequest] ADD  CONSTRAINT [PK_losrebaterequest] PRIMARY KEY NONCLUSTERED ([rrshopid],[rrreqid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND CONSTRAINT_NAME= 'PK_LOsReceiptVoucherDetails')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ALTER COLUMN  [rdReceiptDetailID] int NOT NULL 
	ALTER TABLE [LOsReceiptVoucherDetails] ALTER COLUMN  [rdReceiptID] int NOT NULL 
	ALTER TABLE [LOsReceiptVoucherDetails] ALTER COLUMN  [rdShopID] int NOT NULL 
	ALTER TABLE [LOsReceiptVoucherDetails] ADD  CONSTRAINT [PK_LOsReceiptVoucherDetails] PRIMARY KEY NONCLUSTERED ([rdReceiptDetailID],[rdReceiptID],[rdShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND CONSTRAINT_NAME= 'PK_LOsReceiptVoucherHeader')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ALTER COLUMN  [rhReceiptID] int NOT NULL 
	ALTER TABLE [LOsReceiptVoucherHeader] ALTER COLUMN  [rhShopID] int NOT NULL 
	ALTER TABLE [LOsReceiptVoucherHeader] ADD  CONSTRAINT [PK_LOsReceiptVoucherHeader] PRIMARY KEY NONCLUSTERED ([rhReceiptID],[rhShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacereceivedetails' AND CONSTRAINT_NAME= 'PK_losreplacereceivedetails')
BEGIN
	ALTER TABLE [losreplacereceivedetails] ALTER COLUMN  [reprecdid] int NOT NULL 
	ALTER TABLE [losreplacereceivedetails] ALTER COLUMN  [reprecdcompanyid] int NOT NULL 
	ALTER TABLE [losreplacereceivedetails] ALTER COLUMN  [reprecdshopid] int NOT NULL 
	ALTER TABLE [losreplacereceivedetails] ALTER COLUMN  [reprecditemid] int NOT NULL 
	ALTER TABLE [losreplacereceivedetails] ALTER COLUMN  [reprecdbookid] int NOT NULL 
	ALTER TABLE [losreplacereceivedetails] ALTER COLUMN  [repRepReqID] int NOT NULL 
	ALTER TABLE [losreplacereceivedetails] ADD  CONSTRAINT [PK_losreplacereceivedetails] PRIMARY KEY CLUSTERED ([reprecdid],[reprecdcompanyid],[reprecdshopid],[reprecditemid],[reprecdbookid],[repRepReqID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacereceiveheader' AND CONSTRAINT_NAME= 'PK_losreplacereceiveheader')
BEGIN
	ALTER TABLE [losreplacereceiveheader] ALTER COLUMN  [reprechid] int NOT NULL 
	ALTER TABLE [losreplacereceiveheader] ALTER COLUMN  [reprechcompanyid] int NOT NULL 
	ALTER TABLE [losreplacereceiveheader] ALTER COLUMN  [reprechshopid] int NOT NULL 
	ALTER TABLE [losreplacereceiveheader] ADD  CONSTRAINT [PK_losreplacereceiveheader] PRIMARY KEY NONCLUSTERED ([reprechid],[reprechcompanyid],[reprechshopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacerequestdetails' AND CONSTRAINT_NAME= 'PK_losreplacerequestdetails')
BEGIN
	ALTER TABLE [losreplacerequestdetails] ALTER COLUMN  [repreqdid] int NOT NULL 
	ALTER TABLE [losreplacerequestdetails] ALTER COLUMN  [repreqdcompanyid] int NOT NULL 
	ALTER TABLE [losreplacerequestdetails] ALTER COLUMN  [repreqdshopid] int NOT NULL 
	ALTER TABLE [losreplacerequestdetails] ALTER COLUMN  [repreqditemid] int NOT NULL 
	ALTER TABLE [losreplacerequestdetails] ALTER COLUMN  [repreqdbookid] int NOT NULL 
	ALTER TABLE [losreplacerequestdetails] ADD  CONSTRAINT [PK_losreplacerequestdetails] PRIMARY KEY NONCLUSTERED ([repreqdid],[repreqdcompanyid],[repreqdshopid],[repreqditemid],[repreqdbookid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacerequestheader' AND CONSTRAINT_NAME= 'PK_losreplacerequestheader')
BEGIN
	ALTER TABLE [losreplacerequestheader] ALTER COLUMN  [repreqhid] int NOT NULL 
	ALTER TABLE [losreplacerequestheader] ALTER COLUMN  [repreqhcompanyid] int NOT NULL 
	ALTER TABLE [losreplacerequestheader] ALTER COLUMN  [repreqshopid] int NOT NULL 
	ALTER TABLE [losreplacerequestheader] ADD  CONSTRAINT [PK_losreplacerequestheader] PRIMARY KEY NONCLUSTERED ([repreqhid],[repreqhcompanyid],[repreqshopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosReservationHeader' AND CONSTRAINT_NAME= 'pk_LosReservationHeader')
BEGIN
	ALTER TABLE [LosReservationHeader] ALTER COLUMN  [rhcompanyid] int NOT NULL 
	ALTER TABLE [LosReservationHeader] ALTER COLUMN  [rhshopid] int NOT NULL 
	ALTER TABLE [LosReservationHeader] ALTER COLUMN  [rhreservationid] int NOT NULL 
	ALTER TABLE [LosReservationHeader] ADD  CONSTRAINT [pk_LosReservationHeader] PRIMARY KEY CLUSTERED ([rhcompanyid],[rhshopid],[rhreservationid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosReserveItem' AND CONSTRAINT_NAME= 'PK_LosReserveItem')
BEGIN
	ALTER TABLE [LosReserveItem] ALTER COLUMN  [godownid] int NOT NULL 
	ALTER TABLE [LosReserveItem] ALTER COLUMN  [itemid] int NOT NULL 
	ALTER TABLE [LosReserveItem] ALTER COLUMN  [locationid] int NOT NULL 
	ALTER TABLE [LosReserveItem] ALTER COLUMN  [shipmentid] int NOT NULL 
	ALTER TABLE [LosReserveItem] ADD  CONSTRAINT [PK_LosReserveItem] PRIMARY KEY NONCLUSTERED ([godownid],[itemid],[locationid],[shipmentid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losroomdetail' AND CONSTRAINT_NAME= 'PK_losroomdetail')
BEGIN
	ALTER TABLE [losroomdetail] ALTER COLUMN  [rdcompanyid] int NOT NULL 
	ALTER TABLE [losroomdetail] ALTER COLUMN  [rdapartmentid] int NOT NULL 
	ALTER TABLE [losroomdetail] ALTER COLUMN  [rdshopid] int NOT NULL 
	ALTER TABLE [losroomdetail] ALTER COLUMN  [rdroomdetailid] int NOT NULL 
	ALTER TABLE [losroomdetail] ADD  CONSTRAINT [PK_losroomdetail] PRIMARY KEY NONCLUSTERED ([rdcompanyid],[rdapartmentid],[rdshopid],[rdroomdetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losserconditiondetails' AND CONSTRAINT_NAME= 'pk_losserconditiondetails')
BEGIN
	ALTER TABLE [losserconditiondetails] ALTER COLUMN  [cndserbookdid] int NOT NULL 
	ALTER TABLE [losserconditiondetails] ALTER COLUMN  [cndserid] int NOT NULL 
	ALTER TABLE [losserconditiondetails] ALTER COLUMN  [cndserdcompanyid] int NOT NULL 
	ALTER TABLE [losserconditiondetails] ALTER COLUMN  [cndserdshopid] int NOT NULL 
	ALTER TABLE [losserconditiondetails] ADD  CONSTRAINT [pk_losserconditiondetails] PRIMARY KEY NONCLUSTERED ([cndserbookdid],[cndserid],[cndserdcompanyid],[cndserdshopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerestimateapproval' AND CONSTRAINT_NAME= 'PK_losSerestimateapproval')
BEGIN
	ALTER TABLE [losSerestimateapproval] ALTER COLUMN  [seaAppShopId] int NOT NULL 
	ALTER TABLE [losSerestimateapproval] ALTER COLUMN  [seaAppId] int NOT NULL 
	ALTER TABLE [losSerestimateapproval] ALTER COLUMN  [seaAppcompanyID] int NOT NULL 
	ALTER TABLE [losSerestimateapproval] ADD  CONSTRAINT [PK_losSerestimateapproval] PRIMARY KEY NONCLUSTERED ([seaAppShopId],[seaAppId],[seaAppcompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerialNoVerificationHeader' AND CONSTRAINT_NAME= 'PK_losSerialNoVerificationHeader')
BEGIN
	ALTER TABLE [losSerialNoVerificationHeader] ALTER COLUMN  [svhCompanyID] int NOT NULL 
	ALTER TABLE [losSerialNoVerificationHeader] ALTER COLUMN  [svhShopID] int NOT NULL 
	ALTER TABLE [losSerialNoVerificationHeader] ALTER COLUMN  [svhID] int NOT NULL 
	ALTER TABLE [losSerialNoVerificationHeader] ADD  CONSTRAINT [PK_losSerialNoVerificationHeader] PRIMARY KEY CLUSTERED ([svhCompanyID],[svhShopID],[svhID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND CONSTRAINT_NAME= 'PK_losSerMaintenanceContractDetail')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] ALTER COLUMN  [mcdCompanyID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceContractDetail] ALTER COLUMN  [mcdID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceContractDetail] ALTER COLUMN  [mcdShopID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceContractDetail] ALTER COLUMN  [mcdPeriodDetailID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceContractDetail] ADD  CONSTRAINT [PK_losSerMaintenanceContractDetail] PRIMARY KEY NONCLUSTERED ([mcdCompanyID],[mcdID],[mcdShopID],[mcdPeriodDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND CONSTRAINT_NAME= 'PK_losSerMaintenanceContractHeader')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ALTER COLUMN  [mchCompanyID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceContractHeader] ALTER COLUMN  [mchID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceContractHeader] ALTER COLUMN  [mchShopID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceContractHeader] ADD  CONSTRAINT [PK_losSerMaintenanceContractHeader] PRIMARY KEY NONCLUSTERED ([mchCompanyID],[mchID],[mchShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND CONSTRAINT_NAME= 'PK_losSerMaintenanceMachineDetail')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] ALTER COLUMN  [mmdCompanyID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceMachineDetail] ALTER COLUMN  [mmdMCID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceMachineDetail] ALTER COLUMN  [mmdShopID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceMachineDetail] ALTER COLUMN  [mmdDetailID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceMachineDetail] ADD  CONSTRAINT [PK_losSerMaintenanceMachineDetail] PRIMARY KEY NONCLUSTERED ([mmdCompanyID],[mmdMCID],[mmdShopID],[mmdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND CONSTRAINT_NAME= 'PK_losSerMaintenanceServiceDetail')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ALTER COLUMN  [msdCompanyID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceServiceDetail] ALTER COLUMN  [msdMCID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceServiceDetail] ALTER COLUMN  [msdShopID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceServiceDetail] ALTER COLUMN  [msdDetailID] int NOT NULL 
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD  CONSTRAINT [PK_losSerMaintenanceServiceDetail] PRIMARY KEY NONCLUSTERED ([msdCompanyID],[msdMCID],[msdShopID],[msdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losserpartsfromcustomer' AND CONSTRAINT_NAME= 'PK_losserpartsfromcustomer')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ALTER COLUMN  [custprodcompanyid] int NOT NULL 
	ALTER TABLE [losserpartsfromcustomer] ALTER COLUMN  [custprodshopid] int NOT NULL 
	ALTER TABLE [losserpartsfromcustomer] ALTER COLUMN  [custprodbookingid] int NOT NULL 
	ALTER TABLE [losserpartsfromcustomer] ALTER COLUMN  [custprodproductid] int NOT NULL 
	ALTER TABLE [losserpartsfromcustomer] ADD  CONSTRAINT [PK_losserpartsfromcustomer] PRIMARY KEY NONCLUSTERED ([custprodcompanyid],[custprodshopid],[custprodbookingid],[custprodproductid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND CONSTRAINT_NAME= 'PK_losSerStandByIssueDetail')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] ALTER COLUMN  [isdCompanyID] int NOT NULL 
	ALTER TABLE [losSerStandByIssueDetail] ALTER COLUMN  [isdIssueID] int NOT NULL 
	ALTER TABLE [losSerStandByIssueDetail] ALTER COLUMN  [isdShopID] int NOT NULL 
	ALTER TABLE [losSerStandByIssueDetail] ALTER COLUMN  [isdDetailID] int NOT NULL 
	ALTER TABLE [losSerStandByIssueDetail] ADD  CONSTRAINT [PK_losSerStandByIssueDetail] PRIMARY KEY NONCLUSTERED ([isdCompanyID],[isdIssueID],[isdShopID],[isdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND CONSTRAINT_NAME= 'PK_losSerStandByIssueHeader')
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ALTER COLUMN  [ishCompanyID] int NOT NULL 
	ALTER TABLE [losSerStandByIssueHeader] ALTER COLUMN  [ishIssueID] int NOT NULL 
	ALTER TABLE [losSerStandByIssueHeader] ALTER COLUMN  [ishShopID] int NOT NULL 
	ALTER TABLE [losSerStandByIssueHeader] ADD  CONSTRAINT [PK_losSerStandByIssueHeader] PRIMARY KEY NONCLUSTERED ([ishCompanyID],[ishIssueID],[ishShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND CONSTRAINT_NAME= 'PK_losSerStandByReceiptDetail')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] ALTER COLUMN  [rdCompanyID] int NOT NULL 
	ALTER TABLE [losSerStandByReceiptDetail] ALTER COLUMN  [rdReceiptID] int NOT NULL 
	ALTER TABLE [losSerStandByReceiptDetail] ALTER COLUMN  [rdShopID] int NOT NULL 
	ALTER TABLE [losSerStandByReceiptDetail] ALTER COLUMN  [rdDetailID] int NOT NULL 
	ALTER TABLE [losSerStandByReceiptDetail] ADD  CONSTRAINT [PK_losSerStandByReceiptDetail] PRIMARY KEY NONCLUSTERED ([rdCompanyID],[rdReceiptID],[rdShopID],[rdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND CONSTRAINT_NAME= 'PK_losSerStandByReceiptHeader')
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ALTER COLUMN  [rhCompanyID] int NOT NULL 
	ALTER TABLE [losSerStandByReceiptHeader] ALTER COLUMN  [rhShopID] int NOT NULL 
	ALTER TABLE [losSerStandByReceiptHeader] ALTER COLUMN  [rhReceiptID] int NOT NULL 
	ALTER TABLE [losSerStandByReceiptHeader] ADD  CONSTRAINT [PK_losSerStandByReceiptHeader] PRIMARY KEY NONCLUSTERED ([rhCompanyID],[rhShopID],[rhReceiptID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND CONSTRAINT_NAME= 'PK_losSerStandByRequestDetail')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] ALTER COLUMN  [reqdCompanyID] int NOT NULL 
	ALTER TABLE [losSerStandByRequestDetail] ALTER COLUMN  [reqdShopID] int NOT NULL 
	ALTER TABLE [losSerStandByRequestDetail] ALTER COLUMN  [reqdRequestID] int NOT NULL 
	ALTER TABLE [losSerStandByRequestDetail] ALTER COLUMN  [reqdDetailID] int NOT NULL 
	ALTER TABLE [losSerStandByRequestDetail] ADD  CONSTRAINT [PK_losSerStandByRequestDetail] PRIMARY KEY NONCLUSTERED ([reqdCompanyID],[reqdShopID],[reqdRequestID],[reqdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND CONSTRAINT_NAME= 'PK_losSerStandByRequestHeader')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ALTER COLUMN  [reqhCompanyID] int NOT NULL 
	ALTER TABLE [losSerStandByRequestHeader] ALTER COLUMN  [reqhRequestID] int NOT NULL 
	ALTER TABLE [losSerStandByRequestHeader] ALTER COLUMN  [reqhShopID] int NOT NULL 
	ALTER TABLE [losSerStandByRequestHeader] ADD  CONSTRAINT [PK_losSerStandByRequestHeader] PRIMARY KEY NONCLUSTERED ([reqhCompanyID],[reqhRequestID],[reqhShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND CONSTRAINT_NAME= 'PK_lossertoolsallocationdetail')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] ALTER COLUMN  [alcdCompanyId] int NOT NULL 
	ALTER TABLE [losSerToolsAllocationDetail] ALTER COLUMN  [alcdShopid] int NOT NULL 
	ALTER TABLE [losSerToolsAllocationDetail] ALTER COLUMN  [alcdid] int NOT NULL 
	ALTER TABLE [losSerToolsAllocationDetail] ALTER COLUMN  [alcddetailid] int NOT NULL 
	ALTER TABLE [losSerToolsAllocationDetail] ADD  CONSTRAINT [PK_lossertoolsallocationdetail] PRIMARY KEY NONCLUSTERED ([alcdCompanyId],[alcdShopid],[alcdid],[alcddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND CONSTRAINT_NAME= 'PK_lossertoolsallocationheader')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] ALTER COLUMN  [alchCompanyId] int NOT NULL 
	ALTER TABLE [losSerToolsAllocationHeader] ALTER COLUMN  [alchShopid] int NOT NULL 
	ALTER TABLE [losSerToolsAllocationHeader] ALTER COLUMN  [alchid] int NOT NULL 
	ALTER TABLE [losSerToolsAllocationHeader] ADD  CONSTRAINT [PK_lossertoolsallocationheader] PRIMARY KEY NONCLUSTERED ([alchCompanyId],[alchShopid],[alchid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosserToolsReturnDetail' AND CONSTRAINT_NAME= 'PK_LosserToolsReturnDetail')
BEGIN
	ALTER TABLE [LosserToolsReturnDetail] ALTER COLUMN  [tlretdCompanyId] int NOT NULL 
	ALTER TABLE [LosserToolsReturnDetail] ALTER COLUMN  [tlretdShopid] int NOT NULL 
	ALTER TABLE [LosserToolsReturnDetail] ALTER COLUMN  [tlretdid] int NOT NULL 
	ALTER TABLE [LosserToolsReturnDetail] ALTER COLUMN  [tlretdetailid] int NOT NULL 
	ALTER TABLE [LosserToolsReturnDetail] ADD  CONSTRAINT [PK_LosserToolsReturnDetail] PRIMARY KEY NONCLUSTERED ([tlretdCompanyId],[tlretdShopid],[tlretdid],[tlretdetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND CONSTRAINT_NAME= 'PK_LosserToolsReturnHeader')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] ALTER COLUMN  [tlrethCompanyId] int NOT NULL 
	ALTER TABLE [LosserToolsReturnHeader] ALTER COLUMN  [tlrethShopid] int NOT NULL 
	ALTER TABLE [LosserToolsReturnHeader] ALTER COLUMN  [tlrethid] int NOT NULL 
	ALTER TABLE [LosserToolsReturnHeader] ADD  CONSTRAINT [PK_LosserToolsReturnHeader] PRIMARY KEY NONCLUSTERED ([tlrethCompanyId],[tlrethShopid],[tlrethid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losServiceBookingHeader' AND CONSTRAINT_NAME= 'PK_LOSSERVICEBOOKINGHEADER')
BEGIN
	ALTER TABLE [losServiceBookingHeader] ALTER COLUMN  [serbookhid] int NOT NULL 
	ALTER TABLE [losServiceBookingHeader] ALTER COLUMN  [serbookhshopid] int NOT NULL 
	ALTER TABLE [losServiceBookingHeader] ALTER COLUMN  [serbookhcompanyid] int NOT NULL 
	ALTER TABLE [losServiceBookingHeader] ADD  CONSTRAINT [PK_LOSSERVICEBOOKINGHEADER] PRIMARY KEY NONCLUSTERED ([serbookhid],[serbookhshopid],[serbookhcompanyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losServiceHeader' AND CONSTRAINT_NAME= 'PK_losserviceheader')
BEGIN
	ALTER TABLE [losServiceHeader] ALTER COLUMN  [serinvhid] int NOT NULL 
	ALTER TABLE [losServiceHeader] ALTER COLUMN  [serinvhcompanyid] int NOT NULL 
	ALTER TABLE [losServiceHeader] ALTER COLUMN  [serinvhshopid] int NOT NULL 
	ALTER TABLE [losServiceHeader] ADD  CONSTRAINT [PK_losserviceheader] PRIMARY KEY NONCLUSTERED ([serinvhid],[serinvhcompanyid],[serinvhshopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosServiceInvHeader' AND CONSTRAINT_NAME= 'pk_losserviceinvheader')
BEGIN
	ALTER TABLE [LosServiceInvHeader] ALTER COLUMN  [serinvhid] int NOT NULL 
	ALTER TABLE [LosServiceInvHeader] ALTER COLUMN  [serinvhshopid] int NOT NULL 
	ALTER TABLE [LosServiceInvHeader] ALTER COLUMN  [serinvhcompanyid] int NOT NULL 
	ALTER TABLE [LosServiceInvHeader] ADD  CONSTRAINT [pk_losserviceinvheader] PRIMARY KEY CLUSTERED ([serinvhid],[serinvhshopid],[serinvhcompanyid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND CONSTRAINT_NAME= 'PK_LOsServiceInvoiceDetails')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ALTER COLUMN  [siInvoiceDetailID] int NOT NULL 
	ALTER TABLE [LOsServiceInvoiceDetails] ALTER COLUMN  [siInvoiceID] int NOT NULL 
	ALTER TABLE [LOsServiceInvoiceDetails] ALTER COLUMN  [siShopID] int NOT NULL 
	ALTER TABLE [LOsServiceInvoiceDetails] ADD  CONSTRAINT [PK_LOsServiceInvoiceDetails] PRIMARY KEY NONCLUSTERED ([siInvoiceDetailID],[siInvoiceID],[siShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND CONSTRAINT_NAME= 'PK_losservinvoicetechniciandetails')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ALTER COLUMN  [serinvtechcompanyid] int NOT NULL 
	ALTER TABLE [losservinvoicetechniciandetails] ALTER COLUMN  [sertechinvid] int NOT NULL 
	ALTER TABLE [losservinvoicetechniciandetails] ALTER COLUMN  [serinvtechshopid] int NOT NULL 
	ALTER TABLE [losservinvoicetechniciandetails] ALTER COLUMN  [serinvtechdetailid] int NOT NULL 
	ALTER TABLE [losservinvoicetechniciandetails] ALTER COLUMN  [serinvTechServiceID] int NOT NULL 
	ALTER TABLE [losservinvoicetechniciandetails] ADD  CONSTRAINT [PK_losservinvoicetechniciandetails] PRIMARY KEY NONCLUSTERED ([serinvtechcompanyid],[sertechinvid],[serinvtechshopid],[serinvtechdetailid],[serinvTechServiceID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsSettings' AND CONSTRAINT_NAME= 'PK_LOsSettings')
BEGIN
	ALTER TABLE [LOsSettings] ALTER COLUMN  [ShopId] int NOT NULL 
	ALTER TABLE [LOsSettings] ADD  CONSTRAINT [PK_LOsSettings] PRIMARY KEY NONCLUSTERED ([ShopId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosShipmentbndetail' AND CONSTRAINT_NAME= 'PK_LosShipmentbhdetail')
BEGIN
	ALTER TABLE [LosShipmentbndetail] ALTER COLUMN  [bndShopId] int NOT NULL 
	ALTER TABLE [LosShipmentbndetail] ALTER COLUMN  [bndboatnoteId] int NOT NULL 
	ALTER TABLE [LosShipmentbndetail] ALTER COLUMN  [bnddetailId] int NOT NULL 
	ALTER TABLE [LosShipmentbndetail] ADD  CONSTRAINT [PK_LosShipmentbhdetail] PRIMARY KEY NONCLUSTERED ([bndShopId],[bndboatnoteId],[bnddetailId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosShipmentbnheader' AND CONSTRAINT_NAME= 'PK_LosShipmentbhheader')
BEGIN
	ALTER TABLE [LosShipmentbnheader] ALTER COLUMN  [bnhShopId] int NOT NULL 
	ALTER TABLE [LosShipmentbnheader] ALTER COLUMN  [bnhboatnoteId] int NOT NULL 
	ALTER TABLE [LosShipmentbnheader] ADD  CONSTRAINT [PK_LosShipmentbhheader] PRIMARY KEY NONCLUSTERED ([bnhShopId],[bnhboatnoteId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShipmentBNOCDetail' AND CONSTRAINT_NAME= 'pk_losShipmentOCDetail')
BEGIN
	ALTER TABLE [losShipmentBNOCDetail] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [losShipmentBNOCDetail] ALTER COLUMN  [BoatNoteID] int NOT NULL 
	ALTER TABLE [losShipmentBNOCDetail] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [losShipmentBNOCDetail] ADD  CONSTRAINT [pk_losShipmentOCDetail] PRIMARY KEY CLUSTERED ([ShopID],[BoatNoteID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND CONSTRAINT_NAME= 'PK_LOsShopDamageClearingDetails')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] ALTER COLUMN  [dcdClearingID] int NOT NULL 
	ALTER TABLE [LOsShopDamageClearingDetails] ALTER COLUMN  [dcdShipmentID] int NOT NULL 
	ALTER TABLE [LOsShopDamageClearingDetails] ALTER COLUMN  [dcdItemID] int NOT NULL 
	ALTER TABLE [LOsShopDamageClearingDetails] ALTER COLUMN  [dcdShopid] int NOT NULL 
	ALTER TABLE [LOsShopDamageClearingDetails] ADD  CONSTRAINT [PK_LOsShopDamageClearingDetails] PRIMARY KEY NONCLUSTERED ([dcdClearingID],[dcdShipmentID],[dcdItemID],[dcdShopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND CONSTRAINT_NAME= 'PK_LOsShopDamageClearingHeader')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ALTER COLUMN  [dchClearingID] int NOT NULL 
	ALTER TABLE [LOsShopDamageClearingHeader] ALTER COLUMN  [dchShopid] int NOT NULL 
	ALTER TABLE [LOsShopDamageClearingHeader] ADD  CONSTRAINT [PK_LOsShopDamageClearingHeader] PRIMARY KEY NONCLUSTERED ([dchClearingID],[dchShopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShopItemDiffPriceLevels' AND CONSTRAINT_NAME= 'PK_losShopItemDiffPriceLevels')
BEGIN
	ALTER TABLE [losShopItemDiffPriceLevels] ALTER COLUMN  [IpID] int NOT NULL 
	ALTER TABLE [losShopItemDiffPriceLevels] ADD  CONSTRAINT [PK_losShopItemDiffPriceLevels] PRIMARY KEY CLUSTERED ([IpID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND CONSTRAINT_NAME= 'PK_losShopItemShipmentDetail')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ALTER COLUMN  [ipid] int NOT NULL 
	ALTER TABLE [losShopItemShipmentDetail] ADD  CONSTRAINT [PK_losShopItemShipmentDetail] PRIMARY KEY CLUSTERED ([ipid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShopTransactionsSummary' AND CONSTRAINT_NAME= 'PK_ShopStockSummary')
BEGIN
	ALTER TABLE [losShopTransactionsSummary] ALTER COLUMN  [ShopId] int NOT NULL 
	ALTER TABLE [losShopTransactionsSummary] ALTER COLUMN  [ItemId] int NOT NULL 
	ALTER TABLE [losShopTransactionsSummary] ADD  CONSTRAINT [PK_ShopStockSummary] PRIMARY KEY CLUSTERED ([ShopId],[ItemId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationDetail' AND CONSTRAINT_NAME= 'PK_losSIQuotationDetail')
BEGIN
	ALTER TABLE [losSIQuotationDetail] ALTER COLUMN  [idInvoiceId] int NOT NULL 
	ALTER TABLE [losSIQuotationDetail] ALTER COLUMN  [idGodownID] int NOT NULL 
	ALTER TABLE [losSIQuotationDetail] ALTER COLUMN  [idItemid] int NOT NULL 
	ALTER TABLE [losSIQuotationDetail] ALTER COLUMN  [idShopid] int NOT NULL 
	ALTER TABLE [losSIQuotationDetail] ALTER COLUMN  [locationid] int NOT NULL 
	ALTER TABLE [losSIQuotationDetail] ALTER COLUMN  [shipmentid] int NOT NULL 
	ALTER TABLE [losSIQuotationDetail] ADD  CONSTRAINT [PK_losSIQuotationDetail] PRIMARY KEY NONCLUSTERED ([idInvoiceId],[idGodownID],[idItemid],[idShopid],[locationid],[shipmentid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'PK_losSIQuotationHeader')
BEGIN
	ALTER TABLE [losSIQuotationHeader] ALTER COLUMN  [IhInvoiceID] int NOT NULL 
	ALTER TABLE [losSIQuotationHeader] ALTER COLUMN  [IhShopID] int NOT NULL 
	ALTER TABLE [losSIQuotationHeader] ADD  CONSTRAINT [PK_losSIQuotationHeader] PRIMARY KEY NONCLUSTERED ([IhInvoiceID],[IhShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND CONSTRAINT_NAME= 'PK_losSpecialInvoiceDetail')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ALTER COLUMN  [idInvoiceId] int NOT NULL 
	ALTER TABLE [losSpecialInvoiceDetail] ALTER COLUMN  [idGodownID] int NOT NULL 
	ALTER TABLE [losSpecialInvoiceDetail] ALTER COLUMN  [idItemid] int NOT NULL 
	ALTER TABLE [losSpecialInvoiceDetail] ALTER COLUMN  [idShopid] int NOT NULL 
	ALTER TABLE [losSpecialInvoiceDetail] ALTER COLUMN  [locationid] int NOT NULL 
	ALTER TABLE [losSpecialInvoiceDetail] ALTER COLUMN  [shipmentid] int NOT NULL 
	ALTER TABLE [losSpecialInvoiceDetail] ALTER COLUMN  [idKitID] int NOT NULL 
	ALTER TABLE [losSpecialInvoiceDetail] ADD  CONSTRAINT [PK_losSpecialInvoiceDetail] PRIMARY KEY NONCLUSTERED ([idInvoiceId],[idGodownID],[idItemid],[idShopid],[locationid],[shipmentid],[idKitID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'PK_losSpecialInvoiceHeader')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ALTER COLUMN  [IhInvoiceID] int NOT NULL 
	ALTER TABLE [losSpecialInvoiceHeader] ALTER COLUMN  [IhShopID] int NOT NULL 
	ALTER TABLE [losSpecialInvoiceHeader] ADD  CONSTRAINT [PK_losSpecialInvoiceHeader] PRIMARY KEY NONCLUSTERED ([IhInvoiceID],[IhShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialOC' AND CONSTRAINT_NAME= 'PK_losSpecialOC')
BEGIN
	ALTER TABLE [losSpecialOC] ALTER COLUMN  [ioShopid] int NOT NULL 
	ALTER TABLE [losSpecialOC] ALTER COLUMN  [ioInvoiceID] int NOT NULL 
	ALTER TABLE [losSpecialOC] ALTER COLUMN  [ioAccid] int NOT NULL 
	ALTER TABLE [losSpecialOC] ADD  CONSTRAINT [PK_losSpecialOC] PRIMARY KEY NONCLUSTERED ([ioShopid],[ioInvoiceID],[ioAccid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockRecovery' AND CONSTRAINT_NAME= 'PK_losStockRecovery')
BEGIN
	ALTER TABLE [losStockRecovery] ALTER COLUMN  [srID] int NOT NULL 
	ALTER TABLE [losStockRecovery] ALTER COLUMN  [srShopID] int NOT NULL 
	ALTER TABLE [losStockRecovery] ADD  CONSTRAINT [PK_losStockRecovery] PRIMARY KEY NONCLUSTERED ([srID],[srShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockVerificationDetail' AND CONSTRAINT_NAME= 'PK_losStockVerificationDetail')
BEGIN
	ALTER TABLE [losStockVerificationDetail] ALTER COLUMN  [svdid] int NOT NULL 
	ALTER TABLE [losStockVerificationDetail] ALTER COLUMN  [svdShipmentID] int NOT NULL 
	ALTER TABLE [losStockVerificationDetail] ALTER COLUMN  [svditemid] int NOT NULL 
	ALTER TABLE [losStockVerificationDetail] ALTER COLUMN  [svdShopid] int NOT NULL 
	ALTER TABLE [losStockVerificationDetail] ADD  CONSTRAINT [PK_losStockVerificationDetail] PRIMARY KEY NONCLUSTERED ([svdid],[svdShipmentID],[svditemid],[svdShopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockVerificationHeader' AND CONSTRAINT_NAME= 'PK_lopStockVerificationHeader')
BEGIN
	ALTER TABLE [losStockVerificationHeader] ALTER COLUMN  [svhid] int NOT NULL 
	ALTER TABLE [losStockVerificationHeader] ALTER COLUMN  [svhShopId] int NOT NULL 
	ALTER TABLE [losStockVerificationHeader] ADD  CONSTRAINT [PK_lopStockVerificationHeader] PRIMARY KEY NONCLUSTERED ([svhid],[svhShopId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losTenantServiceBillDetail' AND CONSTRAINT_NAME= 'PK_losTenantServiceBillDetail')
BEGIN
	ALTER TABLE [losTenantServiceBillDetail] ALTER COLUMN  [tbdBillId] int NOT NULL 
	ALTER TABLE [losTenantServiceBillDetail] ALTER COLUMN  [tbdShopId] int NOT NULL 
	ALTER TABLE [losTenantServiceBillDetail] ALTER COLUMN  [tbdCompanyId] int NOT NULL 
	ALTER TABLE [losTenantServiceBillDetail] ALTER COLUMN  [tbdUtilityTransID] int NOT NULL 
	ALTER TABLE [losTenantServiceBillDetail] ALTER COLUMN  [tbddetailid] int NOT NULL 
	ALTER TABLE [losTenantServiceBillDetail] ADD  CONSTRAINT [PK_losTenantServiceBillDetail] PRIMARY KEY NONCLUSTERED ([tbdBillId],[tbdShopId],[tbdCompanyId],[tbdUtilityTransID],[tbddetailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losTenantServiceBillHeader' AND CONSTRAINT_NAME= 'PK_losTenantServiceBillHeader')
BEGIN
	ALTER TABLE [losTenantServiceBillHeader] ALTER COLUMN  [tbhBillId] int NOT NULL 
	ALTER TABLE [losTenantServiceBillHeader] ALTER COLUMN  [tbhShopId] int NOT NULL 
	ALTER TABLE [losTenantServiceBillHeader] ALTER COLUMN  [tbhCompanyId] int NOT NULL 
	ALTER TABLE [losTenantServiceBillHeader] ADD  CONSTRAINT [PK_losTenantServiceBillHeader] PRIMARY KEY NONCLUSTERED ([tbhBillId],[tbhShopId],[tbhCompanyId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND CONSTRAINT_NAME= 'PK_losTenantUtilityBillDetail')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] ALTER COLUMN  [utdBillId] int NOT NULL 
	ALTER TABLE [losTenantUtilityBillDetail] ALTER COLUMN  [utdShopId] int NOT NULL 
	ALTER TABLE [losTenantUtilityBillDetail] ALTER COLUMN  [utdCompanyId] int NOT NULL 
	ALTER TABLE [losTenantUtilityBillDetail] ALTER COLUMN  [utdServiceId] int NOT NULL 
	ALTER TABLE [losTenantUtilityBillDetail] ADD  CONSTRAINT [PK_losTenantUtilityBillDetail] PRIMARY KEY NONCLUSTERED ([utdBillId],[utdShopId],[utdCompanyId],[utdServiceId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOSTransferindetail' AND CONSTRAINT_NAME= 'PK_LOSTransferindetail')
BEGIN
	ALTER TABLE [LOSTransferindetail] ALTER COLUMN  [TIDID] int NOT NULL 
	ALTER TABLE [LOSTransferindetail] ALTER COLUMN  [TIDshopid] int NOT NULL 
	ALTER TABLE [LOSTransferindetail] ALTER COLUMN  [TIDshipmentID] int NOT NULL 
	ALTER TABLE [LOSTransferindetail] ALTER COLUMN  [TIDitemID] int NOT NULL 
	ALTER TABLE [LOSTransferindetail] ADD  CONSTRAINT [PK_LOSTransferindetail] PRIMARY KEY NONCLUSTERED ([TIDID],[TIDshopid],[TIDshipmentID],[TIDitemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOSTransferinheader' AND CONSTRAINT_NAME= 'PK_LOSTransferinheader')
BEGIN
	ALTER TABLE [LOSTransferinheader] ALTER COLUMN  [TIHShopid] int NOT NULL 
	ALTER TABLE [LOSTransferinheader] ALTER COLUMN  [TIHID] int NOT NULL 
	ALTER TABLE [LOSTransferinheader] ADD  CONSTRAINT [PK_LOSTransferinheader] PRIMARY KEY NONCLUSTERED ([TIHShopid],[TIHID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosVrRegistartionReceiveDetail' AND CONSTRAINT_NAME= 'PK_LosVrRegistartionReceiveDetail')
BEGIN
	ALTER TABLE [LosVrRegistartionReceiveDetail] ALTER COLUMN  [RegistartionReceiveId] int NOT NULL 
	ALTER TABLE [LosVrRegistartionReceiveDetail] ALTER COLUMN  [RegistartionReceiveDtlId] int NOT NULL 
	ALTER TABLE [LosVrRegistartionReceiveDetail] ADD  CONSTRAINT [PK_LosVrRegistartionReceiveDetail] PRIMARY KEY CLUSTERED ([RegistartionReceiveId],[RegistartionReceiveDtlId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND CONSTRAINT_NAME= 'PK_losWarrentyClaimDetail')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] ALTER COLUMN  [wcdCompanyID] int NOT NULL 
	ALTER TABLE [losWarrentyClaimDetail] ALTER COLUMN  [wcdShopID] int NOT NULL 
	ALTER TABLE [losWarrentyClaimDetail] ALTER COLUMN  [wcdID] int NOT NULL 
	ALTER TABLE [losWarrentyClaimDetail] ALTER COLUMN  [wcdDetailID] int NOT NULL 
	ALTER TABLE [losWarrentyClaimDetail] ADD  CONSTRAINT [PK_losWarrentyClaimDetail] PRIMARY KEY CLUSTERED ([wcdCompanyID],[wcdShopID],[wcdID],[wcdDetailID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND CONSTRAINT_NAME= 'PK_losWarrentyClaimHeader')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] ALTER COLUMN  [wchCompanyID] int NOT NULL 
	ALTER TABLE [losWarrentyClaimHeader] ALTER COLUMN  [wchShopID] int NOT NULL 
	ALTER TABLE [losWarrentyClaimHeader] ALTER COLUMN  [wchID] int NOT NULL 
	ALTER TABLE [losWarrentyClaimHeader] ADD  CONSTRAINT [PK_losWarrentyClaimHeader] PRIMARY KEY CLUSTERED ([wchCompanyID],[wchShopID],[wchID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsWriteOffDetail' AND CONSTRAINT_NAME= 'PK_LOsWriteOffDetail')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ALTER COLUMN  [wdShopID] int NOT NULL 
	ALTER TABLE [LOsWriteOffDetail] ALTER COLUMN  [WdID] int NOT NULL 
	ALTER TABLE [LOsWriteOffDetail] ALTER COLUMN  [WdItemID] int NOT NULL 
	ALTER TABLE [LOsWriteOffDetail] ALTER COLUMN  [WdShipmentID] int NOT NULL 
	ALTER TABLE [LOsWriteOffDetail] ADD  CONSTRAINT [PK_LOsWriteOffDetail] PRIMARY KEY NONCLUSTERED ([wdShopID],[WdID],[WdItemID],[WdShipmentID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsWriteOffHeader' AND CONSTRAINT_NAME= 'PK_LOsWriteOffHeader')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ALTER COLUMN  [whShopID] int NOT NULL 
	ALTER TABLE [LOsWriteOffHeader] ALTER COLUMN  [WhID] int NOT NULL 
	ALTER TABLE [LOsWriteOffHeader] ADD  CONSTRAINT [PK_LOsWriteOffHeader] PRIMARY KEY NONCLUSTERED ([whShopID],[WhID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUserGroupRights' AND CONSTRAINT_NAME= 'PK_LOUserGroupRights')
BEGIN
	ALTER TABLE [LOUserGroupRights] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [LOUserGroupRights] ALTER COLUMN  [InterfaceID] int NOT NULL 
	ALTER TABLE [LOUserGroupRights] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [LOUserGroupRights] ADD  CONSTRAINT [PK_LOUserGroupRights] PRIMARY KEY CLUSTERED ([UserGroupID],[InterfaceID],[CompanyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUserGroups' AND CONSTRAINT_NAME= 'PK_LOUserGroups')
BEGIN
	ALTER TABLE [LOUserGroups] ALTER COLUMN  [UserGroupID] int NOT NULL 
	ALTER TABLE [LOUserGroups] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [LOUserGroups] ADD  CONSTRAINT [PK_LOUserGroups] PRIMARY KEY CLUSTERED ([UserGroupID],[CompanyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUserMasterGridSettings' AND CONSTRAINT_NAME= 'PK_LOUserMasterGridSettings')
BEGIN
	ALTER TABLE [LOUserMasterGridSettings] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [LOUserMasterGridSettings] ALTER COLUMN  [UserID] int NOT NULL 
	ALTER TABLE [LOUserMasterGridSettings] ADD  CONSTRAINT [PK_LOUserMasterGridSettings] PRIMARY KEY CLUSTERED ([CompanyID],[UserID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUserRights' AND CONSTRAINT_NAME= 'PK_LOUserRights')
BEGIN
	ALTER TABLE [LOUserRights] ALTER COLUMN  [UserID] int NOT NULL 
	ALTER TABLE [LOUserRights] ALTER COLUMN  [InterfaceID] int NOT NULL 
	ALTER TABLE [LOUserRights] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [LOUserRights] ADD  CONSTRAINT [PK_LOUserRights] PRIMARY KEY NONCLUSTERED ([UserID],[InterfaceID],[CompanyID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUsers' AND CONSTRAINT_NAME= 'PK_LOUsers')
BEGIN
	ALTER TABLE [LOUsers] ALTER COLUMN  [UserID] int NOT NULL 
	ALTER TABLE [LOUsers] ADD  CONSTRAINT [PK_LOUsers] PRIMARY KEY NONCLUSTERED ([UserID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LtimeDetail' AND CONSTRAINT_NAME= 'PK_LtimeDetail')
BEGIN
	ALTER TABLE [LtimeDetail] ALTER COLUMN  [Ltimeid] int NOT NULL 
	ALTER TABLE [LtimeDetail] ALTER COLUMN  [Ltimestageid] int NOT NULL 
	ALTER TABLE [LtimeDetail] ADD  CONSTRAINT [PK_LtimeDetail] PRIMARY KEY NONCLUSTERED ([Ltimeid],[Ltimestageid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LtimeHeader' AND CONSTRAINT_NAME= 'PK_LtimeHeader')
BEGIN
	ALTER TABLE [LtimeHeader] ALTER COLUMN  [LtimeID] int NOT NULL 
	ALTER TABLE [LtimeHeader] ADD  CONSTRAINT [PK_LtimeHeader] PRIMARY KEY NONCLUSTERED ([LtimeID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mealname' AND CONSTRAINT_NAME= 'PK_mealname_1')
BEGIN
	ALTER TABLE [mealname] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [mealname] ALTER COLUMN  [mealnameid] int NOT NULL 
	ALTER TABLE [mealname] ADD  CONSTRAINT [PK_mealname_1] PRIMARY KEY NONCLUSTERED ([companyid],[mealnameid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND CONSTRAINT_NAME= 'PK_MEiDespatchToShopDetail')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ALTER COLUMN  [ddDespatchID] int NOT NULL 
	ALTER TABLE [MEiDespatchToShopDetail] ALTER COLUMN  [ddGodownID] int NOT NULL 
	ALTER TABLE [MEiDespatchToShopDetail] ALTER COLUMN  [ddShipmentID] int NOT NULL 
	ALTER TABLE [MEiDespatchToShopDetail] ALTER COLUMN  [ddItemID] int NOT NULL 
	ALTER TABLE [MEiDespatchToShopDetail] ADD  CONSTRAINT [PK_MEiDespatchToShopDetail] PRIMARY KEY CLUSTERED ([ddDespatchID],[ddGodownID],[ddShipmentID],[ddItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND CONSTRAINT_NAME= 'PK_MEiDespatchToShopHeader')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ALTER COLUMN  [dhDespatchID] int NOT NULL 
	ALTER TABLE [MEiDespatchToShopHeader] ALTER COLUMN  [dhGodownID] int NOT NULL 
	ALTER TABLE [MEiDespatchToShopHeader] ADD  CONSTRAINT [PK_MEiDespatchToShopHeader] PRIMARY KEY NONCLUSTERED ([dhDespatchID],[dhGodownID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MeiGodownRequestDetail' AND CONSTRAINT_NAME= 'PK_MeiGodownRequestDetail')
BEGIN
	ALTER TABLE [MeiGodownRequestDetail] ALTER COLUMN  [GRDRequestId] int NOT NULL 
	ALTER TABLE [MeiGodownRequestDetail] ALTER COLUMN  [GRDDetailId] int NOT NULL 
	ALTER TABLE [MeiGodownRequestDetail] ALTER COLUMN  [GRDGodownId] int NOT NULL 
	ALTER TABLE [MeiGodownRequestDetail] ADD  CONSTRAINT [PK_MeiGodownRequestDetail] PRIMARY KEY CLUSTERED ([GRDRequestId],[GRDDetailId],[GRDGodownId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND CONSTRAINT_NAME= 'PK_MeiGodownRequestHeader')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ALTER COLUMN  [GRHRequestId] int NOT NULL 
	ALTER TABLE [MeiGodownRequestHeader] ALTER COLUMN  [GRHGodownId] int NOT NULL 
	ALTER TABLE [MeiGodownRequestHeader] ADD  CONSTRAINT [PK_MeiGodownRequestHeader] PRIMARY KEY CLUSTERED ([GRHRequestId],[GRHGodownId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND CONSTRAINT_NAME= 'PK_MEiGodownTransferDetail')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ALTER COLUMN  [gtdDespatchID] int NOT NULL 
	ALTER TABLE [MEiGodownTransferDetail] ALTER COLUMN  [gtdGodownID] int NOT NULL 
	ALTER TABLE [MEiGodownTransferDetail] ALTER COLUMN  [gtdShipmentID] int NOT NULL 
	ALTER TABLE [MEiGodownTransferDetail] ALTER COLUMN  [gtdItemID] int NOT NULL 
	ALTER TABLE [MEiGodownTransferDetail] ADD  CONSTRAINT [PK_MEiGodownTransferDetail] PRIMARY KEY CLUSTERED ([gtdDespatchID],[gtdGodownID],[gtdShipmentID],[gtdItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND CONSTRAINT_NAME= 'PK_MEiGodownTransferHeader')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ALTER COLUMN  [gthDespatchID] int NOT NULL 
	ALTER TABLE [MEiGodownTransferHeader] ALTER COLUMN  [gthFromGodownID] int NOT NULL 
	ALTER TABLE [MEiGodownTransferHeader] ADD  CONSTRAINT [PK_MEiGodownTransferHeader] PRIMARY KEY NONCLUSTERED ([gthDespatchID],[gthFromGodownID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiRQtoHQforItem' AND CONSTRAINT_NAME= 'PK_meiRQtoHQforItem')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ALTER COLUMN  [GodownID] int NOT NULL 
	ALTER TABLE [meiRQtoHQforItem] ALTER COLUMN  [RequestID] int NOT NULL 
	ALTER TABLE [meiRQtoHQforItem] ADD  CONSTRAINT [PK_meiRQtoHQforItem] PRIMARY KEY NONCLUSTERED ([GodownID],[RequestID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND CONSTRAINT_NAME= 'PK_meiSpecialDespatchtoShopDetail')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ALTER COLUMN  [ddDespatchid] int NOT NULL 
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ALTER COLUMN  [ddGodownid] int NOT NULL 
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ALTER COLUMN  [ddShipmentid] int NOT NULL 
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ALTER COLUMN  [ddItemid] int NOT NULL 
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD  CONSTRAINT [PK_meiSpecialDespatchtoShopDetail] PRIMARY KEY CLUSTERED ([ddDespatchid],[ddGodownid],[ddShipmentid],[ddItemid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND CONSTRAINT_NAME= 'PK_meiSpecialDespatchtoshopHeader')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ALTER COLUMN  [dhdespatchid] int NOT NULL 
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ALTER COLUMN  [dhgodownid] int NOT NULL 
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD  CONSTRAINT [PK_meiSpecialDespatchtoshopHeader] PRIMARY KEY NONCLUSTERED ([dhdespatchid],[dhgodownid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND CONSTRAINT_NAME= 'PK_MEsDespatchtoGodownDetail')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ALTER COLUMN  [dgdID] int NOT NULL 
	ALTER TABLE [MEsDespatchtoGodownDetail] ALTER COLUMN  [dgdShipmentID] int NOT NULL 
	ALTER TABLE [MEsDespatchtoGodownDetail] ALTER COLUMN  [dgdItemID] int NOT NULL 
	ALTER TABLE [MEsDespatchtoGodownDetail] ALTER COLUMN  [dgdShopID] int NOT NULL 
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD  CONSTRAINT [PK_MEsDespatchtoGodownDetail] PRIMARY KEY NONCLUSTERED ([dgdID],[dgdShipmentID],[dgdItemID],[dgdShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND CONSTRAINT_NAME= 'PK_MEsDespatchtoGodownHeader')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ALTER COLUMN  [dghID] int NOT NULL 
	ALTER TABLE [MEsDespatchtoGodownHeader] ALTER COLUMN  [dghShopID] int NOT NULL 
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD  CONSTRAINT [PK_MEsDespatchtoGodownHeader] PRIMARY KEY NONCLUSTERED ([dghID],[dghShopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesfuture' AND CONSTRAINT_NAME= 'PK_mesfuture')
BEGIN
	ALTER TABLE [mesfuture] ALTER COLUMN  [futureint] int NOT NULL 
	ALTER TABLE [mesfuture] ADD  CONSTRAINT [PK_mesfuture] PRIMARY KEY NONCLUSTERED ([futureint])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND CONSTRAINT_NAME= 'PK_mesShopRequestDetail')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] ALTER COLUMN  [SRDrequestid] int NOT NULL 
	ALTER TABLE [mesRequesttoShopDetail] ALTER COLUMN  [srdshopid] int NOT NULL 
	ALTER TABLE [mesRequesttoShopDetail] ALTER COLUMN  [srditemid] int NOT NULL 
	ALTER TABLE [mesRequesttoShopDetail] ADD  CONSTRAINT [PK_mesShopRequestDetail] PRIMARY KEY NONCLUSTERED ([SRDrequestid],[srdshopid],[srditemid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND CONSTRAINT_NAME= 'PK_mesRequesttoShopHeader')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ALTER COLUMN  [SRHshopid] int NOT NULL 
	ALTER TABLE [mesRequesttoShopHeader] ALTER COLUMN  [SRHrequestID] int NOT NULL 
	ALTER TABLE [mesRequesttoShopHeader] ADD  CONSTRAINT [PK_mesRequesttoShopHeader] PRIMARY KEY NONCLUSTERED ([SRHshopid],[SRHrequestID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRQtoHQforItem' AND CONSTRAINT_NAME= 'PK_mesRQtoHQforItem')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [mesRQtoHQforItem] ALTER COLUMN  [RequestID] int NOT NULL 
	ALTER TABLE [mesRQtoHQforItem] ADD  CONSTRAINT [PK_mesRQtoHQforItem] PRIMARY KEY NONCLUSTERED ([ShopID],[RequestID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferOutArrivalDetail' AND CONSTRAINT_NAME= 'PK_mesTransferOutArrivalDetail')
BEGIN
	ALTER TABLE [mesTransferOutArrivalDetail] ALTER COLUMN  [toaShopid] int NOT NULL 
	ALTER TABLE [mesTransferOutArrivalDetail] ALTER COLUMN  [toaTransOutId] int NOT NULL 
	ALTER TABLE [mesTransferOutArrivalDetail] ALTER COLUMN  [toaArrivalId] int NOT NULL 
	ALTER TABLE [mesTransferOutArrivalDetail] ADD  CONSTRAINT [PK_mesTransferOutArrivalDetail] PRIMARY KEY CLUSTERED ([toaShopid],[toaTransOutId],[toaArrivalId])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferoutDetail' AND CONSTRAINT_NAME= 'PK_mesTransferoutDetail')
BEGIN
	ALTER TABLE [mesTransferoutDetail] ALTER COLUMN  [TODid] int NOT NULL 
	ALTER TABLE [mesTransferoutDetail] ALTER COLUMN  [TODshopid] int NOT NULL 
	ALTER TABLE [mesTransferoutDetail] ALTER COLUMN  [TODitemid] int NOT NULL 
	ALTER TABLE [mesTransferoutDetail] ALTER COLUMN  [TODshipmentid] int NOT NULL 
	ALTER TABLE [mesTransferoutDetail] ADD  CONSTRAINT [PK_mesTransferoutDetail] PRIMARY KEY NONCLUSTERED ([TODid],[TODshopid],[TODitemid],[TODshipmentid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferOutHeader' AND CONSTRAINT_NAME= 'PK_mesTransferOutHeader')
BEGIN
	ALTER TABLE [mesTransferOutHeader] ALTER COLUMN  [TOHid] int NOT NULL 
	ALTER TABLE [mesTransferOutHeader] ALTER COLUMN  [TOHShopid] int NOT NULL 
	ALTER TABLE [mesTransferOutHeader] ADD  CONSTRAINT [PK_mesTransferOutHeader] PRIMARY KEY NONCLUSTERED ([TOHid],[TOHShopid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsTransLog' AND CONSTRAINT_NAME= 'PK_MEsTransLog')
BEGIN
	ALTER TABLE [MEsTransLog] ALTER COLUMN  [TransLogID] int NOT NULL 
	ALTER TABLE [MEsTransLog] ADD  CONSTRAINT [PK_MEsTransLog] PRIMARY KEY NONCLUSTERED ([TransLogID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MiscInquiry' AND CONSTRAINT_NAME= 'PK_MiscInquiry')
BEGIN
	ALTER TABLE [MiscInquiry] ALTER COLUMN  [QueryID] int NOT NULL 
	ALTER TABLE [MiscInquiry] ADD  CONSTRAINT [PK_MiscInquiry] PRIMARY KEY NONCLUSTERED ([QueryID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='moafuture' AND CONSTRAINT_NAME= 'PK_moafuture')
BEGIN
	ALTER TABLE [moafuture] ALTER COLUMN  [futureint] int NOT NULL 
	ALTER TABLE [moafuture] ADD  CONSTRAINT [PK_moafuture] PRIMARY KEY NONCLUSTERED ([futureint])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalDetails' AND CONSTRAINT_NAME= 'PK_MOaJournalDetails')
BEGIN
	ALTER TABLE [MOaJournalDetails] ALTER COLUMN  [JournalDetailID] int NOT NULL 
	ALTER TABLE [MOaJournalDetails] ALTER COLUMN  [JournalID] int NOT NULL 
	ALTER TABLE [MOaJournalDetails] ADD  CONSTRAINT [PK_MOaJournalDetails] PRIMARY KEY NONCLUSTERED ([JournalDetailID],[JournalID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalHeader' AND CONSTRAINT_NAME= 'PK_MOaJournalHeader')
BEGIN
	ALTER TABLE [MOaJournalHeader] ALTER COLUMN  [JournalID] int NOT NULL 
	ALTER TABLE [MOaJournalHeader] ADD  CONSTRAINT [PK_MOaJournalHeader] PRIMARY KEY NONCLUSTERED ([JournalID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='moapoitems' AND CONSTRAINT_NAME= 'PK_moapoitems')
BEGIN
	ALTER TABLE [moapoitems] ALTER COLUMN  [shopid] int NOT NULL 
	ALTER TABLE [moapoitems] ALTER COLUMN  [itemid] int NOT NULL 
	ALTER TABLE [moapoitems] ADD  CONSTRAINT [PK_moapoitems] PRIMARY KEY NONCLUSTERED ([shopid],[itemid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOiGodownStock' AND CONSTRAINT_NAME= 'PK_MOiGodownStock')
BEGIN
	ALTER TABLE [MOiGodownStock] ALTER COLUMN  [gsGodownID] int NOT NULL 
	ALTER TABLE [MOiGodownStock] ALTER COLUMN  [gsShipmentID] int NOT NULL 
	ALTER TABLE [MOiGodownStock] ALTER COLUMN  [gsItemID] int NOT NULL 
	ALTER TABLE [MOiGodownStock] ADD  CONSTRAINT [PK_MOiGodownStock] PRIMARY KEY CLUSTERED ([gsGodownID],[gsShipmentID],[gsItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOiGodownStockBackup' AND CONSTRAINT_NAME= 'PK_MOiGodownStockBackup')
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ALTER COLUMN  [gsGodownID] int NOT NULL 
	ALTER TABLE [MOiGodownStockBackup] ALTER COLUMN  [gsLocationID] int NOT NULL 
	ALTER TABLE [MOiGodownStockBackup] ALTER COLUMN  [gsStockDate] datetime NOT NULL 
	ALTER TABLE [MOiGodownStockBackup] ALTER COLUMN  [gsShipmentID] int NOT NULL 
	ALTER TABLE [MOiGodownStockBackup] ALTER COLUMN  [gsItemID] int NOT NULL 
	ALTER TABLE [MOiGodownStockBackup] ADD  CONSTRAINT [PK_MOiGodownStockBackup] PRIMARY KEY NONCLUSTERED ([gsGodownID],[gsLocationID],[gsStockDate],[gsShipmentID],[gsItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND CONSTRAINT_NAME= 'PK_mosGoodsRequestDetail')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ALTER COLUMN  [GRDrequestID] int NOT NULL 
	ALTER TABLE [mosGoodsRequestDetail] ALTER COLUMN  [GRDshopID] int NOT NULL 
	ALTER TABLE [mosGoodsRequestDetail] ALTER COLUMN  [GRDitemID] int NOT NULL 
	ALTER TABLE [mosGoodsRequestDetail] ADD  CONSTRAINT [PK_mosGoodsRequestDetail] PRIMARY KEY NONCLUSTERED ([GRDrequestID],[GRDshopID],[GRDitemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND CONSTRAINT_NAME= 'PK_mosGoodsRequestHeader')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ALTER COLUMN  [GRHrequestID] int NOT NULL 
	ALTER TABLE [mosGoodsRequestHeader] ALTER COLUMN  [GRHshopID] int NOT NULL 
	ALTER TABLE [mosGoodsRequestHeader] ADD  CONSTRAINT [PK_mosGoodsRequestHeader] PRIMARY KEY NONCLUSTERED ([GRHrequestID],[GRHshopID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mosshopservicestock' AND CONSTRAINT_NAME= 'PK_mosshopservicestock')
BEGIN
	ALTER TABLE [mosshopservicestock] ALTER COLUMN  [serstkshopid] int NOT NULL 
	ALTER TABLE [mosshopservicestock] ALTER COLUMN  [serstkcompanyid] int NOT NULL 
	ALTER TABLE [mosshopservicestock] ALTER COLUMN  [serstkitemid] int NOT NULL 
	ALTER TABLE [mosshopservicestock] ADD  CONSTRAINT [PK_mosshopservicestock] PRIMARY KEY CLUSTERED ([serstkshopid],[serstkcompanyid],[serstkitemid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOsShopStock' AND CONSTRAINT_NAME= 'PK_MOsShopStock')
BEGIN
	ALTER TABLE [MOsShopStock] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [MOsShopStock] ALTER COLUMN  [StockDate] datetime NOT NULL 
	ALTER TABLE [MOsShopStock] ALTER COLUMN  [ShipmentID] int NOT NULL 
	ALTER TABLE [MOsShopStock] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [MOsShopStock] ADD  CONSTRAINT [PK_MOsShopStock] PRIMARY KEY NONCLUSTERED ([ShopID],[StockDate],[ShipmentID],[ItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOsShopStockBackup' AND CONSTRAINT_NAME= 'PK_MOsShopStockBackup')
BEGIN
	ALTER TABLE [MOsShopStockBackup] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [MOsShopStockBackup] ALTER COLUMN  [StockDate] datetime NOT NULL 
	ALTER TABLE [MOsShopStockBackup] ALTER COLUMN  [ShipmentID] int NOT NULL 
	ALTER TABLE [MOsShopStockBackup] ALTER COLUMN  [ItemID] int NOT NULL 
	ALTER TABLE [MOsShopStockBackup] ADD  CONSTRAINT [PK_MOsShopStockBackup] PRIMARY KEY NONCLUSTERED ([ShopID],[StockDate],[ShipmentID],[ItemID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='moStockWriteOffHQ' AND CONSTRAINT_NAME= 'PK_moStockWriteOffHQ')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ALTER COLUMN  [swID] int NOT NULL 
	ALTER TABLE [moStockWriteOffHQ] ADD  CONSTRAINT [PK_moStockWriteOffHQ] PRIMARY KEY NONCLUSTERED ([swID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='paPayAccLinkDetails' AND CONSTRAINT_NAME= 'pk_paPayAccLinkDetails')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [paPayAccLinkDetails] ALTER COLUMN  [TransID] int NOT NULL 
	ALTER TABLE [paPayAccLinkDetails] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [paPayAccLinkDetails] ADD  CONSTRAINT [pk_paPayAccLinkDetails] PRIMARY KEY CLUSTERED ([CompanyID],[TransID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='paPayAccLinkHeader' AND CONSTRAINT_NAME= 'pk_paPayAccLinkHeader')
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [paPayAccLinkHeader] ALTER COLUMN  [TransID] int NOT NULL 
	ALTER TABLE [paPayAccLinkHeader] ADD  CONSTRAINT [pk_paPayAccLinkHeader] PRIMARY KEY CLUSTERED ([CompanyID],[TransID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND CONSTRAINT_NAME= 'pk_paPayAccLinkPostingDetails')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [paPayAccLinkPostingDetails] ALTER COLUMN  [TransID] int NOT NULL 
	ALTER TABLE [paPayAccLinkPostingDetails] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [paPayAccLinkPostingDetails] ADD  CONSTRAINT [pk_paPayAccLinkPostingDetails] PRIMARY KEY CLUSTERED ([CompanyID],[TransID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherCreditDetails' AND CONSTRAINT_NAME= 'PK_ReceiptVoucherCreditDetails')
BEGIN
	ALTER TABLE [ReceiptVoucherCreditDetails] ALTER COLUMN  [ReceiptDebitID] int NOT NULL 
	ALTER TABLE [ReceiptVoucherCreditDetails] ALTER COLUMN  [ReceiptID] int NOT NULL 
	ALTER TABLE [ReceiptVoucherCreditDetails] ADD  CONSTRAINT [PK_ReceiptVoucherCreditDetails] PRIMARY KEY NONCLUSTERED ([ReceiptDebitID],[ReceiptID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherCustomerDetails' AND CONSTRAINT_NAME= 'PK_ReceiptVoucherCustomerDetails')
BEGIN
	ALTER TABLE [ReceiptVoucherCustomerDetails] ALTER COLUMN  [Companyid] int NOT NULL 
	ALTER TABLE [ReceiptVoucherCustomerDetails] ALTER COLUMN  [ReceiptId] int NOT NULL 
	ALTER TABLE [ReceiptVoucherCustomerDetails] ALTER COLUMN  [Detailid] int NOT NULL 
	ALTER TABLE [ReceiptVoucherCustomerDetails] ADD  CONSTRAINT [PK_ReceiptVoucherCustomerDetails] PRIMARY KEY NONCLUSTERED ([Companyid],[ReceiptId],[Detailid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND CONSTRAINT_NAME= 'PK_ReceiptVoucherDetails')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ALTER COLUMN  [ReceiptID] int NOT NULL 
	ALTER TABLE [ReceiptVoucherDetails] ALTER COLUMN  [ReceiptDetailID] int NOT NULL 
	ALTER TABLE [ReceiptVoucherDetails] ADD  CONSTRAINT [PK_ReceiptVoucherDetails] PRIMARY KEY NONCLUSTERED ([ReceiptID],[ReceiptDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'PK_ReceiptVoucherHeader')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ALTER COLUMN  [ReceiptID] int NOT NULL 
	ALTER TABLE [ReceiptVoucherHeader] ADD  CONSTRAINT [PK_ReceiptVoucherHeader] PRIMARY KEY NONCLUSTERED ([ReceiptID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReportCategoryHeader' AND CONSTRAINT_NAME= 'PK_ReportCategoryHeader')
BEGIN
	ALTER TABLE [ReportCategoryHeader] ALTER COLUMN  [repCatId] int NOT NULL 
	ALTER TABLE [ReportCategoryHeader] ADD  CONSTRAINT [PK_ReportCategoryHeader] PRIMARY KEY CLUSTERED ([repCatId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ScheduleHeader' AND CONSTRAINT_NAME= 'PK_ScheduleHeader')
BEGIN
	ALTER TABLE [ScheduleHeader] ALTER COLUMN  [schid] int NOT NULL 
	ALTER TABLE [ScheduleHeader] ADD  CONSTRAINT [PK_ScheduleHeader] PRIMARY KEY NONCLUSTERED ([schid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND CONSTRAINT_NAME= 'PK_ServiceInvoiceDetails')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ALTER COLUMN  [InvoiceID] int NOT NULL 
	ALTER TABLE [ServiceInvoiceDetails] ALTER COLUMN  [InvoiceDetailID] int NOT NULL 
	ALTER TABLE [ServiceInvoiceDetails] ADD  CONSTRAINT [PK_ServiceInvoiceDetails] PRIMARY KEY NONCLUSTERED ([InvoiceID],[InvoiceDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceChequeDetails' AND CONSTRAINT_NAME= 'pk_ShipmentClearenceChequeDetails')
BEGIN
	ALTER TABLE [ShipmentClearenceChequeDetails] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceChequeDetails] ALTER COLUMN  [ClearenceID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceChequeDetails] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceChequeDetails] ADD  CONSTRAINT [pk_ShipmentClearenceChequeDetails] PRIMARY KEY CLUSTERED ([ShopID],[ClearenceID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceHeader' AND CONSTRAINT_NAME= 'pk_ShipmentClearenceHeader')
BEGIN
	ALTER TABLE [ShipmentClearenceHeader] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceHeader] ALTER COLUMN  [ClearenceID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceHeader] ADD  CONSTRAINT [pk_ShipmentClearenceHeader] PRIMARY KEY CLUSTERED ([ShopID],[ClearenceID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND CONSTRAINT_NAME= 'pk_ShipmentClearenceItemDetails')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceItemDetails] ALTER COLUMN  [ClearenceID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceItemDetails] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceItemDetails] ADD  CONSTRAINT [pk_ShipmentClearenceItemDetails] PRIMARY KEY CLUSTERED ([ShopID],[ClearenceID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND CONSTRAINT_NAME= 'pk_ShipmentClearenceOCDetails')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceOCDetails] ALTER COLUMN  [ClearenceID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceOCDetails] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceOCDetails] ADD  CONSTRAINT [pk_ShipmentClearenceOCDetails] PRIMARY KEY CLUSTERED ([ShopID],[ClearenceID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND CONSTRAINT_NAME= 'pk_ShipmentClearenceRequestDetails')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] ALTER COLUMN  [ShopID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceRequestDetails] ALTER COLUMN  [ClearenceID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceRequestDetails] ALTER COLUMN  [DetailID] int NOT NULL 
	ALTER TABLE [ShipmentClearenceRequestDetails] ADD  CONSTRAINT [pk_ShipmentClearenceRequestDetails] PRIMARY KEY CLUSTERED ([ShopID],[ClearenceID],[DetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShopbfMealplan' AND CONSTRAINT_NAME= 'PK_ShopbfMealplan')
BEGIN
	ALTER TABLE [ShopbfMealplan] ALTER COLUMN  [Companyid] int NOT NULL 
	ALTER TABLE [ShopbfMealplan] ALTER COLUMN  [Outletid] int NOT NULL 
	ALTER TABLE [ShopbfMealplan] ALTER COLUMN  [Mealnameid] int NOT NULL 
	ALTER TABLE [ShopbfMealplan] ADD  CONSTRAINT [PK_ShopbfMealplan] PRIMARY KEY NONCLUSTERED ([Companyid],[Outletid],[Mealnameid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TargetAccountsLink' AND CONSTRAINT_NAME= 'PK_TargetAccountsLink')
BEGIN
	ALTER TABLE [TargetAccountsLink] ALTER COLUMN  [tacCompanyID] int NOT NULL 
	ALTER TABLE [TargetAccountsLink] ALTER COLUMN  [tacTargetID] int NOT NULL 
	ALTER TABLE [TargetAccountsLink] ALTER COLUMN  [tacDetailID] int NOT NULL 
	ALTER TABLE [TargetAccountsLink] ADD  CONSTRAINT [PK_TargetAccountsLink] PRIMARY KEY NONCLUSTERED ([tacCompanyID],[tacTargetID],[tacDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TargetCheckDetail' AND CONSTRAINT_NAME= 'PK_TargetCheckDetail')
BEGIN
	ALTER TABLE [TargetCheckDetail] ALTER COLUMN  [tcdCompanyID] int NOT NULL 
	ALTER TABLE [TargetCheckDetail] ALTER COLUMN  [tcdCheckID] int NOT NULL 
	ALTER TABLE [TargetCheckDetail] ALTER COLUMN  [tcdDetailId] int NOT NULL 
	ALTER TABLE [TargetCheckDetail] ADD  CONSTRAINT [PK_TargetCheckDetail] PRIMARY KEY NONCLUSTERED ([tcdCompanyID],[tcdCheckID],[tcdDetailId])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TargetCheckHeader' AND CONSTRAINT_NAME= 'PK_TargetCheckHeader')
BEGIN
	ALTER TABLE [TargetCheckHeader] ALTER COLUMN  [tchCompanyID] int NOT NULL 
	ALTER TABLE [TargetCheckHeader] ALTER COLUMN  [tchCheckID] int NOT NULL 
	ALTER TABLE [TargetCheckHeader] ADD  CONSTRAINT [PK_TargetCheckHeader] PRIMARY KEY NONCLUSTERED ([tchCompanyID],[tchCheckID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TargetFixationDetail' AND CONSTRAINT_NAME= 'PK_TargetFixationDetail')
BEGIN
	ALTER TABLE [TargetFixationDetail] ALTER COLUMN  [tfdCompanyID] int NOT NULL 
	ALTER TABLE [TargetFixationDetail] ALTER COLUMN  [tfdFixationID] int NOT NULL 
	ALTER TABLE [TargetFixationDetail] ALTER COLUMN  [tfdDetailID] int NOT NULL 
	ALTER TABLE [TargetFixationDetail] ADD  CONSTRAINT [PK_TargetFixationDetail] PRIMARY KEY NONCLUSTERED ([tfdCompanyID],[tfdFixationID],[tfdDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TargetFixationHeader' AND CONSTRAINT_NAME= 'PK_TargetAllocationHeader')
BEGIN
	ALTER TABLE [TargetFixationHeader] ALTER COLUMN  [tfhCompanyID] int NOT NULL 
	ALTER TABLE [TargetFixationHeader] ALTER COLUMN  [tfhFixationID] int NOT NULL 
	ALTER TABLE [TargetFixationHeader] ADD  CONSTRAINT [PK_TargetAllocationHeader] PRIMARY KEY NONCLUSTERED ([tfhCompanyID],[tfhFixationID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TargetMaster' AND CONSTRAINT_NAME= 'PK_TargetMaster')
BEGIN
	ALTER TABLE [TargetMaster] ALTER COLUMN  [CompanyID] int NOT NULL 
	ALTER TABLE [TargetMaster] ALTER COLUMN  [TargetID] int NOT NULL 
	ALTER TABLE [TargetMaster] ADD  CONSTRAINT [PK_TargetMaster] PRIMARY KEY NONCLUSTERED ([CompanyID],[TargetID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TempDishSegmentDetail' AND CONSTRAINT_NAME= 'PK_segTid_segTheaderid_segTdishid_segTcompanyid_segTNewInsertedID_SegTUpdateTime')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] ALTER COLUMN  [seg_detail_Tid] int NOT NULL 
	ALTER TABLE [TempDishSegmentDetail] ALTER COLUMN  [seg_detail_Theader_id] int NOT NULL 
	ALTER TABLE [TempDishSegmentDetail] ALTER COLUMN  [seg_detail_Tdishid] int NOT NULL 
	ALTER TABLE [TempDishSegmentDetail] ALTER COLUMN  [seg_detail_Tcompanyid] int NOT NULL 
	ALTER TABLE [TempDishSegmentDetail] ALTER COLUMN  [seg_detail_TLatestID] int NOT NULL 
	ALTER TABLE [TempDishSegmentDetail] ALTER COLUMN  [seg_detail_TUpdateTime] datetime NOT NULL 
	ALTER TABLE [TempDishSegmentDetail] ADD  CONSTRAINT [PK_segTid_segTheaderid_segTdishid_segTcompanyid_segTNewInsertedID_SegTUpdateTime] PRIMARY KEY CLUSTERED ([seg_detail_Tid],[seg_detail_Theader_id],[seg_detail_Tdishid],[seg_detail_Tcompanyid],[seg_detail_TLatestID],[seg_detail_TUpdateTime])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillBalanceHistory' AND CONSTRAINT_NAME= 'PK_TillBalanceHistory')
BEGIN
	ALTER TABLE [TillBalanceHistory] ALTER COLUMN  [till_hist_id] int NOT NULL 
	ALTER TABLE [TillBalanceHistory] ALTER COLUMN  [till_currencyid] int NOT NULL 
	ALTER TABLE [TillBalanceHistory] ALTER COLUMN  [till_outletid] int NOT NULL 
	ALTER TABLE [TillBalanceHistory] ALTER COLUMN  [till_companyid] int NOT NULL 
	ALTER TABLE [TillBalanceHistory] ADD  CONSTRAINT [PK_TillBalanceHistory] PRIMARY KEY CLUSTERED ([till_hist_id],[till_currencyid],[till_outletid],[till_companyid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillDetail' AND CONSTRAINT_NAME= 'PK_TillDetail')
BEGIN
	ALTER TABLE [TillDetail] ALTER COLUMN  [till_td_detailid] int NOT NULL 
	ALTER TABLE [TillDetail] ALTER COLUMN  [till_td_tillid] int NOT NULL 
	ALTER TABLE [TillDetail] ALTER COLUMN  [till_td_companyid] int NOT NULL 
	ALTER TABLE [TillDetail] ALTER COLUMN  [till_td_outletid] int NOT NULL 
	ALTER TABLE [TillDetail] ADD  CONSTRAINT [PK_TillDetail] PRIMARY KEY CLUSTERED ([till_td_detailid],[till_td_tillid],[till_td_companyid],[till_td_outletid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHeader' AND CONSTRAINT_NAME= 'PK_TillHeader')
BEGIN
	ALTER TABLE [TillHeader] ALTER COLUMN  [till_th_tillid] int NOT NULL 
	ALTER TABLE [TillHeader] ALTER COLUMN  [till_th_outletid] int NOT NULL 
	ALTER TABLE [TillHeader] ALTER COLUMN  [till_th_companyid] int NOT NULL 
	ALTER TABLE [TillHeader] ADD  CONSTRAINT [PK_TillHeader] PRIMARY KEY CLUSTERED ([till_th_tillid],[till_th_outletid],[till_th_companyid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHistory' AND CONSTRAINT_NAME= 'PK_TillHistory')
BEGIN
	ALTER TABLE [TillHistory] ALTER COLUMN  [till_hist_id] int NOT NULL 
	ALTER TABLE [TillHistory] ALTER COLUMN  [till_outletid] int NOT NULL 
	ALTER TABLE [TillHistory] ALTER COLUMN  [till_companyid] int NOT NULL 
	ALTER TABLE [TillHistory] ADD  CONSTRAINT [PK_TillHistory] PRIMARY KEY CLUSTERED ([till_hist_id],[till_outletid],[till_companyid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillOpeningstock' AND CONSTRAINT_NAME= 'PK_TillOpeningstock_companyid_tillHistId_tillid_shopid_itemid')
BEGIN
	ALTER TABLE [TillOpeningstock] ALTER COLUMN  [companyid] int NOT NULL 
	ALTER TABLE [TillOpeningstock] ALTER COLUMN  [tillHistId] int NOT NULL 
	ALTER TABLE [TillOpeningstock] ALTER COLUMN  [tillid] int NOT NULL 
	ALTER TABLE [TillOpeningstock] ALTER COLUMN  [shopid] int NOT NULL 
	ALTER TABLE [TillOpeningstock] ALTER COLUMN  [itemid] int NOT NULL 
	ALTER TABLE [TillOpeningstock] ADD  CONSTRAINT [PK_TillOpeningstock_companyid_tillHistId_tillid_shopid_itemid] PRIMARY KEY CLUSTERED ([companyid],[tillHistId],[tillid],[shopid],[itemid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillStatusMaster' AND CONSTRAINT_NAME= 'PK_TillStatus')
BEGIN
	ALTER TABLE [TillStatusMaster] ALTER COLUMN  [tillstatus_id] int NOT NULL 
	ALTER TABLE [TillStatusMaster] ADD  CONSTRAINT [PK_TillStatus] PRIMARY KEY CLUSTERED ([tillstatus_id])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementDetail' AND CONSTRAINT_NAME= 'PK_VendorSettlementDetail')
BEGIN
	ALTER TABLE [VendorSettlementDetail] ALTER COLUMN  [VSID] int NOT NULL 
	ALTER TABLE [VendorSettlementDetail] ALTER COLUMN  [VSDetailID] int NOT NULL 
	ALTER TABLE [VendorSettlementDetail] ADD  CONSTRAINT [PK_VendorSettlementDetail] PRIMARY KEY NONCLUSTERED ([VSID],[VSDetailID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementHeader' AND CONSTRAINT_NAME= 'PK_VendorSettlementHeader')
BEGIN
	ALTER TABLE [VendorSettlementHeader] ALTER COLUMN  [VSID] int NOT NULL 
	ALTER TABLE [VendorSettlementHeader] ADD  CONSTRAINT [PK_VendorSettlementHeader] PRIMARY KEY NONCLUSTERED ([VSID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VoucherMaster' AND CONSTRAINT_NAME= 'PK_VoucherMaster')
BEGIN
	ALTER TABLE [VoucherMaster] ALTER COLUMN  [VoucherID] int NOT NULL 
	ALTER TABLE [VoucherMaster] ALTER COLUMN  [VoucherCompanyID] int NOT NULL 
	ALTER TABLE [VoucherMaster] ADD  CONSTRAINT [PK_VoucherMaster] PRIMARY KEY CLUSTERED ([VoucherID],[VoucherCompanyID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='WeekDays' AND CONSTRAINT_NAME= 'PK_WeekID')
BEGIN
	ALTER TABLE [WeekDays] ALTER COLUMN  [week_id] int NOT NULL 
	ALTER TABLE [WeekDays] ADD  CONSTRAINT [PK_WeekID] PRIMARY KEY CLUSTERED ([week_id])
END
GO
--Script for Foreign Key Constraints
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccountFinYearOpening' AND CONSTRAINT_NAME= 'fk_aaccountfinyearopening_aaccountmaster')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] WITH CHECK ADD  CONSTRAINT [fk_aaccountfinyearopening_aaccountmaster] FOREIGN KEY ([Accountid],[Companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aAccountFinYearOpening] CHECK CONSTRAINT [fk_aaccountfinyearopening_aaccountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccountFinYearOpening' AND CONSTRAINT_NAME= 'fk_aaccountfinyearopening_acompanymaster')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] WITH CHECK ADD  CONSTRAINT [fk_aaccountfinyearopening_acompanymaster] FOREIGN KEY ([Companyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aAccountFinYearOpening] CHECK CONSTRAINT [fk_aaccountfinyearopening_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccountFinYearOpening' AND CONSTRAINT_NAME= 'fk_aaccountfinyearopening_adepartmentmaster')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] WITH CHECK ADD  CONSTRAINT [fk_aaccountfinyearopening_adepartmentmaster] FOREIGN KEY ([departmentid],[Companyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aAccountFinYearOpening] CHECK CONSTRAINT [fk_aaccountfinyearopening_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccountFinYearOpening' AND CONSTRAINT_NAME= 'fk_aaccountfinyearopening_afinancialyear')
BEGIN
	ALTER TABLE [aAccountFinYearOpening] WITH CHECK ADD  CONSTRAINT [fk_aaccountfinyearopening_afinancialyear] FOREIGN KEY ([Financialid],[Companyid]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [aAccountFinYearOpening] CHECK CONSTRAINT [fk_aaccountfinyearopening_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccountMaster' AND CONSTRAINT_NAME= 'fk_aaccountmaster_acurrencymaster')
BEGIN
	ALTER TABLE [aAccountMaster] WITH CHECK ADD  CONSTRAINT [fk_aaccountmaster_acurrencymaster] FOREIGN KEY ([CurrencyID],[CompanyID]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [aAccountMaster] CHECK CONSTRAINT [fk_aaccountmaster_acurrencymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccountMaster' AND CONSTRAINT_NAME= 'fk_aaccountmaster_agroupmaster')
BEGIN
	ALTER TABLE [aAccountMaster] WITH CHECK ADD  CONSTRAINT [fk_aaccountmaster_agroupmaster] FOREIGN KEY ([GroupID],[CompanyID]) REFERENCES aGroupMaster([GroupID],[CompanyID])
END
GO
 ALTER TABLE [aAccountMaster] CHECK CONSTRAINT [fk_aaccountmaster_agroupmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AAccRatioEntitiesAccounts' AND CONSTRAINT_NAME= 'FK_AAccRatioEntitiesAccounts_aAccountMaster')
BEGIN
	ALTER TABLE [AAccRatioEntitiesAccounts] WITH CHECK ADD  CONSTRAINT [FK_AAccRatioEntitiesAccounts_aAccountMaster] FOREIGN KEY ([AccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [AAccRatioEntitiesAccounts] CHECK CONSTRAINT [FK_AAccRatioEntitiesAccounts_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AAccRatioEntitiesAccounts' AND CONSTRAINT_NAME= 'FK_AAccRatioEntitiesAccounts_AAccRatioEntitiesMaster')
BEGIN
	ALTER TABLE [AAccRatioEntitiesAccounts] WITH CHECK ADD  CONSTRAINT [FK_AAccRatioEntitiesAccounts_AAccRatioEntitiesMaster] FOREIGN KEY ([CompanyID],[EntityID]) REFERENCES AAccRatioEntitiesMaster([CompanyID],[EntityId])
END
GO
 ALTER TABLE [AAccRatioEntitiesAccounts] CHECK CONSTRAINT [FK_AAccRatioEntitiesAccounts_AAccRatioEntitiesMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AAccRatioEntitiesMaster' AND CONSTRAINT_NAME= 'FK_AAccRatioEntitiesMaster_aAccRatioGroupMaster')
BEGIN
	ALTER TABLE [AAccRatioEntitiesMaster] WITH CHECK ADD  CONSTRAINT [FK_AAccRatioEntitiesMaster_aAccRatioGroupMaster] FOREIGN KEY ([CompanyID],[GroupID]) REFERENCES aAccRatioGroupMaster([CompanyID],[GroupID])
END
GO
 ALTER TABLE [AAccRatioEntitiesMaster] CHECK CONSTRAINT [FK_AAccRatioEntitiesMaster_aAccRatioGroupMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND CONSTRAINT_NAME= 'FK_aAccRatioGroupMaster_aCompanyMaster')
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] WITH CHECK ADD  CONSTRAINT [FK_aAccRatioGroupMaster_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aAccRatioGroupMaster] CHECK CONSTRAINT [FK_aAccRatioGroupMaster_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aaccrepformat' AND CONSTRAINT_NAME= 'fk_aaccrepformat_acompanymaster')
BEGIN
	ALTER TABLE [aaccrepformat] WITH CHECK ADD  CONSTRAINT [fk_aaccrepformat_acompanymaster] FOREIGN KEY ([companyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aaccrepformat] CHECK CONSTRAINT [fk_aaccrepformat_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aaccrepgroup' AND CONSTRAINT_NAME= 'fk_aaccrepgroup_acompanymaster')
BEGIN
	ALTER TABLE [aaccrepgroup] WITH CHECK ADD  CONSTRAINT [fk_aaccrepgroup_acompanymaster] FOREIGN KEY ([companyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aaccrepgroup] CHECK CONSTRAINT [fk_aaccrepgroup_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aAnalysedPOItems' AND CONSTRAINT_NAME= 'FK_aAnalysedPOItems_aItem')
BEGIN
	ALTER TABLE [aAnalysedPOItems] WITH CHECK ADD  CONSTRAINT [FK_aAnalysedPOItems_aItem] FOREIGN KEY ([alitemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aAnalysedPOItems] CHECK CONSTRAINT [FK_aAnalysedPOItems_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aBouncedChequeDetails' AND CONSTRAINT_NAME= 'fk_aBouncedChequeDetails_acompanymaster')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] WITH CHECK ADD  CONSTRAINT [fk_aBouncedChequeDetails_acompanymaster] FOREIGN KEY ([BcCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aBouncedChequeDetails] CHECK CONSTRAINT [fk_aBouncedChequeDetails_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aBouncedChequeDetails' AND CONSTRAINT_NAME= 'fk_aBouncedChequeDetails_adepartmentmaster')
BEGIN
	ALTER TABLE [aBouncedChequeDetails] WITH CHECK ADD  CONSTRAINT [fk_aBouncedChequeDetails_adepartmentmaster] FOREIGN KEY ([BcDepartmentID],[BcCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aBouncedChequeDetails] CHECK CONSTRAINT [fk_aBouncedChequeDetails_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_AccountsInvoiceHeader_aAccountMaster')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_AccountsInvoiceHeader_aAccountMaster] FOREIGN KEY ([BankCashID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [AccountsInvoiceHeader] CHECK CONSTRAINT [FK_AccountsInvoiceHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_AccountsInvoiceHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_AccountsInvoiceHeader_aAccountMaster1] FOREIGN KEY ([DiscountAccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [AccountsInvoiceHeader] CHECK CONSTRAINT [FK_AccountsInvoiceHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_AccountsInvoiceHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_AccountsInvoiceHeader_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [AccountsInvoiceHeader] CHECK CONSTRAINT [FK_AccountsInvoiceHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND CONSTRAINT_NAME= 'fk_accountsinvoiceheader_acustomermaster')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [fk_accountsinvoiceheader_acustomermaster] FOREIGN KEY ([CustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [AccountsInvoiceHeader] CHECK CONSTRAINT [fk_accountsinvoiceheader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_AccountsInvoiceHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_AccountsInvoiceHeader_aDepartmentMaster] FOREIGN KEY ([DepartmentID],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [AccountsInvoiceHeader] CHECK CONSTRAINT [FK_AccountsInvoiceHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_AccountsInvoiceHeader_aFinancialYear')
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_AccountsInvoiceHeader_aFinancialYear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [AccountsInvoiceHeader] CHECK CONSTRAINT [FK_AccountsInvoiceHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCity' AND CONSTRAINT_NAME= 'fk_aCity_acompanymaster')
BEGIN
	ALTER TABLE [aCity] WITH CHECK ADD  CONSTRAINT [fk_aCity_acompanymaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aCity] CHECK CONSTRAINT [fk_aCity_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCity' AND CONSTRAINT_NAME= 'fk_aCity_acountrymaster')
BEGIN
	ALTER TABLE [aCity] WITH CHECK ADD  CONSTRAINT [fk_aCity_acountrymaster] FOREIGN KEY ([CountryID],[CompanyID]) REFERENCES aCountryMaster([CountryID],[CompanyID])
END
GO
 ALTER TABLE [aCity] CHECK CONSTRAINT [fk_aCity_acountrymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCountryMaster' AND CONSTRAINT_NAME= 'FK_aCountryMaster_aCompanyMaster')
BEGIN
	ALTER TABLE [aCountryMaster] WITH CHECK ADD  CONSTRAINT [FK_aCountryMaster_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aCountryMaster] CHECK CONSTRAINT [FK_aCountryMaster_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCurrencyMaster' AND CONSTRAINT_NAME= 'FK_aCurrencyMaster_aCountryMaster')
BEGIN
	ALTER TABLE [aCurrencyMaster] WITH CHECK ADD  CONSTRAINT [FK_aCurrencyMaster_aCountryMaster] FOREIGN KEY ([CountryID],[CompanyID]) REFERENCES aCountryMaster([CountryID],[CompanyID])
END
GO
 ALTER TABLE [aCurrencyMaster] CHECK CONSTRAINT [FK_aCurrencyMaster_aCountryMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCustomerMaster' AND CONSTRAINT_NAME= 'FK_aCustomerMaster_aCity')
BEGIN
	ALTER TABLE [aCustomerMaster] WITH CHECK ADD  CONSTRAINT [FK_aCustomerMaster_aCity] FOREIGN KEY ([CityID]) REFERENCES aCity([CityID])
END
GO
 ALTER TABLE [aCustomerMaster] CHECK CONSTRAINT [FK_aCustomerMaster_aCity]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCustomerMaster' AND CONSTRAINT_NAME= 'FK_aCustomerMaster_aCompanyMaster')
BEGIN
	ALTER TABLE [aCustomerMaster] WITH CHECK ADD  CONSTRAINT [FK_aCustomerMaster_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aCustomerMaster] CHECK CONSTRAINT [FK_aCustomerMaster_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCustomerMaster' AND CONSTRAINT_NAME= 'FK_aCustomerMaster_aCountryMaster')
BEGIN
	ALTER TABLE [aCustomerMaster] WITH CHECK ADD  CONSTRAINT [FK_aCustomerMaster_aCountryMaster] FOREIGN KEY ([CountryID],[CompanyID]) REFERENCES aCountryMaster([CountryID],[CompanyID])
END
GO
 ALTER TABLE [aCustomerMaster] CHECK CONSTRAINT [FK_aCustomerMaster_aCountryMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCustomerMaster' AND CONSTRAINT_NAME= 'FK_aCustomerMaster_aCurrencyMaster')
BEGIN
	ALTER TABLE [aCustomerMaster] WITH CHECK ADD  CONSTRAINT [FK_aCustomerMaster_aCurrencyMaster] FOREIGN KEY ([CurrencyID],[CompanyID]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [aCustomerMaster] CHECK CONSTRAINT [FK_aCustomerMaster_aCurrencyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aCustomerMaster' AND CONSTRAINT_NAME= 'fk_acustomermaster_asegmentmaster')
BEGIN
	ALTER TABLE [aCustomerMaster] WITH CHECK ADD  CONSTRAINT [fk_acustomermaster_asegmentmaster] FOREIGN KEY ([CompanyID],[segmentid]) REFERENCES ASegmentMaster([companyid],[Segmentid])
END
GO
 ALTER TABLE [aCustomerMaster] CHECK CONSTRAINT [fk_acustomermaster_asegmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aDepartmentMaster' AND CONSTRAINT_NAME= 'FK_aDepartmentMaster_aCompanyMaster')
BEGIN
	ALTER TABLE [aDepartmentMaster] WITH CHECK ADD  CONSTRAINT [FK_aDepartmentMaster_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aDepartmentMaster] CHECK CONSTRAINT [FK_aDepartmentMaster_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aDepartmentMaster' AND CONSTRAINT_NAME= 'fk_adepartmentmaster_acurrencymaster')
BEGIN
	ALTER TABLE [aDepartmentMaster] WITH CHECK ADD  CONSTRAINT [fk_adepartmentmaster_acurrencymaster] FOREIGN KEY ([depcurrencyid],[CompanyID]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [aDepartmentMaster] CHECK CONSTRAINT [fk_adepartmentmaster_acurrencymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aDepartmentMaster' AND CONSTRAINT_NAME= 'fk_department_Dep')
BEGIN
	ALTER TABLE [aDepartmentMaster] WITH CHECK ADD  CONSTRAINT [fk_department_Dep] FOREIGN KEY ([ParentDepId],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aDepartmentMaster] CHECK CONSTRAINT [fk_department_Dep]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentDetails' AND CONSTRAINT_NAME= 'FK_AdjustmentDetails_AccountMaster')
BEGIN
	ALTER TABLE [AdjustmentDetails] WITH CHECK ADD  CONSTRAINT [FK_AdjustmentDetails_AccountMaster] FOREIGN KEY ([AccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [AdjustmentDetails] CHECK CONSTRAINT [FK_AdjustmentDetails_AccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentDetails' AND CONSTRAINT_NAME= 'FK_AdjustmentDetails_AdjustmentHeader')
BEGIN
	ALTER TABLE [AdjustmentDetails] WITH CHECK ADD  CONSTRAINT [FK_AdjustmentDetails_AdjustmentHeader] FOREIGN KEY ([AdjustmentID],[CompanyID]) REFERENCES AdjustmentHeader([AdjustmentID],[CompanyID])
END
GO
 ALTER TABLE [AdjustmentDetails] CHECK CONSTRAINT [FK_AdjustmentDetails_AdjustmentHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentDetails' AND CONSTRAINT_NAME= 'FK_AdjustmentDetails_CustomerMaster')
BEGIN
	ALTER TABLE [AdjustmentDetails] WITH CHECK ADD  CONSTRAINT [FK_AdjustmentDetails_CustomerMaster] FOREIGN KEY ([CustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [AdjustmentDetails] CHECK CONSTRAINT [FK_AdjustmentDetails_CustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentDetails' AND CONSTRAINT_NAME= 'FK_AdjustmentDetails_VendorMaster')
BEGIN
	ALTER TABLE [AdjustmentDetails] WITH CHECK ADD  CONSTRAINT [FK_AdjustmentDetails_VendorMaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [AdjustmentDetails] CHECK CONSTRAINT [FK_AdjustmentDetails_VendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentHeader' AND CONSTRAINT_NAME= 'FK_AdjustmentHeader_AccountMaster')
BEGIN
	ALTER TABLE [AdjustmentHeader] WITH CHECK ADD  CONSTRAINT [FK_AdjustmentHeader_AccountMaster] FOREIGN KEY ([Accountid],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [AdjustmentHeader] CHECK CONSTRAINT [FK_AdjustmentHeader_AccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentHeader' AND CONSTRAINT_NAME= 'FK_AdjustmentHeader_CompanyMaster')
BEGIN
	ALTER TABLE [AdjustmentHeader] WITH CHECK ADD  CONSTRAINT [FK_AdjustmentHeader_CompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [AdjustmentHeader] CHECK CONSTRAINT [FK_AdjustmentHeader_CompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentHeader' AND CONSTRAINT_NAME= 'FK_AdjustmentHeader_DepartmentMaster')
BEGIN
	ALTER TABLE [AdjustmentHeader] WITH CHECK ADD  CONSTRAINT [FK_AdjustmentHeader_DepartmentMaster] FOREIGN KEY ([Departmentid],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [AdjustmentHeader] CHECK CONSTRAINT [FK_AdjustmentHeader_DepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AdjustmentHeader' AND CONSTRAINT_NAME= 'FK_AdjustmentHeader_FinancialYear')
BEGIN
	ALTER TABLE [AdjustmentHeader] WITH CHECK ADD  CONSTRAINT [FK_AdjustmentHeader_FinancialYear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [AdjustmentHeader] CHECK CONSTRAINT [FK_AdjustmentHeader_FinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aFinancialYear' AND CONSTRAINT_NAME= 'FK_aFinancialYear_aCompanyMaster')
BEGIN
	ALTER TABLE [aFinancialYear] WITH CHECK ADD  CONSTRAINT [FK_aFinancialYear_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aFinancialYear] CHECK CONSTRAINT [FK_aFinancialYear_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aFineDetail' AND CONSTRAINT_NAME= 'FK_afineDetail_aFineHeader')
BEGIN
	ALTER TABLE [aFineDetail] WITH CHECK ADD  CONSTRAINT [FK_afineDetail_aFineHeader] FOREIGN KEY ([fdFineID]) REFERENCES aFineHeader([fhFineID])
END
GO
 ALTER TABLE [aFineDetail] CHECK CONSTRAINT [FK_afineDetail_aFineHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodown' AND CONSTRAINT_NAME= 'fk_aGodown_aaccountmaster')
BEGIN
	ALTER TABLE [aGodown] WITH CHECK ADD  CONSTRAINT [fk_aGodown_aaccountmaster] FOREIGN KEY ([stockwriteoffaccid],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aGodown] CHECK CONSTRAINT [fk_aGodown_aaccountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodown' AND CONSTRAINT_NAME= 'FK_aGodown_aCity')
BEGIN
	ALTER TABLE [aGodown] WITH CHECK ADD  CONSTRAINT [FK_aGodown_aCity] FOREIGN KEY ([CityID]) REFERENCES aCity([CityID])
END
GO
 ALTER TABLE [aGodown] CHECK CONSTRAINT [FK_aGodown_aCity]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodown' AND CONSTRAINT_NAME= 'FK_aGodown_aCompanyMaster')
BEGIN
	ALTER TABLE [aGodown] WITH CHECK ADD  CONSTRAINT [FK_aGodown_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aGodown] CHECK CONSTRAINT [FK_aGodown_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodown' AND CONSTRAINT_NAME= 'FK_aGodown_aCountryMaster')
BEGIN
	ALTER TABLE [aGodown] WITH CHECK ADD  CONSTRAINT [FK_aGodown_aCountryMaster] FOREIGN KEY ([CountryID],[CompanyID]) REFERENCES aCountryMaster([CountryID],[CompanyID])
END
GO
 ALTER TABLE [aGodown] CHECK CONSTRAINT [FK_aGodown_aCountryMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodown' AND CONSTRAINT_NAME= 'FK_aGodown_aDepartmentMaster')
BEGIN
	ALTER TABLE [aGodown] WITH CHECK ADD  CONSTRAINT [FK_aGodown_aDepartmentMaster] FOREIGN KEY ([DepartmentId],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aGodown] CHECK CONSTRAINT [FK_aGodown_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodownDetail' AND CONSTRAINT_NAME= 'FK_aGodownDetail_aGodown')
BEGIN
	ALTER TABLE [aGodownDetail] WITH CHECK ADD  CONSTRAINT [FK_aGodownDetail_aGodown] FOREIGN KEY ([GodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [aGodownDetail] CHECK CONSTRAINT [FK_aGodownDetail_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodownDetail' AND CONSTRAINT_NAME= 'FK_aGodownDetail_Item')
BEGIN
	ALTER TABLE [aGodownDetail] WITH CHECK ADD  CONSTRAINT [FK_aGodownDetail_Item] FOREIGN KEY ([ItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aGodownDetail] CHECK CONSTRAINT [FK_aGodownDetail_Item]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodownItemCategory' AND CONSTRAINT_NAME= 'FK_aGodownItemCategory_aGodown')
BEGIN
	ALTER TABLE [aGodownItemCategory] WITH CHECK ADD  CONSTRAINT [FK_aGodownItemCategory_aGodown] FOREIGN KEY ([Godownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [aGodownItemCategory] CHECK CONSTRAINT [FK_aGodownItemCategory_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGodownItemCategory' AND CONSTRAINT_NAME= 'FK_aGodownItemCategory_aItemCategory')
BEGIN
	ALTER TABLE [aGodownItemCategory] WITH CHECK ADD  CONSTRAINT [FK_aGodownItemCategory_aItemCategory] FOREIGN KEY ([categoryID]) REFERENCES aItemCategory([ItemCategoryID])
END
GO
 ALTER TABLE [aGodownItemCategory] CHECK CONSTRAINT [FK_aGodownItemCategory_aItemCategory]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementContents' AND CONSTRAINT_NAME= 'FK_AgreementContents_AgreementRegister')
BEGIN
	ALTER TABLE [AgreementContents] WITH CHECK ADD  CONSTRAINT [FK_AgreementContents_AgreementRegister] FOREIGN KEY ([agcagreementid],[agcDepartmentid]) REFERENCES AgreementRegister([agragreementid],[agrDepartmentid])
END
GO
 ALTER TABLE [AgreementContents] CHECK CONSTRAINT [FK_AgreementContents_AgreementRegister]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementDetails' AND CONSTRAINT_NAME= 'FK_AgreementDetails_AgreementRegister')
BEGIN
	ALTER TABLE [AgreementDetails] WITH CHECK ADD  CONSTRAINT [FK_AgreementDetails_AgreementRegister] FOREIGN KEY ([agdAgreementid],[agdDepartmentid]) REFERENCES AgreementRegister([agragreementid],[agrDepartmentid])
END
GO
 ALTER TABLE [AgreementDetails] CHECK CONSTRAINT [FK_AgreementDetails_AgreementRegister]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementFinancialDetails' AND CONSTRAINT_NAME= 'FK_AgreementFinancialDetails_AgreementRegister')
BEGIN
	ALTER TABLE [AgreementFinancialDetails] WITH CHECK ADD  CONSTRAINT [FK_AgreementFinancialDetails_AgreementRegister] FOREIGN KEY ([agfAgreementid],[agfDepartmentId]) REFERENCES AgreementRegister([agragreementid],[agrDepartmentid])
END
GO
 ALTER TABLE [AgreementFinancialDetails] CHECK CONSTRAINT [FK_AgreementFinancialDetails_AgreementRegister]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementSignedDetails' AND CONSTRAINT_NAME= 'FK_AgreementSignedDetails_AgreementRegister')
BEGIN
	ALTER TABLE [AgreementSignedDetails] WITH CHECK ADD  CONSTRAINT [FK_AgreementSignedDetails_AgreementRegister] FOREIGN KEY ([agsagreementid],[agsDepartmentid]) REFERENCES AgreementRegister([agragreementid],[agrDepartmentid])
END
GO
 ALTER TABLE [AgreementSignedDetails] CHECK CONSTRAINT [FK_AgreementSignedDetails_AgreementRegister]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AgreementWitnessDetails' AND CONSTRAINT_NAME= 'FK_AgreementWitnessDetails_AgreementRegister')
BEGIN
	ALTER TABLE [AgreementWitnessDetails] WITH CHECK ADD  CONSTRAINT [FK_AgreementWitnessDetails_AgreementRegister] FOREIGN KEY ([agwAgreementid],[agwDepartmentid]) REFERENCES AgreementRegister([agragreementid],[agrDepartmentid])
END
GO
 ALTER TABLE [AgreementWitnessDetails] CHECK CONSTRAINT [FK_AgreementWitnessDetails_AgreementRegister]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGroupMaster' AND CONSTRAINT_NAME= 'FK_aGroupMaster_aCompanyMaster')
BEGIN
	ALTER TABLE [aGroupMaster] WITH CHECK ADD  CONSTRAINT [FK_aGroupMaster_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aGroupMaster] CHECK CONSTRAINT [FK_aGroupMaster_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aGroupMaster' AND CONSTRAINT_NAME= 'FK_aGroupMaster_aGroupMaster')
BEGIN
	ALTER TABLE [aGroupMaster] WITH CHECK ADD  CONSTRAINT [FK_aGroupMaster_aGroupMaster] FOREIGN KEY ([ParentGroupID],[CompanyID]) REFERENCES aGroupMaster([GroupID],[CompanyID])
END
GO
 ALTER TABLE [aGroupMaster] CHECK CONSTRAINT [FK_aGroupMaster_aGroupMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHpItemDetails' AND CONSTRAINT_NAME= 'FK_aHpItemDetails_aItem')
BEGIN
	ALTER TABLE [aHpItemDetails] WITH CHECK ADD  CONSTRAINT [FK_aHpItemDetails_aItem] FOREIGN KEY ([ItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aHpItemDetails] CHECK CONSTRAINT [FK_aHpItemDetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHPItemTransferDetail' AND CONSTRAINT_NAME= 'FK_aHPItemTransferDetail_aHPItemTransferHeader')
BEGIN
	ALTER TABLE [aHPItemTransferDetail] WITH CHECK ADD  CONSTRAINT [FK_aHPItemTransferDetail_aHPItemTransferHeader] FOREIGN KEY ([itdCompanyID],[itdFinancialID],[itdTransferID]) REFERENCES aHPItemTransferHeader([ithCompanyID],[ithFinancialID],[ithTransferID])
END
GO
 ALTER TABLE [aHPItemTransferDetail] CHECK CONSTRAINT [FK_aHPItemTransferDetail_aHPItemTransferHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHpProcessingHeader' AND CONSTRAINT_NAME= 'FK_aHpProcessingHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [aHpProcessingHeader] WITH NOCHECK ADD  CONSTRAINT [FK_aHpProcessingHeader_aCompanyMaster] FOREIGN KEY ([hphCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aHpProcessingHeader] CHECK CONSTRAINT [FK_aHpProcessingHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND CONSTRAINT_NAME= 'FK_aHpReceiptVoucherHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_aHpReceiptVoucherHeader_aCompanyMaster] FOREIGN KEY ([hprhCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aHpReceiptVoucherHeader] CHECK CONSTRAINT [FK_aHpReceiptVoucherHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHpReceiptVoucherHeader' AND CONSTRAINT_NAME= 'FK_aHpReceiptVoucherHeader_aShops')
BEGIN
	ALTER TABLE [aHpReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_aHpReceiptVoucherHeader_aShops] FOREIGN KEY ([hprhShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aHpReceiptVoucherHeader] CHECK CONSTRAINT [FK_aHpReceiptVoucherHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND CONSTRAINT_NAME= 'FK_aHQDespatchNoteDetails_aGodown')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQDespatchNoteDetails_aGodown] FOREIGN KEY ([ddGodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [aHQDespatchNoteDetails] CHECK CONSTRAINT [FK_aHQDespatchNoteDetails_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND CONSTRAINT_NAME= 'FK_aHQDespatchNoteDetails_aHQDespatchnoteHeader')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQDespatchNoteDetails_aHQDespatchnoteHeader] FOREIGN KEY ([ddDespatchnoteID]) REFERENCES aHQDespatchnoteHeader([dhDespatchnoteID])
END
GO
 ALTER TABLE [aHQDespatchNoteDetails] CHECK CONSTRAINT [FK_aHQDespatchNoteDetails_aHQDespatchnoteHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND CONSTRAINT_NAME= 'FK_aHQDespatchnoteDetails_aItem')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQDespatchnoteDetails_aItem] FOREIGN KEY ([ddItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aHQDespatchNoteDetails] CHECK CONSTRAINT [FK_aHQDespatchnoteDetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND CONSTRAINT_NAME= 'FK_aHQDespatchNoteDetails_aPackingType')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQDespatchNoteDetails_aPackingType] FOREIGN KEY ([ddPackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [aHQDespatchNoteDetails] CHECK CONSTRAINT [FK_aHQDespatchNoteDetails_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND CONSTRAINT_NAME= 'fk_aHQDespatchNoteDetails_aShops')
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] WITH CHECK ADD  CONSTRAINT [fk_aHQDespatchNoteDetails_aShops] FOREIGN KEY ([ddShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aHQDespatchNoteDetails] CHECK CONSTRAINT [fk_aHQDespatchNoteDetails_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND CONSTRAINT_NAME= 'FK_aHQDespatchnoteHeader_aGodown')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] WITH CHECK ADD  CONSTRAINT [FK_aHQDespatchnoteHeader_aGodown] FOREIGN KEY ([dhGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [aHQDespatchnoteHeader] CHECK CONSTRAINT [FK_aHQDespatchnoteHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND CONSTRAINT_NAME= 'FK_aHQDespatchnoteHeader_aHQDespatchNoteMain')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] WITH CHECK ADD  CONSTRAINT [FK_aHQDespatchnoteHeader_aHQDespatchNoteMain] FOREIGN KEY ([dhDespatchNoteMainID]) REFERENCES aHQDespatchNoteMain([dnmDespatchNoteID])
END
GO
 ALTER TABLE [aHQDespatchnoteHeader] CHECK CONSTRAINT [FK_aHQDespatchnoteHeader_aHQDespatchNoteMain]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND CONSTRAINT_NAME= 'fk_aHQDespatchNoteHeader_ashipment')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] WITH CHECK ADD  CONSTRAINT [fk_aHQDespatchNoteHeader_ashipment] FOREIGN KEY ([dhShipmentID]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [aHQDespatchnoteHeader] CHECK CONSTRAINT [fk_aHQDespatchNoteHeader_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND CONSTRAINT_NAME= 'fk_aHQDespatchnoteHeader_aShops')
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] WITH CHECK ADD  CONSTRAINT [fk_aHQDespatchnoteHeader_aShops] FOREIGN KEY ([dhshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aHQDespatchnoteHeader] CHECK CONSTRAINT [fk_aHQDespatchnoteHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND CONSTRAINT_NAME= 'FK_aHQDespatchNoteMain_aDepartmentMaster')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] WITH CHECK ADD  CONSTRAINT [FK_aHQDespatchNoteMain_aDepartmentMaster] FOREIGN KEY ([departmentid],[companyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aHQDespatchNoteMain] CHECK CONSTRAINT [FK_aHQDespatchNoteMain_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND CONSTRAINT_NAME= 'FK_aHQDespatchNoteMain_LOspPurchaseBillHeader')
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] WITH CHECK ADD  CONSTRAINT [FK_aHQDespatchNoteMain_LOspPurchaseBillHeader] FOREIGN KEY ([dnmBillID]) REFERENCES LOspPurchaseBillHeader([pbhBillID])
END
GO
 ALTER TABLE [aHQDespatchNoteMain] CHECK CONSTRAINT [FK_aHQDespatchNoteMain_LOspPurchaseBillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND CONSTRAINT_NAME= 'fk_aHQIssuenotedetail_agodown')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] WITH CHECK ADD  CONSTRAINT [fk_aHQIssuenotedetail_agodown] FOREIGN KEY ([INDGodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [aHQIssuenoteDetail] CHECK CONSTRAINT [fk_aHQIssuenotedetail_agodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND CONSTRAINT_NAME= 'FK_aHQIssuenoteDetail_aHQIssuenoteHeader')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] WITH CHECK ADD  CONSTRAINT [FK_aHQIssuenoteDetail_aHQIssuenoteHeader] FOREIGN KEY ([INDIssuenoteID]) REFERENCES aHQIssuenoteHeader([INHIssuenoteID])
END
GO
 ALTER TABLE [aHQIssuenoteDetail] CHECK CONSTRAINT [FK_aHQIssuenoteDetail_aHQIssuenoteHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND CONSTRAINT_NAME= 'fk_aHQIssuenotedetail_aitem')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] WITH CHECK ADD  CONSTRAINT [fk_aHQIssuenotedetail_aitem] FOREIGN KEY ([INDItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aHQIssuenoteDetail] CHECK CONSTRAINT [fk_aHQIssuenotedetail_aitem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND CONSTRAINT_NAME= 'fk_aHQIssuenotedetail_ashipment')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] WITH CHECK ADD  CONSTRAINT [fk_aHQIssuenotedetail_ashipment] FOREIGN KEY ([INDShipmentID]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [aHQIssuenoteDetail] CHECK CONSTRAINT [fk_aHQIssuenotedetail_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND CONSTRAINT_NAME= 'fk_aHQIssuenotedetail_loilocation')
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] WITH CHECK ADD  CONSTRAINT [fk_aHQIssuenotedetail_loilocation] FOREIGN KEY ([INDGodownid],[INDLocationID]) REFERENCES LOiLocation([lGodownID],[lLocationID])
END
GO
 ALTER TABLE [aHQIssuenoteDetail] CHECK CONSTRAINT [fk_aHQIssuenotedetail_loilocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND CONSTRAINT_NAME= 'FK_aHQIssuenoteHeader_aGodown')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] WITH CHECK ADD  CONSTRAINT [FK_aHQIssuenoteHeader_aGodown] FOREIGN KEY ([INHGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [aHQIssuenoteHeader] CHECK CONSTRAINT [FK_aHQIssuenoteHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND CONSTRAINT_NAME= 'FK_aHQIssuenoteHeader_aGodown1')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] WITH CHECK ADD  CONSTRAINT [FK_aHQIssuenoteHeader_aGodown1] FOREIGN KEY ([INHTogodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [aHQIssuenoteHeader] CHECK CONSTRAINT [FK_aHQIssuenoteHeader_aGodown1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND CONSTRAINT_NAME= 'FK_aHQIssuenoteHeader_aHQIssueNoteMain')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] WITH CHECK ADD  CONSTRAINT [FK_aHQIssuenoteHeader_aHQIssueNoteMain] FOREIGN KEY ([INHIssuenotemainID]) REFERENCES aHQIssueNoteMain([INMIssuenoteID])
END
GO
 ALTER TABLE [aHQIssuenoteHeader] CHECK CONSTRAINT [FK_aHQIssuenoteHeader_aHQIssueNoteMain]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND CONSTRAINT_NAME= 'FK_aHQIssuenoteHeader_aShops')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] WITH CHECK ADD  CONSTRAINT [FK_aHQIssuenoteHeader_aShops] FOREIGN KEY ([INHToshopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aHQIssuenoteHeader] CHECK CONSTRAINT [FK_aHQIssuenoteHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND CONSTRAINT_NAME= 'fk_aHQIssuenoteHeader_mosgoodsrequestheader')
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] WITH CHECK ADD  CONSTRAINT [fk_aHQIssuenoteHeader_mosgoodsrequestheader] FOREIGN KEY ([INHShopReqId],[INHToshopID]) REFERENCES mosGoodsRequestHeader([GRHrequestID],[GRHshopID])
END
GO
 ALTER TABLE [aHQIssuenoteHeader] CHECK CONSTRAINT [fk_aHQIssuenoteHeader_mosgoodsrequestheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssueNoteMain' AND CONSTRAINT_NAME= 'FK_aHQIssueNoteMain_aDepartmentMaster')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] WITH CHECK ADD  CONSTRAINT [FK_aHQIssueNoteMain_aDepartmentMaster] FOREIGN KEY ([departmentid],[companyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aHQIssueNoteMain] CHECK CONSTRAINT [FK_aHQIssueNoteMain_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssueNoteMain' AND CONSTRAINT_NAME= 'FK_aHQIssueNoteMain_aShops')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] WITH CHECK ADD  CONSTRAINT [FK_aHQIssueNoteMain_aShops] FOREIGN KEY ([INMShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aHQIssueNoteMain] CHECK CONSTRAINT [FK_aHQIssueNoteMain_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQIssueNoteMain' AND CONSTRAINT_NAME= 'fk_aHQIssueNoteMain_mosgoodsrequestheader')
BEGIN
	ALTER TABLE [aHQIssueNoteMain] WITH CHECK ADD  CONSTRAINT [fk_aHQIssueNoteMain_mosgoodsrequestheader] FOREIGN KEY ([INMRequestID],[INMShopID]) REFERENCES mosGoodsRequestHeader([GRHrequestID],[GRHshopID])
END
GO
 ALTER TABLE [aHQIssueNoteMain] CHECK CONSTRAINT [fk_aHQIssueNoteMain_mosgoodsrequestheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherDebitDetails_aAccountMaster')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherDebitDetails_aAccountMaster] FOREIGN KEY ([pddAccountID],[pddCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aHQPaymentVoucherDebitDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherDebitDetails_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherDebitDetails_aCompanyMaster')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherDebitDetails_aCompanyMaster] FOREIGN KEY ([pddCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aHQPaymentVoucherDebitDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherDebitDetails_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherDebitDetails_aHQPaymentVoucherHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherDebitDetails_aHQPaymentVoucherHeader] FOREIGN KEY ([pddPaymentID]) REFERENCES aHQPaymentVoucherHeader([phPaymentID])
END
GO
 ALTER TABLE [aHQPaymentVoucherDebitDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherDebitDetails_aHQPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherdebitDetails_lopurchaseorderheader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] WITH NOCHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherdebitDetails_lopurchaseorderheader] FOREIGN KEY ([pddhqpoid]) REFERENCES loPurchaseOrderHeader([pohPoid])
END
GO
 ALTER TABLE [aHQPaymentVoucherDebitDetails] CHECK CONSTRAINT [fk_aHQPaymentVoucherdebitDetails_lopurchaseorderheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherDetails_aHQPaymentVoucherHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherDetails_aHQPaymentVoucherHeader] FOREIGN KEY ([pdPaymentID]) REFERENCES aHQPaymentVoucherHeader([phPaymentID])
END
GO
 ALTER TABLE [aHQPaymentVoucherDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherDetails_aHQPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherDetails_Bills')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] WITH NOCHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherDetails_Bills] FOREIGN KEY ([pdAccBillsID]) REFERENCES Bills([BillsID])
END
GO
 ALTER TABLE [aHQPaymentVoucherDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherDetails_Bills]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherDetails_debitcreditnote')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherDetails_debitcreditnote] FOREIGN KEY ([pddcnid]) REFERENCES DebitCreditNote([DCNId])
END
GO
 ALTER TABLE [aHQPaymentVoucherDetails] CHECK CONSTRAINT [fk_aHQPaymentVoucherDetails_debitcreditnote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherDetails_loPurchaseOrderHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] WITH NOCHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherDetails_loPurchaseOrderHeader] FOREIGN KEY ([pdHQPOID]) REFERENCES loPurchaseOrderHeader([pohPoid])
END
GO
 ALTER TABLE [aHQPaymentVoucherDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherDetails_loPurchaseOrderHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherDetails_losDebitCreditNote')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherDetails_losDebitCreditNote] FOREIGN KEY ([pdshopid],[shopdcnid]) REFERENCES losDebitCreditNote([losDCNShopid],[losDCNId])
END
GO
 ALTER TABLE [aHQPaymentVoucherDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherDetails_losDebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherDetails_loslocalpurchaseheader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherDetails_loslocalpurchaseheader] FOREIGN KEY ([pdshopid],[pdposlpbillid]) REFERENCES LosLocalPurchaseHeader([lphShopID],[lphBillID])
END
GO
 ALTER TABLE [aHQPaymentVoucherDetails] CHECK CONSTRAINT [fk_aHQPaymentVoucherDetails_loslocalpurchaseheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherDetails_LOspPurchaseBillHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherDetails_LOspPurchaseBillHeader] FOREIGN KEY ([pdBillsID]) REFERENCES LOspPurchaseBillHeader([pbhBillID])
END
GO
 ALTER TABLE [aHQPaymentVoucherDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherDetails_LOspPurchaseBillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherDetails_ReceiptVoucherHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherDetails_ReceiptVoucherHeader] FOREIGN KEY ([pdreceiptid]) REFERENCES ReceiptVoucherHeader([ReceiptID])
END
GO
 ALTER TABLE [aHQPaymentVoucherDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherDetails_ReceiptVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherHeader_aAccountMaster')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherHeader_aAccountMaster] FOREIGN KEY ([phBankCashID],[phCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aHQPaymentVoucherHeader] CHECK CONSTRAINT [FK_aHQPaymentVoucherHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherheader_aaccountmaster_debit')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherheader_aaccountmaster_debit] FOREIGN KEY ([phdebitaccountid],[phCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aHQPaymentVoucherHeader] CHECK CONSTRAINT [fk_aHQPaymentVoucherheader_aaccountmaster_debit]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherHeader_aAccountMaster1] FOREIGN KEY ([phGoodsinTransitaccid],[phCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aHQPaymentVoucherHeader] CHECK CONSTRAINT [FK_aHQPaymentVoucherHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherHeader_aCompanyMaster] FOREIGN KEY ([phCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aHQPaymentVoucherHeader] CHECK CONSTRAINT [FK_aHQPaymentVoucherHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherheader_acustomermaster')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherheader_acustomermaster] FOREIGN KEY ([phCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [aHQPaymentVoucherHeader] CHECK CONSTRAINT [fk_aHQPaymentVoucherheader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherheader_adepartmentmaster')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherheader_adepartmentmaster] FOREIGN KEY ([phDepartmentID],[phCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aHQPaymentVoucherHeader] CHECK CONSTRAINT [fk_aHQPaymentVoucherheader_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherheader_afinancialyear')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherheader_afinancialyear] FOREIGN KEY ([phFinancialID],[phCompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [aHQPaymentVoucherHeader] CHECK CONSTRAINT [fk_aHQPaymentVoucherheader_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherheader_avendormaster')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherheader_avendormaster] FOREIGN KEY ([phVendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [aHQPaymentVoucherHeader] CHECK CONSTRAINT [fk_aHQPaymentVoucherheader_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherheader_lopurchaseorderheader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] WITH NOCHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherheader_lopurchaseorderheader] FOREIGN KEY ([phpohid]) REFERENCES loPurchaseOrderHeader([pohPoid])
END
GO
 ALTER TABLE [aHQPaymentVoucherHeader] CHECK CONSTRAINT [fk_aHQPaymentVoucherheader_lopurchaseorderheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherRebateDetails_aHQPaymentVoucherHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherRebateDetails_aHQPaymentVoucherHeader] FOREIGN KEY ([PaymentID]) REFERENCES aHQPaymentVoucherHeader([phPaymentID])
END
GO
 ALTER TABLE [aHQPaymentVoucherRebateDetails] CHECK CONSTRAINT [fk_aHQPaymentVoucherRebateDetails_aHQPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherRebateDetails' AND CONSTRAINT_NAME= 'pk_aHQPaymentVoucherRebateDetails_losRebateConfirmHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherRebateDetails] WITH CHECK ADD  CONSTRAINT [pk_aHQPaymentVoucherRebateDetails_losRebateConfirmHeader] FOREIGN KEY ([ShopID],[RebateApprovalID]) REFERENCES losrebateconfirmheader([rcshopid],[rcapprovedid])
END
GO
 ALTER TABLE [aHQPaymentVoucherRebateDetails] CHECK CONSTRAINT [pk_aHQPaymentVoucherRebateDetails_losRebateConfirmHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherSCDetails_aHQPaymentVoucherHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherSCDetails_aHQPaymentVoucherHeader] FOREIGN KEY ([PaymentID]) REFERENCES aHQPaymentVoucherHeader([phPaymentID])
END
GO
 ALTER TABLE [aHQPaymentVoucherSCDetails] CHECK CONSTRAINT [fk_aHQPaymentVoucherSCDetails_aHQPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherSCDetails' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherSCDetails_HQSalesCommisionHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSCDetails] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherSCDetails_HQSalesCommisionHeader] FOREIGN KEY ([SalesCommID],[CompanyID]) REFERENCES hqSalesCommisionHeader([schCommisionid],[schcompanyid])
END
GO
 ALTER TABLE [aHQPaymentVoucherSCDetails] CHECK CONSTRAINT [fk_aHQPaymentVoucherSCDetails_HQSalesCommisionHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherSPDetails' AND CONSTRAINT_NAME= 'fk_aHQPaymentVoucherSPDetails_HQSalesPromotionDetail')
BEGIN
	ALTER TABLE [aHQPaymentVoucherSPDetails] WITH CHECK ADD  CONSTRAINT [fk_aHQPaymentVoucherSPDetails_HQSalesPromotionDetail] FOREIGN KEY ([CompanyID],[PromotionID],[PromotionDetailID]) REFERENCES HQSalesPromotionDetail([spdCompanyID],[spdpromotionID],[spdDetailID])
END
GO
 ALTER TABLE [aHQPaymentVoucherSPDetails] CHECK CONSTRAINT [fk_aHQPaymentVoucherSPDetails_HQSalesPromotionDetail]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherVendorDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherVendorDetails_aHQPaymentVoucherHeader')
BEGIN
	ALTER TABLE [aHQPaymentVoucherVendorDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherVendorDetails_aHQPaymentVoucherHeader] FOREIGN KEY ([pvdPaymentid]) REFERENCES aHQPaymentVoucherHeader([phPaymentID])
END
GO
 ALTER TABLE [aHQPaymentVoucherVendorDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherVendorDetails_aHQPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aHQPaymentVoucherVendorDetails' AND CONSTRAINT_NAME= 'FK_aHQPaymentVoucherVendorDetails_aVendorMaster')
BEGIN
	ALTER TABLE [aHQPaymentVoucherVendorDetails] WITH CHECK ADD  CONSTRAINT [FK_aHQPaymentVoucherVendorDetails_aVendorMaster] FOREIGN KEY ([pvdVendorid]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [aHQPaymentVoucherVendorDetails] CHECK CONSTRAINT [FK_aHQPaymentVoucherVendorDetails_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aItemPackingDetail' AND CONSTRAINT_NAME= 'FK_aItemPackingDetail_aItem')
BEGIN
	ALTER TABLE [aItemPackingDetail] WITH CHECK ADD  CONSTRAINT [FK_aItemPackingDetail_aItem] FOREIGN KEY ([ItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aItemPackingDetail] CHECK CONSTRAINT [FK_aItemPackingDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aItemPackingDetail' AND CONSTRAINT_NAME= 'fk_aitemPackingDetail_aPackingType')
BEGIN
	ALTER TABLE [aItemPackingDetail] WITH CHECK ADD  CONSTRAINT [fk_aitemPackingDetail_aPackingType] FOREIGN KEY ([PackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [aItemPackingDetail] CHECK CONSTRAINT [fk_aitemPackingDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aLCRegisterDetails' AND CONSTRAINT_NAME= 'fk_aLCRegisterDetails_acompanymaster')
BEGIN
	ALTER TABLE [aLCRegisterDetails] WITH CHECK ADD  CONSTRAINT [fk_aLCRegisterDetails_acompanymaster] FOREIGN KEY ([LcCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aLCRegisterDetails] CHECK CONSTRAINT [fk_aLCRegisterDetails_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aLCRegisterDetails' AND CONSTRAINT_NAME= 'fk_aLCRegisterDetails_adepartmentmaster')
BEGIN
	ALTER TABLE [aLCRegisterDetails] WITH CHECK ADD  CONSTRAINT [fk_aLCRegisterDetails_adepartmentmaster] FOREIGN KEY ([LcDepartmentID],[LcCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aLCRegisterDetails] CHECK CONSTRAINT [fk_aLCRegisterDetails_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aletterformat' AND CONSTRAINT_NAME= 'fk_aletterformat_companyid')
BEGIN
	ALTER TABLE [aletterformat] WITH CHECK ADD  CONSTRAINT [fk_aletterformat_companyid] FOREIGN KEY ([companyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aletterformat] CHECK CONSTRAINT [fk_aletterformat_companyid]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aListItemDetails' AND CONSTRAINT_NAME= 'FK_aListItemDetails_aListItemMaster')
BEGIN
	ALTER TABLE [aListItemDetails] WITH CHECK ADD  CONSTRAINT [FK_aListItemDetails_aListItemMaster] FOREIGN KEY ([ListID]) REFERENCES aListItemMaster([Listid])
END
GO
 ALTER TABLE [aListItemDetails] CHECK CONSTRAINT [FK_aListItemDetails_aListItemMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aListViewDetails' AND CONSTRAINT_NAME= 'FK_aListViewDetails_aListViewHeader')
BEGIN
	ALTER TABLE [aListViewDetails] WITH CHECK ADD  CONSTRAINT [FK_aListViewDetails_aListViewHeader] FOREIGN KEY ([lvwdid]) REFERENCES aListViewHeader([lvwid])
END
GO
 ALTER TABLE [aListViewDetails] CHECK CONSTRAINT [FK_aListViewDetails_aListViewHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aLoyaltyCardContactDetails' AND CONSTRAINT_NAME= 'FK_aLoyaltyCardContactDetails_aLoyaltyCardMaster')
BEGIN
	ALTER TABLE [aLoyaltyCardContactDetails] WITH NOCHECK ADD  CONSTRAINT [FK_aLoyaltyCardContactDetails_aLoyaltyCardMaster] FOREIGN KEY ([CompanyID],[CardID]) REFERENCES aLoyaltyCardMaster([CompanyID],[CardID])
END
GO
 ALTER TABLE [aLoyaltyCardContactDetails] CHECK CONSTRAINT [FK_aLoyaltyCardContactDetails_aLoyaltyCardMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'fk_aaccountmaster_assetconvacc')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [fk_aaccountmaster_assetconvacc] FOREIGN KEY ([AssetConversionAccid],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [fk_aaccountmaster_assetconvacc]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aAccountMaster')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aAccountMaster] FOREIGN KEY ([HQSalesAccID],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'fk_apackagesettings_aaccountmaster_rtnadj')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [fk_apackagesettings_aaccountmaster_rtnadj] FOREIGN KEY ([Returnadjustmentaccid],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [fk_apackagesettings_aaccountmaster_rtnadj]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aAccountMaster1')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aAccountMaster1] FOREIGN KEY ([HQPurchaseAccID],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aAccountMaster2')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aAccountMaster2] FOREIGN KEY ([customsaccid],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aAccountMaster2]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aAccountMaster3')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aAccountMaster3] FOREIGN KEY ([GoodsInTransitID],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aAccountMaster3]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aAccountMaster4')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aAccountMaster4] FOREIGN KEY ([InventoryID],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aAccountMaster4]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aAccountMaster5')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aAccountMaster5] FOREIGN KEY ([shipmentfixedandactualvaluediff],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aAccountMaster5]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aAccountMaster6')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aAccountMaster6] FOREIGN KEY ([compprofitshareacc],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aAccountMaster6]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aAccountMaster7')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aAccountMaster7] FOREIGN KEY ([stocktransfercontrolacc],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aAccountMaster7]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aAccountMaster8')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aAccountMaster8] FOREIGN KEY ([profittransfercontrolacc],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aAccountMaster8]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPackageSettings_aCustomerGroup')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPackageSettings_aCustomerGroup] FOREIGN KEY ([companyid],[CustomerGroupIdForEmployees]) REFERENCES aCustomerGroup([CompanyID],[CusGroupId])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPackageSettings_aCustomerGroup]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPAckageSettings' AND CONSTRAINT_NAME= 'FK_aPAckageSettings_aDepartmentMaster')
BEGIN
	ALTER TABLE [aPAckageSettings] WITH CHECK ADD  CONSTRAINT [FK_aPAckageSettings_aDepartmentMaster] FOREIGN KEY ([companydepartment],[companyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aPAckageSettings] CHECK CONSTRAINT [FK_aPAckageSettings_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPackingTypeCapacityDetail' AND CONSTRAINT_NAME= 'FK_aPackingTypeCapacityDetail_aPackingType')
BEGIN
	ALTER TABLE [aPackingTypeCapacityDetail] WITH CHECK ADD  CONSTRAINT [FK_aPackingTypeCapacityDetail_aPackingType] FOREIGN KEY ([PackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [aPackingTypeCapacityDetail] CHECK CONSTRAINT [FK_aPackingTypeCapacityDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPackingTypeCapacityDetail' AND CONSTRAINT_NAME= 'FK_aPackingTypeCapacityDetail_aUnit')
BEGIN
	ALTER TABLE [aPackingTypeCapacityDetail] WITH CHECK ADD  CONSTRAINT [FK_aPackingTypeCapacityDetail_aUnit] FOREIGN KEY ([UnitsID]) REFERENCES aUnit([UnitID])
END
GO
 ALTER TABLE [aPackingTypeCapacityDetail] CHECK CONSTRAINT [FK_aPackingTypeCapacityDetail_aUnit]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPrefix' AND CONSTRAINT_NAME= 'FK_aPrefix_aCompanyMaster')
BEGIN
	ALTER TABLE [aPrefix] WITH CHECK ADD  CONSTRAINT [FK_aPrefix_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aPrefix] CHECK CONSTRAINT [FK_aPrefix_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPrefix' AND CONSTRAINT_NAME= 'fk_aPrefix_aFinancialYear')
BEGIN
	ALTER TABLE [aPrefix] WITH CHECK ADD  CONSTRAINT [fk_aPrefix_aFinancialYear] FOREIGN KEY ([Financialid],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [aPrefix] CHECK CONSTRAINT [fk_aPrefix_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPrefix' AND CONSTRAINT_NAME= 'FK_aPrefix_aInterface')
BEGIN
	ALTER TABLE [aPrefix] WITH CHECK ADD  CONSTRAINT [FK_aPrefix_aInterface] FOREIGN KEY ([InterfaceID],[CompanyID]) REFERENCES aInterface([InterfaceID],[CompanyID])
END
GO
 ALTER TABLE [aPrefix] CHECK CONSTRAINT [FK_aPrefix_aInterface]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aproductconditionmaster' AND CONSTRAINT_NAME= 'FK_APRODUCT_REF_82_ASERVICE')
BEGIN
	ALTER TABLE [aproductconditionmaster] WITH CHECK ADD  CONSTRAINT [FK_APRODUCT_REF_82_ASERVICE] FOREIGN KEY ([prodcndsercatid],[prodcndcompanyid]) REFERENCES aServiceCategory([sercategid],[sercatcompanyid])
END
GO
 ALTER TABLE [aproductconditionmaster] CHECK CONSTRAINT [FK_APRODUCT_REF_82_ASERVICE]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPurchasePriceRange' AND CONSTRAINT_NAME= 'fk_aPurchasePriceRange_aCompanyMaster')
BEGIN
	ALTER TABLE [aPurchasePriceRange] WITH CHECK ADD  CONSTRAINT [fk_aPurchasePriceRange_aCompanyMaster] FOREIGN KEY ([CompanyId]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aPurchasePriceRange] CHECK CONSTRAINT [fk_aPurchasePriceRange_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPurchasePriceRange' AND CONSTRAINT_NAME= 'fk_aPurchasePriceRange_aCurrencyMaster')
BEGIN
	ALTER TABLE [aPurchasePriceRange] WITH CHECK ADD  CONSTRAINT [fk_aPurchasePriceRange_aCurrencyMaster] FOREIGN KEY ([CurrencyId],[CompanyId]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [aPurchasePriceRange] CHECK CONSTRAINT [fk_aPurchasePriceRange_aCurrencyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPurchasePriceRange' AND CONSTRAINT_NAME= 'fk_aPurchasePriceRange_aItem')
BEGIN
	ALTER TABLE [aPurchasePriceRange] WITH CHECK ADD  CONSTRAINT [fk_aPurchasePriceRange_aItem] FOREIGN KEY ([ItemId]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aPurchasePriceRange] CHECK CONSTRAINT [fk_aPurchasePriceRange_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND CONSTRAINT_NAME= 'fk_aPurchasePriceRangeHistory_aCompanyMaster')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] WITH CHECK ADD  CONSTRAINT [fk_aPurchasePriceRangeHistory_aCompanyMaster] FOREIGN KEY ([CompanyId]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aPurchasePriceRangeHistory] CHECK CONSTRAINT [fk_aPurchasePriceRangeHistory_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND CONSTRAINT_NAME= 'fk_aPurchasePriceRangeHistory_aCurrencyMaster')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] WITH CHECK ADD  CONSTRAINT [fk_aPurchasePriceRangeHistory_aCurrencyMaster] FOREIGN KEY ([CurrencyId],[CompanyId]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [aPurchasePriceRangeHistory] CHECK CONSTRAINT [fk_aPurchasePriceRangeHistory_aCurrencyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPurchasePriceRangeHistory' AND CONSTRAINT_NAME= 'fk_aPurchasePriceRangeHistory_aItem')
BEGIN
	ALTER TABLE [aPurchasePriceRangeHistory] WITH CHECK ADD  CONSTRAINT [fk_aPurchasePriceRangeHistory_aItem] FOREIGN KEY ([ItemId]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aPurchasePriceRangeHistory] CHECK CONSTRAINT [fk_aPurchasePriceRangeHistory_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aRepFormatAccounts' AND CONSTRAINT_NAME= 'Fk_aRepFormatAccounts_aAccountMaster')
BEGIN
	ALTER TABLE [aRepFormatAccounts] WITH CHECK ADD  CONSTRAINT [Fk_aRepFormatAccounts_aAccountMaster] FOREIGN KEY ([Accountid],[CompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aRepFormatAccounts] CHECK CONSTRAINT [Fk_aRepFormatAccounts_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aRepFormatAccounts' AND CONSTRAINT_NAME= 'Fk_aRepFormatAccounts_aAccRepGroup')
BEGIN
	ALTER TABLE [aRepFormatAccounts] WITH CHECK ADD  CONSTRAINT [Fk_aRepFormatAccounts_aAccRepGroup] FOREIGN KEY ([CompanyId],[GroupId]) REFERENCES aaccrepgroup([companyid],[Groupid])
END
GO
 ALTER TABLE [aRepFormatAccounts] CHECK CONSTRAINT [Fk_aRepFormatAccounts_aAccRepGroup]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='areprecvendorheader' AND CONSTRAINT_NAME= 'FK_areprecvendorheader_aVendorMaster')
BEGIN
	ALTER TABLE [areprecvendorheader] WITH CHECK ADD  CONSTRAINT [FK_areprecvendorheader_aVendorMaster] FOREIGN KEY ([rrvhvendorid]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [areprecvendorheader] CHECK CONSTRAINT [FK_areprecvendorheader_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ASalesPersonCommisionDetail' AND CONSTRAINT_NAME= 'FK_ASalesPersonCommisionDetail_AsalesPersonmaster')
BEGIN
	ALTER TABLE [ASalesPersonCommisionDetail] WITH CHECK ADD  CONSTRAINT [FK_ASalesPersonCommisionDetail_AsalesPersonmaster] FOREIGN KEY ([salespersonid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [ASalesPersonCommisionDetail] CHECK CONSTRAINT [FK_ASalesPersonCommisionDetail_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='AsalesPersonmaster' AND CONSTRAINT_NAME= 'fk_asalespersonmaster_acompanymaster')
BEGIN
	ALTER TABLE [AsalesPersonmaster] WITH CHECK ADD  CONSTRAINT [fk_asalespersonmaster_acompanymaster] FOREIGN KEY ([Companyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [AsalesPersonmaster] CHECK CONSTRAINT [fk_asalespersonmaster_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aserviceitemdetails' AND CONSTRAINT_NAME= 'fk_aserviceitemdetails_aitem')
BEGIN
	ALTER TABLE [aserviceitemdetails] WITH CHECK ADD  CONSTRAINT [fk_aserviceitemdetails_aitem] FOREIGN KEY ([ItemId]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aserviceitemdetails] CHECK CONSTRAINT [fk_aserviceitemdetails_aitem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSettings' AND CONSTRAINT_NAME= 'fk_asettings_aaccountmaster')
BEGIN
	ALTER TABLE [aSettings] WITH CHECK ADD  CONSTRAINT [fk_asettings_aaccountmaster] FOREIGN KEY ([TradeDebtorAcID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aSettings] CHECK CONSTRAINT [fk_asettings_aaccountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSettings' AND CONSTRAINT_NAME= 'fk_asettings_aaccountmaster1')
BEGIN
	ALTER TABLE [aSettings] WITH CHECK ADD  CONSTRAINT [fk_asettings_aaccountmaster1] FOREIGN KEY ([TradeCreditorAcID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aSettings] CHECK CONSTRAINT [fk_asettings_aaccountmaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSettings' AND CONSTRAINT_NAME= 'fk_asettings_aaccountmaster2')
BEGIN
	ALTER TABLE [aSettings] WITH CHECK ADD  CONSTRAINT [fk_asettings_aaccountmaster2] FOREIGN KEY ([ExchangeDiffAcID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aSettings] CHECK CONSTRAINT [fk_asettings_aaccountmaster2]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSettings' AND CONSTRAINT_NAME= 'fk_asettings_ACURRENCYMASTER')
BEGIN
	ALTER TABLE [aSettings] WITH CHECK ADD  CONSTRAINT [fk_asettings_ACURRENCYMASTER] FOREIGN KEY ([CashGroupID],[CompanyID]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [aSettings] CHECK CONSTRAINT [fk_asettings_ACURRENCYMASTER]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSettings' AND CONSTRAINT_NAME= 'fk_asettings_agroupmaster')
BEGIN
	ALTER TABLE [aSettings] WITH CHECK ADD  CONSTRAINT [fk_asettings_agroupmaster] FOREIGN KEY ([FixedAssetGroupID],[CompanyID]) REFERENCES aGroupMaster([GroupID],[CompanyID])
END
GO
 ALTER TABLE [aSettings] CHECK CONSTRAINT [fk_asettings_agroupmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSettings' AND CONSTRAINT_NAME= 'fk_asettings_agroupmaster2')
BEGIN
	ALTER TABLE [aSettings] WITH CHECK ADD  CONSTRAINT [fk_asettings_agroupmaster2] FOREIGN KEY ([BankGroupID],[CompanyID]) REFERENCES aGroupMaster([GroupID],[CompanyID])
END
GO
 ALTER TABLE [aSettings] CHECK CONSTRAINT [fk_asettings_agroupmaster2]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSettings' AND CONSTRAINT_NAME= 'fk_asettings_agroupmaster3')
BEGIN
	ALTER TABLE [aSettings] WITH CHECK ADD  CONSTRAINT [fk_asettings_agroupmaster3] FOREIGN KEY ([SalesGroupID],[CompanyID]) REFERENCES aGroupMaster([GroupID],[CompanyID])
END
GO
 ALTER TABLE [aSettings] CHECK CONSTRAINT [fk_asettings_agroupmaster3]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSettings' AND CONSTRAINT_NAME= 'fk_asettings_agroupmaster4')
BEGIN
	ALTER TABLE [aSettings] WITH CHECK ADD  CONSTRAINT [fk_asettings_agroupmaster4] FOREIGN KEY ([PurchaseGroupID],[CompanyID]) REFERENCES aGroupMaster([GroupID],[CompanyID])
END
GO
 ALTER TABLE [aSettings] CHECK CONSTRAINT [fk_asettings_agroupmaster4]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ashopcashaccountdetails' AND CONSTRAINT_NAME= 'FK_ashopcashaccountdetails_aAccountMaster')
BEGIN
	ALTER TABLE [ashopcashaccountdetails] WITH CHECK ADD  CONSTRAINT [FK_ashopcashaccountdetails_aAccountMaster] FOREIGN KEY ([CashAccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [ashopcashaccountdetails] CHECK CONSTRAINT [FK_ashopcashaccountdetails_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ashopcashaccountdetails' AND CONSTRAINT_NAME= 'FK_ashopcashaccountdetails_aShops')
BEGIN
	ALTER TABLE [ashopcashaccountdetails] WITH CHECK ADD  CONSTRAINT [FK_ashopcashaccountdetails_aShops] FOREIGN KEY ([shopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [ashopcashaccountdetails] CHECK CONSTRAINT [FK_ashopcashaccountdetails_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopCustomerDetails' AND CONSTRAINT_NAME= 'FK_aShopCustomerDetails_aCustomerMaster')
BEGIN
	ALTER TABLE [aShopCustomerDetails] WITH CHECK ADD  CONSTRAINT [FK_aShopCustomerDetails_aCustomerMaster] FOREIGN KEY ([CustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [aShopCustomerDetails] CHECK CONSTRAINT [FK_aShopCustomerDetails_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopCustomerDetails' AND CONSTRAINT_NAME= 'FK_aShopCustomerDetails_aShops')
BEGIN
	ALTER TABLE [aShopCustomerDetails] WITH CHECK ADD  CONSTRAINT [FK_aShopCustomerDetails_aShops] FOREIGN KEY ([ShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aShopCustomerDetails] CHECK CONSTRAINT [FK_aShopCustomerDetails_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopitemCategory' AND CONSTRAINT_NAME= 'FK_aShopitemCategory_aItemCategory')
BEGIN
	ALTER TABLE [aShopitemCategory] WITH CHECK ADD  CONSTRAINT [FK_aShopitemCategory_aItemCategory] FOREIGN KEY ([itemcategoryid]) REFERENCES aItemCategory([ItemCategoryID])
END
GO
 ALTER TABLE [aShopitemCategory] CHECK CONSTRAINT [FK_aShopitemCategory_aItemCategory]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopitemCategory' AND CONSTRAINT_NAME= 'FK_aShopitemCategory_aShops')
BEGIN
	ALTER TABLE [aShopitemCategory] WITH CHECK ADD  CONSTRAINT [FK_aShopitemCategory_aShops] FOREIGN KEY ([shopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aShopitemCategory] CHECK CONSTRAINT [FK_aShopitemCategory_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopItemDetail' AND CONSTRAINT_NAME= 'FK_aShopItemDetail_aItem')
BEGIN
	ALTER TABLE [aShopItemDetail] WITH CHECK ADD  CONSTRAINT [FK_aShopItemDetail_aItem] FOREIGN KEY ([ItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aShopItemDetail] CHECK CONSTRAINT [FK_aShopItemDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopItemDetail' AND CONSTRAINT_NAME= 'FK_aShopItemDetail_aShops')
BEGIN
	ALTER TABLE [aShopItemDetail] WITH CHECK ADD  CONSTRAINT [FK_aShopItemDetail_aShops] FOREIGN KEY ([ShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aShopItemDetail] CHECK CONSTRAINT [FK_aShopItemDetail_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ashopprintmessages' AND CONSTRAINT_NAME= 'FK_ashopprintmessages_aShops')
BEGIN
	ALTER TABLE [ashopprintmessages] WITH CHECK ADD  CONSTRAINT [FK_ashopprintmessages_aShops] FOREIGN KEY ([shopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [ashopprintmessages] CHECK CONSTRAINT [FK_ashopprintmessages_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_AShops_aaccountmaster3')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_AShops_aaccountmaster3] FOREIGN KEY ([ShopGoodsReturnNoteAccID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_AShops_aaccountmaster3]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_AShops_aaccountmaster4')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_AShops_aaccountmaster4] FOREIGN KEY ([stockWriteoffAccID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_AShops_aaccountmaster4]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_AShops_aaccountmaster5')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_AShops_aaccountmaster5] FOREIGN KEY ([discountaccountid],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_AShops_aaccountmaster5]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_AShops_aaccountmaster6')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_AShops_aaccountmaster6] FOREIGN KEY ([discountaccountid],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_AShops_aaccountmaster6]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_AShops_aCity')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_AShops_aCity] FOREIGN KEY ([CityID]) REFERENCES aCity([CityID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_AShops_aCity]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_AShops_acountrymaster')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_AShops_acountrymaster] FOREIGN KEY ([Countryid],[CompanyID]) REFERENCES aCountryMaster([CountryID],[CompanyID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_AShops_acountrymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'FK_aShops_aDepartmentMaster')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [FK_aShops_aDepartmentMaster] FOREIGN KEY ([DepartmentID],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [FK_aShops_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_ashops_asegmentmaster')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_ashops_asegmentmaster] FOREIGN KEY ([CompanyID],[segmentid]) REFERENCES ASegmentMaster([companyid],[Segmentid])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_ashops_asegmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_AShops_aaccountmaster')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_AShops_aaccountmaster] FOREIGN KEY ([DefaultCashaccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_AShops_aaccountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_AShops_aaccountmaster1')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_AShops_aaccountmaster1] FOREIGN KEY ([ShopSalesaccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_AShops_aaccountmaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShops' AND CONSTRAINT_NAME= 'fk_AShops_aaccountmaster2')
BEGIN
	ALTER TABLE [aShops] WITH CHECK ADD  CONSTRAINT [fk_AShops_aaccountmaster2] FOREIGN KEY ([ShopPurchaseAcID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [aShops] CHECK CONSTRAINT [fk_AShops_aaccountmaster2]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Ashopsalespersondetails' AND CONSTRAINT_NAME= 'FK_Ashopsalespersondetails_AsalesPersonmaster')
BEGIN
	ALTER TABLE [Ashopsalespersondetails] WITH CHECK ADD  CONSTRAINT [FK_Ashopsalespersondetails_AsalesPersonmaster] FOREIGN KEY ([SperID]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [Ashopsalespersondetails] CHECK CONSTRAINT [FK_Ashopsalespersondetails_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Ashopsalespersondetails' AND CONSTRAINT_NAME= 'FK_Ashopsalespersondetails_aShops')
BEGIN
	ALTER TABLE [Ashopsalespersondetails] WITH CHECK ADD  CONSTRAINT [FK_Ashopsalespersondetails_aShops] FOREIGN KEY ([SperShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [Ashopsalespersondetails] CHECK CONSTRAINT [FK_Ashopsalespersondetails_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ashopsercategory' AND CONSTRAINT_NAME= 'FK_ashopsercategory_aShops')
BEGIN
	ALTER TABLE [ashopsercategory] WITH CHECK ADD  CONSTRAINT [FK_ashopsercategory_aShops] FOREIGN KEY ([sshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [ashopsercategory] CHECK CONSTRAINT [FK_ashopsercategory_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopServiceCharges' AND CONSTRAINT_NAME= 'fk_aShopServiceCharges_aServiceMaster')
BEGIN
	ALTER TABLE [aShopServiceCharges] WITH CHECK ADD  CONSTRAINT [fk_aShopServiceCharges_aServiceMaster] FOREIGN KEY ([serid],[sercompanyid]) REFERENCES aservicemaster([serid],[sercompanyid])
END
GO
 ALTER TABLE [aShopServiceCharges] CHECK CONSTRAINT [fk_aShopServiceCharges_aServiceMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopServiceCharges' AND CONSTRAINT_NAME= 'fk_aShopServiceCharges_aShops')
BEGIN
	ALTER TABLE [aShopServiceCharges] WITH CHECK ADD  CONSTRAINT [fk_aShopServiceCharges_aShops] FOREIGN KEY ([serShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aShopServiceCharges] CHECK CONSTRAINT [fk_aShopServiceCharges_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopToolsDetails' AND CONSTRAINT_NAME= 'fk_ashoptoolsdetails_ashops')
BEGIN
	ALTER TABLE [aShopToolsDetails] WITH CHECK ADD  CONSTRAINT [fk_ashoptoolsdetails_ashops] FOREIGN KEY ([shopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aShopToolsDetails] CHECK CONSTRAINT [fk_ashoptoolsdetails_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopToolsDetails' AND CONSTRAINT_NAME= 'fk_ashoptoolsdetails_fixedasset')
BEGIN
	ALTER TABLE [aShopToolsDetails] WITH CHECK ADD  CONSTRAINT [fk_ashoptoolsdetails_fixedasset] FOREIGN KEY ([toolsastid],[companyid]) REFERENCES FixedAsset([FixedAssetID],[CompanyID])
END
GO
 ALTER TABLE [aShopToolsDetails] CHECK CONSTRAINT [fk_ashoptoolsdetails_fixedasset]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopVendorDetails' AND CONSTRAINT_NAME= 'FK_aShopVendorDetails_aShops')
BEGIN
	ALTER TABLE [aShopVendorDetails] WITH CHECK ADD  CONSTRAINT [FK_aShopVendorDetails_aShops] FOREIGN KEY ([ShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [aShopVendorDetails] CHECK CONSTRAINT [FK_aShopVendorDetails_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aShopVendorDetails' AND CONSTRAINT_NAME= 'FK_aShopVendorDetails_aVendorMaster')
BEGIN
	ALTER TABLE [aShopVendorDetails] WITH CHECK ADD  CONSTRAINT [FK_aShopVendorDetails_aVendorMaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [aShopVendorDetails] CHECK CONSTRAINT [FK_aShopVendorDetails_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assetdisposaldetail' AND CONSTRAINT_NAME= 'fk_AssetDisposalDetail_FixedAsset')
BEGIN
	ALTER TABLE [assetdisposaldetail] WITH CHECK ADD  CONSTRAINT [fk_AssetDisposalDetail_FixedAsset] FOREIGN KEY ([dispdasstid],[dispdcompanyid]) REFERENCES FixedAsset([FixedAssetID],[CompanyID])
END
GO
 ALTER TABLE [assetdisposaldetail] CHECK CONSTRAINT [fk_AssetDisposalDetail_FixedAsset]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assetexpensetrackingdetail' AND CONSTRAINT_NAME= 'fk_assetexpensetrackingdetail_acompanymaster')
BEGIN
	ALTER TABLE [assetexpensetrackingdetail] WITH CHECK ADD  CONSTRAINT [fk_assetexpensetrackingdetail_acompanymaster] FOREIGN KEY ([aexcompanyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [assetexpensetrackingdetail] CHECK CONSTRAINT [fk_assetexpensetrackingdetail_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assetexpensetrackingdetail' AND CONSTRAINT_NAME= 'fk_assetexpensetrackingdetail_FixedAsset')
BEGIN
	ALTER TABLE [assetexpensetrackingdetail] WITH CHECK ADD  CONSTRAINT [fk_assetexpensetrackingdetail_FixedAsset] FOREIGN KEY ([aexassetid],[aexcompanyid]) REFERENCES FixedAsset([FixedAssetID],[CompanyID])
END
GO
 ALTER TABLE [assetexpensetrackingdetail] CHECK CONSTRAINT [fk_assetexpensetrackingdetail_FixedAsset]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assettransfer' AND CONSTRAINT_NAME= 'fk_AssetTransfer_aAccountMaster_1')
BEGIN
	ALTER TABLE [assettransfer] WITH CHECK ADD  CONSTRAINT [fk_AssetTransfer_aAccountMaster_1] FOREIGN KEY ([FromDeprAccId],[asttranscompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [assettransfer] CHECK CONSTRAINT [fk_AssetTransfer_aAccountMaster_1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assettransfer' AND CONSTRAINT_NAME= 'fk_AssetTransfer_aAccountMaster_2')
BEGIN
	ALTER TABLE [assettransfer] WITH CHECK ADD  CONSTRAINT [fk_AssetTransfer_aAccountMaster_2] FOREIGN KEY ([ToDeprAccId],[asttranscompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [assettransfer] CHECK CONSTRAINT [fk_AssetTransfer_aAccountMaster_2]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assettransfer' AND CONSTRAINT_NAME= 'fk_AssetTransfer_aAccountMaster_3')
BEGIN
	ALTER TABLE [assettransfer] WITH CHECK ADD  CONSTRAINT [fk_AssetTransfer_aAccountMaster_3] FOREIGN KEY ([FromACCDeprAccId],[asttranscompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [assettransfer] CHECK CONSTRAINT [fk_AssetTransfer_aAccountMaster_3]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assettransfer' AND CONSTRAINT_NAME= 'fk_AssetTransfer_aAccountMaster_4')
BEGIN
	ALTER TABLE [assettransfer] WITH CHECK ADD  CONSTRAINT [fk_AssetTransfer_aAccountMaster_4] FOREIGN KEY ([ToACCDeprAccId],[asttranscompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [assettransfer] CHECK CONSTRAINT [fk_AssetTransfer_aAccountMaster_4]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assettransfer' AND CONSTRAINT_NAME= 'fk_assettransfer_acompanymaster')
BEGIN
	ALTER TABLE [assettransfer] WITH CHECK ADD  CONSTRAINT [fk_assettransfer_acompanymaster] FOREIGN KEY ([asttranscompanyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [assettransfer] CHECK CONSTRAINT [fk_assettransfer_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assettransfer' AND CONSTRAINT_NAME= 'fk_assettransfer_adepartmentmaster')
BEGIN
	ALTER TABLE [assettransfer] WITH CHECK ADD  CONSTRAINT [fk_assettransfer_adepartmentmaster] FOREIGN KEY ([asttransfromdepid],[asttranscompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [assettransfer] CHECK CONSTRAINT [fk_assettransfer_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='assettransfer' AND CONSTRAINT_NAME= 'fk_assettransfer_adepartmentmaster2')
BEGIN
	ALTER TABLE [assettransfer] WITH CHECK ADD  CONSTRAINT [fk_assettransfer_adepartmentmaster2] FOREIGN KEY ([asttranstodepid],[asttranscompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [assettransfer] CHECK CONSTRAINT [fk_assettransfer_adepartmentmaster2]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aStatus' AND CONSTRAINT_NAME= 'fk_aStatus_aStatusGroup')
BEGIN
	ALTER TABLE [aStatus] WITH CHECK ADD  CONSTRAINT [fk_aStatus_aStatusGroup] FOREIGN KEY ([CompanyId],[StatusGroupId]) REFERENCES aStatusGroup([CompanyId],[StatusGroupId])
END
GO
 ALTER TABLE [aStatus] CHECK CONSTRAINT [fk_aStatus_aStatusGroup]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSubItemDetails' AND CONSTRAINT_NAME= 'FK_aSubItemDetails_aItem1')
BEGIN
	ALTER TABLE [aSubItemDetails] WITH CHECK ADD  CONSTRAINT [FK_aSubItemDetails_aItem1] FOREIGN KEY ([ItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [aSubItemDetails] CHECK CONSTRAINT [FK_aSubItemDetails_aItem1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSubItemDetails' AND CONSTRAINT_NAME= 'FK_aSubItemDetails_aPackingType')
BEGIN
	ALTER TABLE [aSubItemDetails] WITH CHECK ADD  CONSTRAINT [FK_aSubItemDetails_aPackingType] FOREIGN KEY ([PackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [aSubItemDetails] CHECK CONSTRAINT [FK_aSubItemDetails_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aSubItemDetails' AND CONSTRAINT_NAME= 'FK_aSubItemDetails_aUnit')
BEGIN
	ALTER TABLE [aSubItemDetails] WITH CHECK ADD  CONSTRAINT [FK_aSubItemDetails_aUnit] FOREIGN KEY ([UnitsID]) REFERENCES aUnit([UnitID])
END
GO
 ALTER TABLE [aSubItemDetails] CHECK CONSTRAINT [FK_aSubItemDetails_aUnit]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aTableColumns' AND CONSTRAINT_NAME= 'FK_TableColumns_Tables')
BEGIN
	ALTER TABLE [aTableColumns] WITH CHECK ADD  CONSTRAINT [FK_TableColumns_Tables] FOREIGN KEY ([TableID]) REFERENCES aTables([TableID])
END
GO
 ALTER TABLE [aTableColumns] CHECK CONSTRAINT [FK_TableColumns_Tables]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aTechnicianServiceDetails' AND CONSTRAINT_NAME= 'fk_aTechnicianServiceDetails_aSalesPersonMaster')
BEGIN
	ALTER TABLE [aTechnicianServiceDetails] WITH CHECK ADD  CONSTRAINT [fk_aTechnicianServiceDetails_aSalesPersonMaster] FOREIGN KEY ([serTechnicianID]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [aTechnicianServiceDetails] CHECK CONSTRAINT [fk_aTechnicianServiceDetails_aSalesPersonMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserDeptDetails' AND CONSTRAINT_NAME= 'fk_aUserDeptDetails')
BEGIN
	ALTER TABLE [aUserDeptDetails] WITH CHECK ADD  CONSTRAINT [fk_aUserDeptDetails] FOREIGN KEY ([userid],[companyid]) REFERENCES aUsers([UserID],[CompanyID])
END
GO
 ALTER TABLE [aUserDeptDetails] CHECK CONSTRAINT [fk_aUserDeptDetails]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserRights' AND CONSTRAINT_NAME= 'FK_aUserRights_aInterface')
BEGIN
	ALTER TABLE [aUserRights] WITH CHECK ADD  CONSTRAINT [FK_aUserRights_aInterface] FOREIGN KEY ([InterfaceID],[CompanyID]) REFERENCES aInterface([InterfaceID],[CompanyID])
END
GO
 ALTER TABLE [aUserRights] CHECK CONSTRAINT [FK_aUserRights_aInterface]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aUserRights' AND CONSTRAINT_NAME= 'FK_aUserRights_aUsers1')
BEGIN
	ALTER TABLE [aUserRights] WITH CHECK ADD  CONSTRAINT [FK_aUserRights_aUsers1] FOREIGN KEY ([UserID],[CompanyID]) REFERENCES aUsers([UserID],[CompanyID])
END
GO
 ALTER TABLE [aUserRights] CHECK CONSTRAINT [FK_aUserRights_aUsers1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aVendorMaster' AND CONSTRAINT_NAME= 'FK_aVendorMaster_aCity')
BEGIN
	ALTER TABLE [aVendorMaster] WITH CHECK ADD  CONSTRAINT [FK_aVendorMaster_aCity] FOREIGN KEY ([CityID]) REFERENCES aCity([CityID])
END
GO
 ALTER TABLE [aVendorMaster] CHECK CONSTRAINT [FK_aVendorMaster_aCity]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aVendorMaster' AND CONSTRAINT_NAME= 'FK_aVendorMaster_aCompanyMaster')
BEGIN
	ALTER TABLE [aVendorMaster] WITH CHECK ADD  CONSTRAINT [FK_aVendorMaster_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [aVendorMaster] CHECK CONSTRAINT [FK_aVendorMaster_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aVendorMaster' AND CONSTRAINT_NAME= 'FK_aVendorMaster_aCountryMaster')
BEGIN
	ALTER TABLE [aVendorMaster] WITH CHECK ADD  CONSTRAINT [FK_aVendorMaster_aCountryMaster] FOREIGN KEY ([CountryID],[CompanyID]) REFERENCES aCountryMaster([CountryID],[CompanyID])
END
GO
 ALTER TABLE [aVendorMaster] CHECK CONSTRAINT [FK_aVendorMaster_aCountryMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aVendorMaster' AND CONSTRAINT_NAME= 'FK_aVendorMaster_aCurrencyMaster')
BEGIN
	ALTER TABLE [aVendorMaster] WITH CHECK ADD  CONSTRAINT [FK_aVendorMaster_aCurrencyMaster] FOREIGN KEY ([CurrencyID],[CompanyID]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [aVendorMaster] CHECK CONSTRAINT [FK_aVendorMaster_aCurrencyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Bills' AND CONSTRAINT_NAME= 'fk_Bills_accountmaster')
BEGIN
	ALTER TABLE [Bills] WITH NOCHECK ADD  CONSTRAINT [fk_Bills_accountmaster] FOREIGN KEY ([BankCashAccID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [Bills] CHECK CONSTRAINT [fk_Bills_accountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Bills' AND CONSTRAINT_NAME= 'fk_Bills_accountmaster2')
BEGIN
	ALTER TABLE [Bills] WITH NOCHECK ADD  CONSTRAINT [fk_Bills_accountmaster2] FOREIGN KEY ([DiscountAccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [Bills] CHECK CONSTRAINT [fk_Bills_accountmaster2]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Bills' AND CONSTRAINT_NAME= 'fk_bills_avendormaster')
BEGIN
	ALTER TABLE [Bills] WITH NOCHECK ADD  CONSTRAINT [fk_bills_avendormaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [Bills] CHECK CONSTRAINT [fk_bills_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Bills' AND CONSTRAINT_NAME= 'fk_Bills_Company')
BEGIN
	ALTER TABLE [Bills] WITH NOCHECK ADD  CONSTRAINT [fk_Bills_Company] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [Bills] CHECK CONSTRAINT [fk_Bills_Company]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Bills' AND CONSTRAINT_NAME= 'fk_Bills3_financialyear')
BEGIN
	ALTER TABLE [Bills] WITH NOCHECK ADD  CONSTRAINT [fk_Bills3_financialyear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [Bills] CHECK CONSTRAINT [fk_Bills3_financialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BillsDebitDetails' AND CONSTRAINT_NAME= 'fk_Billsdebitdetails_accountmaster')
BEGIN
	ALTER TABLE [BillsDebitDetails] WITH CHECK ADD  CONSTRAINT [fk_Billsdebitdetails_accountmaster] FOREIGN KEY ([AccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [BillsDebitDetails] CHECK CONSTRAINT [fk_Billsdebitdetails_accountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BillsDebitDetails' AND CONSTRAINT_NAME= 'fk_Billsdebitdetails_bills')
BEGIN
	ALTER TABLE [BillsDebitDetails] WITH NOCHECK ADD  CONSTRAINT [fk_Billsdebitdetails_bills] FOREIGN KEY ([BillsID]) REFERENCES Bills([BillsID])
END
GO
 ALTER TABLE [BillsDebitDetails] CHECK CONSTRAINT [fk_Billsdebitdetails_bills]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetAllocationDetail' AND CONSTRAINT_NAME= 'FK_badBudgetHeadID_aAccountMaster')
BEGIN
	ALTER TABLE [BudgetAllocationDetail] WITH CHECK ADD  CONSTRAINT [FK_badBudgetHeadID_aAccountMaster] FOREIGN KEY ([badBudgetHeadID],[badCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [BudgetAllocationDetail] CHECK CONSTRAINT [FK_badBudgetHeadID_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetAllocationHeader' AND CONSTRAINT_NAME= 'FK_BudgetAllocationHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [BudgetAllocationHeader] WITH CHECK ADD  CONSTRAINT [FK_BudgetAllocationHeader_aDepartmentMaster] FOREIGN KEY ([bahDepartmentId],[bahCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [BudgetAllocationHeader] CHECK CONSTRAINT [FK_BudgetAllocationHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetitemPlanDetail' AND CONSTRAINT_NAME= 'fk_BudgetitemPlanDetail_BudgetPlanHeader')
BEGIN
	ALTER TABLE [BudgetitemPlanDetail] WITH CHECK ADD  CONSTRAINT [fk_BudgetitemPlanDetail_BudgetPlanHeader] FOREIGN KEY ([bpdICompanyID],[bpdIBudgetPlanID]) REFERENCES BudgetPlanHeader([bphCompanyID],[bphBudgetPlanID])
END
GO
 ALTER TABLE [BudgetitemPlanDetail] CHECK CONSTRAINT [fk_BudgetitemPlanDetail_BudgetPlanHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetPlanDetail' AND CONSTRAINT_NAME= 'FK_BudgetPlanDetail_aAccountMaster')
BEGIN
	ALTER TABLE [BudgetPlanDetail] WITH CHECK ADD  CONSTRAINT [FK_BudgetPlanDetail_aAccountMaster] FOREIGN KEY ([bpdBudgetHeadID],[bpdCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [BudgetPlanDetail] CHECK CONSTRAINT [FK_BudgetPlanDetail_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetPlanDetail' AND CONSTRAINT_NAME= 'FK_BudgetPlanDetail_BudgetPlanHeader')
BEGIN
	ALTER TABLE [BudgetPlanDetail] WITH CHECK ADD  CONSTRAINT [FK_BudgetPlanDetail_BudgetPlanHeader] FOREIGN KEY ([bpdCompanyID],[bpdBudgetPlanID]) REFERENCES BudgetPlanHeader([bphCompanyID],[bphBudgetPlanID])
END
GO
 ALTER TABLE [BudgetPlanDetail] CHECK CONSTRAINT [FK_BudgetPlanDetail_BudgetPlanHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetPlanDetail' AND CONSTRAINT_NAME= 'FK_BudgetPlanDetail_BudgetPlanReviseDetail')
BEGIN
	ALTER TABLE [BudgetPlanDetail] WITH CHECK ADD  CONSTRAINT [FK_BudgetPlanDetail_BudgetPlanReviseDetail] FOREIGN KEY ([bpdCompanyID],[bpdBudgetPlanID],[bpdReviseDetailId]) REFERENCES BudgetPlanReviseDetail([brdCompanyID],[brdBudgetPlanID],[brdDetailID])
END
GO
 ALTER TABLE [BudgetPlanDetail] CHECK CONSTRAINT [FK_BudgetPlanDetail_BudgetPlanReviseDetail]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND CONSTRAINT_NAME= 'FK_BudgetReviseDetail_BudgetPlanHeader')
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] WITH CHECK ADD  CONSTRAINT [FK_BudgetReviseDetail_BudgetPlanHeader] FOREIGN KEY ([brdCompanyID],[brdBudgetPlanID]) REFERENCES BudgetPlanHeader([bphCompanyID],[bphBudgetPlanID])
END
GO
 ALTER TABLE [BudgetPlanReviseDetail] CHECK CONSTRAINT [FK_BudgetReviseDetail_BudgetPlanHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CashBox' AND CONSTRAINT_NAME= 'FK_CashBox_aShops')
BEGIN
	ALTER TABLE [CashBox] WITH CHECK ADD  CONSTRAINT [FK_CashBox_aShops] FOREIGN KEY ([CBShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [CashBox] CHECK CONSTRAINT [FK_CashBox_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ClearenceRequestDetail' AND CONSTRAINT_NAME= 'fk_ClearenceRequestDetail_ClearenceRequestHeader')
BEGIN
	ALTER TABLE [ClearenceRequestDetail] WITH CHECK ADD  CONSTRAINT [fk_ClearenceRequestDetail_ClearenceRequestHeader] FOREIGN KEY ([ShopID],[ClearenceReqID]) REFERENCES ClearenceRequestHeader([ShopID],[ClearenceReqID])
END
GO
 ALTER TABLE [ClearenceRequestDetail] CHECK CONSTRAINT [fk_ClearenceRequestDetail_ClearenceRequestHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ClearenceRequestHeader' AND CONSTRAINT_NAME= 'fk_ClearenceRequestHeader_aCurrencyMaster')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] WITH CHECK ADD  CONSTRAINT [fk_ClearenceRequestHeader_aCurrencyMaster] FOREIGN KEY ([POCurrencyID],[CompanyID]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [ClearenceRequestHeader] CHECK CONSTRAINT [fk_ClearenceRequestHeader_aCurrencyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ClearenceRequestHeader' AND CONSTRAINT_NAME= 'fk_ClearenceRequestHeader_aCustomerMaster')
BEGIN
	ALTER TABLE [ClearenceRequestHeader] WITH CHECK ADD  CONSTRAINT [fk_ClearenceRequestHeader_aCustomerMaster] FOREIGN KEY ([CustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [ClearenceRequestHeader] CHECK CONSTRAINT [fk_ClearenceRequestHeader_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Contra' AND CONSTRAINT_NAME= 'FK_Contra_aAccountMaster')
BEGIN
	ALTER TABLE [Contra] WITH CHECK ADD  CONSTRAINT [FK_Contra_aAccountMaster] FOREIGN KEY ([FromAccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [Contra] CHECK CONSTRAINT [FK_Contra_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Contra' AND CONSTRAINT_NAME= 'FK_Contra_aAccountMaster1')
BEGIN
	ALTER TABLE [Contra] WITH CHECK ADD  CONSTRAINT [FK_Contra_aAccountMaster1] FOREIGN KEY ([ToAccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [Contra] CHECK CONSTRAINT [FK_Contra_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Contra' AND CONSTRAINT_NAME= 'fk_contra_aaccountmaster2')
BEGIN
	ALTER TABLE [Contra] WITH CHECK ADD  CONSTRAINT [fk_contra_aaccountmaster2] FOREIGN KEY ([ChargeAccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [Contra] CHECK CONSTRAINT [fk_contra_aaccountmaster2]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Contra' AND CONSTRAINT_NAME= 'FK_Contra_aCompanyMaster')
BEGIN
	ALTER TABLE [Contra] WITH CHECK ADD  CONSTRAINT [FK_Contra_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [Contra] CHECK CONSTRAINT [FK_Contra_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Contra' AND CONSTRAINT_NAME= 'FK_Contra_aDepartmentMaster')
BEGIN
	ALTER TABLE [Contra] WITH CHECK ADD  CONSTRAINT [FK_Contra_aDepartmentMaster] FOREIGN KEY ([DepartmentID],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [Contra] CHECK CONSTRAINT [FK_Contra_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Contra' AND CONSTRAINT_NAME= 'FK_Contra_aFinancialYear')
BEGIN
	ALTER TABLE [Contra] WITH CHECK ADD  CONSTRAINT [FK_Contra_aFinancialYear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [Contra] CHECK CONSTRAINT [FK_Contra_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmLeads' AND CONSTRAINT_NAME= 'FK_CrmLeads_CrmLeadMaster')
BEGIN
	ALTER TABLE [CrmLeads] WITH CHECK ADD  CONSTRAINT [FK_CrmLeads_CrmLeadMaster] FOREIGN KEY ([LeadTypeId]) REFERENCES CrmLeadMaster([LeadId])
END
GO
 ALTER TABLE [CrmLeads] CHECK CONSTRAINT [FK_CrmLeads_CrmLeadMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmOpportunity' AND CONSTRAINT_NAME= 'FK_CrmOpportunity_CrmLeadMaster')
BEGIN
	ALTER TABLE [CrmOpportunity] WITH CHECK ADD  CONSTRAINT [FK_CrmOpportunity_CrmLeadMaster] FOREIGN KEY ([LeadTypeId]) REFERENCES CrmLeadMaster([LeadId])
END
GO
 ALTER TABLE [CrmOpportunity] CHECK CONSTRAINT [FK_CrmOpportunity_CrmLeadMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmTask' AND CONSTRAINT_NAME= 'FK_CrmTask_aUsergroups')
BEGIN
	ALTER TABLE [CrmTask] WITH CHECK ADD  CONSTRAINT [FK_CrmTask_aUsergroups] FOREIGN KEY ([UserGroupId],[CompanyId]) REFERENCES aUsergroups([UserGroupID],[CompanyID])
END
GO
 ALTER TABLE [CrmTask] CHECK CONSTRAINT [FK_CrmTask_aUsergroups]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CrmUserHirarchey' AND CONSTRAINT_NAME= 'FK_CrmUserHirarchey_aUsergroups')
BEGIN
	ALTER TABLE [CrmUserHirarchey] WITH CHECK ADD  CONSTRAINT [FK_CrmUserHirarchey_aUsergroups] FOREIGN KEY ([UserGroupID],[CompanyId]) REFERENCES aUsergroups([UserGroupID],[CompanyID])
END
GO
 ALTER TABLE [CrmUserHirarchey] CHECK CONSTRAINT [FK_CrmUserHirarchey_aUsergroups]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementDetail' AND CONSTRAINT_NAME= 'FK_CustomerSettlementDetail_CustomerSettlementHeader')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementDetail_CustomerSettlementHeader] FOREIGN KEY ([CSID]) REFERENCES CustomerSettlementHeader([CSID])
END
GO
 ALTER TABLE [CustomerSettlementDetail] CHECK CONSTRAINT [FK_CustomerSettlementDetail_CustomerSettlementHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementDetail' AND CONSTRAINT_NAME= 'FK_CustomerSettlementDetail_DebitCreditNote')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementDetail_DebitCreditNote] FOREIGN KEY ([dcnid]) REFERENCES DebitCreditNote([DCNId])
END
GO
 ALTER TABLE [CustomerSettlementDetail] CHECK CONSTRAINT [FK_CustomerSettlementDetail_DebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementDetail' AND CONSTRAINT_NAME= 'FK_CustomerSettlementDetail_LOsAccountsInvoiceHeader')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementDetail_LOsAccountsInvoiceHeader] FOREIGN KEY ([shopid],[LosAccInvoiceID]) REFERENCES LOsAccountsInvoiceHeader([aiShopID],[aiInvoiceID])
END
GO
 ALTER TABLE [CustomerSettlementDetail] CHECK CONSTRAINT [FK_CustomerSettlementDetail_LOsAccountsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementDetail' AND CONSTRAINT_NAME= 'FK_CustomerSettlementDetail_losDebitCreditNote')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementDetail_losDebitCreditNote] FOREIGN KEY ([shopid],[losdcnid]) REFERENCES losDebitCreditNote([losDCNShopid],[losDCNId])
END
GO
 ALTER TABLE [CustomerSettlementDetail] CHECK CONSTRAINT [FK_CustomerSettlementDetail_losDebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementDetail' AND CONSTRAINT_NAME= 'FK_CustomerSettlementDetail_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementDetail_LOsInvoiceHeader] FOREIGN KEY ([shopid],[losinvoiceid]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [CustomerSettlementDetail] CHECK CONSTRAINT [FK_CustomerSettlementDetail_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementDetail' AND CONSTRAINT_NAME= 'FK_CustomerSettlementDetail_losSpecialInvoiceHeader')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementDetail_losSpecialInvoiceHeader] FOREIGN KEY ([losSpInvoiceId],[shopid]) REFERENCES losSpecialInvoiceHeader([IhInvoiceID],[IhShopID])
END
GO
 ALTER TABLE [CustomerSettlementDetail] CHECK CONSTRAINT [FK_CustomerSettlementDetail_losSpecialInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementDetail' AND CONSTRAINT_NAME= 'FK_CustomerSettlementDetail_AccountsInvoiceHeader')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementDetail_AccountsInvoiceHeader] FOREIGN KEY ([AccInvoiceID]) REFERENCES AccountsInvoiceHeader([InvoiceID])
END
GO
 ALTER TABLE [CustomerSettlementDetail] CHECK CONSTRAINT [FK_CustomerSettlementDetail_AccountsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementDetail' AND CONSTRAINT_NAME= 'FK_CustomerSettlementDetail_aHQPaymentVoucherHeader')
BEGIN
	ALTER TABLE [CustomerSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementDetail_aHQPaymentVoucherHeader] FOREIGN KEY ([paymentid]) REFERENCES aHQPaymentVoucherHeader([phPaymentID])
END
GO
 ALTER TABLE [CustomerSettlementDetail] CHECK CONSTRAINT [FK_CustomerSettlementDetail_aHQPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementHeader' AND CONSTRAINT_NAME= 'FK_CustomerSettlementHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementHeader_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [CustomerSettlementHeader] CHECK CONSTRAINT [FK_CustomerSettlementHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementHeader' AND CONSTRAINT_NAME= 'fk_CustomerSettlementHeader_acustomermaster')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] WITH CHECK ADD  CONSTRAINT [fk_CustomerSettlementHeader_acustomermaster] FOREIGN KEY ([CustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [CustomerSettlementHeader] CHECK CONSTRAINT [fk_CustomerSettlementHeader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementHeader' AND CONSTRAINT_NAME= 'FK_CustomerSettlementHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementHeader_aDepartmentMaster] FOREIGN KEY ([DepartmentID],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [CustomerSettlementHeader] CHECK CONSTRAINT [FK_CustomerSettlementHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementHeader' AND CONSTRAINT_NAME= 'FK_CustomerSettlementHeader_aFinancialYear')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementHeader_aFinancialYear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [CustomerSettlementHeader] CHECK CONSTRAINT [FK_CustomerSettlementHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementHeader' AND CONSTRAINT_NAME= 'FK_CustomerSettlementHeader_DebitCreditNote')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementHeader_DebitCreditNote] FOREIGN KEY ([dcnid]) REFERENCES DebitCreditNote([DCNId])
END
GO
 ALTER TABLE [CustomerSettlementHeader] CHECK CONSTRAINT [FK_CustomerSettlementHeader_DebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementHeader' AND CONSTRAINT_NAME= 'FK_CustomerSettlementHeader_LosGoodsReturnNoteHeader')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementHeader_LosGoodsReturnNoteHeader] FOREIGN KEY ([shopid],[losGoodsreturnnoteID]) REFERENCES LosGoodsReturnNoteHeader([grnhShopid],[GrnhGoodsreturnnoteID])
END
GO
 ALTER TABLE [CustomerSettlementHeader] CHECK CONSTRAINT [FK_CustomerSettlementHeader_LosGoodsReturnNoteHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementHeader' AND CONSTRAINT_NAME= 'fk_CustomerSettlementHeader_LOSspecialinvoiceheader')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] WITH CHECK ADD  CONSTRAINT [fk_CustomerSettlementHeader_LOSspecialinvoiceheader] FOREIGN KEY ([losdcnid],[shopid]) REFERENCES losSpecialInvoiceHeader([IhInvoiceID],[IhShopID])
END
GO
 ALTER TABLE [CustomerSettlementHeader] CHECK CONSTRAINT [fk_CustomerSettlementHeader_LOSspecialinvoiceheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='CustomerSettlementHeader' AND CONSTRAINT_NAME= 'FK_CustomerSettlementHeader_ReceiptVoucherHeader')
BEGIN
	ALTER TABLE [CustomerSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_CustomerSettlementHeader_ReceiptVoucherHeader] FOREIGN KEY ([ReceiptID]) REFERENCES ReceiptVoucherHeader([ReceiptID])
END
GO
 ALTER TABLE [CustomerSettlementHeader] CHECK CONSTRAINT [FK_CustomerSettlementHeader_ReceiptVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DebitCreditNote' AND CONSTRAINT_NAME= 'fk_debitcreditnote_accountmaster')
BEGIN
	ALTER TABLE [DebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_debitcreditnote_accountmaster] FOREIGN KEY ([DCNOtherAccId],[DCNCompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [DebitCreditNote] CHECK CONSTRAINT [fk_debitcreditnote_accountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DebitCreditNote' AND CONSTRAINT_NAME= 'fk_debitcreditnote_acustomermaster')
BEGIN
	ALTER TABLE [DebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_debitcreditnote_acustomermaster] FOREIGN KEY ([DCNCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [DebitCreditNote] CHECK CONSTRAINT [fk_debitcreditnote_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DebitCreditNote' AND CONSTRAINT_NAME= 'fk_DebitCreditNote_adepartmentmaster')
BEGIN
	ALTER TABLE [DebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_DebitCreditNote_adepartmentmaster] FOREIGN KEY ([dcndepartmentid],[DCNCompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [DebitCreditNote] CHECK CONSTRAINT [fk_DebitCreditNote_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DebitCreditNote' AND CONSTRAINT_NAME= 'fk_DebitCreditNote_afinancialyear')
BEGIN
	ALTER TABLE [DebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_DebitCreditNote_afinancialyear] FOREIGN KEY ([Dcnfinancialid],[DCNCompanyid]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [DebitCreditNote] CHECK CONSTRAINT [fk_DebitCreditNote_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DebitCreditNote' AND CONSTRAINT_NAME= 'fk_debitcreditnote_avendormaster')
BEGIN
	ALTER TABLE [DebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_debitcreditnote_avendormaster] FOREIGN KEY ([DCNVendorId]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [DebitCreditNote] CHECK CONSTRAINT [fk_debitcreditnote_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DebitCreditNote' AND CONSTRAINT_NAME= 'fk_debitcreditnote_companymaster')
BEGIN
	ALTER TABLE [DebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_debitcreditnote_companymaster] FOREIGN KEY ([DCNCompanyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [DebitCreditNote] CHECK CONSTRAINT [fk_debitcreditnote_companymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DebitCreditNote' AND CONSTRAINT_NAME= 'fk_DebitCreditNote_HQSalesPromotionDetail')
BEGIN
	ALTER TABLE [DebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_DebitCreditNote_HQSalesPromotionDetail] FOREIGN KEY ([DCNCompanyid],[dcnSalesPromotionID],[dcnSalesPromotionDetID]) REFERENCES HQSalesPromotionDetail([spdCompanyID],[spdpromotionID],[spdDetailID])
END
GO
 ALTER TABLE [DebitCreditNote] CHECK CONSTRAINT [fk_DebitCreditNote_HQSalesPromotionDetail]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DebitCreditNote' AND CONSTRAINT_NAME= 'fk_debitcreditnote_losppurchasebillheader')
BEGIN
	ALTER TABLE [DebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_debitcreditnote_losppurchasebillheader] FOREIGN KEY ([DCNBillId]) REFERENCES LOspPurchaseBillHeader([pbhBillID])
END
GO
 ALTER TABLE [DebitCreditNote] CHECK CONSTRAINT [fk_debitcreditnote_losppurchasebillheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DenominationChequeDetails' AND CONSTRAINT_NAME= 'Fk_DenominationChequeDetails_DenominationHeader')
BEGIN
	ALTER TABLE [DenominationChequeDetails] WITH CHECK ADD  CONSTRAINT [Fk_DenominationChequeDetails_DenominationHeader] FOREIGN KEY ([dcdShopId],[dcdDenomId]) REFERENCES denominationheader([shopid],[denominationid])
END
GO
 ALTER TABLE [DenominationChequeDetails] CHECK CONSTRAINT [Fk_DenominationChequeDetails_DenominationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='denominationdetail' AND CONSTRAINT_NAME= 'fk_denominationdetail_denominationHeader')
BEGIN
	ALTER TABLE [denominationdetail] WITH CHECK ADD  CONSTRAINT [fk_denominationdetail_denominationHeader] FOREIGN KEY ([dshopid],[ddenominationid]) REFERENCES denominationheader([shopid],[denominationid])
END
GO
 ALTER TABLE [denominationdetail] CHECK CONSTRAINT [fk_denominationdetail_denominationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DepreciationDetail' AND CONSTRAINT_NAME= 'fk_depreciationdetail_depreciationheader')
BEGIN
	ALTER TABLE [DepreciationDetail] WITH NOCHECK ADD  CONSTRAINT [fk_depreciationdetail_depreciationheader] FOREIGN KEY ([DepreciationID],[CompanyID]) REFERENCES DepreciationHeader([DepreciationID],[CompanyID])
END
GO
 ALTER TABLE [DepreciationDetail] CHECK CONSTRAINT [fk_depreciationdetail_depreciationheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DepreciationDetail' AND CONSTRAINT_NAME= 'fk_depreciationdetail_fixedasset')
BEGIN
	ALTER TABLE [DepreciationDetail] WITH CHECK ADD  CONSTRAINT [fk_depreciationdetail_fixedasset] FOREIGN KEY ([FixedAssetID],[CompanyID]) REFERENCES FixedAsset([FixedAssetID],[CompanyID])
END
GO
 ALTER TABLE [DepreciationDetail] CHECK CONSTRAINT [fk_depreciationdetail_fixedasset]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DepreciationHeader' AND CONSTRAINT_NAME= 'FK_Depreciation_aAccountMaster1')
BEGIN
	ALTER TABLE [DepreciationHeader] WITH NOCHECK ADD  CONSTRAINT [FK_Depreciation_aAccountMaster1] FOREIGN KEY ([DeprAccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [DepreciationHeader] CHECK CONSTRAINT [FK_Depreciation_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DepreciationHeader' AND CONSTRAINT_NAME= 'FK_Depreciation_aCompanyMaster')
BEGIN
	ALTER TABLE [DepreciationHeader] WITH NOCHECK ADD  CONSTRAINT [FK_Depreciation_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [DepreciationHeader] CHECK CONSTRAINT [FK_Depreciation_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DepreciationHeader' AND CONSTRAINT_NAME= 'FK_Depreciation_aDepartmentMaster')
BEGIN
	ALTER TABLE [DepreciationHeader] WITH NOCHECK ADD  CONSTRAINT [FK_Depreciation_aDepartmentMaster] FOREIGN KEY ([DepartmentID],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [DepreciationHeader] CHECK CONSTRAINT [FK_Depreciation_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DepreciationHeader' AND CONSTRAINT_NAME= 'FK_Depreciation_aFinancialYear')
BEGIN
	ALTER TABLE [DepreciationHeader] WITH NOCHECK ADD  CONSTRAINT [FK_Depreciation_aFinancialYear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [DepreciationHeader] CHECK CONSTRAINT [FK_Depreciation_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Discountdetails' AND CONSTRAINT_NAME= 'FK_Discountdetails_Discountheader')
BEGIN
	ALTER TABLE [Discountdetails] WITH CHECK ADD  CONSTRAINT [FK_Discountdetails_Discountheader] FOREIGN KEY ([Companyid],[Discountid]) REFERENCES Discountheader([Companyid],[Discountid])
END
GO
 ALTER TABLE [Discountdetails] CHECK CONSTRAINT [FK_Discountdetails_Discountheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='discountdishdetails' AND CONSTRAINT_NAME= 'FK_discountdishdetails_Discountdetails')
BEGIN
	ALTER TABLE [discountdishdetails] WITH CHECK ADD  CONSTRAINT [FK_discountdishdetails_Discountdetails] FOREIGN KEY ([companyid],[discountid],[Outletid]) REFERENCES Discountdetails([Companyid],[Discountid],[Outletid])
END
GO
 ALTER TABLE [discountdishdetails] CHECK CONSTRAINT [FK_discountdishdetails_Discountdetails]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DishSegmentDetail' AND CONSTRAINT_NAME= 'FK_DishSegmentDetail_DishSegmentHeader')
BEGIN
	ALTER TABLE [DishSegmentDetail] WITH CHECK ADD  CONSTRAINT [FK_DishSegmentDetail_DishSegmentHeader] FOREIGN KEY ([seg_detail_header_id],[seg_detail_companyid]) REFERENCES DishSegmentHeader([seg_header_id],[seg_header_companyID])
END
GO
 ALTER TABLE [DishSegmentDetail] CHECK CONSTRAINT [FK_DishSegmentDetail_DishSegmentHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DishSegmentDetail' AND CONSTRAINT_NAME= 'FK_seg_detail_header_id_seg_detail_companyid')
BEGIN
	ALTER TABLE [DishSegmentDetail] WITH CHECK ADD  CONSTRAINT [FK_seg_detail_header_id_seg_detail_companyid] FOREIGN KEY ([seg_detail_header_id],[seg_detail_companyid]) REFERENCES DishSegmentHeader([seg_header_id],[seg_header_companyID])
END
GO
 ALTER TABLE [DishSegmentDetail] CHECK CONSTRAINT [FK_seg_detail_header_id_seg_detail_companyid]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ExchangeRate' AND CONSTRAINT_NAME= 'FK_ExchangeRate_aCompanyMaster')
BEGIN
	ALTER TABLE [ExchangeRate] WITH CHECK ADD  CONSTRAINT [FK_ExchangeRate_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [ExchangeRate] CHECK CONSTRAINT [FK_ExchangeRate_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ExchangeRateDetail' AND CONSTRAINT_NAME= 'FK_ExchangeRateDetail_aCompanyMaster')
BEGIN
	ALTER TABLE [ExchangeRateDetail] WITH CHECK ADD  CONSTRAINT [FK_ExchangeRateDetail_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [ExchangeRateDetail] CHECK CONSTRAINT [FK_ExchangeRateDetail_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ExchangeRateDetail' AND CONSTRAINT_NAME= 'FK_ExchangeRateDetail_aCurrencyMaster')
BEGIN
	ALTER TABLE [ExchangeRateDetail] WITH CHECK ADD  CONSTRAINT [FK_ExchangeRateDetail_aCurrencyMaster] FOREIGN KEY ([CurrencyID],[CompanyID]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [ExchangeRateDetail] CHECK CONSTRAINT [FK_ExchangeRateDetail_aCurrencyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ExchangeRateDetail' AND CONSTRAINT_NAME= 'FK_ExchangeRateDetail_ExchangeRate')
BEGIN
	ALTER TABLE [ExchangeRateDetail] WITH CHECK ADD  CONSTRAINT [FK_ExchangeRateDetail_ExchangeRate] FOREIGN KEY ([ExchangeID],[CompanyID]) REFERENCES ExchangeRate([ExchangeID],[CompanyID])
END
GO
 ALTER TABLE [ExchangeRateDetail] CHECK CONSTRAINT [FK_ExchangeRateDetail_ExchangeRate]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ExchangeRateHistoryDetails' AND CONSTRAINT_NAME= 'FK_ExchangeRateHistoryDetails')
BEGIN
	ALTER TABLE [ExchangeRateHistoryDetails] WITH CHECK ADD  CONSTRAINT [FK_ExchangeRateHistoryDetails] FOREIGN KEY ([ExchangeID],[CompanyID]) REFERENCES ExchangeRateHistoryHeader([ExchangeID],[CompanyID])
END
GO
 ALTER TABLE [ExchangeRateHistoryDetails] CHECK CONSTRAINT [FK_ExchangeRateHistoryDetails]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ExchangeRateHistoryHeader' AND CONSTRAINT_NAME= 'FK_ExchangeRateHistoryHeader')
BEGIN
	ALTER TABLE [ExchangeRateHistoryHeader] WITH CHECK ADD  CONSTRAINT [FK_ExchangeRateHistoryHeader] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [ExchangeRateHistoryHeader] CHECK CONSTRAINT [FK_ExchangeRateHistoryHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_botdetails' AND CONSTRAINT_NAME= 'FK_Fb_botdetails_Fb_botheader')
BEGIN
	ALTER TABLE [Fb_botdetails] WITH CHECK ADD  CONSTRAINT [FK_Fb_botdetails_Fb_botheader] FOREIGN KEY ([Fb_bd_Companyid],[fb_bd_Outletid],[Fb_bd_botid]) REFERENCES Fb_botheader([Fb_bh_Companyid],[Fb_bh_outletid],[Fb_bh_botid])
END
GO
 ALTER TABLE [Fb_botdetails] CHECK CONSTRAINT [FK_Fb_botdetails_Fb_botheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_botdetails' AND CONSTRAINT_NAME= 'FK_Fb_botdetails_FB_Dishdetails')
BEGIN
	ALTER TABLE [Fb_botdetails] WITH CHECK ADD  CONSTRAINT [FK_Fb_botdetails_FB_Dishdetails] FOREIGN KEY ([Fb_bd_Companyid],[fb_bd_dishid]) REFERENCES FB_Dishdetails([fb_dd_companyid],[fb_dd_dishid])
END
GO
 ALTER TABLE [Fb_botdetails] CHECK CONSTRAINT [FK_Fb_botdetails_FB_Dishdetails]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_DishAdds' AND CONSTRAINT_NAME= 'FK_Fb_DishAdds_aItem')
BEGIN
	ALTER TABLE [Fb_DishAdds] WITH CHECK ADD  CONSTRAINT [FK_Fb_DishAdds_aItem] FOREIGN KEY ([Fb_da_itemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [Fb_DishAdds] CHECK CONSTRAINT [FK_Fb_DishAdds_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_DishAdds' AND CONSTRAINT_NAME= 'FK_Fb_DishAdds_FB_Dishdetails')
BEGIN
	ALTER TABLE [Fb_DishAdds] WITH CHECK ADD  CONSTRAINT [FK_Fb_DishAdds_FB_Dishdetails] FOREIGN KEY ([Fb_da_Companyid],[Fb_da_dishid]) REFERENCES FB_Dishdetails([fb_dd_companyid],[fb_dd_dishid])
END
GO
 ALTER TABLE [Fb_DishAdds] CHECK CONSTRAINT [FK_Fb_DishAdds_FB_Dishdetails]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FB_Dishsubgroup' AND CONSTRAINT_NAME= 'fk_fb_dishsubgroup_fb_dishgroup')
BEGIN
	ALTER TABLE [FB_Dishsubgroup] WITH CHECK ADD  CONSTRAINT [fk_fb_dishsubgroup_fb_dishgroup] FOREIGN KEY ([Fb_Ds_CompanyID],[Fb_Ds_DishGroupID]) REFERENCES FB_Dishgroup([FB_dg_companyid],[FB_dg_Dishgroupid])
END
GO
 ALTER TABLE [FB_Dishsubgroup] CHECK CONSTRAINT [fk_fb_dishsubgroup_fb_dishgroup]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_kotdetails' AND CONSTRAINT_NAME= 'FK_Fb_kotdetails_FB_Dishdetails')
BEGIN
	ALTER TABLE [Fb_kotdetails] WITH CHECK ADD  CONSTRAINT [FK_Fb_kotdetails_FB_Dishdetails] FOREIGN KEY ([fb_kd_Companyid],[fb_kd_dishid]) REFERENCES FB_Dishdetails([fb_dd_companyid],[fb_dd_dishid])
END
GO
 ALTER TABLE [Fb_kotdetails] CHECK CONSTRAINT [FK_Fb_kotdetails_FB_Dishdetails]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_processdetail' AND CONSTRAINT_NAME= 'FK_Fb_processdetail_LosPosFAndBHeader')
BEGIN
	ALTER TABLE [Fb_processdetail] WITH NOCHECK ADD  CONSTRAINT [FK_Fb_processdetail_LosPosFAndBHeader] FOREIGN KEY ([fb_pd_outletid],[fb_pd_processid]) REFERENCES LosPosFAndBHeader([poshShopID],[poshBillID])
END
GO
 ALTER TABLE [Fb_processdetail] CHECK CONSTRAINT [FK_Fb_processdetail_LosPosFAndBHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_processrecipedetail' AND CONSTRAINT_NAME= 'FK_Fb_processrecipedetail_Fb_processdetail1')
BEGIN
	ALTER TABLE [Fb_processrecipedetail] WITH CHECK ADD  CONSTRAINT [FK_Fb_processrecipedetail_Fb_processdetail1] FOREIGN KEY ([fb_pr_companyid],[fb_pr_outletid],[fb_pr_Processid],[fb_pr_processdetailid]) REFERENCES Fb_processdetail([fb_pd_companyid],[fb_pd_outletid],[fb_pd_processid],[fb_pd_processdetailid])
END
GO
 ALTER TABLE [Fb_processrecipedetail] CHECK CONSTRAINT [FK_Fb_processrecipedetail_Fb_processdetail1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_recipedetails' AND CONSTRAINT_NAME= 'FK_Fb_recipedetails_aItem')
BEGIN
	ALTER TABLE [Fb_recipedetails] WITH CHECK ADD  CONSTRAINT [FK_Fb_recipedetails_aItem] FOREIGN KEY ([Fb_rd_itemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [Fb_recipedetails] CHECK CONSTRAINT [FK_Fb_recipedetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_recipedetails' AND CONSTRAINT_NAME= 'FK_Fb_recipedetails_FB_Dishdetails')
BEGIN
	ALTER TABLE [Fb_recipedetails] WITH CHECK ADD  CONSTRAINT [FK_Fb_recipedetails_FB_Dishdetails] FOREIGN KEY ([Fb_rd_Companyid],[Fb_rd_dishid]) REFERENCES FB_Dishdetails([fb_dd_companyid],[fb_dd_dishid])
END
GO
 ALTER TABLE [Fb_recipedetails] CHECK CONSTRAINT [FK_Fb_recipedetails_FB_Dishdetails]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Fb_resttable' AND CONSTRAINT_NAME= 'FK_Fb_resttable_fb_resttablemaster')
BEGIN
	ALTER TABLE [Fb_resttable] WITH CHECK ADD  CONSTRAINT [FK_Fb_resttable_fb_resttablemaster] FOREIGN KEY ([Fb_rt_companyid],[Fb_rt_outletid],[fb_rt_tablemasterid]) REFERENCES fb_resttablemaster([fb_rm_companyid],[fb_rm_outletid],[fb_rm_tablemasterid])
END
GO
 ALTER TABLE [Fb_resttable] CHECK CONSTRAINT [FK_Fb_resttable_fb_resttablemaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='fb_Tableoccupancy' AND CONSTRAINT_NAME= 'FK_fb_Tableoccupancy_Fb_resttable')
BEGIN
	ALTER TABLE [fb_Tableoccupancy] WITH CHECK ADD  CONSTRAINT [FK_fb_Tableoccupancy_Fb_resttable] FOREIGN KEY ([Fb_to_companyid],[fb_to_Outletid],[fb_to_coverid]) REFERENCES Fb_resttable([Fb_rt_companyid],[Fb_rt_outletid],[Fb_rt_tableid])
END
GO
 ALTER TABLE [fb_Tableoccupancy] CHECK CONSTRAINT [FK_fb_Tableoccupancy_Fb_resttable]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'fk_FixedAsset_aAccountMaster_5')
BEGIN
	ALTER TABLE [FixedAsset] WITH CHECK ADD  CONSTRAINT [fk_FixedAsset_aAccountMaster_5] FOREIGN KEY ([CurrDeprecExpAccID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [fk_FixedAsset_aAccountMaster_5]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'fk_FixedAsset_aAccountMaster_6')
BEGIN
	ALTER TABLE [FixedAsset] WITH CHECK ADD  CONSTRAINT [fk_FixedAsset_aAccountMaster_6] FOREIGN KEY ([CurrAccDepExpAccID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [fk_FixedAsset_aAccountMaster_6]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'fk_fixedasset_accountmaster_conv')
BEGIN
	ALTER TABLE [FixedAsset] WITH CHECK ADD  CONSTRAINT [fk_fixedasset_accountmaster_conv] FOREIGN KEY ([conversiondiffaccid],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [fk_fixedasset_accountmaster_conv]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'fk_fixedasset_accountmaster_dep')
BEGIN
	ALTER TABLE [FixedAsset] WITH CHECK ADD  CONSTRAINT [fk_fixedasset_accountmaster_dep] FOREIGN KEY ([DepreciationAccId],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [fk_fixedasset_accountmaster_dep]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'fk_fixedasset_accountmaster_fxa')
BEGIN
	ALTER TABLE [FixedAsset] WITH CHECK ADD  CONSTRAINT [fk_fixedasset_accountmaster_fxa] FOREIGN KEY ([FixedAssetAccID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [fk_fixedasset_accountmaster_fxa]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'FK_FixedAsset_aCompanyMaster')
BEGIN
	ALTER TABLE [FixedAsset] WITH CHECK ADD  CONSTRAINT [FK_FixedAsset_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [FK_FixedAsset_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'fk_fixedasset_adepartmentmaster_c')
BEGIN
	ALTER TABLE [FixedAsset] WITH CHECK ADD  CONSTRAINT [fk_fixedasset_adepartmentmaster_c] FOREIGN KEY ([CurrentDepartmentId],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [fk_fixedasset_adepartmentmaster_c]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'fk_fixedasset_afinancialyear')
BEGIN
	ALTER TABLE [FixedAsset] WITH CHECK ADD  CONSTRAINT [fk_fixedasset_afinancialyear] FOREIGN KEY ([financialid],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [fk_fixedasset_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'fk_fixedasset_bills')
BEGIN
	ALTER TABLE [FixedAsset] WITH NOCHECK ADD  CONSTRAINT [fk_fixedasset_bills] FOREIGN KEY ([billsrefid]) REFERENCES Bills([BillsID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [fk_fixedasset_bills]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FixedAsset' AND CONSTRAINT_NAME= 'fk_fixedasset_writeoff')
BEGIN
	ALTER TABLE [FixedAsset] WITH NOCHECK ADD  CONSTRAINT [fk_fixedasset_writeoff] FOREIGN KEY ([godownrefid],[writeoffrefid]) REFERENCES LOiWriteOffHeader([whGodownID],[whID])
END
GO
 ALTER TABLE [FixedAsset] CHECK CONSTRAINT [fk_fixedasset_writeoff]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FlightOperatorMaster' AND CONSTRAINT_NAME= 'FK_FlightOperatorMaster_aCustomerMaster')
BEGIN
	ALTER TABLE [FlightOperatorMaster] WITH CHECK ADD  CONSTRAINT [FK_FlightOperatorMaster_aCustomerMaster] FOREIGN KEY ([FlghtOpid]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [FlightOperatorMaster] CHECK CONSTRAINT [FK_FlightOperatorMaster_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FlightOperatorMaster' AND CONSTRAINT_NAME= 'FK_FlightOperatorMaster_DishSegmentHeader')
BEGIN
	ALTER TABLE [FlightOperatorMaster] WITH CHECK ADD  CONSTRAINT [FK_FlightOperatorMaster_DishSegmentHeader] FOREIGN KEY ([FlghtSegID],[companyid]) REFERENCES DishSegmentHeader([seg_header_id],[seg_header_companyID])
END
GO
 ALTER TABLE [FlightOperatorMaster] CHECK CONSTRAINT [FK_FlightOperatorMaster_DishSegmentHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Flights' AND CONSTRAINT_NAME= 'FK_Flights_FlightOperatorMaster')
BEGIN
	ALTER TABLE [Flights] WITH CHECK ADD  CONSTRAINT [FK_Flights_FlightOperatorMaster] FOREIGN KEY ([companyid],[FlightOpid]) REFERENCES FlightOperatorMaster([companyid],[FlghtOpid])
END
GO
 ALTER TABLE [Flights] CHECK CONSTRAINT [FK_Flights_FlightOperatorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Forex' AND CONSTRAINT_NAME= 'FK_Forex_aAccountMaster')
BEGIN
	ALTER TABLE [Forex] WITH CHECK ADD  CONSTRAINT [FK_Forex_aAccountMaster] FOREIGN KEY ([salesorpurchaseaccid],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [Forex] CHECK CONSTRAINT [FK_Forex_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Forex' AND CONSTRAINT_NAME= 'FK_Forex_aAccountMaster1')
BEGIN
	ALTER TABLE [Forex] WITH CHECK ADD  CONSTRAINT [FK_Forex_aAccountMaster1] FOREIGN KEY ([otheraccid],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [Forex] CHECK CONSTRAINT [FK_Forex_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Forex' AND CONSTRAINT_NAME= 'FK_Forex_aAccountMaster2')
BEGIN
	ALTER TABLE [Forex] WITH CHECK ADD  CONSTRAINT [FK_Forex_aAccountMaster2] FOREIGN KEY ([forexgainlossaccid],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [Forex] CHECK CONSTRAINT [FK_Forex_aAccountMaster2]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Forex' AND CONSTRAINT_NAME= 'FK_Forex_aAccountMaster3')
BEGIN
	ALTER TABLE [Forex] WITH CHECK ADD  CONSTRAINT [FK_Forex_aAccountMaster3] FOREIGN KEY ([forexgainlossaccid],[companyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [Forex] CHECK CONSTRAINT [FK_Forex_aAccountMaster3]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Forex' AND CONSTRAINT_NAME= 'FK_Forex_aCompanyMaster')
BEGIN
	ALTER TABLE [Forex] WITH CHECK ADD  CONSTRAINT [FK_Forex_aCompanyMaster] FOREIGN KEY ([companyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [Forex] CHECK CONSTRAINT [FK_Forex_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Forex' AND CONSTRAINT_NAME= 'FK_Forex_aCountryMaster')
BEGIN
	ALTER TABLE [Forex] WITH CHECK ADD  CONSTRAINT [FK_Forex_aCountryMaster] FOREIGN KEY ([nationalityid],[companyid]) REFERENCES aCountryMaster([CountryID],[CompanyID])
END
GO
 ALTER TABLE [Forex] CHECK CONSTRAINT [FK_Forex_aCountryMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Forex' AND CONSTRAINT_NAME= 'FK_Forex_aCustomerMaster')
BEGIN
	ALTER TABLE [Forex] WITH CHECK ADD  CONSTRAINT [FK_Forex_aCustomerMaster] FOREIGN KEY ([customerid]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [Forex] CHECK CONSTRAINT [FK_Forex_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Forex' AND CONSTRAINT_NAME= 'FK_Forex_aVendorMaster')
BEGIN
	ALTER TABLE [Forex] WITH CHECK ADD  CONSTRAINT [FK_Forex_aVendorMaster] FOREIGN KEY ([vendorid]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [Forex] CHECK CONSTRAINT [FK_Forex_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='hqInhousePurchaseBillingDetails' AND CONSTRAINT_NAME= 'fk_hqInhousePurchaseBillingDetails_BillsDebitDetails')
BEGIN
	ALTER TABLE [hqInhousePurchaseBillingDetails] WITH CHECK ADD  CONSTRAINT [fk_hqInhousePurchaseBillingDetails_BillsDebitDetails] FOREIGN KEY ([ipbdBillId],[ipbdBillDetailId]) REFERENCES BillsDebitDetails([BillsID],[BillsDebitID])
END
GO
 ALTER TABLE [hqInhousePurchaseBillingDetails] CHECK CONSTRAINT [fk_hqInhousePurchaseBillingDetails_BillsDebitDetails]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='hqInhousePurchaseBillingDetails' AND CONSTRAINT_NAME= 'fk_hqInhousePurchaseBillingDetails_loaInhousePurchaseHeader')
BEGIN
	ALTER TABLE [hqInhousePurchaseBillingDetails] WITH CHECK ADD  CONSTRAINT [fk_hqInhousePurchaseBillingDetails_loaInhousePurchaseHeader] FOREIGN KEY ([ipbdInhousePurchaseId]) REFERENCES loaInhousePurchaseHeader([iphId])
END
GO
 ALTER TABLE [hqInhousePurchaseBillingDetails] CHECK CONSTRAINT [fk_hqInhousePurchaseBillingDetails_loaInhousePurchaseHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='hqSalesCommisiondetail' AND CONSTRAINT_NAME= 'fk_hqsalescommisiondetail_hqsalescommisionheader')
BEGIN
	ALTER TABLE [hqSalesCommisiondetail] WITH CHECK ADD  CONSTRAINT [fk_hqsalescommisiondetail_hqsalescommisionheader] FOREIGN KEY ([scdCommisionID],[scdcompanyid]) REFERENCES hqSalesCommisionHeader([schCommisionid],[schcompanyid])
END
GO
 ALTER TABLE [hqSalesCommisiondetail] CHECK CONSTRAINT [fk_hqsalescommisiondetail_hqsalescommisionheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND CONSTRAINT_NAME= 'fk_hqsalescommisionheader_acompanymaster')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] WITH CHECK ADD  CONSTRAINT [fk_hqsalescommisionheader_acompanymaster] FOREIGN KEY ([schcompanyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [hqSalesCommisionHeader] CHECK CONSTRAINT [fk_hqsalescommisionheader_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND CONSTRAINT_NAME= 'fk_hqsalescommisionheader_adepartmentmaster')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] WITH CHECK ADD  CONSTRAINT [fk_hqsalescommisionheader_adepartmentmaster] FOREIGN KEY ([schdepartmentid],[schcompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [hqSalesCommisionHeader] CHECK CONSTRAINT [fk_hqsalescommisionheader_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND CONSTRAINT_NAME= 'fk_hqsalescommisionheader_afinancialyear')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] WITH CHECK ADD  CONSTRAINT [fk_hqsalescommisionheader_afinancialyear] FOREIGN KEY ([schfinancialid],[schcompanyid]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [hqSalesCommisionHeader] CHECK CONSTRAINT [fk_hqsalescommisionheader_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND CONSTRAINT_NAME= 'fk_hqsalescommisionheader_asalespersonmaster')
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] WITH CHECK ADD  CONSTRAINT [fk_hqsalescommisionheader_asalespersonmaster] FOREIGN KEY ([schsalespersonid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [hqSalesCommisionHeader] CHECK CONSTRAINT [fk_hqsalescommisionheader_asalespersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND CONSTRAINT_NAME= 'fk_HQSalesPromotionDetail_aCustomerMaster')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] WITH CHECK ADD  CONSTRAINT [fk_HQSalesPromotionDetail_aCustomerMaster] FOREIGN KEY ([spdCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [HQSalesPromotionDetail] CHECK CONSTRAINT [fk_HQSalesPromotionDetail_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND CONSTRAINT_NAME= 'fk_HQSalesPromotionDetail_HQSalesPromotionHeader')
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] WITH CHECK ADD  CONSTRAINT [fk_HQSalesPromotionDetail_HQSalesPromotionHeader] FOREIGN KEY ([spdCompanyID],[spdpromotionID]) REFERENCES HQSalesPromotionHeader([sphCompanyID],[sphPromotionID])
END
GO
 ALTER TABLE [HQSalesPromotionDetail] CHECK CONSTRAINT [fk_HQSalesPromotionDetail_HQSalesPromotionHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND CONSTRAINT_NAME= 'fk_InterDivisionBillsDetails_accountmaster')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] WITH CHECK ADD  CONSTRAINT [fk_InterDivisionBillsDetails_accountmaster] FOREIGN KEY ([AccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [InterDivisionBillsDetails] CHECK CONSTRAINT [fk_InterDivisionBillsDetails_accountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND CONSTRAINT_NAME= 'FK_InterDivisionBillsDetails_aDepartmentMaster')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] WITH CHECK ADD  CONSTRAINT [FK_InterDivisionBillsDetails_aDepartmentMaster] FOREIGN KEY ([DepartmentId],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [InterDivisionBillsDetails] CHECK CONSTRAINT [FK_InterDivisionBillsDetails_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsDetails' AND CONSTRAINT_NAME= 'fk_InterDivisionBillsDetails_InterDivisionBillsHeader')
BEGIN
	ALTER TABLE [InterDivisionBillsDetails] WITH NOCHECK ADD  CONSTRAINT [fk_InterDivisionBillsDetails_InterDivisionBillsHeader] FOREIGN KEY ([BillsID]) REFERENCES InterDivisionBillsHeader([BillsID])
END
GO
 ALTER TABLE [InterDivisionBillsDetails] CHECK CONSTRAINT [fk_InterDivisionBillsDetails_InterDivisionBillsHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND CONSTRAINT_NAME= 'fk_InterDivisionBillsHeader_accountmaster')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] WITH NOCHECK ADD  CONSTRAINT [fk_InterDivisionBillsHeader_accountmaster] FOREIGN KEY ([BankCashAccID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [InterDivisionBillsHeader] CHECK CONSTRAINT [fk_InterDivisionBillsHeader_accountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND CONSTRAINT_NAME= 'fk_InterDivisionBillsHeader_accountmasterDiscAcc')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] WITH NOCHECK ADD  CONSTRAINT [fk_InterDivisionBillsHeader_accountmasterDiscAcc] FOREIGN KEY ([DiscountAccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [InterDivisionBillsHeader] CHECK CONSTRAINT [fk_InterDivisionBillsHeader_accountmasterDiscAcc]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND CONSTRAINT_NAME= 'fk_InterDivisionBillsHeader_avendormaster')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] WITH NOCHECK ADD  CONSTRAINT [fk_InterDivisionBillsHeader_avendormaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [InterDivisionBillsHeader] CHECK CONSTRAINT [fk_InterDivisionBillsHeader_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND CONSTRAINT_NAME= 'fk_InterDivisionBillsHeader_Company')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] WITH NOCHECK ADD  CONSTRAINT [fk_InterDivisionBillsHeader_Company] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [InterDivisionBillsHeader] CHECK CONSTRAINT [fk_InterDivisionBillsHeader_Company]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND CONSTRAINT_NAME= 'fk_InterDivisionBillsHeader_financialyear')
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] WITH NOCHECK ADD  CONSTRAINT [fk_InterDivisionBillsHeader_financialyear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [InterDivisionBillsHeader] CHECK CONSTRAINT [fk_InterDivisionBillsHeader_financialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='JournalTransDetails' AND CONSTRAINT_NAME= 'FK_JournalTransDetails_aAccountMaster')
BEGIN
	ALTER TABLE [JournalTransDetails] WITH CHECK ADD  CONSTRAINT [FK_JournalTransDetails_aAccountMaster] FOREIGN KEY ([AccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [JournalTransDetails] CHECK CONSTRAINT [FK_JournalTransDetails_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='JournalTransHeader' AND CONSTRAINT_NAME= 'FK_JournalTransHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [JournalTransHeader] WITH CHECK ADD  CONSTRAINT [FK_JournalTransHeader_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [JournalTransHeader] CHECK CONSTRAINT [FK_JournalTransHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='JournalTransHeader' AND CONSTRAINT_NAME= 'FK_JournalTransHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [JournalTransHeader] WITH CHECK ADD  CONSTRAINT [FK_JournalTransHeader_aDepartmentMaster] FOREIGN KEY ([departmentid],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [JournalTransHeader] CHECK CONSTRAINT [FK_JournalTransHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='JournalTransHeader' AND CONSTRAINT_NAME= 'FK_JournalTransHeader_aFinancialYear')
BEGIN
	ALTER TABLE [JournalTransHeader] WITH CHECK ADD  CONSTRAINT [FK_JournalTransHeader_aFinancialYear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [JournalTransHeader] CHECK CONSTRAINT [FK_JournalTransHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LeadTimeStage' AND CONSTRAINT_NAME= 'FK_LeadTimeStage_LeadTimeDivision')
BEGIN
	ALTER TABLE [LeadTimeStage] WITH CHECK ADD  CONSTRAINT [FK_LeadTimeStage_LeadTimeDivision] FOREIGN KEY ([Lstagedivisionid]) REFERENCES LeadTimeDivision([Ldivisionid])
END
GO
 ALTER TABLE [LeadTimeStage] CHECK CONSTRAINT [FK_LeadTimeStage_LeadTimeDivision]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND CONSTRAINT_NAME= 'FK_LOaCostingAccountDetails_aAccountMaster')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingAccountDetails_aAccountMaster] FOREIGN KEY ([cadAccountID],[cadCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOaCostingAccountDetails] CHECK CONSTRAINT [FK_LOaCostingAccountDetails_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND CONSTRAINT_NAME= 'FK_LOaCostingAccountDetails_aAccountMaster1')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingAccountDetails_aAccountMaster1] FOREIGN KEY ([cadBankCashAccID],[cadCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOaCostingAccountDetails] CHECK CONSTRAINT [FK_LOaCostingAccountDetails_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingAccountDetails' AND CONSTRAINT_NAME= 'FK_LOaCostingAccountDetails_LOaCostingHeader')
BEGIN
	ALTER TABLE [LOaCostingAccountDetails] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingAccountDetails_LOaCostingHeader] FOREIGN KEY ([cadCostingID]) REFERENCES LOaCostingHeader([chCostingID])
END
GO
 ALTER TABLE [LOaCostingAccountDetails] CHECK CONSTRAINT [FK_LOaCostingAccountDetails_LOaCostingHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingDetail' AND CONSTRAINT_NAME= 'FK_LOaCostingDetail_aItem')
BEGIN
	ALTER TABLE [LOaCostingDetail] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingDetail_aItem] FOREIGN KEY ([cdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOaCostingDetail] CHECK CONSTRAINT [FK_LOaCostingDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingDetail' AND CONSTRAINT_NAME= 'FK_LOaCostingDetail_LOaCostingHeader')
BEGIN
	ALTER TABLE [LOaCostingDetail] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingDetail_LOaCostingHeader] FOREIGN KEY ([cdCostingID]) REFERENCES LOaCostingHeader([chCostingID])
END
GO
 ALTER TABLE [LOaCostingDetail] CHECK CONSTRAINT [FK_LOaCostingDetail_LOaCostingHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingHeader' AND CONSTRAINT_NAME= 'FK_LOaCostingHeader_aAccountMaster')
BEGIN
	ALTER TABLE [LOaCostingHeader] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingHeader_aAccountMaster] FOREIGN KEY ([chInventoryaccid],[chCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOaCostingHeader] CHECK CONSTRAINT [FK_LOaCostingHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingHeader' AND CONSTRAINT_NAME= 'FK_LOaCostingHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [LOaCostingHeader] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingHeader_aAccountMaster1] FOREIGN KEY ([chGoodsinTransitaccid],[chCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOaCostingHeader] CHECK CONSTRAINT [FK_LOaCostingHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingHeader' AND CONSTRAINT_NAME= 'FK_LOaCostingHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [LOaCostingHeader] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingHeader_aCompanyMaster] FOREIGN KEY ([chCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [LOaCostingHeader] CHECK CONSTRAINT [FK_LOaCostingHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingHeader' AND CONSTRAINT_NAME= 'FK_LOaCostingHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [LOaCostingHeader] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingHeader_aDepartmentMaster] FOREIGN KEY ([chDepartmentID],[chCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [LOaCostingHeader] CHECK CONSTRAINT [FK_LOaCostingHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOaCostingHeader' AND CONSTRAINT_NAME= 'FK_LOaCostingHeader_LOspPurchaseBillHeader')
BEGIN
	ALTER TABLE [LOaCostingHeader] WITH CHECK ADD  CONSTRAINT [FK_LOaCostingHeader_LOspPurchaseBillHeader] FOREIGN KEY ([chBillID]) REFERENCES LOspPurchaseBillHeader([pbhBillID])
END
GO
 ALTER TABLE [LOaCostingHeader] CHECK CONSTRAINT [FK_LOaCostingHeader_LOspPurchaseBillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaInhousePurchaseDetail' AND CONSTRAINT_NAME= 'FK_loaInhousePurchaseDetail_loaInhousePurchaseHeader')
BEGIN
	ALTER TABLE [loaInhousePurchaseDetail] WITH CHECK ADD  CONSTRAINT [FK_loaInhousePurchaseDetail_loaInhousePurchaseHeader] FOREIGN KEY ([ipdid]) REFERENCES loaInhousePurchaseHeader([iphId])
END
GO
 ALTER TABLE [loaInhousePurchaseDetail] CHECK CONSTRAINT [FK_loaInhousePurchaseDetail_loaInhousePurchaseHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaInhousePurchaseHeader' AND CONSTRAINT_NAME= 'FK_loaInhousePurchaseHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [loaInhousePurchaseHeader] WITH CHECK ADD  CONSTRAINT [FK_loaInhousePurchaseHeader_aCompanyMaster] FOREIGN KEY ([iphCompanyId]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [loaInhousePurchaseHeader] CHECK CONSTRAINT [FK_loaInhousePurchaseHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND CONSTRAINT_NAME= 'FK_loaItemSplitCostingDetail_aItem')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] WITH CHECK ADD  CONSTRAINT [FK_loaItemSplitCostingDetail_aItem] FOREIGN KEY ([scfdItemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loaItemSplitCostingDetail] CHECK CONSTRAINT [FK_loaItemSplitCostingDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaItemSplitCostingDetail' AND CONSTRAINT_NAME= 'FK_loaItemSplitCostingDetail_loaItemsplitcostingHeader')
BEGIN
	ALTER TABLE [loaItemSplitCostingDetail] WITH CHECK ADD  CONSTRAINT [FK_loaItemSplitCostingDetail_loaItemsplitcostingHeader] FOREIGN KEY ([scfdid]) REFERENCES loaItemsplitcostingHeader([scfhid])
END
GO
 ALTER TABLE [loaItemSplitCostingDetail] CHECK CONSTRAINT [FK_loaItemSplitCostingDetail_loaItemsplitcostingHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND CONSTRAINT_NAME= 'fk_loaitemsplitcostingheader_adepartmentmaster')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] WITH CHECK ADD  CONSTRAINT [fk_loaitemsplitcostingheader_adepartmentmaster] FOREIGN KEY ([scfhdepartmentid],[scfhcompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [loaItemsplitcostingHeader] CHECK CONSTRAINT [fk_loaitemsplitcostingheader_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND CONSTRAINT_NAME= 'fk_loaItemsplitCostingHeader_ashipment')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] WITH CHECK ADD  CONSTRAINT [fk_loaItemsplitCostingHeader_ashipment] FOREIGN KEY ([scfhShipmentid]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [loaItemsplitcostingHeader] CHECK CONSTRAINT [fk_loaItemsplitCostingHeader_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND CONSTRAINT_NAME= 'FK_loaItemsplitcostingHeader_LOaCostingHeader')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] WITH CHECK ADD  CONSTRAINT [FK_loaItemsplitcostingHeader_LOaCostingHeader] FOREIGN KEY ([scfhCostingId]) REFERENCES LOaCostingHeader([chCostingID])
END
GO
 ALTER TABLE [loaItemsplitcostingHeader] CHECK CONSTRAINT [FK_loaItemsplitcostingHeader_LOaCostingHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND CONSTRAINT_NAME= 'FK_loaItemsplitcostingHeader_LoiItemSplitHeader')
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] WITH CHECK ADD  CONSTRAINT [FK_loaItemsplitcostingHeader_LoiItemSplitHeader] FOREIGN KEY ([scfhGodownid],[scfhItemSplitId]) REFERENCES LoiItemSplitHeader([ishgodownid],[ishid])
END
GO
 ALTER TABLE [loaItemsplitcostingHeader] CHECK CONSTRAINT [FK_loaItemsplitcostingHeader_LoiItemSplitHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND CONSTRAINT_NAME= 'FK_loalocalpurchasecostingdetail_aItem')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] WITH CHECK ADD  CONSTRAINT [FK_loalocalpurchasecostingdetail_aItem] FOREIGN KEY ([lpcditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loalocalpurchasecostingdetail] CHECK CONSTRAINT [FK_loalocalpurchasecostingdetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loalocalpurchasecostingdetail' AND CONSTRAINT_NAME= 'FK_loalocalpurchasecostingdetail_loalocalpurchaseCostingheader')
BEGIN
	ALTER TABLE [loalocalpurchasecostingdetail] WITH CHECK ADD  CONSTRAINT [FK_loalocalpurchasecostingdetail_loalocalpurchaseCostingheader] FOREIGN KEY ([lpcdcostingid]) REFERENCES loalocalpurchaseCostingheader([lpchCostingid])
END
GO
 ALTER TABLE [loalocalpurchasecostingdetail] CHECK CONSTRAINT [FK_loalocalpurchasecostingdetail_loalocalpurchaseCostingheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND CONSTRAINT_NAME= 'FK_loalocalpurchaseCostingheader_aAccountMaster')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] WITH CHECK ADD  CONSTRAINT [FK_loalocalpurchaseCostingheader_aAccountMaster] FOREIGN KEY ([lpchGoodsinTransitaccid],[lpchCompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [loalocalpurchaseCostingheader] CHECK CONSTRAINT [FK_loalocalpurchaseCostingheader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND CONSTRAINT_NAME= 'FK_loalocalpurchaseCostingheader_aAccountMaster1')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] WITH CHECK ADD  CONSTRAINT [FK_loalocalpurchaseCostingheader_aAccountMaster1] FOREIGN KEY ([lpchInventoryaccid],[lpchCompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [loalocalpurchaseCostingheader] CHECK CONSTRAINT [FK_loalocalpurchaseCostingheader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND CONSTRAINT_NAME= 'FK_loalocalpurchaseCostingheader_aDepartmentMaster')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] WITH CHECK ADD  CONSTRAINT [FK_loalocalpurchaseCostingheader_aDepartmentMaster] FOREIGN KEY ([lpchDepartmentid],[lpchCompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [loalocalpurchaseCostingheader] CHECK CONSTRAINT [FK_loalocalpurchaseCostingheader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND CONSTRAINT_NAME= 'FK_loalocalpurchaseCostingheader_LosLocalPurchaseHeader')
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] WITH CHECK ADD  CONSTRAINT [FK_loalocalpurchaseCostingheader_LosLocalPurchaseHeader] FOREIGN KEY ([lpchShopid],[lpchBillid]) REFERENCES LosLocalPurchaseHeader([lphShopID],[lphBillID])
END
GO
 ALTER TABLE [loalocalpurchaseCostingheader] CHECK CONSTRAINT [FK_loalocalpurchaseCostingheader_LosLocalPurchaseHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalDetail' AND CONSTRAINT_NAME= 'FK_LOiArrivalDetail_aItem')
BEGIN
	ALTER TABLE [LOiArrivalDetail] WITH CHECK ADD  CONSTRAINT [FK_LOiArrivalDetail_aItem] FOREIGN KEY ([adItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOiArrivalDetail] CHECK CONSTRAINT [FK_LOiArrivalDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalDetail' AND CONSTRAINT_NAME= 'FK_LOiArrivalDetail_aPackingType')
BEGIN
	ALTER TABLE [LOiArrivalDetail] WITH CHECK ADD  CONSTRAINT [FK_LOiArrivalDetail_aPackingType] FOREIGN KEY ([adPackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [LOiArrivalDetail] CHECK CONSTRAINT [FK_LOiArrivalDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalDetail' AND CONSTRAINT_NAME= 'FK_LOiArrivalDetail_LOiArrivalHeader')
BEGIN
	ALTER TABLE [LOiArrivalDetail] WITH CHECK ADD  CONSTRAINT [FK_LOiArrivalDetail_LOiArrivalHeader] FOREIGN KEY ([adArrivalID],[adGodownID]) REFERENCES LOiArrivalHeader([ahArrivalID],[ahLocalGodownID])
END
GO
 ALTER TABLE [LOiArrivalDetail] CHECK CONSTRAINT [FK_LOiArrivalDetail_LOiArrivalHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalHeader' AND CONSTRAINT_NAME= 'FK_LOiArrivalHeader_aGodown')
BEGIN
	ALTER TABLE [LOiArrivalHeader] WITH CHECK ADD  CONSTRAINT [FK_LOiArrivalHeader_aGodown] FOREIGN KEY ([ahGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LOiArrivalHeader] CHECK CONSTRAINT [FK_LOiArrivalHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalHeader' AND CONSTRAINT_NAME= 'fk_LOiArrivalHeader_agodown1')
BEGIN
	ALTER TABLE [LOiArrivalHeader] WITH CHECK ADD  CONSTRAINT [fk_LOiArrivalHeader_agodown1] FOREIGN KEY ([ahLocalGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LOiArrivalHeader] CHECK CONSTRAINT [fk_LOiArrivalHeader_agodown1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalHeader' AND CONSTRAINT_NAME= 'fk_LOiArrivalHeader_ashipment')
BEGIN
	ALTER TABLE [LOiArrivalHeader] WITH CHECK ADD  CONSTRAINT [fk_LOiArrivalHeader_ashipment] FOREIGN KEY ([ahShipmentID]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [LOiArrivalHeader] CHECK CONSTRAINT [fk_LOiArrivalHeader_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalHeader' AND CONSTRAINT_NAME= 'fk_LOiArrivalHeader_ashops')
BEGIN
	ALTER TABLE [LOiArrivalHeader] WITH CHECK ADD  CONSTRAINT [fk_LOiArrivalHeader_ashops] FOREIGN KEY ([ahShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOiArrivalHeader] CHECK CONSTRAINT [fk_LOiArrivalHeader_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND CONSTRAINT_NAME= 'FK_LOiArrivalShipmentDetail_aItem')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] WITH CHECK ADD  CONSTRAINT [FK_LOiArrivalShipmentDetail_aItem] FOREIGN KEY ([asdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOiArrivalShipmentDetail] CHECK CONSTRAINT [FK_LOiArrivalShipmentDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND CONSTRAINT_NAME= 'FK_LOiArrivalShipmentDetail_LOiArrivalHeader')
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] WITH CHECK ADD  CONSTRAINT [FK_LOiArrivalShipmentDetail_LOiArrivalHeader] FOREIGN KEY ([asdArrivalID],[asdGodownID]) REFERENCES LOiArrivalHeader([ahArrivalID],[ahLocalGodownID])
END
GO
 ALTER TABLE [LOiArrivalShipmentDetail] CHECK CONSTRAINT [FK_LOiArrivalShipmentDetail_LOiArrivalHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND CONSTRAINT_NAME= 'FK_LOiArrivaltoLocation_aItem')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] WITH CHECK ADD  CONSTRAINT [FK_LOiArrivaltoLocation_aItem] FOREIGN KEY ([alItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOiArrivaltoLocation] CHECK CONSTRAINT [FK_LOiArrivaltoLocation_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND CONSTRAINT_NAME= 'FK_LOiArrivaltoLocation_LOiArrivalHeader')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] WITH CHECK ADD  CONSTRAINT [FK_LOiArrivaltoLocation_LOiArrivalHeader] FOREIGN KEY ([alArrivalID],[alGodownID]) REFERENCES LOiArrivalHeader([ahArrivalID],[ahLocalGodownID])
END
GO
 ALTER TABLE [LOiArrivaltoLocation] CHECK CONSTRAINT [FK_LOiArrivaltoLocation_LOiArrivalHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND CONSTRAINT_NAME= 'FK_LOiArrivaltoLocation_LOiLocation1')
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] WITH CHECK ADD  CONSTRAINT [FK_LOiArrivaltoLocation_LOiLocation1] FOREIGN KEY ([alGodownID],[alLocationID]) REFERENCES LOiLocation([lGodownID],[lLocationID])
END
GO
 ALTER TABLE [LOiArrivaltoLocation] CHECK CONSTRAINT [FK_LOiArrivaltoLocation_LOiLocation1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND CONSTRAINT_NAME= 'FK_LOiDamageClearingDetails_aItem')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] WITH CHECK ADD  CONSTRAINT [FK_LOiDamageClearingDetails_aItem] FOREIGN KEY ([dcdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOiDamageClearingDetails] CHECK CONSTRAINT [FK_LOiDamageClearingDetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND CONSTRAINT_NAME= 'fk_LoiDamageClearingDetails_ashipment')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] WITH CHECK ADD  CONSTRAINT [fk_LoiDamageClearingDetails_ashipment] FOREIGN KEY ([dcdShipmentID]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [LOiDamageClearingDetails] CHECK CONSTRAINT [fk_LoiDamageClearingDetails_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND CONSTRAINT_NAME= 'FK_LOiDamageClearingDetails_LOiDamageClearingHeader')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] WITH CHECK ADD  CONSTRAINT [FK_LOiDamageClearingDetails_LOiDamageClearingHeader] FOREIGN KEY ([dcdClearingID],[dcdGodownid]) REFERENCES LOiDamageClearingHeader([dchClearingID],[dchGodownid])
END
GO
 ALTER TABLE [LOiDamageClearingDetails] CHECK CONSTRAINT [FK_LOiDamageClearingDetails_LOiDamageClearingHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND CONSTRAINT_NAME= 'fk_LoiDamageClearingDetails_loilocation')
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] WITH CHECK ADD  CONSTRAINT [fk_LoiDamageClearingDetails_loilocation] FOREIGN KEY ([dcdGodownid],[dcdLocationID]) REFERENCES LOiLocation([lGodownID],[lLocationID])
END
GO
 ALTER TABLE [LOiDamageClearingDetails] CHECK CONSTRAINT [fk_LoiDamageClearingDetails_loilocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND CONSTRAINT_NAME= 'FK_LOiDamageClearingHeader_aGodown')
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] WITH CHECK ADD  CONSTRAINT [FK_LOiDamageClearingHeader_aGodown] FOREIGN KEY ([dchGodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LOiDamageClearingHeader] CHECK CONSTRAINT [FK_LOiDamageClearingHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND CONSTRAINT_NAME= 'FK_loiexpiryarrivaldetails_aGodown')
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] WITH CHECK ADD  CONSTRAINT [FK_loiexpiryarrivaldetails_aGodown] FOREIGN KEY ([eadgodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [loiexpiryarrivaldetails] CHECK CONSTRAINT [FK_loiexpiryarrivaldetails_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiexpiryissuedetails' AND CONSTRAINT_NAME= 'FK_loiexpiryissuedetails_aGodown')
BEGIN
	ALTER TABLE [loiexpiryissuedetails] WITH CHECK ADD  CONSTRAINT [FK_loiexpiryissuedetails_aGodown] FOREIGN KEY ([eidgodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [loiexpiryissuedetails] CHECK CONSTRAINT [FK_loiexpiryissuedetails_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND CONSTRAINT_NAME= 'FK_LOiGodownShopArrivalToLocation_aItem')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] WITH CHECK ADD  CONSTRAINT [FK_LOiGodownShopArrivalToLocation_aItem] FOREIGN KEY ([gsalItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOiGodownShopArrivalToLocation] CHECK CONSTRAINT [FK_LOiGodownShopArrivalToLocation_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND CONSTRAINT_NAME= 'FK_LOiGodownShopArrivalToLocation_LOiArrivalHeader')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] WITH CHECK ADD  CONSTRAINT [FK_LOiGodownShopArrivalToLocation_LOiArrivalHeader] FOREIGN KEY ([gsalArrivalID],[gsalGodownID]) REFERENCES LOiArrivalHeader([ahArrivalID],[ahLocalGodownID])
END
GO
 ALTER TABLE [LOiGodownShopArrivalToLocation] CHECK CONSTRAINT [FK_LOiGodownShopArrivalToLocation_LOiArrivalHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND CONSTRAINT_NAME= 'FK_LOiGodownShopArrivalToLocation_LOiLocation')
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] WITH CHECK ADD  CONSTRAINT [FK_LOiGodownShopArrivalToLocation_LOiLocation] FOREIGN KEY ([gsalGodownID],[gsalLocationID]) REFERENCES LOiLocation([lGodownID],[lLocationID])
END
GO
 ALTER TABLE [LOiGodownShopArrivalToLocation] CHECK CONSTRAINT [FK_LOiGodownShopArrivalToLocation_LOiLocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoiItemSplitDetail' AND CONSTRAINT_NAME= 'FK_LoiItemSplitDetail_aItem')
BEGIN
	ALTER TABLE [LoiItemSplitDetail] WITH CHECK ADD  CONSTRAINT [FK_LoiItemSplitDetail_aItem] FOREIGN KEY ([isditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LoiItemSplitDetail] CHECK CONSTRAINT [FK_LoiItemSplitDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoiItemSplitDetail' AND CONSTRAINT_NAME= 'FK_LoiItemSplitDetail_LoiItemSplitHeader')
BEGIN
	ALTER TABLE [LoiItemSplitDetail] WITH CHECK ADD  CONSTRAINT [FK_LoiItemSplitDetail_LoiItemSplitHeader] FOREIGN KEY ([isdgodownid],[isdid]) REFERENCES LoiItemSplitHeader([ishgodownid],[ishid])
END
GO
 ALTER TABLE [LoiItemSplitDetail] CHECK CONSTRAINT [FK_LoiItemSplitDetail_LoiItemSplitHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoiItemSplitHeader' AND CONSTRAINT_NAME= 'FK_LoiItemSplitHeader_aGodown')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] WITH CHECK ADD  CONSTRAINT [FK_LoiItemSplitHeader_aGodown] FOREIGN KEY ([ishgodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LoiItemSplitHeader] CHECK CONSTRAINT [FK_LoiItemSplitHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoiItemSplitHeader' AND CONSTRAINT_NAME= 'FK_LoiItemSplitHeader_aItem')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] WITH CHECK ADD  CONSTRAINT [FK_LoiItemSplitHeader_aItem] FOREIGN KEY ([ishSplititemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LoiItemSplitHeader] CHECK CONSTRAINT [FK_LoiItemSplitHeader_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoiItemSplitHeader' AND CONSTRAINT_NAME= 'fk_loiItemSplitHeader_ashipment')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] WITH CHECK ADD  CONSTRAINT [fk_loiItemSplitHeader_ashipment] FOREIGN KEY ([ishshipmentid]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [LoiItemSplitHeader] CHECK CONSTRAINT [fk_loiItemSplitHeader_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoiItemSplitHeader' AND CONSTRAINT_NAME= 'fk_loiItemSplitHeader_loiarrivalheader')
BEGIN
	ALTER TABLE [LoiItemSplitHeader] WITH CHECK ADD  CONSTRAINT [fk_loiItemSplitHeader_loiarrivalheader] FOREIGN KEY ([ishArrivalID],[ishgodownid]) REFERENCES LOiArrivalHeader([ahArrivalID],[ahLocalGodownID])
END
GO
 ALTER TABLE [LoiItemSplitHeader] CHECK CONSTRAINT [fk_loiItemSplitHeader_loiarrivalheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiLocation' AND CONSTRAINT_NAME= 'FK_LOiLocation_aGodown')
BEGIN
	ALTER TABLE [LOiLocation] WITH CHECK ADD  CONSTRAINT [FK_LOiLocation_aGodown] FOREIGN KEY ([lGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LOiLocation] CHECK CONSTRAINT [FK_LOiLocation_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiLocation' AND CONSTRAINT_NAME= 'fk_loilocation_loilocationgroup')
BEGIN
	ALTER TABLE [LOiLocation] WITH CHECK ADD  CONSTRAINT [fk_loilocation_loilocationgroup] FOREIGN KEY ([lcompanyid],[lgroupid],[lGodownID]) REFERENCES LoilocationGroup([Lgcompanyid],[Lggroupid],[Lggodownid])
END
GO
 ALTER TABLE [LOiLocation] CHECK CONSTRAINT [fk_loilocation_loilocationgroup]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loilocationarrivaldetails' AND CONSTRAINT_NAME= 'FK_loilocationarrivaldetails_aItem')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] WITH CHECK ADD  CONSTRAINT [FK_loilocationarrivaldetails_aItem] FOREIGN KEY ([laditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loilocationarrivaldetails] CHECK CONSTRAINT [FK_loilocationarrivaldetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loilocationarrivaldetails' AND CONSTRAINT_NAME= 'FK_loilocationarrivaldetails_aPackingType')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] WITH CHECK ADD  CONSTRAINT [FK_loilocationarrivaldetails_aPackingType] FOREIGN KEY ([ladpackingtypeid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [loilocationarrivaldetails] CHECK CONSTRAINT [FK_loilocationarrivaldetails_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loilocationarrivaldetails' AND CONSTRAINT_NAME= 'FK_loilocationarrivaldetails_LOiLocation')
BEGIN
	ALTER TABLE [loilocationarrivaldetails] WITH CHECK ADD  CONSTRAINT [FK_loilocationarrivaldetails_LOiLocation] FOREIGN KEY ([ladgodownid],[ladlocationid]) REFERENCES LOiLocation([lGodownID],[lLocationID])
END
GO
 ALTER TABLE [loilocationarrivaldetails] CHECK CONSTRAINT [FK_loilocationarrivaldetails_LOiLocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoilocationGroup' AND CONSTRAINT_NAME= 'fk_loilocationgroup_acompanymaster')
BEGIN
	ALTER TABLE [LoilocationGroup] WITH CHECK ADD  CONSTRAINT [fk_loilocationgroup_acompanymaster] FOREIGN KEY ([Lgcompanyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [LoilocationGroup] CHECK CONSTRAINT [fk_loilocationgroup_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoilocationGroup' AND CONSTRAINT_NAME= 'fk_loilocationgroup_agodwn')
BEGIN
	ALTER TABLE [LoilocationGroup] WITH CHECK ADD  CONSTRAINT [fk_loilocationgroup_agodwn] FOREIGN KEY ([Lggodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LoilocationGroup] CHECK CONSTRAINT [fk_loilocationgroup_agodwn]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loilocationissuedetails' AND CONSTRAINT_NAME= 'FK_loilocationissuedetails_aItem')
BEGIN
	ALTER TABLE [loilocationissuedetails] WITH CHECK ADD  CONSTRAINT [FK_loilocationissuedetails_aItem] FOREIGN KEY ([liditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loilocationissuedetails] CHECK CONSTRAINT [FK_loilocationissuedetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loilocationissuedetails' AND CONSTRAINT_NAME= 'FK_loilocationissuedetails_aPackingType')
BEGIN
	ALTER TABLE [loilocationissuedetails] WITH CHECK ADD  CONSTRAINT [FK_loilocationissuedetails_aPackingType] FOREIGN KEY ([lidpackingtypeid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [loilocationissuedetails] CHECK CONSTRAINT [FK_loilocationissuedetails_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loilocationissuedetails' AND CONSTRAINT_NAME= 'FK_loilocationissuedetails_LOiLocation')
BEGIN
	ALTER TABLE [loilocationissuedetails] WITH CHECK ADD  CONSTRAINT [FK_loilocationissuedetails_LOiLocation] FOREIGN KEY ([lidgodownid],[lidlocationid]) REFERENCES LOiLocation([lGodownID],[lLocationID])
END
GO
 ALTER TABLE [loilocationissuedetails] CHECK CONSTRAINT [FK_loilocationissuedetails_LOiLocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiSettings' AND CONSTRAINT_NAME= 'fk_loisettings_agodown')
BEGIN
	ALTER TABLE [LOiSettings] WITH CHECK ADD  CONSTRAINT [fk_loisettings_agodown] FOREIGN KEY ([Godownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LOiSettings] CHECK CONSTRAINT [fk_loisettings_agodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockRecovery' AND CONSTRAINT_NAME= 'FK_loiStockRecovery_aGodown')
BEGIN
	ALTER TABLE [loiStockRecovery] WITH CHECK ADD  CONSTRAINT [FK_loiStockRecovery_aGodown] FOREIGN KEY ([srGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [loiStockRecovery] CHECK CONSTRAINT [FK_loiStockRecovery_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockRecovery' AND CONSTRAINT_NAME= 'FK_loiStockRecovery_aGodown1')
BEGIN
	ALTER TABLE [loiStockRecovery] WITH CHECK ADD  CONSTRAINT [FK_loiStockRecovery_aGodown1] FOREIGN KEY ([srGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [loiStockRecovery] CHECK CONSTRAINT [FK_loiStockRecovery_aGodown1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockRecovery' AND CONSTRAINT_NAME= 'FK_loiStockRecovery_aItem')
BEGIN
	ALTER TABLE [loiStockRecovery] WITH CHECK ADD  CONSTRAINT [FK_loiStockRecovery_aItem] FOREIGN KEY ([srItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loiStockRecovery] CHECK CONSTRAINT [FK_loiStockRecovery_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockVerificationDetail' AND CONSTRAINT_NAME= 'FK_loiStockVerificationDetail_aItem')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] WITH CHECK ADD  CONSTRAINT [FK_loiStockVerificationDetail_aItem] FOREIGN KEY ([svdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loiStockVerificationDetail] CHECK CONSTRAINT [FK_loiStockVerificationDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockVerificationDetail' AND CONSTRAINT_NAME= 'fk_loiStockVerificationDetail_ashipment')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] WITH CHECK ADD  CONSTRAINT [fk_loiStockVerificationDetail_ashipment] FOREIGN KEY ([svdShipmentID]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [loiStockVerificationDetail] CHECK CONSTRAINT [fk_loiStockVerificationDetail_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockVerificationDetail' AND CONSTRAINT_NAME= 'fk_loiStockVerificationDetail_loilocation')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] WITH CHECK ADD  CONSTRAINT [fk_loiStockVerificationDetail_loilocation] FOREIGN KEY ([svdGodownID],[svdLocationid]) REFERENCES LOiLocation([lGodownID],[lLocationID])
END
GO
 ALTER TABLE [loiStockVerificationDetail] CHECK CONSTRAINT [fk_loiStockVerificationDetail_loilocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockVerificationDetail' AND CONSTRAINT_NAME= 'FK_loiStockVerificationDetail_loiStockVerificationHeader')
BEGIN
	ALTER TABLE [loiStockVerificationDetail] WITH CHECK ADD  CONSTRAINT [FK_loiStockVerificationDetail_loiStockVerificationHeader] FOREIGN KEY ([svdid],[svdGodownID]) REFERENCES loiStockVerificationHeader([svhid],[svhGodownid])
END
GO
 ALTER TABLE [loiStockVerificationDetail] CHECK CONSTRAINT [FK_loiStockVerificationDetail_loiStockVerificationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiStockVerificationHeader' AND CONSTRAINT_NAME= 'FK_loiStockVerificationHeader_aGodown')
BEGIN
	ALTER TABLE [loiStockVerificationHeader] WITH CHECK ADD  CONSTRAINT [FK_loiStockVerificationHeader_aGodown] FOREIGN KEY ([svhGodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [loiStockVerificationHeader] CHECK CONSTRAINT [FK_loiStockVerificationHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiUserAuditDetail' AND CONSTRAINT_NAME= 'FK_loiUserAuditDetail_loiUserAuditHeader')
BEGIN
	ALTER TABLE [loiUserAuditDetail] WITH NOCHECK ADD  CONSTRAINT [FK_loiUserAuditDetail_loiUserAuditHeader] FOREIGN KEY ([gdCompanyId],[gdAuditId],[gdGodownId]) REFERENCES loiUserAuditHeader([ghCompanyId],[ghAuditId],[ghGodownId])
END
GO
 ALTER TABLE [loiUserAuditDetail] CHECK CONSTRAINT [FK_loiUserAuditDetail_loiUserAuditHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiUserAuditHeader' AND CONSTRAINT_NAME= 'FK_loiUserAuditHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [loiUserAuditHeader] WITH NOCHECK ADD  CONSTRAINT [FK_loiUserAuditHeader_aCompanyMaster] FOREIGN KEY ([ghCompanyId]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [loiUserAuditHeader] CHECK CONSTRAINT [FK_loiUserAuditHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiUserAuditHeader' AND CONSTRAINT_NAME= 'FK_loiUserAuditHeader_aGodown')
BEGIN
	ALTER TABLE [loiUserAuditHeader] WITH NOCHECK ADD  CONSTRAINT [FK_loiUserAuditHeader_aGodown] FOREIGN KEY ([ghGodownId]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [loiUserAuditHeader] CHECK CONSTRAINT [FK_loiUserAuditHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loiUserAuditHeader' AND CONSTRAINT_NAME= 'FK_loiUserAuditHeader_aInterface')
BEGIN
	ALTER TABLE [loiUserAuditHeader] WITH NOCHECK ADD  CONSTRAINT [FK_loiUserAuditHeader_aInterface] FOREIGN KEY ([ghInterfaceId],[ghCompanyId]) REFERENCES aInterface([InterfaceID],[CompanyID])
END
GO
 ALTER TABLE [loiUserAuditHeader] CHECK CONSTRAINT [FK_loiUserAuditHeader_aInterface]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiWriteOffDetail' AND CONSTRAINT_NAME= 'FK_LOiWriteOffDetail_aItem')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] WITH CHECK ADD  CONSTRAINT [FK_LOiWriteOffDetail_aItem] FOREIGN KEY ([wdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOiWriteOffDetail] CHECK CONSTRAINT [FK_LOiWriteOffDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiWriteOffDetail' AND CONSTRAINT_NAME= 'fk_loiwriteoffdetail_ashipment')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] WITH CHECK ADD  CONSTRAINT [fk_loiwriteoffdetail_ashipment] FOREIGN KEY ([wdShipmentID]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [LOiWriteOffDetail] CHECK CONSTRAINT [fk_loiwriteoffdetail_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiWriteOffDetail' AND CONSTRAINT_NAME= 'fk_loiwriteoffdetail_loilocation')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] WITH CHECK ADD  CONSTRAINT [fk_loiwriteoffdetail_loilocation] FOREIGN KEY ([wdGodownID],[wdLocationID]) REFERENCES LOiLocation([lGodownID],[lLocationID])
END
GO
 ALTER TABLE [LOiWriteOffDetail] CHECK CONSTRAINT [fk_loiwriteoffdetail_loilocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiWriteOffDetail' AND CONSTRAINT_NAME= 'FK_LOiWriteOffDetail_LOiWriteOffHeader')
BEGIN
	ALTER TABLE [LOiWriteOffDetail] WITH NOCHECK ADD  CONSTRAINT [FK_LOiWriteOffDetail_LOiWriteOffHeader] FOREIGN KEY ([wdGodownID],[wdID]) REFERENCES LOiWriteOffHeader([whGodownID],[whID])
END
GO
 ALTER TABLE [LOiWriteOffDetail] CHECK CONSTRAINT [FK_LOiWriteOffDetail_LOiWriteOffHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOiWriteOffHeader' AND CONSTRAINT_NAME= 'FK_LOiWriteOffHeader_aGodown')
BEGIN
	ALTER TABLE [LOiWriteOffHeader] WITH NOCHECK ADD  CONSTRAINT [FK_LOiWriteOffHeader_aGodown] FOREIGN KEY ([whGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LOiWriteOffHeader] CHECK CONSTRAINT [FK_LOiWriteOffHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND CONSTRAINT_NAME= 'FK_loPrePurchaseOrderDetail_aItem')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] WITH CHECK ADD  CONSTRAINT [FK_loPrePurchaseOrderDetail_aItem] FOREIGN KEY ([poditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loPrePurchaseOrderDetail] CHECK CONSTRAINT [FK_loPrePurchaseOrderDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND CONSTRAINT_NAME= 'FK_loPrePurchaseOrderDetail_aPackingType')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] WITH CHECK ADD  CONSTRAINT [FK_loPrePurchaseOrderDetail_aPackingType] FOREIGN KEY ([podpackingtypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [loPrePurchaseOrderDetail] CHECK CONSTRAINT [FK_loPrePurchaseOrderDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND CONSTRAINT_NAME= 'FK_loPrePurchaseOrderDetail_loPrePurchaseOrderHeader')
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] WITH CHECK ADD  CONSTRAINT [FK_loPrePurchaseOrderDetail_loPrePurchaseOrderHeader] FOREIGN KEY ([podPoid]) REFERENCES loPrePurchaseOrderHeader([pohPoid])
END
GO
 ALTER TABLE [loPrePurchaseOrderDetail] CHECK CONSTRAINT [FK_loPrePurchaseOrderDetail_loPrePurchaseOrderHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND CONSTRAINT_NAME= 'fk_loPrePurchaseOrderHeader_aaccountmaster')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] WITH CHECK ADD  CONSTRAINT [fk_loPrePurchaseOrderHeader_aaccountmaster] FOREIGN KEY ([pohLCAccountid],[pohcompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [loPrePurchaseOrderHeader] CHECK CONSTRAINT [fk_loPrePurchaseOrderHeader_aaccountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND CONSTRAINT_NAME= 'fk_loPrePurchaseOrderHeader_aaccountmaster_lc')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] WITH CHECK ADD  CONSTRAINT [fk_loPrePurchaseOrderHeader_aaccountmaster_lc] FOREIGN KEY ([pohLCAccountid],[pohcompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [loPrePurchaseOrderHeader] CHECK CONSTRAINT [fk_loPrePurchaseOrderHeader_aaccountmaster_lc]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND CONSTRAINT_NAME= 'fk_loPrePurchaseOrderHeader_acompanymaster')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] WITH CHECK ADD  CONSTRAINT [fk_loPrePurchaseOrderHeader_acompanymaster] FOREIGN KEY ([pohcompanyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [loPrePurchaseOrderHeader] CHECK CONSTRAINT [fk_loPrePurchaseOrderHeader_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND CONSTRAINT_NAME= 'fk_loPrePurchaseOrderHeader_adepartmentmaster')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] WITH CHECK ADD  CONSTRAINT [fk_loPrePurchaseOrderHeader_adepartmentmaster] FOREIGN KEY ([pohDepartmentid],[pohcompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [loPrePurchaseOrderHeader] CHECK CONSTRAINT [fk_loPrePurchaseOrderHeader_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND CONSTRAINT_NAME= 'FK_loPrePurchaseOrderHeader_aVendorMaster')
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] WITH CHECK ADD  CONSTRAINT [FK_loPrePurchaseOrderHeader_aVendorMaster] FOREIGN KEY ([pohVendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [loPrePurchaseOrderHeader] CHECK CONSTRAINT [FK_loPrePurchaseOrderHeader_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND CONSTRAINT_NAME= 'FK_loPurchaseOrderDetail_aItem')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] WITH NOCHECK ADD  CONSTRAINT [FK_loPurchaseOrderDetail_aItem] FOREIGN KEY ([poditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loPurchaseOrderDetail] CHECK CONSTRAINT [FK_loPurchaseOrderDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND CONSTRAINT_NAME= 'FK_loPurchaseOrderDetail_aPackingType')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] WITH NOCHECK ADD  CONSTRAINT [FK_loPurchaseOrderDetail_aPackingType] FOREIGN KEY ([podpackingtypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [loPurchaseOrderDetail] CHECK CONSTRAINT [FK_loPurchaseOrderDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND CONSTRAINT_NAME= 'FK_loPurchaseOrderDetail_loPurchaseOrderHeader')
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] WITH NOCHECK ADD  CONSTRAINT [FK_loPurchaseOrderDetail_loPurchaseOrderHeader] FOREIGN KEY ([podPoid]) REFERENCES loPurchaseOrderHeader([pohPoid])
END
GO
 ALTER TABLE [loPurchaseOrderDetail] CHECK CONSTRAINT [FK_loPurchaseOrderDetail_loPurchaseOrderHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND CONSTRAINT_NAME= 'FK_loPurchaseOrderItemSplitDetails_aItem')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] WITH CHECK ADD  CONSTRAINT [FK_loPurchaseOrderItemSplitDetails_aItem] FOREIGN KEY ([ItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loPurchaseOrderItemSplitDetails] CHECK CONSTRAINT [FK_loPurchaseOrderItemSplitDetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND CONSTRAINT_NAME= 'FK_loPurchaseOrderItemSplitDetails_aVendorMaster')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] WITH CHECK ADD  CONSTRAINT [FK_loPurchaseOrderItemSplitDetails_aVendorMaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [loPurchaseOrderItemSplitDetails] CHECK CONSTRAINT [FK_loPurchaseOrderItemSplitDetails_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderItemSplitDetails' AND CONSTRAINT_NAME= 'FK_loPurchaseOrderItemSplitDetails_loPurchaseOrderHeader')
BEGIN
	ALTER TABLE [loPurchaseOrderItemSplitDetails] WITH CHECK ADD  CONSTRAINT [FK_loPurchaseOrderItemSplitDetails_loPurchaseOrderHeader] FOREIGN KEY ([podID]) REFERENCES loPurchaseOrderHeader([pohPoid])
END
GO
 ALTER TABLE [loPurchaseOrderItemSplitDetails] CHECK CONSTRAINT [FK_loPurchaseOrderItemSplitDetails_loPurchaseOrderHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchaseOrderOC' AND CONSTRAINT_NAME= 'FK_loPurchaseOrderOC_loPurchaseOrderHeader')
BEGIN
	ALTER TABLE [loPurchaseOrderOC] WITH NOCHECK ADD  CONSTRAINT [FK_loPurchaseOrderOC_loPurchaseOrderHeader] FOREIGN KEY ([podOthPoId]) REFERENCES loPurchaseOrderHeader([pohPoid])
END
GO
 ALTER TABLE [loPurchaseOrderOC] CHECK CONSTRAINT [FK_loPurchaseOrderOC_loPurchaseOrderHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchasereturndetail' AND CONSTRAINT_NAME= 'FK_loPurchasereturndetail_aItem')
BEGIN
	ALTER TABLE [loPurchasereturndetail] WITH CHECK ADD  CONSTRAINT [FK_loPurchasereturndetail_aItem] FOREIGN KEY ([prditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loPurchasereturndetail] CHECK CONSTRAINT [FK_loPurchasereturndetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchasereturndetail' AND CONSTRAINT_NAME= 'FK_loPurchasereturndetail_loPurchasereturnheader')
BEGIN
	ALTER TABLE [loPurchasereturndetail] WITH CHECK ADD  CONSTRAINT [FK_loPurchasereturndetail_loPurchasereturnheader] FOREIGN KEY ([prdcompanyid],[prdreturnid]) REFERENCES loPurchasereturnheader([prhcompanyid],[prhreturnid])
END
GO
 ALTER TABLE [loPurchasereturndetail] CHECK CONSTRAINT [FK_loPurchasereturndetail_loPurchasereturnheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchasereturnheader' AND CONSTRAINT_NAME= 'fk_lopurchasereturndetail_afinancialyear')
BEGIN
	ALTER TABLE [loPurchasereturnheader] WITH CHECK ADD  CONSTRAINT [fk_lopurchasereturndetail_afinancialyear] FOREIGN KEY ([prhFinancialID],[prhcompanyid]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [loPurchasereturnheader] CHECK CONSTRAINT [fk_lopurchasereturndetail_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchasereturnheader' AND CONSTRAINT_NAME= 'FK_loPurchasereturnheader_aAccountMaster')
BEGIN
	ALTER TABLE [loPurchasereturnheader] WITH CHECK ADD  CONSTRAINT [FK_loPurchasereturnheader_aAccountMaster] FOREIGN KEY ([prhadjaccountid],[prhcompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [loPurchasereturnheader] CHECK CONSTRAINT [FK_loPurchasereturnheader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loPurchasereturnheader' AND CONSTRAINT_NAME= 'FK_loPurchasereturnheader_aVendorMaster')
BEGIN
	ALTER TABLE [loPurchasereturnheader] WITH CHECK ADD  CONSTRAINT [FK_loPurchasereturnheader_aVendorMaster] FOREIGN KEY ([prhvendorid]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [loPurchasereturnheader] CHECK CONSTRAINT [FK_loPurchasereturnheader_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND CONSTRAINT_NAME= 'FK_loreplacereqtovendorheader_aVendorMaster')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] WITH CHECK ADD  CONSTRAINT [FK_loreplacereqtovendorheader_aVendorMaster] FOREIGN KEY ([rrvvendorid]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [loreplacereqtovendorheader] CHECK CONSTRAINT [FK_loreplacereqtovendorheader_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND CONSTRAINT_NAME= 'FK_loreplacereqtovendorheader_losreplacerequestheader')
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] WITH CHECK ADD  CONSTRAINT [FK_loreplacereqtovendorheader_losreplacerequestheader] FOREIGN KEY ([rrvrepreqid],[rrvcompanyid],[rrvshopid]) REFERENCES losreplacerequestheader([repreqhid],[repreqhcompanyid],[repreqshopid])
END
GO
 ALTER TABLE [loreplacereqtovendorheader] CHECK CONSTRAINT [FK_loreplacereqtovendorheader_losreplacerequestheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND CONSTRAINT_NAME= 'FK_LOs_InHouseCons_ReturnDetail_LOs_InHouseCons_ReturnHeader')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] WITH CHECK ADD  CONSTRAINT [FK_LOs_InHouseCons_ReturnDetail_LOs_InHouseCons_ReturnHeader] FOREIGN KEY ([IHRDShopID],[IHRDID]) REFERENCES LOs_InHouseCons_ReturnHeader([IHRHShopID],[IHRHID])
END
GO
 ALTER TABLE [LOs_InHouseCons_ReturnDetail] CHECK CONSTRAINT [FK_LOs_InHouseCons_ReturnDetail_LOs_InHouseCons_ReturnHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND CONSTRAINT_NAME= 'FK_LOs_InHouseCons_ReturnHeader_LOswriteoffheader')
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] WITH CHECK ADD  CONSTRAINT [FK_LOs_InHouseCons_ReturnHeader_LOswriteoffheader] FOREIGN KEY ([IHRHShopID],[IHRHReferenceid]) REFERENCES LOsWriteOffHeader([whShopID],[WhID])
END
GO
 ALTER TABLE [LOs_InHouseCons_ReturnHeader] CHECK CONSTRAINT [FK_LOs_InHouseCons_ReturnHeader_LOswriteoffheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsAccountsInvoiceHeader_aAccountMaster')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsAccountsInvoiceHeader_aAccountMaster] FOREIGN KEY ([aiBankCashID],[aiCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsAccountsInvoiceHeader] CHECK CONSTRAINT [FK_LOsAccountsInvoiceHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND CONSTRAINT_NAME= 'fk_LOsAccountsInvoiceHeader_aaccountmaster_sales')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [fk_LOsAccountsInvoiceHeader_aaccountmaster_sales] FOREIGN KEY ([aiSalesAccID],[aiCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsAccountsInvoiceHeader] CHECK CONSTRAINT [fk_LOsAccountsInvoiceHeader_aaccountmaster_sales]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsAccountsInvoiceHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsAccountsInvoiceHeader_aAccountMaster1] FOREIGN KEY ([aiDiscountAccountID],[aiCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsAccountsInvoiceHeader] CHECK CONSTRAINT [FK_LOsAccountsInvoiceHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND CONSTRAINT_NAME= 'fk_LOsAccountsInvoiceHeader_acustomermaster')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [fk_LOsAccountsInvoiceHeader_acustomermaster] FOREIGN KEY ([aiCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [LOsAccountsInvoiceHeader] CHECK CONSTRAINT [fk_LOsAccountsInvoiceHeader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsAccountsInvoiceHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsAccountsInvoiceHeader_aDepartmentMaster] FOREIGN KEY ([aiDepartmentID],[aiCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [LOsAccountsInvoiceHeader] CHECK CONSTRAINT [FK_LOsAccountsInvoiceHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsAccountsInvoiceHeader_aFinancialYear')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsAccountsInvoiceHeader_aFinancialYear] FOREIGN KEY ([aiFinancialID],[aiCompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [LOsAccountsInvoiceHeader] CHECK CONSTRAINT [FK_LOsAccountsInvoiceHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsAccountsInvoiceHeader_aShops')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsAccountsInvoiceHeader_aShops] FOREIGN KEY ([aiShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOsAccountsInvoiceHeader] CHECK CONSTRAINT [FK_LOsAccountsInvoiceHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsAccountsInvoiceHeader_CashBox')
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsAccountsInvoiceHeader_CashBox] FOREIGN KEY ([aicbid],[aiShopID]) REFERENCES CashBox([CBID],[CBShopID])
END
GO
 ALTER TABLE [LOsAccountsInvoiceHeader] CHECK CONSTRAINT [FK_LOsAccountsInvoiceHeader_CashBox]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentAgreementDetails' AND CONSTRAINT_NAME= 'fk_losApartmentAgreementDetails_losApartmentAgreementHeader')
BEGIN
	ALTER TABLE [losApartmentAgreementDetails] WITH CHECK ADD  CONSTRAINT [fk_losApartmentAgreementDetails_losApartmentAgreementHeader] FOREIGN KEY ([mgdcompanyid],[mgdshopid],[mgdAgreementId]) REFERENCES losApartmentAgreementHeader([mghCompanyId],[mghShopId],[mghAgreementid])
END
GO
 ALTER TABLE [losApartmentAgreementDetails] CHECK CONSTRAINT [fk_losApartmentAgreementDetails_losApartmentAgreementHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND CONSTRAINT_NAME= 'fk_losApartmentAgreementHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] WITH CHECK ADD  CONSTRAINT [fk_losApartmentAgreementHeader_aDepartmentMaster] FOREIGN KEY ([mghDepartmentid],[mghCompanyId]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losApartmentAgreementHeader] CHECK CONSTRAINT [fk_losApartmentAgreementHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND CONSTRAINT_NAME= 'fk_losApartmentAgreementHeader_ashops')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] WITH CHECK ADD  CONSTRAINT [fk_losApartmentAgreementHeader_ashops] FOREIGN KEY ([mghShopId]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losApartmentAgreementHeader] CHECK CONSTRAINT [fk_losApartmentAgreementHeader_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND CONSTRAINT_NAME= 'fk_losApartmentAgreementHeader_losReservationHeader')
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] WITH CHECK ADD  CONSTRAINT [fk_losApartmentAgreementHeader_losReservationHeader] FOREIGN KEY ([mghCompanyId],[mghShopId],[mghReservationID]) REFERENCES LosReservationHeader([rhcompanyid],[rhshopid],[rhreservationid])
END
GO
 ALTER TABLE [losApartmentAgreementHeader] CHECK CONSTRAINT [fk_losApartmentAgreementHeader_losReservationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentBillHeader' AND CONSTRAINT_NAME= 'fk_losApartmentBillHeader_aAccountMaster')
BEGIN
	ALTER TABLE [losApartmentBillHeader] WITH CHECK ADD  CONSTRAINT [fk_losApartmentBillHeader_aAccountMaster] FOREIGN KEY ([abhCashAccId],[abhCompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losApartmentBillHeader] CHECK CONSTRAINT [fk_losApartmentBillHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentBillHeader' AND CONSTRAINT_NAME= 'fk_losApartmentBillHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [losApartmentBillHeader] WITH CHECK ADD  CONSTRAINT [fk_losApartmentBillHeader_aDepartmentMaster] FOREIGN KEY ([abhDepartmentid],[abhCompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losApartmentBillHeader] CHECK CONSTRAINT [fk_losApartmentBillHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentBillHeader' AND CONSTRAINT_NAME= 'fk_losApartmentBillHeader_ashops')
BEGIN
	ALTER TABLE [losApartmentBillHeader] WITH CHECK ADD  CONSTRAINT [fk_losApartmentBillHeader_ashops] FOREIGN KEY ([abhSHopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losApartmentBillHeader] CHECK CONSTRAINT [fk_losApartmentBillHeader_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentBillHeader' AND CONSTRAINT_NAME= 'fk_losApartmentBillHeader_LOSApartmentAgreementHeader')
BEGIN
	ALTER TABLE [losApartmentBillHeader] WITH CHECK ADD  CONSTRAINT [fk_losApartmentBillHeader_LOSApartmentAgreementHeader] FOREIGN KEY ([abhCompanyid],[abhSHopID],[abhAgreementId]) REFERENCES losApartmentAgreementHeader([mghCompanyId],[mghShopId],[mghAgreementid])
END
GO
 ALTER TABLE [losApartmentBillHeader] CHECK CONSTRAINT [fk_losApartmentBillHeader_LOSApartmentAgreementHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentCheckOut' AND CONSTRAINT_NAME= 'fk_losApartmentCheckOut_aAccountMaster')
BEGIN
	ALTER TABLE [losApartmentCheckOut] WITH CHECK ADD  CONSTRAINT [fk_losApartmentCheckOut_aAccountMaster] FOREIGN KEY ([chCashAccId],[chCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losApartmentCheckOut] CHECK CONSTRAINT [fk_losApartmentCheckOut_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentCheckOut' AND CONSTRAINT_NAME= 'fk_losApartmentCheckOut_aAccountMaster_chWriteOffAccID')
BEGIN
	ALTER TABLE [losApartmentCheckOut] WITH CHECK ADD  CONSTRAINT [fk_losApartmentCheckOut_aAccountMaster_chWriteOffAccID] FOREIGN KEY ([chWriteOffAccID],[chCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losApartmentCheckOut] CHECK CONSTRAINT [fk_losApartmentCheckOut_aAccountMaster_chWriteOffAccID]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentCheckOut' AND CONSTRAINT_NAME= 'fk_losApartmentCheckOut_aDepartmentMaster')
BEGIN
	ALTER TABLE [losApartmentCheckOut] WITH CHECK ADD  CONSTRAINT [fk_losApartmentCheckOut_aDepartmentMaster] FOREIGN KEY ([ChDepartmentID],[chCompanyId]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losApartmentCheckOut] CHECK CONSTRAINT [fk_losApartmentCheckOut_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentCheckOut' AND CONSTRAINT_NAME= 'fk_losApartmentCheckOut_ashops')
BEGIN
	ALTER TABLE [losApartmentCheckOut] WITH CHECK ADD  CONSTRAINT [fk_losApartmentCheckOut_ashops] FOREIGN KEY ([chShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losApartmentCheckOut] CHECK CONSTRAINT [fk_losApartmentCheckOut_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losApartmentCheckOut' AND CONSTRAINT_NAME= 'fk_losApartmentCheckOut_LOSApartmentAgreementHeader')
BEGIN
	ALTER TABLE [losApartmentCheckOut] WITH CHECK ADD  CONSTRAINT [fk_losApartmentCheckOut_LOSApartmentAgreementHeader] FOREIGN KEY ([chCompanyId],[chShopID],[chAgreementID]) REFERENCES losApartmentAgreementHeader([mghCompanyId],[mghShopId],[mghAgreementid])
END
GO
 ALTER TABLE [losApartmentCheckOut] CHECK CONSTRAINT [fk_losApartmentCheckOut_LOSApartmentAgreementHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND CONSTRAINT_NAME= 'fk_losBoatNoteConfirmHeader_losShipmentBNHeader')
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] WITH CHECK ADD  CONSTRAINT [fk_losBoatNoteConfirmHeader_losShipmentBNHeader] FOREIGN KEY ([ShopID],[BoatNoteID]) REFERENCES LosShipmentbnheader([bnhShopId],[bnhboatnoteId])
END
GO
 ALTER TABLE [losBoatNoteConfirmHeader] CHECK CONSTRAINT [fk_losBoatNoteConfirmHeader_losShipmentBNHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookingcancellation' AND CONSTRAINT_NAME= 'FK_losbookingcancellation_losservicebookingheader')
BEGIN
	ALTER TABLE [losbookingcancellation] WITH CHECK ADD  CONSTRAINT [FK_losbookingcancellation_losservicebookingheader] FOREIGN KEY ([bkcancellbookingId],[bkcancellshopid],[bkcancellcomapnyid]) REFERENCES losServiceBookingHeader([serbookhid],[serbookhshopid],[serbookhcompanyid])
END
GO
 ALTER TABLE [losbookingcancellation] CHECK CONSTRAINT [FK_losbookingcancellation_losservicebookingheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND CONSTRAINT_NAME= 'fk_losbookpartsreplacedetails_aitem')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] WITH CHECK ADD  CONSTRAINT [fk_losbookpartsreplacedetails_aitem] FOREIGN KEY ([repbkdserpartsid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losbookpartsreplacedetails] CHECK CONSTRAINT [fk_losbookpartsreplacedetails_aitem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND CONSTRAINT_NAME= 'fk_losbookpartsreplacedetails_apackingtype')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] WITH CHECK ADD  CONSTRAINT [fk_losbookpartsreplacedetails_apackingtype] FOREIGN KEY ([repbkdpackid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [losbookpartsreplacedetails] CHECK CONSTRAINT [fk_losbookpartsreplacedetails_apackingtype]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND CONSTRAINT_NAME= 'fk_losbookpartsreplacedetails_losservicebookingheader')
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] WITH CHECK ADD  CONSTRAINT [fk_losbookpartsreplacedetails_losservicebookingheader] FOREIGN KEY ([repbkdserbookid],[repbkdshopid],[repbkdsercompanyid]) REFERENCES losServiceBookingHeader([serbookhid],[serbookhshopid],[serbookhcompanyid])
END
GO
 ALTER TABLE [losbookpartsreplacedetails] CHECK CONSTRAINT [fk_losbookpartsreplacedetails_losservicebookingheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookservicedetails' AND CONSTRAINT_NAME= 'FK_LOSBOOKS_REF_2125_ASERVICE')
BEGIN
	ALTER TABLE [losbookservicedetails] WITH CHECK ADD  CONSTRAINT [FK_LOSBOOKS_REF_2125_ASERVICE] FOREIGN KEY ([serbkdserviceid],[serbkdcompanyid]) REFERENCES aservicemaster([serid],[sercompanyid])
END
GO
 ALTER TABLE [losbookservicedetails] CHECK CONSTRAINT [FK_LOSBOOKS_REF_2125_ASERVICE]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookservicedetails' AND CONSTRAINT_NAME= 'FK_LOSBOOKS_REF_252_LOSSERVI')
BEGIN
	ALTER TABLE [losbookservicedetails] WITH CHECK ADD  CONSTRAINT [FK_LOSBOOKS_REF_252_LOSSERVI] FOREIGN KEY ([serbkdbookid],[serbkdshopid],[serbkdcompanyid]) REFERENCES losServiceBookingHeader([serbookhid],[serbookhshopid],[serbookhcompanyid])
END
GO
 ALTER TABLE [losbookservicedetails] CHECK CONSTRAINT [FK_LOSBOOKS_REF_252_LOSSERVI]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookservtechniciandetails' AND CONSTRAINT_NAME= 'FK_losbookservtechniciandetails_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] WITH CHECK ADD  CONSTRAINT [FK_losbookservtechniciandetails_AsalesPersonmaster] FOREIGN KEY ([sertechid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losbookservtechniciandetails] CHECK CONSTRAINT [FK_losbookservtechniciandetails_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookservtechniciandetails' AND CONSTRAINT_NAME= 'fk_losbookservtechniciandetails_aservicemaster')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] WITH CHECK ADD  CONSTRAINT [fk_losbookservtechniciandetails_aservicemaster] FOREIGN KEY ([sertechServiceID],[sertechcompanyid]) REFERENCES aservicemaster([serid],[sercompanyid])
END
GO
 ALTER TABLE [losbookservtechniciandetails] CHECK CONSTRAINT [fk_losbookservtechniciandetails_aservicemaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losbookservtechniciandetails' AND CONSTRAINT_NAME= 'FK_losbookservtechniciandetails_losservicebookingheader')
BEGIN
	ALTER TABLE [losbookservtechniciandetails] WITH CHECK ADD  CONSTRAINT [FK_losbookservtechniciandetails_losservicebookingheader] FOREIGN KEY ([sertechbookid],[sertechshopid],[sertechcompanyid]) REFERENCES losServiceBookingHeader([serbookhid],[serbookhshopid],[serbookhcompanyid])
END
GO
 ALTER TABLE [losbookservtechniciandetails] CHECK CONSTRAINT [FK_losbookservtechniciandetails_losservicebookingheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losCallBookingHeader' AND CONSTRAINT_NAME= 'fk_serCallBkhStatusId')
BEGIN
	ALTER TABLE [losCallBookingHeader] WITH CHECK ADD  CONSTRAINT [fk_serCallBkhStatusId] FOREIGN KEY ([serCallBkhcompanyid],[serCallBkhStatusId]) REFERENCES aservicestatus([serstatuscompanyid],[serStatusID])
END
GO
 ALTER TABLE [losCallBookingHeader] CHECK CONSTRAINT [fk_serCallBkhStatusId]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNote' AND CONSTRAINT_NAME= 'fk_losDebitCreditNote_avendormaster')
BEGIN
	ALTER TABLE [losDebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_losDebitCreditNote_avendormaster] FOREIGN KEY ([losDCNVendorId]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [losDebitCreditNote] CHECK CONSTRAINT [fk_losDebitCreditNote_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNote' AND CONSTRAINT_NAME= 'fk_losdebitcreditnote_shop')
BEGIN
	ALTER TABLE [losDebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_losdebitcreditnote_shop] FOREIGN KEY ([losDCNShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losDebitCreditNote] CHECK CONSTRAINT [fk_losdebitcreditnote_shop]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNote' AND CONSTRAINT_NAME= 'fk_losdebitcreditnote_accountmaster')
BEGIN
	ALTER TABLE [losDebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_losdebitcreditnote_accountmaster] FOREIGN KEY ([losDCNOtherAccId],[losDCNCompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losDebitCreditNote] CHECK CONSTRAINT [fk_losdebitcreditnote_accountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNote' AND CONSTRAINT_NAME= 'fk_losDebitCreditNote_acustomermaster')
BEGIN
	ALTER TABLE [losDebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_losDebitCreditNote_acustomermaster] FOREIGN KEY ([losDCNCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [losDebitCreditNote] CHECK CONSTRAINT [fk_losDebitCreditNote_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNote' AND CONSTRAINT_NAME= 'fk_losDebitCreditNote_adepartmentmaster')
BEGIN
	ALTER TABLE [losDebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_losDebitCreditNote_adepartmentmaster] FOREIGN KEY ([losdcndepartmentid],[losDCNCompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losDebitCreditNote] CHECK CONSTRAINT [fk_losDebitCreditNote_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNote' AND CONSTRAINT_NAME= 'fk_losDebitCreditNote_afinancialyear')
BEGIN
	ALTER TABLE [losDebitCreditNote] WITH CHECK ADD  CONSTRAINT [fk_losDebitCreditNote_afinancialyear] FOREIGN KEY ([losfinancialid],[losDCNCompanyid]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [losDebitCreditNote] CHECK CONSTRAINT [fk_losDebitCreditNote_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND CONSTRAINT_NAME= 'FK_losDebitcreditNotedetail_losDebitcreditNote')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] WITH CHECK ADD  CONSTRAINT [FK_losDebitcreditNotedetail_losDebitcreditNote] FOREIGN KEY ([ShopID],[DCNID]) REFERENCES losDebitCreditNote([losDCNShopid],[losDCNId])
END
GO
 ALTER TABLE [losDebitCreditNoteDetail] CHECK CONSTRAINT [FK_losDebitcreditNotedetail_losDebitcreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDebitCreditNoteDetail' AND CONSTRAINT_NAME= 'fk_LosDebitCreditNoteDetail_losLPHeader')
BEGIN
	ALTER TABLE [losDebitCreditNoteDetail] WITH CHECK ADD  CONSTRAINT [fk_LosDebitCreditNoteDetail_losLPHeader] FOREIGN KEY ([ShopID],[POID]) REFERENCES losLPHeader([ShopID],[POID])
END
GO
 ALTER TABLE [losDebitCreditNoteDetail] CHECK CONSTRAINT [fk_LosDebitCreditNoteDetail_losLPHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryDetails' AND CONSTRAINT_NAME= 'FK_losDeliveryDetails_aCompanyMaster')
BEGIN
	ALTER TABLE [losDeliveryDetails] WITH CHECK ADD  CONSTRAINT [FK_losDeliveryDetails_aCompanyMaster] FOREIGN KEY ([CompanyId]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [losDeliveryDetails] CHECK CONSTRAINT [FK_losDeliveryDetails_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryDetails' AND CONSTRAINT_NAME= 'FK_losDeliveryDetails_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [losDeliveryDetails] WITH CHECK ADD  CONSTRAINT [FK_losDeliveryDetails_LOsInvoiceHeader] FOREIGN KEY ([ShopId],[CreditInvoiceId]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [losDeliveryDetails] CHECK CONSTRAINT [FK_losDeliveryDetails_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryDetails' AND CONSTRAINT_NAME= 'FK_losDeliveryDetails_losPosHeader')
BEGIN
	ALTER TABLE [losDeliveryDetails] WITH CHECK ADD  CONSTRAINT [FK_losDeliveryDetails_losPosHeader] FOREIGN KEY ([ShopId],[CashInvoiceId]) REFERENCES LOsPosHeader([poshShopID],[poshBillID])
END
GO
 ALTER TABLE [losDeliveryDetails] CHECK CONSTRAINT [FK_losDeliveryDetails_losPosHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDeliveryNoteDetail' AND CONSTRAINT_NAME= 'FK_LosDeliveryNoteDetail_LosDeliveryNoteHeader')
BEGIN
	ALTER TABLE [LosDeliveryNoteDetail] WITH CHECK ADD  CONSTRAINT [FK_LosDeliveryNoteDetail_LosDeliveryNoteHeader] FOREIGN KEY ([DnDShopid],[DnDdnId]) REFERENCES LosDeliveryNoteHeader([DnShopid],[DndnId])
END
GO
 ALTER TABLE [LosDeliveryNoteDetail] CHECK CONSTRAINT [FK_LosDeliveryNoteDetail_LosDeliveryNoteHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDeliveryNoteDetail' AND CONSTRAINT_NAME= 'FK_LosDeliveryNoteDetail_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [LosDeliveryNoteDetail] WITH CHECK ADD  CONSTRAINT [FK_LosDeliveryNoteDetail_LOsInvoiceHeader] FOREIGN KEY ([DnDShopid],[DnDinvoiceId]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [LosDeliveryNoteDetail] CHECK CONSTRAINT [FK_LosDeliveryNoteDetail_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND CONSTRAINT_NAME= 'FK_LosDeliveryNoteHeader_aCustomerMaster')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] WITH CHECK ADD  CONSTRAINT [FK_LosDeliveryNoteHeader_aCustomerMaster] FOREIGN KEY ([DnCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [LosDeliveryNoteHeader] CHECK CONSTRAINT [FK_LosDeliveryNoteHeader_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND CONSTRAINT_NAME= 'fk_LosDeliverynoteHeader_ashops')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] WITH CHECK ADD  CONSTRAINT [fk_LosDeliverynoteHeader_ashops] FOREIGN KEY ([DnShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LosDeliveryNoteHeader] CHECK CONSTRAINT [fk_LosDeliverynoteHeader_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND CONSTRAINT_NAME= 'fk_LosDeliveryNoteHeader_aStatus')
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] WITH CHECK ADD  CONSTRAINT [fk_LosDeliveryNoteHeader_aStatus] FOREIGN KEY ([dnCompanyId],[dnStatus]) REFERENCES aStatus([CompanyId],[StatusId])
END
GO
 ALTER TABLE [LosDeliveryNoteHeader] CHECK CONSTRAINT [fk_LosDeliveryNoteHeader_aStatus]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryNoteImage' AND CONSTRAINT_NAME= 'fk_losDeliveryNoteImage_losDeliveryNoteHeader')
BEGIN
	ALTER TABLE [losDeliveryNoteImage] WITH CHECK ADD  CONSTRAINT [fk_losDeliveryNoteImage_losDeliveryNoteHeader] FOREIGN KEY ([ShopId],[DeliveryNoteId]) REFERENCES LosDeliveryNoteHeader([DnShopid],[DndnId])
END
GO
 ALTER TABLE [losDeliveryNoteImage] CHECK CONSTRAINT [fk_losDeliveryNoteImage_losDeliveryNoteHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND CONSTRAINT_NAME= 'fk_losDeliveryNoteItemDetails_aGodown')
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] WITH CHECK ADD  CONSTRAINT [fk_losDeliveryNoteItemDetails_aGodown] FOREIGN KEY ([dndCollectFromGodownId]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [losDeliveryNoteItemDetails] CHECK CONSTRAINT [fk_losDeliveryNoteItemDetails_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND CONSTRAINT_NAME= 'FK_losDeliveryItemsVerificationDetails_losDeliveryItemsVerificationHeader')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] WITH CHECK ADD  CONSTRAINT [FK_losDeliveryItemsVerificationDetails_losDeliveryItemsVerificationHeader] FOREIGN KEY ([CompanyId],[ShopId],[DeliveryVerificationId]) REFERENCES losDeliveryVerificationHeader([CompanyId],[ShopId],[DeliveryVerificationId])
END
GO
 ALTER TABLE [losDeliveryVerificationDetails] CHECK CONSTRAINT [FK_losDeliveryItemsVerificationDetails_losDeliveryItemsVerificationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND CONSTRAINT_NAME= 'FK_losDeliveryItemsVerificationDetails_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] WITH CHECK ADD  CONSTRAINT [FK_losDeliveryItemsVerificationDetails_LOsInvoiceHeader] FOREIGN KEY ([ShopId],[InvoiceId]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [losDeliveryVerificationDetails] CHECK CONSTRAINT [FK_losDeliveryItemsVerificationDetails_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND CONSTRAINT_NAME= 'FK_losDeliveryItemsVerificationDetails_LOsPosHeader')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] WITH CHECK ADD  CONSTRAINT [FK_losDeliveryItemsVerificationDetails_LOsPosHeader] FOREIGN KEY ([ShopId],[BillId]) REFERENCES LOsPosHeader([poshShopID],[poshBillID])
END
GO
 ALTER TABLE [losDeliveryVerificationDetails] CHECK CONSTRAINT [FK_losDeliveryItemsVerificationDetails_LOsPosHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND CONSTRAINT_NAME= 'FK_losDeliveryVerificationDetails_aItem')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] WITH CHECK ADD  CONSTRAINT [FK_losDeliveryVerificationDetails_aItem] FOREIGN KEY ([ItemId]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losDeliveryVerificationDetails] CHECK CONSTRAINT [FK_losDeliveryVerificationDetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDeliveryVerificationDetails' AND CONSTRAINT_NAME= 'FK_losDeliveryVerificationDetails_aPackingType')
BEGIN
	ALTER TABLE [losDeliveryVerificationDetails] WITH CHECK ADD  CONSTRAINT [FK_losDeliveryVerificationDetails_aPackingType] FOREIGN KEY ([PackId]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [losDeliveryVerificationDetails] CHECK CONSTRAINT [FK_losDeliveryVerificationDetails_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND CONSTRAINT_NAME= 'FK_LosDummyReceiptDetail_LOsAccountsInvoiceHeader1')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] WITH CHECK ADD  CONSTRAINT [FK_LosDummyReceiptDetail_LOsAccountsInvoiceHeader1] FOREIGN KEY ([drdShopID],[drdserviceinvoiceid]) REFERENCES LOsAccountsInvoiceHeader([aiShopID],[aiInvoiceID])
END
GO
 ALTER TABLE [LosDummyReceiptDetail] CHECK CONSTRAINT [FK_LosDummyReceiptDetail_LOsAccountsInvoiceHeader1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND CONSTRAINT_NAME= 'fk_LosDummyReceiptDetail_losApartmentBillHeader')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] WITH CHECK ADD  CONSTRAINT [fk_LosDummyReceiptDetail_losApartmentBillHeader] FOREIGN KEY ([drdRoomBillID],[drdShopID],[drdcompanyid]) REFERENCES losApartmentBillHeader([abhBillId],[abhSHopID],[abhCompanyid])
END
GO
 ALTER TABLE [LosDummyReceiptDetail] CHECK CONSTRAINT [fk_LosDummyReceiptDetail_losApartmentBillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND CONSTRAINT_NAME= 'FK_LosDummyReceiptDetail_losDebitCreditNote')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] WITH CHECK ADD  CONSTRAINT [FK_LosDummyReceiptDetail_losDebitCreditNote] FOREIGN KEY ([drdShopID],[drddcnid]) REFERENCES losDebitCreditNote([losDCNShopid],[losDCNId])
END
GO
 ALTER TABLE [LosDummyReceiptDetail] CHECK CONSTRAINT [FK_LosDummyReceiptDetail_losDebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND CONSTRAINT_NAME= 'FK_LosDummyReceiptDetail_losDummyReceiptHeader')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] WITH CHECK ADD  CONSTRAINT [FK_LosDummyReceiptDetail_losDummyReceiptHeader] FOREIGN KEY ([drdShopID],[drdid]) REFERENCES losDummyReceiptHeader([drShopid],[drId])
END
GO
 ALTER TABLE [LosDummyReceiptDetail] CHECK CONSTRAINT [FK_LosDummyReceiptDetail_losDummyReceiptHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND CONSTRAINT_NAME= 'FK_LosDummyReceiptDetail_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] WITH CHECK ADD  CONSTRAINT [FK_LosDummyReceiptDetail_LOsInvoiceHeader] FOREIGN KEY ([drdShopID],[drdinvoiceid]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [LosDummyReceiptDetail] CHECK CONSTRAINT [FK_LosDummyReceiptDetail_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND CONSTRAINT_NAME= 'FK_LosDummyReceiptDetail_losSpecialInvoiceHeader')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] WITH CHECK ADD  CONSTRAINT [FK_LosDummyReceiptDetail_losSpecialInvoiceHeader] FOREIGN KEY ([drdsplinvoiceid],[drdShopID]) REFERENCES losSpecialInvoiceHeader([IhInvoiceID],[IhShopID])
END
GO
 ALTER TABLE [LosDummyReceiptDetail] CHECK CONSTRAINT [FK_LosDummyReceiptDetail_losSpecialInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND CONSTRAINT_NAME= 'fk_LosDummyReceiptDetail_losTenantServiceBillHeader')
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] WITH CHECK ADD  CONSTRAINT [fk_LosDummyReceiptDetail_losTenantServiceBillHeader] FOREIGN KEY ([drdUtilityBillID],[drdShopID],[drdcompanyid]) REFERENCES losTenantServiceBillHeader([tbhBillId],[tbhShopId],[tbhCompanyId])
END
GO
 ALTER TABLE [LosDummyReceiptDetail] CHECK CONSTRAINT [fk_LosDummyReceiptDetail_losTenantServiceBillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDummyReceiptHeader' AND CONSTRAINT_NAME= 'FK_losDummyReceiptHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] WITH CHECK ADD  CONSTRAINT [FK_losDummyReceiptHeader_aDepartmentMaster] FOREIGN KEY ([drdepartmentid],[drCompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losDummyReceiptHeader] CHECK CONSTRAINT [FK_losDummyReceiptHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDummyReceiptHeader' AND CONSTRAINT_NAME= 'FK_losDummyReceiptHeader_aShops')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] WITH CHECK ADD  CONSTRAINT [FK_losDummyReceiptHeader_aShops] FOREIGN KEY ([drShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losDummyReceiptHeader] CHECK CONSTRAINT [FK_losDummyReceiptHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losDummyReceiptHeader' AND CONSTRAINT_NAME= 'FK_losDummyReceiptHeader_CashBox')
BEGIN
	ALTER TABLE [losDummyReceiptHeader] WITH CHECK ADD  CONSTRAINT [FK_losDummyReceiptHeader_CashBox] FOREIGN KEY ([drcbid],[drShopid]) REFERENCES CashBox([CBID],[CBShopID])
END
GO
 ALTER TABLE [losDummyReceiptHeader] CHECK CONSTRAINT [FK_losDummyReceiptHeader_CashBox]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losEDIConfirmation' AND CONSTRAINT_NAME= 'FK_losEDIConfirmation_losEDIRequest')
BEGIN
	ALTER TABLE [losEDIConfirmation] WITH CHECK ADD  CONSTRAINT [FK_losEDIConfirmation_losEDIRequest] FOREIGN KEY ([ecshopid],[ecediid]) REFERENCES losEDIRequest([ershopid],[erediid])
END
GO
 ALTER TABLE [losEDIConfirmation] CHECK CONSTRAINT [FK_losEDIConfirmation_losEDIRequest]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losEDIRequest' AND CONSTRAINT_NAME= 'FK_losEDIRequest_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [losEDIRequest] WITH CHECK ADD  CONSTRAINT [FK_losEDIRequest_LOsInvoiceHeader] FOREIGN KEY ([ershopid],[erpoid]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [losEDIRequest] CHECK CONSTRAINT [FK_losEDIRequest_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losExportDetail' AND CONSTRAINT_NAME= 'fk_loSExportDetail_aitem')
BEGIN
	ALTER TABLE [losExportDetail] WITH CHECK ADD  CONSTRAINT [fk_loSExportDetail_aitem] FOREIGN KEY ([redItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losExportDetail] CHECK CONSTRAINT [fk_loSExportDetail_aitem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losExportDetail' AND CONSTRAINT_NAME= 'fk_losexportdetail_losexportheader')
BEGIN
	ALTER TABLE [losExportDetail] WITH CHECK ADD  CONSTRAINT [fk_losexportdetail_losexportheader] FOREIGN KEY ([redExportID],[redShopID]) REFERENCES losExportHeader([rehExportID],[rehShopID])
END
GO
 ALTER TABLE [losExportDetail] CHECK CONSTRAINT [fk_losexportdetail_losexportheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losExportHeader' AND CONSTRAINT_NAME= 'fk_loSExportHeader')
BEGIN
	ALTER TABLE [losExportHeader] WITH CHECK ADD  CONSTRAINT [fk_loSExportHeader] FOREIGN KEY ([rehcustomerid]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [losExportHeader] CHECK CONSTRAINT [fk_loSExportHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losExportHeader' AND CONSTRAINT_NAME= 'fk_losexportheader_acompanymaster')
BEGIN
	ALTER TABLE [losExportHeader] WITH CHECK ADD  CONSTRAINT [fk_losexportheader_acompanymaster] FOREIGN KEY ([rehCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [losExportHeader] CHECK CONSTRAINT [fk_losexportheader_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losExportHeader' AND CONSTRAINT_NAME= 'fk_losexportheader_ashops')
BEGIN
	ALTER TABLE [losExportHeader] WITH CHECK ADD  CONSTRAINT [fk_losexportheader_ashops] FOREIGN KEY ([rehShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losExportHeader] CHECK CONSTRAINT [fk_losexportheader_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losFacilityBookingDetail' AND CONSTRAINT_NAME= 'FK_losFacilityBookingDetail_aservicemaster')
BEGIN
	ALTER TABLE [losFacilityBookingDetail] WITH CHECK ADD  CONSTRAINT [FK_losFacilityBookingDetail_aservicemaster] FOREIGN KEY ([ftFaclityID],[ftCompanyId]) REFERENCES aservicemaster([serid],[sercompanyid])
END
GO
 ALTER TABLE [losFacilityBookingDetail] CHECK CONSTRAINT [FK_losFacilityBookingDetail_aservicemaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losfuturetabdetail' AND CONSTRAINT_NAME= 'FK_LOSFUTUR_REF_6391_LOSFUTUR')
BEGIN
	ALTER TABLE [losfuturetabdetail] WITH CHECK ADD  CONSTRAINT [FK_LOSFUTUR_REF_6391_LOSFUTUR] FOREIGN KEY ([futdid],[futdcompanyid],[futdshopid]) REFERENCES losfuturetabheader([futheadid],[futhcompanyid],[futhshopid])
END
GO
 ALTER TABLE [losfuturetabdetail] CHECK CONSTRAINT [FK_LOSFUTUR_REF_6391_LOSFUTUR]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losfuturetabdetail' AND CONSTRAINT_NAME= 'FK_losfuturetabdetail_losfuturetabheader')
BEGIN
	ALTER TABLE [losfuturetabdetail] WITH CHECK ADD  CONSTRAINT [FK_losfuturetabdetail_losfuturetabheader] FOREIGN KEY ([futdid],[futdcompanyid],[futdshopid]) REFERENCES losfuturetabheader([futheadid],[futhcompanyid],[futhshopid])
END
GO
 ALTER TABLE [losfuturetabdetail] CHECK CONSTRAINT [FK_losfuturetabdetail_losfuturetabheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losfuturetabheader' AND CONSTRAINT_NAME= 'FK_losfuturetabheader_aShops')
BEGIN
	ALTER TABLE [losfuturetabheader] WITH CHECK ADD  CONSTRAINT [FK_losfuturetabheader_aShops] FOREIGN KEY ([futhshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losfuturetabheader] CHECK CONSTRAINT [FK_losfuturetabheader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND CONSTRAINT_NAME= 'FK_LOsGoodsArrivaltoShopDetail_aItem1')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsGoodsArrivaltoShopDetail_aItem1] FOREIGN KEY ([gadItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOsGoodsArrivaltoShopDetail] CHECK CONSTRAINT [FK_LOsGoodsArrivaltoShopDetail_aItem1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND CONSTRAINT_NAME= 'FK_LOsGoodsArrivaltoShopDetail_LOsGoodsArrivaltoShopHeader')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsGoodsArrivaltoShopDetail_LOsGoodsArrivaltoShopHeader] FOREIGN KEY ([gadArrivalID],[gadShopid]) REFERENCES LOsGoodsArrivaltoShopHeader([gahArrivalID],[gahShopid])
END
GO
 ALTER TABLE [LOsGoodsArrivaltoShopDetail] CHECK CONSTRAINT [FK_LOsGoodsArrivaltoShopDetail_LOsGoodsArrivaltoShopHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND CONSTRAINT_NAME= 'FK_LOsGoodsArrivaltoShopHeader_aGodown')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsGoodsArrivaltoShopHeader_aGodown] FOREIGN KEY ([gahDespatchedGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LOsGoodsArrivaltoShopHeader] CHECK CONSTRAINT [FK_LOsGoodsArrivaltoShopHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND CONSTRAINT_NAME= 'fk_LOsGoodsArrivaltoShopHeader_aHQDespatchnoteHeader')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] WITH CHECK ADD  CONSTRAINT [fk_LOsGoodsArrivaltoShopHeader_aHQDespatchnoteHeader] FOREIGN KEY ([gahhqdespatchid]) REFERENCES aHQDespatchnoteHeader([dhDespatchnoteID])
END
GO
 ALTER TABLE [LOsGoodsArrivaltoShopHeader] CHECK CONSTRAINT [fk_LOsGoodsArrivaltoShopHeader_aHQDespatchnoteHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND CONSTRAINT_NAME= 'FK_LOsGoodsArrivaltoShopHeader_aShops')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsGoodsArrivaltoShopHeader_aShops] FOREIGN KEY ([gahShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOsGoodsArrivaltoShopHeader] CHECK CONSTRAINT [FK_LOsGoodsArrivaltoShopHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND CONSTRAINT_NAME= 'FK_LOsGoodsArrivaltoShopHeader_MEiDespatchToShopHeader')
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsGoodsArrivaltoShopHeader_MEiDespatchToShopHeader] FOREIGN KEY ([gahGodownDespatchID],[gahDespatchedGodownID]) REFERENCES MEiDespatchToShopHeader([dhDespatchID],[dhGodownID])
END
GO
 ALTER TABLE [LOsGoodsArrivaltoShopHeader] CHECK CONSTRAINT [FK_LOsGoodsArrivaltoShopHeader_MEiDespatchToShopHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND CONSTRAINT_NAME= 'FK_LosGoodsReturnNoteDetail_aItem')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] WITH CHECK ADD  CONSTRAINT [FK_LosGoodsReturnNoteDetail_aItem] FOREIGN KEY ([GRNDItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LosGoodsReturnNoteDetail] CHECK CONSTRAINT [FK_LosGoodsReturnNoteDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND CONSTRAINT_NAME= 'FK_LosGoodsReturnNoteDetail_LosGoodsReturnNoteHeader')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] WITH CHECK ADD  CONSTRAINT [FK_LosGoodsReturnNoteDetail_LosGoodsReturnNoteHeader] FOREIGN KEY ([GRNDShopid],[GRNDReturnNoteID]) REFERENCES LosGoodsReturnNoteHeader([grnhShopid],[GrnhGoodsreturnnoteID])
END
GO
 ALTER TABLE [LosGoodsReturnNoteDetail] CHECK CONSTRAINT [FK_LosGoodsReturnNoteDetail_LosGoodsReturnNoteHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND CONSTRAINT_NAME= 'fk_LosGoodsReturnNoteHeader_aaccountmaster')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] WITH CHECK ADD  CONSTRAINT [fk_LosGoodsReturnNoteHeader_aaccountmaster] FOREIGN KEY ([GrnReturnAccID],[GrnCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LosGoodsReturnNoteHeader] CHECK CONSTRAINT [fk_LosGoodsReturnNoteHeader_aaccountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND CONSTRAINT_NAME= 'fk_LosGoodsReturnNoteHeader_acustomermaster')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] WITH CHECK ADD  CONSTRAINT [fk_LosGoodsReturnNoteHeader_acustomermaster] FOREIGN KEY ([GrnhCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [LosGoodsReturnNoteHeader] CHECK CONSTRAINT [fk_LosGoodsReturnNoteHeader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND CONSTRAINT_NAME= 'FK_LosGoodsReturnNoteHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] WITH CHECK ADD  CONSTRAINT [FK_LosGoodsReturnNoteHeader_aDepartmentMaster] FOREIGN KEY ([grnhDepartmentid],[GrnCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [LosGoodsReturnNoteHeader] CHECK CONSTRAINT [FK_LosGoodsReturnNoteHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND CONSTRAINT_NAME= 'FK_LosGoodsReturnNoteHeader_aFinancialYear')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] WITH CHECK ADD  CONSTRAINT [FK_LosGoodsReturnNoteHeader_aFinancialYear] FOREIGN KEY ([grnhfinancialid],[GrnCompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [LosGoodsReturnNoteHeader] CHECK CONSTRAINT [FK_LosGoodsReturnNoteHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND CONSTRAINT_NAME= 'FK_LosGoodsReturnNoteHeader_aShops')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] WITH CHECK ADD  CONSTRAINT [FK_LosGoodsReturnNoteHeader_aShops] FOREIGN KEY ([grnhShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LosGoodsReturnNoteHeader] CHECK CONSTRAINT [FK_LosGoodsReturnNoteHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND CONSTRAINT_NAME= 'FK_LosGoodsReturnNoteHeader_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] WITH CHECK ADD  CONSTRAINT [FK_LosGoodsReturnNoteHeader_LOsInvoiceHeader] FOREIGN KEY ([grnhShopid],[GrnhInvoiceID]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [LosGoodsReturnNoteHeader] CHECK CONSTRAINT [FK_LosGoodsReturnNoteHeader_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHPChequeRegisterDetail' AND CONSTRAINT_NAME= 'FK_losHPChequeRegisterDetail_losHPChequeRegisterHeader')
BEGIN
	ALTER TABLE [losHPChequeRegisterDetail] WITH NOCHECK ADD  CONSTRAINT [FK_losHPChequeRegisterDetail_losHPChequeRegisterHeader] FOREIGN KEY ([HpdChqRegID]) REFERENCES losHPChequeRegisterHeader([HphChqRegID])
END
GO
 ALTER TABLE [losHPChequeRegisterDetail] CHECK CONSTRAINT [FK_losHPChequeRegisterDetail_losHPChequeRegisterHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpDummyQuotationDetails' AND CONSTRAINT_NAME= 'FK_losHpDummyQuotationDetails_losHpDummyQuotationHeader')
BEGIN
	ALTER TABLE [losHpDummyQuotationDetails] WITH NOCHECK ADD  CONSTRAINT [FK_losHpDummyQuotationDetails_losHpDummyQuotationHeader] FOREIGN KEY ([hpqdQuotationID]) REFERENCES losHpDummyQuotationHeader([hpqhQuotationID])
END
GO
 ALTER TABLE [losHpDummyQuotationDetails] CHECK CONSTRAINT [FK_losHpDummyQuotationDetails_losHpDummyQuotationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpInvoiceDetail' AND CONSTRAINT_NAME= 'FK_losHpInvoiceDetail_losHpInvoiceHeader')
BEGIN
	ALTER TABLE [losHpInvoiceDetail] WITH NOCHECK ADD  CONSTRAINT [FK_losHpInvoiceDetail_losHpInvoiceHeader] FOREIGN KEY ([hpqdQuotationID]) REFERENCES losHpInvoiceHeader([hpqhQuotationID])
END
GO
 ALTER TABLE [losHpInvoiceDetail] CHECK CONSTRAINT [FK_losHpInvoiceDetail_losHpInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losHpInvoiceDetailOthers' AND CONSTRAINT_NAME= 'FK_losHpInvoiceDetailOthers_losHpInvoiceHeader')
BEGIN
	ALTER TABLE [losHpInvoiceDetailOthers] WITH NOCHECK ADD  CONSTRAINT [FK_losHpInvoiceDetailOthers_losHpInvoiceHeader] FOREIGN KEY ([hpqdQuotationID]) REFERENCES losHpInvoiceHeader([hpqhQuotationID])
END
GO
 ALTER TABLE [losHpInvoiceDetailOthers] CHECK CONSTRAINT [FK_losHpInvoiceDetailOthers_losHpInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinquirydetail' AND CONSTRAINT_NAME= 'FK_losinquirydetail_aItem')
BEGIN
	ALTER TABLE [losinquirydetail] WITH CHECK ADD  CONSTRAINT [FK_losinquirydetail_aItem] FOREIGN KEY ([iditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losinquirydetail] CHECK CONSTRAINT [FK_losinquirydetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinquirydetail' AND CONSTRAINT_NAME= 'FK_losinquirydetail_losInquiryHeader')
BEGIN
	ALTER TABLE [losinquirydetail] WITH CHECK ADD  CONSTRAINT [FK_losinquirydetail_losInquiryHeader] FOREIGN KEY ([idcompanyid],[idshopid],[idid]) REFERENCES losInquiryHeader([ihcompanyid],[ihshopid],[ihid])
END
GO
 ALTER TABLE [losinquirydetail] CHECK CONSTRAINT [FK_losinquirydetail_losInquiryHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losInquiryHeader' AND CONSTRAINT_NAME= 'FK_losInquiryHeader_aCustomerMaster')
BEGIN
	ALTER TABLE [losInquiryHeader] WITH CHECK ADD  CONSTRAINT [FK_losInquiryHeader_aCustomerMaster] FOREIGN KEY ([ihcustid]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [losInquiryHeader] CHECK CONSTRAINT [FK_losInquiryHeader_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losInquiryHeader' AND CONSTRAINT_NAME= 'FK_losInquiryHeader_aShops')
BEGIN
	ALTER TABLE [losInquiryHeader] WITH CHECK ADD  CONSTRAINT [FK_losInquiryHeader_aShops] FOREIGN KEY ([ihshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losInquiryHeader] CHECK CONSTRAINT [FK_losInquiryHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceDetail' AND CONSTRAINT_NAME= 'FK_LOsInvoiceDetail_aItem')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceDetail_aItem] FOREIGN KEY ([idItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOsInvoiceDetail] CHECK CONSTRAINT [FK_LOsInvoiceDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceDetail' AND CONSTRAINT_NAME= 'FK_LOsInvoiceDetail_aPackingType')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceDetail_aPackingType] FOREIGN KEY ([idPackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [LOsInvoiceDetail] CHECK CONSTRAINT [FK_LOsInvoiceDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceDetail' AND CONSTRAINT_NAME= 'FK_LOsInvoiceDetail_aUnit')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceDetail_aUnit] FOREIGN KEY ([idPUnitID]) REFERENCES aUnit([UnitID])
END
GO
 ALTER TABLE [LOsInvoiceDetail] CHECK CONSTRAINT [FK_LOsInvoiceDetail_aUnit]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceDetail' AND CONSTRAINT_NAME= 'FK_LOsInvoiceDetail_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [LOsInvoiceDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceDetail_LOsInvoiceHeader] FOREIGN KEY ([idShopID],[idInvoiceID]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [LOsInvoiceDetail] CHECK CONSTRAINT [FK_LOsInvoiceDetail_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsInvoiceHeader_aAccountMaster')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceHeader_aAccountMaster] FOREIGN KEY ([ihBankcashAccID],[ihCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsInvoiceHeader] CHECK CONSTRAINT [FK_LOsInvoiceHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'fk_LOsInvoiceHeader_aaccountmaster_sales')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [fk_LOsInvoiceHeader_aaccountmaster_sales] FOREIGN KEY ([ihSalesAccID],[ihCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsInvoiceHeader] CHECK CONSTRAINT [fk_LOsInvoiceHeader_aaccountmaster_sales]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsInvoiceHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceHeader_aAccountMaster1] FOREIGN KEY ([ihDiscountAccID],[ihCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsInvoiceHeader] CHECK CONSTRAINT [FK_LOsInvoiceHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'fk_losinvoiceheader_acustomermaster')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [fk_losinvoiceheader_acustomermaster] FOREIGN KEY ([ihCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [LOsInvoiceHeader] CHECK CONSTRAINT [fk_losinvoiceheader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsInvoiceHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceHeader_aDepartmentMaster] FOREIGN KEY ([ihDepartmentID],[ihCompanyId]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [LOsInvoiceHeader] CHECK CONSTRAINT [FK_LOsInvoiceHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsInvoiceHeader_aFinancialYear')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceHeader_aFinancialYear] FOREIGN KEY ([ihFinancialID],[ihCompanyId]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [LOsInvoiceHeader] CHECK CONSTRAINT [FK_LOsInvoiceHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsInvoiceHeader_AsalesPersonmaster')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceHeader_AsalesPersonmaster] FOREIGN KEY ([ihsalespersonid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [LOsInvoiceHeader] CHECK CONSTRAINT [FK_LOsInvoiceHeader_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_LOsInvoiceHeader_aShops')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceHeader_aShops] FOREIGN KEY ([ihShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOsInvoiceHeader] CHECK CONSTRAINT [FK_LOsInvoiceHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceHeader' AND CONSTRAINT_NAME= 'FK_losInvoiceHeader_aVendorMaster')
BEGIN
	ALTER TABLE [LOsInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_losInvoiceHeader_aVendorMaster] FOREIGN KEY ([ihOptedVendorId]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [LOsInvoiceHeader] CHECK CONSTRAINT [FK_losInvoiceHeader_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceOC' AND CONSTRAINT_NAME= 'FK_LOsInvoiceOC_aAccountMaster')
BEGIN
	ALTER TABLE [LOsInvoiceOC] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceOC_aAccountMaster] FOREIGN KEY ([ioAccID],[ioCompanyid]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsInvoiceOC] CHECK CONSTRAINT [FK_LOsInvoiceOC_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceOC' AND CONSTRAINT_NAME= 'FK_LOsInvoiceOC_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [LOsInvoiceOC] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceOC_LOsInvoiceHeader] FOREIGN KEY ([ioShopID],[ioInvoiceID]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [LOsInvoiceOC] CHECK CONSTRAINT [FK_LOsInvoiceOC_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND CONSTRAINT_NAME= 'FK_losInvoiceProjectRequestDetails_aShops')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] WITH CHECK ADD  CONSTRAINT [FK_losInvoiceProjectRequestDetails_aShops] FOREIGN KEY ([idrShopId]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losInvoiceProjectRequestDetails] CHECK CONSTRAINT [FK_losInvoiceProjectRequestDetails_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND CONSTRAINT_NAME= 'FK_losInvoiceProjectRequestDetails_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] WITH CHECK ADD  CONSTRAINT [FK_losInvoiceProjectRequestDetails_LOsInvoiceHeader] FOREIGN KEY ([idrShopId],[idrInvoiceId]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [losInvoiceProjectRequestDetails] CHECK CONSTRAINT [FK_losInvoiceProjectRequestDetails_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosInvoiceST' AND CONSTRAINT_NAME= 'FK_LosInvoiceST_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [LosInvoiceST] WITH CHECK ADD  CONSTRAINT [FK_LosInvoiceST_LOsInvoiceHeader] FOREIGN KEY ([ioSTShopID],[ioSTInvoiceID]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [LosInvoiceST] CHECK CONSTRAINT [FK_LosInvoiceST_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND CONSTRAINT_NAME= 'FK_LOsInvoiceSubItemDetail_aItem')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceSubItemDetail_aItem] FOREIGN KEY ([isditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOsInvoiceSubItemDetail] CHECK CONSTRAINT [FK_LOsInvoiceSubItemDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND CONSTRAINT_NAME= 'FK_LOsInvoiceSubItemDetail_aItem1')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceSubItemDetail_aItem1] FOREIGN KEY ([isdsubitemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOsInvoiceSubItemDetail] CHECK CONSTRAINT [FK_LOsInvoiceSubItemDetail_aItem1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND CONSTRAINT_NAME= 'FK_LOsInvoiceSubItemDetail_aPackingType')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceSubItemDetail_aPackingType] FOREIGN KEY ([isdpackingtypeid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [LOsInvoiceSubItemDetail] CHECK CONSTRAINT [FK_LOsInvoiceSubItemDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND CONSTRAINT_NAME= 'FK_LOsInvoiceSubItemDetail_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsInvoiceSubItemDetail_LOsInvoiceHeader] FOREIGN KEY ([isdShopid],[isdinvoiceid]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [LOsInvoiceSubItemDetail] CHECK CONSTRAINT [FK_LOsInvoiceSubItemDetail_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND CONSTRAINT_NAME= 'fk_losinvpartsreplacedetails_aitem')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] WITH CHECK ADD  CONSTRAINT [fk_losinvpartsreplacedetails_aitem] FOREIGN KEY ([repinvdpartsid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losinvpartsreplacedetails] CHECK CONSTRAINT [fk_losinvpartsreplacedetails_aitem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND CONSTRAINT_NAME= 'fk_losinvpartsreplacedetails_losserviceheader')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] WITH CHECK ADD  CONSTRAINT [fk_losinvpartsreplacedetails_losserviceheader] FOREIGN KEY ([repinvinvoiceid],[repinvcompanyid],[repinvdshopid]) REFERENCES losServiceHeader([serinvhid],[serinvhcompanyid],[serinvhshopid])
END
GO
 ALTER TABLE [losinvpartsreplacedetails] CHECK CONSTRAINT [fk_losinvpartsreplacedetails_losserviceheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND CONSTRAINT_NAME= 'fk_losinvpartsreplacedetails_packingtype')
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] WITH CHECK ADD  CONSTRAINT [fk_losinvpartsreplacedetails_packingtype] FOREIGN KEY ([repinvpackid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [losinvpartsreplacedetails] CHECK CONSTRAINT [fk_losinvpartsreplacedetails_packingtype]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinvservicedetails' AND CONSTRAINT_NAME= 'FK_LOSINVSE_REF_1308_LOSSERVI')
BEGIN
	ALTER TABLE [losinvservicedetails] WITH CHECK ADD  CONSTRAINT [FK_LOSINVSE_REF_1308_LOSSERVI] FOREIGN KEY ([serinvdinvoiceid],[serinvdcompanyid],[serinvdshopid]) REFERENCES losServiceHeader([serinvhid],[serinvhcompanyid],[serinvhshopid])
END
GO
 ALTER TABLE [losinvservicedetails] CHECK CONSTRAINT [FK_LOSINVSE_REF_1308_LOSSERVI]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losinvservicedetails' AND CONSTRAINT_NAME= 'FK_LOSINVSE_REF_2134_ASERVICE')
BEGIN
	ALTER TABLE [losinvservicedetails] WITH CHECK ADD  CONSTRAINT [FK_LOSINVSE_REF_2134_ASERVICE] FOREIGN KEY ([serinvdserviceid],[serinvdcompanyid]) REFERENCES aservicemaster([serid],[sercompanyid])
END
GO
 ALTER TABLE [losinvservicedetails] CHECK CONSTRAINT [FK_LOSINVSE_REF_2134_ASERVICE]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosKegReturnDetail' AND CONSTRAINT_NAME= 'FK_LosKegReturnDetail_aItem')
BEGIN
	ALTER TABLE [LosKegReturnDetail] WITH CHECK ADD  CONSTRAINT [FK_LosKegReturnDetail_aItem] FOREIGN KEY ([krDItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LosKegReturnDetail] CHECK CONSTRAINT [FK_LosKegReturnDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosKegReturnDetail' AND CONSTRAINT_NAME= 'FK_LosKegReturnDetail_LOsInvoiceDetail')
BEGIN
	ALTER TABLE [LosKegReturnDetail] WITH CHECK ADD  CONSTRAINT [FK_LosKegReturnDetail_LOsInvoiceDetail] FOREIGN KEY ([krDShopid],[krDInvoiceId]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [LosKegReturnDetail] CHECK CONSTRAINT [FK_LosKegReturnDetail_LOsInvoiceDetail]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosKegReturnDetail' AND CONSTRAINT_NAME= 'FK_LosKegReturnDetail_LosKegReturnHeader')
BEGIN
	ALTER TABLE [LosKegReturnDetail] WITH CHECK ADD  CONSTRAINT [FK_LosKegReturnDetail_LosKegReturnHeader] FOREIGN KEY ([krDShopid],[krDReturnNoteID]) REFERENCES LosKegReturnHeader([krhShopid],[krhKegReturnID])
END
GO
 ALTER TABLE [LosKegReturnDetail] CHECK CONSTRAINT [FK_LosKegReturnDetail_LosKegReturnHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosKegReturnHeader' AND CONSTRAINT_NAME= 'fk_LosKegReturnHeader_acustomermaster')
BEGIN
	ALTER TABLE [LosKegReturnHeader] WITH CHECK ADD  CONSTRAINT [fk_LosKegReturnHeader_acustomermaster] FOREIGN KEY ([krhCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [LosKegReturnHeader] CHECK CONSTRAINT [fk_LosKegReturnHeader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosKegReturnHeader' AND CONSTRAINT_NAME= 'FK_LosKegReturnHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [LosKegReturnHeader] WITH CHECK ADD  CONSTRAINT [FK_LosKegReturnHeader_aDepartmentMaster] FOREIGN KEY ([krhDepartmentid],[krCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [LosKegReturnHeader] CHECK CONSTRAINT [FK_LosKegReturnHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosKegReturnHeader' AND CONSTRAINT_NAME= 'FK_LosKegReturnHeader_aShops')
BEGIN
	ALTER TABLE [LosKegReturnHeader] WITH CHECK ADD  CONSTRAINT [FK_LosKegReturnHeader_aShops] FOREIGN KEY ([krhShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LosKegReturnHeader] CHECK CONSTRAINT [FK_LosKegReturnHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLocalClearenceRequestDetail' AND CONSTRAINT_NAME= 'fk_losLocalClearenceRequestDetail_losLocalClearenceRequestHeader')
BEGIN
	ALTER TABLE [losLocalClearenceRequestDetail] WITH CHECK ADD  CONSTRAINT [fk_losLocalClearenceRequestDetail_losLocalClearenceRequestHeader] FOREIGN KEY ([ShopID],[ClearenceReqID]) REFERENCES losLocalClearenceRequestHeader([ShopID],[ClearenceReqID])
END
GO
 ALTER TABLE [losLocalClearenceRequestDetail] CHECK CONSTRAINT [fk_losLocalClearenceRequestDetail_losLocalClearenceRequestHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND CONSTRAINT_NAME= 'fk_losLocalClearenceRequestHeader_aCustomerMaster')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] WITH CHECK ADD  CONSTRAINT [fk_losLocalClearenceRequestHeader_aCustomerMaster] FOREIGN KEY ([CustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [losLocalClearenceRequestHeader] CHECK CONSTRAINT [fk_losLocalClearenceRequestHeader_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND CONSTRAINT_NAME= 'fk_losLocalClearenceRequestHeader_aVendorMaster')
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] WITH CHECK ADD  CONSTRAINT [fk_losLocalClearenceRequestHeader_aVendorMaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [losLocalClearenceRequestHeader] CHECK CONSTRAINT [fk_losLocalClearenceRequestHeader_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND CONSTRAINT_NAME= 'fk_loslocalpurchasedetail_aitem')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] WITH CHECK ADD  CONSTRAINT [fk_loslocalpurchasedetail_aitem] FOREIGN KEY ([lpdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LosLocalPurchaseDetail] CHECK CONSTRAINT [fk_loslocalpurchasedetail_aitem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND CONSTRAINT_NAME= 'fk_loslocalpurchasedetail_loslocalpurchaseheader')
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] WITH CHECK ADD  CONSTRAINT [fk_loslocalpurchasedetail_loslocalpurchaseheader] FOREIGN KEY ([lpdShopID],[lpdBillID]) REFERENCES LosLocalPurchaseHeader([lphShopID],[lphBillID])
END
GO
 ALTER TABLE [LosLocalPurchaseDetail] CHECK CONSTRAINT [fk_loslocalpurchasedetail_loslocalpurchaseheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'FK_LosLocalPurcaseHeader_aAccountMaster')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] WITH CHECK ADD  CONSTRAINT [FK_LosLocalPurcaseHeader_aAccountMaster] FOREIGN KEY ([lphDiscountAccID],[lphCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LosLocalPurchaseHeader] CHECK CONSTRAINT [FK_LosLocalPurcaseHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'FK_LosLocalPurcaseHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] WITH CHECK ADD  CONSTRAINT [FK_LosLocalPurcaseHeader_aAccountMaster1] FOREIGN KEY ([lphBankcashAccID],[lphCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LosLocalPurchaseHeader] CHECK CONSTRAINT [FK_LosLocalPurcaseHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'FK_LosLocalPurcaseHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] WITH CHECK ADD  CONSTRAINT [FK_LosLocalPurcaseHeader_aDepartmentMaster] FOREIGN KEY ([lphDepartmentID],[lphCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [LosLocalPurchaseHeader] CHECK CONSTRAINT [FK_LosLocalPurcaseHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'FK_LosLocalPurcaseHeader_aFinancialYear')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] WITH CHECK ADD  CONSTRAINT [FK_LosLocalPurcaseHeader_aFinancialYear] FOREIGN KEY ([lphFinancialID],[lphCompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [LosLocalPurchaseHeader] CHECK CONSTRAINT [FK_LosLocalPurcaseHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'fk_losLocalPurchaseHeader_aaccountmaster')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] WITH CHECK ADD  CONSTRAINT [fk_losLocalPurchaseHeader_aaccountmaster] FOREIGN KEY ([lphPurchaseAccID],[lphCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LosLocalPurchaseHeader] CHECK CONSTRAINT [fk_losLocalPurchaseHeader_aaccountmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'FK_LosLocalPurchaseHeader_aShops')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] WITH CHECK ADD  CONSTRAINT [FK_LosLocalPurchaseHeader_aShops] FOREIGN KEY ([lphShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LosLocalPurchaseHeader] CHECK CONSTRAINT [FK_LosLocalPurchaseHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'fk_loslocalpurchaseheader_avendormaster')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] WITH CHECK ADD  CONSTRAINT [fk_loslocalpurchaseheader_avendormaster] FOREIGN KEY ([lphVendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [LosLocalPurchaseHeader] CHECK CONSTRAINT [fk_loslocalpurchaseheader_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'FK_LosLocalPurchaseHeader_CashBox')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] WITH CHECK ADD  CONSTRAINT [FK_LosLocalPurchaseHeader_CashBox] FOREIGN KEY ([lphcbid],[lphShopID]) REFERENCES CashBox([CBID],[CBShopID])
END
GO
 ALTER TABLE [LosLocalPurchaseHeader] CHECK CONSTRAINT [FK_LosLocalPurchaseHeader_CashBox]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND CONSTRAINT_NAME= 'fk_loslocalpurchaseheader_lospurchaseorderheader')
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] WITH CHECK ADD  CONSTRAINT [fk_loslocalpurchaseheader_lospurchaseorderheader] FOREIGN KEY ([lphPOID],[lphShopID]) REFERENCES losPurchaseOrderHeader([pohPoid],[pohShopid])
END
GO
 ALTER TABLE [LosLocalPurchaseHeader] CHECK CONSTRAINT [fk_loslocalpurchaseheader_lospurchaseorderheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND CONSTRAINT_NAME= 'FK_LOsLocalPurchaseOC_aAccountMaster')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] WITH CHECK ADD  CONSTRAINT [FK_LOsLocalPurchaseOC_aAccountMaster] FOREIGN KEY ([lpoAccID],[lpoCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsLocalPurchaseOC] CHECK CONSTRAINT [FK_LOsLocalPurchaseOC_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND CONSTRAINT_NAME= 'FK_LOsLocalPurchaseOC_LosLocalPurchaseHeader')
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] WITH CHECK ADD  CONSTRAINT [FK_LOsLocalPurchaseOC_LosLocalPurchaseHeader] FOREIGN KEY ([lpoShopID],[lpoBillID]) REFERENCES LosLocalPurchaseHeader([lphShopID],[lphBillID])
END
GO
 ALTER TABLE [LOsLocalPurchaseOC] CHECK CONSTRAINT [FK_LOsLocalPurchaseOC_LosLocalPurchaseHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocation' AND CONSTRAINT_NAME= 'fk_loslocation_ashops')
BEGIN
	ALTER TABLE [loslocation] WITH CHECK ADD  CONSTRAINT [fk_loslocation_ashops] FOREIGN KEY ([lshopiD]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [loslocation] CHECK CONSTRAINT [fk_loslocation_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocation' AND CONSTRAINT_NAME= 'fk_loslocation_loslocationgroup')
BEGIN
	ALTER TABLE [loslocation] WITH CHECK ADD  CONSTRAINT [fk_loslocation_loslocationgroup] FOREIGN KEY ([lcompanyid],[lgroupid],[lshopiD]) REFERENCES LoslocationGroup([Lgcompanyid],[Lggroupid],[Lgshopid])
END
GO
 ALTER TABLE [loslocation] CHECK CONSTRAINT [fk_loslocation_loslocationgroup]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocationarrivaldetails' AND CONSTRAINT_NAME= 'FK_loslocationarrivaldetails_aItem')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] WITH CHECK ADD  CONSTRAINT [FK_loslocationarrivaldetails_aItem] FOREIGN KEY ([laditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loslocationarrivaldetails] CHECK CONSTRAINT [FK_loslocationarrivaldetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocationarrivaldetails' AND CONSTRAINT_NAME= 'FK_loslocationarrivaldetails_aPackingType')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] WITH CHECK ADD  CONSTRAINT [FK_loslocationarrivaldetails_aPackingType] FOREIGN KEY ([ladpackingtypeid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [loslocationarrivaldetails] CHECK CONSTRAINT [FK_loslocationarrivaldetails_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocationarrivaldetails' AND CONSTRAINT_NAME= 'FK_loslocationarrivaldetails_loslocation')
BEGIN
	ALTER TABLE [loslocationarrivaldetails] WITH CHECK ADD  CONSTRAINT [FK_loslocationarrivaldetails_loslocation] FOREIGN KEY ([ladshopid],[ladlocationid]) REFERENCES loslocation([lshopiD],[lLocationID])
END
GO
 ALTER TABLE [loslocationarrivaldetails] CHECK CONSTRAINT [FK_loslocationarrivaldetails_loslocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoslocationGroup' AND CONSTRAINT_NAME= 'fk_loslocationgroup_acompanymaster')
BEGIN
	ALTER TABLE [LoslocationGroup] WITH CHECK ADD  CONSTRAINT [fk_loslocationgroup_acompanymaster] FOREIGN KEY ([Lgcompanyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [LoslocationGroup] CHECK CONSTRAINT [fk_loslocationgroup_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LoslocationGroup' AND CONSTRAINT_NAME= 'fk_loslocationgroup_ashops')
BEGIN
	ALTER TABLE [LoslocationGroup] WITH CHECK ADD  CONSTRAINT [fk_loslocationgroup_ashops] FOREIGN KEY ([Lgshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LoslocationGroup] CHECK CONSTRAINT [fk_loslocationgroup_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocationissuedetails' AND CONSTRAINT_NAME= 'FK_loslocationissuedetails_aItem')
BEGIN
	ALTER TABLE [loslocationissuedetails] WITH CHECK ADD  CONSTRAINT [FK_loslocationissuedetails_aItem] FOREIGN KEY ([liditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [loslocationissuedetails] CHECK CONSTRAINT [FK_loslocationissuedetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocationissuedetails' AND CONSTRAINT_NAME= 'FK_loslocationissuedetails_aPackingType')
BEGIN
	ALTER TABLE [loslocationissuedetails] WITH CHECK ADD  CONSTRAINT [FK_loslocationissuedetails_aPackingType] FOREIGN KEY ([lidpackingtypeid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [loslocationissuedetails] CHECK CONSTRAINT [FK_loslocationissuedetails_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='loslocationissuedetails' AND CONSTRAINT_NAME= 'FK_loslocationissuedetails_loslocation')
BEGIN
	ALTER TABLE [loslocationissuedetails] WITH CHECK ADD  CONSTRAINT [FK_loslocationissuedetails_loslocation] FOREIGN KEY ([lidshopid],[lidlocationid]) REFERENCES loslocation([lshopiD],[lLocationID])
END
GO
 ALTER TABLE [loslocationissuedetails] CHECK CONSTRAINT [FK_loslocationissuedetails_loslocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLPDetail' AND CONSTRAINT_NAME= 'fk_losLPDetail_losLPHeader')
BEGIN
	ALTER TABLE [losLPDetail] WITH CHECK ADD  CONSTRAINT [fk_losLPDetail_losLPHeader] FOREIGN KEY ([ShopID],[POID]) REFERENCES losLPHeader([ShopID],[POID])
END
GO
 ALTER TABLE [losLPDetail] CHECK CONSTRAINT [fk_losLPDetail_losLPHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLPHeader' AND CONSTRAINT_NAME= 'fk_losLPHeader_aCustomerMaster')
BEGIN
	ALTER TABLE [losLPHeader] WITH CHECK ADD  CONSTRAINT [fk_losLPHeader_aCustomerMaster] FOREIGN KEY ([CustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [losLPHeader] CHECK CONSTRAINT [fk_losLPHeader_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLPHeader' AND CONSTRAINT_NAME= 'fk_losLPHeader_aVendorMaster')
BEGIN
	ALTER TABLE [losLPHeader] WITH CHECK ADD  CONSTRAINT [fk_losLPHeader_aVendorMaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [losLPHeader] CHECK CONSTRAINT [fk_losLPHeader_aVendorMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losLPHeader' AND CONSTRAINT_NAME= 'fk_losLPHeader_losLocalClearenceHeader')
BEGIN
	ALTER TABLE [losLPHeader] WITH CHECK ADD  CONSTRAINT [fk_losLPHeader_losLocalClearenceHeader] FOREIGN KEY ([ShopID],[ClearenceReqID]) REFERENCES losLocalClearenceRequestHeader([ShopID],[ClearenceReqID])
END
GO
 ALTER TABLE [losLPHeader] CHECK CONSTRAINT [fk_losLPHeader_losLocalClearenceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPackingListDetail' AND CONSTRAINT_NAME= 'fk_LosPackingListDetail_LosPackingListHeader')
BEGIN
	ALTER TABLE [LosPackingListDetail] WITH CHECK ADD  CONSTRAINT [fk_LosPackingListDetail_LosPackingListHeader] FOREIGN KEY ([PldShopId],[PldId]) REFERENCES LosPackingListHeader([plhShopId],[plhPackListId])
END
GO
 ALTER TABLE [LosPackingListDetail] CHECK CONSTRAINT [fk_LosPackingListDetail_LosPackingListHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND CONSTRAINT_NAME= 'FK_LOsPaymentVoucherDetails_LosLocalPurchaseHeader')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_LOsPaymentVoucherDetails_LosLocalPurchaseHeader] FOREIGN KEY ([pdShopID],[pdBillsID]) REFERENCES LosLocalPurchaseHeader([lphShopID],[lphBillID])
END
GO
 ALTER TABLE [LOsPaymentVoucherDetails] CHECK CONSTRAINT [FK_LOsPaymentVoucherDetails_LosLocalPurchaseHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND CONSTRAINT_NAME= 'FK_LOsPaymentVoucherDetails_LOsPaymentVoucherHeader')
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_LOsPaymentVoucherDetails_LOsPaymentVoucherHeader] FOREIGN KEY ([pdPaymentID],[pdShopID]) REFERENCES LOsPaymentVoucherHeader([phPaymentID],[phShopID])
END
GO
 ALTER TABLE [LOsPaymentVoucherDetails] CHECK CONSTRAINT [FK_LOsPaymentVoucherDetails_LOsPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'FK_LOsPaymentVoucherHeader_aAccountMaster')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsPaymentVoucherHeader_aAccountMaster] FOREIGN KEY ([phBankCashID],[phCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsPaymentVoucherHeader] CHECK CONSTRAINT [FK_LOsPaymentVoucherHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_LOsPaymentVoucherHeader_aaccountmaster1')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_LOsPaymentVoucherHeader_aaccountmaster1] FOREIGN KEY ([phdebitaccountid],[phCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsPaymentVoucherHeader] CHECK CONSTRAINT [fk_LOsPaymentVoucherHeader_aaccountmaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'FK_LOsPaymentVoucherHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsPaymentVoucherHeader_aCompanyMaster] FOREIGN KEY ([phCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [LOsPaymentVoucherHeader] CHECK CONSTRAINT [FK_LOsPaymentVoucherHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_LOsPaymentVoucherHeader_acustomermaster')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_LOsPaymentVoucherHeader_acustomermaster] FOREIGN KEY ([phCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [LOsPaymentVoucherHeader] CHECK CONSTRAINT [fk_LOsPaymentVoucherHeader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_LOsPaymentVoucherHeader_adepartmentmaster')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_LOsPaymentVoucherHeader_adepartmentmaster] FOREIGN KEY ([phDepartmentID],[phCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [LOsPaymentVoucherHeader] CHECK CONSTRAINT [fk_LOsPaymentVoucherHeader_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_LOsPaymentVoucherHeader_afinancialyear')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_LOsPaymentVoucherHeader_afinancialyear] FOREIGN KEY ([phFinancialID],[phCompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [LOsPaymentVoucherHeader] CHECK CONSTRAINT [fk_LOsPaymentVoucherHeader_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'FK_LOsPaymentVoucherHeader_aShops')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsPaymentVoucherHeader_aShops] FOREIGN KEY ([phShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOsPaymentVoucherHeader] CHECK CONSTRAINT [FK_LOsPaymentVoucherHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'fk_LOsPaymentVoucherHeader_avendormaster')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_LOsPaymentVoucherHeader_avendormaster] FOREIGN KEY ([phVendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [LOsPaymentVoucherHeader] CHECK CONSTRAINT [fk_LOsPaymentVoucherHeader_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND CONSTRAINT_NAME= 'FK_LOsPaymentVoucherHeader_CashBox')
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsPaymentVoucherHeader_CashBox] FOREIGN KEY ([phcbid],[phShopID]) REFERENCES CashBox([CBID],[CBShopID])
END
GO
 ALTER TABLE [LOsPaymentVoucherHeader] CHECK CONSTRAINT [FK_LOsPaymentVoucherHeader_CashBox]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosDetail' AND CONSTRAINT_NAME= 'FK_LOsPosDetail_aItem')
BEGIN
	ALTER TABLE [LOsPosDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsPosDetail_aItem] FOREIGN KEY ([posdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOsPosDetail] CHECK CONSTRAINT [FK_LOsPosDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosDetail' AND CONSTRAINT_NAME= 'FK_LOsPosDetail_aPackingType')
BEGIN
	ALTER TABLE [LOsPosDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsPosDetail_aPackingType] FOREIGN KEY ([posdPackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [LOsPosDetail] CHECK CONSTRAINT [FK_LOsPosDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosDetail' AND CONSTRAINT_NAME= 'FK_LOsPosDetail_aUnit')
BEGIN
	ALTER TABLE [LOsPosDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsPosDetail_aUnit] FOREIGN KEY ([posdPUnitID]) REFERENCES aUnit([UnitID])
END
GO
 ALTER TABLE [LOsPosDetail] CHECK CONSTRAINT [FK_LOsPosDetail_aUnit]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosDetail' AND CONSTRAINT_NAME= 'FK_LOsPosDetail_LOsPosHeader')
BEGIN
	ALTER TABLE [LOsPosDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsPosDetail_LOsPosHeader] FOREIGN KEY ([posdShopID],[posdBillID]) REFERENCES LOsPosHeader([poshShopID],[poshBillID])
END
GO
 ALTER TABLE [LOsPosDetail] CHECK CONSTRAINT [FK_LOsPosDetail_LOsPosHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeDetail' AND CONSTRAINT_NAME= 'FK_losposExchangeDetail_aItem')
BEGIN
	ALTER TABLE [losposExchangeDetail] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeDetail_aItem] FOREIGN KEY ([sedItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losposExchangeDetail] CHECK CONSTRAINT [FK_losposExchangeDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeDetail' AND CONSTRAINT_NAME= 'FK_losposExchangeDetail_aPackingType')
BEGIN
	ALTER TABLE [losposExchangeDetail] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeDetail_aPackingType] FOREIGN KEY ([sedPackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [losposExchangeDetail] CHECK CONSTRAINT [FK_losposExchangeDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeDetail' AND CONSTRAINT_NAME= 'FK_losposExchangeDetail_aUnit')
BEGIN
	ALTER TABLE [losposExchangeDetail] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeDetail_aUnit] FOREIGN KEY ([sedPUnitID]) REFERENCES aUnit([UnitID])
END
GO
 ALTER TABLE [losposExchangeDetail] CHECK CONSTRAINT [FK_losposExchangeDetail_aUnit]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeDetail' AND CONSTRAINT_NAME= 'FK_losposExchangeDetail_losposExchangeHeader')
BEGIN
	ALTER TABLE [losposExchangeDetail] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeDetail_losposExchangeHeader] FOREIGN KEY ([sedShopID],[sedExchangeID]) REFERENCES losposExchangeHeader([sehShopID],[sehExchangeID])
END
GO
 ALTER TABLE [losposExchangeDetail] CHECK CONSTRAINT [FK_losposExchangeDetail_losposExchangeHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeHeader' AND CONSTRAINT_NAME= 'FK_losposExchangeHeader_aAccountMaster')
BEGIN
	ALTER TABLE [losposExchangeHeader] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeHeader_aAccountMaster] FOREIGN KEY ([sehSalesAccID],[sehCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losposExchangeHeader] CHECK CONSTRAINT [FK_losposExchangeHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeHeader' AND CONSTRAINT_NAME= 'FK_losposExchangeHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [losposExchangeHeader] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeHeader_aAccountMaster1] FOREIGN KEY ([sehCashAccID],[sehCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losposExchangeHeader] CHECK CONSTRAINT [FK_losposExchangeHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeHeader' AND CONSTRAINT_NAME= 'FK_losposExchangeHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [losposExchangeHeader] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeHeader_aDepartmentMaster] FOREIGN KEY ([sehDepartmentID],[sehCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losposExchangeHeader] CHECK CONSTRAINT [FK_losposExchangeHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeHeader' AND CONSTRAINT_NAME= 'FK_losposExchangeHeader_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losposExchangeHeader] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeHeader_AsalesPersonmaster] FOREIGN KEY ([sehsalespersonid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losposExchangeHeader] CHECK CONSTRAINT [FK_losposExchangeHeader_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeHeader' AND CONSTRAINT_NAME= 'FK_losposExchangeHeader_CashBox')
BEGIN
	ALTER TABLE [losposExchangeHeader] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeHeader_CashBox] FOREIGN KEY ([sehcbid],[sehShopID]) REFERENCES CashBox([CBID],[CBShopID])
END
GO
 ALTER TABLE [losposExchangeHeader] CHECK CONSTRAINT [FK_losposExchangeHeader_CashBox]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeHeader' AND CONSTRAINT_NAME= 'FK_losposExchangeHeader_LOsPosHeader')
BEGIN
	ALTER TABLE [losposExchangeHeader] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeHeader_LOsPosHeader] FOREIGN KEY ([sehShopID],[sehBillID]) REFERENCES LOsPosHeader([poshShopID],[poshBillID])
END
GO
 ALTER TABLE [losposExchangeHeader] CHECK CONSTRAINT [FK_losposExchangeHeader_LOsPosHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND CONSTRAINT_NAME= 'FK_losposExchangeOtherCharges_aAccountMaster')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeOtherCharges_aAccountMaster] FOREIGN KEY ([seoAccID],[seoCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losposExchangeOtherCharges] CHECK CONSTRAINT [FK_losposExchangeOtherCharges_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND CONSTRAINT_NAME= 'FK_losposExchangeOtherCharges_losposExchangeHeader')
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeOtherCharges_losposExchangeHeader] FOREIGN KEY ([seoShopID],[seoExchangeID]) REFERENCES losposExchangeHeader([sehShopID],[sehExchangeID])
END
GO
 ALTER TABLE [losposExchangeOtherCharges] CHECK CONSTRAINT [FK_losposExchangeOtherCharges_losposExchangeHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND CONSTRAINT_NAME= 'FK_losposExchangeSubItemDetails_aItem')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeSubItemDetails_aItem] FOREIGN KEY ([seidItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losposExchangeSubItemDetails] CHECK CONSTRAINT [FK_losposExchangeSubItemDetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND CONSTRAINT_NAME= 'FK_losposExchangeSubItemDetails_aItem1')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeSubItemDetails_aItem1] FOREIGN KEY ([seidSubItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losposExchangeSubItemDetails] CHECK CONSTRAINT [FK_losposExchangeSubItemDetails_aItem1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND CONSTRAINT_NAME= 'FK_losposExchangeSubItemDetails_aPackingType')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeSubItemDetails_aPackingType] FOREIGN KEY ([seidPackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [losposExchangeSubItemDetails] CHECK CONSTRAINT [FK_losposExchangeSubItemDetails_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND CONSTRAINT_NAME= 'FK_losposExchangeSubItemDetails_losposExchangeHeader')
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] WITH CHECK ADD  CONSTRAINT [FK_losposExchangeSubItemDetails_losposExchangeHeader] FOREIGN KEY ([seidShopID],[seidExchangeID]) REFERENCES losposExchangeHeader([sehShopID],[sehExchangeID])
END
GO
 ALTER TABLE [losposExchangeSubItemDetails] CHECK CONSTRAINT [FK_losposExchangeSubItemDetails_losposExchangeHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPosFAndBHeader' AND CONSTRAINT_NAME= 'FK_FlightOperatorMaster_LosposFandBHeader_poshCompanyID_poshFlightOpID')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] WITH CHECK ADD  CONSTRAINT [FK_FlightOperatorMaster_LosposFandBHeader_poshCompanyID_poshFlightOpID] FOREIGN KEY ([poshCompanyID],[poshFlightOpID]) REFERENCES FlightOperatorMaster([companyid],[FlghtOpid])
END
GO
 ALTER TABLE [LosPosFAndBHeader] CHECK CONSTRAINT [FK_FlightOperatorMaster_LosposFandBHeader_poshCompanyID_poshFlightOpID]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPosFAndBHeader' AND CONSTRAINT_NAME= 'FK_losposfandbheader_acustomermaster')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] WITH CHECK ADD  CONSTRAINT [FK_losposfandbheader_acustomermaster] FOREIGN KEY ([poshcustomerid]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [LosPosFAndBHeader] CHECK CONSTRAINT [FK_losposfandbheader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPosFAndBHeader' AND CONSTRAINT_NAME= 'fk_losposfandbheader_afinancialyear')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] WITH CHECK ADD  CONSTRAINT [fk_losposfandbheader_afinancialyear] FOREIGN KEY ([poshFinancialId],[poshCompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [LosPosFAndBHeader] CHECK CONSTRAINT [fk_losposfandbheader_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPosFAndBHeader' AND CONSTRAINT_NAME= 'FK_LosPosFAndBHeader_aShops')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] WITH CHECK ADD  CONSTRAINT [FK_LosPosFAndBHeader_aShops] FOREIGN KEY ([poshShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LosPosFAndBHeader] CHECK CONSTRAINT [FK_LosPosFAndBHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPosFAndBHeader' AND CONSTRAINT_NAME= 'FK_Losposfandbheader_dishsegmentheader')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] WITH CHECK ADD  CONSTRAINT [FK_Losposfandbheader_dishsegmentheader] FOREIGN KEY ([poshSegID],[poshCompanyID]) REFERENCES DishSegmentHeader([seg_header_id],[seg_header_companyID])
END
GO
 ALTER TABLE [LosPosFAndBHeader] CHECK CONSTRAINT [FK_Losposfandbheader_dishsegmentheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPosFAndBHeader' AND CONSTRAINT_NAME= 'FK_LosPosFAndBHeader_Flights')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] WITH CHECK ADD  CONSTRAINT [FK_LosPosFAndBHeader_Flights] FOREIGN KEY ([poshCompanyID],[poshFlightID]) REFERENCES Flights([companyid],[FlightID])
END
GO
 ALTER TABLE [LosPosFAndBHeader] CHECK CONSTRAINT [FK_LosPosFAndBHeader_Flights]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosPosFAndBHeader' AND CONSTRAINT_NAME= 'FK_losposfandbheader_vouchermaster')
BEGIN
	ALTER TABLE [LosPosFAndBHeader] WITH CHECK ADD  CONSTRAINT [FK_losposfandbheader_vouchermaster] FOREIGN KEY ([poshvoucherid],[poshCompanyID]) REFERENCES VoucherMaster([VoucherID],[VoucherCompanyID])
END
GO
 ALTER TABLE [LosPosFAndBHeader] CHECK CONSTRAINT [FK_losposfandbheader_vouchermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosHeader' AND CONSTRAINT_NAME= 'FK_LOsPosHeader_aCustomerMaster')
BEGIN
	ALTER TABLE [LOsPosHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsPosHeader_aCustomerMaster] FOREIGN KEY ([poshcustomerid]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [LOsPosHeader] CHECK CONSTRAINT [FK_LOsPosHeader_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosOthercharges' AND CONSTRAINT_NAME= 'FK_LOsPosOthercharges_aAccountMaster')
BEGIN
	ALTER TABLE [LOsPosOthercharges] WITH CHECK ADD  CONSTRAINT [FK_LOsPosOthercharges_aAccountMaster] FOREIGN KEY ([posoAccID],[posoCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsPosOthercharges] CHECK CONSTRAINT [FK_LOsPosOthercharges_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosOthercharges' AND CONSTRAINT_NAME= 'FK_LOsPosOthercharges_LOsPosHeader')
BEGIN
	ALTER TABLE [LOsPosOthercharges] WITH CHECK ADD  CONSTRAINT [FK_LOsPosOthercharges_LOsPosHeader] FOREIGN KEY ([posoShopID],[posoBillID]) REFERENCES LOsPosHeader([poshShopID],[poshBillID])
END
GO
 ALTER TABLE [LOsPosOthercharges] CHECK CONSTRAINT [FK_LOsPosOthercharges_LOsPosHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND CONSTRAINT_NAME= 'FK_LOsPosSubItemDetail_aItem')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsPosSubItemDetail_aItem] FOREIGN KEY ([posiditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOsPosSubItemDetail] CHECK CONSTRAINT [FK_LOsPosSubItemDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND CONSTRAINT_NAME= 'FK_LOsPosSubItemDetail_aItem1')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsPosSubItemDetail_aItem1] FOREIGN KEY ([posidsubitemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOsPosSubItemDetail] CHECK CONSTRAINT [FK_LOsPosSubItemDetail_aItem1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND CONSTRAINT_NAME= 'FK_LOsPosSubItemDetail_aPackingType')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsPosSubItemDetail_aPackingType] FOREIGN KEY ([posidpackingtypeid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [LOsPosSubItemDetail] CHECK CONSTRAINT [FK_LOsPosSubItemDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND CONSTRAINT_NAME= 'FK_LOsPosSubItemDetail_LOsPosHeader')
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsPosSubItemDetail_LOsPosHeader] FOREIGN KEY ([posidshopid],[posidbillid]) REFERENCES LOsPosHeader([poshShopID],[poshBillID])
END
GO
 ALTER TABLE [LOsPosSubItemDetail] CHECK CONSTRAINT [FK_LOsPosSubItemDetail_LOsPosHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillDetail_aItem')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] WITH CHECK ADD  CONSTRAINT [FK_LOspPurchaseBillDetail_aItem] FOREIGN KEY ([pbdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOspPurchaseBillDetail] CHECK CONSTRAINT [FK_LOspPurchaseBillDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND CONSTRAINT_NAME= 'fk_losppurchasebilldetail_apackingtype')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] WITH CHECK ADD  CONSTRAINT [fk_losppurchasebilldetail_apackingtype] FOREIGN KEY ([pbdPackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [LOspPurchaseBillDetail] CHECK CONSTRAINT [fk_losppurchasebilldetail_apackingtype]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillDetail_loPurchaseOrderHeader')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] WITH NOCHECK ADD  CONSTRAINT [FK_LOspPurchaseBillDetail_loPurchaseOrderHeader] FOREIGN KEY ([pbdpoid]) REFERENCES loPurchaseOrderHeader([pohPoid])
END
GO
 ALTER TABLE [LOspPurchaseBillDetail] CHECK CONSTRAINT [FK_LOspPurchaseBillDetail_loPurchaseOrderHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillDetail_LOspPurchaseBillHeader')
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] WITH CHECK ADD  CONSTRAINT [FK_LOspPurchaseBillDetail_LOspPurchaseBillHeader] FOREIGN KEY ([pbdBillID]) REFERENCES LOspPurchaseBillHeader([pbhBillID])
END
GO
 ALTER TABLE [LOspPurchaseBillDetail] CHECK CONSTRAINT [FK_LOspPurchaseBillDetail_LOspPurchaseBillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillHeader_aAccountMaster')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] WITH CHECK ADD  CONSTRAINT [FK_LOspPurchaseBillHeader_aAccountMaster] FOREIGN KEY ([pbhDiscountAccID],[pbhCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOspPurchaseBillHeader] CHECK CONSTRAINT [FK_LOspPurchaseBillHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND CONSTRAINT_NAME= 'fk_lospPurchasebillHeader_aaccountmaster_pacc')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] WITH CHECK ADD  CONSTRAINT [fk_lospPurchasebillHeader_aaccountmaster_pacc] FOREIGN KEY ([pbhPurchaseAccID],[pbhCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOspPurchaseBillHeader] CHECK CONSTRAINT [fk_lospPurchasebillHeader_aaccountmaster_pacc]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] WITH CHECK ADD  CONSTRAINT [FK_LOspPurchaseBillHeader_aAccountMaster1] FOREIGN KEY ([pbhBankCashAccID],[pbhCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOspPurchaseBillHeader] CHECK CONSTRAINT [FK_LOspPurchaseBillHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] WITH CHECK ADD  CONSTRAINT [FK_LOspPurchaseBillHeader_aCompanyMaster] FOREIGN KEY ([pbhCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [LOspPurchaseBillHeader] CHECK CONSTRAINT [FK_LOspPurchaseBillHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] WITH CHECK ADD  CONSTRAINT [FK_LOspPurchaseBillHeader_aDepartmentMaster] FOREIGN KEY ([pbhDepartmentID],[pbhCompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [LOspPurchaseBillHeader] CHECK CONSTRAINT [FK_LOspPurchaseBillHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillHeader_aFinancialYear')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] WITH CHECK ADD  CONSTRAINT [FK_LOspPurchaseBillHeader_aFinancialYear] FOREIGN KEY ([pbhFinancialID],[pbhCompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [LOspPurchaseBillHeader] CHECK CONSTRAINT [FK_LOspPurchaseBillHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND CONSTRAINT_NAME= 'fk_lospPurchaseBillHeader_avendormaster')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] WITH CHECK ADD  CONSTRAINT [fk_lospPurchaseBillHeader_avendormaster] FOREIGN KEY ([pbhVendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [LOspPurchaseBillHeader] CHECK CONSTRAINT [fk_lospPurchaseBillHeader_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillHeader_loPurchaseOrderHeader1')
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] WITH NOCHECK ADD  CONSTRAINT [FK_LOspPurchaseBillHeader_loPurchaseOrderHeader1] FOREIGN KEY ([pbhPOID]) REFERENCES loPurchaseOrderHeader([pohPoid])
END
GO
 ALTER TABLE [LOspPurchaseBillHeader] CHECK CONSTRAINT [FK_LOspPurchaseBillHeader_loPurchaseOrderHeader1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillOC' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillOC_aAccountMaster')
BEGIN
	ALTER TABLE [LOspPurchaseBillOC] WITH CHECK ADD  CONSTRAINT [FK_LOspPurchaseBillOC_aAccountMaster] FOREIGN KEY ([pboAccID],[pboCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOspPurchaseBillOC] CHECK CONSTRAINT [FK_LOspPurchaseBillOC_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOspPurchaseBillOC' AND CONSTRAINT_NAME= 'FK_LOspPurchaseBillOC_LOspPurchaseBillHeader1')
BEGIN
	ALTER TABLE [LOspPurchaseBillOC] WITH CHECK ADD  CONSTRAINT [FK_LOspPurchaseBillOC_LOspPurchaseBillHeader1] FOREIGN KEY ([pboBillID]) REFERENCES LOspPurchaseBillHeader([pbhBillID])
END
GO
 ALTER TABLE [LOspPurchaseBillOC] CHECK CONSTRAINT [FK_LOspPurchaseBillOC_LOspPurchaseBillHeader1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND CONSTRAINT_NAME= 'FK_losPurchaseOrderDetail_aItem')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] WITH CHECK ADD  CONSTRAINT [FK_losPurchaseOrderDetail_aItem] FOREIGN KEY ([poditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losPurchaseOrderDetail] CHECK CONSTRAINT [FK_losPurchaseOrderDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND CONSTRAINT_NAME= 'FK_losPurchaseOrderDetail_losPurchaseOrderHeader')
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] WITH CHECK ADD  CONSTRAINT [FK_losPurchaseOrderDetail_losPurchaseOrderHeader] FOREIGN KEY ([podPoid],[podShopid]) REFERENCES losPurchaseOrderHeader([pohPoid],[pohShopid])
END
GO
 ALTER TABLE [losPurchaseOrderDetail] CHECK CONSTRAINT [FK_losPurchaseOrderDetail_losPurchaseOrderHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND CONSTRAINT_NAME= 'fk_losPurchaseOrderHeader_acompanymaster')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] WITH CHECK ADD  CONSTRAINT [fk_losPurchaseOrderHeader_acompanymaster] FOREIGN KEY ([pohCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [losPurchaseOrderHeader] CHECK CONSTRAINT [fk_losPurchaseOrderHeader_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND CONSTRAINT_NAME= 'FK_losPurchaseOrderHeader_aShops')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] WITH CHECK ADD  CONSTRAINT [FK_losPurchaseOrderHeader_aShops] FOREIGN KEY ([pohShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losPurchaseOrderHeader] CHECK CONSTRAINT [FK_losPurchaseOrderHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND CONSTRAINT_NAME= 'fk_losPurchaseOrderHeader_avendormaster')
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] WITH CHECK ADD  CONSTRAINT [fk_losPurchaseOrderHeader_avendormaster] FOREIGN KEY ([pohVendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [losPurchaseOrderHeader] CHECK CONSTRAINT [fk_losPurchaseOrderHeader_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losrebateconfirmdetail' AND CONSTRAINT_NAME= 'FK_losrebateconfirmdetail_aItem')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] WITH CHECK ADD  CONSTRAINT [FK_losrebateconfirmdetail_aItem] FOREIGN KEY ([rcditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losrebateconfirmdetail] CHECK CONSTRAINT [FK_losrebateconfirmdetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losrebateconfirmdetail' AND CONSTRAINT_NAME= 'FK_losrebateconfirmdetail_losrebateconfirmheader')
BEGIN
	ALTER TABLE [losrebateconfirmdetail] WITH CHECK ADD  CONSTRAINT [FK_losrebateconfirmdetail_losrebateconfirmheader] FOREIGN KEY ([rcdshopid],[rcdapprovedid]) REFERENCES losrebateconfirmheader([rcshopid],[rcapprovedid])
END
GO
 ALTER TABLE [losrebateconfirmdetail] CHECK CONSTRAINT [FK_losrebateconfirmdetail_losrebateconfirmheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losrebateconfirmheader' AND CONSTRAINT_NAME= 'FK_losrebateconfirmheader_losrebaterequest')
BEGIN
	ALTER TABLE [losrebateconfirmheader] WITH CHECK ADD  CONSTRAINT [FK_losrebateconfirmheader_losrebaterequest] FOREIGN KEY ([rcshopid],[rcreqid]) REFERENCES losrebaterequest([rrshopid],[rrreqid])
END
GO
 ALTER TABLE [losrebateconfirmheader] CHECK CONSTRAINT [FK_losrebateconfirmheader_losrebaterequest]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losrebaterequest' AND CONSTRAINT_NAME= 'FK_losrebaterequest_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losrebaterequest] WITH CHECK ADD  CONSTRAINT [FK_losrebaterequest_AsalesPersonmaster] FOREIGN KEY ([rrsalespersonid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losrebaterequest] CHECK CONSTRAINT [FK_losrebaterequest_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losrebaterequest' AND CONSTRAINT_NAME= 'FK_losrebaterequest_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [losrebaterequest] WITH CHECK ADD  CONSTRAINT [FK_losrebaterequest_LOsInvoiceHeader] FOREIGN KEY ([rrshopid],[rrpoid]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [losrebaterequest] CHECK CONSTRAINT [FK_losrebaterequest_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND CONSTRAINT_NAME= 'FK_LOsReceiptVoucherDetails_LOsAccountsInvoiceHeader')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_LOsReceiptVoucherDetails_LOsAccountsInvoiceHeader] FOREIGN KEY ([rdShopID],[rdAccountsInvoiceID]) REFERENCES LOsAccountsInvoiceHeader([aiShopID],[aiInvoiceID])
END
GO
 ALTER TABLE [LOsReceiptVoucherDetails] CHECK CONSTRAINT [FK_LOsReceiptVoucherDetails_LOsAccountsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND CONSTRAINT_NAME= 'FK_LOsReceiptVoucherDetails_LOsInvoiceHeader')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_LOsReceiptVoucherDetails_LOsInvoiceHeader] FOREIGN KEY ([rdShopID],[rdInvoiceID]) REFERENCES LOsInvoiceHeader([ihShopID],[ihInvoiceID])
END
GO
 ALTER TABLE [LOsReceiptVoucherDetails] CHECK CONSTRAINT [FK_LOsReceiptVoucherDetails_LOsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND CONSTRAINT_NAME= 'FK_LOsReceiptVoucherDetails_LOsReceiptVoucherHeader')
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_LOsReceiptVoucherDetails_LOsReceiptVoucherHeader] FOREIGN KEY ([rdReceiptID],[rdShopID]) REFERENCES LOsReceiptVoucherHeader([rhReceiptID],[rhShopID])
END
GO
 ALTER TABLE [LOsReceiptVoucherDetails] CHECK CONSTRAINT [FK_LOsReceiptVoucherDetails_LOsReceiptVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND CONSTRAINT_NAME= 'FK_LOsReceiptVoucherHeader_aAccountMaster')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsReceiptVoucherHeader_aAccountMaster] FOREIGN KEY ([rhBankCashAccountID],[rhCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [LOsReceiptVoucherHeader] CHECK CONSTRAINT [FK_LOsReceiptVoucherHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND CONSTRAINT_NAME= 'FK_LOsReceiptVoucherHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsReceiptVoucherHeader_aCompanyMaster] FOREIGN KEY ([rhCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [LOsReceiptVoucherHeader] CHECK CONSTRAINT [FK_LOsReceiptVoucherHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND CONSTRAINT_NAME= 'FK_LOsReceiptVoucherHeader_aShops')
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsReceiptVoucherHeader_aShops] FOREIGN KEY ([rhShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOsReceiptVoucherHeader] CHECK CONSTRAINT [FK_LOsReceiptVoucherHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacereceivedetails' AND CONSTRAINT_NAME= 'FK_LOSREPLA_REF_686_LOSREPLA')
BEGIN
	ALTER TABLE [losreplacereceivedetails] WITH CHECK ADD  CONSTRAINT [FK_LOSREPLA_REF_686_LOSREPLA] FOREIGN KEY ([reprecdid],[reprecdcompanyid],[reprecdshopid]) REFERENCES losreplacereceiveheader([reprechid],[reprechcompanyid],[reprechshopid])
END
GO
 ALTER TABLE [losreplacereceivedetails] CHECK CONSTRAINT [FK_LOSREPLA_REF_686_LOSREPLA]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacereceivedetails' AND CONSTRAINT_NAME= 'FK_losreplacereceivedetails_aItem')
BEGIN
	ALTER TABLE [losreplacereceivedetails] WITH CHECK ADD  CONSTRAINT [FK_losreplacereceivedetails_aItem] FOREIGN KEY ([reprecditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losreplacereceivedetails] CHECK CONSTRAINT [FK_losreplacereceivedetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacereceiveheader' AND CONSTRAINT_NAME= 'fk_losreplacereceiveheader_areprecvendorheader')
BEGIN
	ALTER TABLE [losreplacereceiveheader] WITH CHECK ADD  CONSTRAINT [fk_losreplacereceiveheader_areprecvendorheader] FOREIGN KEY ([reprechcompanyid],[reprechqreceiveid]) REFERENCES areprecvendorheader([rrvhcompanyid],[rrvhreceiveid])
END
GO
 ALTER TABLE [losreplacereceiveheader] CHECK CONSTRAINT [fk_losreplacereceiveheader_areprecvendorheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacereceiveheader' AND CONSTRAINT_NAME= 'FK_losreplacereceiveheader_aShops')
BEGIN
	ALTER TABLE [losreplacereceiveheader] WITH CHECK ADD  CONSTRAINT [FK_losreplacereceiveheader_aShops] FOREIGN KEY ([reprechshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losreplacereceiveheader] CHECK CONSTRAINT [FK_losreplacereceiveheader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacerequestdetails' AND CONSTRAINT_NAME= 'FK_LOSREPLA_REF_637_LOSSERVI')
BEGIN
	ALTER TABLE [losreplacerequestdetails] WITH CHECK ADD  CONSTRAINT [FK_LOSREPLA_REF_637_LOSSERVI] FOREIGN KEY ([repreqdbookid],[repreqdshopid],[repreqdcompanyid]) REFERENCES losServiceBookingHeader([serbookhid],[serbookhshopid],[serbookhcompanyid])
END
GO
 ALTER TABLE [losreplacerequestdetails] CHECK CONSTRAINT [FK_LOSREPLA_REF_637_LOSSERVI]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacerequestdetails' AND CONSTRAINT_NAME= 'FK_LOSREPLA_REF_656_LOSREPLA')
BEGIN
	ALTER TABLE [losreplacerequestdetails] WITH CHECK ADD  CONSTRAINT [FK_LOSREPLA_REF_656_LOSREPLA] FOREIGN KEY ([repreqdid],[repreqdcompanyid],[repreqdshopid]) REFERENCES losreplacerequestheader([repreqhid],[repreqhcompanyid],[repreqshopid])
END
GO
 ALTER TABLE [losreplacerequestdetails] CHECK CONSTRAINT [FK_LOSREPLA_REF_656_LOSREPLA]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacerequestdetails' AND CONSTRAINT_NAME= 'FK_losreplacerequestdetails_aItem')
BEGIN
	ALTER TABLE [losreplacerequestdetails] WITH CHECK ADD  CONSTRAINT [FK_losreplacerequestdetails_aItem] FOREIGN KEY ([repreqditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losreplacerequestdetails] CHECK CONSTRAINT [FK_losreplacerequestdetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacerequestheader' AND CONSTRAINT_NAME= 'fk_losreplacerequestheader_adepartmentmaster')
BEGIN
	ALTER TABLE [losreplacerequestheader] WITH CHECK ADD  CONSTRAINT [fk_losreplacerequestheader_adepartmentmaster] FOREIGN KEY ([repreqhdepartmentid],[repreqhcompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losreplacerequestheader] CHECK CONSTRAINT [fk_losreplacerequestheader_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losreplacerequestheader' AND CONSTRAINT_NAME= 'FK_losreplacerequestheader_aShops')
BEGIN
	ALTER TABLE [losreplacerequestheader] WITH CHECK ADD  CONSTRAINT [FK_losreplacerequestheader_aShops] FOREIGN KEY ([repreqshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losreplacerequestheader] CHECK CONSTRAINT [FK_losreplacerequestheader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosReserveItem' AND CONSTRAINT_NAME= 'FK_LosReserveItem_aGodown')
BEGIN
	ALTER TABLE [LosReserveItem] WITH CHECK ADD  CONSTRAINT [FK_LosReserveItem_aGodown] FOREIGN KEY ([godownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LosReserveItem] CHECK CONSTRAINT [FK_LosReserveItem_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosReserveItem' AND CONSTRAINT_NAME= 'FK_LosReserveItem_aItem')
BEGIN
	ALTER TABLE [LosReserveItem] WITH CHECK ADD  CONSTRAINT [FK_LosReserveItem_aItem] FOREIGN KEY ([itemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LosReserveItem] CHECK CONSTRAINT [FK_LosReserveItem_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losserconditiondetails' AND CONSTRAINT_NAME= 'FK_LOSSERCO_REF_221_LOSSERVI')
BEGIN
	ALTER TABLE [losserconditiondetails] WITH CHECK ADD  CONSTRAINT [FK_LOSSERCO_REF_221_LOSSERVI] FOREIGN KEY ([cndserbookdid],[cndserdshopid],[cndserdcompanyid]) REFERENCES losServiceBookingHeader([serbookhid],[serbookhshopid],[serbookhcompanyid])
END
GO
 ALTER TABLE [losserconditiondetails] CHECK CONSTRAINT [FK_LOSSERCO_REF_221_LOSSERVI]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losserconditiondetails' AND CONSTRAINT_NAME= 'FK_losserconditiondetails_aproductconditionmaster')
BEGIN
	ALTER TABLE [losserconditiondetails] WITH CHECK ADD  CONSTRAINT [FK_losserconditiondetails_aproductconditionmaster] FOREIGN KEY ([cndserdcompanyid],[cndserid]) REFERENCES aproductconditionmaster([prodcndcompanyid],[prodcndid])
END
GO
 ALTER TABLE [losserconditiondetails] CHECK CONSTRAINT [FK_losserconditiondetails_aproductconditionmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerestimateapproval' AND CONSTRAINT_NAME= 'FK_losSerestimateapproval_losservicebookingheader')
BEGIN
	ALTER TABLE [losSerestimateapproval] WITH CHECK ADD  CONSTRAINT [FK_losSerestimateapproval_losservicebookingheader] FOREIGN KEY ([seaAppbookingId],[seaAppShopId],[seaAppcompanyID]) REFERENCES losServiceBookingHeader([serbookhid],[serbookhshopid],[serbookhcompanyid])
END
GO
 ALTER TABLE [losSerestimateapproval] CHECK CONSTRAINT [FK_losSerestimateapproval_losservicebookingheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceContractDetail_acompanymaster')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceContractDetail_acompanymaster] FOREIGN KEY ([mcdCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [losSerMaintenanceContractDetail] CHECK CONSTRAINT [fk_losSerMaintenanceContractDetail_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceContractDetail_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceContractDetail_AsalesPersonmaster] FOREIGN KEY ([mcdPrepByID]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losSerMaintenanceContractDetail] CHECK CONSTRAINT [fk_losSerMaintenanceContractDetail_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceContractDetail' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceContractDetail_losSerMaintenanceContractHeader')
BEGIN
	ALTER TABLE [losSerMaintenanceContractDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceContractDetail_losSerMaintenanceContractHeader] FOREIGN KEY ([mcdCompanyID],[mcdID],[mcdShopID]) REFERENCES losSerMaintenanceContractHeader([mchCompanyID],[mchID],[mchShopID])
END
GO
 ALTER TABLE [losSerMaintenanceContractDetail] CHECK CONSTRAINT [fk_losSerMaintenanceContractDetail_losSerMaintenanceContractHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceContractHeader_acompanymaster')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceContractHeader_acompanymaster] FOREIGN KEY ([mchCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [losSerMaintenanceContractHeader] CHECK CONSTRAINT [fk_losSerMaintenanceContractHeader_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceContractHeader_acustomermaster')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceContractHeader_acustomermaster] FOREIGN KEY ([mchCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [losSerMaintenanceContractHeader] CHECK CONSTRAINT [fk_losSerMaintenanceContractHeader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceContractHeader_ashops')
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceContractHeader_ashops] FOREIGN KEY ([mchShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losSerMaintenanceContractHeader] CHECK CONSTRAINT [fk_losSerMaintenanceContractHeader_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceMachineDetail_aItem')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceMachineDetail_aItem] FOREIGN KEY ([mmdMachineID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losSerMaintenanceMachineDetail] CHECK CONSTRAINT [fk_losSerMaintenanceMachineDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceMachineDetail' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceMachineDetail_losSerMaintenanceContractHeader')
BEGIN
	ALTER TABLE [losSerMaintenanceMachineDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceMachineDetail_losSerMaintenanceContractHeader] FOREIGN KEY ([mmdCompanyID],[mmdMCID],[mmdShopID]) REFERENCES losSerMaintenanceContractHeader([mchCompanyID],[mchID],[mchShopID])
END
GO
 ALTER TABLE [losSerMaintenanceMachineDetail] CHECK CONSTRAINT [fk_losSerMaintenanceMachineDetail_losSerMaintenanceContractHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceServiceDetail_aItem')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceServiceDetail_aItem] FOREIGN KEY ([msdMachineID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losSerMaintenanceServiceDetail] CHECK CONSTRAINT [fk_losSerMaintenanceServiceDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceServiceDetail_aservicemaster')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceServiceDetail_aservicemaster] FOREIGN KEY ([msdServiceID],[msdCompanyID]) REFERENCES aservicemaster([serid],[sercompanyid])
END
GO
 ALTER TABLE [losSerMaintenanceServiceDetail] CHECK CONSTRAINT [fk_losSerMaintenanceServiceDetail_aservicemaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND CONSTRAINT_NAME= 'fk_losSerMaintenanceServiceDetail_losSerMaintenanceContractHeader')
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerMaintenanceServiceDetail_losSerMaintenanceContractHeader] FOREIGN KEY ([msdCompanyID],[msdMCID],[msdShopID]) REFERENCES losSerMaintenanceContractHeader([mchCompanyID],[mchID],[mchShopID])
END
GO
 ALTER TABLE [losSerMaintenanceServiceDetail] CHECK CONSTRAINT [fk_losSerMaintenanceServiceDetail_losSerMaintenanceContractHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losserpartsfromcustomer' AND CONSTRAINT_NAME= 'FK_LOSSERPA_REF_312_LOSSERVI')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] WITH CHECK ADD  CONSTRAINT [FK_LOSSERPA_REF_312_LOSSERVI] FOREIGN KEY ([custprodbookingid],[custprodshopid],[custprodcompanyid]) REFERENCES losServiceBookingHeader([serbookhid],[serbookhshopid],[serbookhcompanyid])
END
GO
 ALTER TABLE [losserpartsfromcustomer] CHECK CONSTRAINT [FK_LOSSERPA_REF_312_LOSSERVI]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losserpartsfromcustomer' AND CONSTRAINT_NAME= 'FK_losserpartsfromcustomer_aItem')
BEGIN
	ALTER TABLE [losserpartsfromcustomer] WITH CHECK ADD  CONSTRAINT [FK_losserpartsfromcustomer_aItem] FOREIGN KEY ([custprodproductid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losserpartsfromcustomer] CHECK CONSTRAINT [FK_losserpartsfromcustomer_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND CONSTRAINT_NAME= 'fk_losSerStandByIssueDetail_aItem')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByIssueDetail_aItem] FOREIGN KEY ([isdMachineID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losSerStandByIssueDetail] CHECK CONSTRAINT [fk_losSerStandByIssueDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByIssueDetail' AND CONSTRAINT_NAME= 'fk_losSerStandByIssueDetail_losSerStandByIssueHeader')
BEGIN
	ALTER TABLE [losSerStandByIssueDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByIssueDetail_losSerStandByIssueHeader] FOREIGN KEY ([isdCompanyID],[isdIssueID],[isdShopID]) REFERENCES losSerStandByIssueHeader([ishCompanyID],[ishIssueID],[ishShopID])
END
GO
 ALTER TABLE [losSerStandByIssueDetail] CHECK CONSTRAINT [fk_losSerStandByIssueDetail_losSerStandByIssueHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND CONSTRAINT_NAME= 'fk_losSerStandByReceiptDetail_aItem')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByReceiptDetail_aItem] FOREIGN KEY ([rdMachineID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losSerStandByReceiptDetail] CHECK CONSTRAINT [fk_losSerStandByReceiptDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByReceiptDetail' AND CONSTRAINT_NAME= 'fk_losSerStandByReceiptDetail_losSerStandByReceiptHeader')
BEGIN
	ALTER TABLE [losSerStandByReceiptDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByReceiptDetail_losSerStandByReceiptHeader] FOREIGN KEY ([rdCompanyID],[rdShopID],[rdReceiptID]) REFERENCES losSerStandByReceiptHeader([rhCompanyID],[rhShopID],[rhReceiptID])
END
GO
 ALTER TABLE [losSerStandByReceiptDetail] CHECK CONSTRAINT [fk_losSerStandByReceiptDetail_losSerStandByReceiptHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND CONSTRAINT_NAME= 'fk_losSerStandByRequestDetail_aItem')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByRequestDetail_aItem] FOREIGN KEY ([reqdMachineID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losSerStandByRequestDetail] CHECK CONSTRAINT [fk_losSerStandByRequestDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByRequestDetail' AND CONSTRAINT_NAME= 'fk_losSerStandByRequestDetail_losSerStandByRequestHeader')
BEGIN
	ALTER TABLE [losSerStandByRequestDetail] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByRequestDetail_losSerStandByRequestHeader] FOREIGN KEY ([reqdCompanyID],[reqdRequestID],[reqdShopID]) REFERENCES losSerStandByRequestHeader([reqhCompanyID],[reqhRequestID],[reqhShopID])
END
GO
 ALTER TABLE [losSerStandByRequestDetail] CHECK CONSTRAINT [fk_losSerStandByRequestDetail_losSerStandByRequestHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND CONSTRAINT_NAME= 'fk_losSerStandByRequestHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByRequestHeader_aCompanyMaster] FOREIGN KEY ([reqhCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [losSerStandByRequestHeader] CHECK CONSTRAINT [fk_losSerStandByRequestHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND CONSTRAINT_NAME= 'fk_losSerStandByRequestHeader_aCustomerMaster')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByRequestHeader_aCustomerMaster] FOREIGN KEY ([reqhCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [losSerStandByRequestHeader] CHECK CONSTRAINT [fk_losSerStandByRequestHeader_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND CONSTRAINT_NAME= 'fk_losSerStandByRequestHeader_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByRequestHeader_AsalesPersonmaster] FOREIGN KEY ([reqhApprovedByID]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losSerStandByRequestHeader] CHECK CONSTRAINT [fk_losSerStandByRequestHeader_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND CONSTRAINT_NAME= 'fk_losSerStandByRequestHeader_aShops')
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] WITH CHECK ADD  CONSTRAINT [fk_losSerStandByRequestHeader_aShops] FOREIGN KEY ([reqhShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losSerStandByRequestHeader] CHECK CONSTRAINT [fk_losSerStandByRequestHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND CONSTRAINT_NAME= 'FK_lossertoolsallocationdetail_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] WITH CHECK ADD  CONSTRAINT [FK_lossertoolsallocationdetail_AsalesPersonmaster] FOREIGN KEY ([alcdtechnicianid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losSerToolsAllocationDetail] CHECK CONSTRAINT [FK_lossertoolsallocationdetail_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND CONSTRAINT_NAME= 'fk_LosserToolsAllocationDetail_FixedAsset')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] WITH CHECK ADD  CONSTRAINT [fk_LosserToolsAllocationDetail_FixedAsset] FOREIGN KEY ([alcdtoolsid],[alcdCompanyId]) REFERENCES FixedAsset([FixedAssetID],[CompanyID])
END
GO
 ALTER TABLE [losSerToolsAllocationDetail] CHECK CONSTRAINT [fk_LosserToolsAllocationDetail_FixedAsset]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerToolsAllocationDetail' AND CONSTRAINT_NAME= 'FK_lossertoolsallocationdetail_lossertoolsallocationheader')
BEGIN
	ALTER TABLE [losSerToolsAllocationDetail] WITH CHECK ADD  CONSTRAINT [FK_lossertoolsallocationdetail_lossertoolsallocationheader] FOREIGN KEY ([alcdCompanyId],[alcdShopid],[alcdid]) REFERENCES losSerToolsAllocationHeader([alchCompanyId],[alchShopid],[alchid])
END
GO
 ALTER TABLE [losSerToolsAllocationDetail] CHECK CONSTRAINT [FK_lossertoolsallocationdetail_lossertoolsallocationheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND CONSTRAINT_NAME= 'fk_LosserToolsAllocationHeader')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] WITH CHECK ADD  CONSTRAINT [fk_LosserToolsAllocationHeader] FOREIGN KEY ([alchShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losSerToolsAllocationHeader] CHECK CONSTRAINT [fk_LosserToolsAllocationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND CONSTRAINT_NAME= 'fk_LosserToolsAllocationHeader_acompanymaster')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] WITH CHECK ADD  CONSTRAINT [fk_LosserToolsAllocationHeader_acompanymaster] FOREIGN KEY ([alchCompanyId]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [losSerToolsAllocationHeader] CHECK CONSTRAINT [fk_LosserToolsAllocationHeader_acompanymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSerToolsAllocationHeader' AND CONSTRAINT_NAME= 'FK_lossertoolsallocationheader_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losSerToolsAllocationHeader] WITH CHECK ADD  CONSTRAINT [FK_lossertoolsallocationheader_AsalesPersonmaster] FOREIGN KEY ([alchtechnicianid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losSerToolsAllocationHeader] CHECK CONSTRAINT [FK_lossertoolsallocationheader_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosserToolsReturnHeader' AND CONSTRAINT_NAME= 'fk_LosserToolsReturnHeader_LosserToolsAllocationHeader')
BEGIN
	ALTER TABLE [LosserToolsReturnHeader] WITH CHECK ADD  CONSTRAINT [fk_LosserToolsReturnHeader_LosserToolsAllocationHeader] FOREIGN KEY ([tlrethCompanyId],[tlrethShopid],[tlrethallocid]) REFERENCES losSerToolsAllocationHeader([alchCompanyId],[alchShopid],[alchid])
END
GO
 ALTER TABLE [LosserToolsReturnHeader] CHECK CONSTRAINT [fk_LosserToolsReturnHeader_LosserToolsAllocationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losServiceBookingHeader' AND CONSTRAINT_NAME= 'fk_losservicebookingheader_adepartmentmaster')
BEGIN
	ALTER TABLE [losServiceBookingHeader] WITH CHECK ADD  CONSTRAINT [fk_losservicebookingheader_adepartmentmaster] FOREIGN KEY ([serbookhdepartmentid],[serbookhcompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losServiceBookingHeader] CHECK CONSTRAINT [fk_losservicebookingheader_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losServiceBookingHeader' AND CONSTRAINT_NAME= 'fk_LosServiceBookingHeader_losCallBookingHeader')
BEGIN
	ALTER TABLE [losServiceBookingHeader] WITH CHECK ADD  CONSTRAINT [fk_LosServiceBookingHeader_losCallBookingHeader] FOREIGN KEY ([serbookhRefId],[serbookhshopid],[serbookhcompanyid]) REFERENCES losCallBookingHeader([serCallBkhid],[serCallBkhshopid],[serCallBkhcompanyid])
END
GO
 ALTER TABLE [losServiceBookingHeader] CHECK CONSTRAINT [fk_LosServiceBookingHeader_losCallBookingHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losServiceHeader' AND CONSTRAINT_NAME= 'fk_losserviceheader_adepartmentmaster')
BEGIN
	ALTER TABLE [losServiceHeader] WITH CHECK ADD  CONSTRAINT [fk_losserviceheader_adepartmentmaster] FOREIGN KEY ([serinvhdepartmentid],[serinvhcompanyid]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losServiceHeader] CHECK CONSTRAINT [fk_losserviceheader_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losServiceHeader' AND CONSTRAINT_NAME= 'fk_losserviceheader_aitem')
BEGIN
	ALTER TABLE [losServiceHeader] WITH CHECK ADD  CONSTRAINT [fk_losserviceheader_aitem] FOREIGN KEY ([serinvhitemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losServiceHeader] CHECK CONSTRAINT [fk_losserviceheader_aitem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losServiceHeader' AND CONSTRAINT_NAME= 'FK_losserviceheader_aShops')
BEGIN
	ALTER TABLE [losServiceHeader] WITH CHECK ADD  CONSTRAINT [FK_losserviceheader_aShops] FOREIGN KEY ([serinvhshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losServiceHeader] CHECK CONSTRAINT [FK_losserviceheader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losServiceHeader' AND CONSTRAINT_NAME= 'fk_losserviceheader_losservicebookingheader')
BEGIN
	ALTER TABLE [losServiceHeader] WITH CHECK ADD  CONSTRAINT [fk_losserviceheader_losservicebookingheader] FOREIGN KEY ([serinvhbookingid],[serinvhshopid],[serinvhcompanyid]) REFERENCES losServiceBookingHeader([serbookhid],[serbookhshopid],[serbookhcompanyid])
END
GO
 ALTER TABLE [losServiceHeader] CHECK CONSTRAINT [fk_losserviceheader_losservicebookingheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND CONSTRAINT_NAME= 'FK_LOsServiceInvoiceDetails_LOsAccountsInvoiceHeader')
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] WITH CHECK ADD  CONSTRAINT [FK_LOsServiceInvoiceDetails_LOsAccountsInvoiceHeader] FOREIGN KEY ([siShopID],[siInvoiceID]) REFERENCES LOsAccountsInvoiceHeader([aiShopID],[aiInvoiceID])
END
GO
 ALTER TABLE [LOsServiceInvoiceDetails] CHECK CONSTRAINT [FK_LOsServiceInvoiceDetails_LOsAccountsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND CONSTRAINT_NAME= 'FK_losservinvoicetechniciandetails_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] WITH CHECK ADD  CONSTRAINT [FK_losservinvoicetechniciandetails_AsalesPersonmaster] FOREIGN KEY ([serinvtechid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losservinvoicetechniciandetails] CHECK CONSTRAINT [FK_losservinvoicetechniciandetails_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND CONSTRAINT_NAME= 'fk_losservinvoicetechniciandetails_aservicemaster')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] WITH CHECK ADD  CONSTRAINT [fk_losservinvoicetechniciandetails_aservicemaster] FOREIGN KEY ([serinvTechServiceID],[serinvtechcompanyid]) REFERENCES aservicemaster([serid],[sercompanyid])
END
GO
 ALTER TABLE [losservinvoicetechniciandetails] CHECK CONSTRAINT [fk_losservinvoicetechniciandetails_aservicemaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND CONSTRAINT_NAME= 'FK_losservinvoicetechniciandetails_losserviceheader')
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] WITH CHECK ADD  CONSTRAINT [FK_losservinvoicetechniciandetails_losserviceheader] FOREIGN KEY ([sertechinvid],[serinvtechcompanyid],[serinvtechshopid]) REFERENCES losServiceHeader([serinvhid],[serinvhcompanyid],[serinvhshopid])
END
GO
 ALTER TABLE [losservinvoicetechniciandetails] CHECK CONSTRAINT [FK_losservinvoicetechniciandetails_losserviceheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsSettings' AND CONSTRAINT_NAME= 'fk_lossettings_ashops')
BEGIN
	ALTER TABLE [LOsSettings] WITH CHECK ADD  CONSTRAINT [fk_lossettings_ashops] FOREIGN KEY ([ShopId]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOsSettings] CHECK CONSTRAINT [fk_lossettings_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosShipmentbndetail' AND CONSTRAINT_NAME= 'FK_LosShipmentbndetail_LosShipmentbnheader')
BEGIN
	ALTER TABLE [LosShipmentbndetail] WITH CHECK ADD  CONSTRAINT [FK_LosShipmentbndetail_LosShipmentbnheader] FOREIGN KEY ([bndShopId],[bndboatnoteId]) REFERENCES LosShipmentbnheader([bnhShopId],[bnhboatnoteId])
END
GO
 ALTER TABLE [LosShipmentbndetail] CHECK CONSTRAINT [FK_LosShipmentbndetail_LosShipmentbnheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LosShipmentbnheader' AND CONSTRAINT_NAME= 'FK_LosShipmentbnheader_aCustomerMaster')
BEGIN
	ALTER TABLE [LosShipmentbnheader] WITH CHECK ADD  CONSTRAINT [FK_LosShipmentbnheader_aCustomerMaster] FOREIGN KEY ([bnhCustomerId]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [LosShipmentbnheader] CHECK CONSTRAINT [FK_LosShipmentbnheader_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShipmentBNOCDetail' AND CONSTRAINT_NAME= 'fk_losShipmentOCDetail_losShipmentBNHeader')
BEGIN
	ALTER TABLE [losShipmentBNOCDetail] WITH CHECK ADD  CONSTRAINT [fk_losShipmentOCDetail_losShipmentBNHeader] FOREIGN KEY ([ShopID],[BoatNoteID]) REFERENCES LosShipmentbnheader([bnhShopId],[bnhboatnoteId])
END
GO
 ALTER TABLE [losShipmentBNOCDetail] CHECK CONSTRAINT [fk_losShipmentOCDetail_losShipmentBNHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND CONSTRAINT_NAME= 'FK_LOsShopDamageClearingDetails_aItem')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] WITH CHECK ADD  CONSTRAINT [FK_LOsShopDamageClearingDetails_aItem] FOREIGN KEY ([dcdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOsShopDamageClearingDetails] CHECK CONSTRAINT [FK_LOsShopDamageClearingDetails_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND CONSTRAINT_NAME= 'FK_LOsShopDamageClearingDetails_LOsShopDamageClearingHeader')
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] WITH CHECK ADD  CONSTRAINT [FK_LOsShopDamageClearingDetails_LOsShopDamageClearingHeader] FOREIGN KEY ([dcdClearingID],[dcdShopid]) REFERENCES LOsShopDamageClearingHeader([dchClearingID],[dchShopid])
END
GO
 ALTER TABLE [LOsShopDamageClearingDetails] CHECK CONSTRAINT [FK_LOsShopDamageClearingDetails_LOsShopDamageClearingHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND CONSTRAINT_NAME= 'FK_LOsShopDamageClearingHeader_aShops')
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsShopDamageClearingHeader_aShops] FOREIGN KEY ([dchShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOsShopDamageClearingHeader] CHECK CONSTRAINT [FK_LOsShopDamageClearingHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND CONSTRAINT_NAME= 'FK_losShopItemShipmentDetail_aCurrencyMaster')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] WITH NOCHECK ADD  CONSTRAINT [FK_losShopItemShipmentDetail_aCurrencyMaster] FOREIGN KEY ([currencyid],[companyid]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [losShopItemShipmentDetail] CHECK CONSTRAINT [FK_losShopItemShipmentDetail_aCurrencyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND CONSTRAINT_NAME= 'FK_losShopItemShipmentDetail_aItem')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] WITH NOCHECK ADD  CONSTRAINT [FK_losShopItemShipmentDetail_aItem] FOREIGN KEY ([itemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losShopItemShipmentDetail] CHECK CONSTRAINT [FK_losShopItemShipmentDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND CONSTRAINT_NAME= 'FK_losShopItemShipmentDetail_aPackingType')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] WITH NOCHECK ADD  CONSTRAINT [FK_losShopItemShipmentDetail_aPackingType] FOREIGN KEY ([PackingTypeid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [losShopItemShipmentDetail] CHECK CONSTRAINT [FK_losShopItemShipmentDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND CONSTRAINT_NAME= 'fk_losshopitemshipmentdetail_asegmentmaster')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] WITH NOCHECK ADD  CONSTRAINT [fk_losshopitemshipmentdetail_asegmentmaster] FOREIGN KEY ([companyid],[segmentid]) REFERENCES ASegmentMaster([companyid],[Segmentid])
END
GO
 ALTER TABLE [losShopItemShipmentDetail] CHECK CONSTRAINT [fk_losshopitemshipmentdetail_asegmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND CONSTRAINT_NAME= 'FK_losShopItemShipmentDetail_aShops')
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] WITH NOCHECK ADD  CONSTRAINT [FK_losShopItemShipmentDetail_aShops] FOREIGN KEY ([shopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losShopItemShipmentDetail] CHECK CONSTRAINT [FK_losShopItemShipmentDetail_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationDetail' AND CONSTRAINT_NAME= 'FK_losSIQuotationDetail_aGodown')
BEGIN
	ALTER TABLE [losSIQuotationDetail] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationDetail_aGodown] FOREIGN KEY ([idGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [losSIQuotationDetail] CHECK CONSTRAINT [FK_losSIQuotationDetail_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationDetail' AND CONSTRAINT_NAME= 'FK_losSIQuotationDetail_aItem')
BEGIN
	ALTER TABLE [losSIQuotationDetail] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationDetail_aItem] FOREIGN KEY ([idItemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losSIQuotationDetail] CHECK CONSTRAINT [FK_losSIQuotationDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationDetail' AND CONSTRAINT_NAME= 'FK_losSIQuotationDetail_aPackingType')
BEGIN
	ALTER TABLE [losSIQuotationDetail] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationDetail_aPackingType] FOREIGN KEY ([idPackingTypeid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [losSIQuotationDetail] CHECK CONSTRAINT [FK_losSIQuotationDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationDetail' AND CONSTRAINT_NAME= 'fk_losSIQuotationDetail_ashipment')
BEGIN
	ALTER TABLE [losSIQuotationDetail] WITH CHECK ADD  CONSTRAINT [fk_losSIQuotationDetail_ashipment] FOREIGN KEY ([shipmentid]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [losSIQuotationDetail] CHECK CONSTRAINT [fk_losSIQuotationDetail_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationDetail' AND CONSTRAINT_NAME= 'FK_losSIQuotationDetail_losSIQuotationHeader')
BEGIN
	ALTER TABLE [losSIQuotationDetail] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationDetail_losSIQuotationHeader] FOREIGN KEY ([idInvoiceId],[idShopid]) REFERENCES losSIQuotationHeader([IhInvoiceID],[IhShopID])
END
GO
 ALTER TABLE [losSIQuotationDetail] CHECK CONSTRAINT [FK_losSIQuotationDetail_losSIQuotationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'FK_losSIQuotationHeader_aAccountMaster')
BEGIN
	ALTER TABLE [losSIQuotationHeader] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationHeader_aAccountMaster] FOREIGN KEY ([IhBankcashAccID],[IhCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losSIQuotationHeader] CHECK CONSTRAINT [FK_losSIQuotationHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'FK_losSIQuotationHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [losSIQuotationHeader] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationHeader_aAccountMaster1] FOREIGN KEY ([IhDiscountAccID],[IhCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losSIQuotationHeader] CHECK CONSTRAINT [FK_losSIQuotationHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'fk_losSIQuotationHeader_aaccountmaster5')
BEGIN
	ALTER TABLE [losSIQuotationHeader] WITH CHECK ADD  CONSTRAINT [fk_losSIQuotationHeader_aaccountmaster5] FOREIGN KEY ([IhSalesAccID],[IhCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losSIQuotationHeader] CHECK CONSTRAINT [fk_losSIQuotationHeader_aaccountmaster5]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'fk_losSIQuotationHeader_acustomermaster')
BEGIN
	ALTER TABLE [losSIQuotationHeader] WITH CHECK ADD  CONSTRAINT [fk_losSIQuotationHeader_acustomermaster] FOREIGN KEY ([IhCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [losSIQuotationHeader] CHECK CONSTRAINT [fk_losSIQuotationHeader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'FK_losSIQuotationHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [losSIQuotationHeader] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationHeader_aDepartmentMaster] FOREIGN KEY ([IhDepartmentID],[IhCompanyId]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losSIQuotationHeader] CHECK CONSTRAINT [FK_losSIQuotationHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'FK_losSIQuotationHeader_aFinancialYear')
BEGIN
	ALTER TABLE [losSIQuotationHeader] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationHeader_aFinancialYear] FOREIGN KEY ([IhFinancialID],[IhCompanyId]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [losSIQuotationHeader] CHECK CONSTRAINT [FK_losSIQuotationHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'FK_losSIQuotationHeader_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losSIQuotationHeader] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationHeader_AsalesPersonmaster] FOREIGN KEY ([ihsalespersonid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losSIQuotationHeader] CHECK CONSTRAINT [FK_losSIQuotationHeader_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'FK_losSIQuotationHeader_aShops')
BEGIN
	ALTER TABLE [losSIQuotationHeader] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationHeader_aShops] FOREIGN KEY ([IhShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losSIQuotationHeader] CHECK CONSTRAINT [FK_losSIQuotationHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSIQuotationHeader' AND CONSTRAINT_NAME= 'FK_losSIQuotationHeader_CashBox')
BEGIN
	ALTER TABLE [losSIQuotationHeader] WITH CHECK ADD  CONSTRAINT [FK_losSIQuotationHeader_CashBox] FOREIGN KEY ([ihcbid],[IhShopID]) REFERENCES CashBox([CBID],[CBShopID])
END
GO
 ALTER TABLE [losSIQuotationHeader] CHECK CONSTRAINT [FK_losSIQuotationHeader_CashBox]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceDetail_aGodown')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceDetail_aGodown] FOREIGN KEY ([idGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [losSpecialInvoiceDetail] CHECK CONSTRAINT [FK_losSpecialInvoiceDetail_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceDetail_aItem')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceDetail_aItem] FOREIGN KEY ([idItemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losSpecialInvoiceDetail] CHECK CONSTRAINT [FK_losSpecialInvoiceDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceDetail_aPackingType')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceDetail_aPackingType] FOREIGN KEY ([idPackingTypeid]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [losSpecialInvoiceDetail] CHECK CONSTRAINT [FK_losSpecialInvoiceDetail_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND CONSTRAINT_NAME= 'fk_losSpecialInvoiceDetail_ashipment')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] WITH CHECK ADD  CONSTRAINT [fk_losSpecialInvoiceDetail_ashipment] FOREIGN KEY ([shipmentid]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [losSpecialInvoiceDetail] CHECK CONSTRAINT [fk_losSpecialInvoiceDetail_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceDetail_losSpecialInvoiceHeader')
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceDetail_losSpecialInvoiceHeader] FOREIGN KEY ([idInvoiceId],[idShopid]) REFERENCES losSpecialInvoiceHeader([IhInvoiceID],[IhShopID])
END
GO
 ALTER TABLE [losSpecialInvoiceDetail] CHECK CONSTRAINT [FK_losSpecialInvoiceDetail_losSpecialInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceHeader_aAccountMaster')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceHeader_aAccountMaster] FOREIGN KEY ([IhBankcashAccID],[IhCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losSpecialInvoiceHeader] CHECK CONSTRAINT [FK_losSpecialInvoiceHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceHeader_aAccountMaster1] FOREIGN KEY ([IhDiscountAccID],[IhCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losSpecialInvoiceHeader] CHECK CONSTRAINT [FK_losSpecialInvoiceHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'fk_losSpecialInvoiceHeader_aaccountmaster5')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] WITH CHECK ADD  CONSTRAINT [fk_losSpecialInvoiceHeader_aaccountmaster5] FOREIGN KEY ([IhSalesAccID],[IhCompanyId]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losSpecialInvoiceHeader] CHECK CONSTRAINT [fk_losSpecialInvoiceHeader_aaccountmaster5]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'fk_losSpecialInvoiceHeader_acustomermaster')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] WITH CHECK ADD  CONSTRAINT [fk_losSpecialInvoiceHeader_acustomermaster] FOREIGN KEY ([IhCustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [losSpecialInvoiceHeader] CHECK CONSTRAINT [fk_losSpecialInvoiceHeader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceHeader_aDepartmentMaster] FOREIGN KEY ([IhDepartmentID],[IhCompanyId]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [losSpecialInvoiceHeader] CHECK CONSTRAINT [FK_losSpecialInvoiceHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceHeader_aFinancialYear')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceHeader_aFinancialYear] FOREIGN KEY ([IhFinancialID],[IhCompanyId]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [losSpecialInvoiceHeader] CHECK CONSTRAINT [FK_losSpecialInvoiceHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceHeader_AsalesPersonmaster')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceHeader_AsalesPersonmaster] FOREIGN KEY ([ihsalespersonid]) REFERENCES AsalesPersonmaster([Sperid])
END
GO
 ALTER TABLE [losSpecialInvoiceHeader] CHECK CONSTRAINT [FK_losSpecialInvoiceHeader_AsalesPersonmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceHeader_aShops')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceHeader_aShops] FOREIGN KEY ([IhShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losSpecialInvoiceHeader] CHECK CONSTRAINT [FK_losSpecialInvoiceHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND CONSTRAINT_NAME= 'FK_losSpecialInvoiceHeader_CashBox')
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] WITH CHECK ADD  CONSTRAINT [FK_losSpecialInvoiceHeader_CashBox] FOREIGN KEY ([ihcbid],[IhShopID]) REFERENCES CashBox([CBID],[CBShopID])
END
GO
 ALTER TABLE [losSpecialInvoiceHeader] CHECK CONSTRAINT [FK_losSpecialInvoiceHeader_CashBox]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialOC' AND CONSTRAINT_NAME= 'FK_losSpecialOC_aAccountMaster')
BEGIN
	ALTER TABLE [losSpecialOC] WITH CHECK ADD  CONSTRAINT [FK_losSpecialOC_aAccountMaster] FOREIGN KEY ([ioAccid],[ioCompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [losSpecialOC] CHECK CONSTRAINT [FK_losSpecialOC_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losSpecialOC' AND CONSTRAINT_NAME= 'FK_losSpecialOC_losSpecialInvoiceHeader')
BEGIN
	ALTER TABLE [losSpecialOC] WITH CHECK ADD  CONSTRAINT [FK_losSpecialOC_losSpecialInvoiceHeader] FOREIGN KEY ([ioInvoiceID],[ioShopid]) REFERENCES losSpecialInvoiceHeader([IhInvoiceID],[IhShopID])
END
GO
 ALTER TABLE [losSpecialOC] CHECK CONSTRAINT [FK_losSpecialOC_losSpecialInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockRecovery' AND CONSTRAINT_NAME= 'FK_losStockRecovery_aItem')
BEGIN
	ALTER TABLE [losStockRecovery] WITH CHECK ADD  CONSTRAINT [FK_losStockRecovery_aItem] FOREIGN KEY ([srItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losStockRecovery] CHECK CONSTRAINT [FK_losStockRecovery_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockRecovery' AND CONSTRAINT_NAME= 'FK_losStockRecovery_aItem1')
BEGIN
	ALTER TABLE [losStockRecovery] WITH CHECK ADD  CONSTRAINT [FK_losStockRecovery_aItem1] FOREIGN KEY ([srItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losStockRecovery] CHECK CONSTRAINT [FK_losStockRecovery_aItem1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockRecovery' AND CONSTRAINT_NAME= 'FK_losStockRecovery_aShops')
BEGIN
	ALTER TABLE [losStockRecovery] WITH CHECK ADD  CONSTRAINT [FK_losStockRecovery_aShops] FOREIGN KEY ([srShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losStockRecovery] CHECK CONSTRAINT [FK_losStockRecovery_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockRecovery' AND CONSTRAINT_NAME= 'FK_losStockRecovery_aShops1')
BEGIN
	ALTER TABLE [losStockRecovery] WITH CHECK ADD  CONSTRAINT [FK_losStockRecovery_aShops1] FOREIGN KEY ([srShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losStockRecovery] CHECK CONSTRAINT [FK_losStockRecovery_aShops1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockVerificationDetail' AND CONSTRAINT_NAME= 'FK_losStockVerificationDetail_aItem')
BEGIN
	ALTER TABLE [losStockVerificationDetail] WITH CHECK ADD  CONSTRAINT [FK_losStockVerificationDetail_aItem] FOREIGN KEY ([svditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [losStockVerificationDetail] CHECK CONSTRAINT [FK_losStockVerificationDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockVerificationDetail' AND CONSTRAINT_NAME= 'FK_losStockVerificationDetail_losStockVerificationHeader')
BEGIN
	ALTER TABLE [losStockVerificationDetail] WITH CHECK ADD  CONSTRAINT [FK_losStockVerificationDetail_losStockVerificationHeader] FOREIGN KEY ([svdid],[svdShopid]) REFERENCES losStockVerificationHeader([svhid],[svhShopId])
END
GO
 ALTER TABLE [losStockVerificationDetail] CHECK CONSTRAINT [FK_losStockVerificationDetail_losStockVerificationHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losStockVerificationHeader' AND CONSTRAINT_NAME= 'FK_losStockVerificationHeader_aShops')
BEGIN
	ALTER TABLE [losStockVerificationHeader] WITH CHECK ADD  CONSTRAINT [FK_losStockVerificationHeader_aShops] FOREIGN KEY ([svhShopId]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losStockVerificationHeader] CHECK CONSTRAINT [FK_losStockVerificationHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losTenantServiceBillDetail' AND CONSTRAINT_NAME= 'FK_losTenantServiceBillDetail_losTenantServiceBillHeader')
BEGIN
	ALTER TABLE [losTenantServiceBillDetail] WITH CHECK ADD  CONSTRAINT [FK_losTenantServiceBillDetail_losTenantServiceBillHeader] FOREIGN KEY ([tbdBillId],[tbdShopId],[tbdCompanyId]) REFERENCES losTenantServiceBillHeader([tbhBillId],[tbhShopId],[tbhCompanyId])
END
GO
 ALTER TABLE [losTenantServiceBillDetail] CHECK CONSTRAINT [FK_losTenantServiceBillDetail_losTenantServiceBillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losTenantUtilityBillDetail' AND CONSTRAINT_NAME= 'FK_losTenantUtilityBillDetail_losTenantServiceBillHeader')
BEGIN
	ALTER TABLE [losTenantUtilityBillDetail] WITH CHECK ADD  CONSTRAINT [FK_losTenantUtilityBillDetail_losTenantServiceBillHeader] FOREIGN KEY ([utdBillId],[utdShopId],[utdCompanyId]) REFERENCES losTenantServiceBillHeader([tbhBillId],[tbhShopId],[tbhCompanyId])
END
GO
 ALTER TABLE [losTenantUtilityBillDetail] CHECK CONSTRAINT [FK_losTenantUtilityBillDetail_losTenantServiceBillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOSTransferindetail' AND CONSTRAINT_NAME= 'FK_LOSTransferindetail_aItem')
BEGIN
	ALTER TABLE [LOSTransferindetail] WITH CHECK ADD  CONSTRAINT [FK_LOSTransferindetail_aItem] FOREIGN KEY ([TIDitemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOSTransferindetail] CHECK CONSTRAINT [FK_LOSTransferindetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOSTransferindetail' AND CONSTRAINT_NAME= 'FK_LOSTransferindetail_LOSTransferinheader')
BEGIN
	ALTER TABLE [LOSTransferindetail] WITH CHECK ADD  CONSTRAINT [FK_LOSTransferindetail_LOSTransferinheader] FOREIGN KEY ([TIDshopid],[TIDID]) REFERENCES LOSTransferinheader([TIHShopid],[TIHID])
END
GO
 ALTER TABLE [LOSTransferindetail] CHECK CONSTRAINT [FK_LOSTransferindetail_LOSTransferinheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOSTransferinheader' AND CONSTRAINT_NAME= 'FK_LOSTransferinheader_aShops')
BEGIN
	ALTER TABLE [LOSTransferinheader] WITH CHECK ADD  CONSTRAINT [FK_LOSTransferinheader_aShops] FOREIGN KEY ([TIHShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOSTransferinheader] CHECK CONSTRAINT [FK_LOSTransferinheader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOSTransferinheader' AND CONSTRAINT_NAME= 'FK_LOSTransferinheader_aShops1')
BEGIN
	ALTER TABLE [LOSTransferinheader] WITH CHECK ADD  CONSTRAINT [FK_LOSTransferinheader_aShops1] FOREIGN KEY ([TIHfromshopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOSTransferinheader] CHECK CONSTRAINT [FK_LOSTransferinheader_aShops1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOSTransferinheader' AND CONSTRAINT_NAME= 'FK_LOSTransferinheader_mesTransferOutHeader1')
BEGIN
	ALTER TABLE [LOSTransferinheader] WITH CHECK ADD  CONSTRAINT [FK_LOSTransferinheader_mesTransferOutHeader1] FOREIGN KEY ([TIHdespatchID],[TIHfromshopID]) REFERENCES mesTransferOutHeader([TOHid],[TOHShopid])
END
GO
 ALTER TABLE [LOSTransferinheader] CHECK CONSTRAINT [FK_LOSTransferinheader_mesTransferOutHeader1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losWarrentyClaimDetail' AND CONSTRAINT_NAME= 'FK_losWarrentyClaimDetail_losWarrentyClaimHeader')
BEGIN
	ALTER TABLE [losWarrentyClaimDetail] WITH CHECK ADD  CONSTRAINT [FK_losWarrentyClaimDetail_losWarrentyClaimHeader] FOREIGN KEY ([wcdCompanyID],[wcdShopID],[wcdID]) REFERENCES losWarrentyClaimHeader([wchCompanyID],[wchShopID],[wchID])
END
GO
 ALTER TABLE [losWarrentyClaimDetail] CHECK CONSTRAINT [FK_losWarrentyClaimDetail_losWarrentyClaimHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND CONSTRAINT_NAME= 'FK_losWarrentyClaimHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] WITH CHECK ADD  CONSTRAINT [FK_losWarrentyClaimHeader_aCompanyMaster] FOREIGN KEY ([wchCompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [losWarrentyClaimHeader] CHECK CONSTRAINT [FK_losWarrentyClaimHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='losWarrentyClaimHeader' AND CONSTRAINT_NAME= 'FK_losWarrentyClaimHeader_aShops')
BEGIN
	ALTER TABLE [losWarrentyClaimHeader] WITH CHECK ADD  CONSTRAINT [FK_losWarrentyClaimHeader_aShops] FOREIGN KEY ([wchShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [losWarrentyClaimHeader] CHECK CONSTRAINT [FK_losWarrentyClaimHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsWriteOffDetail' AND CONSTRAINT_NAME= 'FK_LOsWriteOffDetail_aItem')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsWriteOffDetail_aItem] FOREIGN KEY ([WdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [LOsWriteOffDetail] CHECK CONSTRAINT [FK_LOsWriteOffDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsWriteOffDetail' AND CONSTRAINT_NAME= 'FK_LOsWriteOffDetail_LOsWriteOffHeader')
BEGIN
	ALTER TABLE [LOsWriteOffDetail] WITH CHECK ADD  CONSTRAINT [FK_LOsWriteOffDetail_LOsWriteOffHeader] FOREIGN KEY ([wdShopID],[WdID]) REFERENCES LOsWriteOffHeader([whShopID],[WhID])
END
GO
 ALTER TABLE [LOsWriteOffDetail] CHECK CONSTRAINT [FK_LOsWriteOffDetail_LOsWriteOffHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsWriteOffHeader' AND CONSTRAINT_NAME= 'FK_LOsWriteOffHeader_aShops')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsWriteOffHeader_aShops] FOREIGN KEY ([whShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOsWriteOffHeader] CHECK CONSTRAINT [FK_LOsWriteOffHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOsWriteOffHeader' AND CONSTRAINT_NAME= 'FK_LOsWriteOffHeader_whIhCRequestID')
BEGIN
	ALTER TABLE [LOsWriteOffHeader] WITH CHECK ADD  CONSTRAINT [FK_LOsWriteOffHeader_whIhCRequestID] FOREIGN KEY ([whIhCRequestID]) REFERENCES InhouseConsumptionReqHeader([StoreRequestId])
END
GO
 ALTER TABLE [LOsWriteOffHeader] CHECK CONSTRAINT [FK_LOsWriteOffHeader_whIhCRequestID]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUserRights' AND CONSTRAINT_NAME= 'fk_LOUserRights_ainterface')
BEGIN
	ALTER TABLE [LOUserRights] WITH CHECK ADD  CONSTRAINT [fk_LOUserRights_ainterface] FOREIGN KEY ([InterfaceID],[CompanyID]) REFERENCES aInterface([InterfaceID],[CompanyID])
END
GO
 ALTER TABLE [LOUserRights] CHECK CONSTRAINT [fk_LOUserRights_ainterface]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUserRights' AND CONSTRAINT_NAME= 'FK_LOUserRights_LOUsers')
BEGIN
	ALTER TABLE [LOUserRights] WITH CHECK ADD  CONSTRAINT [FK_LOUserRights_LOUsers] FOREIGN KEY ([UserID]) REFERENCES LOUsers([UserID])
END
GO
 ALTER TABLE [LOUserRights] CHECK CONSTRAINT [FK_LOUserRights_LOUsers]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUsers' AND CONSTRAINT_NAME= 'FK_LOUsers_aCompanyMaster')
BEGIN
	ALTER TABLE [LOUsers] WITH CHECK ADD  CONSTRAINT [FK_LOUsers_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [LOUsers] CHECK CONSTRAINT [FK_LOUsers_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUsers' AND CONSTRAINT_NAME= 'FK_LOUsers_aGlobalUsers')
BEGIN
	ALTER TABLE [LOUsers] WITH CHECK ADD  CONSTRAINT [FK_LOUsers_aGlobalUsers] FOREIGN KEY ([GlobalUserID]) REFERENCES aGlobalUsers([UserID])
END
GO
 ALTER TABLE [LOUsers] CHECK CONSTRAINT [FK_LOUsers_aGlobalUsers]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUsers' AND CONSTRAINT_NAME= 'FK_LOUsers_aGodown')
BEGIN
	ALTER TABLE [LOUsers] WITH CHECK ADD  CONSTRAINT [FK_LOUsers_aGodown] FOREIGN KEY ([GodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [LOUsers] CHECK CONSTRAINT [FK_LOUsers_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LOUsers' AND CONSTRAINT_NAME= 'FK_LOUsers_aShops')
BEGIN
	ALTER TABLE [LOUsers] WITH CHECK ADD  CONSTRAINT [FK_LOUsers_aShops] FOREIGN KEY ([ShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [LOUsers] CHECK CONSTRAINT [FK_LOUsers_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='LtimeDetail' AND CONSTRAINT_NAME= 'FK_LtimeDetail_LtimeHeader')
BEGIN
	ALTER TABLE [LtimeDetail] WITH CHECK ADD  CONSTRAINT [FK_LtimeDetail_LtimeHeader] FOREIGN KEY ([Ltimeid]) REFERENCES LtimeHeader([LtimeID])
END
GO
 ALTER TABLE [LtimeDetail] CHECK CONSTRAINT [FK_LtimeDetail_LtimeHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEDifferenceinStock' AND CONSTRAINT_NAME= 'FK_MEDifferenceinStock_aItem')
BEGIN
	ALTER TABLE [MEDifferenceinStock] WITH CHECK ADD  CONSTRAINT [FK_MEDifferenceinStock_aItem] FOREIGN KEY ([dsItemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [MEDifferenceinStock] CHECK CONSTRAINT [FK_MEDifferenceinStock_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND CONSTRAINT_NAME= 'FK_MEiDespatchToShopDetail_aItem')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] WITH CHECK ADD  CONSTRAINT [FK_MEiDespatchToShopDetail_aItem] FOREIGN KEY ([ddItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [MEiDespatchToShopDetail] CHECK CONSTRAINT [FK_MEiDespatchToShopDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND CONSTRAINT_NAME= 'FK_MEiDespatchToShopDetail_MEiDespatchToShopHeader')
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] WITH CHECK ADD  CONSTRAINT [FK_MEiDespatchToShopDetail_MEiDespatchToShopHeader] FOREIGN KEY ([ddDespatchID],[ddGodownID]) REFERENCES MEiDespatchToShopHeader([dhDespatchID],[dhGodownID])
END
GO
 ALTER TABLE [MEiDespatchToShopDetail] CHECK CONSTRAINT [FK_MEiDespatchToShopDetail_MEiDespatchToShopHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND CONSTRAINT_NAME= 'FK_MEiDespatchToShopHeader_aGodown')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] WITH CHECK ADD  CONSTRAINT [FK_MEiDespatchToShopHeader_aGodown] FOREIGN KEY ([dhGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [MEiDespatchToShopHeader] CHECK CONSTRAINT [FK_MEiDespatchToShopHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND CONSTRAINT_NAME= 'FK_MEiDespatchToShopHeader_aHQIssuenoteHeader')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] WITH CHECK ADD  CONSTRAINT [FK_MEiDespatchToShopHeader_aHQIssuenoteHeader] FOREIGN KEY ([dhIssueNoteID]) REFERENCES aHQIssuenoteHeader([INHIssuenoteID])
END
GO
 ALTER TABLE [MEiDespatchToShopHeader] CHECK CONSTRAINT [FK_MEiDespatchToShopHeader_aHQIssuenoteHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND CONSTRAINT_NAME= 'FK_MEiDespatchToShopHeader_aShops')
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] WITH CHECK ADD  CONSTRAINT [FK_MEiDespatchToShopHeader_aShops] FOREIGN KEY ([dhShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [MEiDespatchToShopHeader] CHECK CONSTRAINT [FK_MEiDespatchToShopHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MeiGodownRequestDetail' AND CONSTRAINT_NAME= 'FK_MeiGodownRequestDetail_MeiGodownRequestHeader')
BEGIN
	ALTER TABLE [MeiGodownRequestDetail] WITH CHECK ADD  CONSTRAINT [FK_MeiGodownRequestDetail_MeiGodownRequestHeader] FOREIGN KEY ([GRDRequestId],[GRDGodownId]) REFERENCES MeiGodownRequestHeader([GRHRequestId],[GRHGodownId])
END
GO
 ALTER TABLE [MeiGodownRequestDetail] CHECK CONSTRAINT [FK_MeiGodownRequestDetail_MeiGodownRequestHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND CONSTRAINT_NAME= 'FK_MeiGodownRequestHeader_aGodown')
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] WITH CHECK ADD  CONSTRAINT [FK_MeiGodownRequestHeader_aGodown] FOREIGN KEY ([GRHGodownId]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [MeiGodownRequestHeader] CHECK CONSTRAINT [FK_MeiGodownRequestHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND CONSTRAINT_NAME= 'FK_MEiGodownTransferDetail_aGodown1')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] WITH CHECK ADD  CONSTRAINT [FK_MEiGodownTransferDetail_aGodown1] FOREIGN KEY ([gtdToGodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [MEiGodownTransferDetail] CHECK CONSTRAINT [FK_MEiGodownTransferDetail_aGodown1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND CONSTRAINT_NAME= 'FK_MEiGodownTransferDetail_aItem')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] WITH CHECK ADD  CONSTRAINT [FK_MEiGodownTransferDetail_aItem] FOREIGN KEY ([gtdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [MEiGodownTransferDetail] CHECK CONSTRAINT [FK_MEiGodownTransferDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND CONSTRAINT_NAME= 'fk_MEiGodownTransferDetail_ashipment')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] WITH CHECK ADD  CONSTRAINT [fk_MEiGodownTransferDetail_ashipment] FOREIGN KEY ([gtdShipmentID]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [MEiGodownTransferDetail] CHECK CONSTRAINT [fk_MEiGodownTransferDetail_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND CONSTRAINT_NAME= 'fk_MEiGodownTransferDetail_loilocation')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] WITH CHECK ADD  CONSTRAINT [fk_MEiGodownTransferDetail_loilocation] FOREIGN KEY ([gtdGodownID],[gtdLocationID]) REFERENCES LOiLocation([lGodownID],[lLocationID])
END
GO
 ALTER TABLE [MEiGodownTransferDetail] CHECK CONSTRAINT [fk_MEiGodownTransferDetail_loilocation]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND CONSTRAINT_NAME= 'FK_MEiGodownTransferDetail_MEiGodownTransferHeader')
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] WITH CHECK ADD  CONSTRAINT [FK_MEiGodownTransferDetail_MEiGodownTransferHeader] FOREIGN KEY ([gtdDespatchID],[gtdGodownID]) REFERENCES MEiGodownTransferHeader([gthDespatchID],[gthFromGodownID])
END
GO
 ALTER TABLE [MEiGodownTransferDetail] CHECK CONSTRAINT [FK_MEiGodownTransferDetail_MEiGodownTransferHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND CONSTRAINT_NAME= 'FK_MEiGodownTransferHeader_aGodown')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] WITH CHECK ADD  CONSTRAINT [FK_MEiGodownTransferHeader_aGodown] FOREIGN KEY ([gthFromGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [MEiGodownTransferHeader] CHECK CONSTRAINT [FK_MEiGodownTransferHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND CONSTRAINT_NAME= 'FK_MEiGodownTransferHeader_aGodown1')
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] WITH CHECK ADD  CONSTRAINT [FK_MEiGodownTransferHeader_aGodown1] FOREIGN KEY ([gthToGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [MEiGodownTransferHeader] CHECK CONSTRAINT [FK_MEiGodownTransferHeader_aGodown1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_meiRQtoHQforItem_aColor')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_meiRQtoHQforItem_aColor] FOREIGN KEY ([ColorID]) REFERENCES aColor([ColorID])
END
GO
 ALTER TABLE [meiRQtoHQforItem] CHECK CONSTRAINT [FK_meiRQtoHQforItem_aColor]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_meiRQtoHQforItem_aGodown')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_meiRQtoHQforItem_aGodown] FOREIGN KEY ([GodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [meiRQtoHQforItem] CHECK CONSTRAINT [FK_meiRQtoHQforItem_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_meiRQtoHQforItem_aPackingType')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_meiRQtoHQforItem_aPackingType] FOREIGN KEY ([PackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [meiRQtoHQforItem] CHECK CONSTRAINT [FK_meiRQtoHQforItem_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_meiRQtoHQforItem_aSize')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_meiRQtoHQforItem_aSize] FOREIGN KEY ([SizeID]) REFERENCES aSize([SizeID])
END
GO
 ALTER TABLE [meiRQtoHQforItem] CHECK CONSTRAINT [FK_meiRQtoHQforItem_aSize]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_meiRQtoHQforItem_aUnit')
BEGIN
	ALTER TABLE [meiRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_meiRQtoHQforItem_aUnit] FOREIGN KEY ([UnitID]) REFERENCES aUnit([UnitID])
END
GO
 ALTER TABLE [meiRQtoHQforItem] CHECK CONSTRAINT [FK_meiRQtoHQforItem_aUnit]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND CONSTRAINT_NAME= 'fk_meiSpecialDespatchtoshodeatil_aitem')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] WITH CHECK ADD  CONSTRAINT [fk_meiSpecialDespatchtoshodeatil_aitem] FOREIGN KEY ([ddItemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [meiSpecialDespatchtoShopDetail] CHECK CONSTRAINT [fk_meiSpecialDespatchtoshodeatil_aitem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND CONSTRAINT_NAME= 'fk_meiSpecialDespatchtoshodeatil_ashipment')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] WITH CHECK ADD  CONSTRAINT [fk_meiSpecialDespatchtoshodeatil_ashipment] FOREIGN KEY ([ddShipmentid]) REFERENCES aShipment([sShipmentID])
END
GO
 ALTER TABLE [meiSpecialDespatchtoShopDetail] CHECK CONSTRAINT [fk_meiSpecialDespatchtoshodeatil_ashipment]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND CONSTRAINT_NAME= 'fk_meiSpecialDespatchtoshodeatil_ashops')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] WITH CHECK ADD  CONSTRAINT [fk_meiSpecialDespatchtoshodeatil_ashops] FOREIGN KEY ([ddShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [meiSpecialDespatchtoShopDetail] CHECK CONSTRAINT [fk_meiSpecialDespatchtoshodeatil_ashops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND CONSTRAINT_NAME= 'FK_meiSpecialDespatchtoShopDetail_meiSpecialDespatchtoshopHeader')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] WITH CHECK ADD  CONSTRAINT [FK_meiSpecialDespatchtoShopDetail_meiSpecialDespatchtoshopHeader] FOREIGN KEY ([ddDespatchid],[ddGodownid]) REFERENCES meiSpecialDespatchtoshopHeader([dhdespatchid],[dhgodownid])
END
GO
 ALTER TABLE [meiSpecialDespatchtoShopDetail] CHECK CONSTRAINT [FK_meiSpecialDespatchtoShopDetail_meiSpecialDespatchtoshopHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND CONSTRAINT_NAME= 'FK_meiSpecialDespatchtoshopHeader_aGodown')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] WITH CHECK ADD  CONSTRAINT [FK_meiSpecialDespatchtoshopHeader_aGodown] FOREIGN KEY ([dhgodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [meiSpecialDespatchtoshopHeader] CHECK CONSTRAINT [FK_meiSpecialDespatchtoshopHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND CONSTRAINT_NAME= 'FK_meiSpecialDespatchtoshopHeader_aShops')
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] WITH CHECK ADD  CONSTRAINT [FK_meiSpecialDespatchtoshopHeader_aShops] FOREIGN KEY ([dhShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [meiSpecialDespatchtoshopHeader] CHECK CONSTRAINT [FK_meiSpecialDespatchtoshopHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEmessages' AND CONSTRAINT_NAME= 'FK_MEmessages_aGlobalUsers')
BEGIN
	ALTER TABLE [MEmessages] WITH CHECK ADD  CONSTRAINT [FK_MEmessages_aGlobalUsers] FOREIGN KEY ([fromUserID]) REFERENCES aGlobalUsers([UserID])
END
GO
 ALTER TABLE [MEmessages] CHECK CONSTRAINT [FK_MEmessages_aGlobalUsers]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEmessages' AND CONSTRAINT_NAME= 'FK_MEmessages_aGlobalUsers1')
BEGIN
	ALTER TABLE [MEmessages] WITH CHECK ADD  CONSTRAINT [FK_MEmessages_aGlobalUsers1] FOREIGN KEY ([toUserID]) REFERENCES aGlobalUsers([UserID])
END
GO
 ALTER TABLE [MEmessages] CHECK CONSTRAINT [FK_MEmessages_aGlobalUsers1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND CONSTRAINT_NAME= 'FK_MEsDespatchtoGodownDetail_aGodown')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] WITH CHECK ADD  CONSTRAINT [FK_MEsDespatchtoGodownDetail_aGodown] FOREIGN KEY ([dgdGodownid]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [MEsDespatchtoGodownDetail] CHECK CONSTRAINT [FK_MEsDespatchtoGodownDetail_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND CONSTRAINT_NAME= 'FK_MEsDespatchtoGodownDetail_aItem')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] WITH CHECK ADD  CONSTRAINT [FK_MEsDespatchtoGodownDetail_aItem] FOREIGN KEY ([dgdItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [MEsDespatchtoGodownDetail] CHECK CONSTRAINT [FK_MEsDespatchtoGodownDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND CONSTRAINT_NAME= 'FK_MEsDespatchtoGodownDetail_MEsDespatchtoGodownHeader')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] WITH CHECK ADD  CONSTRAINT [FK_MEsDespatchtoGodownDetail_MEsDespatchtoGodownHeader] FOREIGN KEY ([dgdID],[dgdShopID]) REFERENCES MEsDespatchtoGodownHeader([dghID],[dghShopID])
END
GO
 ALTER TABLE [MEsDespatchtoGodownDetail] CHECK CONSTRAINT [FK_MEsDespatchtoGodownDetail_MEsDespatchtoGodownHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND CONSTRAINT_NAME= 'FK_MEsDespatchtoGodownHeader_aGodown')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] WITH CHECK ADD  CONSTRAINT [FK_MEsDespatchtoGodownHeader_aGodown] FOREIGN KEY ([dghGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [MEsDespatchtoGodownHeader] CHECK CONSTRAINT [FK_MEsDespatchtoGodownHeader_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND CONSTRAINT_NAME= 'FK_MEsDespatchtoGodownHeader_aShops')
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] WITH CHECK ADD  CONSTRAINT [FK_MEsDespatchtoGodownHeader_aShops] FOREIGN KEY ([dghShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [MEsDespatchtoGodownHeader] CHECK CONSTRAINT [FK_MEsDespatchtoGodownHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND CONSTRAINT_NAME= 'FK_mesRequesttoShopDetail_aItem')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] WITH CHECK ADD  CONSTRAINT [FK_mesRequesttoShopDetail_aItem] FOREIGN KEY ([srditemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [mesRequesttoShopDetail] CHECK CONSTRAINT [FK_mesRequesttoShopDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND CONSTRAINT_NAME= 'FK_mesRequesttoShopDetail_aShops1')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] WITH CHECK ADD  CONSTRAINT [FK_mesRequesttoShopDetail_aShops1] FOREIGN KEY ([srdToShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [mesRequesttoShopDetail] CHECK CONSTRAINT [FK_mesRequesttoShopDetail_aShops1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRequesttoShopDetail' AND CONSTRAINT_NAME= 'FK_mesRequesttoShopDetail_mesRequesttoShopHeader')
BEGIN
	ALTER TABLE [mesRequesttoShopDetail] WITH CHECK ADD  CONSTRAINT [FK_mesRequesttoShopDetail_mesRequesttoShopHeader] FOREIGN KEY ([srdshopid],[SRDrequestid]) REFERENCES mesRequesttoShopHeader([SRHshopid],[SRHrequestID])
END
GO
 ALTER TABLE [mesRequesttoShopDetail] CHECK CONSTRAINT [FK_mesRequesttoShopDetail_mesRequesttoShopHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND CONSTRAINT_NAME= 'FK_mesRequesttoShopHeader_aShops')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] WITH CHECK ADD  CONSTRAINT [FK_mesRequesttoShopHeader_aShops] FOREIGN KEY ([SRHshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [mesRequesttoShopHeader] CHECK CONSTRAINT [FK_mesRequesttoShopHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND CONSTRAINT_NAME= 'FK_mesRequesttoShopHeader_aShops1')
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] WITH CHECK ADD  CONSTRAINT [FK_mesRequesttoShopHeader_aShops1] FOREIGN KEY ([SRHtoShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [mesRequesttoShopHeader] CHECK CONSTRAINT [FK_mesRequesttoShopHeader_aShops1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_mesRQtoHQforItem_aColor')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_mesRQtoHQforItem_aColor] FOREIGN KEY ([ColorID]) REFERENCES aColor([ColorID])
END
GO
 ALTER TABLE [mesRQtoHQforItem] CHECK CONSTRAINT [FK_mesRQtoHQforItem_aColor]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_mesRQtoHQforItem_aPackingType')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_mesRQtoHQforItem_aPackingType] FOREIGN KEY ([PackingTypeID]) REFERENCES aPackingType([PackingTypeID])
END
GO
 ALTER TABLE [mesRQtoHQforItem] CHECK CONSTRAINT [FK_mesRQtoHQforItem_aPackingType]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_mesRQtoHQforItem_aShops')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_mesRQtoHQforItem_aShops] FOREIGN KEY ([ShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [mesRQtoHQforItem] CHECK CONSTRAINT [FK_mesRQtoHQforItem_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_mesRQtoHQforItem_aSize')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_mesRQtoHQforItem_aSize] FOREIGN KEY ([SizeID]) REFERENCES aSize([SizeID])
END
GO
 ALTER TABLE [mesRQtoHQforItem] CHECK CONSTRAINT [FK_mesRQtoHQforItem_aSize]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesRQtoHQforItem' AND CONSTRAINT_NAME= 'FK_mesRQtoHQforItem_aUnit')
BEGIN
	ALTER TABLE [mesRQtoHQforItem] WITH CHECK ADD  CONSTRAINT [FK_mesRQtoHQforItem_aUnit] FOREIGN KEY ([UnitID]) REFERENCES aUnit([UnitID])
END
GO
 ALTER TABLE [mesRQtoHQforItem] CHECK CONSTRAINT [FK_mesRQtoHQforItem_aUnit]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferOutArrivalDetail' AND CONSTRAINT_NAME= 'FK_mesTransferOutArrivalDetail_LOsGoodsArrivaltoShopHeader')
BEGIN
	ALTER TABLE [mesTransferOutArrivalDetail] WITH CHECK ADD  CONSTRAINT [FK_mesTransferOutArrivalDetail_LOsGoodsArrivaltoShopHeader] FOREIGN KEY ([toaArrivalId],[toaShopid]) REFERENCES LOsGoodsArrivaltoShopHeader([gahArrivalID],[gahShopid])
END
GO
 ALTER TABLE [mesTransferOutArrivalDetail] CHECK CONSTRAINT [FK_mesTransferOutArrivalDetail_LOsGoodsArrivaltoShopHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferOutArrivalDetail' AND CONSTRAINT_NAME= 'FK_mesTransferOutArrivalDetail_mesTransferOutHeader')
BEGIN
	ALTER TABLE [mesTransferOutArrivalDetail] WITH CHECK ADD  CONSTRAINT [FK_mesTransferOutArrivalDetail_mesTransferOutHeader] FOREIGN KEY ([toaTransOutId],[toaShopid]) REFERENCES mesTransferOutHeader([TOHid],[TOHShopid])
END
GO
 ALTER TABLE [mesTransferOutArrivalDetail] CHECK CONSTRAINT [FK_mesTransferOutArrivalDetail_mesTransferOutHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferoutDetail' AND CONSTRAINT_NAME= 'FK_mesTransferoutDetail_aItem')
BEGIN
	ALTER TABLE [mesTransferoutDetail] WITH CHECK ADD  CONSTRAINT [FK_mesTransferoutDetail_aItem] FOREIGN KEY ([TODitemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [mesTransferoutDetail] CHECK CONSTRAINT [FK_mesTransferoutDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferoutDetail' AND CONSTRAINT_NAME= 'FK_mesTransferoutDetail_aShops1')
BEGIN
	ALTER TABLE [mesTransferoutDetail] WITH CHECK ADD  CONSTRAINT [FK_mesTransferoutDetail_aShops1] FOREIGN KEY ([TODtoShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [mesTransferoutDetail] CHECK CONSTRAINT [FK_mesTransferoutDetail_aShops1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferoutDetail' AND CONSTRAINT_NAME= 'FK_mesTransferoutDetail_mesTransferOutHeader')
BEGIN
	ALTER TABLE [mesTransferoutDetail] WITH CHECK ADD  CONSTRAINT [FK_mesTransferoutDetail_mesTransferOutHeader] FOREIGN KEY ([TODid],[TODshopid]) REFERENCES mesTransferOutHeader([TOHid],[TOHShopid])
END
GO
 ALTER TABLE [mesTransferoutDetail] CHECK CONSTRAINT [FK_mesTransferoutDetail_mesTransferOutHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferOutHeader' AND CONSTRAINT_NAME= 'FK_mesTransferOutHeader_aShops')
BEGIN
	ALTER TABLE [mesTransferOutHeader] WITH CHECK ADD  CONSTRAINT [FK_mesTransferOutHeader_aShops] FOREIGN KEY ([TOHShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [mesTransferOutHeader] CHECK CONSTRAINT [FK_mesTransferOutHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferOutHeader' AND CONSTRAINT_NAME= 'FK_mesTransferOutHeader_aShops1')
BEGIN
	ALTER TABLE [mesTransferOutHeader] WITH CHECK ADD  CONSTRAINT [FK_mesTransferOutHeader_aShops1] FOREIGN KEY ([TOHtoShopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [mesTransferOutHeader] CHECK CONSTRAINT [FK_mesTransferOutHeader_aShops1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mesTransferOutHeader' AND CONSTRAINT_NAME= 'FK_mesTransferOutHeader_mesRequesttoShopHeader')
BEGIN
	ALTER TABLE [mesTransferOutHeader] WITH CHECK ADD  CONSTRAINT [FK_mesTransferOutHeader_mesRequesttoShopHeader] FOREIGN KEY ([TOHtoShopid],[TOHrequestid]) REFERENCES mesRequesttoShopHeader([SRHshopid],[SRHrequestID])
END
GO
 ALTER TABLE [mesTransferOutHeader] CHECK CONSTRAINT [FK_mesTransferOutHeader_mesRequesttoShopHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsTransLog' AND CONSTRAINT_NAME= 'FK_METransLog_aGodown')
BEGIN
	ALTER TABLE [MEsTransLog] WITH CHECK ADD  CONSTRAINT [FK_METransLog_aGodown] FOREIGN KEY ([GodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [MEsTransLog] CHECK CONSTRAINT [FK_METransLog_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MEsTransLog' AND CONSTRAINT_NAME= 'FK_METransLog_aShops')
BEGIN
	ALTER TABLE [MEsTransLog] WITH CHECK ADD  CONSTRAINT [FK_METransLog_aShops] FOREIGN KEY ([ShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [MEsTransLog] CHECK CONSTRAINT [FK_METransLog_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalDetails' AND CONSTRAINT_NAME= 'FK_MOaJournalDetails_aAccountMaster')
BEGIN
	ALTER TABLE [MOaJournalDetails] WITH CHECK ADD  CONSTRAINT [FK_MOaJournalDetails_aAccountMaster] FOREIGN KEY ([AccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [MOaJournalDetails] CHECK CONSTRAINT [FK_MOaJournalDetails_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalDetails' AND CONSTRAINT_NAME= 'fk_MOaJournalDetails_acustomermaster')
BEGIN
	ALTER TABLE [MOaJournalDetails] WITH CHECK ADD  CONSTRAINT [fk_MOaJournalDetails_acustomermaster] FOREIGN KEY ([CustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [MOaJournalDetails] CHECK CONSTRAINT [fk_MOaJournalDetails_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalDetails' AND CONSTRAINT_NAME= 'fk_moajournaldetails_adepartmentmaster')
BEGIN
	ALTER TABLE [MOaJournalDetails] WITH CHECK ADD  CONSTRAINT [fk_moajournaldetails_adepartmentmaster] FOREIGN KEY ([DepartmentID],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [MOaJournalDetails] CHECK CONSTRAINT [fk_moajournaldetails_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalDetails' AND CONSTRAINT_NAME= 'fk_MOaJournalDetails_avendormaster')
BEGIN
	ALTER TABLE [MOaJournalDetails] WITH CHECK ADD  CONSTRAINT [fk_MOaJournalDetails_avendormaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [MOaJournalDetails] CHECK CONSTRAINT [fk_MOaJournalDetails_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalDetails' AND CONSTRAINT_NAME= 'FK_MOaJournalDetails_MOaJournalHeader')
BEGIN
	ALTER TABLE [MOaJournalDetails] WITH CHECK ADD  CONSTRAINT [FK_MOaJournalDetails_MOaJournalHeader] FOREIGN KEY ([JournalID]) REFERENCES MOaJournalHeader([JournalID])
END
GO
 ALTER TABLE [MOaJournalDetails] CHECK CONSTRAINT [FK_MOaJournalDetails_MOaJournalHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalHeader' AND CONSTRAINT_NAME= 'FK_MOaJournalHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [MOaJournalHeader] WITH CHECK ADD  CONSTRAINT [FK_MOaJournalHeader_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [MOaJournalHeader] CHECK CONSTRAINT [FK_MOaJournalHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalHeader' AND CONSTRAINT_NAME= 'fk_moajournalheader_acurrencymaster')
BEGIN
	ALTER TABLE [MOaJournalHeader] WITH CHECK ADD  CONSTRAINT [fk_moajournalheader_acurrencymaster] FOREIGN KEY ([CurrencyId],[CompanyID]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [MOaJournalHeader] CHECK CONSTRAINT [fk_moajournalheader_acurrencymaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOaJournalHeader' AND CONSTRAINT_NAME= 'fk_moajournalheader_afinancialyear')
BEGIN
	ALTER TABLE [MOaJournalHeader] WITH CHECK ADD  CONSTRAINT [fk_moajournalheader_afinancialyear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [MOaJournalHeader] CHECK CONSTRAINT [fk_moajournalheader_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='moapoitems' AND CONSTRAINT_NAME= 'FK_moapoitems_aItem')
BEGIN
	ALTER TABLE [moapoitems] WITH CHECK ADD  CONSTRAINT [FK_moapoitems_aItem] FOREIGN KEY ([itemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [moapoitems] CHECK CONSTRAINT [FK_moapoitems_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='moapoitems' AND CONSTRAINT_NAME= 'FK_moapoitems_aShops')
BEGIN
	ALTER TABLE [moapoitems] WITH CHECK ADD  CONSTRAINT [FK_moapoitems_aShops] FOREIGN KEY ([shopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [moapoitems] CHECK CONSTRAINT [FK_moapoitems_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOiGodownStock' AND CONSTRAINT_NAME= 'FK_MOiGodownStock_aGodown')
BEGIN
	ALTER TABLE [MOiGodownStock] WITH CHECK ADD  CONSTRAINT [FK_MOiGodownStock_aGodown] FOREIGN KEY ([gsGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [MOiGodownStock] CHECK CONSTRAINT [FK_MOiGodownStock_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOiGodownStock' AND CONSTRAINT_NAME= 'FK_MOiGodownStock_aItem')
BEGIN
	ALTER TABLE [MOiGodownStock] WITH CHECK ADD  CONSTRAINT [FK_MOiGodownStock_aItem] FOREIGN KEY ([gsItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [MOiGodownStock] CHECK CONSTRAINT [FK_MOiGodownStock_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND CONSTRAINT_NAME= 'FK_mosGoodsRequestDetail_aItem')
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] WITH CHECK ADD  CONSTRAINT [FK_mosGoodsRequestDetail_aItem] FOREIGN KEY ([GRDitemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [mosGoodsRequestDetail] CHECK CONSTRAINT [FK_mosGoodsRequestDetail_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND CONSTRAINT_NAME= 'FK_mosGoodsRequestHeader_aShops')
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] WITH CHECK ADD  CONSTRAINT [FK_mosGoodsRequestHeader_aShops] FOREIGN KEY ([GRHshopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [mosGoodsRequestHeader] CHECK CONSTRAINT [FK_mosGoodsRequestHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mosrequestinvdetail' AND CONSTRAINT_NAME= 'fk_mosrequestinvdetail_mosgoodsrequestheader')
BEGIN
	ALTER TABLE [mosrequestinvdetail] WITH CHECK ADD  CONSTRAINT [fk_mosrequestinvdetail_mosgoodsrequestheader] FOREIGN KEY ([reqdid],[reqinvdshopid]) REFERENCES mosGoodsRequestHeader([GRHrequestID],[GRHshopID])
END
GO
 ALTER TABLE [mosrequestinvdetail] CHECK CONSTRAINT [fk_mosrequestinvdetail_mosgoodsrequestheader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mosshopservicestock' AND CONSTRAINT_NAME= 'FK_mosshopservicestock_aCompanyMaster')
BEGIN
	ALTER TABLE [mosshopservicestock] WITH CHECK ADD  CONSTRAINT [FK_mosshopservicestock_aCompanyMaster] FOREIGN KEY ([serstkcompanyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [mosshopservicestock] CHECK CONSTRAINT [FK_mosshopservicestock_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mosshopservicestock' AND CONSTRAINT_NAME= 'FK_mosshopservicestock_aItem')
BEGIN
	ALTER TABLE [mosshopservicestock] WITH CHECK ADD  CONSTRAINT [FK_mosshopservicestock_aItem] FOREIGN KEY ([serstkitemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [mosshopservicestock] CHECK CONSTRAINT [FK_mosshopservicestock_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='mosshopservicestock' AND CONSTRAINT_NAME= 'FK_mosshopservicestock_aShops')
BEGIN
	ALTER TABLE [mosshopservicestock] WITH CHECK ADD  CONSTRAINT [FK_mosshopservicestock_aShops] FOREIGN KEY ([serstkshopid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [mosshopservicestock] CHECK CONSTRAINT [FK_mosshopservicestock_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOsShopStock' AND CONSTRAINT_NAME= 'FK_MOsShopStock_aItem')
BEGIN
	ALTER TABLE [MOsShopStock] WITH CHECK ADD  CONSTRAINT [FK_MOsShopStock_aItem] FOREIGN KEY ([ItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [MOsShopStock] CHECK CONSTRAINT [FK_MOsShopStock_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='MOsShopStock' AND CONSTRAINT_NAME= 'FK_MOsShopStock_aShops')
BEGIN
	ALTER TABLE [MOsShopStock] WITH CHECK ADD  CONSTRAINT [FK_MOsShopStock_aShops] FOREIGN KEY ([ShopID]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [MOsShopStock] CHECK CONSTRAINT [FK_MOsShopStock_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='moStockWriteOffHQ' AND CONSTRAINT_NAME= 'FK_moStockWriteOffHQ_aGodown')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] WITH CHECK ADD  CONSTRAINT [FK_moStockWriteOffHQ_aGodown] FOREIGN KEY ([swGodownID]) REFERENCES aGodown([GodownID])
END
GO
 ALTER TABLE [moStockWriteOffHQ] CHECK CONSTRAINT [FK_moStockWriteOffHQ_aGodown]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='moStockWriteOffHQ' AND CONSTRAINT_NAME= 'FK_moStockWriteOffHQ_aItem')
BEGIN
	ALTER TABLE [moStockWriteOffHQ] WITH CHECK ADD  CONSTRAINT [FK_moStockWriteOffHQ_aItem] FOREIGN KEY ([swItemID]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [moStockWriteOffHQ] CHECK CONSTRAINT [FK_moStockWriteOffHQ_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='paPayAccLinkDetails' AND CONSTRAINT_NAME= 'fk_paPayAccLinkDetails_paPayAccLinkHeader')
BEGIN
	ALTER TABLE [paPayAccLinkDetails] WITH CHECK ADD  CONSTRAINT [fk_paPayAccLinkDetails_paPayAccLinkHeader] FOREIGN KEY ([CompanyID],[TransID]) REFERENCES paPayAccLinkHeader([CompanyID],[TransID])
END
GO
 ALTER TABLE [paPayAccLinkDetails] CHECK CONSTRAINT [fk_paPayAccLinkDetails_paPayAccLinkHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='paPayAccLinkPostingDetails' AND CONSTRAINT_NAME= 'fk_paPayAccLinkPostingDetails_paPayAccLinkHeader')
BEGIN
	ALTER TABLE [paPayAccLinkPostingDetails] WITH CHECK ADD  CONSTRAINT [fk_paPayAccLinkPostingDetails_paPayAccLinkHeader] FOREIGN KEY ([CompanyID],[TransID]) REFERENCES paPayAccLinkHeader([CompanyID],[TransID])
END
GO
 ALTER TABLE [paPayAccLinkPostingDetails] CHECK CONSTRAINT [fk_paPayAccLinkPostingDetails_paPayAccLinkHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherCreditDetails' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherCreditDetails_aAccountMaster')
BEGIN
	ALTER TABLE [ReceiptVoucherCreditDetails] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherCreditDetails_aAccountMaster] FOREIGN KEY ([AccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [ReceiptVoucherCreditDetails] CHECK CONSTRAINT [FK_ReceiptVoucherCreditDetails_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherCustomerDetails' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherCustomerDetails_aCustomerMaster')
BEGIN
	ALTER TABLE [ReceiptVoucherCustomerDetails] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherCustomerDetails_aCustomerMaster] FOREIGN KEY ([CustomerId]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [ReceiptVoucherCustomerDetails] CHECK CONSTRAINT [FK_ReceiptVoucherCustomerDetails_aCustomerMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherCustomerDetails' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherCustomerDetails_ReceiptVoucherHeader')
BEGIN
	ALTER TABLE [ReceiptVoucherCustomerDetails] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherCustomerDetails_ReceiptVoucherHeader] FOREIGN KEY ([ReceiptId]) REFERENCES ReceiptVoucherHeader([ReceiptID])
END
GO
 ALTER TABLE [ReceiptVoucherCustomerDetails] CHECK CONSTRAINT [FK_ReceiptVoucherCustomerDetails_ReceiptVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherDetails_aHQPaymentVoucherHeader')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherDetails_aHQPaymentVoucherHeader] FOREIGN KEY ([phpaymentid]) REFERENCES aHQPaymentVoucherHeader([phPaymentID])
END
GO
 ALTER TABLE [ReceiptVoucherDetails] CHECK CONSTRAINT [FK_ReceiptVoucherDetails_aHQPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherDetails_LOsAccountsInvoiceHeader')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherDetails_LOsAccountsInvoiceHeader] FOREIGN KEY ([shopid],[posaccountsInvoiceID]) REFERENCES LOsAccountsInvoiceHeader([aiShopID],[aiInvoiceID])
END
GO
 ALTER TABLE [ReceiptVoucherDetails] CHECK CONSTRAINT [FK_ReceiptVoucherDetails_LOsAccountsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherDetails_losDebitCreditNote')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherDetails_losDebitCreditNote] FOREIGN KEY ([shopid],[losdcnid]) REFERENCES losDebitCreditNote([losDCNShopid],[losDCNId])
END
GO
 ALTER TABLE [ReceiptVoucherDetails] CHECK CONSTRAINT [FK_ReceiptVoucherDetails_losDebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherDetails_ReceiptVoucherHeader')
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherDetails_ReceiptVoucherHeader] FOREIGN KEY ([ReceiptID]) REFERENCES ReceiptVoucherHeader([ReceiptID])
END
GO
 ALTER TABLE [ReceiptVoucherDetails] CHECK CONSTRAINT [FK_ReceiptVoucherDetails_ReceiptVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherHeader_aAccountMaster')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherHeader_aAccountMaster] FOREIGN KEY ([BankCashAccountID],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [ReceiptVoucherHeader] CHECK CONSTRAINT [FK_ReceiptVoucherHeader_aAccountMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'fk_receiptvoucherheader_aaccountmaster_deb')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_receiptvoucherheader_aaccountmaster_deb] FOREIGN KEY ([debitaccountid],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [ReceiptVoucherHeader] CHECK CONSTRAINT [fk_receiptvoucherheader_aaccountmaster_deb]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherHeader_aAccountMaster1')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherHeader_aAccountMaster1] FOREIGN KEY ([creditaccountid],[CompanyID]) REFERENCES aAccountMaster([AccountID],[CompanyID])
END
GO
 ALTER TABLE [ReceiptVoucherHeader] CHECK CONSTRAINT [FK_ReceiptVoucherHeader_aAccountMaster1]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'FK_ReceiptVoucherHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [FK_ReceiptVoucherHeader_aCompanyMaster] FOREIGN KEY ([CompanyID]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [ReceiptVoucherHeader] CHECK CONSTRAINT [FK_ReceiptVoucherHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'fk_receiptvoucherheader_acustomermaster')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_receiptvoucherheader_acustomermaster] FOREIGN KEY ([CustomerID]) REFERENCES aCustomerMaster([CustomerID])
END
GO
 ALTER TABLE [ReceiptVoucherHeader] CHECK CONSTRAINT [fk_receiptvoucherheader_acustomermaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'fk_receiptvoucherheader_adepartmentmaster')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_receiptvoucherheader_adepartmentmaster] FOREIGN KEY ([DepartmentID],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [ReceiptVoucherHeader] CHECK CONSTRAINT [fk_receiptvoucherheader_adepartmentmaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'fk_receiptvoucherheader_afinancialyear')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_receiptvoucherheader_afinancialyear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [ReceiptVoucherHeader] CHECK CONSTRAINT [fk_receiptvoucherheader_afinancialyear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'fk_receiptvoucherheader_avendormaster')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_receiptvoucherheader_avendormaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [ReceiptVoucherHeader] CHECK CONSTRAINT [fk_receiptvoucherheader_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND CONSTRAINT_NAME= 'fk_receiptvoucherheader_losDummyReceiptHeader')
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] WITH CHECK ADD  CONSTRAINT [fk_receiptvoucherheader_losDummyReceiptHeader] FOREIGN KEY ([recshopid],[dummyreceiptid]) REFERENCES losDummyReceiptHeader([drShopid],[drId])
END
GO
 ALTER TABLE [ReceiptVoucherHeader] CHECK CONSTRAINT [fk_receiptvoucherheader_losDummyReceiptHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='SCHEDULEDETAIL' AND CONSTRAINT_NAME= 'FK_SCHEDULEDETAIL_ScheduleHeader')
BEGIN
	ALTER TABLE [SCHEDULEDETAIL] WITH CHECK ADD  CONSTRAINT [FK_SCHEDULEDETAIL_ScheduleHeader] FOREIGN KEY ([scdid]) REFERENCES ScheduleHeader([schid])
END
GO
 ALTER TABLE [SCHEDULEDETAIL] CHECK CONSTRAINT [FK_SCHEDULEDETAIL_ScheduleHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND CONSTRAINT_NAME= 'FK_ServiceInvoiceDetails_AccountsInvoiceHeader')
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] WITH CHECK ADD  CONSTRAINT [FK_ServiceInvoiceDetails_AccountsInvoiceHeader] FOREIGN KEY ([InvoiceID]) REFERENCES AccountsInvoiceHeader([InvoiceID])
END
GO
 ALTER TABLE [ServiceInvoiceDetails] CHECK CONSTRAINT [FK_ServiceInvoiceDetails_AccountsInvoiceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceChequeDetails' AND CONSTRAINT_NAME= 'fk_ShipmentClearenceChequeDetails_ShipmentClearenceHeader')
BEGIN
	ALTER TABLE [ShipmentClearenceChequeDetails] WITH CHECK ADD  CONSTRAINT [fk_ShipmentClearenceChequeDetails_ShipmentClearenceHeader] FOREIGN KEY ([ShopID],[ClearenceID]) REFERENCES ShipmentClearenceHeader([ShopID],[ClearenceID])
END
GO
 ALTER TABLE [ShipmentClearenceChequeDetails] CHECK CONSTRAINT [fk_ShipmentClearenceChequeDetails_ShipmentClearenceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND CONSTRAINT_NAME= 'fk_ShipmentClearenceItemDetails_ClearenceRequestDetail')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] WITH CHECK ADD  CONSTRAINT [fk_ShipmentClearenceItemDetails_ClearenceRequestDetail] FOREIGN KEY ([ShopID],[ClearenceReqID],[ClearenceDetailID]) REFERENCES ClearenceRequestDetail([ShopID],[ClearenceReqID],[DetailID])
END
GO
 ALTER TABLE [ShipmentClearenceItemDetails] CHECK CONSTRAINT [fk_ShipmentClearenceItemDetails_ClearenceRequestDetail]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceItemDetails' AND CONSTRAINT_NAME= 'fk_ShipmentClearenceItemDetails_ShipmentClearenceHeader')
BEGIN
	ALTER TABLE [ShipmentClearenceItemDetails] WITH CHECK ADD  CONSTRAINT [fk_ShipmentClearenceItemDetails_ShipmentClearenceHeader] FOREIGN KEY ([ShopID],[ClearenceID]) REFERENCES ShipmentClearenceHeader([ShopID],[ClearenceID])
END
GO
 ALTER TABLE [ShipmentClearenceItemDetails] CHECK CONSTRAINT [fk_ShipmentClearenceItemDetails_ShipmentClearenceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND CONSTRAINT_NAME= 'fk_ShipmentClearenceOCDetails_ClearenceRequestHeader')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] WITH CHECK ADD  CONSTRAINT [fk_ShipmentClearenceOCDetails_ClearenceRequestHeader] FOREIGN KEY ([ShopID],[ClearenceReqID]) REFERENCES ClearenceRequestHeader([ShopID],[ClearenceReqID])
END
GO
 ALTER TABLE [ShipmentClearenceOCDetails] CHECK CONSTRAINT [fk_ShipmentClearenceOCDetails_ClearenceRequestHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceOCDetails' AND CONSTRAINT_NAME= 'fk_ShipmentClearenceOCDetails_ShipmentClearenceHeader')
BEGIN
	ALTER TABLE [ShipmentClearenceOCDetails] WITH CHECK ADD  CONSTRAINT [fk_ShipmentClearenceOCDetails_ShipmentClearenceHeader] FOREIGN KEY ([ShopID],[ClearenceID]) REFERENCES ShipmentClearenceHeader([ShopID],[ClearenceID])
END
GO
 ALTER TABLE [ShipmentClearenceOCDetails] CHECK CONSTRAINT [fk_ShipmentClearenceOCDetails_ShipmentClearenceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND CONSTRAINT_NAME= 'fk_ShipmentClearenceRequestDetails_ClearenceRequestHeader')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] WITH CHECK ADD  CONSTRAINT [fk_ShipmentClearenceRequestDetails_ClearenceRequestHeader] FOREIGN KEY ([ShopID],[ClearenceReqID]) REFERENCES ClearenceRequestHeader([ShopID],[ClearenceReqID])
END
GO
 ALTER TABLE [ShipmentClearenceRequestDetails] CHECK CONSTRAINT [fk_ShipmentClearenceRequestDetails_ClearenceRequestHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='ShipmentClearenceRequestDetails' AND CONSTRAINT_NAME= 'fk_ShipmentClearenceRequestDetails_ShipmentClearenceHeader')
BEGIN
	ALTER TABLE [ShipmentClearenceRequestDetails] WITH CHECK ADD  CONSTRAINT [fk_ShipmentClearenceRequestDetails_ShipmentClearenceHeader] FOREIGN KEY ([ShopID],[ClearenceID]) REFERENCES ShipmentClearenceHeader([ShopID],[ClearenceID])
END
GO
 ALTER TABLE [ShipmentClearenceRequestDetails] CHECK CONSTRAINT [fk_ShipmentClearenceRequestDetails_ShipmentClearenceHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TempDishSegmentDetail' AND CONSTRAINT_NAME= 'FK_seg_detail_Theader_id_seg_detail_Tcompanyid')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] WITH CHECK ADD  CONSTRAINT [FK_seg_detail_Theader_id_seg_detail_Tcompanyid] FOREIGN KEY ([seg_detail_Theader_id],[seg_detail_Tcompanyid]) REFERENCES DishSegmentHeader([seg_header_id],[seg_header_companyID])
END
GO
 ALTER TABLE [TempDishSegmentDetail] CHECK CONSTRAINT [FK_seg_detail_Theader_id_seg_detail_Tcompanyid]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillBalanceHistory' AND CONSTRAINT_NAME= 'FK_TillBalanceHistory_TillHistory')
BEGIN
	ALTER TABLE [TillBalanceHistory] WITH CHECK ADD  CONSTRAINT [FK_TillBalanceHistory_TillHistory] FOREIGN KEY ([till_hist_id],[till_outletid],[till_companyid]) REFERENCES TillHistory([till_hist_id],[till_outletid],[till_companyid])
END
GO
 ALTER TABLE [TillBalanceHistory] CHECK CONSTRAINT [FK_TillBalanceHistory_TillHistory]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillDetail' AND CONSTRAINT_NAME= 'FK_TillDetail_aCurrencyMaster')
BEGIN
	ALTER TABLE [TillDetail] WITH CHECK ADD  CONSTRAINT [FK_TillDetail_aCurrencyMaster] FOREIGN KEY ([till_td_currencyid],[till_td_companyid]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [TillDetail] CHECK CONSTRAINT [FK_TillDetail_aCurrencyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillDetail' AND CONSTRAINT_NAME= 'FK_TillDetail_TillHeader')
BEGIN
	ALTER TABLE [TillDetail] WITH CHECK ADD  CONSTRAINT [FK_TillDetail_TillHeader] FOREIGN KEY ([till_td_tillid],[till_td_outletid],[till_td_companyid]) REFERENCES TillHeader([till_th_tillid],[till_th_outletid],[till_th_companyid])
END
GO
 ALTER TABLE [TillDetail] CHECK CONSTRAINT [FK_TillDetail_TillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHeader' AND CONSTRAINT_NAME= 'FK_TillHeader_aCompanyMaster')
BEGIN
	ALTER TABLE [TillHeader] WITH CHECK ADD  CONSTRAINT [FK_TillHeader_aCompanyMaster] FOREIGN KEY ([till_th_companyid]) REFERENCES aCompanyMaster([CompanyID])
END
GO
 ALTER TABLE [TillHeader] CHECK CONSTRAINT [FK_TillHeader_aCompanyMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHeader' AND CONSTRAINT_NAME= 'FK_TillHeader_aShops')
BEGIN
	ALTER TABLE [TillHeader] WITH CHECK ADD  CONSTRAINT [FK_TillHeader_aShops] FOREIGN KEY ([till_th_outletid]) REFERENCES aShops([ShopID])
END
GO
 ALTER TABLE [TillHeader] CHECK CONSTRAINT [FK_TillHeader_aShops]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHeader' AND CONSTRAINT_NAME= 'FK_TillHeader_LOUsers')
BEGIN
	ALTER TABLE [TillHeader] WITH CHECK ADD  CONSTRAINT [FK_TillHeader_LOUsers] FOREIGN KEY ([till_th_cashierid]) REFERENCES LOUsers([UserID])
END
GO
 ALTER TABLE [TillHeader] CHECK CONSTRAINT [FK_TillHeader_LOUsers]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHistory' AND CONSTRAINT_NAME= 'FK_TillHistory_CreateModify_User')
BEGIN
	ALTER TABLE [TillHistory] WITH CHECK ADD  CONSTRAINT [FK_TillHistory_CreateModify_User] FOREIGN KEY ([till_createmodify_user]) REFERENCES LOUsers([UserID])
END
GO
 ALTER TABLE [TillHistory] CHECK CONSTRAINT [FK_TillHistory_CreateModify_User]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHistory' AND CONSTRAINT_NAME= 'FK_TillHistory_LOUsers')
BEGIN
	ALTER TABLE [TillHistory] WITH CHECK ADD  CONSTRAINT [FK_TillHistory_LOUsers] FOREIGN KEY ([till_cashierid]) REFERENCES LOUsers([UserID])
END
GO
 ALTER TABLE [TillHistory] CHECK CONSTRAINT [FK_TillHistory_LOUsers]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHistory' AND CONSTRAINT_NAME= 'FK_TillHistory_LOUsers_ManagerUser')
BEGIN
	ALTER TABLE [TillHistory] WITH CHECK ADD  CONSTRAINT [FK_TillHistory_LOUsers_ManagerUser] FOREIGN KEY ([till_managerid]) REFERENCES LOUsers([UserID])
END
GO
 ALTER TABLE [TillHistory] CHECK CONSTRAINT [FK_TillHistory_LOUsers_ManagerUser]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHistory' AND CONSTRAINT_NAME= 'FK_TillHistory_TillHeader')
BEGIN
	ALTER TABLE [TillHistory] WITH CHECK ADD  CONSTRAINT [FK_TillHistory_TillHeader] FOREIGN KEY ([till_id],[till_outletid],[till_companyid]) REFERENCES TillHeader([till_th_tillid],[till_th_outletid],[till_th_companyid])
END
GO
 ALTER TABLE [TillHistory] CHECK CONSTRAINT [FK_TillHistory_TillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHistory' AND CONSTRAINT_NAME= 'FK_TillHistory_TillStatusMaster')
BEGIN
	ALTER TABLE [TillHistory] WITH CHECK ADD  CONSTRAINT [FK_TillHistory_TillStatusMaster] FOREIGN KEY ([till_statusid]) REFERENCES TillStatusMaster([tillstatus_id])
END
GO
 ALTER TABLE [TillHistory] CHECK CONSTRAINT [FK_TillHistory_TillStatusMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillOpeningstock' AND CONSTRAINT_NAME= 'FK_TillOpeningstock_aItem')
BEGIN
	ALTER TABLE [TillOpeningstock] WITH CHECK ADD  CONSTRAINT [FK_TillOpeningstock_aItem] FOREIGN KEY ([itemid]) REFERENCES aItem([ItemID])
END
GO
 ALTER TABLE [TillOpeningstock] CHECK CONSTRAINT [FK_TillOpeningstock_aItem]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementDetail' AND CONSTRAINT_NAME= 'FK_VendorSettlementDetail_Bills')
BEGIN
	ALTER TABLE [VendorSettlementDetail] WITH NOCHECK ADD  CONSTRAINT [FK_VendorSettlementDetail_Bills] FOREIGN KEY ([BillID]) REFERENCES Bills([BillsID])
END
GO
 ALTER TABLE [VendorSettlementDetail] CHECK CONSTRAINT [FK_VendorSettlementDetail_Bills]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementDetail' AND CONSTRAINT_NAME= 'FK_VendorSettlementDetail_DebitCreditNote')
BEGIN
	ALTER TABLE [VendorSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementDetail_DebitCreditNote] FOREIGN KEY ([dcnid]) REFERENCES DebitCreditNote([DCNId])
END
GO
 ALTER TABLE [VendorSettlementDetail] CHECK CONSTRAINT [FK_VendorSettlementDetail_DebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementDetail' AND CONSTRAINT_NAME= 'FK_VendorSettlementDetail_losDebitCreditNote')
BEGIN
	ALTER TABLE [VendorSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementDetail_losDebitCreditNote] FOREIGN KEY ([shopid],[losdcnid]) REFERENCES losDebitCreditNote([losDCNShopid],[losDCNId])
END
GO
 ALTER TABLE [VendorSettlementDetail] CHECK CONSTRAINT [FK_VendorSettlementDetail_losDebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementDetail' AND CONSTRAINT_NAME= 'FK_VendorSettlementDetail_LosLocalPurchaseHeader')
BEGIN
	ALTER TABLE [VendorSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementDetail_LosLocalPurchaseHeader] FOREIGN KEY ([shopid],[lphbillid]) REFERENCES LosLocalPurchaseHeader([lphShopID],[lphBillID])
END
GO
 ALTER TABLE [VendorSettlementDetail] CHECK CONSTRAINT [FK_VendorSettlementDetail_LosLocalPurchaseHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementDetail' AND CONSTRAINT_NAME= 'FK_VendorSettlementDetail_LOspPurchaseBillHeader')
BEGIN
	ALTER TABLE [VendorSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementDetail_LOspPurchaseBillHeader] FOREIGN KEY ([pbhbillid]) REFERENCES LOspPurchaseBillHeader([pbhBillID])
END
GO
 ALTER TABLE [VendorSettlementDetail] CHECK CONSTRAINT [FK_VendorSettlementDetail_LOspPurchaseBillHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementDetail' AND CONSTRAINT_NAME= 'FK_VendorSettlementDetail_ReceiptVoucherHeader')
BEGIN
	ALTER TABLE [VendorSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementDetail_ReceiptVoucherHeader] FOREIGN KEY ([receiptid]) REFERENCES ReceiptVoucherHeader([ReceiptID])
END
GO
 ALTER TABLE [VendorSettlementDetail] CHECK CONSTRAINT [FK_VendorSettlementDetail_ReceiptVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementDetail' AND CONSTRAINT_NAME= 'FK_VendorSettlementDetail_VendorSettlementHeader')
BEGIN
	ALTER TABLE [VendorSettlementDetail] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementDetail_VendorSettlementHeader] FOREIGN KEY ([VSID]) REFERENCES VendorSettlementHeader([VSID])
END
GO
 ALTER TABLE [VendorSettlementDetail] CHECK CONSTRAINT [FK_VendorSettlementDetail_VendorSettlementHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementHeader' AND CONSTRAINT_NAME= 'FK_VendorSettlementHeader_aDepartmentMaster')
BEGIN
	ALTER TABLE [VendorSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementHeader_aDepartmentMaster] FOREIGN KEY ([DepartmentID],[CompanyID]) REFERENCES aDepartmentMaster([DepartmentID],[CompanyID])
END
GO
 ALTER TABLE [VendorSettlementHeader] CHECK CONSTRAINT [FK_VendorSettlementHeader_aDepartmentMaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementHeader' AND CONSTRAINT_NAME= 'FK_VendorSettlementHeader_aFinancialYear')
BEGIN
	ALTER TABLE [VendorSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementHeader_aFinancialYear] FOREIGN KEY ([FinancialID],[CompanyID]) REFERENCES aFinancialYear([FinancialID],[CompanyID])
END
GO
 ALTER TABLE [VendorSettlementHeader] CHECK CONSTRAINT [FK_VendorSettlementHeader_aFinancialYear]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementHeader' AND CONSTRAINT_NAME= 'FK_VendorSettlementHeader_aHQPaymentVoucherHeader')
BEGIN
	ALTER TABLE [VendorSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementHeader_aHQPaymentVoucherHeader] FOREIGN KEY ([PaymentID]) REFERENCES aHQPaymentVoucherHeader([phPaymentID])
END
GO
 ALTER TABLE [VendorSettlementHeader] CHECK CONSTRAINT [FK_VendorSettlementHeader_aHQPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementHeader' AND CONSTRAINT_NAME= 'fk_vendorsettlementheader_avendormaster')
BEGIN
	ALTER TABLE [VendorSettlementHeader] WITH CHECK ADD  CONSTRAINT [fk_vendorsettlementheader_avendormaster] FOREIGN KEY ([VendorID]) REFERENCES aVendorMaster([VendorID])
END
GO
 ALTER TABLE [VendorSettlementHeader] CHECK CONSTRAINT [fk_vendorsettlementheader_avendormaster]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementHeader' AND CONSTRAINT_NAME= 'FK_VendorSettlementHeader_DebitCreditNote')
BEGIN
	ALTER TABLE [VendorSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementHeader_DebitCreditNote] FOREIGN KEY ([dcnid]) REFERENCES DebitCreditNote([DCNId])
END
GO
 ALTER TABLE [VendorSettlementHeader] CHECK CONSTRAINT [FK_VendorSettlementHeader_DebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementHeader' AND CONSTRAINT_NAME= 'FK_VendorSettlementHeader_losDebitCreditNote')
BEGIN
	ALTER TABLE [VendorSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementHeader_losDebitCreditNote] FOREIGN KEY ([shopid],[losdcnid]) REFERENCES losDebitCreditNote([losDCNShopid],[losDCNId])
END
GO
 ALTER TABLE [VendorSettlementHeader] CHECK CONSTRAINT [FK_VendorSettlementHeader_losDebitCreditNote]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VendorSettlementHeader' AND CONSTRAINT_NAME= 'FK_VendorSettlementHeader_LOsPaymentVoucherHeader')
BEGIN
	ALTER TABLE [VendorSettlementHeader] WITH CHECK ADD  CONSTRAINT [FK_VendorSettlementHeader_LOsPaymentVoucherHeader] FOREIGN KEY ([lospaymentid],[shopid]) REFERENCES LOsPaymentVoucherHeader([phPaymentID],[phShopID])
END
GO
 ALTER TABLE [VendorSettlementHeader] CHECK CONSTRAINT [FK_VendorSettlementHeader_LOsPaymentVoucherHeader]
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VoucherMaster' AND CONSTRAINT_NAME= 'FK_VoucherMaster_VoucherMaster')
BEGIN
	ALTER TABLE [VoucherMaster] WITH CHECK ADD  CONSTRAINT [FK_VoucherMaster_VoucherMaster] FOREIGN KEY ([VoucherCurrencyID],[VoucherCompanyID]) REFERENCES aCurrencyMaster([CurrencyID],[CompanyID])
END
GO
 ALTER TABLE [VoucherMaster] CHECK CONSTRAINT [FK_VoucherMaster_VoucherMaster]
GO
 CREATE PROCEDURE DropUK
 AS
 BEGIN
--Script for Drop All Unique Constraints
 CREATE TABLE #sqlDeleteAllUK 
(
		ConstraintID INT IDENTITY(1,1) NOT NULL,  
		SqlStatement VARCHAR(4000) 
)
 INSERT INTO #sqlDeleteAllUK 
 SELECT 'ALTER TABLE ' + TABLE_SCHEMA + '.' + TABLE_NAME + 
' DROP CONSTRAINT ' + CONSTRAINT_NAME 
 FROM information_schema.table_constraints 
 WHERE CONSTRAINT_TYPE = 'UNIQUE' 
 DECLARE @intID INT 
 DECLARE @intCount INT 
 SET @intID = 1 
 SELECT @intCount= COUNT(*) 
 FROM #sqlDeleteAllUK 
 DECLARE @SqlStatement NVARCHAR(4000) 
 WHILE @intID <= @intCount 
 BEGIN 
	SELECT @SqlStatement = SqlStatement 
 FROM #sqlDeleteAllUK 
 WHERE ConstraintID = @intID 
 execute sp_executesql @SqlStatement 
 SET @intID = @intID + 1 
 END 
 DROP TABLE #sqlDeleteAllUK
 END 
 GO 
 EXEC  DropUK
 GO 
 DROP PROCEDURE  DropUK
 GO 
--Script for Unique Constraints
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aDeptAccounts' AND CONSTRAINT_NAME= 'UQ_aDeptAccounts')
BEGIN
	ALTER TABLE [aDeptAccounts] WITH CHECK ADD  CONSTRAINT [UQ_aDeptAccounts] UNIQUE NONCLUSTERED([daCompanyID],[daDepartmentID],[daAccountID])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aPrefix' AND CONSTRAINT_NAME= 'IX_aPrefix')
BEGIN
	ALTER TABLE [aPrefix] WITH CHECK ADD  CONSTRAINT [IX_aPrefix] UNIQUE NONCLUSTERED([CompanyID],[InterfaceID],[shopid],[godownid],[departmentid],[Financialid])
		WITH  FILLFACTOR = 90
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='aTaxCategoryMaster' AND CONSTRAINT_NAME= 'UQ__aTaxCategoryMast__387BD129')
BEGIN
	ALTER TABLE [aTaxCategoryMaster] WITH CHECK ADD  CONSTRAINT [UQ__aTaxCategoryMast__387BD129] UNIQUE NONCLUSTERED([TaxCategoryCode])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='DishSegmentDetail' AND CONSTRAINT_NAME= 'UK_segid_segheaderid_segdishid_segcompanyid_segoutletid_SegUpdateTime')
BEGIN
	ALTER TABLE [DishSegmentDetail] WITH CHECK ADD  CONSTRAINT [UK_segid_segheaderid_segdishid_segcompanyid_segoutletid_SegUpdateTime] UNIQUE NONCLUSTERED([seg_detail_id],[seg_detail_header_id],[seg_detail_dishid],[seg_detail_companyid],[seg_detail_outletid],[Seg_Detail_UpdateTime])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='FlightOperatorMaster' AND CONSTRAINT_NAME= 'Unique_FlightOperatorName')
BEGIN
	ALTER TABLE [FlightOperatorMaster] WITH CHECK ADD  CONSTRAINT [Unique_FlightOperatorName] UNIQUE NONCLUSTERED([FlghtOpName])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='Flights' AND CONSTRAINT_NAME= 'Unique_FlightNo')
BEGIN
	ALTER TABLE [Flights] WITH CHECK ADD  CONSTRAINT [Unique_FlightNo] UNIQUE NONCLUSTERED([FlightNo])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TempDishSegmentDetail' AND CONSTRAINT_NAME= 'UK_segTid_segTheaderid_segTdishid_segTcompanyid_segToutletid_SegTUpdateTime_SegTNewInsertedID')
BEGIN
	ALTER TABLE [TempDishSegmentDetail] WITH CHECK ADD  CONSTRAINT [UK_segTid_segTheaderid_segTdishid_segTcompanyid_segToutletid_SegTUpdateTime_SegTNewInsertedID] UNIQUE NONCLUSTERED([seg_detail_Tid],[seg_detail_Theader_id],[seg_detail_Tdishid],[seg_detail_Tcompanyid],[seg_detail_Toutletid],[seg_detail_TUpdateTime],[seg_detail_TLatestID])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillDetail' AND CONSTRAINT_NAME= 'Unique_TillHeaderID_TillCurrencyID')
BEGIN
	ALTER TABLE [TillDetail] WITH CHECK ADD  CONSTRAINT [Unique_TillHeaderID_TillCurrencyID] UNIQUE NONCLUSTERED([till_td_tillid],[till_td_currencyid],[till_td_outletid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='TillHeader' AND CONSTRAINT_NAME= 'Unique_TllHeaderName')
BEGIN
	ALTER TABLE [TillHeader] WITH CHECK ADD  CONSTRAINT [Unique_TllHeaderName] UNIQUE NONCLUSTERED([till_th_tillname],[till_th_outletid])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='VoucherMaster' AND CONSTRAINT_NAME= 'Unique_VoucherName')
BEGIN
	ALTER TABLE [VoucherMaster] WITH CHECK ADD  CONSTRAINT [Unique_VoucherName] UNIQUE NONCLUSTERED([VoucherName])
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE  TABLE_NAME='WeekDays' AND CONSTRAINT_NAME= 'Unique_WeekDays')
BEGIN
	ALTER TABLE [WeekDays] WITH CHECK ADD  CONSTRAINT [Unique_WeekDays] UNIQUE NONCLUSTERED([week_days])
END
GO
 CREATE PROCEDURE DropDK
 AS
 BEGIN
--Script for Drop All Default Constraints
 DECLARE @SqlStatement NVARCHAR(4000) 
CREATE TABLE #sqlDeleteAllDefault
(
	ConstraintID INT IDENTITY(1,1) NOT NULL,
	TABLE_NAME VARCHAR(250),
	CONSTRAINT_NAME VARCHAR(250) 
)
INSERT INTO #sqlDeleteAllDefault
SELECT  
b.name AS TABLE_NAME, 
   a.name AS CONSTRAINT_NAME
FROM sys.sysobjects a INNER JOIN 
   (SELECT name, id 
       FROM sys.sysobjects 
       WHERE xtype = 'U') b on (a.parent_obj = b.id)
                    INNER JOIN sys.syscomments c ON (a.id = c.id) 
                    INNER JOIN sys.syscolumns d ON (d.cdefault = a.id)
 WHERE a.xtype = 'D'
 ORDER BY b.name, a.name
 DECLARE @intID INT
 DECLARE @intCountID INT 
 DECLARE @strTableName VARCHAR(250)
 DECLARE @strConstraintName VARCHAR(250)
 SET @intID = 1 
 SELECT @intCountID = COUNT(1) FROM #sqlDeleteAllDefault 
 IF @intCountID >= 1 
 BEGIN
		WHILE @intID <= @intCountID
		BEGIN 
			SELECT @strTableName = TABLE_NAME,
			@strConstraintName = CONSTRAINT_NAME 
			FROM #sqlDeleteAllDefault
			WHERE ConstraintID = @intID
			SET  @SqlStatement =  'ALTER TABLE ' + @strTableName + 
			' DROP CONSTRAINT [' + @strConstraintName + ']' 
			execute sp_executesql @SqlStatement
		SET @intID = @intID + 1
	END
 END
 DROP TABLE #sqlDeleteAllDefault
 END 
 GO 
 EXEC  DropDK
 GO 
 DROP PROCEDURE  DropDK
 GO 
--Script for Default Constraints
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aAccountMaster] ADD CONSTRAINT [DF__aAccountM__rowgu__7B5CE8F9] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME= 'BudgetAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aAccountMaster] ADD CONSTRAINT [DF_aAccountMaster_BudgetAmount] DEFAULT ((0)) FOR [BudgetAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccountMaster' AND COLUMN_NAME= 'Misc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aAccountMaster] ADD CONSTRAINT [DF_aAccountMaster_Misc] DEFAULT ('') FOR [Misc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesAccounts' AND COLUMN_NAME= 'CalcType' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AAccRatioEntitiesAccounts] ADD CONSTRAINT [DF__AAccRatio__CalcT__77816B1D] DEFAULT ((1)) FOR [CalcType]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AAccRatioEntitiesMaster' AND COLUMN_NAME= 'Numerator' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AAccRatioEntitiesMaster] ADD CONSTRAINT [DF__AAccRatio__Numer__71C891C7] DEFAULT ((1)) FOR [Numerator]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME= 'Active' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD CONSTRAINT [DF__aAccRatio__Activ__4401C717] DEFAULT ((0)) FOR [Active]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME= 'Multiplier' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD CONSTRAINT [DF__aAccRatio__Multi__759922AB] DEFAULT ((1.00)) FOR [Multiplier]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAccRatioGroupMaster' AND COLUMN_NAME= 'RatioType' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aAccRatioGroupMaster] ADD CONSTRAINT [DF__aAccRatio__Ratio__74A4FE72] DEFAULT ('P') FOR [RatioType]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAnalysedPOItems' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aAnalysedPOItems] ADD CONSTRAINT [DF_aAnalysedPOItems_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aAutoGenerateBillRiminder' AND COLUMN_NAME= 'Generated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aAutoGenerateBillRiminder] ADD CONSTRAINT [DF_aAutoGenerateBillRiminder_Generated] DEFAULT ((0)) FOR [Generated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='abarcodetype' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [abarcodetype] ADD CONSTRAINT [DF__abarcodet__rowgu__699C94C3] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aBrandMaster] ADD CONSTRAINT [DF__aBrandMas__rowgu__38102627] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME= 'Cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD CONSTRAINT [DF_aBrandMergeDetails_Cancelled] DEFAULT ((0)) FOR [Cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aBrandMergeDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aBrandMergeDetails] ADD CONSTRAINT [DF_aBrandMergeDetails_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME= 'ExcludeGST' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD CONSTRAINT [DF__AccountsI__Exclu__0AD36B5C] DEFAULT ((0)) FOR [ExcludeGST]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME= 'Discount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD CONSTRAINT [DF_AccountsInvoiceHeader_Discount] DEFAULT ((0)) FOR [Discount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME= 'ExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD CONSTRAINT [DF_AccountsInvoiceHeader_ExchangeRate] DEFAULT ((1)) FOR [ExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME= 'Futurevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD CONSTRAINT [DF_AccountsInvoiceHeader_Futurevc] DEFAULT ('') FOR [Futurevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AccountsInvoiceHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AccountsInvoiceHeader] ADD CONSTRAINT [DF_AccountsInvoiceHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCity' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCity] ADD CONSTRAINT [DF__aCity__rowguid__5E3FF0B0] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aColor' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aColor] ADD CONSTRAINT [DF__aColor__rowguid__37B03374] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCompanyMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCompanyMaster] ADD CONSTRAINT [DF__aCompanyM__rowgu__41A3B202] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCountryMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCountryMaster] ADD CONSTRAINT [DF__aCountryM__rowgu__3D690CCA] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCurrencyMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCurrencyMaster] ADD CONSTRAINT [DF__aCurrency__rowgu__63F8CA06] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME= 'Prefix' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerGroup] ADD CONSTRAINT [DF__aCustomer__Prefi__0E8400AF] DEFAULT ('') FOR [Prefix]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME= 'PrefixActive' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerGroup] ADD CONSTRAINT [DF__aCustomer__Prefi__0F7824E8] DEFAULT ((0)) FOR [PrefixActive]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerGroup' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerGroup] ADD CONSTRAINT [DF_aCustomerGroup_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME= 'ExcludeGST' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerMaster] ADD CONSTRAINT [DF__aCustomer__Exclu__34FEAF52] DEFAULT ((0)) FOR [ExcludeGST]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerMaster] ADD CONSTRAINT [DF__aCustomer__rowgu__1F4E99FE] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME= 'Active' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerMaster] ADD CONSTRAINT [DF_aCustomerMaster_Active] DEFAULT ((1)) FOR [Active]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME= 'CreditLimit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerMaster] ADD CONSTRAINT [DF_aCustomerMaster_CreditLimit] DEFAULT ((0)) FOR [CreditLimit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME= 'CustomerCategory' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerMaster] ADD CONSTRAINT [DF_aCustomerMaster_CustomerCategory] DEFAULT ('') FOR [CustomerCategory]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME= 'Dueperiod' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerMaster] ADD CONSTRAINT [DF_aCustomerMaster_Dueperiod] DEFAULT ((0)) FOR [Dueperiod]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME= 'OpeningCreditBalance' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerMaster] ADD CONSTRAINT [DF_aCustomerMaster_OpeningCreditBalance] DEFAULT ((0)) FOR [OpeningCreditBalance]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMaster' AND COLUMN_NAME= 'OpeningDebitBalance' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerMaster] ADD CONSTRAINT [DF_aCustomerMaster_OpeningDebitBalance] DEFAULT ((0)) FOR [OpeningDebitBalance]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomerMasterBackUp' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomerMasterBackUp] ADD CONSTRAINT [DF__aCustomer__rowgu__4321E620] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aCustomsMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aCustomsMaster] ADD CONSTRAINT [DF__aCustomsM__rowgu__48DABF76] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD CONSTRAINT [DF__aDepartme__rowgu__271AA44F] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME= 'BudgetedAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD CONSTRAINT [DF_aDepartmentMaster_BudgetedAmount] DEFAULT ((0)) FOR [BudgetedAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aDepartmentMaster' AND COLUMN_NAME= 'Selected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aDepartmentMaster] ADD CONSTRAINT [DF_aDepartmentMaster_Selected] DEFAULT ((0)) FOR [Selected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='adistributormaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [adistributormaster] ADD CONSTRAINT [DF__adistribu__rowgu__5F35AB97] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME= 'Cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD CONSTRAINT [DF_AdjustmentHeader_Cancelled] DEFAULT ((0)) FOR [Cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME= 'ExchangeGain' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD CONSTRAINT [DF_AdjustmentHeader_ExchangeGain] DEFAULT ('') FOR [ExchangeGain]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AdjustmentHeader' AND COLUMN_NAME= 'Posted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AdjustmentHeader] ADD CONSTRAINT [DF_AdjustmentHeader_Posted] DEFAULT ((0)) FOR [Posted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFinancialYear' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aFinancialYear] ADD CONSTRAINT [DF__aFinancia__rowgu__4E9398CC] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFinancialYear' AND COLUMN_NAME= 'CurFinancialYear' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aFinancialYear] ADD CONSTRAINT [DF_aFinancialYear_CurFinancialYear] DEFAULT ((0)) FOR [CurFinancialYear]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aFineHeader' AND COLUMN_NAME= 'fhInvoiceCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aFineHeader] ADD CONSTRAINT [DF__aFineHead__fhInv__2D0887CF] DEFAULT ((0)) FOR [fhInvoiceCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGlobalUsers' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGlobalUsers] ADD CONSTRAINT [DF__aGlobalUs__rowgu__63E3BB6D] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGodown] ADD CONSTRAINT [DF__aGodown__rowguid__31CED39A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME= 'selected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGodown] ADD CONSTRAINT [DF__agodown__selecte__24A84BF8] DEFAULT ((0)) FOR [selected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME= 'Fifo' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGodown] ADD CONSTRAINT [DF_aGodown_Fifo] DEFAULT ((1)) FOR [Fifo]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodown' AND COLUMN_NAME= 'LocationArrangement' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGodown] ADD CONSTRAINT [DF_aGodown_LocationArrangement] DEFAULT ((0)) FOR [LocationArrangement]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGodownDetail] ADD CONSTRAINT [DF__aGodownDe__rowgu__40257DE4] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME= 'OrderRaised' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGodownDetail] ADD CONSTRAINT [DF_aGodownDetail_OrderRaised] DEFAULT ((0)) FOR [OrderRaised]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownDetail' AND COLUMN_NAME= 'QuotationRaised' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGodownDetail] ADD CONSTRAINT [DF_aGodownDetail_QuotationRaised] DEFAULT ((0)) FOR [QuotationRaised]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGodownItemCategory' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGodownItemCategory] ADD CONSTRAINT [DF__aGodownIt__rowgu__13FCE2E3] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementRegister' AND COLUMN_NAME= 'agrcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AgreementRegister] ADD CONSTRAINT [DF_AgreementRegister_agrcancelled] DEFAULT ((0)) FOR [agrcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementSignedDetails' AND COLUMN_NAME= 'agsAgency' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AgreementSignedDetails] ADD CONSTRAINT [DF__Agreement__agsAg__15C5FB1B] DEFAULT ((0)) FOR [agsAgency]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AgreementWitnessDetails' AND COLUMN_NAME= 'agwAgency' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AgreementWitnessDetails] ADD CONSTRAINT [DF__Agreement__agwAg__17AE438D] DEFAULT ((0)) FOR [agwAgency]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aGroupMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aGroupMaster] ADD CONSTRAINT [DF__aGroupMas__rowgu__30792600] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD CONSTRAINT [DF__aHQDespat__rowgu__62720AF5] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteDetails' AND COLUMN_NAME= 'ddCostPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchNoteDetails] ADD CONSTRAINT [DF_aHQDespatchNoteDetails_ddCostPrice] DEFAULT ((0)) FOR [ddCostPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD CONSTRAINT [DF__aHQDespat__rowgu__2942188C] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME= 'barcodegenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD CONSTRAINT [DF_aHQDespatchnoteHeader_barcodegenerated] DEFAULT ((0)) FOR [barcodegenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME= 'dhCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD CONSTRAINT [DF_aHQDespatchnoteHeader_dhCancelled] DEFAULT ((0)) FOR [dhCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME= 'dhNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD CONSTRAINT [DF_aHQDespatchnoteHeader_dhNoofDetails] DEFAULT ((0)) FOR [dhNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME= 'dhSelected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD CONSTRAINT [DF_aHQDespatchnoteHeader_dhSelected] DEFAULT ((0)) FOR [dhSelected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME= 'dhTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD CONSTRAINT [DF_aHQDespatchnoteHeader_dhTransFinished] DEFAULT ((0)) FOR [dhTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME= 'Futurevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD CONSTRAINT [DF_aHQDespatchnoteHeader_Futurevc] DEFAULT ('') FOR [Futurevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchnoteHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchnoteHeader] ADD CONSTRAINT [DF_aHQDespatchnoteHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD CONSTRAINT [DF__aHQDespat__rowgu__45DE573A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME= 'dnmCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD CONSTRAINT [DF_aHQDespatchNoteMain_dnmCancelled] DEFAULT ((0)) FOR [dnmCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME= 'dnmCostPriceFixed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD CONSTRAINT [DF_aHQDespatchNoteMain_dnmCostPriceFixed] DEFAULT ((0)) FOR [dnmCostPriceFixed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME= 'Futurevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD CONSTRAINT [DF_aHQDespatchNoteMain_Futurevc] DEFAULT ('') FOR [Futurevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQDespatchNoteMain' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQDespatchNoteMain] ADD CONSTRAINT [DF_aHQDespatchNoteMain_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssuenoteDetail] ADD CONSTRAINT [DF__aHQIssuen__rowgu__544C7222] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD CONSTRAINT [DF__aHQIssuen__rowgu__216BEC9A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME= 'futurevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD CONSTRAINT [DF_aHQIssuenoteHeader_futurevc] DEFAULT ('') FOR [futurevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME= 'INHCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD CONSTRAINT [DF_aHQIssuenoteHeader_INHCancelled] DEFAULT ((0)) FOR [INHCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME= 'INHNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD CONSTRAINT [DF_aHQIssuenoteHeader_INHNoofDetails] DEFAULT ((0)) FOR [INHNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME= 'INHTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD CONSTRAINT [DF_aHQIssuenoteHeader_INHTransFinished] DEFAULT ((0)) FOR [INHTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME= 'INHUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD CONSTRAINT [DF_aHQIssuenoteHeader_INHUsed] DEFAULT ((0)) FOR [INHUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssuenoteHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssuenoteHeader] ADD CONSTRAINT [DF_aHQIssuenoteHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD CONSTRAINT [DF__aHQIssueN__rowgu__69B1A35C] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME= 'futurevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD CONSTRAINT [DF_aHQIssueNoteMain_futurevc] DEFAULT ('') FOR [futurevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME= 'INMCancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD CONSTRAINT [DF_aHQIssueNoteMain_INMCancel] DEFAULT ((0)) FOR [INMCancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQIssueNoteMain' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQIssueNoteMain] ADD CONSTRAINT [DF_aHQIssueNoteMain_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHqMergingDetails] ADD CONSTRAINT [DF_aHqMergingDetails_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHqMergingHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHqMergingHeader] ADD CONSTRAINT [DF_aHqMergingHeader_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherDebitDetails' AND COLUMN_NAME= 'pddVendorExchangeDifference' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQPaymentVoucherDebitDetails] ADD CONSTRAINT [DF__aHQpaymen__pddVe__2C0A41F5] DEFAULT ((0)) FOR [pddVendorExchangeDifference]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME= 'phconfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD CONSTRAINT [DF__aHQPaymen__phcon__398E5A45] DEFAULT ((0)) FOR [phconfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME= 'phExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD CONSTRAINT [DF_aHQPaymentVoucherHeader_phExchangeRate] DEFAULT ((1)) FOR [phExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME= 'phlcpayment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD CONSTRAINT [DF_aHQPaymentVoucherHeader_phlcpayment] DEFAULT ('OP') FOR [phlcpayment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME= 'refreceiptid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD CONSTRAINT [DF_aHQPaymentVoucherHeader_refreceiptid] DEFAULT (NULL) FOR [refreceiptid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPaymentVoucherHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQPaymentVoucherHeader] ADD CONSTRAINT [DF_aHQPaymentVoucherHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aHQPDChequeProcessing' AND COLUMN_NAME= 'PDChequePosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aHQPDChequeProcessing] ADD CONSTRAINT [DF__aHQPDCheq__PDChe__19018F22] DEFAULT ((0)) FOR [PDChequePosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ahqPostDatedChequeDetails' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ahqPostDatedChequeDetails] ADD CONSTRAINT [DF__ahqPostDa__updat__11606D5A] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aInterface] ADD CONSTRAINT [DF__aInterfac__rowgu__3631FF56] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aInterface' AND COLUMN_NAME= 'PrefixNeeded' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aInterface] ADD CONSTRAINT [DF_aInterface_PrefixNeeded] DEFAULT ((0)) FOR [PrefixNeeded]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'partsWarrantyPeriod' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF__aItem__partsWarr__58E70A0D] DEFAULT ((0)) FOR [partsWarrantyPeriod]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF__aItem__rowguid__5CECA51B] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'SerialNoDupli' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF__aitem__SerialNoD__59B43E70] DEFAULT ((0)) FOR [SerialNoDupli]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'servWarrantyPeriod' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF__aItem__servWarra__57F2E5D4] DEFAULT ((0)) FOR [servWarrantyPeriod]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'bitf1' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_bitf1] DEFAULT ((0)) FOR [bitf1]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'bitf2' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_bitf2] DEFAULT ((0)) FOR [bitf2]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'bitf3' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_bitf3] DEFAULT ((0)) FOR [bitf3]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'brand' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_brand] DEFAULT ('') FOR [brand]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'compvarflag' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [df_aitem_compvarflag] DEFAULT ((0)) FOR [compvarflag]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'DPMargin' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_DPMargin] DEFAULT ((0)) FOR [DPMargin]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'DPQty' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_DPQty] DEFAULT ((0)) FOR [DPQty]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'ExpiryNoofDays' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_ExpiryNoofDays] DEFAULT ((0)) FOR [ExpiryNoofDays]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'GenerateBC' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_GenerateBC] DEFAULT ((1)) FOR [GenerateBC]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'forsales' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_itemforsale] DEFAULT ((1)) FOR [forsales]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'itemvarflag' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [df_aitem_itemvarflag] DEFAULT ((0)) FOR [itemvarflag]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'MarginPercent' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_MarginPercent] DEFAULT ((0)) FOR [MarginPercent]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'ModelNo' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_ModelNo] DEFAULT ('') FOR [ModelNo]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'onetimeshipment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_onetimeshipment] DEFAULT ((0)) FOR [onetimeshipment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'pricefixedathq' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_pricefixedathq] DEFAULT ((0)) FOR [pricefixedathq]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'QuantityDecimal' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_QuantityDecimal] DEFAULT ('') FOR [QuantityDecimal]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'ReorderLevel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_ReorderLevel] DEFAULT ((0)) FOR [ReorderLevel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'ReorderQuantity' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_ReorderQuantity] DEFAULT ((0)) FOR [ReorderQuantity]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'Vendors' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_Vendors] DEFAULT ('0') FOR [Vendors]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'WPMargin' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_WPMargin] DEFAULT ((0)) FOR [WPMargin]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItem' AND COLUMN_NAME= 'WPQty' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItem] ADD CONSTRAINT [DF_aItem_WPQty] DEFAULT ((0)) FOR [WPQty]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemCategory] ADD CONSTRAINT [DF__aItemCate__rowgu__5A054B78] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME= 'DPDefMargin' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemCategory] ADD CONSTRAINT [DF_aItemCategory_DPDefMargin] DEFAULT ((0)) FOR [DPDefMargin]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME= 'DPDefQty' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemCategory] ADD CONSTRAINT [DF_aItemCategory_DPDefQty] DEFAULT ((0)) FOR [DPDefQty]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME= 'SalesValue' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemCategory] ADD CONSTRAINT [DF_aItemCategory_SalesValue_1] DEFAULT ((0)) FOR [SalesValue]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME= 'SPDefMargin' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemCategory] ADD CONSTRAINT [DF_aItemCategory_SPDefMargin] DEFAULT ((0)) FOR [SPDefMargin]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME= 'WPDefMargin' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemCategory] ADD CONSTRAINT [DF_aItemCategory_WPDefMargin] DEFAULT ((0)) FOR [WPDefMargin]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategory' AND COLUMN_NAME= 'WPDefQty' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemCategory] ADD CONSTRAINT [DF_aItemCategory_WPDefQty] DEFAULT ((0)) FOR [WPDefQty]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemCategoryMergingDetails' AND COLUMN_NAME= 'Rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemCategoryMergingDetails] ADD CONSTRAINT [DF_aItemCategoryMergingDetails_Rowguid] DEFAULT (newid()) FOR [Rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemPackingDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemPackingDetail] ADD CONSTRAINT [DF__aItemPack__rowgu__66161CA2] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aItemPackingDetail' AND COLUMN_NAME= 'active' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aItemPackingDetail] ADD CONSTRAINT [DF_aItemPackingDetail_active] DEFAULT ((0)) FOR [active]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemDetail' AND COLUMN_NAME= 'KitDetailId' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aKitItemDetail] ADD CONSTRAINT [DF__aKitItemD__KitDe__2C146396] DEFAULT ((0)) FOR [KitDetailId]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aKitItemMaster' AND COLUMN_NAME= 'GenerateBarcode' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aKitItemMaster] ADD CONSTRAINT [DF__aKitItemM__Gener__1AE9D794] DEFAULT ((0)) FOR [GenerateBarcode]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListItemDetails' AND COLUMN_NAME= 'Qty' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aListItemDetails] ADD CONSTRAINT [DF_aListItemDetails_Qty] DEFAULT ((1)) FOR [Qty]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewDetails' AND COLUMN_NAME= 'lvwdcolalign' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aListViewDetails] ADD CONSTRAINT [DF_aListViewDetails_lvwdcolalign] DEFAULT ((0)) FOR [lvwdcolalign]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aListViewDetails' AND COLUMN_NAME= 'lvwdcolwidth' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aListViewDetails] ADD CONSTRAINT [DF_aListViewDetails_lvwdcolwidth] DEFAULT ((1500)) FOR [lvwdcolwidth]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'Alias' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__Alias__33807B34] DEFAULT ((0)) FOR [Alias]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'AllowDirectLocalPurchaseCosting' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__Allow__34749F6D] DEFAULT ((0)) FOR [AllowDirectLocalPurchaseCosting]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'AllowItemCodeDuplication' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__apackages__Allow__4615C369] DEFAULT ((0)) FOR [AllowItemCodeDuplication]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'AutoConfirmAccTrans' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__AutoC__365CE7DF] DEFAULT ((0)) FOR [AutoConfirmAccTrans]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'EnableRemainderAccBills' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__Enabl__3568C3A6] DEFAULT ((0)) FOR [EnableRemainderAccBills]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'HQLocalPurchaseConfirmation' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__HQLoc__328C56FB] DEFAULT ((0)) FOR [HQLocalPurchaseConfirmation]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'NeedApproval' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__NeedA__6E0D0F7C] DEFAULT ((0)) FOR [NeedApproval]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'NoCreditForOverdueCustomers' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__NoCre__38453051] DEFAULT ((0)) FOR [NoCreditForOverdueCustomers]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'postdatedcheque' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__postd__3939548A] DEFAULT ((0)) FOR [postdatedcheque]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__rowgu__5FBE24CE] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPAckageSettings' AND COLUMN_NAME= 'SellingPriceBelowCostPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPAckageSettings] ADD CONSTRAINT [DF__aPAckageS__Selli__37510C18] DEFAULT ((0)) FOR [SellingPriceBelowCostPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingType' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPackingType] ADD CONSTRAINT [DF__aPackingT__rowgu__6576FE24] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPackingTypeCapacityDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPackingTypeCapacityDetail] ADD CONSTRAINT [DF__aPackingT__rowgu__475C8B58] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aparentCategoryMergingDetails' AND COLUMN_NAME= 'Rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aparentCategoryMergingDetails] ADD CONSTRAINT [DF_aparentCategoryMergingDetails_Rowguid] DEFAULT (newid()) FOR [Rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aproductconditionmaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aproductconditionmaster] ADD CONSTRAINT [DF__aproductc__rowgu__3C15C135] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRange' AND COLUMN_NAME= 'MaxPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPurchasePriceRange] ADD CONSTRAINT [DF_aPurchasePriceRange_MaxPrice] DEFAULT ((0)) FOR [MaxPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aPurchasePriceRange' AND COLUMN_NAME= 'MinPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aPurchasePriceRange] ADD CONSTRAINT [DF_aPurchasePriceRange_MinPrice] DEFAULT ((0)) FOR [MinPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aReports' AND COLUMN_NAME= 'ReportActive' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aReports] ADD CONSTRAINT [DF__aReports__Report__1CD22006] DEFAULT ((0)) FOR [ReportActive]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendordetail' AND COLUMN_NAME= 'rrvdselected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [areprecvendordetail] ADD CONSTRAINT [DF_areprerecvendordetail_rrvdselected] DEFAULT ((0)) FOR [rrvdselected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME= 'rrvhcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [areprecvendorheader] ADD CONSTRAINT [DF_areprecvendorheader_rrvhposted] DEFAULT ((0)) FOR [rrvhcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='areprecvendorheader' AND COLUMN_NAME= 'rrvhtransfinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [areprecvendorheader] ADD CONSTRAINT [DF_areprecvendorheader_rrvhtransfinished] DEFAULT ((0)) FOR [rrvhtransfinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD CONSTRAINT [DF__AsalesPer__rowgu__23150941] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='AsalesPersonmaster' AND COLUMN_NAME= 'SperSex' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [AsalesPersonmaster] ADD CONSTRAINT [DF_AsalesPersonmaster_SperSex] DEFAULT ((0)) FOR [SperSex]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aServiceCategory' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aServiceCategory] ADD CONSTRAINT [DF__aservicec__rowgu__12DEA178] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicelocations' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aservicelocations] ADD CONSTRAINT [DF__aservicel__rowgu__18977ACE] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aservicemaster] ADD CONSTRAINT [DF__aservicem__rowgu__365CE7DF] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aservicemaster' AND COLUMN_NAME= 'serservicetype' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aservicemaster] ADD CONSTRAINT [DF__aServiceM__serse__387018DA] DEFAULT ('S') FOR [serservicetype]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME= 'autogenerateasstcode' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSettings] ADD CONSTRAINT [DF__asettings__autog__3FF13F11] DEFAULT ((0)) FOR [autogenerateasstcode]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSettings] ADD CONSTRAINT [DF__aSettings__rowgu__7CF981FA] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME= 'AverageRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSettings] ADD CONSTRAINT [DF_aSettings_Averagerate] DEFAULT ((0)) FOR [AverageRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME= 'EnableBudgetCheck' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSettings] ADD CONSTRAINT [DF_aSettings_EnableBudgetCheck] DEFAULT ((0)) FOR [EnableBudgetCheck]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME= 'EnableTargetCheck' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSettings] ADD CONSTRAINT [DF_aSettings_EnableTargetCheck] DEFAULT ((0)) FOR [EnableTargetCheck]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSettings' AND COLUMN_NAME= 'openingfreezed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSettings] ADD CONSTRAINT [DF_aSettings_openingfreezed] DEFAULT ((0)) FOR [openingfreezed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShipment' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShipment] ADD CONSTRAINT [DF__aShipment__rowgu__70E8B0D0] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShipment' AND COLUMN_NAME= 'sCostingDone' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShipment] ADD CONSTRAINT [DF_aShipment_sCostingDone] DEFAULT ((0)) FOR [sCostingDone]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopcashaccountdetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ashopcashaccountdetails] ADD CONSTRAINT [DF__ashopcash__rowgu__7E97B1A9] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopcashaccountdetails' AND COLUMN_NAME= 'futurevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ashopcashaccountdetails] ADD CONSTRAINT [DF_ashopcashaccountdetails_futurevc] DEFAULT ('') FOR [futurevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopChequeAccountDetails' AND COLUMN_NAME= 'futurevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopChequeAccountDetails] ADD CONSTRAINT [DF__aShopCheq__futur__0BA79404] DEFAULT ('') FOR [futurevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopChequeAccountDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopChequeAccountDetails] ADD CONSTRAINT [DF__aShopCheq__rowgu__0C9BB83D] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD CONSTRAINT [DF__aShopCust__rowgu__76A18A26] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME= 'creditlimit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD CONSTRAINT [DF_aShopCustomerDetails_creditlimit] DEFAULT ((0)) FOR [creditlimit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopCustomerDetails' AND COLUMN_NAME= 'futurevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopCustomerDetails] ADD CONSTRAINT [DF_aShopCustomerDetails_futurevc] DEFAULT ('') FOR [futurevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopitemCategory' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopitemCategory] ADD CONSTRAINT [DF__aShopitem__rowgu__4964CF5B] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopItemDetail] ADD CONSTRAINT [DF__aShopItem__rowgu__4F32B74A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME= 'orderraised' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopItemDetail] ADD CONSTRAINT [DF_aShopItemDetail_orderraised] DEFAULT ((0)) FOR [orderraised]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME= 'quotationraised' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopItemDetail] ADD CONSTRAINT [DF_aShopItemDetail_quotationraised] DEFAULT ((0)) FOR [quotationraised]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopItemDetail' AND COLUMN_NAME= 'RequestRaised' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopItemDetail] ADD CONSTRAINT [DF_aShopItemDetail_RequestRaised] DEFAULT ((0)) FOR [RequestRaised]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopprintmessages' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ashopprintmessages] ADD CONSTRAINT [DF__ashopprin__rowgu__1EA62536] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'DeliveryMust' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF__aShops__Delivery__0FB81C0A] DEFAULT ((0)) FOR [DeliveryMust]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'locationarrangement' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF__ashops__location__7579271A] DEFAULT ((0)) FOR [locationarrangement]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'printKOTseperatly' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF__aShops__printKOT__4440F2E2] DEFAULT ((0)) FOR [printKOTseperatly]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'RateEditingonDirectCashInv' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF__aShops__RateEdit__07C1F487] DEFAULT ((1)) FOR [RateEditingonDirectCashInv]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'RateEditingonDirectCreditInv' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF__aShops__RateEdit__08B618C0] DEFAULT ((1)) FOR [RateEditingonDirectCreditInv]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF__aShops__rowguid__319832C2] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'ShipmentDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF__aShops__Shipment__4258AA70] DEFAULT ((0)) FOR [ShipmentDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'showbinlocation' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF__aShops__showbinl__434CCEA9] DEFAULT ((0)) FOR [showbinlocation]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'showcostpriceinsales' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF__ashops__showcost__08211BE3] DEFAULT ((0)) FOR [showcostpriceinsales]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'allowblockprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF_aShops_allowblockprice] DEFAULT ((0)) FOR [allowblockprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'dayClosed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF_aShops_dayClosed] DEFAULT ((0)) FOR [dayClosed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'FIFO' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF_aShops_FIFO] DEFAULT ((1)) FOR [FIFO]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'RevisedCostPricePercent' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF_aShops_RevisedCostPricePercent] DEFAULT ((0)) FOR [RevisedCostPricePercent]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'Selected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF_aShops_Selected] DEFAULT ((0)) FOR [Selected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'TruncateCheck' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF_aShops_Truncate] DEFAULT ((1)) FOR [TruncateCheck]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShops' AND COLUMN_NAME= 'wholesaleallowed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShops] ADD CONSTRAINT [DF_aShops_wholesaleallowed] DEFAULT ((0)) FOR [wholesaleallowed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Ashopsalespersondetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Ashopsalespersondetails] ADD CONSTRAINT [DF__Ashopsale__rowgu__12549193] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ashopsercategory' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ashopsercategory] ADD CONSTRAINT [DF__ashopserc__rowgu__08CB2759] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopVendorDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopVendorDetails] ADD CONSTRAINT [DF__aShopVend__rowgu__54EB90A0] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aShopVendorDetails' AND COLUMN_NAME= 'futurevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aShopVendorDetails] ADD CONSTRAINT [DF_aShopVendorDetails_futurevc] DEFAULT ('') FOR [futurevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSize' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSize] ADD CONSTRAINT [DF__aSize__rowguid__7C5A637C] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposaldetail' AND COLUMN_NAME= 'dispdcredit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [assetdisposaldetail] ADD CONSTRAINT [DF__assetdisp__dispd__4A6ECD84] DEFAULT ((0)) FOR [dispdcredit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assetdisposalheader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [assetdisposalheader] ADD CONSTRAINT [DF__AssetDisp__updat__5AE52C6F] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME= 'asttransposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [assettransfer] ADD CONSTRAINT [DF__assettran__asttr__3E08F69F] DEFAULT ((0)) FOR [asttransposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME= 'asttranscancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [assettransfer] ADD CONSTRAINT [DF__assettran__asttr__3EFD1AD8] DEFAULT ((0)) FOR [asttranscancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='assettransfer' AND COLUMN_NAME= 'Updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [assettransfer] ADD CONSTRAINT [DF__assettran__Updat__5BD950A8] DEFAULT (getdate()) FOR [Updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME= 'BudgetedAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD CONSTRAINT [DF_aSubDepartmentMaster_BudgetedAmount] DEFAULT ((0)) FOR [BudgetedAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD CONSTRAINT [DF_aSubDepartmentMaster_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubDepartmentMaster' AND COLUMN_NAME= 'Selected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSubDepartmentMaster] ADD CONSTRAINT [DF_aSubDepartmentMaster_Selected] DEFAULT ((0)) FOR [Selected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aSubItemDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aSubItemDetails] ADD CONSTRAINT [DF__aSubItemD__rowgu__7187CF4E] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTableColumns' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aTableColumns] ADD CONSTRAINT [DF__aTableCol__rowgu__6F6A7CB2] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aTables' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aTables] ADD CONSTRAINT [DF__aTables__rowguid__02133CD2] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUnit' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUnit] ADD CONSTRAINT [DF__aUnit__rowguid__07CC1628] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserAuditHeader' AND COLUMN_NAME= 'hSaved' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUserAuditHeader] ADD CONSTRAINT [DF_aUserAuditHeader_hSaved] DEFAULT ((0)) FOR [hSaved]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ausergroupAccGroupDetails' AND COLUMN_NAME= 'Rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ausergroupAccGroupDetails] ADD CONSTRAINT [DF_ausergroupAccDetails_Rowguid] DEFAULT (newid()) FOR [Rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupBrandDetails' AND COLUMN_NAME= 'rowguiD' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUserGroupBrandDetails] ADD CONSTRAINT [DF_aUserGroupBrandDetails_rowguiD] DEFAULT (newid()) FOR [rowguiD]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupCusGroupDetails' AND COLUMN_NAME= 'Rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUserGroupCusGroupDetails] ADD CONSTRAINT [DF_aUserGroupCusGroupDetails_Rowguid] DEFAULT (newid()) FOR [Rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupGodownDetails' AND COLUMN_NAME= 'rowguID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUserGroupGodownDetails] ADD CONSTRAINT [DF_aUserGroupGodownDetails_rowguID] DEFAULT (newid()) FOR [rowguID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupItemCategoryDetails' AND COLUMN_NAME= 'rowguID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUserGroupItemCategoryDetails] ADD CONSTRAINT [DF_aUserGroupItemCategoryDetails_rowguID] DEFAULT (newid()) FOR [rowguID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupRights' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUserGroupRights] ADD CONSTRAINT [DF__aUserGrou__rowgu__03F163A3] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsergroups' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUsergroups] ADD CONSTRAINT [DF_aUsergroups_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupShopDetails' AND COLUMN_NAME= 'rowguID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUserGroupShopDetails] ADD CONSTRAINT [DF_aUserGroupShopDetails_rowguID] DEFAULT (newid()) FOR [rowguID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserGroupVenGroupDetails' AND COLUMN_NAME= 'Rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUserGroupVenGroupDetails] ADD CONSTRAINT [DF_aUserGroupVenGroupDetails_Rowguid] DEFAULT (newid()) FOR [Rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUserRights' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUserRights] ADD CONSTRAINT [DF__aUserRigh__rowgu__515009E6] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aUsers' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aUsers] ADD CONSTRAINT [DF__aUsers__rowguid__2724C5F0] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorGroup' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aVendorGroup] ADD CONSTRAINT [DF_aVendorGroup_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME= 'allowblankcheque' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aVendorMaster] ADD CONSTRAINT [DF__avendorma__allow__40B05920] DEFAULT ((0)) FOR [allowblankcheque]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aVendorMaster] ADD CONSTRAINT [DF__aVendorMa__rowgu__3BEAD8AC] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME= 'DuePeriod' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aVendorMaster] ADD CONSTRAINT [DF_aVendorMaster_DuePeriod] DEFAULT ((0)) FOR [DuePeriod]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME= 'OpeningCreditBalance' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aVendorMaster] ADD CONSTRAINT [DF_aVendorMaster_OpeningCreditBalance] DEFAULT ((0)) FOR [OpeningCreditBalance]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMaster' AND COLUMN_NAME= 'OpeningDebitBalance' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aVendorMaster] ADD CONSTRAINT [DF_aVendorMaster_OpeningDebitBalance] DEFAULT ((0)) FOR [OpeningDebitBalance]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='aVendorMasterBackUp' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [aVendorMasterBackUp] ADD CONSTRAINT [DF__aVendorMa__rowgu__0D84EF7E] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME= 'AutoGenerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Bills] ADD CONSTRAINT [DF__Bills__AutoGener__2A4C16B5] DEFAULT ((0)) FOR [AutoGenerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME= 'exchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Bills] ADD CONSTRAINT [DF_Bills_exchangerate] DEFAULT ((1)) FOR [exchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Bills' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Bills] ADD CONSTRAINT [DF_Bills_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME= 'badMonthNo' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD CONSTRAINT [DF__BudgetAll__badMo__6621D4F1] DEFAULT ((0)) FOR [badMonthNo]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetAllocationDetail' AND COLUMN_NAME= 'badRevised' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [BudgetAllocationDetail] ADD CONSTRAINT [DF__BudgetAll__badRe__6715F92A] DEFAULT ((0)) FOR [badRevised]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanHeader' AND COLUMN_NAME= 'bphCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [BudgetPlanHeader] ADD CONSTRAINT [DF__BudgetPla__bphCa__7B1CF1D7] DEFAULT ((0)) FOR [bphCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='BudgetPlanReviseDetail' AND COLUMN_NAME= 'brdConfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [BudgetPlanReviseDetail] ADD CONSTRAINT [DF__BudgetPla__brdCo__13E89FA1] DEFAULT ((0)) FOR [brdConfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CashBox' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [CashBox] ADD CONSTRAINT [DF__CashBox__rowguid__18ED4BE0] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME= 'ContraAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Contra] ADD CONSTRAINT [DF_Contra_ContraAmount] DEFAULT ((0)) FOR [ContraAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME= 'ContraChargeAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Contra] ADD CONSTRAINT [DF_Contra_ContraChargeAmount] DEFAULT ((0)) FOR [ContraChargeAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME= 'ExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Contra] ADD CONSTRAINT [DF_Contra_ExchangeRate] DEFAULT ((1)) FOR [ExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Contra' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Contra] ADD CONSTRAINT [DF_Contra_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmCustomerMaster' AND COLUMN_NAME= 'Deleted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [CrmCustomerMaster] ADD CONSTRAINT [DF__CrmCustom__Delet__19C0A931] DEFAULT ((0)) FOR [Deleted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CustomerSettlementHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [CustomerSettlementHeader] ADD CONSTRAINT [DF_CustomerSettlementHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME= 'DCNConfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DebitCreditNote] ADD CONSTRAINT [DF__DebitCred__DCNCo__19218AB3] DEFAULT ((1)) FOR [DCNConfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME= 'DCNCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DebitCreditNote] ADD CONSTRAINT [DF_DebitCreditNote_DCNCancelled] DEFAULT ((0)) FOR [DCNCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME= 'DCNDebit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DebitCreditNote] ADD CONSTRAINT [DF_DebitCreditNote_DCNDebit] DEFAULT ((0)) FOR [DCNDebit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME= 'DCNExchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DebitCreditNote] ADD CONSTRAINT [DF_DebitCreditNote_DCNExchangerate] DEFAULT ((1)) FOR [DCNExchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME= 'DCNPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DebitCreditNote] ADD CONSTRAINT [DF_DebitCreditNote_DCNPosted] DEFAULT ((0)) FOR [DCNPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DebitCreditNote' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DebitCreditNote] ADD CONSTRAINT [DF_DebitCreditNote_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DepreciationHeader] ADD CONSTRAINT [DF__Depreciat__rowgu__17786E0C] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME= 'Amount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DepreciationHeader] ADD CONSTRAINT [DF_Depreciation_Amount] DEFAULT ((0)) FOR [Amount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME= 'Cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DepreciationHeader] ADD CONSTRAINT [DF_Depreciation_Cancelled] DEFAULT ((0)) FOR [Cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='DepreciationHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [DepreciationHeader] ADD CONSTRAINT [DF_Depreciation_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME= 'alldishtrue' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Discountdetails] ADD CONSTRAINT [DF_Discountdetails_alldishtrue] DEFAULT ((0)) FOR [alldishtrue]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountdetails' AND COLUMN_NAME= 'dailytrue' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Discountdetails] ADD CONSTRAINT [DF_Discountdetails_dailytrue] DEFAULT ((0)) FOR [dailytrue]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Discountheader' AND COLUMN_NAME= 'Discountid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Discountheader] ADD CONSTRAINT [DF_Discountheader_Discountid] DEFAULT ((0)) FOR [Discountid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRate' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ExchangeRate] ADD CONSTRAINT [DF__ExchangeR__rowgu__1D314762] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD CONSTRAINT [DF__ExchangeR__rowgu__22EA20B8] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME= 'AverageRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD CONSTRAINT [DF_ExchangeRateDetail_AverageRate] DEFAULT ((0)) FOR [AverageRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME= 'BuyingRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD CONSTRAINT [DF_ExchangeRateDetail_BuyingRate] DEFAULT ((0)) FOR [BuyingRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateDetail' AND COLUMN_NAME= 'SellingRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ExchangeRateDetail] ADD CONSTRAINT [DF_ExchangeRateDetail_SellingRate] DEFAULT ((0)) FOR [SellingRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ExchangeRateHistoryDetails] ADD CONSTRAINT [DF__ExchangeR__rowgu__5AEF4E10] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryHeader' AND COLUMN_NAME= 'ExchangeDate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ExchangeRateHistoryHeader] ADD CONSTRAINT [DF__ExchangeR__Excha__345F90D4] DEFAULT (getdate()) FOR [ExchangeDate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ExchangeRateHistoryHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ExchangeRateHistoryHeader] ADD CONSTRAINT [DF__ExchangeR__rowgu__3553B50D] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_botheader' AND COLUMN_NAME= 'Fb_bh_cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Fb_botheader] ADD CONSTRAINT [DF_Fb_botheader_Fb_bh_cancelled] DEFAULT ((0)) FOR [Fb_bh_cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishdetails' AND COLUMN_NAME= 'fb_dd_yield' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [FB_Dishdetails] ADD CONSTRAINT [DF_FB_Dishdetails_fb_dd_yield] DEFAULT ((0)) FOR [fb_dd_yield]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME= 'fb_dg_foodbeverage' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD CONSTRAINT [DF_FB_Dishgroup_fb_dg_foodbeverage] DEFAULT ((0)) FOR [fb_dg_foodbeverage]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishgroup' AND COLUMN_NAME= 'FB_dg_Futurebit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [FB_Dishgroup] ADD CONSTRAINT [DF_FB_Dishgroup_FB_dg_Futurebit] DEFAULT ((0)) FOR [FB_dg_Futurebit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FB_Dishsubgroup' AND COLUMN_NAME= 'Fb_Ds_FutureBit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [FB_Dishsubgroup] ADD CONSTRAINT [DF_FB_Dishsubgroup_Fb_Ds_FutureBit] DEFAULT ((0)) FOR [Fb_Ds_FutureBit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME= 'fb_kd_processed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Fb_kotdetails] ADD CONSTRAINT [DF__fb_kotdet__fb_kd__5F9EF494] DEFAULT ((0)) FOR [fb_kd_processed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotheader' AND COLUMN_NAME= 'Fb_kh_cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Fb_kotheader] ADD CONSTRAINT [DF__fb_kothea__Fb_kd__70C98096] DEFAULT ((0)) FOR [Fb_kh_cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME= 'fb_to_cashreceived' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD CONSTRAINT [DF_fb_Tableoccupancy_fb_to_cashreceived] DEFAULT ((0)) FOR [fb_to_cashreceived]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_Tableoccupancy' AND COLUMN_NAME= 'fb_to_kottrue' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [fb_Tableoccupancy] ADD CONSTRAINT [DF_fb_Tableoccupancy_fb_to_kottrue] DEFAULT ((1)) FOR [fb_to_kottrue]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME= 'Cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [FixedAsset] ADD CONSTRAINT [DF__fixedasse__Cance__48DB8ACD] DEFAULT ((0)) FOR [Cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME= 'ExcludeFirstPeriodDep' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [FixedAsset] ADD CONSTRAINT [DF__fixedasse__Exclu__1605F23D] DEFAULT ((0)) FOR [ExcludeFirstPeriodDep]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME= 'posted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [FixedAsset] ADD CONSTRAINT [DF__fixedasse__poste__0DE4E231] DEFAULT ((0)) FOR [posted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [FixedAsset] ADD CONSTRAINT [DF__FixedAsse__rowgu__28A2FA0E] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='FixedAsset' AND COLUMN_NAME= 'CostPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [FixedAsset] ADD CONSTRAINT [DF_FixedAsset_CostPrice] DEFAULT ((0)) FOR [CostPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME= 'cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Forex] ADD CONSTRAINT [DF_Forex_cancelled] DEFAULT ((0)) FOR [cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Forex' AND COLUMN_NAME= 'posted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [Forex] ADD CONSTRAINT [DF_Forex_posted] DEFAULT ((0)) FOR [posted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='hqSalesCommisionHeader' AND COLUMN_NAME= 'schAfterSales' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [hqSalesCommisionHeader] ADD CONSTRAINT [DF__HQSalesCo__schAf__6F16424E] DEFAULT ((0)) FOR [schAfterSales]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='HQSalesPromotionDetail' AND COLUMN_NAME= 'spdToBePaid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [HQSalesPromotionDetail] ADD CONSTRAINT [DF__HQSalesPr__spdTo__7B7C1933] DEFAULT ((1)) FOR [spdToBePaid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME= 'exchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD CONSTRAINT [DF_InterDivisionBillsHeader_exchangerate] DEFAULT ((1)) FOR [exchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionBillsHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [InterDivisionBillsHeader] ADD CONSTRAINT [DF_InterDivisionBillsHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransDetails' AND COLUMN_NAME= 'Amount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [InterDivisionJournalTransDetails] ADD CONSTRAINT [DF__InterDivi__Amoun__0406723C] DEFAULT ((0)) FOR [Amount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='InterDivisionJournalTransHeader' AND COLUMN_NAME= 'Cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [InterDivisionJournalTransHeader] ADD CONSTRAINT [DF__InterDivi__Cance__012A0591] DEFAULT ((0)) FOR [Cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ItemPriceHistory' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ItemPriceHistory] ADD CONSTRAINT [DF_ItemPriceHistory_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME= 'ActualAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD CONSTRAINT [DF_JournalDetailBackup_ActualAmount] DEFAULT ((0)) FOR [ActualAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalDetailBackup' AND COLUMN_NAME= 'Amount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [JournalDetailBackup] ADD CONSTRAINT [DF_JournalDetailBackup_Amount] DEFAULT ((0)) FOR [Amount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME= 'PayrollLinktransId' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [JournalTransDetails] ADD CONSTRAINT [DF__JournalTr__Payro__2ED1A007] DEFAULT (NULL) FOR [PayrollLinktransId]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransDetails' AND COLUMN_NAME= 'Amount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [JournalTransDetails] ADD CONSTRAINT [DF_JournalTransDetails_Amount] DEFAULT ((0)) FOR [Amount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME= 'Confirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [JournalTransHeader] ADD CONSTRAINT [DF__JournalTr__Confi__3D5EEB29] DEFAULT ((1)) FOR [Confirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME= 'Cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [JournalTransHeader] ADD CONSTRAINT [DF_JournalTransHeader_Cancelled] DEFAULT ((0)) FOR [Cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME= 'Posted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [JournalTransHeader] ADD CONSTRAINT [DF_JournalTransHeader_Posted] DEFAULT ((0)) FOR [Posted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='JournalTransHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [JournalTransHeader] ADD CONSTRAINT [DF_JournalTransHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME= 'chCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD CONSTRAINT [DF_LOaCostingHeader_chCancelled] DEFAULT ((0)) FOR [chCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME= 'chCostingDone' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD CONSTRAINT [DF_LOaCostingHeader_chCostingDone] DEFAULT ((0)) FOR [chCostingDone]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME= 'chPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD CONSTRAINT [DF_LOaCostingHeader_chPosted] DEFAULT ((0)) FOR [chPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOaCostingHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOaCostingHeader] ADD CONSTRAINT [DF_LOaCostingHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME= 'scfhCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD CONSTRAINT [DF_loaItemsplitcostingHeader_scfhCancelled] DEFAULT ((0)) FOR [scfhCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loaItemsplitcostingHeader' AND COLUMN_NAME= 'scfhCostFixed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loaItemsplitcostingHeader] ADD CONSTRAINT [DF_loaItemsplitcostingHeader_scfhCostFixed] DEFAULT ((0)) FOR [scfhCostFixed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME= 'lpchCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD CONSTRAINT [DF_loalocalpurchaseCostingheader_lpchCancelled] DEFAULT ((0)) FOR [lpchCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME= 'lpchCostingDone' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD CONSTRAINT [DF_loalocalpurchaseCostingheader_lpchCostingDone] DEFAULT ((0)) FOR [lpchCostingDone]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME= 'lpchposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD CONSTRAINT [DF_loalocalpurchaseCostingheader_lpchposted] DEFAULT ((0)) FOR [lpchposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loalocalpurchaseCostingheader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loalocalpurchaseCostingheader] ADD CONSTRAINT [DF_loalocalpurchaseCostingheader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD CONSTRAINT [DF__LOiArriva__rowgu__1DD065E0] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalDetail' AND COLUMN_NAME= 'adCostPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalDetail] ADD CONSTRAINT [DF_LOiArrivalDetail_adCostPrice] DEFAULT ((0)) FOR [adCostPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD CONSTRAINT [DF__LOiArriva__rowgu__02B25B50] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME= 'ahCostPriceFixed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD CONSTRAINT [DF_LOiArrivalHeader_ahCostPriceFixed] DEFAULT ((0)) FOR [ahCostPriceFixed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME= 'ahfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD CONSTRAINT [DF_LOiArrivalHeader_ahfuturevc] DEFAULT ('') FOR [ahfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME= 'ahGodownID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD CONSTRAINT [DF_LOiArrivalHeader_ahGodownID] DEFAULT ((0)) FOR [ahGodownID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME= 'ahposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD CONSTRAINT [DF_LOiArrivalHeader_ahposted] DEFAULT ((0)) FOR [ahposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME= 'ahShopID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD CONSTRAINT [DF_LOiArrivalHeader_ahShopID] DEFAULT ((0)) FOR [ahShopID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME= 'ahTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD CONSTRAINT [DF_LOiArrivalHeader_ahTransFinished] DEFAULT ((0)) FOR [ahTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalHeader] ADD CONSTRAINT [DF_LOiArrivalHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD CONSTRAINT [DF__LOiArriva__rowgu__01342732] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivalShipmentDetail' AND COLUMN_NAME= 'asdcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivalShipmentDetail] ADD CONSTRAINT [DF_LOiArrivalShipmentDetail_asdcostprice] DEFAULT ((0)) FOR [asdcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiArrivaltoLocation' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiArrivaltoLocation] ADD CONSTRAINT [DF__LOiArriva__rowgu__06ED0088] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiDamageClearingDetails] ADD CONSTRAINT [DF__LOiDamage__rowgu__7740A8A4] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD CONSTRAINT [DF__LOiDamage__rowgu__086B34A6] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME= 'dchfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD CONSTRAINT [DF_LOiDamageClearingHeader_dchfuturevc] DEFAULT ('') FOR [dchfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiDamageClearingHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiDamageClearingHeader] ADD CONSTRAINT [DF_LOiDamageClearingHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME= 'eadAdjustment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD CONSTRAINT [DF_loiexpiryarrivaldetails_eadAdjustment] DEFAULT ((0)) FOR [eadAdjustment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryarrivaldetails' AND COLUMN_NAME= 'eadcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiexpiryarrivaldetails] ADD CONSTRAINT [DF_loiexpiryarrivaldetails_eadcancel] DEFAULT ((0)) FOR [eadcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME= 'eidAdjustment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD CONSTRAINT [DF_loiexpiryissuedetails_eidAdjustment] DEFAULT ((0)) FOR [eidAdjustment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiexpiryissuedetails' AND COLUMN_NAME= 'eidcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiexpiryissuedetails] ADD CONSTRAINT [DF_loiexpiryissuedetails_eidcancel] DEFAULT ((0)) FOR [eidcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME= 'evdBatchNo' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD CONSTRAINT [DF__loiExpiry__evdBa__04315AC5] DEFAULT ('OLDBATCH') FOR [evdBatchNo]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiExpiryVerificationDetail' AND COLUMN_NAME= 'evdPrevBatchNo' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiExpiryVerificationDetail] ADD CONSTRAINT [DF__loiExpiry__evdPr__033D368C] DEFAULT ('OLDBATCH') FOR [evdPrevBatchNo]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiGodownShopArrivalToLocation' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiGodownShopArrivalToLocation] ADD CONSTRAINT [DF__LOiGodown__rowgu__7B7B4DDC] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LoiItemSplitDetail] ADD CONSTRAINT [DF__LoiItemSp__rowgu__7484378A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD CONSTRAINT [DF__LoiItemSp__rowgu__17CD73C7] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME= 'ishCostPriceFixed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD CONSTRAINT [DF_LoiItemSplitHeader_ishCostPriceFixed] DEFAULT ((0)) FOR [ishCostPriceFixed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME= 'ishfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD CONSTRAINT [DF_LoiItemSplitHeader_ishfuturevc] DEFAULT ('') FOR [ishfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LoiItemSplitHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LoiItemSplitHeader] ADD CONSTRAINT [DF_LoiItemSplitHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiLocation' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiLocation] ADD CONSTRAINT [DF__LOiLocati__rowgu__0E240DFC] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME= 'ladconfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD CONSTRAINT [DF__loilocati__ladco__76184598] DEFAULT ((1)) FOR [ladconfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME= 'ladadjustment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD CONSTRAINT [DF_loilocationarrivaldetails_ladadjustment] DEFAULT ((0)) FOR [ladadjustment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationarrivaldetails' AND COLUMN_NAME= 'ladcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loilocationarrivaldetails] ADD CONSTRAINT [DF_loilocationarrivaldetails_ladcancel] DEFAULT ((0)) FOR [ladcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME= 'lidconfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD CONSTRAINT [DF__loilocati__lidco__770C69D1] DEFAULT ((1)) FOR [lidconfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME= 'lidadjustment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD CONSTRAINT [DF_loilocationissuedetails_lidadjustment] DEFAULT ((0)) FOR [lidadjustment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loilocationissuedetails' AND COLUMN_NAME= 'lidcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loilocationissuedetails] ADD CONSTRAINT [DF_loilocationissuedetails_lidcancel] DEFAULT ((0)) FOR [lidcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialArrivalDetails' AND COLUMN_NAME= 'sadSavedByShopId' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiSerialArrivalDetails] ADD CONSTRAINT [DF__loiSerial__sadSa__17D860BF] DEFAULT (NULL) FOR [sadSavedByShopId]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiSerialIssueDetails' AND COLUMN_NAME= 'sidSavedByShopId' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiSerialIssueDetails] ADD CONSTRAINT [DF__loiSerial__sidSa__2843D2B2] DEFAULT (NULL) FOR [sidSavedByShopId]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiSettings' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiSettings] ADD CONSTRAINT [DF__LOiSettin__rowgu__453F38BC] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockRecovery] ADD CONSTRAINT [DF__loiStockR__rowgu__2BD46C74] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME= 'srcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockRecovery] ADD CONSTRAINT [DF_loiStockRecovery_srcostprice] DEFAULT ((0)) FOR [srcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME= 'srposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockRecovery] ADD CONSTRAINT [DF_loiStockRecovery_srposted] DEFAULT ((0)) FOR [srposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockRecovery' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockRecovery] ADD CONSTRAINT [DF_loiStockRecovery_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD CONSTRAINT [DF__loiStockV__rowgu__75235608] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationDetail' AND COLUMN_NAME= 'svdcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockVerificationDetail] ADD CONSTRAINT [DF_loiStockVerificationDetail_svdcostprice] DEFAULT ((0)) FOR [svdcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD CONSTRAINT [DF__loiStockV__rowgu__246854D6] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME= 'svhCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD CONSTRAINT [DF_loiStockVerificationHeader_svhCancelled] DEFAULT ((0)) FOR [svhCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME= 'svhfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD CONSTRAINT [DF_loiStockVerificationHeader_svhfuturevc] DEFAULT ('') FOR [svhfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME= 'svhposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD CONSTRAINT [DF_loiStockVerificationHeader_svhposted] DEFAULT ((0)) FOR [svhposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loiStockVerificationHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loiStockVerificationHeader] ADD CONSTRAINT [DF_loiStockVerificationHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD CONSTRAINT [DF__LOiWriteO__rowgu__5AA469F6] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffDetail' AND COLUMN_NAME= 'wdcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiWriteOffDetail] ADD CONSTRAINT [DF_LOiWriteOffDetail_wdcostprice] DEFAULT ((0)) FOR [wdcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD CONSTRAINT [DF__LOiWriteO__rowgu__4AF81212] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME= 'whSelected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD CONSTRAINT [DF__loiwriteo__whSel__55F58EC9] DEFAULT ((0)) FOR [whSelected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME= 'whtransfinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD CONSTRAINT [DF__loiwriteo__whtra__56E9B302] DEFAULT ((0)) FOR [whtransfinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD CONSTRAINT [DF_LOiWriteOffHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME= 'whfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD CONSTRAINT [DF_LOiWriteOffHeader_whfuturevc] DEFAULT ('') FOR [whfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOiWriteOffHeader' AND COLUMN_NAME= 'whposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOiWriteOffHeader] ADD CONSTRAINT [DF_LOiWriteOffHeader_whposted] DEFAULT ((0)) FOR [whposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderDetail] ADD CONSTRAINT [DF__loPrePurchas__rowgu__18F6A22A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohCostingDone' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF__loPrepurchas__pohCo__0B22DD87] DEFAULT ('P') FOR [pohCostingDone]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohCustomDutyByCustomer' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF__loPrePurchas__pohCu__17CE3F1E] DEFAULT ((0)) FOR [pohCustomDutyByCustomer]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pogenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pogenerated] DEFAULT ((0)) FOR [pogenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohbillgenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohbillgenerated] DEFAULT ((0)) FOR [pohbillgenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohcancel] DEFAULT ((0)) FOR [pohcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohDeliveryTerms' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohDeladdress] DEFAULT ('') FOR [pohDeliveryTerms]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohfuturevc] DEFAULT ('') FOR [pohfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohLcMarginOpened' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohLcMarginOpened] DEFAULT ((0)) FOR [pohLcMarginOpened]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohLCopened' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohLCopened] DEFAULT ((0)) FOR [pohLCopened]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohpogenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohpogenerated] DEFAULT ((0)) FOR [pohpogenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohpoonhold' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohpoonhold] DEFAULT ((0)) FOR [pohpoonhold]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohPosted] DEFAULT ((0)) FOR [pohPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohppconfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohquotconfirmed] DEFAULT ((0)) FOR [pohppconfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'pohUsedinPayments' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_pohUsedinPayments] DEFAULT ((0)) FOR [pohUsedinPayments]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPrePurchaseOrderHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPrePurchaseOrderHeader] ADD CONSTRAINT [DF_loPrePurchaseOrderHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderDetail] ADD CONSTRAINT [DF__loPurchas__rowgu__18F6A22A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohCostingDone' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF__lopurchas__pohCo__0B22DD87] DEFAULT ('P') FOR [pohCostingDone]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohCustomDutyByCustomer' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF__loPurchas__pohCu__17CE3F1E] DEFAULT ((0)) FOR [pohCustomDutyByCustomer]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pogenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pogenerated] DEFAULT ((0)) FOR [pogenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohbillgenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohbillgenerated] DEFAULT ((0)) FOR [pohbillgenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohcancel] DEFAULT ((0)) FOR [pohcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohDeliveryTerms' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohDeladdress] DEFAULT ('') FOR [pohDeliveryTerms]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohfuturevc] DEFAULT ('') FOR [pohfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohLcMarginOpened' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohLcMarginOpened] DEFAULT ((0)) FOR [pohLcMarginOpened]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohLCopened' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohLCopened] DEFAULT ((0)) FOR [pohLCopened]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohpogenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohpogenerated] DEFAULT ((0)) FOR [pohpogenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohpoonhold' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohpoonhold] DEFAULT ((0)) FOR [pohpoonhold]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohPosted] DEFAULT ((0)) FOR [pohPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohquotconfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohquotconfirmed] DEFAULT ((0)) FOR [pohquotconfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'pohUsedinPayments' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_pohUsedinPayments] DEFAULT ((0)) FOR [pohUsedinPayments]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchaseOrderHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchaseOrderHeader] ADD CONSTRAINT [DF_loPurchaseOrderHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME= 'prhcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD CONSTRAINT [DF_loPurchasereturnheader_prhcancelled] DEFAULT ((0)) FOR [prhcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loPurchasereturnheader' AND COLUMN_NAME= 'prhposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loPurchasereturnheader] ADD CONSTRAINT [DF_loPurchasereturnheader_prhposted] DEFAULT ((0)) FOR [prhposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loreplacereqtovendorheader' AND COLUMN_NAME= 'rrvcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loreplacereqtovendorheader] ADD CONSTRAINT [DF_loreplacereqtovendorheader_rrvcancelled] DEFAULT ((0)) FOR [rrvcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnDetail' AND COLUMN_NAME= 'IHRDcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnDetail] ADD CONSTRAINT [DF_LOs_InHouseCons_ReturnDetail_IHRDcostprice] DEFAULT ((0)) FOR [IHRDcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME= 'IHRHCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD CONSTRAINT [DF__LOs_InHou__IHRHC__4DFF6746] DEFAULT ((0)) FOR [IHRHCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD CONSTRAINT [DF__LOs_InHou__updat__4FE7AFB8] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOs_InHouseCons_ReturnHeader' AND COLUMN_NAME= 'IHRHposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOs_InHouseCons_ReturnHeader] ADD CONSTRAINT [DF_LOsWriteOffHeader_IHRHposted] DEFAULT ((0)) FOR [IHRHposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'aiCashPaidByshop' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF__losAccoun__aiCas__05107065] DEFAULT ((0)) FOR [aiCashPaidByshop]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'ExcludeGST' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF__LOsAccoun__Exclu__10F65906] DEFAULT ((0)) FOR [ExcludeGST]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF__LOsAccoun__rowgu__419A5BB8] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'aiCashInvoice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF_LOsAccountsInvoiceHeader_aiCashInvoice] DEFAULT ((0)) FOR [aiCashInvoice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'aicfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF_LOsAccountsInvoiceHeader_aicfuturevc] DEFAULT ('') FOR [aicfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'aiExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF_LOsAccountsInvoiceHeader_aiExchangeRate] DEFAULT ((1)) FOR [aiExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'aiProduct' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF_LOsAccountsInvoiceHeader_aiProduct] DEFAULT ((0)) FOR [aiProduct]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'aiSettled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF_LOsAccountsInvoiceHeader_aiSettled] DEFAULT ((0)) FOR [aiSettled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'aiSettledamount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF_LOsAccountsInvoiceHeader_aiSettledamount] DEFAULT ((0)) FOR [aiSettledamount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsAccountsInvoiceHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsAccountsInvoiceHeader] ADD CONSTRAINT [DF_LOsAccountsInvoiceHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME= 'mghPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD CONSTRAINT [DF__losApartm__mghPo__27CF9CBD] DEFAULT ((0)) FOR [mghPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentAgreementHeader' AND COLUMN_NAME= 'mghUpdateTime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losApartmentAgreementHeader] ADD CONSTRAINT [DF_losApartmentAgreementHeader_mghUpdateTime] DEFAULT (getdate()) FOR [mghUpdateTime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME= 'abhUpdateTime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD CONSTRAINT [DF__losApartm__abhUp__157BE258] DEFAULT (getdate()) FOR [abhUpdateTime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentBillHeader' AND COLUMN_NAME= 'abhSettled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losApartmentBillHeader] ADD CONSTRAINT [DF_losApartmentBillHeader_abhSettled] DEFAULT ((0)) FOR [abhSettled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losApartmentCheckOut' AND COLUMN_NAME= 'chUpdateTime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losApartmentCheckOut] ADD CONSTRAINT [DF__losApartm__chUpd__2A76FF3E] DEFAULT (getdate()) FOR [chUpdateTime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losBoatNoteConfirmHeader' AND COLUMN_NAME= 'Cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losBoatNoteConfirmHeader] ADD CONSTRAINT [DF__losBoatNo__Cance__1CFD088F] DEFAULT ((0)) FOR [Cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME= 'bkcancellcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losbookingcancellation] ADD CONSTRAINT [DF_losbookingcancellation_bkcancellcancelled] DEFAULT ((0)) FOR [bkcancellcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookingcancellation' AND COLUMN_NAME= 'bkcancellposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losbookingcancellation] ADD CONSTRAINT [DF_losbookingcancellation_bkcancellposted] DEFAULT ((0)) FOR [bkcancellposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookpartsreplacedetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losbookpartsreplacedetails] ADD CONSTRAINT [DF__losbookpa__rowgu__752E4300] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservicedetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losbookservicedetails] ADD CONSTRAINT [DF__losbookse__rowgu__76E317F6] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losbookservtechniciandetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losbookservtechniciandetails] ADD CONSTRAINT [DF__losbookse__rowgu__4DABF839] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME= 'serCallBkhExcludeGST' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD CONSTRAINT [DF__losCallBo__serCa__1022305E] DEFAULT ((0)) FOR [serCallBkhExcludeGST]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME= 'serCallBkhcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD CONSTRAINT [DF_losCallBookingHeader_serCallBkhcancelled] DEFAULT ((0)) FOR [serCallBkhcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losCallBookingHeader' AND COLUMN_NAME= 'serCallBkhinstallation' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losCallBookingHeader] ADD CONSTRAINT [DF_losCallBookingHeader_serCallBkhinstallation] DEFAULT ((0)) FOR [serCallBkhinstallation]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME= 'cmpupdatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loscomplaints] ADD CONSTRAINT [DF__loscompla__cmpup__013F142A] DEFAULT (getdate()) FOR [cmpupdatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loscomplaints' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loscomplaints] ADD CONSTRAINT [DF__loscompla__rowgu__009FF5AC] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME= 'losDCNDuePeriod' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD CONSTRAINT [DF__losDebitC__losDC__1546D82E] DEFAULT ((0)) FOR [losDCNDuePeriod]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD CONSTRAINT [DF__losDebitC__rowgu__271B6FA6] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME= 'losDCNCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD CONSTRAINT [DF_losDebitCreditNote_DCNCancelled] DEFAULT ((0)) FOR [losDCNCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME= 'losDCNDebit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD CONSTRAINT [DF_losDebitCreditNote_DCNDebit] DEFAULT ((0)) FOR [losDCNDebit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME= 'losDCNPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD CONSTRAINT [DF_losDebitCreditNote_DCNPosted] DEFAULT ((0)) FOR [losDCNPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME= 'losexchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD CONSTRAINT [DF_losDebitCreditNote_losexchangerate] DEFAULT ((1)) FOR [losexchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDebitCreditNote' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDebitCreditNote] ADD CONSTRAINT [DF_losDebitCreditNote_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDeliveryNoteHeader' AND COLUMN_NAME= 'Dncancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosDeliveryNoteHeader] ADD CONSTRAINT [DF_LosDeliveryNoteHeader_Dncancelled] DEFAULT ((0)) FOR [Dncancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME= 'dndPackingTypeID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD CONSTRAINT [DF__losDelive__dndPa__0D45C3B3] DEFAULT ((0)) FOR [dndPackingTypeID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME= 'dndItemType' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD CONSTRAINT [DF_LosDeliveryNoteItemDetails_dndItemType] DEFAULT ('I') FOR [dndItemType]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDeliveryNoteItemDetails' AND COLUMN_NAME= 'dndKitID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDeliveryNoteItemDetails] ADD CONSTRAINT [DF_LosDeliveryNoteItemDetails_dndKitID] DEFAULT ((0)) FOR [dndKitID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME= 'Active' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDocument] ADD CONSTRAINT [DF_losDocument_Active] DEFAULT ((1)) FOR [Active]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME= 'AlertBeforeDays' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDocument] ADD CONSTRAINT [DF_losDocument_AlertBeforeDays] DEFAULT ((0)) FOR [AlertBeforeDays]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME= 'Cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDocument] ADD CONSTRAINT [DF_losDocument_Cancelled] DEFAULT ((0)) FOR [Cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDocument' AND COLUMN_NAME= 'CoMailIn' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDocument] ADD CONSTRAINT [DF_losDocument_CoMailIn] DEFAULT ((1)) FOR [CoMailIn]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosDummyReceiptDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosDummyReceiptDetail] ADD CONSTRAINT [DF__LosDummyR__rowgu__4ACEC037] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD CONSTRAINT [DF__losDummyR__rowgu__5AF01967] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME= 'drcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD CONSTRAINT [DF_losDummyReceipt_cancelled] DEFAULT ((0)) FOR [drcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME= 'drBankExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD CONSTRAINT [DF_losDummyReceiptHeader_drBankExchangeRate] DEFAULT ((1)) FOR [drBankExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME= 'drExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD CONSTRAINT [DF_losDummyReceiptHeader_drExchangeRate] DEFAULT ((1)) FOR [drExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME= 'drfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD CONSTRAINT [DF_losDummyReceiptHeader_drfuturevc] DEFAULT ('') FOR [drfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losDummyReceiptHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losDummyReceiptHeader] ADD CONSTRAINT [DF_losDummyReceiptHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIConfirmation' AND COLUMN_NAME= 'eccancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losEDIConfirmation] ADD CONSTRAINT [DF_losEDIConfirmation_eccancelled] DEFAULT ((0)) FOR [eccancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losEDIRequest' AND COLUMN_NAME= 'ercancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losEDIRequest] ADD CONSTRAINT [DF_losEDIRequest_ercancelled] DEFAULT ((0)) FOR [ercancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME= 'eadAdjustment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD CONSTRAINT [DF_losexpiryarrivaldetails_eadAdjustment] DEFAULT ((0)) FOR [eadAdjustment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryarrivaldetails' AND COLUMN_NAME= 'eadCancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losexpiryarrivaldetails] ADD CONSTRAINT [DF_losexpiryarrivaldetails_eadCancel] DEFAULT ((0)) FOR [eadCancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME= 'eidAdjustment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD CONSTRAINT [DF_losexpiryissuedetails_eidAdjustment] DEFAULT ((0)) FOR [eidAdjustment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losexpiryissuedetails' AND COLUMN_NAME= 'eidCancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losexpiryissuedetails] ADD CONSTRAINT [DF_losexpiryissuedetails_eidCancel] DEFAULT ((0)) FOR [eidCancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME= 'evdBatchNo' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD CONSTRAINT [DF__losExpiry__evdBa__02491253] DEFAULT ('OLDBATCH') FOR [evdBatchNo]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExpiryVerificationDetail' AND COLUMN_NAME= 'evdPrevBatchNo' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losExpiryVerificationDetail] ADD CONSTRAINT [DF__losExpiry__evdPr__0154EE1A] DEFAULT ('OLDBATCH') FOR [evdPrevBatchNo]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losExportHeader' AND COLUMN_NAME= 'rehTerminate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losExportHeader] ADD CONSTRAINT [DF__losExport__rehTe__1BBECB93] DEFAULT ((0)) FOR [rehTerminate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosFacilityTracking' AND COLUMN_NAME= 'ftcheckinCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosFacilityTracking] ADD CONSTRAINT [DF_LosFacilityTracking_ftcheckinCancelled] DEFAULT ((0)) FOR [ftcheckinCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuture' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losfuture] ADD CONSTRAINT [DF__losfuture__rowgu__6FB62C23] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabdetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losfuturetabdetail] ADD CONSTRAINT [DF__losfuture__rowgu__401B5C43] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME= 'futhupdatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losfuturetabheader] ADD CONSTRAINT [DF__losfuture__futhu__02333863] DEFAULT (getdate()) FOR [futhupdatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losfuturetabheader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losfuturetabheader] ADD CONSTRAINT [DF__losfuture__rowgu__7B3C2211] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopDetail' AND COLUMN_NAME= 'gadcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopDetail] ADD CONSTRAINT [DF_LOsGoodsArrivaltoShopDetail_gadcostprice] DEFAULT ((0)) FOR [gadcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD CONSTRAINT [DF__LOsGoodsA__rowgu__37BB206C] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME= 'gahCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_gahCancelled] DEFAULT ((0)) FOR [gahCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME= 'gahfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_gahfuturevc] DEFAULT ('') FOR [gahfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME= 'gahposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_gahposted] DEFAULT ((0)) FOR [gahposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME= 'gahTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_gahTransFinished] DEFAULT ((0)) FOR [gahTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsGoodsArrivaltoShopHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsGoodsArrivaltoShopHeader] ADD CONSTRAINT [DF_LOsGoodsArrivaltoShopHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME= 'grncostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD CONSTRAINT [DF_LosGoodsReturnNoteDetail_grncostprice] DEFAULT ((0)) FOR [grncostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME= 'GRNDDamaged' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD CONSTRAINT [DF_LosGoodsReturnNoteDetail_GRNDDamaged] DEFAULT ((0)) FOR [GRNDDamaged]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteDetail' AND COLUMN_NAME= 'GRNDunitprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosGoodsReturnNoteDetail] ADD CONSTRAINT [DF_LosGoodsReturnNoteDetail_GRNDunitprice] DEFAULT ((0)) FOR [GRNDunitprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD CONSTRAINT [DF__LosGoodsR__rowgu__10416098] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME= 'GrnCompanyID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD CONSTRAINT [DF_LosGoodsReturnNoteHeader_GrnCompanyID] DEFAULT ((1)) FOR [GrnCompanyID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME= 'grnfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD CONSTRAINT [DF_LosGoodsReturnNoteHeader_grnfuturevc] DEFAULT ('') FOR [grnfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME= 'GrnhCancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD CONSTRAINT [DF_LosGoodsReturnNoteHeader_GrnhCancel] DEFAULT ((0)) FOR [GrnhCancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME= 'GrnhPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD CONSTRAINT [DF_LosGoodsReturnNoteHeader_GrnhPosted] DEFAULT ((0)) FOR [GrnhPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosGoodsReturnNoteHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosGoodsReturnNoteHeader] ADD CONSTRAINT [DF_LosGoodsReturnNoteHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME= 'hpqhDownPaid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD CONSTRAINT [DF__losHpDumm__hpqhD__2046B6EA] DEFAULT ((0)) FOR [hpqhDownPaid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME= 'hpqhPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD CONSTRAINT [DF__losHpDumm__hpqhP__1F5292B1] DEFAULT ((0)) FOR [hpqhPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpDummyQuotationHeader' AND COLUMN_NAME= 'hpqhProcessed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losHpDummyQuotationHeader] ADD CONSTRAINT [DF__losHpDumm__hpqhP__213ADB23] DEFAULT ((0)) FOR [hpqhProcessed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME= 'hpqhDownPaid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD CONSTRAINT [DF_losHpInvoiceHeader_hpqhDownPaid] DEFAULT ((0)) FOR [hpqhDownPaid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME= 'hpqhPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD CONSTRAINT [DF_losHpInvoiceHeader_hpqhPosted] DEFAULT ((0)) FOR [hpqhPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHpInvoiceHeader' AND COLUMN_NAME= 'hpqhProcessed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losHpInvoiceHeader] ADD CONSTRAINT [DF_losHpInvoiceHeader_hpqhProcessed] DEFAULT ((0)) FOR [hpqhProcessed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losHPResaleHeader' AND COLUMN_NAME= 'hphRemarks' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losHPResaleHeader] ADD CONSTRAINT [DF__losHPResa__hphRe__581DCE5D] DEFAULT ('w') FOR [hphRemarks]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD CONSTRAINT [DF__losInhous__rowgu__68294D9D] DEFAULT (newsequentialid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInhouseExchangeDetail' AND COLUMN_NAME= 'sedcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losInhouseExchangeDetail] ADD CONSTRAINT [DF__losInhous__sedco__67352964] DEFAULT ((0)) FOR [sedcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME= 'ihcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losInquiryHeader] ADD CONSTRAINT [DF_losInquiryHeader_ihcancelled] DEFAULT ((0)) FOR [ihcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInquiryHeader' AND COLUMN_NAME= 'ihupdatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losInquiryHeader] ADD CONSTRAINT [DF_losInquiryHeader_ihupdatetime] DEFAULT (getdate()) FOR [ihupdatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME= 'idCustomPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD CONSTRAINT [DF__losInvoic__idCus__70E97C27] DEFAULT ((0)) FOR [idCustomPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME= 'idType' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD CONSTRAINT [DF__losinvoic__idTyp__18C26357] DEFAULT (' ') FOR [idType]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD CONSTRAINT [DF__LOsInvoic__rowgu__6497E884] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME= 'idcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD CONSTRAINT [DF_LOsInvoiceDetail_idcostprice] DEFAULT ((0)) FOR [idcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceDetail' AND COLUMN_NAME= 'idKitID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceDetail] ADD CONSTRAINT [DF_losInvoiceDetail_idKitID] DEFAULT ((0)) FOR [idKitID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedPartsReplacedetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losInvoicedPartsReplacedetails] ADD CONSTRAINT [DF_losInvoicedPartsReplacedetails_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoicedServiceDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losInvoicedServiceDetails] ADD CONSTRAINT [DF_losInvoicedServiceDetails_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'ExcludeGST' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF__LOsInvoic__Exclu__6D430875] DEFAULT ((0)) FOR [ExcludeGST]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF__LOsInvoic__rowgu__23D4EEA7] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'ihAdjustmentAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF_LOsInvoiceHeader_ihAdjustmentAmount] DEFAULT ((0)) FOR [ihAdjustmentAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'ihCompanyId' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF_LOsInvoiceHeader_ihCompanyId] DEFAULT ((1)) FOR [ihCompanyId]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'ihexchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF_LOsInvoiceHeader_ihexchangerate] DEFAULT ((1)) FOR [ihexchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'ihfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF_LOsInvoiceHeader_ihfuturevc] DEFAULT ('') FOR [ihfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'ihGoodsReturned' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF_LOsInvoiceHeader_ihGoodsReturned] DEFAULT ((0)) FOR [ihGoodsReturned]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'ihSettled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF_LOsInvoiceHeader_ihSettled] DEFAULT ((0)) FOR [ihSettled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'ihsettledamount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF_LOsInvoiceHeader_ihsettledamount] DEFAULT ((0)) FOR [ihsettledamount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'ihwholesale' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF_LOsInvoiceHeader_ihwholesale] DEFAULT ((0)) FOR [ihwholesale]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceHeader] ADD CONSTRAINT [DF_LOsInvoiceHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD CONSTRAINT [DF__LOsInvoic__rowgu__795DFB40] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceOC' AND COLUMN_NAME= 'ioCompanyid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceOC] ADD CONSTRAINT [DF_LOsInvoiceOC_icCompanyid] DEFAULT ((1)) FOR [ioCompanyid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losInvoiceProjectRequestDetails' AND COLUMN_NAME= 'idrCustomDutyByCustomer' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losInvoiceProjectRequestDetails] ADD CONSTRAINT [DF__losInvoic__idrCu__16DA1AE5] DEFAULT ((0)) FOR [idrCustomDutyByCustomer]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsInvoiceSubItemDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsInvoiceSubItemDetail] ADD CONSTRAINT [DF__LOsInvoic__rowgu__426F4FB7] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvpartsreplacedetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losinvpartsreplacedetails] ADD CONSTRAINT [DF__losinvpar__rowgu__0C11A858] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losinvservicedetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losinvservicedetails] ADD CONSTRAINT [DF__losinvser__rowgu__5733CBC5] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnDetail' AND COLUMN_NAME= 'krDDamaged' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosKegReturnDetail] ADD CONSTRAINT [DF_LosKegReturnDetail_krDDamaged] DEFAULT ((0)) FOR [krDDamaged]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME= 'krCompanyID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD CONSTRAINT [DF_LosKegReturnHeader_krCompanyID] DEFAULT ((1)) FOR [krCompanyID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME= 'krhCancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD CONSTRAINT [DF_LosKegReturnHeader_krhCancel] DEFAULT ((0)) FOR [krhCancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosKegReturnHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosKegReturnHeader] ADD CONSTRAINT [DF_LosKegReturnHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME= 'CashorCredit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD CONSTRAINT [DF__losLocalC__Casho__1C3DEE80] DEFAULT ((0)) FOR [CashorCredit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocalClearenceRequestHeader' AND COLUMN_NAME= 'CashPaidByShop' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losLocalClearenceRequestHeader] ADD CONSTRAINT [DF__losLocalC__CashP__1D3212B9] DEFAULT ((0)) FOR [CashPaidByShop]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseDetail] ADD CONSTRAINT [DF__LosLocalP__rowgu__6A50C1DA] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME= 'lphConfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD CONSTRAINT [DF__LosLocalP__lphCo__039C5DE8] DEFAULT ((0)) FOR [lphConfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD CONSTRAINT [DF__LosLocalP__rowgu__67C004A0] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME= 'lphAdjustmentAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD CONSTRAINT [DF_LosLocalPurchaseHeader_lphAdjustmentAmount] DEFAULT ((0)) FOR [lphAdjustmentAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME= 'lphcosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD CONSTRAINT [DF_LosLocalPurchaseHeader_lphcosted] DEFAULT ((0)) FOR [lphcosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME= 'lphexchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD CONSTRAINT [DF_LosLocalPurchaseHeader_lphexchangerate] DEFAULT ((1)) FOR [lphexchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME= 'lphfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD CONSTRAINT [DF_LosLocalPurchaseHeader_lphfuturevc] DEFAULT ('') FOR [lphfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME= 'lphSettled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD CONSTRAINT [DF_LosLocalPurchaseHeader_lphSettled] DEFAULT ((0)) FOR [lphSettled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME= 'lphUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD CONSTRAINT [DF_LosLocalPurchaseHeader_lphUsed] DEFAULT ((0)) FOR [lphUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosLocalPurchaseHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosLocalPurchaseHeader] ADD CONSTRAINT [DF_LosLocalPurchaseHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsLocalPurchaseOC' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsLocalPurchaseOC] ADD CONSTRAINT [DF__LOsLocalP__rowgu__5708E33C] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME= 'ladconfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD CONSTRAINT [DF__loslocati__ladco__78008E0A] DEFAULT ((1)) FOR [ladconfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME= 'ladadjustment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD CONSTRAINT [DF_loslocationarrivaldetails_ladadjustment] DEFAULT ((0)) FOR [ladadjustment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationarrivaldetails' AND COLUMN_NAME= 'ladcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loslocationarrivaldetails] ADD CONSTRAINT [DF_loslocationarrivaldetails_ladcancel] DEFAULT ((0)) FOR [ladcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME= 'lidconfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD CONSTRAINT [DF__loslocati__lidco__78F4B243] DEFAULT ((1)) FOR [lidconfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME= 'lidcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD CONSTRAINT [DF_loslocationissuedetails_ladcancel] DEFAULT ((0)) FOR [lidcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='loslocationissuedetails' AND COLUMN_NAME= 'lidadjustment' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [loslocationissuedetails] ADD CONSTRAINT [DF_loslocationissuedetails_lidadjustment] DEFAULT ((0)) FOR [lidadjustment]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME= 'lvhCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD CONSTRAINT [DF__losLocati__lvhCa__129488B5] DEFAULT ((0)) FOR [lvhCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME= 'lvhposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD CONSTRAINT [DF__losLocati__lvhpo__1388ACEE] DEFAULT ((0)) FOR [lvhposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLocationVerificationHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losLocationVerificationHeader] ADD CONSTRAINT [DF__losLocati__updat__147CD127] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPDetail' AND COLUMN_NAME= 'status' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losLPDetail] ADD CONSTRAINT [DF__losLPDeta__statu__0BD27C8D] DEFAULT ('D') FOR [status]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME= 'CashorCredit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losLPHeader] ADD CONSTRAINT [DF__losLPHead__Casho__37E608F5] DEFAULT ((0)) FOR [CashorCredit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losLPHeader' AND COLUMN_NAME= 'CashPaidByShop' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losLPHeader] ADD CONSTRAINT [DF__losLPHead__CashP__38DA2D2E] DEFAULT ((0)) FOR [CashPaidByShop]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losNonRestrictedItems' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losNonRestrictedItems] ADD CONSTRAINT [DF__losNonRes__rowgu__5F29F348] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPaymentVoucherDetails] ADD CONSTRAINT [DF__LOsPaymen__rowgu__7F16D496] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD CONSTRAINT [DF__LOsPaymen__rowgu__35F39EE2] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME= 'phExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD CONSTRAINT [DF_LOsPaymentVoucherHeader_phExchangeRate] DEFAULT ((1)) FOR [phExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME= 'phfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD CONSTRAINT [DF_LOsPaymentVoucherHeader_phfuturevc] DEFAULT ('') FOR [phfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPaymentVoucherHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPaymentVoucherHeader] ADD CONSTRAINT [DF_LOsPaymentVoucherHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPosChequeDetails' AND COLUMN_NAME= 'PosChequeUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPosChequeDetails] ADD CONSTRAINT [DF_losPosChequeDetails_PosChequeUsed] DEFAULT ((0)) FOR [PosChequeUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME= 'posdBillDetailID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosDetail] ADD CONSTRAINT [DF__LOsPosDet__posdB__62FA842C] DEFAULT ((1)) FOR [posdBillDetailID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME= 'posdItemType' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosDetail] ADD CONSTRAINT [DF__LOsPosDet__posdI__63EEA865] DEFAULT ('I') FOR [posdItemType]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosDetail] ADD CONSTRAINT [DF__LOsPosDet__rowgu__384F51F2] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME= 'posdcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosDetail] ADD CONSTRAINT [DF_LOsPosDetail_posdcostprice] DEFAULT ((0)) FOR [posdcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME= 'posdKitID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosDetail] ADD CONSTRAINT [DF_losPosDetail_posdKitID] DEFAULT ((0)) FOR [posdKitID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosDetail' AND COLUMN_NAME= 'posdRateType' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosDetail] ADD CONSTRAINT [DF_LOsPosDetail_posdRateType] DEFAULT ((0)) FOR [posdRateType]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosdummyDetail' AND COLUMN_NAME= 'posdBillDetailID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosdummyDetail] ADD CONSTRAINT [DF__LOsPosdum__posdB__6ED64B2C] DEFAULT ((1)) FOR [posdBillDetailID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD CONSTRAINT [DF__losposExc__rowgu__05306BF6] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeDetail' AND COLUMN_NAME= 'sedcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeDetail] ADD CONSTRAINT [DF_losposExchangeDetail_sedcostprice] DEFAULT ((0)) FOR [sedcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD CONSTRAINT [DF__losposExc__rowgu__52C4E7BA] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME= 'sehCompanyID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD CONSTRAINT [DF_losposExchangeHeader_sehCompanyID] DEFAULT ((1)) FOR [sehCompanyID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME= 'sehExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD CONSTRAINT [DF_losposExchangeHeader_sehExchangeRate] DEFAULT ((1)) FOR [sehExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME= 'sehfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD CONSTRAINT [DF_losposExchangeHeader_sehfuturevc] DEFAULT ('') FOR [sehfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME= 'sehwholesale' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD CONSTRAINT [DF_losposExchangeHeader_sehwholesale] DEFAULT ((0)) FOR [sehwholesale]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeHeader] ADD CONSTRAINT [DF_losposExchangeHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeOtherCharges' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeOtherCharges] ADD CONSTRAINT [DF__losposExc__rowgu__52F9F1E4] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposExchangeSubItemDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposExchangeSubItemDetails] ADD CONSTRAINT [DF__losposExc__rowgu__10A21EA2] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'PoshBillCount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF__losposhea__PoshB__5B1BCD47] DEFAULT ((0)) FOR [PoshBillCount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'poshAccAuditid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_poshAccAuditid] DEFAULT ((0)) FOR [poshAccAuditid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'poshcash' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_poshcash] DEFAULT ((0)) FOR [poshcash]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'poshCompanyID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_poshCompanyID] DEFAULT ((1)) FOR [poshCompanyID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'poshfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_poshfuturevc] DEFAULT ('') FOR [poshfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'poshReturned' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_poshReturned] DEFAULT ((0)) FOR [poshReturned]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'poshservicecharge' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_poshservicec0harge] DEFAULT ((0)) FOR [poshservicecharge]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'poshWholesale' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_poshWholesale] DEFAULT ((0)) FOR [poshWholesale]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'receipted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_receipted] DEFAULT ((0)) FOR [receipted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'salesbillbit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_salesbillbit] DEFAULT ((0)) FOR [salesbillbit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosPosFAndBHeader] ADD CONSTRAINT [DF_LosPosFAndBHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME= 'poshCustomerTIN' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosHeader] ADD CONSTRAINT [DF__LOsPosHea__poshC__31B82E53] DEFAULT ('') FOR [poshCustomerTIN]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosHeader] ADD CONSTRAINT [DF__LOsPosHea__rowgu__2937F6EB] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME= 'poshCompanyID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosHeader] ADD CONSTRAINT [DF_LOsPosHeader_poshCompanyID] DEFAULT ((1)) FOR [poshCompanyID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME= 'poshExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosHeader] ADD CONSTRAINT [DF_LOsPosHeader_poshExchangeRate] DEFAULT ((1)) FOR [poshExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME= 'poshReturned' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosHeader] ADD CONSTRAINT [DF_LOsPosHeader_poshReturned] DEFAULT ((0)) FOR [poshReturned]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME= 'poshWholesale' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosHeader] ADD CONSTRAINT [DF_LOsPosHeader_poshWholesale] DEFAULT ((0)) FOR [poshWholesale]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosHeader] ADD CONSTRAINT [DF_LOsPosHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosOthercharges' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosOthercharges] ADD CONSTRAINT [DF__LOsPosOth__rowgu__605D434C] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPosSubItemDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPosSubItemDetail] ADD CONSTRAINT [DF__LOsPosSub__rowgu__070CFC19] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losposWarDet' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losposWarDet] ADD CONSTRAINT [DF__losposWarDet__rowgu__2937F6EB] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME= 'pbdItemCostedPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD CONSTRAINT [DF_LOspPurchaseBillDetail_pbdItemCostedPrice] DEFAULT ((0)) FOR [pbdItemCostedPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillDetail' AND COLUMN_NAME= 'pbdItemFixedPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOspPurchaseBillDetail] ADD CONSTRAINT [DF_LOspPurchaseBillDetail_pbdItemFixedPrice] DEFAULT ((0)) FOR [pbdItemFixedPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME= 'pbhAdjustmentAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD CONSTRAINT [DF_LOspPurchaseBillHeader_pbhAdjustmentAmount] DEFAULT ((0)) FOR [pbhAdjustmentAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME= 'pbhDespatched' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD CONSTRAINT [DF_LOspPurchaseBillHeader_pbhDespatched] DEFAULT ((0)) FOR [pbhDespatched]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME= 'pbhexchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD CONSTRAINT [DF_LOspPurchaseBillHeader_pbhexchangerate] DEFAULT ((1)) FOR [pbhexchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME= 'pbhSettled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD CONSTRAINT [DF_LOspPurchaseBillHeader_pbhSettled] DEFAULT ((0)) FOR [pbhSettled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME= 'pbhUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD CONSTRAINT [DF_LOspPurchaseBillHeader_pbhUsed] DEFAULT ((0)) FOR [pbhUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOspPurchaseBillHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOspPurchaseBillHeader] ADD CONSTRAINT [DF_LOspPurchaseBillHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderDetail] ADD CONSTRAINT [DF__losPurcha__rowgu__2A212E2C] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'pohPOclosed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF__lospurcha__pohPO__71DDA060] DEFAULT ((0)) FOR [pohPOclosed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'poHQConfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF__losPurcha__poHQC__56E9B302] DEFAULT ((0)) FOR [poHQConfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF__losPurcha__rowgu__2FDA0782] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'pogenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF_losPurchaseOrderHeader_pogenerated] DEFAULT ((0)) FOR [pogenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'pohbillgenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF_losPurchaseOrderHeader_pohbillgenerated] DEFAULT ((0)) FOR [pohbillgenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'pohcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF_losPurchaseOrderHeader_pohcancel] DEFAULT ((0)) FOR [pohcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'pohfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF_losPurchaseOrderHeader_pohfuturevc] DEFAULT ('') FOR [pohfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'pohQuotation' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF_losPurchaseOrderHeader_pohPocheck] DEFAULT ((0)) FOR [pohQuotation]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'pohpogenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF_losPurchaseOrderHeader_pohpogenerated] DEFAULT ((0)) FOR [pohpogenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losPurchaseOrderHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losPurchaseOrderHeader] ADD CONSTRAINT [DF_losPurchaseOrderHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPurchaseReturnDetail] ADD CONSTRAINT [DF_LOsPurchaseReturnDetail_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD CONSTRAINT [DF_LOsPurchaseReturnHeader_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD CONSTRAINT [DF_LOsPurchaseReturnHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME= 'Whfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD CONSTRAINT [DF_LOsPurchaseReturnHeader_Whfuturevc] DEFAULT ('') FOR [Whfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME= 'whposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD CONSTRAINT [DF_LOsPurchaseReturnHeader_whposted] DEFAULT ((0)) FOR [whposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsPurchaseReturnHeader' AND COLUMN_NAME= 'whselected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsPurchaseReturnHeader] ADD CONSTRAINT [DF_LOsPurchaseReturnHeader_whselected] DEFAULT ((0)) FOR [whselected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebateconfirmheader' AND COLUMN_NAME= 'rccancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losrebateconfirmheader] ADD CONSTRAINT [DF_losrebateconfirmheader_rccancelled] DEFAULT ((0)) FOR [rccancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losrebaterequest' AND COLUMN_NAME= 'rrcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losrebaterequest] ADD CONSTRAINT [DF_losrebaterequest_rrcancelled] DEFAULT ((0)) FOR [rrcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsReceiptVoucherDetails] ADD CONSTRAINT [DF__LOsReceip__rowgu__04CFADEC] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD CONSTRAINT [DF__LOsReceip__rowgu__08EBEE41] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME= 'rhCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD CONSTRAINT [DF_LOsReceiptVoucherHeader_rhCancelled] DEFAULT ((0)) FOR [rhCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME= 'rhCompanyID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD CONSTRAINT [DF_LOsReceiptVoucherHeader_rhCompanyID] DEFAULT ((1)) FOR [rhCompanyID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME= 'rhExchangeRate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD CONSTRAINT [DF_LOsReceiptVoucherHeader_rhExchangeRate] DEFAULT ((1)) FOR [rhExchangeRate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME= 'rhfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD CONSTRAINT [DF_LOsReceiptVoucherHeader_rhfuturevc] DEFAULT ('') FOR [rhfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME= 'rhPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD CONSTRAINT [DF_LOsReceiptVoucherHeader_rhPosted] DEFAULT ((0)) FOR [rhPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsReceiptVoucherHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsReceiptVoucherHeader] ADD CONSTRAINT [DF_LOsReceiptVoucherHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceivedetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacereceivedetails] ADD CONSTRAINT [DF__losreplac__rowgu__0658CF02] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME= 'reprechupdatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD CONSTRAINT [DF__losreplac__repre__004AEFF1] DEFAULT (getdate()) FOR [reprechupdatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD CONSTRAINT [DF__losreplac__rowgu__34A9A997] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacereceiveheader' AND COLUMN_NAME= 'reprechcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacereceiveheader] ADD CONSTRAINT [DF_losreplacereceiveheader_reprechcancelled] DEFAULT ((0)) FOR [reprechcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestdetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacerequestdetails] ADD CONSTRAINT [DF__losreplac__rowgu__5C629536] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME= 'repreqhtransfinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD CONSTRAINT [DF__losreplac__repre__37861642] DEFAULT ((0)) FOR [repreqhtransfinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME= 'repreqhnoofdetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD CONSTRAINT [DF__losreplac__repre__387A3A7B] DEFAULT ((0)) FOR [repreqhnoofdetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME= 'repreqhupdatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD CONSTRAINT [DF__losreplac__repre__7F56CBB8] DEFAULT (getdate()) FOR [repreqhupdatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD CONSTRAINT [DF__losreplac__rowgu__758348BB] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME= 'repreqhcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD CONSTRAINT [DF_losreplacerequestheader_repreqhcancelled] DEFAULT ((0)) FOR [repreqhcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losreplacerequestheader' AND COLUMN_NAME= 'repreqhreceived' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losreplacerequestheader] ADD CONSTRAINT [DF_losreplacerequestheader_repreqhreceived] DEFAULT ((0)) FOR [repreqhreceived]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosReserveItem' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosReserveItem] ADD CONSTRAINT [DF__LosReserv__rowgu__386F4D83] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserconditiondetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losserconditiondetails] ADD CONSTRAINT [DF__lossercon__rowgu__42A2C333] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME= 'seaAppCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD CONSTRAINT [DF_losSerestimateapproval_seaCancelled] DEFAULT ((0)) FOR [seaAppCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerestimateapproval' AND COLUMN_NAME= 'seaApporRejected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSerestimateapproval] ADD CONSTRAINT [DF_losSerestimateapproval_seaRejected] DEFAULT ((1)) FOR [seaApporRejected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceContractHeader' AND COLUMN_NAME= 'mchguarantee' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSerMaintenanceContractHeader] ADD CONSTRAINT [DF__losSerMai__mchgu__1CE7F9F6] DEFAULT ((0)) FOR [mchguarantee]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerMaintenanceServiceDetail' AND COLUMN_NAME= 'msdAlerttype' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSerMaintenanceServiceDetail] ADD CONSTRAINT [DF__losSerMai__msdAl__19176912] DEFAULT ((0)) FOR [msdAlerttype]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losserpartsfromcustomer' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losserpartsfromcustomer] ADD CONSTRAINT [DF__losserpar__rowgu__7AE71C56] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByIssueHeader' AND COLUMN_NAME= 'ishInstallDate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSerStandByIssueHeader] ADD CONSTRAINT [DF_losSerStandByIssueHeader_ishInstallDate] DEFAULT (getdate()) FOR [ishInstallDate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByReceiptHeader' AND COLUMN_NAME= 'rhUpdateTime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSerStandByReceiptHeader] ADD CONSTRAINT [DF_losSerStandByReceiptHeader_rhUpdateTime] DEFAULT (getdate()) FOR [rhUpdateTime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSerStandByRequestHeader' AND COLUMN_NAME= 'reqhUpdateTime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSerStandByRequestHeader] ADD CONSTRAINT [DF_losSerStandByRequestHeader_reqhUpdateTime] DEFAULT (getdate()) FOR [reqhUpdateTime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME= 'serbookhinpcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD CONSTRAINT [DF__losservic__serbo__55E08030] DEFAULT ((0)) FOR [serbookhinpcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME= 'serserbookhExcludeGST' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD CONSTRAINT [DF__losServic__serse__46B34B39] DEFAULT ((0)) FOR [serserbookhExcludeGST]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME= 'serbookconfirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD CONSTRAINT [DF_losservicebookingheader_serbookconfirmed] DEFAULT ((0)) FOR [serbookconfirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME= 'serbookhinvoiced' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD CONSTRAINT [DF_losservicebookingheader_serbookhinvoiced] DEFAULT ((0)) FOR [serbookhinvoiced]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME= 'serbookhposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD CONSTRAINT [DF_losservicebookingheader_serbookhposted] DEFAULT ((0)) FOR [serbookhposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME= 'serbookhUpdateTime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD CONSTRAINT [DF_losServiceBookingHeader_serbookhUpdateTime] DEFAULT (getdate()) FOR [serbookhUpdateTime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceBookingHeader' AND COLUMN_NAME= 'serbooksermode' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceBookingHeader] ADD CONSTRAINT [DF_losservicebookingheader_serbooksermode] DEFAULT ((0)) FOR [serbooksermode]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceHeader] ADD CONSTRAINT [DF__losservic__rowgu__3A6282ED] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME= 'serinvhToInvoice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceHeader] ADD CONSTRAINT [DF__losServic__serin__1DA71405] DEFAULT ((0)) FOR [serinvhToInvoice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losServiceHeader' AND COLUMN_NAME= 'serinvhjobinvcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losServiceHeader] ADD CONSTRAINT [DF_losserviceheader_serinvhjobinvcancelled] DEFAULT ((0)) FOR [serinvhjobinvcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME= 'serinvhCashInv' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD CONSTRAINT [DF__losservic__serin__3B6C8116] DEFAULT ((0)) FOR [serinvhCashInv]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME= 'serinvhcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD CONSTRAINT [DF_LosServiceInvHeader_serinvhcancelled] DEFAULT ((0)) FOR [serinvhcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosServiceInvHeader' AND COLUMN_NAME= 'serinvhposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosServiceInvHeader] ADD CONSTRAINT [DF_LosServiceInvHeader_serinvhposted] DEFAULT ((0)) FOR [serinvhposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsServiceInvoiceDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsServiceInvoiceDetails] ADD CONSTRAINT [DF__LOsServic__rowgu__5C229E14] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losservinvoicetechniciandetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losservinvoicetechniciandetails] ADD CONSTRAINT [DF__losservin__rowgu__12211E17] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME= 'BlockAboveSP' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsSettings] ADD CONSTRAINT [DF__losSettin__Block__5EFFD616] DEFAULT ((0)) FOR [BlockAboveSP]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME= 'DirectLocalPurchaseCosting' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsSettings] ADD CONSTRAINT [DF__LOsSettin__Direc__308EFFF0] DEFAULT ((0)) FOR [DirectLocalPurchaseCosting]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME= 'PopulateDateWise' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsSettings] ADD CONSTRAINT [DF__losSettin__Popul__25C758BA] DEFAULT ((0)) FOR [PopulateDateWise]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME= 'QuickItemFetch' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsSettings] ADD CONSTRAINT [DF__losSettin__Quick__31390B66] DEFAULT ((1)) FOR [QuickItemFetch]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsSettings] ADD CONSTRAINT [DF__LOsSettin__rowgu__61DB776A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsSettings' AND COLUMN_NAME= 'ShopActiveDirectoryLogin' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsSettings] ADD CONSTRAINT [DF__LOsSettin__ShopA__32B80ADB] DEFAULT ((0)) FOR [ShopActiveDirectoryLogin]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbndetail' AND COLUMN_NAME= 'bndStatus' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosShipmentbndetail] ADD CONSTRAINT [DF__losShipme__bndSt__1B14C01D] DEFAULT ('D') FOR [bndStatus]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosShipmentbnheader' AND COLUMN_NAME= 'bnhcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LosShipmentbnheader] ADD CONSTRAINT [DF_LosShipmentbhheader_bnhcancelled] DEFAULT ((0)) FOR [bnhcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingDetails' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsShopDamageClearingDetails] ADD CONSTRAINT [DF__LOsShopDa__rowgu__0A888742] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD CONSTRAINT [DF__LOsShopDa__rowgu__43C1049E] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME= 'dchfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD CONSTRAINT [DF_LOsShopDamageClearingHeader_dchfuturevc] DEFAULT ('') FOR [dchfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsShopDamageClearingHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsShopDamageClearingHeader] ADD CONSTRAINT [DF_LOsShopDamageClearingHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD CONSTRAINT [DF__losShopIt__rowgu__7ECCBBD3] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME= 'DiscountPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD CONSTRAINT [DF_losShopItemShipmentDetail_DiscountPrice] DEFAULT ((0)) FOR [DiscountPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME= 'PackingTypeid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD CONSTRAINT [DF_losShopItemShipmentDetail_PackingTypeid] DEFAULT ((1)) FOR [PackingTypeid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME= 'Pricechanged' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD CONSTRAINT [DF_losShopItemShipmentDetail_Pricechanged] DEFAULT ((0)) FOR [Pricechanged]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME= 'sellingPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD CONSTRAINT [DF_losShopItemShipmentDetail_sellingPrice] DEFAULT ((0)) FOR [sellingPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losShopItemShipmentDetail' AND COLUMN_NAME= 'WholesalePrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losShopItemShipmentDetail] ADD CONSTRAINT [DF_losShopItemShipmentDetail_WholesalePrice] DEFAULT ((0)) FOR [WholesalePrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME= 'idFreeQuantity' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD CONSTRAINT [DF__losSIQuo__idFre__32B73F84] DEFAULT ((0)) FOR [idFreeQuantity]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD CONSTRAINT [DF__losSIQuo__rowgu__17D9F76D] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME= 'despatch' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD CONSTRAINT [DF_losSIQuotationDetail_despatch] DEFAULT ((0)) FOR [despatch]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME= 'idcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD CONSTRAINT [DF_losSIQuotationDetail_idcostprice] DEFAULT ((0)) FOR [idcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationDetail' AND COLUMN_NAME= 'idRateType' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationDetail] ADD CONSTRAINT [DF_losSIQuotationDetail_idRateType] DEFAULT ((0)) FOR [idRateType]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF__losQuo__rowgu__318D45CA] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'IhCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_IhCancelled] DEFAULT ((0)) FOR [IhCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'IhCashInvoice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_IhCashInvoice] DEFAULT ((0)) FOR [IhCashInvoice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'IhCompanyId' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_IhCompanyId] DEFAULT ((1)) FOR [IhCompanyId]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'ihexchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_ihexchangerate] DEFAULT ((1)) FOR [ihexchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'ihfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_ihfuturevc] DEFAULT ('') FOR [ihfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'ihGoodsReturned' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_ihGoodsReturned] DEFAULT ((0)) FOR [ihGoodsReturned]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'ihNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_ihNoofDetails] DEFAULT ((0)) FOR [ihNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'ihNoofOCDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_ihNoofOCDetails] DEFAULT ((0)) FOR [ihNoofOCDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'IhPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_IhPosted] DEFAULT ((0)) FOR [IhPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'IhProforma' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_IhProforma] DEFAULT ((0)) FOR [IhProforma]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'IhSettled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_IhSettled] DEFAULT ((0)) FOR [IhSettled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'ihsettledamount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_ihsettledamount] DEFAULT ((0)) FOR [ihsettledamount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'ihTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_ihTransFinished] DEFAULT ((0)) FOR [ihTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'ihUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_ihUsed] DEFAULT ((0)) FOR [ihUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSIQuotationHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSIQuotationHeader] ADD CONSTRAINT [DF_losSIQuotationHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME= 'idFreeQuantity' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD CONSTRAINT [DF__losSpecia__idFre__32B73F84] DEFAULT ((0)) FOR [idFreeQuantity]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD CONSTRAINT [DF__losSpecia__rowgu__17D9F76D] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME= 'despatch' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD CONSTRAINT [DF_losSpecialInvoiceDetail_despatch] DEFAULT ((0)) FOR [despatch]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME= 'idcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD CONSTRAINT [DF_losSpecialInvoiceDetail_idcostprice] DEFAULT ((0)) FOR [idcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME= 'idItemType' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD CONSTRAINT [DF_losSpecialInvoiceDetail_idItemType] DEFAULT ('I') FOR [idItemType]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME= 'idKitID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD CONSTRAINT [DF_losSpecialInvoiceDetail_idKitID] DEFAULT ((0)) FOR [idKitID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceDetail' AND COLUMN_NAME= 'idRateType' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceDetail] ADD CONSTRAINT [DF_losSpecialInvoiceDetail_idRateType] DEFAULT ((0)) FOR [idRateType]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF__losSpecia__rowgu__318D45CA] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'IhCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_IhCancelled] DEFAULT ((0)) FOR [IhCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'IhCashInvoice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_IhCashInvoice] DEFAULT ((0)) FOR [IhCashInvoice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'IhCompanyId' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_IhCompanyId] DEFAULT ((1)) FOR [IhCompanyId]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'ihexchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_ihexchangerate] DEFAULT ((1)) FOR [ihexchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'ihfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_ihfuturevc] DEFAULT ('') FOR [ihfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'ihGoodsReturned' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_ihGoodsReturned] DEFAULT ((0)) FOR [ihGoodsReturned]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'ihNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_ihNoofDetails] DEFAULT ((0)) FOR [ihNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'ihNoofOCDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_ihNoofOCDetails] DEFAULT ((0)) FOR [ihNoofOCDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'IhPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_IhPosted] DEFAULT ((0)) FOR [IhPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'IhProforma' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_IhProforma] DEFAULT ((0)) FOR [IhProforma]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'IhSettled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_IhSettled] DEFAULT ((0)) FOR [IhSettled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'ihsettledamount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_ihsettledamount] DEFAULT ((0)) FOR [ihsettledamount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'ihTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_ihTransFinished] DEFAULT ((0)) FOR [ihTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'ihUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_ihUsed] DEFAULT ((0)) FOR [ihUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialInvoiceHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialInvoiceHeader] ADD CONSTRAINT [DF_losSpecialInvoiceHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losSpecialOC' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losSpecialOC] ADD CONSTRAINT [DF__losSpecia__rowgu__1D92D0C3] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockRecovery] ADD CONSTRAINT [DF__losStockR__rowgu__306FCFB6] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME= 'srcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockRecovery] ADD CONSTRAINT [DF_losStockRecovery_srcostprice] DEFAULT ((0)) FOR [srcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME= 'srposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockRecovery] ADD CONSTRAINT [DF_losStockRecovery_srposted] DEFAULT ((0)) FOR [srposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockRecovery' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockRecovery] ADD CONSTRAINT [DF_losStockRecovery_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD CONSTRAINT [DF__losStockV__rowgu__7ADC2F5E] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationDetail' AND COLUMN_NAME= 'svdcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockVerificationDetail] ADD CONSTRAINT [DF_losStockVerificationDetail_svdcostprice] DEFAULT ((0)) FOR [svdcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD CONSTRAINT [DF__losStockV__rowgu__3592E0D8] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME= 'svhcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD CONSTRAINT [DF_lopStockVerificationHeader_svhcancelled] DEFAULT ((0)) FOR [svhcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME= 'svhfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD CONSTRAINT [DF_losStockVerificationHeader_svhfuturevc] DEFAULT ('') FOR [svhfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME= 'svhposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD CONSTRAINT [DF_losStockVerificationHeader_svhposted] DEFAULT ((0)) FOR [svhposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='losStockVerificationHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [losStockVerificationHeader] ADD CONSTRAINT [DF_losStockVerificationHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferindetail' AND COLUMN_NAME= 'TIDCostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOSTransferindetail] ADD CONSTRAINT [DF_LOSTransferindetail_TIDCostprice] DEFAULT ((0)) FOR [TIDCostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD CONSTRAINT [DF__LOSTransf__rowgu__387A3A7B] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME= 'TIHcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD CONSTRAINT [DF_LOSTransferinheader_TIHcancel] DEFAULT ((0)) FOR [TIHcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME= 'TIHfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD CONSTRAINT [DF_LOSTransferinheader_TIHfuturevc] DEFAULT ('') FOR [TIHfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME= 'TIHPosted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD CONSTRAINT [DF_LOSTransferinheader_TIHPosted] DEFAULT ((0)) FOR [TIHPosted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME= 'TIHTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD CONSTRAINT [DF_LOSTransferinheader_TIHTransFinished] DEFAULT ((0)) FOR [TIHTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOSTransferinheader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOSTransferinheader] ADD CONSTRAINT [DF_LOSTransferinheader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD CONSTRAINT [DF__LOsWriteO__rowgu__52CE3E04] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffDetail' AND COLUMN_NAME= 'wdcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsWriteOffDetail] ADD CONSTRAINT [DF_LOsWriteOffDetail_wdcostprice] DEFAULT ((0)) FOR [wdcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD CONSTRAINT [DF__LOsWriteO__rowgu__679450C0] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME= 'whVerified' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD CONSTRAINT [DF__LOsWriteO__whVer__63849411] DEFAULT ((1)) FOR [whVerified]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD CONSTRAINT [DF_LOsWriteOffHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME= 'Whfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD CONSTRAINT [DF_LOsWriteOffHeader_Whfuturevc] DEFAULT ('') FOR [Whfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LOsWriteOffHeader' AND COLUMN_NAME= 'whposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [LOsWriteOffHeader] ADD CONSTRAINT [DF_LOsWriteOffHeader_whposted] DEFAULT ((0)) FOR [whposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME= 'dsFromGodownID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD CONSTRAINT [DF_MEDifferenceinStock_dsFromGodownID] DEFAULT ((0)) FOR [dsFromGodownID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME= 'dsFromShopID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD CONSTRAINT [DF_MEDifferenceinStock_dsFromShopID] DEFAULT ((0)) FOR [dsFromShopID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME= 'dsToAdd' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD CONSTRAINT [DF_MEDifferenceinStock_dsToAdd] DEFAULT ((0)) FOR [dsToAdd]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME= 'dsToDeduct' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD CONSTRAINT [DF_MEDifferenceinStock_dsToDeduct] DEFAULT ((0)) FOR [dsToDeduct]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME= 'dsToGodownID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD CONSTRAINT [DF_MEDifferenceinStock_dsToGodownID] DEFAULT ((0)) FOR [dsToGodownID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEDifferenceinStock' AND COLUMN_NAME= 'dsToShopID' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEDifferenceinStock] ADD CONSTRAINT [DF_MEDifferenceinStock_dsToShopID] DEFAULT ((0)) FOR [dsToShopID]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiDespatchToShopDetail] ADD CONSTRAINT [DF__MEiDespat__rowgu__6D4D2A16] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME= 'dhposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD CONSTRAINT [DF__meidespat__dhpos__37088A03] DEFAULT ((0)) FOR [dhposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD CONSTRAINT [DF__MEiDespat__rowgu__554B8353] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME= 'dhfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD CONSTRAINT [DF_MEiDespatchToShopHeader_dhfuturevc] DEFAULT ('') FOR [dhfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME= 'dhNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD CONSTRAINT [DF_MEiDespatchToShopHeader_dhNoofDetails] DEFAULT ((0)) FOR [dhNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME= 'dhTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD CONSTRAINT [DF_MEiDespatchToShopHeader_dhTransFinished] DEFAULT ((0)) FOR [dhTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiDespatchToShopHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiDespatchToShopHeader] ADD CONSTRAINT [DF_MEiDespatchToShopHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MeiGodownRequestDetail] ADD CONSTRAINT [DF_MeiGodownRequestDetail_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME= 'GRHCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD CONSTRAINT [DF_MeiGodownRequestHeader_GRHCancelled] DEFAULT ((0)) FOR [GRHCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME= 'GRHUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD CONSTRAINT [DF_MeiGodownRequestHeader_GRHUsed] DEFAULT ((0)) FOR [GRHUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MeiGodownRequestHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MeiGodownRequestHeader] ADD CONSTRAINT [DF_MeiGodownRequestHeader_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD CONSTRAINT [DF__MEiGodown__rowgu__4979DDF4] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferDetail' AND COLUMN_NAME= 'gtdcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiGodownTransferDetail] ADD CONSTRAINT [DF_MEiGodownTransferDetail_gtdcostprice] DEFAULT ((0)) FOR [gtdcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME= 'gthposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD CONSTRAINT [DF__meigodown__gthpo__23C0AB65] DEFAULT ((0)) FOR [gthposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD CONSTRAINT [DF__MEiGodown__rowgu__78BEDCC2] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME= 'gthfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD CONSTRAINT [DF_MEiGodownTransferHeader_gthfuturevc] DEFAULT ('') FOR [gthfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME= 'gthNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD CONSTRAINT [DF_MEiGodownTransferHeader_gthNoofDetails] DEFAULT ((0)) FOR [gthNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME= 'gthTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD CONSTRAINT [DF_MEiGodownTransferHeader_gthTransFinished] DEFAULT ((0)) FOR [gthTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEiGodownTransferHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEiGodownTransferHeader] ADD CONSTRAINT [DF_MEiGodownTransferHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiRQtoHQforItem' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiRQtoHQforItem] ADD CONSTRAINT [DF__meiRQtoHQ__rowgu__3C0AD43D] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD CONSTRAINT [DF__meiSpecia__rowgu__1A74D648] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME= 'ddCostedPrice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD CONSTRAINT [DF_meiSpecialDespatchtoShopDetail_ddCostedPrice] DEFAULT ((0)) FOR [ddCostedPrice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME= 'ddinvqty' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD CONSTRAINT [DF_meiSpecialDespatchtoShopDetail_ddinvqty] DEFAULT ((0)) FOR [ddinvqty]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME= 'ddItemBadQty' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD CONSTRAINT [DF_meiSpecialDespatchtoShopDetail_ddItemBadQty] DEFAULT ((0)) FOR [ddItemBadQty]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoShopDetail' AND COLUMN_NAME= 'ddItemGoodQty' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoShopDetail] ADD CONSTRAINT [DF_meiSpecialDespatchtoShopDetail_ddItemGoodQty] DEFAULT ((0)) FOR [ddItemGoodQty]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD CONSTRAINT [DF__meiSpecia__rowgu__1530FE3E] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME= 'dhCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD CONSTRAINT [DF_meiSpecialDespatchtoshopHeader_dhCancelled] DEFAULT ((0)) FOR [dhCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME= 'dhposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD CONSTRAINT [DF_meiSpecialDespatchtoshopHeader_dhposted] DEFAULT ((0)) FOR [dhposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME= 'dhSelected' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD CONSTRAINT [DF_meiSpecialDespatchtoshopHeader_dhSelected] DEFAULT ((0)) FOR [dhSelected]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='meiSpecialDespatchtoshopHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [meiSpecialDespatchtoshopHeader] ADD CONSTRAINT [DF_meiSpecialDespatchtoshopHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEmessages' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEmessages] ADD CONSTRAINT [DF__MEmessage__rowgu__3FA65AF7] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD CONSTRAINT [DF__MEsDespat__rowgu__70099B30] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownDetail' AND COLUMN_NAME= 'dgdcostprice' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownDetail] ADD CONSTRAINT [DF_MEsDespatchtoGodownDetail_dgdcostprice] DEFAULT ((0)) FOR [dgdcostprice]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME= 'dghposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD CONSTRAINT [DF__mesdespat__dghpo__3CC16359] DEFAULT ((0)) FOR [dghposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD CONSTRAINT [DF__MEsDespat__rowgu__0F7824E8] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME= 'dghCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD CONSTRAINT [DF_MEsDespatchtoGodownHeader_dghCancelled] DEFAULT ((0)) FOR [dghCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME= 'dghfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD CONSTRAINT [DF_MEsDespatchtoGodownHeader_dghfuturevc] DEFAULT ('') FOR [dghfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME= 'dghNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD CONSTRAINT [DF_MEsDespatchtoGodownHeader_dghNoofDetails] DEFAULT ((0)) FOR [dghNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME= 'dghTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD CONSTRAINT [DF_MEsDespatchtoGodownHeader_dghTransFinished] DEFAULT ((0)) FOR [dghTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME= 'dghUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD CONSTRAINT [DF_MEsDespatchtoGodownHeader_dgUsed] DEFAULT ((0)) FOR [dghUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsDespatchtoGodownHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsDespatchtoGodownHeader] ADD CONSTRAINT [DF_MEsDespatchtoGodownHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesfuture' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesfuture] ADD CONSTRAINT [DF__mesfuture__rowgu__5E2AE217] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME= 'SRHcancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD CONSTRAINT [DF_mesRequesttoShopHeader_SRHcancelled] DEFAULT ((0)) FOR [SRHcancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME= 'SRHfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD CONSTRAINT [DF_mesRequesttoShopHeader_SRHfuturevc] DEFAULT ('') FOR [SRHfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME= 'SRHNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD CONSTRAINT [DF_mesRequesttoShopHeader_SRHNoofDetails] DEFAULT ((0)) FOR [SRHNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME= 'SRHTransfinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD CONSTRAINT [DF_mesRequesttoShopHeader_SRHTransfinished] DEFAULT ((0)) FOR [SRHTransfinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME= 'SRHUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD CONSTRAINT [DF_mesRequesttoShopHeader_SRHUsed] DEFAULT ((0)) FOR [SRHUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRequesttoShopHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesRequesttoShopHeader] ADD CONSTRAINT [DF_mesRequesttoShopHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesRQtoHQforItem' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesRQtoHQforItem] ADD CONSTRAINT [DF__mesRQtoHQ__rowgu__50A7951E] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD CONSTRAINT [DF__mesTransf__rowgu__5145E845] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME= 'tohposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD CONSTRAINT [DF__mestransf__tohpo__3AD91AE7] DEFAULT ((0)) FOR [tohposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME= 'TOHCancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD CONSTRAINT [DF_mesTransferOutHeader_TOHCancelled] DEFAULT ((0)) FOR [TOHCancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME= 'TOHfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD CONSTRAINT [DF_mesTransferOutHeader_TOHfuturevc] DEFAULT ('') FOR [TOHfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME= 'TOHNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD CONSTRAINT [DF_mesTransferOutHeader_TOHNoofDetails] DEFAULT ((0)) FOR [TOHNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME= 'TOHTransfinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD CONSTRAINT [DF_mesTransferOutHeader_TOHTransfinished] DEFAULT ((0)) FOR [TOHTransfinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME= 'TOhUsed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD CONSTRAINT [DF_mesTransferOutHeader_TOhUsed] DEFAULT ((0)) FOR [TOhUsed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mesTransferOutHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mesTransferOutHeader] ADD CONSTRAINT [DF_mesTransferOutHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsTransLog] ADD CONSTRAINT [DF__MEsTransL__rowgu__5F54107A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MEsTransLog' AND COLUMN_NAME= 'systemlog' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MEsTransLog] ADD CONSTRAINT [DF_METransLog_systemlog] DEFAULT ((0)) FOR [systemlog]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'AllowZeroLcMargin' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF__MiscSetti__Allow__2374FBF4] DEFAULT ((0)) FOR [AllowZeroLcMargin]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'allowlocalpurchhq' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF__miscsetti__allow__27FB509D] DEFAULT ((0)) FOR [allowlocalpurchhq]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'fixsellingpriceaftercosting' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF__miscsetti__fixse__047D0A36] DEFAULT ((1)) FOR [fixsellingpriceaftercosting]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'openingbalancenottallying' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF__miscsetti__openi__01368937] DEFAULT ((0)) FOR [openingbalancenottallying]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'AllowItemCodeDuplication' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF_MiscSettings_AllowItemCodeDuplication] DEFAULT ((0)) FOR [AllowItemCodeDuplication]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'CustomerCodeAutoGen' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF_MiscSettings_CustomerCodeAutoGen] DEFAULT ((0)) FOR [CustomerCodeAutoGen]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'customertoshoponcreation' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF_MiscSettings_customertoshoponcreation] DEFAULT ((0)) FOR [customertoshoponcreation]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'ItemCodeAutoGen' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF_MiscSettings_ItemCodeAutoGen] DEFAULT ((0)) FOR [ItemCodeAutoGen]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'showlocationswitch' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF_MiscSettings_showlocationswitch] DEFAULT ((1)) FOR [showlocationswitch]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MiscSettings' AND COLUMN_NAME= 'SupplierCodeAutoGen' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MiscSettings] ADD CONSTRAINT [DF_MiscSettings_SupplierCodeAutoGen] DEFAULT ((0)) FOR [SupplierCodeAutoGen]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moafuture' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [moafuture] ADD CONSTRAINT [DF__moafuture__rowgu__587208C1] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME= 'ActualAmount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD CONSTRAINT [DF_MOaJournalDetails_ActualAmount] DEFAULT ((0)) FOR [ActualAmount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME= 'Amount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD CONSTRAINT [DF_MOaJournalDetails_Amount] DEFAULT ((0)) FOR [Amount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalDetails' AND COLUMN_NAME= 'depamount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MOaJournalDetails] ADD CONSTRAINT [DF_MOaJournalDetails_depamount] DEFAULT ((0)) FOR [depamount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME= 'Cancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD CONSTRAINT [DF_MOaJournalHeader_Cancel] DEFAULT ((0)) FOR [Cancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOaJournalHeader' AND COLUMN_NAME= 'Realised' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MOaJournalHeader] ADD CONSTRAINT [DF_MOaJournalHeader_Realised] DEFAULT ((0)) FOR [Realised]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moapoitems' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [moapoitems] ADD CONSTRAINT [DF__moapoitem__rowgu__1F4543B4] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStock' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MOiGodownStock] ADD CONSTRAINT [DF__MOiGodown__rowgu__23893F36] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOiGodownStockBackup' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MOiGodownStockBackup] ADD CONSTRAINT [DF__MOiGodown__rowgu__0FA2421A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestDetail' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosGoodsRequestDetail] ADD CONSTRAINT [DF__mosGoodsR__rowgu__064DE20A] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD CONSTRAINT [DF__mosGoodsR__rowgu__4C764630] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME= 'GRHcancel' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD CONSTRAINT [DF_mosGoodsRequestHeader_GRHcancel] DEFAULT ((0)) FOR [GRHcancel]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME= 'grhfuturevc' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD CONSTRAINT [DF_mosGoodsRequestHeader_grhfuturevc] DEFAULT ('') FOR [grhfuturevc]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME= 'GRHIssuenotegenerated' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD CONSTRAINT [DF_mosGoodsRequestHeader_GRHIssuenotegenerated] DEFAULT ((0)) FOR [GRHIssuenotegenerated]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME= 'grhNoofDetails' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD CONSTRAINT [DF_mosGoodsRequestHeader_grhNoofDetails] DEFAULT ((0)) FOR [grhNoofDetails]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME= 'grhSpecialRequest' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD CONSTRAINT [DF_mosGoodsRequestHeader_grhSpecialRequest] DEFAULT ((0)) FOR [grhSpecialRequest]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME= 'grhTransFinished' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD CONSTRAINT [DF_mosGoodsRequestHeader_grhTransFinished] DEFAULT ((0)) FOR [grhTransFinished]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosGoodsRequestHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosGoodsRequestHeader] ADD CONSTRAINT [DF_mosGoodsRequestHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosshopservicestock] ADD CONSTRAINT [DF__mosshopse__rowgu__052FA09F] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='mosshopservicestock' AND COLUMN_NAME= 'serstkfuturebit' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [mosshopservicestock] ADD CONSTRAINT [DF_mosshopservicestock_serstkfuturebit] DEFAULT ((0)) FOR [serstkfuturebit]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStock' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MOsShopStock] ADD CONSTRAINT [DF__MOsShopSt__rowgu__75C27486] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='MOsShopStockBackup' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [MOsShopStockBackup] ADD CONSTRAINT [DF__MOsShopSt__rowgu__155B1B70] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME= 'swposted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD CONSTRAINT [DF_moStockWriteOffHQ_swposted] DEFAULT ((0)) FOR [swposted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='moStockWriteOffHQ' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [moStockWriteOffHQ] ADD CONSTRAINT [DF_moStockWriteOffHQ_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME= 'Cancelled' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD CONSTRAINT [DF__paPayAccL__Cance__04866080] DEFAULT ((0)) FOR [Cancelled]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME= 'Posted' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD CONSTRAINT [DF__paPayAccL__Poste__057A84B9] DEFAULT ((0)) FOR [Posted]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='paPayAccLinkHeader' AND COLUMN_NAME= 'UpdateTime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [paPayAccLinkHeader] ADD CONSTRAINT [DF__paPayAccL__Updat__066EA8F2] DEFAULT (getdate()) FOR [UpdateTime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherCreditDetails' AND COLUMN_NAME= 'Amount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ReceiptVoucherCreditDetails] ADD CONSTRAINT [DF_ReceiptVoucherCreditDetails_Amount] DEFAULT ((0)) FOR [Amount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME= 'AmountReceived' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD CONSTRAINT [DF_ReceiptVoucherDetails_AmountReceived] DEFAULT ((0)) FOR [AmountReceived]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherDetails' AND COLUMN_NAME= 'dueperiod' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ReceiptVoucherDetails] ADD CONSTRAINT [DF_ReceiptVoucherDetails_dueperiod] DEFAULT ((0)) FOR [dueperiod]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME= 'Confirmed' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD CONSTRAINT [DF__ReceiptVo__Confi__1DE63FD0] DEFAULT ((0)) FOR [Confirmed]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME= 'receiptcustomerid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD CONSTRAINT [DF__receiptvo__recei__47284C85] DEFAULT (NULL) FOR [receiptcustomerid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME= 'Amount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD CONSTRAINT [DF_ReceiptVoucherHeader_Amount] DEFAULT ((0)) FOR [Amount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME= 'exchangerate' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD CONSTRAINT [DF_ReceiptVoucherHeader_exchangerate] DEFAULT ((1)) FOR [exchangerate]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReceiptVoucherHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ReceiptVoucherHeader] ADD CONSTRAINT [DF_ReceiptVoucherHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ReportNames' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ReportNames] ADD CONSTRAINT [DF__ReportNam__rowgu__2685A772] DEFAULT (newid()) FOR [rowguid]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME= 'Amount' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD CONSTRAINT [DF_ServiceInvoiceDetails_Amount] DEFAULT ((0)) FOR [Amount]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='ServiceInvoiceDetails' AND COLUMN_NAME= 'ServiceQty' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [ServiceInvoiceDetails] ADD CONSTRAINT [DF_ServiceInvoiceDetails_ServiceQty] DEFAULT ((0)) FOR [ServiceQty]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TempDishCost' AND COLUMN_NAME= 'DishCostAmt' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [TempDishCost] ADD CONSTRAINT [DF_TempDishCost_DishCostAmt] DEFAULT ((0)) FOR [DishCostAmt]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VendorSettlementHeader' AND COLUMN_NAME= 'updatetime' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [VendorSettlementHeader] ADD CONSTRAINT [DF_VendorSettlementHeader_updatetime] DEFAULT (getdate()) FOR [updatetime]
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='VoucherMaster' AND COLUMN_NAME= 'rowguid' AND COLUMN_DEFAULT IS NOT NULL )
BEGIN
	ALTER TABLE [VoucherMaster] ADD CONSTRAINT [DF_VoucherMaster_rowguid] DEFAULT (newid()) FOR [rowguid]
END
GO
 CREATE PROCEDURE DropCK
 AS
 BEGIN
--Script for Drop All Check Constraints
 CREATE TABLE #sqlDeleteAllCK
(
 ConstraintID INT IDENTITY(1,1) NOT NULL, 
 SqlStatement VARCHAR(4000) 
)
INSERT INTO #sqlDeleteAllCK
SELECT 'ALTER TABLE ' + TABLE_SCHEMA + '.' + TABLE_NAME + 
' DROP CONSTRAINT ' + CONSTRAINT_NAME 
 FROM information_schema.table_constraints 
	WHERE CONSTRAINT_TYPE = 'CHECK'
 DECLARE @intID INT 
 DECLARE @intCount INT 
 SET @intID = 1 
 SELECT @intCount= COUNT(*) 
 FROM #sqlDeleteAllCK 
 DECLARE @SqlStatement NVARCHAR(4000) 
 WHILE @intID <= @intCount 
 BEGIN 
 SELECT @SqlStatement = SqlStatement 
 FROM #sqlDeleteAllCK 
 WHERE ConstraintID = @intID 
	execute sp_executesql @SqlStatement 
 SET @intID = @intID + 1 
 END 
 DROP TABLE #sqlDeleteAllCK
 END 
 GO 
 EXEC  DropCK
 GO 
 DROP PROCEDURE  DropCK
 GO 
--Script for Check Constraints
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS  WHERE  CONSTRAINT_NAME='CK_aUserAuditHeader_hMode')
BEGIN
 ALTER TABLE  [aUserAuditHeader]
 ADD CONSTRAINT [CK_aUserAuditHeader_hMode] CHECK ([hMode]='V' OR ([hMode]='C' OR ([hMode]='P' OR ([hMode]='D' OR ([hMode]='E' OR [hMode]='N')))))
END
GO
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS  WHERE  CONSTRAINT_NAME='CK_loiUserAuditHeader')
BEGIN
 ALTER TABLE  [loiUserAuditHeader]
 ADD CONSTRAINT [CK_loiUserAuditHeader] CHECK ([ghMode]='C' OR ([ghMode]='P' OR ([ghMode]='D' OR ([ghMode]='E' OR [ghMode]='N'))))
END
GO
--Script for Indexes
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_805577908')
BEGIN
CREATE NONCLUSTERED INDEX [index_805577908]ON[aAccountMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_133575514')
BEGIN
CREATE NONCLUSTERED INDEX [index_133575514]ON[abarcodetype]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_261575970')
BEGIN
CREATE NONCLUSTERED INDEX [index_261575970]ON[aBrandMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='CITYUNIQUE')
BEGIN
CREATE NONCLUSTERED INDEX [CITYUNIQUE]ON[aCity]
(
[CountryID] ASC ,
[CityCode] ASC ,
[CityName] ASC ,
[AreaCode] ASC ,
[CompanyID] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1029578706')
BEGIN
CREATE NONCLUSTERED INDEX [index_1029578706]ON[aCity]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_149575571')
BEGIN
CREATE NONCLUSTERED INDEX [index_149575571]ON[aColor]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1237579447')
BEGIN
CREATE NONCLUSTERED INDEX [index_1237579447]ON[aCompanyMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_165575628')
BEGIN
CREATE NONCLUSTERED INDEX [index_165575628]ON[aCountryMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1045578763')
BEGIN
CREATE NONCLUSTERED INDEX [index_1045578763]ON[aCurrencyMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1349579846')
BEGIN
CREATE NONCLUSTERED INDEX [index_1349579846]ON[aCustomerMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_181575685')
BEGIN
CREATE NONCLUSTERED INDEX [index_181575685]ON[aCustomerMasterBackUp]
(
[rowguid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='customersalespersonunique')
BEGIN
CREATE NONCLUSTERED INDEX [customersalespersonunique]ON[ACustomerSalesPerson]
(
[salespersonid] ASC ,
[customerid] ASC ,
[shopid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_197575742')
BEGIN
CREATE NONCLUSTERED INDEX [index_197575742]ON[aCustomsMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_388912457')
BEGIN
CREATE NONCLUSTERED INDEX [index_388912457]ON[aDepartmentMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='uniquerec')
BEGIN
CREATE NONCLUSTERED INDEX [uniquerec]ON[adepcontrolaccounts]
(
[maindepid] ASC ,
[otherdepid] ASC ,
[controlaccid] ASC ,
[companyid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_325576198')
BEGIN
CREATE NONCLUSTERED INDEX [index_325576198]ON[adistributormaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_213575799')
BEGIN
CREATE NONCLUSTERED INDEX [index_213575799]ON[aFinancialYear]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_213575799')
BEGIN
CREATE NONCLUSTERED INDEX [index_213575799]ON[aGlobalUsers]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_581017251')
BEGIN
CREATE NONCLUSTERED INDEX [index_581017251]ON[aGodown]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1461580245')
BEGIN
CREATE NONCLUSTERED INDEX [index_1461580245]ON[aGodownDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_229575856')
BEGIN
CREATE NONCLUSTERED INDEX [index_229575856]ON[aGodownItemCategory]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1397580017')
BEGIN
CREATE NONCLUSTERED INDEX [index_1397580017]ON[aGroupMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1144495256')
BEGIN
CREATE NONCLUSTERED INDEX [index_1144495256]ON[aHQDespatchNoteDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_245575913')
BEGIN
CREATE NONCLUSTERED INDEX [index_245575913]ON[aHQDespatchnoteHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1733581214')
BEGIN
CREATE NONCLUSTERED INDEX [index_1733581214]ON[aHQDespatchNoteMain]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_229575856')
BEGIN
CREATE NONCLUSTERED INDEX [index_229575856]ON[aHQIssuenoteDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1061578820')
BEGIN
CREATE NONCLUSTERED INDEX [index_1061578820]ON[aHQIssueNoteMain]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_ahqpaymentvoucherdetails_pdBillsID')
BEGIN
CREATE NONCLUSTERED INDEX [ind_ahqpaymentvoucherdetails_pdBillsID]ON[aHQPaymentVoucherDetails]
(
[pdBillsID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_ahqpaymentvoucherdetails_pddcnid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_ahqpaymentvoucherdetails_pddcnid]ON[aHQPaymentVoucherDetails]
(
[pddcnid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_ahqpaymentvoucherdetails_pdposlpbillid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_ahqpaymentvoucherdetails_pdposlpbillid]ON[aHQPaymentVoucherDetails]
(
[pdposlpbillid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_ahqpaymentvoucherdetails_pdshopid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_ahqpaymentvoucherdetails_pdshopid]ON[aHQPaymentVoucherDetails]
(
[pdshopid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_ahqpaymentvoucherdetails_shopdcnid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_ahqpaymentvoucherdetails_shopdcnid]ON[aHQPaymentVoucherDetails]
(
[shopdcnid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1413580074')
BEGIN
CREATE NONCLUSTERED INDEX [index_1413580074]ON[aInterface]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_933578364')
BEGIN
CREATE NONCLUSTERED INDEX [index_933578364]ON[aItem]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='itemcodeduplicatecheck')
BEGIN
CREATE NONCLUSTERED INDEX [itemcodeduplicatecheck]ON[aItem]
(
[ItemCode] ASC ,
[ItemDescription] ASC ,
[barcode] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_245575913')
BEGIN
CREATE NONCLUSTERED INDEX [index_245575913]ON[aItemCategory]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idxBarCode')
BEGIN
CREATE NONCLUSTERED INDEX [idxBarCode]ON[aItemPackingDetail]
(
[PackingBarCode] ASC ,
[ItemID] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idxItemId')
BEGIN
CREATE NONCLUSTERED INDEX [idxItemId]ON[aItemPackingDetail]
(
[ItemID] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1253579504')
BEGIN
CREATE NONCLUSTERED INDEX [index_1253579504]ON[aItemPackingDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idxAps')
BEGIN
CREATE NONCLUSTERED INDEX [idxAps]ON[aPAckageSettings]
(
[companyid] ASC ,
[InventoryID] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1877581727')
BEGIN
CREATE NONCLUSTERED INDEX [index_1877581727]ON[aPAckageSettings]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_277576027')
BEGIN
CREATE NONCLUSTERED INDEX [index_277576027]ON[aPackingType]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idxPack')
BEGIN
CREATE NONCLUSTERED INDEX [idxPack]ON[aPackingTypeCapacityDetail]
(
[PackingTypeID] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1093578934')
BEGIN
CREATE NONCLUSTERED INDEX [index_1093578934]ON[aPackingTypeCapacityDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_997578592')
BEGIN
CREATE NONCLUSTERED INDEX [index_997578592]ON[aproductconditionmaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_453576654')
BEGIN
CREATE NONCLUSTERED INDEX [index_453576654]ON[AsalesPersonmaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_469576711')
BEGIN
CREATE NONCLUSTERED INDEX [index_469576711]ON[aServiceCategory]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_485576768')
BEGIN
CREATE NONCLUSTERED INDEX [index_485576768]ON[aservicelocations]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1013578649')
BEGIN
CREATE NONCLUSTERED INDEX [index_1013578649]ON[aservicemaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_517576882')
BEGIN
CREATE NONCLUSTERED INDEX [index_517576882]ON[aSettings]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_309576141')
BEGIN
CREATE NONCLUSTERED INDEX [index_309576141]ON[aShipment]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1429580131')
BEGIN
CREATE NONCLUSTERED INDEX [index_1429580131]ON[ashopcashaccountdetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_325576198')
BEGIN
CREATE NONCLUSTERED INDEX [index_325576198]ON[aShopCustomerDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_405576483')
BEGIN
CREATE NONCLUSTERED INDEX [index_405576483]ON[aShopitemCategory]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1797581442')
BEGIN
CREATE NONCLUSTERED INDEX [index_1797581442]ON[aShopItemDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_901578250')
BEGIN
CREATE NONCLUSTERED INDEX [index_901578250]ON[ashopprintmessages]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1237579447')
BEGIN
CREATE NONCLUSTERED INDEX [index_1237579447]ON[aShops]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1413580074')
BEGIN
CREATE NONCLUSTERED INDEX [index_1413580074]ON[Ashopsalespersondetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1429580131')
BEGIN
CREATE NONCLUSTERED INDEX [index_1429580131]ON[ashopsercategory]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1813581499')
BEGIN
CREATE NONCLUSTERED INDEX [index_1813581499]ON[aShopVendorDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_341576255')
BEGIN
CREATE NONCLUSTERED INDEX [index_341576255]ON[aSize]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1269579561')
BEGIN
CREATE NONCLUSTERED INDEX [index_1269579561]ON[aSubItemDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1109578991')
BEGIN
CREATE NONCLUSTERED INDEX [index_1109578991]ON[aTableColumns]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_357576312')
BEGIN
CREATE NONCLUSTERED INDEX [index_357576312]ON[aTables]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_373576369')
BEGIN
CREATE NONCLUSTERED INDEX [index_373576369]ON[aUnit]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_2117582582')
BEGIN
CREATE NONCLUSTERED INDEX [index_2117582582]ON[aUserRights]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1829581556')
BEGIN
CREATE NONCLUSTERED INDEX [index_1829581556]ON[aUsers]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1429580131')
BEGIN
CREATE NONCLUSTERED INDEX [index_1429580131]ON[aVendorMaster]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_389576426')
BEGIN
CREATE NONCLUSTERED INDEX [index_389576426]ON[aVendorMasterBackUp]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_Bills_vendorid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_Bills_vendorid]ON[Bills]
(
[VendorID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_933578364')
BEGIN
CREATE NONCLUSTERED INDEX [index_933578364]ON[CashBox]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_debitcreditnote_dcnDepartmentId')
BEGIN
CREATE NONCLUSTERED INDEX [ind_debitcreditnote_dcnDepartmentId]ON[DebitCreditNote]
(
[dcndepartmentid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_debitcreditnote_dcnvendorid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_debitcreditnote_dcnvendorid]ON[DebitCreditNote]
(
[DCNVendorId] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_437576597')
BEGIN
CREATE NONCLUSTERED INDEX [index_437576597]ON[DepreciationHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_453576654')
BEGIN
CREATE NONCLUSTERED INDEX [index_453576654]ON[ExchangeRate]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idxErd')
BEGIN
CREATE NONCLUSTERED INDEX [idxErd]ON[ExchangeRateDetail]
(
[CurrencyID] ASC ,
[CompanyID] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_469576711')
BEGIN
CREATE NONCLUSTERED INDEX [index_469576711]ON[ExchangeRateDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_485576768')
BEGIN
CREATE NONCLUSTERED INDEX [index_485576768]ON[FixedAsset]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1589580701')
BEGIN
CREATE NONCLUSTERED INDEX [index_1589580701]ON[LOiArrivalDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1605580758')
BEGIN
CREATE NONCLUSTERED INDEX [index_1605580758]ON[LOiArrivalShipmentDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1621580815')
BEGIN
CREATE NONCLUSTERED INDEX [index_1621580815]ON[LOiArrivaltoLocation]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1637580872')
BEGIN
CREATE NONCLUSTERED INDEX [index_1637580872]ON[LOiDamageClearingDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1493580359')
BEGIN
CREATE NONCLUSTERED INDEX [index_1493580359]ON[LOiDamageClearingHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1653580929')
BEGIN
CREATE NONCLUSTERED INDEX [index_1653580929]ON[LOiGodownShopArrivalToLocation]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_2117582582')
BEGIN
CREATE NONCLUSTERED INDEX [index_2117582582]ON[LoiItemSplitDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1429580131')
BEGIN
CREATE NONCLUSTERED INDEX [index_1429580131]ON[LoiItemSplitHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1509580416')
BEGIN
CREATE NONCLUSTERED INDEX [index_1509580416]ON[LOiLocation]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_565577053')
BEGIN
CREATE NONCLUSTERED INDEX [index_565577053]ON[LOiSettings]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1125579048')
BEGIN
CREATE NONCLUSTERED INDEX [index_1125579048]ON[loiStockVerificationDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1285579618')
BEGIN
CREATE NONCLUSTERED INDEX [index_1285579618]ON[LOiWriteOffDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1541580530')
BEGIN
CREATE NONCLUSTERED INDEX [index_1541580530]ON[LOsAccountsInvoiceHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_2099048')
BEGIN
CREATE NONCLUSTERED INDEX [index_2099048]ON[losbookpartsreplacedetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 100
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_321540329')
BEGIN
CREATE NONCLUSTERED INDEX [index_321540329]ON[losbookservicedetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 100
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_337540386')
BEGIN
CREATE NONCLUSTERED INDEX [index_337540386]ON[losbookservtechniciandetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_34099162')
BEGIN
CREATE NONCLUSTERED INDEX [index_34099162]ON[loscomplaints]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_losdebitcreditnote_losdcndepartmentid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_losdebitcreditnote_losdcndepartmentid]ON[losDebitCreditNote]
(
[losdcndepartmentid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_losdebitcreditnote_losdcnVendorID')
BEGIN
CREATE NONCLUSTERED INDEX [ind_losdebitcreditnote_losdcnVendorID]ON[losDebitCreditNote]
(
[losDCNVendorId] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_850102069')
BEGIN
CREATE NONCLUSTERED INDEX [index_850102069]ON[losDebitCreditNote]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_546100986')
BEGIN
CREATE NONCLUSTERED INDEX [index_546100986]ON[LosDummyReceiptDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1557580587')
BEGIN
CREATE NONCLUSTERED INDEX [index_1557580587]ON[losDummyReceiptHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losexportdetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_losexportdetail]ON[losExportDetail]
(
[redExportID] ASC ,
[redShopID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losexportheader_rehExportDate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losexportheader_rehExportDate]ON[losExportHeader]
(
[rehExportDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losexportheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losexportheader]ON[losExportHeader]
(
[rehExportID] ASC ,
[rehShopID] ASC ,
[rehCancelled] ASC ,
[rehProforma] ASC ,
[rehtype] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_389576426')
BEGIN
CREATE NONCLUSTERED INDEX [index_389576426]ON[losfuture]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_66099276')
BEGIN
CREATE NONCLUSTERED INDEX [index_66099276]ON[losfuturetabdetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1493580359')
BEGIN
CREATE NONCLUSTERED INDEX [index_1493580359]ON[losfuturetabheader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losgoodsarrivaltoshopdetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_losgoodsarrivaltoshopdetail]ON[LOsGoodsArrivaltoShopDetail]
(
[gadArrivalID] ASC ,
[gadShopid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losgoodsarrivaltoshopheader_gaharrivaldate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losgoodsarrivaltoshopheader_gaharrivaldate]ON[LOsGoodsArrivaltoShopHeader]
(
[gahArrivalDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1378103950')
BEGIN
CREATE NONCLUSTERED INDEX [index_1378103950]ON[LOsGoodsArrivaltoShopHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losgoodsarrivaltoshopheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losgoodsarrivaltoshopheader]ON[LOsGoodsArrivaltoShopHeader]
(
[gahArrivalID] ASC ,
[gahShopid] ASC ,
[gahCancelled] ASC ,
[gahTransFinished] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_LosGoodsReturnNoteDetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_LosGoodsReturnNoteDetail]ON[LosGoodsReturnNoteDetail]
(
[GRNDReturnNoteID] ASC ,
[GRNDShopid] ASC ,
[GRNDDamaged] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_LosGoodsReturnNoteHeader_GrnhGoodsreturnnoteDate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_LosGoodsReturnNoteHeader_GrnhGoodsreturnnoteDate]ON[LosGoodsReturnNoteHeader]
(
[GrnhGoodsreturnnoteDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_866102126')
BEGIN
CREATE NONCLUSTERED INDEX [index_866102126]ON[LosGoodsReturnNoteHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_LosGoodsReturnNoteHeader')
BEGIN
CREATE NONCLUSTERED INDEX [index_LosGoodsReturnNoteHeader]ON[LosGoodsReturnNoteHeader]
(
[GrnhGoodsreturnnoteID] ASC ,
[grnhShopid] ASC ,
[GrnhCancel] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_loshpInvoiceDetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_loshpInvoiceDetail]ON[losHpInvoiceDetail]
(
[hpqdQuotationID] ASC ,
[hpqdShopId] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losHpInvoiceHeader_hpqhQuotationDate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losHpInvoiceHeader_hpqhQuotationDate]ON[losHpInvoiceHeader]
(
[hpqhQuotationDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losHpInvoiceHeader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losHpInvoiceHeader]ON[losHpInvoiceHeader]
(
[hpqhQuotationID] ASC ,
[hpqhShopID] ASC ,
[hpqhCancel] ASC ,
[hpqhType] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_882102183')
BEGIN
CREATE NONCLUSTERED INDEX [index_882102183]ON[LOsInvoiceDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losinvoicedetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_losinvoicedetail]ON[LOsInvoiceDetail]
(
[idInvoiceID] ASC ,
[idShopID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losinvoicedpartsreplacedetails')
BEGIN
CREATE NONCLUSTERED INDEX [index_losinvoicedpartsreplacedetails]ON[losInvoicedPartsReplacedetails]
(
[repinvinvoiceid] ASC ,
[repinvdshopid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losinvoiceheader_ihInvoicedate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losinvoiceheader_ihInvoicedate]ON[LOsInvoiceHeader]
(
[ihInvoiceDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_114099447')
BEGIN
CREATE NONCLUSTERED INDEX [index_114099447]ON[LOsInvoiceHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losinvoiceheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losinvoiceheader]ON[LOsInvoiceHeader]
(
[ihInvoiceID] ASC ,
[ihShopID] ASC ,
[ihCancelled] ASC ,
[ihProforma] ASC ,
[ihType] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1909581841')
BEGIN
CREATE NONCLUSTERED INDEX [index_1909581841]ON[LOsInvoiceOC]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_2145546827')
BEGIN
CREATE NONCLUSTERED INDEX [index_2145546827]ON[LOsInvoiceSubItemDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_98099390')
BEGIN
CREATE NONCLUSTERED INDEX [index_98099390]ON[losinvpartsreplacedetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 100
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_114099447')
BEGIN
CREATE NONCLUSTERED INDEX [index_114099447]ON[losinvservicedetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1925581898')
BEGIN
CREATE NONCLUSTERED INDEX [index_1925581898]ON[LosLocalPurchaseDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_loslocalpurchasedetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_loslocalpurchasedetail]ON[LosLocalPurchaseDetail]
(
[lpdBillID] ASC ,
[lpdShopID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_loslocalpurchaseheader_lphbilldate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_loslocalpurchaseheader_lphbilldate]ON[LosLocalPurchaseHeader]
(
[lphBillDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_loslocalpurchaseheader_lphdepartmentid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_loslocalpurchaseheader_lphdepartmentid]ON[LosLocalPurchaseHeader]
(
[lphDepartmentID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_loslocalpurchaseheader_lphVendorID')
BEGIN
CREATE NONCLUSTERED INDEX [ind_loslocalpurchaseheader_lphVendorID]ON[LosLocalPurchaseHeader]
(
[lphVendorID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1589580701')
BEGIN
CREATE NONCLUSTERED INDEX [index_1589580701]ON[LosLocalPurchaseHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_loslocalpurchaseheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_loslocalpurchaseheader]ON[LosLocalPurchaseHeader]
(
[lphBillID] ASC ,
[lphShopID] ASC ,
[lphCancelled] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1941581955')
BEGIN
CREATE NONCLUSTERED INDEX [index_1941581955]ON[LOsLocalPurchaseOC]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losMergeDetails')
BEGIN
CREATE NONCLUSTERED INDEX [index_losMergeDetails]ON[LosMergeDetails]
(
[lsdID] ASC ,
[lsdShopID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losMergeHeader_lshDate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losMergeHeader_lshDate]ON[LosMergeHeader]
(
[lshDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losMergeHeader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losMergeHeader]ON[LosMergeHeader]
(
[lshID] ASC ,
[lshShopID] ASC ,
[lshCancelled] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_741577680')
BEGIN
CREATE NONCLUSTERED INDEX [index_741577680]ON[losNonRestrictedItems]
(
[rowguid] ASC 
) WITH FILLFACTOR = 100
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_50099219')
BEGIN
CREATE NONCLUSTERED INDEX [index_50099219]ON[LOsPaymentVoucherDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1605580758')
BEGIN
CREATE NONCLUSTERED INDEX [index_1605580758]ON[LOsPaymentVoucherHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_962102468')
BEGIN
CREATE NONCLUSTERED INDEX [index_962102468]ON[LOsPosDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losposdetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_losposdetail]ON[LOsPosDetail]
(
[posdBillID] ASC ,
[posdShopID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1410104064')
BEGIN
CREATE NONCLUSTERED INDEX [index_1410104064]ON[losposExchangeDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losposexchangedetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_losposexchangedetail]ON[losposExchangeDetail]
(
[sedExchangeID] ASC ,
[sedShopID] ASC ,
[sedBillorExchange] ASC ,
[sedExchangeQty] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losposexchangeheader_sehExchangeDate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losposexchangeheader_sehExchangeDate]ON[losposExchangeHeader]
(
[sehExchangeDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_978102525')
BEGIN
CREATE NONCLUSTERED INDEX [index_978102525]ON[losposExchangeHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losposexchangeheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losposexchangeheader]ON[losposExchangeHeader]
(
[sehExchangeID] ASC ,
[sehShopID] ASC ,
[sehCancelled] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_610101214')
BEGIN
CREATE NONCLUSTERED INDEX [index_610101214]ON[losposExchangeOtherCharges]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_626101271')
BEGIN
CREATE NONCLUSTERED INDEX [index_626101271]ON[losposExchangeSubItemDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='IX_LosPosFAndBHeader_poshcompanyid')
BEGIN
CREATE NONCLUSTERED INDEX [IX_LosPosFAndBHeader_poshcompanyid]ON[LosPosFAndBHeader]
(
[poshCompanyID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='IX_LosPosFAndBHeader_poshgBillNo')
BEGIN
CREATE NONCLUSTERED INDEX [IX_LosPosFAndBHeader_poshgBillNo]ON[LosPosFAndBHeader]
(
[poshgbillno] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='IX_LosPosFAndBHeader_poshgBillUser')
BEGIN
CREATE NONCLUSTERED INDEX [IX_LosPosFAndBHeader_poshgBillUser]ON[LosPosFAndBHeader]
(
[poshgBillUser] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='IX_LosPosFAndBHeader_poshRecAddUser')
BEGIN
CREATE NONCLUSTERED INDEX [IX_LosPosFAndBHeader_poshRecAddUser]ON[LosPosFAndBHeader]
(
[poshRecAddUser] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='IX_LosPosFAndBHeader_poshRecModifyUser')
BEGIN
CREATE NONCLUSTERED INDEX [IX_LosPosFAndBHeader_poshRecModifyUser]ON[LosPosFAndBHeader]
(
[poshRecModifyUser] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losposheader_poshBilldate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losposheader_poshBilldate]ON[LOsPosHeader]
(
[poshBillDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losposheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losposheader]ON[LOsPosHeader]
(
[poshBillID] ASC ,
[poshShopID] ASC ,
[poshCancelled] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1701581100')
BEGIN
CREATE NONCLUSTERED INDEX [index_1701581100]ON[LOsPosOthercharges]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1413580074')
BEGIN
CREATE NONCLUSTERED INDEX [index_1413580074]ON[LOsPosSubItemDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_677577452')
BEGIN
CREATE NONCLUSTERED INDEX [index_677577452]ON[losPurchaseOrderDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_693577509')
BEGIN
CREATE NONCLUSTERED INDEX [index_693577509]ON[losPurchaseOrderHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losPurchaseReturndetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_losPurchaseReturndetail]ON[LOsPurchaseReturnDetail]
(
[WdID] ASC ,
[wdShopID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losPurchaseReturnheader_whdate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losPurchaseReturnheader_whdate]ON[LOsPurchaseReturnHeader]
(
[WhDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losPurchaseReturnheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losPurchaseReturnheader]ON[LOsPurchaseReturnHeader]
(
[WhID] ASC ,
[whShopID] ASC ,
[WhCancelled] ASC ,
[whtransfinished] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_66099276')
BEGIN
CREATE NONCLUSTERED INDEX [index_66099276]ON[LOsReceiptVoucherDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1653580929')
BEGIN
CREATE NONCLUSTERED INDEX [index_1653580929]ON[LOsReceiptVoucherHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1010102639')
BEGIN
CREATE NONCLUSTERED INDEX [index_1010102639]ON[losreplacereceivedetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 100
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_226099846')
BEGIN
CREATE NONCLUSTERED INDEX [index_226099846]ON[losreplacereceiveheader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_242099903')
BEGIN
CREATE NONCLUSTERED INDEX [index_242099903]ON[losreplacerequestdetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1525580473')
BEGIN
CREATE NONCLUSTERED INDEX [index_1525580473]ON[losreplacerequestheader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_805577908')
BEGIN
CREATE NONCLUSTERED INDEX [index_805577908]ON[LosReserveItem]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_274100017')
BEGIN
CREATE NONCLUSTERED INDEX [index_274100017]ON[losserconditiondetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_290100074')
BEGIN
CREATE NONCLUSTERED INDEX [index_290100074]ON[losserpartsfromcustomer]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1573580644')
BEGIN
CREATE NONCLUSTERED INDEX [index_1573580644]ON[losServiceHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losserviceinvheader_serinvhdate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losserviceinvheader_serinvhdate]ON[LosServiceInvHeader]
(
[serinvhdate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losserviceinvheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losserviceinvheader]ON[LosServiceInvHeader]
(
[serinvhid] ASC ,
[serinvhshopid] ASC ,
[serinvhcancelled] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_709577566')
BEGIN
CREATE NONCLUSTERED INDEX [index_709577566]ON[LOsServiceInvoiceDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_497540956')
BEGIN
CREATE NONCLUSTERED INDEX [index_497540956]ON[losservinvoicetechniciandetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_725577623')
BEGIN
CREATE NONCLUSTERED INDEX [index_725577623]ON[LOsSettings]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_82099333')
BEGIN
CREATE NONCLUSTERED INDEX [index_82099333]ON[LOsShopDamageClearingDetails]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_2021582240')
BEGIN
CREATE NONCLUSTERED INDEX [index_2021582240]ON[LOsShopDamageClearingHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_853578079')
BEGIN
CREATE NONCLUSTERED INDEX [index_853578079]ON[losShopItemShipmentDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='uniq_sellprice')
BEGIN
CREATE NONCLUSTERED INDEX [uniq_sellprice]ON[losShopItemShipmentDetail]
(
[itemid] ASC ,
[shopid] ASC ,
[PackingTypeid] ASC ,
[currencyid] ASC ,
[segmentid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1090102924')
BEGIN
CREATE NONCLUSTERED INDEX [index_1090102924]ON[losSpecialInvoiceDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losspecialinvoicedetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_losspecialinvoicedetail]ON[losSpecialInvoiceDetail]
(
[idInvoiceId] ASC ,
[idShopid] ASC ,
[idRateType] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losspecialinvoiceheader_ihInvoicedate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losspecialinvoiceheader_ihInvoicedate]ON[losSpecialInvoiceHeader]
(
[IhInvoiceDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_338100245')
BEGIN
CREATE NONCLUSTERED INDEX [index_338100245]ON[losSpecialInvoiceHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losspecialinvoiceheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losspecialinvoiceheader]ON[losSpecialInvoiceHeader]
(
[IhInvoiceID] ASC ,
[IhShopID] ASC ,
[IhCancelled] ASC ,
[IhProforma] ASC ,
[ihTransFinished] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1384496111')
BEGIN
CREATE NONCLUSTERED INDEX [index_1384496111]ON[losSpecialOC]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losstockrecovery_srdate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losstockrecovery_srdate]ON[losStockRecovery]
(
[srDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1637580872')
BEGIN
CREATE NONCLUSTERED INDEX [index_1637580872]ON[losStockRecovery]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1141579105')
BEGIN
CREATE NONCLUSTERED INDEX [index_1141579105]ON[losStockVerificationDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losstockverificationdetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_losstockverificationdetail]ON[losStockVerificationDetail]
(
[svdid] ASC ,
[svdShopid] ASC ,
[svdVerifiedStock] ASC ,
[svdAvailStock] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losstockverificationheader_svhDate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losstockverificationheader_svhDate]ON[losStockVerificationHeader]
(
[svhdate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1653580929')
BEGIN
CREATE NONCLUSTERED INDEX [index_1653580929]ON[losStockVerificationHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losstockverificationheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losstockverificationheader]ON[losStockVerificationHeader]
(
[svhid] ASC ,
[svhShopId] ASC ,
[svhcancelled] ASC ,
[svhfuturevc] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_lostransferindetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_lostransferindetail]ON[LOSTransferindetail]
(
[TIDID] ASC ,
[TIDshopid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_lostransferinheader_tihdate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_lostransferinheader_tihdate]ON[LOSTransferinheader]
(
[TIHDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1122103038')
BEGIN
CREATE NONCLUSTERED INDEX [index_1122103038]ON[LOSTransferinheader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_lostransferinheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_lostransferinheader]ON[LOSTransferinheader]
(
[TIHID] ASC ,
[TIHShopid] ASC ,
[TIHcancel] ASC ,
[TIHTransFinished] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losWarrentyClaimDetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_losWarrentyClaimDetail]ON[losWarrentyClaimDetail]
(
[wcdID] ASC ,
[wcdShopID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_losWarrentyClaimHeader_wchdate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_losWarrentyClaimHeader_wchdate]ON[losWarrentyClaimHeader]
(
[wchDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_losWarrentyClaimHeader')
BEGIN
CREATE NONCLUSTERED INDEX [index_losWarrentyClaimHeader]ON[losWarrentyClaimHeader]
(
[wchID] ASC ,
[wchShopID] ASC ,
[wchCancelled] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1173579219')
BEGIN
CREATE NONCLUSTERED INDEX [index_1173579219]ON[LOsWriteOffDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_loswriteoffdetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_loswriteoffdetail]ON[LOsWriteOffDetail]
(
[WdID] ASC ,
[wdShopID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_loswriteoffheader_whdate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_loswriteoffheader_whdate]ON[LOsWriteOffHeader]
(
[WhDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_loswriteoffheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_loswriteoffheader]ON[LOsWriteOffHeader]
(
[WhID] ASC ,
[whShopID] ASC ,
[WhCancelled] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='unique_userid_companyid_shopid_Godownid ')
BEGIN
CREATE NONCLUSTERED INDEX [unique_userid_companyid_shopid_Godownid ]ON[LOUsers]
(
[UserID] ASC ,
[CompanyID] ASC ,
[ShopID] ASC ,
[GodownID] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_773577794')
BEGIN
CREATE NONCLUSTERED INDEX [index_773577794]ON[MEiDespatchToShopDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1154103152')
BEGIN
CREATE NONCLUSTERED INDEX [index_1154103152]ON[MEiDespatchToShopHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1333579789')
BEGIN
CREATE NONCLUSTERED INDEX [index_1333579789]ON[MEiGodownTransferDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1781581385')
BEGIN
CREATE NONCLUSTERED INDEX [index_1781581385]ON[meiRQtoHQforItem]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_997578592')
BEGIN
CREATE NONCLUSTERED INDEX [index_997578592]ON[meiSpecialDespatchtoShopDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_434100587')
BEGIN
CREATE NONCLUSTERED INDEX [index_434100587]ON[meiSpecialDespatchtoshopHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_645577338')
BEGIN
CREATE NONCLUSTERED INDEX [index_645577338]ON[MEmessages]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_2053582354')
BEGIN
CREATE NONCLUSTERED INDEX [index_2053582354]ON[MEsDespatchtoGodownDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_mesdespatchtogodowndetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_mesdespatchtogodowndetail]ON[MEsDespatchtoGodownDetail]
(
[dgdID] ASC ,
[dgdShopID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_mesdespatchtogodownheader_dghDate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_mesdespatchtogodownheader_dghDate]ON[MEsDespatchtoGodownHeader]
(
[dghDate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_450100644')
BEGIN
CREATE NONCLUSTERED INDEX [index_450100644]ON[MEsDespatchtoGodownHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_mesdespatchtogodownheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_mesdespatchtogodownheader]ON[MEsDespatchtoGodownHeader]
(
[dghID] ASC ,
[dghShopID] ASC ,
[dghCancelled] ASC ,
[dghTransFinished] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_405576483')
BEGIN
CREATE NONCLUSTERED INDEX [index_405576483]ON[mesfuture]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1093578934')
BEGIN
CREATE NONCLUSTERED INDEX [index_1093578934]ON[mesRQtoHQforItem]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_mestransferoutdetail')
BEGIN
CREATE NONCLUSTERED INDEX [index_mestransferoutdetail]ON[mesTransferoutDetail]
(
[TODid] ASC ,
[TODshopid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idx_mestransferoutheader_tohDate')
BEGIN
CREATE NONCLUSTERED INDEX [idx_mestransferoutheader_tohDate]ON[mesTransferOutHeader]
(
[TOHdate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_482100758')
BEGIN
CREATE NONCLUSTERED INDEX [index_482100758]ON[mesTransferOutHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_mestransferoutheader')
BEGIN
CREATE NONCLUSTERED INDEX [index_mestransferoutheader]ON[mesTransferOutHeader]
(
[TOHid] ASC ,
[TOHShopid] ASC ,
[TOHCancelled] ASC ,
[TOHTransfinished] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1861581670')
BEGIN
CREATE NONCLUSTERED INDEX [index_1861581670]ON[MEsTransLog]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_421576540')
BEGIN
CREATE NONCLUSTERED INDEX [index_421576540]ON[moafuture]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='IDX_MOaJournalDet_DeptID_AccID')
BEGIN
CREATE NONCLUSTERED INDEX [IDX_MOaJournalDet_DeptID_AccID]ON[MOaJournalDetails]
(
[AccountID] ASC ,
[DepartmentID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='IDX_MOaJournalHDR_JournalDate_BankDate')
BEGIN
CREATE NONCLUSTERED INDEX [IDX_MOaJournalHDR_JournalDate_BankDate]ON[MOaJournalHeader]
(
[JournalDate] ASC ,
[bankdate] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1109578991')
BEGIN
CREATE NONCLUSTERED INDEX [index_1109578991]ON[moapoitems]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1525580473')
BEGIN
CREATE NONCLUSTERED INDEX [index_1525580473]ON[MOiGodownStock]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_901578250')
BEGIN
CREATE NONCLUSTERED INDEX [index_901578250]ON[MOiGodownStockBackup]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1205579333')
BEGIN
CREATE NONCLUSTERED INDEX [index_1205579333]ON[mosGoodsRequestDetail]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_917578307')
BEGIN
CREATE NONCLUSTERED INDEX [index_917578307]ON[mosGoodsRequestHeader]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_1733581214')
BEGIN
CREATE NONCLUSTERED INDEX [index_1733581214]ON[mosshopservicestock]
(
[rowguid] ASC 
) WITH FILLFACTOR = 100
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idxItemID')
BEGIN
CREATE NONCLUSTERED INDEX [idxItemID]ON[MOsShopStock]
(
[ItemID] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='idxShopId')
BEGIN
CREATE NONCLUSTERED INDEX [idxShopId]ON[MOsShopStock]
(
[ShopID] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_2085582468')
BEGIN
CREATE NONCLUSTERED INDEX [index_2085582468]ON[MOsShopStock]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_949578421')
BEGIN
CREATE NONCLUSTERED INDEX [index_949578421]ON[MOsShopStockBackup]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_receiptvoucherheader_vendorid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_receiptvoucherheader_vendorid]ON[ReceiptVoucherHeader]
(
[VendorID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='index_997578592')
BEGIN
CREATE NONCLUSTERED INDEX [index_997578592]ON[ReportNames]
(
[rowguid] ASC 
) WITH FILLFACTOR = 90
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_vendorsettlementdetail_dcnid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_vendorsettlementdetail_dcnid]ON[VendorSettlementDetail]
(
[dcnid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_vendorsettlementdetail_losdcnid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_vendorsettlementdetail_losdcnid]ON[VendorSettlementDetail]
(
[losdcnid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_vendorsettlementdetail_lphbillid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_vendorsettlementdetail_lphbillid]ON[VendorSettlementDetail]
(
[lphbillid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_vendorsettlementdetail_pbhbillid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_vendorsettlementdetail_pbhbillid]ON[VendorSettlementDetail]
(
[pbhbillid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_vendorsettlementdetail_receiptid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_vendorsettlementdetail_receiptid]ON[VendorSettlementDetail]
(
[receiptid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_vendorsettlementdetail_shopid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_vendorsettlementdetail_shopid]ON[VendorSettlementDetail]
(
[shopid] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_vendorsettlementdetail_vsid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_vendorsettlementdetail_vsid]ON[VendorSettlementDetail]
(
[VSID] ASC 
)
END
 GO 
IF NOT EXISTS (SELECT * FROM sysindexes  WHERE  name='ind_vendorsettlementheader_vsid')
BEGIN
CREATE NONCLUSTERED INDEX [ind_vendorsettlementheader_vsid]ON[VendorSettlementHeader]
(
[VSID] ASC 
)
END
 GO 
 GO 
 CREATE PROCEDURE DropExtndProp
 AS
 BEGIN
--Script fot Drop all Extended Properties
 CREATE TABLE  #sqlDeleteAllExtndProp
 (
		ConstraintID INT IDENTITY(1,1) NOT NULL,  
		SqlStatement VARCHAR(4000) 
 )
 INSERT INTO #sqlDeleteAllExtndProp 
SELECT 'EXEC sp_dropextendedproperty @name = ' + QUOTENAME(ep.name, '''') +
 ', @level0type = ''schema'', @level0name = ''dbo''' +
  ', @level1type = ''table'', @level1name = ' + 
  QUOTENAME(OBJECT_NAME(c.[object_id]), '''') + ', 
  @level2type = ''column'', @level2name = ' + QUOTENAME(c.name, '''') + ';' 
  FROM sys.extended_properties AS ep 
  INNER JOIN sys.columns AS c ON c.[object_id] = ep.major_id AND c.column_id = ep.minor_id
 DECLARE @intID INT 
 DECLARE @intCount INT 
 SET @intID = 1 
 SELECT @intCount= COUNT(*) 
 FROM #sqlDeleteAllExtndProp
 DECLARE @SqlStatement NVARCHAR(4000) 
 WHILE @intID <= @intCount 
 BEGIN 
	SELECT @SqlStatement = SqlStatement 
	FROM #sqlDeleteAllExtndProp
	WHERE ConstraintID = @intID 
	execute sp_executesql @SqlStatement 
	SET @intID = @intID + 1 
 END 
 DROP TABLE #sqlDeleteAllExtndProp
 END 
 GO 
 EXEC  DropExtndProp
 GO 
 DROP PROCEDURE  DropExtndProp
 GO 
--Script for Extended Properties 
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='Fb_kotdetails' AND COLUMN_NAME='fb_kd_AddedItemtype')
BEGIN
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_Description' , N'SCHEMA',N'dbo', N'TABLE',N'Fb_kotdetails', N'COLUMN',N'fb_kd_AddedItemtype'))
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=['1-Added Dish '2-Added Item '0-Ordinary Dish],@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Fb_kotdetails', @level2type=N'COLUMN',@level2name=N'fb_kd_AddedItemtype'
END
GO
SET ANSI_PADDING OFF
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='LosPosFAndBHeader' AND COLUMN_NAME='poshBillType')
BEGIN
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_Description' , N'SCHEMA',N'dbo', N'TABLE',N'LosPosFAndBHeader', N'COLUMN',N'poshBillType'))
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=[CR-Credit,CA-Cash,VO-Voucher,NP-NoPay,VCA-Voucher&Cash,VCR-Voucher&Credit],@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'LosPosFAndBHeader', @level2type=N'COLUMN',@level2name=N'poshBillType'
END
GO
SET ANSI_PADDING OFF
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillStatusMaster' AND COLUMN_NAME='tillstatus_name')
BEGIN
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_Description' , N'SCHEMA',N'dbo', N'TABLE',N'TillStatusMaster', N'COLUMN',N'tillstatus_name'))
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=[1 - Ready,2 - Used,3 - Not Used],@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TillStatusMaster', @level2type=N'COLUMN',@level2name=N'tillstatus_name'
END
GO
SET ANSI_PADDING OFF
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='CrmEmailRecepients' AND COLUMN_NAME='Type')
BEGIN
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_Description' , N'SCHEMA',N'dbo', N'TABLE',N'CrmEmailRecepients', N'COLUMN',N'Type'))
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=[T for To,B Bcc,C Cc],@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CrmEmailRecepients', @level2type=N'COLUMN',@level2name=N'Type'
END
GO
SET ANSI_PADDING OFF
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='TillBalanceHistory' AND COLUMN_NAME='till_status')
BEGIN
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_Description' , N'SCHEMA',N'dbo', N'TABLE',N'TillBalanceHistory', N'COLUMN',N'till_status'))
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=[1 - Open,0 - Close],@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TillBalanceHistory', @level2type=N'COLUMN',@level2name=N'till_status'
END
GO
SET ANSI_PADDING OFF
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS  WHERE  TABLE_NAME='fb_kotHistory' AND COLUMN_NAME='fb_kd_AddedItemtype')
BEGIN
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_Description' , N'SCHEMA',N'dbo', N'TABLE',N'fb_kotHistory', N'COLUMN',N'fb_kd_AddedItemtype'))
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=['1-Added Dish '2-Added Item '0-Ordinary Dish],@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'fb_kotHistory', @level2type=N'COLUMN',@level2name=N'fb_kd_AddedItemtype'
END
GO
SET ANSI_PADDING OFF
GO
 CREATE PROCEDURE DropTrig
 AS
 BEGIN
--Script for Drop All triggers
 CREATE TABLE  #sqlDeleteAllTrigger
 (
		ConstraintID INT IDENTITY(1,1) NOT NULL,  
		SqlStatement VARCHAR(4000) 
 )
 INSERT INTO #sqlDeleteAllTrigger
 SELECT 'DROP TRIGGER ' + name FROM sys.triggers
 DECLARE @intID INT 
 DECLARE @intCount INT 
 SET @intID = 1 
 SELECT @intCount= COUNT(*) 
 FROM #sqlDeleteAllTrigger
 DECLARE @SqlStatement NVARCHAR(4000) 
 WHILE @intID <= @intCount 
 BEGIN 
	SELECT @SqlStatement = SqlStatement 
	FROM #sqlDeleteAllTrigger
	WHERE ConstraintID = @intID 
	execute sp_executesql @SqlStatement 
	SET @intID = @intID + 1 
 END 
 DROP TABLE #sqlDeleteAllTrigger
 END 
 GO 
 EXEC  DropTrig
 GO 
 DROP PROCEDURE  DropTrig
 GO 
IF EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[TRIGGER_UPDATE_ITEMPRICEHISTORY]'))
 DROP TRIGGER TRIGGER_UPDATE_ITEMPRICEHISTORY
 GO

CREATE TRIGGER [dbo].[TRIGGER_UPDATE_ITEMPRICEHISTORY] ON [dbo].[losShopItemShipmentDetail] 
   AFTER  
   INSERT,
   DELETE,
   UPDATE
AS 
BEGIN
	
	SET NOCOUNT ON;
   
	DECLARE @ItemId AS INT,
			@PackId AS INT,
			@ShopId AS INT,
			@SegmentId AS INT,
			@CurrencyId AS INT,
			@SellingPrice AS NUMERIC(18,2),
			@DiscountPrice AS  NUMERIC(18,2),
			@WholesalePrice AS NUMERIC(18,2),
			@CreditSP AS NUMERIC(18,2),
			@CreditDP AS NUMERIC(18,2),
			@CreditWP AS NUMERIC(18,2),
			@FixDate AS DATETIME,
			@UpdateTime AS DATETIME,
			@UserId AS NUMERIC(18,2),
			@CompanyId AS NUMERIC(18,2),
			@FinancialId AS NUMERIC(18,2),
			@rowguid AS NUMERIC(18,2)

	SET @UpdateTime = (SELECT GETDATE())

	SELECT @ItemId = itemid,
			@PackId = PackingTypeid,
			@ShopId = shopid,
			@SegmentId = segmentid,
			@CurrencyId = currencyid,
			@SellingPrice = sellingPrice,
			@DiscountPrice = DiscountPrice,
			@WholesalePrice = WholesalePrice,
			@CreditSP = CreditSP,
			@CreditDP = CreditDP,
			@CreditWP = CreditWP,
			@FixDate = spFixdate,			
			@UserId = Userid,
			@CompanyId = companyid 

	FROM   losShopitemShipmentDetail

if (select COUNT(*) from losshopitemshipmentdetail)>=1 
begin
INSERT INTO ItemPriceHistory(ItemId,PackId,	ShopId,SegmentId,CurrencyId,SellingPrice,DiscountPrice,
							 WholesalePrice,CreditSP,CreditDP,CreditWP,FixDate,UpdateTime,UserId,CompanyId) 
		VALUES(@ItemId ,@PackId,@ShopId,@SegmentId ,@CurrencyId ,@SellingPrice ,@DiscountPrice ,
			@WholesalePrice ,@CreditSP ,@CreditDP ,	@CreditWP,@FixDate,@UpdateTime,	@UserId ,@CompanyId )
  
end
END

GO
IF EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[CRMInsertAccounts]'))
 DROP TRIGGER CRMInsertAccounts
 GO
CREATE trigger [dbo].[CRMInsertAccounts]
on [dbo].[aCustomerMaster]
AFTER Insert
as
BEGIN
declare @CustomerID as int
select @CustomerID=case isnull(max(CustomerID),0) when 0 then 1 else max(CustomerID)+1 end  from [dbo].CrmCustomerMaster      
INSERT INTO dbo.CrmCustomerMaster
(
	CustomerID,CompanyID,CustomerName,Active,Address1,Address2,Address3,CityID,PhoneNo,FaxNo,EmailID,CurrencyID,
	CountryID,custdob,webadd,CreditLimit,registerdate,CusGroupId,MasterApllicationCustomerId,Deleted
)
select @CustomerID,CompanyID,CustomerName,Active,Address1,Address2,Address3,CityID,PhoneNo,FaxNo,EmailID,
	CurrencyID,CountryID,custdob,webadd,CreditLimit,registerdate,CusGroupId,CustomerID,0
 from INSERTED
end
GO
IF EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[CRMUpdateAccounts]'))
 DROP TRIGGER CRMUpdateAccounts
 GO
CREATE trigger [dbo].[CRMUpdateAccounts]  
	on [dbo].[aCustomerMaster]  
	after update  
	as  
		if update(customerid)  
		BEGIN  
			update dbo.CrmCustomerMaster  
			set  
				CustomerName=up.CustomerName,  
				Address1=up.Address1,  
				Address2=up.Address2,  
				Address3=up.Address3,  
				CityID=up.CityID,  
				PhoneNo=up.PhoneNo,  
				FaxNo=up.FaxNo,  
				EmailID=up.EmailID,  
				CurrencyID=up.CurrencyID,  
				CountryID=up.CountryID,  
				custdob=up.custdob,  
				webadd=up.webadd,  
				CreditLimit=up.CreditLimit,  
				CusGroupId=up.CusGroupId  
			from acustomermaster up  
			where  up.customerid=CrmCustomerMaster.MasterApllicationCustomerId  
		end
GO
GO
ALTER TABLE [aVendorItem] ALTER COLUMN  [itemid] int NOT NULL 
go
ALTER TABLE [aVendorItem] ALTER COLUMN  [vendorid] int NOT NULL 
go
ALTER TABLE [aVendorItem] ADD  CONSTRAINT [PK_avendoritem] PRIMARY KEY CLUSTERED ([itemid],[vendorid])
go


Go




















