CREATE TABLE VS4TAR
	(
	TARNCode nvarchar(30) NOT NULL,
	TARNTCmpCode nvarchar(30) NULL,
	TARNTARTCode nvarchar(30) NULL,
	TARNIntro nvarchar(50) NULL,
	TARNName nvarchar(200) NULL,
	TARNName2 nvarchar(200) NULL,
	TARNIntroName nvarchar(200) NULL,
	TARNType smallint NULL,
	TARNOwnerName nvarchar(160) NULL,
	TARNDocCode nvarchar(30) NULL,
	TARNContactName nvarchar(160) NULL,
	TARNTaxNo nvarchar(30) NULL,
	TARNAccountCode nvarchar(30) NULL,
	TARNTARGCode nvarchar(30) NULL,
	TARNAddressBill nvarchar(255) NULL,
	TARNAddressDeliver nvarchar(255) NULL,
	TARNAddress nvarchar(255) NULL,
	TARNAddress2 nvarchar(255) NULL,
	TARNSubProvince nvarchar(50) NULL,
	TARNCity nvarchar(50) NULL,
	TARNPostalCode nvarchar(5) NULL,
	TARNStaCode nvarchar(3) NULL,
	TARNTCouCode nvarchar(3) NULL,
	TARNWebsite nvarchar(50) NULL,
	TARNEmail nvarchar(50) NULL,
	TARNPhone nvarchar(100) NULL,
	TARNFax nvarchar(50) NULL,
	TARNMobile nvarchar(20) NULL,
	TARNImage1 nvarchar(50) NULL,
	TARNCreditUseBegin money NULL,
	TARNCreditLimit money NULL,
	TARNCreditUseBal money NULL,
	TARNCreditUse money NULL,
	TARNCreditBalance money NULL,
	TARNCreditAvaiBal money NULL,
	TARNBeginBalance money NULL,
	TARNTotalOrderBal int NULL,
	TARNPriceChannel smallint NULL,
	TARNDiscount nvarchar(30) NULL,
	TARNDiscountPC real NULL,
	TARNDiscountDay smallint NULL,
	TARNCreditDay smallint NULL,
	TARNLimitTCurCode nvarchar(15) NULL,
	TARNSpecialTaxRate float(53) NULL,
	TARNPaymentNote nvarchar(255) NULL,
	TARNStatementNote nvarchar(255) NULL,
	TARNDeliveryNote nvarchar(255) NULL,
	TARNMapFile nvarchar(50) NULL,
	TARNTimeToOrder int NULL,
	TARNLastDueDate datetime NULL,
	TARNFirstOrderDate datetime NULL,
	TARNLastOrderDate datetime NULL,
	TARNTARSAlias nvarchar(30) NULL,
	TARNTBsTCode nvarchar(30) NULL,
	TARNTSAeCode nvarchar(30) NULL,
	TARNNeedBill smallint NULL,
	TARNBillDay1 smallint NULL,
	TARNBillDay2 smallint NULL,
	TARNBillDay3 smallint NULL,
	TARNBillDay4 smallint NULL,
	TARNBillMove smallint NULL,
	TARNBillAdjust smallint NULL,
	TARNNote nvarchar(255) NULL,
	TARNCreateCode nvarchar(30) NULL,
	TARNCreateDate datetime NULL,
	TARNEditCode nvarchar(30) NULL,
	TARNEditDate datetime NULL,
	TARNTextSort nvarchar(30) NULL,
	TARNFlag1 smallint NULL,
	TARNFlag2 smallint NULL,
	TARNFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TAR ADD CONSTRAINT
	PK_VS4TAR PRIMARY KEY CLUSTERED 
	(
	TARNCode
	) ON [PRIMARY]

GO

CREATE TABLE VS4TAR2
	(
	TAR2TARNCode nvarchar(30) NOT NULL,
	TAR2Ln int NOT NULL,
	TAR2OwnerName nvarchar(160) NULL,
	TAR2Nature nvarchar(120) NULL,
	TAR2TaxNo nvarchar(30) NULL,
	TAR2TAPNCode nvarchar(30) NULL,
	TAR2SaleCode nvarchar(30) NULL,
	TAR2TCMSCode nvarchar(30) NULL,
	TAR2CreditUseBegin money NULL,
	TAR2CreditLimit money NULL,
	TAR2CreditUseBal money NULL,
	TAR2CreditUse money NULL,
	TAR2CreditBalance money NULL,
	TAR2CreditAvaiBal money NULL,
	TAR2BeginBalance money NULL,
	TAR2TotalOrderBal int NULL,
	TAR2DiscountPC real NULL,
	TAR2DiscountDay smallint NULL,
	TAR2CreditDay smallint NULL,
	TAR2LimitTCurCode nvarchar(15) NULL,
	TAR2TimeToOrder int NULL,
	TAR2LastDueDate datetime NULL,
	TAR2LastOrderDate datetime NULL,
	TAR2RelationLevel smallint NULL,
	TAR2CompanyHolder smallint NULL,
	TAR2SignDate datetime NULL,
	TAR2Capital money NULL,
	TAR2CapitalPC real NULL,
	TAR2CapitalNote nvarchar(50) NULL,
	TAR2VATDoc smallint NULL,
	TAR2VATDocImage nvarchar(50) NULL,
	TAR2Assure smallint NULL,
	TAR2AssureImage nvarchar(50) NULL,
	TAR2FirstDrawing smallint NULL,
	TAR2Profile int NULL,
	TAR2Level int NULL,
	TAR2CashOnly tinyint NULL,
	TAR2TRouCode nvarchar(30) NULL,
	TAR2TShpCode nvarchar(30) NULL,
	TAR2DeliveryCond smallint NULL,
	TAR2Distance real NULL,
	TAR2DeliveryHour real NULL,
	TAR2UseLastPrice smallint NULL,
	TAR2RequestBy nvarchar(160) NULL,
	TAR2RequestDate datetime NULL,
	TAR2ApproveBy nvarchar(160) NULL,
	TAR2ApproveStatus smallint NULL,
	TAR2ApproveDate datetime NULL,
	TAR2TMedCode nvarchar(30) NULL,
	TAR2Favorite nvarchar(255) NULL,
	TAR2NotLike nvarchar(255) NULL,
	TAR2Style nvarchar(255) NULL,
	TAR2TSPvCode nvarchar(4) NULL,
	TAR2TPrvCode nvarchar(3) NULL,
	TAR2TDecCode nvarchar(30) NULL,
	TAR2TBSMCode nvarchar(30) NULL,
	TAR2Grade smallint NULL,
	TAR2MonthlyAppoint smallint NULL,
	TAR2TSitCode nvarchar(30) NULL,
	TAR2Marks nvarchar(200) NULL,
	TAR2LastInvoice nvarchar(30) NULL,
	TAR2BillNote nvarchar(255) NULL,
	TAR2Note2 nvarchar(255) NULL,
	TAR2Note3 nvarchar(255) NULL,
	TAR2LifeStyle1 nvarchar(250) NULL,
	TAR2LifeStyle2 nvarchar(250) NULL,
	TAR2Flag1 smallint NULL,
	TAR2Flag2 smallint NULL,
	TAR2Flag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TAR2 ADD CONSTRAINT
	PK_VS4TAR2 PRIMARY KEY CLUSTERED 
	(
	TAR2TARNCode,
	TAR2Ln
	) ON [PRIMARY]

GO

CREATE TABLE VS4TAR3
	(
	TAR3TARNCode nvarchar(30) NOT NULL,
	TAR3Ln int NOT NULL,
	TAR3Gender nvarchar(1) NULL,
	TAR3TitleName nvarchar(50) NULL,
	TAR3FirstName nvarchar(50) NULL,
	TAR3MiddleName nvarchar(5) NULL,
	TAR3LastName nvarchar(50) NULL,
	TAR3AliasName nvarchar(10) NULL,
	TAR3NickName nvarchar(20) NULL,
	TAR3TitleName2 nvarchar(50) NULL,
	TAR3FirstName2 nvarchar(50) NULL,
	TAR3MiddleName2 nvarchar(5) NULL,
	TAR3Lastname2 nvarchar(50) NULL,
	TAR3PostAddess smallint NULL,
	TAR3CitizenNo nvarchar(15) NULL,
	TAR3CitizenFrom datetime NULL,
	TAR3CitizenTo datetime NULL,
	TAR3CitizenAddress nvarchar(255) NULL,
	TAR3Race nvarchar(50) NULL,
	TAR3CitizenShip nvarchar(50) NULL,
	TAR3Religion nvarchar(50) NULL,
	TAR3Language nvarchar(50) NULL,
	TAR3BornZone nvarchar(30) NULL,
	TAR3SocialSecurity nvarchar(15) NULL,
	TAR3BirthDay datetime NULL,
	TAR3Blood nvarchar(5) NULL,
	TAR3Height real NULL,
	TAR3Weight real NULL,
	TAR3StatusPer smallint NULL,
	TAR3PassportNo nvarchar(15) NULL,
	TAR3CardAlien nvarchar(50) NULL,
	TAR3AllowAlien nvarchar(50) NULL,
	TAR3PassportFrom datetime NULL,
	TAR3PassportTo datetime NULL,
	TAR3WorkPermitFrom datetime NULL,
	TAR3WorkPermitTo datetime NULL,
	TAR3Company nvarchar(200) NULL,
	TAR3Company2 nvarchar(200) NULL,
	TAR3CmpAddress nvarchar(200) NULL,
	TAR3CmpAddress2 nvarchar(200) NULL,
	TAR3TSpvCode nvarchar(4) NULL,
	TAR3TPrvCode nvarchar(2) NULL,
	TAR3PostalCode nvarchar(5) NULL,
	TAR3TStaCode nvarchar(3) NULL,
	TAR3TCouCode nvarchar(30) NULL,
	TAR3Website nvarchar(50) NULL,
	TAR3Email nvarchar(50) NULL,
	TAR3Phone nvarchar(100) NULL,
	TAR3Fax nvarchar(50) NULL,
	TAR3Image1 nvarchar(50) NULL,
	TAR3Salary money NULL,
	TAR3OtherIncome money NULL,
	TAR3FirstTalkType smallint NULL,
	TAR3ProspectStatus smallint NULL,
	TAR3OrderStatus smallint NULL,
	TAR3Flag1 smallint NULL,
	TAR3Flag2 smallint NULL,
	TAR3Flag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TAR3 ADD CONSTRAINT
	PK_VS4TAR3 PRIMARY KEY CLUSTERED 
	(
	TAR3TARNCode,
	TAR3Ln
	) ON [PRIMARY]

GO

CREATE TABLE VS4TARHolder
	(
	TARHCode nvarchar(30) NOT NULL,
	TARHIntro nvarchar(50) NULL,
	TARHName nvarchar(200) NULL,
	TARHName2 nvarchar(200) NULL,
	TARHIntroName nvarchar(200) NULL,
	TARHType smallint NULL,
	TARHParent nvarchar(30) NULL,
	TARHFlag1 smallint NULL,
	TARHFlag2 smallint NULL,
	TARHFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TARHolder ADD CONSTRAINT
	PK_VS4TARHolder PRIMARY KEY CLUSTERED 
	(
	TARHCode
	) ON [PRIMARY]

GO

CREATE TABLE VS4TARMedia
	(
	TAMdTMedCode nvarchar(30) NOT NULL,
	TAMdTARNCode nvarchar(30) NOT NULL,
	TAMdFlag1 smallint NULL,
	TAMdFlag2 smallint NULL,
	TAMdFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TARMedia ADD CONSTRAINT
	PK_VS4TARMedia PRIMARY KEY CLUSTERED 
	(
	TAMdTMedCode,
	TAMdTARNCode
	) ON [PRIMARY]

GO

CREATE TABLE VS4TCountry
	(
	TCouCode nvarchar(3) NOT NULL,
	TCouName nvarchar(50) NULL,
	TCouName2 nvarchar(50) NULL,
	TCouPhoneCode nvarchar(3) NULL,
	TCouTCTNCode nvarchar(3) NULL,
	TCouGroup1 nvarchar(30) NULL,
	TCouGroup2 nvarchar(30) NULL,
	TCouFlag1 smallint NULL,
	TCouFlag2 smallint NULL,
	TCouFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TCountry ADD CONSTRAINT
	PK_VS4TCountry PRIMARY KEY CLUSTERED 
	(
	TCouCode
	) ON [PRIMARY]

GO

CREATE TABLE VS4TFreeCode
	(
	TFreCode nvarchar(30) NOT NULL,
	TFreName nvarchar(200) NULL,
	TFreName2 nvarchar(200) NULL,
	TFreTACCCode nvarchar(30) NULL,
	TFreFlag1 smallint NULL,
	TFreFlag2 smallint NULL,
	TFreFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TFreeCode ADD CONSTRAINT
	PK_VS4TFreeCode PRIMARY KEY CLUSTERED 
	(
	TFreCode
	) ON [PRIMARY]

GO

CREATE TABLE VS4TMedia
	(
	TMedCode nvarchar(30) NOT NULL,
	TMedName nvarchar(200) NULL,
	TMedName2 nvarchar(200) NULL,
	TMedDescription nvarchar(200) NULL,
	TMedFlag1 smallint NULL,
	TMedFlag2 smallint NULL,
	TMedFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TMedia ADD CONSTRAINT
	PK_VS4TMedia PRIMARY KEY CLUSTERED 
	(
	TMedCode
	) ON [PRIMARY]

GO

CREATE TABLE VS4TPOSLastPrice
	(
	TPLPTPmtCode nvarchar(30) NOT NULL,
	TPLPTPOSCode nvarchar(30) NOT NULL,
	TPLPFromQuantity float(53) NOT NULL,
	TPLPTUntCode nvarchar(15) NOT NULL,
	TPLPBarCode nvarchar(30) NULL,
	TPLPName nvarchar(150) NULL,
	TPLPPriceChannel smallint NULL,
	TPLPTUntCode2 nvarchar(15) NULL,
	TPLPTUntCode3 nvarchar(15) NULL,
	TPLPWarranty float(53) NULL,
	TPLPWarrantyUnit nvarchar(1) NULL,
	TPLPWarrantyType smallint NULL,
	TPLPRefund smallint NULL,
	TPLPTPPMTPPLNo nvarchar(30) NULL,
	TPLPTPPMLn int NULL,
	TPLPApproveTime datetime NULL,
	TPLPUnitCalc smallint NULL,
	TPLPPrice1 money NULL,
	TPLPDiscountText1 nvarchar(30) NULL,
	TPLPTCurCode1 nvarchar(5) NULL,
	TPLPTaxType1 smallint NULL,
	TPLPPrice2 money NULL,
	TPLPDiscountText2 nvarchar(30) NULL,
	TPLPTCurCode2 nvarchar(5) NULL,
	TPLPTaxType2 smallint NULL,
	TPLPPrice3 money NULL,
	TPLPDiscountText3 nvarchar(30) NULL,
	TPLPTCurCode3 nvarchar(5) NULL,
	TPLPTaxType3 smallint NULL,
	TPLPPrice4 money NULL,
	TPLPDiscountText4 nvarchar(30) NULL,
	TPLPTCurCode4 nvarchar(5) NULL,
	TPLPTaxType4 smallint NULL,
	TPLPPrice5 money NULL,
	TPLPDiscountText5 nvarchar(30) NULL,
	TPLPTCurCode5 nvarchar(5) NULL,
	TPLPTaxType5 smallint NULL,
	TPLPPrice6 money NULL,
	TPLPDiscountText6 nvarchar(30) NULL,
	TPLPTCurCode6 nvarchar(5) NULL,
	TPLPTaxType6 smallint NULL,
	TPLPPrice7 money NULL,
	TPLPDiscountText7 nvarchar(30) NULL,
	TPLPTCurCode7 nvarchar(5) NULL,
	TPLPTaxType7 smallint NULL,
	TPLPPrice8 money NULL,
	TPLPDiscountText8 nvarchar(30) NULL,
	TPLPTCurCode8 nvarchar(5) NULL,
	TPLPTaxType8 smallint NULL,
	TPLPPrice9 money NULL,
	TPLPDiscountText9 nvarchar(30) NULL,
	TPLPTCurCode9 nvarchar(5) NULL,
	TPLPTaxType9 smallint NULL,
	TPLPPrice10 money NULL,
	TPLPDiscountText10 nvarchar(30) NULL,
	TPLPTCurCode10 nvarchar(5) NULL,
	TPLPTaxType10 smallint NULL,
	TPLPTPTyAlias nvarchar(30) NULL,
	TPLPDiscountPC real NULL,
	TPLPDiscountFix money NULL,
	TPLPReplacePrice money NULL,
	TPLPGetNumber float(53) NULL,
	TPLPFreeCode nvarchar(30) NULL,
	TPLPFreeNumber float(53) NULL,
	TPLPSaleCount smallint NULL,
	TPLPFlag1 smallint NULL,
	TPLPFlag2 smallint NULL,
	TPLPFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TPOSLastPrice ADD CONSTRAINT
	PK_VS4TPOSLastPrice PRIMARY KEY CLUSTERED 
	(
	TPLPTPmtCode,
	TPLPTPOSCode,
	TPLPFromQuantity,
	TPLPTUntCode
	) ON [PRIMARY]

GO

CREATE TABLE VS4TSO
	(
	TSODNo nvarchar(30) NOT NULL,
	TSODTSBkCode nvarchar(30) NULL,
	TSODTRCACode nvarchar(30) NULL,
	TSODMode smallint NULL,
	TSODCode nvarchar(30) NULL,
	TSODType smallint NULL,
	TSODDate datetime NULL,
	TSODTime datetime NULL,
	TSODDueDate datetime NULL,
	TSODRefNo nvarchar(30) NULL,
	TSODRefDate datetime NULL,
	TSODBODeposit int NULL,
	TSODTPrjCode nvarchar(30) NULL,
	TSODTBraCode nvarchar(30) NULL,
	TSODTEmpCode nvarchar(30) NULL,
	TSODSaleName nvarchar(140) NULL,
	TSODGuideText nvarchar(100) NULL,
	TSODEmpText nvarchar(100) NULL,
	TSODDeliveryDate datetime NULL,
	TSODDeliveryTime datetime NULL,
	TSODDeliveryTo nvarchar(255) NULL,
	TSODTOTNLn int NULL,
	TSODTARNCode nvarchar(30) NULL,
	TSODTARDCode nvarchar(30) NULL,
	TSODContactNote nvarchar(50) NULL,
	TSODContactName nvarchar(160) NULL,
	TSODCustomerName nvarchar(200) NULL,
	TSODCusAddress nvarchar(255) NULL,
	TSODConsignee nvarchar(255) NULL,
	TSODNotifyParty nvarchar(255) NULL,
	TSODCostTotal money NULL,
	TSODPMCostTotal money NULL,
	TSODPriceChannel smallint NULL,
	TSODChannelName nvarchar(30) NULL,
	TSODDiscountList money NULL,
	TSODSubTotal money NULL,
	TSODDiscountText nvarchar(30) NULL,
	TSODDiscountTotal money NULL,
	TSODNetTotal money NULL,
	TSODDepositText nvarchar(30) NULL,
	TSODDeposit money NULL,
	TSODTotal money NULL,
	TSODTotalFOB money NULL,
	TSODTCurCode nvarchar(5) NULL,
	TSODExchangeRate money NULL,
	TSODTotalInRate money NULL,
	TSODVATType smallint NULL,
	TSODVATRate real NULL,
	TSODTaxBase money NULL,
	TSODVATTotal money NULL,
	TSODGrandTotal money NULL,
	TSODNOTAXTotal money NULL,
	TSODWTAXBase money NULL,
	TSODWTaxRate real NULL,
	TSODWTaxTotal money NULL,
	TSODNetPayment money NULL,
	TSODAdjustTotal money NULL,
	TSODRewardTotal money NULL,
	TSODPremiumTotal money NULL,
	TSODCommissionBase money NULL,
	TSODCommissionRate nvarchar(30) NULL,
	TSODCommission money NULL,
	TSODBaseIncoType nvarchar(3) NULL,
	TSODIncoType nvarchar(3) NULL,
	TSODIncoterms nvarchar(50) NULL,
	TSODOtherFee money NULL,
	TSODTransportFee money NULL,
	TSODHandlingFee money NULL,
	TSODFreightFee money NULL,
	TSODInsurance money NULL,
	TSODTransportDesc money NULL,
	TSODDuty money NULL,
	TSODShipBy nvarchar(255) NULL,
	TSODCountryOrigin nvarchar(50) NULL,
	TSODDestination nvarchar(255) NULL,
	TSODCondition nvarchar(100) NULL,
	TSODConditionDay smallint NULL,
	TSODCondition1 real NULL,
	TSODConditionDay1 smallint NULL,
	TSODPaymentNote nvarchar(200) NULL,
	TSODStatementNote nvarchar(200) NULL,
	TSODDeliveryNote nvarchar(200) NULL,
	TSODPackingNote nvarchar(200) NULL,
	TSODDayAvailable smallint NULL,
	TSODDescription nvarchar(255) NULL,
	TSODCustom1 nvarchar(30) NULL,
	TSODCustom2 nvarchar(30) NULL,
	TSODCustom3 nvarchar(30) NULL,
	TSODCustom4 nvarchar(255) NULL,
	TSODCustom5 nvarchar(255) NULL,
	TSODVerifyStatus smallint NULL,
	TSODStartDate datetime NULL,
	TSODFinishDate datetime NULL,
	TSODTSOTCode nvarchar(50) NULL,
	TSODInvoiceStatus smallint NULL,
	TSODDeliveryStatus smallint NULL,
	TSODCreateCode nvarchar(30) NULL,
	TSODCreateBy nvarchar(140) NULL,
	TSODCreateDate datetime NULL,
	TSODEditCode nvarchar(30) NULL,
	TSODEditBy nvarchar(140) NULL,
	TSODEditDate datetime NULL,
	TSODConfirmStatus smallint NULL,
	TSODConfirmBy nvarchar(140) NULL,
	TSODConfirmDate datetime NULL,
	TSODApproveStatus smallint NULL,
	TSODApproveBy nvarchar(140) NULL,
	TSODApproveDate datetime NULL,
	TSODApproveNote nvarchar(80) NULL,
	TSODRevision smallint NULL,
	TSODReviseBy nvarchar(140) NULL,
	TSODCancelStatus smallint NULL,
	TSODCancelNo nvarchar(30) NULL,
	TSODCancelBy nvarchar(140) NULL,
	TSODCancelDate datetime NULL,
	TSODCancelNote nvarchar(80) NULL,
	TSODFlag1 smallint NULL,
	TSODFlag2 smallint NULL,
	TSODFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TSO ADD CONSTRAINT
	PK_VS4TSO PRIMARY KEY CLUSTERED 
	(
	TSODNo
	) ON [PRIMARY]

GO

CREATE TABLE VS4TSOMB
	(
	TSOBTSODNo nvarchar(30) NOT NULL,
	TSOBLn int NOT NULL,
	TSOBType smallint NULL,
	TSOBJobCode nvarchar(30) NULL,
	TSOBGroupName nvarchar(30) NULL,
	TSOBTOInCode nvarchar(50) NULL,
	TSOBTPOSCode nvarchar(50) NULL,
	TSOBCustom1 nvarchar(30) NULL,
	TSOBCustom2 nvarchar(30) NULL,
	TSOBCustom3 nvarchar(30) NULL,
	TSOBCustom4 nvarchar(30) NULL,
	TSOBCustom5 nvarchar(30) NULL,
	TSOBShippingMark nvarchar(255) NULL,
	TSOBPOSCode nvarchar(30) NULL,
	TSOBFactoryCode nvarchar(30) NULL,
	TSOBPOSName nvarchar(150) NULL,
	TSOBOLDPOSName nvarchar(150) NULL,
	TSOBCost money NULL,
	TSOBPremiumCost money NULL,
	TSOBPrice money NULL,
	TSOBPerQuantity float(53) NULL,
	TSOBUnitFactor float(53) NULL,
	TSOBQuantityCalc float(53) NULL,
	TSOBUnitCalc smallint NULL,
	TSOBAcceptError nvarchar(30) NULL,
	TSOBQuantityText nvarchar(255) NULL,
	TSOBQuantity float(53) NULL,
	TSOBTUntCode nvarchar(50) NULL,
	TSOBQuantity2 float(53) NULL,
	TSOBTUntCode2 nvarchar(50) NULL,
	TSOBQuantity3 float(53) NULL,
	TSOBTUntCode3 nvarchar(50) NULL,
	TSOBCostAmount float(53) NULL,
	TSOBAmount float(53) NULL,
	TSOBDiscountText nvarchar(30) NULL,
	TSOBDiscountTotal money NULL,
	TSOBNetAmount money NULL,
	TSOBTaxType smallint NULL,
	TSOBTaxBase money NULL,
	TSOBWTAXBase money NULL,
	TSOBAmountVAT money NULL,
	TSOBAmountWTAX money NULL,
	TSOBPromotionType nvarchar(15) NULL,
	TSOBFreeCode nvarchar(30) NULL,
	TSOBIsPremium float(53) NULL,
	TSOBDescription nvarchar(255) NULL,
	TSOBUseDate datetime NULL,
	TSOBSourceNo nvarchar(30) NULL,
	TSOBSourceLn int NULL,
	TSOBTIvoNo nvarchar(100) NULL,
	TSOBTotalDelivery float(53) NULL,
	TSOBTotalDelivery2 float(53) NULL,
	TSOBTotalDelivery3 float(53) NULL,
	TSOBTotalArrear float(53) NULL,
	TSOBTotalArrear2 float(53) NULL,
	TSOBTotalArrear3 float(53) NULL,
	TSOBTotalJob float(53) NULL,
	TSOBTotalJob2 float(53) NULL,
	TSOBTotalJob3 float(53) NULL,
	TSOBTotalJobArr float(53) NULL,
	TSOBTotalJobArr2 float(53) NULL,
	TSOBTotalJobArr3 float(53) NULL,
	TSOBDayProcess smallint NULL,
	TSOBTLctCode nvarchar(30) NULL,
	TSOBFG float(53) NULL,
	TSOBJobRequest float(53) NULL,
	TSOBRequestDate datetime NULL,
	TSOBReadyDate datetime NULL,
	TSOBStatus smallint NULL,
	TSOBManualClose smallint NULL,
	TSOBFlag1 smallint NULL,
	TSOBFlag2 smallint NULL,
	TSOBFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TSOMB ADD CONSTRAINT
	PK_VS4TSOMB PRIMARY KEY CLUSTERED 
	(
	TSOBTSODNo,
	TSOBLn
	) ON [PRIMARY]

GO

CREATE TABLE VS4TSODelivery
	(
	TMDSTSOBTSODNo nvarchar(30) NOT NULL,
	TMDSTSOBLn int NOT NULL,
	TMDSLn int NOT NULL,
	TMDSProductCode nvarchar(30) NULL,
	TMDSProductName nvarchar(250) NULL,
	TMDSCustom1 nvarchar(30) NULL,
	TMDSCustom2 nvarchar(30) NULL,
	TMDSCustom3 nvarchar(30) NULL,
	TMDSCustom4 nvarchar(30) NULL,
	TMDSCustom5 nvarchar(30) NULL,
	TMDSDate datetime NULL,
	TMDSDateTime datetime NULL,
	TMDSQuantity float(53) NULL,
	TMDSQuantity2 float(53) NULL,
	TMDSQuantity3 float(53) NULL,
	TMDSUnitCode nvarchar(15) NULL,
	TMDSUnitCode2 nvarchar(15) NULL,
	TMDSUnitCode3 nvarchar(15) NULL,
	TMDSTotalDelivery float(53) NULL,
	TMDSTotalDelivery2 float(53) NULL,
	TMDSTotalDelivery3 float(53) NULL,
	TMDSTotalArrear float(53) NULL,
	TMDSTotalArrear2 float(53) NULL,
	TMDSTotalArrear3 float(53) NULL,
	TMDSUnitCalc smallint NULL,
	TMDSMapTPdtCode nvarchar(30) NULL,
	TMDSMapTUntCode nvarchar(50) NULL,
	TMDSMapUnitRatio real NULL,
	TMDSQuantityBase float(53) NULL,
	TMDSDeliveryBase float(53) NULL,
	TMDSArrearBase float(53) NULL,
	TMDSTLctCode nvarchar(30) NULL,
	TMDSFlag1 smallint NULL,
	TMDSFlag2 smallint NULL,
	TMDSFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TSODelivery ADD CONSTRAINT
	PK_VS4TSODelivery PRIMARY KEY CLUSTERED 
	(
	TMDSTSOBTSODNo,
	TMDSTSOBLn,
	TMDSLn
	) ON [PRIMARY]

GO

CREATE TABLE VS4TState
	(
	TStaCode nvarchar(2) NOT NULL,
	TStaName nvarchar(50) NULL,
	TStaName2 nvarchar(50) NULL,
	TStaPhoneCode nvarchar(3) NULL,
	TStaTCouCode nvarchar(30) NULL,
	TStaFlag1 smallint NULL,
	TStaFlag2 smallint NULL,
	TStaFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TState ADD CONSTRAINT
	PK_VS4TState PRIMARY KEY CLUSTERED 
	(
	TStaCode
	) ON [PRIMARY]

GO

CREATE TABLE VS4TUser
	(
	TUsrID int NOT NULL,
	TUsrName nvarchar(30) NULL,
	TUsrPassword nvarchar(50) NULL,
	TUsrTEmpCode nvarchar(30) NULL,
	TUsrFullName nvarchar(160) NULL,
	TUsrDescription nvarchar(255) NULL,
	TUsrMobile nvarchar(30) NULL,
	TUsrDisable smallint NULL,
	TUsrSecurity smallint NULL,
	TUsrLevel smallint NULL,
	TUsrGroupware nvarchar(50) NULL,
	TUsrOwner int NULL,
	TUsrFlag1 smallint NULL,
	TUsrFlag2 smallint NULL,
	TUsrFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TUser ADD CONSTRAINT
	PK_VS4TUser PRIMARY KEY CLUSTERED 
	(
	TUsrID
	) ON [PRIMARY]

GO

CREATE TABLE VS4TSystem
	(
	TSysID int NOT NULL,
	TSysTSyGAlias nvarchar(30) NULL,
	TSysName nvarchar(100) NULL,
	TSysName2 nvarchar(100) NULL,
	TSysType smallint NULL,
	TSysText nvarchar(255) NULL,
	TSysValue float(53) NULL,
	TSysDecimal smallint NULL,
	TSysLock smallint NULL,
	TSysFlag1 smallint NULL,
	TSysFlag2 smallint NULL,
	TSysFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TSystem ADD CONSTRAINT
	PK_VS4TSystem PRIMARY KEY CLUSTERED 
	(
	TSysID
	) ON [PRIMARY]

GO

CREATE TABLE VS4TSystemUser
	(
	TSyUID int NOT NULL,
	TSyUUserID int NULL,
	TSyUName nvarchar(100) NULL,
	TSyUName2 nvarchar(100) NULL,
	TSyUType smallint NULL,
	TSyUText nvarchar(255) NULL,
	TSyUValue float(53) NULL,
	TSyUDecimal smallint NULL,
	TSyULock smallint NULL,
	TSyUFlag1 smallint NULL,
	TSyUFlag2 smallint NULL,
	TSyUFlag3 smallint NULL
	)  ON [PRIMARY]
GO
ALTER TABLE VS4TSystemUser ADD CONSTRAINT
	PK_VS4TSystemUser PRIMARY KEY CLUSTERED 
	(
	TSyUID
	) ON [PRIMARY]

GO