ALTER TABLE VS4TARInvoiceADJ ADD
	TIvAWTAXBase money NULL,
	TIvAVATType smallint NULL,
	TIvATotal money NULL,
	TIvATotalInRate money NULL,
	TIvANetTotal money NULL,
	TIvADepositText nvarchar(30) NULL,
	TIvADiscountText nvarchar(30) NULL
GO

UPDATE VS4TARInvoiceADJ Set TIvAWTAXBase=TIvATaxBase ,TIvAVATType=TIvADepositVAT,TIvATotal=TIvAGrandTotalVAT, TIvATotalInRate=TIvAFirstPayment, TIvANetTotal=TIvAWTAXRate
GO
UPDATE VS4TARInvoiceADJ Set TIvAFlag2=TIvAIncoType
GO
ALTER TABLE VS4TARInvoiceADJ
	DROP COLUMN TIvAIncoType
GO
DROP INDEX VS4TARInvoiceADJ.TFliCreateCode
GO
DROP INDEX VS4TARInvoiceADJ.TFliEditBy
GO
DROP INDEX VS4TARInvoiceADJ.TFliEditCode
GO
ALTER TABLE VS4TARInvoiceADJ
	DROP COLUMN TIvACreateCode,TIvACreateBy,TIvACreateDate,TIvAEditCode,TIvAEditBy,TIvAEditDate,TIvAConfirmBy,TIvAConfirmDate,TIvAApproveBy,TIvAApproveDate,TIvAApproveNote,TIvACancelNo,TIvACancelBy,TIvACancelDate,TIvACancelNote
GO
ALTER TABLE VS4TARInvoiceADJ ADD
	TIvAIncoType nvarchar(3) NULL
GO
UPDATE VS4TARInvoiceADJ Set TIvAIncoType='FOB' WHERE TIvAFlag2=0
GO
UPDATE VS4TARInvoiceADJ Set TIvAIncoType='CIF' WHERE TIvAFlag2=1
GO
UPDATE VS4TARInvoiceADJ Set TIvAIncoType='CFR' WHERE TIvAFlag2=2
GO
UPDATE VS4TARInvoiceADJ Set TIvAIncoType='EXW' WHERE TIvAFlag2=3
GO
