CREATE TABLE VS4TAPInvoiceP(
	TIAPNo nvarchar(30) NOT NULL,
	TIAPBalanceFlag tinyint NULL,
	TIAPType smallint NULL,
	TIAPTPBKCode nvarchar(30) NULL,
	TIAPTPCACode nvarchar(30) NULL,
	TIAPMode smallint NULL,
	TIAPDate datetime NULL,
	TIAPLoadingDate datetime NULL,
	TIAPStartAgingDate datetime NULL,
	TIAPDueDate datetime NULL,
	TIAPGLMethod smallint NULL,
	TIAPTGLTNo nvarchar(30) NULL,
	TIAPClientTaxNo nvarchar(30) NULL,
	TIAPBranchCode nvarchar(30) NULL,
	TIAPBranchName nvarchar(150) NULL,
	TIAPTaxNo nvarchar(30) NULL,
	TIAPRefNo nvarchar(30) NULL,
	TIAPRefDate datetime NULL,
	TIAPRefNo2 nvarchar(30) NULL,
	TIAPRefDate2 datetime NULL,
	TIAPRefNo3 nvarchar(30) NULL,
	TIAPRefNo4 nvarchar(60) NULL,
	TIAPPONo nvarchar(30) NULL,
	TIAPSOCode nvarchar(30) NULL,
	TIAPJobCode nvarchar(30) NULL,
	TIAPTJobNo nvarchar(30) NULL,
	TIAPTJbMLn int NULL,
	TIAPTPrjCode nvarchar(30) NULL,
	TIAPTBraCode nvarchar(30) NULL,
	TIAPDeliveryDate datetime NULL,
	TIAPDeliveryTo nvarchar(255) NULL,
	TIAPTAPNCode nvarchar(30) NULL,
	TIAPTAPUCode nvarchar(30) NULL,
	TIAPContactNote nvarchar(100) NULL,
	TIAPContactName nvarchar(160) NULL,
	TIAPSupplierName nvarchar(200) NULL,
	TIAPSupAddress nvarchar(255) NULL,
	TIAPConsignee nvarchar(255) NULL,
	TIAPNotifyParty nvarchar(255) NULL,
	TIAPPriceChannel smallint NULL,
	TIAPDiscountList money NULL,
	TIAPSubTotal money NULL,
	TIAPDiscountText nvarchar(30) NULL,
	TIAPDiscountTotal money NULL,
	TIAPNetTotal money NULL,
	TIAPDepositText nvarchar(30) NULL,
	TIAPDeposit money NULL,
	TIAPTotal money NULL,
	TIAPTotalFOB money NULL,
	TIAPTCurCode nvarchar(5) NULL,
	TIAPExchangeRate float NULL,
	TIAPTotalInRate money NULL,
	TIAPVATType smallint NULL,
	TIAPVATRate real NULL,
	TIAPTaxBase money NULL,
	TIAPVATTotal money NULL,
	TIAPGrandTotal money NULL,
	TIAPNOTAXTotal money NULL,
	TIAPWTaxBase money NULL,
	TIAPWTaxRate real NULL,
	TIAPWTaxTotal money NULL,
	TIAPWTaxBase2 money NULL,
	TIAPWTaxRate2 real NULL,
	TIAPWTaxTotal2 money NULL,
	TIAPExciseBase money NULL,
	TIAPExciseRate real NULL,
	TIAPExciseTotal money NULL,
	TIAPLastPayDate datetime NULL,
	TIAPNetPayment money NULL,
	TIAPManualArrear tinyint NULL,
	TIAPBaseArrears money NULL,
	TIAPArrears money NULL,
	TIAPIgnoreArrears smallint NULL,
	TIAPAdjustTotal money NULL,
	TIAPBaseAVailable money NULL,
	TIAPAVailable money NULL,
	TIAPPremiumTotal money NULL,
	TIAPBaseIncoType nvarchar(3) NULL,
	TIAPIncoType nvarchar(3) NULL,
	TIAPIncoterms nvarchar(50) NULL,
	TIAPOtherFee money NULL,
	TIAPTransportFee money NULL,
	TIAPHandlingFee money NULL,
	TIAPFreightFee money NULL,
	TIAPInsurance money NULL,
	TIAPTransportDesc money NULL,
	TIAPDuty money NULL,
	TIAPShipBy nvarchar(255) NULL,
	TIAPCountryOrigin nvarchar(50) NULL,
	TIAPDestination nvarchar(255) NULL,
	TIAPCondition nvarchar(100) NULL,
	TIAPConditionType smallint NULL,
	TIAPConditionDay smallint NULL,
	TIAPCondition1 real NULL,
	TIAPConditionDay1 smallint NULL,
	TIAPTShpCode nvarchar(30) NULL,
	TIAPDayAvailable smallint NULL,
	TIAPPaymentNote nvarchar(200) NULL,
	TIAPStatementNote nvarchar(200) NULL,
	TIAPDeliveryNote nvarchar(200) NULL,
	TIAPPackingNote nvarchar(200) NULL,
	TIAPNote nvarchar(255) NULL,
	TIAPDescription nvarchar(4000) NULL,
	TIAPCustom1 nvarchar(30) NULL,
	TIAPCustom2 nvarchar(30) NULL,
	TIAPCustom3 nvarchar(30) NULL,
	TIAPCustom4 nvarchar(255) NULL,
	TIAPCustom5 nvarchar(255) NULL,
	TIAPCustomNo nvarchar(30) NULL,
	TIAPCustomDate datetime NULL,
	TIAPTPOTCode nvarchar(50) NULL,
	TIAPDeliveryStatus smallint NULL,
	TIAPBillStatus smallint NULL,
	TIAPCardFlag smallint NULL,
	TIAPTaxFlag smallint NULL,
	TIAPReceiptStatus smallint NULL,
	TIAPInvoiceStatus smallint NULL,
	TIAPCNStatus smallint NULL,
	TIAPStockMode smallint NULL,
	TIAPCreateBy nvarchar(140) NULL,
	TIAPCreateDate datetime NULL,
	TIAPEditCode nvarchar(30) NULL,
	TIAPEditBy nvarchar(140) NULL,
	TIAPEditDate datetime NULL,
	TIAPConfirmStatus smallint NULL,
	TIAPConfirmBy nvarchar(140) NULL,
	TIAPConfirmDate datetime NULL,
	TIAPApproveStatus smallint NULL,
	TIAPApproveBy nvarchar(140) NULL,
	TIAPApproveDate datetime NULL,
	TIAPApproveNote nvarchar(80) NULL,
	TIAPRevision smallint NULL,
	TIAPCancelStatus smallint NULL,
	TIAPCancelBy nvarchar(140) NULL,
	TIAPCancelDate datetime NULL,
	TIAPCancelNote nvarchar(80) NULL,
	TIAPFlag1 smallint NULL,
	TIAPFlag2 smallint NULL,
	TIAPFlag3 datetime NULL
) ON [PRIMARY]
GO
ALTER TABLE VS4TAPInvoiceP ADD CONSTRAINT
	PK_VS4TAPInvoiceP PRIMARY KEY CLUSTERED 
	(
	TIAPNo
	) ON [PRIMARY]

GO
