ALTER TABLE VS4TQuotation ADD
	TQuoTransportDesc money NULL,
	TQuoDuty money NULL,
	TQuoBaseIncoType smallint NULL,
	TQuoDiscountText nvarchar(30) NULL,
	TQuoDepositText nvarchar(30) NULL,
	TQuoWTAXBase money NULL,
	TQuoVATType smallint NULL,
	TQuoTotal money NULL,
	TQuoTotalInRate money NULL,
	TQuoNetTotal money NULL,
	TQuoReviseBy nvarchar(140) NULL,
	TQuoReviseStatus smallint NULL
GO
UPDATE VS4TQuotation Set TQuoBaseIncoType =TQuoIncoType where TQuoBaseIncoType is null
GO
UPDATE VS4TQuotation Set TQuoTransportDesc=0 where TQuoTransportDesc is null
GO
UPDATE VS4TQuotation Set TQuoDuty=0 where TQuoDuty is null
GO

UPDATE VS4TQuotation Set TQuoWTAXBase=TQuoTaxBase ,TQuoVATType=TQuoDepositVAT,TQuoTotal=TQuoGrandTotalVAT, TQuoTotalInRate=TQuoFirstPayment, TQuoNetTotal=TQuoWTAXRate
GO

UPDATE VS4TQuotation SET TQuoDepositText=replace(''+convert(char(20),round(TQuoDepositRate,2)),' ','') where TQuoDepositRate > 0
GO
UPDATE VS4TQuotation SET TQuoDepositText=TQuoDepositText+'%' WHERE TQuoDepositText<>''
GO

UPDATE VS4TQuotation SET TQuoDiscountText=replace(''+convert(char(20),round(TQuoDiscountPC,2)),' ','') where TQuoDiscountPC > 0
GO
UPDATE VS4TQuotation SET TQuoDiscountText=TQuoDiscountText+'%' WHERE TQuoDiscountText<>''
GO
UPDATE VS4TQuotation SET TQuoDiscountText=TQuoDiscountText+'+'+replace(''+convert(char(20),round(TQuoDiscountFix,2)),' ','') where TQuoDiscountFix > 0
GO

UPDATE VS4TQuotation Set TQuoFlag2=TQuoIncoType
GO
ALTER TABLE VS4TQuotation
	DROP COLUMN TQuoIncoType,TQuoBaseIncoType
GO
ALTER TABLE VS4TQuotation ADD
	TQuoIncoType nvarchar(3) NULL,
	TQuoBaseIncoType nvarchar(3) NULL
GO
UPDATE VS4TQuotation Set TQuoIncoType='FOB' WHERE TQuoFlag2=0
GO
UPDATE VS4TQuotation Set TQuoIncoType='CIF' WHERE TQuoFlag2=1
GO
UPDATE VS4TQuotation Set TQuoIncoType='CFR' WHERE TQuoFlag2=2
GO
UPDATE VS4TQuotation Set TQuoIncoType='EXW' WHERE TQuoFlag2=3
GO
UPDATE VS4TQuotation Set TQuoBaseIncoType =TQuoIncoType where TQuoBaseIncoType is null
GO