# ---------- MdbToMySQL XP 0.9 MySQL IMPORT FROM `D:\MyPrgs\Vision4\BizSol1\DataSample\DataRC\Data\VS4Database.mdb` ----------


# ---------- DROP TABLE `VS4TACChart` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TACChart`;

# ---------- CREATE TABLE `VS4TACChart` ----------

CREATE TABLE `VS4TACChart` (
	`TACCCode` VARCHAR(30) NOT NULL,
	`TACCName` VARCHAR(100) NULL,
	`TACCName2` VARCHAR(100) NULL,
	`TACCTACGCode` VARCHAR(30) NULL,
	`TACCTAGsCode` VARCHAR(30) NULL,
	`TACCPLTAGsCode` VARCHAR(30) NULL,
	`TACCTBraCode` VARCHAR(30) NULL,
	`TACCParentTACCCode` VARCHAR(30) NULL,
	`TACCLevel` SMALLINT NULL,
	`TACCACType` INT NULL,
	`TACCCashFlowGroup` SMALLINT NULL,
	`TACCCashFlowUPDN` INT NULL,
	`TACCIsControl` SMALLINT NULL,
	`TACCIsSpecial` SMALLINT NULL,
	`TACCShowReport` SMALLINT NULL,
	`TACCReverseSign` SMALLINT NULL,
	`TACCReportCaption` VARCHAR(20) NULL,
	`TACCLastBalDate` DATETIME NULL,
	`TACCCreateCode` VARCHAR(30) NULL,
	`TACCCreateDate` DATETIME NULL,
	`TACCEditCode` VARCHAR(30) NULL,
	`TACCEditDate` DATETIME NULL,
	`TACCTextSort` VARCHAR(30) NULL,
	`TACCFlag1` SMALLINT NULL,
	`TACCFlag2` SMALLINT NULL,
	`TACCFlag3` SMALLINT NULL,
	PRIMARY KEY (`TACCCode`),
	KEY `VS4TACGroupSubVS4TACChart` (`TACCTAGsCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAccountMap` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAccountMap`;

# ---------- CREATE TABLE `VS4TAccountMap` ----------

CREATE TABLE `VS4TAccountMap` (
	`TACMAlias` VARCHAR(30) NOT NULL,
	`TACMMode` SMALLINT NULL DEFAULT '0',
	`TACMTACCCode` VARCHAR(30) NULL,
	`TACMFlag1` SMALLINT NULL DEFAULT '0',
	`TACMFlag2` SMALLINT NULL DEFAULT '0',
	`TACMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TACMAlias`),
	KEY `TACMTACCCode` (`TACMTACCCode`),
	KEY `VS4TACChartVS4TAccountMap` (`TACMTACCCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAccountPeriod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAccountPeriod`;

# ---------- CREATE TABLE `VS4TAccountPeriod` ----------

CREATE TABLE `VS4TAccountPeriod` (
	`TACPTACYID` INT NOT NULL DEFAULT '0',
	`TACPID` INT NOT NULL DEFAULT '0',
	`TACPStartDate` DATETIME NULL,
	`TACPEndDate` DATETIME NULL,
	`TACPFinishGoods` FLOAT NULL DEFAULT '0',
	`TACPWorkInProcess` FLOAT NULL DEFAULT '0',
	`TACPRawMaterials` FLOAT NULL DEFAULT '0',
	`TACPAssets` FLOAT NULL DEFAULT '0',
	`TACPLiabilities` FLOAT NULL DEFAULT '0',
	`TACPCaptitals` FLOAT NULL DEFAULT '0',
	`TACPNetProfitLoss` FLOAT NULL DEFAULT '0',
	`TACPSumProfitLoss` FLOAT NULL DEFAULT '0',
	`TACPStatus` SMALLINT NULL DEFAULT '0',
	`TACPFlag1` SMALLINT NULL DEFAULT '0',
	`TACPFlag2` SMALLINT NULL DEFAULT '0',
	`TACPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TACPTACYID`, `TACPID`),
	KEY `TACPID` (`TACPTACYID`),
	KEY `TACPNo` (`TACPID`),
	KEY `VS4TAccountYearVS4TAccountPeriod` (`TACPTACYID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAccountSet` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAccountSet`;

# ---------- CREATE TABLE `VS4TAccountSet` ----------

CREATE TABLE `VS4TAccountSet` (
	`TACSCode` VARCHAR(30) NOT NULL,
	`TACSMode` SMALLINT NULL DEFAULT '0',
	`TACSName` VARCHAR(50) NULL,
	`TACSName2` VARCHAR(50) NULL,
	`TACSTACCCode` VARCHAR(30) NULL,
	`TACSPurTACCCode` VARCHAR(30) NULL,
	`TACSSaleTACCCode` VARCHAR(30) NULL,
	`TACSIMTACCCode` VARCHAR(30) NULL,
	`TACSEXTACCCode` VARCHAR(30) NULL,
	`TACSCNTACCCode` VARCHAR(30) NULL,
	`TACSPCNTACCCode` VARCHAR(30) NULL,
	`TACSCOSTACCCode` VARCHAR(30) NULL,
	`TACSPROPTACCCode` VARCHAR(30) NULL,
	`TACSPROATACCCode` VARCHAR(30) NULL,
	`TACSDiscTACCCode` VARCHAR(30) NULL,
	`TACSFlag1` SMALLINT NULL DEFAULT '0',
	`TACSFlag2` SMALLINT NULL DEFAULT '0',
	`TACSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TACSCode`),
	KEY `ProductMemberCategoryID` (`TACSFlag1`),
	KEY `ProductMemberProductID1` (`TACSName`),
	KEY `TACSCOSTACCCode` (`TACSPROPTACCCode`),
	KEY `TACSCOSTACCCode1` (`TACSPROATACCCode`),
	KEY `TPd2CNTACCCode` (`TACSCNTACCCode`),
	KEY `TPd2COSTACCCode` (`TACSCOSTACCCode`),
	KEY `TPd2EXTACCCode` (`TACSEXTACCCode`),
	KEY `TPd2IMTACCCode` (`TACSIMTACCCode`),
	KEY `TPd2PCNTACCCode` (`TACSPCNTACCCode`),
	KEY `TPdGCode` (`TACSCode`),
	KEY `TPdGFlag1` (`TACSFlag2`),
	KEY `TPdGFlag11` (`TACSFlag3`),
	KEY `TPdLName` (`TACSName2`),
	KEY `TPdLTAccCode` (`TACSTACCCode`),
	KEY `TPG1PurTACCCode` (`TACSPurTACCCode`),
	KEY `TPG1SaleTACCCode` (`TACSSaleTACCCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAccountSetMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAccountSetMB`;

# ---------- CREATE TABLE `VS4TAccountSetMB` ----------

CREATE TABLE `VS4TAccountSetMB` (
	`TACMTACSCode` VARCHAR(30) NOT NULL,
	`TACMBookCode` VARCHAR(30) NOT NULL,
	`TACMPayType` INT NOT NULL,
	`TACMMode` SMALLINT NULL DEFAULT '0',
	`TACMName` VARCHAR(50) NULL,
	`TACMName2` VARCHAR(50) NULL,
	`TACMTACCCode` VARCHAR(30) NULL,
	`TACMPurTACCCode` VARCHAR(30) NULL,
	`TACMSaleTACCCode` VARCHAR(30) NULL,
	`TACMIMTACCCode` VARCHAR(30) NULL,
	`TACMEXTACCCode` VARCHAR(30) NULL,
	`TACMCNTACCCode` VARCHAR(30) NULL,
	`TACMPCNTACCCode` VARCHAR(30) NULL,
	`TACMCOSTACCCode` VARCHAR(30) NULL,
	`TACMPROPTACCCode` VARCHAR(30) NULL,
	`TACMPROATACCCode` VARCHAR(30) NULL,
	`TACMDiscTACCCode` VARCHAR(30) NULL,
	`TACMFlag1` SMALLINT NULL DEFAULT '0',
	`TACMFlag2` SMALLINT NULL DEFAULT '0',
	`TACMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TACMTACSCode`, `TACMBookCode`, `TACMPayType`),
	KEY `ProductMemberCategoryID` (`TACMFlag1`),
	KEY `ProductMemberProductID1` (`TACMName`),
	KEY `TACSBookCode` (`TACMBookCode`),
	KEY `TACSCOSTACCCode` (`TACMPROPTACCCode`),
	KEY `TACSCOSTACCCode1` (`TACMPROATACCCode`),
	KEY `TPd2CNTACCCode` (`TACMCNTACCCode`),
	KEY `TPd2COSTACCCode` (`TACMCOSTACCCode`),
	KEY `TPd2EXTACCCode` (`TACMEXTACCCode`),
	KEY `TPd2IMTACCCode` (`TACMIMTACCCode`),
	KEY `TPd2PCNTACCCode` (`TACMPCNTACCCode`),
	KEY `TPdGCode` (`TACMTACSCode`),
	KEY `TPdGFlag1` (`TACMFlag2`),
	KEY `TPdGFlag11` (`TACMFlag3`),
	KEY `TPdLName` (`TACMName2`),
	KEY `TPdLTAccCode` (`TACMTACCCode`),
	KEY `TPG1PurTACCCode` (`TACMPurTACCCode`),
	KEY `TPG1SaleTACCCode` (`TACMSaleTACCCode`),
	KEY `VS4TAccountSetVS4TAccountSetMB` (`TACMTACSCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAccountYear` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAccountYear`;

# ---------- CREATE TABLE `VS4TAccountYear` ----------

CREATE TABLE `VS4TAccountYear` (
	`TACYID` INT NOT NULL DEFAULT '0',
	`TACYStartDate` DATETIME NULL,
	`TACYEndDate` DATETIME NULL,
	`TACYFinishGoods` FLOAT NULL DEFAULT '0',
	`TACYWorkInProcess` FLOAT NULL DEFAULT '0',
	`TACYRawMaterials` FLOAT NULL DEFAULT '0',
	`TACYAssets` FLOAT NULL DEFAULT '0',
	`TACYLiabilities` FLOAT NULL DEFAULT '0',
	`TACYCaptitals` FLOAT NULL DEFAULT '0',
	`TACYNetProfitLoss` FLOAT NULL DEFAULT '0',
	`TACYSumProfitLoss` FLOAT NULL DEFAULT '0',
	`TACYFlag1` SMALLINT NULL DEFAULT '0',
	`TACYFlag2` SMALLINT NULL DEFAULT '0',
	`TACYFlag3` SMALLINT NULL DEFAULT '0',
	UNIQUE KEY `TACYID` (`TACYID`),
	KEY `Index_B0D14894_767D_4A78` (`TACYID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TACFormat` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TACFormat`;

# ---------- CREATE TABLE `VS4TACFormat` ----------

CREATE TABLE `VS4TACFormat` (
	`TACFCode` VARCHAR(30) NOT NULL,
	`TACFMode` SMALLINT NULL DEFAULT '0',
	`TACFName` VARCHAR(50) NULL,
	`TACFName2` VARCHAR(50) NULL,
	`TACFFlag1` SMALLINT NULL DEFAULT '0',
	`TACFFlag2` SMALLINT NULL DEFAULT '0',
	`TACFFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TACFCode`),
	KEY `ProductMemberCategoryID` (`TACFFlag1`),
	KEY `ProductMemberProductID1` (`TACFName`),
	KEY `TPdGCode` (`TACFCode`),
	KEY `TPdGFlag1` (`TACFFlag2`),
	KEY `TPdGFlag11` (`TACFFlag3`),
	KEY `TPdLName` (`TACFName2`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TACFormatMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TACFormatMB`;

# ---------- CREATE TABLE `VS4TACFormatMB` ----------

CREATE TABLE `VS4TACFormatMB` (
	`TAFMTACFCode` VARCHAR(30) NOT NULL,
	`TAFMLn` INT NOT NULL,
	`TAFMTACCCode` VARCHAR(30) NULL,
	`TACFName2` VARCHAR(50) NULL,
	`TAFMIsDebit` SMALLINT NULL,
	`TAFMPC` SMALLINT NULL DEFAULT '0',
	`TAFMPattern` VARCHAR(255) NULL,
	`TAFMFlag1` SMALLINT NULL DEFAULT '0',
	`TAFMFlag2` SMALLINT NULL DEFAULT '0',
	`TAFMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAFMTACFCode`, `TAFMLn`),
	KEY `ProductMemberCategoryID` (`TAFMFlag1`),
	KEY `ProductMemberProductID1` (`TAFMTACCCode`),
	KEY `TACTACCCode` (`TAFMPattern`),
	KEY `TPdGCode` (`TAFMTACFCode`),
	KEY `TPdGFlag1` (`TAFMFlag2`),
	KEY `TPdGFlag11` (`TAFMFlag3`),
	KEY `VS4TACChartVS4TACFormatMB` (`TAFMTACCCode`),
	KEY `VS4TACFormatVS4TACFormatMB` (`TAFMTACFCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TACGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TACGroup`;

# ---------- CREATE TABLE `VS4TACGroup` ----------

CREATE TABLE `VS4TACGroup` (
	`TACGCode` VARCHAR(30) NOT NULL,
	`TACGName` VARCHAR(100) NULL,
	`TACGName2` VARCHAR(100) NULL,
	`TACGAccountCode` VARCHAR(30) NULL,
	`TACGSysName` VARCHAR(100) NULL,
	`TACGSysName2` VARCHAR(100) NULL,
	`TACGTextSort` VARCHAR(30) NULL,
	`TACGFlag1` SMALLINT NULL DEFAULT '0',
	`TACGFlag2` SMALLINT NULL DEFAULT '0',
	`TACGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TACGCode`),
	KEY `TAGsSysName` (`TACGSysName`),
	KEY `TBnkCode` (`TACGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TACGroupSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TACGroupSub`;

# ---------- CREATE TABLE `VS4TACGroupSub` ----------

CREATE TABLE `VS4TACGroupSub` (
	`TAGsCode` VARCHAR(30) NOT NULL,
	`TAGsAccountCode` VARCHAR(30) NULL,
	`TAGsName` VARCHAR(100) NULL,
	`TAGsName2` VARCHAR(100) NULL,
	`TAGsTACGCode` VARCHAR(30) NULL,
	`TAGsSysName` VARCHAR(100) NULL,
	`TAGsSysName2` VARCHAR(100) NULL,
	`TAGsSort` SMALLINT NULL DEFAULT '0',
	`TAGsFlag1` SMALLINT NULL DEFAULT '0',
	`TAGsFlag2` SMALLINT NULL DEFAULT '0',
	`TAGsFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAGsCode`),
	KEY `TACCName` (`TAGsName`),
	KEY `TAGsName` (`TAGsSysName`),
	KEY `VS4TACGroupVS4TACGroupSub` (`TAGsTACGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAirline` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAirline`;

# ---------- CREATE TABLE `VS4TAirline` ----------

CREATE TABLE `VS4TAirline` (
	`TAIRCode` VARCHAR(5) NOT NULL,
	`TAIRName` VARCHAR(100) NULL,
	`TAIRName2` VARCHAR(100) NULL,
	`TAIRDocNo` VARCHAR(5) NULL,
	`TAIRVAT` DOUBLE NULL,
	`TAIRFlag1` SMALLINT NULL,
	`TAIRFlag2` SMALLINT NULL,
	`TAIRFlag3` SMALLINT NULL,
	PRIMARY KEY (`TAIRCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAllocate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAllocate`;

# ---------- CREATE TABLE `VS4TAllocate` ----------

CREATE TABLE `VS4TAllocate` (
	`TAolCode` VARCHAR(30) NOT NULL,
	`TAolName` VARCHAR(100) NULL,
	`TAolName2` VARCHAR(100) NULL,
	`TAolDocCode` VARCHAR(30) NULL,
	`TAolMode` SMALLINT NULL DEFAULT '0',
	`TAolFlag1` SMALLINT NULL DEFAULT '0',
	`TAolFlag2` SMALLINT NULL DEFAULT '0',
	`TAolFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAolCode`),
	KEY `TBnkCode` (`TAolCode`),
	KEY `TPrjDocCode` (`TAolDocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAP` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAP`;

# ---------- CREATE TABLE `VS4TAP` ----------

CREATE TABLE `VS4TAP` (
	`TAPNCode` VARCHAR(30) NOT NULL,
	`TAPNTCmpCode` VARCHAR(30) NULL,
	`TAPNTAPTCode` VARCHAR(30) NULL,
	`TAPNIntro` VARCHAR(50) NULL,
	`TAPNName` VARCHAR(200) NULL,
	`TAPNName2` VARCHAR(200) NULL,
	`TAPNIntroName` VARCHAR(200) NULL,
	`TAPNType` SMALLINT NULL DEFAULT '0',
	`TAPNTBsTCode` VARCHAR(30) NULL,
	`TAPNOwnerName` VARCHAR(160) NULL,
	`TAPNDocCode` VARCHAR(30) NULL,
	`TAPNContactName` VARCHAR(160) NULL,
	`TAPNTaxNo` VARCHAR(30) NULL,
	`TAPNAccountCode` VARCHAR(30) NULL,
	`TAPNTAPGCode` VARCHAR(30) NULL,
	`TAPNTAPCCode` VARCHAR(50) NULL,
	`TAPNAddressBill` VARCHAR(255) NULL,
	`TAPNAddressDeliver` VARCHAR(255) NULL,
	`TAPNAddress` VARCHAR(200) NULL,
	`TAPNSubProvince` VARCHAR(50) NULL,
	`TAPNCity` VARCHAR(50) NULL,
	`TAPNPostalCode` VARCHAR(5) NULL,
	`TAPNStaCode` VARCHAR(3) NULL,
	`TAPNTCouCode` VARCHAR(3) NULL,
	`TAPNWebsite` VARCHAR(100) NULL,
	`TAPNEmail` VARCHAR(50) NULL,
	`TAPNPhone` VARCHAR(100) NULL,
	`TAPNFax` VARCHAR(50) NULL,
	`TAPNImage1` VARCHAR(50) NULL,
	`TAPNDiscountPC` DOUBLE NULL DEFAULT '0',
	`TAPNDiscountDay` SMALLINT NULL DEFAULT '0',
	`TAPNCreditDay` SMALLINT NULL DEFAULT '0',
	`TAPNConditionType` SMALLINT NULL DEFAULT '0',
	`TAPNLimitTCurCode` VARCHAR(15) NULL,
	`TAPNSpecialTaxRate` DOUBLE NULL DEFAULT '0',
	`TAPNPaymentNote` VARCHAR(255) NULL,
	`TAPNStatementNote` VARCHAR(255) NULL,
	`TAPNDeliveryNote` VARCHAR(255) NULL,
	`TAPNQualityScore` DOUBLE NULL DEFAULT '0',
	`TAPNDeliveryScore` DOUBLE NULL DEFAULT '0',
	`TAPNTotalScore` DOUBLE NULL DEFAULT '0',
	`TAPNTimeToOrder` INT NULL DEFAULT '0',
	`TAPNLastDueDate` DATETIME NULL,
	`TAPNLastOrderDate` DATETIME NULL,
	`TAPNMapFile` VARCHAR(50) NULL,
	`TAPNCreditUseBegin` FLOAT NULL DEFAULT '0',
	`TAPNCreditLimit` FLOAT NULL DEFAULT '0',
	`TAPNCreditUseBal` FLOAT NULL DEFAULT '0',
	`TAPNCreditUse` FLOAT NULL DEFAULT '0',
	`TAPNCreditBalance` FLOAT NULL DEFAULT '0',
	`TAPNCreditAvaiBal` FLOAT NULL DEFAULT '0',
	`TAPNBeginBalance` FLOAT NULL DEFAULT '0',
	`TAPNTotalOrderBal` INT NULL DEFAULT '0',
	`TAPNQualityBal` DOUBLE NULL DEFAULT '0',
	`TAPNDeliveryBal` DOUBLE NULL DEFAULT '0',
	`TAPNTotalScoreBal` DOUBLE NULL DEFAULT '0',
	`TAPNBillAdjust` SMALLINT NULL DEFAULT '0',
	`TAPNNote` VARCHAR(255) NULL,
	`TAPNCreateCode` VARCHAR(30) NULL,
	`TAPNCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPNEditCode` VARCHAR(30) NULL,
	`TAPNEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPNTextSort` VARCHAR(30) NULL,
	`TAPNFlag1` SMALLINT NULL DEFAULT '0',
	`TAPNFlag2` SMALLINT NULL DEFAULT '0',
	`TAPNFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPNCode`),
	KEY `TAPCCode` (`TAPNCode`),
	KEY `VS4TAPTypeVS4TAP` (`TAPNTAPTCode`),
	KEY `VS4TBusinessTypeVS4TAP` (`TAPNTBsTCode`),
	KEY `VS4TCountryVS4TAP` (`TAPNTCouCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAP2` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAP2`;

# ---------- CREATE TABLE `VS4TAP2` ----------

CREATE TABLE `VS4TAP2` (
	`TAP2TAPNCode` VARCHAR(30) NOT NULL,
	`TAP2Ln` INT NOT NULL DEFAULT '0',
	`TAP2CreditUseBegin` FLOAT NULL DEFAULT '0',
	`TAP2CreditLimit` FLOAT NULL DEFAULT '0',
	`TAP2CreditUseBal` FLOAT NULL DEFAULT '0',
	`TAP2CreditUse` FLOAT NULL DEFAULT '0',
	`TAP2CreditBalance` FLOAT NULL DEFAULT '0',
	`TAP2CreditAvaiBal` FLOAT NULL DEFAULT '0',
	`TAP2BeginBalance` FLOAT NULL DEFAULT '0',
	`TAP2TotalOrderBal` INT NULL DEFAULT '0',
	`TAP2DeliveryCond` SMALLINT NULL DEFAULT '0',
	`TAP2LastInvoice` VARCHAR(30) NULL,
	`TAP2LastReceive` VARCHAR(30) NULL,
	`TAP2Marks` VARCHAR(200) NULL,
	`TAP2Flag1` SMALLINT NULL DEFAULT '0',
	`TAP2Flag2` SMALLINT NULL DEFAULT '0',
	`TAP2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAP2TAPNCode`, `TAP2Ln`),
	KEY `TAPCCode` (`TAP2TAPNCode`),
	KEY `VS4TAPVS4TAP2` (`TAP2TAPNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPBalance` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPBalance`;

# ---------- CREATE TABLE `VS4TAPBalance` ----------

CREATE TABLE `VS4TAPBalance` (
	`TAPLTACPTACYID` INT NOT NULL DEFAULT '0',
	`TAPLTACPID` INT NOT NULL DEFAULT '0',
	`TAPLTAPNCode` VARCHAR(30) NOT NULL,
	`TAPLMode` INT NOT NULL DEFAULT '0',
	`TAPLQuarter` INT NULL DEFAULT '0',
	`TAPLCreditLimit` FLOAT NULL DEFAULT '0',
	`TAPLCreditUseBal` FLOAT NULL DEFAULT '0',
	`TAPLCreditUse` FLOAT NULL DEFAULT '0',
	`TAPLCreditBalance` FLOAT NULL DEFAULT '0',
	`TAPLCreditAvaiBal` FLOAT NULL DEFAULT '0',
	`TAPLBeginBalance` FLOAT NULL DEFAULT '0',
	`TAPLTotalOrderBal` INT NULL DEFAULT '0',
	`TAPLDisBill` FLOAT NULL DEFAULT '0',
	`TAPLTotalOrder` INT NULL DEFAULT '0',
	`TAPLTimeOrder` INT NULL DEFAULT '0',
	`TAPLCosTotal` FLOAT NULL DEFAULT '0',
	`TAPLInvGrandTotal` FLOAT NULL,
	`TAPLCNGrandTotal` FLOAT NULL,
	`TAPLDBGrandTotal` FLOAT NULL,
	`TAPLBillTotal` FLOAT NULL,
	`TAPLChequePayment` FLOAT NULL,
	`TAPLCashPayment` FLOAT NULL,
	`TAPLBankPayment` FLOAT NULL,
	`TAPLCardPayment` FLOAT NULL,
	`TAPLDisCash` FLOAT NULL DEFAULT '0',
	`TAPLAdjustTotal` FLOAT NULL DEFAULT '0',
	`TAPLInterestTotal` FLOAT NULL DEFAULT '0',
	`TAPLCutDeposit` FLOAT NULL DEFAULT '0',
	`TAPLFee` FLOAT NULL DEFAULT '0',
	`TAPLWtaxTotal` FLOAT NULL DEFAULT '0',
	`TAPLWtaxTotal2` FLOAT NULL DEFAULT '0',
	`TAPLPayLess` FLOAT NULL DEFAULT '0',
	`TAPLPayCoupon` FLOAT NULL DEFAULT '0',
	`TAPLPayOther` FLOAT NULL DEFAULT '0',
	`TAPLPayMisc` FLOAT NULL DEFAULT '0',
	`TAPLTotalPaid` FLOAT NULL DEFAULT '0',
	`TAPLTotalLate` FLOAT NULL DEFAULT '0',
	`TAPLEndBalance` FLOAT NULL DEFAULT '0',
	`TAPLFlag1` SMALLINT NULL DEFAULT '0',
	`TAPLFlag2` SMALLINT NULL DEFAULT '0',
	`TAPLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPLTACPTACYID`, `TAPLTACPID`, `TAPLTAPNCode`, `TAPLMode`),
	KEY `TARLMode` (`TAPLMode`),
	KEY `TARLQuarter` (`TAPLQuarter`),
	KEY `TGTMTACPID` (`TAPLTACPID`),
	KEY `TGTMTACPTACYID` (`TAPLTACPTACYID`),
	KEY `TGTMTGTSTACCCode` (`TAPLTAPNCode`),
	KEY `VS4TAccountPeriodVS4TAPBalance` (`TAPLTACPTACYID`, `TAPLTACPID`),
	KEY `VS4TAPVS4TAPBalance` (`TAPLTAPNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPBank` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPBank`;

# ---------- CREATE TABLE `VS4TAPBank` ----------

CREATE TABLE `VS4TAPBank` (
	`TAPBTAPNCode` VARCHAR(30) NOT NULL,
	`TAPBLn` INT NOT NULL DEFAULT '0',
	`TAPBTBBrCode` VARCHAR(30) NULL,
	`TAPBTBnkCode` VARCHAR(30) NULL,
	`TAPBAccountType` SMALLINT NULL DEFAULT '0',
	`TAPBAccountName` VARCHAR(100) NULL,
	`TAPBAccountNo` VARCHAR(30) NULL,
	`TAPBAccountBranch` VARCHAR(20) NULL,
	`TAPBDescription` VARCHAR(80) NULL,
	`TAPBFlag1` SMALLINT NULL DEFAULT '0',
	`TAPBFlag2` SMALLINT NULL DEFAULT '0',
	`TAPBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPBTAPNCode`, `TAPBLn`),
	KEY `TBAcTBBrID` (`TAPBTBBrCode`),
	KEY `TEmBID` (`TAPBLn`),
	KEY `TEmBTBnkCode` (`TAPBTBnkCode`),
	KEY `VS4TAPVS4TAPBank` (`TAPBTAPNCode`),
	KEY `VS4TBankVS4TAPBank` (`TAPBTBnkCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPBill` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPBill`;

# ---------- CREATE TABLE `VS4TAPBill` ----------

CREATE TABLE `VS4TAPBill` (
	`TPBINo` VARCHAR(30) NOT NULL,
	`TPBIDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPBIDueDate` DATETIME NULL,
	`TPBIRefNo` VARCHAR(30) NULL,
	`TPBIRefDate` DATETIME NULL,
	`TPBITBraCode` VARCHAR(30) NULL,
	`TPBITAPNCode` VARCHAR(30) NULL,
	`TPBIPayTo` VARCHAR(160) NULL,
	`TPBIAPAddress` VARCHAR(255) NULL,
	`TPBITGLBCode` VARCHAR(30) NULL,
	`TPBITPrjCode` VARCHAR(30) NULL,
	`TPBIGrandTotal` FLOAT NULL DEFAULT '0',
	`TPBINetPayment` FLOAT NULL DEFAULT '0',
	`TPBIArrears` FLOAT NULL DEFAULT '0',
	`TPBICommissionBase` FLOAT NULL DEFAULT '0',
	`TPBICommissionRate` DOUBLE NULL DEFAULT '0',
	`TPBICommission` FLOAT NULL DEFAULT '0',
	`TPBINote` VARCHAR(255) NULL,
	`TPBIFlagAPBill` INT NULL DEFAULT '0',
	`TPBICreateCode` VARCHAR(30) NULL,
	`TPBICreateBy` VARCHAR(140) NULL,
	`TPBICreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPBIEditCode` VARCHAR(30) NULL,
	`TPBIEditBy` VARCHAR(140) NULL,
	`TPBIEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPBIConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TPBIConfirmBy` VARCHAR(140) NULL,
	`TPBIConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPBIApproveStatus` SMALLINT NULL DEFAULT '0',
	`TPBIApproveBy` VARCHAR(140) NULL,
	`TPBIApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPBIApproveNote` VARCHAR(80) NULL,
	`TPBIRevision` SMALLINT NULL DEFAULT '0',
	`TPBICancelStatus` SMALLINT NULL DEFAULT '0',
	`TPBICancelNo` VARCHAR(30) NULL,
	`TPBICancelBy` VARCHAR(140) NULL,
	`TPBICancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPBICancelNote` VARCHAR(80) NULL,
	`TPBIFlag1` SMALLINT NULL DEFAULT '0',
	`TPBIFlag2` SMALLINT NULL DEFAULT '0',
	`TPBIFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPBINo`),
	KEY `TAPVNo` (`TPBINo`),
	KEY `TAPVTGLBCode` (`TPBITGLBCode`),
	KEY `TPBITARNCode` (`TPBITAPNCode`),
	KEY `TRVHTPrjCode` (`TPBITPrjCode`),
	KEY `VS4TAPVS4TAPBill` (`TPBITAPNCode`),
	KEY `VS4TProjectVS4TAPBill` (`TPBITPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPBillMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPBillMB`;

# ---------- CREATE TABLE `VS4TAPBillMB` ----------

CREATE TABLE `VS4TAPBillMB` (
	`TPBMTPBINo` VARCHAR(30) NOT NULL,
	`TPBMLn` INT NOT NULL DEFAULT '0',
	`TPBMType` SMALLINT NULL DEFAULT '0',
	`TPBMTIPJNo` VARCHAR(30) NULL,
	`TPBMTIPJDate` DATETIME NULL,
	`TPBMTIPJDueDate` DATETIME NULL,
	`TPBMCondition` VARCHAR(100) NULL,
	`TPBMTaxBase` FLOAT NULL DEFAULT '0',
	`TPBMTIPJGrandTotal` FLOAT NULL DEFAULT '0',
	`TPBMNetPayment` FLOAT NULL DEFAULT '0',
	`TPBMTIPJArrears` FLOAT NULL DEFAULT '0',
	`TPBMFlagAPInv` INT NULL DEFAULT '0',
	`TPBMRefNo` VARCHAR(30) NULL,
	`TPBMRefNo2` VARCHAR(30) NULL,
	`TPBMRefNo3` VARCHAR(30) NULL,
	`TPBMPONo` VARCHAR(30) NULL,
	`TPBMCommissionBase` FLOAT NULL DEFAULT '0',
	`TPBMCommissionRate` DOUBLE NULL DEFAULT '0',
	`TPBMCommission` FLOAT NULL DEFAULT '0',
	`TPBMFlag1` SMALLINT NULL DEFAULT '0',
	`TPBMFlag2` SMALLINT NULL DEFAULT '0',
	`TPBMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPBMLn`, `TPBMTPBINo`),
	KEY `TPWBID` (`TPBMLn`),
	KEY `TTfMID` (`TPBMTPBINo`),
	KEY `VS4TAPBillVS4TAPBillMB` (`TPBMTPBINo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPBranch` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPBranch`;

# ---------- CREATE TABLE `VS4TAPBranch` ----------

CREATE TABLE `VS4TAPBranch` (
	`TAPUTAPNCode` VARCHAR(30) NOT NULL,
	`TAPUCode` VARCHAR(30) NOT NULL,
	`TAPUName` VARCHAR(100) NULL,
	`TAPUAddress` VARCHAR(255) NULL,
	`TAPUPhone` VARCHAR(50) NULL,
	`TAPUFax` VARCHAR(50) NULL,
	`TAPUFullName` VARCHAR(255) NULL,
	`TAPUName2` VARCHAR(100) NULL,
	`TAPUAddress2` VARCHAR(255) NULL,
	`TAPUPhone2` VARCHAR(50) NULL,
	`TAPUFax2` VARCHAR(50) NULL,
	`TAPUFullName2` VARCHAR(255) NULL,
	`TAPUGPS` VARCHAR(30) NULL,
	`TAPUMapFile` VARCHAR(50) NULL,
	`TAPUMapFile2` VARCHAR(50) NULL,
	`TAPUTRouCode` VARCHAR(50) NULL,
	`TAPUDistance` DOUBLE NULL DEFAULT '0',
	`TAPUDeliveryHour` DOUBLE NULL DEFAULT '0',
	`TAPUTShpCode` VARCHAR(30) NULL,
	`TAPUDeliveryCond` SMALLINT NULL DEFAULT '0',
	`TAPUContactName` VARCHAR(160) NULL,
	`TAPUNote` VARCHAR(255) NULL,
	`TAPUFlag1` SMALLINT NULL DEFAULT '0',
	`TAPUFlag2` SMALLINT NULL DEFAULT '0',
	`TAPUFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPUTAPNCode`, `TAPUCode`),
	KEY `TAPCCode` (`TAPUTAPNCode`),
	KEY `TAR2TShpCode` (`TAPUTShpCode`),
	KEY `TARDContactName` (`TAPUContactName`),
	KEY `TARDNote` (`TAPUNote`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPBusinessType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPBusinessType`;

# ---------- CREATE TABLE `VS4TAPBusinessType` ----------

CREATE TABLE `VS4TAPBusinessType` (
	`TAPYTBsTCode` VARCHAR(30) NOT NULL,
	`TAPYTAPNCode` VARCHAR(30) NOT NULL,
	`TAPYFlag1` SMALLINT NULL DEFAULT '0',
	`TAPYFlag2` SMALLINT NULL DEFAULT '0',
	`TAPYFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPYTBsTCode`, `TAPYTAPNCode`),
	KEY `TBsTCode` (`TAPYTBsTCode`),
	KEY `VS4TAPVS4TAPBusinessType` (`TAPYTAPNCode`),
	KEY `VS4TBusinessTypeVS4TAPBusinessType` (`TAPYTBsTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPCampaign` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPCampaign`;

# ---------- CREATE TABLE `VS4TAPCampaign` ----------

CREATE TABLE `VS4TAPCampaign` (
	`TPCACode` VARCHAR(30) NOT NULL,
	`TPCATAPNCode` VARCHAR(30) NULL,
	`TPCAName` VARCHAR(100) NULL,
	`TPCAName2` VARCHAR(100) NULL,
	`TPCANote` VARCHAR(255) NULL,
	`TPCAStartDate` DATETIME NULL,
	`TPCAEndDate` DATETIME NULL,
	`TPCAEditDate` DATETIME NULL,
	`TPCATEmpCode` VARCHAR(30) NULL,
	`TPCATarget` FLOAT NULL DEFAULT '0',
	`TPCATotalPO` VARCHAR(50) NULL,
	`TPCAPOAuto` SMALLINT NULL DEFAULT '0',
	`TPCAFlag1` SMALLINT NULL DEFAULT '0',
	`TPCAFlag2` SMALLINT NULL DEFAULT '0',
	`TPCAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPCACode`),
	KEY `TBnkCode` (`TPCACode`),
	KEY `TEveTEmpCode` (`TPCATEmpCode`),
	KEY `TPCATAPNCode` (`TPCATAPNCode`),
	KEY `VS4TAPVS4TAPCampaign` (`TPCATAPNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPCampaignMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPCampaignMB`;

# ---------- CREATE TABLE `VS4TAPCampaignMB` ----------

CREATE TABLE `VS4TAPCampaignMB` (
	`TPCPTPCACode` VARCHAR(30) NOT NULL,
	`TPCPLn` SMALLINT NOT NULL DEFAULT '0',
	`TPCPName` VARCHAR(100) NULL,
	`TPCPName2` VARCHAR(100) NULL,
	`TPCPTarget` DOUBLE NULL DEFAULT '0',
	`TPCPPeriodDay` SMALLINT NULL,
	`TPCPQuantity` DOUBLE NULL DEFAULT '0',
	`TPCPPrice` DOUBLE NULL DEFAULT '0',
	`TPCPAmount` DOUBLE NULL DEFAULT '0',
	`TPCPNote` VARCHAR(255) NULL,
	`TPCPFlag1` SMALLINT NULL DEFAULT '0',
	`TPCPFlag2` SMALLINT NULL DEFAULT '0',
	`TPCPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPCPTPCACode`, `TPCPLn`),
	KEY `TBnkCode` (`TPCPTPCACode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPCard` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPCard`;

# ---------- CREATE TABLE `VS4TAPCard` ----------

CREATE TABLE `VS4TAPCard` (
	`TPICTAPNCode` VARCHAR(30) NOT NULL,
	`TPICDocNo` VARCHAR(30) NOT NULL,
	`TPICType` VARCHAR(2) NOT NULL,
	`TPICLn` INT NULL DEFAULT '0',
	`TPICTBraCode` VARCHAR(30) NULL,
	`TPICTPrjCode` VARCHAR(30) NULL,
	`TPICBalanceFlag` SMALLINT NULL,
	`TPICTACPTACYID` INT NULL DEFAULT '0',
	`TPICTACPID` INT NULL DEFAULT '0',
	`TPICDueDate` DATETIME NULL,
	`TPICDocDate` DATETIME NULL,
	`TPICTGLTNo` VARCHAR(30) NULL,
	`TPICTaxNo` VARCHAR(30) NULL,
	`TPICRefNo` VARCHAR(30) NULL,
	`TPICRefDate` DATETIME NULL,
	`TPICRefNo2` VARCHAR(30) NULL,
	`TPICRefDate2` DATETIME NULL,
	`TPICRefNo3` VARCHAR(30) NULL,
	`TPICTotalOrder` FLOAT NULL,
	`TPICCostTotal` FLOAT NULL DEFAULT '0',
	`TPICInvGrandTotal` FLOAT NULL,
	`TPICCNGrandTotal` FLOAT NULL,
	`TPICDBGrandTotal` FLOAT NULL,
	`TPICChequePayment` FLOAT NULL,
	`TPICCashPayment` FLOAT NULL,
	`TPICBankPayment` FLOAT NULL,
	`TPICCardPayment` FLOAT NULL,
	`TPICDiscountTotal` FLOAT NULL,
	`TPICAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPICInterestTotal` FLOAT NULL DEFAULT '0',
	`TPICCutDeposit` FLOAT NULL DEFAULT '0',
	`TPICFee` FLOAT NULL DEFAULT '0',
	`TPICWtaxTotal` FLOAT NULL DEFAULT '0',
	`TPICWtaxTotal2` FLOAT NULL DEFAULT '0',
	`TPICPayLess` FLOAT NULL DEFAULT '0',
	`TPICPayCoupon` FLOAT NULL DEFAULT '0',
	`TPICPayOther` FLOAT NULL DEFAULT '0',
	`TPICPayMisc` FLOAT NULL DEFAULT '0',
	`TPICDescription` VARCHAR(255) NULL,
	`TPICApproveStatus` SMALLINT NULL,
	`TPICCancelStatus` SMALLINT NULL,
	`TPICSignTotal` FLOAT NULL DEFAULT '0',
	`TPICSignArrear` FLOAT NULL DEFAULT '0',
	`TPICFlag1` SMALLINT NULL,
	`TPICFlag2` SMALLINT NULL,
	`TPICFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPICTAPNCode`, `TPICDocNo`, `TPICType`),
	KEY `TAPQTCmpCode` (`TPICTAPNCode`),
	KEY `TARBTACPID` (`TPICTACPID`),
	KEY `TARBTACPTACYID` (`TPICTACPTACYID`),
	KEY `TIvoTaxNo` (`TPICTaxNo`),
	KEY `TRICTBraCode` (`TPICTBraCode`),
	KEY `TRICTPrjCode` (`TPICTPrjCode`),
	KEY `TSODTCurCode` (`TPICDescription`),
	KEY `VS4TAPVS4TAPCard` (`TPICTAPNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPContact` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPContact`;

# ---------- CREATE TABLE `VS4TAPContact` ----------

CREATE TABLE `VS4TAPContact` (
	`TAPCTAPNCode` VARCHAR(30) NOT NULL,
	`TAPCCode` VARCHAR(30) NOT NULL,
	`TAPCTAPUCode` VARCHAR(30) NULL,
	`TAPCTitleName` VARCHAR(30) NULL,
	`TAPCFirstName` VARCHAR(200) NULL,
	`TAPCLastname` VARCHAR(150) NULL,
	`TAPCNickname` VARCHAR(20) NULL,
	`TAPCTitleName2` VARCHAR(50) NULL,
	`TAPCFirstname2` VARCHAR(200) NULL,
	`TAPCLastname2` VARCHAR(150) NULL,
	`TAPCPosition` VARCHAR(80) NULL,
	`TAPCRespond` VARCHAR(50) NULL,
	`TAPCTel` VARCHAR(50) NULL,
	`TAPCFax` VARCHAR(50) NULL,
	`TAPCMobile` VARCHAR(15) NULL,
	`TAPCEmail` VARCHAR(50) NULL,
	`TAPCImage1` VARCHAR(50) NULL,
	`TAPCCardImage1` VARCHAR(50) NULL,
	`TAPCPriority` SMALLINT NULL DEFAULT '0',
	`TAPCFavorite` VARCHAR(255) NULL,
	`TAPCNotLike` VARCHAR(255) NULL,
	`TAPCStyle` VARCHAR(255) NULL,
	`TAPCStatus` SMALLINT NULL DEFAULT '0',
	`TAPCNote` VARCHAR(50) NULL,
	`TAPCFlag1` SMALLINT NULL DEFAULT '0',
	`TAPCFlag2` SMALLINT NULL DEFAULT '0',
	`TAPCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPCCode`, `TAPCTAPNCode`),
	KEY `TARCFavorite` (`TAPCFavorite`),
	KEY `TARDCode` (`TAPCTAPUCode`),
	KEY `TConTComID` (`TAPCTAPNCode`),
	KEY `TTCnID` (`TAPCCode`),
	KEY `VS4TAPVS4TAPContact` (`TAPCTAPNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPCreditLimit` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPCreditLimit`;

# ---------- CREATE TABLE `VS4TAPCreditLimit` ----------

CREATE TABLE `VS4TAPCreditLimit` (
	`TPCLTAPNCode` VARCHAR(30) NOT NULL,
	`TPCLStartDate` DATETIME NOT NULL,
	`TPCLCreditLimit` FLOAT NULL DEFAULT '0',
	`TPCLFlag1` SMALLINT NULL DEFAULT '0',
	`TPCLFlag2` SMALLINT NULL DEFAULT '0',
	`TPCLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPCLTAPNCode`, `TPCLStartDate`),
	KEY `VS4TAPVS4TAPCreditLimit` (`TPCLTAPNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPCreditNote` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPCreditNote`;

# ---------- CREATE TABLE `VS4TAPCreditNote` ----------

CREATE TABLE `VS4TAPCreditNote` (
	`TPCNNo` VARCHAR(30) NOT NULL,
	`TPCNTIAPNo` VARCHAR(30) NULL,
	`TPCNBalanceFlag` TINYINT NULL DEFAULT '0',
	`TPCNInvoiceList` VARCHAR(255) NULL,
	`TPCNType` SMALLINT NULL DEFAULT '0',
	`TPCNTPCACode` VARCHAR(30) NULL,
	`TPCNMode` SMALLINT NULL DEFAULT '0',
	`TPCNDate` DATETIME NULL,
	`TPCNGLMethod` SMALLINT NULL DEFAULT '0',
	`TPCNTGLTNo` VARCHAR(30) NULL,
	`TPCNTInvNo` VARCHAR(30) NULL,
	`TPCNTBraCode` VARCHAR(30) NULL,
	`TPCNTPrjCode` VARCHAR(30) NULL,
	`TPCNTaxNo` VARCHAR(30) NULL,
	`TPCNTaxPeriodNo` DATETIME NULL,
	`TPCNTaxPeriodType` SMALLINT NULL,
	`TPCNTaxRefund` SMALLINT NULL,
	`TPCNPayType` SMALLINT NULL DEFAULT '0',
	`TPCNRefNo` VARCHAR(30) NULL,
	`TPCNRefDate` DATETIME NULL,
	`TPCNRefNo2` VARCHAR(30) NULL,
	`TPCNRefDate2` DATETIME NULL,
	`TPCNTAPNCode` VARCHAR(30) NULL,
	`TPCNTAPUCode` VARCHAR(30) NULL,
	`TPCNContactNote` VARCHAR(50) NULL,
	`TPCNContactName` VARCHAR(160) NULL,
	`TPCNSupplierName` VARCHAR(200) NULL,
	`TPCNSupAddress` VARCHAR(255) NULL,
	`TPCNPriceChannel` SMALLINT NULL DEFAULT '0',
	`TPCNChannelName` VARCHAR(30) NULL,
	`TPCNCostTotal` FLOAT NULL DEFAULT '0',
	`TPCNOldSubTotal` FLOAT NULL DEFAULT '0',
	`TPCNNewSubTotal` FLOAT NULL,
	`TPCNDiscountList` FLOAT NULL,
	`TPCNSubTotal` FLOAT NULL,
	`TPCNDiscountText` VARCHAR(30) NULL,
	`TPCNDiscountTotal` FLOAT NULL,
	`TPCNNetTotal` FLOAT NULL,
	`TPCNDepositText` VARCHAR(255) NULL,
	`TPCNDeposit` FLOAT NULL DEFAULT '0',
	`TPCNTotal` FLOAT NULL,
	`TPCNTotalFOB` FLOAT NULL,
	`TPCNTCurCode` VARCHAR(5) NULL,
	`TPCNExchangeRate` DOUBLE NULL DEFAULT '0',
	`TPCNTotalInRate` FLOAT NULL,
	`TPCNVATType` SMALLINT NULL,
	`TPCNVATRate` DOUBLE NULL,
	`TPCNTaxBase` FLOAT NULL DEFAULT '0',
	`TPCNVATTotal` FLOAT NULL,
	`TPCNGrandTotal` FLOAT NULL,
	`TPCNNetPayment` FLOAT NULL,
	`TPCNBaseArrears` FLOAT NULL DEFAULT '0',
	`TPCNArrears` FLOAT NULL DEFAULT '0',
	`TPCNAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPCNPremiumTotal` FLOAT NULL,
	`TPCNCommissionBase` FLOAT NULL DEFAULT '0',
	`TPCNCommissionRate` DOUBLE NULL DEFAULT '0',
	`TPCNCommission` FLOAT NULL DEFAULT '0',
	`TPCNDescription` VARCHAR(255) NULL,
	`TPCNBillStatus` SMALLINT NULL DEFAULT '0',
	`TPCNCardFlag` SMALLINT NULL DEFAULT '0',
	`TPCNTaxFlag` SMALLINT NULL DEFAULT '0',
	`TPCNCreateCode` VARCHAR(30) NULL,
	`TPCNCreateBy` VARCHAR(140) NULL,
	`TPCNCreateDate` DATETIME NULL,
	`TPCNEditCode` VARCHAR(30) NULL,
	`TPCNEditBy` VARCHAR(140) NULL,
	`TPCNEditDate` DATETIME NULL,
	`TPCNConfirmStatus` SMALLINT NULL,
	`TPCNConfirmBy` VARCHAR(140) NULL,
	`TPCNConfirmDate` DATETIME NULL,
	`TPCNApproveStatus` SMALLINT NULL,
	`TPCNApproveBy` VARCHAR(140) NULL,
	`TPCNApproveDate` DATETIME NULL,
	`TPCNApproveNote` VARCHAR(80) NULL,
	`TPCNRevision` SMALLINT NULL,
	`TPCNCancelStatus` SMALLINT NULL,
	`TPCNCancelNo` VARCHAR(30) NULL,
	`TPCNCancelBy` VARCHAR(140) NULL,
	`TPCNCancelDate` DATETIME NULL,
	`TPCNCancelNote` VARCHAR(80) NULL,
	`TPCNFlag1` SMALLINT NULL,
	`TPCNFlag2` SMALLINT NULL,
	`TPCNFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPCNNo`),
	KEY `TAPQTCmpCode` (`TPCNTAPNCode`),
	KEY `TInBTPrjCode` (`TPCNTPrjCode`),
	KEY `TIvoTARDCode` (`TPCNTAPUCode`),
	KEY `TIvoTaxNo` (`TPCNTaxNo`),
	KEY `TPCNTPrjCode` (`TPCNTBraCode`),
	KEY `TPODTAPNCode` (`TPCNContactNote`),
	KEY `TPSDTPCACode` (`TPCNTPCACode`),
	KEY `TPWOSupplierName` (`TPCNSupAddress`),
	KEY `TPWOTCmpCode` (`TPCNSupplierName`),
	KEY `TRCNTIvoNo` (`TPCNTIAPNo`),
	KEY `TSODTCurCode` (`TPCNTCurCode`),
	KEY `VS4TAPVS4TAPCreditNote` (`TPCNTAPNCode`),
	KEY `VS4TProjectVS4TAPCreditNote` (`TPCNTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPCreditNoteMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPCreditNoteMB`;

# ---------- CREATE TABLE `VS4TAPCreditNoteMB` ----------

CREATE TABLE `VS4TAPCreditNoteMB` (
	`TPCMTPCNNo` VARCHAR(30) NOT NULL,
	`TPCMLn` INT NOT NULL DEFAULT '0',
	`TPCMType` SMALLINT NULL DEFAULT '0',
	`TPCMReturnFlag` SMALLINT NULL DEFAULT '0',
	`TPCMTOExCode` VARCHAR(50) NULL,
	`TPCMTPdtCode` VARCHAR(50) NULL,
	`TPCMSerialNo` VARCHAR(30) NULL,
	`TPCMJobCode` VARCHAR(30) NULL,
	`TPCMCustom1` VARCHAR(30) NULL,
	`TPCMCustom2` VARCHAR(30) NULL,
	`TPCMCustom3` VARCHAR(30) NULL,
	`TPCMCustom4` VARCHAR(30) NULL,
	`TPCMCustom5` VARCHAR(30) NULL,
	`TPCMShippingMark` VARCHAR(255) NULL,
	`TPCMProductCode` VARCHAR(50) NULL,
	`TPCMFactoryCode` VARCHAR(50) NULL,
	`TPCMProductName` VARCHAR(255) NULL,
	`TPCMCost` FLOAT NULL DEFAULT '0',
	`TPCMOldPrice` FLOAT NULL DEFAULT '0',
	`TPCMNewPrice` FLOAT NULL DEFAULT '0',
	`TPCMPrice` FLOAT NULL DEFAULT '0',
	`TPCMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TPCMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TPCMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TPCMOldQuantityCal` DOUBLE NULL DEFAULT '0',
	`TPCMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TPCMOldQuantity` DOUBLE NULL DEFAULT '0',
	`TPCMNewQuantity` DOUBLE NULL DEFAULT '0',
	`TPCMQuantityText` VARCHAR(255) NULL,
	`TPCMQuantityStock` DOUBLE NULL DEFAULT '0',
	`TPCMQuantity` DOUBLE NULL DEFAULT '0',
	`TPCMTUntCode` VARCHAR(50) NULL,
	`TPCMOldQuantity2` DOUBLE NULL DEFAULT '0',
	`TPCMQuantity2` DOUBLE NULL DEFAULT '0',
	`TPCMTUntCode2` VARCHAR(50) NULL,
	`TPCMOldQuantity3` DOUBLE NULL DEFAULT '0',
	`TPCMQuantity3` DOUBLE NULL DEFAULT '0',
	`TPCMTUntCode3` VARCHAR(50) NULL,
	`TPCMCostOldAmount` DOUBLE NULL DEFAULT '0',
	`TPCMCostAmount` DOUBLE NULL DEFAULT '0',
	`TPCMOldAmount` DOUBLE NULL DEFAULT '0',
	`TPCMAmount` DOUBLE NULL DEFAULT '0',
	`TPCMDiscountText` VARCHAR(30) NULL,
	`TPCMDiscountTotal` FLOAT NULL,
	`TPCMOldDiscTotal` FLOAT NULL DEFAULT '0',
	`TPCMOldNetAmount` FLOAT NULL DEFAULT '0',
	`TPCMNetAmount` FLOAT NULL DEFAULT '0',
	`TPCMNAmountInRate` FLOAT NULL DEFAULT '0',
	`TPCMTaxBase` FLOAT NULL DEFAULT '0',
	`TPCMTaxType` SMALLINT NULL DEFAULT '0',
	`TPCMAmountVAT` FLOAT NULL DEFAULT '0',
	`TPCMDescription` VARCHAR(255) NULL,
	`TPCMSourceNo` VARCHAR(30) NULL,
	`TPCMSourceLn` INT NULL DEFAULT '0',
	`TPCMSourceDate` DATETIME NULL,
	`TPCMTaxNo` VARCHAR(30) NULL,
	`TPCMRefNo` VARCHAR(30) NULL,
	`TPCMRefDate` DATETIME NULL,
	`TPCMIVType` SMALLINT NULL DEFAULT '0',
	`TPCMVATRate` DOUBLE NULL,
	`TPCMGrandTotal` FLOAT NULL,
	`TPCMNetPayment` FLOAT NULL,
	`TPCMArrears` FLOAT NULL DEFAULT '0',
	`TPCMBaseArrears` FLOAT NULL DEFAULT '0',
	`TPCMIsPremium` SMALLINT NULL DEFAULT '0',
	`TPCMFlag1` SMALLINT NULL DEFAULT '0',
	`TPCMFlag2` SMALLINT NULL DEFAULT '0',
	`TPCMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPCMLn`, `TPCMTPCNNo`),
	KEY `TIoMTUntCode2` (`TPCMTUntCode3`),
	KEY `TJbMSourceNo` (`TPCMSourceNo`),
	KEY `TPCNTaxNo` (`TPCMTaxNo`),
	KEY `TPOBTPdtCode` (`TPCMTPdtCode`),
	KEY `TPSMTOExCode` (`TPCMTOExCode`),
	KEY `TPSMUnitFactor` (`TPCMUnitFactor`),
	KEY `TPWBID` (`TPCMLn`),
	KEY `TPWBPdtCode1` (`TPCMProductCode`),
	KEY `TPWBTUntCode` (`TPCMTUntCode`),
	KEY `TPWBTUntCode1` (`TPCMTUntCode2`),
	KEY `TQuBFactoryCode` (`TPCMFactoryCode`),
	KEY `TRCMReturnFlag` (`TPCMReturnFlag`),
	KEY `TTfMID` (`TPCMTPCNNo`),
	KEY `TTfrToTShfCode` (`TPCMType`),
	KEY `VS4TAPCreditNoteVS4TAPCreditNoteMB` (`TPCMTPCNNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPDebitNote` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPDebitNote`;

# ---------- CREATE TABLE `VS4TAPDebitNote` ----------

CREATE TABLE `VS4TAPDebitNote` (
	`TDENNo` VARCHAR(30) NOT NULL,
	`TDENTIAPNo` VARCHAR(30) NULL,
	`TDENBalanceFlag` TINYINT NULL DEFAULT '0',
	`TDENInvoiceList` VARCHAR(255) NULL,
	`TDENType` SMALLINT NULL DEFAULT '0',
	`TDENTPCACode` VARCHAR(30) NULL,
	`TDENMode` SMALLINT NULL DEFAULT '0',
	`TDENDate` DATETIME NULL,
	`TDENGLMethod` SMALLINT NULL DEFAULT '0',
	`TDENTGLTNo` VARCHAR(30) NULL,
	`TDENTBraCode` VARCHAR(30) NULL,
	`TDENTPrjCode` VARCHAR(30) NULL,
	`TDENTaxNo` VARCHAR(30) NULL,
	`TDENTaxPeriodNo` DATETIME NULL,
	`TDENTaxPeriodType` SMALLINT NULL,
	`TDENTaxRefund` SMALLINT NULL,
	`TDENPayType` SMALLINT NULL DEFAULT '0',
	`TDENRefNo` VARCHAR(30) NULL,
	`TDENRefDate` DATETIME NULL,
	`TDENRefNo2` VARCHAR(30) NULL,
	`TDENRefDate2` DATETIME NULL,
	`TDENTAPNCode` VARCHAR(30) NULL,
	`TDENTAPUCode` VARCHAR(30) NULL,
	`TDENContactNote` VARCHAR(50) NULL,
	`TDENContactName` VARCHAR(160) NULL,
	`TDENSupplierName` VARCHAR(200) NULL,
	`TDENSupAddress` VARCHAR(255) NULL,
	`TDENPriceChannel` SMALLINT NULL DEFAULT '0',
	`TDENChannelName` VARCHAR(30) NULL,
	`TDENCostTotal` FLOAT NULL DEFAULT '0',
	`TDENOldSubTotal` FLOAT NULL DEFAULT '0',
	`TDENNewSubTotal` FLOAT NULL,
	`TDENDiscountList` FLOAT NULL,
	`TDENSubTotal` FLOAT NULL,
	`TDENDiscountText` VARCHAR(30) NULL,
	`TDENDiscountTotal` FLOAT NULL,
	`TDENNetTotal` FLOAT NULL,
	`TDENDepositText` VARCHAR(30) NULL,
	`TDENDeposit` FLOAT NULL DEFAULT '0',
	`TDENTotal` FLOAT NULL,
	`TDENTotalFOB` FLOAT NULL,
	`TDENTCurCode` VARCHAR(5) NULL,
	`TDENExchangeRate` DOUBLE NULL DEFAULT '0',
	`TDENTotalInRate` FLOAT NULL,
	`TDENVATType` SMALLINT NULL,
	`TDENVATRate` DOUBLE NULL,
	`TDENTaxBase` FLOAT NULL DEFAULT '0',
	`TDENVATTotal` FLOAT NULL,
	`TDENGrandTotal` FLOAT NULL,
	`TDENNetPayment` FLOAT NULL,
	`TDENBaseArrears` FLOAT NULL DEFAULT '0',
	`TDENArrears` FLOAT NULL DEFAULT '0',
	`TDENAdjustTotal` FLOAT NULL DEFAULT '0',
	`TDENPremiumTotal` FLOAT NULL,
	`TDENCommissionBase` FLOAT NULL DEFAULT '0',
	`TDENCommissionRate` DOUBLE NULL DEFAULT '0',
	`TDENCommission` FLOAT NULL DEFAULT '0',
	`TDENDescription` VARCHAR(255) NULL,
	`TDENBillStatus` SMALLINT NULL DEFAULT '0',
	`TDENCardFlag` SMALLINT NULL DEFAULT '0',
	`TDENTaxFlag` SMALLINT NULL DEFAULT '0',
	`TDENCreateCode` VARCHAR(30) NULL,
	`TDENCreateBy` VARCHAR(140) NULL,
	`TDENCreateDate` DATETIME NULL,
	`TDENEditCode` VARCHAR(30) NULL,
	`TDENEditBy` VARCHAR(140) NULL,
	`TDENEditDate` DATETIME NULL,
	`TDENConfirmStatus` SMALLINT NULL,
	`TDENConfirmBy` VARCHAR(140) NULL,
	`TDENConfirmDate` DATETIME NULL,
	`TDENApproveStatus` SMALLINT NULL,
	`TDENApproveBy` VARCHAR(140) NULL,
	`TDENApproveDate` DATETIME NULL,
	`TDENApproveNote` VARCHAR(80) NULL,
	`TDENRevision` SMALLINT NULL,
	`TDENCancelStatus` SMALLINT NULL,
	`TDENCancelNo` VARCHAR(30) NULL,
	`TDENCancelBy` VARCHAR(140) NULL,
	`TDENCancelDate` DATETIME NULL,
	`TDENCancelNote` VARCHAR(80) NULL,
	`TDENFlag1` SMALLINT NULL,
	`TDENFlag2` SMALLINT NULL,
	`TDENFlag3` SMALLINT NULL,
	PRIMARY KEY (`TDENNo`),
	KEY `TAPQTCmpCode` (`TDENTAPNCode`),
	KEY `TInBTPrjCode` (`TDENTPrjCode`),
	KEY `TIvoTaxNo` (`TDENTaxNo`),
	KEY `TPCNTAPUCode` (`TDENTAPUCode`),
	KEY `TPCNTBraCode` (`TDENTBraCode`),
	KEY `TPODTAPNCode` (`TDENContactNote`),
	KEY `TPSDTPCACode` (`TDENTPCACode`),
	KEY `TPWOSupplierName` (`TDENSupAddress`),
	KEY `TPWOTCmpCode` (`TDENSupplierName`),
	KEY `TRCNTIvoNo` (`TDENTIAPNo`),
	KEY `TSODTCurCode` (`TDENTCurCode`),
	KEY `VS4TAPVS4TAPDebitNote` (`TDENTAPNCode`),
	KEY `VS4TProjectVS4TAPDebitNote` (`TDENTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPDebitNoteMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPDebitNoteMB`;

# ---------- CREATE TABLE `VS4TAPDebitNoteMB` ----------

CREATE TABLE `VS4TAPDebitNoteMB` (
	`TDEBTDENNo` VARCHAR(30) NOT NULL,
	`TDEBLn` INT NOT NULL DEFAULT '0',
	`TDEBType` SMALLINT NULL DEFAULT '0',
	`TDEBTOExCode` VARCHAR(50) NULL,
	`TDEBTPdtCode` VARCHAR(50) NULL,
	`TDEBSerialNo` VARCHAR(30) NULL,
	`TDEBJobCode` VARCHAR(30) NULL,
	`TDEBCustom1` VARCHAR(30) NULL,
	`TDEBCustom2` VARCHAR(30) NULL,
	`TDEBCustom3` VARCHAR(30) NULL,
	`TDEBCustom4` VARCHAR(30) NULL,
	`TDEBCustom5` VARCHAR(30) NULL,
	`TDEBShippingMark` VARCHAR(255) NULL,
	`TDEBProductCode` VARCHAR(50) NULL,
	`TDEBFactoryCode` VARCHAR(50) NULL,
	`TDEBProductName` VARCHAR(255) NULL,
	`TDEBCost` FLOAT NULL DEFAULT '0',
	`TDEBOldPrice` FLOAT NULL DEFAULT '0',
	`TDEBNewPrice` FLOAT NULL DEFAULT '0',
	`TDEBPrice` FLOAT NULL DEFAULT '0',
	`TDEBPerQuantity` DOUBLE NULL DEFAULT '1',
	`TDEBUnitFactor` DOUBLE NULL DEFAULT '0',
	`TDEBUnitCalc` SMALLINT NULL DEFAULT '0',
	`TDEBOldQuantityCal` DOUBLE NULL DEFAULT '0',
	`TDEBQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TDEBOldQuantity` DOUBLE NULL DEFAULT '0',
	`TDEBQuantityText` VARCHAR(255) NULL,
	`TDEBQuantity` DOUBLE NULL DEFAULT '0',
	`TDEBTUntCode` VARCHAR(50) NULL,
	`TDEBOldQuantity2` DOUBLE NULL DEFAULT '0',
	`TDEBQuantity2` DOUBLE NULL DEFAULT '0',
	`TDEBTUntCode2` VARCHAR(50) NULL,
	`TDEBOldQuantity3` DOUBLE NULL DEFAULT '0',
	`TDEBQuantity3` DOUBLE NULL DEFAULT '0',
	`TDEBTUntCode3` VARCHAR(50) NULL,
	`TDEBCostOldAmount` DOUBLE NULL DEFAULT '0',
	`TDEBCostAmount` DOUBLE NULL DEFAULT '0',
	`TDEBOldAmount` DOUBLE NULL DEFAULT '0',
	`TDEBAmount` DOUBLE NULL DEFAULT '0',
	`TDEBDiscountText` VARCHAR(30) NULL,
	`TDEBDiscountTotal` FLOAT NULL,
	`TDEBOldDiscTotal` FLOAT NULL DEFAULT '0',
	`TDEBOldNetAmount` FLOAT NULL DEFAULT '0',
	`TDEBNetAmount` FLOAT NULL DEFAULT '0',
	`TDEBNAmountInRate` FLOAT NULL DEFAULT '0',
	`TDEBTaxBase` FLOAT NULL DEFAULT '0',
	`TDEBTaxType` SMALLINT NULL DEFAULT '0',
	`TDEBAmountVAT` FLOAT NULL DEFAULT '0',
	`TDEBDescription` VARCHAR(255) NULL,
	`TDEBSourceNo` VARCHAR(30) NULL,
	`TDEBSourceLn` INT NULL DEFAULT '0',
	`TDEBSourceDate` DATETIME NULL,
	`TDEBTaxNo` VARCHAR(30) NULL,
	`TDEBRefNo` VARCHAR(30) NULL,
	`TDEBRefDate` DATETIME NULL,
	`TDEBIVType` SMALLINT NULL DEFAULT '0',
	`TDEBVATRate` DOUBLE NULL,
	`TDEBGrandTotal` FLOAT NULL,
	`TDEBNetPayment` FLOAT NULL,
	`TDEBArrears` FLOAT NULL DEFAULT '0',
	`TDEBBaseArrears` FLOAT NULL DEFAULT '0',
	`TDEBIsPremium` SMALLINT NULL DEFAULT '0',
	`TDEBFlag1` SMALLINT NULL DEFAULT '0',
	`TDEBFlag2` SMALLINT NULL DEFAULT '0',
	`TDEBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDEBLn`, `TDEBTDENNo`),
	KEY `TIoMTUntCode2` (`TDEBTUntCode3`),
	KEY `TJbMSourceNo` (`TDEBSourceNo`),
	KEY `TPCNTaxNo` (`TDEBTaxNo`),
	KEY `TPOBTPdtCode` (`TDEBTPdtCode`),
	KEY `TPSMTOExCode` (`TDEBTOExCode`),
	KEY `TPSMUnitFactor` (`TDEBUnitFactor`),
	KEY `TPWBID` (`TDEBLn`),
	KEY `TPWBPdtCode1` (`TDEBProductCode`),
	KEY `TPWBTUntCode` (`TDEBTUntCode`),
	KEY `TPWBTUntCode1` (`TDEBTUntCode2`),
	KEY `TQuBFactoryCode` (`TDEBFactoryCode`),
	KEY `TTfMID` (`TDEBTDENNo`),
	KEY `TTfrToTShfCode` (`TDEBType`),
	KEY `VS4TAPDebitNoteVS4TAPDebitNoteMB` (`TDEBTDENNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPDebtAdjust` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPDebtAdjust`;

# ---------- CREATE TABLE `VS4TAPDebtAdjust` ----------

CREATE TABLE `VS4TAPDebtAdjust` (
	`TPAJNo` VARCHAR(30) NOT NULL,
	`TPAJType` SMALLINT NULL DEFAULT '0',
	`TPAJDate` DATETIME NULL,
	`TPAJMode` SMALLINT NULL DEFAULT '0',
	`TPAJGLMethod` SMALLINT NULL DEFAULT '0',
	`TPAJTGLTNo` VARCHAR(30) NULL,
	`TPAJTBraCode` VARCHAR(30) NULL,
	`TPAJTPrjCode` VARCHAR(30) NULL,
	`TPAJRefNo` VARCHAR(30) NULL,
	`TPAJRefDate` DATETIME NULL,
	`TPAJTAPNCode` VARCHAR(30) NULL,
	`TPAJContactNote` VARCHAR(50) NULL,
	`TPAJContactName` VARCHAR(160) NULL,
	`TPAJCustomerName` VARCHAR(200) NULL,
	`TPAJCusAddress` VARCHAR(255) NULL,
	`TPAJTotal` FLOAT NULL,
	`TPAJTCurCode` VARCHAR(5) NULL,
	`TPAJExchangeRate` FLOAT NULL DEFAULT '0',
	`TPAJTaxBase` FLOAT NULL DEFAULT '0',
	`TPAJGrandTotal` FLOAT NULL,
	`TPAJNetPayment` FLOAT NULL,
	`TPAJArrears` FLOAT NULL DEFAULT '0',
	`TPAJBaseArrears` FLOAT NULL DEFAULT '0',
	`TPAJDescription` VARCHAR(255) NULL,
	`TPAJBillStatus` SMALLINT NULL DEFAULT '0',
	`TPAJCardFlag` SMALLINT NULL DEFAULT '0',
	`TPAJCreateCode` VARCHAR(30) NULL,
	`TPAJCreateBy` VARCHAR(140) NULL,
	`TPAJCreateDate` DATETIME NULL,
	`TPAJEditCode` VARCHAR(30) NULL,
	`TPAJEditBy` VARCHAR(140) NULL,
	`TPAJEditDate` DATETIME NULL,
	`TPAJConfirmStatus` SMALLINT NULL,
	`TPAJConfirmBy` VARCHAR(140) NULL,
	`TPAJConfirmDate` DATETIME NULL,
	`TPAJApproveStatus` SMALLINT NULL,
	`TPAJApproveBy` VARCHAR(140) NULL,
	`TPAJApproveDate` DATETIME NULL,
	`TPAJApproveNote` VARCHAR(80) NULL,
	`TPAJRevision` SMALLINT NULL,
	`TPAJCancelStatus` SMALLINT NULL,
	`TPAJCancelNo` VARCHAR(30) NULL,
	`TPAJCancelBy` VARCHAR(140) NULL,
	`TPAJCancelDate` DATETIME NULL,
	`TPAJCancelNote` VARCHAR(80) NULL,
	`TPAJFlag1` SMALLINT NULL,
	`TPAJFlag2` SMALLINT NULL,
	`TPAJFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPAJNo`),
	KEY `TAPQTCmpCode` (`TPAJTAPNCode`),
	KEY `TInBTPrjCode` (`TPAJTPrjCode`),
	KEY `TPCNTBraCode` (`TPAJTBraCode`),
	KEY `TPODTAPNCode` (`TPAJContactNote`),
	KEY `TPWOSupplierName` (`TPAJCusAddress`),
	KEY `TPWOTCmpCode` (`TPAJCustomerName`),
	KEY `TSODTCurCode` (`TPAJTCurCode`),
	KEY `VS4TAPVS4TAPDebtAdjust` (`TPAJTAPNCode`),
	KEY `VS4TBranchVS4TAPDebtAdjust` (`TPAJTBraCode`),
	KEY `VS4TCurrencyVS4TAPDebtAdjust` (`TPAJTCurCode`),
	KEY `VS4TProjectVS4TAPDebtAdjust` (`TPAJTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPDebtAdjustMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPDebtAdjustMB`;

# ---------- CREATE TABLE `VS4TAPDebtAdjustMB` ----------

CREATE TABLE `VS4TAPDebtAdjustMB` (
	`TPJMTPJANo` VARCHAR(30) NOT NULL,
	`TPJMLn` INT NOT NULL DEFAULT '0',
	`TPJMType` INT NULL DEFAULT '0',
	`TPJMDocNo` VARCHAR(30) NULL,
	`TPJMTaxNo` VARCHAR(30) NULL,
	`TPJMDate` VARCHAR(30) NULL,
	`TPJMRefNo` VARCHAR(30) NULL,
	`TPJMRefDate` DATETIME NULL,
	`TPJMRefNo2` VARCHAR(30) NULL,
	`TPJMRefDate2` DATETIME NULL,
	`TPJMRefNo3` VARCHAR(30) NULL,
	`TPJMRefDate3` DATETIME NULL,
	`TPJMNetAmount` FLOAT NULL DEFAULT '0',
	`TPJMTCurCode` VARCHAR(5) NULL,
	`TPJMExchangeRate` FLOAT NULL DEFAULT '0',
	`TPJMNAmountInRate` FLOAT NULL DEFAULT '0',
	`TPJMTaxBase` FLOAT NULL DEFAULT '0',
	`TPJMDescription` VARCHAR(255) NULL,
	`TPJMFlag1` SMALLINT NULL DEFAULT '0',
	`TPJMFlag2` SMALLINT NULL DEFAULT '0',
	`TPJMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPJMLn`, `TPJMTPJANo`),
	KEY `TPWBID` (`TPJMLn`),
	KEY `TRAJTaxNo` (`TPJMTaxNo`),
	KEY `TRAJTCurCode` (`TPJMTCurCode`),
	KEY `TRCMLn` (`TPJMType`),
	KEY `TRCNDocNo` (`TPJMDate`),
	KEY `TRCNTIvoNo` (`TPJMDocNo`),
	KEY `TTfMID` (`TPJMTPJANo`),
	KEY `VS4TAPDebtAdjustVS4TAPDebtAdjustMB` (`TPJMTPJANo`),
	KEY `VS4TCurrencyVS4TAPDebtAdjustMB` (`TPJMTCurCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPGroup`;

# ---------- CREATE TABLE `VS4TAPGroup` ----------

CREATE TABLE `VS4TAPGroup` (
	`TAPGCode` VARCHAR(30) NOT NULL,
	`TAPGName` VARCHAR(100) NULL,
	`TAPGCreateCode` VARCHAR(30) NULL,
	`TAPGCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPGEditCode` VARCHAR(30) NULL,
	`TAPGEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPGConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TAPGConfirmCode` VARCHAR(30) NULL,
	`TAPGConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPGCancelStatus` SMALLINT NULL DEFAULT '0',
	`TAPGCancelCode` VARCHAR(30) NULL,
	`TAPGCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPGFlag1` SMALLINT NULL DEFAULT '0',
	`TAPGFlag2` SMALLINT NULL DEFAULT '0',
	`TAPGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPGCode`),
	KEY `TAPNCancelCode` (`TAPGCancelCode`),
	KEY `TAPNConfirmCode` (`TAPGConfirmCode`),
	KEY `TBnkCode` (`TAPGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPImportantDay` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPImportantDay`;

# ---------- CREATE TABLE `VS4TAPImportantDay` ----------

CREATE TABLE `VS4TAPImportantDay` (
	`TAPITAPNCode` VARCHAR(30) NOT NULL,
	`TAPILn` INT NOT NULL DEFAULT '0',
	`TAPITIMDCode` VARCHAR(30) NULL,
	`TAPIDate` DATETIME NULL,
	`TAPINote` VARCHAR(100) NULL,
	`TAPIFlag1` SMALLINT NULL DEFAULT '0',
	`TAPIFlag2` SMALLINT NULL DEFAULT '0',
	`TAPIFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPITAPNCode`, `TAPILn`),
	KEY `TARITARNCode` (`TAPITAPNCode`),
	KEY `TARITIMDCode` (`TAPITIMDCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPInvoice` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPInvoice`;

# ---------- CREATE TABLE `VS4TAPInvoice` ----------

CREATE TABLE `VS4TAPInvoice` (
	`TIAPNo` VARCHAR(30) NOT NULL,
	`TIAPBalanceFlag` TINYINT NULL DEFAULT '0',
	`TIAPType` SMALLINT NULL DEFAULT '0',
	`TIAPTPCACode` VARCHAR(30) NULL,
	`TIAPMode` SMALLINT NULL DEFAULT '0',
	`TIAPDate` DATETIME NULL,
	`TIAPLoadingDate` DATETIME NULL,
	`TIAPStartAgingDate` DATETIME NULL,
	`TIAPDueDate` DATETIME NULL,
	`TIAPGLMethod` SMALLINT NULL DEFAULT '0',
	`TIAPTGLTNo` VARCHAR(30) NULL,
	`TIAPTTeTNo` VARCHAR(30) NULL,
	`TIAPTaxNo` VARCHAR(30) NULL,
	`TIAPTaxPeriodNo` DATETIME NULL,
	`TIAPTaxPeriodType` SMALLINT NULL,
	`TIAPTaxRefund` SMALLINT NULL,
	`TIAPPayType` SMALLINT NULL DEFAULT '0',
	`TIAPRefNo` VARCHAR(30) NULL,
	`TIAPRefDate` DATETIME NULL,
	`TIAPRefNo2` VARCHAR(30) NULL,
	`TIAPRefDate2` DATETIME NULL,
	`TIAPPONo` VARCHAR(30) NULL,
	`TIAPSOCode` VARCHAR(30) NULL,
	`TIAPJobCode` VARCHAR(30) NULL,
	`TIAPTJobNo` VARCHAR(30) NULL,
	`TIAPTJbMLn` INT NULL DEFAULT '0',
	`TIAPTPrjCode` VARCHAR(30) NULL,
	`TIAPTBraCode` VARCHAR(30) NULL,
	`TIAPDeliveryDate` DATETIME NULL,
	`TIAPDeliveryTo` VARCHAR(255) NULL,
	`TIAPTAPNCode` VARCHAR(30) NULL,
	`TIAPTAPUCode` VARCHAR(30) NULL,
	`TIAPContactNote` VARCHAR(50) NULL,
	`TIAPContactName` VARCHAR(160) NULL,
	`TIAPSupplierName` VARCHAR(200) NULL,
	`TIAPSupAddress` VARCHAR(255) NULL,
	`TIAPConsignee` VARCHAR(255) NULL,
	`TIAPNotifyParty` VARCHAR(255) NULL,
	`TIAPPriceChannel` SMALLINT NULL DEFAULT '0',
	`TIAPChannelName` VARCHAR(30) NULL,
	`TIAPDiscountList` FLOAT NULL,
	`TIAPSubTotal` FLOAT NULL,
	`TIAPDiscountText` VARCHAR(30) NULL,
	`TIAPDiscountTotal` FLOAT NULL,
	`TIAPNetTotal` FLOAT NULL DEFAULT '0',
	`TIAPDepositText` VARCHAR(30) NULL,
	`TIAPDeposit` FLOAT NULL DEFAULT '0',
	`TIAPTotal` FLOAT NULL,
	`TIAPTotalFOB` FLOAT NULL,
	`TIAPTCurCode` VARCHAR(5) NULL,
	`TIAPExchangeRate` DOUBLE NULL DEFAULT '0',
	`TIAPTotalInRate` FLOAT NULL,
	`TIAPVATType` SMALLINT NULL DEFAULT '0',
	`TIAPVATRate` DOUBLE NULL,
	`TIAPTaxBase` FLOAT NULL DEFAULT '0',
	`TIAPVATTotal` FLOAT NULL,
	`TIAPGrandTotal` FLOAT NULL,
	`TIAPNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TIAPWTaxBase` FLOAT NULL DEFAULT '0',
	`TIAPWTaxRate` DOUBLE NULL DEFAULT '0',
	`TIAPWTaxTotal` FLOAT NULL DEFAULT '0',
	`TIAPNetPayment` FLOAT NULL,
	`TIAPBaseArrears` FLOAT NULL DEFAULT '0',
	`TIAPArrears` FLOAT NULL DEFAULT '0',
	`TIAPIgnoreArrears` SMALLINT NULL,
	`TIAPAdjustTotal` FLOAT NULL DEFAULT '0',
	`TIAPBaseAVailable` FLOAT NULL,
	`TIAPAVailable` FLOAT NULL,
	`TIAPPremiumTotal` FLOAT NULL,
	`TIAPCommissionBase` FLOAT NULL DEFAULT '0',
	`TIAPCommissionRate` DOUBLE NULL DEFAULT '0',
	`TIAPCommission` FLOAT NULL DEFAULT '0',
	`TIAPBaseIncoType` VARCHAR(3) NULL,
	`TIAPIncoType` VARCHAR(3) NULL,
	`TIAPIncoterms` VARCHAR(50) NULL,
	`TIAPOtherFee` FLOAT NULL DEFAULT '0',
	`TIAPTransportFee` FLOAT NULL DEFAULT '0',
	`TIAPHandlingFee` FLOAT NULL DEFAULT '0',
	`TIAPFreightFee` FLOAT NULL DEFAULT '0',
	`TIAPInsurance` FLOAT NULL DEFAULT '0',
	`TIAPTransportDesc` FLOAT NULL,
	`TIAPDuty` FLOAT NULL,
	`TIAPShipBy` VARCHAR(255) NULL,
	`TIAPCountryOrigin` VARCHAR(50) NULL,
	`TIAPDestination` VARCHAR(255) NULL,
	`TIAPCondition` VARCHAR(100) NULL,
	`TIAPConditionType` SMALLINT NULL,
	`TIAPConditionDay` SMALLINT NULL DEFAULT '0',
	`TIAPCondition1` DOUBLE NULL DEFAULT '0',
	`TIAPConditionDay1` SMALLINT NULL DEFAULT '0',
	`TIAPPaymentNote` VARCHAR(200) NULL,
	`TIAPStatementNote` VARCHAR(200) NULL,
	`TIAPTShpCode` VARCHAR(30) NULL,
	`TIAPDeliveryNote` VARCHAR(200) NULL,
	`TIAPPackingNote` VARCHAR(200) NULL,
	`TIAPDayAvailable` SMALLINT NULL,
	`TIAPDescription` VARCHAR(255) NULL,
	`TIAPCustom1` VARCHAR(30) NULL,
	`TIAPCustom2` VARCHAR(30) NULL,
	`TIAPCustom3` VARCHAR(30) NULL,
	`TIAPCustom4` VARCHAR(255) NULL,
	`TIAPCustom5` VARCHAR(255) NULL,
	`TIAPCustomNo` VARCHAR(30) NULL,
	`TIAPCustomDate` DATETIME NULL,
	`TIAPTPOTCode` VARCHAR(50) NULL,
	`TIAPDeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TIAPBillStatus` SMALLINT NULL DEFAULT '0',
	`TIAPCardFlag` SMALLINT NULL DEFAULT '0',
	`TIAPTaxFlag` SMALLINT NULL DEFAULT '0',
	`TIAPCreateBy` VARCHAR(140) NULL,
	`TIAPCreateDate` DATETIME NULL,
	`TIAPEditCode` VARCHAR(30) NULL,
	`TIAPEditBy` VARCHAR(140) NULL,
	`TIAPEditDate` DATETIME NULL,
	`TIAPConfirmStatus` SMALLINT NULL,
	`TIAPConfirmBy` VARCHAR(140) NULL,
	`TIAPConfirmDate` DATETIME NULL,
	`TIAPApproveStatus` SMALLINT NULL,
	`TIAPApproveBy` VARCHAR(140) NULL,
	`TIAPApproveDate` DATETIME NULL,
	`TIAPApproveNote` VARCHAR(80) NULL,
	`TIAPRevision` SMALLINT NULL,
	`TIAPCancelStatus` SMALLINT NULL,
	`TIAPCancelBy` VARCHAR(140) NULL,
	`TIAPCancelDate` DATETIME NULL,
	`TIAPCancelNote` VARCHAR(80) NULL,
	`TIAPFlag1` SMALLINT NULL,
	`TIAPFlag2` SMALLINT NULL,
	`TIAPFlag3` SMALLINT NULL,
	PRIMARY KEY (`TIAPNo`),
	KEY `TAPQTCmpCode` (`TIAPTAPNCode`),
	KEY `TIAPTShpCode` (`TIAPTShpCode`),
	KEY `TIvoJobCode` (`TIAPJobCode`),
	KEY `TIvoPONo` (`TIAPPONo`),
	KEY `TIvoSOCode` (`TIAPSOCode`),
	KEY `TIvoTaxNo` (`TIAPTaxNo`),
	KEY `TPCNTAPUCode` (`TIAPTAPUCode`),
	KEY `TPCNTJbMLn` (`TIAPTJbMLn`),
	KEY `TPODTAPNCode` (`TIAPContactNote`),
	KEY `TPRDTBraCode` (`TIAPTBraCode`),
	KEY `TPSDTPCACode` (`TIAPTPCACode`),
	KEY `TPWOSupplierName` (`TIAPSupAddress`),
	KEY `TPWOTCmpCode` (`TIAPSupplierName`),
	KEY `TQuoTJobNo` (`TIAPTJobNo`),
	KEY `TQuoTPrjCode` (`TIAPTPrjCode`),
	KEY `TSODTCurCode` (`TIAPTCurCode`),
	KEY `VS4TAPVS4TAPInvoice` (`TIAPTAPNCode`),
	KEY `VS4TProjectVS4TAPInvoice` (`TIAPTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPInvoiceADJ` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPInvoiceADJ`;

# ---------- CREATE TABLE `VS4TAPInvoiceADJ` ----------

CREATE TABLE `VS4TAPInvoiceADJ` (
	`TIPJNo` VARCHAR(30) NOT NULL,
	`TIPJType` SMALLINT NULL DEFAULT '0',
	`TIPJDate` DATETIME NULL,
	`TIPJDueDate` DATETIME NULL,
	`TIPJTaxNo` VARCHAR(30) NULL,
	`TIPJRefNo` VARCHAR(30) NULL,
	`TIPJRefDate` DATETIME NULL,
	`TIPJRefNo2` VARCHAR(30) NULL,
	`TIPJRefDate2` DATETIME NULL,
	`TIPJPONo` VARCHAR(30) NULL,
	`TIPJSOCode` VARCHAR(30) NULL,
	`TIPJJobCode` VARCHAR(30) NULL,
	`TIPJTJobNo` VARCHAR(30) NULL,
	`TIPJTJbMLn` INT NULL DEFAULT '0',
	`TIPJTPrjCode` VARCHAR(30) NULL,
	`TIPJTBraCode` VARCHAR(30) NULL,
	`TIPJDeliveryDate` DATETIME NULL,
	`TIPJDeliveryTo` VARCHAR(255) NULL,
	`TIPJTACPTACYID` INT NULL DEFAULT '0',
	`TIPJTACPID` INT NULL DEFAULT '0',
	`TIPJTAPNCode` VARCHAR(30) NULL,
	`TIPJContactNote` VARCHAR(50) NULL,
	`TIPJContactName` VARCHAR(160) NULL,
	`TIPJSupplierName` VARCHAR(200) NULL,
	`TIPJSupAddress` VARCHAR(255) NULL,
	`TIPJPriceChannel` SMALLINT NULL DEFAULT '0',
	`TIPJChannelName` VARCHAR(30) NULL,
	`TIPJDiscountList` FLOAT NULL,
	`TIPJSubTotal` FLOAT NULL,
	`TIPJDiscountText` VARCHAR(30) NULL,
	`TIPJDiscountTotal` FLOAT NULL,
	`TIPJTaxBase` FLOAT NULL DEFAULT '0',
	`TIPJVATRate` DOUBLE NULL,
	`TIPJVATTotal` FLOAT NULL,
	`TIPJNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TIPJZTAXTotal` FLOAT NULL DEFAULT '0',
	`TIPJWTaxBase` FLOAT NULL DEFAULT '0',
	`TIPJWTaxRate` DOUBLE NULL DEFAULT '0',
	`TIPJWTaxTotal` FLOAT NULL DEFAULT '0',
	`TIPJPremiumTotal` FLOAT NULL,
	`TIPJGrandTotalVAT` FLOAT NULL,
	`TIPJGrandTotal` FLOAT NULL,
	`TIPJNetPayment` FLOAT NULL,
	`TIPJTotalFOB` FLOAT NULL,
	`TIPJIVTotal` FLOAT NULL DEFAULT '0',
	`TIPJCNTotal` FLOAT NULL DEFAULT '0',
	`TIPJDBTotal` FLOAT NULL DEFAULT '0',
	`TIPJNetQuantity` DOUBLE NULL DEFAULT '0',
	`TIPJPayQuantity` DOUBLE NULL DEFAULT '0',
	`TIPJPayDate` DATETIME NULL,
	`TIPJRefCN` VARCHAR(255) NULL,
	`TIPJRefDB` VARCHAR(255) NULL,
	`TIPJRefPayment` VARCHAR(255) NULL,
	`TIPJVASTType` FLOAT NULL DEFAULT '0',
	`TIPJDepositText` VARCHAR(30) NULL,
	`TIPJDeposit` FLOAT NULL DEFAULT '0',
	`TIPJIncoType` SMALLINT NULL DEFAULT '0',
	`TIPJInsurance` FLOAT NULL DEFAULT '0',
	`TIPJFreightFee` FLOAT NULL DEFAULT '0',
	`TIPJOtherFee` FLOAT NULL DEFAULT '0',
	`TIPJTransportFee` FLOAT NULL DEFAULT '0',
	`TIPJFirstPayment` FLOAT NULL,
	`TIPJTotalPayment` FLOAT NULL DEFAULT '0',
	`TIPJTotalArrear` FLOAT NULL DEFAULT '0',
	`TIPJIVArrear` FLOAT NULL DEFAULT '0',
	`TIPJCNArrear` FLOAT NULL DEFAULT '0',
	`TIPJDBArrear` FLOAT NULL DEFAULT '0',
	`TIPJIVNetPayment` FLOAT NULL DEFAULT '0',
	`TIPJCNNetPayment` FLOAT NULL DEFAULT '0',
	`TIPJDBNetPayment` FLOAT NULL DEFAULT '0',
	`TIPJTCurCode` VARCHAR(5) NULL,
	`TIPJExchangeRate` FLOAT NULL DEFAULT '0',
	`TIPJAdjustTotal` FLOAT NULL DEFAULT '0',
	`TIPJCountryOrigin` VARCHAR(50) NULL,
	`TIPJCondition` VARCHAR(100) NULL,
	`TIPJConditionDay` SMALLINT NULL DEFAULT '0',
	`TIPJCondition1` DOUBLE NULL DEFAULT '0',
	`TIPJConditionDay1` SMALLINT NULL DEFAULT '0',
	`TIPJPaymentNote` VARCHAR(100) NULL,
	`TIPJStatementNote` VARCHAR(100) NULL,
	`TIPJDeliveryNote` VARCHAR(100) NULL,
	`TIPJDayAvailable` SMALLINT NULL,
	`TIPJDescription` VARCHAR(255) NULL,
	`TIPJTPOTCode` VARCHAR(50) NULL,
	`TIPJDeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TIPJCancelStatus` SMALLINT NULL DEFAULT '0',
	`TIPJConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TIPJApproveStatus` SMALLINT NULL DEFAULT '0',
	`TIPJBillStatus` SMALLINT NULL DEFAULT '0',
	`TIPJCardFlag` SMALLINT NULL DEFAULT '0',
	`TIPJTaxFlag` SMALLINT NULL DEFAULT '0',
	`TIPJFlag1` SMALLINT NULL,
	`TIPJFlag2` SMALLINT NULL,
	`TIPJFlag3` SMALLINT NULL,
	PRIMARY KEY (`TIPJNo`),
	KEY `TAPQTCmpCode` (`TIPJTAPNCode`),
	KEY `TIAPJobCode` (`TIPJJobCode`),
	KEY `TIAPPONo` (`TIPJPONo`),
	KEY `TIAPSOCode` (`TIPJSOCode`),
	KEY `TIvoTACPID` (`TIPJTACPID`),
	KEY `TIvoTACPTACYID` (`TIPJTACPTACYID`),
	KEY `TIvoTaxNo` (`TIPJTaxNo`),
	KEY `TPCNTJbMLn` (`TIPJTJbMLn`),
	KEY `TPODTAPNCode` (`TIPJContactNote`),
	KEY `TPRDTBraCode` (`TIPJTBraCode`),
	KEY `TPWOSupplierName` (`TIPJSupAddress`),
	KEY `TPWOTCmpCode` (`TIPJSupplierName`),
	KEY `TQuoTJobNo` (`TIPJTJobNo`),
	KEY `TQuoTPrjCode` (`TIPJTPrjCode`),
	KEY `TSODTCurCode` (`TIPJTCurCode`),
	KEY `VS4TAPVS4TAPInvoiceADJ` (`TIPJTAPNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPInvoiceCost` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPInvoiceCost`;

# ---------- CREATE TABLE `VS4TAPInvoiceCost` ----------

CREATE TABLE `VS4TAPInvoiceCost` (
	`TIPCTIAPNo` VARCHAR(30) NOT NULL,
	`TIPCToTIAPNo` VARCHAR(30) NOT NULL,
	`TIPCType` SMALLINT NULL,
	`TIPCMode` SMALLINT NULL DEFAULT '0',
	`TIPCCostAmount` DOUBLE NULL DEFAULT '0',
	`TIPCFlag1` SMALLINT NULL DEFAULT '0',
	`TIPCFlag2` SMALLINT NULL DEFAULT '0',
	`TIPCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIPCTIAPNo`, `TIPCToTIAPNo`),
	KEY `VS4TAPInvoiceVS4TAPInvoiceCost` (`TIPCTIAPNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPInvoiceMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPInvoiceMB`;

# ---------- CREATE TABLE `VS4TAPInvoiceMB` ----------

CREATE TABLE `VS4TAPInvoiceMB` (
	`TIPMTIAPNo` VARCHAR(30) NOT NULL,
	`TIPMLn` INT NOT NULL DEFAULT '0',
	`TIPMType` SMALLINT NULL DEFAULT '0',
	`TIPMGroupName` VARCHAR(30) NULL,
	`TIPMJobCode` VARCHAR(30) NULL,
	`TIPMTOExCode` VARCHAR(50) NULL,
	`TIPMTPdtCode` VARCHAR(50) NULL,
	`TIPMSerialNo` VARCHAR(30) NULL,
	`TIPMCustom1` VARCHAR(30) NULL,
	`TIPMCustom2` VARCHAR(150) NULL,
	`TIPMCustom3` VARCHAR(150) NULL,
	`TIPMCustom4` VARCHAR(150) NULL,
	`TIPMCustom5` VARCHAR(150) NULL,
	`TIPMShippingMark` VARCHAR(255) NULL,
	`TIPMProductCode` VARCHAR(50) NULL,
	`TIPMFactoryCode` VARCHAR(50) NULL,
	`TIPMProductName` VARCHAR(255) NULL,
	`TIPMMinimumOrder` DOUBLE NULL DEFAULT '0',
	`TIPMMaximumOrder` DOUBLE NULL DEFAULT '0',
	`TIPMCost` FLOAT NULL DEFAULT '0',
	`TIPMPrice` FLOAT NULL DEFAULT '0',
	`TIPMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TIPMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TIPMQuantityText` VARCHAR(255) NULL,
	`TIPMQuantity` DOUBLE NULL DEFAULT '0',
	`TIPMAcceptError` VARCHAR(30) NULL,
	`TIPMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TIPMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TIPMQuantityStock` DOUBLE NULL DEFAULT '0',
	`TIPMTUntCode` VARCHAR(50) NULL,
	`TIPMQuantity2` DOUBLE NULL DEFAULT '0',
	`TIPMTUntCode2` VARCHAR(50) NULL,
	`TIPMQuantity3` DOUBLE NULL DEFAULT '0',
	`TIPMTUntCode3` VARCHAR(50) NULL,
	`TIPMDutyAmount` FLOAT NULL DEFAULT '0',
	`TIPMDivideExpense` FLOAT NULL DEFAULT '0',
	`TIPMCostAmount` FLOAT NULL DEFAULT '0',
	`TIPMAmount` DOUBLE NULL DEFAULT '0',
	`TIPMDiscountText` VARCHAR(30) NULL,
	`TIPMDiscountTotal` FLOAT NULL,
	`TIPMNetAmount` FLOAT NULL DEFAULT '0',
	`TIPMTaxType` SMALLINT NULL DEFAULT '0',
	`TIPMTaxBase` FLOAT NULL DEFAULT '0',
	`TIPMWTAXBase` FLOAT NULL DEFAULT '0',
	`TIPMAmountVAT` FLOAT NULL DEFAULT '0',
	`TIPMAmountWTAX` FLOAT NULL DEFAULT '0',
	`TIPMGetNumber` DOUBLE NULL DEFAULT '0',
	`TIPMFreeCode` VARCHAR(30) NULL,
	`TIPMIsPremium` SMALLINT NULL DEFAULT '0',
	`TIPMDescription` VARCHAR(255) NULL,
	`TIPMSourceNo` VARCHAR(30) NULL,
	`TIPMSourceLn` INT NULL DEFAULT '0',
	`TIPMSourceDate` DATETIME NULL,
	`TIPMTLctCode` VARCHAR(30) NULL,
	`TIPMFlag1` SMALLINT NULL DEFAULT '0',
	`TIPMFlag2` SMALLINT NULL DEFAULT '0',
	`TIPMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIPMLn`, `TIPMTIAPNo`),
	KEY `TIoMTUntCode2` (`TIPMTUntCode3`),
	KEY `TJbMSourceNo` (`TIPMSourceNo`),
	KEY `TPOBTPdtCode` (`TIPMTPdtCode`),
	KEY `TPSMTOExCode` (`TIPMTOExCode`),
	KEY `TPSMUnitFactor` (`TIPMUnitFactor`),
	KEY `TPWBID` (`TIPMLn`),
	KEY `TPWBPdtCode1` (`TIPMProductCode`),
	KEY `TPWBTUntCode` (`TIPMTUntCode`),
	KEY `TPWBTUntCode1` (`TIPMTUntCode2`),
	KEY `TQuBFactoryCode` (`TIPMFactoryCode`),
	KEY `TSOBFreeCode` (`TIPMFreeCode`),
	KEY `TSOBJobCode` (`TIPMJobCode`),
	KEY `TSOBTLctCode` (`TIPMTLctCode`),
	KEY `TTfMID` (`TIPMTIAPNo`),
	KEY `TTfrToTShfCode` (`TIPMType`),
	KEY `VS4TAPInvoiceVS4TAPInvoiceMB` (`TIPMTIAPNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPInvoicePay` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPInvoicePay`;

# ---------- CREATE TABLE `VS4TAPInvoicePay` ----------

CREATE TABLE `VS4TAPInvoicePay` (
	`TPIPTIAPNo` VARCHAR(30) NOT NULL,
	`TPIPLn` INT NOT NULL DEFAULT '0',
	`TPIPIsChange` SMALLINT NULL DEFAULT '0',
	`TPIPPaymentType` VARCHAR(15) NULL,
	`TPIPCurrency` VARCHAR(4) NULL,
	`TPIPTBnkCode` VARCHAR(50) NULL,
	`TPIPTransferDate` DATETIME NULL,
	`TPIPCashDate` DATETIME NULL,
	`TPIPDocNo` VARCHAR(50) NULL,
	`TPIPBankBranch` VARCHAR(50) NULL,
	`TPIPAccountType` VARCHAR(25) NULL,
	`TPIPAccountName` VARCHAR(160) NULL,
	`TPIPAccountNumber` VARCHAR(30) NULL,
	`TPIPTBCDNo` VARCHAR(10) NULL,
	`TPIPCardCode` VARCHAR(30) NULL,
	`TPIPCardType` VARCHAR(50) NULL,
	`TPIPCardName` VARCHAR(50) NULL,
	`TPIPCardNo` VARCHAR(20) NULL,
	`TPIPBackCardNo` VARCHAR(8) NULL,
	`TPIPCardExpire` VARCHAR(7) NULL,
	`TPIPExchangeRate` DOUBLE NULL DEFAULT '0',
	`TPIPAmount` FLOAT NULL DEFAULT '0',
	`TPIPAmountInRate` FLOAT NULL DEFAULT '0',
	`TPIPAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPIPDiscount` FLOAT NULL DEFAULT '0',
	`TPIPFee` FLOAT NULL DEFAULT '0',
	`TPIPFeeProvide` SMALLINT NULL DEFAULT '0',
	`TPIPNetAmount` FLOAT NULL DEFAULT '0',
	`TPIPTCBBNo` VARCHAR(30) NULL,
	`TPIPNote` VARCHAR(250) NULL,
	`TPIPFlag1` SMALLINT NULL DEFAULT '0',
	`TPIPFlag2` SMALLINT NULL DEFAULT '0',
	`TPIPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPIPTIAPNo`, `TPIPLn`),
	KEY `TPPyTPTAID` (`TPIPTIAPNo`),
	KEY `VS4TAPInvoiceVS4TAPInvoicePay` (`TPIPTIAPNo`),
	KEY `VS4TCompanyBankVS4TAPInvoicePay` (`TPIPTCBBNo`),
	KEY `VS4TPaymentTypeVS4TAPInvoicePay` (`TPIPPaymentType`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPParent` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPParent`;

# ---------- CREATE TABLE `VS4TAPParent` ----------

CREATE TABLE `VS4TAPParent` (
	`TAPPTAPNCode` VARCHAR(30) NOT NULL,
	`TAPPTAPNCode2` VARCHAR(30) NOT NULL,
	`TAPPISMain` SMALLINT NULL DEFAULT '0',
	`TAPPFlag1` SMALLINT NULL DEFAULT '0',
	`TAPPFlag2` SMALLINT NULL DEFAULT '0',
	`TAPPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPPTAPNCode`, `TAPPTAPNCode2`),
	KEY `TARPTARNCode` (`TAPPTAPNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAppointType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAppointType`;

# ---------- CREATE TABLE `VS4TAppointType` ----------

CREATE TABLE `VS4TAppointType` (
	`TAtyCode` VARCHAR(30) NOT NULL,
	`TAtyName` VARCHAR(200) NULL,
	`TAtyName2` VARCHAR(200) NULL,
	`TAtyType` SMALLINT NULL DEFAULT '0',
	`TAtyFlag1` SMALLINT NULL DEFAULT '0',
	`TAtyFlag2` SMALLINT NULL DEFAULT '0',
	`TAtyFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAtyCode`),
	KEY `TCmTCode` (`TAtyCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TApproveOne` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TApproveOne`;

# ---------- CREATE TABLE `VS4TApproveOne` ----------

CREATE TABLE `VS4TApproveOne` (
	`TAP1ID` INT NOT NULL DEFAULT '0',
	`TAP1TUsrID` INT NULL DEFAULT '0',
	`TAP1Password` VARCHAR(30) NULL,
	`TAP1TCmdAlias` VARCHAR(30) NULL,
	`TAP1UsedBy` VARCHAR(30) NULL,
	`TAP1Level` SMALLINT NULL DEFAULT '0',
	`TAP1Status` SMALLINT NULL DEFAULT '0',
	`TAP1Flag1` SMALLINT NULL DEFAULT '0',
	`TAP1Flag2` SMALLINT NULL DEFAULT '0',
	`TAP1Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAP1ID`),
	KEY `TAP1ID` (`TAP1ID`),
	KEY `TAP1TUsrID` (`TAP1TUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPScroll` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPScroll`;

# ---------- CREATE TABLE `VS4TAPScroll` ----------

CREATE TABLE `VS4TAPScroll` (
	`TASCTASGAlias` VARCHAR(30) NOT NULL,
	`TASCScroll` INT NOT NULL DEFAULT '0',
	`TASCName` VARCHAR(100) NULL,
	`TASCName2` VARCHAR(100) NULL,
	`TASCCondition1` VARCHAR(10) NULL,
	`TASCValue1` DOUBLE NULL DEFAULT '0',
	`TASCCondition2` VARCHAR(10) NULL,
	`TASCValue2` DOUBLE NULL DEFAULT '0',
	`TASCTUntCode` VARCHAR(15) NULL,
	`TASCFlag1` SMALLINT NULL DEFAULT '0',
	`TASCFlag2` SMALLINT NULL DEFAULT '0',
	`TASCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TASCTASGAlias`, `TASCScroll`),
	KEY `TAPSTASGCode` (`TASCTASGAlias`),
	KEY `VS4TAPScrollGroupVS4TAPScroll` (`TASCTASGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPScrollGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPScrollGroup`;

# ---------- CREATE TABLE `VS4TAPScrollGroup` ----------

CREATE TABLE `VS4TAPScrollGroup` (
	`TASGAlias` VARCHAR(30) NOT NULL,
	`TASGName` VARCHAR(100) NULL,
	`TASGName2` VARCHAR(100) NULL,
	`TASGType` SMALLINT NULL DEFAULT '0',
	`TASGFlag1` SMALLINT NULL DEFAULT '0',
	`TASGFlag2` SMALLINT NULL DEFAULT '0',
	`TASGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TASGAlias`),
	KEY `TAPSTASGCode` (`TASGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPType`;

# ---------- CREATE TABLE `VS4TAPType` ----------

CREATE TABLE `VS4TAPType` (
	`TAPTCode` VARCHAR(30) NOT NULL,
	`TAPTName` VARCHAR(100) NULL,
	`TAPTName2` VARCHAR(100) NULL,
	`TAPTFlag1` SMALLINT NULL DEFAULT '0',
	`TAPTFlag2` SMALLINT NULL DEFAULT '0',
	`TAPTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPTCode`),
	KEY `TBnkCode` (`TAPTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPVDocRef` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPVDocRef`;

# ---------- CREATE TABLE `VS4TAPVDocRef` ----------

CREATE TABLE `VS4TAPVDocRef` (
	`TPVRTAPVNo` VARCHAR(30) NOT NULL,
	`TPVRLn` INT NOT NULL DEFAULT '0',
	`TPVRType` INT NULL DEFAULT '0',
	`TPVRRefAPBillNo` VARCHAR(30) NULL,
	`TPVRRefDocNo` VARCHAR(30) NULL,
	`TPVRRefDocDate` DATETIME NULL,
	`TPVRRefNo` VARCHAR(30) NULL,
	`TPVRRefNo2` VARCHAR(30) NULL,
	`TPVRRefNo3` VARCHAR(30) NULL,
	`TPVRRefDocAmount` FLOAT NULL DEFAULT '0',
	`TPVRRefDocType` VARCHAR(30) NULL,
	`TPVRRefDueDate` DATETIME NULL,
	`TPVRCurrency` VARCHAR(4) NULL,
	`TPVRCurRate` DOUBLE NULL DEFAULT '0',
	`TPVRCurSubTotal` FLOAT NULL DEFAULT '0',
	`TPVRCurDiscount` FLOAT NULL DEFAULT '0',
	`TPVRCurAmount` FLOAT NULL DEFAULT '0',
	`TPVRAmountRate` FLOAT NULL DEFAULT '0',
	`TPVRTaxBase` FLOAT NULL DEFAULT '0',
	`TPVRVATType` SMALLINT NULL,
	`TPVRVATRate` DOUBLE NULL,
	`TPVRVATTotal` FLOAT NULL,
	`TPVRVATNo` VARCHAR(30) NULL,
	`TPVRTAXNo` VARCHAR(30) NULL,
	`TPVRWTAXRate` DOUBLE NULL DEFAULT '0',
	`TPVRWTAXTotal` FLOAT NULL DEFAULT '0',
	`TPVRWTAXCond` SMALLINT NULL DEFAULT '0',
	`TPVRWTAXDesc` VARCHAR(250) NULL,
	`TPVRCommissionBase` FLOAT NULL DEFAULT '0',
	`TPVRCommissionRate` DOUBLE NULL DEFAULT '0',
	`TPVRCommission` FLOAT NULL DEFAULT '0',
	`TPVRInterestRate` DOUBLE NULL DEFAULT '0',
	`TPVRInterestTotal` FLOAT NULL DEFAULT '0',
	`TPVRTOEXCode` VARCHAR(30) NULL,
	`TPVRDOVAT` SMALLINT NULL DEFAULT '0',
	`TPVRNote` VARCHAR(250) NULL,
	`TPVRNote2` VARCHAR(255) NULL,
	`TPVRFlag1` INT NULL DEFAULT '0',
	`TPVRFlag2` INT NULL DEFAULT '0',
	`TPVRFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TPVRTAPVNo`, `TPVRLn`),
	KEY `TCHRRefNo` (`TPVRRefDocAmount`),
	KEY `TCHRTCHSNo` (`TPVRTAPVNo`),
	KEY `TCHRTCHSTGLTNo` (`TPVRLn`),
	KEY `TRDRTOINCode` (`TPVRTOEXCode`),
	KEY `VS4TAPVoucherVS4TAPVDocRef` (`TPVRTAPVNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPVDocRefMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPVDocRefMB`;

# ---------- CREATE TABLE `VS4TAPVDocRefMB` ----------

CREATE TABLE `VS4TAPVDocRefMB` (
	`TPVMTAPVNo` VARCHAR(30) NOT NULL,
	`TPVMLn` INT NOT NULL DEFAULT '0',
	`TPVMType` INT NULL DEFAULT '0',
	`TPVMRefAPBillNo` VARCHAR(30) NULL,
	`TPVMRefDocNo` VARCHAR(30) NULL,
	`TPVMRefDocDate` DATETIME NULL,
	`TPVMRefNo` VARCHAR(30) NULL,
	`TPVMRefNo2` VARCHAR(30) NULL,
	`TPVMRefNo3` VARCHAR(30) NULL,
	`TPVMRefDocAmount` FLOAT NULL DEFAULT '0',
	`TPVMRefDocType` VARCHAR(30) NULL,
	`TPVMRefDueDate` DATETIME NULL,
	`TPVMCurrency` VARCHAR(4) NULL,
	`TPVMCurRate` DOUBLE NULL DEFAULT '0',
	`TPVMCurSubTotal` FLOAT NULL DEFAULT '0',
	`TPVMCurDiscount` FLOAT NULL DEFAULT '0',
	`TPVMCurAmount` FLOAT NULL DEFAULT '0',
	`TPVMAmountRate` FLOAT NULL DEFAULT '0',
	`TPVMTPdtCode` VARCHAR(50) NULL,
	`TPVMCustom1` VARCHAR(30) NULL,
	`TPVMCustom2` VARCHAR(30) NULL,
	`TPVMCustom3` VARCHAR(30) NULL,
	`TPVMCustom4` VARCHAR(30) NULL,
	`TPVMCustom5` VARCHAR(30) NULL,
	`TPVMFactoryCode` VARCHAR(50) NULL,
	`TPVMProductName` VARCHAR(150) NULL,
	`TPVMCost` FLOAT NULL DEFAULT '0',
	`TPVMOldPrice` FLOAT NULL DEFAULT '0',
	`TPVMPrice` FLOAT NULL DEFAULT '0',
	`TPVMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TPVMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TPVMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TPVMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TPVMQuantity` DOUBLE NULL DEFAULT '0',
	`TPVMTUntCode` VARCHAR(50) NULL,
	`TPVMQuantity2` DOUBLE NULL DEFAULT '0',
	`TPVMTUntCode2` VARCHAR(50) NULL,
	`TPVMQuantity3` DOUBLE NULL DEFAULT '0',
	`TPVMTUntCode3` VARCHAR(50) NULL,
	`TPVMCostAmount` DOUBLE NULL DEFAULT '0',
	`TPVMAmount` DOUBLE NULL DEFAULT '0',
	`TPVMDiscountText` VARCHAR(30) NULL,
	`TPVMDiscountTotal` FLOAT NULL,
	`TPVMNetAmount` FLOAT NULL DEFAULT '0',
	`TPVMNAmountInRate` FLOAT NULL DEFAULT '0',
	`TPVMTaxBase` FLOAT NULL DEFAULT '0',
	`TPVMVATType` SMALLINT NULL,
	`TPVMVATRate` DOUBLE NULL,
	`TPVMVATTotal` FLOAT NULL,
	`TPVMVATNo` VARCHAR(30) NULL,
	`TPVMTAXNo` VARCHAR(30) NULL,
	`TPVMWTAXRate` DOUBLE NULL DEFAULT '0',
	`TPVMWTAXTotal` FLOAT NULL DEFAULT '0',
	`TPVMWTAXCond` SMALLINT NULL DEFAULT '0',
	`TPVMWTAXDesc` VARCHAR(250) NULL,
	`TPVMCommissionBase` FLOAT NULL DEFAULT '0',
	`TPVMCommissionRate` DOUBLE NULL DEFAULT '0',
	`TPVMCommission` FLOAT NULL DEFAULT '0',
	`TPVMInterestRate` DOUBLE NULL DEFAULT '0',
	`TPVMInterestTotal` FLOAT NULL DEFAULT '0',
	`TPVMNote` VARCHAR(255) NULL,
	`TPVMNote2` VARCHAR(255) NULL,
	`TPVMFlag1` INT NULL DEFAULT '0',
	`TPVMFlag2` INT NULL DEFAULT '0',
	`TPVMFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TPVMTAPVNo`, `TPVMLn`),
	KEY `TCHRRefNo` (`TPVMRefDocAmount`),
	KEY `TCHRTCHSNo` (`TPVMTAPVNo`),
	KEY `TCHRTCHSTGLTNo` (`TPVMLn`),
	KEY `TRVMFactoryCode` (`TPVMFactoryCode`),
	KEY `TRVMTPOSCode` (`TPVMTPdtCode`),
	KEY `TRVMTUntCode` (`TPVMTUntCode`),
	KEY `TRVMTUntCode2` (`TPVMTUntCode2`),
	KEY `TRVMTUntCode3` (`TPVMTUntCode3`),
	KEY `TRVMUnitFactor` (`TPVMUnitFactor`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPVoucher` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPVoucher`;

# ---------- CREATE TABLE `VS4TAPVoucher` ----------

CREATE TABLE `VS4TAPVoucher` (
	`TAPVNo` VARCHAR(30) NOT NULL,
	`TAPVDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPVType` SMALLINT NULL DEFAULT '0',
	`TAPVDetailType` SMALLINT NULL DEFAULT '0',
	`TAPVMode` SMALLINT NULL DEFAULT '0',
	`TAPVBalanceFlag` SMALLINT NULL DEFAULT '0',
	`TAPVBaseArrear` FLOAT NULL DEFAULT '0',
	`TAPVArrear` FLOAT NULL DEFAULT '0',
	`TAPVRefNo` VARCHAR(30) NULL,
	`TAPVRefDate` DATETIME NULL,
	`TAPVRefNo2` VARCHAR(30) NULL,
	`TAPVRefNo3` VARCHAR(30) NULL,
	`TAPVPaymentStatus` SMALLINT NULL DEFAULT '0',
	`TAPVTBraCode` VARCHAR(30) NULL,
	`TAPVTAPNCode` VARCHAR(30) NULL,
	`TAPVPayTo` VARCHAR(160) NULL,
	`TAPVAddress` VARCHAR(255) NULL,
	`TAPVCurrency` VARCHAR(4) NULL,
	`TAPVSubTotal` FLOAT NULL DEFAULT '0',
	`TAPVCurRate` VARCHAR(50) NULL,
	`TAPVCurAmount` FLOAT NULL DEFAULT '0',
	`TAPVCurDiscount` FLOAT NULL DEFAULT '0',
	`TAPVDiscount` FLOAT NULL DEFAULT '0',
	`TAPVPayLess` FLOAT NULL DEFAULT '0',
	`TAPVAdjustTotal` FLOAT NULL DEFAULT '0',
	`TAPVFee` FLOAT NULL DEFAULT '0',
	`TAPVNetAmount` FLOAT NULL DEFAULT '0',
	`TAPVTaxBase` FLOAT NULL DEFAULT '0',
	`TAPVWTAXTotal` FLOAT NULL DEFAULT '0',
	`TAPVTaxBase2` FLOAT NULL DEFAULT '0',
	`TAPVWTAXTotal2` FLOAT NULL DEFAULT '0',
	`TAPVTotal` FLOAT NULL DEFAULT '0',
	`TAPVNote` VARCHAR(255) NULL,
	`TAPVTGLBCode` VARCHAR(30) NULL,
	`TAPVTPrjCode` VARCHAR(30) NULL,
	`TAPVGLMethod` SMALLINT NULL DEFAULT '0',
	`TAPVTGLTNo` VARCHAR(30) NULL,
	`TAPVTTeTNo` VARCHAR(30) NULL,
	`TAPVVATNo` VARCHAR(30) NULL,
	`TAPVTaxPeriodNo` DATETIME NULL,
	`TAPVTaxPeriodType` SMALLINT NULL,
	`TAPVTaxRefund` SMALLINT NULL,
	`TAPVPayType` SMALLINT NULL DEFAULT '0',
	`TAPVTaxNo` VARCHAR(30) NULL,
	`TAPVWTaxPeriodNo` VARCHAR(10) NULL,
	`TAPVWTaxPeriodType` SMALLINT NULL,
	`TAPVChequePayment` FLOAT NULL DEFAULT '0',
	`TAPVCashPayment` FLOAT NULL DEFAULT '0',
	`TAPVBankPayment` FLOAT NULL DEFAULT '0',
	`TAPVCutDeposit` FLOAT NULL DEFAULT '0',
	`TAPVCardPayment` FLOAT NULL DEFAULT '0',
	`TAPVPayCoupon` FLOAT NULL DEFAULT '0',
	`TAPVPayOther` FLOAT NULL DEFAULT '0',
	`TAPVPayMisc` FLOAT NULL DEFAULT '0',
	`TAPVCommissionBase` FLOAT NULL DEFAULT '0',
	`TAPVCommissionRate` DOUBLE NULL DEFAULT '0',
	`TAPVCommission` FLOAT NULL DEFAULT '0',
	`TAPVInterestRate` DOUBLE NULL DEFAULT '0',
	`TAPVInterestTotal` FLOAT NULL DEFAULT '0',
	`TAPVCardFlag` SMALLINT NULL DEFAULT '0',
	`TAPVTaxFlag` SMALLINT NULL DEFAULT '0',
	`TAPVClientTaxNo` VARCHAR(30) NULL,
	`TAPVAPType` SMALLINT NULL DEFAULT '0',
	`TAPVCreateCode` VARCHAR(30) NULL,
	`TAPVCreateBy` VARCHAR(140) NULL,
	`TAPVCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPVEditCode` VARCHAR(30) NULL,
	`TAPVEditBy` VARCHAR(140) NULL,
	`TAPVEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPVConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TAPVConfirmBy` VARCHAR(140) NULL,
	`TAPVConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPVApproveStatus` SMALLINT NULL DEFAULT '0',
	`TAPVApproveBy` VARCHAR(140) NULL,
	`TAPVApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPVApproveNote` VARCHAR(80) NULL,
	`TAPVRevision` SMALLINT NULL DEFAULT '0',
	`TAPVCancelStatus` SMALLINT NULL DEFAULT '0',
	`TAPVCancelNo` VARCHAR(30) NULL,
	`TAPVCancelBy` VARCHAR(140) NULL,
	`TAPVCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAPVCancelNote` VARCHAR(80) NULL,
	`TAPVFlag1` SMALLINT NULL DEFAULT '0',
	`TAPVFlag2` SMALLINT NULL DEFAULT '0',
	`TAPVFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPVNo`),
	KEY `TAPVPrepaid` (`TAPVPaymentStatus`),
	KEY `TAPVTAPNCode` (`TAPVTAPNCode`),
	KEY `TGLTTGLBCode` (`TAPVTGLBCode`),
	KEY `TIAPSupAddress` (`TAPVAddress`),
	KEY `TRVHTPrjCode` (`TAPVTPrjCode`),
	KEY `VS4TAPVS4TAPVoucher` (`TAPVTAPNCode`),
	KEY `VS4TProjectVS4TAPVoucher` (`TAPVTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAPVoucherPay` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAPVoucherPay`;

# ---------- CREATE TABLE `VS4TAPVoucherPay` ----------

CREATE TABLE `VS4TAPVoucherPay` (
	`TPVPTAPVNo` VARCHAR(30) NOT NULL,
	`TPVPLn` INT NOT NULL DEFAULT '0',
	`TPVPIsChange` SMALLINT NULL DEFAULT '0',
	`TPVPPaymentType` VARCHAR(15) NULL,
	`TPVPCurrency` VARCHAR(4) NULL,
	`TPVPTBnkCode` VARCHAR(10) NULL,
	`TPVPTransferDate` DATETIME NULL,
	`TPVPCashDate` DATETIME NULL,
	`TPVPDocNo` VARCHAR(50) NULL,
	`TPVPBankBranch` VARCHAR(50) NULL,
	`TPVPAccountType` VARCHAR(25) NULL,
	`TPVPAccountName` VARCHAR(160) NULL,
	`TPVPAccountNumber` VARCHAR(30) NULL,
	`TPVPTBCDNo` VARCHAR(10) NULL,
	`TPVPCardCode` VARCHAR(30) NULL,
	`TPVPCardType` VARCHAR(50) NULL,
	`TPVPCardName` VARCHAR(50) NULL,
	`TPVPCardNo` VARCHAR(20) NULL,
	`TPVPBackCardNo` VARCHAR(8) NULL,
	`TPVPCardExpire` VARCHAR(7) NULL,
	`TPVPExchangeRate` DOUBLE NULL DEFAULT '0',
	`TPVPAmount` FLOAT NULL DEFAULT '0',
	`TPVPAmountInRate` FLOAT NULL DEFAULT '0',
	`TPVPAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPVPDiscount` FLOAT NULL DEFAULT '0',
	`TPVPFee` FLOAT NULL DEFAULT '0',
	`TPVPFeeProvide` SMALLINT NULL DEFAULT '0',
	`TPVPNetAmount` FLOAT NULL DEFAULT '0',
	`TPVPTCBBNo` VARCHAR(30) NULL,
	`TPVPNote` VARCHAR(250) NULL,
	`TPVPFlag1` SMALLINT NULL DEFAULT '0',
	`TPVPFlag2` SMALLINT NULL DEFAULT '0',
	`TPVPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPVPTAPVNo`, `TPVPLn`),
	KEY `TPPyTPTAID` (`TPVPTAPVNo`),
	KEY `VS4TAPVoucherVS4TAPVoucherPay` (`TPVPTAPVNo`),
	KEY `VS4TCompanyBankVS4TAPVoucherPay` (`TPVPTCBBNo`),
	KEY `VS4TPaymentTypeVS4TAPVoucherPay` (`TPVPPaymentType`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAR` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAR`;

# ---------- CREATE TABLE `VS4TAR` ----------

CREATE TABLE `VS4TAR` (
	`TARNCode` VARCHAR(30) NOT NULL,
	`TARNTCmpCode` VARCHAR(30) NULL,
	`TARNTARTCode` VARCHAR(30) NULL,
	`TARNIntro` VARCHAR(50) NULL,
	`TARNName` VARCHAR(200) NULL,
	`TARNName2` VARCHAR(200) NULL,
	`TARNIntroName` VARCHAR(200) NULL,
	`TARNType` SMALLINT NULL DEFAULT '0',
	`TARNOwnerName` VARCHAR(160) NULL,
	`TARNDocCode` VARCHAR(30) NULL,
	`TARNContactName` VARCHAR(160) NULL,
	`TARNTaxNo` VARCHAR(30) NULL,
	`TARNAccountCode` VARCHAR(30) NULL,
	`TARNTARGCode` VARCHAR(30) NULL,
	`TARNAddressBill` VARCHAR(255) NULL,
	`TARNAddressDeliver` VARCHAR(255) NULL,
	`TARNAddress` VARCHAR(255) NULL,
	`TARNAddress2` VARCHAR(255) NULL,
	`TARNSubProvince` VARCHAR(50) NULL,
	`TARNCity` VARCHAR(50) NULL,
	`TARNPostalCode` VARCHAR(5) NULL,
	`TARNStaCode` VARCHAR(3) NULL,
	`TARNTCouCode` VARCHAR(3) NULL,
	`TARNWebsite` VARCHAR(50) NULL,
	`TARNEmail` VARCHAR(50) NULL,
	`TARNPhone` VARCHAR(100) NULL,
	`TARNFax` VARCHAR(50) NULL,
	`TARNMobile` VARCHAR(20) NULL,
	`TARNImage1` VARCHAR(50) NULL,
	`TARNCreditUseBegin` FLOAT NULL DEFAULT '0',
	`TARNCreditLimit` FLOAT NULL DEFAULT '0',
	`TARNCreditUseBal` FLOAT NULL DEFAULT '0',
	`TARNCreditUse` FLOAT NULL DEFAULT '0',
	`TARNCreditBalance` FLOAT NULL DEFAULT '0',
	`TARNCreditAvaiBal` FLOAT NULL DEFAULT '0',
	`TARNBeginBalance` FLOAT NULL DEFAULT '0',
	`TARNTotalOrderBal` INT NULL DEFAULT '0',
	`TARNPriceChannel` SMALLINT NULL DEFAULT '0',
	`TARNDiscount` VARCHAR(30) NULL,
	`TARNDiscountPC` DOUBLE NULL DEFAULT '0',
	`TARNDiscountDay` SMALLINT NULL DEFAULT '0',
	`TARNCreditDay` SMALLINT NULL DEFAULT '0',
	`TARNLimitTCurCode` VARCHAR(15) NULL,
	`TARNSpecialTaxRate` DOUBLE NULL DEFAULT '0',
	`TARNPaymentNote` VARCHAR(255) NULL,
	`TARNStatementNote` VARCHAR(255) NULL,
	`TARNDeliveryNote` VARCHAR(255) NULL,
	`TARNMapFile` VARCHAR(50) NULL,
	`TARNTimeToOrder` INT NULL DEFAULT '0',
	`TARNLastDueDate` DATETIME NULL,
	`TARNFirstOrderDate` DATETIME NULL,
	`TARNLastOrderDate` DATETIME NULL,
	`TARNTARSAlias` VARCHAR(30) NULL,
	`TARNTBsTCode` VARCHAR(30) NULL,
	`TARNTSAeCode` VARCHAR(30) NULL,
	`TARNNeedBill` SMALLINT NULL DEFAULT '0',
	`TARNBillDay1` SMALLINT NULL DEFAULT '0',
	`TARNBillDay2` SMALLINT NULL DEFAULT '0',
	`TARNBillDay3` SMALLINT NULL DEFAULT '0',
	`TARNBillDay4` SMALLINT NULL DEFAULT '0',
	`TARNBillMove` SMALLINT NULL DEFAULT '0',
	`TARNBillAdjust` SMALLINT NULL DEFAULT '0',
	`TARNNote` VARCHAR(255) NULL,
	`TARNCreateCode` VARCHAR(30) NULL,
	`TARNCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TARNEditCode` VARCHAR(30) NULL,
	`TARNEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TARNTextSort` VARCHAR(30) NULL,
	`TARNFlag1` SMALLINT NULL DEFAULT '0',
	`TARNFlag2` SMALLINT NULL DEFAULT '0',
	`TARNFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARNCode`),
	KEY `VS4TARStatusVS4TAR` (`TARNTARSAlias`),
	KEY `VS4TARTypeVS4TAR` (`TARNTARTCode`),
	KEY `VS4TBusinessTypeVS4TAR` (`TARNTBsTCode`),
	KEY `VS4TCountryVS4TAR` (`TARNTCouCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAR2` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAR2`;

# ---------- CREATE TABLE `VS4TAR2` ----------

CREATE TABLE `VS4TAR2` (
	`TAR2TARNCode` VARCHAR(30) NOT NULL,
	`TAR2Ln` INT NOT NULL DEFAULT '0',
	`TAR2OwnerName` VARCHAR(160) NULL,
	`TAR2Nature` VARCHAR(120) NULL,
	`TAR2TaxNo` VARCHAR(30) NULL,
	`TAR2TAPNCode` VARCHAR(30) NULL,
	`TAR2SaleCode` VARCHAR(30) NULL,
	`TAR2TCMSCode` VARCHAR(30) NULL,
	`TAR2CreditUseBegin` FLOAT NULL DEFAULT '0',
	`TAR2CreditLimit` FLOAT NULL DEFAULT '0',
	`TAR2CreditUseBal` FLOAT NULL DEFAULT '0',
	`TAR2CreditUse` FLOAT NULL DEFAULT '0',
	`TAR2CreditBalance` FLOAT NULL DEFAULT '0',
	`TAR2CreditAvaiBal` FLOAT NULL DEFAULT '0',
	`TAR2BeginBalance` FLOAT NULL DEFAULT '0',
	`TAR2TotalOrderBal` INT NULL DEFAULT '0',
	`TAR2DiscountPC` DOUBLE NULL DEFAULT '0',
	`TAR2DiscountDay` SMALLINT NULL DEFAULT '0',
	`TAR2CreditDay` SMALLINT NULL DEFAULT '0',
	`TAR2LimitTCurCode` VARCHAR(15) NULL,
	`TAR2TimeToOrder` INT NULL DEFAULT '0',
	`TAR2LastDueDate` DATETIME NULL,
	`TAR2LastOrderDate` DATETIME NULL,
	`TAR2RelationLevel` SMALLINT NULL DEFAULT '0',
	`TAR2CompanyHolder` SMALLINT NULL DEFAULT '0',
	`TAR2SignDate` DATETIME NULL,
	`TAR2Capital` FLOAT NULL DEFAULT '0',
	`TAR2CapitalPC` DOUBLE NULL DEFAULT '0',
	`TAR2CapitalNote` VARCHAR(50) NULL,
	`TAR2VATDoc` SMALLINT NULL DEFAULT '0',
	`TAR2VATDocImage` VARCHAR(50) NULL,
	`TAR2Assure` SMALLINT NULL DEFAULT '0',
	`TAR2AssureImage` VARCHAR(50) NULL,
	`TAR2FirstDrawing` SMALLINT NULL DEFAULT '0',
	`TAR2Profile` INT NULL DEFAULT '0',
	`TAR2Level` INT NULL DEFAULT '0',
	`TAR2CashOnly` TINYINT NULL DEFAULT '0',
	`TAR2TRouCode` VARCHAR(30) NULL,
	`TAR2TShpCode` VARCHAR(30) NULL,
	`TAR2DeliveryCond` SMALLINT NULL DEFAULT '0',
	`TAR2Distance` DOUBLE NULL DEFAULT '0',
	`TAR2DeliveryHour` DOUBLE NULL DEFAULT '0',
	`TAR2UseLastPrice` SMALLINT NULL DEFAULT '0',
	`TAR2RequestBy` VARCHAR(160) NULL,
	`TAR2RequestDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAR2ApproveBy` VARCHAR(160) NULL,
	`TAR2ApproveStatus` SMALLINT NULL DEFAULT '0',
	`TAR2ApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAR2TMedCode` VARCHAR(30) NULL,
	`TAR2Favorite` VARCHAR(255) NULL,
	`TAR2NotLike` VARCHAR(255) NULL,
	`TAR2Style` VARCHAR(255) NULL,
	`TAR2TSPvCode` VARCHAR(4) NULL,
	`TAR2TPrvCode` VARCHAR(3) NULL,
	`TAR2TDecCode` VARCHAR(30) NULL,
	`TAR2TBSMCode` VARCHAR(30) NULL,
	`TAR2Grade` SMALLINT NULL DEFAULT '0',
	`TAR2MonthlyAppoint` SMALLINT NULL DEFAULT '0',
	`TAR2TSitCode` VARCHAR(30) NULL,
	`TAR2Marks` VARCHAR(200) NULL,
	`TAR2LastInvoice` VARCHAR(30) NULL,
	`TAR2BillNote` VARCHAR(255) NULL,
	`TAR2Note2` VARCHAR(255) NULL,
	`TAR2Note3` VARCHAR(255) NULL,
	`TAR2LifeStyle1` VARCHAR(250) NULL,
	`TAR2LifeStyle2` VARCHAR(250) NULL,
	`TAR2Flag1` SMALLINT NULL DEFAULT '0',
	`TAR2Flag2` SMALLINT NULL DEFAULT '0',
	`TAR2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAR2TARNCode`, `TAR2Ln`),
	KEY `TAPCCode` (`TAR2TARNCode`),
	KEY `TAR2TDecCode` (`TAR2TPrvCode`),
	KEY `TAR2TDecCode1` (`TAR2TBSMCode`),
	KEY `TAR2TMedCode` (`TAR2TMedCode`),
	KEY `TAR2TMedCode1` (`TAR2Favorite`),
	KEY `TAR2TPrvCode` (`TAR2TSPvCode`),
	KEY `TAR2TRouCode` (`TAR2TRouCode`),
	KEY `TAR2TShpcode` (`TAR2TShpCode`),
	KEY `TAR2TSitCode` (`TAR2TSitCode`),
	KEY `TAR2TSitCode1` (`TAR2TDecCode`),
	KEY `TAR2VATDocImage` (`TAR2AssureImage`),
	KEY `TARNTEmpCode` (`TAR2VATDocImage`),
	KEY `VS4TARVS4TAR2` (`TAR2TARNCode`),
	KEY `VS4TDistrictVS4TAR2` (`TAR2TSPvCode`),
	KEY `VS4TProvinceVS4TAR2` (`TAR2TPrvCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAR3` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAR3`;

# ---------- CREATE TABLE `VS4TAR3` ----------

CREATE TABLE `VS4TAR3` (
	`TAR3TARNCode` VARCHAR(30) NOT NULL,
	`TAR3Ln` INT NOT NULL DEFAULT '0',
	`TAR3Gender` VARCHAR(1) NULL,
	`TAR3TitleName` VARCHAR(50) NULL,
	`TAR3FirstName` VARCHAR(50) NULL,
	`TAR3MiddleName` VARCHAR(5) NULL,
	`TAR3LastName` VARCHAR(50) NULL,
	`TAR3AliasName` VARCHAR(10) NULL,
	`TAR3NickName` VARCHAR(20) NULL,
	`TAR3TitleName2` VARCHAR(50) NULL,
	`TAR3FirstName2` VARCHAR(50) NULL,
	`TAR3MiddleName2` VARCHAR(5) NULL,
	`TAR3Lastname2` VARCHAR(50) NULL,
	`TAR3PostAddess` SMALLINT NULL DEFAULT '0',
	`TAR3CitizenNo` VARCHAR(15) NULL,
	`TAR3CitizenFrom` DATETIME NULL,
	`TAR3CitizenTo` DATETIME NULL,
	`TAR3CitizenAddress` VARCHAR(255) NULL,
	`TAR3Race` VARCHAR(50) NULL,
	`TAR3CitizenShip` VARCHAR(50) NULL,
	`TAR3Religion` VARCHAR(50) NULL,
	`TAR3Language` VARCHAR(50) NULL,
	`TAR3BornZone` VARCHAR(30) NULL,
	`TAR3SocialSecurity` VARCHAR(15) NULL,
	`TAR3BirthDay` DATETIME NULL DEFAULT '3333-3-3',
	`TAR3Blood` VARCHAR(5) NULL,
	`TAR3Height` DOUBLE NULL DEFAULT '0',
	`TAR3Weight` DOUBLE NULL DEFAULT '0',
	`TAR3StatusPer` SMALLINT NULL DEFAULT '0',
	`TAR3PassportNo` VARCHAR(15) NULL,
	`TAR3CardAlien` VARCHAR(50) NULL,
	`TAR3AllowAlien` VARCHAR(50) NULL,
	`TAR3PassportFrom` DATETIME NULL,
	`TAR3PassportTo` DATETIME NULL,
	`TAR3WorkPermitFrom` DATETIME NULL,
	`TAR3WorkPermitTo` DATETIME NULL,
	`TAR3Company` VARCHAR(200) NULL,
	`TAR3Company2` VARCHAR(200) NULL,
	`TAR3CmpAddress` VARCHAR(200) NULL,
	`TAR3CmpAddress2` VARCHAR(200) NULL,
	`TAR3TSpvCode` VARCHAR(4) NULL,
	`TAR3TPrvCode` VARCHAR(2) NULL,
	`TAR3PostalCode` VARCHAR(5) NULL,
	`TAR3TStaCode` VARCHAR(3) NULL,
	`TAR3TCouCode` VARCHAR(30) NULL,
	`TAR3Website` VARCHAR(50) NULL,
	`TAR3Email` VARCHAR(50) NULL,
	`TAR3Phone` VARCHAR(100) NULL,
	`TAR3Fax` VARCHAR(50) NULL,
	`TAR3Image1` VARCHAR(50) NULL,
	`TAR3Salary` FLOAT NULL DEFAULT '0',
	`TAR3OtherIncome` FLOAT NULL DEFAULT '0',
	`TAR3FirstTalkType` SMALLINT NULL DEFAULT '0',
	`TAR3ProspectStatus` SMALLINT NULL DEFAULT '0',
	`TAR3OrderStatus` SMALLINT NULL DEFAULT '0',
	`TAR3Flag1` SMALLINT NULL DEFAULT '0',
	`TAR3Flag2` SMALLINT NULL DEFAULT '0',
	`TAR3Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAR3TARNCode`, `TAR3Ln`),
	KEY `VS4TARVS4TAR3` (`TAR3TARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARAppointComp` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARAppointComp`;

# ---------- CREATE TABLE `VS4TARAppointComp` ----------

CREATE TABLE `VS4TARAppointComp` (
	`TARMTARANo` VARCHAR(30) NOT NULL,
	`TARMTTCPSTCPTCode` VARCHAR(30) NOT NULL,
	`TARMTCPSCode` VARCHAR(30) NOT NULL,
	`TARMFlag1` SMALLINT NULL DEFAULT '0',
	`TARMFlag2` SMALLINT NULL DEFAULT '0',
	`TARMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARMTARANo`, `TARMTTCPSTCPTCode`, `TARMTCPSCode`),
	KEY `VS4TARAppointmentVS4TARAppointComp` (`TARMTARANo`),
	KEY `VS4TCompetSectionVS4TARAppointComp` (`TARMTTCPSTCPTCode`, `TARMTCPSCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARAppointment` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARAppointment`;

# ---------- CREATE TABLE `VS4TARAppointment` ----------

CREATE TABLE `VS4TARAppointment` (
	`TARANo` VARCHAR(30) NOT NULL,
	`TARAType` SMALLINT NULL DEFAULT '0',
	`TARATAtyCode` VARCHAR(30) NULL,
	`TARATCCtCode` VARCHAR(30) NULL,
	`TARATPrjCode` VARCHAR(30) NULL,
	`TARADate` DATETIME NULL DEFAULT '3333-3-3',
	`TARARefNo` VARCHAR(30) NULL,
	`TARAPriority` DOUBLE NULL DEFAULT '0',
	`TARAFromTime` DATETIME NULL DEFAULT '3333-3-3',
	`TARAHour` DOUBLE NULL DEFAULT '0',
	`TARAToTime` DATETIME NULL DEFAULT '3333-3-3',
	`TARAIsReminder` SMALLINT NULL DEFAULT '0',
	`TARAReminderTime` DATETIME NULL,
	`TARAIsReminder2` SMALLINT NULL DEFAULT '0',
	`TARAReminderTime2` DATETIME NULL,
	`TARAVisitTime` DATETIME NULL DEFAULT '3333-3-3',
	`TARAMedTime` DATETIME NULL DEFAULT '3333-3-3',
	`TARAFinishTime` DATETIME NULL DEFAULT '3333-3-3',
	`TARATEmpCode` VARCHAR(30) NULL,
	`TARAEmployeeName` VARCHAR(30) NULL,
	`TARATOTNLn` INT NULL,
	`TARATARNCode` VARCHAR(30) NULL,
	`TARATARCCode` VARCHAR(30) NULL,
	`TARAContactName` VARCHAR(255) NULL,
	`TARATel` VARCHAR(100) NULL,
	`TARALocation` VARCHAR(255) NULL,
	`TARALocationTel` VARCHAR(255) NULL,
	`TARASubject` VARCHAR(255) NULL,
	`TARADetail` TEXT NULL,
	`TARAAppointStatus` SMALLINT NULL DEFAULT '0',
	`TARASummary` TEXT NULL,
	`TARADescription` TEXT NULL,
	`TARAMisNote` VARCHAR(255) NULL,
	`TARAProspectStatus` SMALLINT NULL DEFAULT '0',
	`TARAOrderStatus` SMALLINT NULL DEFAULT '0',
	`TARACheckStatus` SMALLINT NULL DEFAULT '0',
	`TARACheckDate` DATETIME NULL,
	`TARACreateCode` VARCHAR(30) NULL,
	`TARACreateBy` VARCHAR(140) NULL,
	`TARACreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TARAEditCode` VARCHAR(30) NULL,
	`TARAEditBy` VARCHAR(140) NULL,
	`TARAEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TARAConfirmStatus` SMALLINT NULL,
	`TARAConfirmBy` VARCHAR(140) NULL,
	`TARAConfirmDate` DATETIME NULL,
	`TARAConfirmNote` VARCHAR(80) NULL,
	`TARAApproveStatus` SMALLINT NULL,
	`TARAApproveBy` VARCHAR(140) NULL,
	`TARAApproveDate` DATETIME NULL,
	`TARAApproveNote` VARCHAR(80) NULL,
	`TARARevision` SMALLINT NULL,
	`TARACancelStatus` SMALLINT NULL,
	`TARACancelNo` VARCHAR(30) NULL,
	`TARACancelBy` VARCHAR(140) NULL,
	`TARACancelDate` DATETIME NULL,
	`TARACancelNote` VARCHAR(80) NULL,
	`TARAFlag1` SMALLINT NULL DEFAULT '0',
	`TARAFlag2` SMALLINT NULL DEFAULT '0',
	`TARAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARANo`),
	KEY `TARAID` (`TARANo`),
	KEY `TARALastTARAID` (`TARARefNo`),
	KEY `TARATAtyCode` (`TARATAtyCode`),
	KEY `TARATCCtCode` (`TARATCCtCode`),
	KEY `TARATel` (`TARALocationTel`),
	KEY `TQuoTPrjCode` (`TARATPrjCode`),
	KEY `TRCNCusAddress` (`TARALocation`),
	KEY `TRCNLocation` (`TARATel`),
	KEY `TRCNTARCCode` (`TARATARCCode`),
	KEY `VS4TAppointTypeVS4TARAppointment` (`TARATAtyCode`),
	KEY `VS4TARVS4TARAppointment` (`TARATARNCode`),
	KEY `VS4TEmployeeVS4TARAppointment` (`TARATEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARBalance` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARBalance`;

# ---------- CREATE TABLE `VS4TARBalance` ----------

CREATE TABLE `VS4TARBalance` (
	`TARLTACPTACYID` INT NOT NULL DEFAULT '0',
	`TARLTACPID` INT NOT NULL DEFAULT '0',
	`TARLTARNCode` VARCHAR(30) NOT NULL,
	`TARLMode` INT NOT NULL DEFAULT '0',
	`TARLQuarter` INT NULL DEFAULT '0',
	`TARLCreditLimit` FLOAT NULL DEFAULT '0',
	`TARLCreditUseBal` FLOAT NULL DEFAULT '0',
	`TARLCreditUse` FLOAT NULL DEFAULT '0',
	`TARLCreditBalance` FLOAT NULL DEFAULT '0',
	`TARLCreditAvaiBal` FLOAT NULL DEFAULT '0',
	`TARLBeginBalance` FLOAT NULL DEFAULT '0',
	`TARLTotalOrderBal` INT NULL DEFAULT '0',
	`TARLTotalOrder` FLOAT NULL DEFAULT '0',
	`TARLTimeOrder` INT NULL DEFAULT '0',
	`TARLDisBill` FLOAT NULL DEFAULT '0',
	`TARLCostTotal` FLOAT NULL DEFAULT '0',
	`TARLInvGrandTotal` FLOAT NULL,
	`TARLCNGrandTotal` FLOAT NULL,
	`TARLDBGrandTotal` FLOAT NULL,
	`TARLBillTotal` FLOAT NULL,
	`TARLChequePayment` FLOAT NULL,
	`TARLCashPayment` FLOAT NULL,
	`TARLBankPayment` FLOAT NULL,
	`TARLCardPayment` FLOAT NULL,
	`TARLDisCash` FLOAT NULL DEFAULT '0',
	`TARLAdjustTotal` FLOAT NULL DEFAULT '0',
	`TARLInterestTotal` FLOAT NULL DEFAULT '0',
	`TARLCutDeposit` FLOAT NULL DEFAULT '0',
	`TARLFee` FLOAT NULL DEFAULT '0',
	`TARLWtaxTotal` FLOAT NULL DEFAULT '0',
	`TARLWtaxTotal2` FLOAT NULL DEFAULT '0',
	`TARLPayLess` FLOAT NULL DEFAULT '0',
	`TARLPayCoupon` FLOAT NULL DEFAULT '0',
	`TARLPayOther` FLOAT NULL DEFAULT '0',
	`TARLPayMisc` FLOAT NULL DEFAULT '0',
	`TARLTotalPaid` FLOAT NULL DEFAULT '0',
	`TARLTotalLate` FLOAT NULL DEFAULT '0',
	`TARLEndBalance` FLOAT NULL DEFAULT '0',
	`TARLFlag1` SMALLINT NULL DEFAULT '0',
	`TARLFlag2` SMALLINT NULL DEFAULT '0',
	`TARLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARLTACPTACYID`, `TARLTACPID`, `TARLTARNCode`, `TARLMode`),
	KEY `TARLQuarter` (`TARLMode`),
	KEY `TGTMQuarter` (`TARLQuarter`),
	KEY `TGTMTACPID` (`TARLTACPID`),
	KEY `TGTMTACPTACYID` (`TARLTACPTACYID`),
	KEY `TGTMTGTSTACCCode` (`TARLTARNCode`),
	KEY `VS4TAccountPeriodVS4TARBalance` (`TARLTACPTACYID`, `TARLTACPID`),
	KEY `VS4TARVS4TARBalance` (`TARLTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARBill` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARBill`;

# ---------- CREATE TABLE `VS4TARBill` ----------

CREATE TABLE `VS4TARBill` (
	`TBilNo` VARCHAR(30) NOT NULL,
	`TBilDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBilDueDate` DATETIME NULL,
	`TBilRefNo` VARCHAR(30) NULL,
	`TBilRefDate` DATETIME NULL,
	`TBilTBraCode` VARCHAR(30) NULL,
	`TBilTARNCode` VARCHAR(30) NULL,
	`TBilTPrjCode` VARCHAR(30) NULL,
	`TBilPayTo` VARCHAR(160) NULL,
	`TBilARAddress` VARCHAR(255) NULL,
	`TBilGrandTotal` FLOAT NULL DEFAULT '0',
	`TBilCost` FLOAT NULL DEFAULT '0',
	`TBilNote` VARCHAR(255) NULL,
	`TBilFlagBill` INT NULL DEFAULT '0',
	`TBilNetPayment` FLOAT NULL DEFAULT '0',
	`TBilArrears` FLOAT NULL DEFAULT '0',
	`TBilCommissionBase` FLOAT NULL DEFAULT '0',
	`TBilCommissionRate` VARCHAR(30) NULL,
	`TBilCommission` FLOAT NULL DEFAULT '0',
	`TBilCreateCode` VARCHAR(30) NULL,
	`TBilCreateBy` VARCHAR(140) NULL,
	`TBilCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBilEditCode` VARCHAR(30) NULL,
	`TBilEditBy` VARCHAR(140) NULL,
	`TBilEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBilConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TBilConfirmBy` VARCHAR(140) NULL,
	`TBilConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBilApproveStatus` SMALLINT NULL DEFAULT '0',
	`TBilApproveBy` VARCHAR(140) NULL,
	`TBilApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBilApproveNote` VARCHAR(80) NULL,
	`TBilRevision` SMALLINT NULL DEFAULT '0',
	`TBilCancelStatus` SMALLINT NULL DEFAULT '0',
	`TBilCancelNo` VARCHAR(30) NULL,
	`TBilCancelBy` VARCHAR(140) NULL,
	`TBilCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBilCancelNote` VARCHAR(80) NULL,
	`TBilFlag1` SMALLINT NULL DEFAULT '0',
	`TBilFlag2` SMALLINT NULL DEFAULT '0',
	`TBilFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBilNo`),
	KEY `TAPVNo` (`TBilNo`),
	KEY `TRVHTPrjCode` (`TBilTPrjCode`),
	KEY `VS4TARVS4TBill` (`TBilTARNCode`),
	KEY `VS4TProjectVS4TARBill` (`TBilTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARBillMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARBillMB`;

# ---------- CREATE TABLE `VS4TARBillMB` ----------

CREATE TABLE `VS4TARBillMB` (
	`TBMBTBilNo` VARCHAR(30) NOT NULL,
	`TBMBLn` INT NOT NULL DEFAULT '0',
	`TBMBType` SMALLINT NULL DEFAULT '0',
	`TBMBTIvANo` VARCHAR(30) NULL,
	`TBMBTIvADate` DATETIME NULL,
	`TBMBTIVADueDate` DATETIME NULL,
	`TBMBCondition` VARCHAR(100) NULL,
	`TBMBTaxBase` FLOAT NULL DEFAULT '0',
	`TBMBTIvAGrandTotal` FLOAT NULL DEFAULT '0',
	`TBMBNetPayment` FLOAT NULL DEFAULT '0',
	`TBMBTIvAArrears` FLOAT NULL DEFAULT '0',
	`TBMBFlagInv` INT NULL DEFAULT '0',
	`TBMBRefNo` VARCHAR(30) NULL,
	`TBMBRefNo2` VARCHAR(30) NULL,
	`TBMBRefNo3` VARCHAR(30) NULL,
	`TBMBPONo` VARCHAR(30) NULL,
	`TBMBCommissionBase` FLOAT NULL DEFAULT '0',
	`TBMBCommissionRate` VARCHAR(30) NULL,
	`TBMBCommission` FLOAT NULL DEFAULT '0',
	`TBMBFlag1` SMALLINT NULL DEFAULT '0',
	`TBMBFlag2` SMALLINT NULL DEFAULT '0',
	`TBMBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBMBLn`, `TBMBTBilNo`),
	KEY `TPWBID` (`TBMBLn`),
	KEY `TTfMID` (`TBMBTBilNo`),
	KEY `VS4TBillVS4TBillMB` (`TBMBTBilNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARBranch` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARBranch`;

# ---------- CREATE TABLE `VS4TARBranch` ----------

CREATE TABLE `VS4TARBranch` (
	`TARDTARNCode` VARCHAR(30) NOT NULL,
	`TARDCode` VARCHAR(30) NOT NULL,
	`TARDIsDefault` SMALLINT NULL,
	`TARDType` SMALLINT NULL,
	`TARDName` VARCHAR(150) NULL,
	`TARDAddress` VARCHAR(255) NULL,
	`TARDPhone` VARCHAR(50) NULL,
	`TARDFax` VARCHAR(50) NULL,
	`TARDFullName` VARCHAR(255) NULL,
	`TARDName2` VARCHAR(150) NULL,
	`TARDAddress2` VARCHAR(255) NULL,
	`TARDPhone2` VARCHAR(50) NULL,
	`TARDFax2` VARCHAR(50) NULL,
	`TARDFullName2` VARCHAR(255) NULL,
	`TARDGPS` VARCHAR(30) NULL,
	`TARDMapFile` VARCHAR(50) NULL,
	`TARDMapFile2` VARCHAR(50) NULL,
	`TARDTRouCode` VARCHAR(30) NULL,
	`TARDTShpCode` VARCHAR(30) NULL,
	`TARDDeliveryCond` SMALLINT NULL DEFAULT '0',
	`TARDDistance` DOUBLE NULL DEFAULT '0',
	`TARDDeliveryHour` DOUBLE NULL DEFAULT '0',
	`TARDContactName` VARCHAR(160) NULL,
	`TARDNote` VARCHAR(255) NULL,
	`TARDFlag1` SMALLINT NULL DEFAULT '0',
	`TARDFlag2` SMALLINT NULL DEFAULT '0',
	`TARDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARDTARNCode`, `TARDCode`),
	KEY `TAPCCode` (`TARDTARNCode`),
	KEY `TAR2TShpCode` (`TARDTShpCode`),
	KEY `TARDNote` (`TARDContactName`),
	KEY `TARDTShpCode` (`TARDNote`),
	KEY `VS4TARVS4TARDelivery` (`TARDTARNCode`),
	KEY `VS4TRountVS4TARDelivery` (`TARDTRouCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARBuddy` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARBuddy`;

# ---------- CREATE TABLE `VS4TARBuddy` ----------

CREATE TABLE `VS4TARBuddy` (
	`TABuTARNCode` VARCHAR(30) NOT NULL,
	`TABuLn` INT NOT NULL DEFAULT '0',
	`TABuName` VARCHAR(160) NULL,
	`TABuSex` VARCHAR(1) NULL,
	`TABuBirthDay` DATETIME NULL,
	`TABuDeadDay` DATETIME NULL,
	`TABuDno` VARCHAR(15) NULL,
	`TABuTaxNo` VARCHAR(15) NULL,
	`TABuHasIncome` SMALLINT NULL DEFAULT '0',
	`TABuIsDead` SMALLINT NULL DEFAULT '0',
	`TABuHasSeniorCard` SMALLINT NULL DEFAULT '0',
	`TABuTel` VARCHAR(20) NULL,
	`TABuFlag1` SMALLINT NULL DEFAULT '0',
	`TABuFlag2` SMALLINT NULL DEFAULT '0',
	`TABuFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TABuTARNCode`, `TABuLn`),
	KEY `TEprTEmpCode` (`TABuTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARBusinessType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARBusinessType`;

# ---------- CREATE TABLE `VS4TARBusinessType` ----------

CREATE TABLE `VS4TARBusinessType` (
	`TARBTBsTCode` VARCHAR(30) NOT NULL,
	`TARBTARNCode` VARCHAR(30) NOT NULL,
	`TARBFlag1` SMALLINT NULL DEFAULT '0',
	`TARBFlag2` SMALLINT NULL DEFAULT '0',
	`TARBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARBTBsTCode`, `TARBTARNCode`),
	KEY `TBsTCode` (`TARBTBsTCode`),
	KEY `VS4TARVS4TARBusinessType` (`TARBTARNCode`),
	KEY `VS4TBusinessTypeVS4TARBusinessType` (`TARBTBsTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARCampaign` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARCampaign`;

# ---------- CREATE TABLE `VS4TARCampaign` ----------

CREATE TABLE `VS4TARCampaign` (
	`TRCACode` VARCHAR(30) NOT NULL,
	`TRCAMode` SMALLINT NULL DEFAULT '0',
	`TRCATARNCode` VARCHAR(30) NULL,
	`TRCAName` VARCHAR(100) NULL,
	`TRCAName2` VARCHAR(100) NULL,
	`TRCANote` VARCHAR(255) NULL,
	`TRCAStartDate` DATETIME NULL,
	`TRCAEndDate` DATETIME NULL,
	`TRCAEditDate` DATETIME NULL,
	`TRCATEmpCode` VARCHAR(30) NULL,
	`TRCABudget` FLOAT NULL DEFAULT '0',
	`TRCASaleOnEvent` FLOAT NULL DEFAULT '0',
	`TRCAAfterSale` FLOAT NULL DEFAULT '0',
	`TRCATotalSale` VARCHAR(50) NULL,
	`TRCAProfit` FLOAT NULL DEFAULT '0',
	`TRCACost` FLOAT NULL DEFAULT '0',
	`TRCANetProfit` FLOAT NULL DEFAULT '0',
	`TRCASOAuto` SMALLINT NULL DEFAULT '0',
	`TRCAStatus` SMALLINT NULL DEFAULT '0',
	`TRCAImage1` VARCHAR(50) NULL,
	`TRCAImage2` VARCHAR(50) NULL,
	`TRCAImage3` VARCHAR(50) NULL,
	`TRCAImage4` VARCHAR(50) NULL,
	`TRCAImage5` VARCHAR(50) NULL,
	`TRCAImage6` VARCHAR(50) NULL,
	`TRCAImage7` VARCHAR(50) NULL,
	`TRCAImage8` VARCHAR(50) NULL,
	`TRCAFlag1` SMALLINT NULL DEFAULT '0',
	`TRCAFlag2` SMALLINT NULL DEFAULT '0',
	`TRCAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRCACode`),
	KEY `TBnkCode` (`TRCACode`),
	KEY `TEveTEmpCode` (`TRCATEmpCode`),
	KEY `TPCATAPNCode` (`TRCATARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARCampaignBG` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARCampaignBG`;

# ---------- CREATE TABLE `VS4TARCampaignBG` ----------

CREATE TABLE `VS4TARCampaignBG` (
	`TRBGTRCACode` VARCHAR(30) NOT NULL,
	`TRBGLn` SMALLINT NULL DEFAULT '0',
	`TRBGName` VARCHAR(100) NULL,
	`TRBGName2` VARCHAR(100) NULL,
	`TRBGQuantity` DOUBLE NULL,
	`TRBGPrice` DOUBLE NULL DEFAULT '0',
	`TRBGAmount` DOUBLE NULL DEFAULT '0',
	`TRBGNote` VARCHAR(255) NULL,
	`TRBGFlag1` SMALLINT NULL DEFAULT '0',
	`TRBGFlag2` SMALLINT NULL DEFAULT '0',
	`TRBGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRBGTRCACode`),
	KEY `TBnkCode` (`TRBGTRCACode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARCampaignMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARCampaignMB`;

# ---------- CREATE TABLE `VS4TARCampaignMB` ----------

CREATE TABLE `VS4TARCampaignMB` (
	`TRCPTRCACode` VARCHAR(30) NOT NULL,
	`TRCPLn` SMALLINT NOT NULL DEFAULT '0',
	`TRCPName` VARCHAR(100) NULL,
	`TRCPName2` VARCHAR(100) NULL,
	`TRCPTarget` DOUBLE NULL DEFAULT '0',
	`TRCPPeriodDay` SMALLINT NULL,
	`TRCPQuantity` DOUBLE NULL DEFAULT '0',
	`TRCPPrice` DOUBLE NULL DEFAULT '0',
	`TRCPAmount` DOUBLE NULL DEFAULT '0',
	`TRCPNote` VARCHAR(255) NULL,
	`TRCPFlag1` SMALLINT NULL DEFAULT '0',
	`TRCPFlag2` SMALLINT NULL DEFAULT '0',
	`TRCPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRCPTRCACode`, `TRCPLn`),
	KEY `TBnkCode` (`TRCPTRCACode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARCard` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARCard`;

# ---------- CREATE TABLE `VS4TARCard` ----------

CREATE TABLE `VS4TARCard` (
	`TRICTARNCode` VARCHAR(30) NOT NULL,
	`TRICDocNo` VARCHAR(30) NOT NULL,
	`TRICType` VARCHAR(2) NOT NULL,
	`TRICLn` INT NULL DEFAULT '0',
	`TRICTBraCode` VARCHAR(30) NULL,
	`TRICTPrjCode` VARCHAR(30) NULL,
	`TRICBalanceFlag` SMALLINT NULL,
	`TRICTACPTACYID` INT NULL DEFAULT '0',
	`TRICTACPID` INT NULL DEFAULT '0',
	`TRICDueDate` DATETIME NULL,
	`TRICDocDate` DATETIME NULL,
	`TRICTGLTNo` VARCHAR(30) NULL,
	`TRICTaxNo` VARCHAR(30) NULL,
	`TRICRefNo` VARCHAR(30) NULL,
	`TRICRefDate` DATETIME NULL,
	`TRICRefNo2` VARCHAR(30) NULL,
	`TRICRefDate2` DATETIME NULL,
	`TRICRefNo3` VARCHAR(30) NULL,
	`TRICRefDate3` DATETIME NULL,
	`TRICTotalOrder` FLOAT NULL,
	`TRICCostTotal` FLOAT NULL DEFAULT '0',
	`TRICInvGrandTotal` FLOAT NULL,
	`TRICCNGrandTotal` FLOAT NULL,
	`TRICDBGrandTotal` FLOAT NULL,
	`TRICChequePayment` FLOAT NULL,
	`TRICCashPayment` FLOAT NULL,
	`TRICBankPayment` FLOAT NULL,
	`TRICCardPayment` FLOAT NULL,
	`TRICDiscountTotal` FLOAT NULL,
	`TRICAdjustTotal` FLOAT NULL DEFAULT '0',
	`TRICInterestTotal` FLOAT NULL DEFAULT '0',
	`TRICCutDeposit` FLOAT NULL DEFAULT '0',
	`TRICFee` FLOAT NULL DEFAULT '0',
	`TRICWtaxTotal` FLOAT NULL DEFAULT '0',
	`TRICWtaxTotal2` FLOAT NULL DEFAULT '0',
	`TRICPayLess` FLOAT NULL DEFAULT '0',
	`TRICPayCoupon` FLOAT NULL DEFAULT '0',
	`TRICPayOther` FLOAT NULL DEFAULT '0',
	`TRICPayMisc` FLOAT NULL DEFAULT '0',
	`TRICDescription` VARCHAR(255) NULL,
	`TRICApproveStatus` SMALLINT NULL,
	`TRICCancelStatus` SMALLINT NULL,
	`TRICSignTotal` FLOAT NULL DEFAULT '0',
	`TRICSignArrear` FLOAT NULL DEFAULT '0',
	`TRICFlag1` SMALLINT NULL,
	`TRICFlag2` SMALLINT NULL,
	`TRICFlag3` SMALLINT NULL,
	PRIMARY KEY (`TRICTARNCode`, `TRICDocNo`, `TRICType`),
	KEY `TAPLMode` (`TRICTPrjCode`),
	KEY `TAPLTBraCode` (`TRICTBraCode`),
	KEY `TAPQTCmpCode` (`TRICTARNCode`),
	KEY `TARBTACPID` (`TRICTACPID`),
	KEY `TARBTACPTACYID` (`TRICTACPTACYID`),
	KEY `TIvoTaxNo` (`TRICTaxNo`),
	KEY `TSODTCurCode` (`TRICDescription`),
	KEY `VS4TARVS4TARCard` (`TRICTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARContact` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARContact`;

# ---------- CREATE TABLE `VS4TARContact` ----------

CREATE TABLE `VS4TARContact` (
	`TARCTARNCode` VARCHAR(30) NOT NULL,
	`TARCCode` VARCHAR(30) NOT NULL,
	`TARCTARDCode` VARCHAR(30) NULL,
	`TARCTitleName` VARCHAR(30) NULL,
	`TARCFirstName` VARCHAR(200) NULL,
	`TARCLastName` VARCHAR(150) NULL,
	`TARCNickname` VARCHAR(20) NULL,
	`TARCTitleName2` VARCHAR(50) NULL,
	`TARCFirstname2` VARCHAR(200) NULL,
	`TARCLastName2` VARCHAR(150) NULL,
	`TARCPosition` VARCHAR(80) NULL,
	`TARCRespond` VARCHAR(50) NULL,
	`TARCTel` VARCHAR(50) NULL,
	`TARCFax` VARCHAR(50) NULL,
	`TARCMobile` VARCHAR(15) NULL,
	`TARCMobile2` VARCHAR(15) NULL,
	`TARCEmail` VARCHAR(50) NULL,
	`TARCEmail2` VARCHAR(50) NULL,
	`TARCImage1` VARCHAR(50) NULL,
	`TARCCardImage1` VARCHAR(50) NULL,
	`TARCPriority` SMALLINT NULL DEFAULT '0',
	`TARCFavorite` VARCHAR(255) NULL,
	`TARCNotLike` VARCHAR(255) NULL,
	`TARCStyle` VARCHAR(255) NULL,
	`TARCStatus` SMALLINT NULL DEFAULT '0',
	`TARCBirthday` DATETIME NULL,
	`TARCAnniversary` DATETIME NULL,
	`TARCSpouse` VARCHAR(200) NULL,
	`TARCNote` VARCHAR(255) NULL,
	`TARCFlag1` SMALLINT NULL DEFAULT '0',
	`TARCFlag2` SMALLINT NULL DEFAULT '0',
	`TARCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARCCode`, `TARCTARNCode`),
	KEY `TAPCTARDCode` (`TARCTARDCode`),
	KEY `TAR2Favorite` (`TARCFavorite`),
	KEY `TConTComID` (`TARCTARNCode`),
	KEY `TTCnID` (`TARCCode`),
	KEY `VS4TARVS4TARContact` (`TARCTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARContactInden` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARContactInden`;

# ---------- CREATE TABLE `VS4TARContactInden` ----------

CREATE TABLE `VS4TARContactInden` (
	`TIDCTARCTARNCode` VARCHAR(30) NOT NULL,
	`TIDCTARCCode` VARCHAR(30) NOT NULL,
	`TIDCLn` INT NOT NULL DEFAULT '0',
	`TIDCIdentify1` TEXT NULL,
	`TIDCImage1` VARCHAR(255) NULL,
	`TIDCFlag1` SMALLINT NULL DEFAULT '0',
	`TIDCFlag2` SMALLINT NULL DEFAULT '0',
	`TIDCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIDCTARCTARNCode`, `TIDCTARCCode`, `TIDCLn`),
	KEY `TCmTCode` (`TIDCTARCTARNCode`),
	KEY `TIDCTARCTARNCode` (`TIDCTARCCode`),
	KEY `TIDETEmpCode` (`TIDCLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARCreditCard` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARCreditCard`;

# ---------- CREATE TABLE `VS4TARCreditCard` ----------

CREATE TABLE `VS4TARCreditCard` (
	`TACDTARNCode` VARCHAR(30) NOT NULL,
	`TACDLn` SMALLINT NOT NULL DEFAULT '0',
	`TACDCardCode` VARCHAR(5) NULL,
	`TACDCardType` VARCHAR(50) NULL,
	`TACDLevel` VARCHAR(20) NULL,
	`TACDCardName` VARCHAR(50) NULL,
	`TACDCardNo` VARCHAR(20) NULL,
	`TACDBackCardNo` VARCHAR(8) NULL,
	`TACDCardExpire` DATETIME NULL,
	`TACDCardIssue` DATETIME NULL,
	`TACDCardSince` DATETIME NULL,
	`TACDNote` VARCHAR(100) NULL,
	`TACDFlag1` SMALLINT NULL DEFAULT '0',
	`TACDFlag2` SMALLINT NULL DEFAULT '0',
	`TACDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TACDTARNCode`, `TACDLn`),
	KEY `TPPyTPTAID` (`TACDTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARCreditLimit` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARCreditLimit`;

# ---------- CREATE TABLE `VS4TARCreditLimit` ----------

CREATE TABLE `VS4TARCreditLimit` (
	`TRCLTARNCode` VARCHAR(30) NOT NULL,
	`TRCLStartDate` DATETIME NOT NULL,
	`TRCLCreditLimit` FLOAT NULL DEFAULT '0',
	`TRCLFlag1` SMALLINT NULL DEFAULT '0',
	`TRCLFlag2` SMALLINT NULL DEFAULT '0',
	`TRCLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRCLTARNCode`, `TRCLStartDate`),
	KEY `VS4TARVS4TARCreditLimit` (`TRCLTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARCreditNote` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARCreditNote`;

# ---------- CREATE TABLE `VS4TARCreditNote` ----------

CREATE TABLE `VS4TARCreditNote` (
	`TRCNNo` VARCHAR(30) NOT NULL,
	`TRCNTIvoNo` VARCHAR(30) NULL,
	`TRCNBalanceFlag` TINYINT NULL DEFAULT '0',
	`TRCNInvoiceList` VARCHAR(255) NULL,
	`TRCNType` SMALLINT NULL DEFAULT '0',
	`TRCNTRCACode` VARCHAR(30) NULL,
	`TRCNMode` SMALLINT NULL DEFAULT '0',
	`TRCNDate` DATETIME NULL,
	`TRCNGLMethod` SMALLINT NULL DEFAULT '0',
	`TRCNTGLTNo` VARCHAR(30) NULL,
	`TRCNTInvNo` VARCHAR(30) NULL,
	`TRCNTEmpCode` VARCHAR(30) NULL,
	`TRCNSaleName` VARCHAR(140) NULL,
	`TRCNGuideText` VARCHAR(100) NULL,
	`TRCNEmpText` VARCHAR(100) NULL,
	`TRCNTBraCode` VARCHAR(30) NULL,
	`TRCNTPrjCode` VARCHAR(30) NULL,
	`TRCNTaxNo` VARCHAR(30) NULL,
	`TRCNTaxPeriodNo` DATETIME NULL,
	`TRCNTaxPeriodType` SMALLINT NULL,
	`TRCNTaxRefund` SMALLINT NULL,
	`TRCNPayType` SMALLINT NULL DEFAULT '0',
	`TRCNRefNo` VARCHAR(30) NULL,
	`TRCNRefDate` DATETIME NULL,
	`TRCNRefNo2` VARCHAR(30) NULL,
	`TRCNRefDate2` DATETIME NULL,
	`TRCNTARNCode` VARCHAR(30) NULL,
	`TRCNTARDCode` VARCHAR(30) NULL,
	`TRCNContactNote` VARCHAR(50) NULL,
	`TRCNContactName` VARCHAR(160) NULL,
	`TRCNCustomerName` VARCHAR(200) NULL,
	`TRCNCusAddress` VARCHAR(255) NULL,
	`TRCNCustomerName2` VARCHAR(200) NULL,
	`TRCNCusAddress2` VARCHAR(255) NULL,
	`TRCNPriceChannel` SMALLINT NULL DEFAULT '0',
	`TRCNChannelName` VARCHAR(30) NULL,
	`TRCNCostTotal` FLOAT NULL DEFAULT '0',
	`TRCNOldSubTotal` FLOAT NULL DEFAULT '0',
	`TRCNNewSubTotal` FLOAT NULL,
	`TRCNDiscountList` FLOAT NULL,
	`TRCNSubTotal` FLOAT NULL,
	`TRCNDiscountText` VARCHAR(30) NULL,
	`TRCNDiscountTotal` FLOAT NULL,
	`TRCNNetTotal` FLOAT NULL,
	`TRCNDepositText` VARCHAR(30) NULL,
	`TRCNDeposit` FLOAT NULL DEFAULT '0',
	`TRCNTotal` FLOAT NULL,
	`TRCNTotalFOB` FLOAT NULL,
	`TRCNTCurCode` VARCHAR(5) NULL,
	`TRCNExchangeRate` DOUBLE NULL DEFAULT '0',
	`TRCNTotalInRate` FLOAT NULL,
	`TRCNVATType` SMALLINT NULL,
	`TRCNVATRate` DOUBLE NULL,
	`TRCNTaxBase` FLOAT NULL DEFAULT '0',
	`TRCNVATTotal` FLOAT NULL,
	`TRCNGrandTotal` FLOAT NULL,
	`TRCNNetPayment` FLOAT NULL,
	`TRCNBaseArrears` FLOAT NULL DEFAULT '0',
	`TRCNArrears` FLOAT NULL DEFAULT '0',
	`TRCNRewardTotal` FLOAT NULL,
	`TRCNPremiumTotal` FLOAT NULL,
	`TRCNCommissionBase` FLOAT NULL DEFAULT '0',
	`TRCNCommissionRate` VARCHAR(30) NULL,
	`TRCNCommission` FLOAT NULL DEFAULT '0',
	`TRCNDescription` VARCHAR(255) NULL,
	`TRCNBillStatus` SMALLINT NULL DEFAULT '0',
	`TRCNCardFlag` SMALLINT NULL DEFAULT '0',
	`TRCNTaxFlag` SMALLINT NULL DEFAULT '0',
	`TRCNCreateCode` VARCHAR(30) NULL,
	`TRCNCreateBy` VARCHAR(140) NULL,
	`TRCNCreateDate` DATETIME NULL,
	`TRCNEditCode` VARCHAR(30) NULL,
	`TRCNEditBy` VARCHAR(140) NULL,
	`TRCNEditDate` DATETIME NULL,
	`TRCNConfirmStatus` SMALLINT NULL,
	`TRCNConfirmBy` VARCHAR(140) NULL,
	`TRCNConfirmDate` DATETIME NULL,
	`TRCNApproveStatus` SMALLINT NULL,
	`TRCNApproveBy` VARCHAR(140) NULL,
	`TRCNApproveDate` DATETIME NULL,
	`TRCNApproveNote` VARCHAR(80) NULL,
	`TRCNConfidential` SMALLINT NULL,
	`TRCNRevision` SMALLINT NULL,
	`TRCNCancelStatus` SMALLINT NULL,
	`TRCNCancelNo` VARCHAR(30) NULL,
	`TRCNCancelBy` VARCHAR(140) NULL,
	`TRCNCancelDate` DATETIME NULL,
	`TRCNCancelNote` VARCHAR(80) NULL,
	`TRCNFlag1` SMALLINT NULL,
	`TRCNFlag2` SMALLINT NULL,
	`TRCNFlag3` SMALLINT NULL,
	PRIMARY KEY (`TRCNNo`),
	KEY `TAPQTCmpCode` (`TRCNTARNCode`),
	KEY `TDBNTEmpCode` (`TRCNTEmpCode`),
	KEY `TInBTPrjCode` (`TRCNTPrjCode`),
	KEY `TIvoTARDCode` (`TRCNTARDCode`),
	KEY `TIvoTaxNo` (`TRCNTaxNo`),
	KEY `TPCNTBraCode` (`TRCNTBraCode`),
	KEY `TPODTAPNCode` (`TRCNContactNote`),
	KEY `TPWOSupplierName` (`TRCNCusAddress`),
	KEY `TPWOTCmpCode` (`TRCNCustomerName`),
	KEY `TQuoTRCACode` (`TRCNTRCACode`),
	KEY `TRCNCusAddress` (`TRCNCusAddress2`),
	KEY `TRCNCustomerName` (`TRCNCustomerName2`),
	KEY `TRCNTIvoNo` (`TRCNTIvoNo`),
	KEY `TSODTCurCode` (`TRCNTCurCode`),
	KEY `VS4TARVS4TARCreditNote` (`TRCNTARNCode`),
	KEY `VS4TProjectVS4TARCreditNote` (`TRCNTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARCreditNoteMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARCreditNoteMB`;

# ---------- CREATE TABLE `VS4TARCreditNoteMB` ----------

CREATE TABLE `VS4TARCreditNoteMB` (
	`TRCMTRCNNo` VARCHAR(30) NOT NULL,
	`TRCMLn` INT NOT NULL DEFAULT '0',
	`TRCMType` SMALLINT NULL DEFAULT '0',
	`TRCMReturnFlag` SMALLINT NULL DEFAULT '0',
	`TRCMTOInCode` VARCHAR(50) NULL,
	`TRCMTPOSCode` VARCHAR(50) NULL,
	`TRCMSerialNo` VARCHAR(30) NULL,
	`TRCMJobCode` VARCHAR(30) NULL,
	`TRCMCustom1` VARCHAR(30) NULL,
	`TRCMCustom2` VARCHAR(30) NULL,
	`TRCMCustom3` VARCHAR(30) NULL,
	`TRCMCustom4` VARCHAR(30) NULL,
	`TRCMCustom5` VARCHAR(30) NULL,
	`TRCMShippingMark` VARCHAR(255) NULL,
	`TRCMPOSCode` VARCHAR(50) NULL,
	`TRCMFactoryCode` VARCHAR(50) NULL,
	`TRCMPOSName` VARCHAR(150) NULL,
	`TRCMCost` FLOAT NULL DEFAULT '0',
	`TRCMOldPrice` FLOAT NULL DEFAULT '0',
	`TRCMNewPrice` FLOAT NULL DEFAULT '0',
	`TRCMPrice` FLOAT NULL DEFAULT '0',
	`TRCMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TRCMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TRCMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TRCMOldQuantityCal` DOUBLE NULL DEFAULT '0',
	`TRCMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TRCMOldQuantity` DOUBLE NULL DEFAULT '0',
	`TRCMQuantityText` VARCHAR(255) NULL,
	`TRCMQuantity` DOUBLE NULL DEFAULT '0',
	`TRCMTUntCode` VARCHAR(50) NULL,
	`TRCMOldQuantity2` DOUBLE NULL DEFAULT '0',
	`TRCMQuantity2` DOUBLE NULL DEFAULT '0',
	`TRCMTUntCode2` VARCHAR(50) NULL,
	`TRCMOldQuantity3` DOUBLE NULL DEFAULT '0',
	`TRCMQuantity3` DOUBLE NULL DEFAULT '0',
	`TRCMTUntCode3` VARCHAR(50) NULL,
	`TRCMCostOldAmount` DOUBLE NULL DEFAULT '0',
	`TRCMCostAmount` DOUBLE NULL DEFAULT '0',
	`TRCMOldAmount` DOUBLE NULL DEFAULT '0',
	`TRCMAmount` DOUBLE NULL DEFAULT '0',
	`TRCMDiscountText` VARCHAR(30) NULL,
	`TRCMDiscountTotal` FLOAT NULL,
	`TRCMOLDDiscTotal` FLOAT NULL,
	`TRCMOldNetAmount` FLOAT NULL DEFAULT '0',
	`TRCMNetAmount` FLOAT NULL DEFAULT '0',
	`TRCMNAmountInRate` FLOAT NULL DEFAULT '0',
	`TRCMTaxBase` FLOAT NULL DEFAULT '0',
	`TRCMTaxType` SMALLINT NULL DEFAULT '0',
	`TRCMAmountVAT` FLOAT NULL DEFAULT '0',
	`TRCMDescription` VARCHAR(255) NULL,
	`TRCMSourceNo` VARCHAR(30) NULL,
	`TRCMSourceLn` INT NULL DEFAULT '0',
	`TRCMSourceDate` DATETIME NULL,
	`TRCMTaxNo` VARCHAR(30) NULL,
	`TRCMRefNo` VARCHAR(30) NULL,
	`TRCMRefDate` DATETIME NULL,
	`TRCMIVType` SMALLINT NULL DEFAULT '0',
	`TRCMVATRate` DOUBLE NULL,
	`TRCMGrandTotal` FLOAT NULL,
	`TRCMNetPayment` FLOAT NULL,
	`TRCMArrears` FLOAT NULL DEFAULT '0',
	`TRCMBaseArrears` FLOAT NULL DEFAULT '0',
	`TRCMIsPremium` SMALLINT NULL DEFAULT '0',
	`TRCMCommissionBase` FLOAT NULL DEFAULT '0',
	`TRCMCommissionRate` VARCHAR(30) NULL,
	`TRCMCommission` FLOAT NULL DEFAULT '0',
	`TRCMFlag1` SMALLINT NULL DEFAULT '0',
	`TRCMFlag2` SMALLINT NULL DEFAULT '0',
	`TRCMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRCMLn`, `TRCMTRCNNo`),
	KEY `TIoMTUntCode2` (`TRCMTUntCode3`),
	KEY `TJbMSourceNo` (`TRCMSourceNo`),
	KEY `TPCNTaxNo` (`TRCMTaxNo`),
	KEY `TPOBTPdtCode` (`TRCMTPOSCode`),
	KEY `TPSMUnitFactor` (`TRCMUnitFactor`),
	KEY `TPWBID` (`TRCMLn`),
	KEY `TPWBPdtCode1` (`TRCMPOSCode`),
	KEY `TPWBTUntCode` (`TRCMTUntCode`),
	KEY `TPWBTUntCode1` (`TRCMTUntCode2`),
	KEY `TQuBFactoryCode` (`TRCMFactoryCode`),
	KEY `TRCMType` (`TRCMReturnFlag`),
	KEY `TSOBTOInCode` (`TRCMTOInCode`),
	KEY `TTfMID` (`TRCMTRCNNo`),
	KEY `TTfrToTShfCode` (`TRCMType`),
	KEY `VS4TARCreditNoteVS4TARCreditNoteMB` (`TRCMTRCNNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARDebitNote` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARDebitNote`;

# ---------- CREATE TABLE `VS4TARDebitNote` ----------

CREATE TABLE `VS4TARDebitNote` (
	`TDBNNo` VARCHAR(30) NOT NULL,
	`TDBNTIvoNo` VARCHAR(30) NULL,
	`TDBNBalanceFlag` TINYINT NULL DEFAULT '0',
	`TDBNInvoiceList` VARCHAR(255) NULL,
	`TDBNType` SMALLINT NULL DEFAULT '0',
	`TDBNTRCACode` VARCHAR(30) NULL,
	`TDBNMode` SMALLINT NULL DEFAULT '0',
	`TDBNDate` DATETIME NULL,
	`TDBNGLMethod` SMALLINT NULL DEFAULT '0',
	`TDBNTEmpCode` VARCHAR(30) NULL,
	`TDBNSaleName` VARCHAR(140) NULL,
	`TDBNGuideText` VARCHAR(100) NULL,
	`TDBNEmpText` VARCHAR(100) NULL,
	`TDBNTBraCode` VARCHAR(30) NULL,
	`TDBNTPrjCode` VARCHAR(30) NULL,
	`TDBNTGLTNo` VARCHAR(30) NULL,
	`TDBNTaxNo` VARCHAR(30) NULL,
	`TDBNTaxPeriodNo` DATETIME NULL,
	`TDBNTaxPeriodType` SMALLINT NULL,
	`TDBNTaxRefund` SMALLINT NULL,
	`TDBNPayType` SMALLINT NULL DEFAULT '0',
	`TDBNRefNo` VARCHAR(30) NULL,
	`TDBNRefDate` DATETIME NULL,
	`TDBNRefNo2` VARCHAR(30) NULL,
	`TDBNRefDate2` DATETIME NULL,
	`TDBNTARNCode` VARCHAR(30) NULL,
	`TDBNTARDCode` VARCHAR(30) NULL,
	`TDBNContactNote` VARCHAR(50) NULL,
	`TDBNContactName` VARCHAR(160) NULL,
	`TDBNCustomerName` VARCHAR(200) NULL,
	`TDBNCusAddress` VARCHAR(255) NULL,
	`TDBNCustomerName2` VARCHAR(200) NULL,
	`TDBNCusAddress2` VARCHAR(255) NULL,
	`TDBNPriceChannel` SMALLINT NULL DEFAULT '0',
	`TDBNChannelName` VARCHAR(30) NULL,
	`TDBNCostTotal` FLOAT NULL DEFAULT '0',
	`TDBNOldSubTotal` FLOAT NULL DEFAULT '0',
	`TDBNNewSubTotal` FLOAT NULL,
	`TDBNDiscountList` FLOAT NULL,
	`TDBNSubTotal` FLOAT NULL,
	`TDBNDiscountText` VARCHAR(30) NULL,
	`TDBNDiscountTotal` FLOAT NULL,
	`TDBNNetTotal` FLOAT NULL,
	`TDBNDepositText` VARCHAR(30) NULL,
	`TDBNDeposit` FLOAT NULL DEFAULT '0',
	`TDBNTotal` FLOAT NULL,
	`TDBNTotalFOB` FLOAT NULL,
	`TDBNTCurCode` VARCHAR(5) NULL,
	`TDBNExchangeRate` DOUBLE NULL DEFAULT '0',
	`TDBNTotalInRate` FLOAT NULL,
	`TDBNVATType` SMALLINT NULL,
	`TDBNVATRate` DOUBLE NULL,
	`TDBNTaxBase` FLOAT NULL DEFAULT '0',
	`TDBNVATTotal` FLOAT NULL,
	`TDBNGrandTotal` FLOAT NULL,
	`TDBNRewardTotal` FLOAT NULL,
	`TDBNPremiumTotal` FLOAT NULL,
	`TDBNNetPayment` FLOAT NULL,
	`TDBNBaseArrears` FLOAT NULL DEFAULT '0',
	`TDBNArrears` FLOAT NULL DEFAULT '0',
	`TDBNCommissionBase` FLOAT NULL DEFAULT '0',
	`TDBNCommissionRate` VARCHAR(30) NULL,
	`TDBNCommission` FLOAT NULL DEFAULT '0',
	`TDBNDescription` VARCHAR(255) NULL,
	`TDBNBillStatus` SMALLINT NULL DEFAULT '0',
	`TDBNCardFlag` SMALLINT NULL DEFAULT '0',
	`TDBNTaxFlag` SMALLINT NULL DEFAULT '0',
	`TDBNCreateCode` VARCHAR(30) NULL,
	`TDBNCreateBy` VARCHAR(140) NULL,
	`TDBNCreateDate` DATETIME NULL,
	`TDBNEditCode` VARCHAR(30) NULL,
	`TDBNEditBy` VARCHAR(140) NULL,
	`TDBNEditDate` DATETIME NULL,
	`TDBNConfirmStatus` SMALLINT NULL,
	`TDBNConfirmBy` VARCHAR(140) NULL,
	`TDBNConfirmDate` DATETIME NULL,
	`TDBNApproveStatus` SMALLINT NULL,
	`TDBNApproveBy` VARCHAR(140) NULL,
	`TDBNApproveDate` DATETIME NULL,
	`TDBNApproveNote` VARCHAR(80) NULL,
	`TDBNRevision` SMALLINT NULL,
	`TDBNCancelStatus` SMALLINT NULL,
	`TDBNCancelNo` VARCHAR(30) NULL,
	`TDBNCancelBy` VARCHAR(140) NULL,
	`TDBNCancelDate` DATETIME NULL,
	`TDBNCancelNote` VARCHAR(80) NULL,
	`TDBNFlag1` SMALLINT NULL,
	`TDBNFlag2` SMALLINT NULL,
	`TDBNFlag3` SMALLINT NULL,
	PRIMARY KEY (`TDBNNo`),
	KEY `TAPQTCmpCode` (`TDBNTARNCode`),
	KEY `TInBTPrjCode` (`TDBNTPrjCode`),
	KEY `TIvoTARDCode` (`TDBNTARDCode`),
	KEY `TIvoTaxNo` (`TDBNTaxNo`),
	KEY `TIvoTEmpCode` (`TDBNTEmpCode`),
	KEY `TPCNTBraCode` (`TDBNTBraCode`),
	KEY `TPODTAPNCode` (`TDBNContactNote`),
	KEY `TPWOSupplierName` (`TDBNCusAddress`),
	KEY `TPWOTCmpCode` (`TDBNCustomerName`),
	KEY `TQuoTRCACode` (`TDBNTRCACode`),
	KEY `TRCNCusAddress2` (`TDBNCusAddress2`),
	KEY `TRCNCustomerName2` (`TDBNCustomerName2`),
	KEY `TRCNTIvoNo` (`TDBNTIvoNo`),
	KEY `TSODTCurCode` (`TDBNTCurCode`),
	KEY `VS4TARVS4TARDebitNote` (`TDBNTARNCode`),
	KEY `VS4TProjectVS4TARDebitNote` (`TDBNTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARDebitNoteMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARDebitNoteMB`;

# ---------- CREATE TABLE `VS4TARDebitNoteMB` ----------

CREATE TABLE `VS4TARDebitNoteMB` (
	`TDBMTDBNNo` VARCHAR(30) NOT NULL,
	`TDBMLn` INT NOT NULL DEFAULT '0',
	`TDBMType` SMALLINT NULL DEFAULT '0',
	`TDBMTOInCode` VARCHAR(50) NULL,
	`TDBMTPOSCode` VARCHAR(50) NULL,
	`TDBMSerialNo` VARCHAR(30) NULL,
	`TDBMJobCode` VARCHAR(30) NULL,
	`TDBMCustom1` VARCHAR(30) NULL,
	`TDBMCustom2` VARCHAR(30) NULL,
	`TDBMCustom3` VARCHAR(30) NULL,
	`TDBMCustom4` VARCHAR(30) NULL,
	`TDBMCustom5` VARCHAR(30) NULL,
	`TDBMShippingMark` VARCHAR(255) NULL,
	`TDBMPOSCode` VARCHAR(50) NULL,
	`TDBMFactoryCode` VARCHAR(50) NULL,
	`TDBMPOSName` VARCHAR(150) NULL,
	`TDBMCost` FLOAT NULL DEFAULT '0',
	`TDBMOldPrice` FLOAT NULL DEFAULT '0',
	`TDBMPrice` FLOAT NULL DEFAULT '0',
	`TDBMNewPrice` FLOAT NULL DEFAULT '0',
	`TDBMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TDBMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TDBMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TDBMOldQuantityCal` DOUBLE NULL DEFAULT '0',
	`TDBMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TDBMOldQuantity` DOUBLE NULL DEFAULT '0',
	`TDBMQuantityText` VARCHAR(255) NULL,
	`TDBMQuantity` DOUBLE NULL DEFAULT '0',
	`TDBMTUntCode` VARCHAR(50) NULL,
	`TDBMOldQuantity2` DOUBLE NULL DEFAULT '0',
	`TDBMQuantity2` DOUBLE NULL DEFAULT '0',
	`TDBMTUntCode2` VARCHAR(50) NULL,
	`TDBMOldQuantity3` DOUBLE NULL DEFAULT '0',
	`TDBMQuantity3` DOUBLE NULL DEFAULT '0',
	`TDBMTUntCode3` VARCHAR(50) NULL,
	`TDBMCostOldAmount` DOUBLE NULL DEFAULT '0',
	`TDBMCostAmount` DOUBLE NULL DEFAULT '0',
	`TDBMOldAmount` DOUBLE NULL DEFAULT '0',
	`TDBMAmount` DOUBLE NULL DEFAULT '0',
	`TDBMDiscountText` VARCHAR(30) NULL,
	`TDBMDiscountTotal` FLOAT NULL,
	`TDBMOldDiscTotal` FLOAT NULL DEFAULT '0',
	`TDBMOldNetAmount` FLOAT NULL DEFAULT '0',
	`TDBMNetAmount` FLOAT NULL DEFAULT '0',
	`TDBMNAmountInRate` FLOAT NULL DEFAULT '0',
	`TDBMTaxBase` FLOAT NULL DEFAULT '0',
	`TDBMTaxType` SMALLINT NULL DEFAULT '0',
	`TDBMAmountVAT` FLOAT NULL DEFAULT '0',
	`TDBMDescription` VARCHAR(255) NULL,
	`TDBMSourceNo` VARCHAR(30) NULL,
	`TDBMSourceLn` INT NULL DEFAULT '0',
	`TDBMSourceDate` DATETIME NULL,
	`TDBMTaxNo` VARCHAR(30) NULL,
	`TDBMRefNo` VARCHAR(30) NULL,
	`TDBMRefDate` DATETIME NULL,
	`TDBMIVType` SMALLINT NULL DEFAULT '0',
	`TDBMVATRate` DOUBLE NULL,
	`TDBMGrandTotal` FLOAT NULL,
	`TDBMNetPayment` FLOAT NULL,
	`TDBMArrears` FLOAT NULL DEFAULT '0',
	`TDBMBaseArrears` FLOAT NULL DEFAULT '0',
	`TDBMIsPremium` SMALLINT NULL DEFAULT '0',
	`TDBMCommissionBase` FLOAT NULL DEFAULT '0',
	`TDBMCommissionRate` VARCHAR(30) NULL,
	`TDBMCommission` FLOAT NULL DEFAULT '0',
	`TDBMFlag1` SMALLINT NULL DEFAULT '0',
	`TDBMFlag2` SMALLINT NULL DEFAULT '0',
	`TDBMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDBMLn`, `TDBMTDBNNo`),
	KEY `TIoMTUntCode2` (`TDBMTUntCode3`),
	KEY `TJbMSourceNo` (`TDBMSourceNo`),
	KEY `TPCNTaxNo` (`TDBMTaxNo`),
	KEY `TPOBTPdtCode` (`TDBMTPOSCode`),
	KEY `TPSMUnitFactor` (`TDBMUnitFactor`),
	KEY `TPWBID` (`TDBMLn`),
	KEY `TPWBPdtCode1` (`TDBMPOSCode`),
	KEY `TPWBTUntCode` (`TDBMTUntCode`),
	KEY `TPWBTUntCode1` (`TDBMTUntCode2`),
	KEY `TQuBFactoryCode` (`TDBMFactoryCode`),
	KEY `TSOBTOInCode` (`TDBMTOInCode`),
	KEY `TTfMID` (`TDBMTDBNNo`),
	KEY `TTfrToTShfCode` (`TDBMType`),
	KEY `VS4TARDebitNoteVS4TARDebitNoteMB` (`TDBMTDBNNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARDebtAdjust` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARDebtAdjust`;

# ---------- CREATE TABLE `VS4TARDebtAdjust` ----------

CREATE TABLE `VS4TARDebtAdjust` (
	`TRAJNo` VARCHAR(30) NOT NULL,
	`TRAJType` SMALLINT NULL DEFAULT '0',
	`TRAJDate` DATETIME NULL,
	`TRAJGLMethod` SMALLINT NULL DEFAULT '0',
	`TRAJMode` SMALLINT NULL DEFAULT '0',
	`TRAJTGLTNo` VARCHAR(30) NULL,
	`TRAJTBraCode` VARCHAR(30) NULL,
	`TRAJTPrjCode` VARCHAR(30) NULL,
	`TRAJRefNo` VARCHAR(30) NULL,
	`TRAJRefDate` DATETIME NULL,
	`TRAJTARNCode` VARCHAR(30) NULL,
	`TRAJContactNote` VARCHAR(50) NULL,
	`TRAJContactName` VARCHAR(160) NULL,
	`TRAJCustomerName` VARCHAR(200) NULL,
	`TRAJCusAddress` VARCHAR(255) NULL,
	`TRAJTotal` FLOAT NULL,
	`TRAJTCurCode` VARCHAR(5) NULL,
	`TRAJExchangeRate` FLOAT NULL DEFAULT '0',
	`TRAJTaxBase` FLOAT NULL DEFAULT '0',
	`TRAJGrandTotal` FLOAT NULL,
	`TRAJNetPayment` FLOAT NULL,
	`TRAJArrears` FLOAT NULL DEFAULT '0',
	`TRAJBaseArrears` FLOAT NULL DEFAULT '0',
	`TRAJDescription` VARCHAR(255) NULL,
	`TRAJBillStatus` SMALLINT NULL DEFAULT '0',
	`TRAJCardFlag` SMALLINT NULL DEFAULT '0',
	`TRAJCreateCode` VARCHAR(30) NULL,
	`TRAJCreateBy` VARCHAR(140) NULL,
	`TRAJCreateDate` DATETIME NULL,
	`TRAJEditCode` VARCHAR(30) NULL,
	`TRAJEditBy` VARCHAR(140) NULL,
	`TRAJEditDate` DATETIME NULL,
	`TRAJConfirmStatus` SMALLINT NULL,
	`TRAJConfirmBy` VARCHAR(140) NULL,
	`TRAJConfirmDate` DATETIME NULL,
	`TRAJApproveStatus` SMALLINT NULL,
	`TRAJApproveBy` VARCHAR(140) NULL,
	`TRAJApproveDate` DATETIME NULL,
	`TRAJApproveNote` VARCHAR(80) NULL,
	`TRAJRevision` SMALLINT NULL,
	`TRAJCancelStatus` SMALLINT NULL,
	`TRAJCancelNo` VARCHAR(30) NULL,
	`TRAJCancelBy` VARCHAR(140) NULL,
	`TRAJCancelDate` DATETIME NULL,
	`TRAJCancelNote` VARCHAR(80) NULL,
	`TRAJFlag1` SMALLINT NULL,
	`TRAJFlag2` SMALLINT NULL,
	`TRAJFlag3` SMALLINT NULL,
	PRIMARY KEY (`TRAJNo`),
	KEY `TAPQTCmpCode` (`TRAJTARNCode`),
	KEY `TInBTPrjCode` (`TRAJTPrjCode`),
	KEY `TPCNTBraCode` (`TRAJTBraCode`),
	KEY `TPODTAPNCode` (`TRAJContactNote`),
	KEY `TPWOSupplierName` (`TRAJCusAddress`),
	KEY `TPWOTCmpCode` (`TRAJCustomerName`),
	KEY `TSODTCurCode` (`TRAJTCurCode`),
	KEY `VS4TARVS4TARDebtAdjust` (`TRAJTARNCode`),
	KEY `VS4TBranchVS4TARDebtAdjust` (`TRAJTBraCode`),
	KEY `VS4TCurrencyVS4TARDebtAdjust` (`TRAJTCurCode`),
	KEY `VS4TProjectVS4TARDebtAdjust` (`TRAJTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARDebtAdjustMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARDebtAdjustMB`;

# ---------- CREATE TABLE `VS4TARDebtAdjustMB` ----------

CREATE TABLE `VS4TARDebtAdjustMB` (
	`TRJMTRJANo` VARCHAR(30) NOT NULL,
	`TRJMLn` INT NOT NULL DEFAULT '0',
	`TRJMType` INT NULL DEFAULT '0',
	`TRJMDocNo` VARCHAR(30) NULL,
	`TRJMTaxNo` VARCHAR(30) NULL,
	`TRJMDate` VARCHAR(30) NULL,
	`TRJMRefNo` VARCHAR(30) NULL,
	`TRJMRefDate` DATETIME NULL,
	`TRJMRefNo2` VARCHAR(30) NULL,
	`TRJMRefDate2` DATETIME NULL,
	`TRJMRefNo3` VARCHAR(30) NULL,
	`TRJMRefDate3` DATETIME NULL,
	`TRJMNetAmount` FLOAT NULL DEFAULT '0',
	`TRJMTCurCode` VARCHAR(5) NULL,
	`TRJMExchangeRate` FLOAT NULL DEFAULT '0',
	`TRJMNAmountInRate` FLOAT NULL DEFAULT '0',
	`TRJMTaxBase` FLOAT NULL DEFAULT '0',
	`TRJMDescription` VARCHAR(255) NULL,
	`TRJMFlag1` SMALLINT NULL DEFAULT '0',
	`TRJMFlag2` SMALLINT NULL DEFAULT '0',
	`TRJMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRJMLn`, `TRJMTRJANo`),
	KEY `TPWBID` (`TRJMLn`),
	KEY `TRAJTaxNo` (`TRJMTaxNo`),
	KEY `TRAJTCurCode` (`TRJMTCurCode`),
	KEY `TRCMLn` (`TRJMType`),
	KEY `TRCNDocNo` (`TRJMDate`),
	KEY `TRCNTIvoNo` (`TRJMDocNo`),
	KEY `TTfMID` (`TRJMTRJANo`),
	KEY `VS4TARDebtAdjustVS4TARDebtAdjustMB` (`TRJMTRJANo`),
	KEY `VS4TCurrencyVS4TARDebtAdjustMB` (`TRJMTCurCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARGroup`;

# ---------- CREATE TABLE `VS4TARGroup` ----------

CREATE TABLE `VS4TARGroup` (
	`TARGCode` VARCHAR(30) NOT NULL,
	`TARGName` VARCHAR(100) NULL,
	`TARGCreateCode` VARCHAR(30) NULL,
	`TARGCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TARGEditCode` VARCHAR(30) NULL,
	`TARGEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TARGConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TARGConfirmCode` VARCHAR(30) NULL,
	`TARGConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TARGCancelStatus` SMALLINT NULL DEFAULT '0',
	`TARGCancelCode` VARCHAR(30) NULL,
	`TARGCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TARGFlag1` SMALLINT NULL DEFAULT '0',
	`TARGFlag2` SMALLINT NULL DEFAULT '0',
	`TARGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARGCode`),
	KEY `TAPNCancelCode` (`TARGCancelCode`),
	KEY `TAPNConfirmCode` (`TARGConfirmCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARHolder` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARHolder`;

# ---------- CREATE TABLE `VS4TARHolder` ----------

CREATE TABLE `VS4TARHolder` (
	`TARHCode` VARCHAR(30) NOT NULL,
	`TARHIntro` VARCHAR(50) NULL,
	`TARHName` VARCHAR(200) NULL,
	`TARHName2` VARCHAR(200) NULL,
	`TARHIntroName` VARCHAR(200) NULL,
	`TARHType` SMALLINT NULL DEFAULT '0',
	`TARHParent` VARCHAR(30) NULL,
	`TARHFlag1` SMALLINT NULL DEFAULT '0',
	`TARHFlag2` SMALLINT NULL DEFAULT '0',
	`TARHFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARHCode`),
	UNIQUE KEY `TARHParent` (`TARHParent`),
	KEY `TSHPCode` (`TARHCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARImportantDay` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARImportantDay`;

# ---------- CREATE TABLE `VS4TARImportantDay` ----------

CREATE TABLE `VS4TARImportantDay` (
	`TARITARNCode` VARCHAR(30) NOT NULL,
	`TARILn` INT NOT NULL DEFAULT '0',
	`TARITIMDCode` VARCHAR(30) NULL,
	`TARIDate` DATETIME NULL,
	`TARINote` VARCHAR(100) NULL,
	`TARIFlag1` SMALLINT NULL DEFAULT '0',
	`TARIFlag2` SMALLINT NULL DEFAULT '0',
	`TARIFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARITARNCode`, `TARILn`),
	KEY `TARITARNCode` (`TARITARNCode`),
	KEY `TARITIMDCode` (`TARITIMDCode`),
	KEY `VS4TARVS4TARImportantDay` (`TARITARNCode`),
	KEY `VS4TImportantDayVS4TARImportantDay` (`TARITIMDCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARIndentify` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARIndentify`;

# ---------- CREATE TABLE `VS4TARIndentify` ----------

CREATE TABLE `VS4TARIndentify` (
	`TIDRTARNCode` VARCHAR(30) NOT NULL,
	`TIDRLn` INT NOT NULL DEFAULT '0',
	`TIDRIdentify1` TEXT NULL,
	`TIDRImage1` VARCHAR(255) NULL,
	`TIDRFlag1` SMALLINT NULL DEFAULT '0',
	`TIDRFlag2` SMALLINT NULL DEFAULT '0',
	`TIDRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIDRTARNCode`, `TIDRLn`),
	KEY `TCmTCode` (`TIDRTARNCode`),
	KEY `TIDETEmpCode` (`TIDRLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARInquiry` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARInquiry`;

# ---------- CREATE TABLE `VS4TARInquiry` ----------

CREATE TABLE `VS4TARInquiry` (
	`TAQCTARNCode` VARCHAR(30) NOT NULL,
	`TAQCLn` INT NOT NULL DEFAULT '0',
	`TAQCTIQCTIQRCode` VARCHAR(15) NULL,
	`TAQCTIQCLn` INT NULL DEFAULT '0',
	`TAQCNote` VARCHAR(100) NULL,
	`TAQCFlag1` SMALLINT NULL DEFAULT '0',
	`TAQCFlag2` SMALLINT NULL DEFAULT '0',
	`TAQCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAQCTARNCode`, `TAQCLn`),
	KEY `TAQCLn` (`TAQCLn`),
	KEY `TAQCTARNCode` (`TAQCTARNCode`),
	KEY `TIQGCode` (`TAQCTIQCLn`),
	KEY `VS4TARVS4TARInquiry` (`TAQCTARNCode`),
	KEY `VS4TInquiryChoiceVS4TARInquiry` (`TAQCTIQCTIQRCode`, `TAQCTIQCLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARInvoice` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARInvoice`;

# ---------- CREATE TABLE `VS4TARInvoice` ----------

CREATE TABLE `VS4TARInvoice` (
	`TIvoNo` VARCHAR(30) NOT NULL,
	`TIvoBalanceFlag` TINYINT NULL DEFAULT '0',
	`TIvoType` SMALLINT NULL DEFAULT '0',
	`TIvoTRBKCode` VARCHAR(30) NULL,
	`TIvoTRCACode` VARCHAR(30) NULL,
	`TIvoMode` SMALLINT NULL DEFAULT '0',
	`TIvoDate` DATETIME NULL,
	`TIvoLoadingDate` DATETIME NULL,
	`TIvoStartAgingDate` DATETIME NULL,
	`TIvoDueDate` DATETIME NULL,
	`TIvoGLMethod` SMALLINT NULL DEFAULT '0',
	`TIvoTGLTNo` VARCHAR(30) NULL,
	`TIvoTTeTNo` VARCHAR(30) NULL,
	`TIvoTaxNo` VARCHAR(30) NULL,
	`TIvoTaxPeriodNo` DATETIME NULL,
	`TIvoTaxPeriodType` SMALLINT NULL,
	`TIvoTaxRefund` SMALLINT NULL,
	`TIvoPayType` SMALLINT NULL DEFAULT '0',
	`TIvoRefNo` VARCHAR(30) NULL,
	`TIvoRefDate` DATETIME NULL,
	`TIvoRefNo2` VARCHAR(30) NULL,
	`TIvoRefDate2` DATETIME NULL,
	`TIvoPONo` VARCHAR(30) NULL,
	`TIvoSOCode` VARCHAR(30) NULL,
	`TIvoJobCode` VARCHAR(30) NULL,
	`TIvoTJobNo` VARCHAR(30) NULL,
	`TIvoTJbMLn` INT NULL DEFAULT '0',
	`TIvoTPrjCode` VARCHAR(30) NULL,
	`TIvoTBraCode` VARCHAR(30) NULL,
	`TIvoTEmpCode` VARCHAR(30) NULL,
	`TIvoSaleName` VARCHAR(140) NULL,
	`TIvoGuideText` VARCHAR(100) NULL,
	`TIvoEmpText` VARCHAR(100) NULL,
	`TIvoDeliveryDate` DATETIME NULL,
	`TIvoDeliveryTo` VARCHAR(255) NULL,
	`TIvoTOTNLn` INT NULL,
	`TIvoTARNCode` VARCHAR(30) NULL,
	`TIvoTARDCode` VARCHAR(30) NULL,
	`TIvoContactNote` VARCHAR(50) NULL,
	`TIvoContactName` VARCHAR(160) NULL,
	`TIvoCustomerName` VARCHAR(200) NULL,
	`TIvoCusAddress` VARCHAR(255) NULL,
	`TIvoCustomerName2` VARCHAR(200) NULL,
	`TIvoCusAddress2` VARCHAR(255) NULL,
	`TIvoConsignee` VARCHAR(255) NULL,
	`TIvoNotifyParty` VARCHAR(255) NULL,
	`TIvoCostTotal` FLOAT NULL DEFAULT '0',
	`TIvoPMCostTotal` FLOAT NULL DEFAULT '0',
	`TIvoPriceChannel` SMALLINT NULL DEFAULT '0',
	`TIvoDiscountList` FLOAT NULL,
	`TIvoSubTotal` FLOAT NULL,
	`TIvoDiscountText` VARCHAR(30) NULL,
	`TIvoDiscountTotal` FLOAT NULL,
	`TIvoNetTotal` FLOAT NULL DEFAULT '0',
	`TIvoDepositText` VARCHAR(3) NULL,
	`TIvoDeposit` FLOAT NULL DEFAULT '0',
	`TIvoTotal` FLOAT NULL,
	`TIvoTotalFOB` FLOAT NULL,
	`TIvoTCurCode` VARCHAR(5) NULL,
	`TIvoExchangeRate` DOUBLE NULL DEFAULT '0',
	`TIvoTotalInRate` FLOAT NULL,
	`TIvoVATType` SMALLINT NULL DEFAULT '0',
	`TIvoVATRate` DOUBLE NULL,
	`TIvoTaxBase` FLOAT NULL DEFAULT '0',
	`TIvoVATTotal` FLOAT NULL,
	`TIvoGrandTotal` FLOAT NULL,
	`TIvoNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TIvoWTaxBase` FLOAT NULL DEFAULT '0',
	`TIvoWTaxRate` DOUBLE NULL DEFAULT '0',
	`TIvoWTaxTotal` FLOAT NULL DEFAULT '0',
	`TIvoNetPayment` FLOAT NULL,
	`TIvoBaseArrears` FLOAT NULL DEFAULT '0',
	`TIvoArrears` FLOAT NULL DEFAULT '0',
	`TIvoIgnoreArrears` SMALLINT NULL,
	`TIvoAdjustTotal` FLOAT NULL DEFAULT '0',
	`TIvoBaseAvailable` FLOAT NULL,
	`TIvoAvailable` FLOAT NULL,
	`TIvoRewardTotal` FLOAT NULL,
	`TIvoPremiumTotal` FLOAT NULL,
	`TIvoCommissionBase` FLOAT NULL DEFAULT '0',
	`TIvoCommissionRate` VARCHAR(30) NULL,
	`TIvoCommission` FLOAT NULL DEFAULT '0',
	`TIvoBaseIncoType` VARCHAR(3) NULL,
	`TIvoIncoType` VARCHAR(3) NULL,
	`TIvoIncoTerms` VARCHAR(50) NULL,
	`TIvoOtherFee` FLOAT NULL DEFAULT '0',
	`TIvoTransportFee` FLOAT NULL DEFAULT '0',
	`TIvoHandlingFee` FLOAT NULL DEFAULT '0',
	`TIvoFreightFee` FLOAT NULL DEFAULT '0',
	`TIvoInsurance` FLOAT NULL DEFAULT '0',
	`TIvoTransportDesc` FLOAT NULL,
	`TIvoDuty` FLOAT NULL,
	`TIvoShipBy` VARCHAR(255) NULL,
	`TIvoCountryOrigin` VARCHAR(50) NULL,
	`TIvoDestination` VARCHAR(255) NULL,
	`TIvoCondition` VARCHAR(100) NULL,
	`TIvoConditionDay` SMALLINT NULL DEFAULT '0',
	`TIvoCondition1` DOUBLE NULL DEFAULT '0',
	`TIvoConditionDay1` SMALLINT NULL DEFAULT '0',
	`TIvoPaymentNote` VARCHAR(200) NULL,
	`TIvoStatementNote` VARCHAR(200) NULL,
	`TIvoTShpCode` VARCHAR(30) NULL,
	`TIvoTRouCode` VARCHAR(30) NULL,
	`TIvoDeliveryCond` SMALLINT NULL,
	`TIvoDeliveryNote` VARCHAR(200) NULL,
	`TIvoPackingNote` VARCHAR(200) NULL,
	`TIvoCustom1` VARCHAR(30) NULL,
	`TIvoCustom2` VARCHAR(30) NULL,
	`TIvoCustom3` VARCHAR(30) NULL,
	`TIvoCustom4` VARCHAR(255) NULL,
	`TIvoCustom5` VARCHAR(255) NULL,
	`TIvoCustom6` VARCHAR(30) NULL,
	`TIvoCustomNo` VARCHAR(30) NULL,
	`TIvoCustomDate` DATETIME NULL,
	`TIvoCartonName` VARCHAR(10) NULL,
	`TIvoTotalCarton` DOUBLE NULL,
	`TIvoTotalNW` DOUBLE NULL,
	`TIvoTotalGW` DOUBLE NULL,
	`TIvoDayAvailable` SMALLINT NULL,
	`TIvoDescription` VARCHAR(255) NULL,
	`TIvoTSOTCode` VARCHAR(50) NULL,
	`TIvoDeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TIvoBillStatus` SMALLINT NULL DEFAULT '0',
	`TIvoCardFlag` SMALLINT NULL DEFAULT '0',
	`TIvoTaxFlag` SMALLINT NULL DEFAULT '0',
	`TIvoBoxList` VARCHAR(60) NULL,
	`TIvoCreateBy` VARCHAR(140) NULL,
	`TIvoCreateDate` DATETIME NULL,
	`TIvoEditCode` VARCHAR(30) NULL,
	`TIvoEditBy` VARCHAR(140) NULL,
	`TIvoEditDate` DATETIME NULL,
	`TIvoConfirmStatus` SMALLINT NULL,
	`TIvoConfirmBy` VARCHAR(140) NULL,
	`TIvoConfirmDate` DATETIME NULL,
	`TIvoApproveStatus` SMALLINT NULL,
	`TIvoApproveBy` VARCHAR(140) NULL,
	`TIvoApproveDate` DATETIME NULL,
	`TIvoApproveNote` VARCHAR(80) NULL,
	`TIvoRevision` SMALLINT NULL,
	`TIvoCancelStatus` SMALLINT NULL,
	`TIvoCancelBy` VARCHAR(140) NULL,
	`TIvoCancelDate` DATETIME NULL,
	`TIvoCancelNote` VARCHAR(80) NULL,
	`TIvoFlag1` SMALLINT NULL,
	`TIvoFlag2` SMALLINT NULL,
	`TIvoFlag3` SMALLINT NULL,
	PRIMARY KEY (`TIvoNo`),
	KEY `TAPQTCmpCode` (`TIvoTARNCode`),
	KEY `TIAPTShpCode` (`TIvoTShpCode`),
	KEY `TIvoCusAddress` (`TIvoCusAddress2`),
	KEY `TIvoCustomerName` (`TIvoCustomerName2`),
	KEY `TIvoJobCode` (`TIvoSOCode`),
	KEY `TIvoSOCode` (`TIvoPONo`),
	KEY `TIvoTaxNo` (`TIvoTaxNo`),
	KEY `TIvoTJobNo` (`TIvoJobCode`),
	KEY `TIvoTRCACode` (`TIvoTRBKCode`),
	KEY `TIvoTRouCode` (`TIvoDeliveryCond`),
	KEY `TIvoTShpCode` (`TIvoTRouCode`),
	KEY `TPCNTJbMLn` (`TIvoTJbMLn`),
	KEY `TPODTAPNCode` (`TIvoContactNote`),
	KEY `TPRDTBraCode` (`TIvoTBraCode`),
	KEY `TPTATARDCode` (`TIvoTARDCode`),
	KEY `TPWOSupplierName` (`TIvoCusAddress`),
	KEY `TPWOTCmpCode` (`TIvoCustomerName`),
	KEY `TQuoTJobNo` (`TIvoTJobNo`),
	KEY `TQuoTPrjCode` (`TIvoTPrjCode`),
	KEY `TQuoTRCACode` (`TIvoTRCACode`),
	KEY `TSODTCurCode` (`TIvoTCurCode`),
	KEY `TSODTEmpCode` (`TIvoTEmpCode`),
	KEY `VS4TARVS4TInvoice` (`TIvoTARNCode`),
	KEY `VS4TProjectVS4TInvoice` (`TIvoTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARInvoiceADJ` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARInvoiceADJ`;

# ---------- CREATE TABLE `VS4TARInvoiceADJ` ----------

CREATE TABLE `VS4TARInvoiceADJ` (
	`TIvANo` VARCHAR(30) NOT NULL,
	`TIvAType` SMALLINT NULL DEFAULT '0',
	`TIvADate` DATETIME NULL,
	`TIvADueDate` DATETIME NULL,
	`TIvATaxNo` VARCHAR(30) NULL,
	`TIvARefNo` VARCHAR(30) NULL,
	`TIvARefDate` DATETIME NULL,
	`TIvARefNo2` VARCHAR(30) NULL,
	`TIvARefDate2` DATETIME NULL,
	`TIvAPONo` VARCHAR(30) NULL,
	`TIvASOCode` VARCHAR(30) NULL,
	`TIvAJobCode` VARCHAR(30) NULL,
	`TIvATJobNo` VARCHAR(30) NULL,
	`TIvATJbMLn` INT NULL DEFAULT '0',
	`TIvATPrjCode` VARCHAR(30) NULL,
	`TIvATBraCode` VARCHAR(30) NULL,
	`TIvATEmpCode` VARCHAR(30) NULL,
	`TIvASaleName` VARCHAR(140) NULL,
	`TIvAGuideText` VARCHAR(100) NULL,
	`TIvAEmpText` VARCHAR(100) NULL,
	`TIvADeliveryDate` DATETIME NULL,
	`TIvADeliveryTo` VARCHAR(255) NULL,
	`TIvATACPTACYID` INT NULL DEFAULT '0',
	`TIvATACPID` INT NULL DEFAULT '0',
	`TIvATARNCode` VARCHAR(30) NULL,
	`TIvAContactNote` VARCHAR(50) NULL,
	`TIvAContactName` VARCHAR(160) NULL,
	`TIvACustomerName` VARCHAR(200) NULL,
	`TIvACusAddress` VARCHAR(255) NULL,
	`TIvACostTotal` FLOAT NULL DEFAULT '0',
	`TIvAPriceChannel` SMALLINT NULL DEFAULT '0',
	`TIvAChannelName` VARCHAR(30) NULL,
	`TIvADiscountList` FLOAT NULL,
	`TIvASubTotal` FLOAT NULL,
	`TIvADiscountText` VARCHAR(30) NULL,
	`TIvADiscountTotal` FLOAT NULL,
	`TIvANetTotal` FLOAT NULL,
	`TIvATaxBase` FLOAT NULL DEFAULT '0',
	`TIvAVATRate` DOUBLE NULL,
	`TIvAVATTotal` FLOAT NULL,
	`TIvANOTAXTotal` FLOAT NULL DEFAULT '0',
	`TIvAZTAXTotal` FLOAT NULL DEFAULT '0',
	`TIvAWTaxBase` FLOAT NULL DEFAULT '0',
	`TIvAWTaxRate` DOUBLE NULL DEFAULT '0',
	`TIvAWTaxTotal` FLOAT NULL DEFAULT '0',
	`TIvARewardTotal` FLOAT NULL,
	`TIvAPremiumTotal` FLOAT NULL,
	`TIvAGrandTotalVAT` FLOAT NULL,
	`TIvAGrandTotal` FLOAT NULL,
	`TIvANetPayment` FLOAT NULL,
	`TIvACommissionBase` FLOAT NULL DEFAULT '0',
	`TIvACommissionRate` VARCHAR(30) NULL,
	`TIvACommission` FLOAT NULL DEFAULT '0',
	`TIvATotalFOB` FLOAT NULL,
	`TIvAIVTotal` FLOAT NULL DEFAULT '0',
	`TIvACNTotal` FLOAT NULL DEFAULT '0',
	`TIvADBTotal` FLOAT NULL DEFAULT '0',
	`TIvANetQuantity` DOUBLE NULL DEFAULT '0',
	`TIvAPayQuantity` DOUBLE NULL DEFAULT '0',
	`TIvAPayDate` DATETIME NULL,
	`TIvARefCN` VARCHAR(255) NULL,
	`TIvARefDB` VARCHAR(255) NULL,
	`TIvARefPayment` VARCHAR(255) NULL,
	`TIvAVATType` SMALLINT NULL DEFAULT '0',
	`TIvADepositText` VARCHAR(30) NULL,
	`TIvADeposit` FLOAT NULL DEFAULT '0',
	`TIvAIncoType` FLOAT NULL DEFAULT '0',
	`TIvAInsurance` FLOAT NULL DEFAULT '0',
	`TIvAFreightFee` FLOAT NULL DEFAULT '0',
	`TIvAOtherFee` FLOAT NULL DEFAULT '0',
	`TIvATransportFee` FLOAT NULL DEFAULT '0',
	`TIvAFirstPayment` FLOAT NULL,
	`TIvATotalPayment` FLOAT NULL DEFAULT '0',
	`TIvATotalArrear` FLOAT NULL DEFAULT '0',
	`TIvAIVArrear` FLOAT NULL DEFAULT '0',
	`TIvACNArrear` FLOAT NULL DEFAULT '0',
	`TIvADBArrear` FLOAT NULL DEFAULT '0',
	`TIvAIVNetPayment` FLOAT NULL DEFAULT '0',
	`TIvACNNetPayment` FLOAT NULL DEFAULT '0',
	`TIvADBNetPayment` FLOAT NULL DEFAULT '0',
	`TIvATCurCode` VARCHAR(5) NULL,
	`TIvAExchangeRate` FLOAT NULL DEFAULT '0',
	`TIvATotalInRate` FLOAT NULL,
	`TIvAAdjustTotal` FLOAT NULL DEFAULT '0',
	`TIvACountryOrigin` VARCHAR(50) NULL,
	`TIvACondition` VARCHAR(100) NULL,
	`TIvAConditionDay` SMALLINT NULL DEFAULT '0',
	`TIvACondition1` DOUBLE NULL DEFAULT '0',
	`TIvAConditionDay1` SMALLINT NULL DEFAULT '0',
	`TIvADecimalEX` DOUBLE NULL DEFAULT '0',
	`TIvADecimalUnit` SMALLINT NULL DEFAULT '0',
	`TIvADecimalCost` SMALLINT NULL DEFAULT '0',
	`TIvAPaymentNote` VARCHAR(200) NULL,
	`TIvAStatementNote` VARCHAR(200) NULL,
	`TIvADeliveryNote` VARCHAR(200) NULL,
	`TIvADayAvailable` SMALLINT NULL,
	`TIvADescription` VARCHAR(255) NULL,
	`TIvAMultiProject` SMALLINT NULL,
	`TIvATSOTCode` VARCHAR(50) NULL,
	`TIvADeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TIvACancelStatus` SMALLINT NULL DEFAULT '0',
	`TIvAConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TIvAApproveStatus` SMALLINT NULL DEFAULT '0',
	`TIvABillStatus` SMALLINT NULL DEFAULT '0',
	`TIvACardFlag` SMALLINT NULL DEFAULT '0',
	`TIvATaxFlag` SMALLINT NULL DEFAULT '0',
	`TIvAFlag1` SMALLINT NULL,
	`TIvAFlag2` SMALLINT NULL,
	`TIvAFlag3` SMALLINT NULL,
	PRIMARY KEY (`TIvANo`),
	KEY `TAPQTCmpCode` (`TIvATARNCode`),
	KEY `TIvASOCode` (`TIvASOCode`),
	KEY `TIvoJobCode` (`TIvAJobCode`),
	KEY `TIvoTACPID` (`TIvATACPID`),
	KEY `TIvoTACPTACYID` (`TIvATACPTACYID`),
	KEY `TIvoTaxNo` (`TIvATaxNo`),
	KEY `TPCNTJbMLn` (`TIvATJbMLn`),
	KEY `TPODTAPNCode` (`TIvAContactNote`),
	KEY `TPRDTBraCode` (`TIvATBraCode`),
	KEY `TPWOSupplierName` (`TIvACusAddress`),
	KEY `TPWOTCmpCode` (`TIvACustomerName`),
	KEY `TQuoTJobNo` (`TIvATJobNo`),
	KEY `TQuoTPrjCode` (`TIvATPrjCode`),
	KEY `TSODTCurCode` (`TIvATCurCode`),
	KEY `TSODTEmpCode` (`TIvATEmpCode`),
	KEY `VS4TARVS4TARInvoiceADJ` (`TIvATARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARInvoiceBook` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARInvoiceBook`;

# ---------- CREATE TABLE `VS4TARInvoiceBook` ----------

CREATE TABLE `VS4TARInvoiceBook` (
	`TRBKCode` VARCHAR(30) NOT NULL,
	`TRBKName` VARCHAR(140) NULL,
	`TRBKName2` VARCHAR(140) NULL,
	`TRBKDocCode` VARCHAR(30) NULL,
	`TRBKFlag1` SMALLINT NULL DEFAULT '0',
	`TRBKFlag2` SMALLINT NULL DEFAULT '0',
	`TRBKFlag3` SMALLINT NULL DEFAULT '0',
	UNIQUE KEY `Index_B0D14894_767D_4A78` (`TRBKCode`),
	KEY `TPRBCode` (`TRBKDocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARInvoiceMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARInvoiceMB`;

# ---------- CREATE TABLE `VS4TARInvoiceMB` ----------

CREATE TABLE `VS4TARInvoiceMB` (
	`TIoMTIvoNo` VARCHAR(30) NOT NULL,
	`TIoMLn` INT NOT NULL DEFAULT '0',
	`TIoMType` SMALLINT NULL DEFAULT '0',
	`TIoMGroupName` VARCHAR(30) NULL,
	`TIoMJobCode` VARCHAR(30) NULL,
	`TIoMTOInCode` VARCHAR(50) NULL,
	`TIoMTPOSCode` VARCHAR(50) NULL,
	`TIoMSerialNo` VARCHAR(30) NULL,
	`TIoMCustom1` VARCHAR(30) NULL,
	`TIoMCustom2` VARCHAR(30) NULL,
	`TIoMCustom3` VARCHAR(30) NULL,
	`TIoMCustom4` VARCHAR(30) NULL,
	`TIoMCustom5` VARCHAR(30) NULL,
	`TIoMShippingMark` VARCHAR(255) NULL,
	`TIoMPOSCode` VARCHAR(50) NULL,
	`TIoMFactoryCode` VARCHAR(50) NULL,
	`TIoMPOSName` VARCHAR(150) NULL,
	`TIoMCost` FLOAT NULL DEFAULT '0',
	`TIoMPremiumCost` FLOAT NULL DEFAULT '0',
	`TIoMPrice` FLOAT NULL DEFAULT '0',
	`TIoMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TIoMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TIoMAcceptError` VARCHAR(30) NULL,
	`TIoMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TIoMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TIoMQuantityText` VARCHAR(255) NULL,
	`TIoMQuantity` DOUBLE NULL DEFAULT '0',
	`TIoMTUntCode` VARCHAR(50) NULL,
	`TIoMQuantity2` DOUBLE NULL DEFAULT '0',
	`TIoMTUntCode2` VARCHAR(50) NULL,
	`TIoMQuantity3` DOUBLE NULL DEFAULT '0',
	`TIoMTUntCode3` VARCHAR(50) NULL,
	`TIoMCostAmount` DOUBLE NULL DEFAULT '0',
	`TIoMAmount` DOUBLE NULL DEFAULT '0',
	`TIoMDiscountText` VARCHAR(30) NULL,
	`TIoMDiscountTotal` FLOAT NULL,
	`TIoMNetAmount` FLOAT NULL DEFAULT '0',
	`TIoMTaxType` SMALLINT NULL DEFAULT '0',
	`TIoMTaxBase` FLOAT NULL DEFAULT '0',
	`TIoMWTAXBase` FLOAT NULL DEFAULT '0',
	`TIoMAmountVAT` FLOAT NULL DEFAULT '0',
	`TIoMAmountWTAX` FLOAT NULL DEFAULT '0',
	`TIoMPromotionType` VARCHAR(15) NULL,
	`TIoMFreeCode` VARCHAR(30) NULL,
	`TIoMIsPremium` SMALLINT NULL DEFAULT '0',
	`TIoMDescription` VARCHAR(255) NULL,
	`TIoMSourceNo` VARCHAR(30) NULL,
	`TIoMSourceLn` INT NULL DEFAULT '0',
	`TIoMSourceDate` DATETIME NULL,
	`TIoMTLctCode` VARCHAR(30) NULL,
	`TIoMCommissionBase` FLOAT NULL DEFAULT '0',
	`TIoMCommissionRate` VARCHAR(30) NULL,
	`TIoMCommission` FLOAT NULL DEFAULT '0',
	`TIoMFlag1` SMALLINT NULL DEFAULT '0',
	`TIoMFlag2` SMALLINT NULL DEFAULT '0',
	`TIoMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIoMLn`, `TIoMTIvoNo`),
	KEY `TIoMTUntCode2` (`TIoMTUntCode3`),
	KEY `TJbMSourceNo` (`TIoMSourceNo`),
	KEY `TPOBTPdtCode` (`TIoMTPOSCode`),
	KEY `TPSMUnitFactor` (`TIoMUnitFactor`),
	KEY `TPWBID` (`TIoMLn`),
	KEY `TPWBPdtCode1` (`TIoMPOSCode`),
	KEY `TPWBTUntCode` (`TIoMTUntCode`),
	KEY `TPWBTUntCode1` (`TIoMTUntCode2`),
	KEY `TQuBFactoryCode` (`TIoMFactoryCode`),
	KEY `TSOBFreeCode` (`TIoMFreeCode`),
	KEY `TSOBJobCode` (`TIoMJobCode`),
	KEY `TSOBTLctCode` (`TIoMTLctCode`),
	KEY `TSOBTOInCode` (`TIoMTOInCode`),
	KEY `TTfMID` (`TIoMTIvoNo`),
	KEY `TTfrToTShfCode` (`TIoMType`),
	KEY `VS4TInvoiceVS4TInvoiceMB` (`TIoMTIvoNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARInvoicePay` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARInvoicePay`;

# ---------- CREATE TABLE `VS4TARInvoicePay` ----------

CREATE TABLE `VS4TARInvoicePay` (
	`TIPyTIvoNo` VARCHAR(30) NOT NULL,
	`TIPyLn` INT NOT NULL DEFAULT '0',
	`TIPyIsChange` SMALLINT NULL DEFAULT '0',
	`TIPyReceiveType` VARCHAR(15) NULL,
	`TIPyCurrency` VARCHAR(4) NULL,
	`TIPyTBnkCode` VARCHAR(50) NULL,
	`TIPyTransferDate` DATETIME NULL,
	`TIPyCashDate` DATETIME NULL,
	`TIPyDocNo` VARCHAR(50) NULL,
	`TIPyBankBranch` VARCHAR(50) NULL,
	`TIPyAccountType` VARCHAR(25) NULL,
	`TIPyAccountName` VARCHAR(160) NULL,
	`TIPyAccountNumber` VARCHAR(30) NULL,
	`TIPyTBCDNo` VARCHAR(10) NULL,
	`TIPyCardCode` VARCHAR(30) NULL,
	`TIPyCardType` VARCHAR(50) NULL,
	`TIPyCardName` VARCHAR(50) NULL,
	`TIPyCardNo` VARCHAR(20) NULL,
	`TIPyBackCardNo` VARCHAR(8) NULL,
	`TIPyCardExpire` VARCHAR(7) NULL,
	`TIPyExchangeRate` DOUBLE NULL DEFAULT '0',
	`TIPyAmount` FLOAT NULL DEFAULT '0',
	`TIPyAmountInRate` FLOAT NULL DEFAULT '0',
	`TIPyAdjustTotal` FLOAT NULL DEFAULT '0',
	`TIPyDiscount` FLOAT NULL DEFAULT '0',
	`TIPyFee` FLOAT NULL DEFAULT '0',
	`TIPyFeeProvide` SMALLINT NULL DEFAULT '0',
	`TIPyNetAmount` FLOAT NULL DEFAULT '0',
	`TIPyTCBBNo` VARCHAR(30) NULL,
	`TIPyNote` VARCHAR(100) NULL,
	`TIPyFlag1` SMALLINT NULL DEFAULT '0',
	`TIPyFlag2` SMALLINT NULL DEFAULT '0',
	`TIPyFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIPyTIvoNo`, `TIPyLn`),
	KEY `TPPyTPTAID` (`TIPyTIvoNo`),
	KEY `TRVRTCBBNo` (`TIPyTCBBNo`),
	KEY `VS4TCompanyBankVS4TInvoicePayment` (`TIPyTCBBNo`),
	KEY `VS4TInvoiceVS4TInvoicePayment` (`TIPyTIvoNo`),
	KEY `VS4TPaymentTypeVS4TARInvoicePay` (`TIPyReceiveType`),
	KEY `VS4TPaymentTypeVS4TInvoicePayment` (`TIPyReceiveType`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARMedia` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARMedia`;

# ---------- CREATE TABLE `VS4TARMedia` ----------

CREATE TABLE `VS4TARMedia` (
	`TAMdTMedCode` VARCHAR(30) NOT NULL,
	`TAMdTARNCode` VARCHAR(30) NOT NULL,
	`TAMdFlag1` SMALLINT NULL DEFAULT '0',
	`TAMdFlag2` SMALLINT NULL DEFAULT '0',
	`TAMdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAMdTMedCode`, `TAMdTARNCode`),
	KEY `TBsTCode` (`TAMdTMedCode`),
	KEY `VS4TMediaVS4TARMedia` (`TAMdTMedCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARMemberCard` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARMemberCard`;

# ---------- CREATE TABLE `VS4TARMemberCard` ----------

CREATE TABLE `VS4TARMemberCard` (
	`TAMCTARNCode` VARCHAR(30) NOT NULL,
	`TAMCLn` SMALLINT NOT NULL DEFAULT '0',
	`TAMCVenderName` VARCHAR(100) NULL,
	`TAMCTMCDCode` VARCHAR(15) NULL,
	`TAMCLevel` VARCHAR(50) NULL,
	`TAMCCardName` VARCHAR(50) NULL,
	`TAMCCardNo` VARCHAR(20) NULL,
	`TAMCCardExpire` DATETIME NULL,
	`TAMCCardIssue` DATETIME NULL,
	`TAMCCardSince` DATETIME NULL,
	`TAMCNote` VARCHAR(100) NULL,
	`TAMCFlag1` SMALLINT NULL DEFAULT '0',
	`TAMCFlag2` SMALLINT NULL DEFAULT '0',
	`TAMCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAMCTARNCode`, `TAMCLn`),
	KEY `TAMCTARNCode` (`TAMCTMCDCode`),
	KEY `TPPyTPTAID` (`TAMCTARNCode`),
	KEY `VS4TARVS4TARMemberCard` (`TAMCTARNCode`),
	KEY `VS4TMemberCardVS4TARMemberCard` (`TAMCTMCDCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARParent` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARParent`;

# ---------- CREATE TABLE `VS4TARParent` ----------

CREATE TABLE `VS4TARParent` (
	`TARPTARNCode` VARCHAR(30) NOT NULL,
	`TARPTARNCode2` VARCHAR(30) NOT NULL,
	`TARPISMain` SMALLINT NULL DEFAULT '0',
	`TARPFlag1` SMALLINT NULL DEFAULT '0',
	`TARPFlag2` SMALLINT NULL DEFAULT '0',
	`TARPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARPTARNCode`, `TARPTARNCode2`),
	KEY `TARPTARNCode` (`TARPTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARReceipt` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARReceipt`;

# ---------- CREATE TABLE `VS4TARReceipt` ----------

CREATE TABLE `VS4TARReceipt` (
	`TAIHNo` VARCHAR(30) NOT NULL,
	`TAIHDate` DATETIME NULL,
	`TAIHMode` SMALLINT NULL DEFAULT '0',
	`TAIHType` DATETIME NULL,
	`TAIHTGLBCode` VARCHAR(30) NULL,
	`TAIHTBraCode` VARCHAR(30) NULL,
	`TAIHTPrjCode` VARCHAR(30) NULL,
	`TAIHRefNo` VARCHAR(30) NULL,
	`TAIHRefDate` DATETIME NULL,
	`TAIHRefNo2` VARCHAR(30) NULL,
	`TAIHRefDate2` DATETIME NULL,
	`TAIHTARNCode` VARCHAR(30) NULL,
	`TAIHCustomerName` VARCHAR(200) NULL,
	`TAIHCusAddress` VARCHAR(255) NULL,
	`TAIHCostTotal` FLOAT NULL DEFAULT '0',
	`TAIHSubTotal` FLOAT NULL,
	`TAIHDiscountPC` DOUBLE NULL,
	`TAIHDiscPCAmount` DOUBLE NULL,
	`TAIHDiscountFix` FLOAT NULL,
	`TAIHDiscountTotal` FLOAT NULL,
	`TAIHNetTotal` FLOAT NULL,
	`TAIHDepositRate` FLOAT NULL DEFAULT '0',
	`TAIHDepPCAmount` FLOAT NULL DEFAULT '0',
	`TAIHDepositFix` FLOAT NULL DEFAULT '0',
	`TAIHDeposit` FLOAT NULL DEFAULT '0',
	`TAIHTotal` FLOAT NULL,
	`TAIHTCurCode` VARCHAR(5) NULL,
	`TAIHExchangeRate` FLOAT NULL DEFAULT '0',
	`TAIHTotalInRate` FLOAT NULL,
	`TAIHCommissionBase` FLOAT NULL DEFAULT '0',
	`TAIHCommissionRate` VARCHAR(30) NULL,
	`TAIHCommission` FLOAT NULL DEFAULT '0',
	`TAIHVATType` SMALLINT NULL,
	`TAIHVATRate` DOUBLE NULL,
	`TAIHTaxBase` FLOAT NULL DEFAULT '0',
	`TAIHVATTotal` FLOAT NULL,
	`TAIHGrandTotal` FLOAT NULL,
	`TAIHNetPayment` FLOAT NULL,
	`TAIHArrears` FLOAT NULL DEFAULT '0',
	`TAIHDescription` VARCHAR(255) NULL,
	`TAIHStatus` SMALLINT NULL DEFAULT '0',
	`TAIHWTaxRate` DOUBLE NULL DEFAULT '0',
	`TAIHDiscount` FLOAT NULL DEFAULT '0',
	`TAIHWTaxTotal` FLOAT NULL DEFAULT '0',
	`TAIHCreateCode` VARCHAR(30) NULL,
	`TAIHCreateBy` VARCHAR(140) NULL,
	`TAIHCreateDate` DATETIME NULL,
	`TAIHEditCode` VARCHAR(30) NULL,
	`TAIHEditBy` VARCHAR(140) NULL,
	`TAIHEditDate` DATETIME NULL,
	`TAIHConfirmStatus` SMALLINT NULL,
	`TAIHConfirmBy` VARCHAR(140) NULL,
	`TAIHConfirmDate` DATETIME NULL,
	`TAIHApproveStatus` SMALLINT NULL,
	`TAIHApproveBy` VARCHAR(140) NULL,
	`TAIHApproveDate` DATETIME NULL,
	`TAIHApproveNote` VARCHAR(80) NULL,
	`TAIHRevision` SMALLINT NULL,
	`TAIHCancelStatus` SMALLINT NULL,
	`TAIHCancelNo` VARCHAR(30) NULL,
	`TAIHCancelBy` VARCHAR(140) NULL,
	`TAIHCancelDate` DATETIME NULL,
	`TAIHCancelNote` VARCHAR(80) NULL,
	`TAIHFlag1` SMALLINT NULL,
	`TAIHFlag2` SMALLINT NULL,
	`TAIHFlag3` SMALLINT NULL,
	PRIMARY KEY (`TAIHNo`),
	KEY `TAPQTCmpCode` (`TAIHTARNCode`),
	KEY `TInBTPrjCode` (`TAIHTPrjCode`),
	KEY `TPCNTBraCode` (`TAIHTBraCode`),
	KEY `TPWOSupplierName` (`TAIHCusAddress`),
	KEY `TPWOTCmpCode` (`TAIHCustomerName`),
	KEY `TRECTGLBCode` (`TAIHTGLBCode`),
	KEY `TSODTCurCode` (`TAIHTCurCode`),
	KEY `VS4TARVS4TARReceipt` (`TAIHTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARReceiptD` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARReceiptD`;

# ---------- CREATE TABLE `VS4TARReceiptD` ----------

CREATE TABLE `VS4TARReceiptD` (
	`TAIRNo` VARCHAR(30) NOT NULL,
	`TAIRDate` DATETIME NULL,
	`TAIRMode` SMALLINT NULL DEFAULT '0',
	`TAIRType` DATETIME NULL,
	`TAIRTGLBCode` VARCHAR(30) NULL,
	`TAIRTBraCode` VARCHAR(30) NULL,
	`TAIRTPrjCode` VARCHAR(30) NULL,
	`TAIRRefNo` VARCHAR(30) NULL,
	`TAIRRefDate` DATETIME NULL,
	`TAIRRefNo2` VARCHAR(30) NULL,
	`TAIRRefDate2` DATETIME NULL,
	`TAIRTARNCode` VARCHAR(30) NULL,
	`TAIRCustomerName` VARCHAR(200) NULL,
	`TAIRCusAddress` VARCHAR(255) NULL,
	`TAIRCostTotal` FLOAT NULL DEFAULT '0',
	`TAIRSubTotal` FLOAT NULL,
	`TAIRDiscountPC` DOUBLE NULL,
	`TAIRDiscPCAmount` DOUBLE NULL,
	`TAIRDiscountFix` FLOAT NULL,
	`TAIRDiscountTotal` FLOAT NULL,
	`TAIRNetTotal` FLOAT NULL,
	`TAIRDepositRate` FLOAT NULL DEFAULT '0',
	`TAIRDepPCAmount` FLOAT NULL DEFAULT '0',
	`TAIRDepositFix` FLOAT NULL DEFAULT '0',
	`TAIRDeposit` FLOAT NULL DEFAULT '0',
	`TAIRTotal` FLOAT NULL,
	`TAIRTCurCode` VARCHAR(5) NULL,
	`TAIRExchangeRate` FLOAT NULL DEFAULT '0',
	`TAIRTotalInRate` FLOAT NULL,
	`TAIRCommissionBase` FLOAT NULL DEFAULT '0',
	`TAIRCommissionRate` VARCHAR(30) NULL,
	`TAIRCommission` FLOAT NULL DEFAULT '0',
	`TAIRVATType` SMALLINT NULL,
	`TAIRVATRate` DOUBLE NULL,
	`TAIRTaxBase` FLOAT NULL DEFAULT '0',
	`TAIRVATTotal` FLOAT NULL,
	`TAIRGrandTotal` FLOAT NULL,
	`TAIRNetPayment` FLOAT NULL,
	`TAIRArrears` FLOAT NULL DEFAULT '0',
	`TAIRDescription` VARCHAR(255) NULL,
	`TAIRStatus` SMALLINT NULL DEFAULT '0',
	`TAIRWTaxRate` DOUBLE NULL DEFAULT '0',
	`TAIRDiscount` FLOAT NULL DEFAULT '0',
	`TAIRWTaxTotal` FLOAT NULL DEFAULT '0',
	`TAIRCreateCode` VARCHAR(30) NULL,
	`TAIRCreateBy` VARCHAR(140) NULL,
	`TAIRCreateDate` DATETIME NULL,
	`TAIREditCode` VARCHAR(30) NULL,
	`TAIREditBy` VARCHAR(140) NULL,
	`TAIREditDate` DATETIME NULL,
	`TAIRConfirmStatus` SMALLINT NULL,
	`TAIRConfirmBy` VARCHAR(140) NULL,
	`TAIRConfirmDate` DATETIME NULL,
	`TAIRApproveStatus` SMALLINT NULL,
	`TAIRApproveBy` VARCHAR(140) NULL,
	`TAIRApproveDate` DATETIME NULL,
	`TAIRApproveNote` VARCHAR(80) NULL,
	`TAIRRevision` SMALLINT NULL,
	`TAIRCancelStatus` SMALLINT NULL,
	`TAIRCancelNo` VARCHAR(30) NULL,
	`TAIRCancelBy` VARCHAR(140) NULL,
	`TAIRCancelDate` DATETIME NULL,
	`TAIRCancelNote` VARCHAR(80) NULL,
	`TAIRFlag1` SMALLINT NULL,
	`TAIRFlag2` SMALLINT NULL,
	`TAIRFlag3` SMALLINT NULL,
	PRIMARY KEY (`TAIRNo`),
	KEY `TAIHCusAddress` (`TAIRCusAddress`),
	KEY `TAIHCustomerName` (`TAIRCustomerName`),
	KEY `TAIHNo` (`TAIRNo`),
	KEY `TAIHTARNCode` (`TAIRTARNCode`),
	KEY `TAIHTCurCode` (`TAIRTCurCode`),
	KEY `TAIHTGLBCode` (`TAIRTGLBCode`),
	KEY `TAIHTPrjCode` (`TAIRTPrjCode`),
	KEY `TPCNTBraCode` (`TAIRTBraCode`),
	KEY `VS4TARVS4TARReceiptD` (`TAIRTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARReceiptDMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARReceiptDMB`;

# ---------- CREATE TABLE `VS4TARReceiptDMB` ----------

CREATE TABLE `VS4TARReceiptDMB` (
	`TRDMTAIRNo` VARCHAR(30) NOT NULL,
	`TRDMLn` INT NOT NULL DEFAULT '0',
	`TRDMDocLn` INT NULL DEFAULT '0',
	`TRDMRefBillNo` VARCHAR(30) NULL,
	`TRDMRefDocNo` VARCHAR(30) NULL,
	`TRDMRefDocDate` DATETIME NULL,
	`TRDMRefNo` VARCHAR(30) NULL,
	`TRDMRefNo2` VARCHAR(30) NULL,
	`TRDMRefNo3` VARCHAR(30) NULL,
	`TRDMRefDocAmount` FLOAT NULL DEFAULT '0',
	`TRDMRefDocType` VARCHAR(30) NULL,
	`TRDMRefDueDate` DATETIME NULL,
	`TRDMCurrency` VARCHAR(4) NULL,
	`TRDMType` SMALLINT NULL DEFAULT '0',
	`TRDMTPOSCode` VARCHAR(50) NULL,
	`TRDMCustom1` VARCHAR(30) NULL,
	`TRDMCustom2` VARCHAR(30) NULL,
	`TRDMCustom3` VARCHAR(30) NULL,
	`TRDMCustom4` VARCHAR(30) NULL,
	`TRDMCustom5` VARCHAR(30) NULL,
	`TRDMPOSCode` VARCHAR(50) NULL,
	`TRDMFactoryCode` VARCHAR(50) NULL,
	`TRDMPOSName` VARCHAR(150) NULL,
	`TRDMCost` FLOAT NULL DEFAULT '0',
	`TRDMOldPrice` FLOAT NULL DEFAULT '0',
	`TRDMPrice` FLOAT NULL DEFAULT '0',
	`TRDMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TRDMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TRDMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TRDMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TRDMQuantity` DOUBLE NULL DEFAULT '0',
	`TRDMTUntCode` VARCHAR(50) NULL,
	`TRDMQuantity2` DOUBLE NULL DEFAULT '0',
	`TRDMTUntCode2` VARCHAR(50) NULL,
	`TRDMQuantity3` DOUBLE NULL DEFAULT '0',
	`TRDMTUntCode3` VARCHAR(50) NULL,
	`TRDMCostAmount` DOUBLE NULL DEFAULT '0',
	`TRDMAmount` DOUBLE NULL DEFAULT '0',
	`TRDMDiscountText` VARCHAR(30) NULL,
	`TRDMDiscountTotal` FLOAT NULL,
	`TRDMNetAmount` FLOAT NULL DEFAULT '0',
	`TRDMNAmountInRate` FLOAT NULL DEFAULT '0',
	`TRDMTaxBase` FLOAT NULL DEFAULT '0',
	`TRDMTaxType` SMALLINT NULL DEFAULT '0',
	`TRDMAmountVAT` FLOAT NULL DEFAULT '0',
	`TRDMDescription` VARCHAR(150) NULL,
	`TRDMSourceNo` VARCHAR(30) NULL,
	`TRDMSourceLn` INT NULL DEFAULT '0',
	`TRDMFlag1` SMALLINT NULL DEFAULT '0',
	`TRDMFlag2` SMALLINT NULL DEFAULT '0',
	`TRDMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRDMLn`, `TRDMTAIRNo`),
	KEY `TIoMTUntCode2` (`TRDMTUntCode3`),
	KEY `TJbMSourceNo` (`TRDMSourceNo`),
	KEY `TPOBTPdtCode` (`TRDMTPOSCode`),
	KEY `TPSMUnitFactor` (`TRDMUnitFactor`),
	KEY `TPWBID` (`TRDMLn`),
	KEY `TPWBPdtCode1` (`TRDMPOSCode`),
	KEY `TPWBTUntCode` (`TRDMTUntCode`),
	KEY `TPWBTUntCode1` (`TRDMTUntCode2`),
	KEY `TQuBFactoryCode` (`TRDMFactoryCode`),
	KEY `TTfMID` (`TRDMTAIRNo`),
	KEY `TTfrToTShfCode` (`TRDMType`),
	KEY `VS4TARReceiptDVS4TARReceiptDMB` (`TRDMTAIRNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARReceiptMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARReceiptMB`;

# ---------- CREATE TABLE `VS4TARReceiptMB` ----------

CREATE TABLE `VS4TARReceiptMB` (
	`TREMTAIHNo` VARCHAR(30) NOT NULL,
	`TREMLn` INT NOT NULL DEFAULT '0',
	`TREMType` INT NULL DEFAULT '0',
	`TREMRefBillNo` VARCHAR(30) NULL,
	`TREMRefDocNo` VARCHAR(30) NULL,
	`TREMRefDocDate` DATETIME NULL,
	`TREMRefNo` VARCHAR(30) NULL,
	`TREMRefNo2` VARCHAR(30) NULL,
	`TREMRefNo3` VARCHAR(30) NULL,
	`TREMRefDocAmount` FLOAT NULL DEFAULT '0',
	`TREMRefDocType` VARCHAR(30) NULL,
	`TREMRefDueDate` DATETIME NULL,
	`TREMCurrency` VARCHAR(4) NULL,
	`TREMCurRate` DOUBLE NULL DEFAULT '0',
	`TREMCurSubTotal` FLOAT NULL DEFAULT '0',
	`TREMDiscount` VARCHAR(30) NULL,
	`TREMCurDiscount` FLOAT NULL DEFAULT '0',
	`TREMCurAmount` FLOAT NULL DEFAULT '0',
	`TREMAmountRate` FLOAT NULL DEFAULT '0',
	`TREMTaxBase` FLOAT NULL DEFAULT '0',
	`TREMVATType` SMALLINT NULL,
	`TREMVATRate` DOUBLE NULL,
	`TREMVATTotal` FLOAT NULL,
	`TREMWTAXRate` DOUBLE NULL DEFAULT '0',
	`TREMWTAXTotal` FLOAT NULL DEFAULT '0',
	`TREMWTAXCond` SMALLINT NULL DEFAULT '0',
	`TREMWTAXDesc` VARCHAR(250) NULL,
	`TREMCommissionBase` FLOAT NULL DEFAULT '0',
	`TREMCommissionRate` VARCHAR(30) NULL,
	`TREMCommission` FLOAT NULL DEFAULT '0',
	`TREMInterestRate` DOUBLE NULL DEFAULT '0',
	`TREMInterestTotal` FLOAT NULL DEFAULT '0',
	`TREMNote` VARCHAR(250) NULL,
	`TREMStatus` SMALLINT NULL DEFAULT '0',
	`TREMFlag1` SMALLINT NULL DEFAULT '0',
	`TREMFlag2` SMALLINT NULL DEFAULT '0',
	`TREMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TREMTAIHNo`, `TREMLn`),
	KEY `TCHRTCHSNo` (`TREMTAIHNo`),
	KEY `TCHRTCHSTGLTNo` (`TREMLn`),
	KEY `VS4TARReceiptVS4TARReceiptMB` (`TREMTAIHNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARReceiptMBD` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARReceiptMBD`;

# ---------- CREATE TABLE `VS4TARReceiptMBD` ----------

CREATE TABLE `VS4TARReceiptMBD` (
	`TRBDTREMTAIHNo` VARCHAR(30) NOT NULL,
	`TRBDTREMLn` INT NOT NULL DEFAULT '0',
	`TRBDLn` INT NOT NULL DEFAULT '0',
	`TRBDDocLn` INT NULL DEFAULT '0',
	`TRBDRefBillNo` VARCHAR(30) NULL,
	`TRBDRefDocNo` VARCHAR(30) NULL,
	`TRBDRefDocDate` DATETIME NULL,
	`TRBDRefNo` VARCHAR(30) NULL,
	`TRBDRefNo2` VARCHAR(30) NULL,
	`TRBDRefNo3` VARCHAR(30) NULL,
	`TRBDRefDocAmount` FLOAT NULL DEFAULT '0',
	`TRBDRefDocType` VARCHAR(30) NULL,
	`TRBDRefDueDate` DATETIME NULL,
	`TRBDCurrency` VARCHAR(4) NULL,
	`TRBDType` SMALLINT NULL DEFAULT '0',
	`TRBDTPOSCode` VARCHAR(50) NULL,
	`TRBDCustom1` VARCHAR(30) NULL,
	`TRBDCustom2` VARCHAR(30) NULL,
	`TRBDCustom3` VARCHAR(30) NULL,
	`TRBDCustom4` VARCHAR(30) NULL,
	`TRBDCustom5` VARCHAR(30) NULL,
	`TRBDPOSCode` VARCHAR(50) NULL,
	`TRBDFactoryCode` VARCHAR(50) NULL,
	`TRBDPOSName` VARCHAR(150) NULL,
	`TRBDCost` FLOAT NULL DEFAULT '0',
	`TRBDOldPrice` FLOAT NULL DEFAULT '0',
	`TRBDPrice` FLOAT NULL DEFAULT '0',
	`TRBDPerQuantity` DOUBLE NULL DEFAULT '1',
	`TRBDUnitFactor` DOUBLE NULL DEFAULT '0',
	`TRBDUnitCalc` SMALLINT NULL DEFAULT '0',
	`TRBDQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TRBDQuantity` DOUBLE NULL DEFAULT '0',
	`TRBDTUntCode` VARCHAR(50) NULL,
	`TRBDQuantity2` DOUBLE NULL DEFAULT '0',
	`TRBDTUntCode2` VARCHAR(50) NULL,
	`TRBDQuantity3` DOUBLE NULL DEFAULT '0',
	`TRBDTUntCode3` VARCHAR(50) NULL,
	`TRBDCostAmount` DOUBLE NULL DEFAULT '0',
	`TRBDAmount` DOUBLE NULL DEFAULT '0',
	`TRBDDiscountText` VARCHAR(30) NULL,
	`TRBDDiscountTotal` FLOAT NULL,
	`TRBDNetAmount` FLOAT NULL DEFAULT '0',
	`TRBDNAmountInRate` FLOAT NULL DEFAULT '0',
	`TRBDTaxBase` FLOAT NULL DEFAULT '0',
	`TRBDTaxType` SMALLINT NULL DEFAULT '0',
	`TRBDAmountVAT` FLOAT NULL DEFAULT '0',
	`TRBDDescription` VARCHAR(150) NULL,
	`TRBDSourceNo` VARCHAR(30) NULL,
	`TRBDSourceLn` INT NULL DEFAULT '0',
	`TRBDFlag1` SMALLINT NULL DEFAULT '0',
	`TRBDFlag2` SMALLINT NULL DEFAULT '0',
	`TRBDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRBDTREMTAIHNo`, `TRBDTREMLn`, `TRBDLn`),
	KEY `TIoMTUntCode2` (`TRBDTUntCode3`),
	KEY `TJbMSourceNo` (`TRBDSourceNo`),
	KEY `TPOBTPdtCode` (`TRBDTPOSCode`),
	KEY `TPSMUnitFactor` (`TRBDUnitFactor`),
	KEY `TPWBID` (`TRBDLn`),
	KEY `TPWBPdtCode1` (`TRBDPOSCode`),
	KEY `TPWBTUntCode` (`TRBDTUntCode`),
	KEY `TPWBTUntCode1` (`TRBDTUntCode2`),
	KEY `TQuBFactoryCode` (`TRBDFactoryCode`),
	KEY `TTfMID` (`TRBDTREMTAIHNo`),
	KEY `TTfrToTShfCode` (`TRBDType`),
	KEY `VS4TARReceiptMBVS4TARReceiptMBD` (`TRBDTREMTAIHNo`, `TRBDTREMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARShippingMark` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARShippingMark`;

# ---------- CREATE TABLE `VS4TARShippingMark` ----------

CREATE TABLE `VS4TARShippingMark` (
	`TRSMTARNCode` VARCHAR(30) NOT NULL,
	`TRSMLn` INT NOT NULL,
	`TRSMMark` VARCHAR(255) NULL,
	`TRSMFlag1` SMALLINT NULL DEFAULT '0',
	`TRSMFlag2` SMALLINT NULL DEFAULT '0',
	`TRSMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRSMLn`, `TRSMTARNCode`),
	KEY `TBsTCode` (`TRSMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARStatus` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARStatus`;

# ---------- CREATE TABLE `VS4TARStatus` ----------

CREATE TABLE `VS4TARStatus` (
	`TARSAlias` VARCHAR(30) NOT NULL,
	`TARSName` VARCHAR(50) NULL,
	`TARSName2` VARCHAR(50) NULL,
	`TARSCode` VARCHAR(10) NULL,
	`TARSIsProspect` SMALLINT NULL,
	`TARSSort` SMALLINT NULL DEFAULT '0',
	`TARSFlag1` SMALLINT NULL DEFAULT '0',
	`TARSFlag2` SMALLINT NULL DEFAULT '0',
	`TARSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARSAlias`),
	KEY `TARSCode` (`TARSCode`),
	KEY `TBsTCode` (`TARSAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARType`;

# ---------- CREATE TABLE `VS4TARType` ----------

CREATE TABLE `VS4TARType` (
	`TARTCode` VARCHAR(30) NOT NULL,
	`TARTName` VARCHAR(100) NULL,
	`TARTName2` VARCHAR(100) NULL,
	`TARTFlag1` SMALLINT NULL DEFAULT '0',
	`TARTFlag2` SMALLINT NULL DEFAULT '0',
	`TARTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TARTCode`),
	KEY `TBnkCode` (`TARTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARVandReceipt` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARVandReceipt`;

# ---------- CREATE TABLE `VS4TARVandReceipt` ----------

CREATE TABLE `VS4TARVandReceipt` (
	`TRNRTRVHNo` VARCHAR(30) NOT NULL,
	`TRNRTRECNo` VARCHAR(30) NOT NULL,
	`TRNRFlag1` INT NULL DEFAULT '0',
	`TRNRFlag2` INT NULL DEFAULT '0',
	`TRNRFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TRNRTRVHNo`, `TRNRTRECNo`),
	KEY `PVGLTAPVNo` (`TRNRTRECNo`),
	KEY `PVGLTGLTNo` (`TRNRTRVHNo`),
	KEY `VS4TReceiptVS4TRVandReceipt` (`TRNRTRECNo`),
	KEY `VS4TReceiveVoucherVS4TRVandReceipt` (`TRNRTRVHNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARVDocRef` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARVDocRef`;

# ---------- CREATE TABLE `VS4TARVDocRef` ----------

CREATE TABLE `VS4TARVDocRef` (
	`TRDRTRVHNo` VARCHAR(30) NOT NULL,
	`TRDRLn` INT NOT NULL DEFAULT '0',
	`TRDRType` INT NULL DEFAULT '0',
	`TRDRRefBillNo` VARCHAR(30) NULL,
	`TRDRRefDocNo` VARCHAR(30) NULL,
	`TRDRRefDocDate` DATETIME NULL,
	`TRDRRefNo` VARCHAR(30) NULL,
	`TRDRRefNo2` VARCHAR(30) NULL,
	`TRDRRefNo3` VARCHAR(30) NULL,
	`TRDRRefDocAmount` FLOAT NULL DEFAULT '0',
	`TRDRRefDocType` VARCHAR(30) NULL,
	`TRDRRefDueDate` DATETIME NULL,
	`TRDRCurrency` VARCHAR(4) NULL,
	`TRDRCurRate` DOUBLE NULL DEFAULT '0',
	`TRDRCurSubTotal` FLOAT NULL DEFAULT '0',
	`TRDRCurDiscount` FLOAT NULL DEFAULT '0',
	`TRDRCurAmount` FLOAT NULL DEFAULT '0',
	`TRDRAmountRate` FLOAT NULL DEFAULT '0',
	`TRDRTaxBase` FLOAT NULL DEFAULT '0',
	`TRDRVATType` SMALLINT NULL,
	`TRDRVATRate` DOUBLE NULL,
	`TRDRVATTotal` FLOAT NULL,
	`TRDRVATNo` VARCHAR(30) NULL,
	`TRDRTAXNo` VARCHAR(30) NULL,
	`TRDRWTAXRate` DOUBLE NULL DEFAULT '0',
	`TRDRWTAXTotal` FLOAT NULL DEFAULT '0',
	`TRDRWTAXCond` SMALLINT NULL DEFAULT '0',
	`TRDRWTAXDesc` VARCHAR(250) NULL,
	`TRDRCommissionBase` FLOAT NULL DEFAULT '0',
	`TRDRCommissionRate` DOUBLE NULL DEFAULT '0',
	`TRDRCommission` FLOAT NULL DEFAULT '0',
	`TRDRInterestRate` DOUBLE NULL DEFAULT '0',
	`TRDRInterestTotal` FLOAT NULL DEFAULT '0',
	`TRDRTOINCode` VARCHAR(30) NULL,
	`TRDRDOVAT` SMALLINT NULL DEFAULT '0',
	`TRDRNote` VARCHAR(250) NULL,
	`TRDRNote2` VARCHAR(255) NULL,
	`TRDRFlag1` INT NULL DEFAULT '0',
	`TRDRFlag2` INT NULL DEFAULT '0',
	`TRDRFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TRDRTRVHNo`, `TRDRLn`),
	KEY `TCHRRefNo` (`TRDRRefDocAmount`),
	KEY `TCHRTCHSNo` (`TRDRTRVHNo`),
	KEY `TCHRTCHSTGLTNo` (`TRDRLn`),
	KEY `TRDRTOINCode` (`TRDRTOINCode`),
	KEY `VS4TReceiveVoucherVS4TRVDocRef` (`TRDRTRVHNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARVDocRefMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARVDocRefMB`;

# ---------- CREATE TABLE `VS4TARVDocRefMB` ----------

CREATE TABLE `VS4TARVDocRefMB` (
	`TRVMTRDRTRVHNo` VARCHAR(30) NOT NULL,
	`TRVMTRDRLn` INT NOT NULL DEFAULT '0',
	`TRVMLn` INT NOT NULL DEFAULT '0',
	`TRVMDocLn` INT NULL DEFAULT '0',
	`TRVMRefBillNo` VARCHAR(30) NULL,
	`TRVMRefDocNo` VARCHAR(30) NULL,
	`TRVMRefDocDate` DATETIME NULL,
	`TRVMRefNo` VARCHAR(30) NULL,
	`TRVMRefDocAmount` FLOAT NULL DEFAULT '0',
	`TRVMRefDocType` VARCHAR(30) NULL,
	`TRVMRefDueDate` DATETIME NULL,
	`TRVMCurrency` VARCHAR(4) NULL,
	`TRVMCurRate` DOUBLE NULL DEFAULT '0',
	`TRVMCurSubTotal` FLOAT NULL DEFAULT '0',
	`TRVMCurDiscount` FLOAT NULL DEFAULT '0',
	`TRVMCurAmount` FLOAT NULL DEFAULT '0',
	`TRVMAmountRate` FLOAT NULL DEFAULT '0',
	`TRVMType` SMALLINT NULL DEFAULT '0',
	`TRVMTPOSCode` VARCHAR(50) NULL,
	`TRVMCustom1` VARCHAR(30) NULL,
	`TRVMCustom2` VARCHAR(30) NULL,
	`TRVMCustom3` VARCHAR(30) NULL,
	`TRVMCustom4` VARCHAR(30) NULL,
	`TRVMCustom5` VARCHAR(30) NULL,
	`TRVMPOSCode` VARCHAR(50) NULL,
	`TRVMFactoryCode` VARCHAR(50) NULL,
	`TRVMPOSName` VARCHAR(150) NULL,
	`TRVMCost` FLOAT NULL DEFAULT '0',
	`TRVMOldPrice` FLOAT NULL DEFAULT '0',
	`TRVMPrice` FLOAT NULL DEFAULT '0',
	`TRVMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TRVMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TRVMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TRVMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TRVMQuantity` DOUBLE NULL DEFAULT '0',
	`TRVMTUntCode` VARCHAR(50) NULL,
	`TRVMQuantity2` DOUBLE NULL DEFAULT '0',
	`TRVMTUntCode2` VARCHAR(50) NULL,
	`TRVMQuantity3` DOUBLE NULL DEFAULT '0',
	`TRVMTUntCode3` VARCHAR(50) NULL,
	`TRVMCostAmount` DOUBLE NULL DEFAULT '0',
	`TRVMAmount` DOUBLE NULL DEFAULT '0',
	`TRVMDiscountText` VARCHAR(30) NULL,
	`TRVMDiscountTotal` FLOAT NULL,
	`TRVMNetAmount` FLOAT NULL DEFAULT '0',
	`TRVMNAmountInRate` FLOAT NULL DEFAULT '0',
	`TRVMTaxBase` FLOAT NULL DEFAULT '0',
	`TRVMVATType` SMALLINT NULL DEFAULT '0',
	`TRVMVATTotal` FLOAT NULL DEFAULT '0',
	`TRVMVATNo` VARCHAR(30) NULL,
	`TRVMTAXNo` VARCHAR(30) NULL,
	`TRVMWTAXRate` DOUBLE NULL DEFAULT '0',
	`TRVMWTAXTotal` FLOAT NULL DEFAULT '0',
	`TRVMWTAXCond` SMALLINT NULL DEFAULT '0',
	`TRVMWTAXDesc` VARCHAR(250) NULL,
	`TRVMDescription` VARCHAR(150) NULL,
	`TRVMSourceNo` VARCHAR(30) NULL,
	`TRVMSourceLn` INT NULL DEFAULT '0',
	`TRVMCommissionBase` FLOAT NULL DEFAULT '0',
	`TRVMCommissionRate` DOUBLE NULL DEFAULT '0',
	`TRVMCommission` FLOAT NULL DEFAULT '0',
	`TRVMInterestRate` DOUBLE NULL DEFAULT '0',
	`TRVMInterestTotal` FLOAT NULL DEFAULT '0',
	`TRVMNote` VARCHAR(255) NULL,
	`TRVMNote2` VARCHAR(255) NULL,
	`TRVMFlag1` SMALLINT NULL DEFAULT '0',
	`TRVMFlag2` SMALLINT NULL DEFAULT '0',
	`TRVMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRVMTRDRTRVHNo`, `TRVMTRDRLn`, `TRVMLn`),
	KEY `TIoMTUntCode2` (`TRVMTUntCode3`),
	KEY `TJbMSourceNo` (`TRVMSourceNo`),
	KEY `TPOBTPdtCode` (`TRVMTPOSCode`),
	KEY `TPSMUnitFactor` (`TRVMUnitFactor`),
	KEY `TPWBID` (`TRVMLn`),
	KEY `TPWBPdtCode1` (`TRVMPOSCode`),
	KEY `TPWBTUntCode` (`TRVMTUntCode`),
	KEY `TPWBTUntCode1` (`TRVMTUntCode2`),
	KEY `TQuBFactoryCode` (`TRVMFactoryCode`),
	KEY `TREMRefDocAmount` (`TRVMRefDocAmount`),
	KEY `TRFMTRVHNo` (`TRVMTRDRTRVHNo`),
	KEY `TTfMID` (`TRVMTRDRLn`),
	KEY `TTfrToTShfCode` (`TRVMType`),
	KEY `VS4TRVDocRefVS4TRVDocRefMB` (`TRVMTRDRTRVHNo`, `TRVMTRDRLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARVoucher` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARVoucher`;

# ---------- CREATE TABLE `VS4TARVoucher` ----------

CREATE TABLE `VS4TARVoucher` (
	`TRVHNo` VARCHAR(30) NOT NULL,
	`TRVHType` SMALLINT NULL DEFAULT '0',
	`TRVHDetailType` SMALLINT NULL DEFAULT '0',
	`TRVHMode` SMALLINT NULL DEFAULT '0',
	`TRVHBalanceFlag` SMALLINT NULL DEFAULT '0',
	`TRVHBaseArrear` FLOAT NULL DEFAULT '0',
	`TRVHArrear` FLOAT NULL DEFAULT '0',
	`TRVHDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRVHTBraCode` VARCHAR(30) NULL,
	`TRVHPaymentStatus` SMALLINT NULL DEFAULT '0',
	`TRVHRefNo` VARCHAR(30) NULL,
	`TRVHRefDate` DATETIME NULL,
	`TRVHTARNCode` VARCHAR(30) NULL,
	`TRVHPayTo` VARCHAR(200) NULL,
	`TRVHAddress` VARCHAR(255) NULL,
	`TRVHPayTo2` VARCHAR(200) NULL,
	`TRVHAddress2` VARCHAR(255) NULL,
	`TRVHCurDiscount` FLOAT NULL DEFAULT '0',
	`TRVHCurRate` DOUBLE NULL DEFAULT '0',
	`TRVHCurAmount` FLOAT NULL DEFAULT '0',
	`TRVHSubTotal` FLOAT NULL DEFAULT '0',
	`TRVHDiscount` FLOAT NULL DEFAULT '0',
	`TRVHPayLess` FLOAT NULL DEFAULT '0',
	`TRVHAdjustTotal` FLOAT NULL DEFAULT '0',
	`TRVHFee` FLOAT NULL DEFAULT '0',
	`TRVHNetAmount` FLOAT NULL DEFAULT '0',
	`TRVHTaxBase` FLOAT NULL DEFAULT '0',
	`TRVHWTaxTotal` FLOAT NULL DEFAULT '0',
	`TRVHTaxBase2` FLOAT NULL DEFAULT '0',
	`TRVHWTaxTotal2` FLOAT NULL DEFAULT '0',
	`TRVHTotal` FLOAT NULL DEFAULT '0',
	`TRVHNote` VARCHAR(255) NULL,
	`TRVHTGLBCode` VARCHAR(30) NULL,
	`TRVHTPrjCode` VARCHAR(30) NULL,
	`TRVHGLMethod` SMALLINT NULL DEFAULT '0',
	`TRVHTGLTNo` VARCHAR(30) NULL,
	`TRVHTTeTNo` VARCHAR(30) NULL,
	`TRVHVATNo` VARCHAR(30) NULL,
	`TRVHTaxPeriodNo` DATETIME NULL,
	`TRVHTaxPeriodType` SMALLINT NULL,
	`TRVHTaxRefund` SMALLINT NULL,
	`TRVHPayType` SMALLINT NULL DEFAULT '0',
	`TRVHTaxNo` VARCHAR(30) NULL,
	`TRVHWTaxPeriodNo` VARCHAR(10) NULL,
	`TRVHWTaxPeriodType` SMALLINT NULL,
	`TRVHChequePayment` FLOAT NULL DEFAULT '0',
	`TRVHCashPayment` FLOAT NULL DEFAULT '0',
	`TRVHBankPayment` FLOAT NULL DEFAULT '0',
	`TRVHCardPayment` FLOAT NULL DEFAULT '0',
	`TRVHPayCoupon` FLOAT NULL DEFAULT '0',
	`TRVHPayOther` FLOAT NULL DEFAULT '0',
	`TRVHPayMisc` FLOAT NULL DEFAULT '0',
	`TRVHCutDeposit` FLOAT NULL DEFAULT '0',
	`TRVHCommissionBase` FLOAT NULL DEFAULT '0',
	`TRVHCommissionRate` VARCHAR(30) NULL,
	`TRVHCommission` FLOAT NULL DEFAULT '0',
	`TRVHInterestRate` DOUBLE NULL DEFAULT '0',
	`TRVHInterestTotal` FLOAT NULL DEFAULT '0',
	`TRVHCardFlag` SMALLINT NULL DEFAULT '0',
	`TRVHTaxFlag` SMALLINT NULL DEFAULT '0',
	`TRVHCreateCode` VARCHAR(30) NULL,
	`TRVHCreateBy` VARCHAR(140) NULL,
	`TRVHCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRVHEditCode` VARCHAR(30) NULL,
	`TRVHEditBy` VARCHAR(140) NULL,
	`TRVHEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRVHConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TRVHConfirmBy` VARCHAR(140) NULL,
	`TRVHConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRVHApproveStatus` SMALLINT NULL DEFAULT '0',
	`TRVHApproveBy` VARCHAR(140) NULL,
	`TRVHApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRVHApproveNote` VARCHAR(80) NULL,
	`TRVHRevision` SMALLINT NULL DEFAULT '0',
	`TRVHCancelStatus` SMALLINT NULL DEFAULT '0',
	`TRVHCancelNo` VARCHAR(30) NULL,
	`TRVHCancelBy` VARCHAR(140) NULL,
	`TRVHCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRVHCancelNote` VARCHAR(80) NULL,
	`TRVHFlag1` SMALLINT NULL DEFAULT '0',
	`TRVHFlag2` SMALLINT NULL DEFAULT '0',
	`TRVHFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRVHNo`),
	KEY `TAPVNo` (`TRVHNo`),
	KEY `TAPVPaymentStatus` (`TRVHPaymentStatus`),
	KEY `TGLTPrjCode` (`TRVHTPrjCode`),
	KEY `TIvoCusAddress` (`TRVHAddress`),
	KEY `TIvoCusAddress2` (`TRVHAddress2`),
	KEY `TIvoCustomerName2` (`TRVHPayTo2`),
	KEY `TRVHTARNCode` (`TRVHTARNCode`),
	KEY `TRVHTGLBCode` (`TRVHTGLBCode`),
	KEY `VS4TARVS4TReceiveVoucher` (`TRVHTARNCode`),
	KEY `VS4TProjectVS4TARVoucher` (`TRVHTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TARVoucherPay` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TARVoucherPay`;

# ---------- CREATE TABLE `VS4TARVoucherPay` ----------

CREATE TABLE `VS4TARVoucherPay` (
	`TRVRTRVHNo` VARCHAR(30) NOT NULL,
	`TRVRLn` INT NOT NULL DEFAULT '0',
	`TRVRIsChange` SMALLINT NULL DEFAULT '0',
	`TRVRReceiveType` VARCHAR(15) NULL,
	`TRVRCurrency` VARCHAR(4) NULL,
	`TRVRTBnkCode` VARCHAR(10) NULL,
	`TRVRTransferDate` DATETIME NULL,
	`TRVRCashDate` DATETIME NULL,
	`TRVRDocNo` VARCHAR(50) NULL,
	`TRVRBankBranch` VARCHAR(50) NULL,
	`TRVRAccountType` VARCHAR(25) NULL,
	`TRVRAccountName` VARCHAR(160) NULL,
	`TRVRAccountNumber` VARCHAR(30) NULL,
	`TRVRTBCDNo` VARCHAR(10) NULL,
	`TRVRCardCode` VARCHAR(30) NULL,
	`TRVRCardType` VARCHAR(50) NULL,
	`TRVRCardName` VARCHAR(50) NULL,
	`TRVRCardNo` VARCHAR(20) NULL,
	`TRVRBackCardNo` VARCHAR(8) NULL,
	`TRVRCardExpire` VARCHAR(7) NULL,
	`TRVRExchangeRate` DOUBLE NULL DEFAULT '0',
	`TRVRAmount` FLOAT NULL DEFAULT '0',
	`TRVRAmountInRate` FLOAT NULL DEFAULT '0',
	`TRVRAdjustTotal` FLOAT NULL DEFAULT '0',
	`TRVRDiscount` FLOAT NULL DEFAULT '0',
	`TRVRFee` FLOAT NULL DEFAULT '0',
	`TRVRFeeProvide` SMALLINT NULL DEFAULT '0',
	`TRVRNetAmount` FLOAT NULL DEFAULT '0',
	`TRVRTCBBNo` VARCHAR(30) NULL,
	`TRVRNote` VARCHAR(250) NULL,
	`TRVRFlag1` SMALLINT NULL DEFAULT '0',
	`TRVRFlag2` SMALLINT NULL DEFAULT '0',
	`TRVRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRVRTRVHNo`, `TRVRLn`),
	KEY `TPPyTPTAID` (`TRVRTRVHNo`),
	KEY `TRDRTCBBNo` (`TRVRTCBBNo`),
	KEY `VS4TCompanyBankVS4TRVReceive` (`TRVRTCBBNo`),
	KEY `VS4TPaymentTypeVS4TARVoucherPay` (`TRVRReceiveType`),
	KEY `VS4TPaymentTypeVS4TRVReceive` (`TRVRReceiveType`),
	KEY `VS4TReceiveVoucherVS4TRVReceive` (`TRVRTRVHNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAsset` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAsset`;

# ---------- CREATE TABLE `VS4TAsset` ----------

CREATE TABLE `VS4TAsset` (
	`TAssCode` VARCHAR(30) NOT NULL,
	`TAssNo` VARCHAR(30) NULL,
	`TAssAlias` VARCHAR(30) NULL,
	`TAssName` VARCHAR(100) NULL,
	`TAssName2` VARCHAR(100) NULL,
	`TAssTAPNCode` VARCHAR(30) NULL,
	`TAssDebitCode` VARCHAR(30) NULL,
	`TAssCreditCode` VARCHAR(30) NULL,
	`TAssTACCCode` VARCHAR(30) NULL,
	`TAssTAsTCode` VARCHAR(30) NULL,
	`TAssTAseCode` VARCHAR(30) NULL,
	`TAssMethod` SMALLINT NULL DEFAULT '0',
	`TAssTCstAlias` VARCHAR(1) NULL,
	`TAssQuantity` DOUBLE NULL DEFAULT '0',
	`TAssTUntCode` VARCHAR(30) NULL,
	`TAssNote` VARCHAR(255) NULL,
	`TAssNote2` VARCHAR(255) NULL,
	`TAssCustom1` VARCHAR(30) NULL,
	`TAssCustom2` VARCHAR(30) NULL,
	`TAssCustom3` VARCHAR(30) NULL,
	`TAssCustom4` VARCHAR(30) NULL,
	`TAsscustom5` VARCHAR(30) NULL,
	`TAssUnitType` SMALLINT NULL DEFAULT '0',
	`TAssTPrjCode` VARCHAR(30) NULL,
	`TAssTSecCode` VARCHAR(30) NULL,
	`TAssTDepCode` VARCHAR(30) NULL,
	`TAssTDivCode` VARCHAR(30) NULL,
	`TAssTBraCode` VARCHAR(30) NULL,
	`TAssLocation` VARCHAR(30) NULL,
	`TAssIcon1` VARCHAR(50) NULL,
	`TAssImage1` VARCHAR(100) NULL,
	`TAssImage2` VARCHAR(100) NULL,
	`TAssStandardCost` FLOAT NULL,
	`TAssTotalCost` FLOAT NULL,
	`TAssRefNo` VARCHAR(30) NULL,
	`TAssRefDate` DATETIME NULL,
	`TAssRefNoCost` VARCHAR(50) NULL,
	`TAssReceiveNo` VARCHAR(30) NULL,
	`TAssReceiveDate` DATETIME NULL,
	`TAssReceiveBy` VARCHAR(50) NULL,
	`TAssDateCalcStart` DATETIME NULL,
	`TAssMainTAssCode` VARCHAR(30) NULL,
	`TAssManuFacture` VARCHAR(200) NULL,
	`TAssBrandName` VARCHAR(80) NULL,
	`TAssModel` VARCHAR(30) NULL,
	`TAssSerialNo` VARCHAR(30) NULL,
	`TAssRFID` VARCHAR(255) NULL,
	`TAssMAP` VARCHAR(100) NULL,
	`TAsssPolicy` VARCHAR(30) NULL,
	`TAssCompInsurance` VARCHAR(80) NULL,
	`TAssInsuranceNo` VARCHAR(30) NULL,
	`TAssAgeInsurance` DOUBLE NULL DEFAULT '0',
	`TAssAgeInsUnit` VARCHAR(50) NULL,
	`TAssInsuranceSDate` DATETIME NULL,
	`TAssInsuranceEDate` DATETIME NULL,
	`TAssInsurPremium` DOUBLE NULL DEFAULT '0',
	`TAssAmount` DOUBLE NULL,
	`TAssBeforPeriodY` SMALLINT NULL DEFAULT '0',
	`TAssBeforPeriodM` SMALLINT NULL DEFAULT '0',
	`TAssBeforInAmass` FLOAT NULL DEFAULT '0',
	`TAssBeforInNet` FLOAT NULL DEFAULT '0',
	`TAssBeforOutAmass` FLOAT NULL DEFAULT '0',
	`TAssBeforOutNet` FLOAT NULL DEFAULT '0',
	`TAssBeforAdjust` FLOAT NULL DEFAULT '0',
	`TAssBeforInAmount` FLOAT NULL DEFAULT '0',
	`TAssBeforOutAmount` FLOAT NULL DEFAULT '0',
	`TAssTACTAlias` VARCHAR(30) NULL,
	`TAssRate` DOUBLE NULL,
	`TAssAge` SMALLINT NULL,
	`TAssAgeUnit` SMALLINT NULL DEFAULT '0',
	`TAssAgeUse` INT NULL DEFAULT '0',
	`TAssAgeUseUnit` VARCHAR(50) NULL,
	`TAssDateCalcEnd` DATETIME NULL,
	`TAssBalance` DOUBLE NULL,
	`TAssSaleDate` DATETIME NULL,
	`TAssSalePrice` DOUBLE NULL,
	`TAssSaleRefNo` VARCHAR(20) NULL,
	`TAssSaleRefDate` DATETIME NULL,
	`TAssSalvageCost` FLOAT NULL,
	`TAssTotalPeriod` SMALLINT NULL DEFAULT '0',
	`TAssPeriodUnit` VARCHAR(30) NULL,
	`TAssCheckStatus` SMALLINT NULL DEFAULT '0',
	`TAssCostStatus` SMALLINT NULL DEFAULT '0',
	`TAssStatus` SMALLINT NULL DEFAULT '0',
	`TAssStatusAsset` SMALLINT NULL DEFAULT '0',
	`TAssStatusAmount` SMALLINT NULL DEFAULT '0',
	`TAssOwnerCode` VARCHAR(30) NULL,
	`TAssOwnerName` VARCHAR(160) NULL,
	`TAssOwnerDate` DATETIME NULL,
	`TAssDayAmount` DOUBLE NULL DEFAULT '0',
	`TAssPurPrice` FLOAT NULL DEFAULT '0',
	`TAssPurDate` DATETIME NULL,
	`TAssSaleCode` VARCHAR(30) NULL,
	`TAssCost` FLOAT NULL DEFAULT '0',
	`TAssPeriodYear` SMALLINT NULL DEFAULT '0',
	`TAssPeriodMonth` SMALLINT NULL DEFAULT '0',
	`TAssPeriodAmount` FLOAT NULL DEFAULT '0',
	`TAssStatusGL` SMALLINT NULL DEFAULT '0',
	`TAssSaleAmass` FLOAT NULL DEFAULT '0',
	`TAssSaleAmount` FLOAT NULL DEFAULT '0',
	`TAssAmass` FLOAT NULL DEFAULT '0',
	`TAssAmountNet` FLOAT NULL DEFAULT '0',
	`TAssTextSort` VARCHAR(30) NULL,
	`TAssAjustYear` SMALLINT NULL DEFAULT '0',
	`TAssAjustMonth` SMALLINT NULL DEFAULT '0',
	`TAssAjustAmount` DOUBLE NULL DEFAULT '0',
	`TAssAjustDayAmount` DOUBLE NULL DEFAULT '0',
	`TAssAjustAmass` DOUBLE NULL DEFAULT '0',
	`TAssSaleMark` VARCHAR(100) NULL,
	`TAssWatt` DOUBLE NULL DEFAULT '0',
	`TAssShape` SMALLINT NULL DEFAULT '0',
	`TAssWidth` DOUBLE NULL DEFAULT '0',
	`TAssLength` DOUBLE NULL DEFAULT '0',
	`TAssHeight` DOUBLE NULL DEFAULT '0',
	`TAssWeight` DOUBLE NULL DEFAULT '0',
	`TAssCapacity` DOUBLE NULL DEFAULT '0',
	`TAssDescription` VARCHAR(255) NULL,
	`TAssCreateCode` VARCHAR(30) NULL,
	`TAssCreateBy` VARCHAR(160) NULL,
	`TAssCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAssEditCode` VARCHAR(30) NULL,
	`TAssEditBy` VARCHAR(140) NULL,
	`TAssEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TAssFlag1` SMALLINT NULL DEFAULT '0',
	`TAssFlag2` SMALLINT NULL DEFAULT '0',
	`TAssFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAssCode`),
	KEY `TInvTBraCode` (`TAssTBraCode`),
	KEY `TInvTDepCode` (`TAssTDepCode`),
	KEY `TInvTDivCode` (`TAssTDivCode`),
	KEY `TInvTPrjCode` (`TAssTPrjCode`),
	KEY `VS4TAssetSectionVS4TAsset` (`TAssTAseCode`),
	KEY `VS4TAssetTypeVS4TAsset` (`TAssTAsTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetAllocate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetAllocate`;

# ---------- CREATE TABLE `VS4TAssetAllocate` ----------

CREATE TABLE `VS4TAssetAllocate` (
	`TAsATAssCode` VARCHAR(30) NOT NULL,
	`TAsALn` INT NOT NULL DEFAULT '0',
	`TAsATBraCode` VARCHAR(30) NULL,
	`TAsATDivCode` VARCHAR(30) NULL,
	`TAsATDepCode` VARCHAR(30) NULL,
	`TAsATSecCode` VARCHAR(30) NULL,
	`TAsAPC` FLOAT NULL DEFAULT '0',
	`TAsADescription` VARCHAR(50) NULL,
	`TAsADescription2` VARCHAR(50) NULL,
	`TAsAFlag1` SMALLINT NULL DEFAULT '0',
	`TAsAFlag2` SMALLINT NULL DEFAULT '0',
	`TAsAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAsATAssCode`, `TAsALn`),
	KEY `TTfmtPdtCode` (`TAsATAssCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetBuiltReq` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetBuiltReq`;

# ---------- CREATE TABLE `VS4TAssetBuiltReq` ----------

CREATE TABLE `VS4TAssetBuiltReq` (
	`TBRqNo` VARCHAR(30) NOT NULL,
	`TBRqDate` DATETIME NULL,
	`TBRqRefNo` VARCHAR(30) NULL,
	`TBRqRefDate` DATETIME NULL,
	`TBRqTAssCode` VARCHAR(30) NULL,
	`TBRqAssetName` VARCHAR(100) NULL,
	`TBRqTPrjCode` VARCHAR(30) NULL,
	`TBRqTBraCode` VARCHAR(30) NULL,
	`TBRqTDivCode` VARCHAR(30) NULL,
	`TBRqTDepCode` VARCHAR(30) NULL,
	`TBRqTSecCode` VARCHAR(30) NULL,
	`TBRqTEmpCode` VARCHAR(50) NULL,
	`TBRqEmpName` VARCHAR(160) NULL,
	`TBRqRequestDate` DATETIME NULL,
	`TBRqCustom1` VARCHAR(50) NULL,
	`TBRqCustom2` VARCHAR(50) NULL,
	`TBRqCustom3` VARCHAR(50) NULL,
	`TBRqCustom4` VARCHAR(50) NULL,
	`TBRqCustom5` VARCHAR(50) NULL,
	`TBRqObjective` VARCHAR(255) NULL,
	`TBRqDetail` VARCHAR(255) NULL,
	`TBRqStatus` SMALLINT NULL DEFAULT '0',
	`TBRqGLStatus` SMALLINT NULL DEFAULT '0',
	`TBRqDescription` VARCHAR(255) NULL,
	`TBRqCreateCode` VARCHAR(30) NULL,
	`TBRqCreateBy` VARCHAR(140) NULL,
	`TBRqCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBRqEditCode` VARCHAR(30) NULL,
	`TBRqEditBy` VARCHAR(140) NULL,
	`TBRqEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBRqConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TBRqConfirmBy` VARCHAR(140) NULL,
	`TBRqConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBRqApproveStatus` SMALLINT NULL DEFAULT '0',
	`TBRqApproveBy` VARCHAR(140) NULL,
	`TBRqApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBRqApproveNote` VARCHAR(80) NULL,
	`TBRqRevision` SMALLINT NULL DEFAULT '0',
	`TBRqCancelStatus` SMALLINT NULL DEFAULT '0',
	`TBRqCancelNo` VARCHAR(30) NULL,
	`TBRqCancelBy` VARCHAR(140) NULL,
	`TBRqCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBRqCancelNote` VARCHAR(80) NULL,
	`TBRqTextSort` VARCHAR(30) NULL,
	`TBRqFlag1` SMALLINT NULL DEFAULT '0',
	`TBRqFlag2` SMALLINT NULL DEFAULT '0',
	`TBRqFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBRqNo`),
	KEY `TFRqTDepCode` (`TBRqTBraCode`),
	KEY `TFRqTDivCode` (`TBRqTPrjCode`),
	KEY `TFstCode` (`TBRqNo`),
	KEY `TFstRefTDepCode` (`TBRqTSecCode`),
	KEY `TFstRefTDepCode1` (`TBRqTDivCode`),
	KEY `TFstRefTDepCode2` (`TBRqTDepCode`),
	KEY `TFstTAssCode` (`TBRqTAssCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetCalcType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetCalcType`;

# ---------- CREATE TABLE `VS4TAssetCalcType` ----------

CREATE TABLE `VS4TAssetCalcType` (
	`TACTAlias` VARCHAR(30) NOT NULL,
	`TACTName` VARCHAR(100) NULL,
	`TACTName2` VARCHAR(100) NULL,
	`TACTSORT` SMALLINT NULL DEFAULT '0',
	`TACTFlag1` SMALLINT NULL DEFAULT '0',
	`TACTFlag2` SMALLINT NULL DEFAULT '0',
	`TACTFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TACTAlias`),
	KEY `TACTCode` (`TACTAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFix` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFix`;

# ---------- CREATE TABLE `VS4TAssetFix` ----------

CREATE TABLE `VS4TAssetFix` (
	`TFstNo` VARCHAR(30) NOT NULL,
	`TFstTFRqNo` VARCHAR(50) NULL,
	`TFstName` VARCHAR(100) NULL,
	`TFstType` SMALLINT NULL DEFAULT '0',
	`TFstDate` DATETIME NULL,
	`TFstRefNo` VARCHAR(30) NULL,
	`TFstRefDate` DATETIME NULL,
	`TFstTPrjCode` VARCHAR(30) NULL,
	`TFstTBraCode` VARCHAR(30) NULL,
	`TFstReqRefNo` VARCHAR(30) NULL,
	`TFstReqRefDate` DATETIME NULL,
	`TFstTReqTDivCode` VARCHAR(30) NULL,
	`TFstTReqTDepCode` VARCHAR(30) NULL,
	`TFstTReqTSecCode` VARCHAR(30) NULL,
	`TFstReqTEmpCode` VARCHAR(30) NULL,
	`TFstReqBy` VARCHAR(100) NULL,
	`TFstReqDate` DATETIME NULL,
	`TFstTRecTDivCode` VARCHAR(30) NULL,
	`TFstTRecTDepCode` VARCHAR(30) NULL,
	`TFstTRecTSecCode` VARCHAR(30) NULL,
	`TFstRecTEmpCode` VARCHAR(30) NULL,
	`TFstDetail` VARCHAR(100) NULL,
	`TFstRecBy` VARCHAR(100) NULL,
	`TFstRecDate` DATETIME NULL,
	`TFstRecTime` VARCHAR(10) NULL,
	`TFstRecHour` SMALLINT NULL DEFAULT '0',
	`TFstCustom1` VARCHAR(50) NULL,
	`TFstCustom2` VARCHAR(50) NULL,
	`TFstCustom3` VARCHAR(50) NULL,
	`TFstRecMark` VARCHAR(255) NULL,
	`TFstStopEngine` SMALLINT NULL DEFAULT '0',
	`TFstStopPlant` SMALLINT NULL DEFAULT '0',
	`TFstFixTEmpCode` VARCHAR(30) NULL,
	`TFstFixBy` VARCHAR(100) NULL,
	`TFstFixDate` DATETIME NULL,
	`TFstFinishDate` DATETIME NULL,
	`TFstFixMark` VARCHAR(255) NULL,
	`TFstFixDay` SMALLINT NULL DEFAULT '0',
	`TFstFixTime` VARCHAR(10) NULL,
	`TFstTotalAsset` INT NULL DEFAULT '0',
	`TFstTotalQty` INT NULL DEFAULT '0',
	`TFstTotalPrice` FLOAT NULL DEFAULT '0',
	`TFstPRStatus` SMALLINT NULL DEFAULT '0',
	`TFstPRCheck` SMALLINT NULL DEFAULT '0',
	`TFstTPRBCode` VARCHAR(30) NULL,
	`TFstPRBookName` VARCHAR(100) NULL,
	`TFstPRNo` VARCHAR(30) NULL,
	`TFstPRMark` VARCHAR(255) NULL,
	`TFstFixStatus` SMALLINT NULL DEFAULT '0',
	`TFstDescription` VARCHAR(255) NULL,
	`TFstStatus` SMALLINT NULL DEFAULT '0',
	`TFstStatusFix` SMALLINT NULL DEFAULT '0',
	`TFstIndex` VARCHAR(50) NULL,
	`TFstCreateCode` VARCHAR(30) NULL,
	`TFstCreateBy` VARCHAR(140) NULL,
	`TFstCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFstEditCode` VARCHAR(30) NULL,
	`TFstEditBy` VARCHAR(140) NULL,
	`TFstEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFstConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TFstConfirmBy` VARCHAR(140) NULL,
	`TFstConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFstApproveStatus` SMALLINT NULL DEFAULT '0',
	`TFstApproveBy` VARCHAR(140) NULL,
	`TFstApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFstApproveNote` VARCHAR(80) NULL,
	`TFstRevision` SMALLINT NULL DEFAULT '0',
	`TFstCancelStatus` SMALLINT NULL DEFAULT '0',
	`TFstCancelNo` VARCHAR(30) NULL,
	`TFstCancelBy` VARCHAR(140) NULL,
	`TFstCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFstCancelNote` VARCHAR(80) NULL,
	`TFstFlag1` SMALLINT NULL DEFAULT '0',
	`TFstFlag2` SMALLINT NULL DEFAULT '0',
	`TFstFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFstNo`),
	KEY `TFstCode` (`TFstNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFixCCL` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFixCCL`;

# ---------- CREATE TABLE `VS4TAssetFixCCL` ----------

CREATE TABLE `VS4TAssetFixCCL` (
	`TCCLTFITCode` VARCHAR(30) NOT NULL,
	`TCCLLn` INT NOT NULL DEFAULT '0',
	`TCCLName` VARCHAR(100) NULL,
	`TCCLMethod` VARCHAR(100) NULL,
	`TCCLStandard` VARCHAR(100) NULL,
	`TCCLEquipment` VARCHAR(100) NULL,
	`TCCLMethodNote` VARCHAR(255) NULL,
	`TCCLStopEngine` SMALLINT NULL,
	`TCCLStopPlant` SMALLINT NULL DEFAULT '0',
	`TCCLTime` SMALLINT NULL DEFAULT '0',
	`TCCLMan` SMALLINT NULL DEFAULT '0',
	`TCCLFrequency` SMALLINT NULL,
	`TCCLUnitStatus` SMALLINT NULL,
	`TCCLFlag1` SMALLINT NULL DEFAULT '0',
	`TCCLFlag2` SMALLINT NULL DEFAULT '0',
	`TCCLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCCLTFITCode`, `TCCLLn`),
	KEY `TAFBTASSCode` (`TCCLTFITCode`),
	KEY `TAFBTASSCode1` (`TCCLLn`),
	KEY `VS4TAssetFixTypeVS4TAssetFixCCL` (`TCCLTFITCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFixMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFixMB`;

# ---------- CREATE TABLE `VS4TAssetFixMB` ----------

CREATE TABLE `VS4TAssetFixMB` (
	`TFSbTFstNo` VARCHAR(30) NOT NULL,
	`TFSbLn` INT NOT NULL DEFAULT '0',
	`TFSbTAssCode` VARCHAR(30) NULL,
	`TFSbTAssName` VARCHAR(100) NULL,
	`TFSbTFITCode` VARCHAR(30) NULL,
	`TFSbFitName` VARCHAR(100) NULL,
	`TFSbAccesories` VARCHAR(100) NULL,
	`TFSbStandard` VARCHAR(50) NULL,
	`TFSbSymptom` VARCHAR(255) NULL,
	`TFSbCause` VARCHAR(255) NULL,
	`TFSbEdit` VARCHAR(255) NULL,
	`TFSbMethod` VARCHAR(255) NULL,
	`TFSbMaintain` VARCHAR(255) NULL,
	`TFSbDescription` VARCHAR(255) NULL,
	`TFSbCustom1` VARCHAR(50) NULL,
	`TFSbCustom2` VARCHAR(50) NULL,
	`TFSbCustom3` VARCHAR(50) NULL,
	`TFSbStatus` SMALLINT NULL DEFAULT '0',
	`TFSbStatusCheck` SMALLINT NULL DEFAULT '0',
	`TFSbSourceNo` VARCHAR(30) NULL,
	`TFSbSourceDate` DATETIME NULL,
	`TFSbFinishDate` DATETIME NULL,
	`TFSbCost` FLOAT NULL DEFAULT '0',
	`TFSbFlag1` SMALLINT NULL DEFAULT '0',
	`TFSbFlag2` SMALLINT NULL DEFAULT '0',
	`TFSbFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFSbTFstNo`, `TFSbLn`),
	KEY `TFSbTAssCode` (`TFSbTAssCode`),
	KEY `TFSbTAssCode1` (`TFSbTAssName`),
	KEY `TFssCode` (`TFSbTFITCode`),
	KEY `TFssTFstCode` (`TFSbTFstNo`),
	KEY `VS4TAssetFixVS4TAssetFixMB` (`TFSbTFstNo`),
	KEY `VS4TAssetVS4TAssetFixMB` (`TFSbTAssCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFixMethod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFixMethod`;

# ---------- CREATE TABLE `VS4TAssetFixMethod` ----------

CREATE TABLE `VS4TAssetFixMethod` (
	`TCCMCode` VARCHAR(1) NOT NULL,
	`TCCMName` VARCHAR(255) NULL,
	`TCCMName2` VARCHAR(255) NULL,
	`TCCMIcon1` VARCHAR(50) NULL,
	`TCCMFlag1` SMALLINT NULL DEFAULT '0',
	`TCCMFlag2` SMALLINT NULL DEFAULT '0',
	`TCCMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCCMCode`),
	KEY `TPdMTPdtID` (`TCCMCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFixReq` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFixReq`;

# ---------- CREATE TABLE `VS4TAssetFixReq` ----------

CREATE TABLE `VS4TAssetFixReq` (
	`TFRqNo` VARCHAR(30) NOT NULL,
	`TFRqDate` DATETIME NULL,
	`TFRqRefNo` VARCHAR(30) NULL,
	`TFRqRefDate` DATETIME NULL,
	`TFRqTAssCode` VARCHAR(30) NULL,
	`TFRqAssetName` VARCHAR(100) NULL,
	`TFRqTPrjCode` VARCHAR(30) NULL,
	`TFRqTBraCode` VARCHAR(30) NULL,
	`TFRqTDivCode` VARCHAR(30) NULL,
	`TFRqTDepCode` VARCHAR(30) NULL,
	`TFRqTSecCode` VARCHAR(30) NULL,
	`TFRqTEmpCode` VARCHAR(50) NULL,
	`TFRqEmpName` VARCHAR(160) NULL,
	`TFRqFixDate` DATETIME NULL,
	`TFRqTime` VARCHAR(10) NULL,
	`TFRqCustom1` VARCHAR(50) NULL,
	`TFRqCustom2` VARCHAR(50) NULL,
	`TFRqCustom3` VARCHAR(50) NULL,
	`TFRqCustom4` VARCHAR(50) NULL,
	`TFRqCustom5` VARCHAR(50) NULL,
	`TFRqSymptom` VARCHAR(255) NULL,
	`TFRqCause` VARCHAR(255) NULL,
	`TFRqStatus` SMALLINT NULL DEFAULT '0',
	`TFRqGLStatus` SMALLINT NULL DEFAULT '0',
	`TFRqDescription` VARCHAR(255) NULL,
	`TFRqCreateCode` VARCHAR(30) NULL,
	`TFRqCreateBy` VARCHAR(140) NULL,
	`TFRqCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFRqEditCode` VARCHAR(30) NULL,
	`TFRqEditBy` VARCHAR(140) NULL,
	`TFRqEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFRqConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TFRqConfirmBy` VARCHAR(140) NULL,
	`TFRqConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFRqApproveStatus` SMALLINT NULL DEFAULT '0',
	`TFRqApproveBy` VARCHAR(140) NULL,
	`TFRqApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFRqApproveNote` VARCHAR(80) NULL,
	`TFRqRevision` SMALLINT NULL DEFAULT '0',
	`TFRqCancelStatus` SMALLINT NULL DEFAULT '0',
	`TFRqCancelNo` VARCHAR(30) NULL,
	`TFRqCancelBy` VARCHAR(140) NULL,
	`TFRqCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFRqCancelNote` VARCHAR(80) NULL,
	`TFRqTextSort` VARCHAR(30) NULL,
	`TFRqFlag1` SMALLINT NULL DEFAULT '0',
	`TFRqFlag2` SMALLINT NULL DEFAULT '0',
	`TFRqFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFRqNo`),
	KEY `TFRqTDepCode` (`TFRqTBraCode`),
	KEY `TFRqTDivCode` (`TFRqTPrjCode`),
	KEY `TFstCode` (`TFRqNo`),
	KEY `TFstRefTDepCode` (`TFRqTSecCode`),
	KEY `TFstRefTDepCode1` (`TFRqTDivCode`),
	KEY `TFstRefTDepCode2` (`TFRqTDepCode`),
	KEY `TFstTAssCode` (`TFRqTAssCode`),
	KEY `VS4TAssetVS4TAssetFixReq` (`TFRqTAssCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFixSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFixSub`;

# ---------- CREATE TABLE `VS4TAssetFixSub` ----------

CREATE TABLE `VS4TAssetFixSub` (
	`TFssTFstNo` VARCHAR(30) NOT NULL,
	`TFssLn` INT NOT NULL DEFAULT '0',
	`TFssCode` VARCHAR(30) NULL,
	`TFssName` VARCHAR(100) NULL,
	`TFssBrand` VARCHAR(50) NULL,
	`TFssModel` VARCHAR(50) NULL,
	`TFssRefNo` VARCHAR(30) NULL,
	`TFssTUntCode` VARCHAR(15) NULL,
	`TFssQuantity` INT NULL DEFAULT '0',
	`TFssPrice` FLOAT NULL DEFAULT '0',
	`TFssAmount` FLOAT NULL DEFAULT '0',
	`TFssDescription` VARCHAR(100) NULL,
	`TFssPRStatus` SMALLINT NULL DEFAULT '0',
	`TFssFlag1` SMALLINT NULL DEFAULT '0',
	`TFssFlag2` SMALLINT NULL DEFAULT '0',
	`TFssFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFssTFstNo`, `TFssLn`),
	KEY `TFssCode` (`TFssCode`),
	KEY `TFssTFstCode` (`TFssTFstNo`),
	KEY `VS4TAssetFixVS4TAssetFixSub` (`TFssTFstNo`),
	KEY `VS4TUnitVS4TAssetFixSub` (`TFssTUntCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFixTool` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFixTool`;

# ---------- CREATE TABLE `VS4TAssetFixTool` ----------

CREATE TABLE `VS4TAssetFixTool` (
	`TCCTCode` VARCHAR(2) NOT NULL,
	`TCCTName` VARCHAR(255) NULL,
	`TCCTName2` VARCHAR(255) NULL,
	`TCCTIcon1` VARCHAR(50) NULL,
	`TCCTFlag1` SMALLINT NULL DEFAULT '0',
	`TCCTFlag2` SMALLINT NULL DEFAULT '0',
	`TCCTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCCTCode`),
	KEY `TPdMTPdtID` (`TCCTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFixType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFixType`;

# ---------- CREATE TABLE `VS4TAssetFixType` ----------

CREATE TABLE `VS4TAssetFixType` (
	`TFITCode` VARCHAR(30) NOT NULL,
	`TFITName` VARCHAR(100) NULL,
	`TFITName2` VARCHAR(100) NULL,
	`TFITFlag1` SMALLINT NULL DEFAULT '0',
	`TFITFlag2` SMALLINT NULL DEFAULT '0',
	`TFITFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFITCode`),
	KEY `TFITCode` (`TFITCode`),
	KEY `TFITCode1` (`TFITName`),
	KEY `TFITCode3` (`TFITFlag1`),
	KEY `TFITFlag1` (`TFITFlag2`),
	KEY `TFITFlag11` (`TFITFlag3`),
	KEY `TFITName` (`TFITName2`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFund` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFund`;

# ---------- CREATE TABLE `VS4TAssetFund` ----------

CREATE TABLE `VS4TAssetFund` (
	`TAFdTAssCode` VARCHAR(50) NOT NULL,
	`TAFdLn` INT NOT NULL DEFAULT '0',
	`TAFdTAFtCode` VARCHAR(30) NULL,
	`TAFdCode` VARCHAR(30) NULL,
	`TAFdDate` DATETIME NULL,
	`TAFdRefNo` VARCHAR(50) NULL,
	`TAFdRefNo2` VARCHAR(50) NULL,
	`TAFdRefNo3` VARCHAR(50) NULL,
	`TAFdQuantity` DOUBLE NULL DEFAULT '0',
	`TAFdTUntCode` VARCHAR(50) NULL,
	`TAFdQuantity2` DOUBLE NULL DEFAULT '0',
	`TAFdTUntCode2` VARCHAR(50) NULL,
	`TAFdQuantity3` DOUBLE NULL DEFAULT '0',
	`TAFdTUntCode3` VARCHAR(50) NULL,
	`TAFdCost` FLOAT NULL DEFAULT '0',
	`TAFdAmount` FLOAT NULL DEFAULT '0',
	`TAFdTCurCode` VARCHAR(30) NULL,
	`TAFdExchangeRate` FLOAT NULL DEFAULT '0',
	`TAFdAmountInRate` FLOAT NULL DEFAULT '0',
	`TAFdStatus` INT NULL DEFAULT '0',
	`TAFdDescription` VARCHAR(150) NULL,
	`TAFdFlag1` INT NULL DEFAULT '0',
	`TAFdFlag2` INT NULL DEFAULT '0',
	`TAFdFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TAFdTAssCode`, `TAFdLn`),
	KEY `TAFdTAFtCode` (`TAFdTAFtCode`),
	KEY `TAFdTCurCode` (`TAFdTCurCode`),
	KEY `VS4TAssetFundTypeVS4TAssetFund` (`TAFdTAFtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetFundType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetFundType`;

# ---------- CREATE TABLE `VS4TAssetFundType` ----------

CREATE TABLE `VS4TAssetFundType` (
	`TAFtCode` VARCHAR(30) NOT NULL,
	`TAFtName` VARCHAR(50) NULL,
	`TAFtName2` VARCHAR(50) NULL,
	`TAFtFlag1` SMALLINT NULL DEFAULT '0',
	`TAFtFlag2` SMALLINT NULL DEFAULT '0',
	`TAFtFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAFtCode`),
	KEY `TAFtCode` (`TAFtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetImage` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetImage`;

# ---------- CREATE TABLE `VS4TAssetImage` ----------

CREATE TABLE `VS4TAssetImage` (
	`TAsITAssCode` VARCHAR(30) NOT NULL,
	`TAsICode` INT NOT NULL DEFAULT '0',
	`TAsITImageName` VARCHAR(100) NULL,
	`TAsITImageFile` VARCHAR(255) NULL,
	`TAsIFlag1` SMALLINT NULL DEFAULT '0',
	`TAsIFlag2` SMALLINT NULL DEFAULT '0',
	`TAsIFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAsITAssCode`, `TAsICode`),
	KEY `TAsITAssCode` (`TAsITAssCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetMB`;

# ---------- CREATE TABLE `VS4TAssetMB` ----------

CREATE TABLE `VS4TAssetMB` (
	`TAsbTAssCode` VARCHAR(30) NOT NULL,
	`TAsbTAssCode2` VARCHAR(30) NOT NULL,
	`TAsbName` VARCHAR(100) NULL,
	`TAsbQuantity` DOUBLE NULL DEFAULT '1',
	`TAsbTUntCode` VARCHAR(15) NULL,
	`TAsbQuantity2` DOUBLE NULL DEFAULT '1',
	`TAsbTUntCode2` VARCHAR(15) NULL,
	`TAsbQuantity3` DOUBLE NULL DEFAULT '1',
	`TAsbTUntCode3` VARCHAR(15) NULL,
	`TAsbCanDepack` SMALLINT NULL DEFAULT '0',
	`TAsbFlag1` SMALLINT NULL DEFAULT '0',
	`TAsbFlag2` SMALLINT NULL DEFAULT '0',
	`TAsbFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAsbTAssCode`, `TAsbTAssCode2`),
	KEY `TAsbTUntCode` (`TAsbTUntCode`),
	KEY `TAsbTUntCode1` (`TAsbTUntCode2`),
	KEY `TAsbTUntCode2` (`TAsbTUntCode3`),
	KEY `VS4TAssetVS4TAssetMB` (`TAsbTAssCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetPeriod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetPeriod`;

# ---------- CREATE TABLE `VS4TAssetPeriod` ----------

CREATE TABLE `VS4TAssetPeriod` (
	`TAPeTAssCode` VARCHAR(30) NOT NULL,
	`TAPePeriodNo` INT NOT NULL DEFAULT '0',
	`TAPeYear` INT NULL DEFAULT '0',
	`TAPePeriodUnit` VARCHAR(30) NULL,
	`TAPeCalcDate` DATETIME NULL,
	`TAPeBeginBalance` FLOAT NULL DEFAULT '0',
	`TAPeAmount` FLOAT NULL DEFAULT '0',
	`TAPeAmass` FLOAT NULL DEFAULT '0',
	`TAPeEndBalance` FLOAT NULL DEFAULT '0',
	`TAPeAmountCalc` DOUBLE NULL DEFAULT '0',
	`TAPeRate` VARCHAR(10) NULL,
	`TAPeDayAmount` DOUBLE NULL DEFAULT '0',
	`TAPeDayQty` INT NULL DEFAULT '0',
	`TAPeDescription` VARCHAR(100) NULL,
	`TAPeTGLTNo` VARCHAR(30) NULL,
	`TAPeGLDate` DATETIME NULL,
	`TAPeAmountArrear` DOUBLE NULL DEFAULT '0',
	`TAPeAmassArrear` DOUBLE NULL DEFAULT '0',
	`TAPeBalanceArrear` DOUBLE NULL DEFAULT '0',
	`TAPeAmountNet` DOUBLE NULL DEFAULT '0',
	`TAPeCountM` SMALLINT NULL DEFAULT '0',
	`TAPeStatus` INT NULL DEFAULT '0',
	`TAPeCheckStatus` INT NULL DEFAULT '0',
	`TAPeCancelStatus` SMALLINT NULL DEFAULT '0',
	`TAPeFlag1` SMALLINT NULL DEFAULT '0',
	`TAPeFlag2` SMALLINT NULL DEFAULT '0',
	`TAPeFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPeTAssCode`, `TAPePeriodNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetPeriodSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetPeriodSub`;

# ---------- CREATE TABLE `VS4TAssetPeriodSub` ----------

CREATE TABLE `VS4TAssetPeriodSub` (
	`TSPbTAssCode` VARCHAR(30) NOT NULL,
	`TSPbYear` INT NOT NULL DEFAULT '0',
	`TSPbMonth` INT NOT NULL DEFAULT '0',
	`TSPbLn` INT NOT NULL DEFAULT '0',
	`TSPbTAPePeriodNo` SMALLINT NULL DEFAULT '0',
	`TSPbPeriod` VARCHAR(30) NULL,
	`TSPbDateSave` DATETIME NULL,
	`TSPbDate` DATETIME NULL,
	`TSPbRate` VARCHAR(10) NULL,
	`TSPbDayQty` SMALLINT NULL DEFAULT '0',
	`TSPbDayAmount` DOUBLE NULL DEFAULT '0',
	`TSPbAmount` DOUBLE NULL DEFAULT '0',
	`TSPbCostAmount` DOUBLE NULL DEFAULT '0',
	`TSPbAmass` DOUBLE NULL DEFAULT '0',
	`TSPbCostNet` DOUBLE NULL DEFAULT '0',
	`TSPbTotalAmount` DOUBLE NULL DEFAULT '0',
	`TSPbTPrjCode` VARCHAR(30) NULL,
	`TSPbTBraCode` VARCHAR(30) NULL,
	`TSPbTDivCode` VARCHAR(30) NULL,
	`TSPbTDepCode` VARCHAR(30) NULL,
	`TSPbTSecCode` VARCHAR(30) NULL,
	`TSPbDescription` VARCHAR(255) NULL,
	`TSPbStatus` SMALLINT NULL DEFAULT '0',
	`TSPbTransStatus` SMALLINT NULL DEFAULT '0',
	`TSPbTGLTNo` VARCHAR(50) NULL,
	`TSPbTGLTDate` DATETIME NULL,
	`TSPbOwnerCode` VARCHAR(30) NULL,
	`TSPbOwnerName` VARCHAR(160) NULL,
	`TSPbFlag1` SMALLINT NULL DEFAULT '0',
	`TSPbFlag2` SMALLINT NULL DEFAULT '0',
	`TSPbFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSPbTAssCode`, `TSPbYear`, `TSPbMonth`, `TSPbLn`),
	KEY `TSPbOwnerCode` (`TSPbOwnerCode`),
	KEY `TSPbTAssCode` (`TSPbTAssCode`),
	KEY `TSPbTBraCode` (`TSPbTBraCode`),
	KEY `TSPbTBraCode1` (`TSPbTDivCode`),
	KEY `TSPbTBraCode2` (`TSPbTPrjCode`),
	KEY `TSPbTDivCode` (`TSPbTDepCode`),
	KEY `TSPbTDivCode1` (`TSPbTSecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetPlan` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetPlan`;

# ---------- CREATE TABLE `VS4TAssetPlan` ----------

CREATE TABLE `VS4TAssetPlan` (
	`TASPTAFPNo` VARCHAR(30) NOT NULL,
	`TASPYear` INT NOT NULL DEFAULT '0',
	`TASPMonth` INT NOT NULL DEFAULT '0',
	`TASPWeek` INT NOT NULL DEFAULT '0',
	`TASPLn` INT NOT NULL DEFAULT '0',
	`TASPDate` DATETIME NULL,
	`TASPTime` DATETIME NULL,
	`TASPHour` SMALLINT NULL DEFAULT '0',
	`TASPDay` SMALLINT NULL DEFAULT '0',
	`TASPManHour` INT NULL DEFAULT '0',
	`TASPStatus` SMALLINT NULL DEFAULT '0',
	`TASPSourceNo` VARCHAR(30) NULL,
	`TASPSourceDate` DATETIME NULL,
	`TASPFinishDate` DATETIME NULL,
	`TASPCost` FLOAT NULL DEFAULT '0',
	`TASPCreateCode` VARCHAR(30) NULL,
	`TASPCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TASPEditCode` VARCHAR(30) NULL,
	`TASPEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TASPCancelCode` VARCHAR(30) NULL,
	`TASPCancelStatus` SMALLINT NULL DEFAULT '0',
	`TASPFlag1` SMALLINT NULL DEFAULT '0',
	`TASPFlag2` SMALLINT NULL DEFAULT '0',
	`TASPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TASPTAFPNo`, `TASPYear`, `TASPMonth`, `TASPWeek`, `TASPLn`),
	KEY `TAFBTASSCode` (`TASPTAFPNo`),
	KEY `TAFBTASSCode1` (`TASPLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetPlanMain` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetPlanMain`;

# ---------- CREATE TABLE `VS4TAssetPlanMain` ----------

CREATE TABLE `VS4TAssetPlanMain` (
	`TAPMTAFPNo` VARCHAR(30) NOT NULL,
	`TAPMYear` INT NOT NULL DEFAULT '0',
	`TAPMChkMonth` SMALLINT NULL DEFAULT '0',
	`TAPMChkWeek` SMALLINT NULL DEFAULT '0',
	`TAPMDate` DATETIME NULL,
	`TAPMStatus` SMALLINT NULL DEFAULT '0',
	`TAPMStatusCheck` SMALLINT NULL DEFAULT '0',
	`TAPMFlag1` SMALLINT NULL DEFAULT '0',
	`TAPMFlag2` SMALLINT NULL DEFAULT '0',
	`TAPMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAPMTAFPNo`, `TAPMYear`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetPM` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetPM`;

# ---------- CREATE TABLE `VS4TAssetPM` ----------

CREATE TABLE `VS4TAssetPM` (
	`TAFPNo` VARCHAR(30) NOT NULL,
	`TAFPPMName` VARCHAR(100) NULL,
	`TAFPDate` DATETIME NULL,
	`TAFPTPrjCode` VARCHAR(30) NULL,
	`TAFPTBraCode` VARCHAR(30) NULL,
	`TAFPTDivCode` VARCHAR(30) NULL,
	`TAFPTDepCode` VARCHAR(30) NULL,
	`TAFPTSecCode` VARCHAR(30) NULL,
	`TAFPTEmpCode` VARCHAR(30) NULL,
	`TAFPRefNo` VARCHAR(50) NULL,
	`TAFPRefDate` DATETIME NULL,
	`TAFPRefNo2` VARCHAR(50) NULL,
	`TAFPRefDate2` DATETIME NULL,
	`TAFPStartDate` DATETIME NULL,
	`TAFPTime` DATETIME NULL,
	`TAFPHour` SMALLINT NULL DEFAULT '0',
	`TAFPManHours` SMALLINT NULL DEFAULT '0',
	`TAFPDay` SMALLINT NULL DEFAULT '0',
	`TAFPFrequency` INT NULL DEFAULT '0',
	`TAFPUnit` VARCHAR(30) NULL,
	`TAFPUnitStatus` INT NULL DEFAULT '0',
	`TAFPCondition` VARCHAR(50) NULL,
	`TAFPCustom1` VARCHAR(255) NULL,
	`TAFPCustom2` VARCHAR(255) NULL,
	`TAFPCustom3` VARCHAR(255) NULL,
	`TAFPDescription` VARCHAR(255) NULL,
	`TAFPStopEngine` SMALLINT NULL DEFAULT '0',
	`TAFPStopPlant` SMALLINT NULL DEFAULT '0',
	`TAFPStatus` SMALLINT NULL DEFAULT '0',
	`TAFPSourceNo` VARCHAR(30) NULL,
	`TAFPSourceDate` DATETIME NULL,
	`TAFPFinishDate` DATETIME NULL,
	`TAFPCreateCode` VARCHAR(30) NULL,
	`TAFPCreateBy` VARCHAR(140) NULL,
	`TAFPCreateDate` DATETIME NULL,
	`TAFPEditCode` VARCHAR(30) NULL,
	`TAFPEditBy` VARCHAR(140) NULL,
	`TAFPEditDate` DATETIME NULL,
	`TAFPConfirmStatus` SMALLINT NULL,
	`TAFPConfirmBy` VARCHAR(140) NULL,
	`TAFPConfirmDate` DATETIME NULL,
	`TAFPApproveStatus` SMALLINT NULL,
	`TAFPApproveBy` VARCHAR(140) NULL,
	`TAFPApproveDate` DATETIME NULL,
	`TAFPApproveNote` VARCHAR(80) NULL,
	`TAFPRevision` SMALLINT NULL,
	`TAFPCancelStatus` SMALLINT NULL,
	`TAFPCancelNo` VARCHAR(30) NULL,
	`TAFPCancelBy` VARCHAR(140) NULL,
	`TAFPCancelDate` DATETIME NULL,
	`TAFPCancelNote` VARCHAR(80) NULL,
	`TAFPFlag1` SMALLINT NULL DEFAULT '0',
	`TAFPFlag2` SMALLINT NULL DEFAULT '0',
	`TAFPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAFPNo`),
	KEY `TAFPNo` (`TAFPPMName`),
	KEY `TFssTFstCode` (`TAFPNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetPMMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetPMMB`;

# ---------- CREATE TABLE `VS4TAssetPMMB` ----------

CREATE TABLE `VS4TAssetPMMB` (
	`TAFBTAFPNo` VARCHAR(30) NOT NULL,
	`TAFBLn` INT NOT NULL DEFAULT '0',
	`TAFBTAssCode` VARCHAR(30) NULL,
	`TAFBTFITCode` VARCHAR(30) NULL,
	`TAFBStatus` SMALLINT NULL DEFAULT '0',
	`TAFBStartDate` DATETIME NULL,
	`TAFBFinishDate` DATETIME NULL,
	`TAFBDescription` VARCHAR(255) NULL,
	`TAFBFlag1` SMALLINT NULL DEFAULT '0',
	`TAFBFlag2` SMALLINT NULL DEFAULT '0',
	`TAFBFlag3` SMALLINT NULL DEFAULT '0',
	`TAFBTAssName` VARCHAR(100) NULL,
	`TAFBAccesories` VARCHAR(50) NULL,
	`TAFBTFITName` VARCHAR(50) NULL,
	`TAFBStandard` VARCHAR(50) NULL,
	`TAFBSymptom` VARCHAR(255) NULL,
	`TAFBCause` VARCHAR(255) NULL,
	`TAFBEdit` VARCHAR(255) NULL,
	`TAFBMethod` VARCHAR(255) NULL,
	`TAFBMaintain` VARCHAR(255) NULL,
	`TAFBCustom1` VARCHAR(255) NULL,
	`TAFBCustom2` VARCHAR(255) NULL,
	`TAFBCustom3` VARCHAR(255) NULL,
	`TAFBStatusCheck` SMALLINT NULL DEFAULT '0',
	`TAFBSourceNo` VARCHAR(30) NULL,
	`TAFBSourceDate` DATETIME NULL,
	`TAFBCost` FLOAT NULL DEFAULT '0',
	`TAFBCancelCode` VARCHAR(30) NULL,
	`TAFBCancelStatus` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAFBTAFPNo`, `TAFBLn`),
	KEY `TAFBTASSCode` (`TAFBTAFPNo`),
	KEY `TAFBTASSCode1` (`TAFBLn`),
	KEY `TFSbTAssCode1` (`TAFBTAssName`),
	KEY `TFssCode` (`TAFBTFITCode`),
	KEY `TFssTFstCode` (`TAFBTAssCode`),
	KEY `VS4TAssetFixTypeVS4TAssetPMMB` (`TAFBTFITCode`),
	KEY `VS4TAssetPMVS4TAssetPMMB` (`TAFBTAFPNo`),
	KEY `VS4TAssetVS4TAssetPMMB` (`TAFBTAssCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetSection` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetSection`;

# ---------- CREATE TABLE `VS4TAssetSection` ----------

CREATE TABLE `VS4TAssetSection` (
	`TAseCode` VARCHAR(30) NOT NULL,
	`TAseName` VARCHAR(50) NULL,
	`TAseName2` VARCHAR(50) NULL,
	`TAseTAsTCode` VARCHAR(30) NULL,
	`TAseAge` SMALLINT NULL DEFAULT '0',
	`TAseSort` SMALLINT NULL DEFAULT '0',
	`TAseMode` SMALLINT NULL DEFAULT '0',
	`TAseCalcDepreciate` SMALLINT NULL DEFAULT '0',
	`TAseDocCode` VARCHAR(30) NULL,
	`TAseTACCCode` VARCHAR(30) NULL,
	`TAseDebitCode` VARCHAR(30) NULL,
	`TAseCreditCode` VARCHAR(30) NULL,
	`TAseFlag1` SMALLINT NULL DEFAULT '0',
	`TAseFlag2` SMALLINT NULL DEFAULT '0',
	`TAseFlag3` SMALLINT NULL DEFAULT '0',
	`TAseCustomName1` VARCHAR(30) NULL,
	`TAseCustomName2` VARCHAR(30) NULL,
	`TAseCustomName3` VARCHAR(30) NULL,
	`TAseCustomName4` VARCHAR(30) NULL,
	`TAseCustomName5` VARCHAR(30) NULL,
	PRIMARY KEY (`TAseCode`),
	KEY `ProductMemberCategoryID` (`TAseFlag1`),
	KEY `ProductMemberProductID1` (`TAseName`),
	KEY `TAseCustomName1` (`TAseCustomName2`),
	KEY `TAseCustomName11` (`TAseCustomName3`),
	KEY `TAseCustomName12` (`TAseCustomName4`),
	KEY `TAseCustomName13` (`TAseCustomName5`),
	KEY `TAseName2` (`TAseCustomName1`),
	KEY `TAseTUntCode` (`TAseSort`),
	KEY `TAseTUntCode1` (`TAseMode`),
	KEY `TAseTUntCode2` (`TAseCalcDepreciate`),
	KEY `TPdGCode` (`TAseCode`),
	KEY `TPdGPdtGroupCode` (`TAseTAsTCode`),
	KEY `TPGsFlag1` (`TAseFlag2`),
	KEY `TPGsFlag11` (`TAseFlag3`),
	KEY `TPSEName` (`TAseName2`),
	KEY `TPSETACCCode` (`TAseTACCCode`),
	KEY `TPTTDocCode` (`TAseDocCode`),
	KEY `VS4TAssetTypeVS4TAssetSection` (`TAseTAsTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetSub`;

# ---------- CREATE TABLE `VS4TAssetSub` ----------

CREATE TABLE `VS4TAssetSub` (
	`TASuID` INT NOT NULL DEFAULT '0',
	`TASuAlias` VARCHAR(30) NULL,
	`TASuTAssCode` VARCHAR(30) NULL,
	`TASuName` VARCHAR(50) NULL,
	`TASuCapture1` VARCHAR(50) NULL,
	`TASuType1` SMALLINT NULL DEFAULT '0',
	`TASuText1` VARCHAR(50) NULL,
	`TASuValue1` DOUBLE NULL DEFAULT '0',
	`TASuDecimal1` SMALLINT NULL DEFAULT '0',
	`TASuTUnit1` VARCHAR(30) NULL,
	`TASuCapture2` VARCHAR(50) NULL,
	`TASuType2` SMALLINT NULL DEFAULT '0',
	`TASuText2` VARCHAR(50) NULL,
	`TASuValue2` DOUBLE NULL DEFAULT '0',
	`TASuDecimal2` SMALLINT NULL DEFAULT '0',
	`TASuTUnit2` VARCHAR(30) NULL,
	`TASuCapture3` VARCHAR(50) NULL,
	`TASuType3` SMALLINT NULL DEFAULT '0',
	`TASuText3` VARCHAR(50) NULL,
	`TASuValue3` DOUBLE NULL DEFAULT '0',
	`TASuDecimal3` SMALLINT NULL DEFAULT '0',
	`TASuTUnit3` VARCHAR(30) NULL,
	`TASuCapture4` VARCHAR(50) NULL,
	`TASuType4` SMALLINT NULL DEFAULT '0',
	`TASuText4` VARCHAR(50) NULL,
	`TASuValue4` DOUBLE NULL DEFAULT '0',
	`TASuDecimal4` SMALLINT NULL DEFAULT '0',
	`TASuTUnit4` VARCHAR(30) NULL,
	`TASuCapture5` VARCHAR(50) NULL,
	`TASuType5` SMALLINT NULL DEFAULT '0',
	`TASuText5` VARCHAR(50) NULL,
	`TASuValue5` DOUBLE NULL DEFAULT '0',
	`TASuDecimal5` SMALLINT NULL DEFAULT '0',
	`TASuTUnit5` VARCHAR(30) NULL,
	`TASuDisplayFormat` INT NULL DEFAULT '0',
	`TASuDisplayText` VARCHAR(50) NULL,
	`TASuFlag1` SMALLINT NULL DEFAULT '0',
	`TASuFlag2` SMALLINT NULL DEFAULT '0',
	`TASuFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TASuID`),
	KEY `TAsBTUnit1` (`TASuTUnit2`),
	KEY `TAsBTUnit11` (`TASuTUnit3`),
	KEY `TAsBTUnit12` (`TASuTUnit4`),
	KEY `TAsBTUnit13` (`TASuTUnit5`),
	KEY `TAsBTUnitCode` (`TASuTUnit1`),
	KEY `TPdMID` (`TASuID`),
	KEY `TPdMTPdtID` (`TASuTAssCode`),
	KEY `TPdtSizeFormat` (`TASuDisplayFormat`),
	KEY `VS4TAssetVS4TAssetSub` (`TASuTAssCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetTrans` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetTrans`;

# ---------- CREATE TABLE `VS4TAssetTrans` ----------

CREATE TABLE `VS4TAssetTrans` (
	`TATfNo` VARCHAR(30) NOT NULL,
	`TATfDate` DATETIME NULL DEFAULT '3333-3-3',
	`TATfTransferDate` DATETIME NULL DEFAULT '3333-3-3',
	`TATfRefNo` VARCHAR(30) NULL,
	`TATfRefNo2` VARCHAR(30) NULL,
	`TATfDescription` VARCHAR(255) NULL,
	`TATfDescription2` VARCHAR(100) NULL,
	`TATfTATTAlias` VARCHAR(30) NULL,
	`TATfToTBraCode` VARCHAR(30) NULL,
	`TATfToTDivCode` VARCHAR(30) NULL,
	`TATfToTDepCode` VARCHAR(30) NULL,
	`TATfToTSecCode` VARCHAR(30) NULL,
	`TATfToLocation` VARCHAR(30) NULL,
	`TATfRequestCode` VARCHAR(30) NULL,
	`TATfRequestBy` VARCHAR(140) NULL,
	`TATfTGLTNo` VARCHAR(30) NULL,
	`TATfCreateCode` VARCHAR(30) NULL,
	`TATfCreateBy` VARCHAR(160) NULL,
	`TATfCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TATfEditCode` VARCHAR(30) NULL,
	`TATfEditBy` VARCHAR(140) NULL,
	`TATfEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TATfConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TATfConfirmBy` VARCHAR(140) NULL,
	`TATfConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TATfApproveStatus` SMALLINT NULL DEFAULT '0',
	`TATfApproveBy` VARCHAR(140) NULL,
	`TATfApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TATfApproveNote` VARCHAR(80) NULL,
	`TATfRevision` SMALLINT NULL DEFAULT '0',
	`TATfCancelStatus` SMALLINT NULL DEFAULT '0',
	`TATfCancelNo` VARCHAR(30) NULL,
	`TATfCancelBy` VARCHAR(140) NULL,
	`TATfCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TATfCancelNote` VARCHAR(80) NULL,
	`TATfFlag1` SMALLINT NULL DEFAULT '0',
	`TATfFlag2` SMALLINT NULL DEFAULT '0',
	`TATfFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TATfNo`),
	KEY `TATfFromTLocCode` (`TATfToLocation`),
	KEY `TATfFromTLocCode1` (`TATfToTDepCode`),
	KEY `TATfFromTWahCode` (`TATfToTDivCode`),
	KEY `TATfRequestCode` (`TATfRequestCode`),
	KEY `TPWRRequestBy` (`TATfRequestBy`),
	KEY `TSTKTShfID` (`TATfToTBraCode`),
	KEY `TSTKTTftID` (`TATfTATTAlias`),
	KEY `TTfrFromTStoCode` (`TATfToTSecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetTransMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetTransMB`;

# ---------- CREATE TABLE `VS4TAssetTransMB` ----------

CREATE TABLE `VS4TAssetTransMB` (
	`TATMTATfNo` VARCHAR(30) NOT NULL,
	`TATMLn` INT NOT NULL DEFAULT '0',
	`TATMTAssCode` VARCHAR(30) NULL,
	`TATMCode` VARCHAR(30) NULL,
	`TATMName` VARCHAR(100) NULL,
	`TATMOldBraCode` VARCHAR(30) NULL,
	`TATMOldBraName` VARCHAR(100) NULL,
	`TATMOldDivCode` VARCHAR(30) NULL,
	`TATMOldDivName` VARCHAR(100) NULL,
	`TATMOldDepCode` VARCHAR(30) NULL,
	`TATMOldDepName` VARCHAR(100) NULL,
	`TATMOldSecCode` VARCHAR(30) NULL,
	`TATMOldSecName` VARCHAR(100) NULL,
	`TATMOldLocation` VARCHAR(100) NULL,
	`TATMTPrjCode` VARCHAR(30) NULL,
	`TATMNewBraCode` VARCHAR(30) NULL,
	`TATMNewBraName` VARCHAR(100) NULL,
	`TATMNewDivCode` VARCHAR(30) NULL,
	`TATMNewDivName` VARCHAR(100) NULL,
	`TATMNewDepCode` VARCHAR(30) NULL,
	`TATMNewDepName` VARCHAR(100) NULL,
	`TATMNewSecCode` VARCHAR(30) NULL,
	`TATMNewSecName` VARCHAR(100) NULL,
	`TATMNewLocation` VARCHAR(100) NULL,
	`TATMOwnerCode` VARCHAR(30) NULL,
	`TATMOwnerName` VARCHAR(100) NULL,
	`TATMEmpOldCode` VARCHAR(30) NULL,
	`TATMEmpOldName` VARCHAR(100) NULL,
	`TATMQuantity` INT NULL DEFAULT '0',
	`TATMTUntCode` VARCHAR(30) NULL,
	`TATMQuantity2` INT NULL DEFAULT '0',
	`TATMTUntCode2` VARCHAR(30) NULL,
	`TATMQuantity3` INT NULL DEFAULT '0',
	`TATMTUntCode3` VARCHAR(30) NULL,
	`TATMPeriod` VARCHAR(10) NULL,
	`TATMPeriodAmount` DOUBLE NULL DEFAULT '0',
	`TATMPeriodArrear` DOUBLE NULL DEFAULT '0',
	`TATMPeriodNet` DOUBLE NULL DEFAULT '0',
	`TATMPeriodLn` VARCHAR(50) NULL,
	`TATMPeriodMonth` SMALLINT NULL DEFAULT '0',
	`TATMPeriodYear` VARCHAR(4) NULL,
	`TATMPeriodNo` INT NULL DEFAULT '0',
	`TATMPTransferDate` DATETIME NULL,
	`TATMPDate` DATETIME NULL,
	`TATMDayQty` SMALLINT NULL DEFAULT '0',
	`TATMDayAmount` SMALLINT NULL DEFAULT '0',
	`TATMRate` DOUBLE NULL DEFAULT '0',
	`TATMFee` FLOAT NULL DEFAULT '0',
	`TATMDescription` VARCHAR(150) NULL,
	`TATMFlag1` SMALLINT NULL DEFAULT '0',
	`TATMFlag2` SMALLINT NULL DEFAULT '0',
	`TATMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TATMTATfNo`, `TATMLn`),
	KEY `TATMCode` (`TATMCode`),
	KEY `TATMDepCode` (`TATMOldDepCode`),
	KEY `TATMDivCode` (`TATMOldDivCode`),
	KEY `TATMEmpOldCode` (`TATMEmpOldCode`),
	KEY `TATMOldBraCode` (`TATMNewBraCode`),
	KEY `TATMOldDepCode` (`TATMNewDepCode`),
	KEY `TATMOldDivCode` (`TATMNewDivCode`),
	KEY `TATMOldSecCode` (`TATMNewSecCode`),
	KEY `TATMOwnerCode` (`TATMOwnerCode`),
	KEY `TATMSecCode` (`TATMOldSecCode`),
	KEY `TATMTBraCode` (`TATMOldBraCode`),
	KEY `TATMTPrjCode` (`TATMTPrjCode`),
	KEY `TSTKID` (`TATMTATfNo`),
	KEY `TSTKtLoDID` (`TATMTAssCode`),
	KEY `VS4TAssetTransVS4TAssetTransMB` (`TATMTATfNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetTransType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetTransType`;

# ---------- CREATE TABLE `VS4TAssetTransType` ----------

CREATE TABLE `VS4TAssetTransType` (
	`TATTAlias` VARCHAR(30) NOT NULL,
	`TATTDocCode` VARCHAR(30) NULL,
	`TATTName` VARCHAR(100) NULL,
	`TATTName2` VARCHAR(100) NULL,
	`TATTCountType` SMALLINT NULL DEFAULT '1',
	`TATTFlag1` SMALLINT NULL DEFAULT '0',
	`TATTFlag2` SMALLINT NULL DEFAULT '0',
	`TATTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TATTAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetType`;

# ---------- CREATE TABLE `VS4TAssetType` ----------

CREATE TABLE `VS4TAssetType` (
	`TAsTCode` VARCHAR(30) NOT NULL,
	`TAstName` VARCHAR(100) NULL,
	`TAstName2` VARCHAR(100) NULL,
	`TAstMode` SMALLINT NULL DEFAULT '0',
	`TAstCalcDepreciate` SMALLINT NULL DEFAULT '0',
	`TAstAge` DOUBLE NULL DEFAULT '0',
	`TAstTUntCode` VARCHAR(15) NULL,
	`TAstTACCCode` VARCHAR(30) NULL,
	`TAstDocCode` VARCHAR(30) NULL,
	`TAstSort` INT NULL DEFAULT '0',
	`TAstFlag1` SMALLINT NULL DEFAULT '0',
	`TAstFlag2` INT NULL DEFAULT '0',
	`TAstFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TAsTCode`),
	KEY `TAstDefaultTuntCode` (`TAstTUntCode`),
	KEY `TAstDocCode` (`TAstDocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetWGMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetWGMB`;

# ---------- CREATE TABLE `VS4TAssetWGMB` ----------

CREATE TABLE `VS4TAssetWGMB` (
	`TAegTAgtCode` VARCHAR(30) NOT NULL,
	`TAegTAssCode` VARCHAR(30) NOT NULL,
	`TAegFlag1` SMALLINT NULL DEFAULT '0',
	`TAegFlag2` SMALLINT NULL DEFAULT '0',
	`TAegFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAegTAgtCode`, `TAegTAssCode`),
	KEY `TAegTAgtCode` (`TAegTAgtCode`),
	KEY `VS4TAssetVS4TAssetWGMB` (`TAegTAssCode`),
	KEY `VS4TAssetWorkGroupVS4TAssetWGMB` (`TAegTAgtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetWorkGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetWorkGroup`;

# ---------- CREATE TABLE `VS4TAssetWorkGroup` ----------

CREATE TABLE `VS4TAssetWorkGroup` (
	`TAgtCode` VARCHAR(30) NOT NULL,
	`TAgtName` VARCHAR(50) NULL,
	`TAgtName2` VARCHAR(50) NULL,
	`TAgtWatt` DOUBLE NULL DEFAULT '0',
	`TAgtFlag1` SMALLINT NULL DEFAULT '0',
	`TAgtFlag2` SMALLINT NULL DEFAULT '0',
	`TAgtFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAgtCode`),
	KEY `TAgtCode` (`TAgtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TAssetWorkTime` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TAssetWorkTime`;

# ---------- CREATE TABLE `VS4TAssetWorkTime` ----------

CREATE TABLE `VS4TAssetWorkTime` (
	`TEntTAssCode` VARCHAR(30) NOT NULL,
	`TEntLn` INT NOT NULL DEFAULT '0',
	`TEntFormDay` SMALLINT NULL DEFAULT '0',
	`TEntToDay` SMALLINT NULL DEFAULT '0',
	`TEntTimeStart` DATETIME NULL,
	`TEntTime` SMALLINT NULL DEFAULT '0',
	`TEntStopDay` VARCHAR(50) NULL,
	`TEntInteruptTime` SMALLINT NULL DEFAULT '0',
	`TEntExpTimeStart` DATETIME NULL,
	`TEntExpressTime` SMALLINT NULL DEFAULT '0',
	`TEntOverLoad` SMALLINT NULL DEFAULT '0',
	`TEntDescription` VARCHAR(150) NULL,
	`TEntFlag1` SMALLINT NULL DEFAULT '0',
	`TEntFlag2` SMALLINT NULL DEFAULT '0',
	`TEntFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEntTAssCode`, `TEntLn`),
	KEY `TEntTAssCode` (`TEntTAssCode`),
	KEY `VS4TAssetVS4TAssetWorkTime` (`TEntTAssCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBank` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBank`;

# ---------- CREATE TABLE `VS4TBank` ----------

CREATE TABLE `VS4TBank` (
	`TBnkCode` VARCHAR(30) NOT NULL,
	`TBnkName` VARCHAR(100) NULL,
	`TBnkName2` VARCHAR(100) NULL,
	`TBnkHotChar` VARCHAR(3) NULL,
	`TBnkVirtual` SMALLINT NULL DEFAULT '1',
	`TBnkUploadCode` VARCHAR(50) NULL,
	`TBnkUploadCustom1` VARCHAR(50) NULL,
	`TBnkUploadCustom2` VARCHAR(50) NULL,
	`TBnkUploadCustom3` VARCHAR(50) NULL,
	`TBnkPatternFile` VARCHAR(100) NULL,
	`TBnkPayrollFile` VARCHAR(30) NULL,
	`TBnkLogoFile` VARCHAR(30) NULL,
	`TBnkWebsite` VARCHAR(50) NULL,
	`TBnkFlag1` SMALLINT NULL DEFAULT '0',
	`TBnkFlag2` SMALLINT NULL DEFAULT '0',
	`TBnkFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBnkCode`),
	KEY `TBnkCode` (`TBnkCode`),
	KEY `TBnkUploadCode` (`TBnkUploadCode`),
	KEY `TBnkUploadCode1` (`TBnkHotChar`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBankAccType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBankAccType`;

# ---------- CREATE TABLE `VS4TBankAccType` ----------

CREATE TABLE `VS4TBankAccType` (
	`TBATID` DOUBLE NOT NULL DEFAULT '0',
	`TBATName` VARCHAR(50) NULL,
	`TBATName2` VARCHAR(50) NULL,
	`TBATFlag1` SMALLINT NULL DEFAULT '0',
	`TBATFlag2` SMALLINT NULL DEFAULT '0',
	`TBATFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBATID`),
	KEY `TCrdID` (`TBATID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBankBranch` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBankBranch`;

# ---------- CREATE TABLE `VS4TBankBranch` ----------

CREATE TABLE `VS4TBankBranch` (
	`TBBrCode` VARCHAR(30) NOT NULL,
	`TBBrName` VARCHAR(100) NULL,
	`TBBrTBnkCode` VARCHAR(30) NULL,
	`TBBrLocation` VARCHAR(150) NULL,
	`TBBrFlag1` SMALLINT NULL DEFAULT '0',
	`TBBrFlag2` SMALLINT NULL DEFAULT '0',
	`TBBrFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBBrCode`),
	KEY `TBBrCode` (`TBBrCode`),
	KEY `TBBrTBnkID` (`TBBrTBnkCode`),
	KEY `VS4TBankVS4TBankBranch` (`TBBrTBnkCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBankCardFee` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBankCardFee`;

# ---------- CREATE TABLE `VS4TBankCardFee` ----------

CREATE TABLE `VS4TBankCardFee` (
	`TBCFTBnkCode` VARCHAR(30) NOT NULL,
	`TBCFTPymCode` VARCHAR(15) NOT NULL,
	`TBCFCardBank` VARCHAR(15) NOT NULL,
	`TBCFName` VARCHAR(80) NULL,
	`TBCFFeeRate` DOUBLE NULL DEFAULT '0',
	`TBCFVATType` SMALLINT NULL DEFAULT '0',
	`TBCFTransferDelay` SMALLINT NULL DEFAULT '0',
	`TBCFSkipWeekEnd` SMALLINT NULL DEFAULT '0',
	`TBCFSkipHoliday` SMALLINT NULL DEFAULT '0',
	`TBCFFlag1` SMALLINT NULL DEFAULT '0',
	`TBCFFlag2` SMALLINT NULL DEFAULT '0',
	`TBCFFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBCFTBnkCode`, `TBCFTPymCode`, `TBCFCardBank`),
	KEY `VS4TBankVS4TBankCardFee` (`TBCFTBnkCode`),
	KEY `VS4TPaymentVS4TBankCardFee` (`TBCFTPymCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBankCheque` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBankCheque`;

# ---------- CREATE TABLE `VS4TBankCheque` ----------

CREATE TABLE `VS4TBankCheque` (
	`TBCqCode` VARCHAR(30) NOT NULL,
	`TBCqTBnkCode` VARCHAR(30) NULL,
	`TBCqName` VARCHAR(100) NULL,
	`TBCqName2` VARCHAR(100) NULL,
	`TBCqChequeFile` VARCHAR(30) NULL,
	`TBCqChequeSize` VARCHAR(30) NULL,
	`TBCqDatePos` VARCHAR(30) NULL,
	`TBCqDateFormat` SMALLINT NULL DEFAULT '0',
	`TBCqPaytoPos` VARCHAR(30) NULL,
	`TBCqMoneyPos` VARCHAR(30) NULL,
	`TBCqMoneyTextPos` VARCHAR(30) NULL,
	`TBCqLogoPos` VARCHAR(40) NULL,
	`TBCqUseBearer` INT NULL DEFAULT '0',
	`TBCqBearerPos` VARCHAR(30) NULL,
	`TBCqUseACPayee` INT NULL DEFAULT '0',
	`TBCqACPos` VARCHAR(15) NULL,
	`TBCqXXXPos` VARCHAR(15) NULL,
	`TBCqUsePayto2` INT NULL DEFAULT '0',
	`TBCqPayTo2Pos` VARCHAR(30) NULL,
	`TBCqUsePayFor` INT NULL DEFAULT '0',
	`TBCqPayForPos` VARCHAR(30) NULL,
	`TBCqUseDesc` INT NULL DEFAULT '0',
	`TBCqDescPos` VARCHAR(30) NULL,
	`TBCqUseDate2` INT NULL DEFAULT '0',
	`TBCqDate2Pos` VARCHAR(30) NULL,
	`TBCqUseMoney2` INT NULL DEFAULT '0',
	`TBCqMoney2Pos` VARCHAR(30) NULL,
	`TBCqFontName` VARCHAR(30) NULL,
	`TBCqFontSize` INT NULL DEFAULT '0',
	`TBCqFontBold` SMALLINT NULL DEFAULT '0',
	`TBCqMargin` VARCHAR(40) NULL,
	`TBCqSafeText` VARCHAR(10) NULL,
	`TBCqSafeNumber` VARCHAR(10) NULL,
	`TBCqBearerText` VARCHAR(20) NULL,
	`TBCqLanguageID` SMALLINT NULL DEFAULT '0',
	`TBCqFlag1` SMALLINT NULL DEFAULT '0',
	`TBCqFlag2` SMALLINT NULL DEFAULT '0',
	`TBCqFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBCqCode`),
	KEY `TBCqCode` (`TBCqCode`),
	KEY `TBnkCode` (`TBCqTBnkCode`),
	KEY `VS4TBankVS4TBankCheque` (`TBCqTBnkCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBankCreditCard` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBankCreditCard`;

# ---------- CREATE TABLE `VS4TBankCreditCard` ----------

CREATE TABLE `VS4TBankCreditCard` (
	`TBCDNo` VARCHAR(30) NOT NULL,
	`TBCDName` VARCHAR(80) NULL,
	`TBCDTBraCode` VARCHAR(30) NULL,
	`TBCDTCBBNo` VARCHAR(30) NULL,
	`TBCDFlag1` SMALLINT NULL DEFAULT '0',
	`TBCDFlag2` SMALLINT NULL DEFAULT '0',
	`TBCDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBCDNo`),
	KEY `VS4TBranchVS4TBankCreditCard` (`TBCDTBraCode`),
	KEY `VS4TCompanyBankVS4TBankCreditCard` (`TBCDTCBBNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBankHoliday` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBankHoliday`;

# ---------- CREATE TABLE `VS4TBankHoliday` ----------

CREATE TABLE `VS4TBankHoliday` (
	`TBHdHolidayDate` DATETIME NOT NULL,
	`TBHdHolidayName` VARCHAR(100) NULL,
	`TBHdYear` SMALLINT NULL DEFAULT '0',
	`TBHdFlag1` SMALLINT NULL DEFAULT '0',
	`TBHdFlag2` SMALLINT NULL DEFAULT '0',
	`TBHdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBHdHolidayDate`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBankSlip` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBankSlip`;

# ---------- CREATE TABLE `VS4TBankSlip` ----------

CREATE TABLE `VS4TBankSlip` (
	`TBSLCode` VARCHAR(30) NOT NULL,
	`TBSLTBnkCode` VARCHAR(30) NULL,
	`TBSLName` VARCHAR(100) NULL,
	`TBSLName2` VARCHAR(100) NULL,
	`TBSLType` SMALLINT NULL DEFAULT '0',
	`TBSLSlipFile` VARCHAR(30) NULL,
	`TBSLSlipSize` VARCHAR(30) NULL,
	`TBSLPaytoPos` VARCHAR(30) NULL,
	`TBSLPayBranchPos` VARCHAR(30) NULL,
	`TBSLPayACNoPos` VARCHAR(30) NULL,
	`TBSLUseACNoFull` SMALLINT NULL DEFAULT '0',
	`TBSLSplitPos` VARCHAR(255) NULL,
	`TBSLUseACNoSplit` SMALLINT NULL DEFAULT '0',
	`TBSLPayByPos` VARCHAR(30) NULL,
	`TBSLPayTelPos` VARCHAR(30) NULL,
	`TBSLUseMoney` SMALLINT NULL DEFAULT '0',
	`TBSLMoneyPos` VARCHAR(30) NULL,
	`TBSLMoneyTextPos` VARCHAR(30) NULL,
	`TBSLUseDate` SMALLINT NULL DEFAULT '0',
	`TBSLDatePos` VARCHAR(30) NULL,
	`TBSLDateFormat` SMALLINT NULL DEFAULT '0',
	`TBSLUseACType` SMALLINT NULL DEFAULT '0',
	`TBSLACTypePos` VARCHAR(15) NULL,
	`TBSLACTypePos2` VARCHAR(15) NULL,
	`TBSLACTypePos3` VARCHAR(15) NULL,
	`TBSLACTypePos4` VARCHAR(15) NULL,
	`TBSLACTypePos5` VARCHAR(15) NULL,
	`TBSLUseOther` VARCHAR(15) NULL,
	`TBSLOtherPos` VARCHAR(15) NULL,
	`TBSLOthertxtPos` VARCHAR(15) NULL,
	`TBSLUsePayType` SMALLINT NULL DEFAULT '0',
	`TBSLUsePayCash` SMALLINT NULL DEFAULT '0',
	`TBSLPayCashPos` VARCHAR(15) NULL,
	`TBSLUsePayTransfer` SMALLINT NULL DEFAULT '0',
	`TBSLTransferPos` VARCHAR(15) NULL,
	`TBSLTransferPos2` VARCHAR(15) NULL,
	`TBSLTransferPos3` VARCHAR(15) NULL,
	`TBSLTransACNoPOS` VARCHAR(15) NULL,
	`TBSLUsePayCheque` SMALLINT NULL DEFAULT '0',
	`TBSLPayChequePos` VARCHAR(15) NULL,
	`TBSLPayChequePos2` VARCHAR(15) NULL,
	`TBSLUseFee` INT NULL DEFAULT '0',
	`TBSLFeePos` VARCHAR(30) NULL,
	`TBSLUseCharge` INT NULL DEFAULT '0',
	`TBSLChargePos` VARCHAR(30) NULL,
	`TBSLUseCheque` INT NULL DEFAULT '0',
	`TBSLChequePos` VARCHAR(30) NULL,
	`TBSLChequeTextPos` VARCHAR(30) NULL,
	`TBSLUseCQCount` SMALLINT NULL DEFAULT '0',
	`TBSLCQPos` VARCHAR(30) NULL,
	`TBSLUseCash` SMALLINT NULL DEFAULT '0',
	`TBSLCashPos` VARCHAR(30) NULL,
	`TBSLCashTextPos` VARCHAR(30) NULL,
	`TBSLFontName` VARCHAR(30) NULL,
	`TBSLFontSize` SMALLINT NULL DEFAULT '0',
	`TBSLFontBold` SMALLINT NULL DEFAULT '0',
	`TBSLMargin` VARCHAR(40) NULL,
	`TBSLSafeText` VARCHAR(10) NULL,
	`TBSLSafeNumber` VARCHAR(10) NULL,
	`TBSLFlag1` SMALLINT NULL DEFAULT '0',
	`TBSLFlag2` SMALLINT NULL DEFAULT '0',
	`TBSLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBSLCode`),
	KEY `TBCqCode` (`TBSLCode`),
	KEY `TBnkCode` (`TBSLTBnkCode`),
	KEY `VS4TBankVS4TBankSlip` (`TBSLTBnkCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBranch` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBranch`;

# ---------- CREATE TABLE `VS4TBranch` ----------

CREATE TABLE `VS4TBranch` (
	`TBraCode` VARCHAR(30) NOT NULL,
	`TBraName` VARCHAR(200) NULL,
	`TBraName2` VARCHAR(200) NULL,
	`TBraDocCode` VARCHAR(5) NULL,
	`TBraTBrTAlias` VARCHAR(30) NULL,
	`TBraTaxMode` SMALLINT NULL DEFAULT '0',
	`TBraTaxNo` VARCHAR(30) NULL,
	`TBraAddressBill` VARCHAR(255) NULL,
	`TBraSocialNo` VARCHAR(30) NULL,
	`TBraSocialArea` VARCHAR(30) NULL,
	`TBraTCurCode` VARCHAR(3) NULL,
	`TBraTCmpCode` VARCHAR(30) NULL,
	`TBraNo` VARCHAR(30) NULL,
	`TBraAddress` VARCHAR(200) NULL,
	`TBraSubProvince` VARCHAR(50) NULL,
	`TBraCity` VARCHAR(50) NULL,
	`TBraPostalCode` VARCHAR(5) NULL,
	`TBraStaCode` VARCHAR(3) NULL,
	`TBraTCouCode` VARCHAR(3) NULL,
	`TBraWebsite` VARCHAR(100) NULL,
	`TBraEmail` VARCHAR(50) NULL,
	`TBraPhone` VARCHAR(100) NULL,
	`TBraFax` VARCHAR(50) NULL,
	`TBraMap1` VARCHAR(50) NULL,
	`TBraMap2` VARCHAR(50) NULL,
	`TBraImage1` VARCHAR(50) NULL,
	`TBraIcon1` VARCHAR(50) NULL,
	`TBraNote` VARCHAR(255) NULL,
	`TBraLeadDay` DOUBLE NULL DEFAULT '0',
	`TBraSafePerDay` SMALLINT NULL DEFAULT '0',
	`TBraSafeDayCalc` SMALLINT NULL DEFAULT '0',
	`TBraBackDayCalc` SMALLINT NULL DEFAULT '0',
	`TBraSafeTotalDay` SMALLINT NULL DEFAULT '0',
	`TBraCreateCode` VARCHAR(30) NULL,
	`TBraCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBraEditCode` VARCHAR(30) NULL,
	`TBraEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TBraTextSort` VARCHAR(30) NULL,
	`TBraFlag1` SMALLINT NULL DEFAULT '0',
	`TBraFlag2` SMALLINT NULL DEFAULT '0',
	`TBraFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBraCode`),
	KEY `TBraCode` (`TBraCode`),
	KEY `TBraInvoiceCode` (`TBraDocCode`),
	KEY `TBraTCmpID` (`TBraTCmpCode`),
	KEY `TBraTCouCode` (`TBraTCurCode`),
	KEY `TWahStaCode` (`TBraStaCode`),
	KEY `TWahTCouCode` (`TBraTCouCode`),
	KEY `VS4TBranchTypeVS4TBranch` (`TBraTBrTAlias`),
	KEY `VS4TCompanyVS4TBranch` (`TBraTCmpCode`),
	KEY `VS4TCountryVS4TBranch` (`TBraTCouCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBranchGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBranchGroup`;

# ---------- CREATE TABLE `VS4TBranchGroup` ----------

CREATE TABLE `VS4TBranchGroup` (
	`TBrGCode` VARCHAR(30) NOT NULL,
	`TBrGName` VARCHAR(50) NULL,
	`TBrGFlag1` SMALLINT NULL DEFAULT '0',
	`TBrGFlag2` SMALLINT NULL DEFAULT '0',
	`TBrGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBrGCode`),
	KEY `TDepCode` (`TBrGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBranchGroupMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBranchGroupMB`;

# ---------- CREATE TABLE `VS4TBranchGroupMB` ----------

CREATE TABLE `VS4TBranchGroupMB` (
	`TBGMTBrGCode` VARCHAR(30) NOT NULL,
	`TBGMTBraCode` VARCHAR(30) NOT NULL,
	`TBGMFlag1` SMALLINT NULL DEFAULT '0',
	`TBGMFlag2` SMALLINT NULL DEFAULT '0',
	`TBGMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBGMTBrGCode`, `TBGMTBraCode`),
	KEY `ProductMemberCategoryID` (`TBGMTBraCode`),
	KEY `ProductMemberProductID1` (`TBGMTBrGCode`),
	KEY `VS4TBranchGroupVS4TBranchGroupMB` (`TBGMTBrGCode`),
	KEY `VS4TBranchVS4TBranchGroupMB` (`TBGMTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBranchSign` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBranchSign`;

# ---------- CREATE TABLE `VS4TBranchSign` ----------

CREATE TABLE `VS4TBranchSign` (
	`TBrSTBraCode` VARCHAR(30) NOT NULL,
	`TBrSLn` VARCHAR(255) NOT NULL,
	`TBrSSSOSignName` VARCHAR(160) NULL,
	`TBrSSSOSignTitle` VARCHAR(160) NULL,
	`TBrSRD1SignName` VARCHAR(160) NULL,
	`TBraTaxMode` SMALLINT NULL DEFAULT '0',
	`TBrSRD1SignTitle` VARCHAR(160) NULL,
	`TBrSRD3SignName` VARCHAR(160) NULL,
	`TBrSRD3SignTitle` VARCHAR(160) NULL,
	`TBrSRD53SignName` VARCHAR(160) NULL,
	`TBrSRD53SignTitle` VARCHAR(160) NULL,
	`TBrSSignName` VARCHAR(160) NULL,
	`TBrSSignTitle` VARCHAR(160) NULL,
	`TBrSFlag1` SMALLINT NULL DEFAULT '0',
	`TBrSFlag2` SMALLINT NULL DEFAULT '0',
	`TBrSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBrSTBraCode`, `TBrSLn`),
	KEY `TBrSLn` (`TBrSLn`),
	KEY `TBrSTBraCode` (`TBrSTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBranchType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBranchType`;

# ---------- CREATE TABLE `VS4TBranchType` ----------

CREATE TABLE `VS4TBranchType` (
	`TBrTAlias` VARCHAR(30) NOT NULL,
	`TBrTName` VARCHAR(80) NULL,
	`TBrTName2` VARCHAR(80) NULL,
	`TBrTDocCode` VARCHAR(30) NULL,
	`TBrTFlag1` SMALLINT NULL DEFAULT '0',
	`TBrTFlag2` SMALLINT NULL DEFAULT '0',
	`TBrTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBrTAlias`),
	KEY `TBrTDocCode` (`TBrTDocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBrand` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBrand`;

# ---------- CREATE TABLE `VS4TBrand` ----------

CREATE TABLE `VS4TBrand` (
	`TBndCode` VARCHAR(30) NOT NULL,
	`TBndName` VARCHAR(100) NULL,
	`TBndName2` VARCHAR(100) NULL,
	`TBndTBnGCode` VARCHAR(30) NULL,
	`TBndFlag1` SMALLINT NULL DEFAULT '0',
	`TBndFlag2` SMALLINT NULL DEFAULT '0',
	`TBndFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBndCode`),
	KEY `TBnGCode` (`TBndName2`),
	KEY `TBnGCode1` (`TBndTBnGCode`),
	KEY `TBnkCode` (`TBndCode`),
	KEY `VS4TBrandGroupVS4TBrand` (`TBndTBnGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBrandGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBrandGroup`;

# ---------- CREATE TABLE `VS4TBrandGroup` ----------

CREATE TABLE `VS4TBrandGroup` (
	`TBnGCode` VARCHAR(30) NOT NULL,
	`TBnGName` VARCHAR(100) NULL,
	`TBnGName2` VARCHAR(100) NULL,
	`TBnGTBnTCode` VARCHAR(30) NULL,
	`TBnGFlag1` SMALLINT NULL DEFAULT '0',
	`TBnGFlag2` SMALLINT NULL DEFAULT '0',
	`TBnGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBnGCode`),
	KEY `TBnkCode` (`TBnGCode`),
	KEY `VS4TBrandTypeVS4TBrandGroup` (`TBnGTBnTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBrandType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBrandType`;

# ---------- CREATE TABLE `VS4TBrandType` ----------

CREATE TABLE `VS4TBrandType` (
	`TBnTCode` VARCHAR(30) NOT NULL,
	`TBnTName` VARCHAR(100) NULL,
	`TBnTName2` VARCHAR(100) NULL,
	`TBnTFlag1` SMALLINT NULL DEFAULT '0',
	`TBnTFlag2` SMALLINT NULL DEFAULT '0',
	`TBnTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBnTCode`),
	KEY `TBnkCode` (`TBnTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBudget` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBudget`;

# ---------- CREATE TABLE `VS4TBudget` ----------

CREATE TABLE `VS4TBudget` (
	`TBDGNo` VARCHAR(30) NOT NULL,
	`TBDGDate` DATETIME NULL,
	`TBDGDateSave` VARCHAR(50) NULL,
	`TBDGRefNo` VARCHAR(50) NULL,
	`TBDGRefDate` DATETIME NULL,
	`TBDGBudgetDate` DATETIME NULL,
	`TBDGBudgetMonth` INT NULL DEFAULT '0',
	`TBDGBudgetYear` INT NULL DEFAULT '0',
	`TBDGBudgetSecYear` INT NULL DEFAULT '0',
	`TBDGTACPTACYID` INT NULL DEFAULT '0',
	`TBDGTACPID` INT NULL DEFAULT '0',
	`TBDGOldBudgetTotal` FLOAT NULL,
	`TBDGNewBudgetTotal` FLOAT NULL DEFAULT '0',
	`TBDGTJobNo` VARCHAR(30) NULL,
	`TBDGTJbMLn` INT NULL DEFAULT '0',
	`TBDGTPrjCode` VARCHAR(30) NULL,
	`TBDGTCmpCode` VARCHAR(30) NULL,
	`TBDGTBraCode` VARCHAR(30) NULL,
	`TBDGTDivCode` VARCHAR(30) NULL,
	`TBDGTDepCode` VARCHAR(30) NULL,
	`TBDGTSecCode` VARCHAR(30) NULL,
	`TBDGRequestCode` VARCHAR(30) NULL,
	`TBDGRequestBy` VARCHAR(160) NULL,
	`TBDGDescription` VARCHAR(200) NULL,
	`TBDGCreateCode` VARCHAR(30) NULL,
	`TBDGCreateBy` VARCHAR(140) NULL,
	`TBDGCreateDate` DATETIME NULL,
	`TBDGEditCode` VARCHAR(30) NULL,
	`TBDGEditBy` VARCHAR(140) NULL,
	`TBDGEditDate` DATETIME NULL,
	`TBDGConfirmStatus` SMALLINT NULL,
	`TBDGConfirmBy` VARCHAR(140) NULL,
	`TBDGConfirmDate` DATETIME NULL,
	`TBDGApproveStatus` SMALLINT NULL,
	`TBDGApproveBy` VARCHAR(140) NULL,
	`TBDGApproveDate` DATETIME NULL,
	`TBDGApproveNote` VARCHAR(80) NULL,
	`TBDGRevision` SMALLINT NULL,
	`TBDGCancelStatus` SMALLINT NULL,
	`TBDGCancelNo` VARCHAR(30) NULL,
	`TBDGCancelBy` VARCHAR(140) NULL,
	`TBDGCancelDate` DATETIME NULL,
	`TBDGCancelNote` VARCHAR(80) NULL,
	`TBDGFlag1` SMALLINT NULL,
	`TBDGFlag2` SMALLINT NULL,
	`TBDGFlag3` SMALLINT NULL,
	PRIMARY KEY (`TBDGNo`),
	KEY `TBDGTACPID` (`TBDGTACPID`),
	KEY `TBDGTACPTACYID` (`TBDGTACPTACYID`),
	KEY `TBDGTCmpCode` (`TBDGTCmpCode`),
	KEY `TBDGTDepCode` (`TBDGTDepCode`),
	KEY `TBDGTDivCode` (`TBDGTDivCode`),
	KEY `TBDGTSecCode` (`TBDGTSecCode`),
	KEY `TPCNTJbMLn` (`TBDGTJbMLn`),
	KEY `TSODTBraCode` (`TBDGTBraCode`),
	KEY `TSODTJobNo` (`TBDGTJobNo`),
	KEY `TSODTPrjCode` (`TBDGTPrjCode`),
	KEY `TTfrFromTStoCode` (`TBDGRequestBy`),
	KEY `VS4TAccountPeriodVS4TBudget` (`TBDGTACPTACYID`, `TBDGTACPID`),
	KEY `VS4TProjectVS4TBudget` (`TBDGTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBudgetMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBudgetMB`;

# ---------- CREATE TABLE `VS4TBudgetMB` ----------

CREATE TABLE `VS4TBudgetMB` (
	`TBDMTBDGNo` VARCHAR(30) NOT NULL,
	`TBDMLn` INT NOT NULL DEFAULT '0',
	`TBDMTACCCode` VARCHAR(30) NULL,
	`TBDMLastAmount` FLOAT NULL DEFAULT '0',
	`TBDMAmount` FLOAT NULL DEFAULT '0',
	`TBDMPerAdap` DOUBLE NULL,
	`TBDMActualAmount` FLOAT NULL DEFAULT '0',
	`TBDMPerActual` DOUBLE NULL,
	`TBDMType` SMALLINT NULL,
	`TBDMM1` FLOAT NULL,
	`TBDMM2` FLOAT NULL,
	`TBDMM3` FLOAT NULL,
	`TBDMM4` FLOAT NULL,
	`TBDMM5` FLOAT NULL,
	`TBDMM6` FLOAT NULL,
	`TBDMM7` FLOAT NULL,
	`TBDMM8` FLOAT NULL,
	`TBDMM9` FLOAT NULL,
	`TBDMM10` FLOAT NULL,
	`TBDMM11` FLOAT NULL,
	`TBDMM12` FLOAT NULL,
	`TBDMFlag1` INT NULL DEFAULT '0',
	`TBDMFlag2` INT NULL DEFAULT '0',
	`TBDMFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TBDMTBDGNo`, `TBDMLn`),
	KEY `TBGTTACCCode` (`TBDMTACCCode`),
	KEY `VS4TACChartVS4TBudgetMB` (`TBDMTACCCode`),
	KEY `VS4TBudgetVS4TBudgetMB` (`TBDMTBDGNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBusinessFlow` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBusinessFlow`;

# ---------- CREATE TABLE `VS4TBusinessFlow` ----------

CREATE TABLE `VS4TBusinessFlow` (
	`TBsFCode` VARCHAR(30) NOT NULL,
	`TBsFName` VARCHAR(100) NULL,
	`TBsFName2` VARCHAR(100) NULL,
	`TBsFFlag1` SMALLINT NULL DEFAULT '0',
	`TBsFFlag2` SMALLINT NULL DEFAULT '0',
	`TBsFFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBsFCode`),
	KEY `TBsFCode` (`TBsFCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBusinessFlowMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBusinessFlowMB`;

# ---------- CREATE TABLE `VS4TBusinessFlowMB` ----------

CREATE TABLE `VS4TBusinessFlowMB` (
	`TBFMTBsFCode` VARCHAR(30) NOT NULL,
	`TBFMTLn` INT NOT NULL DEFAULT '0',
	`TBFMTCmdAlias` VARCHAR(30) NULL,
	`TBFMCommandName` VARCHAR(100) NULL,
	`TBFMDescription` VARCHAR(200) NULL,
	`TBFMFlag1` SMALLINT NULL DEFAULT '0',
	`TBFMFlag2` SMALLINT NULL DEFAULT '0',
	`TBFMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBFMTBsFCode`, `TBFMTLn`),
	KEY `TBFMTBsFCode` (`TBFMTBsFCode`),
	KEY `VS4TBusinessFlowVS4TBusinessFlowMB` (`TBFMTBsFCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBusinessMajor` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBusinessMajor`;

# ---------- CREATE TABLE `VS4TBusinessMajor` ----------

CREATE TABLE `VS4TBusinessMajor` (
	`TBsMCode` VARCHAR(30) NOT NULL,
	`TBsMName` VARCHAR(50) NULL,
	`TBsMName2` VARCHAR(50) NULL,
	`TBsMFlag1` SMALLINT NULL DEFAULT '0',
	`TBsMFlag2` SMALLINT NULL DEFAULT '0',
	`TBsMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBsMCode`),
	KEY `TBsTCode` (`TBsMCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TBusinessType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TBusinessType`;

# ---------- CREATE TABLE `VS4TBusinessType` ----------

CREATE TABLE `VS4TBusinessType` (
	`TBsTCode` VARCHAR(30) NOT NULL,
	`TBstName` VARCHAR(50) NULL,
	`TBstName2` VARCHAR(50) NULL,
	`TBstFlag1` SMALLINT NULL DEFAULT '0',
	`TBstFlag2` SMALLINT NULL DEFAULT '0',
	`TBstFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TBsTCode`),
	KEY `TBsTCode` (`TBsTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCapacityMG` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCapacityMG`;

# ---------- CREATE TABLE `VS4TCapacityMG` ----------

CREATE TABLE `VS4TCapacityMG` (
	`TCPMTAgtCode` VARCHAR(30) NOT NULL,
	`TCPMYear` INT NOT NULL,
	`TCPMWeek` INT NOT NULL,
	`TCPMHour` DOUBLE NULL,
	`TCPMHourExpress` DOUBLE NULL,
	`TCPMFlag1` SMALLINT NULL,
	`TCPMFlag2` SMALLINT NULL,
	`TCPMFlag3` SMALLINT NULL,
	PRIMARY KEY (`TCPMTAgtCode`, `TCPMYear`, `TCPMWeek`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCapacitySect` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCapacitySect`;

# ---------- CREATE TABLE `VS4TCapacitySect` ----------

CREATE TABLE `VS4TCapacitySect` (
	`TCPSTSecCode` VARCHAR(30) NOT NULL,
	`TCPSYear` INT NOT NULL,
	`TCPSWeek` INT NOT NULL,
	`TCPSHour` DOUBLE NULL,
	`TCPSHourOT15` DOUBLE NULL,
	`TCPSHourOT2` DOUBLE NULL,
	`TCPSHourOT3` DOUBLE NULL,
	`TCPSTotalHour` DOUBLE NULL,
	`TCPSFlag1` SMALLINT NULL,
	`TCPSFlag2` SMALLINT NULL,
	`TCPSFlag3` SMALLINT NULL,
	PRIMARY KEY (`TCPSTSecCode`, `TCPSYear`, `TCPSWeek`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCashDeposit` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCashDeposit`;

# ---------- CREATE TABLE `VS4TCashDeposit` ----------

CREATE TABLE `VS4TCashDeposit` (
	`TDPSNo` VARCHAR(30) NOT NULL,
	`TDPSDate` DATETIME NULL,
	`TDPSMode` SMALLINT NULL DEFAULT '0',
	`TDPSRefNo` VARCHAR(50) NULL,
	`TDPSRefDate` DATETIME NULL,
	`TDPSDocType` INT NULL DEFAULT '0',
	`TDPSGLMethod` INT NULL DEFAULT '0',
	`TDPSTGLTNo` VARCHAR(30) NULL,
	`TDPSTTeTNo` VARCHAR(30) NULL,
	`TDPSTBnkCode` VARCHAR(15) NULL,
	`TDPSTCBBNo` VARCHAR(30) NULL,
	`TDPSTPrjCode` VARCHAR(30) NULL,
	`TDPSTBraCode` VARCHAR(30) NULL,
	`TDPSTEmpCode` VARCHAR(30) NULL,
	`TDPSCashTotal` FLOAT NULL,
	`TDPSChequeTotal` FLOAT NULL,
	`TDPSGrandTotal` FLOAT NULL,
	`TDPSFee` FLOAT NULL DEFAULT '0',
	`TDPSAdjustTotal` FLOAT NULL DEFAULT '0',
	`TDPSNetTotal` FLOAT NULL DEFAULT '0',
	`TDPSRequestCode` VARCHAR(30) NULL,
	`TDPSRequestBy` VARCHAR(160) NULL,
	`TDPSDescription` VARCHAR(200) NULL,
	`TDPSCreateCode` VARCHAR(30) NULL,
	`TDPSCreateBy` VARCHAR(140) NULL,
	`TDPSCreateDate` DATETIME NULL,
	`TDPSEditCode` VARCHAR(30) NULL,
	`TDPSEditBy` VARCHAR(140) NULL,
	`TDPSEditDate` DATETIME NULL,
	`TDPSConfirmStatus` SMALLINT NULL,
	`TDPSConfirmBy` VARCHAR(140) NULL,
	`TDPSConfirmDate` DATETIME NULL,
	`TDPSApproveStatus` SMALLINT NULL,
	`TDPSApproveBy` VARCHAR(140) NULL,
	`TDPSApproveDate` DATETIME NULL,
	`TDPSApproveNote` VARCHAR(80) NULL,
	`TDPSRevision` SMALLINT NULL,
	`TDPSCancelStatus` SMALLINT NULL,
	`TDPSCancelNo` VARCHAR(30) NULL,
	`TDPSCancelBy` VARCHAR(140) NULL,
	`TDPSCancelDate` DATETIME NULL,
	`TDPSCancelNote` VARCHAR(80) NULL,
	`TDPSFlag1` SMALLINT NULL,
	`TDPSFlag2` SMALLINT NULL,
	`TDPSFlag3` SMALLINT NULL,
	PRIMARY KEY (`TDPSNo`),
	KEY `TDPSTBnkCode` (`TDPSTGLTNo`),
	KEY `TDPSTBnkCode1` (`TDPSTCBBNo`),
	KEY `TDPSTGLTNo` (`TDPSTTeTNo`),
	KEY `TDPSTPrjCode` (`TDPSTBnkCode`),
	KEY `TInvTCurCode` (`TDPSTEmpCode`),
	KEY `TPCNTJbMLn` (`TDPSNetTotal`),
	KEY `TSODTBraCode` (`TDPSTBraCode`),
	KEY `TSODTJobNo` (`TDPSFee`),
	KEY `TSODTPrjCode` (`TDPSTPrjCode`),
	KEY `TTfrFromTStoCode` (`TDPSRequestBy`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCashDepositMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCashDepositMB`;

# ---------- CREATE TABLE `VS4TCashDepositMB` ----------

CREATE TABLE `VS4TCashDepositMB` (
	`TDPMTDPSNo` VARCHAR(30) NOT NULL,
	`TDPMLn` INT NOT NULL DEFAULT '0',
	`TDPMDepositType` VARCHAR(30) NULL,
	`TDPMTCBBNoF` VARCHAR(30) NULL,
	`TDPMTCBBNo` VARCHAR(30) NULL,
	`TDPMCashAmount` FLOAT NULL DEFAULT '0',
	`TDPMFee` FLOAT NULL DEFAULT '0',
	`TDPMTCurCode` VARCHAR(5) NULL,
	`TDPMExchangeRate` FLOAT NULL DEFAULT '0',
	`TDPMAmountRate` FLOAT NULL DEFAULT '0',
	`TDPMAdjustTotal` FLOAT NULL DEFAULT '0',
	`TDPMTotal` FLOAT NULL DEFAULT '0',
	`TDPMFlag1` SMALLINT NULL DEFAULT '0',
	`TDPMFlag2` SMALLINT NULL DEFAULT '0',
	`TDPMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDPMTDPSNo`, `TDPMLn`),
	KEY `TACMBookTransOut` (`TDPMTCBBNo`),
	KEY `TACMTGLBCode` (`TDPMTCurCode`),
	KEY `VS4TCashDepositVS4TCashDepositMB` (`TDPMTDPSNo`),
	KEY `VS4TCompanyBankVS4TCashDepositMB` (`TDPMTCBBNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCashRequest` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCashRequest`;

# ---------- CREATE TABLE `VS4TCashRequest` ----------

CREATE TABLE `VS4TCashRequest` (
	`TCRQNo` VARCHAR(30) NOT NULL,
	`TCRQDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCRQType` SMALLINT NULL DEFAULT '0',
	`TCRQDetailType` SMALLINT NULL DEFAULT '0',
	`TCRQBalanceFlag` SMALLINT NULL DEFAULT '0',
	`TCRQBaseArrear` FLOAT NULL DEFAULT '0',
	`TCRQArrear` FLOAT NULL DEFAULT '0',
	`TCRQRefNo` VARCHAR(30) NULL,
	`TCRQRefDate` DATETIME NULL,
	`TCRQRefNo2` VARCHAR(30) NULL,
	`TCRQPaymentStatus` SMALLINT NULL DEFAULT '0',
	`TCRQTBraCode` VARCHAR(30) NULL,
	`TCRQTAPNCode` VARCHAR(30) NULL,
	`TCRQPayTo` VARCHAR(160) NULL,
	`TCRQAddress` VARCHAR(255) NULL,
	`TCRQCurrency` VARCHAR(4) NULL,
	`TCRQSubTotal` FLOAT NULL DEFAULT '0',
	`TCRQCurRate` VARCHAR(50) NULL,
	`TCRQCurAmount` FLOAT NULL DEFAULT '0',
	`TCRQCurDiscount` FLOAT NULL DEFAULT '0',
	`TCRQDiscount` FLOAT NULL DEFAULT '0',
	`TCRQPayLess` FLOAT NULL DEFAULT '0',
	`TCRQAdjustTotal` FLOAT NULL DEFAULT '0',
	`TCRQFee` FLOAT NULL DEFAULT '0',
	`TCRQNetAmount` FLOAT NULL DEFAULT '0',
	`TCRQTaxBase` FLOAT NULL DEFAULT '0',
	`TCRQWTAXTotal` FLOAT NULL DEFAULT '0',
	`TCRQTaxBase2` FLOAT NULL DEFAULT '0',
	`TCRQWTAXTotal2` FLOAT NULL DEFAULT '0',
	`TCRQTotal` FLOAT NULL DEFAULT '0',
	`TCRQNote` VARCHAR(255) NULL,
	`TCRQTGLBCode` VARCHAR(30) NULL,
	`TCRQTPrjCode` VARCHAR(30) NULL,
	`TCRQGLMethod` SMALLINT NULL DEFAULT '0',
	`TCRQTGLTNo` VARCHAR(30) NULL,
	`TCRQTTeTNo` VARCHAR(30) NULL,
	`TCRQVATNo` VARCHAR(30) NULL,
	`TCRQTaxPeriodNo` DATETIME NULL,
	`TCRQTaxPeriodType` SMALLINT NULL,
	`TCRQTaxRefund` SMALLINT NULL,
	`TCRQPayType` SMALLINT NULL DEFAULT '0',
	`TCRQTaxNo` VARCHAR(30) NULL,
	`TCRQWTaxPeriodNo` VARCHAR(10) NULL,
	`TCRQWTaxPeriodType` SMALLINT NULL,
	`TCRQChequePayment` FLOAT NULL DEFAULT '0',
	`TCRQCashPayment` FLOAT NULL DEFAULT '0',
	`TCRQBankPayment` FLOAT NULL DEFAULT '0',
	`TCRQCutDeposit` FLOAT NULL DEFAULT '0',
	`TCRQCommissionBase` FLOAT NULL DEFAULT '0',
	`TCRQCommissionRate` DOUBLE NULL DEFAULT '0',
	`TCRQCommission` FLOAT NULL DEFAULT '0',
	`TCRQInterestRate` DOUBLE NULL DEFAULT '0',
	`TCRQInterestTotal` FLOAT NULL DEFAULT '0',
	`TCRQCardFlag` SMALLINT NULL DEFAULT '0',
	`TCRQTaxFlag` SMALLINT NULL DEFAULT '0',
	`TCRQCreateCode` VARCHAR(30) NULL,
	`TCRQCreateBy` VARCHAR(140) NULL,
	`TCRQCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCRQEditCode` VARCHAR(30) NULL,
	`TCRQEditBy` VARCHAR(140) NULL,
	`TCRQEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCRQConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TCRQConfirmBy` VARCHAR(140) NULL,
	`TCRQConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCRQApproveStatus` SMALLINT NULL DEFAULT '0',
	`TCRQApproveBy` VARCHAR(140) NULL,
	`TCRQApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCRQApproveNote` VARCHAR(80) NULL,
	`TCRQRevision` SMALLINT NULL DEFAULT '0',
	`TCRQCancelStatus` SMALLINT NULL DEFAULT '0',
	`TCRQCancelNo` VARCHAR(30) NULL,
	`TCRQCancelBy` VARCHAR(140) NULL,
	`TCRQCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCRQCancelNote` VARCHAR(80) NULL,
	`TCRQFlag1` SMALLINT NULL DEFAULT '0',
	`TCRQFlag2` SMALLINT NULL DEFAULT '0',
	`TCRQFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCRQNo`),
	KEY `TAPVPrepaid` (`TCRQPaymentStatus`),
	KEY `TAPVTAPNCode` (`TCRQTAPNCode`),
	KEY `TGLTTGLBCode` (`TCRQTGLBCode`),
	KEY `TIAPSupAddress` (`TCRQAddress`),
	KEY `TRVHTPrjCode` (`TCRQTPrjCode`),
	KEY `VS4TProjectVS4TCashRequest` (`TCRQTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCashRequestMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCashRequestMB`;

# ---------- CREATE TABLE `VS4TCashRequestMB` ----------

CREATE TABLE `VS4TCashRequestMB` (
	`TCRMTCRQNo` VARCHAR(30) NOT NULL,
	`TCRMLn` INT NOT NULL DEFAULT '0',
	`TCRMType` INT NULL DEFAULT '0',
	`TCRMRefAPBillNo` VARCHAR(30) NULL,
	`TCRMRefDocNo` VARCHAR(30) NULL,
	`TCRMRefDocDate` DATETIME NULL,
	`TCRMRefNo` VARCHAR(30) NULL,
	`TCRMRefNo2` VARCHAR(30) NULL,
	`TCRMRefNo3` VARCHAR(30) NULL,
	`TCRMRefDocAmount` FLOAT NULL DEFAULT '0',
	`TCRMRefDocType` VARCHAR(30) NULL,
	`TCRMRefDueDate` DATETIME NULL,
	`TCRMCurrency` VARCHAR(4) NULL,
	`TCRMCurRate` DOUBLE NULL DEFAULT '0',
	`TCRMCurSubTotal` FLOAT NULL DEFAULT '0',
	`TCRMCurDiscount` FLOAT NULL DEFAULT '0',
	`TCRMCurAmount` FLOAT NULL DEFAULT '0',
	`TCRMAmountRate` FLOAT NULL DEFAULT '0',
	`TCRMTaxBase` FLOAT NULL DEFAULT '0',
	`TCRMVATType` SMALLINT NULL,
	`TCRMVATRate` DOUBLE NULL,
	`TCRMVATTotal` FLOAT NULL,
	`TCRMVATNo` VARCHAR(30) NULL,
	`TCRMTAXNo` VARCHAR(30) NULL,
	`TCRMWTAXRate` DOUBLE NULL DEFAULT '0',
	`TCRMWTAXTotal` FLOAT NULL DEFAULT '0',
	`TCRMWTAXCond` SMALLINT NULL DEFAULT '0',
	`TCRMWTAXDesc` VARCHAR(250) NULL,
	`TCRMCommissionBase` FLOAT NULL DEFAULT '0',
	`TCRMCommissionRate` DOUBLE NULL DEFAULT '0',
	`TCRMCommission` FLOAT NULL DEFAULT '0',
	`TCRMInterestRate` DOUBLE NULL DEFAULT '0',
	`TCRMInterestTotal` FLOAT NULL DEFAULT '0',
	`TCRMTOEXCode` VARCHAR(30) NULL,
	`TCRMDOVAT` SMALLINT NULL DEFAULT '0',
	`TCRMNote` VARCHAR(255) NULL,
	`TCRMNote2` VARCHAR(255) NULL,
	`TCRMFlag1` INT NULL DEFAULT '0',
	`TCRMFlag2` INT NULL DEFAULT '0',
	`TCRMFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TCRMTCRQNo`, `TCRMLn`),
	KEY `TCHRRefNo` (`TCRMRefDocAmount`),
	KEY `TCHRTCHSNo` (`TCRMTCRQNo`),
	KEY `TCHRTCHSTGLTNo` (`TCRMLn`),
	KEY `TRDRTOINCode` (`TCRMTOEXCode`),
	KEY `VS4TCashRequestVS4TCashRequestMB` (`TCRMTCRQNo`),
	KEY `VS4TOtherExpenseVS4TCashRequestMB` (`TCRMTOEXCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCategory` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCategory`;

# ---------- CREATE TABLE `VS4TCategory` ----------

CREATE TABLE `VS4TCategory` (
	`TCatCode` VARCHAR(30) NOT NULL,
	`TCatName` VARCHAR(35) NULL,
	`TCatName2` VARCHAR(35) NULL,
	`TCatDescription` VARCHAR(255) NULL,
	`TCatIcon1` VARCHAR(50) NULL,
	`TCatImage1` VARCHAR(50) NULL,
	`TCatFlag1` SMALLINT NULL DEFAULT '0',
	`TCatFlag2` SMALLINT NULL DEFAULT '0',
	`TCatFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCatCode`),
	KEY `TCatCode` (`TCatCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCategoryMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCategoryMB`;

# ---------- CREATE TABLE `VS4TCategoryMB` ----------

CREATE TABLE `VS4TCategoryMB` (
	`TCaMTPOSCode` VARCHAR(30) NOT NULL,
	`TCaMTCatCode` VARCHAR(30) NOT NULL,
	`TCaMFlag1` SMALLINT NULL DEFAULT '0',
	`TCaMFlag2` SMALLINT NULL DEFAULT '0',
	`TCaMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCaMTPOSCode`, `TCaMTCatCode`),
	KEY `ProductMemberCategoryID` (`TCaMTCatCode`),
	KEY `ProductMemberProductID1` (`TCaMTPOSCode`),
	KEY `VS4TCategoryVS4TCategoryMB` (`TCaMTCatCode`),
	KEY `VS4TPOSVS4TCategoryMB` (`TCaMTPOSCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCategoryMBDwg` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCategoryMBDwg`;

# ---------- CREATE TABLE `VS4TCategoryMBDwg` ----------

CREATE TABLE `VS4TCategoryMBDwg` (
	`TCaDTDwgCode` VARCHAR(30) NOT NULL,
	`TCaDTCatCode` VARCHAR(30) NOT NULL,
	`TCaDFlag1` SMALLINT NULL DEFAULT '0',
	`TCaDFlag2` SMALLINT NULL DEFAULT '0',
	`TCaDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCaDTDwgCode`, `TCaDTCatCode`),
	KEY `ProductMemberCategoryID` (`TCaDTCatCode`),
	KEY `ProductMemberProductID1` (`TCaDTDwgCode`),
	KEY `VS4TCategoryVS4TCatagoryMBDwg` (`TCaDTCatCode`),
	KEY `VS4TDrawingVS4TCatagoryMBDwg` (`TCaDTDwgCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCertificate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCertificate`;

# ---------- CREATE TABLE `VS4TCertificate` ----------

CREATE TABLE `VS4TCertificate` (
	`TCerNo` VARCHAR(30) NOT NULL,
	`TCerDate` DATETIME NULL,
	`TCerRefNo` VARCHAR(50) NULL,
	`TCerRefDate` DATETIME NULL,
	`TCerTARNCode` VARCHAR(30) NULL,
	`TCerTBraCode` VARCHAR(30) NULL,
	`TCerCustomerName` VARCHAR(160) NULL,
	`TCerCondition` SMALLINT NULL DEFAULT '0',
	`TCerNote` VARCHAR(150) NULL,
	`TCerCreateCode` VARCHAR(30) NULL,
	`TCerCreateBy` VARCHAR(140) NULL,
	`TCerCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCerEditCode` VARCHAR(30) NULL,
	`TCerEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCerEditBy` VARCHAR(140) NULL,
	`TCerConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TCerConfirmBy` VARCHAR(140) NULL,
	`TCerConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCerApproveStatus` SMALLINT NULL DEFAULT '0',
	`TCerApproveBy` VARCHAR(140) NULL,
	`TCerApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCerApproveNote` VARCHAR(80) NULL,
	`TCerConfidential` SMALLINT NULL DEFAULT '0',
	`TCerCancelStatus` SMALLINT NULL DEFAULT '0',
	`TCerCancelNo` VARCHAR(30) NULL,
	`TCerCancelBy` VARCHAR(140) NULL,
	`TCerCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCerCancelNote` VARCHAR(80) NULL,
	`TCerFlag1` SMALLINT NULL DEFAULT '0',
	`TCerFlag2` SMALLINT NULL DEFAULT '0',
	`TCerFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCerNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCertificateSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCertificateSub`;

# ---------- CREATE TABLE `VS4TCertificateSub` ----------

CREATE TABLE `VS4TCertificateSub` (
	`TCeMTCerNo` VARCHAR(30) NOT NULL,
	`TCeMLn` INT NOT NULL DEFAULT '0',
	`TCeMProductSerial` VARCHAR(100) NULL,
	`TCeMProductCode` VARCHAR(100) NULL,
	`TCeMProductName` VARCHAR(100) NULL,
	`TCeMProductDesc` VARCHAR(100) NULL,
	`TCeMQuantity` DOUBLE NULL DEFAULT '0',
	`TCeMUnit` VARCHAR(10) NULL,
	`TCeMQuantity2` DOUBLE NULL DEFAULT '0',
	`TCeMUnit2` VARCHAR(10) NULL,
	`TCeMQuantity3` DOUBLE NULL DEFAULT '0',
	`TCeMUnit3` VARCHAR(10) NULL,
	`TCeMStartDate` DATETIME NULL,
	`TCeMExpireDate` DATETIME NULL,
	`TCeMWarrantyText` DOUBLE NULL DEFAULT '0',
	`TCeMWarrantyBy` VARCHAR(200) NULL,
	`TCeMRefund` SMALLINT NULL DEFAULT '0',
	`TCeMNetPrice` FLOAT NULL DEFAULT '0',
	`TCeMFlag1` SMALLINT NULL DEFAULT '0',
	`TCeMFlag2` SMALLINT NULL DEFAULT '0',
	`TCeMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCeMTCerNo`, `TCeMLn`),
	KEY `VS4TCertificatedVS4TCertificatedMB` (`TCeMTCerNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TChequeBackType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TChequeBackType`;

# ---------- CREATE TABLE `VS4TChequeBackType` ----------

CREATE TABLE `VS4TChequeBackType` (
	`TCQBCode` VARCHAR(30) NOT NULL,
	`TCQBName` VARCHAR(100) NULL,
	`TCQBName2` VARCHAR(100) NULL,
	`TCQBBaseStatus` SMALLINT NULL DEFAULT '0',
	`TCQBFlag1` SMALLINT NULL DEFAULT '0',
	`TCQBFlag2` SMALLINT NULL DEFAULT '0',
	`TCQBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCQBCode`),
	KEY `TBnkCode` (`TCQBCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TChequeRec` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TChequeRec`;

# ---------- CREATE TABLE `VS4TChequeRec` ----------

CREATE TABLE `VS4TChequeRec` (
	`TCHRNo` VARCHAR(30) NOT NULL,
	`TCHRTBnkCode` VARCHAR(30) NULL,
	`TCHRTCBBNo` VARCHAR(30) NULL,
	`TCHRTRVRTRVHNo` VARCHAR(30) NULL,
	`TCHRTRVRLn` INT NULL DEFAULT '0',
	`TCHRTPrjCode` VARCHAR(30) NULL,
	`TCHRChqDate` DATETIME NULL,
	`TCHRTotal` FLOAT NULL DEFAULT '0',
	`TCHRTCurCode` VARCHAR(30) NULL,
	`TCHRCurRate` FLOAT NULL DEFAULT '0',
	`TCHRTotalRate` FLOAT NULL DEFAULT '0',
	`TCHRAvailable` FLOAT NULL,
	`TCHRPayment` FLOAT NULL,
	`TCHRDepositCount` SMALLINT NULL DEFAULT '0',
	`TCHRTARNCode` VARCHAR(220) NULL,
	`TCHRPayChqDate` DATETIME NULL,
	`TCHRCashDate` DATETIME NULL,
	`TCHRChqStatus` INT NULL DEFAULT '0',
	`TCHRChqRef` VARCHAR(30) NULL,
	`TCHRBankBranch` VARCHAR(50) NULL,
	`TCHRTGLTNo` VARCHAR(30) NULL,
	`TCHRDescription` VARCHAR(220) NULL,
	`TCHRChqOnHandBy` VARCHAR(140) NULL,
	`TCHRChqOnHandDate` DATETIME NULL,
	`TCHRChqDepBy` VARCHAR(140) NULL,
	`TCHRChqDepDate` DATETIME NULL,
	`TCHRChqPassBy` VARCHAR(140) NULL,
	`TCHRChqPassDate` DATETIME NULL,
	`TCHRChqBackBy` VARCHAR(140) NULL,
	`TCHRChqBackDate` DATETIME NULL,
	`TCHRChqBackNote` VARCHAR(255) NULL,
	`TCHRCreateCode` VARCHAR(30) NULL,
	`TCHRCreateDate` DATETIME NULL,
	`TCHREditCode` VARCHAR(30) NULL,
	`TCHREditDate` DATETIME NULL,
	`TCHRApproveStatus` SMALLINT NULL DEFAULT '0',
	`TCHRApproveBy` VARCHAR(140) NULL,
	`TCHRApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCHRApproveNote` VARCHAR(80) NULL,
	`TCHRConfidential` SMALLINT NULL DEFAULT '0',
	`TCHRCancelStatus` SMALLINT NULL DEFAULT '0',
	`TCHRCancelNo` VARCHAR(30) NULL,
	`TCHRCancelBy` VARCHAR(140) NULL,
	`TCHRCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCHRCancelNote` VARCHAR(80) NULL,
	`TCHRFlag1` SMALLINT NULL DEFAULT '0',
	`TCHRFlag2` SMALLINT NULL DEFAULT '0',
	`TCHRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCHRNo`),
	KEY `TCHRTBnkCode` (`TCHRBankBranch`),
	KEY `TCHRTCBBNo` (`TCHRTCBBNo`),
	KEY `TCHRTCurCode` (`TCHRTCurCode`),
	KEY `TCHRTCurCode1` (`TCHRTBnkCode`),
	KEY `TCHRTCurCode2` (`TCHRTPrjCode`),
	KEY `TCHRTPrjCode` (`TCHRTGLTNo`),
	KEY `TCHSNo` (`TCHRNo`),
	KEY `TCHSTGLPTGLTNo` (`TCHRTRVRTRVHNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TChequeRec2IV` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TChequeRec2IV`;

# ---------- CREATE TABLE `VS4TChequeRec2IV` ----------

CREATE TABLE `VS4TChequeRec2IV` (
	`TR2ITCHRNo` VARCHAR(30) NOT NULL,
	`TR2ITIPyTIvoNo` VARCHAR(30) NOT NULL,
	`TR2ITIPyLn` INT NOT NULL DEFAULT '0',
	`TR2ITBnkCode` VARCHAR(10) NULL,
	`TR2IFlag1` SMALLINT NULL DEFAULT '0',
	`TR2IFlag2` SMALLINT NULL DEFAULT '0',
	`TR2IFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TR2ITCHRNo`, `TR2ITIPyTIvoNo`, `TR2ITIPyLn`),
	KEY `TCHSNo` (`TR2ITCHRNo`),
	KEY `TCHSTBnkCode` (`TR2ITBnkCode`),
	KEY `TCHSTGLPTGLTNo` (`TR2ITIPyTIvoNo`),
	KEY `VS4TChequeRecVS4TChequeRec2IV` (`TR2ITCHRNo`),
	KEY `VS4TInvoicePaymentVS4TChequeRec2IV` (`TR2ITIPyTIvoNo`, `TR2ITIPyLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TChequeRec2RV` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TChequeRec2RV`;

# ---------- CREATE TABLE `VS4TChequeRec2RV` ----------

CREATE TABLE `VS4TChequeRec2RV` (
	`TR2RTCHRNo` VARCHAR(30) NOT NULL,
	`TR2RTRVRTRVHNo` VARCHAR(30) NOT NULL,
	`TR2RTRVRLn` INT NOT NULL DEFAULT '0',
	`TR2RTBnkCode` VARCHAR(10) NULL,
	`TR2RFlag1` SMALLINT NULL DEFAULT '0',
	`TR2RFlag2` SMALLINT NULL DEFAULT '0',
	`TR2RFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TR2RTCHRNo`, `TR2RTRVRTRVHNo`, `TR2RTRVRLn`),
	KEY `TCHSNo` (`TR2RTCHRNo`),
	KEY `TCHSTGLPTGLTNo` (`TR2RTRVRTRVHNo`),
	KEY `TR2ITBnkCode` (`TR2RTBnkCode`),
	KEY `VS4TChequeRecVS4TChequeRec2RV` (`TR2RTCHRNo`),
	KEY `VS4TRVReceiveVS4TChequeRec2RV` (`TR2RTRVRTRVHNo`, `TR2RTRVRLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TChequeSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TChequeSub`;

# ---------- CREATE TABLE `VS4TChequeSub` ----------

CREATE TABLE `VS4TChequeSub` (
	`TCHSNo` VARCHAR(30) NOT NULL,
	`TCHSTBnkCode` VARCHAR(10) NULL,
	`TCHSTCBBNo` VARCHAR(30) NULL,
	`TCHSTPVPTAPVNo` VARCHAR(30) NULL,
	`TCHSTPVPLn` INT NULL DEFAULT '0',
	`TCHSTPrjCode` VARCHAR(30) NULL,
	`TCHSChqDate` DATETIME NULL,
	`TCHSTCurCode` VARCHAR(30) NULL,
	`TCHSTotal` FLOAT NULL DEFAULT '0',
	`TCHSCurRate` DOUBLE NULL DEFAULT '0',
	`TCHSTotalRate` FLOAT NULL DEFAULT '0',
	`TCHSAvailable` FLOAT NULL,
	`TCHSPayment` FLOAT NULL,
	`TCHSDepositCount` SMALLINT NULL DEFAULT '0',
	`TCHSTAPNCode` VARCHAR(30) NULL,
	`TCHSPayTo` VARCHAR(255) NULL,
	`TCHSPayFor` VARCHAR(255) NULL,
	`TCHSPayChqDate` DATETIME NULL,
	`TCHSCashDate` DATETIME NULL,
	`TCHSDescription` VARCHAR(255) NULL,
	`TCHSDescription2` VARCHAR(255) NULL,
	`TCHSChqStatus` SMALLINT NULL DEFAULT '0',
	`TCHSChqRef` VARCHAR(30) NULL,
	`TCHSTGLTNo` VARCHAR(30) NULL,
	`TCHSChqOnHandBy` VARCHAR(140) NULL,
	`TCHSChqOnHandDate` DATETIME NULL,
	`TCHSChqDepBy` VARCHAR(140) NULL,
	`TCHSChqDepDate` DATETIME NULL,
	`TCHSChqPassBy` VARCHAR(140) NULL,
	`TCHSChqPassDate` DATETIME NULL,
	`TCHSChqBackBy` VARCHAR(140) NULL,
	`TCHSChqBackDate` DATETIME NULL,
	`TCHSCreateCode` VARCHAR(30) NULL,
	`TCHSCreateDate` DATETIME NULL,
	`TCHSEditCode` VARCHAR(30) NULL,
	`TCHSEditDate` DATETIME NULL,
	`TCHSApproveStatus` SMALLINT NULL DEFAULT '0',
	`TCHSApproveBy` VARCHAR(140) NULL,
	`TCHSApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCHSApproveNote` VARCHAR(80) NULL,
	`TCHSCancelStatus` SMALLINT NULL DEFAULT '0',
	`TCHSCancelNo` VARCHAR(30) NULL,
	`TCHSCancelBy` VARCHAR(140) NULL,
	`TCHSCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCHSCancelNote` VARCHAR(80) NULL,
	`TCHSFlag1` SMALLINT NULL DEFAULT '0',
	`TCHSFlag2` SMALLINT NULL DEFAULT '0',
	`TCHSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCHSNo`),
	KEY `TCHRTGLTNo` (`TCHSTGLTNo`),
	KEY `TCHSTBnkCode` (`TCHSTBnkCode`),
	KEY `TCHSTCHBCode` (`TCHSTPrjCode`),
	KEY `TCHSTCHBCode1` (`TCHSTCBBNo`),
	KEY `TCHSTCurCode` (`TCHSTCurCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TChequeSub2IV` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TChequeSub2IV`;

# ---------- CREATE TABLE `VS4TChequeSub2IV` ----------

CREATE TABLE `VS4TChequeSub2IV` (
	`TS2ITCHSNo` VARCHAR(30) NOT NULL,
	`TS2ITPIPTIAPNo` VARCHAR(30) NOT NULL,
	`TS2ITPIPLn` INT NOT NULL DEFAULT '0',
	`TS2ITBnkCode` VARCHAR(10) NULL,
	`TS2IFlag1` SMALLINT NULL DEFAULT '0',
	`TS2IFlag2` SMALLINT NULL DEFAULT '0',
	`TS2IFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TS2ITCHSNo`, `TS2ITPIPTIAPNo`, `TS2ITPIPLn`),
	KEY `TR2ITBnkCode` (`TS2ITBnkCode`),
	KEY `VS4TAPInvoicePayVS4TChequeSub2IV` (`TS2ITPIPTIAPNo`, `TS2ITPIPLn`),
	KEY `VS4TChequeSubVS4TChequeSub2IV` (`TS2ITCHSNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TChequeSub2PV` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TChequeSub2PV`;

# ---------- CREATE TABLE `VS4TChequeSub2PV` ----------

CREATE TABLE `VS4TChequeSub2PV` (
	`TS2PTCHSNo` VARCHAR(30) NOT NULL,
	`TS2PTPVPTAPVNo` VARCHAR(30) NOT NULL,
	`TS2PTPVPLn` INT NOT NULL DEFAULT '0',
	`TS2PTBnkCode` VARCHAR(10) NULL,
	`TS2PFlag1` SMALLINT NULL DEFAULT '0',
	`TS2PFlag2` SMALLINT NULL DEFAULT '0',
	`TS2PFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TS2PTCHSNo`, `TS2PTPVPTAPVNo`, `TS2PTPVPLn`),
	KEY `TR2ITBnkCode` (`TS2PTBnkCode`),
	KEY `VS4TAPVoucherPayVS4TChequeSub2PV` (`TS2PTPVPTAPVNo`, `TS2PTPVPLn`),
	KEY `VS4TChequeSubVS4TChequeSub2PV` (`TS2PTCHSNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCode` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCode`;

# ---------- CREATE TABLE `VS4TCode` ----------

CREATE TABLE `VS4TCode` (
	`TCodAlias` VARCHAR(30) NOT NULL,
	`TCodTCoGAlias` VARCHAR(30) NULL,
	`TCodName` VARCHAR(100) NULL,
	`TCodName2` VARCHAR(100) NULL,
	`TCodCapture` SMALLINT NULL DEFAULT '0',
	`TCodCaptureWhere` VARCHAR(200) NULL,
	`TCodLoad` SMALLINT NULL DEFAULT '0',
	`TCodTable` VARCHAR(18) NULL,
	`TCodPrimaryKey` VARCHAR(18) NULL,
	`TCodCancelKey` VARCHAR(18) NULL,
	`TCodFormat` VARCHAR(255) NULL,
	`TCodFormat2` VARCHAR(255) NULL,
	`TCodSupportManual` SMALLINT NULL DEFAULT '0',
	`TCodUserEdit` SMALLINT NULL DEFAULT '0',
	`TCodCounter` INT NULL DEFAULT '1',
	`TCodBaseCounter` INT NULL DEFAULT '0',
	`TCodResetNumber` INT NULL DEFAULT '0',
	`TCodMethod` SMALLINT NULL DEFAULT '0',
	`TCodDataSource` SMALLINT NULL DEFAULT '0',
	`TCodResetType` VARCHAR(1) NULL,
	`TCodResetLastDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCodResetCount` INT NULL DEFAULT '0',
	`TCodAcceptChar` VARCHAR(100) NULL,
	`TCodNumberOnly` SMALLINT NULL DEFAULT '0',
	`TCodFirstChar` SMALLINT NULL DEFAULT '0',
	`TCodEngLishNumber` SMALLINT NULL DEFAULT '0',
	`TCodAcceptSpace` SMALLINT NULL DEFAULT '0',
	`TCodStartupNumber` INT NULL DEFAULT '1',
	`TCodStartupNumber2` INT NULL DEFAULT '1',
	`TCodOption1` SMALLINT NULL DEFAULT '0',
	`TCodIsSystem` SMALLINT NULL DEFAULT '0',
	`TCodFixLength` SMALLINT NULL DEFAULT '0',
	`TCodManualFormat` VARCHAR(30) NULL,
	`TCodPrintButton` SMALLINT NULL DEFAULT '0',
	`TCodPrintCancel` SMALLINT NULL DEFAULT '0',
	`TCodCreateCode` VARCHAR(30) NULL,
	`TCodCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCodEditCode` VARCHAR(30) NULL,
	`TCodEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCodFlag1` SMALLINT NULL DEFAULT '0',
	`TCodFlag2` SMALLINT NULL DEFAULT '0',
	`TCodFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCodAlias`),
	KEY `TCode` (`TCodResetCount`),
	KEY `TCodePrimaryKey` (`TCodPrimaryKey`),
	KEY `TCodInternalCode` (`TCodAlias`),
	KEY `TCodPrimaryKey` (`TCodCancelKey`),
	KEY `VS4TCodeGroupVS4TCode` (`TCodTCoGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCodeGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCodeGroup`;

# ---------- CREATE TABLE `VS4TCodeGroup` ----------

CREATE TABLE `VS4TCodeGroup` (
	`TCoGAlias` VARCHAR(30) NOT NULL,
	`TCoGTCmGAlias` VARCHAR(30) NULL,
	`TCoGName` VARCHAR(80) NULL,
	`TCoGName2` VARCHAR(80) NULL,
	`TCoGTable` VARCHAR(18) NULL,
	`TCoGPrimaryKey` VARCHAR(18) NULL,
	`TCoGCancelKey` VARCHAR(18) NULL,
	`TCoGCustom1` VARCHAR(30) NULL,
	`TCoGCustom1E` VARCHAR(30) NULL,
	`TCoGCustom2` VARCHAR(30) NULL,
	`TCoGCustom2E` VARCHAR(30) NULL,
	`TCoGCustom3` VARCHAR(30) NULL,
	`TCoGCustom3E` VARCHAR(30) NULL,
	`TCoGCustom4` VARCHAR(30) NULL,
	`TCoGCustom4E` VARCHAR(30) NULL,
	`TCoGCustom5` VARCHAR(30) NULL,
	`TCoGCustom5E` VARCHAR(30) NULL,
	`TCoGCustom6` VARCHAR(30) NULL,
	`TCoGCustom6E` VARCHAR(30) NULL,
	`TCoGCustom7` VARCHAR(30) NULL,
	`TCoGCustom7E` VARCHAR(30) NULL,
	`TCoGCustom8` VARCHAR(30) NULL,
	`TCoGCustom8E` VARCHAR(30) NULL,
	`TCoGCustom9` VARCHAR(30) NULL,
	`TCoGCustom9E` VARCHAR(30) NULL,
	`TCoGCustom10` VARCHAR(30) NULL,
	`TCoGCustom10E` VARCHAR(30) NULL,
	`TCoGCustom11` VARCHAR(30) NULL,
	`TCoGCustom11E` VARCHAR(30) NULL,
	`TCoGCustom12` VARCHAR(30) NULL,
	`TCoGCustom12E` VARCHAR(30) NULL,
	`TCoGCustom13` VARCHAR(30) NULL,
	`TCoGCustom13E` VARCHAR(30) NULL,
	`TCoGCustom14` VARCHAR(30) NULL,
	`TCoGCustom14E` VARCHAR(30) NULL,
	`TCoGCustom15` VARCHAR(30) NULL,
	`TCoGCustom15E` VARCHAR(30) NULL,
	`TCoGCustom16` VARCHAR(30) NULL,
	`TCoGCustom16E` VARCHAR(30) NULL,
	`TCoGCustom17` VARCHAR(30) NULL,
	`TCoGCustom17E` VARCHAR(30) NULL,
	`TCoGCustom18` VARCHAR(30) NULL,
	`TCoGCustom18E` VARCHAR(30) NULL,
	`TCoGCustom19` VARCHAR(30) NULL,
	`TCoGCustom19E` VARCHAR(30) NULL,
	`TCoGCustom20` VARCHAR(30) NULL,
	`TCoGCustom20E` VARCHAR(30) NULL,
	`TCoGCustom21` VARCHAR(30) NULL,
	`TCoGCustom21E` VARCHAR(30) NULL,
	`TCoGCustom22` VARCHAR(30) NULL,
	`TCoGCustom22E` VARCHAR(30) NULL,
	`TCoGCustom23` VARCHAR(30) NULL,
	`TCoGCustom23E` VARCHAR(30) NULL,
	`TCoGCustom24` VARCHAR(30) NULL,
	`TCoGCustom24E` VARCHAR(30) NULL,
	`TCoGCustom25` VARCHAR(30) NULL,
	`TCoGCustom25E` VARCHAR(30) NULL,
	`TCoGCustom26` VARCHAR(30) NULL,
	`TCoGCustom26E` VARCHAR(30) NULL,
	`TCoGCustom27` VARCHAR(30) NULL,
	`TCoGCustom27E` VARCHAR(30) NULL,
	`TCoGCustom28` VARCHAR(30) NULL,
	`TCoGCustom28E` VARCHAR(30) NULL,
	`TCoGCustom29` VARCHAR(30) NULL,
	`TCoGCustom29E` VARCHAR(30) NULL,
	`TCoGCustom30` VARCHAR(30) NULL,
	`TCoGCustom30E` VARCHAR(30) NULL,
	`TCoGFlag1` SMALLINT NULL DEFAULT '0',
	`TCoGFlag2` SMALLINT NULL DEFAULT '0',
	`TCoGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCoGAlias`),
	KEY `TCodInternalCode` (`TCoGAlias`),
	KEY `TCodPrimaryKey` (`TCoGPrimaryKey`),
	KEY `TCoGPrimaryKey` (`TCoGCancelKey`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCommand` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCommand`;

# ---------- CREATE TABLE `VS4TCommand` ----------

CREATE TABLE `VS4TCommand` (
	`TCmdID` INT NOT NULL DEFAULT '0',
	`TCmdAlias` VARCHAR(30) NULL,
	`TCmdName` VARCHAR(100) NULL,
	`TCmdName2` VARCHAR(100) NULL,
	`TCmdReportNo` VARCHAR(10) NULL,
	`TCmdTCmGAlias` VARCHAR(30) NULL,
	`TCmdSort` DOUBLE NULL DEFAULT '1',
	`TCmdTopSeparate` SMALLINT NULL DEFAULT '0',
	`TCmdExitChevron` SMALLINT NULL DEFAULT '0',
	`TCmdType` VARCHAR(1) NULL,
	`TCmdMode` INT NULL DEFAULT '0',
	`TCmdMaskKey` INT NULL DEFAULT '0',
	`TCmdShortKey` INT NULL DEFAULT '0',
	`TCmdActiveStatus` SMALLINT NULL DEFAULT '0',
	`TCmdShowMenu` INT NULL DEFAULT '1',
	`TCmdShowToolbar` INT NULL DEFAULT '1',
	`TCmdShowListbar` INT NULL DEFAULT '1',
	`TCmdShowPermission` INT NULL DEFAULT '1',
	`TCmdCanShare` INT NULL DEFAULT '1',
	`TCmdIsReProcess` SMALLINT NULL DEFAULT '0',
	`TCmdHelpURL` VARCHAR(100) NULL,
	`TCmdIcon` VARCHAR(50) NULL,
	`TCmdSmallIcon` VARCHAR(50) NULL,
	`TCmdDescription` VARCHAR(100) NULL,
	`TCmdFlag1` SMALLINT NULL DEFAULT '0',
	`TCmdFlag2` SMALLINT NULL DEFAULT '0',
	`TCmdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCmdID`),
	KEY `CommandGroupID` (`TCmdTCmGAlias`),
	KEY `TCmdAlias` (`TCmdAlias`),
	KEY `TCmdID` (`TCmdID`),
	KEY `VS4TCommandGroupVS4TCommand` (`TCmdTCmGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCommandGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCommandGroup`;

# ---------- CREATE TABLE `VS4TCommandGroup` ----------

CREATE TABLE `VS4TCommandGroup` (
	`TCmGAlias` VARCHAR(30) NOT NULL,
	`TCmGName` VARCHAR(80) NULL,
	`TCmGName2` VARCHAR(80) NULL,
	`TCmGSort` DOUBLE NULL DEFAULT '1',
	`TCmGShow` SMALLINT NULL DEFAULT '0',
	`TCmgShell` VARCHAR(50) NULL,
	`TCmGFlag1` SMALLINT NULL DEFAULT '0',
	`TCmGFlag2` SMALLINT NULL DEFAULT '0',
	`TCmGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCmGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCommission` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCommission`;

# ---------- CREATE TABLE `VS4TCommission` ----------

CREATE TABLE `VS4TCommission` (
	`TComNo` VARCHAR(30) NOT NULL,
	`TComDate` DATETIME NULL DEFAULT '3333-3-3',
	`TComSaveFrom` SMALLINT NULL DEFAULT '0',
	`TComRefNo` VARCHAR(30) NULL,
	`TComRefDate` DATETIME NULL DEFAULT '3333-3-3',
	`TComTForCode` VARCHAR(30) NULL,
	`TComBaseAmount` FLOAT NULL DEFAULT '0',
	`TComCalcAmount` FLOAT NULL DEFAULT '0',
	`TComTCurCode` VARCHAR(4) NULL,
	`TComCustomTotal1` FLOAT NULL DEFAULT '0',
	`TComCustomTotal2` FLOAT NULL DEFAULT '0',
	`TComCustomTotal3` FLOAT NULL DEFAULT '0',
	`TComSubTotal` FLOAT NULL DEFAULT '0',
	`TComWTaxRate` DOUBLE NULL DEFAULT '0',
	`TComWTaxTotal` FLOAT NULL DEFAULT '0',
	`TComGrandTotal` FLOAT NULL DEFAULT '0',
	`TComNote` VARCHAR(80) NULL,
	`TComCreateCode` VARCHAR(30) NULL,
	`TComCreateBy` VARCHAR(140) NULL,
	`TComCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TComEditCode` VARCHAR(30) NULL,
	`TComEditBy` VARCHAR(140) NULL,
	`TComEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TComConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TComConfirmBy` VARCHAR(140) NULL,
	`TComConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TComApproveStatus` SMALLINT NULL DEFAULT '0',
	`TComApproveBy` VARCHAR(140) NULL,
	`TComApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TComApproveNote` VARCHAR(80) NULL,
	`TComConfidential` SMALLINT NULL DEFAULT '0',
	`TComCancelStatus` SMALLINT NULL DEFAULT '0',
	`TComCancelNo` VARCHAR(30) NULL,
	`TComCancelBy` VARCHAR(140) NULL,
	`TComCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TComCancelNote` VARCHAR(80) NULL,
	`TComFlag1` SMALLINT NULL DEFAULT '0',
	`TComFlag2` SMALLINT NULL DEFAULT '0',
	`TComFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TComNo`),
	KEY `TCmrTForCode` (`TComTForCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCommissionSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCommissionSub`;

# ---------- CREATE TABLE `VS4TCommissionSub` ----------

CREATE TABLE `VS4TCommissionSub` (
	`TCmrTComNo` VARCHAR(30) NOT NULL,
	`TCmrLn` SMALLINT NOT NULL DEFAULT '0',
	`TCmrChannel` SMALLINT NULL DEFAULT '0',
	`TCmrTFoGCode` VARCHAR(30) NULL,
	`TCmrCommissorType` VARCHAR(30) NULL,
	`TCmrTCmsCode` VARCHAR(30) NULL,
	`TCmrReceiverCode` VARCHAR(30) NULL,
	`TCmrReceiverName` VARCHAR(160) NULL,
	`TCmrPositionCode` VARCHAR(15) NULL,
	`TCmrPositionName` VARCHAR(50) NULL,
	`TCmrBaseAmount` FLOAT NULL DEFAULT '0',
	`TCmrCalcAmount` FLOAT NULL DEFAULT '0',
	`TCmrRate` DOUBLE NULL DEFAULT '0',
	`TCmrRateType` DOUBLE NULL DEFAULT '0',
	`TCmrAmount` FLOAT NULL DEFAULT '0',
	`TCmrCustomValue1` FLOAT NULL DEFAULT '0',
	`TCmrCustomValue2` FLOAT NULL DEFAULT '0',
	`TCmrCustomValue3` FLOAT NULL DEFAULT '0',
	`TCmrTCurCode` VARCHAR(5) NULL,
	`TCmrNote` VARCHAR(80) NULL,
	`TCmrFlag1` SMALLINT NULL DEFAULT '0',
	`TCmrFlag2` SMALLINT NULL DEFAULT '0',
	`TCmrFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCmrTComNo`, `TCmrLn`),
	KEY `TCmrTFoGCode` (`TCmrTFoGCode`),
	KEY `VS4TCommissionVS4TCommissionSub` (`TCmrTComNo`),
	KEY `VS4TCommissorVS4TCommissionSub` (`TCmrTCmsCode`),
	KEY `VS4TFormulaGroupVS4TCommissionSub` (`TCmrTFoGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCommissor` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCommissor`;

# ---------- CREATE TABLE `VS4TCommissor` ----------

CREATE TABLE `VS4TCommissor` (
	`TCmsCode` VARCHAR(30) NOT NULL,
	`TCmsNo` VARCHAR(30) NULL,
	`TCmsTCmTCode` VARCHAR(30) NULL,
	`TCmsSide` SMALLINT NULL DEFAULT '0',
	`TCmsLinkCode` VARCHAR(30) NULL,
	`TCmsFullName` VARCHAR(140) NULL,
	`TCmsFullName2` VARCHAR(140) NULL,
	`TCmsGuideTitleName` VARCHAR(40) NULL,
	`TCmsFirstname` VARCHAR(50) NULL,
	`TCmsMiddleName` VARCHAR(5) NULL,
	`TCmsLastname` VARCHAR(50) NULL,
	`TCmsTaxId` VARCHAR(20) NULL,
	`TCmsTel` VARCHAR(50) NULL,
	`TCmsCustomType` SMALLINT NULL DEFAULT '0',
	`TCmsTotalValue` INT NULL DEFAULT '0',
	`TCmsCustomValue1` DOUBLE NULL DEFAULT '0',
	`TCmsCustomValue2` DOUBLE NULL DEFAULT '0',
	`TCmsCustomValue3` DOUBLE NULL DEFAULT '0',
	`TCmsCustomValue4` DOUBLE NULL DEFAULT '0',
	`TCmsCustomValue5` DOUBLE NULL DEFAULT '0',
	`TCmsCustomText1` VARCHAR(50) NULL,
	`TCmsCustomText2` VARCHAR(50) NULL,
	`TCmsCustomText3` VARCHAR(50) NULL,
	`TCmsCustomText4` VARCHAR(50) NULL,
	`TCmsCustomText5` VARCHAR(50) NULL,
	`TCmsNote` VARCHAR(50) NULL,
	`TCmsFlag1` SMALLINT NULL DEFAULT '0',
	`TCmsFlag2` SMALLINT NULL DEFAULT '0',
	`TCmsFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCmsCode`),
	KEY `TCmsLinkCode` (`TCmsLinkCode`),
	KEY `TCmsTaxId` (`TCmsTaxId`),
	KEY `TEmpCode` (`TCmsCode`),
	KEY `VS4TCommissorTypeVS4TCommissor` (`TCmsTCmTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCommissorAP` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCommissorAP`;

# ---------- CREATE TABLE `VS4TCommissorAP` ----------

CREATE TABLE `VS4TCommissorAP` (
	`TCAPTCmsCode` VARCHAR(30) NOT NULL,
	`TCAPTAPNCode` VARCHAR(30) NOT NULL,
	`TCAPTFlag1` SMALLINT NULL DEFAULT '0',
	`TCAPTFlag2` SMALLINT NULL DEFAULT '0',
	`TCAPTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCAPTCmsCode`, `TCAPTAPNCode`),
	KEY `TAPNCode` (`TCAPTAPNCode`),
	KEY `TCmsCode` (`TCAPTCmsCode`),
	KEY `VS4TAPVS4TCommissorAP` (`TCAPTAPNCode`),
	KEY `VS4TCommissorVS4TCommissorAP` (`TCAPTCmsCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCommissorAR` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCommissorAR`;

# ---------- CREATE TABLE `VS4TCommissorAR` ----------

CREATE TABLE `VS4TCommissorAR` (
	`TCARTCmsCode` VARCHAR(30) NOT NULL,
	`TCARTAPNCode` VARCHAR(30) NOT NULL,
	`TCARTFlag1` SMALLINT NULL DEFAULT '0',
	`TCARTFlag2` SMALLINT NULL DEFAULT '0',
	`TCARTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCARTCmsCode`, `TCARTAPNCode`),
	KEY `TAPNCode` (`TCARTAPNCode`),
	KEY `TCmsCode` (`TCARTCmsCode`),
	KEY `VS4TARVS4TCommissorAR` (`TCARTAPNCode`),
	KEY `VS4TCommissorVS4TCommissorAR` (`TCARTCmsCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCommissorEMP` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCommissorEMP`;

# ---------- CREATE TABLE `VS4TCommissorEMP` ----------

CREATE TABLE `VS4TCommissorEMP` (
	`TCEPTCmsCode` VARCHAR(30) NOT NULL,
	`TCEPTEmpCode` VARCHAR(30) NOT NULL,
	`TCEPTFlag1` SMALLINT NULL DEFAULT '0',
	`TCEPTFlag2` SMALLINT NULL DEFAULT '0',
	`TCEPTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCEPTCmsCode`, `TCEPTEmpCode`),
	KEY `TAPNCode` (`TCEPTEmpCode`),
	KEY `TCmsCode` (`TCEPTCmsCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCommissorType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCommissorType`;

# ---------- CREATE TABLE `VS4TCommissorType` ----------

CREATE TABLE `VS4TCommissorType` (
	`TCmTCode` VARCHAR(30) NOT NULL,
	`TCmTName` VARCHAR(100) NULL,
	`TCmTName2` VARCHAR(100) NULL,
	`TCmTTextSort` VARCHAR(30) NULL,
	`TCmTFlag1` SMALLINT NULL DEFAULT '0',
	`TCmTFlag2` SMALLINT NULL DEFAULT '0',
	`TCmTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCmTCode`),
	KEY `TBnkCode` (`TCmTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCompany` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCompany`;

# ---------- CREATE TABLE `VS4TCompany` ----------

CREATE TABLE `VS4TCompany` (
	`TCmpCode` VARCHAR(30) NOT NULL,
	`TCmpName` VARCHAR(80) NULL,
	`TCmpName2` VARCHAR(80) NULL,
	`TCmpIntro` VARCHAR(50) NULL,
	`TCmpIntroName` VARCHAR(200) NULL,
	`TCmpType` SMALLINT NULL DEFAULT '0',
	`TCmpRelationType` SMALLINT NULL DEFAULT '0',
	`TCmpDocCode` VARCHAR(15) NULL,
	`TCmpNature` VARCHAR(120) NULL,
	`TCmpOwnerName` VARCHAR(160) NULL,
	`TCmpTaxNo` VARCHAR(30) NULL,
	`TCmpAddressBill` VARCHAR(255) NULL,
	`TCmpAddressDeliver` VARCHAR(255) NULL,
	`TCmpAddress` VARCHAR(200) NULL,
	`TCmpSubProvince` VARCHAR(50) NULL,
	`TCmpCity` VARCHAR(50) NULL,
	`TCmpPostalCode` VARCHAR(5) NULL,
	`TCmpStaCode` VARCHAR(3) NULL,
	`TCmpTCouCode` VARCHAR(3) NULL,
	`TCmpWebsite` VARCHAR(50) NULL,
	`TCmpEmail` VARCHAR(50) NULL,
	`TCmpPhone` VARCHAR(50) NULL,
	`TCmpFax` VARCHAR(50) NULL,
	`TCmpImage1` VARCHAR(50) NULL,
	`TCmpCreateCode` VARCHAR(30) NULL,
	`TCmpCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCmpEditCode` VARCHAR(30) NULL,
	`TCmpEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCmpTextSort` VARCHAR(30) NULL,
	`TCmpFlag1` SMALLINT NULL DEFAULT '0',
	`TCmpFlag2` SMALLINT NULL DEFAULT '0',
	`TCmpFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCmpCode`),
	KEY `CompanyCountryID` (`TCmpTCouCode`),
	KEY `CompayStateCode` (`TCmpStaCode`),
	KEY `TCmpDecCode` (`TCmpDocCode`),
	KEY `VS4TCountryVS4TCompany` (`TCmpTCouCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCompanyAddess` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCompanyAddess`;

# ---------- CREATE TABLE `VS4TCompanyAddess` ----------

CREATE TABLE `VS4TCompanyAddess` (
	`TCPATCmpCode` VARCHAR(30) NOT NULL,
	`TCPALn` INT NOT NULL DEFAULT '0',
	`TCPAAddress` VARCHAR(255) NULL,
	`TCPAPhone` VARCHAR(50) NULL,
	`TCPAFax` VARCHAR(50) NULL,
	`TCPAMapFile` VARCHAR(50) NULL,
	`TCPAMapFile2` VARCHAR(50) NULL,
	`TCPAFlag1` SMALLINT NULL DEFAULT '0',
	`TCPAFlag2` SMALLINT NULL DEFAULT '0',
	`TCPAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCPATCmpCode`, `TCPALn`),
	KEY `TAPCCode` (`TCPATCmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCompanyBank` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCompanyBank`;

# ---------- CREATE TABLE `VS4TCompanyBank` ----------

CREATE TABLE `VS4TCompanyBank` (
	`TCBBNo` VARCHAR(30) NOT NULL,
	`TCBBName` VARCHAR(80) NULL,
	`TCBBName2` VARCHAR(80) NULL,
	`TCBBTBraCode` VARCHAR(30) NULL,
	`TCBBTBnkCode` VARCHAR(30) NULL,
	`TCBBAccountType` SMALLINT NULL DEFAULT '0',
	`TCBBAccountName` VARCHAR(100) NULL,
	`TCBBAccountNo` VARCHAR(30) NULL,
	`TCBBAccountBranch` VARCHAR(100) NULL,
	`TCBBCreditLimit` FLOAT NULL DEFAULT '0',
	`TCBBCashBalance` FLOAT NULL DEFAULT '0',
	`TCBBTACCCode` VARCHAR(30) NULL,
	`TCBBParentBook` VARCHAR(30) NULL,
	`TCBBBalance` FLOAT NULL,
	`TCBBBalanceDate` DATETIME NULL,
	`TCBBSwift` VARCHAR(255) NULL,
	`TCBBFlag1` SMALLINT NULL DEFAULT '0',
	`TCBBFlag2` SMALLINT NULL DEFAULT '0',
	`TCBBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCBBNo`),
	KEY `TBBKTACCCode` (`TCBBTACCCode`),
	KEY `TCBBTACCCode` (`TCBBParentBook`),
	KEY `TCBBTACCCode1` (`TCBBSwift`),
	KEY `TCBBTCmpID` (`TCBBTBraCode`),
	KEY `TEmBTBnkCode` (`TCBBTBnkCode`),
	KEY `VS4TBankVS4TCompanyBank` (`TCBBTBnkCode`),
	KEY `VS4TBranchVS4TCompanyBank` (`TCBBTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCompanyBusType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCompanyBusType`;

# ---------- CREATE TABLE `VS4TCompanyBusType` ----------

CREATE TABLE `VS4TCompanyBusType` (
	`TCTYTCmpCode` VARCHAR(30) NOT NULL,
	`TCTYTBsTCode` VARCHAR(30) NOT NULL,
	`TCTYFlag1` SMALLINT NULL DEFAULT '0',
	`TCTYFlag2` SMALLINT NULL DEFAULT '0',
	`TCTYFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCTYTBsTCode`, `TCTYTCmpCode`),
	KEY `TBsTCode` (`TCTYTBsTCode`),
	KEY `VS4TBusinessTypeVS4TCompanyBusType` (`TCTYTBsTCode`),
	KEY `VS4TCompanyVS4TCompanyBusType` (`TCTYTCmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCompanyContact` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCompanyContact`;

# ---------- CREATE TABLE `VS4TCompanyContact` ----------

CREATE TABLE `VS4TCompanyContact` (
	`TCpCTCmpCode` VARCHAR(30) NOT NULL,
	`TCpCCode` VARCHAR(30) NOT NULL,
	`TCpCSide` SMALLINT NULL DEFAULT '0',
	`TCpCTitleName` VARCHAR(30) NULL,
	`TCpCFirstName` VARCHAR(50) NULL,
	`TCpCMiddleName` VARCHAR(5) NULL,
	`TCpCLastname` VARCHAR(50) NULL,
	`TCpCNickname` VARCHAR(20) NULL,
	`TCpCTitleName2` VARCHAR(50) NULL,
	`TCpCFirstname2` VARCHAR(50) NULL,
	`TCpCMiddleName2` VARCHAR(5) NULL,
	`TCpCLastname2` VARCHAR(50) NULL,
	`TCpCPosition` VARCHAR(80) NULL,
	`TCpCRespond` VARCHAR(50) NULL,
	`TCpCTel` VARCHAR(50) NULL,
	`TCpCFax` VARCHAR(50) NULL,
	`TCpCEmail` VARCHAR(50) NULL,
	`TCpCImage1` VARCHAR(50) NULL,
	`TCpCCardImage1` VARCHAR(50) NULL,
	`TCpCPriority` SMALLINT NULL DEFAULT '0',
	`TCpCStatus` SMALLINT NULL DEFAULT '0',
	`TCpCNote` VARCHAR(50) NULL,
	`TCpCFlag1` SMALLINT NULL DEFAULT '0',
	`TCpCFlag2` SMALLINT NULL DEFAULT '0',
	`TCpCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCpCCode`, `TCpCTCmpCode`),
	KEY `TConTComID` (`TCpCTCmpCode`),
	KEY `TTCnID` (`TCpCCode`),
	KEY `VS4TCompanyVS4TCompanyContact` (`TCpCTCmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCompetitor` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCompetitor`;

# ---------- CREATE TABLE `VS4TCompetitor` ----------

CREATE TABLE `VS4TCompetitor` (
	`TCptCode` VARCHAR(30) NOT NULL,
	`TCptName` VARCHAR(200) NULL,
	`TCptName2` VARCHAR(200) NULL,
	`TCptOwnerName` VARCHAR(160) NULL,
	`TCptTBsTCode` VARCHAR(30) NULL,
	`TCptTBsMCode` VARCHAR(30) NULL,
	`TCptAddress` VARCHAR(255) NULL,
	`TCptTCouCode` VARCHAR(3) NULL,
	`TCptTel` VARCHAR(100) NULL,
	`TCptFax` VARCHAR(100) NULL,
	`TCptImage1` VARCHAR(50) NULL,
	`TCptWebsite` VARCHAR(50) NULL,
	`TCptEmail` VARCHAR(50) NULL,
	`TCptStrength` TEXT NULL,
	`TCptWeakness` TEXT NULL,
	`TCptStyle` VARCHAR(255) NULL,
	`TCptNote` TEXT NULL,
	`TCptTextSort` VARCHAR(30) NULL,
	`TCptFlag1` SMALLINT NULL DEFAULT '0',
	`TCptFlag2` SMALLINT NULL DEFAULT '0',
	`TCptFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCptCode`),
	KEY `TCmTCode` (`TCptCode`),
	KEY `TCptCode` (`TCptTextSort`),
	KEY `TCptTBsTCode` (`TCptTBsTCode`),
	KEY `TCptTBsTCode1` (`TCptTBsMCode`),
	KEY `VS4TBusinessMajorVS4TCompetitor` (`TCptTBsMCode`),
	KEY `VS4TBusinessTypeVS4TCompetitor` (`TCptTBsTCode`),
	KEY `VS4TCountryVS4TCompetitor` (`TCptTCouCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCompetSection` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCompetSection`;

# ---------- CREATE TABLE `VS4TCompetSection` ----------

CREATE TABLE `VS4TCompetSection` (
	`TCPSTCPTCode` VARCHAR(30) NOT NULL,
	`TCPSCode` VARCHAR(30) NOT NULL,
	`TCPSProductName` VARCHAR(150) NULL,
	`TCPSTPSECode` VARCHAR(30) NULL,
	`TCPSStrength` VARCHAR(255) NULL,
	`TCPSWeakness` VARCHAR(255) NULL,
	`TCPSNote` VARCHAR(255) NULL,
	`TCPSFlag1` SMALLINT NULL DEFAULT '0',
	`TCPSFlag2` SMALLINT NULL DEFAULT '0',
	`TCPSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCPSTCPTCode`, `TCPSCode`),
	KEY `VS4TCompetitorVS4TCompetSection` (`TCPSTCPTCode`),
	KEY `VS4TProductSectionVS4TCompetSection` (`TCPSTPSECode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TComSale` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TComSale`;

# ---------- CREATE TABLE `VS4TComSale` ----------

CREATE TABLE `VS4TComSale` (
	`TCosNo` VARCHAR(30) NOT NULL,
	`TCosDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCosType` SMALLINT NULL DEFAULT '0',
	`TCosStartDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCosEndDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCosEmpMode` SMALLINT NULL DEFAULT '0',
	`TCosProductMode` SMALLINT NULL DEFAULT '0',
	`TCosRefNo` VARCHAR(30) NULL,
	`TCosDescription` VARCHAR(200) NULL,
	`TCosCreateCode` VARCHAR(30) NULL,
	`TCosCreateBy` VARCHAR(140) NULL,
	`TCosCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCosEditCode` VARCHAR(30) NULL,
	`TCosEditBy` VARCHAR(140) NULL,
	`TCosEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCosConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TCosConfirmBy` VARCHAR(140) NULL,
	`TCosConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCosApproveStatus` SMALLINT NULL DEFAULT '0',
	`TCosApproveBy` VARCHAR(140) NULL,
	`TCosApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCosApproveNote` VARCHAR(80) NULL,
	`TCosRevision` SMALLINT NULL DEFAULT '0',
	`TCosCancelStatus` SMALLINT NULL DEFAULT '0',
	`TCosCancelNo` VARCHAR(30) NULL,
	`TCosCancelBy` VARCHAR(140) NULL,
	`TCosCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCosCancelNote` VARCHAR(80) NULL,
	`TCosFlag1` SMALLINT NULL DEFAULT '0',
	`TCosFlag2` SMALLINT NULL DEFAULT '0',
	`TCosFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCosNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TComSaleMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TComSaleMB`;

# ---------- CREATE TABLE `VS4TComSaleMB` ----------

CREATE TABLE `VS4TComSaleMB` (
	`TCsBTCosNo` VARCHAR(30) NOT NULL,
	`TCsBLn` INT NOT NULL DEFAULT '0',
	`TCsBTEmpCode` VARCHAR(30) NULL,
	`TCsBEmployeeName` VARCHAR(30) NULL,
	`TCsBFromQuantity` DOUBLE NULL DEFAULT '1',
	`TCsBFromPrice` DOUBLE NULL DEFAULT '1',
	`TCsBType` SMALLINT NULL DEFAULT '1',
	`TCsBRate` VARCHAR(30) NULL,
	`TCsBTPOSCode` VARCHAR(30) NULL,
	`TCsBTUntCode` VARCHAR(15) NULL,
	`TCsBTPSECode` VARCHAR(30) NULL,
	`TCsBTPG1Code` VARCHAR(30) NULL,
	`TCsBApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCsBStatus` SMALLINT NULL DEFAULT '0',
	`TCsBFlag1` SMALLINT NULL DEFAULT '0',
	`TCsBFlag2` SMALLINT NULL DEFAULT '0',
	`TCsBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCsBLn`, `TCsBTCosNo`),
	KEY `TCsBTEmpCode` (`TCsBEmployeeName`),
	KEY `TExRID` (`TCsBLn`),
	KEY `TExRTBnkID` (`TCsBTEmpCode`),
	KEY `TPPMTPOSCode` (`TCsBTPOSCode`),
	KEY `TPPMTUntCode` (`TCsBTUntCode`),
	KEY `VS4TComSaleVS4TComSaleMB` (`TCsBTCosNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TConComment` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TConComment`;

# ---------- CREATE TABLE `VS4TConComment` ----------

CREATE TABLE `VS4TConComment` (
	`TCnCCode` VARCHAR(30) NOT NULL,
	`TCnCName1` VARCHAR(50) NULL,
	`TCnCName2` VARCHAR(50) NULL,
	`TCnCFlag1` SMALLINT NULL DEFAULT '0',
	`TCnCFlag2` SMALLINT NULL DEFAULT '0',
	`TCnCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCnCCode`),
	KEY `TCdCCode` (`TCnCCode`),
	KEY `TCdCCode1` (`TCnCName1`),
	KEY `TCdCCode2` (`TCnCName2`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TContact` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TContact`;

# ---------- CREATE TABLE `VS4TContact` ----------

CREATE TABLE `VS4TContact` (
	`TCntNo` VARCHAR(30) NOT NULL,
	`TCntDate` DATETIME NULL,
	`TCntRefNo` VARCHAR(30) NULL,
	`TCntRefDate` DATETIME NULL,
	`TCntTBraCode` VARCHAR(20) NULL,
	`TCntBranchName` VARCHAR(160) NULL,
	`TCntTEmpCode` VARCHAR(100) NULL,
	`TCntEmployeeName` VARCHAR(160) NULL,
	`TCntFromDate` DATETIME NULL,
	`TCntToDate` DATETIME NULL,
	`TCntDescription` VARCHAR(150) NULL,
	`TCntCreateCode` VARCHAR(30) NULL,
	`TCntCreateBy` VARCHAR(140) NULL,
	`TCntCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCntEditCode` VARCHAR(30) NULL,
	`TCntEditBy` VARCHAR(140) NULL,
	`TCntEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCntConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TCntConfirmBy` VARCHAR(140) NULL,
	`TCntConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCntConfirmNote` VARCHAR(80) NULL,
	`TCntApproveStatus` SMALLINT NULL DEFAULT '0',
	`TCntApproveBy` VARCHAR(140) NULL,
	`TCntApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCntApproveNote` VARCHAR(80) NULL,
	`TCntRevision` SMALLINT NULL DEFAULT '0',
	`TCntCancelStatus` SMALLINT NULL DEFAULT '0',
	`TCntCancelNo` VARCHAR(30) NULL,
	`TCntCancelBy` VARCHAR(140) NULL,
	`TCntCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TCntCancelNote` VARCHAR(80) NULL,
	`TCntFlag1` SMALLINT NULL DEFAULT '0',
	`TCntFlag2` SMALLINT NULL DEFAULT '0',
	`TCntFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCntNo`),
	KEY `TDepCode` (`TCntNo`),
	KEY `TTCnCompany1` (`TCntTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TContactMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TContactMB`;

# ---------- CREATE TABLE `VS4TContactMB` ----------

CREATE TABLE `VS4TContactMB` (
	`TCnMTCntNo` VARCHAR(30) NOT NULL,
	`TCnMLn` INT NOT NULL DEFAULT '0',
	`TCnMTCmsCode` VARCHAR(30) NULL,
	`TCnMFullName` VARCHAR(160) NULL,
	`TCnMTFoGCode` VARCHAR(30) NULL,
	`TCnMRefNo` VARCHAR(30) NULL,
	`TCnMDescription` VARCHAR(150) NULL,
	`TCnMFlag1` SMALLINT NULL DEFAULT '0',
	`TCnMFlag2` SMALLINT NULL DEFAULT '0',
	`TCnMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCnMLn`, `TCnMTCntNo`),
	KEY `TCtMTCmsCode` (`TCnMTCmsCode`),
	KEY `VS4TCommissorVS4TContactMB` (`TCnMTCmsCode`),
	KEY `VS4TContactVS4TContactMB` (`TCnMTCntNo`),
	KEY `VS4TFormulaGroupVS4TContactMB` (`TCnMTFoGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TContactType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TContactType`;

# ---------- CREATE TABLE `VS4TContactType` ----------

CREATE TABLE `VS4TContactType` (
	`TCcTCode` VARCHAR(30) NOT NULL,
	`TCcTName` VARCHAR(200) NULL,
	`TCcTName2` VARCHAR(200) NULL,
	`TCcTFlag1` SMALLINT NULL DEFAULT '0',
	`TCcTFlag2` SMALLINT NULL DEFAULT '0',
	`TCcTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCcTCode`),
	KEY `TCmTCode` (`TCcTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TContinent` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TContinent`;

# ---------- CREATE TABLE `VS4TContinent` ----------

CREATE TABLE `VS4TContinent` (
	`TCTNCode` VARCHAR(3) NOT NULL,
	`TCTNName` VARCHAR(50) NULL,
	`TCTNName2` VARCHAR(50) NULL,
	`TCTNFlag1` SMALLINT NULL DEFAULT '0',
	`TCTNFlag2` SMALLINT NULL DEFAULT '0',
	`TCTNFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCTNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCountry` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCountry`;

# ---------- CREATE TABLE `VS4TCountry` ----------

CREATE TABLE `VS4TCountry` (
	`TCouCode` VARCHAR(3) NOT NULL,
	`TCouName` VARCHAR(50) NULL,
	`TCouName2` VARCHAR(50) NULL,
	`TCouPhoneCode` VARCHAR(3) NULL,
	`TCouTCTNCode` VARCHAR(3) NULL,
	`TCouGroup1` VARCHAR(30) NULL,
	`TCouGroup2` VARCHAR(30) NULL,
	`TCouFlag1` SMALLINT NULL DEFAULT '0',
	`TCouFlag2` SMALLINT NULL DEFAULT '0',
	`TCouFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCouCode`),
	KEY `TCouGroup1` (`TCouGroup2`),
	KEY `TCouTCTNCode` (`TCouTCTNCode`),
	KEY `TCouTCTNCode1` (`TCouGroup1`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCreditNoteType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCreditNoteType`;

# ---------- CREATE TABLE `VS4TCreditNoteType` ----------

CREATE TABLE `VS4TCreditNoteType` (
	`TCRTCode` VARCHAR(30) NOT NULL,
	`TCRTName` VARCHAR(50) NULL,
	`TCRTName2` VARCHAR(50) NULL,
	`TCRTFlag1` SMALLINT NULL DEFAULT '0',
	`TCRTFlag2` SMALLINT NULL DEFAULT '0',
	`TCRTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCRTCode`),
	KEY `TBsTCode` (`TCRTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCreditTerm` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCreditTerm`;

# ---------- CREATE TABLE `VS4TCreditTerm` ----------

CREATE TABLE `VS4TCreditTerm` (
	`TCdTCode` VARCHAR(10) NOT NULL,
	`TCdTName` VARCHAR(50) NULL,
	`TCdTCondition` VARCHAR(100) NULL,
	`TCdTConditionType` SMALLINT NULL,
	`TCdTConditionDay` SMALLINT NULL,
	`TCdTCondition1` DOUBLE NULL,
	`TCdTConditionDay1` SMALLINT NULL,
	`TCdTFlag1` SMALLINT NULL,
	`TCdTFlag2` SMALLINT NULL,
	`TCdTFlag3` SMALLINT NULL,
	PRIMARY KEY (`TCdTCode`),
	KEY `TTrmCode` (`TCdTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCurrency` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCurrency`;

# ---------- CREATE TABLE `VS4TCurrency` ----------

CREATE TABLE `VS4TCurrency` (
	`TCurCode` VARCHAR(5) NOT NULL,
	`TCurName` VARCHAR(15) NULL,
	`TCurName2` VARCHAR(15) NULL,
	`TCurSubName` VARCHAR(15) NULL,
	`TCurSubName2` VARCHAR(15) NULL,
	`TCurDescription` VARCHAR(50) NULL,
	`TCurTCBBNo` VARCHAR(30) NULL,
	`TCurFlag1` SMALLINT NULL DEFAULT '0',
	`TCurFlag2` SMALLINT NULL DEFAULT '0',
	`TCurFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCurCode`),
	KEY `TCurSubName` (`TCurSubName2`),
	KEY `TUnCSubUnitID` (`TCurSubName`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCustom` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCustom`;

# ---------- CREATE TABLE `VS4TCustom` ----------

CREATE TABLE `VS4TCustom` (
	`TCsmCode` VARCHAR(30) NOT NULL,
	`TCsmRefCode` VARCHAR(30) NOT NULL,
	`TCsmText1` VARCHAR(50) NULL,
	`TCsmText2` VARCHAR(50) NULL,
	`TCsmText3` VARCHAR(50) NULL,
	`TCsmText4` VARCHAR(50) NULL,
	`TCsmText5` VARCHAR(50) NULL,
	`TCsmText6` VARCHAR(50) NULL,
	`TCsmText7` VARCHAR(50) NULL,
	`TCsmText8` VARCHAR(50) NULL,
	`TCsmText9` VARCHAR(50) NULL,
	`TCsmText10` VARCHAR(50) NULL,
	`TCsmNumber1` DOUBLE NULL DEFAULT '0',
	`TCsmNumber2` DOUBLE NULL DEFAULT '0',
	`TCsmNumber3` DOUBLE NULL DEFAULT '0',
	`TCsmNumber4` DOUBLE NULL DEFAULT '0',
	`TCsmNumber5` DOUBLE NULL DEFAULT '0',
	`TCsmNumber6` DOUBLE NULL DEFAULT '0',
	`TCsmNumber7` DOUBLE NULL DEFAULT '0',
	`TCsmNumber8` DOUBLE NULL DEFAULT '0',
	`TCsmNumber9` DOUBLE NULL DEFAULT '0',
	`TCsmNumber10` DOUBLE NULL DEFAULT '0',
	`TCsmFlag1` SMALLINT NULL DEFAULT '0',
	`TCsmFlag2` SMALLINT NULL DEFAULT '0',
	`TCsmFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCsmCode`, `TCsmRefCode`),
	KEY `TCsmCode` (`TCsmCode`),
	KEY `TCsmCode1` (`TCsmRefCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TCustom1` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TCustom1`;

# ---------- CREATE TABLE `VS4TCustom1` ----------

CREATE TABLE `VS4TCustom1` (
	`TCS1Type` VARCHAR(10) NOT NULL,
	`TCS1Code` VARCHAR(10) NOT NULL,
	`TCS1Name` VARCHAR(255) NULL,
	`TCS1Flag1` SMALLINT NULL DEFAULT '0',
	`TCS1Flag2` SMALLINT NULL DEFAULT '0',
	`TCS1Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCS1Type`, `TCS1Code`),
	KEY `TCS1Type` (`TCS1Type`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDebitNoteType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDebitNoteType`;

# ---------- CREATE TABLE `VS4TDebitNoteType` ----------

CREATE TABLE `VS4TDebitNoteType` (
	`TDBTCode` VARCHAR(30) NOT NULL,
	`TDBTName` VARCHAR(50) NULL,
	`TDBTName2` VARCHAR(50) NULL,
	`TDBTFlag1` SMALLINT NULL DEFAULT '0',
	`TDBTFlag2` SMALLINT NULL DEFAULT '0',
	`TDBTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDBTCode`),
	KEY `TBsTCode` (`TDBTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDecisionStyle` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDecisionStyle`;

# ---------- CREATE TABLE `VS4TDecisionStyle` ----------

CREATE TABLE `VS4TDecisionStyle` (
	`TDecCode` VARCHAR(30) NOT NULL,
	`TDecName` VARCHAR(200) NULL,
	`TDecName2` VARCHAR(200) NULL,
	`TDecEffect` SMALLINT NULL DEFAULT '0',
	`TDecFlag1` SMALLINT NULL DEFAULT '0',
	`TDecFlag2` SMALLINT NULL DEFAULT '0',
	`TDecFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDecCode`),
	KEY `TCmTCode` (`TDecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDeliveryIN` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDeliveryIN`;

# ---------- CREATE TABLE `VS4TDeliveryIN` ----------

CREATE TABLE `VS4TDeliveryIN` (
	`TDCINo` VARCHAR(30) NOT NULL,
	`TDCIDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCIArticleType` SMALLINT NULL,
	`TDCISource` SMALLINT NULL,
	`TDCIUseMethod` SMALLINT NULL,
	`TDCIRefNo` VARCHAR(30) NULL,
	`TDCIRefDate` DATETIME NULL,
	`TDCITBraCode` VARCHAR(30) NULL,
	`TDCITPrjCode` VARCHAR(30) NULL,
	`TDCINote` VARCHAR(255) NULL,
	`TDCICreateCode` VARCHAR(30) NULL,
	`TDCICreateBy` VARCHAR(140) NULL,
	`TDCICreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCIEditCode` VARCHAR(30) NULL,
	`TDCIEditBy` VARCHAR(140) NULL,
	`TDCIEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCIConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TDCIConfirmBy` VARCHAR(140) NULL,
	`TDCIConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCIApproveStatus` SMALLINT NULL DEFAULT '0',
	`TDCIApproveBy` VARCHAR(140) NULL,
	`TDCIApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCIApproveNote` VARCHAR(80) NULL,
	`TDCIRevision` SMALLINT NULL DEFAULT '0',
	`TDCICancelStatus` SMALLINT NULL DEFAULT '0',
	`TDCICancelNo` VARCHAR(30) NULL,
	`TDCICancelBy` VARCHAR(140) NULL,
	`TDCICancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCICancelNote` VARCHAR(80) NULL,
	`TDCIFlag1` SMALLINT NULL DEFAULT '0',
	`TDCIFlag2` SMALLINT NULL DEFAULT '0',
	`TDCIFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDCINo`),
	KEY `TAPVNo` (`TDCINo`),
	KEY `TRVHTPrjCode` (`TDCITPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDeliveryINMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDeliveryINMB`;

# ---------- CREATE TABLE `VS4TDeliveryINMB` ----------

CREATE TABLE `VS4TDeliveryINMB` (
	`TDIMTDCINo` VARCHAR(30) NOT NULL,
	`TDIMLn` INT NOT NULL DEFAULT '0',
	`TDIMType` SMALLINT NULL DEFAULT '0',
	`TDIMTIAPNo` VARCHAR(30) NULL,
	`TDIMFlag1` SMALLINT NULL DEFAULT '0',
	`TDIMFlag2` SMALLINT NULL DEFAULT '0',
	`TDIMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDIMLn`, `TDIMTDCINo`),
	KEY `TPWBID` (`TDIMLn`),
	KEY `TTfMID` (`TDIMTDCINo`),
	KEY `VS4TAPInvoiceVS4TDeliveryINMB` (`TDIMTIAPNo`),
	KEY `VS4TDeliveryINVS4TDeliveryINMB` (`TDIMTDCINo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDeliveryOut` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDeliveryOut`;

# ---------- CREATE TABLE `VS4TDeliveryOut` ----------

CREATE TABLE `VS4TDeliveryOut` (
	`TDCONo` VARCHAR(30) NOT NULL,
	`TDCODate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCOArticleType` SMALLINT NULL,
	`TDCOUseMethod` SMALLINT NULL,
	`TDCORefNo` VARCHAR(30) NULL,
	`TDCORefDate` DATETIME NULL,
	`TDCOTBraCode` VARCHAR(30) NULL,
	`TDCOTPrjCode` VARCHAR(30) NULL,
	`TDCONote` VARCHAR(255) NULL,
	`TDCOCreateCode` VARCHAR(30) NULL,
	`TDCOCreateBy` VARCHAR(140) NULL,
	`TDCOCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCOEditCode` VARCHAR(30) NULL,
	`TDCOEditBy` VARCHAR(140) NULL,
	`TDCOEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCOConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TDCOConfirmBy` VARCHAR(140) NULL,
	`TDCOConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCOApproveStatus` SMALLINT NULL DEFAULT '0',
	`TDCOApproveBy` VARCHAR(140) NULL,
	`TDCOApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCOApproveNote` VARCHAR(80) NULL,
	`TDCORevision` SMALLINT NULL DEFAULT '0',
	`TDCOCancelStatus` SMALLINT NULL DEFAULT '0',
	`TDCOCancelNo` VARCHAR(30) NULL,
	`TDCOCancelBy` VARCHAR(140) NULL,
	`TDCOCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDCOCancelNote` VARCHAR(80) NULL,
	`TDCOFlag1` SMALLINT NULL DEFAULT '0',
	`TDCOFlag2` SMALLINT NULL DEFAULT '0',
	`TDCOFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDCONo`),
	KEY `TAPVNo` (`TDCONo`),
	KEY `TRVHTPrjCode` (`TDCOTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDeliveryOutMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDeliveryOutMB`;

# ---------- CREATE TABLE `VS4TDeliveryOutMB` ----------

CREATE TABLE `VS4TDeliveryOutMB` (
	`TDOMTDCONo` VARCHAR(30) NOT NULL,
	`TDOMLn` INT NOT NULL DEFAULT '0',
	`TDOMType` SMALLINT NULL DEFAULT '0',
	`TDOMTIvoNo` VARCHAR(30) NULL,
	`TDOMFlag1` SMALLINT NULL DEFAULT '0',
	`TDOMFlag2` SMALLINT NULL DEFAULT '0',
	`TDOMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDOMLn`, `TDOMTDCONo`),
	KEY `TPWBID` (`TDOMLn`),
	KEY `TTfMID` (`TDOMTDCONo`),
	KEY `VS4TARInvoiceVS4TDelvieryOutMB` (`TDOMTIvoNo`),
	KEY `VS4TDeliveryOutVS4TDelvieryOutMB` (`TDOMTDCONo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDepartment` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDepartment`;

# ---------- CREATE TABLE `VS4TDepartment` ----------

CREATE TABLE `VS4TDepartment` (
	`TDepCode` VARCHAR(30) NOT NULL,
	`TDepName` VARCHAR(50) NULL,
	`TDepName2` VARCHAR(50) NULL,
	`TDepDocCode` VARCHAR(30) NULL,
	`TDepTDivCode` VARCHAR(30) NULL,
	`TDepFlag1` SMALLINT NULL DEFAULT '0',
	`TDepFlag2` SMALLINT NULL DEFAULT '0',
	`TDepFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDepCode`),
	KEY `TBraDocCode` (`TDepDocCode`),
	KEY `TDepCode` (`TDepCode`),
	KEY `TDivTBraCode` (`TDepTDivCode`),
	KEY `VS4TDivisionVS4TDepartment` (`TDepTDivCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDepositChq` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDepositChq`;

# ---------- CREATE TABLE `VS4TDepositChq` ----------

CREATE TABLE `VS4TDepositChq` (
	`TCDCTDPMTDPSNo` VARCHAR(30) NOT NULL,
	`TCDCTDPMLn` INT NOT NULL DEFAULT '0',
	`TCDCTCHRNo` VARCHAR(30) NULL,
	`TCDCFlag1` INT NULL DEFAULT '0',
	`TCDCFlag2` INT NULL DEFAULT '0',
	`TCDCFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TCDCTDPMTDPSNo`, `TCDCTDPMLn`),
	UNIQUE KEY `VS4TCashDepositMBVS4TDepositChq` (`TCDCTDPMTDPSNo`, `TCDCTDPMLn`),
	KEY `VS4TChequeRecVS4TDepositChq` (`TCDCTCHRNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDepositChqSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDepositChqSub`;

# ---------- CREATE TABLE `VS4TDepositChqSub` ----------

CREATE TABLE `VS4TDepositChqSub` (
	`TCDQTDPMTDPSNo` VARCHAR(30) NOT NULL,
	`TCDQTDPMLn` INT NOT NULL DEFAULT '0',
	`TCDQTCHSNo` VARCHAR(30) NULL,
	`TCDQFlag1` INT NULL DEFAULT '0',
	`TCDQFlag2` INT NULL DEFAULT '0',
	`TCDQFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TCDQTDPMTDPSNo`, `TCDQTDPMLn`),
	UNIQUE KEY `VS4TCashDepositMBVS4TDepositChqSub` (`TCDQTDPMTDPSNo`, `TCDQTDPMLn`),
	KEY `VS4TChequeSubVS4TDepositChqSub` (`TCDQTCHSNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDistrict` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDistrict`;

# ---------- CREATE TABLE `VS4TDistrict` ----------

CREATE TABLE `VS4TDistrict` (
	`TSPVCode` VARCHAR(4) NOT NULL,
	`TSPvName` VARCHAR(50) NULL,
	`TSPvName2` VARCHAR(50) NULL,
	`TSPvTPrvCode` VARCHAR(3) NULL,
	`TSPvPostalCode` VARCHAR(5) NULL,
	`TSPvFlag1` SMALLINT NULL DEFAULT '0',
	`TSPvFlag2` SMALLINT NULL DEFAULT '0',
	`TSPvFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSPVCode`),
	KEY `VS4TProvinceVS4TDistrict` (`TSPvTPrvCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDivision` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDivision`;

# ---------- CREATE TABLE `VS4TDivision` ----------

CREATE TABLE `VS4TDivision` (
	`TDivCode` VARCHAR(30) NOT NULL,
	`TDivName` VARCHAR(50) NULL,
	`TDivName2` VARCHAR(50) NULL,
	`TDivTCsTAlias` VARCHAR(1) NULL,
	`TDivDocCode` VARCHAR(30) NULL,
	`TDivTBraCode` VARCHAR(30) NULL,
	`TDivInSideDepth` SMALLINT NULL DEFAULT '0',
	`TDivTDiTCode` VARCHAR(30) NULL,
	`TDivLevel` SMALLINT NULL DEFAULT '0',
	`TDivPathKey` VARCHAR(30) NULL,
	`TDivPathWidth` SMALLINT NULL DEFAULT '0',
	`TDivPath` VARCHAR(255) NULL,
	`TDivFlag1` SMALLINT NULL DEFAULT '0',
	`TDivFlag2` SMALLINT NULL DEFAULT '0',
	`TDivFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDivCode`),
	KEY `TBraDocCode` (`TDivDocCode`),
	KEY `TDivCode` (`TDivCode`),
	KEY `TDivTBraCode` (`TDivTBraCode`),
	KEY `TDivTDvTAlias` (`TDivTCsTAlias`),
	KEY `TWahPathKey` (`TDivPathKey`),
	KEY `VS4TBranchVS4TDivision` (`TDivTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDO` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDO`;

# ---------- CREATE TABLE `VS4TDO` ----------

CREATE TABLE `VS4TDO` (
	`TPdyNo` VARCHAR(30) NOT NULL,
	`TPdyDate` DATETIME NULL,
	`TPdyRefNo` VARCHAR(30) NULL,
	`TPdyRefDate` DATETIME NULL,
	`TPdyTBraCode` VARCHAR(30) NULL,
	`TPdyTPrjCode` VARCHAR(30) NULL,
	`TPdyTARNCode` VARCHAR(30) NULL,
	`TPdyCustomerCode` VARCHAR(30) NULL,
	`TPdyCustomerName` VARCHAR(200) NULL,
	`TPdyDeliveryTo` VARCHAR(255) NULL,
	`TPdyCountryOrigin` VARCHAR(50) NULL,
	`TPdyCountryTo` VARCHAR(50) NULL,
	`TPdyTShpCode` VARCHAR(30) NULL,
	`TPdyTShpName` VARCHAR(200) NULL,
	`TPdyContainerNo` VARCHAR(30) NULL,
	`TPdyInvoiceStatus` INT NULL DEFAULT '0',
	`TPdyDeliveryType` SMALLINT NULL DEFAULT '0',
	`TPdyTAssCode` VARCHAR(30) NULL,
	`TPdyTRouCode` VARCHAR(30) NULL,
	`TPdyMileStart` INT NULL DEFAULT '0',
	`TPdyMileEnd` INT NULL DEFAULT '0',
	`TPdyDistance` INT NULL DEFAULT '0',
	`TPdyFuelCost` FLOAT NULL DEFAULT '0',
	`TPdyFuelLoad` DOUBLE NULL DEFAULT '0',
	`TPdyCostTotal` FLOAT NULL DEFAULT '0',
	`TPdyVehicleNo` VARCHAR(30) NULL,
	`TPdyDriverCode` VARCHAR(160) NULL,
	`TPdyDriverName` VARCHAR(160) NULL,
	`TPdyDriverPhone` VARCHAR(50) NULL,
	`TPdyTEmpCode` VARCHAR(30) NULL,
	`TPdyLeaveBy` VARCHAR(30) NULL,
	`TPdyLeaveDate` DATETIME NULL,
	`TPdyLeaveTime` DATETIME NULL,
	`TPdyBackDate` DATETIME NULL,
	`TPdyBackTime` DATETIME NULL,
	`TPdyDescription` VARCHAR(255) NULL,
	`TPdyCreateCode` VARCHAR(30) NULL,
	`TPdyCreateBy` VARCHAR(140) NULL,
	`TPdyCreateDate` DATETIME NULL,
	`TPdyEditCode` VARCHAR(30) NULL,
	`TPdyEditBy` VARCHAR(140) NULL,
	`TPdyEditDate` DATETIME NULL,
	`TPdyConfirmStatus` SMALLINT NULL,
	`TPdyConfirmBy` VARCHAR(140) NULL,
	`TPdyConfirmDate` DATETIME NULL,
	`TPdyApproveStatus` SMALLINT NULL,
	`TPdyApproveBy` VARCHAR(140) NULL,
	`TPdyApproveDate` DATETIME NULL,
	`TPdyApproveNote` VARCHAR(80) NULL,
	`TPdyRevision` SMALLINT NULL,
	`TPdyCancelStatus` SMALLINT NULL,
	`TPdyCancelNo` VARCHAR(30) NULL,
	`TPdyCancelBy` VARCHAR(140) NULL,
	`TPdyCancelDate` DATETIME NULL,
	`TPdyCancelNote` VARCHAR(80) NULL,
	`TPdyFlag1` SMALLINT NULL,
	`TPdyFlag2` SMALLINT NULL,
	`TPdyFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPdyNo`),
	KEY `TCBTTBraCode` (`TPdyTBraCode`),
	KEY `TCBTTPrjCode` (`TPdyTPrjCode`),
	KEY `TPdtTRouCode` (`TPdyVehicleNo`),
	KEY `TPdyCustomerCode` (`TPdyCustomerCode`),
	KEY `TPdyTAssCode` (`TPdyTAssCode`),
	KEY `TPdyTEmpCode` (`TPdyTEmpCode`),
	KEY `TPdyTEmpCode1` (`TPdyLeaveBy`),
	KEY `TPdyTRouCode` (`TPdyTRouCode`),
	KEY `TPdyTShpCode` (`TPdyTShpCode`),
	KEY `TPdyTShpCode1` (`TPdyTShpName`),
	KEY `TPdyTShpName` (`TPdyContainerNo`),
	KEY `TPWOTCmpCode` (`TPdyCustomerName`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDOBoxSet` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDOBoxSet`;

# ---------- CREATE TABLE `VS4TDOBoxSet` ----------

CREATE TABLE `VS4TDOBoxSet` (
	`TDBSNo` VARCHAR(30) NOT NULL,
	`TDBSQuantity` INT NULL,
	`TDBSCustomerName` VARCHAR(200) NULL,
	`TDBSDeliveryTo` VARCHAR(255) NULL,
	`TDBSNote` VARCHAR(255) NULL,
	`TDBSIsDO` SMALLINT NULL,
	`TDBSFlag1` SMALLINT NULL,
	`TDBSFlag2` SMALLINT NULL,
	`TDBSFlag3` SMALLINT NULL,
	PRIMARY KEY (`TDBSNo`),
	KEY `TDSMCustomerName` (`TDBSCustomerName`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDOBoxSetMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDOBoxSetMB`;

# ---------- CREATE TABLE `VS4TDOBoxSetMB` ----------

CREATE TABLE `VS4TDOBoxSetMB` (
	`TDSMTDBSNo` VARCHAR(30) NOT NULL,
	`TDSMLn` INT NOT NULL,
	`TDSMDocType` SMALLINT NULL,
	`TDSMDocNo` VARCHAR(30) NULL,
	`TDSMIsPartial` SMALLINT NULL,
	`TDSMDeliveryDate` DATETIME NULL,
	`TDSMCustomerName` VARCHAR(200) NULL,
	`TDSMContactName` VARCHAR(150) NULL,
	`TDSMDeliveryTo` VARCHAR(255) NULL,
	`TDSMCityTo` VARCHAR(50) NULL,
	`TDSMTRouCode` VARCHAR(30) NULL,
	`TDSMTShpCode` VARCHAR(30) NULL,
	`TDSMDescription` VARCHAR(255) NULL,
	`TDSMFlag1` SMALLINT NULL,
	`TDSMFlag2` SMALLINT NULL,
	`TDSMFlag3` SMALLINT NULL,
	PRIMARY KEY (`TDSMTDBSNo`, `TDSMLn`),
	KEY `TDymCustomerName` (`TDSMCustomerName`),
	KEY `TDymTRouCode` (`TDSMTRouCode`),
	KEY `TDymTShpCode` (`TDSMTShpCode`),
	KEY `VS4TDOBoxSetVS4TDOBoxSetMB` (`TDSMTDBSNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDOBoxSetNo` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDOBoxSetNo`;

# ---------- CREATE TABLE `VS4TDOBoxSetNo` ----------

CREATE TABLE `VS4TDOBoxSetNo` (
	`TDSNTDBSNo` VARCHAR(30) NOT NULL,
	`TDSNLn` INT NOT NULL,
	`TDSNFlag1` SMALLINT NULL,
	`TDSNFlag2` SMALLINT NULL,
	`TDSNFlag3` SMALLINT NULL,
	PRIMARY KEY (`TDSNTDBSNo`, `TDSNLn`),
	KEY `VS4TDOBoxSetVS4TDOBoxSetNo` (`TDSNTDBSNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDocumentStatus` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDocumentStatus`;

# ---------- CREATE TABLE `VS4TDocumentStatus` ----------

CREATE TABLE `VS4TDocumentStatus` (
	`TDStCode` VARCHAR(30) NOT NULL,
	`TDStName` VARCHAR(100) NULL,
	`TDStName2` VARCHAR(100) NULL,
	`TDStDocCode` VARCHAR(30) NULL,
	`TDStSort` SMALLINT NULL DEFAULT '0',
	`TDStFlag1` SMALLINT NULL DEFAULT '0',
	`TDStFlag2` SMALLINT NULL DEFAULT '0',
	`TDStFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDStCode`),
	KEY `ProductMemberCategoryID` (`TDStFlag1`),
	KEY `ProductMemberProductID1` (`TDStName`),
	KEY `TDStName` (`TDStName2`),
	KEY `TPdGID` (`TDStCode`),
	KEY `TPTTDocCode` (`TDStDocCode`),
	KEY `TPTTFlag1` (`TDStFlag2`),
	KEY `TPTTFlag11` (`TDStFlag3`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDOMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDOMB`;

# ---------- CREATE TABLE `VS4TDOMB` ----------

CREATE TABLE `VS4TDOMB` (
	`TDymTPdyNo` VARCHAR(30) NOT NULL,
	`TDymLn` INT NOT NULL DEFAULT '0',
	`TDymDocType` SMALLINT NULL DEFAULT '0',
	`TDymDocNo` VARCHAR(50) NULL,
	`TDymTDBSNo` VARCHAR(50) NULL,
	`TDymTPrjCode` VARCHAR(50) NULL,
	`TDymTJobNo` VARCHAR(50) NULL,
	`TDymContactName` VARCHAR(150) NULL,
	`TDymTJbMLn` DOUBLE NULL DEFAULT '0',
	`TDymJobCode` VARCHAR(30) NULL,
	`TDymDescription` VARCHAR(150) NULL,
	`TDymTBraCode` VARCHAR(50) NULL,
	`TDymTARNCode` VARCHAR(30) NULL,
	`TDymCustomerName` VARCHAR(200) NULL,
	`TDymDeliveryTo` VARCHAR(255) NULL,
	`TDymCityTo` VARCHAR(50) NULL,
	`TDymNote` VARCHAR(255) NULL,
	`TDymAppointTime` DATETIME NULL,
	`TDymInvoiceStatus` INT NULL DEFAULT '0',
	`TDymTRouCode` VARCHAR(30) NULL,
	`TDymTShpCode` VARCHAR(30) NULL,
	`TDymTimeIn` DATETIME NULL,
	`TDymTimeOut` DATETIME NULL,
	`TDymMile` INT NULL DEFAULT '0',
	`TDymDistance` DOUBLE NULL DEFAULT '0',
	`TDymDeliveryHour` DOUBLE NULL DEFAULT '0',
	`TDymRountOrder` SMALLINT NULL DEFAULT '0',
	`TDymSetPlan` DOUBLE NULL DEFAULT '0',
	`TDymDonePlan` DOUBLE NULL DEFAULT '0',
	`TDymSetDoc` DOUBLE NULL DEFAULT '0',
	`TDymDoneDoc` DOUBLE NULL DEFAULT '0',
	`TDymSetStock` DOUBLE NULL DEFAULT '0',
	`TDymDoneStock` DOUBLE NULL DEFAULT '0',
	`TDymSetLogistic` DOUBLE NULL DEFAULT '0',
	`TDymDoneLogistic` DOUBLE NULL DEFAULT '0',
	`TDymDoneLog1` DOUBLE NULL DEFAULT '0',
	`TDymDoneLog2` DOUBLE NULL DEFAULT '0',
	`TDymDoneLog3` DOUBLE NULL DEFAULT '0',
	`TDymDoneLog4` DOUBLE NULL DEFAULT '0',
	`TDymDoneLog5` DOUBLE NULL DEFAULT '0',
	`TDymErrorNote` VARCHAR(100) NULL,
	`TDymNewDueDate` DATETIME NULL,
	`TDymCheckCode` VARCHAR(30) NULL,
	`TDymCheckBy` VARCHAR(160) NULL,
	`TDymCheckDate` DATETIME NULL,
	`TDymFlag1` SMALLINT NULL DEFAULT '0',
	`TDymFlag2` SMALLINT NULL DEFAULT '0',
	`TDymFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDymLn`, `TDymTPdyNo`),
	KEY `TDymCustomerName` (`TDymCustomerName`),
	KEY `TDymDocNo` (`TDymTDBSNo`),
	KEY `TDymTBraCode` (`TDymTBraCode`),
	KEY `TDymTRouCode` (`TDymTRouCode`),
	KEY `TPdyTShpCode` (`TDymTShpCode`),
	KEY `TPOBTPdtCode` (`TDymDocNo`),
	KEY `TPTSFreeTPOSCode` (`TDymJobCode`),
	KEY `TPWBID` (`TDymLn`),
	KEY `TPWBPdtCode1` (`TDymTJobNo`),
	KEY `TPWBTUntCode` (`TDymTPrjCode`),
	KEY `TTfMID` (`TDymTPdyNo`),
	KEY `VS4TProDeliveryDocVS4TProDeliveryMB` (`TDymTPdyNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDOMBDetail` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDOMBDetail`;

# ---------- CREATE TABLE `VS4TDOMBDetail` ----------

CREATE TABLE `VS4TDOMBDetail` (
	`TDMDTIoMTIvoNo` VARCHAR(30) NOT NULL,
	`TDMDTIoMLn` INT NOT NULL DEFAULT '0',
	`TDMDQuantitySend` DOUBLE NULL DEFAULT '0',
	`TDMDSetPlan` DOUBLE NULL DEFAULT '0',
	`TDMDDonePlan` DOUBLE NULL DEFAULT '0',
	`TDMDSetDoc` DOUBLE NULL DEFAULT '0',
	`TDMDDoneDoc` DOUBLE NULL DEFAULT '0',
	`TDMDSetStock` DOUBLE NULL DEFAULT '0',
	`TDMDDoneStock` DOUBLE NULL DEFAULT '0',
	`TDMDSetLogistic` DOUBLE NULL DEFAULT '0',
	`TDMDDoneLogistic` DOUBLE NULL DEFAULT '0',
	`TDMDDoneLog1` DOUBLE NULL DEFAULT '0',
	`TDMDDoneLog2` DOUBLE NULL DEFAULT '0',
	`TDMDDoneLog3` DOUBLE NULL DEFAULT '0',
	`TDMDDoneLog4` DOUBLE NULL DEFAULT '0',
	`TDMDDoneLog5` DOUBLE NULL DEFAULT '0',
	`TDMDErrorNote` VARCHAR(100) NULL,
	`TDMDNewDueDate` DATETIME NULL,
	`TDMDCheckCode` VARCHAR(30) NULL,
	`TDMDCheckBy` VARCHAR(160) NULL,
	`TDMDCheckDate` DATETIME NULL,
	`TDMDFlag1` SMALLINT NULL DEFAULT '0',
	`TDMDFlag2` SMALLINT NULL DEFAULT '0',
	`TDMDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDMDTIoMTIvoNo`, `TDMDTIoMLn`),
	KEY `TDymLn` (`TDMDTIoMLn`),
	KEY `TTfMID` (`TDMDTIoMTIvoNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDrawing` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDrawing`;

# ---------- CREATE TABLE `VS4TDrawing` ----------

CREATE TABLE `VS4TDrawing` (
	`TDwgCode` VARCHAR(30) NOT NULL,
	`TDwgBarCode` VARCHAR(30) NULL,
	`TDwgName` VARCHAR(50) NULL,
	`TDwgName2` VARCHAR(50) NULL,
	`TDwgDescription` VARCHAR(100) NULL,
	`TDwgTEmpCode` VARCHAR(30) NULL,
	`TDwgDesignerName` VARCHAR(160) NULL,
	`TDwgEstimateCost` FLOAT NULL DEFAULT '0',
	`TDwgEstimateCode` VARCHAR(10) NULL,
	`TDwgEstimatePrice` FLOAT NULL DEFAULT '0',
	`TDwgUnitType` SMALLINT NULL DEFAULT '0',
	`TDwgTUntCode` VARCHAR(15) NULL,
	`TDwgTUntCode2` VARCHAR(15) NULL,
	`TDwgTUntCode3` VARCHAR(15) NULL,
	`TDwgUnit2Ratio` DOUBLE NULL DEFAULT '0',
	`TDwgUnit3Ratio` DOUBLE NULL DEFAULT '0',
	`TDwgUseImageCode` SMALLINT NULL DEFAULT '0',
	`TDwgUseIconImage` SMALLINT NULL DEFAULT '0',
	`TDwgImage1` VARCHAR(50) NULL,
	`TDwgImage2` VARCHAR(50) NULL,
	`TDwgIcon1` VARCHAR(50) NULL,
	`TDwgPackText1` VARCHAR(255) NULL,
	`TDwgPackText2` VARCHAR(255) NULL,
	`TDwgPackAlias1` VARCHAR(255) NULL,
	`TDwgPackAlias2` VARCHAR(255) NULL,
	`TDwgRefNo` VARCHAR(30) NULL,
	`TDwgDesignDate` DATETIME NULL,
	`TDwgStatus` INT NULL DEFAULT '0',
	`TDwgTotalBuild` INT NULL DEFAULT '0',
	`TDwgCreateCode` VARCHAR(30) NULL,
	`TDwgCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDwgEditCode` VARCHAR(30) NULL,
	`TDwgEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDwgConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TDwgConfirmCode` VARCHAR(30) NULL,
	`TDwgConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TDwgConfirmBy` VARCHAR(160) NULL,
	`TDwgTextSort` VARCHAR(30) NULL,
	`TDwgFlag1` SMALLINT NULL DEFAULT '0',
	`TDwgFlag2` SMALLINT NULL DEFAULT '0',
	`TDwgFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDwgCode`),
	KEY `TACCConfirmCode` (`TDwgConfirmCode`),
	KEY `TDwgCode` (`TDwgCode`),
	KEY `TDwgCode1` (`TDwgBarCode`),
	KEY `TDwgEstimateCode` (`TDwgEstimateCode`),
	KEY `TDwgTEmpCode` (`TDwgTEmpCode`),
	KEY `TDwgTUntCode` (`TDwgTUntCode`),
	KEY `TDwgTUntCode1` (`TDwgTUntCode2`),
	KEY `TDwgTUntCode2` (`TDwgTUntCode3`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDrawingImage` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDrawingImage`;

# ---------- CREATE TABLE `VS4TDrawingImage` ----------

CREATE TABLE `VS4TDrawingImage` (
	`TDImTDwgCode` VARCHAR(30) NOT NULL,
	`TDImCode` INT NOT NULL DEFAULT '0',
	`TDImImageName` VARCHAR(100) NULL,
	`TDImImageFile` VARCHAR(50) NULL,
	`TDImFlag1` SMALLINT NULL DEFAULT '0',
	`TDImFlag2` SMALLINT NULL DEFAULT '0',
	`TDImFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDImTDwgCode`, `TDImCode`),
	KEY `TAsITAssCode` (`TDImTDwgCode`),
	KEY `VS4TDrawingVS4TDrawingImage` (`TDImTDwgCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TDrawingMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TDrawingMB`;

# ---------- CREATE TABLE `VS4TDrawingMB` ----------

CREATE TABLE `VS4TDrawingMB` (
	`TDwMTDwgCode` VARCHAR(30) NOT NULL,
	`TDwMTPdtCode` VARCHAR(30) NOT NULL,
	`TDwMSort` INT NULL DEFAULT '0',
	`TDwMQuantity` DOUBLE NULL DEFAULT '1',
	`TDwMQuantity2` DOUBLE NULL DEFAULT '1',
	`TDwMQuantity3` DOUBLE NULL DEFAULT '1',
	`TDwMQuantityRange` DOUBLE NULL DEFAULT '1',
	`TDwMQuantityRange2` DOUBLE NULL DEFAULT '1',
	`TDwMQuantityRange3` DOUBLE NULL DEFAULT '1',
	`TDwMCanDepack` SMALLINT NULL DEFAULT '0',
	`TDwMStandardCost` FLOAT NULL DEFAULT '0',
	`TDwMUnitText1` VARCHAR(30) NULL,
	`TDwMUnitText2` VARCHAR(30) NULL,
	`TDwMUnitText3` VARCHAR(30) NULL,
	`TDwMPackText1` VARCHAR(200) NULL,
	`TDwMPackText2` VARCHAR(200) NULL,
	`TDwMPackAlias1` VARCHAR(200) NULL,
	`TDwMPackAlias2` VARCHAR(200) NULL,
	`TDwMRemark` VARCHAR(50) NULL,
	`TDwMFlag1` SMALLINT NULL DEFAULT '0',
	`TDwMFlag2` SMALLINT NULL DEFAULT '0',
	`TDwMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TDwMTDwgCode`, `TDwMTPdtCode`),
	KEY `SetSaleID` (`TDwMTDwgCode`),
	KEY `TPoMTPdtCode` (`TDwMTPdtCode`),
	KEY `VS4TDrawingVS4TDrawingMB` (`TDwMTDwgCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEducation` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEducation`;

# ---------- CREATE TABLE `VS4TEducation` ----------

CREATE TABLE `VS4TEducation` (
	`TEduCode` VARCHAR(30) NOT NULL,
	`TEduName` VARCHAR(50) NULL,
	`TEduName2` VARCHAR(50) NULL,
	`TEduGradeLevel` SMALLINT NULL DEFAULT '0',
	`TEduFlag1` SMALLINT NULL DEFAULT '0',
	`TEduFlag2` SMALLINT NULL DEFAULT '0',
	`TEduFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEduCode`),
	KEY `TEduCode` (`TEduCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpActiveAmass` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpActiveAmass`;

# ---------- CREATE TABLE `VS4TEmpActiveAmass` ----------

CREATE TABLE `VS4TEmpActiveAmass` (
	`TEAATSAPTEmTCode` VARCHAR(30) NOT NULL,
	`TEAATSaPDate` DATETIME NOT NULL,
	`TEAATEmpCode` VARCHAR(50) NOT NULL,
	`TEAASalaryPeriod` VARCHAR(50) NULL,
	`TEAAType` INT NULL DEFAULT '0',
	`TEAAFlag1` SMALLINT NULL DEFAULT '0',
	`TEAAFlag2` SMALLINT NULL DEFAULT '0',
	`TEAAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEAATSAPTEmTCode`, `TEAATSaPDate`, `TEAATEmpCode`),
	KEY `TEGATEmpCode` (`TEAATEmpCode`),
	KEY `TEpsTSaPDate` (`TEAATSaPDate`),
	KEY `TEpsTSAPTEmTCode` (`TEAATSAPTEmTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpAddMoney` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpAddMoney`;

# ---------- CREATE TABLE `VS4TEmpAddMoney` ----------

CREATE TABLE `VS4TEmpAddMoney` (
	`TAmyCode` VARCHAR(30) NOT NULL,
	`TAmyTAMTAlias` VARCHAR(30) NULL,
	`TAmyName` VARCHAR(80) NULL,
	`TAmyName2` VARCHAR(80) NULL,
	`TAmyTEmpCode` VARCHAR(30) NULL,
	`TAmyTaxName` VARCHAR(20) NULL,
	`TAmyTAccCode` VARCHAR(30) NULL,
	`TAmyTIDLAccCode` VARCHAR(30) NULL,
	`TAmyShortName` VARCHAR(15) NULL,
	`TAmyShortName2` VARCHAR(15) NULL,
	`TAmyAmassName` VARCHAR(80) NULL,
	`TAmyAmassName2` VARCHAR(80) NULL,
	`TAmyAmassSName` VARCHAR(15) NULL,
	`TAmyAmassSName2` VARCHAR(15) NULL,
	`TAmyRate` DOUBLE NULL DEFAULT '0',
	`TAmyRateType` INT NULL DEFAULT '0',
	`TAmyBaseSource` SMALLINT NULL DEFAULT '0',
	`TAmyBaseMode` INT NULL DEFAULT '0',
	`TAmyTUntCode` VARCHAR(15) NULL,
	`TAmyCheckMoney` SMALLINT NULL DEFAULT '0',
	`TAmyCheckFix` SMALLINT NULL DEFAULT '0',
	`TAmyPercentGroup` DOUBLE NULL DEFAULT '0',
	`TAmyPayDay` INT NULL DEFAULT '0',
	`TAmyInterestRate` DOUBLE NULL DEFAULT '0',
	`TAmyInterestType` SMALLINT NULL DEFAULT '0',
	`TAmyBaseForPeriod` SMALLINT NULL DEFAULT '0',
	`TAmyCalcSalary` SMALLINT NULL,
	`TAmyCalcTax` SMALLINT NULL DEFAULT '0',
	`TAmyCalcSTAX` SMALLINT NULL DEFAULT '0',
	`TAmyAllowQuantity` DOUBLE NULL DEFAULT '0',
	`TAmyUseAllow` SMALLINT NULL DEFAULT '0',
	`TAmyCutTip` SMALLINT NULL DEFAULT '0',
	`TAmyAverageTotal` SMALLINT NULL DEFAULT '0',
	`TAmyTPunCode` VARCHAR(30) NULL,
	`TAmyAmassComp` SMALLINT NULL DEFAULT '0',
	`TAmyAmassEmp` SMALLINT NULL DEFAULT '0',
	`TAmyCondition` SMALLINT NULL DEFAULT '0',
	`TAmyExpenseType` INT NULL DEFAULT '0',
	`TAmyFixUnit` SMALLINT NULL DEFAULT '0',
	`TAmyDescription` VARCHAR(150) NULL,
	`TAmyFlag1` SMALLINT NULL DEFAULT '0',
	`TAmyFlag2` SMALLINT NULL DEFAULT '0',
	`TAmyFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAmyCode`),
	KEY `TAmyCode` (`TAmyCode`),
	KEY `TAmyTAcccode` (`TAmyTAccCode`),
	KEY `TAmyTAccCode1` (`TAmyTIDLAccCode`),
	KEY `TAmyTAMTAlias` (`TAmyTAMTAlias`),
	KEY `TAmyTEmpCode` (`TAmyTEmpCode`),
	KEY `TSalTPunCode` (`TAmyTPunCode`),
	KEY `VS4TEmpAddMoneyTYVS4TEmpAddMoney` (`TAmyTAMTAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpAddMoneyTY` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpAddMoneyTY`;

# ---------- CREATE TABLE `VS4TEmpAddMoneyTY` ----------

CREATE TABLE `VS4TEmpAddMoneyTY` (
	`TAMTAlias` VARCHAR(30) NOT NULL,
	`TAMTName` VARCHAR(100) NULL,
	`TAMTName2` VARCHAR(100) NULL,
	`TAMTTaxName` VARCHAR(20) NULL,
	`TAMTGroup` VARCHAR(30) NULL,
	`TAMTDocCode` VARCHAR(30) NULL,
	`TAMTFlag1` SMALLINT NULL DEFAULT '0',
	`TAMTFlag2` SMALLINT NULL DEFAULT '0',
	`TAMTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TAMTAlias`),
	KEY `TBnkCode` (`TAMTAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpAmassType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpAmassType`;

# ---------- CREATE TABLE `VS4TEmpAmassType` ----------

CREATE TABLE `VS4TEmpAmassType` (
	`TEATTEmpCode` VARCHAR(30) NOT NULL,
	`TEATCheckGroup` SMALLINT NOT NULL DEFAULT '0',
	`TEATTEmTCode` VARCHAR(30) NOT NULL,
	`TEATPaymentDate` DATETIME NOT NULL,
	`TEATBalanceFlag` SMALLINT NOT NULL DEFAULT '0',
	`TEATSalaryPeriod` VARCHAR(30) NULL,
	`TEATMonth` SMALLINT NULL DEFAULT '0',
	`TEATYear` SMALLINT NULL DEFAULT '0',
	`TEATTBraCode` VARCHAR(30) NULL,
	`TEATTDivCode` VARCHAR(30) NULL,
	`TEATDepCode` VARCHAR(30) NULL,
	`TEATSecCode` VARCHAR(30) NULL,
	`TEATTotalDay` SMALLINT NULL DEFAULT '0',
	`TEATSubDay` SMALLINT NULL DEFAULT '0',
	`TEATSubDayHol` SMALLINT NULL DEFAULT '0',
	`TEATSubDayChild` SMALLINT NULL DEFAULT '0',
	`TEATAddSalary` FLOAT NULL DEFAULT '0',
	`TEATSubSalary` FLOAT NULL DEFAULT '0',
	`TEATSubSalaryHol` FLOAT NULL DEFAULT '0',
	`TEATSubSalaryChild` FLOAT NULL DEFAULT '0',
	`TEATAddOT` FLOAT NULL DEFAULT '0',
	`TEATSubOT` FLOAT NULL DEFAULT '0',
	`TEATSubOT15` FLOAT NULL DEFAULT '0',
	`TEATSubOT2` FLOAT NULL DEFAULT '0',
	`TEATSubOT3` FLOAT NULL DEFAULT '0',
	`TEATAddTIP` FLOAT NULL DEFAULT '0',
	`TEATSubTip` FLOAT NULL DEFAULT '0',
	`TEATSubTipBonus` FLOAT NULL DEFAULT '0',
	`TEATSubTipCom` FLOAT NULL DEFAULT '0',
	`TEATAddWelfare` FLOAT NULL DEFAULT '0',
	`TEATSubAddWelfare` FLOAT NULL DEFAULT '0',
	`TEATSubAddWelfare1` FLOAT NULL DEFAULT '0',
	`TEATSubAddWelfare2` FLOAT NULL DEFAULT '0',
	`TEATSubAddWelfare3` FLOAT NULL DEFAULT '0',
	`TEATSubAddWelfare4` FLOAT NULL DEFAULT '0',
	`TEATSubAddWelfare5` FLOAT NULL DEFAULT '0',
	`TEATAddMoneyFix` FLOAT NULL DEFAULT '0',
	`TEATAddMoneyNoFix` FLOAT NULL DEFAULT '0',
	`TEATAddTotal` FLOAT NULL DEFAULT '0',
	`TEATCutWelfare` FLOAT NULL DEFAULT '0',
	`TEATCutLoan` FLOAT NULL DEFAULT '0',
	`TEATCutSTAX` FLOAT NULL DEFAULT '0',
	`TEATCutSFund` FLOAT NULL DEFAULT '0',
	`TEATCutFund` FLOAT NULL DEFAULT '0',
	`TEATCutTAX` FLOAT NULL DEFAULT '0',
	`TEATCutPunish` FLOAT NULL DEFAULT '0',
	`TEATCutMoneyFix` FLOAT NULL DEFAULT '0',
	`TEATCutMoneyNoFix` FLOAT NULL DEFAULT '0',
	`TEATCutTotal` FLOAT NULL DEFAULT '0',
	`TEATAmassTotal` FLOAT NULL DEFAULT '0',
	`TEATAmassFundInt` FLOAT NULL DEFAULT '0',
	`TEATCutAllTotal` FLOAT NULL DEFAULT '0',
	`TEATNetTotal` FLOAT NULL DEFAULT '0',
	`TEATFlag1` INT NULL DEFAULT '0',
	`TEATFlag2` INT NULL DEFAULT '0',
	`TEATFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TEATTEmpCode`, `TEATCheckGroup`, `TEATTEmTCode`, `TEATPaymentDate`, `TEATBalanceFlag`),
	KEY `TEATDepCode` (`TEATDepCode`),
	KEY `TEATSecCode` (`TEATSecCode`),
	KEY `TEATTDivCode` (`TEATTBraCode`),
	KEY `TEATTDivCode1` (`TEATTDivCode`),
	KEY `TEATTEmTCode` (`TEATTEmTCode`),
	KEY `VS4TBranchVS4TEmpAmassType` (`TEATTBraCode`),
	KEY `VS4TDivisionVS4TEmpAmassType` (`TEATTDivCode`),
	KEY `VS4TEmployeeTypeVS4TEmpAmassType` (`TEATTEmTCode`),
	KEY `VS4TEmployeeVS4TEmpAmassType` (`TEATTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpBuddy` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpBuddy`;

# ---------- CREATE TABLE `VS4TEmpBuddy` ----------

CREATE TABLE `VS4TEmpBuddy` (
	`TEBuTEmpCode` VARCHAR(30) NOT NULL,
	`TEBuLn` INT NOT NULL DEFAULT '0',
	`TEBuName` VARCHAR(160) NULL,
	`TEBuSex` VARCHAR(1) NULL,
	`TEBuBirthDay` DATETIME NULL,
	`TEBuDeadDay` DATETIME NULL,
	`TEBuIDno` VARCHAR(15) NULL,
	`TEBuTaxNo` VARCHAR(15) NULL,
	`TEBuHasIncome` SMALLINT NULL DEFAULT '0',
	`TEBuIsDead` SMALLINT NULL DEFAULT '0',
	`TEBuHasSeniorCard` SMALLINT NULL DEFAULT '0',
	`TEBuTel` VARCHAR(20) NULL,
	`TEBuFlag1` SMALLINT NULL DEFAULT '0',
	`TEBuFlag2` SMALLINT NULL DEFAULT '0',
	`TEBuFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEBuTEmpCode`, `TEBuLn`),
	KEY `TEprTEmpCode` (`TEBuTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpBuddy` (`TEBuTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpChild` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpChild`;

# ---------- CREATE TABLE `VS4TEmpChild` ----------

CREATE TABLE `VS4TEmpChild` (
	`TEcdTEmpCode` VARCHAR(30) NOT NULL,
	`TEcdLn` INT NOT NULL DEFAULT '0',
	`TEcdGender` VARCHAR(1) NULL,
	`TEcdName` VARCHAR(160) NULL,
	`TEcdBirthday` DATETIME NULL,
	`TEcdStudying` SMALLINT NULL DEFAULT '0',
	`TEcdStudyLevel` INT NULL DEFAULT '0',
	`TEcdDescription` VARCHAR(150) NULL,
	`TEcdFlag1` SMALLINT NULL DEFAULT '0',
	`TEcdFlag2` SMALLINT NULL DEFAULT '0',
	`TEcdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEcdLn`, `TEcdTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpChild` (`TEcdTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpCollateFund` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpCollateFund`;

# ---------- CREATE TABLE `VS4TEmpCollateFund` ----------

CREATE TABLE `VS4TEmpCollateFund` (
	`TEcFTEmpCode` VARCHAR(30) NOT NULL,
	`TEcFLn` INT NOT NULL DEFAULT '0',
	`TEcFType` SMALLINT NULL DEFAULT '0',
	`TEcFDescription` VARCHAR(150) NULL,
	`TEcFAmount` VARCHAR(50) NULL,
	`TEcFPaid` VARCHAR(50) NULL,
	`TEcFArrear` VARCHAR(50) NULL,
	`TEcFTRVHNo` VARCHAR(50) NULL,
	`TEcFFlag1` SMALLINT NULL DEFAULT '0',
	`TEcFFlag2` SMALLINT NULL DEFAULT '0',
	`TEcFFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEcFLn`, `TEcFTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpCollateFund` (`TEcFTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpCollateral` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpCollateral`;

# ---------- CREATE TABLE `VS4TEmpCollateral` ----------

CREATE TABLE `VS4TEmpCollateral` (
	`TEclTEmpCode` VARCHAR(30) NOT NULL,
	`TEclLn` INT NOT NULL DEFAULT '0',
	`TEclName` VARCHAR(50) NULL,
	`TEclRelation` VARCHAR(50) NULL,
	`TEclPosition` VARCHAR(50) NULL,
	`TEclAddress` VARCHAR(255) NULL,
	`TEclTelephone` VARCHAR(20) NULL,
	`TEclDescription` VARCHAR(150) NULL,
	`TEclFlag1` SMALLINT NULL DEFAULT '0',
	`TEclFlag2` SMALLINT NULL DEFAULT '0',
	`TEclFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEclLn`, `TEclTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpCollateral` (`TEclTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpContact` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpContact`;

# ---------- CREATE TABLE `VS4TEmpContact` ----------

CREATE TABLE `VS4TEmpContact` (
	`TCttTEmpCode` VARCHAR(30) NOT NULL,
	`TCttLn` INT NOT NULL DEFAULT '0',
	`TCttName` VARCHAR(50) NULL,
	`TCttRelation` VARCHAR(50) NULL,
	`TCttPosition` VARCHAR(50) NULL,
	`TCttAddress` VARCHAR(250) NULL,
	`TCttTelephone` VARCHAR(50) NULL,
	`TCttDescription` VARCHAR(250) NULL,
	`TCttFlag1` SMALLINT NULL DEFAULT '0',
	`TCttFlag2` SMALLINT NULL DEFAULT '0',
	`TCttFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TCttLn`, `TCttTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpContact` (`TCttTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpGroupDoc` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpGroupDoc`;

# ---------- CREATE TABLE `VS4TEmpGroupDoc` ----------

CREATE TABLE `VS4TEmpGroupDoc` (
	`TEgdNo` VARCHAR(30) NOT NULL,
	`TEgdDate` DATETIME NULL,
	`TEgdTime` DATETIME NULL,
	`TEgdRefNo` VARCHAR(30) NULL,
	`TEgdTBraCode` VARCHAR(30) NULL,
	`TEgdTDivCode` VARCHAR(50) NULL,
	`TEgdTDepCode` VARCHAR(30) NULL,
	`TEgdTSecCode` VARCHAR(30) NULL,
	`TEgdDescription` VARCHAR(80) NULL,
	`TEgdCreateCode` VARCHAR(30) NULL,
	`TEgdCreateBy` VARCHAR(140) NULL,
	`TEgdCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEgdEditCode` VARCHAR(30) NULL,
	`TEgdEditBy` VARCHAR(140) NULL,
	`TEgdEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEgdConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TEgdConfirmBy` VARCHAR(140) NULL,
	`TEgdConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEgdConfirmNote` VARCHAR(80) NULL,
	`TEgdApproveStatus` SMALLINT NULL DEFAULT '0',
	`TEgdApproveBy` VARCHAR(140) NULL,
	`TEgdApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEgdApproveNote` VARCHAR(80) NULL,
	`TEgdRevision` SMALLINT NULL DEFAULT '0',
	`TEgdCancelStatus` SMALLINT NULL DEFAULT '0',
	`TEgdCancelNo` VARCHAR(30) NULL,
	`TEgdCancelBy` VARCHAR(140) NULL,
	`TEgdCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEgdCancelNote` VARCHAR(80) NULL,
	`TEgdFlag1` SMALLINT NULL DEFAULT '0',
	`TEgdFlag2` SMALLINT NULL DEFAULT '0',
	`TEgdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEgdNo`),
	KEY `TDepCode` (`TEgdNo`),
	KEY `TEpaTBraCode` (`TEgdTBraCode`),
	KEY `TEpaTDepCode` (`TEgdTDepCode`),
	KEY `TEpaTDivCode` (`TEgdTDivCode`),
	KEY `TEpaTSecCode` (`TEgdTSecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpHisEdu` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpHisEdu`;

# ---------- CREATE TABLE `VS4TEmpHisEdu` ----------

CREATE TABLE `VS4TEmpHisEdu` (
	`THedTEmpCode` VARCHAR(30) NOT NULL,
	`THedLn` INT NOT NULL DEFAULT '0',
	`THedGradeLevel` SMALLINT NULL DEFAULT '0',
	`THedGradeName` VARCHAR(50) NULL,
	`THedName` VARCHAR(50) NULL,
	`THedStartYear` VARCHAR(4) NULL,
	`THedEndYear` VARCHAR(4) NULL,
	`THedGrade` VARCHAR(10) NULL,
	`THedMajor` VARCHAR(150) NULL,
	`THedDescription` VARCHAR(150) NULL,
	`THedFlag1` SMALLINT NULL DEFAULT '0',
	`THedFlag2` SMALLINT NULL DEFAULT '0',
	`THedFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`THedLn`, `THedTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpHisEdu` (`THedTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpHisPosition` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpHisPosition`;

# ---------- CREATE TABLE `VS4TEmpHisPosition` ----------

CREATE TABLE `VS4TEmpHisPosition` (
	`TEHPTEmpCode` VARCHAR(30) NOT NULL,
	`TEHPStartDate` DATETIME NOT NULL,
	`TEHPLn` INT NOT NULL DEFAULT '0',
	`TEHPTPstCode` VARCHAR(50) NULL,
	`TEHPPosition` VARCHAR(50) NULL,
	`TEHPBranch` VARCHAR(50) NULL,
	`TEHPDivision` VARCHAR(50) NULL,
	`TEHPDepartment` VARCHAR(50) NULL,
	`TEHPSection` VARCHAR(50) NULL,
	`TEHPSalary` FLOAT NULL DEFAULT '0',
	`TEHPCustom` FLOAT NULL DEFAULT '0',
	`TEHPDependCode` VARCHAR(30) NULL,
	`TEHPDependOn` VARCHAR(160) NULL,
	`TEHPFlag1` SMALLINT NULL DEFAULT '0',
	`TEHPFlag2` SMALLINT NULL DEFAULT '0',
	`TEHPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEHPTEmpCode`, `TEHPLn`, `TEHPStartDate`),
	KEY `TEHPTempCode` (`TEHPTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpHisProduce` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpHisProduce`;

# ---------- CREATE TABLE `VS4TEmpHisProduce` ----------

CREATE TABLE `VS4TEmpHisProduce` (
	`TEHSTEmpCode` VARCHAR(30) NOT NULL,
	`TEHSLn` INT NOT NULL DEFAULT '0',
	`TEHSDate` DATETIME NULL,
	`TEHSDescription` VARCHAR(100) NULL,
	`TEHSScroll` DOUBLE NULL DEFAULT '0',
	`TEHSTEwoTEidNo` VARCHAR(30) NULL,
	`TEHSTEwoLn` INT NULL DEFAULT '0',
	`TEHSFlag1` SMALLINT NULL DEFAULT '0',
	`TEHSFlag2` SMALLINT NULL DEFAULT '0',
	`TEHSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEHSTEmpCode`, `TEHSLn`),
	KEY `TEHUTEmpCode` (`TEHSTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpHisProduce` (`TEHSTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpHisPunish` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpHisPunish`;

# ---------- CREATE TABLE `VS4TEmpHisPunish` ----------

CREATE TABLE `VS4TEmpHisPunish` (
	`TEHUTEmpCode` VARCHAR(30) NOT NULL,
	`TEHULn` INT NOT NULL DEFAULT '0',
	`TEHUDate` DATETIME NULL,
	`TEHUDescription` VARCHAR(100) NULL,
	`TEHUResult` VARCHAR(100) NULL,
	`TEHUTEPNCode` VARCHAR(30) NULL,
	`TEHUTEPNName` VARCHAR(80) NULL,
	`TEHUScroll` DOUBLE NULL DEFAULT '0',
	`TEHUTEwoTEidNo` VARCHAR(30) NULL,
	`TEHUTEwoLn` INT NULL DEFAULT '0',
	`TEHUFlag1` SMALLINT NULL DEFAULT '0',
	`TEHUFlag2` SMALLINT NULL DEFAULT '0',
	`TEHUFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEHUTEmpCode`, `TEHULn`),
	KEY `TEHUTEmpCode` (`TEHUTEmpCode`),
	KEY `TPunCode` (`TEHUTEPNCode`),
	KEY `VS4TEmployeeVS4TEmpHisPunish` (`TEHUTEmpCode`),
	KEY `VS4TEmpPunishVS4TEmpHisPunish` (`TEHUTEPNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpHisWork` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpHisWork`;

# ---------- CREATE TABLE `VS4TEmpHisWork` ----------

CREATE TABLE `VS4TEmpHisWork` (
	`THwkTEmpCode` VARCHAR(30) NOT NULL,
	`THwkLn` INT NOT NULL DEFAULT '0',
	`THwkName` VARCHAR(50) NULL,
	`THwkStartYear` VARCHAR(4) NULL,
	`THwkEndYear` VARCHAR(4) NULL,
	`THwkPosition` VARCHAR(50) NULL,
	`THwkSalary` FLOAT NULL DEFAULT '0',
	`THwkDescription` VARCHAR(150) NULL,
	`THwkCause` VARCHAR(100) NULL,
	`THwkFlag1` SMALLINT NULL DEFAULT '0',
	`THwkFlag2` SMALLINT NULL DEFAULT '0',
	`THwkFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`THwkLn`, `THwkTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpHisWork` (`THwkTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpHoliday` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpHoliday`;

# ---------- CREATE TABLE `VS4TEmpHoliday` ----------

CREATE TABLE `VS4TEmpHoliday` (
	`TEhdTBraCode` VARCHAR(30) NOT NULL,
	`TEhdHolidayDate` DATETIME NOT NULL,
	`TEhdHolidayName` VARCHAR(100) NULL,
	`TEhdYear` SMALLINT NULL DEFAULT '0',
	`TEhdFlag1` SMALLINT NULL DEFAULT '0',
	`TEhdFlag2` SMALLINT NULL DEFAULT '0',
	`TEhdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEhdTBraCode`, `TEhdHolidayDate`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpIdentify` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpIdentify`;

# ---------- CREATE TABLE `VS4TEmpIdentify` ----------

CREATE TABLE `VS4TEmpIdentify` (
	`TIDETEmpCode` VARCHAR(30) NOT NULL,
	`TIDELn` INT NOT NULL DEFAULT '0',
	`TIDEIdentify1` TEXT NULL,
	`TIDEImage1` VARCHAR(255) NULL,
	`TIDEFlag1` SMALLINT NULL DEFAULT '0',
	`TIDEFlag2` SMALLINT NULL DEFAULT '0',
	`TIDEFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIDETEmpCode`, `TIDELn`),
	KEY `TCmTCode` (`TIDETEmpCode`),
	KEY `TIDETEmpCode` (`TIDELn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpIncomeDoc` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpIncomeDoc`;

# ---------- CREATE TABLE `VS4TEmpIncomeDoc` ----------

CREATE TABLE `VS4TEmpIncomeDoc` (
	`TEidNo` VARCHAR(30) NOT NULL,
	`TEidDate` DATETIME NULL,
	`TEidType` SMALLINT NULL DEFAULT '0',
	`TEidRefNo` VARCHAR(30) NULL,
	`TEidTBraCode` VARCHAR(30) NULL,
	`TEidTDivCode` VARCHAR(50) NULL,
	`TEidTDepCode` VARCHAR(30) NULL,
	`TEidTSecCode` VARCHAR(30) NULL,
	`TEidAddAmount` FLOAT NULL,
	`TEidDisAmount` FLOAT NULL,
	`TEidDescription` VARCHAR(150) NULL,
	`TEidCreateCode` VARCHAR(30) NULL,
	`TEidCreateBy` VARCHAR(140) NULL,
	`TEidCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEidEditCode` VARCHAR(30) NULL,
	`TEidEditBy` VARCHAR(140) NULL,
	`TEidEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEidConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TEidConfirmBy` VARCHAR(140) NULL,
	`TEidConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEidApproveStatus` SMALLINT NULL DEFAULT '0',
	`TEidApproveBy` VARCHAR(140) NULL,
	`TEidApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEidApproveNote` VARCHAR(80) NULL,
	`TEidRevision` SMALLINT NULL DEFAULT '0',
	`TEidCancelStatus` SMALLINT NULL DEFAULT '0',
	`TEidCancelNo` VARCHAR(30) NULL,
	`TEidCancelBy` VARCHAR(140) NULL,
	`TEidCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEidCancelNote` VARCHAR(80) NULL,
	`TEidFlag1` SMALLINT NULL DEFAULT '0',
	`TEidFlag2` SMALLINT NULL DEFAULT '0',
	`TEidFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEidNo`),
	KEY `TDepCode` (`TEidNo`),
	KEY `TEOTTBraCode` (`TEidTBraCode`),
	KEY `TEOTTDepCode` (`TEidTDepCode`),
	KEY `TEOTTDivCode` (`TEidTDivCode`),
	KEY `TEOTTSecCode` (`TEidTSecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpIncomeMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpIncomeMB`;

# ---------- CREATE TABLE `VS4TEmpIncomeMB` ----------

CREATE TABLE `VS4TEmpIncomeMB` (
	`TEwoTEidNo` VARCHAR(30) NOT NULL,
	`TEwoLn` INT NOT NULL DEFAULT '0',
	`TEwoTEmpCode` VARCHAR(30) NULL,
	`TEwoEmployeeCode` VARCHAR(30) NULL,
	`TEwoEmployeeName` VARCHAR(50) NULL,
	`TEwoDate` DATETIME NULL,
	`TEwoRefNo` VARCHAR(30) NULL,
	`TEwoTAmyCode` VARCHAR(30) NULL,
	`TEwoTAMTAlias` VARCHAR(30) NULL,
	`TEwoMoneyCode` VARCHAR(50) NULL,
	`TEwoMoneyName` VARCHAR(50) NULL,
	`TEwoRecordDate` DATETIME NULL,
	`TEwoStartDate` DATETIME NULL,
	`TEwoAmount` FLOAT NULL DEFAULT '0',
	`TEwoAmount2` FLOAT NULL DEFAULT '0',
	`TEwoCheckPay` INT NULL DEFAULT '0',
	`TEwoCheckMoney` SMALLINT NULL DEFAULT '0',
	`TEwoCheckFix` SMALLINT NULL DEFAULT '1',
	`TEwoCheckGroup` SMALLINT NULL DEFAULT '0',
	`TEwoPercentGroup` DOUBLE NULL DEFAULT '0',
	`TEwoPayDay` INT NULL DEFAULT '0',
	`TEwoFomula` SMALLINT NULL DEFAULT '0',
	`TEwoQuantity` DOUBLE NULL DEFAULT '0',
	`TEwoTUntCode` VARCHAR(30) NULL,
	`TEwoDescription` VARCHAR(150) NULL,
	`TEwoFlag1` SMALLINT NULL DEFAULT '0',
	`TEwoFlag2` SMALLINT NULL DEFAULT '0',
	`TEwoFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEwoTEidNo`, `TEwoLn`),
	KEY `TSaTTAMTAlias` (`TEwoTAMTAlias`),
	KEY `VS4TEmpAddMoneyVS4TEmpIncomeMB` (`TEwoTAmyCode`),
	KEY `VS4TEmpIncomeDocVS4TEmpIncomeMB` (`TEwoTEidNo`),
	KEY `VS4TEmployeeVS4TEmpIncomeMB` (`TEwoTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpInOutNote` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpInOutNote`;

# ---------- CREATE TABLE `VS4TEmpInOutNote` ----------

CREATE TABLE `VS4TEmpInOutNote` (
	`TEIOTEmpCode` VARCHAR(30) NOT NULL,
	`TEIODate` DATETIME NOT NULL,
	`TEIOLn` INT NOT NULL DEFAULT '0',
	`TEIOTimeOutStatus` SMALLINT NULL DEFAULT '0',
	`TEIOTimeOut` VARCHAR(30) NULL,
	`TEIOTVeTCode` SMALLINT NULL DEFAULT '0',
	`TEIOTimeOutNote` VARCHAR(255) NULL,
	`TEIOTimeBackStatus` SMALLINT NULL DEFAULT '0',
	`TEIOTimeBack` VARCHAR(30) NULL,
	`TEIOTimeBackNote` VARCHAR(255) NULL,
	`TEIOFlag1` SMALLINT NULL DEFAULT '0',
	`TEIOFlag2` SMALLINT NULL DEFAULT '0',
	`TEIOFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEIOTEmpCode`, `TEIODate`, `TEIOLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpLeave` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpLeave`;

# ---------- CREATE TABLE `VS4TEmpLeave` ----------

CREATE TABLE `VS4TEmpLeave` (
	`TEpaNo` VARCHAR(30) NOT NULL,
	`TEpaDate` DATETIME NULL,
	`TEpaRefNo` VARCHAR(30) NULL,
	`TEpaTBraCode` VARCHAR(30) NULL,
	`TEpaTDivCode` VARCHAR(50) NULL,
	`TEpaTDepCode` VARCHAR(30) NULL,
	`TEpaTSecCode` VARCHAR(30) NULL,
	`TEpaTEmpCode` VARCHAR(30) NULL,
	`TEpaEmployeeCode` VARCHAR(30) NULL,
	`TEpaEmployeeName` VARCHAR(50) NULL,
	`TEpaDescription` VARCHAR(150) NULL,
	`TEpaCreateCode` VARCHAR(30) NULL,
	`TEpaCreateBy` VARCHAR(140) NULL,
	`TEpaCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpaEditCode` VARCHAR(30) NULL,
	`TEpaEditBy` VARCHAR(140) NULL,
	`TEpaEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpaConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TEpaConfirmBy` VARCHAR(140) NULL,
	`TEpaConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpaApproveStatus` SMALLINT NULL DEFAULT '0',
	`TEpaApproveBy` VARCHAR(140) NULL,
	`TEpaApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpaApproveNote` VARCHAR(80) NULL,
	`TEpaRevision` SMALLINT NULL DEFAULT '0',
	`TEpaCancelStatus` SMALLINT NULL DEFAULT '0',
	`TEpaCancelNo` VARCHAR(30) NULL,
	`TEpaCancelBy` VARCHAR(140) NULL,
	`TEpaCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpaCancelNote` VARCHAR(80) NULL,
	`TEpaFlag1` SMALLINT NULL DEFAULT '0',
	`TEpaFlag2` SMALLINT NULL DEFAULT '0',
	`TEpaFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEpaNo`),
	KEY `TDepCode` (`TEpaNo`),
	KEY `TEpaTBraCode` (`TEpaTBraCode`),
	KEY `TEpaTDivCode` (`TEpaTDivCode`),
	KEY `TEpaTDivCode1` (`TEpaTDepCode`),
	KEY `TEpaTDivCode2` (`TEpaTSecCode`),
	KEY `VS4TEmployeeVS4TEmpLeaveDoc` (`TEpaTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpLeaveAllow` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpLeaveAllow`;

# ---------- CREATE TABLE `VS4TEmpLeaveAllow` ----------

CREATE TABLE `VS4TEmpLeaveAllow` (
	`TELATEmpCode` VARCHAR(30) NOT NULL,
	`TELAYear` INT NOT NULL DEFAULT '0',
	`TELAType` INT NOT NULL DEFAULT '0',
	`TELATotal1` DOUBLE NULL DEFAULT '0',
	`TELATime1` SMALLINT NULL DEFAULT '0',
	`TELATotal2` DOUBLE NULL DEFAULT '0',
	`TELATime2` SMALLINT NULL DEFAULT '0',
	`TELATotal3` DOUBLE NULL DEFAULT '0',
	`TELATime3` SMALLINT NULL DEFAULT '0',
	`TELATotal4` DOUBLE NULL DEFAULT '0',
	`TELATime4` SMALLINT NULL DEFAULT '0',
	`TELATotal5` DOUBLE NULL DEFAULT '0',
	`TELATime5` SMALLINT NULL DEFAULT '0',
	`TELATotal6` DOUBLE NULL DEFAULT '0',
	`TELATime6` SMALLINT NULL DEFAULT '0',
	`TELATotal7` DOUBLE NULL DEFAULT '0',
	`TELATime7` SMALLINT NULL DEFAULT '0',
	`TELATotal8` DOUBLE NULL DEFAULT '0',
	`TELATime8` SMALLINT NULL DEFAULT '0',
	`TELATotal9` DOUBLE NULL DEFAULT '0',
	`TELATime9` SMALLINT NULL DEFAULT '0',
	`TELATotal10` DOUBLE NULL DEFAULT '0',
	`TELATime10` SMALLINT NULL DEFAULT '0',
	`TELATotal11` DOUBLE NULL DEFAULT '0',
	`TELATime11` SMALLINT NULL DEFAULT '0',
	`TELATotal12` DOUBLE NULL DEFAULT '0',
	`TELATime12` SMALLINT NULL DEFAULT '0',
	`TELATotal13` DOUBLE NULL DEFAULT '0',
	`TELATime13` SMALLINT NULL DEFAULT '0',
	`TELATotal14` DOUBLE NULL DEFAULT '0',
	`TELATime14` SMALLINT NULL DEFAULT '0',
	`TELATotal15` DOUBLE NULL DEFAULT '0',
	`TELATime15` SMALLINT NULL DEFAULT '0',
	`TELAFlag1` SMALLINT NULL DEFAULT '0',
	`TELAFlag2` SMALLINT NULL DEFAULT '0',
	`TELAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TELATEmpCode`, `TELAYear`, `TELAType`),
	KEY `TELATEmpCode` (`TELATEmpCode`),
	KEY `VS4TEmployeeVS4TEmpLeaveAllow` (`TELATEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpLeaveMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpLeaveMB`;

# ---------- CREATE TABLE `VS4TEmpLeaveMB` ----------

CREATE TABLE `VS4TEmpLeaveMB` (
	`TElbTEpaNo` VARCHAR(30) NOT NULL,
	`TElbLn` INT NOT NULL DEFAULT '0',
	`TElbTEmpCode` VARCHAR(30) NULL,
	`TElbTLvtCode` VARCHAR(30) NULL,
	`TElbTLvtName` VARCHAR(50) NULL,
	`TElbTLvtType` SMALLINT NULL DEFAULT '0',
	`TElbInputType` SMALLINT NULL DEFAULT '0',
	`TElBTotalPermiss` DOUBLE NULL DEFAULT '0',
	`TElBTotalAvailable` DOUBLE NULL DEFAULT '0',
	`TElBTimePermiss` DOUBLE NULL DEFAULT '0',
	`TElBTimeAvailable` SMALLINT NULL DEFAULT '0',
	`TElbTotalDay` SMALLINT NULL DEFAULT '0',
	`TElbTotalHour` SMALLINT NULL DEFAULT '0',
	`TElbTotalTime` DOUBLE NULL DEFAULT '0',
	`TElBTotalUse` DOUBLE NULL DEFAULT '0',
	`TElBTotalUnUse` DOUBLE NULL DEFAULT '0',
	`TElbLeaveFromDate` DATETIME NULL,
	`TElbLeaveToDate` DATETIME NULL,
	`TElbLeaveFromTime` DATETIME NULL,
	`TElbLeaveToTime` DATETIME NULL,
	`TElbDoctorSign` SMALLINT NULL DEFAULT '0',
	`TElbCutMoney` SMALLINT NULL DEFAULT '0',
	`TElbRefNo` VARCHAR(30) NULL,
	`TElbDescription` VARCHAR(150) NULL,
	`TElbFlag1` SMALLINT NULL DEFAULT '0',
	`TElbFlag2` SMALLINT NULL DEFAULT '0',
	`TElbFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TElbLn`, `TElbTEpaNo`),
	KEY `TElbTLvtCode` (`TElbTLvtCode`),
	KEY `VS4TEmpLeaveDocVS4TEmpLeaveMB` (`TElbTEpaNo`),
	KEY `VS4TEmpLeaveTypeVS4TEmpLeaveMB` (`TElbTLvtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpLeaveType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpLeaveType`;

# ---------- CREATE TABLE `VS4TEmpLeaveType` ----------

CREATE TABLE `VS4TEmpLeaveType` (
	`TLvtCode` VARCHAR(30) NOT NULL,
	`TLvtName` VARCHAR(50) NULL,
	`TLvtName2` VARCHAR(50) NULL,
	`TLvtType` SMALLINT NULL DEFAULT '0',
	`TLvtTotalPermiss` DOUBLE NULL DEFAULT '0',
	`TLvtTimePermiss` DOUBLE NULL DEFAULT '0',
	`TLvtDescription` VARCHAR(150) NULL,
	`TLvtFlag1` SMALLINT NULL DEFAULT '0',
	`TLvtFlag2` SMALLINT NULL DEFAULT '0',
	`TLvtFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TLvtCode`),
	KEY `TEatCode` (`TLvtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmployee` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmployee`;

# ---------- CREATE TABLE `VS4TEmployee` ----------

CREATE TABLE `VS4TEmployee` (
	`TEmpCode` VARCHAR(30) NOT NULL,
	`TEmpNo` VARCHAR(30) NULL,
	`TEmpBarCode` VARCHAR(30) NULL,
	`TEmpCardNo` VARCHAR(30) NULL,
	`TEmpTEmTCode` VARCHAR(30) NULL,
	`TEmpTCsTAlias` VARCHAR(1) NULL,
	`TEmpTWPDCode` VARCHAR(30) NULL,
	`TEmpGender` VARCHAR(1) NULL,
	`TEmpTitleName` VARCHAR(50) NULL,
	`TEmpFirstName` VARCHAR(50) NULL,
	`TEmpMiddleName` VARCHAR(5) NULL,
	`TEmpLastName` VARCHAR(50) NULL,
	`TEmpAliasName` VARCHAR(10) NULL,
	`TEmpNickName` VARCHAR(20) NULL,
	`TEmpFullName` VARCHAR(160) NULL,
	`TEmpTitleName2` VARCHAR(50) NULL,
	`TEmpFirstName2` VARCHAR(50) NULL,
	`TEmpMiddleName2` VARCHAR(5) NULL,
	`TEmpLastname2` VARCHAR(50) NULL,
	`TEmpFullName2` VARCHAR(160) NULL,
	`TEmpAddress` VARCHAR(200) NULL,
	`TEmpSubProvince` VARCHAR(50) NULL,
	`TEmpCity` VARCHAR(50) NULL,
	`TEmpPostalCode` VARCHAR(5) NULL,
	`TEmpTStaCode` VARCHAR(3) NULL,
	`TEmpTCouCode` VARCHAR(30) NULL,
	`TEmpTel` VARCHAR(50) NULL,
	`TEmpFax` VARCHAR(50) NULL,
	`TEmpEmail` VARCHAR(50) NULL,
	`TEmpAddressContact` VARCHAR(255) NULL,
	`TEmpImage1` VARCHAR(50) NULL,
	`TEmpBirthDay` DATETIME NULL DEFAULT '3333-3-3',
	`TEmpBornZone` VARCHAR(30) NULL,
	`TEmpBlood` VARCHAR(5) NULL,
	`TEmpFundNo` VARCHAR(15) NULL,
	`TEmpCitizenNo` VARCHAR(15) NULL,
	`TEmpCitizenAddress` VARCHAR(100) NULL,
	`TEmpPassportNo` VARCHAR(15) NULL,
	`TEmpTaxNo` VARCHAR(15) NULL,
	`TEmpSocialSecurity` VARCHAR(15) NULL,
	`TEmpCardAlien` VARCHAR(50) NULL,
	`TEmpAllowAlien` VARCHAR(50) NULL,
	`TEmpRace` VARCHAR(50) NULL,
	`TEmpCitizenShip` VARCHAR(50) NULL,
	`TEmpReligion` VARCHAR(50) NULL,
	`TEmpHospital` VARCHAR(50) NULL,
	`TEmpHospital1` VARCHAR(50) NULL,
	`TEmpType` SMALLINT NULL DEFAULT '0',
	`TEmpDropStatus` SMALLINT NULL DEFAULT '0',
	`TEmpStatus` SMALLINT NULL DEFAULT '0',
	`TEmpSignDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEmpPermanantDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEmpResignDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEmpStatusPer` SMALLINT NULL DEFAULT '0',
	`TEmpBuddyCalcTAX` SMALLINT NULL DEFAULT '0',
	`TEmpTotalParent` SMALLINT NULL DEFAULT '0',
	`TEmpTotalFMCalc` SMALLINT NULL DEFAULT '0',
	`TEmpSoldierStatus` SMALLINT NULL DEFAULT '0',
	`TEmpChildStudy` SMALLINT NULL DEFAULT '0',
	`TEmpChildNotStudy` SMALLINT NULL DEFAULT '0',
	`TEmpCalcChildList` SMALLINT NULL DEFAULT '0',
	`TEmpCalcBuddy` SMALLINT NULL DEFAULT '0',
	`TEmpTPstCode` VARCHAR(30) NULL,
	`TEmpTSecCode` VARCHAR(30) NULL,
	`TEmpTDepCode` VARCHAR(30) NULL,
	`TEmpTDivCode` VARCHAR(30) NULL,
	`TEmpTBraCode` VARCHAR(30) NULL,
	`TEmpPriority` SMALLINT NULL DEFAULT '0',
	`TEmpProbationDate` DATETIME NULL,
	`TEmpScroll` DOUBLE NULL DEFAULT '0',
	`TEmpIsAdmin` SMALLINT NULL DEFAULT '0',
	`TEmpMainChange` SMALLINT NULL DEFAULT '0',
	`TEmpGradeLevel` SMALLINT NULL DEFAULT '0',
	`TEmpHeight` DOUBLE NULL DEFAULT '0',
	`TEmpWeight` DOUBLE NULL DEFAULT '0',
	`TEmpLastSalaryDate` DATETIME NULL,
	`TEmpSalary` FLOAT NULL DEFAULT '0',
	`TEmpCustom` FLOAT NULL DEFAULT '0',
	`TEmpWTax` FLOAT NULL DEFAULT '0',
	`TEmpSTAX` FLOAT NULL DEFAULT '0',
	`TEmpSFund` FLOAT NULL DEFAULT '0',
	`TEmpStartSFund` DATETIME NULL,
	`TEmpApproveLimit` FLOAT NULL DEFAULT '0',
	`TEmpApproveLimitM` FLOAT NULL DEFAULT '0',
	`TEmpApproveLimitY` FLOAT NULL DEFAULT '0',
	`TEmpFund` FLOAT NULL DEFAULT '0',
	`TEmpEnableFUND` FLOAT NULL DEFAULT '0',
	`TEmpStartFund` DATETIME NULL,
	`TEmpTotalReduce` FLOAT NULL DEFAULT '0',
	`TEmpCreateCode` VARCHAR(30) NULL,
	`TEmpCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEmpEditCode` VARCHAR(30) NULL,
	`TEmpEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEmpTextSort` VARCHAR(30) NULL,
	`TEmpFlag1` SMALLINT NULL DEFAULT '0',
	`TEmpFlag2` SMALLINT NULL DEFAULT '0',
	`TEmpFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEmpCode`),
	KEY `VS4TBranchVS4TEmployee` (`TEmpTBraCode`),
	KEY `VS4TDivisionVS4TEmployee` (`TEmpTDivCode`),
	KEY `VS4TEmployeeTypeVS4TEmployee` (`TEmpTEmTCode`),
	KEY `VS4TEmpWorkPeriodVS4TEmployee` (`TEmpTWPDCode`),
	KEY `VS4TPositionVS4TEmployee` (`TEmpTPstCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmployee2` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmployee2`;

# ---------- CREATE TABLE `VS4TEmployee2` ----------

CREATE TABLE `VS4TEmployee2` (
	`TEm2TEmpCode` VARCHAR(30) NOT NULL,
	`TEm2Ln` INT NOT NULL DEFAULT '0',
	`TEm2BuddyCalcTAX` SMALLINT NULL DEFAULT '0',
	`TEm2TotalHandicap` SMALLINT NULL DEFAULT '0',
	`TEm2TotalParent` SMALLINT NULL DEFAULT '0',
	`TEm2TotalFMCalc` SMALLINT NULL DEFAULT '0',
	`TEm2ChildStudy` SMALLINT NULL DEFAULT '0',
	`TEm2ChildNotStudy` SMALLINT NULL DEFAULT '0',
	`TEm2CutStudySup` FLOAT NULL DEFAULT '0',
	`TEm2CutDonate` FLOAT NULL DEFAULT '0',
	`TEm2ABC` FLOAT NULL DEFAULT '0',
	`TEm2Teacher` FLOAT NULL DEFAULT '0',
	`TEm2PayBackRaw` FLOAT NULL DEFAULT '0',
	`TEm2CalcBuddy` SMALLINT NULL DEFAULT '0',
	`TEm2BeforeSalary` FLOAT NULL DEFAULT '0',
	`TEm2BeforeWTax` FLOAT NULL DEFAULT '0',
	`TEm2LastSalary` FLOAT NULL DEFAULT '0',
	`TEm2LastWTax` FLOAT NULL DEFAULT '0',
	`TEm2LastSTAX` FLOAT NULL DEFAULT '0',
	`TEm2LastSFUND` FLOAT NULL DEFAULT '0',
	`TEm2LastFund` FLOAT NULL DEFAULT '0',
	`TEm2Insurance` FLOAT NULL DEFAULT '0',
	`TEm2FundInvest` FLOAT NULL DEFAULT '0',
	`TEm2LFundInvest` FLOAT NULL DEFAULT '0',
	`TEm2FundInterest` FLOAT NULL DEFAULT '0',
	`TEm2FixedAsset` FLOAT NULL DEFAULT '0',
	`TEm2OldInsurance` FLOAT NULL,
	`TEm2OldManIncome` FLOAT NULL,
	`TEm2TotalReduce` FLOAT NULL DEFAULT '0',
	`TEm2BOSGroupWork` VARCHAR(255) NULL,
	`TEm2LastCompany` VARCHAR(200) NULL,
	`TEm2PassportFrom` DATETIME NULL,
	`TEm2PassportTo` DATETIME NULL,
	`TEm2WorkPermitFrom` DATETIME NULL,
	`TEm2WorkPermitTo` DATETIME NULL,
	`TEm2CitizenFrom` DATETIME NULL,
	`TEm2CitizenTo` DATETIME NULL,
	`TEm2SkipTax` SMALLINT NULL DEFAULT '0',
	`TEm2SkipSSO` SMALLINT NULL DEFAULT '0',
	`TEm2SkipSlip` SMALLINT NULL DEFAULT '0',
	`TEm2Condition` SMALLINT NULL DEFAULT '0',
	`TEm2ConditionText` VARCHAR(30) NULL,
	`TEm2TRouCode` VARCHAR(30) NULL,
	`TEm2PTAXMethod` SMALLINT NULL,
	`TEm2LastBonusAmass` SMALLINT NULL,
	`TEm2BonusAmass` SMALLINT NULL,
	`TEm2PayStamp` SMALLINT NULL,
	`TEm2ExceptTimeIn` SMALLINT NULL DEFAULT '0',
	`TEm2ExceptLunchOut` SMALLINT NULL DEFAULT '0',
	`TEm2ExceptLunchIn` SMALLINT NULL DEFAULT '0',
	`TEm2ExceptTimeOut` SMALLINT NULL DEFAULT '0',
	`TEm2ExceptOTIn` SMALLINT NULL DEFAULT '0',
	`TEm2ExceptOTOut` SMALLINT NULL DEFAULT '0',
	`TEm2ExceptTip` SMALLINT NULL DEFAULT '0',
	`TEm2ExceptOT` SMALLINT NULL DEFAULT '0',
	`TEm2FullOTCheck` SMALLINT NULL DEFAULT '0',
	`TEm2DeductLoss` SMALLINT NULL DEFAULT '0',
	`TEm2DeductLeave` SMALLINT NULL DEFAULT '0',
	`TEm2DeductLate` SMALLINT NULL DEFAULT '0',
	`TEm2DeductEarly` SMALLINT NULL DEFAULT '0',
	`TEm2Flag1` SMALLINT NULL DEFAULT '0',
	`TEm2Flag2` SMALLINT NULL DEFAULT '0',
	`TEm2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEm2TEmpCode`, `TEm2Ln`),
	KEY `TEm2TRouCode` (`TEm2TRouCode`),
	KEY `TEmpNo` (`TEm2Ln`),
	KEY `VS4TEmployeeVS4TEmployee2` (`TEm2TEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmployeeBank` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmployeeBank`;

# ---------- CREATE TABLE `VS4TEmployeeBank` ----------

CREATE TABLE `VS4TEmployeeBank` (
	`TEmBTEmpCode` VARCHAR(30) NOT NULL,
	`TEmBLn` INT NOT NULL DEFAULT '0',
	`TEmBTBBrCode` VARCHAR(30) NULL,
	`TEmBTBnkCode` VARCHAR(30) NULL,
	`TEmBAccountType` SMALLINT NULL DEFAULT '0',
	`TEmBAccountName` VARCHAR(100) NULL,
	`TEmBAccountNo` VARCHAR(30) NULL,
	`TEmBAccountBranch` VARCHAR(100) NULL,
	`TEmBDescription` VARCHAR(80) NULL,
	`TEmBFlag1` SMALLINT NULL DEFAULT '0',
	`TEmBFlag2` SMALLINT NULL DEFAULT '0',
	`TEmBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEmBTEmpCode`, `TEmBLn`),
	KEY `TBAcTBBrID` (`TEmBTBBrCode`),
	KEY `TEmBID` (`TEmBLn`),
	KEY `TEmBTBBrCode` (`TEmBTBnkCode`),
	KEY `VS4TBankVS4TEmployeeBank` (`TEmBTBnkCode`),
	KEY `VS4TEmployeeVS4TEmployeeBank` (`TEmBTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmployeeGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmployeeGroup`;

# ---------- CREATE TABLE `VS4TEmployeeGroup` ----------

CREATE TABLE `VS4TEmployeeGroup` (
	`TEmGCode` VARCHAR(30) NOT NULL,
	`TEmGName` VARCHAR(100) NULL,
	`TEmGFlag1` SMALLINT NULL DEFAULT '0',
	`TEmGFlag2` SMALLINT NULL DEFAULT '0',
	`TEmGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEmGCode`),
	KEY `TDepCode` (`TEmGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmployeeGrpMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmployeeGrpMB`;

# ---------- CREATE TABLE `VS4TEmployeeGrpMB` ----------

CREATE TABLE `VS4TEmployeeGrpMB` (
	`TEGMTEgdNo` VARCHAR(30) NOT NULL,
	`TEGMLn` INT NOT NULL DEFAULT '0',
	`TEGMTEmpCode` VARCHAR(30) NULL,
	`TEGMTEmGCode` VARCHAR(30) NULL,
	`TEGMTPgpCode` VARCHAR(30) NULL,
	`TEGMEmployeeCode` VARCHAR(30) NULL,
	`TEGMEmployeeName` VARCHAR(160) NULL,
	`TEGMGroupCode` VARCHAR(30) NULL,
	`TEGMGroupName` VARCHAR(100) NULL,
	`TEGMPostionCode` VARCHAR(30) NULL,
	`TEGMPostionName` VARCHAR(100) NULL,
	`TEgmDecription` VARCHAR(50) NULL,
	`TEgmCustomText1` VARCHAR(50) NULL,
	`TEgmCustomText2` VARCHAR(50) NULL,
	`TEgmCustomText3` VARCHAR(50) NULL,
	`TEgmCustomValue1` DOUBLE NULL DEFAULT '0',
	`TEgmCustomValue2` DOUBLE NULL DEFAULT '0',
	`TEgmCustomValue3` DOUBLE NULL DEFAULT '0',
	`TEgmApproveTime` DATETIME NULL,
	`TEgmStatus` SMALLINT NULL DEFAULT '0',
	`TEgmFlag1` SMALLINT NULL DEFAULT '0',
	`TEgmFlag2` SMALLINT NULL DEFAULT '0',
	`TEgmFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEGMTEgdNo`, `TEGMLn`),
	KEY `TEGMEmployeeCode` (`TEGMEmployeeCode`),
	KEY `TEGMGroupCode` (`TEGMGroupCode`),
	KEY `TEGMPostionCode` (`TEGMPostionCode`),
	KEY `VS4TEmpGroupDocVS4TEmployeeGrpMB` (`TEGMTEgdNo`),
	KEY `VS4TEmployeeGroupVS4TEmployeeGrpMB` (`TEGMTEmGCode`),
	KEY `VS4TPositionGroupVS4TEmployeeGrpMB` (`TEGMTPgpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmployeeSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmployeeSub`;

# ---------- CREATE TABLE `VS4TEmployeeSub` ----------

CREATE TABLE `VS4TEmployeeSub` (
	`TEMSTEmpCode` VARCHAR(30) NOT NULL,
	`TEMSLn` INT NOT NULL DEFAULT '0',
	`TEMSDescription` VARCHAR(100) NULL,
	`TEMSFilename` VARCHAR(50) NULL,
	`TEMSFlag1` SMALLINT NULL DEFAULT '0',
	`TEMSFlag2` SMALLINT NULL DEFAULT '0',
	`TEMSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEMSTEmpCode`, `TEMSLn`),
	KEY `TEMSTEmpCode` (`TEMSTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmployeeType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmployeeType`;

# ---------- CREATE TABLE `VS4TEmployeeType` ----------

CREATE TABLE `VS4TEmployeeType` (
	`TEmTCode` VARCHAR(30) NOT NULL,
	`TEmTName` VARCHAR(50) NULL,
	`TEmTName2` VARCHAR(50) NULL,
	`TEmTCalculateType` SMALLINT NULL DEFAULT '0',
	`TEmTSalaryType` SMALLINT NULL DEFAULT '0',
	`TEmTPeriodType` SMALLINT NULL DEFAULT '0',
	`TEmTHolidayShift` SMALLINT NULL DEFAULT '0',
	`TEmTWrongShift` SMALLINT NULL DEFAULT '0',
	`TEmTTotalPeriod` SMALLINT NULL DEFAULT '0',
	`TEmTAutoPeriod` SMALLINT NULL DEFAULT '0',
	`TEmTStartPeriod1` SMALLINT NULL DEFAULT '0',
	`TEmTEndPeriod1` SMALLINT NULL DEFAULT '0',
	`TEmTOTStartPeriod1` SMALLINT NULL DEFAULT '0',
	`TEmTOTEndPeriod1` SMALLINT NULL DEFAULT '0',
	`TEmTPaymentPeriod1` SMALLINT NULL DEFAULT '0',
	`TEmTPaymentCustom1` SMALLINT NULL DEFAULT '0',
	`TEmTStartPeriod2` SMALLINT NULL DEFAULT '0',
	`TEmTEndPeriod2` SMALLINT NULL DEFAULT '0',
	`TEmTOTStartPeriod2` SMALLINT NULL DEFAULT '0',
	`TEmTOTEndPeriod2` SMALLINT NULL DEFAULT '0',
	`TEmTPaymentPeriod2` SMALLINT NULL DEFAULT '0',
	`TEmTPaymentCustom2` SMALLINT NULL DEFAULT '0',
	`TEmTStartPeriod3` SMALLINT NULL DEFAULT '0',
	`TEmTEndPeriod3` SMALLINT NULL DEFAULT '0',
	`TEmTOTStartPeriod3` SMALLINT NULL DEFAULT '0',
	`TEmTOTEndPeriod3` SMALLINT NULL DEFAULT '0',
	`TEmTPaymentPeriod3` SMALLINT NULL DEFAULT '0',
	`TEmTPaymentCustom3` SMALLINT NULL DEFAULT '0',
	`TEmTStartPeriod4` SMALLINT NULL DEFAULT '0',
	`TEmTEndPeriod4` SMALLINT NULL DEFAULT '0',
	`TEmTOTStartPeriod4` SMALLINT NULL DEFAULT '0',
	`TEmTOTEndPeriod4` SMALLINT NULL DEFAULT '0',
	`TEmTPaymentPeriod4` SMALLINT NULL DEFAULT '0',
	`TEmTPaymentCustom4` SMALLINT NULL DEFAULT '0',
	`TEmTDayPerPeriod` DOUBLE NULL DEFAULT '0',
	`TEmTDayPerWeek` DOUBLE NULL DEFAULT '0',
	`TEmTDayPerMonth` DOUBLE NULL DEFAULT '0',
	`TEmTDayPerYear` DOUBLE NULL DEFAULT '0',
	`TEmTHourPerDay` DOUBLE NULL DEFAULT '0',
	`TEmTHourPerPeriod` DOUBLE NULL DEFAULT '0',
	`TEmTHourPerWeek` DOUBLE NULL DEFAULT '0',
	`TEmTHourPerMonth` DOUBLE NULL DEFAULT '0',
	`TEmTHourPerYear` DOUBLE NULL DEFAULT '0',
	`TEmTProbationDay` SMALLINT NULL DEFAULT '0',
	`TEmTPayHoliday` SMALLINT NULL DEFAULT '0',
	`TEmTPayLeaveDoctor` SMALLINT NULL DEFAULT '0',
	`TEmTPayLeaveVacat` SMALLINT NULL DEFAULT '0',
	`TEmTOT1TAmyCode` VARCHAR(30) NULL,
	`TEmTOT15TAmyCode` VARCHAR(30) NULL,
	`TEmTOT2TAmyCode` VARCHAR(30) NULL,
	`TEmTOT3TAmyCode` VARCHAR(30) NULL,
	`TEmTNWageTAmyCode` VARCHAR(30) NULL,
	`TEmTSWageTAmyCode` VARCHAR(30) NULL,
	`TEmTTipATAmyCode` VARCHAR(30) NULL,
	`TEmTTipTAmyCode` VARCHAR(30) NULL,
	`TEmTStampTAmyCode` VARCHAR(30) NULL,
	`TEmTStampAmount` FLOAT NULL DEFAULT '0',
	`TEmTStamp2TAmyCode` VARCHAR(30) NULL,
	`TEmTStamp2Amount` FLOAT NULL DEFAULT '0',
	`TEmTStamp3TAmyCode` VARCHAR(30) NULL,
	`TEmTStamp3Amount` FLOAT NULL DEFAULT '0',
	`TEmTShiftTAmyCode` VARCHAR(30) NULL,
	`TEmTShiftAmount` FLOAT NULL DEFAULT '0',
	`TEmTShiftByLevel` SMALLINT NULL,
	`TEmTFoodTAmyCode` VARCHAR(30) NULL,
	`TEmTFoodAmount` FLOAT NULL DEFAULT '0',
	`TEmTFood2TAmyCode` VARCHAR(30) NULL,
	`TEmTFood2Amount` FLOAT NULL DEFAULT '0',
	`TEmTVTAmyCode` VARCHAR(30) NULL,
	`TEmTVHAmount` FLOAT NULL DEFAULT '0',
	`TEmTVAmount` FLOAT NULL DEFAULT '0',
	`TEmTStartDate` DATETIME NULL,
	`TEmTCreateCode` VARCHAR(30) NULL,
	`TEmTCreateDate` DATETIME NULL,
	`TEmTEditCode` VARCHAR(30) NULL,
	`TEmTEditDate` DATETIME NULL,
	`TEmTTextSort` VARCHAR(30) NULL,
	`TEmTFlag1` SMALLINT NULL DEFAULT '0',
	`TEmTFlag2` SMALLINT NULL DEFAULT '0',
	`TEmTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEmTCode`),
	KEY `TEmpCode` (`TEmTCode`),
	KEY `TEmTOT1TAmyCode` (`TEmTTipTAmyCode`),
	KEY `TEmTStampAmount` (`TEmTStamp2Amount`),
	KEY `TEmTStampAmount1` (`TEmTStamp3Amount`),
	KEY `TEmTStampTAmyCode` (`TEmTStamp2TAmyCode`),
	KEY `TEmTStampTAmyCode1` (`TEmTStamp3TAmyCode`),
	KEY `TEmTTipAAmount` (`TEmTStampAmount`),
	KEY `TEmTTipAAmount1` (`TEmTShiftAmount`),
	KEY `TEmTTipAAmount2` (`TEmTFoodAmount`),
	KEY `TEmTTipAAmount3` (`TEmTFood2Amount`),
	KEY `TEmTTipAAmount4` (`TEmTVAmount`),
	KEY `TEmTTipATAmyCode` (`TEmTNWageTAmyCode`),
	KEY `TEmTTipATAmyCode1` (`TEmTSWageTAmyCode`),
	KEY `TEmTTipTAmyCode` (`TEmTTipATAmyCode`),
	KEY `TEmTTipTAmyCode1` (`TEmTStampTAmyCode`),
	KEY `TEmTTipTAmyCode2` (`TEmTShiftTAmyCode`),
	KEY `TEmTTipTAmyCode3` (`TEmTFoodTAmyCode`),
	KEY `TEmTTipTAmyCode4` (`TEmTFood2TAmyCode`),
	KEY `TEmTTipTAmyCode5` (`TEmTVTAmyCode`),
	KEY `TEmTVAmount` (`TEmTVHAmount`),
	KEY `TGSlOT15TAmyCode` (`TEmTOT15TAmyCode`),
	KEY `TGSlOT1TAmyCode` (`TEmTOT1TAmyCode`),
	KEY `TGSlOT2TAmyCode` (`TEmTOT2TAmyCode`),
	KEY `TGSlOT3TAmyCode` (`TEmTOT3TAmyCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmployeeTypeSL` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmployeeTypeSL`;

# ---------- CREATE TABLE `VS4TEmployeeTypeSL` ----------

CREATE TABLE `VS4TEmployeeTypeSL` (
	`TGSlTEmTCode` VARCHAR(30) NOT NULL,
	`TGSlTAmyCode` VARCHAR(30) NOT NULL,
	`TGSlRecordDate` DATETIME NULL,
	`TGSlStartDate` DATETIME NULL,
	`TGSlEndDate` DATETIME NULL,
	`TGSlAmount` FLOAT NULL DEFAULT '0',
	`TGSlAmount2` FLOAT NULL DEFAULT '0',
	`TGSlDescription` VARCHAR(150) NULL,
	`TGSlFlag1` SMALLINT NULL DEFAULT '0',
	`TGSlFlag2` SMALLINT NULL DEFAULT '0',
	`TGSlFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TGSlTEmTCode`, `TGSlTAmyCode`),
	KEY `TEmpTAmyCode` (`TGSlTAmyCode`),
	KEY `TGSlTEmTCode` (`TGSlTEmTCode`),
	KEY `VS4TEmployeeTypeVS4TGlobalSlip` (`TGSlTEmTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpOT` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpOT`;

# ---------- CREATE TABLE `VS4TEmpOT` ----------

CREATE TABLE `VS4TEmpOT` (
	`TEOTNo` VARCHAR(30) NOT NULL,
	`TEOTDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEOTRefNo` VARCHAR(30) NULL,
	`TEOTTBraCode` VARCHAR(30) NULL,
	`TEOTTDivCode` VARCHAR(50) NULL,
	`TEOTTDepCode` VARCHAR(30) NULL,
	`TEOTTSecCode` VARCHAR(30) NULL,
	`TEOTDescription` VARCHAR(200) NULL,
	`TEOTCreateCode` VARCHAR(30) NULL,
	`TEOTCreateBy` VARCHAR(140) NULL,
	`TEOTCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEOTEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEOTEditCode` VARCHAR(30) NULL,
	`TEOTEditBy` VARCHAR(140) NULL,
	`TEOTConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TEOTConfirmBy` VARCHAR(140) NULL,
	`TEOTConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEOTApproveStatus` SMALLINT NULL DEFAULT '0',
	`TEOTApproveBy` VARCHAR(140) NULL,
	`TEOTApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEOTApproveNote` VARCHAR(80) NULL,
	`TEOTRevision` SMALLINT NULL DEFAULT '0',
	`TEOTCancelStatus` SMALLINT NULL DEFAULT '0',
	`TEOTCancelBy` VARCHAR(140) NULL,
	`TEOTCancelNo` VARCHAR(30) NULL,
	`TEOTCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEOTCancelNote` VARCHAR(80) NULL,
	`TEOTFlag1` SMALLINT NULL DEFAULT '0',
	`TEOTFlag2` SMALLINT NULL DEFAULT '0',
	`TEOTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEOTNo`),
	KEY `TEpaTBraCode` (`TEOTTBraCode`),
	KEY `TEpaTDepCode` (`TEOTTDepCode`),
	KEY `TEpaTDivCode` (`TEOTTDivCode`),
	KEY `TEpaTSecCode` (`TEOTTSecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpOTMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpOTMB`;

# ---------- CREATE TABLE `VS4TEmpOTMB` ----------

CREATE TABLE `VS4TEmpOTMB` (
	`TOTMTEOTNo` VARCHAR(30) NOT NULL,
	`TOTMLn` INT NOT NULL DEFAULT '0',
	`TOTMTEmpCode` VARCHAR(30) NULL,
	`TOTMFromTWPDCode` VARCHAR(30) NULL,
	`TOTMWorkDate` DATETIME NULL,
	`TOTMToWorkDate` DATETIME NULL,
	`TOTMInTime3` DATETIME NULL,
	`TOTMInTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TOTMOutTime3` DATETIME NULL,
	`TOTMOutTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TOTMTotalTime` DATETIME NULL,
	`TOTMAllowMore` SMALLINT NULL DEFAULT '0',
	`TOTMPayFee` SMALLINT NULL,
	`TOTMPayFood` SMALLINT NULL,
	`TOTMPayFood2` SMALLINT NULL,
	`TOTMPayVehicle` SMALLINT NULL,
	`TOTMFlag1` SMALLINT NULL DEFAULT '0',
	`TOTMFlag2` SMALLINT NULL DEFAULT '0',
	`TOTMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TOTMTEOTNo`, `TOTMLn`),
	KEY `TOTMFromTWPDCode` (`TOTMFromTWPDCode`),
	KEY `TSTMTEmpCode` (`TOTMTEmpCode`),
	KEY `TTCKTEmpCode` (`TOTMTEOTNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpParent` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpParent`;

# ---------- CREATE TABLE `VS4TEmpParent` ----------

CREATE TABLE `VS4TEmpParent` (
	`TEpPTEmpCode` VARCHAR(30) NOT NULL,
	`TEpPLn` INT NOT NULL DEFAULT '0',
	`TEpPName` VARCHAR(160) NULL,
	`TEpPBirthDay` DATETIME NULL,
	`TEpPDeadDay` DATETIME NULL,
	`TEpPIDno` VARCHAR(15) NULL,
	`TEpPTaxNo` VARCHAR(15) NULL,
	`TEpPHasIncome` SMALLINT NULL DEFAULT '0',
	`TEpPIsDead` SMALLINT NULL DEFAULT '0',
	`TEpPHasSeniorCard` SMALLINT NULL DEFAULT '0',
	`TEpPTakecare` SMALLINT NULL DEFAULT '0',
	`TEpPTel` VARCHAR(20) NULL,
	`TEpPName2` VARCHAR(160) NULL,
	`TEpPBirthDay2` DATETIME NULL,
	`TEpPDeadDay2` DATETIME NULL,
	`TEpPIDno2` VARCHAR(15) NULL,
	`TEpPTaxNo2` VARCHAR(15) NULL,
	`TEpPHasIncome2` SMALLINT NULL DEFAULT '0',
	`TEpPIsDead2` SMALLINT NULL DEFAULT '0',
	`TEpPHasSeniorCard2` SMALLINT NULL DEFAULT '0',
	`TEpPTakecare2` SMALLINT NULL DEFAULT '0',
	`TEpPTel2` VARCHAR(20) NULL,
	`TEpPName3` VARCHAR(160) NULL,
	`TEpPBirthDay3` DATETIME NULL,
	`TEpPDeadDay3` DATETIME NULL,
	`TEpPIDno3` VARCHAR(15) NULL,
	`TEpPTaxNo3` VARCHAR(15) NULL,
	`TEpPHasIncome3` SMALLINT NULL DEFAULT '0',
	`TEpPIsDead3` SMALLINT NULL DEFAULT '0',
	`TEpPHasSeniorCard3` SMALLINT NULL DEFAULT '0',
	`TEpPTakecare3` SMALLINT NULL DEFAULT '0',
	`TEpPTel3` VARCHAR(20) NULL,
	`TEpPName4` VARCHAR(160) NULL,
	`TEpPBirthDay4` DATETIME NULL,
	`TEpPDeadDay4` DATETIME NULL,
	`TEpPIDno4` VARCHAR(15) NULL,
	`TEpPTaxNo4` VARCHAR(15) NULL,
	`TEpPHasIncome4` SMALLINT NULL DEFAULT '0',
	`TEpPIsDead4` SMALLINT NULL DEFAULT '0',
	`TEpPHasSeniorCard4` SMALLINT NULL DEFAULT '0',
	`TEpPTakecare4` SMALLINT NULL DEFAULT '0',
	`TEpPTel4` VARCHAR(20) NULL,
	`TEpPFlag1` SMALLINT NULL DEFAULT '0',
	`TEpPFlag2` SMALLINT NULL DEFAULT '0',
	`TEpPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEpPTEmpCode`, `TEpPLn`),
	KEY `TEprTEmpCode` (`TEpPTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpParent` (`TEpPTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpPunish` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpPunish`;

# ---------- CREATE TABLE `VS4TEmpPunish` ----------

CREATE TABLE `VS4TEmpPunish` (
	`TEPNCode` VARCHAR(30) NOT NULL,
	`TEPNTAmyCode` VARCHAR(30) NULL,
	`TEPNName` VARCHAR(80) NULL,
	`TEPNName2` VARCHAR(80) NULL,
	`TEPNFlag1` SMALLINT NULL DEFAULT '0',
	`TEPNFlag2` SMALLINT NULL DEFAULT '0',
	`TEPNFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEPNCode`),
	KEY `TPunCode` (`TEPNCode`),
	KEY `TPunTAmyCode` (`TEPNTAmyCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpRevenue91` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpRevenue91`;

# ---------- CREATE TABLE `VS4TEmpRevenue91` ----------

CREATE TABLE `VS4TEmpRevenue91` (
	`TER9TEmpCode` VARCHAR(30) NOT NULL,
	`TER9Year` SMALLINT NOT NULL DEFAULT '0',
	`TER9TotalIncome` FLOAT NULL DEFAULT '0',
	`TER9CutWaive` FLOAT NULL DEFAULT '0',
	`TER9CutExpense` FLOAT NULL DEFAULT '0',
	`TER9TotalReduce` FLOAT NULL DEFAULT '0',
	`TER9CutStudySup` FLOAT NULL DEFAULT '0',
	`TER9CutDonate` FLOAT NULL DEFAULT '0',
	`TER9NetIncome` FLOAT NULL DEFAULT '0',
	`TER9WTax` FLOAT NULL DEFAULT '0',
	`TER9IsCutOver` SMALLINT NULL DEFAULT '0',
	`TER9PayMore` FLOAT NULL DEFAULT '0',
	`TER9Fund` FLOAT NULL DEFAULT '0',
	`TER9Fund2` FLOAT NULL DEFAULT '0',
	`TER9ABC` FLOAT NULL DEFAULT '0',
	`TER9Teacher` FLOAT NULL DEFAULT '0',
	`TER9PayBackRaw` FLOAT NULL DEFAULT '0',
	`TER9CalcBuddy` SMALLINT NULL DEFAULT '0',
	`TER9BuddyCalcTAX` SMALLINT NULL DEFAULT '0',
	`TER9SelfExpense` FLOAT NULL DEFAULT '0',
	`TER9CutBuddy` FLOAT NULL DEFAULT '0',
	`TER9ChildNotStudy` SMALLINT NULL DEFAULT '0',
	`TER9ChildStudy` SMALLINT NULL DEFAULT '0',
	`TER9ChildNotStudyC` FLOAT NULL DEFAULT '0',
	`TER9ChildStudyC` FLOAT NULL DEFAULT '0',
	`TER9TakeCareM1` SMALLINT NULL DEFAULT '0',
	`TER9TakeCareM1C` SMALLINT NULL DEFAULT '0',
	`TER9TakeCareF1` SMALLINT NULL DEFAULT '0',
	`TER9TakeCareF1C` SMALLINT NULL DEFAULT '0',
	`TER9TakeCareM2` SMALLINT NULL DEFAULT '0',
	`TER9TakeCareM2C` SMALLINT NULL DEFAULT '0',
	`TER9TakeCareF2` SMALLINT NULL DEFAULT '0',
	`TER9TakeCareF2C` SMALLINT NULL DEFAULT '0',
	`TER9Insurance` FLOAT NULL DEFAULT '0',
	`TER9Fund3` FLOAT NULL DEFAULT '0',
	`TER9FundInvest` FLOAT NULL DEFAULT '0',
	`TER9LFundInvest` FLOAT NULL DEFAULT '0',
	`TER9FundInterest` FLOAT NULL DEFAULT '0',
	`TER9STAX` FLOAT NULL DEFAULT '0',
	`TER9Flag1` SMALLINT NULL DEFAULT '0',
	`TER9Flag2` SMALLINT NULL DEFAULT '0',
	`TER9Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TER9TEmpCode`, `TER9Year`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpSalary` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpSalary`;

# ---------- CREATE TABLE `VS4TEmpSalary` ----------

CREATE TABLE `VS4TEmpSalary` (
	`TSalTEmpCode` VARCHAR(30) NOT NULL,
	`TSalLn` INT NOT NULL DEFAULT '0',
	`TSalTAmyCode` VARCHAR(30) NULL,
	`TSalRecordDate` DATETIME NULL,
	`TSalStartDate` DATETIME NULL,
	`TSalEndDate` DATETIME NULL,
	`TSalAmount` FLOAT NULL DEFAULT '0',
	`TSalAmount2` FLOAT NULL DEFAULT '0',
	`TSalDescription` VARCHAR(150) NULL,
	`TSalFlag1` SMALLINT NULL DEFAULT '0',
	`TSalFlag2` SMALLINT NULL DEFAULT '0',
	`TSalFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSalLn`, `TSalTEmpCode`),
	KEY `TEmpTAmyCode` (`TSalTAmyCode`),
	KEY `VS4TEmpAddMoneyVS4TEmpSalary` (`TSalTAmyCode`),
	KEY `VS4TEmployeeVS4TEmpSalary` (`TSalTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpSlipDoc` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpSlipDoc`;

# ---------- CREATE TABLE `VS4TEmpSlipDoc` ----------

CREATE TABLE `VS4TEmpSlipDoc` (
	`TEpsNo` VARCHAR(30) NOT NULL,
	`TEpsCheckGroup` INT NOT NULL DEFAULT '0',
	`TEpsDate` DATETIME NULL,
	`TEpsRefNo` VARCHAR(30) NULL,
	`TEpsTEmpCode` VARCHAR(30) NULL,
	`TEpsIsAdmin` SMALLINT NULL DEFAULT '0',
	`TEpsEmployeeCode` VARCHAR(30) NULL,
	`TEpsEmployeeName` VARCHAR(160) NULL,
	`TEpsEmployeeType` VARCHAR(50) NULL,
	`TEpsBalanceFlag` SMALLINT NULL DEFAULT '0',
	`TEpsTSAPTEmTCode` VARCHAR(30) NULL,
	`TEpsTSaPDate` DATETIME NULL,
	`TEpsSalaryPeriod` VARCHAR(50) NULL,
	`TEpsDivision` VARCHAR(50) NULL,
	`TEpsDepartment` VARCHAR(50) NULL,
	`TEpsSection` VARCHAR(50) NULL,
	`TEpsPosition` VARCHAR(50) NULL,
	`TEpsStartDate` DATETIME NULL,
	`TEpsEndDate` DATETIME NULL,
	`TEpsOTStartDate` DATETIME NULL,
	`TEpsOTEndDate` DATETIME NULL,
	`TEpsTotalWorkDay` SMALLINT NULL DEFAULT '0',
	`TEpsTotalLeaveHDay` SMALLINT NULL DEFAULT '0',
	`TEpsTotalDebit` DOUBLE NULL DEFAULT '0',
	`TEpsTotalCredit` DOUBLE NULL DEFAULT '0',
	`TEpsTotalSave` DOUBLE NULL DEFAULT '0',
	`TEpsNetTotal` DOUBLE NULL DEFAULT '0',
	`TEpsSalaryBase` DOUBLE NULL DEFAULT '0',
	`TEpsSalaryQuantity` DOUBLE NULL DEFAULT '0',
	`TEpsSalaryCalc` DOUBLE NULL DEFAULT '0',
	`TEpsOTList` VARCHAR(30) NULL,
	`TEpsPTAXBase` DOUBLE NULL DEFAULT '0',
	`TEpsPTAXBaseAmass` DOUBLE NULL,
	`TEpsPTAX` DOUBLE NULL DEFAULT '0',
	`TEpsPTAXOffice` DOUBLE NULL DEFAULT '0',
	`TEpsPTAXAmass` DOUBLE NULL DEFAULT '0',
	`TEpsSTAXBase` DOUBLE NULL DEFAULT '0',
	`TEpsSTAX` DOUBLE NULL DEFAULT '0',
	`TEpsSTAXOffice` DOUBLE NULL DEFAULT '0',
	`TEpsSTAXAmass` DOUBLE NULL DEFAULT '0',
	`TEpsSFUNDBase` DOUBLE NULL DEFAULT '0',
	`TEpsSFUND` DOUBLE NULL DEFAULT '0',
	`TEpsSFUNDOffice` DOUBLE NULL DEFAULT '0',
	`TEpsSFUNDAmass` DOUBLE NULL DEFAULT '0',
	`TEpsFUNDBase` DOUBLE NULL DEFAULT '0',
	`TEpsFUND` DOUBLE NULL DEFAULT '0',
	`TEpsFUNDOffice` DOUBLE NULL DEFAULT '0',
	`TEpsFUNDAmass` DOUBLE NULL DEFAULT '0',
	`TEpsFINT` DOUBLE NULL,
	`TEpsFINTOffice` DOUBLE NULL,
	`TEpsFINTAmass` DOUBLE NULL,
	`TEpsFINTAmassOff` DOUBLE NULL,
	`TEpsAmassRevenue` DOUBLE NULL DEFAULT '0',
	`TEpsAmassExpense` DOUBLE NULL DEFAULT '0',
	`TEpsPaymentType` SMALLINT NULL DEFAULT '0',
	`TEpsPaymentName` VARCHAR(50) NULL,
	`TEpsTBnkCode` VARCHAR(30) NULL,
	`TEpsTBBrCode` VARCHAR(30) NULL,
	`TEpsBankName` VARCHAR(100) NULL,
	`TEpsBankBranch` VARCHAR(100) NULL,
	`TEpsBankAccType` VARCHAR(50) NULL,
	`TEpsBankAccName` VARCHAR(160) NULL,
	`TEpsBankAccNo` VARCHAR(30) NULL,
	`TEpsDateBank` DATETIME NULL,
	`TEpsDescription` VARCHAR(150) NULL,
	`TEpsCreateCode` VARCHAR(30) NULL,
	`TEpsCreateBy` VARCHAR(140) NULL,
	`TEpsCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpsEditCode` VARCHAR(30) NULL,
	`TEpsEditBy` VARCHAR(140) NULL,
	`TEpsEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpsConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TEpsConfirmBy` VARCHAR(140) NULL,
	`TEpsConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpsApproveStatus` SMALLINT NULL DEFAULT '0',
	`TEpsApproveBy` VARCHAR(140) NULL,
	`TEpsApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpsApproveNote` VARCHAR(80) NULL,
	`TEpsRevision` SMALLINT NULL DEFAULT '0',
	`TEpsCancelStatus` SMALLINT NULL DEFAULT '0',
	`TEpsCancelNo` VARCHAR(30) NULL,
	`TEpsCancelBy` VARCHAR(140) NULL,
	`TEpsCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEpsCancelNote` VARCHAR(80) NULL,
	`TEpsFlag1` SMALLINT NULL DEFAULT '0',
	`TEpsFlag2` SMALLINT NULL DEFAULT '0',
	`TEpsFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEpsNo`, `TEpsCheckGroup`),
	KEY `TEpsCheckGroup` (`TEpsCheckGroup`),
	KEY `TEpsNo` (`TEpsNo`),
	KEY `TEpsTBBrCode` (`TEpsTBBrCode`),
	KEY `TEpsTBnkCode` (`TEpsTBnkCode`),
	KEY `TEpsTEmTCode` (`TEpsTSAPTEmTCode`),
	KEY `TEpsTEsTAlias` (`TEpsBalanceFlag`),
	KEY `TSaPID` (`TEpsTSaPDate`),
	KEY `VS4TEmployeeVS4TEmpSlipDoc` (`TEpsTEmpCode`),
	KEY `VS4TEmpSlipPeriodVS4TEmpSlipDoc` (`TEpsTSAPTEmTCode`, `TEpsTSaPDate`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpSlipMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpSlipMB`;

# ---------- CREATE TABLE `VS4TEmpSlipMB` ----------

CREATE TABLE `VS4TEmpSlipMB` (
	`TSmbTEpsNo` VARCHAR(30) NOT NULL,
	`TSmbTEpsCheckGroup` INT NOT NULL DEFAULT '0',
	`TSmbLn` INT NOT NULL DEFAULT '0',
	`TSmbTAmyCode` VARCHAR(30) NULL,
	`TSmbTAMTAlias` VARCHAR(30) NULL,
	`TSmbMoneyCode` VARCHAR(30) NULL,
	`TSmbMoneyName` VARCHAR(50) NULL,
	`TSmbAmassName` VARCHAR(50) NULL,
	`TSmbRate` DOUBLE NULL DEFAULT '0',
	`TSmbRateType` INT NULL DEFAULT '0',
	`TSmbBaseSource` SMALLINT NULL DEFAULT '0',
	`TSmbBaseMode` INT NULL DEFAULT '0',
	`TSmbTUntCode` VARCHAR(15) NULL,
	`TSmbCheckMoney` SMALLINT NULL DEFAULT '0',
	`TSmbCheckFix` SMALLINT NULL DEFAULT '1',
	`TSmbPercentGroup` DOUBLE NULL DEFAULT '0',
	`TSmbPayDay` INT NULL DEFAULT '0',
	`TSmbBaseAmount` FLOAT NULL DEFAULT '0',
	`TSmbQuantity` DOUBLE NULL DEFAULT '0',
	`TSmbAmount` FLOAT NULL DEFAULT '0',
	`TSmbInterestRate` DOUBLE NULL DEFAULT '0',
	`TSmbInterestType` SMALLINT NULL DEFAULT '0',
	`TSmbInterestAmount` FLOAT NULL DEFAULT '0',
	`TSmbIntLastAmass` FLOAT NULL DEFAULT '0',
	`TSmbInterestAmass` FLOAT NULL DEFAULT '0',
	`TSmbTotal` FLOAT NULL DEFAULT '0',
	`TSmbDebit` FLOAT NULL DEFAULT '0',
	`TSmbCrebit` FLOAT NULL DEFAULT '0',
	`TSmbIncrease` FLOAT NULL DEFAULT '0',
	`TSmbDecrease` FLOAT NULL DEFAULT '0',
	`TSmbUseAllow` SMALLINT NULL DEFAULT '0',
	`TSmbCutTip` SMALLINT NULL DEFAULT '0',
	`TSmbFixUnit` SMALLINT NULL DEFAULT '0',
	`TSmbCalcTax` SMALLINT NULL DEFAULT '0',
	`TSmbCalcSTax` SMALLINT NULL DEFAULT '0',
	`TSmbAmass` FLOAT NULL DEFAULT '0',
	`TSmbAmassAmount` FLOAT NULL DEFAULT '0',
	`TSmbDescription` VARCHAR(100) NULL,
	`TSmbFlag1` SMALLINT NULL DEFAULT '0',
	`TSmbFlag2` SMALLINT NULL DEFAULT '0',
	`TSmbFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSmbTEpsNo`, `TSmbTEpsCheckGroup`, `TSmbLn`),
	KEY `TSaTTAMTAlias` (`TSmbTAMTAlias`),
	KEY `TSmbCheckGroup` (`TSmbTEpsCheckGroup`),
	KEY `TSmbMoneyCode` (`TSmbMoneyCode`),
	KEY `TSmbTAmyCode` (`TSmbTAmyCode`),
	KEY `VS4TEmpAddMoneyVS4TEmpSlipMB` (`TSmbTAmyCode`),
	KEY `VS4TEmpSlipDocVS4TEmpSlipMB` (`TSmbTEpsNo`, `TSmbTEpsCheckGroup`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpSlipPeriod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpSlipPeriod`;

# ---------- CREATE TABLE `VS4TEmpSlipPeriod` ----------

CREATE TABLE `VS4TEmpSlipPeriod` (
	`TSaPTEmTCode` VARCHAR(30) NOT NULL,
	`TSaPDate` DATETIME NOT NULL,
	`TSaPStartDate` DATETIME NULL,
	`TSaPEndDate` DATETIME NULL,
	`TSaPOTStartDate` DATETIME NULL,
	`TSaPOTEndDate` DATETIME NULL,
	`TSaPMiscStartDate` DATETIME NULL,
	`TSaPMiscEndDate` DATETIME NULL,
	`TSaPStatus` SMALLINT NULL DEFAULT '0',
	`TSaPFlag1` SMALLINT NULL DEFAULT '0',
	`TSaPFlag2` SMALLINT NULL DEFAULT '0',
	`TSaPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSaPTEmTCode`, `TSaPDate`),
	KEY `TSaPTEmTCode` (`TSaPTEmTCode`),
	KEY `VS4TEmployeeTypeVS4TEmpSlipPeriod` (`TSaPTEmTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpSpecial` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpSpecial`;

# ---------- CREATE TABLE `VS4TEmpSpecial` ----------

CREATE TABLE `VS4TEmpSpecial` (
	`TSplTEmpCode` VARCHAR(30) NOT NULL,
	`TSplLn` INT NOT NULL DEFAULT '0',
	`TSplName` VARCHAR(50) NULL,
	`TSplLevel` VARCHAR(10) NULL,
	`TSplDescription` VARCHAR(150) NULL,
	`TSplFlag1` SMALLINT NULL DEFAULT '0',
	`TSplFlag2` SMALLINT NULL DEFAULT '0',
	`TSplFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSplLn`, `TSplTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpSpecial` (`TSplTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpTimeChk` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpTimeChk`;

# ---------- CREATE TABLE `VS4TEmpTimeChk` ----------

CREATE TABLE `VS4TEmpTimeChk` (
	`TEtcNo` VARCHAR(30) NOT NULL,
	`TEtcDate` DATETIME NULL,
	`TEtcRefNo` VARCHAR(30) NULL,
	`TEtcTSAPTEmTCode` VARCHAR(30) NULL,
	`TEtcTSaPDate` DATETIME NULL,
	`TEtcSalaryPeriod` VARCHAR(50) NULL,
	`TEtcDivision` VARCHAR(50) NULL,
	`TEtcDepartment` VARCHAR(50) NULL,
	`TEtcSection` VARCHAR(50) NULL,
	`TEtcStartDate` DATETIME NULL,
	`TEtcEndDate` DATETIME NULL,
	`TEtcOTStartDate` DATETIME NULL,
	`TEtcOTEndDate` DATETIME NULL,
	`TEtcTEmpCode` VARCHAR(30) NULL,
	`TEtcEmployeeType` VARCHAR(50) NULL,
	`TEtcEmployeeCode` VARCHAR(30) NULL,
	`TEtcEmployeeName` VARCHAR(50) NULL,
	`TEtcTotalDay` DOUBLE NULL DEFAULT '0',
	`TEtcTotalFreeDay` DOUBLE NULL DEFAULT '0',
	`TEtcTotalLeaveHDay` DOUBLE NULL DEFAULT '0',
	`TEtcTotalTime` DOUBLE NULL DEFAULT '0',
	`TEtcTotalWorkDay` DOUBLE NULL DEFAULT '0',
	`TEtcTotalWork` DOUBLE NULL DEFAULT '0',
	`TEtcTotalLossDay` DOUBLE NULL DEFAULT '0',
	`TEtcTotalLeaveDay` DOUBLE NULL DEFAULT '0',
	`TEtcTotalOT1` DOUBLE NULL DEFAULT '0',
	`TEtcTotalOT15` DOUBLE NULL DEFAULT '0',
	`TEtcTotalOT2` DOUBLE NULL DEFAULT '0',
	`TEtcTotalOT3` DOUBLE NULL DEFAULT '0',
	`TEtcTotalLate` DOUBLE NULL DEFAULT '0',
	`TEtcTotalEarly` DOUBLE NULL DEFAULT '0',
	`TEtcTotalLoss` DOUBLE NULL DEFAULT '0',
	`TEtcTotalLeaveH` DOUBLE NULL DEFAULT '0',
	`TEtcTotalLeave` DOUBLE NULL DEFAULT '0',
	`TEtcTotalLeaveOK` DOUBLE NULL DEFAULT '0',
	`TEtcTotalPayBackOT` DOUBLE NULL DEFAULT '0',
	`TEtcBonus` DOUBLE NULL DEFAULT '0',
	`TEtcBonusAmass` DOUBLE NULL DEFAULT '0',
	`TEtcTotalStamp` SMALLINT NULL,
	`TEtcTotalStamp2` SMALLINT NULL,
	`TEtcTotalStamp3` SMALLINT NULL,
	`TEtcTotalShift` SMALLINT NULL,
	`TEtcTotalFood` SMALLINT NULL,
	`TEtcTotalFood2` SMALLINT NULL,
	`TEtcTotalVehicleH` SMALLINT NULL,
	`TEtcTotalVehicle` SMALLINT NULL,
	`TEtcDescription` VARCHAR(50) NULL,
	`TEtcCreateCode` VARCHAR(30) NULL,
	`TEtcCreateBy` VARCHAR(140) NULL,
	`TEtcCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEtcEditCode` VARCHAR(30) NULL,
	`TEtcEditBy` VARCHAR(140) NULL,
	`TEtcEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEtcConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TEtcConfirmBy` VARCHAR(140) NULL,
	`TEtcConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEtcApproveStatus` SMALLINT NULL DEFAULT '0',
	`TEtcApproveBy` VARCHAR(140) NULL,
	`TEtcApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEtcApproveNote` VARCHAR(80) NULL,
	`TEtcRevision` SMALLINT NULL DEFAULT '0',
	`TEtcCancelStatus` SMALLINT NULL DEFAULT '0',
	`TEtcCancelNo` VARCHAR(30) NULL,
	`TEtcCancelBy` VARCHAR(140) NULL,
	`TEtcCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEtcCancelNote` VARCHAR(80) NULL,
	`TEtcFlag1` SMALLINT NULL DEFAULT '0',
	`TEtcFlag2` SMALLINT NULL DEFAULT '0',
	`TEtcFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEtcNo`),
	KEY `TDepCode` (`TEtcNo`),
	KEY `TEpsTSaPDate` (`TEtcTSaPDate`),
	KEY `TEpsTSAPTEmTCode` (`TEtcTSAPTEmTCode`),
	KEY `VS4TEmployeeVS4TEmpTimeChkDoc` (`TEtcTEmpCode`),
	KEY `VS4TEmpSlipPeriodVS4TEmpTimeChkDoc` (`TEtcTSAPTEmTCode`, `TEtcTSaPDate`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpTimeChkMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpTimeChkMB`;

# ---------- CREATE TABLE `VS4TEmpTimeChkMB` ----------

CREATE TABLE `VS4TEmpTimeChkMB` (
	`TTCKTEtcNo` VARCHAR(30) NOT NULL,
	`TTCKLn` INT NOT NULL DEFAULT '0',
	`TTCKTWPDCode` VARCHAR(30) NULL,
	`TTCKWorkDate` DATETIME NULL,
	`TTCKFreeDay` SMALLINT NULL DEFAULT '0',
	`TTCKPayType` SMALLINT NULL DEFAULT '0',
	`TTCKType` SMALLINT NULL DEFAULT '0',
	`TTCKInTHpfCode1` VARCHAR(30) NULL,
	`TTCKInTime1` DATETIME NULL,
	`TTCKInTimeAddDay1` SMALLINT NULL DEFAULT '0',
	`TTCKOutTHpfCode1` VARCHAR(30) NULL,
	`TTCKOutTime1` DATETIME NULL,
	`TTCKOutTimeAddDay1` SMALLINT NULL DEFAULT '0',
	`TTCKInTHpfCode2` VARCHAR(30) NULL,
	`TTCKInTime2` DATETIME NULL,
	`TTCKInTimeAddDay2` SMALLINT NULL DEFAULT '0',
	`TTCKOutTHpfCode2` VARCHAR(30) NULL,
	`TTCKOutTime2` DATETIME NULL,
	`TTCKOutTimeAddDay2` SMALLINT NULL DEFAULT '0',
	`TTCKInTHpfCode3` VARCHAR(30) NULL,
	`TTCKInTime3` DATETIME NULL,
	`TTCKInTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TTCKOutTHpfCode3` VARCHAR(30) NULL,
	`TTCKOutTime3` DATETIME NULL,
	`TTCKOutTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TTCKInTHpfCode4` VARCHAR(30) NULL,
	`TTCKInTime4` DATETIME NULL,
	`TTCKInTimeAddDay4` SMALLINT NULL DEFAULT '0',
	`TTCKOutTHpfCode4` VARCHAR(30) NULL,
	`TTCKOutTime4` DATETIME NULL,
	`TTCKOutTimeAddDay4` SMALLINT NULL DEFAULT '0',
	`TTCKTotalTime` DOUBLE NULL DEFAULT '0',
	`TTCKTotalWork` DOUBLE NULL DEFAULT '0',
	`TTCKTotalOT` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLate` DOUBLE NULL DEFAULT '0',
	`TTCKTotalEarly` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLoss` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLeave` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLeaveOK` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLeaveH` DOUBLE NULL DEFAULT '0',
	`TTCKTotalWorkADJ` DOUBLE NULL DEFAULT '0',
	`TTCKTotalOTADJ` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLateADJ` DOUBLE NULL DEFAULT '0',
	`TTCKTotalEarlyADJ` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLossADJ` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLeaveADJ` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLeaveOKAJ` DOUBLE NULL DEFAULT '0',
	`TTCKTotalLeaveHADJ` DOUBLE NULL DEFAULT '0',
	`TTCKLeaveCode` VARCHAR(30) NULL,
	`TTCKLeaveName` VARCHAR(50) NULL,
	`TTCKRecordList` VARCHAR(100) NULL,
	`TTCKDescription` VARCHAR(150) NULL,
	`TTCKPayShift` SMALLINT NULL,
	`TTCKPayFood` SMALLINT NULL,
	`TTCKPayFood2` SMALLINT NULL,
	`TTCKPayVehicle` SMALLINT NULL,
	`TTCKPayStamp` SMALLINT NULL,
	`TTCKPayStamp2` SMALLINT NULL,
	`TTCKPayStamp3` SMALLINT NULL,
	`TTCKFlag1` SMALLINT NULL DEFAULT '0',
	`TTCKFlag2` SMALLINT NULL DEFAULT '0',
	`TTCKFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTCKLn`, `TTCKTEtcNo`),
	KEY `VS4TEmpTimeChkDocVS4TEmpTimeChk` (`TTCKTEtcNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpTimeFill` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpTimeFill`;

# ---------- CREATE TABLE `VS4TEmpTimeFill` ----------

CREATE TABLE `VS4TEmpTimeFill` (
	`TTGMTEmpCode` VARCHAR(30) NOT NULL,
	`TTGMWorkDate` DATETIME NOT NULL,
	`TTGMTWPDCode` VARCHAR(30) NULL,
	`TTGMFreeDay` SMALLINT NULL DEFAULT '0',
	`TTGMPayType` SMALLINT NULL DEFAULT '0',
	`TTGMType` SMALLINT NULL DEFAULT '0',
	`TTGMInTHpfCode1` VARCHAR(30) NULL,
	`TTGMInTime1` DATETIME NULL,
	`TTGMInTimeAddDay1` SMALLINT NULL DEFAULT '0',
	`TTGMOutTHpfCode1` VARCHAR(30) NULL,
	`TTGMOutTime1` DATETIME NULL,
	`TTGMOutTimeAddDay1` SMALLINT NULL DEFAULT '0',
	`TTGMInTHpfCode2` VARCHAR(30) NULL,
	`TTGMInTime2` DATETIME NULL,
	`TTGMInTimeAddDay2` SMALLINT NULL DEFAULT '0',
	`TTGMOutTHpfCode2` VARCHAR(30) NULL,
	`TTGMOutTime2` DATETIME NULL,
	`TTGMOutTimeAddDay2` SMALLINT NULL DEFAULT '0',
	`TTGMInTHpfCode3` VARCHAR(30) NULL,
	`TTGMInTime3` DATETIME NULL,
	`TTGMInTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TTGMOutTHpfCode3` VARCHAR(30) NULL,
	`TTGMOutTime3` DATETIME NULL,
	`TTGMOutTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TTGMInTHpfCode4` VARCHAR(30) NULL,
	`TTGMInTime4` DATETIME NULL,
	`TTGMInTimeAddDay4` SMALLINT NULL DEFAULT '0',
	`TTGMOutTHpfCode4` VARCHAR(30) NULL,
	`TTGMOutTime4` DATETIME NULL,
	`TTGMOutTimeAddDay4` SMALLINT NULL DEFAULT '0',
	`TTGMTotalTime` DOUBLE NULL DEFAULT '0',
	`TTGMTotalWork` DOUBLE NULL DEFAULT '0',
	`TTGMTotalOT` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLate` DOUBLE NULL DEFAULT '0',
	`TTGMTotalEarly` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLoss` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLeave` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLeaveOK` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLeaveH` DOUBLE NULL DEFAULT '0',
	`TTGMTotalWorkADJ` DOUBLE NULL DEFAULT '0',
	`TTGMTotalOTADJ` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLateADJ` DOUBLE NULL DEFAULT '0',
	`TTGMTotalEarlyADJ` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLossADJ` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLeaveADJ` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLeaveOKAJ` DOUBLE NULL DEFAULT '0',
	`TTGMTotalLeaveHADJ` DOUBLE NULL DEFAULT '0',
	`TTGMLeaveCode` VARCHAR(30) NULL,
	`TTGMLeaveName` VARCHAR(50) NULL,
	`TTGMRecordList` VARCHAR(100) NULL,
	`TTGMDescription` VARCHAR(150) NULL,
	`TTGMPayShift` SMALLINT NULL,
	`TTGMPayFood` SMALLINT NULL,
	`TTGMPayFood2` SMALLINT NULL,
	`TTGMPayVehicle` SMALLINT NULL,
	`TTGMPayStamp` SMALLINT NULL,
	`TTGMPayStamp2` SMALLINT NULL,
	`TTGMPayStamp3` SMALLINT NULL,
	`TTGMFlag1` SMALLINT NULL DEFAULT '0',
	`TTGMFlag2` SMALLINT NULL DEFAULT '0',
	`TTGMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTGMTEmpCode`, `TTGMWorkDate`),
	KEY `TTCKTEmpCode` (`TTGMTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpTip` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpTip`;

# ---------- CREATE TABLE `VS4TEmpTip` ----------

CREATE TABLE `VS4TEmpTip` (
	`TETPCode` VARCHAR(30) NOT NULL,
	`TETPTAmyCode` VARCHAR(30) NULL,
	`TETPName` VARCHAR(80) NULL,
	`TETPName2` VARCHAR(80) NULL,
	`TETPFlag1` SMALLINT NULL DEFAULT '0',
	`TETPFlag2` SMALLINT NULL DEFAULT '0',
	`TETPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TETPCode`),
	KEY `TPunCode` (`TETPCode`),
	KEY `TPunTAmyCode` (`TETPTAmyCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpTipRate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpTipRate`;

# ---------- CREATE TABLE `VS4TEmpTipRate` ----------

CREATE TABLE `VS4TEmpTipRate` (
	`TETRTEmTCode` VARCHAR(30) NOT NULL,
	`TETRFromBase` INT NOT NULL DEFAULT '0',
	`TETRActiveRate` DOUBLE NULL DEFAULT '0',
	`TETRTipRate` DOUBLE NULL DEFAULT '0',
	`TETRFlag1` SMALLINT NULL DEFAULT '0',
	`TETRFlag2` SMALLINT NULL DEFAULT '0',
	`TETRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TETRTEmTCode`, `TETRFromBase`),
	KEY `VS4TEmployeeTypeVS4TEmpTipRate` (`TETRTEmTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpTraining` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpTraining`;

# ---------- CREATE TABLE `VS4TEmpTraining` ----------

CREATE TABLE `VS4TEmpTraining` (
	`TETrNo` VARCHAR(30) NOT NULL,
	`TETrDate` DATETIME NULL,
	`TETrRefNo` VARCHAR(30) NULL,
	`TETrDescription` VARCHAR(150) NULL,
	`TETrCreateCode` VARCHAR(30) NULL,
	`TETrCreateBy` VARCHAR(140) NULL,
	`TETrCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TETrEditCode` VARCHAR(30) NULL,
	`TETrEditBy` VARCHAR(140) NULL,
	`TETrEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TETrConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TETrConfirmBy` VARCHAR(140) NULL,
	`TETrConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TETrApproveStatus` SMALLINT NULL DEFAULT '0',
	`TETrApproveBy` VARCHAR(140) NULL,
	`TETrApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TETrApproveNote` VARCHAR(80) NULL,
	`TETrRevision` SMALLINT NULL DEFAULT '0',
	`TETrCancelStatus` SMALLINT NULL DEFAULT '0',
	`TETrCancelNo` VARCHAR(30) NULL,
	`TETrCancelBy` VARCHAR(140) NULL,
	`TETrCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TETrCancelNote` VARCHAR(80) NULL,
	`TETrFlag1` SMALLINT NULL DEFAULT '0',
	`TETrFlag2` SMALLINT NULL DEFAULT '0',
	`TETrFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TETrNo`),
	KEY `TDepCode` (`TETrNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpTrainingMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpTrainingMB`;

# ---------- CREATE TABLE `VS4TEmpTrainingMB` ----------

CREATE TABLE `VS4TEmpTrainingMB` (
	`TETmTETrNo` VARCHAR(30) NOT NULL,
	`TETmLn` INT NOT NULL DEFAULT '0',
	`TETmTEmpCode` VARCHAR(30) NULL,
	`TETmEmployeeCode` VARCHAR(30) NULL,
	`TETmEmployeeName` VARCHAR(160) NULL,
	`TETmTTrCCode` VARCHAR(30) NULL,
	`TETmName` VARCHAR(150) NULL,
	`TETmType` SMALLINT NULL DEFAULT '0',
	`TETmFee` DOUBLE NULL DEFAULT '0',
	`TETmOtherCost` DOUBLE NULL DEFAULT '0',
	`TETmTravel` DOUBLE NULL DEFAULT '0',
	`TETmEmployCharge` DOUBLE NULL DEFAULT '0',
	`TETmStartDate` DATETIME NULL,
	`TETmEndDate` DATETIME NULL,
	`TETmTotalDay` SMALLINT NULL DEFAULT '0',
	`TETmTotalHour` DOUBLE NULL DEFAULT '0',
	`TETmCustomText1` VARCHAR(50) NULL,
	`TETmCustomText2` VARCHAR(50) NULL,
	`TETmCustomValue1` DOUBLE NULL DEFAULT '0',
	`TETmCustomValue2` DOUBLE NULL DEFAULT '0',
	`TETmFlag1` SMALLINT NULL DEFAULT '0',
	`TETmFlag2` SMALLINT NULL DEFAULT '0',
	`TETmFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TETmTETrNo`, `TETmLn`),
	KEY `TETrCode` (`TETmTEmpCode`),
	KEY `VS4TEmployeeVS4TEmpTrainingMB` (`TETmTEmpCode`),
	KEY `VS4TEmpTrainingVS4TEmpTrainingMB` (`TETmTETrNo`),
	KEY `VS4TTrainingCourseVS4TEmpTrainingMB` (`TETmTTrCCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpUpSalary` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpUpSalary`;

# ---------- CREATE TABLE `VS4TEmpUpSalary` ----------

CREATE TABLE `VS4TEmpUpSalary` (
	`TEUSNo` VARCHAR(30) NOT NULL,
	`TEUSDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEUSRefNo` VARCHAR(30) NULL,
	`TEUSTBraCode` VARCHAR(30) NULL,
	`TEUSTDivCode` VARCHAR(50) NULL,
	`TEUSTDepCode` VARCHAR(30) NULL,
	`TEUSTSecCode` VARCHAR(30) NULL,
	`TEUSDescription` VARCHAR(200) NULL,
	`TEUSCreateCode` VARCHAR(30) NULL,
	`TEUSCreateBy` VARCHAR(140) NULL,
	`TEUSCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEUSEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEUSEditCode` VARCHAR(30) NULL,
	`TEUSEditBy` VARCHAR(140) NULL,
	`TEUSConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TEUSConfirmBy` VARCHAR(140) NULL,
	`TEUSConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEUSApproveStatus` SMALLINT NULL DEFAULT '0',
	`TEUSApproveBy` VARCHAR(140) NULL,
	`TEUSApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEUSApproveNote` VARCHAR(80) NULL,
	`TEUSRevision` SMALLINT NULL DEFAULT '0',
	`TEUSCancelStatus` SMALLINT NULL DEFAULT '0',
	`TEUSCancelBy` VARCHAR(140) NULL,
	`TEUSCancelNo` VARCHAR(30) NULL,
	`TEUSCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEUSCancelNote` VARCHAR(80) NULL,
	`TEUSFlag1` SMALLINT NULL DEFAULT '0',
	`TEUSFlag2` SMALLINT NULL DEFAULT '0',
	`TEUSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEUSNo`),
	KEY `TEpaTBraCode` (`TEUSTBraCode`),
	KEY `TEpaTDepCode` (`TEUSTDepCode`),
	KEY `TEpaTDivCode` (`TEUSTDivCode`),
	KEY `TEpaTSecCode` (`TEUSTSecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpUpSalaryMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpUpSalaryMB`;

# ---------- CREATE TABLE `VS4TEmpUpSalaryMB` ----------

CREATE TABLE `VS4TEmpUpSalaryMB` (
	`TEUMTEUSNo` VARCHAR(30) NOT NULL,
	`TEUMLn` INT NOT NULL DEFAULT '0',
	`TEUMTEmpCode` VARCHAR(30) NULL,
	`TEUMTEmTCode` VARCHAR(30) NULL,
	`TEUMSalaryType` SMALLINT NULL DEFAULT '0',
	`TEUMEmployeeName` VARCHAR(160) NULL,
	`TEUMTBraCode` VARCHAR(30) NULL,
	`TEUMTPstCode` VARCHAR(30) NULL,
	`TEUMTDivCode` VARCHAR(30) NULL,
	`TEUMTDepCode` VARCHAR(30) NULL,
	`TEUMTSecCode` VARCHAR(30) NULL,
	`TEUMLastSalary` FLOAT NULL DEFAULT '0',
	`TEUMLastCustom` FLOAT NULL DEFAULT '0',
	`TEUMChangeSalary` SMALLINT NULL,
	`TEUMChangePosition` SMALLINT NULL,
	`TEUMchangeType` SMALLINT NULL,
	`TEUMChangeSection` SMALLINT NULL,
	`TEUMStartDate` DATETIME NULL,
	`TEUMChangePC` DOUBLE NULL DEFAULT '0',
	`TEUMNewSalaryCalc` FLOAT NULL DEFAULT '0',
	`TEUMNewSalary` FLOAT NULL DEFAULT '0',
	`TEUMNewCustomCalc` FLOAT NULL DEFAULT '0',
	`TEUMNewCustom` FLOAT NULL DEFAULT '0',
	`TEUMNewTEmTCode` VARCHAR(30) NULL,
	`TEUMNewSalaryType` SMALLINT NULL DEFAULT '0',
	`TEUMNewTBraCode` VARCHAR(30) NULL,
	`TEUMNewTPstCode` VARCHAR(30) NULL,
	`TEUMNewTDivCode` VARCHAR(30) NULL,
	`TEUMNewTDepCode` VARCHAR(30) NULL,
	`TEUMNewTSecCode` VARCHAR(30) NULL,
	`TEUMPost` SMALLINT NULL DEFAULT '0',
	`TEUMDescription` VARCHAR(100) NULL,
	`TEUMFlag1` SMALLINT NULL DEFAULT '0',
	`TEUMFlag2` SMALLINT NULL DEFAULT '0',
	`TEUMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEUMTEUSNo`, `TEUMLn`),
	KEY `TSTMTEmpCode` (`TEUMTEmpCode`),
	KEY `TTCKTEmpCode` (`TEUMTEUSNo`),
	KEY `VS4TEmpUpSalaryVS4TEmpUpSalaryMB` (`TEUMTEUSNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpWelfare` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpWelfare`;

# ---------- CREATE TABLE `VS4TEmpWelfare` ----------

CREATE TABLE `VS4TEmpWelfare` (
	`TEWlNo` VARCHAR(30) NOT NULL,
	`TEWlDate` DATETIME NULL,
	`TEWlRefNo` VARCHAR(30) NULL,
	`TEWlDescription` VARCHAR(150) NULL,
	`TEWlCreateCode` VARCHAR(30) NULL,
	`TEWlCreateBy` VARCHAR(140) NULL,
	`TEWlCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWlEditCode` VARCHAR(30) NULL,
	`TEWlEditBy` VARCHAR(140) NULL,
	`TEWlEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWlConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TEWlConfirmBy` VARCHAR(140) NULL,
	`TEWlConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWlApproveStatus` SMALLINT NULL DEFAULT '0',
	`TEWlApproveBy` VARCHAR(140) NULL,
	`TEWlApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWlApproveNote` VARCHAR(80) NULL,
	`TEWlRevision` SMALLINT NULL DEFAULT '0',
	`TEWlCancelStatus` SMALLINT NULL DEFAULT '0',
	`TEWlCancelNo` VARCHAR(30) NULL,
	`TEWlCancelBy` VARCHAR(140) NULL,
	`TEWlCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWlCancelNote` VARCHAR(80) NULL,
	`TEWlFlag1` SMALLINT NULL DEFAULT '0',
	`TEWlFlag2` SMALLINT NULL DEFAULT '0',
	`TEWlFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEWlNo`),
	KEY `TDepCode` (`TEWlNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpWelfareMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpWelfareMB`;

# ---------- CREATE TABLE `VS4TEmpWelfareMB` ----------

CREATE TABLE `VS4TEmpWelfareMB` (
	`TEWMTEWlNo` VARCHAR(30) NOT NULL,
	`TEWMLn` INT NOT NULL DEFAULT '0',
	`TEWMTEmpCode` VARCHAR(30) NULL,
	`TEWMEmployeeCode` VARCHAR(30) NULL,
	`TEWMEmployeeName` VARCHAR(160) NULL,
	`TEWMTWelCode` VARCHAR(30) NULL,
	`TEWMName` VARCHAR(50) NULL,
	`TEWMType` SMALLINT NULL DEFAULT '0',
	`TEWMFee` DOUBLE NULL DEFAULT '0',
	`TEWMOtherCost` DOUBLE NULL DEFAULT '0',
	`TEWMOfficePay` DOUBLE NULL DEFAULT '0',
	`TEWMEmployeePay` DOUBLE NULL DEFAULT '0',
	`TEWMStartDate` DATETIME NULL,
	`TEWMEndDate` DATETIME NULL,
	`TEWMCustomText1` VARCHAR(50) NULL,
	`TEWMCustomText2` VARCHAR(50) NULL,
	`TEWMCustomValue1` DOUBLE NULL DEFAULT '0',
	`TEWMCustomValue2` DOUBLE NULL DEFAULT '0',
	`TEWMFlag1` SMALLINT NULL DEFAULT '0',
	`TEWMFlag2` SMALLINT NULL DEFAULT '0',
	`TEWMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEWMTEWlNo`, `TEWMLn`),
	KEY `TETrCode` (`TEWMTEmpCode`),
	KEY `VS4TEmpWelfareVS4TEmpWelfareMB` (`TEWMTEWlNo`),
	KEY `VS4TWelfareVS4TEmpWelfareMB` (`TEWMTWelCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpWorkCount` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpWorkCount`;

# ---------- CREATE TABLE `VS4TEmpWorkCount` ----------

CREATE TABLE `VS4TEmpWorkCount` (
	`TEWCNo` VARCHAR(30) NOT NULL,
	`TEWCDate` DATETIME NULL,
	`TEWCRefNo` VARCHAR(30) NULL,
	`TEWCTBraCode` VARCHAR(30) NULL,
	`TEWCDescription` VARCHAR(100) NULL,
	`TEWCCreateCode` VARCHAR(30) NULL,
	`TEWCCreateBy` VARCHAR(140) NULL,
	`TEWCCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWCEditCode` VARCHAR(30) NULL,
	`TEWCEditBy` VARCHAR(140) NULL,
	`TEWCEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWCConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TEWCConfirmBy` VARCHAR(140) NULL,
	`TEWCConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWCApproveStatus` SMALLINT NULL DEFAULT '0',
	`TEWCApproveBy` VARCHAR(140) NULL,
	`TEWCApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWCApproveNote` VARCHAR(80) NULL,
	`TEWCRevision` SMALLINT NULL DEFAULT '0',
	`TEWCCancelStatus` SMALLINT NULL DEFAULT '0',
	`TEWCCancelNo` VARCHAR(30) NULL,
	`TEWCCancelBy` VARCHAR(140) NULL,
	`TEWCCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TEWCCancelNote` VARCHAR(80) NULL,
	`TEWCFlag1` SMALLINT NULL DEFAULT '0',
	`TEWCFlag2` SMALLINT NULL DEFAULT '0',
	`TEWCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TEWCNo`),
	KEY `TDepCode` (`TEWCNo`),
	KEY `TEpsTSAPTEmTCode` (`TEWCTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpWorkCountMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpWorkCountMB`;

# ---------- CREATE TABLE `VS4TEmpWorkCountMB` ----------

CREATE TABLE `VS4TEmpWorkCountMB` (
	`TECMTEWCNo` VARCHAR(30) NOT NULL,
	`TECMLn` INT NOT NULL DEFAULT '0',
	`TECMTJbMTJobNo` VARCHAR(50) NULL,
	`TECMTJbMLn` INT NULL DEFAULT '0',
	`TECMTJPdNo` VARCHAR(30) NULL,
	`TECMTSpdStep` INT NULL DEFAULT '0',
	`TECMLevel` SMALLINT NULL DEFAULT '0',
	`TECMTSepCode` VARCHAR(30) NULL,
	`TECMTEmpCode` VARCHAR(30) NULL,
	`TECMType` SMALLINT NULL DEFAULT '0',
	`TECMRefNo` VARCHAR(30) NULL,
	`TECMWorkDate` DATETIME NULL,
	`TECMStartTime` DATETIME NULL,
	`TECMEndTime` DATETIME NULL,
	`TECMPayType` SMALLINT NULL DEFAULT '0',
	`TECMQuantity` DOUBLE NULL DEFAULT '1',
	`TECMMan` SMALLINT NULL DEFAULT '1',
	`TECMManOT` SMALLINT NULL DEFAULT '1',
	`TECMQuantityH` DOUBLE NULL DEFAULT '1',
	`TECMQuantityOT` DOUBLE NULL DEFAULT '1',
	`TECMHourRate` DOUBLE NULL DEFAULT '1',
	`TECMTWRMCode` VARCHAR(30) NULL,
	`TECMCost` DOUBLE NULL DEFAULT '1',
	`TECMTotal` DOUBLE NULL DEFAULT '0',
	`TECMRemark` VARCHAR(150) NULL,
	`TECMFlag1` SMALLINT NULL DEFAULT '0',
	`TECMFlag2` SMALLINT NULL DEFAULT '0',
	`TECMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TECMLn`, `TECMTEWCNo`),
	KEY `TECMTSpdStep` (`TECMType`),
	KEY `TECMType` (`TECMLevel`),
	KEY `TJDLTJbMTJobNo` (`TECMTJbMTJobNo`),
	KEY `TJDLTSepCode` (`TECMTSepCode`),
	KEY `TJDLTSpdStep` (`TECMTSpdStep`),
	KEY `VS4TEmployeeVS4TEmpWorkCountMB` (`TECMTEmpCode`),
	KEY `VS4TEmpWorkCountVS4TEmpWorkCountMB` (`TECMTEWCNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpWorkPeriod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpWorkPeriod`;

# ---------- CREATE TABLE `VS4TEmpWorkPeriod` ----------

CREATE TABLE `VS4TEmpWorkPeriod` (
	`TWPDCode` VARCHAR(30) NOT NULL,
	`TWPDName` VARCHAR(100) NULL,
	`TWPDDescription` VARCHAR(200) NULL,
	`TWPDFlag1` SMALLINT NULL DEFAULT '0',
	`TWPDFlag2` SMALLINT NULL DEFAULT '0',
	`TWPDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TWPDCode`),
	KEY `TTCKTEmpCode` (`TWPDCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpWorkRate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpWorkRate`;

# ---------- CREATE TABLE `VS4TEmpWorkRate` ----------

CREATE TABLE `VS4TEmpWorkRate` (
	`TWRMCode` VARCHAR(30) NOT NULL,
	`TWRMName` VARCHAR(150) NULL,
	`TWRMName2` VARCHAR(150) NULL,
	`TWRMBaseType` SMALLINT NULL,
	`TWRMCalcType` SMALLINT NULL,
	`TWRMTarget0` DOUBLE NULL DEFAULT '0',
	`TWRMRate0` DOUBLE NULL DEFAULT '0',
	`TWRMTarget1` DOUBLE NULL DEFAULT '0',
	`TWRMRate1` DOUBLE NULL DEFAULT '0',
	`TWRMTarget2` DOUBLE NULL DEFAULT '0',
	`TWRMRate2` DOUBLE NULL DEFAULT '0',
	`TWRMTarget3` DOUBLE NULL DEFAULT '0',
	`TWRMRate3` DOUBLE NULL DEFAULT '0',
	`TWRMTarget4` DOUBLE NULL DEFAULT '0',
	`TWRMRate4` DOUBLE NULL DEFAULT '0',
	`TWRMTarget5` DOUBLE NULL DEFAULT '0',
	`TWRMRate5` DOUBLE NULL DEFAULT '0',
	`TWRMFlag1` SMALLINT NULL DEFAULT '0',
	`TWRMFlag2` SMALLINT NULL DEFAULT '0',
	`TWRMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TWRMCode`),
	KEY `TTCKTEmpCode` (`TWRMCode`),
	KEY `TWRTName` (`TWRMName`),
	KEY `TWRTName2` (`TWRMName2`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmpWorkTime` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmpWorkTime`;

# ---------- CREATE TABLE `VS4TEmpWorkTime` ----------

CREATE TABLE `VS4TEmpWorkTime` (
	`TWPTTWPDCode` VARCHAR(30) NOT NULL,
	`TWPTWeekDay` INT NOT NULL DEFAULT '0',
	`TWPTPayType` SMALLINT NULL DEFAULT '0',
	`TWPTType` SMALLINT NULL DEFAULT '0',
	`TWPTInTime1` DATETIME NULL,
	`TWPTInTimeAddDay1` SMALLINT NULL DEFAULT '0',
	`TWPTInLate1` DATETIME NULL,
	`TWPTInLateAddDay1` SMALLINT NULL DEFAULT '0',
	`TWPTOutTime1` DATETIME NULL,
	`TWPTOutTimeAddDay1` SMALLINT NULL DEFAULT '0',
	`TWPTInTime2` DATETIME NULL,
	`TWPTInTimeAddDay2` SMALLINT NULL DEFAULT '0',
	`TWPTInLate2` DATETIME NULL,
	`TWPTInLateAddDay2` SMALLINT NULL DEFAULT '0',
	`TWPTOutTime2` DATETIME NULL,
	`TWPTOutTimeAddDay2` SMALLINT NULL DEFAULT '0',
	`TWPTInTime3` DATETIME NULL,
	`TWPTInTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TWPTInLate3` DATETIME NULL,
	`TWPTInLateAddDay3` SMALLINT NULL DEFAULT '0',
	`TWPTOutTime3` DATETIME NULL,
	`TWPTOutTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TWPTInTime4` DATETIME NULL,
	`TWPTInTimeAddDay4` SMALLINT NULL DEFAULT '0',
	`TWPTInLate4` DATETIME NULL,
	`TWPTInLateAddDay4` SMALLINT NULL DEFAULT '0',
	`TWPTOutTime4` VARCHAR(5) NULL,
	`TWPTOutTimeAddDay4` SMALLINT NULL DEFAULT '0',
	`TWPTPayShift` SMALLINT NULL,
	`TWPTPayFood` SMALLINT NULL,
	`TWPTPayFood2` SMALLINT NULL,
	`TWPTPayVehicle` SMALLINT NULL,
	`TWPTPayStamp` SMALLINT NULL,
	`TWPTPayStamp2` SMALLINT NULL,
	`TWPTPayStamp3` SMALLINT NULL,
	`TWPTFlag1` SMALLINT NULL DEFAULT '0',
	`TWPTFlag2` SMALLINT NULL DEFAULT '0',
	`TWPTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TWPTTWPDCode`, `TWPTWeekDay`),
	KEY `TTCKTEmpCode` (`TWPTTWPDCode`),
	KEY `VS4TEmpWorkPeriodVS4TEmpWorkTime` (`TWPTTWPDCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TEmTLeaveAllow` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TEmTLeaveAllow`;

# ---------- CREATE TABLE `VS4TEmTLeaveAllow` ----------

CREATE TABLE `VS4TEmTLeaveAllow` (
	`TETLTEmTCode` VARCHAR(30) NOT NULL,
	`TETLYear` INT NOT NULL DEFAULT '0',
	`TETLType` INT NOT NULL DEFAULT '0',
	`TETLTotal1` DOUBLE NULL DEFAULT '0',
	`TETLTime1` SMALLINT NULL DEFAULT '0',
	`TETLTotal2` DOUBLE NULL DEFAULT '0',
	`TETLTime2` SMALLINT NULL DEFAULT '0',
	`TETLTotal3` DOUBLE NULL DEFAULT '0',
	`TETLTime3` SMALLINT NULL DEFAULT '0',
	`TETLTotal4` DOUBLE NULL DEFAULT '0',
	`TETLTime4` SMALLINT NULL DEFAULT '0',
	`TETLTotal5` DOUBLE NULL DEFAULT '0',
	`TETLTime5` SMALLINT NULL DEFAULT '0',
	`TETLTotal6` DOUBLE NULL DEFAULT '0',
	`TETLTime6` SMALLINT NULL DEFAULT '0',
	`TETLTotal7` DOUBLE NULL DEFAULT '0',
	`TETLTime7` SMALLINT NULL DEFAULT '0',
	`TETLTotal8` DOUBLE NULL DEFAULT '0',
	`TETLTime8` SMALLINT NULL DEFAULT '0',
	`TETLTotal9` DOUBLE NULL DEFAULT '0',
	`TETLTime9` SMALLINT NULL DEFAULT '0',
	`TETLTotal10` DOUBLE NULL DEFAULT '0',
	`TETLTime10` SMALLINT NULL DEFAULT '0',
	`TETLTotal11` DOUBLE NULL DEFAULT '0',
	`TETLTime11` SMALLINT NULL DEFAULT '0',
	`TETLTotal12` DOUBLE NULL DEFAULT '0',
	`TETLTime12` SMALLINT NULL DEFAULT '0',
	`TETLTotal13` DOUBLE NULL DEFAULT '0',
	`TETLTime13` SMALLINT NULL DEFAULT '0',
	`TETLTotal14` DOUBLE NULL DEFAULT '0',
	`TETLTime14` SMALLINT NULL DEFAULT '0',
	`TETLTotal15` DOUBLE NULL DEFAULT '0',
	`TETLTime15` SMALLINT NULL DEFAULT '0',
	`TETLFlag1` SMALLINT NULL DEFAULT '0',
	`TETLFlag2` SMALLINT NULL DEFAULT '0',
	`TETLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TETLTEmTCode`, `TETLYear`, `TETLType`),
	KEY `TELATEmpCode` (`TETLTEmTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TExchange` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TExchange`;

# ---------- CREATE TABLE `VS4TExchange` ----------

CREATE TABLE `VS4TExchange` (
	`TExcNo` VARCHAR(30) NOT NULL,
	`TExcDate` DATETIME NULL DEFAULT '3333-3-3',
	`TExcRefNo` VARCHAR(30) NULL,
	`TExcDescription` VARCHAR(200) NULL,
	`TExcCreateCode` VARCHAR(30) NULL,
	`TExcCreateBy` VARCHAR(140) NULL,
	`TExcCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TExcEditCode` VARCHAR(30) NULL,
	`TExcEditBy` VARCHAR(140) NULL,
	`TExcEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TExcConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TExcConfirmBy` VARCHAR(140) NULL,
	`TExcConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TExcApproveStatus` SMALLINT NULL DEFAULT '0',
	`TExcApproveBy` VARCHAR(140) NULL,
	`TExcApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TExcApproveNote` VARCHAR(80) NULL,
	`TExcRevision` SMALLINT NULL DEFAULT '0',
	`TExcCancelStatus` SMALLINT NULL DEFAULT '0',
	`TExcCancelNo` VARCHAR(30) NULL,
	`TExcCancelBy` VARCHAR(140) NULL,
	`TExcCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TExcCancelNote` VARCHAR(80) NULL,
	`TExcFlag1` SMALLINT NULL DEFAULT '0',
	`TExcFlag2` SMALLINT NULL DEFAULT '0',
	`TExcFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TExcNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TExchangeRate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TExchangeRate`;

# ---------- CREATE TABLE `VS4TExchangeRate` ----------

CREATE TABLE `VS4TExchangeRate` (
	`TExRTExcNo` VARCHAR(30) NOT NULL,
	`TExRLn` INT NOT NULL DEFAULT '0',
	`TExRTBnkCode` VARCHAR(30) NULL,
	`TExRFromQuantity` DOUBLE NULL DEFAULT '1',
	`TExRTCurCode` VARCHAR(5) NULL,
	`TExRRate` DOUBLE NULL DEFAULT '0',
	`TExRBuyRate` DOUBLE NULL DEFAULT '0',
	`TExRApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TExRStatus` SMALLINT NULL DEFAULT '0',
	`TExRFlag1` SMALLINT NULL DEFAULT '0',
	`TExRFlag2` SMALLINT NULL DEFAULT '0',
	`TExRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TExRLn`, `TExRTExcNo`),
	KEY `TExRID` (`TExRLn`),
	KEY `TExRTBnkID` (`TExRTBnkCode`),
	KEY `TExRTCurID` (`TExRTCurCode`),
	KEY `VS4TBankVS4TExchangeRate` (`TExRTBnkCode`),
	KEY `VS4TCurrencyVS4TExchangeRate` (`TExRTCurCode`),
	KEY `VS4TExchangeVS4TExchangeRate` (`TExRTExcNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFlight` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFlight`;

# ---------- CREATE TABLE `VS4TFlight` ----------

CREATE TABLE `VS4TFlight` (
	`TFliNo` VARCHAR(30) NOT NULL,
	`TFliParkNo` VARCHAR(30) NULL,
	`TFliCardNo` VARCHAR(20) NULL,
	`TFliDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFliDateTime` DATETIME NULL DEFAULT '3333-3-3',
	`TFliJobCode` VARCHAR(30) NULL,
	`TFliReceptionCode` VARCHAR(30) NULL,
	`TFliReceptionName` VARCHAR(150) NULL,
	`TFliTARNCode` VARCHAR(30) NULL,
	`TFliCustomerName` VARCHAR(200) NULL,
	`TFliTAPNCode` VARCHAR(30) NULL,
	`TFliTourName` VARCHAR(200) NULL,
	`TFliTourLeader` SMALLINT NULL DEFAULT '0',
	`TFliTotalMale` SMALLINT NULL DEFAULT '0',
	`TFliTotalFemale` SMALLINT NULL DEFAULT '0',
	`TFliTotalChild` SMALLINT NULL DEFAULT '0',
	`TFliNationalCode` VARCHAR(30) NULL,
	`TFliNational` VARCHAR(50) NULL,
	`TFliLanguage` VARCHAR(40) NULL,
	`TFliLastHotel` VARCHAR(255) NULL,
	`TFliNote` VARCHAR(255) NULL,
	`TFliStatus` SMALLINT NULL DEFAULT '0',
	`TFliLeaveDateTime` DATETIME NULL DEFAULT '3333-3-3',
	`TFliEndReceptCode` VARCHAR(30) NULL,
	`TFliEndReceptName` VARCHAR(150) NULL,
	`TFliTotalGuide` FLOAT NULL DEFAULT '0',
	`TFliTotalEmp` FLOAT NULL DEFAULT '0',
	`TFliTotalTour` FLOAT NULL DEFAULT '0',
	`TFliTotalTourLead` FLOAT NULL DEFAULT '0',
	`TFliTotalDriver` FLOAT NULL DEFAULT '0',
	`TFliTotalSale` FLOAT NULL DEFAULT '0',
	`TFliTotalPremium` FLOAT NULL DEFAULT '0',
	`TFliTotalDiscount` FLOAT NULL DEFAULT '0',
	`TFliCommissionBase` FLOAT NULL DEFAULT '0',
	`TFliCommissionRate` VARCHAR(30) NULL,
	`TFliCommission` FLOAT NULL DEFAULT '0',
	`TFliNetPayment` FLOAT NULL DEFAULT '0',
	`TFliArrear` FLOAT NULL DEFAULT '0',
	`TFLiLicenseNoList` VARCHAR(50) NULL,
	`TFliTCurCode` VARCHAR(5) NULL,
	`TFliCreateCode` VARCHAR(30) NULL,
	`TFliCreateBy` VARCHAR(140) NULL,
	`TFliCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFliEditCode` VARCHAR(30) NULL,
	`TFliEditBy` VARCHAR(140) NULL,
	`TFliEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFliConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TFliConfirmBy` VARCHAR(140) NULL,
	`TFliConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFliApproveStatus` SMALLINT NULL DEFAULT '0',
	`TFliApproveBy` VARCHAR(140) NULL,
	`TFliApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFliApproveNote` VARCHAR(80) NULL,
	`TFliRevision` SMALLINT NULL DEFAULT '0',
	`TFliCancelStatus` SMALLINT NULL DEFAULT '0',
	`TFliCancelNo` VARCHAR(30) NULL,
	`TFliCancelBy` VARCHAR(140) NULL,
	`TFliCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TFliCancelNote` VARCHAR(80) NULL,
	`TFliFlag1` SMALLINT NULL DEFAULT '0',
	`TFliFlag2` SMALLINT NULL DEFAULT '0',
	`TFliFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFliNo`),
	KEY `TFliEndRecpCode` (`TFliEndReceptCode`),
	KEY `TFliTARNCode` (`TFliTAPNCode`),
	KEY `TFliTARNCode1` (`TFliCustomerName`),
	KEY `TFliTCurCode` (`TFliTCurCode`),
	KEY `TFliTourCode` (`TFliTARNCode`),
	KEY `VS4TARVS4TFlight` (`TFliTARNCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFlightEmployee` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFlightEmployee`;

# ---------- CREATE TABLE `VS4TFlightEmployee` ----------

CREATE TABLE `VS4TFlightEmployee` (
	`TFlETFliNo` VARCHAR(30) NOT NULL,
	`TFlELn` SMALLINT NOT NULL DEFAULT '0',
	`TFlECode` VARCHAR(30) NULL,
	`TFlEName` VARCHAR(160) NULL,
	`TFlEPositionName` VARCHAR(50) NULL,
	`TFlEPositionAlias` VARCHAR(15) NULL,
	`TFlETEmGCode` VARCHAR(30) NULL,
	`TFlERate` DOUBLE NULL DEFAULT '0',
	`TFlEFee` FLOAT NULL DEFAULT '0',
	`TFlENote` VARCHAR(80) NULL,
	`TFlEFlag1` SMALLINT NULL DEFAULT '0',
	`TFlEFlag2` SMALLINT NULL DEFAULT '0',
	`TFlEFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFlETFliNo`, `TFlELn`),
	KEY `TFlETEmGCode` (`TFlETEmGCode`),
	KEY `TPTAEmpCode` (`TFlECode`),
	KEY `TPTETPOSID` (`TFlETFliNo`),
	KEY `VS4TFlightVS4TFlightEmployee` (`TFlETFliNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFlightGuide` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFlightGuide`;

# ---------- CREATE TABLE `VS4TFlightGuide` ----------

CREATE TABLE `VS4TFlightGuide` (
	`TFlGTFliNo` VARCHAR(30) NOT NULL,
	`TFlGLn` SMALLINT NOT NULL DEFAULT '0',
	`TFlGCode` VARCHAR(30) NULL,
	`TFlGName` VARCHAR(160) NULL,
	`TFlGRate` DOUBLE NULL DEFAULT '0',
	`TFlGFee` FLOAT NULL DEFAULT '0',
	`TFlGNote` VARCHAR(80) NULL,
	`TFlGFlag1` SMALLINT NULL DEFAULT '0',
	`TFlGFlag2` SMALLINT NULL DEFAULT '0',
	`TFlGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFlGTFliNo`, `TFlGLn`),
	KEY `TFlGTFliID` (`TFlGTFliNo`),
	KEY `TFliGuideCode` (`TFlGCode`),
	KEY `TFliID` (`TFlGLn`),
	KEY `VS4TFlightVS4TFlightGuide` (`TFlGTFliNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFlightVehicle` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFlightVehicle`;

# ---------- CREATE TABLE `VS4TFlightVehicle` ----------

CREATE TABLE `VS4TFlightVehicle` (
	`TFVhTFliNo` VARCHAR(30) NOT NULL,
	`TFVhLn` SMALLINT NOT NULL DEFAULT '0',
	`TFVhLicenseNo` VARCHAR(10) NULL,
	`TFVhTVeTCode` VARCHAR(30) NULL,
	`TFVhType` VARCHAR(50) NULL,
	`TFVhCustom1` FLOAT NULL DEFAULT '0',
	`TFVhCustom2` FLOAT NULL DEFAULT '0',
	`TFVhNote` VARCHAR(80) NULL,
	`TFVhFlag1` SMALLINT NULL DEFAULT '0',
	`TFVhFlag2` SMALLINT NULL DEFAULT '0',
	`TFVhFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFVhTFliNo`, `TFVhLn`),
	KEY `TFVhID` (`TFVhLn`),
	KEY `TFVhTCurCode1` (`TFVhTVeTCode`),
	KEY `TFVhTFliID` (`TFVhTFliNo`),
	KEY `VS4TFlightVS4TFlightVehicle` (`TFVhTFliNo`),
	KEY `VS4TVehicleTypeVS4TFlightVehicle` (`TFVhTVeTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFormula` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFormula`;

# ---------- CREATE TABLE `VS4TFormula` ----------

CREATE TABLE `VS4TFormula` (
	`TForCode` VARCHAR(30) NOT NULL,
	`TForTFmMAlias` VARCHAR(30) NULL,
	`TForName` VARCHAR(100) NULL,
	`TForName2` VARCHAR(100) NULL,
	`TForProcessNo` INT NULL DEFAULT '0',
	`TForNote` VARCHAR(100) NULL,
	`TForFlag1` SMALLINT NULL DEFAULT '0',
	`TForFlag2` SMALLINT NULL DEFAULT '0',
	`TForFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TForCode`),
	KEY `TFoGID` (`TForCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFormulaGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFormulaGroup`;

# ---------- CREATE TABLE `VS4TFormulaGroup` ----------

CREATE TABLE `VS4TFormulaGroup` (
	`TFoGCode` VARCHAR(30) NOT NULL,
	`TFoGName` VARCHAR(100) NULL,
	`TFoGName2` VARCHAR(100) NULL,
	`TFoGFlag1` SMALLINT NULL DEFAULT '0',
	`TFoGFlag2` SMALLINT NULL DEFAULT '0',
	`TFoGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFoGCode`),
	KEY `TFoGID` (`TFoGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFormulaMap` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFormulaMap`;

# ---------- CREATE TABLE `VS4TFormulaMap` ----------

CREATE TABLE `VS4TFormulaMap` (
	`TFmMAlias` VARCHAR(30) NOT NULL,
	`TFmMName` VARCHAR(100) NULL,
	`TFmMName2` VARCHAR(100) NULL,
	`TFmMTFoGCode` VARCHAR(30) NULL,
	`TFmMSort` INT NULL DEFAULT '0',
	`TFmMX1` VARCHAR(30) NULL,
	`TFmMX2` VARCHAR(30) NULL,
	`TFmMX3` VARCHAR(30) NULL,
	`TFmMX4` VARCHAR(30) NULL,
	`TFmMX5` VARCHAR(30) NULL,
	`TFmMX6` VARCHAR(30) NULL,
	`TFmMX7` VARCHAR(30) NULL,
	`TFmMX8` VARCHAR(30) NULL,
	`TFmMX9` VARCHAR(30) NULL,
	`TFmMX10` VARCHAR(30) NULL,
	`TFmMX11` VARCHAR(30) NULL,
	`TFmMX12` VARCHAR(30) NULL,
	`TFmMX13` VARCHAR(30) NULL,
	`TFmMX14` VARCHAR(30) NULL,
	`TFmMX15` VARCHAR(30) NULL,
	`TFmMX16` VARCHAR(30) NULL,
	`TFmMX17` VARCHAR(30) NULL,
	`TFmMX18` VARCHAR(30) NULL,
	`TFmMX19` VARCHAR(30) NULL,
	`TFmMX20` VARCHAR(30) NULL,
	`TFmMY1` VARCHAR(30) NULL,
	`TFmMY2` VARCHAR(30) NULL,
	`TFmMY3` VARCHAR(30) NULL,
	`TFmMY4` VARCHAR(30) NULL,
	`TFmMY5` VARCHAR(30) NULL,
	`TFmMY6` VARCHAR(30) NULL,
	`TFmMY7` VARCHAR(30) NULL,
	`TFmMY8` VARCHAR(30) NULL,
	`TFmMY9` VARCHAR(30) NULL,
	`TFmMY10` VARCHAR(30) NULL,
	`TFmMFlag1` SMALLINT NULL DEFAULT '0',
	`TFmMFlag2` SMALLINT NULL DEFAULT '0',
	`TFmMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFmMAlias`),
	KEY `TFoMTFoGCode` (`TFmMTFoGCode`),
	KEY `VS4TFormulaGroupVS4TFormulaMap` (`TFmMTFoGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFormulaPro` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFormulaPro`;

# ---------- CREATE TABLE `VS4TFormulaPro` ----------

CREATE TABLE `VS4TFormulaPro` (
	`TFcPTForCode` VARCHAR(30) NOT NULL,
	`TFcPCode` VARCHAR(30) NOT NULL,
	`TFcPDescription` VARCHAR(30) NULL,
	`TFcPFlag1` SMALLINT NULL DEFAULT '0',
	`TFcPFlag2` SMALLINT NULL DEFAULT '0',
	`TFcPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFcPTForCode`, `TFcPCode`),
	KEY `TFcUCode` (`TFcPDescription`),
	KEY `TFcUTForCode` (`TFcPTForCode`),
	KEY `VS4TFormulaVS4TFormulaPro` (`TFcPTForCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFormulaScript` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFormulaScript`;

# ---------- CREATE TABLE `VS4TFormulaScript` ----------

CREATE TABLE `VS4TFormulaScript` (
	`TFuSTFcPTForCode` VARCHAR(30) NOT NULL,
	`TFuSTFcPCode` VARCHAR(30) NOT NULL,
	`TFuSLn` INT NOT NULL DEFAULT '0',
	`TFuSStart` VARCHAR(30) NULL,
	`TFuSFunction` VARCHAR(50) NULL,
	`TFuSInput1` VARCHAR(30) NULL,
	`TFuSInput2` VARCHAR(30) NULL,
	`TFuSCondition` SMALLINT NULL DEFAULT '0',
	`TFuSCommand` SMALLINT NULL DEFAULT '0',
	`TFuSResult` VARCHAR(30) NULL,
	`TFuSDecimal` SMALLINT NULL DEFAULT '0',
	`TFuSFlag1` SMALLINT NULL DEFAULT '0',
	`TFuSFlag2` SMALLINT NULL DEFAULT '0',
	`TFuSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFuSTFcPTForCode`, `TFuSTFcPCode`, `TFuSLn`),
	KEY `TFcSTFcPCode` (`TFuSTFcPCode`),
	KEY `TFcUCode` (`TFuSStart`),
	KEY `TFcUTForCode` (`TFuSTFcPTForCode`),
	KEY `VS4TFormulaProVS4TFormulaScript` (`TFuSTFcPTForCode`, `TFuSTFcPCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFormulaSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFormulaSub`;

# ---------- CREATE TABLE `VS4TFormulaSub` ----------

CREATE TABLE `VS4TFormulaSub` (
	`TFmSID` INT NOT NULL DEFAULT '0',
	`TFmSName` VARCHAR(100) NULL,
	`TFmSTForCode` VARCHAR(30) NULL,
	`TFmSType` SMALLINT NULL DEFAULT '2',
	`TFmSFormat` VARCHAR(50) NULL,
	`TFmSValue` DOUBLE NULL DEFAULT '0',
	`TFmSText` VARCHAR(255) NULL,
	`TFmSA1` DOUBLE NULL DEFAULT '0',
	`TFmSA2` DOUBLE NULL DEFAULT '0',
	`TFmSA3` DOUBLE NULL DEFAULT '0',
	`TFmSA4` DOUBLE NULL DEFAULT '0',
	`TFmSA5` DOUBLE NULL DEFAULT '0',
	`TFmSFlag1` SMALLINT NULL DEFAULT '0',
	`TFmSFlag2` SMALLINT NULL DEFAULT '0',
	`TFmSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFmSID`),
	KEY `TForID` (`TFmSID`),
	KEY `VS4TFormulaVS4TFormulaSub` (`TFmSTForCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFormulaSubCell` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFormulaSubCell`;

# ---------- CREATE TABLE `VS4TFormulaSubCell` ----------

CREATE TABLE `VS4TFormulaSubCell` (
	`TFSCID` INT NOT NULL DEFAULT '0',
	`TFSCTFmSID` INT NULL DEFAULT '0',
	`TFSCName` VARCHAR(15) NULL,
	`TFSCCompare` VARCHAR(50) NULL,
	`TFSCIFType` SMALLINT NULL DEFAULT '1',
	`TFSCIFFormat` VARCHAR(50) NULL,
	`TFSCIFValue` DOUBLE NULL DEFAULT '0',
	`TFSCIFText` VARCHAR(255) NULL,
	`TFSCTRUEType` SMALLINT NULL DEFAULT '1',
	`TFSCTRUEFormat` VARCHAR(50) NULL,
	`TFSCTRUEValue` DOUBLE NULL DEFAULT '0',
	`TFSCTRUEText` VARCHAR(255) NULL,
	`TFSCFALSEType` SMALLINT NULL DEFAULT '1',
	`TFSCFALSEFormat` VARCHAR(50) NULL,
	`TFSCFALSEValue` DOUBLE NULL DEFAULT '0',
	`TFSCFALSEText` VARCHAR(255) NULL,
	`TFSCFlag1` SMALLINT NULL DEFAULT '0',
	`TFSCFlag2` SMALLINT NULL DEFAULT '0',
	`TFSCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFSCID`),
	KEY `TForID` (`TFSCID`),
	KEY `VS4TFormulaSubVS4TFormulaSubCell` (`TFSCTFmSID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFormulaSystem` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFormulaSystem`;

# ---------- CREATE TABLE `VS4TFormulaSystem` ----------

CREATE TABLE `VS4TFormulaSystem` (
	`TFcSTForCode` VARCHAR(30) NOT NULL,
	`TFcSCode` VARCHAR(30) NOT NULL,
	`TFcSDataType` SMALLINT NULL DEFAULT '0',
	`TFcSInput1` VARCHAR(30) NULL,
	`TFcSInput2` VARCHAR(30) NULL,
	`TFcSCommand` SMALLINT NULL DEFAULT '0',
	`TFcSDecimal` SMALLINT NULL DEFAULT '0',
	`TFcSFlag1` SMALLINT NULL DEFAULT '0',
	`TFcSFlag2` SMALLINT NULL DEFAULT '0',
	`TFcSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFcSTForCode`, `TFcSCode`),
	KEY `TFcUCode` (`TFcSCode`),
	KEY `TFcUTForCode` (`TFcSTForCode`),
	KEY `VS4TFormulaVS4TFormulaSystem` (`TFcSTForCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFormulaUser` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFormulaUser`;

# ---------- CREATE TABLE `VS4TFormulaUser` ----------

CREATE TABLE `VS4TFormulaUser` (
	`TFuUTForCode` VARCHAR(30) NOT NULL,
	`TFuUCode` VARCHAR(30) NOT NULL,
	`TFuUDataType` SMALLINT NULL DEFAULT '0',
	`TFuUInput1` VARCHAR(30) NULL,
	`TFuUInput2` VARCHAR(30) NULL,
	`TFuUCommand` SMALLINT NULL DEFAULT '0',
	`TFuUDecimal` SMALLINT NULL DEFAULT '0',
	`TFuUFlag1` SMALLINT NULL DEFAULT '0',
	`TFuUFlag2` SMALLINT NULL DEFAULT '0',
	`TFuUFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFuUTForCode`, `TFuUCode`),
	KEY `TFcUCode` (`TFuUCode`),
	KEY `TFcUTForCode` (`TFuUTForCode`),
	KEY `VS4TFormulaVS4TFormulaUser` (`TFuUTForCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFreeCode` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFreeCode`;

# ---------- CREATE TABLE `VS4TFreeCode` ----------

CREATE TABLE `VS4TFreeCode` (
	`TFreCode` VARCHAR(30) NOT NULL,
	`TFreName` VARCHAR(200) NULL,
	`TFreName2` VARCHAR(200) NULL,
	`TFreTACCCode` VARCHAR(30) NULL,
	`TFreFlag1` SMALLINT NULL DEFAULT '0',
	`TFreFlag2` SMALLINT NULL DEFAULT '0',
	`TFreFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFreCode`),
	KEY `TBsTCode` (`TFreCode`),
	KEY `TFreCode` (`TFreName`),
	KEY `TFreName` (`TFreName2`),
	KEY `TOInTACCCode` (`TFreTACCCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFuel` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFuel`;

# ---------- CREATE TABLE `VS4TFuel` ----------

CREATE TABLE `VS4TFuel` (
	`TFueDate` DATETIME NOT NULL,
	`TFueWater` DOUBLE NULL,
	`TFuePower` DOUBLE NULL DEFAULT '0',
	`TFueUGR_91` DOUBLE NULL DEFAULT '0',
	`TFueULG_95` DOUBLE NULL DEFAULT '0',
	`TFueE10_91` DOUBLE NULL DEFAULT '0',
	`TFueE10_95` DOUBLE NULL DEFAULT '0',
	`TFueE20_95` DOUBLE NULL DEFAULT '0',
	`TFueE85_95` DOUBLE NULL DEFAULT '0',
	`TFueHSD` DOUBLE NULL DEFAULT '0',
	`TFueHSD_B5` DOUBLE NULL DEFAULT '0',
	`TFueNGV` DOUBLE NULL DEFAULT '0',
	`TFueLPG` DOUBLE NULL DEFAULT '0',
	`TFueFlag1` SMALLINT NULL DEFAULT '0',
	`TFueFlag2` SMALLINT NULL DEFAULT '0',
	`TFueFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFueDate`),
	KEY `TFuelCode` (`TFueE85_95`),
	KEY `TFuelDieSel` (`TFueUGR_91`),
	KEY `TFuelDieSel1` (`TFueULG_95`),
	KEY `TFuelDieSel2` (`TFueE10_91`),
	KEY `TFuelDieSel3` (`TFueE20_95`),
	KEY `TFuelDieSel4` (`TFueNGV`),
	KEY `TFuelNPG` (`TFueHSD`),
	KEY `TFueNPG` (`TFueLPG`),
	KEY `TFueSohol95` (`TFueE10_95`),
	KEY `TFueUGR91` (`TFueWater`),
	KEY `TFueUGR911` (`TFuePower`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFund` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFund`;

# ---------- CREATE TABLE `VS4TFund` ----------

CREATE TABLE `VS4TFund` (
	`TFunAlias` VARCHAR(30) NOT NULL,
	`TFunName` VARCHAR(50) NULL,
	`TFunName2` VARCHAR(50) NULL,
	`TFunFlag1` SMALLINT NULL DEFAULT '0',
	`TFunFlag2` SMALLINT NULL DEFAULT '0',
	`TFunFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFunAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TFundRate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TFundRate`;

# ---------- CREATE TABLE `VS4TFundRate` ----------

CREATE TABLE `VS4TFundRate` (
	`TFuRTFunAlias` VARCHAR(30) NOT NULL,
	`TFuRFromBase` FLOAT NOT NULL DEFAULT '0',
	`TFuRRate` DOUBLE NULL DEFAULT '0',
	`TFuRShareRate1` DOUBLE NULL DEFAULT '0',
	`TFuRShareRate2` DOUBLE NULL DEFAULT '0',
	`TFuRFlag1` SMALLINT NULL DEFAULT '0',
	`TFuRFlag2` SMALLINT NULL DEFAULT '0',
	`TFuRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TFuRTFunAlias`, `TFuRFromBase`),
	KEY `VS4TFundVS4TFundRate` (`TFuRTFunAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TGLBook` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TGLBook`;

# ---------- CREATE TABLE `VS4TGLBook` ----------

CREATE TABLE `VS4TGLBook` (
	`TGLBCode` VARCHAR(30) NOT NULL,
	`TGLBName` VARCHAR(140) NULL,
	`TGLBName2` VARCHAR(140) NULL,
	`TGLBTitleName` VARCHAR(50) NULL,
	`TGLBDocCode` VARCHAR(30) NULL,
	`TGLBVATType` SMALLINT NULL DEFAULT '0',
	`TGLBFlag1` SMALLINT NULL DEFAULT '0',
	`TGLBFlag2` SMALLINT NULL DEFAULT '0',
	`TGLBFlag3` SMALLINT NULL DEFAULT '0',
	UNIQUE KEY `TGLBCode` (`TGLBCode`),
	KEY `Index_B0D14894_767D_4A78` (`TGLBCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TGLTrans` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TGLTrans`;

# ---------- CREATE TABLE `VS4TGLTrans` ----------

CREATE TABLE `VS4TGLTrans` (
	`TGLTNo` VARCHAR(30) NOT NULL,
	`TGLTMode` INT NULL,
	`TGLTPostStatus` SMALLINT NULL DEFAULT '0',
	`TGLTBalanceFlag` INT NULL DEFAULT '0',
	`TGLTDate` DATETIME NULL,
	`TGLTPayTo` VARCHAR(200) NULL,
	`TGLTTPrjCode` VARCHAR(30) NULL,
	`TGLTTBraCode` VARCHAR(30) NULL,
	`TGLTTGLBCode` VARCHAR(30) NULL,
	`TGLTTACPTACYID` INT NULL DEFAULT '0',
	`TGLTTACPID` INT NULL DEFAULT '0',
	`TGLTIsAdjust` SMALLINT NULL DEFAULT '0',
	`TGLTRefNo` VARCHAR(30) NULL,
	`TGLTRefDate` DATETIME NULL,
	`TGLTRefNo2` VARCHAR(30) NULL,
	`TGLTRefDate2` DATETIME NULL,
	`TGLTAmount` FLOAT NULL DEFAULT '0',
	`TGLTTCurCode` VARCHAR(5) NULL,
	`TGLTExchangeRate` DOUBLE NULL DEFAULT '0',
	`TGLTAmountInRate` FLOAT NULL DEFAULT '0',
	`TGLTInputSource` VARCHAR(30) NULL,
	`TGLTDescription` VARCHAR(255) NULL,
	`TGLTCreateCode` VARCHAR(30) NULL,
	`TGLTCreateBy` VARCHAR(140) NULL,
	`TGLTCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TGLTEditCode` VARCHAR(30) NULL,
	`TGLTEditBy` VARCHAR(140) NULL,
	`TGLTEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TGLTConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TGLTConfirmBy` VARCHAR(140) NULL,
	`TGLTConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TGLTApproveStatus` SMALLINT NULL DEFAULT '0',
	`TGLTApproveBy` VARCHAR(140) NULL,
	`TGLTApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TGLTApproveNote` VARCHAR(80) NULL,
	`TGLTRevision` SMALLINT NULL DEFAULT '0',
	`TGLTCancelStatus` SMALLINT NULL DEFAULT '0',
	`TGLTCancelNo` VARCHAR(30) NULL,
	`TGLTCancelBy` VARCHAR(140) NULL,
	`TGLTCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TGLTCancelNote` VARCHAR(80) NULL,
	`TGLTPostBy` VARCHAR(140) NULL,
	`TGLTPostDate` DATETIME NULL,
	`TGLTFlag1` SMALLINT NULL DEFAULT '0',
	`TGLTFlag2` SMALLINT NULL DEFAULT '0',
	`TGLTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TGLTNo`),
	KEY `TBatchNo` (`TGLTNo`),
	KEY `TGLBCode` (`TGLTTGLBCode`),
	KEY `TGLTRefNo` (`TGLTRefNo`),
	KEY `TGLTRefNo1` (`TGLTRefNo2`),
	KEY `TGLTRefNo2` (`TGLTTBraCode`),
	KEY `TGLTTCurCode` (`TGLTTCurCode`),
	KEY `TGLTTGLBCode` (`TGLTTPrjCode`),
	KEY `VS4TBranchVS4TGLTrans` (`TGLTTBraCode`),
	KEY `VS4TGLBookVS4TGLTrans` (`TGLTTGLBCode`),
	KEY `VS4TGLBookVS4TGLTrans1` (`TGLTTGLBCode`),
	KEY `VS4TProjectVS4TGLTrans` (`TGLTTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TGLTransMove` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TGLTransMove`;

# ---------- CREATE TABLE `VS4TGLTransMove` ----------

CREATE TABLE `VS4TGLTransMove` (
	`TGTMTACPTACYID` INT NOT NULL DEFAULT '0',
	`TGTMTACPID` INT NOT NULL DEFAULT '0',
	`TGTMTACCCode` VARCHAR(30) NOT NULL,
	`TGTMStatus` INT NOT NULL DEFAULT '0',
	`TGTMMode` INT NOT NULL DEFAULT '0',
	`TGTMTBraCode` VARCHAR(30) NOT NULL,
	`TGTMTDivCode` VARCHAR(30) NULL,
	`TGTMTPrjCode` VARCHAR(30) NULL,
	`TGTMQuarter` INT NULL DEFAULT '0',
	`TGTMDebitBegin` FLOAT NULL DEFAULT '0',
	`TGTMCreditBegin` FLOAT NULL DEFAULT '0',
	`TGTMDebitTR` FLOAT NULL DEFAULT '0',
	`TGTMCreditTR` FLOAT NULL DEFAULT '0',
	`TGTMDebitBeginTR` FLOAT NULL DEFAULT '0',
	`TGTMCreditBeginTR` FLOAT NULL DEFAULT '0',
	`TGTMDebitEnd` FLOAT NULL DEFAULT '0',
	`TGTMCreditEnd` FLOAT NULL DEFAULT '0',
	`TGTMDebitBudget` FLOAT NULL DEFAULT '0',
	`TGTMCreditBudget` FLOAT NULL DEFAULT '0',
	`TGTMDebitAdj` FLOAT NULL DEFAULT '0',
	`TGTMCreditAdj` FLOAT NULL DEFAULT '0',
	`TGTMDebitApp` FLOAT NULL DEFAULT '0',
	`TGTMCreditApp` FLOAT NULL DEFAULT '0',
	`TGTMDebitPost` FLOAT NULL DEFAULT '0',
	`TGTMCreditPost` FLOAT NULL DEFAULT '0',
	`TGTMFlag1` SMALLINT NULL DEFAULT '0',
	`TGTMFlag2` SMALLINT NULL DEFAULT '0',
	`TGTMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TGTMTACPTACYID`, `TGTMTACPID`, `TGTMTACCCode`, `TGTMStatus`, `TGTMMode`, `TGTMTBraCode`),
	KEY `TGTMQuarter` (`TGTMMode`),
	KEY `TGTMTACPID` (`TGTMTACPID`),
	KEY `TGTMTACPID1` (`TGTMQuarter`),
	KEY `TGTMTACPTACYID` (`TGTMTACPTACYID`),
	KEY `TGTMTBraCode` (`TGTMTBraCode`),
	KEY `TGTMTdivCode` (`TGTMTDivCode`),
	KEY `TGTMTDivCode1` (`TGTMTPrjCode`),
	KEY `TGTMTGTSTACCCode` (`TGTMTACCCode`),
	KEY `VS4TACChartVS4TGLTransMove` (`TGTMTACCCode`),
	KEY `VS4TAccountPeriodVS4TGLTransMove` (`TGTMTACPTACYID`, `TGTMTACPID`),
	KEY `VS4TAccountPeriodVS4TGLTransMove1` (`TGTMTACPTACYID`, `TGTMTACPID`),
	KEY `VS4TBranchVS4TGLTransMove` (`TGTMTBraCode`),
	KEY `VS4TBranchVS4TGLTransMove1` (`TGTMTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TGLTransSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TGLTransSub`;

# ---------- CREATE TABLE `VS4TGLTransSub` ----------

CREATE TABLE `VS4TGLTransSub` (
	`TGTSTGLTNo` VARCHAR(30) NOT NULL,
	`TGTSLn` INT NOT NULL DEFAULT '0',
	`TGTSTACPTACYID` INT NULL DEFAULT '0',
	`TGTSTACPID` INT NULL DEFAULT '0',
	`TGTSTACCCode` VARCHAR(30) NULL,
	`TGTSTBraCode` VARCHAR(30) NULL,
	`TGTSName` VARCHAR(100) NULL,
	`TGTSName2` VARCHAR(100) NULL,
	`TGTSDescription` VARCHAR(255) NULL,
	`TGTSDescription2` VARCHAR(255) NULL,
	`TGTSDebit` FLOAT NULL DEFAULT '0',
	`TGTSCredit` FLOAT NULL DEFAULT '0',
	`TGTSTPrjCode` VARCHAR(30) NULL,
	`TGTSTDivCode` VARCHAR(30) NULL,
	`TGTSTDepCode` VARCHAR(30) NULL,
	`TGTSTSecCode` VARCHAR(30) NULL,
	`TGTSTSAeCode` VARCHAR(30) NULL,
	`TGTSTARNCode` VARCHAR(30) NULL,
	`TGTSTAPNCode` VARCHAR(30) NULL,
	`TGTSTBnkCode` VARCHAR(30) NULL,
	`TGTSChequeNo` VARCHAR(30) NULL,
	`TGTSTAssCode` VARCHAR(30) NULL,
	`TGTSTEmpCode` VARCHAR(30) NULL,
	`TGTSBlock` SMALLINT NULL DEFAULT '0',
	`TGTSStatus` SMALLINT NULL DEFAULT '0',
	`TGTSBalanceFlag` SMALLINT NULL,
	`TGTSFlag1` SMALLINT NULL DEFAULT '0',
	`TGTSFlag2` SMALLINT NULL DEFAULT '0',
	`TGTSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TGTSTGLTNo`, `TGTSLn`),
	KEY `TACCTSAeCode` (`TGTSTSAeCode`),
	KEY `TGTSTAPNCode` (`TGTSChequeNo`),
	KEY `TGTSTGTBTGLTNo` (`TGTSTGLTNo`),
	KEY `TGTSTSAeCode` (`TGTSTAPNCode`),
	KEY `TTfmtPdtCode` (`TGTSTACCCode`),
	KEY `TTfmTUntCode` (`TGTSCredit`),
	KEY `VS4TACChartVS4TGLTransSub` (`TGTSTACCCode`),
	KEY `VS4TAccountPeriodVS4TGLTransSub` (`TGTSTACPTACYID`, `TGTSTACPID`),
	KEY `VS4TBranchVS4TGLTransSub` (`TGTSTBraCode`),
	KEY `VS4TGLTransVS4TGLTransSub` (`TGTSTGLTNo`),
	KEY `VS4TProjectVS4TGLTransSub` (`TGTSTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TGovPayment` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TGovPayment`;

# ---------- CREATE TABLE `VS4TGovPayment` ----------

CREATE TABLE `VS4TGovPayment` (
	`TGvPMonth` INT NOT NULL DEFAULT '0',
	`TGvPYear` INT NOT NULL DEFAULT '0',
	`TGvPType` INT NOT NULL DEFAULT '0',
	`TGvPTotalGuy` INT NULL DEFAULT '0',
	`TGvPSelfRate` DOUBLE NULL DEFAULT '0',
	`TGvPOfficeRate` DOUBLE NULL DEFAULT '0',
	`TGvPTotalSalary` DOUBLE NULL DEFAULT '0',
	`TGvPTotalBase` DOUBLE NULL DEFAULT '0',
	`TGvPTotalSelfPay` DOUBLE NULL DEFAULT '0',
	`TGvPTotalOfficePay` DOUBLE NULL DEFAULT '0',
	`TGvPTotalCustom1` DOUBLE NULL DEFAULT '0',
	`TGvPTotalCustom2` DOUBLE NULL DEFAULT '0',
	`TGvPStatus` SMALLINT NULL DEFAULT '0',
	`TGvPFlag1` SMALLINT NULL DEFAULT '0',
	`TGvPFlag2` SMALLINT NULL DEFAULT '0',
	`TGvPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TGvPMonth`, `TGvPYear`, `TGvPType`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TGovPaymentMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TGovPaymentMB`;

# ---------- CREATE TABLE `VS4TGovPaymentMB` ----------

CREATE TABLE `VS4TGovPaymentMB` (
	`TGvMTGvPMonth` INT NOT NULL DEFAULT '0',
	`TGvMTGvPYear` INT NOT NULL DEFAULT '0',
	`TGvMTGvPType` INT NOT NULL DEFAULT '0',
	`TGvMLn` INT NOT NULL DEFAULT '0',
	`TGvMTEmTCode` VARCHAR(30) NULL,
	`TGvMTEmpCode` VARCHAR(30) NULL,
	`TGvMEmployeeName` VARCHAR(160) NULL,
	`TGvMAccountNo` VARCHAR(30) NULL,
	`TGvMSalaryCalc` DOUBLE NULL DEFAULT '0',
	`TGvMBaseCalc` DOUBLE NULL DEFAULT '0',
	`TGvMSelfRate` DOUBLE NULL DEFAULT '0',
	`TGvMSelfPay` DOUBLE NULL DEFAULT '0',
	`TGvMOfficeRate` DOUBLE NULL DEFAULT '0',
	`TGvMOfficePay` DOUBLE NULL DEFAULT '0',
	`TGvMCustom1` VARCHAR(30) NULL,
	`TGvMCustom2` VARCHAR(30) NULL,
	`TGvMCustomValue1` DOUBLE NULL DEFAULT '0',
	`TGvMCustomValue2` DOUBLE NULL DEFAULT '0',
	`TGvMTTxTNo` VARCHAR(30) NULL,
	`TGvMFlag1` SMALLINT NULL DEFAULT '0',
	`TGvMFlag2` SMALLINT NULL DEFAULT '0',
	`TGvMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TGvMTGvPMonth`, `TGvMTGvPYear`, `TGvMTGvPType`, `TGvMLn`),
	KEY `TGvMTEmpCode` (`TGvMEmployeeName`),
	KEY `TGvPTEmpCode` (`TGvMTEmpCode`),
	KEY `VS4TGovPaymentVS4TGovPaymentMB` (`TGvMTGvPMonth`, `TGvMTGvPYear`, `TGvMTGvPType`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TGroup`;

# ---------- CREATE TABLE `VS4TGroup` ----------

CREATE TABLE `VS4TGroup` (
	`TGroID` INT NOT NULL DEFAULT '0',
	`TGroName` VARCHAR(35) NULL,
	`TGroDescription` VARCHAR(100) NULL,
	`TGroGroupware` VARCHAR(50) NULL,
	`TGroOwner` INT NULL,
	`TGroFlag1` SMALLINT NULL DEFAULT '0',
	`TGroFlag2` SMALLINT NULL DEFAULT '0',
	`TGroFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TGroID`),
	KEY `GroupID` (`TGroID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TGroupMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TGroupMB`;

# ---------- CREATE TABLE `VS4TGroupMB` ----------

CREATE TABLE `VS4TGroupMB` (
	`TGrMTUsrID` INT NOT NULL DEFAULT '0',
	`TGrMTGroID` INT NOT NULL DEFAULT '0',
	`TGrMFlag1` SMALLINT NULL DEFAULT '0',
	`TGrMFlag2` SMALLINT NULL DEFAULT '0',
	`TGrMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TGrMTUsrID`, `TGrMTGroID`),
	KEY `MemberGroupID` (`TGrMTGroID`),
	KEY `MemberUserID` (`TGrMTUsrID`),
	KEY `VS4TGroupVS4TGroupMB` (`TGrMTGroID`),
	KEY `VS4TUserVS4TGroupMB` (`TGrMTUsrID`),
	KEY `VS4TUserVS4TGroupMB1` (`TGrMTUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TGroupPermiss` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TGroupPermiss`;

# ---------- CREATE TABLE `VS4TGroupPermiss` ----------

CREATE TABLE `VS4TGroupPermiss` (
	`TGrPTCmdID` INT NOT NULL DEFAULT '0',
	`TGrPTGroID` INT NOT NULL DEFAULT '0',
	`TGrPDisplay` SMALLINT NULL DEFAULT '0',
	`TGrPDatabase` SMALLINT NULL DEFAULT '0',
	`TGrPExport` SMALLINT NULL DEFAULT '0',
	`TGrPPrint` SMALLINT NULL DEFAULT '0',
	`TGrPGrantPermiss` SMALLINT NULL DEFAULT '0',
	`TGrPPassword` VARCHAR(10) NULL,
	`TGrPFlag1` SMALLINT NULL DEFAULT '0',
	`TGrPFlag2` SMALLINT NULL DEFAULT '0',
	`TGrPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TGrPTCmdID`, `TGrPTGroID`),
	KEY `SubCommandCommandID` (`TGrPTCmdID`),
	KEY `TPerTUserTypeID` (`TGrPTGroID`),
	KEY `VS4TGroupVS4TGroupPermiss` (`TGrPTGroID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4THoliday` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4THoliday`;

# ---------- CREATE TABLE `VS4THoliday` ----------

CREATE TABLE `VS4THoliday` (
	`THysID` INT NOT NULL DEFAULT '0',
	`THysMonth` SMALLINT NULL DEFAULT '0',
	`THysDay` SMALLINT NULL DEFAULT '0',
	`THysName` VARCHAR(100) NULL,
	`THysFix` SMALLINT NULL DEFAULT '0',
	`THysFlag1` SMALLINT NULL DEFAULT '0',
	`THysFlag2` SMALLINT NULL DEFAULT '0',
	`THysFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`THysID`),
	KEY `THysCode` (`THysID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4THostProfile` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4THostProfile`;

# ---------- CREATE TABLE `VS4THostProfile` ----------

CREATE TABLE `VS4THostProfile` (
	`THPfCode` VARCHAR(30) NOT NULL,
	`THPfTHPGAlias` VARCHAR(30) NULL,
	`THPfTBraCode` VARCHAR(30) NULL,
	`THPfDocCode` VARCHAR(30) NULL,
	`THPfName` VARCHAR(50) NULL,
	`THPfLocation` VARCHAR(50) NULL,
	`THPfDescription` VARCHAR(100) NULL,
	`THPfFlag1` SMALLINT NULL DEFAULT '0',
	`THPfFlag2` SMALLINT NULL DEFAULT '0',
	`THPfFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`THPfCode`),
	KEY `THPfDocCode` (`THPfDocCode`),
	KEY `THPfTBraCode` (`THPfTBraCode`),
	KEY `THPfTHPGCode` (`THPfTHPGAlias`),
	KEY `VS4TBranchVS4THostProfile` (`THPfTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4THostProfileGrp` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4THostProfileGrp`;

# ---------- CREATE TABLE `VS4THostProfileGrp` ----------

CREATE TABLE `VS4THostProfileGrp` (
	`THPGALIAS` VARCHAR(30) NOT NULL,
	`THPGName` VARCHAR(50) NULL,
	`THPGFlag1` SMALLINT NULL DEFAULT '0',
	`THPGFlag2` SMALLINT NULL DEFAULT '0',
	`THPGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`THPGALIAS`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4THostProfileMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4THostProfileMB`;

# ---------- CREATE TABLE `VS4THostProfileMB` ----------

CREATE TABLE `VS4THostProfileMB` (
	`THPMID` INT NOT NULL DEFAULT '0',
	`THPMTHPfCode` VARCHAR(30) NULL,
	`THPMAlias` VARCHAR(30) NULL,
	`THPMName` VARCHAR(30) NULL,
	`THPMType` SMALLINT NULL DEFAULT '0',
	`THPMText` VARCHAR(100) NULL,
	`THPMValue` DOUBLE NULL DEFAULT '0',
	`THPMDecimal` INT NULL DEFAULT '0',
	`THPMLock` INT NULL DEFAULT '0',
	`THPMFlag1` SMALLINT NULL DEFAULT '0',
	`THPMFlag2` SMALLINT NULL DEFAULT '0',
	`THPMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`THPMID`),
	KEY `THPMID` (`THPMID`),
	KEY `VS4THostProfileVS4THostProfileMB` (`THPMTHPfCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TImportantDay` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TImportantDay`;

# ---------- CREATE TABLE `VS4TImportantDay` ----------

CREATE TABLE `VS4TImportantDay` (
	`TImDCode` VARCHAR(30) NOT NULL,
	`TImDName` VARCHAR(50) NULL,
	`TImDName2` VARCHAR(50) NULL,
	`TImDType` SMALLINT NULL DEFAULT '0',
	`TImDFlag1` SMALLINT NULL DEFAULT '0',
	`TImDFlag2` SMALLINT NULL DEFAULT '0',
	`TImDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TImDCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInCorp` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInCorp`;

# ---------- CREATE TABLE `VS4TInCorp` ----------

CREATE TABLE `VS4TInCorp` (
	`TIncCode` VARCHAR(30) NOT NULL,
	`TIncName` VARCHAR(50) NULL,
	`TIncName2` VARCHAR(50) NULL,
	`TIncFlag1` SMALLINT NULL DEFAULT '0',
	`TIncFlag2` SMALLINT NULL DEFAULT '0',
	`TIncFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIncCode`),
	KEY `TDepCode` (`TIncCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInCorpMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInCorpMB`;

# ---------- CREATE TABLE `VS4TInCorpMB` ----------

CREATE TABLE `VS4TInCorpMB` (
	`TICMTIncCode` VARCHAR(30) NOT NULL,
	`TICMTCmpCode` VARCHAR(30) NOT NULL,
	`TICMFlag1` SMALLINT NULL DEFAULT '0',
	`TICMFlag2` SMALLINT NULL DEFAULT '0',
	`TICMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TICMTCmpCode`, `TICMTIncCode`),
	KEY `ProductMemberCategoryID` (`TICMTIncCode`),
	KEY `ProductMemberProductID1` (`TICMTCmpCode`),
	KEY `VS4TCompanyVS4TInCorpMB` (`TICMTCmpCode`),
	KEY `VS4TInCorpVS4TInCorpMB` (`TICMTIncCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInquiry` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInquiry`;

# ---------- CREATE TABLE `VS4TInquiry` ----------

CREATE TABLE `VS4TInquiry` (
	`TIQRCode` VARCHAR(15) NOT NULL,
	`TIQRName` VARCHAR(100) NULL,
	`TIQRName2` VARCHAR(100) NULL,
	`TIQRTIQGCode` VARCHAR(15) NULL,
	`TIQRImage1` VARCHAR(50) NULL,
	`TIQRFlag1` SMALLINT NULL DEFAULT '0',
	`TIQRFlag2` SMALLINT NULL DEFAULT '0',
	`TIQRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIQRCode`),
	KEY `TIQGCode` (`TIQRCode`),
	KEY `VS4TInquiryGroupVS4TInquiry` (`TIQRTIQGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInquiryChoice` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInquiryChoice`;

# ---------- CREATE TABLE `VS4TInquiryChoice` ----------

CREATE TABLE `VS4TInquiryChoice` (
	`TIQCTIQRCode` VARCHAR(15) NOT NULL,
	`TIQCLn` INT NOT NULL DEFAULT '0',
	`TIQCName` VARCHAR(100) NULL,
	`TIQCName2` VARCHAR(100) NULL,
	`TIQCType` SMALLINT NULL DEFAULT '0',
	`TIQCImage1` VARCHAR(50) NULL,
	`TIQCFlag1` SMALLINT NULL DEFAULT '0',
	`TIQCFlag2` SMALLINT NULL DEFAULT '0',
	`TIQCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIQCTIQRCode`, `TIQCLn`),
	KEY `TIQGCode` (`TIQCLn`),
	KEY `VS4TInquiryVS4TInquiryChoice` (`TIQCTIQRCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInquiryGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInquiryGroup`;

# ---------- CREATE TABLE `VS4TInquiryGroup` ----------

CREATE TABLE `VS4TInquiryGroup` (
	`TIQGCode` VARCHAR(15) NOT NULL,
	`TIQGName` VARCHAR(100) NULL,
	`TIQGName2` VARCHAR(100) NULL,
	`TIQGFlag1` SMALLINT NULL DEFAULT '0',
	`TIQGFlag2` SMALLINT NULL DEFAULT '0',
	`TIQGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIQGCode`),
	KEY `TIQGCode` (`TIQGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInsurance` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInsurance`;

# ---------- CREATE TABLE `VS4TInsurance` ----------

CREATE TABLE `VS4TInsurance` (
	`TIslNo` VARCHAR(50) NOT NULL,
	`TIslRefNo` VARCHAR(30) NULL,
	`TIslRefNo2` VARCHAR(30) NULL,
	`TIslDate` DATETIME NULL,
	`TIslTIsTCode` VARCHAR(30) NULL,
	`TIslInsuraceNo` VARCHAR(30) NULL,
	`TIslSaftyNo` VARCHAR(30) NULL,
	`TIslSaftyBy` VARCHAR(100) NULL,
	`TIslRequestBy` VARCHAR(160) NULL,
	`TIslOwner` VARCHAR(160) NULL,
	`TIslGainBy` VARCHAR(160) NULL,
	`TIslAssetCode` VARCHAR(30) NULL,
	`TIslAssetName` VARCHAR(100) NULL,
	`TIslSerialNo` VARCHAR(100) NULL,
	`TIslDescription` VARCHAR(255) NULL,
	`TIslPremium` FLOAT NULL DEFAULT '0',
	`TIslPremiumCurCode` VARCHAR(5) NULL,
	`TIslPMTotalPeriod` SMALLINT NULL DEFAULT '0',
	`TIslPMPeriodUnit` VARCHAR(30) NULL,
	`TIslInsureAge` INT NULL DEFAULT '0',
	`TIslInsureAgeUnit` VARCHAR(15) NULL,
	`TIslStartDate` DATETIME NULL,
	`TIslExpireDate` DATETIME NULL,
	`TIslNoExpire` SMALLINT NULL DEFAULT '0',
	`TIslCreateCode` VARCHAR(30) NULL,
	`TIslCreateBy` VARCHAR(140) NULL,
	`TIslCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIslEditCode` VARCHAR(30) NULL,
	`TIslEditBy` VARCHAR(140) NULL,
	`TIslEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIslConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TIslConfirmBy` VARCHAR(140) NULL,
	`TIslConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIslConfirmNote` VARCHAR(80) NULL,
	`TIslApproveStatus` SMALLINT NULL DEFAULT '0',
	`TIslApproveBy` VARCHAR(140) NULL,
	`TIslApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIslApproveNote` VARCHAR(80) NULL,
	`TIslConfidential` SMALLINT NULL DEFAULT '0',
	`TIslCancelStatus` SMALLINT NULL DEFAULT '0',
	`TIslCancelNo` VARCHAR(30) NULL,
	`TIslCancelBy` VARCHAR(140) NULL,
	`TIslCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIslCancelNote` VARCHAR(80) NULL,
	`TIslFlag1` SMALLINT NULL DEFAULT '0',
	`TIslFlag2` SMALLINT NULL DEFAULT '0',
	`TIslFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIslNo`),
	KEY `TIslTAssID` (`TIslAssetCode`),
	KEY `TIslTIsTID` (`TIslTIsTCode`),
	KEY `TTfrRequestBy` (`TIslGainBy`),
	KEY `TTfrTransferBy` (`TIslRequestBy`),
	KEY `VS4TInsuranceTypeVS4TInsurance` (`TIslTIsTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInsuranceType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInsuranceType`;

# ---------- CREATE TABLE `VS4TInsuranceType` ----------

CREATE TABLE `VS4TInsuranceType` (
	`TIsTCode` VARCHAR(30) NOT NULL,
	`TIsTName` VARCHAR(100) NULL,
	`TIsTName2` VARCHAR(100) NULL,
	`TIsTFlag1` SMALLINT NULL DEFAULT '0',
	`TIsTFlag2` SMALLINT NULL DEFAULT '0',
	`TIsTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIsTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInterCode` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInterCode`;

# ---------- CREATE TABLE `VS4TInterCode` ----------

CREATE TABLE `VS4TInterCode` (
	`TItCCode` VARCHAR(50) NOT NULL,
	`TItCTPdtCode` VARCHAR(30) NULL,
	`TItCFlag1` SMALLINT NULL DEFAULT '0',
	`TItCFlag2` SMALLINT NULL DEFAULT '0',
	`TItCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TItCCode`),
	KEY `TInCCode` (`TItCCode`),
	KEY `TInCTPdtCode` (`TItCTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventAdjust` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventAdjust`;

# ---------- CREATE TABLE `VS4TInventAdjust` ----------

CREATE TABLE `VS4TInventAdjust` (
	`TIjtNo` VARCHAR(30) NOT NULL,
	`TIjtTIBkCode` VARCHAR(30) NULL,
	`TIjtLotNo` VARCHAR(30) NULL,
	`TIjtDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtTTfTAlias` VARCHAR(30) NULL,
	`TIjtRefNo` VARCHAR(30) NULL,
	`TIjtRefDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtRefNo2` VARCHAR(30) NULL,
	`TIjtRefDate2` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtRefNo3` VARCHAR(30) NULL,
	`TIjtRefDate3` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtRefNo4` VARCHAR(30) NULL,
	`TIjtRefDate4` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtTJobNo` VARCHAR(30) NULL,
	`TIjtTJbMLn` INT NULL DEFAULT '0',
	`TIjtTJPdNo` VARCHAR(30) NULL,
	`TIjtTJPMLn` INT NULL DEFAULT '0',
	`TIjtTPrjCode` VARCHAR(30) NULL,
	`TIjtTSecCode` VARCHAR(30) NULL,
	`TIjtTDepCode` VARCHAR(30) NULL,
	`TIjtTDivCode` VARCHAR(30) NULL,
	`TIjtTBraCode` VARCHAR(30) NULL,
	`TIjtFromTBraCode` VARCHAR(30) NULL,
	`TIjtTotalRecord` INT NULL DEFAULT '0',
	`TIjtTotalQuantity` DOUBLE NULL DEFAULT '0',
	`TIjtTotalQuantity2` DOUBLE NULL DEFAULT '0',
	`TIjtTotalQuantity3` DOUBLE NULL DEFAULT '0',
	`TIjtTotal` FLOAT NULL DEFAULT '0',
	`TIjtRequestCode` VARCHAR(30) NULL,
	`TIjtRequestBy` VARCHAR(160) NULL,
	`TIjtDescription` VARCHAR(200) NULL,
	`TIjtGLMethod` SMALLINT NULL DEFAULT '0',
	`TIjtTGLTNo` VARCHAR(30) NULL,
	`TIjtCreateCode` VARCHAR(30) NULL,
	`TIjtCreateBy` VARCHAR(140) NULL,
	`TIjtCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtEditCode` VARCHAR(30) NULL,
	`TIjtEditBy` VARCHAR(140) NULL,
	`TIjtEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TIjtConfirmBy` VARCHAR(140) NULL,
	`TIjtConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtApproveStatus` SMALLINT NULL DEFAULT '0',
	`TIjtApproveBy` VARCHAR(140) NULL,
	`TIjtApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtApproveNote` VARCHAR(80) NULL,
	`TIjtRevision` SMALLINT NULL DEFAULT '0',
	`TIjtCancelStatus` SMALLINT NULL DEFAULT '0',
	`TIjtCancelNo` VARCHAR(30) NULL,
	`TIjtCancelBy` VARCHAR(140) NULL,
	`TIjtCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TIjtCancelNote` VARCHAR(80) NULL,
	`TIjtFlag1` SMALLINT NULL DEFAULT '0',
	`TIjtFlag2` SMALLINT NULL DEFAULT '0',
	`TIjtFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIjtNo`),
	KEY `TInvFromTBraCode` (`TIjtFromTBraCode`),
	KEY `TInvTAolCode` (`TIjtTJbMLn`),
	KEY `TInvTBraCode` (`TIjtTBraCode`),
	KEY `TInvTDepCode` (`TIjtTDepCode`),
	KEY `TInvTDivCode` (`TIjtTDivCode`),
	KEY `TInvTInTAlias` (`TIjtTTfTAlias`),
	KEY `TInvTJobCode` (`TIjtTJobNo`),
	KEY `TInvTPrjCode` (`TIjtTPrjCode`),
	KEY `TPRDTBokCode` (`TIjtTIBkCode`),
	KEY `TTfrFromTStoCode` (`TIjtRequestBy`),
	KEY `VS4TInventBookVS4TInventAdjust` (`TIjtTIBkCode`),
	KEY `VS4TProjectVS4TInventAdjust` (`TIjtTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventAdjustMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventAdjustMB`;

# ---------- CREATE TABLE `VS4TInventAdjustMB` ----------

CREATE TABLE `VS4TInventAdjustMB` (
	`TIjMTIjtNo` VARCHAR(30) NOT NULL,
	`TIjMLn` INT NOT NULL DEFAULT '0',
	`TIjMTPdtCode` VARCHAR(30) NULL,
	`TIjMPremiumNote` VARCHAR(100) NULL,
	`TIjMCustom1` VARCHAR(30) NULL,
	`TIjMCustom2` VARCHAR(30) NULL,
	`TIjMCustom3` VARCHAR(30) NULL,
	`TIjMJobCode` VARCHAR(30) NULL,
	`TIjMLotNo` VARCHAR(30) NULL,
	`TIjMLotDate` DATETIME NULL,
	`TIjMLotNo2` VARCHAR(30) NULL,
	`TIjMScrapLevel` VARCHAR(30) NULL,
	`TIjMReserve` SMALLINT NULL DEFAULT '0',
	`TIjMShape` VARCHAR(30) NULL,
	`TIjMSize` VARCHAR(30) NULL,
	`TIjMSerialNo` VARCHAR(30) NULL,
	`TIjMGrade` VARCHAR(10) NULL,
	`TIjMNoExpire` SMALLINT NULL DEFAULT '0',
	`TIjMExpireDate` DATETIME NULL,
	`TIjMTCgTID` INT NULL DEFAULT '0',
	`TIjMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TIjMIsPremium` SMALLINT NULL DEFAULT '0',
	`TIjMUnitRatio` DOUBLE NULL DEFAULT '0',
	`TIjMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TIjMPerQuantity` DOUBLE NULL DEFAULT '0',
	`TIjMInputCostBal` FLOAT NULL DEFAULT '0',
	`TIjMInputCost` FLOAT NULL DEFAULT '0',
	`TIjMInputCostAdj` FLOAT NULL DEFAULT '0',
	`TIjMLastUnitCost` FLOAT NULL,
	`TIjMQuantityBal` DOUBLE NULL DEFAULT '0',
	`TIjMQuantity` DOUBLE NULL DEFAULT '0',
	`TIjMQuantityAdj` DOUBLE NULL DEFAULT '0',
	`TIjMTUntCode` VARCHAR(30) NULL,
	`TIjMQuantityBal2` DOUBLE NULL DEFAULT '0',
	`TIjMQuantity2` DOUBLE NULL DEFAULT '0',
	`TIjMQuantityAdj2` DOUBLE NULL DEFAULT '0',
	`TIjMQuantityBal3` DOUBLE NULL DEFAULT '0',
	`TIjMQuantity3` DOUBLE NULL DEFAULT '0',
	`TIjMQuantityAdj3` DOUBLE NULL DEFAULT '0',
	`TIjMUnitCost` FLOAT NULL,
	`TIjMUnitCostAdj` FLOAT NULL,
	`TIjMUnitCostBal` FLOAT NULL,
	`TIjMAmount` FLOAT NULL,
	`TIjMAmountAdj` FLOAT NULL,
	`TIjMAmountBal` FLOAT NULL,
	`TIjMTLctCode` VARCHAR(30) NULL,
	`TIjMDescription` VARCHAR(255) NULL,
	`TIjMQuantityText` VARCHAR(255) NULL,
	`TIjMQuantityCutTxt` VARCHAR(255) NULL,
	`TIjMQuantityCut` DOUBLE NULL DEFAULT '0',
	`TIjMQuantityFirst` DOUBLE NULL DEFAULT '0',
	`TIjMArrear` DOUBLE NULL DEFAULT '0',
	`TIjMShow` SMALLINT NULL DEFAULT '0',
	`TIjMStockNo` INT NULL DEFAULT '0',
	`TIjMFlag1` SMALLINT NULL DEFAULT '0',
	`TIjMFlag2` SMALLINT NULL DEFAULT '0',
	`TIjMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIjMTIjtNo`, `TIjMLn`),
	KEY `TInMGrade` (`TIjMGrade`),
	KEY `TInMLotNo` (`TIjMLotNo`),
	KEY `TInMLotNo2` (`TIjMLotNo2`),
	KEY `TTfMJobCode` (`TIjMJobCode`),
	KEY `TTfmtPdtCode` (`TIjMPremiumNote`),
	KEY `TTfmTPdtCode2` (`TIjMTPdtCode`),
	KEY `TTfmTUntCode` (`TIjMTUntCode`),
	KEY `TTfrToTLctCode` (`TIjMTLctCode`),
	KEY `VS4TInventAdjustVS4TInventAdjustMB` (`TIjMTIjtNo`),
	KEY `VS4TLocationVS4TInventAdjustMB` (`TIjMTLctCode`),
	KEY `VS4TProductVS4TInventAdjustMB` (`TIjMTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventAPCN` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventAPCN`;

# ---------- CREATE TABLE `VS4TInventAPCN` ----------

CREATE TABLE `VS4TInventAPCN` (
	`TIPCTInMTInvNo` VARCHAR(30) NOT NULL,
	`TIPCTInMLn` INT NOT NULL DEFAULT '0',
	`TIPCTPCMTPCNNo` VARCHAR(30) NOT NULL,
	`TIPCTPCMLn` INT NOT NULL DEFAULT '0',
	`TIPCFlag1` SMALLINT NULL DEFAULT '0',
	`TIPCFlag2` SMALLINT NULL DEFAULT '0',
	`TIPCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIPCTInMTInvNo`, `TIPCTInMLn`, `TIPCTPCMTPCNNo`, `TIPCTPCMLn`),
	KEY `VS4TInventoryMBVS4TInventAPCN` (`TIPCTInMTInvNo`, `TIPCTInMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventAPIV` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventAPIV`;

# ---------- CREATE TABLE `VS4TInventAPIV` ----------

CREATE TABLE `VS4TInventAPIV` (
	`TIPVTIoMTInvNo` VARCHAR(30) NOT NULL,
	`TIPVTIoMLn` INT NOT NULL DEFAULT '0',
	`TIPVTIPMTIAPNo` VARCHAR(30) NOT NULL,
	`TIPVTIPMLn` INT NOT NULL DEFAULT '0',
	`TIPVFlag1` SMALLINT NULL DEFAULT '0',
	`TIPVFlag2` SMALLINT NULL DEFAULT '0',
	`TIPVFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIPVTIoMTInvNo`, `TIPVTIoMLn`, `TIPVTIPMTIAPNo`, `TIPVTIPMLn`),
	KEY `VS4TInventoryMBVS4TInventAPIV` (`TIPVTIoMTInvNo`, `TIPVTIoMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventARCN` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventARCN`;

# ---------- CREATE TABLE `VS4TInventARCN` ----------

CREATE TABLE `VS4TInventARCN` (
	`TIRCTInMTInvNo` VARCHAR(30) NOT NULL,
	`TIRCTInMLn` INT NOT NULL DEFAULT '0',
	`TIRCTRCMTRCNNo` VARCHAR(30) NOT NULL,
	`TIRCTRCMLn` INT NOT NULL DEFAULT '0',
	`TIRCFlag1` SMALLINT NULL DEFAULT '0',
	`TIRCFlag2` SMALLINT NULL DEFAULT '0',
	`TIRCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIRCTInMTInvNo`, `TIRCTInMLn`, `TIRCTRCMTRCNNo`, `TIRCTRCMLn`),
	KEY `VS4TInventoryMBVS4TInventARCN` (`TIRCTInMTInvNo`, `TIRCTInMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventARIV` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventARIV`;

# ---------- CREATE TABLE `VS4TInventARIV` ----------

CREATE TABLE `VS4TInventARIV` (
	`TIRVTInMTInvNo` VARCHAR(30) NOT NULL,
	`TIRVTInMLn` INT NOT NULL DEFAULT '0',
	`TIRVTIoMTTvoNo` VARCHAR(30) NOT NULL,
	`TIRVTIoMLn` INT NOT NULL DEFAULT '0',
	`TIRVFlag1` SMALLINT NULL DEFAULT '0',
	`TIRVFlag2` SMALLINT NULL DEFAULT '0',
	`TIRVFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIRVTInMTInvNo`, `TIRVTInMLn`, `TIRVTIoMTTvoNo`, `TIRVTIoMLn`),
	KEY `VS4TInventoryMBVS4TInventARIV` (`TIRVTInMTInvNo`, `TIRVTInMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventBook` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventBook`;

# ---------- CREATE TABLE `VS4TInventBook` ----------

CREATE TABLE `VS4TInventBook` (
	`TIBkCode` VARCHAR(30) NOT NULL,
	`TIBkName` VARCHAR(200) NULL,
	`TIBkName2` VARCHAR(200) NULL,
	`TIBkDocCode` VARCHAR(30) NULL,
	`TIBkFlag1` SMALLINT NULL DEFAULT '0',
	`TIBkFlag2` SMALLINT NULL DEFAULT '0',
	`TIBkFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIBkCode`),
	KEY `TCmTCode` (`TIBkCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventMDS` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventMDS`;

# ---------- CREATE TABLE `VS4TInventMDS` ----------

CREATE TABLE `VS4TInventMDS` (
	`TIDSTInMTInvNo` VARCHAR(30) NOT NULL,
	`TIDSTInMLn` INT NOT NULL DEFAULT '0',
	`TIDSTMDSTSOBTSODNo` VARCHAR(30) NOT NULL,
	`TIDSTMDSTSOBLn` INT NOT NULL DEFAULT '0',
	`TIDSTMDSLn` INT NOT NULL DEFAULT '0',
	`TIDSFlag1` SMALLINT NULL DEFAULT '0',
	`TIDSFlag2` SMALLINT NULL DEFAULT '0',
	`TIDSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIDSTInMTInvNo`, `TIDSTInMLn`, `TIDSTMDSTSOBTSODNo`, `TIDSTMDSTSOBLn`, `TIDSTMDSLn`),
	KEY `VS4TInventoryMBVS4TInventMDS` (`TIDSTInMTInvNo`, `TIDSTInMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventory` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventory`;

# ---------- CREATE TABLE `VS4TInventory` ----------

CREATE TABLE `VS4TInventory` (
	`TInvNo` VARCHAR(30) NOT NULL,
	`TInvMode` INT NULL DEFAULT '0',
	`TInvTIBkCode` VARCHAR(30) NULL,
	`TInvDate` DATETIME NULL DEFAULT '3333-3-3',
	`TInvInvoiceStatus` SMALLINT NULL DEFAULT '0',
	`TInvTARNCode` VARCHAR(30) NULL,
	`TInvTInTAlias` VARCHAR(30) NULL,
	`TInvRefNo` VARCHAR(30) NULL,
	`TInvRefDate` DATETIME NULL DEFAULT '3333-3-3',
	`TInvRefNo2` VARCHAR(30) NULL,
	`TInvRefDate2` DATETIME NULL DEFAULT '3333-3-3',
	`TInvRefNo3` VARCHAR(30) NULL,
	`TInvRefDate3` DATETIME NULL DEFAULT '3333-3-3',
	`TInvCustom1` VARCHAR(30) NULL,
	`TInvCustom2` VARCHAR(30) NULL,
	`TInvCustom3` VARCHAR(30) NULL,
	`TInvCustom4` VARCHAR(30) NULL,
	`TInvCustom5` VARCHAR(30) NULL,
	`TInvCustomNo` VARCHAR(30) NULL,
	`TInvCustomDate` DATETIME NULL,
	`TInvTPrjCode` VARCHAR(30) NULL,
	`TInvTJobNo` VARCHAR(30) NULL,
	`TInvTJbMLn` INT NULL DEFAULT '0',
	`TInvTMPSNo` VARCHAR(30) NULL,
	`TInvTJPdNo` VARCHAR(30) NULL,
	`TInvTJPMLn` INT NULL DEFAULT '0',
	`TInvTSecCode` VARCHAR(30) NULL,
	`TInvTDepCode` VARCHAR(30) NULL,
	`TInvTDivCode` VARCHAR(30) NULL,
	`TInvTBraCode` VARCHAR(30) NULL,
	`TInvFromTBraCode` VARCHAR(30) NULL,
	`TInvTotal` FLOAT NULL DEFAULT '0',
	`TInvTotalRecord` INT NULL DEFAULT '0',
	`TInvTotalQuantity` DOUBLE NULL DEFAULT '0',
	`TInvTotalScrap` FLOAT NULL DEFAULT '0',
	`TInvTotalQScrap` DOUBLE NULL DEFAULT '0',
	`TInvTotalPCScrap` DOUBLE NULL DEFAULT '0',
	`TInvTotalPCQScrap` DOUBLE NULL DEFAULT '0',
	`TInvTotalRecordIn` INT NULL DEFAULT '0',
	`TInvTotalQInput` DOUBLE NULL DEFAULT '0',
	`TInvTotalAInput` FLOAT NULL DEFAULT '0',
	`TInvRequestCode` VARCHAR(30) NULL,
	`TInvRequestBy` VARCHAR(160) NULL,
	`TInvDescription` VARCHAR(100) NULL,
	`TInvGLMethod` SMALLINT NULL DEFAULT '0',
	`TInvTGLTNo` VARCHAR(30) NULL,
	`TInvDeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TInvSpecialFlag` SMALLINT NULL,
	`TInvIsCompleted` SMALLINT NULL,
	`TInvCreateBy` VARCHAR(140) NULL,
	`TInvCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TInvEditCode` VARCHAR(30) NULL,
	`TInvEditBy` VARCHAR(140) NULL,
	`TInvEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TInvConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TInvConfirmBy` VARCHAR(140) NULL,
	`TInvConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TInvApproveStatus` SMALLINT NULL DEFAULT '0',
	`TInvApproveBy` VARCHAR(140) NULL,
	`TInvApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TInvApproveNote` VARCHAR(80) NULL,
	`TInvRevision` SMALLINT NULL DEFAULT '0',
	`TInvCancelStatus` SMALLINT NULL DEFAULT '0',
	`TInvCancelBy` VARCHAR(140) NULL,
	`TInvCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TInvCancelNote` VARCHAR(80) NULL,
	`TInvFlag1` SMALLINT NULL DEFAULT '0',
	`TInvFlag2` SMALLINT NULL DEFAULT '0',
	`TInvFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TInvNo`),
	KEY `TInvApproveStatus` (`TInvApproveStatus`),
	KEY `TInvCancelStatus` (`TInvCancelStatus`),
	KEY `TInvDate` (`TInvDate`),
	KEY `TInvFromTBraCode` (`TInvFromTBraCode`),
	KEY `TInvRefNo` (`TInvRefNo`),
	KEY `TInvRefNo2` (`TInvRefNo2`),
	KEY `TInvRefNo3` (`TInvRefNo3`),
	KEY `TInvTBraCode` (`TInvTBraCode`),
	KEY `TInvTIBkCode` (`TInvTIBkCode`),
	KEY `TInvTInTAlias` (`TInvTInTAlias`),
	KEY `TInvTJobNo` (`TInvTJobNo`),
	KEY `TInvTPrjCode` (`TInvTPrjCode`),
	KEY `VS4TInventBookVS4TInventory` (`TInvTIBkCode`),
	KEY `VS4TProjectVS4TInventory` (`TInvTPrjCode`),
	KEY `VS4TStkMoveTypeVS4TStkMove` (`TInvTInTAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventory2` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventory2`;

# ---------- CREATE TABLE `VS4TInventory2` ----------

CREATE TABLE `VS4TInventory2` (
	`TIn2TInvNo` VARCHAR(30) NOT NULL,
	`TIn2Ln` INT NOT NULL,
	`TIn2OHMode` SMALLINT NULL,
	`TIn2Headcount` DOUBLE NULL DEFAULT '1',
	`TIn2QuantityH` DOUBLE NULL DEFAULT '1',
	`TIn2TQuantityH` DOUBLE NULL DEFAULT '1',
	`TIn2HourRate` DOUBLE NULL DEFAULT '1',
	`TIn2HeadcountOT` DOUBLE NULL DEFAULT '1',
	`TIn2QuantityOT` DOUBLE NULL DEFAULT '1',
	`TIn2TQuantityOT` DOUBLE NULL DEFAULT '1',
	`TIn2HourOTRate` DOUBLE NULL DEFAULT '1',
	`TIn2TotalHour` DOUBLE NULL DEFAULT '1',
	`TIn2TotalAmount` DOUBLE NULL DEFAULT '1',
	`TIn2Flag1` SMALLINT NULL,
	`TIn2Flag2` SMALLINT NULL,
	`TIn2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIn2TInvNo`, `TIn2Ln`),
	KEY `TInMLn` (`TIn2Ln`),
	KEY `TInMTInvNo` (`TIn2TInvNo`),
	KEY `VS4TInventoryVS4TInventory2` (`TIn2TInvNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventoryCost` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventoryCost`;

# ---------- CREATE TABLE `VS4TInventoryCost` ----------

CREATE TABLE `VS4TInventoryCost` (
	`TIM2Ln` INT NOT NULL,
	`TIM2TPdtCode` VARCHAR(30) NOT NULL,
	`TIM2Custom1` VARCHAR(30) NOT NULL,
	`TIM2SerialNo` VARCHAR(30) NOT NULL,
	`TIM2LotNo` VARCHAR(30) NOT NULL,
	`TIM2LotDate` DATETIME NOT NULL,
	`TIM2CostFT` VARCHAR(50) NULL,
	`TIM2CostLast` FLOAT NULL,
	`TIM2CostRatio` FLOAT NULL,
	`TIM2CostDM` FLOAT NULL,
	`TIM2CostDL` FLOAT NULL,
	`TIM2CostMOH` FLOAT NULL,
	`TIM2CostUnit` FLOAT NULL,
	`TIM2CostNote` VARCHAR(30) NULL,
	`TIM2Flag1` SMALLINT NULL,
	`TIM2Flag2` SMALLINT NULL,
	`TIM2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIM2Ln`, `TIM2TPdtCode`, `TIM2Custom1`, `TIM2SerialNo`, `TIM2LotNo`, `TIM2LotDate`),
	KEY `TIM2Custom1` (`TIM2Custom1`),
	KEY `TIM2Ln` (`TIM2Ln`),
	KEY `TIM2LotDate` (`TIM2LotDate`),
	KEY `TIMCLotNo` (`TIM2LotNo`),
	KEY `TIMCSerialNo` (`TIM2SerialNo`),
	KEY `TInMTPdtCode` (`TIM2TPdtCode`),
	KEY `VS4TInventoryCostVS4TInventoryCost2` (`TIM2TPdtCode`, `TIM2Custom1`, `TIM2SerialNo`, `TIM2LotNo`, `TIM2LotDate`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventoryInit` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventoryInit`;

# ---------- CREATE TABLE `VS4TInventoryInit` ----------

CREATE TABLE `VS4TInventoryInit` (
	`TInIID` INT NOT NULL DEFAULT '0',
	`TInITInGAlias` VARCHAR(30) NULL,
	`TInITHPfCode` VARCHAR(30) NULL,
	`TInITEmpCode` VARCHAR(30) NULL,
	`TInITGCnCode` VARCHAR(30) NULL,
	`TInITTCnCode` VARCHAR(30) NULL,
	`TInITPSECode` VARCHAR(30) NULL,
	`TInITPG1Code` VARCHAR(30) NULL,
	`TInITPG2Code` VARCHAR(30) NULL,
	`TInITPG3Code` VARCHAR(30) NULL,
	`TInITPG4Code` VARCHAR(30) NULL,
	`TInITPdtCode` VARCHAR(30) NULL,
	`TInITPdLCode` VARCHAR(30) NULL,
	`TInITShfCode` VARCHAR(30) NULL,
	`TInITLctCode` VARCHAR(30) NULL,
	`TInITWahCode` VARCHAR(30) NULL,
	`TInISort` DOUBLE NULL DEFAULT '0',
	`TInIFlag1` SMALLINT NULL DEFAULT '0',
	`TInIFlag2` SMALLINT NULL DEFAULT '0',
	`TInIFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TInIID`),
	KEY `TInIID` (`TInIID`),
	KEY `TInIProductCode` (`TInITPSECode`),
	KEY `TInIRLctCode` (`TInITLctCode`),
	KEY `TInITEmpCode` (`TInITEmpCode`),
	KEY `TInITGCnCode` (`TInITGCnCode`),
	KEY `TIniTPdUTPdtCode` (`TInITPdtCode`),
	KEY `TInITPdUTUntCode` (`TInITPdLCode`),
	KEY `TInITShfCode` (`TInITShfCode`),
	KEY `TInITStoCode` (`TInITWahCode`),
	KEY `TInITTCnCode` (`TInITTCnCode`),
	KEY `VS4TInventoryInitGVS4TInventoryInit` (`TInITInGAlias`),
	KEY `VS4TLocationVS4TInventoryInit` (`TInITLctCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventoryInitG` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventoryInitG`;

# ---------- CREATE TABLE `VS4TInventoryInitG` ----------

CREATE TABLE `VS4TInventoryInitG` (
	`TInGAlias` VARCHAR(30) NOT NULL,
	`TInGName` VARCHAR(80) NULL,
	`TInGFlag1` SMALLINT NULL,
	`TInGFlag2` SMALLINT NULL,
	`TInGFlag3` SMALLINT NULL,
	PRIMARY KEY (`TInGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventoryLOT` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventoryLOT`;

# ---------- CREATE TABLE `VS4TInventoryLOT` ----------

CREATE TABLE `VS4TInventoryLOT` (
	`TIMCTPdtCode` VARCHAR(30) NOT NULL,
	`TIMCCustom1` VARCHAR(30) NOT NULL,
	`TIMCSerialNo` VARCHAR(30) NOT NULL,
	`TIMCLotNo` VARCHAR(30) NOT NULL,
	`TIMCLotDate` DATETIME NOT NULL,
	`TIMCReceiveNo` VARCHAR(30) NULL,
	`TIMCReceiveLn` INT NULL DEFAULT '0',
	`TIMCJobCode` VARCHAR(30) NULL,
	`TIMCIsPremium` FLOAT NULL,
	`TIMCPremiumNote` VARCHAR(150) NULL,
	`TIMCCustom2` VARCHAR(30) NULL,
	`TIMCCustom3` VARCHAR(30) NULL,
	`TIMCCustom4` VARCHAR(30) NULL,
	`TIMCCustom5` VARCHAR(30) NULL,
	`TIMCScrapLevel` VARCHAR(30) NULL,
	`TIMCLotNo2` VARCHAR(30) NULL,
	`TIMCGrade` VARCHAR(10) NULL,
	`TIMCNoExpire` SMALLINT NULL DEFAULT '0',
	`TIMCExpireDate` DATETIME NULL,
	`TIMCTCgTID` INT NULL DEFAULT '0',
	`TIMCReserve` SMALLINT NULL DEFAULT '0',
	`TIMCQAStatus` SMALLINT NULL DEFAULT '0',
	`TIMCQANote` VARCHAR(255) NULL,
	`TIMCLastUnitCost` FLOAT NULL,
	`TIMCInputCost` FLOAT NULL DEFAULT '0',
	`TIMCPerQuantity` DOUBLE NULL DEFAULT '0',
	`TIMCUnitCalc` DOUBLE NULL DEFAULT '0',
	`TIMCUnitCost` FLOAT NULL,
	`TIMCCostCode` VARCHAR(30) NULL,
	`TIMCTPCTAlias` VARCHAR(30) NULL,
	`TIMCTAPNCode` VARCHAR(30) NULL,
	`TIMCInvoiceNo` VARCHAR(30) NULL,
	`TIMCInvoiceDate` DATETIME NULL,
	`TIMCTPODNo` VARCHAR(30) NULL,
	`TIMCTPOBLn` INT NULL DEFAULT '0',
	`TIMCTPDELn` INT NULL DEFAULT '0',
	`TIMCTUntCode` VARCHAR(30) NULL,
	`TIMCUnitRatio` DOUBLE NULL DEFAULT '0',
	`TIMCUnit2Ratio` DOUBLE NULL,
	`TIMCUnit3Ratio` DOUBLE NULL,
	`TIMCLastDate` DATETIME NULL,
	`TIMCConsignFSDate` DATETIME NULL,
	`TIMCConsignLSDate` DATETIME NULL,
	`TIMCAccountLevel` SMALLINT NULL,
	`TIMCIsOwner` SMALLINT NULL,
	`TIMCPKI` VARCHAR(2) NULL,
	`TIMCBarCode` VARCHAR(30) NULL,
	`TIMCFlag1` SMALLINT NULL,
	`TIMCFlag2` SMALLINT NULL,
	`TIMCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIMCTPdtCode`, `TIMCCustom1`, `TIMCSerialNo`, `TIMCLotNo`, `TIMCLotDate`),
	KEY `TIMCBarCode` (`TIMCBarCode`),
	KEY `TIMCReceiveNo` (`TIMCReceiveNo`),
	KEY `TWCLTAPNCode` (`TIMCTAPNCode`),
	KEY `VS4TProductVS4TInventoryCost` (`TIMCTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventoryMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventoryMB`;

# ---------- CREATE TABLE `VS4TInventoryMB` ----------

CREATE TABLE `VS4TInventoryMB` (
	`TInMTInvNo` VARCHAR(30) NOT NULL,
	`TInMLn` INT NOT NULL,
	`TInMTACPTACYID` INT NULL DEFAULT '0',
	`TInMTACPID` INT NULL DEFAULT '0',
	`TInMTPdtCode` VARCHAR(30) NULL,
	`TInMCustom1` VARCHAR(30) NULL,
	`TInMSerialNo` VARCHAR(30) NULL,
	`TInMLotNo` VARCHAR(30) NULL,
	`TInMLotDate` DATETIME NULL,
	`TInMScrapLevel` VARCHAR(30) NULL,
	`TInMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TInMUnitRatio` DOUBLE NULL DEFAULT '0',
	`TInMQuantityBase` DOUBLE NULL DEFAULT '0',
	`TInMTUntCode` VARCHAR(30) NULL,
	`TInMInQuantity` DOUBLE NULL,
	`TInMOutQuantity` DOUBLE NULL,
	`TInMAmouQuantity` DOUBLE NULL,
	`TInMInQuantity2` DOUBLE NULL,
	`TInMOutQuantity2` DOUBLE NULL,
	`TInMAmouQuantity2` DOUBLE NULL,
	`TInMInQuantity3` DOUBLE NULL,
	`TInMOutQuantity3` DOUBLE NULL,
	`TInMAmouQuantity3` DOUBLE NULL,
	`TInMAmount` FLOAT NULL,
	`TInMStatus` SMALLINT NULL DEFAULT '0',
	`TInMFromTLctCode` VARCHAR(30) NULL,
	`TInMTLctCode` VARCHAR(30) NULL,
	`TInMFromTPltCode` VARCHAR(30) NULL,
	`TInMTPltCode` VARCHAR(30) NULL,
	`TInMDescription` VARCHAR(150) NULL,
	`TInMTInTAlias` VARCHAR(30) NULL,
	`TInMTSODNo` VARCHAR(30) NULL,
	`TInMTSOBLn` INT NULL DEFAULT '0',
	`TInMTMDSLn` INT NULL DEFAULT '0',
	`TInMSourceType` SMALLINT NULL DEFAULT '0',
	`TInMSourceNo` VARCHAR(30) NULL,
	`TInMSourceLn` INT NULL DEFAULT '0',
	`TInMQuantityText` VARCHAR(255) NULL,
	`TInMQuantityCutTxt` VARCHAR(255) NULL,
	`TInMQuantityCut` DOUBLE NULL DEFAULT '0',
	`TInMQuantityFirst` DOUBLE NULL DEFAULT '0',
	`TInMArrear` DOUBLE NULL DEFAULT '0',
	`TInMShow` SMALLINT NULL DEFAULT '0',
	`TInMAgentPrice` FLOAT NULL DEFAULT '0',
	`TInMQAStatus` SMALLINT NULL,
	`TInMQANote` VARCHAR(255) NULL,
	`TInMFlag1` SMALLINT NULL,
	`TInMFlag2` SMALLINT NULL,
	`TInMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TInMTInvNo`, `TInMLn`),
	KEY `TInMAmouQuantity` (`TInMAmouQuantity`),
	KEY `TInMCustom1` (`TInMCustom1`),
	KEY `TInMLn` (`TInMLn`),
	KEY `TInMLotDate` (`TInMLotDate`),
	KEY `TInMSerialNo` (`TInMSerialNo`),
	KEY `TInMShow` (`TInMShow`),
	KEY `TInMSourceLn` (`TInMSourceLn`),
	KEY `TInMSourceNo` (`TInMSourceNo`),
	KEY `TInMStatus` (`TInMStatus`),
	KEY `TInMTACPID` (`TInMTACPID`),
	KEY `TInMTACPTACYID` (`TInMTACPTACYID`),
	KEY `TInMTInTAlias` (`TInMTInTAlias`),
	KEY `TInMTInvNo` (`TInMTInvNo`),
	KEY `TInMTLctCode` (`TInMTLctCode`),
	KEY `TInMTPdtCode` (`TInMTPdtCode`),
	KEY `TInMTPltCode` (`TInMTPltCode`),
	KEY `VS4TInventoryCostVS4TInventoryMB` (`TInMTPdtCode`, `TInMCustom1`, `TInMSerialNo`, `TInMLotNo`, `TInMLotDate`),
	KEY `VS4TInventoryTypeVS4TInventoryMB` (`TInMTInTAlias`),
	KEY `VS4TInventoryVS4TInventoryMB` (`TInMTInvNo`),
	KEY `VS4TLocationVS4TInventoryMB` (`TInMTLctCode`),
	KEY `VS4TProductVS4TInventoryMB` (`TInMTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventoryMB2` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventoryMB2`;

# ---------- CREATE TABLE `VS4TInventoryMB2` ----------

CREATE TABLE `VS4TInventoryMB2` (
	`TIn2TInvNo` VARCHAR(30) NOT NULL,
	`TIn2Ln` INT NOT NULL,
	`TIn2TACPTACYID` INT NULL DEFAULT '0',
	`TIn2TACPID` INT NULL DEFAULT '0',
	`TIn2TPdtCode` VARCHAR(30) NULL,
	`TIn2Custom1` VARCHAR(30) NULL,
	`TIn2SerialNo` VARCHAR(30) NULL,
	`TIn2LotNo` VARCHAR(30) NULL,
	`TIn2LotDate` DATETIME NULL,
	`TIn2ScrapLevel` VARCHAR(30) NULL,
	`TIn2QuantityCalc` DOUBLE NULL DEFAULT '0',
	`TIn2UnitRatio` DOUBLE NULL DEFAULT '0',
	`TIn2QuantityBase` DOUBLE NULL DEFAULT '0',
	`TIn2TUntCode` VARCHAR(30) NULL,
	`TIn2InQuantity` DOUBLE NULL,
	`TIn2OutQuantity` DOUBLE NULL,
	`TIn2AmouQuantity` DOUBLE NULL,
	`TIn2InQuantity2` DOUBLE NULL,
	`TIn2OutQuantity2` DOUBLE NULL,
	`TIn2AmouQuantity2` DOUBLE NULL,
	`TIn2InQuantity3` DOUBLE NULL,
	`TIn2OutQuantity3` DOUBLE NULL,
	`TIn2AmouQuantity3` DOUBLE NULL,
	`TIn2Amount` FLOAT NULL,
	`TIn2Status` SMALLINT NULL DEFAULT '0',
	`TIn2FromTLctCode` VARCHAR(30) NULL,
	`TIn2TLctCode` VARCHAR(30) NULL,
	`TIn2FromTPltCode` VARCHAR(30) NULL,
	`TIn2TPltCode` VARCHAR(30) NULL,
	`TIn2Description` VARCHAR(150) NULL,
	`TIn2TInTAlias` VARCHAR(30) NULL,
	`TIn2TSODNo` VARCHAR(30) NULL,
	`TIn2TSOBLn` INT NULL DEFAULT '0',
	`TIn2TMDSLn` INT NULL DEFAULT '0',
	`TIn2SourceType` SMALLINT NULL DEFAULT '0',
	`TIn2SourceNo` VARCHAR(30) NULL,
	`TIn2SourceLn` INT NULL DEFAULT '0',
	`TIn2QuantityText` VARCHAR(255) NULL,
	`TIn2QuantityCutTxt` VARCHAR(255) NULL,
	`TIn2QuantityCut` DOUBLE NULL DEFAULT '0',
	`TIn2QuantityFirst` DOUBLE NULL DEFAULT '0',
	`TIn2Arrear` DOUBLE NULL DEFAULT '0',
	`TIn2Show` SMALLINT NULL DEFAULT '0',
	`TIn2AgentPrice` FLOAT NULL DEFAULT '0',
	`TIn2QAStatus` SMALLINT NULL,
	`TIn2QANote` VARCHAR(255) NULL,
	`TIn2Flag1` SMALLINT NULL,
	`TIn2Flag2` SMALLINT NULL,
	`TIn2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIn2TInvNo`, `TIn2Ln`),
	KEY `TInMAmouQuantity` (`TIn2AmouQuantity`),
	KEY `TInMCustom1` (`TIn2Custom1`),
	KEY `TInMLn` (`TIn2Ln`),
	KEY `TInMLotDate` (`TIn2LotDate`),
	KEY `TInMSerialNo` (`TIn2SerialNo`),
	KEY `TInMShow` (`TIn2Show`),
	KEY `TInMSourceLn` (`TIn2SourceLn`),
	KEY `TInMSourceNo` (`TIn2SourceNo`),
	KEY `TInMStatus` (`TIn2Status`),
	KEY `TInMTACPID` (`TIn2TACPID`),
	KEY `TInMTACPTACYID` (`TIn2TACPTACYID`),
	KEY `TInMTInTAlias` (`TIn2TInTAlias`),
	KEY `TInMTInvNo` (`TIn2TInvNo`),
	KEY `TInMTLctCode` (`TIn2TLctCode`),
	KEY `TInMTPdtCode` (`TIn2TPdtCode`),
	KEY `TInMTPltCode` (`TIn2TPltCode`),
	KEY `VS4TInventoryLOTVS4TInventoryMB2` (`TIn2TPdtCode`, `TIn2Custom1`, `TIn2SerialNo`, `TIn2LotNo`, `TIn2LotDate`),
	KEY `VS4TInventoryVS4TInventoryMB2` (`TIn2TInvNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventoryType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventoryType`;

# ---------- CREATE TABLE `VS4TInventoryType` ----------

CREATE TABLE `VS4TInventoryType` (
	`TInTAlias` VARCHAR(30) NOT NULL,
	`TInTDocCode` VARCHAR(30) NULL,
	`TInTName` VARCHAR(100) NULL,
	`TInTName2` VARCHAR(100) NULL,
	`TInTGroupType` VARCHAR(1) NULL,
	`TInTCountType` SMALLINT NULL DEFAULT '1',
	`TInTInputCost` SMALLINT NULL DEFAULT '0',
	`TInTCalcCost` SMALLINT NULL DEFAULT '0',
	`TInTDescription` VARCHAR(100) NULL,
	`TInTSort` SMALLINT NULL DEFAULT '0',
	`TInTTWahCode` VARCHAR(30) NULL,
	`TInTFlag1` SMALLINT NULL DEFAULT '0',
	`TInTFlag2` SMALLINT NULL DEFAULT '0',
	`TInTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TInTAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventPDE` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventPDE`;

# ---------- CREATE TABLE `VS4TInventPDE` ----------

CREATE TABLE `VS4TInventPDE` (
	`TIDPTInMTInvNo` VARCHAR(30) NOT NULL,
	`TIDPTInMLn` INT NOT NULL DEFAULT '0',
	`TIDPTPDETPOBTPODNo` VARCHAR(30) NOT NULL,
	`TIDPTPDETPOBLn` INT NOT NULL DEFAULT '0',
	`TIDPTPDELn` INT NOT NULL DEFAULT '0',
	`TIDPFlag1` SMALLINT NULL DEFAULT '0',
	`TIDPFlag2` SMALLINT NULL DEFAULT '0',
	`TIDPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIDPTInMTInvNo`, `TIDPTInMLn`, `TIDPTPDETPOBTPODNo`, `TIDPTPDETPOBLn`, `TIDPTPDELn`),
	KEY `VS4TInventoryMBVS4TInventPDE` (`TIDPTInMTInvNo`, `TIDPTInMLn`),
	KEY `VS4TPODeliveryVS4TInventPDE` (`TIDPTPDETPOBTPODNo`, `TIDPTPDETPOBLn`, `TIDPTPDELn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventPeriod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventPeriod`;

# ---------- CREATE TABLE `VS4TInventPeriod` ----------

CREATE TABLE `VS4TInventPeriod` (
	`TIvPTACPTACYID` INT NOT NULL DEFAULT '0',
	`TIvPTACPID` INT NOT NULL DEFAULT '0',
	`TIvPTBraCode` VARCHAR(30) NOT NULL,
	`TIvPStartDate` DATETIME NULL,
	`TIvPEndDate` DATETIME NULL,
	`TIvPFinishGoods` FLOAT NULL DEFAULT '0',
	`TIvPPromotion` FLOAT NULL,
	`TIvPWorkInProcess` FLOAT NULL DEFAULT '0',
	`TIvPSemiGoods` FLOAT NULL,
	`TIvPScrap` FLOAT NULL,
	`TIvPRawMaterials` FLOAT NULL DEFAULT '0',
	`TIvPStationery` FLOAT NULL DEFAULT '0',
	`TIvPFactorySupply` FLOAT NULL DEFAULT '0',
	`TIvPFGStatus` SMALLINT NULL,
	`TIvPPromoteStatus` SMALLINT NULL,
	`TIvPWIPStatus` SMALLINT NULL,
	`TIvPSemiGoodStatus` INT NULL,
	`TIvPScrapStatus` INT NULL,
	`TIvPRMStatus` SMALLINT NULL,
	`TIvPOSupplyStatus` SMALLINT NULL,
	`TIvPSupplyStatus` SMALLINT NULL,
	`TIvPStatus` SMALLINT NULL DEFAULT '0',
	`TIvPTGLTNo` VARCHAR(30) NULL,
	`TIvPAccountStatus` SMALLINT NULL DEFAULT '0',
	`TIvPFlag1` SMALLINT NULL DEFAULT '0',
	`TIvPFlag2` SMALLINT NULL DEFAULT '0',
	`TIvPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TIvPTACPTACYID`, `TIvPTACPID`, `TIvPTBraCode`),
	KEY `TACPID` (`TIvPTACPTACYID`),
	KEY `TACPNo` (`TIvPTACPID`),
	KEY `TIvPTBraCode` (`TIvPTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TInventSerial` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TInventSerial`;

# ---------- CREATE TABLE `VS4TInventSerial` ----------

CREATE TABLE `VS4TInventSerial` (
	`TInRLn` VARCHAR(30) NOT NULL,
	`TInRTPdtCode` VARCHAR(30) NOT NULL,
	`TInRCustom1` VARCHAR(30) NOT NULL,
	`TInRSerialNo` VARCHAR(30) NOT NULL,
	`TInRLotNo` VARCHAR(30) NOT NULL,
	`TInRLotDate` DATETIME NOT NULL,
	`TInRJobCode` VARCHAR(30) NULL,
	`TInRValidStatus` SMALLINT NULL DEFAULT '0',
	`TInRInDate` DATETIME NULL,
	`TInROutDate` DATETIME NULL,
	`TInRRejectNo` VARCHAR(30) NULL,
	`TInRRejectLn` INT NULL DEFAULT '0',
	`TInRSaleInvoiceNo` VARCHAR(30) NULL,
	`TInRSaleInvoiceLn` INT NULL DEFAULT '0',
	`TInRSaleReturnNo` VARCHAR(30) NULL,
	`TInRSaleReturnLn` INT NULL DEFAULT '0',
	`TInRTARNCode` VARCHAR(30) NULL,
	`TInRAmount` FLOAT NULL,
	`TInRCostCode` VARCHAR(30) NULL,
	`TInRUnitRatio` DOUBLE NULL DEFAULT '0',
	`TInRQuantityBase` DOUBLE NULL DEFAULT '0',
	`TInRAmouQuantity` DOUBLE NULL,
	`TInRAmouQuantity2` DOUBLE NULL,
	`TInRAmouQuantity3` DOUBLE NULL,
	`TInRStatus` SMALLINT NULL DEFAULT '0',
	`TInRTLctCode` VARCHAR(30) NULL,
	`TInRDescription` VARCHAR(50) NULL,
	`TInRCustom6` VARCHAR(100) NULL,
	`TInRCustom7` VARCHAR(100) NULL,
	`TInRCustom8` VARCHAR(100) NULL,
	`TInRCustom9` VARCHAR(100) NULL,
	`TInRCustom10` VARCHAR(100) NULL,
	`TInRCustom11` VARCHAR(100) NULL,
	`TInRCustom12` VARCHAR(100) NULL,
	`TInRCustom13` VARCHAR(100) NULL,
	`TInRCustom14` VARCHAR(100) NULL,
	`TInRCustom15` VARCHAR(100) NULL,
	`TInRCustom16` VARCHAR(100) NULL,
	`TInRCustom17` VARCHAR(100) NULL,
	`TInRCustom18` VARCHAR(100) NULL,
	`TInRCustom19` VARCHAR(100) NULL,
	`TInRCustom20` VARCHAR(100) NULL,
	`TInRCustom21` VARCHAR(255) NULL,
	`TInRCustom22` VARCHAR(255) NULL,
	`TInRCustom23` VARCHAR(255) NULL,
	`TInRCustom24` VARCHAR(255) NULL,
	`TInRCustom25` VARCHAR(255) NULL,
	`TInRCustom26` VARCHAR(255) NULL,
	`TInRCustom27` VARCHAR(255) NULL,
	`TInRCustom28` VARCHAR(255) NULL,
	`TInRCustom29` VARCHAR(255) NULL,
	`TInRCustom30` VARCHAR(255) NULL,
	`TInRFlag1` SMALLINT NULL,
	`TInRFlag2` SMALLINT NULL,
	`TInRFlag3` SMALLINT NULL,
	PRIMARY KEY (`TInRLn`, `TInRTPdtCode`, `TInRCustom1`, `TInRSerialNo`, `TInRLotNo`, `TInRLotDate`),
	KEY `TInMCode` (`TInRLotNo`),
	KEY `TInMCostCode` (`TInRCostCode`),
	KEY `TInMCostCode2` (`TInRRejectNo`),
	KEY `TInMJobCode` (`TInRJobCode`),
	KEY `TInMJobCode1` (`TInRDescription`),
	KEY `TInMReceiveLn` (`TInRRejectLn`),
	KEY `TInMReceiveLn1` (`TInRSaleInvoiceLn`),
	KEY `TInMReceiveLn2` (`TInRSaleReturnLn`),
	KEY `TInMSerialNo` (`TInRSerialNo`),
	KEY `TInMTInvNo` (`TInRLn`),
	KEY `TInMTPdtCode` (`TInRTPdtCode`),
	KEY `TInRCustom1` (`TInRCustom1`),
	KEY `TInRInDate` (`TInRValidStatus`),
	KEY `TInRLotDate` (`TInRLotDate`),
	KEY `TInRLotNo` (`TInRTARNCode`),
	KEY `TInRSerialNo` (`TInRInDate`),
	KEY `TTfrToTLctCode` (`TInRTLctCode`),
	KEY `TTfrToTShfCode` (`TInRStatus`),
	KEY `VS4TInventoryCostVS4TInventSerial` (`TInRTPdtCode`, `TInRCustom1`, `TInRSerialNo`, `TInRLotNo`, `TInRLotDate`),
	KEY `VS4TLocationVS4TInventSerial` (`TInRTLctCode`),
	KEY `VS4TProductVS4TInventSerial` (`TInRTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TISO` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TISO`;

# ---------- CREATE TABLE `VS4TISO` ----------

CREATE TABLE `VS4TISO` (
	`TISOCode` VARCHAR(30) NOT NULL,
	`TISOTISGCode` VARCHAR(30) NULL,
	`TISOName` VARCHAR(200) NULL,
	`TISORevision` VARCHAR(30) NULL,
	`TISOStartDate` DATETIME NULL,
	`TISOTotalPage` SMALLINT NULL DEFAULT '0',
	`TISOTotalRevise` SMALLINT NULL DEFAULT '0',
	`TISOTDivCode` VARCHAR(30) NULL,
	`TISONote` VARCHAR(50) NULL,
	`TISOType` VARCHAR(30) NULL,
	`TISOCommandAlias` VARCHAR(30) NULL,
	`TISOReportAlias` VARCHAR(30) NULL,
	`TISOFilename` VARCHAR(255) NULL,
	`TISODescription` VARCHAR(255) NULL,
	`TISOFlag1` SMALLINT NULL DEFAULT '0',
	`TISOFlag2` SMALLINT NULL DEFAULT '0',
	`TISOFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TISOCode`),
	UNIQUE KEY `VS4TISOGroupVS4TISO` (`TISOTISGCode`),
	KEY `TISOCode` (`TISOTISGCode`),
	KEY `TISONo` (`TISOCode`),
	KEY `TISOTDivCode` (`TISOTDivCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TISOGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TISOGroup`;

# ---------- CREATE TABLE `VS4TISOGroup` ----------

CREATE TABLE `VS4TISOGroup` (
	`TISGCode` VARCHAR(30) NOT NULL,
	`TISGName` VARCHAR(50) NULL,
	`TISGName2` VARCHAR(50) NULL,
	`TISGFlag1` SMALLINT NULL DEFAULT '0',
	`TISGFlag2` SMALLINT NULL DEFAULT '0',
	`TISGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TISGCode`),
	KEY `TDepCode` (`TISGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJob` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJob`;

# ---------- CREATE TABLE `VS4TJob` ----------

CREATE TABLE `VS4TJob` (
	`TJobNo` VARCHAR(30) NOT NULL,
	`TJobCode` VARCHAR(30) NULL,
	`TJobTJBkCode` VARCHAR(30) NULL,
	`TJobType` SMALLINT NULL DEFAULT '0',
	`TJobDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJobRefNo` VARCHAR(30) NULL,
	`TJobRefDate` DATETIME NULL,
	`TJobRefLn` INT NULL DEFAULT '0',
	`TJobRefNo2` VARCHAR(30) NULL,
	`TJobRefDate2` DATETIME NULL,
	`TJobTInvNo` VARCHAR(30) NULL,
	`TJOBOriginalNo` VARCHAR(30) NULL,
	`TJobTARNCode` VARCHAR(30) NULL,
	`TJobCustomerName` VARCHAR(200) NULL,
	`TJobTPrjCode` VARCHAR(30) NULL,
	`TJobTSecCode` VARCHAR(30) NULL,
	`TJobTDepCode` VARCHAR(30) NULL,
	`TJobTDivCode` VARCHAR(30) NULL,
	`TJobTBraCode` VARCHAR(30) NULL,
	`TJobFinishDate` DATETIME NULL,
	`TJobFinishTime` DATETIME NULL,
	`TJobDescription` VARCHAR(255) NULL,
	`TJobSetMode` SMALLINT NULL DEFAULT '0',
	`TJobTotalRequest` DOUBLE NULL DEFAULT '0',
	`TJobTotalRequest2` DOUBLE NULL DEFAULT '0',
	`TJobTotalRequest3` DOUBLE NULL DEFAULT '0',
	`TJobTotalArrear` DOUBLE NULL DEFAULT '0',
	`TJobTotalArrear2` DOUBLE NULL DEFAULT '0',
	`TJobTotalArrear3` DOUBLE NULL DEFAULT '0',
	`TJobTotalFinishPCB` DOUBLE NULL DEFAULT '0',
	`TJobTotalFinishPCO` DOUBLE NULL DEFAULT '0',
	`TJobTotalFinishPC` DOUBLE NULL DEFAULT '0',
	`TJobTotalFinishQT` DOUBLE NULL DEFAULT '0',
	`TJobTotalFinishQT2` DOUBLE NULL DEFAULT '0',
	`TJobTotalFinishQT3` DOUBLE NULL DEFAULT '0',
	`TJobTotalLoss` DOUBLE NULL DEFAULT '0',
	`TJobTotalLoss2` DOUBLE NULL DEFAULT '0',
	`TJobTotalLoss3` DOUBLE NULL DEFAULT '0',
	`TJobStandardTotal` FLOAT NULL DEFAULT '0',
	`TJobActualTotal` FLOAT NULL DEFAULT '0',
	`TJobActualLastDate` DATETIME NULL,
	`TJobEstimateTotal` FLOAT NULL DEFAULT '0',
	`TJobCustomText1` VARCHAR(100) NULL,
	`TJobCustomText2` VARCHAR(100) NULL,
	`TJobCustomValue1` DOUBLE NULL DEFAULT '0',
	`TJobCustomValue2` DOUBLE NULL DEFAULT '0',
	`TJobRequestCode` VARCHAR(30) NULL,
	`TJobRequestBy` VARCHAR(140) NULL,
	`TJobCloseStatus` SMALLINT NULL DEFAULT '0',
	`TJobCloseBy` VARCHAR(140) NULL,
	`TJobCloseDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJobCloseNote` VARCHAR(80) NULL,
	`TJobCreateCode` VARCHAR(30) NULL,
	`TJobCreateBy` VARCHAR(140) NULL,
	`TJobCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJobEditCode` VARCHAR(30) NULL,
	`TJobEditBy` VARCHAR(140) NULL,
	`TJobEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJobConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TJobConfirmBy` VARCHAR(140) NULL,
	`TJobConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJobApproveStatus` SMALLINT NULL DEFAULT '0',
	`TJobApproveBy` VARCHAR(140) NULL,
	`TJobApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJobApproveNote` VARCHAR(80) NULL,
	`TJobRevision` SMALLINT NULL DEFAULT '0',
	`TJobCancelStatus` SMALLINT NULL DEFAULT '0',
	`TJobCancelNo` VARCHAR(30) NULL,
	`TJobCancelBy` VARCHAR(140) NULL,
	`TJobCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJobCancelNote` VARCHAR(80) NULL,
	`TJobFlag1` SMALLINT NULL DEFAULT '0',
	`TJobFlag2` SMALLINT NULL DEFAULT '0',
	`TJobFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJobNo`),
	KEY `TBnkCode` (`TJobNo`),
	KEY `TJobCode` (`TJobCode`),
	KEY `TJobCode1` (`TJobTJBkCode`),
	KEY `TJOBOriginalNo` (`TJOBOriginalNo`),
	KEY `TJobTARNCode` (`TJobTARNCode`),
	KEY `TJobTPrjCode` (`TJobTPrjCode`),
	KEY `TPRDRequestBy` (`TJobRequestBy`),
	KEY `TPRDRequestCode` (`TJobRequestCode`),
	KEY `TPRDTAolCode` (`TJobRefDate`),
	KEY `TPRDTBraCode` (`TJobTBraCode`),
	KEY `TPRDTDepCode` (`TJobTDepCode`),
	KEY `TPRDTDivCode` (`TJobTDivCode`),
	KEY `VS4TJobBookVS4TJob` (`TJobTJBkCode`),
	KEY `VS4TProjectVS4TJob` (`TJobTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobBook` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobBook`;

# ---------- CREATE TABLE `VS4TJobBook` ----------

CREATE TABLE `VS4TJobBook` (
	`TJBkCode` VARCHAR(30) NOT NULL,
	`TJBkName` VARCHAR(200) NULL,
	`TJBkName2` VARCHAR(200) NULL,
	`TJBkDocCode` VARCHAR(30) NULL,
	`TJBkFlag1` SMALLINT NULL DEFAULT '0',
	`TJBkFlag2` SMALLINT NULL DEFAULT '0',
	`TJBkFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJBkCode`),
	KEY `TCmTCode` (`TJBkCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobCostSheet` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobCostSheet`;

# ---------- CREATE TABLE `VS4TJobCostSheet` ----------

CREATE TABLE `VS4TJobCostSheet` (
	`TJCSID` INT NOT NULL DEFAULT '0',
	`TJCSTJbMJobNo` VARCHAR(30) NULL,
	`TJCSTJbMLn` INT NULL DEFAULT '0',
	`TJCSTJPDNo` VARCHAR(30) NULL,
	`TJCSLevel` INT NULL DEFAULT '0',
	`TJCSCode` VARCHAR(30) NULL,
	`TJCSDescription` VARCHAR(100) NULL,
	`TJCSBaseCost` DOUBLE NULL DEFAULT '0',
	`TJCSFactor` DOUBLE NULL DEFAULT '0',
	`TJCSUsed` DOUBLE NULL DEFAULT '0',
	`TJCSAmount` DOUBLE NULL DEFAULT '0',
	`TJCSRemark` VARCHAR(100) NULL,
	`TJCSFlag1` SMALLINT NULL DEFAULT '0',
	`TJCSFlag2` SMALLINT NULL DEFAULT '0',
	`TJCSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJCSID`),
	KEY `TBnkCode` (`TJCSTJbMJobNo`),
	KEY `TJbCID` (`TJCSID`),
	KEY `TJbCTJobNo` (`TJCSTJbMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobDL` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobDL`;

# ---------- CREATE TABLE `VS4TJobDL` ----------

CREATE TABLE `VS4TJobDL` (
	`TJDLTJbMTJobNo` VARCHAR(50) NOT NULL,
	`TJDLTJbMLn` INT NOT NULL DEFAULT '0',
	`TJDLTSpdStep` INT NOT NULL DEFAULT '0',
	`TJDLLn` INT NOT NULL DEFAULT '0',
	`TJDLLevel` INT NULL,
	`TJDLTJPdNo` VARCHAR(30) NULL,
	`TJDLTSepCode` VARCHAR(30) NULL,
	`TJDLTPdtCode` VARCHAR(50) NULL,
	`TJDLTEmpCode` VARCHAR(30) NULL,
	`TJDLEmployeeName` VARCHAR(150) NULL,
	`TJDLPositionName` VARCHAR(150) NULL,
	`TJDLStartTime` DOUBLE NULL DEFAULT '1',
	`TJDLEndTime` DOUBLE NULL DEFAULT '1',
	`TJDLQuantityCalc` DOUBLE NULL DEFAULT '1',
	`TJDLQuantity` DOUBLE NULL DEFAULT '1',
	`TJDLMan` SMALLINT NULL DEFAULT '1',
	`TJDLCost` DOUBLE NULL DEFAULT '1',
	`TJDLTotalCost` DOUBLE NULL DEFAULT '1',
	`TJDLRemark` VARCHAR(50) NULL,
	`TJDLFlag1` SMALLINT NULL DEFAULT '0',
	`TJDLFlag2` SMALLINT NULL DEFAULT '0',
	`TJDLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJDLTJbMTJobNo`, `TJDLTJbMLn`, `TJDLTSpdStep`, `TJDLLn`),
	KEY `TJbMTJobNo` (`TJDLTJbMTJobNo`),
	KEY `TJMtStepName` (`TJDLTPdtCode`),
	KEY `TJMtTFPSCode` (`TJDLTEmpCode`),
	KEY `TJMtTSepCode` (`TJDLTSepCode`),
	KEY `TJMtTSpdStep` (`TJDLTSpdStep`),
	KEY `VS4TJobMBVS4TJobDL` (`TJDLTJbMTJobNo`, `TJDLTJbMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobHistory` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobHistory`;

# ---------- CREATE TABLE `VS4TJobHistory` ----------

CREATE TABLE `VS4TJobHistory` (
	`TJbHTJobNo` VARCHAR(30) NOT NULL,
	`TJbHLn` INT NOT NULL DEFAULT '0',
	`TJbHLastNo` INT NULL DEFAULT '0',
	`TJbHLastDate` DATETIME NULL,
	`TJbHCustom1` VARCHAR(50) NULL,
	`TJbHCustom2` VARCHAR(50) NULL,
	`TJbHCustom3` VARCHAR(50) NULL,
	`TJbHCustom4` VARCHAR(50) NULL,
	`TJbHCustom5` VARCHAR(50) NULL,
	`TJbHCustom6` VARCHAR(50) NULL,
	`TJbHCustom7` VARCHAR(50) NULL,
	`TJbHCustom8` VARCHAR(50) NULL,
	`TJbHCustom9` VARCHAR(50) NULL,
	`TJbHCustom10` VARCHAR(50) NULL,
	`TJbHCheckBy` VARCHAR(160) NULL,
	`TJbHApproveBy` VARCHAR(160) NULL,
	`TJbHFinDate` DATETIME NULL,
	`TJbHFinCustom1` VARCHAR(50) NULL,
	`TJbHFinCustom2` VARCHAR(50) NULL,
	`TJbHFinCustom3` VARCHAR(50) NULL,
	`TJbHFinCustom4` VARCHAR(50) NULL,
	`TJbHFinCustom5` VARCHAR(50) NULL,
	`TJbHFinCustom6` VARCHAR(50) NULL,
	`TJbHFinCustom7` VARCHAR(50) NULL,
	`TJbHFinCustom8` VARCHAR(50) NULL,
	`TJbHFinCustom9` VARCHAR(50) NULL,
	`TJbHFinCustom10` VARCHAR(50) NULL,
	`TJbHFinCheckBy` VARCHAR(160) NULL,
	`TJbHFinApproveBy` VARCHAR(160) NULL,
	`TJbHFlag1` SMALLINT NULL DEFAULT '0',
	`TJbHFlag2` SMALLINT NULL DEFAULT '0',
	`TJbHFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJbHTJobNo`, `TJbHLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobMaterial` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobMaterial`;

# ---------- CREATE TABLE `VS4TJobMaterial` ----------

CREATE TABLE `VS4TJobMaterial` (
	`TJMtTJbMTJobNo` VARCHAR(30) NOT NULL,
	`TJMtTJbMLn` INT NOT NULL DEFAULT '0',
	`TJMtTSpdStep` INT NOT NULL DEFAULT '0',
	`TJMtLn` INT NOT NULL DEFAULT '0',
	`TJMtTJstLn` INT NULL,
	`TJMtLevel` INT NULL,
	`TJMtMatType` SMALLINT NULL DEFAULT '0',
	`TJMtNo` INT NULL,
	`TJMtAlternative` SMALLINT NULL DEFAULT '0',
	`TJMtType` SMALLINT NULL DEFAULT '0',
	`TJMtTJPdNo` VARCHAR(30) NULL,
	`TJMtTPdtCode` VARCHAR(30) NULL,
	`TJMtTSepCode` VARCHAR(30) NULL,
	`TJMtProductCode` VARCHAR(30) NULL,
	`TJMtProductName` VARCHAR(150) NULL,
	`TJMtCustom1` VARCHAR(30) NULL,
	`TJMtCustom2` VARCHAR(30) NULL,
	`TJMtCustom3` VARCHAR(30) NULL,
	`TJMtCustom4` VARCHAR(30) NULL,
	`TJMtCustom5` VARCHAR(30) NULL,
	`TJMtQuantity` DOUBLE NULL DEFAULT '1',
	`TJMtUseStock` DOUBLE NULL DEFAULT '1',
	`TJMtUseOrder` DOUBLE NULL DEFAULT '1',
	`TJMtTotalUsed` DOUBLE NULL DEFAULT '1',
	`TJMtTotalDif` DOUBLE NULL DEFAULT '1',
	`TJMtUnitCode` VARCHAR(15) NULL,
	`TJMtQuantity2` DOUBLE NULL DEFAULT '1',
	`TJMtUseStock2` DOUBLE NULL DEFAULT '1',
	`TJMtUseOrder2` DOUBLE NULL DEFAULT '1',
	`TJMtTotalUsed2` DOUBLE NULL DEFAULT '1',
	`TJMtTotalDif2` DOUBLE NULL DEFAULT '1',
	`TJMtUnitCode2` VARCHAR(15) NULL,
	`TJMtQuantity3` DOUBLE NULL DEFAULT '1',
	`TJMtUseStock3` DOUBLE NULL DEFAULT '1',
	`TJMtUseOrder3` DOUBLE NULL DEFAULT '1',
	`TJMtTotalUsed3` DOUBLE NULL DEFAULT '1',
	`TJMtTotalDif3` DOUBLE NULL DEFAULT '1',
	`TJMtUnitCode3` VARCHAR(15) NULL,
	`TJMtRemark` VARCHAR(150) NULL,
	`TJMtFlag1` SMALLINT NULL DEFAULT '0',
	`TJMtFlag2` SMALLINT NULL DEFAULT '0',
	`TJMtFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJMtTJbMTJobNo`, `TJMtTJbMLn`, `TJMtTSpdStep`, `TJMtLn`),
	KEY `TJbMTJobNo` (`TJMtTJbMTJobNo`),
	KEY `TJMtTFPSCode` (`TJMtTPdtCode`),
	KEY `TJMtTSepCode` (`TJMtTSepCode`),
	KEY `TPMtProcessNo` (`TJMtTSpdStep`),
	KEY `TPmTUnitCode` (`TJMtUnitCode`),
	KEY `TPmTUnitCode1` (`TJMtUnitCode2`),
	KEY `TPmTUnitCode2` (`TJMtUnitCode3`),
	KEY `TPoMTPdtCode` (`TJMtProductCode`),
	KEY `VS4TJobMBVS4TJobMaterial` (`TJMtTJbMTJobNo`, `TJMtTJbMLn`),
	KEY `VS4TJobVS4TJobMaterial` (`TJMtTJbMTJobNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobMB`;

# ---------- CREATE TABLE `VS4TJobMB` ----------

CREATE TABLE `VS4TJobMB` (
	`TJbMTJobNo` VARCHAR(30) NOT NULL,
	`TJbMLn` INT NOT NULL DEFAULT '0',
	`TJbMType` SMALLINT NULL DEFAULT '0',
	`TJbMPriority` INT NULL,
	`TJbMTDwgCode` VARCHAR(30) NULL,
	`TJbMTPdtCode` VARCHAR(30) NULL,
	`TJbMProductName` VARCHAR(150) NULL,
	`TJbMCustom1` VARCHAR(30) NULL,
	`TJbMCustom2` VARCHAR(30) NULL,
	`TJbMCustom3` VARCHAR(30) NULL,
	`TJbMCustom4` VARCHAR(30) NULL,
	`TJbMCustom5` VARCHAR(30) NULL,
	`TjbMShippingMark` VARCHAR(255) NULL,
	`TJbMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TJbMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TJbMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TJbMAcceptError` VARCHAR(30) NULL,
	`TJbMQuantity` DOUBLE NULL DEFAULT '0',
	`TJbMStockOnHand` DOUBLE NULL DEFAULT '0',
	`TJbMUseStock` DOUBLE NULL DEFAULT '0',
	`TJbMUseOrder` DOUBLE NULL DEFAULT '0',
	`TJbMTUntCode` VARCHAR(50) NULL,
	`TJbMQuantity2` DOUBLE NULL DEFAULT '0',
	`TJbMStockOnHand2` DOUBLE NULL DEFAULT '0',
	`TJbMUseStock2` DOUBLE NULL DEFAULT '0',
	`TJbMUseOrder2` DOUBLE NULL DEFAULT '0',
	`TJbMTUntCode2` VARCHAR(50) NULL,
	`TJbMQuantity3` DOUBLE NULL DEFAULT '0',
	`TJbMStockOnHand3` DOUBLE NULL DEFAULT '0',
	`TJbMUseStock3` DOUBLE NULL DEFAULT '0',
	`TJbMUseOrder3` DOUBLE NULL DEFAULT '0',
	`TJbMTUntCode3` VARCHAR(50) NULL,
	`TJbMDescription` VARCHAR(255) NULL,
	`TJbMProcessStatus` SMALLINT NULL DEFAULT '0',
	`TJbMTotalRequest` DOUBLE NULL DEFAULT '0',
	`TJbMTotalRequest2` DOUBLE NULL DEFAULT '0',
	`TJbMTotalRequest3` DOUBLE NULL DEFAULT '0',
	`TJbMTotalArrear` DOUBLE NULL DEFAULT '0',
	`TJbMTotalArrear2` DOUBLE NULL DEFAULT '0',
	`TJbMTotalArrear3` DOUBLE NULL DEFAULT '0',
	`TJbMFinishPCOrder` DOUBLE NULL DEFAULT '0',
	`TJbMFinishPC` DOUBLE NULL DEFAULT '0',
	`TJbMFinishQT` DOUBLE NULL DEFAULT '0',
	`TJbMFinishQT2` DOUBLE NULL DEFAULT '0',
	`TJbMFinishQT3` DOUBLE NULL DEFAULT '0',
	`TJbMTotalLoss` DOUBLE NULL DEFAULT '0',
	`TJbMTotalLoss2` DOUBLE NULL DEFAULT '0',
	`TJbMTotalLoss3` DOUBLE NULL DEFAULT '0',
	`TJbMStandardDM` FLOAT NULL DEFAULT '0',
	`TJbMStandardDL` FLOAT NULL DEFAULT '0',
	`TJbMStandardMOH` FLOAT NULL DEFAULT '0',
	`TJbMStandardTotal` FLOAT NULL DEFAULT '0',
	`TJbMStandardUnit` FLOAT NULL DEFAULT '0',
	`TJbMActualDM` FLOAT NULL DEFAULT '0',
	`TJbMActualDL` FLOAT NULL DEFAULT '0',
	`TJbMActualMOH` FLOAT NULL DEFAULT '0',
	`TJbMActualTotal` FLOAT NULL DEFAULT '0',
	`TJbMActualUnit` FLOAT NULL DEFAULT '0',
	`TJbMActualLastDate` DATETIME NULL,
	`TJbMEstimateDM` FLOAT NULL DEFAULT '0',
	`TJbMEstimateDL` FLOAT NULL DEFAULT '0',
	`TJbMEstimateMOH` FLOAT NULL DEFAULT '0',
	`TJbMEstimateTotal` FLOAT NULL DEFAULT '0',
	`TJbMEstimateUnit` FLOAT NULL DEFAULT '0',
	`TJbMCustomText1` VARCHAR(255) NULL,
	`TJbMCustomText2` VARCHAR(255) NULL,
	`TJbMCustomText3` VARCHAR(255) NULL,
	`TJbMCustomText4` VARCHAR(255) NULL,
	`TJbMCustomText5` VARCHAR(255) NULL,
	`TJbMCustomText6` VARCHAR(255) NULL,
	`TJbMCustomText7` VARCHAR(255) NULL,
	`TJbMCustomText8` VARCHAR(255) NULL,
	`TJbMCustomText9` VARCHAR(255) NULL,
	`TJbMCustomText10` VARCHAR(255) NULL,
	`TJbMCustomValue1` DOUBLE NULL DEFAULT '0',
	`TJbMCustomValue2` DOUBLE NULL DEFAULT '0',
	`TJbMCustomValue3` DOUBLE NULL DEFAULT '0',
	`TJbMCustomValue4` DOUBLE NULL DEFAULT '0',
	`TJbMCustomValue5` DOUBLE NULL DEFAULT '0',
	`TJbMUseDate` VARCHAR(4) NULL,
	`TJbMSetMode` SMALLINT NULL DEFAULT '0',
	`TJbMSourceNo` VARCHAR(30) NULL,
	`TJbMSourceLn` INT NULL DEFAULT '0',
	`TJbMStartDate` DATETIME NULL,
	`TJbMSourceDate` DATETIME NULL,
	`TJbMTMDMTMDNNo` VARCHAR(30) NULL,
	`TJbMTMDMLn` INT NULL DEFAULT '0',
	`TJbMTWRMCode` VARCHAR(255) NULL,
	`TJbMFlag1` SMALLINT NULL DEFAULT '0',
	`TJbMFlag2` SMALLINT NULL DEFAULT '0',
	`TJbMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJbMTJobNo`, `TJbMLn`),
	KEY `TJbMSourceNo` (`TJbMSourceNo`),
	KEY `TJbMSourceNo1` (`TJbMTMDMTMDNNo`),
	KEY `TJbMTUntCode2` (`TJbMTUntCode3`),
	KEY `TJbMTWRMCode` (`TJbMTWRMCode`),
	KEY `TJPdTDwgCode` (`TJbMTDwgCode`),
	KEY `TPRMTPdtCode` (`TJbMTPdtCode`),
	KEY `TPWBID` (`TJbMLn`),
	KEY `TPWBTUntCode` (`TJbMTUntCode`),
	KEY `TPWBTUntCode1` (`TJbMTUntCode2`),
	KEY `TSOBUnitFactor` (`TJbMUnitFactor`),
	KEY `TTfMID` (`TJbMTJobNo`),
	KEY `TTfrToTShfCode` (`TJbMType`),
	KEY `VS4TJobVS4TJobMB` (`TJbMTJobNo`),
	KEY `VS4TJobVS4TJobMB1` (`TJbMTJobNo`),
	KEY `VS4TProductVS4TJobMB` (`TJbMTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobMBSerial` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobMBSerial`;

# ---------- CREATE TABLE `VS4TJobMBSerial` ----------

CREATE TABLE `VS4TJobMBSerial` (
	`TJMSID` INT NOT NULL DEFAULT '0',
	`TJMSTJbMTJobNo` VARCHAR(30) NULL,
	`TJMSTJbMLn` INT NULL,
	`TJMSTSpdStep` INT NULL DEFAULT '0',
	`TJMSProductCode` VARCHAR(30) NULL,
	`TJMSProductName` VARCHAR(150) NULL,
	`TJMSCustom1` VARCHAR(30) NULL,
	`TJMSCustom2` VARCHAR(30) NULL,
	`TJMSCustom3` VARCHAR(30) NULL,
	`TJMSCustom4` VARCHAR(30) NULL,
	`TJMSCustom5` VARCHAR(30) NULL,
	`TJMSSerialNo` VARCHAR(30) NULL,
	`TJMSSerialName` VARCHAR(150) NULL,
	`TJMSCaseNo` VARCHAR(30) NULL,
	`TJMSRegisterNo` VARCHAR(35) NULL,
	`TJMSRegisterDate` DATETIME NULL,
	`TJMSStopInsureDate` DATETIME NULL,
	`TJMSExpireDate` DATETIME NULL,
	`TJMSUnitCalc` SMALLINT NULL DEFAULT '0',
	`TJMSQuantity` DOUBLE NULL DEFAULT '0',
	`TJMSQuantity2` DOUBLE NULL DEFAULT '0',
	`TJMSQuantity3` DOUBLE NULL DEFAULT '0',
	`TJMSTUntCode` VARCHAR(30) NULL,
	`TJMSTUntCode2` VARCHAR(30) NULL,
	`TJMSTUntCode3` VARCHAR(30) NULL,
	`TJMSApproveStatus` SMALLINT NULL DEFAULT '0',
	`TJMSShape` VARCHAR(10) NULL,
	`TJMSSize` VARCHAR(10) NULL,
	`TJMSQuality` VARCHAR(10) NULL,
	`TJMSStandardCost` FLOAT NULL DEFAULT '0',
	`TJMSStdCostCode` VARCHAR(30) NULL,
	`TJMSAmount` FLOAT NULL DEFAULT '0',
	`TJMSTransfered` SMALLINT NULL DEFAULT '0',
	`TJMSCustomText1` VARCHAR(50) NULL,
	`TJMSCustomText2` VARCHAR(50) NULL,
	`TJMSCustomText3` VARCHAR(50) NULL,
	`TJMSCustomText4` VARCHAR(50) NULL,
	`TJMSCustomText5` VARCHAR(50) NULL,
	`TJMSCustomText6` VARCHAR(50) NULL,
	`TJMSCustomText7` VARCHAR(50) NULL,
	`TJMSCustomText8` VARCHAR(50) NULL,
	`TJMSCustomText9` VARCHAR(50) NULL,
	`TJMSCustomText10` VARCHAR(50) NULL,
	`TJMSCustomValue1` DOUBLE NULL DEFAULT '0',
	`TJMSCustomValue2` DOUBLE NULL DEFAULT '0',
	`TJMSCustomValue3` DOUBLE NULL DEFAULT '0',
	`TJMSCustomValue4` DOUBLE NULL DEFAULT '0',
	`TJMSCustomValue5` DOUBLE NULL DEFAULT '0',
	`TJMSCustomValue6` DOUBLE NULL DEFAULT '0',
	`TJMSCustomValue7` DOUBLE NULL DEFAULT '0',
	`TJMSCustomValue8` DOUBLE NULL DEFAULT '0',
	`TJMSCustomValue9` DOUBLE NULL DEFAULT '0',
	`TJMSCustomValue10` DOUBLE NULL DEFAULT '0',
	`TJMSNote` VARCHAR(255) NULL,
	`TJMSFlag1` SMALLINT NULL,
	`TJMSFlag2` SMALLINT NULL,
	`TJMSFlag3` SMALLINT NULL,
	PRIMARY KEY (`TJMSID`),
	KEY `TIvSSerialNo` (`TJMSSerialNo`),
	KEY `TIvSTInMTInvNo` (`TJMSTJbMTJobNo`),
	KEY `TJMSProductCode` (`TJMSProductCode`),
	KEY `TJMSProductCode1` (`TJMSProductName`),
	KEY `TJMSStdCostCode` (`TJMSStdCostCode`),
	KEY `TJMSTUntCode` (`TJMSTUntCode`),
	KEY `TJMSTUntCode2` (`TJMSTUntCode2`),
	KEY `TJMSTUntCode3` (`TJMSTUntCode3`),
	KEY `TJOMSID` (`TJMSID`),
	KEY `VS4TJobMBVS4TJobMBSerial` (`TJMSTJbMTJobNo`, `TJMSTJbMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobMethod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobMethod`;

# ---------- CREATE TABLE `VS4TJobMethod` ----------

CREATE TABLE `VS4TJobMethod` (
	`TJStTJbMTJobNo` VARCHAR(50) NOT NULL,
	`TJStTJbMLn` INT NOT NULL DEFAULT '0',
	`TJStTSpdStep` INT NOT NULL DEFAULT '0',
	`TJStLn` INT NOT NULL DEFAULT '0',
	`TJStLevel` INT NULL,
	`TJStTSepCode` VARCHAR(30) NULL,
	`TJStWeek` INT NULL DEFAULT '0',
	`TJStMan` DOUBLE NULL DEFAULT '0',
	`TJStMachine` DOUBLE NULL DEFAULT '0',
	`TJStCapacity` DOUBLE NULL DEFAULT '0',
	`TJStHourPerDay` DOUBLE NULL DEFAULT '0',
	`TJStCapacityHour` SMALLINT NULL DEFAULT '0',
	`TJStCapPerHour` DOUBLE NULL DEFAULT '0',
	`TJStCapPerDay` DOUBLE NULL DEFAULT '0',
	`TJStEstimateDay` DOUBLE NULL DEFAULT '0',
	`TJStSetupTime` SMALLINT NULL DEFAULT '0',
	`TJStLeadIn` SMALLINT NULL DEFAULT '0',
	`TJStLeadOut` SMALLINT NULL DEFAULT '0',
	`TJStTime` DOUBLE NULL DEFAULT '0',
	`TJStProductBy` SMALLINT NULL DEFAULT '0',
	`TJStStartDate` DATETIME NULL,
	`TJStEndDate` DATETIME NULL,
	`TJStDependent` SMALLINT NULL DEFAULT '0',
	`TJStTJPDNo` VARCHAR(30) NULL,
	`TJStTPdtCode` VARCHAR(30) NULL,
	`TJStAlternative` SMALLINT NULL DEFAULT '0',
	`TJStQuantity` DOUBLE NULL,
	`TJStFinishQT` DOUBLE NULL,
	`TJStFinishPC` DOUBLE NULL,
	`TJStArrear` DOUBLE NULL,
	`TJStFGPC` DOUBLE NULL DEFAULT '0',
	`TJStProcessStatus` SMALLINT NULL,
	`TJStFlag1` SMALLINT NULL DEFAULT '0',
	`TJStFlag2` SMALLINT NULL DEFAULT '0',
	`TJStFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJStTJbMTJobNo`, `TJStTJbMLn`, `TJStTSpdStep`, `TJStLn`),
	KEY `TJMtTJbMTJobNo` (`TJStTJbMTJobNo`),
	KEY `TJMtTSpdStep` (`TJStTSpdStep`),
	KEY `TJPMTSpdId` (`TJStWeek`),
	KEY `TMtxTSepCode` (`TJStTSepCode`),
	KEY `VS4TJobMBVS4TJobMethod` (`TJStTJbMTJobNo`, `TJStTJbMLn`),
	KEY `VS4TMRPStepNameVS4TJobMethod` (`TJStTSepCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobProdBook` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobProdBook`;

# ---------- CREATE TABLE `VS4TJobProdBook` ----------

CREATE TABLE `VS4TJobProdBook` (
	`TJPkCode` VARCHAR(30) NOT NULL,
	`TJPkName` VARCHAR(200) NULL,
	`TJPkName2` VARCHAR(200) NULL,
	`TJPkDocCode` VARCHAR(30) NULL,
	`TJPkFlag1` SMALLINT NULL DEFAULT '0',
	`TJPkFlag2` SMALLINT NULL DEFAULT '0',
	`TJPkFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJPkCode`),
	KEY `TCmTCode` (`TJPkCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobProdDL` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobProdDL`;

# ---------- CREATE TABLE `VS4TJobProdDL` ----------

CREATE TABLE `VS4TJobProdDL` (
	`TJPLTJPdNo` VARCHAR(30) NOT NULL,
	`TJPLStep` INT NOT NULL DEFAULT '0',
	`TJPLLn` INT NOT NULL DEFAULT '0',
	`TJPLRevision` INT NULL DEFAULT '0',
	`TJPLLevel` INT NULL DEFAULT '0',
	`TJPLTPdtCode` VARCHAR(30) NULL,
	`TJPLTSepCode` VARCHAR(30) NULL,
	`TJPLTEmpCode` VARCHAR(30) NULL,
	`TJPLEmployeeName` VARCHAR(150) NULL,
	`TJPLPositionName` VARCHAR(150) NULL,
	`TJPLStartTime` DOUBLE NULL DEFAULT '1',
	`TJPLEndTime` DOUBLE NULL DEFAULT '1',
	`TJPLQuantityCalc` DOUBLE NULL DEFAULT '1',
	`TJPLQuantity` DOUBLE NULL DEFAULT '1',
	`TJPLMan` SMALLINT NULL DEFAULT '1',
	`TJPLCost` DOUBLE NULL DEFAULT '1',
	`TJPLTotalCost` DOUBLE NULL DEFAULT '1',
	`TJPLRemark` VARCHAR(50) NULL,
	`TJPLFlag1` SMALLINT NULL DEFAULT '0',
	`TJPLFlag2` SMALLINT NULL DEFAULT '0',
	`TJPLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJPLTJPdNo`, `TJPLStep`, `TJPLLn`),
	KEY `TJMtStepName` (`TJPLTPdtCode`),
	KEY `TJMtTFPSCode` (`TJPLTEmpCode`),
	KEY `TJMtTSepCode` (`TJPLTSepCode`),
	KEY `TMteStep` (`TJPLStep`),
	KEY `VS4TJobProductionVS4TJobProdDL` (`TJPLTJPdNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobProdExpDoc` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobProdExpDoc`;

# ---------- CREATE TABLE `VS4TJobProdExpDoc` ----------

CREATE TABLE `VS4TJobProdExpDoc` (
	`TJpeNo` VARCHAR(30) NOT NULL,
	`TJpeDate` DATETIME NULL,
	`TJpeSecCode` VARCHAR(30) NULL,
	`TJpeSectionCode` VARCHAR(30) NULL,
	`TJpeSectionName` VARCHAR(150) NULL,
	`TJpeCheckMode` SMALLINT NULL DEFAULT '0',
	`TJpeRefNo` VARCHAR(15) NULL,
	`TJpeRefDate` DATETIME NULL,
	`TJpeDescription` VARCHAR(150) NULL,
	`TJpeStatus` SMALLINT NULL DEFAULT '0',
	`TJpeCreateCode` VARCHAR(30) NULL,
	`TJpeCreateBy` VARCHAR(140) NULL,
	`TJpeCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJpeEditCode` VARCHAR(30) NULL,
	`TJpeEditBy` VARCHAR(140) NULL,
	`TJpeEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJpeConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TJpeConfirmBy` VARCHAR(140) NULL,
	`TJpeConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJpeApproveStatus` SMALLINT NULL DEFAULT '0',
	`TJpeApproveBy` VARCHAR(140) NULL,
	`TJpeApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJpeApproveNote` VARCHAR(80) NULL,
	`TJpeConfidential` SMALLINT NULL DEFAULT '0',
	`TJpeCancelStatus` SMALLINT NULL DEFAULT '0',
	`TJpeCancelNo` VARCHAR(30) NULL,
	`TJpeCancelBy` VARCHAR(140) NULL,
	`TJpeCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJpeCancelNote` VARCHAR(80) NULL,
	`TJpeFlag1` SMALLINT NULL DEFAULT '0',
	`TJpeFlag2` SMALLINT NULL DEFAULT '0',
	`TJpeFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJpeNo`),
	KEY `TClcSecCode` (`TJpeSecCode`),
	KEY `TClcSectionCode` (`TJpeSectionCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobProdExpMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobProdExpMB`;

# ---------- CREATE TABLE `VS4TJobProdExpMB` ----------

CREATE TABLE `VS4TJobProdExpMB` (
	`TJebTJpeNo` VARCHAR(30) NOT NULL,
	`TJebLn` INT NOT NULL DEFAULT '0',
	`TJebTJPdNo` VARCHAR(30) NULL,
	`TJebRevision` SMALLINT NULL DEFAULT '0',
	`TJebTJobNo` VARCHAR(30) NULL,
	`TJebTJobCode` VARCHAR(30) NULL,
	`TJebTJobLn` INT NULL DEFAULT '0',
	`TJebProductCode` VARCHAR(30) NULL,
	`TJebTSecCode` VARCHAR(30) NULL,
	`TJebSECode` VARCHAR(30) NULL,
	`TJebPG1Code` VARCHAR(30) NULL,
	`TJebARCode` VARCHAR(30) NULL,
	`TJebARName` VARCHAR(30) NULL,
	`TJebTStep` INT NULL DEFAULT '0',
	`TJebTSepCode` VARCHAR(30) NULL,
	`TJebTSepName` VARCHAR(50) NULL,
	`TJebDescription1` VARCHAR(30) NULL,
	`TJebDescription2` VARCHAR(30) NULL,
	`TJebDescription3` VARCHAR(30) NULL,
	`TJebDescription4` VARCHAR(30) NULL,
	`TJebDescription5` VARCHAR(30) NULL,
	`TJebEndDate` DATETIME NULL,
	`TJebPriority` INT NULL DEFAULT '0',
	`TJebQuantity` DOUBLE NULL DEFAULT '0',
	`TJebQuantity2` DOUBLE NULL DEFAULT '0',
	`TJebQuantity3` DOUBLE NULL DEFAULT '0',
	`TJebUntCode` VARCHAR(30) NULL,
	`TJebUntCode2` VARCHAR(30) NULL,
	`TJebUntCode3` VARCHAR(30) NULL,
	`TJebRemark` VARCHAR(150) NULL,
	`TJebFlag1` SMALLINT NULL DEFAULT '0',
	`TJebFlag2` SMALLINT NULL DEFAULT '0',
	`TJebFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJebTJpeNo`, `TJebLn`),
	KEY `TApdTOtlId` (`TJebTJpeNo`),
	KEY `TApdTSepCode` (`TJebTSepCode`),
	KEY `TApdUntCode` (`TJebUntCode`),
	KEY `TApdUntCode1` (`TJebUntCode2`),
	KEY `TApdUntCode2` (`TJebUntCode3`),
	KEY `TJebARCode` (`TJebARCode`),
	KEY `TJebPG1Code` (`TJebPG1Code`),
	KEY `TJebProductCode` (`TJebProductCode`),
	KEY `TJebSECode` (`TJebSECode`),
	KEY `TJebSECode1` (`TJebTSecCode`),
	KEY `VS4TJobProdExpDocVS4TJobProdExpMB` (`TJebTJpeNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobProdMat` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobProdMat`;

# ---------- CREATE TABLE `VS4TJobProdMat` ----------

CREATE TABLE `VS4TJobProdMat` (
	`TMteTJPdNo` VARCHAR(30) NOT NULL,
	`TMteStep` INT NOT NULL DEFAULT '0',
	`TMteLn` INT NOT NULL DEFAULT '0',
	`TMteNo` INT NULL,
	`TMteTJPMLn` INT NULL,
	`TMteLevel` INT NULL,
	`TMteMatType` SMALLINT NULL DEFAULT '0',
	`TMteAlternative` SMALLINT NULL DEFAULT '0',
	`TMteType` SMALLINT NULL DEFAULT '0',
	`TMteTSepCode` VARCHAR(30) NULL,
	`TMteTPdtCode` VARCHAR(30) NULL,
	`TMteProductCode` VARCHAR(30) NULL,
	`TMteProductName` VARCHAR(150) NULL,
	`TMteCustom1` VARCHAR(30) NULL,
	`TMteCustom2` VARCHAR(30) NULL,
	`TMteCustom3` VARCHAR(30) NULL,
	`TMteCustom4` VARCHAR(30) NULL,
	`TMteCustom5` VARCHAR(30) NULL,
	`TMteQuantity` DOUBLE NULL DEFAULT '0',
	`TMteUseStock` DOUBLE NULL DEFAULT '0',
	`TMteUseOrder` DOUBLE NULL DEFAULT '1',
	`TMteTotalUsed` DOUBLE NULL DEFAULT '0',
	`TMteTotalDif` DOUBLE NULL DEFAULT '0',
	`TMteUntCode` VARCHAR(30) NULL,
	`TMteQuantity2` DOUBLE NULL DEFAULT '0',
	`TMteUseStock2` DOUBLE NULL DEFAULT '0',
	`TMteUseOrder2` DOUBLE NULL DEFAULT '1',
	`TMteTotalUsed2` DOUBLE NULL DEFAULT '0',
	`TMteTotalDif2` DOUBLE NULL DEFAULT '0',
	`TMteUntCode2` VARCHAR(30) NULL,
	`TMteQuantity3` DOUBLE NULL DEFAULT '0',
	`TMteUseStock3` DOUBLE NULL DEFAULT '0',
	`TMteUseOrder3` DOUBLE NULL DEFAULT '1',
	`TMteTotalUsed3` DOUBLE NULL DEFAULT '0',
	`TMteTotalDif3` DOUBLE NULL DEFAULT '0',
	`TMteUntCode3` VARCHAR(30) NULL,
	`TMteDescription` VARCHAR(150) NULL,
	`TMtePRStatus` INT NULL DEFAULT '0',
	`TMteFlag1` SMALLINT NULL DEFAULT '0',
	`TMteFlag2` SMALLINT NULL DEFAULT '0',
	`TMteFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMteTJPdNo`, `TMteStep`, `TMteLn`),
	KEY `TJMtTPdtCode` (`TMteTPdtCode`),
	KEY `TJMtTSepCode` (`TMteTSepCode`),
	KEY `TMteStepCode` (`TMteStep`),
	KEY `TMteUntCode` (`TMteUntCode`),
	KEY `TMteUntCode1` (`TMteUntCode2`),
	KEY `TMteUntCode2` (`TMteUntCode3`),
	KEY `VS4TJobProductionVS4TJobProdMat` (`TMteTJPdNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobProduction` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobProduction`;

# ---------- CREATE TABLE `VS4TJobProduction` ----------

CREATE TABLE `VS4TJobProduction` (
	`TJPdNo` VARCHAR(30) NOT NULL,
	`TJPdRevision` INT NULL DEFAULT '0',
	`TJPdTJPkCode` VARCHAR(30) NULL,
	`TJPdStatusOrder` SMALLINT NULL DEFAULT '0',
	`TJPdDate` DATETIME NULL,
	`TJPdRefNo` VARCHAR(30) NULL,
	`TJPdTJbMTJobNo` VARCHAR(30) NULL,
	`TJPdTJbMLn` INT NULL DEFAULT '0',
	`TJPdTJobRevision` SMALLINT NULL DEFAULT '0',
	`TJPdTJobCode` VARCHAR(30) NULL,
	`TJPdTPrjCode` VARCHAR(30) NULL,
	`TJPdTDwgCode` VARCHAR(30) NULL,
	`TJPdProductCode` VARCHAR(30) NULL,
	`TJPdProductName` VARCHAR(150) NULL,
	`TJPdTPSECode` VARCHAR(30) NULL,
	`TJPdTPG1Code` VARCHAR(30) NULL,
	`TJPdCustom1` VARCHAR(30) NULL,
	`TJPdCustom2` VARCHAR(30) NULL,
	`TJPdCustom3` VARCHAR(30) NULL,
	`TJPdCustom4` VARCHAR(30) NULL,
	`TJPdCustom5` VARCHAR(30) NULL,
	`TJPdStartDate` DATETIME NULL,
	`TJPdEndDate` DATETIME NULL,
	`TJPdStartPlan` DATETIME NULL,
	`TJPdEndPlan` DATETIME NULL,
	`TJPdCustomText1` VARCHAR(255) NULL,
	`TJPdCustomText2` VARCHAR(255) NULL,
	`TJPdCustomText3` VARCHAR(255) NULL,
	`TJPdCustomText4` VARCHAR(255) NULL,
	`TJPdCustomText5` VARCHAR(255) NULL,
	`TJPdCustomText6` VARCHAR(255) NULL,
	`TJPdCustomText7` VARCHAR(255) NULL,
	`TJPdCustomText8` VARCHAR(255) NULL,
	`TJPdCustomText9` VARCHAR(255) NULL,
	`TJPdCustomText10` VARCHAR(255) NULL,
	`TJPdCustomText11` VARCHAR(50) NULL,
	`TJPdCustomText12` VARCHAR(50) NULL,
	`TJPdCustomText13` VARCHAR(50) NULL,
	`TJPdCustomText14` VARCHAR(50) NULL,
	`TJPdCustomText15` VARCHAR(50) NULL,
	`TJPdCalsQty` DOUBLE NULL DEFAULT '0',
	`TJPdCalsQty2` DOUBLE NULL DEFAULT '0',
	`TJPdCalsQty3` DOUBLE NULL DEFAULT '0',
	`TJPdUnitCals` VARCHAR(30) NULL,
	`TJPdUnitCals2` VARCHAR(30) NULL,
	`TJPdUnitCals3` VARCHAR(30) NULL,
	`TJPdQtyNeed` DOUBLE NULL DEFAULT '0',
	`TJPdQtyNeedUnit` DOUBLE NULL DEFAULT '0',
	`TJPdQtyNeedMode` SMALLINT NULL DEFAULT '0',
	`TJPdQtyPer` DOUBLE NULL DEFAULT '0',
	`TJPdQtyNum` DOUBLE NULL DEFAULT '0',
	`TJPdQtyHead` DOUBLE NULL DEFAULT '0',
	`TJPdQtyLast` DOUBLE NULL DEFAULT '0',
	`TJPdQuantity` DOUBLE NULL DEFAULT '0',
	`TJPdQuantityNet` DOUBLE NULL DEFAULT '0',
	`TJPdQuantity2` DOUBLE NULL DEFAULT '0',
	`TJPdQuantityNet2` DOUBLE NULL DEFAULT '0',
	`TJPdQuantity3` DOUBLE NULL DEFAULT '0',
	`TJPdQuantityNet3` DOUBLE NULL DEFAULT '0',
	`TJPdPriority` INT NULL DEFAULT '0',
	`TJPdDependent` INT NULL DEFAULT '0',
	`TJPdTotalStep` INT NULL DEFAULT '0',
	`TJPdFGPC` DOUBLE NULL DEFAULT '0',
	`TJPdCheckStatus` SMALLINT NULL DEFAULT '0',
	`TJPdStatusJob` SMALLINT NULL DEFAULT '0',
	`TJPdDescription` VARCHAR(255) NULL,
	`TJPdMaterialUsed` DOUBLE NULL DEFAULT '0',
	`TJPdUnitMatUsed` VARCHAR(30) NULL,
	`TJPdMaterialLost` DOUBLE NULL DEFAULT '0',
	`TJPdEngine` VARCHAR(255) NULL,
	`TJPdTMRFCode` VARCHAR(30) NULL,
	`TJPdFormulaName` VARCHAR(50) NULL,
	`TJPdTMRFCode2` VARCHAR(30) NULL,
	`TJPdFormulaName2` VARCHAR(50) NULL,
	`TJPdCreateCode` VARCHAR(30) NULL,
	`TJPdCreateBy` VARCHAR(140) NULL,
	`TJPdCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJPdEditCode` VARCHAR(30) NULL,
	`TJPdEditBy` VARCHAR(140) NULL,
	`TJPdEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJPdConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TJPdConfirmBy` VARCHAR(140) NULL,
	`TJPdConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJPdApproveStatus` SMALLINT NULL DEFAULT '0',
	`TJPdApproveBy` VARCHAR(140) NULL,
	`TJPdApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJPdApproveNote` VARCHAR(80) NULL,
	`TJPdCancelStatus` SMALLINT NULL DEFAULT '0',
	`TJPdCancelNo` VARCHAR(30) NULL,
	`TJPdCancelBy` VARCHAR(140) NULL,
	`TJPdCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJPdCancelNote` VARCHAR(80) NULL,
	`TJPdFlag1` SMALLINT NULL DEFAULT '0',
	`TJPdFlag2` SMALLINT NULL DEFAULT '0',
	`TJPdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJPdNo`),
	KEY `TJPdFormulaName1` (`TJPdFormulaName2`),
	KEY `TJPdNo` (`TJPdRefNo`),
	KEY `TJPdTDwgCode` (`TJPdTDwgCode`),
	KEY `TJPdTJobCode` (`TJPdTJobCode`),
	KEY `TJPdTJPkCode` (`TJPdTJPkCode`),
	KEY `TOtxTJobCode` (`TJPdProductCode`),
	KEY `TOtxTMtlMinTextile` (`TJPdFormulaName`),
	KEY `VS4TJobProdBookVS4TJobProduction` (`TJPdTJPkCode`),
	KEY `VS4TProjectVS4TJobProduction` (`TJPdTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobProductionM` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobProductionM`;

# ---------- CREATE TABLE `VS4TJobProductionM` ----------

CREATE TABLE `VS4TJobProductionM` (
	`TJPMTJPdNo` VARCHAR(30) NOT NULL,
	`TJPMLn` INT NOT NULL DEFAULT '0',
	`TJPMStep` INT NULL,
	`TJPMLevel` INT NULL,
	`TJPMRevision` INT NULL DEFAULT '0',
	`TJPMTSepCode` VARCHAR(30) NULL,
	`TJPMWeek` INT NULL DEFAULT '0',
	`TJPMMan` DOUBLE NULL DEFAULT '0',
	`TJPMMachine` DOUBLE NULL DEFAULT '0',
	`TJPMCapacity` DOUBLE NULL DEFAULT '0',
	`TJPMHourPerDay` DOUBLE NULL DEFAULT '0',
	`TJPMCapacityHour` SMALLINT NULL DEFAULT '0',
	`TJPMCapPerHour` DOUBLE NULL DEFAULT '0',
	`TJPMCapPerDay` DOUBLE NULL DEFAULT '0',
	`TJPMEstimateDay` DOUBLE NULL DEFAULT '0',
	`TJPMSetupTime` SMALLINT NULL DEFAULT '0',
	`TJPMLeadIn` SMALLINT NULL DEFAULT '0',
	`TJPMLeadOut` SMALLINT NULL DEFAULT '0',
	`TJPMTime` DOUBLE NULL DEFAULT '0',
	`TJPMLink1` VARCHAR(30) NULL,
	`TJPMFormulaCode` VARCHAR(255) NULL,
	`TJPMFormulaName` VARCHAR(255) NULL,
	`TJPMProductBy` SMALLINT NULL DEFAULT '0',
	`TJPMTSecCode` VARCHAR(30) NULL,
	`TJPMTAgtCode` VARCHAR(30) NULL,
	`TJPMEngine` VARCHAR(30) NULL,
	`TJPMPlanStartDate` DATETIME NULL,
	`TJPMPlanEndDate` DATETIME NULL,
	`TJPMStartDate` DATETIME NULL,
	`TJPMEndDate` DATETIME NULL,
	`TJPMDependent` SMALLINT NULL DEFAULT '0',
	`TJPMTAPNCode` VARCHAR(30) NULL,
	`TJPMProcessStatus` SMALLINT NULL DEFAULT '0',
	`TJPMRequest` DOUBLE NULL DEFAULT '0',
	`TJPMRequest2` DOUBLE NULL DEFAULT '0',
	`TJPMRequest3` DOUBLE NULL DEFAULT '0',
	`TJPMArrear` DOUBLE NULL DEFAULT '0',
	`TJPMArrear2` DOUBLE NULL DEFAULT '0',
	`TJPMArrear3` DOUBLE NULL DEFAULT '0',
	`TJPMFinishPC` DOUBLE NULL DEFAULT '0',
	`TJPMFinishQT` DOUBLE NULL DEFAULT '0',
	`TJPMFinishQT2` DOUBLE NULL DEFAULT '0',
	`TJPMFinishQT3` DOUBLE NULL DEFAULT '0',
	`TJPMAmount` DOUBLE NULL DEFAULT '0',
	`TJPMAmount2` DOUBLE NULL DEFAULT '0',
	`TJPMAmount3` DOUBLE NULL DEFAULT '0',
	`TJPMAmountEngine` DOUBLE NULL DEFAULT '0',
	`TJPMAmountEngine2` DOUBLE NULL DEFAULT '0',
	`TJPMAmountEngine3` DOUBLE NULL DEFAULT '0',
	`TJPMAmountNet` DOUBLE NULL DEFAULT '0',
	`TJPMAmountNet2` DOUBLE NULL DEFAULT '0',
	`TJPMAmountNet3` DOUBLE NULL DEFAULT '0',
	`TJPMTotalTrans` DOUBLE NULL DEFAULT '0',
	`TJPMTotalTrans2` DOUBLE NULL DEFAULT '0',
	`TJPMTotalTrans3` DOUBLE NULL DEFAULT '0',
	`TJPMAmountTrans` DOUBLE NULL DEFAULT '0',
	`TJPMAmountTrans2` DOUBLE NULL DEFAULT '0',
	`TJPMAmountTrans3` DOUBLE NULL DEFAULT '0',
	`TJPMLoss` DOUBLE NULL DEFAULT '0',
	`TJPMLoss2` DOUBLE NULL DEFAULT '0',
	`TJPMLoss3` DOUBLE NULL DEFAULT '0',
	`TJPMAmountLost` DOUBLE NULL DEFAULT '0',
	`TJPMTPdtCode` VARCHAR(30) NULL,
	`TJPMAlternative` SMALLINT NULL DEFAULT '0',
	`TJPMQuantity` DOUBLE NULL DEFAULT '0',
	`TJPMDescription` VARCHAR(150) NULL,
	`TJPMDescription1` VARCHAR(150) NULL,
	`TJPMStatus` SMALLINT NULL DEFAULT '0',
	`TJPMCheckTrans` SMALLINT NULL DEFAULT '0',
	`TJPMCheckSemiCode` SMALLINT NULL DEFAULT '0',
	`TJPMCheckClose` SMALLINT NULL DEFAULT '0',
	`TJPMUsed` SMALLINT NULL DEFAULT '0',
	`TJPMAppCode` VARCHAR(30) NULL,
	`TJPMAppName` VARCHAR(160) NULL,
	`TJPMAppDate` DATETIME NULL,
	`TJPMFGPC` DOUBLE NULL DEFAULT '0',
	`TJPMTWRMCode` VARCHAR(30) NULL,
	`TJPMFlag1` SMALLINT NULL DEFAULT '0',
	`TJPMFlag2` SMALLINT NULL DEFAULT '0',
	`TJPMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJPMTJPdNo`, `TJPMLn`),
	KEY `TJPMAppCode` (`TJPMAppCode`),
	KEY `TJPMAppCode1` (`TJPMAppName`),
	KEY `TJPMCheckSemiCode` (`TJPMCheckSemiCode`),
	KEY `TJPMTAgtCode` (`TJPMEngine`),
	KEY `TJPMTSpdId` (`TJPMWeek`),
	KEY `TJPMTUntCode3` (`TJPMTPdtCode`),
	KEY `TJPMTWRMCode` (`TJPMTWRMCode`),
	KEY `TMtxTAgtCode` (`TJPMTAgtCode`),
	KEY `TMtxTOtxNo` (`TJPMTJPdNo`),
	KEY `TMtxTSepCode` (`TJPMTSepCode`),
	KEY `VS4TJobProductionVS4TJobProductionM` (`TJPMTJPdNo`),
	KEY `VS4TMRPStepNameVS4TJobProductionM` (`TJPMTSepCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TJobVariance` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TJobVariance`;

# ---------- CREATE TABLE `VS4TJobVariance` ----------

CREATE TABLE `VS4TJobVariance` (
	`TJVAID` INT NOT NULL DEFAULT '0',
	`TJVATJbMJobNo` VARCHAR(30) NULL,
	`TJVATJbMLn` INT NULL DEFAULT '0',
	`TJVATJPDNo` VARCHAR(30) NULL,
	`TJVATJPMLn` INT NULL DEFAULT '0',
	`TJVARMUCostS` DOUBLE NULL DEFAULT '0',
	`TJVARMUCostA` DOUBLE NULL DEFAULT '0',
	`TJVARMQS` DOUBLE NULL DEFAULT '0',
	`TJVARMQA` DOUBLE NULL DEFAULT '0',
	`TJVARMSTD` DOUBLE NULL DEFAULT '0',
	`TJVARMActual` DOUBLE NULL DEFAULT '0',
	`TJVARMVC` DOUBLE NULL DEFAULT '0',
	`TJVARMVQ` DOUBLE NULL DEFAULT '0',
	`TJVARMV` DOUBLE NULL DEFAULT '0',
	`TJVADLUCostS` DOUBLE NULL DEFAULT '0',
	`TJVADLUCostA` DOUBLE NULL DEFAULT '0',
	`TJVADLQS` DOUBLE NULL DEFAULT '0',
	`TJVADLQA` DOUBLE NULL DEFAULT '0',
	`TJVADLSTD` DOUBLE NULL DEFAULT '0',
	`TJVADLActualGL` DOUBLE NULL DEFAULT '0',
	`TJVADLActualPD` DOUBLE NULL DEFAULT '0',
	`TJVADLVC` DOUBLE NULL DEFAULT '0',
	`TJVADLVQ` DOUBLE NULL DEFAULT '0',
	`TJVADLVPD` DOUBLE NULL DEFAULT '0',
	`TJVADLVGL` DOUBLE NULL DEFAULT '0',
	`TJVADLVGLPD` DOUBLE NULL DEFAULT '0',
	`TJVARMDLActual` DOUBLE NULL DEFAULT '0',
	`TJVAACCCostS` DOUBLE NULL DEFAULT '0',
	`TJVAACCCostA` DOUBLE NULL DEFAULT '0',
	`TJVAACCQS` DOUBLE NULL DEFAULT '0',
	`TJVAACCQA` DOUBLE NULL DEFAULT '0',
	`TJVAACCSTD` DOUBLE NULL DEFAULT '0',
	`TJVAACCActual` DOUBLE NULL DEFAULT '0',
	`TJVAACCVC` DOUBLE NULL DEFAULT '0',
	`TJVAACCVQ` DOUBLE NULL DEFAULT '0',
	`TJVAACCV` DOUBLE NULL DEFAULT '0',
	`TJVAFCS` DOUBLE NULL DEFAULT '0',
	`TJVAMOHS` DOUBLE NULL DEFAULT '0',
	`TJVAOOHS` DOUBLE NULL DEFAULT '0',
	`TJVAOHS` DOUBLE NULL DEFAULT '0',
	`TJVAMOHA` DOUBLE NULL DEFAULT '0',
	`TJVAOOHA` DOUBLE NULL DEFAULT '0',
	`TJVAOHA` DOUBLE NULL DEFAULT '0',
	`TJVAMOHV` DOUBLE NULL DEFAULT '0',
	`TJVAOOHV` DOUBLE NULL DEFAULT '0',
	`TJVAOHV` DOUBLE NULL DEFAULT '0',
	`TJVACost` DOUBLE NULL DEFAULT '0',
	`TJVAAllocate` DOUBLE NULL DEFAULT '0',
	`TJVANewCost` DOUBLE NULL DEFAULT '0',
	`TJVAUnitCost` DOUBLE NULL DEFAULT '0',
	`TJVAAvailInStock` DOUBLE NULL DEFAULT '0',
	`TJVACostAllocate` DOUBLE NULL DEFAULT '0',
	`TJVACreateCode` VARCHAR(30) NULL,
	`TJVACreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJVAEditCode` VARCHAR(30) NULL,
	`TJVAEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TJVAFlag1` SMALLINT NULL DEFAULT '0',
	`TJVAFlag2` SMALLINT NULL DEFAULT '0',
	`TJVAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TJVAID`),
	KEY `TBnkCode` (`TJVATJbMJobNo`),
	KEY `TJbCID` (`TJVAID`),
	KEY `TJbCTJobNo` (`TJVATJbMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TKBase` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TKBase`;

# ---------- CREATE TABLE `VS4TKBase` ----------

CREATE TABLE `VS4TKBase` (
	`TKBsNo` VARCHAR(30) NOT NULL,
	`TKBsLn` INT NOT NULL DEFAULT '0',
	`TKBsMode` SMALLINT NULL DEFAULT '0',
	`TKBsTKBGCode` VARCHAR(30) NULL,
	`TKBsPostBy` VARCHAR(160) NULL,
	`TKBsDateTime` DATETIME NULL,
	`TKBsReplyEmail` VARCHAR(50) NULL,
	`TKBsTitle` VARCHAR(255) NULL,
	`TKBsMessage` TEXT NULL,
	`TKBsSpecialist` VARCHAR(160) NULL,
	`TKBsFileLink` VARCHAR(100) NULL,
	`TKBsFlag1` SMALLINT NULL DEFAULT '0',
	`TKBsFlag2` SMALLINT NULL DEFAULT '0',
	`TKBsFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TKBsNo`, `TKBsLn`),
	KEY `TFAQID` (`TKBsLn`),
	KEY `TFAQType` (`TKBsMode`),
	KEY `TKBsPostBy` (`TKBsSpecialist`),
	KEY `TKBsSpecialist` (`TKBsFileLink`),
	KEY `TNewTEmpCode` (`TKBsPostBy`),
	KEY `VS4TKBaseGroupVS4TKBase` (`TKBsTKBGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TKBaseGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TKBaseGroup`;

# ---------- CREATE TABLE `VS4TKBaseGroup` ----------

CREATE TABLE `VS4TKBaseGroup` (
	`TKBGCode` VARCHAR(30) NOT NULL,
	`TKBGName` VARCHAR(100) NULL,
	`TKBGName2` VARCHAR(100) NULL,
	`TKBGKeyWord` VARCHAR(255) NULL,
	`TKBGFlag1` SMALLINT NULL DEFAULT '0',
	`TKBGFlag2` SMALLINT NULL DEFAULT '0',
	`TKBGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TKBGCode`),
	KEY `TCmTCode` (`TKBGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TLeaveContact` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TLeaveContact`;

# ---------- CREATE TABLE `VS4TLeaveContact` ----------

CREATE TABLE `VS4TLeaveContact` (
	`TLCoOffense` VARCHAR(50) NOT NULL,
	`TLCoBreak` VARCHAR(50) NULL,
	`TLCoNumber` INT NULL DEFAULT '0',
	`TLCoFlag1` INT NULL DEFAULT '0',
	`TLCoFlag2` INT NULL DEFAULT '0',
	`TLCoFlag3` INT NULL DEFAULT '0',
	PRIMARY KEY (`TLCoOffense`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TLocation` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TLocation`;

# ---------- CREATE TABLE `VS4TLocation` ----------

CREATE TABLE `VS4TLocation` (
	`TLctCode` VARCHAR(30) NOT NULL,
	`TLctName` VARCHAR(50) NULL,
	`TLctName2` VARCHAR(50) NULL,
	`TLctTWahCode` VARCHAR(30) NULL,
	`TLctTBraCode` VARCHAR(30) NULL,
	`TLctDayAlert` SMALLINT NULL,
	`TLctDayMove` SMALLINT NULL,
	`TLctWeight` DOUBLE NULL,
	`TLctWeightUsed` DOUBLE NULL,
	`TLctWeightAval` DOUBLE NULL,
	`TLctVolume` DOUBLE NULL,
	`TLctVolumeUsed` DOUBLE NULL,
	`TLctVolumeAval` DOUBLE NULL,
	`TLctFlag1` SMALLINT NULL,
	`TLctFlag2` SMALLINT NULL,
	`TLctFlag3` SMALLINT NULL,
	PRIMARY KEY (`TLctCode`),
	KEY `TLctTBraCode` (`TLctTBraCode`),
	KEY `TLctTwahCode` (`TLctTWahCode`),
	KEY `TShfCode` (`TLctCode`),
	KEY `VS4TBranchVS4TLocation` (`TLctTBraCode`),
	KEY `VS4TWarehouseVS4TLocation` (`TLctTWahCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TLocationMap` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TLocationMap`;

# ---------- CREATE TABLE `VS4TLocationMap` ----------

CREATE TABLE `VS4TLocationMap` (
	`TLcMCode` VARCHAR(30) NOT NULL,
	`TLcMName` VARCHAR(100) NULL,
	`TLcMName2` VARCHAR(100) NULL,
	`TLcMTRomCode` VARCHAR(30) NULL,
	`TLcMTLctCode` VARCHAR(30) NULL,
	`TLcMDayAlert` SMALLINT NULL,
	`TLcMDayMove` SMALLINT NULL,
	`TLcMDimension` VARCHAR(100) NULL,
	`TLcMMaxPallet` INT NULL,
	`TLcMisLocation` SMALLINT NULL,
	`TLcMFlag1` SMALLINT NULL,
	`TLcMFlag2` SMALLINT NULL,
	`TLcMFlag3` SMALLINT NULL,
	PRIMARY KEY (`TLcMCode`),
	KEY `TLcMTWahCode` (`TLcMTRomCode`),
	KEY `TShfCode` (`TLcMTLctCode`),
	KEY `TWhMTLctCode` (`TLcMCode`),
	KEY `VS4TLocationRoomVS4TLocationMap` (`TLcMTRomCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TLocationRoom` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TLocationRoom`;

# ---------- CREATE TABLE `VS4TLocationRoom` ----------

CREATE TABLE `VS4TLocationRoom` (
	`TRomCode` VARCHAR(30) NOT NULL,
	`TRomTBraCode` VARCHAR(30) NULL,
	`TRomTWahCode` VARCHAR(30) NULL,
	`TRomName` VARCHAR(50) NULL,
	`TRomName2` VARCHAR(50) NULL,
	`TRomFlag1` SMALLINT NULL,
	`TRomFlag2` SMALLINT NULL,
	`TRomFlag3` SMALLINT NULL,
	PRIMARY KEY (`TRomCode`),
	KEY `TLcMTBraCode` (`TRomTBraCode`),
	KEY `TLcMTWahCode` (`TRomTWahCode`),
	KEY `TShfCode` (`TRomCode`),
	KEY `VS4TBranchVS4TLocationRoom` (`TRomTBraCode`),
	KEY `VS4TWarehouseVS4TLocationRoom` (`TRomTWahCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMDS` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMDS`;

# ---------- CREATE TABLE `VS4TMDS` ----------

CREATE TABLE `VS4TMDS` (
	`TMDNNo` VARCHAR(30) NOT NULL,
	`TMDNDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMDNRefNo` VARCHAR(30) NULL,
	`TMDNRefDate` DATETIME NULL,
	`TMDNDescription` VARCHAR(200) NULL,
	`TMDNCreateCode` VARCHAR(30) NULL,
	`TMDNCreateBy` VARCHAR(140) NULL,
	`TMDNCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMDNEditCode` VARCHAR(30) NULL,
	`TMDNEditBy` VARCHAR(140) NULL,
	`TMDNEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMDNConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TMDNConfirmBy` VARCHAR(140) NULL,
	`TMDNConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMDNApproveStatus` SMALLINT NULL DEFAULT '0',
	`TMDNApproveBy` VARCHAR(140) NULL,
	`TMDNApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMDNApproveNote` VARCHAR(80) NULL,
	`TMDNRevision` SMALLINT NULL DEFAULT '0',
	`TMDNCancelStatus` SMALLINT NULL DEFAULT '0',
	`TMDNCancelNo` VARCHAR(30) NULL,
	`TMDNCancelBy` VARCHAR(140) NULL,
	`TMDNCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMDNCancelNote` VARCHAR(80) NULL,
	`TMDNFlag1` SMALLINT NULL DEFAULT '0',
	`TMDNFlag2` SMALLINT NULL DEFAULT '0',
	`TMDNFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMDNNo`),
	KEY `TJobRefDate` (`TMDNRefDate`),
	KEY `TMtxTOtxNo` (`TMDNNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMDSMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMDSMB`;

# ---------- CREATE TABLE `VS4TMDSMB` ----------

CREATE TABLE `VS4TMDSMB` (
	`TMDMTMDNNo` VARCHAR(30) NOT NULL,
	`TMDMLn` INT NOT NULL DEFAULT '0',
	`TMDMRevision` INT NULL DEFAULT '0',
	`TMDMPriority` SMALLINT NULL DEFAULT '0',
	`TMDMTMDSTSOBTSODNo` VARCHAR(30) NULL,
	`TMDMTMDSTSOBLn` INT NULL DEFAULT '0',
	`TMDMTMDSLn` INT NULL DEFAULT '0',
	`TMDMVehicleNo` VARCHAR(30) NULL,
	`TMDMDeliveryType` SMALLINT NULL DEFAULT '0',
	`TMDMTRouCode` VARCHAR(30) NULL,
	`TMDMTShpCode` VARCHAR(30) NULL,
	`TMDMTAssCode` VARCHAR(30) NULL,
	`TMDMTime` INT NULL DEFAULT '0',
	`TMDMES` DATETIME NULL,
	`TMDMLS` DATETIME NULL,
	`TMDMEF` DATETIME NULL,
	`TMDMLF` DATETIME NULL,
	`TMDMDepedStep` INT NULL DEFAULT '0',
	`TMDMStartDate` DATETIME NULL,
	`TMDMEndDate` DATETIME NULL,
	`TMDMPlanStartDate` DATETIME NULL,
	`TMDMPlanEndDate` DATETIME NULL,
	`TMDMQuantity` DOUBLE NULL DEFAULT '0',
	`TMDMQuantity2` DOUBLE NULL DEFAULT '0',
	`TMDMQuantity3` DOUBLE NULL DEFAULT '0',
	`TMDMTotalRequest` DOUBLE NULL DEFAULT '0',
	`TMDMTotalRequest2` DOUBLE NULL DEFAULT '0',
	`TMDMTotalRequest3` DOUBLE NULL DEFAULT '0',
	`TMDMTotalArrear` DOUBLE NULL DEFAULT '0',
	`TMDMTotalArrear2` DOUBLE NULL DEFAULT '0',
	`TMDMTotalArrear3` DOUBLE NULL DEFAULT '0',
	`TMDMFinishPCBill` DOUBLE NULL DEFAULT '0',
	`TMDMFinishPCOrder` DOUBLE NULL DEFAULT '0',
	`TMDMFinishPC` DOUBLE NULL DEFAULT '0',
	`TMDMFinishQT` DOUBLE NULL DEFAULT '0',
	`TMDMFinishQT2` DOUBLE NULL DEFAULT '0',
	`TMDMFinishQT3` DOUBLE NULL DEFAULT '0',
	`TMDMTotalLoss` DOUBLE NULL DEFAULT '0',
	`TMDMTotalLoss2` DOUBLE NULL DEFAULT '0',
	`TMDMTotalLoss3` DOUBLE NULL DEFAULT '0',
	`TMDMFlag1` SMALLINT NULL DEFAULT '0',
	`TMDMFlag2` SMALLINT NULL DEFAULT '0',
	`TMDMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMDMTMDNNo`, `TMDMLn`),
	KEY `TJBPTJobNo` (`TMDMTMDSTSOBLn`),
	KEY `TMDMTSOBTSODNo` (`TMDMTMDSTSOBTSODNo`),
	KEY `TMtxTOtxNo` (`TMDMTMDNNo`),
	KEY `TMtxTSepCode` (`TMDMTMDSLn`),
	KEY `TPdyTAssCode` (`TMDMTAssCode`),
	KEY `TPdyTRouCode` (`TMDMTRouCode`),
	KEY `TPdyTShpCode` (`TMDMTShpCode`),
	KEY `TPdyVehicleNo` (`TMDMVehicleNo`),
	KEY `VS4TMDSVS4TMDSMB` (`TMDMTMDNNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMedia` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMedia`;

# ---------- CREATE TABLE `VS4TMedia` ----------

CREATE TABLE `VS4TMedia` (
	`TMedCode` VARCHAR(30) NOT NULL,
	`TMedName` VARCHAR(200) NULL,
	`TMedName2` VARCHAR(200) NULL,
	`TMedDescription` VARCHAR(255) NULL,
	`TMedFlag1` SMALLINT NULL DEFAULT '0',
	`TMedFlag2` SMALLINT NULL DEFAULT '0',
	`TMedFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMedCode`),
	KEY `TCmTCode` (`TMedCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMember` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMember`;

# ---------- CREATE TABLE `VS4TMember` ----------

CREATE TABLE `VS4TMember` (
	`TMbrCode` VARCHAR(30) NOT NULL,
	`TMbrTMbTAlias` VARCHAR(30) NULL,
	`TMbrName` VARCHAR(100) NULL,
	`TMbrName2` VARCHAR(100) NULL,
	`TMbrStartDate` DATETIME NULL,
	`TMbrEndDate` DATETIME NULL,
	`TMbrFlag1` SMALLINT NULL DEFAULT '0',
	`TMbrFlag2` SMALLINT NULL DEFAULT '0',
	`TMbrFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMbrCode`),
	KEY `TMbGCode` (`TMbrCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMemberCard` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMemberCard`;

# ---------- CREATE TABLE `VS4TMemberCard` ----------

CREATE TABLE `VS4TMemberCard` (
	`TMCDCode` VARCHAR(15) NOT NULL,
	`TMCDName` VARCHAR(100) NULL,
	`TMCDName2` VARCHAR(100) NULL,
	`TMCDFlag1` SMALLINT NULL DEFAULT '0',
	`TMCDFlag2` SMALLINT NULL DEFAULT '0',
	`TMCDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMCDCode`),
	KEY `TIQGCode` (`TMCDCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMemberGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMemberGroup`;

# ---------- CREATE TABLE `VS4TMemberGroup` ----------

CREATE TABLE `VS4TMemberGroup` (
	`TMbGCode` VARCHAR(30) NOT NULL,
	`TMbGName` VARCHAR(100) NULL,
	`TMbGName2` VARCHAR(100) NULL,
	`TMbGFlag1` SMALLINT NULL DEFAULT '0',
	`TMbGFlag2` SMALLINT NULL DEFAULT '0',
	`TMbGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMbGCode`),
	KEY `TMbGCode` (`TMbGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMemberGroupMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMemberGroupMB`;

# ---------- CREATE TABLE `VS4TMemberGroupMB` ----------

CREATE TABLE `VS4TMemberGroupMB` (
	`TMMBTMbGCode` VARCHAR(30) NOT NULL,
	`TMMBTMbrCode` VARCHAR(30) NOT NULL,
	`TMMBFlag1` SMALLINT NULL DEFAULT '0',
	`TMMBFlag2` SMALLINT NULL DEFAULT '0',
	`TMMBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMMBTMbrCode`, `TMMBTMbGCode`),
	KEY `MemberGroupID` (`TMMBTMbGCode`),
	KEY `MemberUserID` (`TMMBTMbrCode`),
	KEY `VS4TMemberGroupVS4TMemberGroupMB` (`TMMBTMbGCode`),
	KEY `VS4TMemberVS4TMemberGroupMB` (`TMMBTMbrCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMessage` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMessage`;

# ---------- CREATE TABLE `VS4TMessage` ----------

CREATE TABLE `VS4TMessage` (
	`TMsgID` INT NOT NULL DEFAULT '0',
	`TMsgType` INT NULL DEFAULT '0',
	`TMsgDescription` VARCHAR(50) NULL,
	`TMsgTCmdAlias` VARCHAR(30) NULL,
	`TMsgTUsrID` INT NULL DEFAULT '0',
	`TMsgFlag1` SMALLINT NULL DEFAULT '0',
	`TMsgFlag2` SMALLINT NULL DEFAULT '0',
	`TMsgFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMsgID`),
	KEY `TMsgID` (`TMsgID`),
	KEY `TMsgUserID` (`TMsgTUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TModuleCommand` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TModuleCommand`;

# ---------- CREATE TABLE `VS4TModuleCommand` ----------

CREATE TABLE `VS4TModuleCommand` (
	`TMdCTCmGAlias` VARCHAR(30) NOT NULL,
	`TMdCTCmdID` INT NOT NULL DEFAULT '0',
	`TMdCSort` INT NULL DEFAULT '0',
	`TMdCFlag1` SMALLINT NULL DEFAULT '0',
	`TMdCFlag2` SMALLINT NULL DEFAULT '0',
	`TMdCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMdCTCmGAlias`, `TMdCTCmdID`),
	KEY `TUsCTCmdID` (`TMdCTCmdID`),
	KEY `TUsCTUsrID` (`TMdCTCmGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TModulePermiss` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TModulePermiss`;

# ---------- CREATE TABLE `VS4TModulePermiss` ----------

CREATE TABLE `VS4TModulePermiss` (
	`TMdPTCmGAlias` VARCHAR(30) NOT NULL,
	`TMdPIDType` VARCHAR(1) NOT NULL,
	`TMdPID` INT NOT NULL DEFAULT '0',
	`TMdPFlag1` SMALLINT NULL DEFAULT '0',
	`TMdPFlag2` SMALLINT NULL DEFAULT '0',
	`TMdPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMdPTCmGAlias`, `TMdPID`, `TMdPIDType`),
	KEY `SubCommandCommandID` (`TMdPTCmGAlias`),
	KEY `TPerTUserTypeID` (`TMdPID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMPR` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMPR`;

# ---------- CREATE TABLE `VS4TMPR` ----------

CREATE TABLE `VS4TMPR` (
	`TMPRNo` VARCHAR(30) NOT NULL,
	`TMPRDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMPRRefNo` VARCHAR(30) NULL,
	`TMPRRefDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMPRJobCode` VARCHAR(30) NULL,
	`TMPRTJobNo` VARCHAR(30) NULL,
	`TMPRTJbMLn` INT NULL DEFAULT '0',
	`TMPRTJPMLn` INT NULL DEFAULT '0',
	`TMPRTJPDNo` VARCHAR(30) NULL,
	`TMPRTPrjCode` VARCHAR(30) NULL,
	`TMPRTSecCode` VARCHAR(30) NULL,
	`TMPRTDepCode` VARCHAR(30) NULL,
	`TMPRTDivCode` VARCHAR(30) NULL,
	`TMPRTBraCode` VARCHAR(30) NULL,
	`TMPRDescription` VARCHAR(200) NULL,
	`TMPRRequestCode` VARCHAR(30) NULL,
	`TMPRRequestBy` VARCHAR(140) NULL,
	`TMPRCreateCode` VARCHAR(30) NULL,
	`TMPRCreateBy` VARCHAR(140) NULL,
	`TMPRCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMPREditCode` VARCHAR(30) NULL,
	`TMPREditBy` VARCHAR(140) NULL,
	`TMPREditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMPRConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TMPRConfirmBy` VARCHAR(140) NULL,
	`TMPRConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMPRApproveStatus` SMALLINT NULL DEFAULT '0',
	`TMPRApproveBy` VARCHAR(140) NULL,
	`TMPRApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMPRApproveNote` VARCHAR(80) NULL,
	`TMPRRevision` SMALLINT NULL DEFAULT '0',
	`TMPRReviseStatus` SMALLINT NULL DEFAULT '0',
	`TMPRCancelStatus` SMALLINT NULL DEFAULT '0',
	`TMPRCancelNo` VARCHAR(30) NULL,
	`TMPRCancelBy` VARCHAR(140) NULL,
	`TMPRCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TMPRCancelNote` VARCHAR(80) NULL,
	`TMPRFlag1` SMALLINT NULL DEFAULT '0',
	`TMPRFlag2` SMALLINT NULL DEFAULT '0',
	`TMPRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMPRNo`),
	UNIQUE KEY `TMPRNo` (`TMPRNo`),
	KEY `TMPRTBraCode` (`TMPRTBraCode`),
	KEY `TMPRTDivCode` (`TMPRTDivCode`),
	KEY `VS4TBranchVS4TMPR` (`TMPRTBraCode`),
	KEY `VS4TDivisionVS4TMPR` (`TMPRTDivCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMPRMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMPRMB`;

# ---------- CREATE TABLE `VS4TMPRMB` ----------

CREATE TABLE `VS4TMPRMB` (
	`TMPMTMPRNo` VARCHAR(30) NOT NULL,
	`TMPMLn` INT NOT NULL DEFAULT '0',
	`TMPMTPstCode` VARCHAR(30) NULL,
	`TMPMPositionCode` VARCHAR(30) NULL,
	`TMPMPositionName` VARCHAR(80) NULL,
	`TMPMRequestDate` DATETIME NULL,
	`TMPMSex` SMALLINT NULL,
	`TMPMTotal` TINYINT NULL,
	`TMPMGet` SMALLINT NULL,
	`TMPMMore` SMALLINT NULL,
	`TMPMStatus` SMALLINT NULL,
	`TMPMNote` VARCHAR(255) NULL,
	`TMPMFlag1` SMALLINT NULL DEFAULT '0',
	`TMPMFlag2` SMALLINT NULL DEFAULT '0',
	`TMPMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMPMTMPRNo`, `TMPMLn`),
	KEY `TMPMTPstCode` (`TMPMTPstCode`),
	KEY `VS4TMPRVS4TMPRMB` (`TMPMTMPRNo`),
	KEY `VS4TPositionVS4TMPRMB` (`TMPMTPstCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMPS` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMPS`;

# ---------- CREATE TABLE `VS4TMPS` ----------

CREATE TABLE `VS4TMPS` (
	`TMPSNo` VARCHAR(30) NOT NULL,
	`TMPSTJStTJbMTJobNo` VARCHAR(30) NULL,
	`TMPSTJStTJbMLn` INT NULL DEFAULT '0',
	`TMPSTJStLevel` SMALLINT NULL,
	`TMPSTJStTSpdStep` INT NULL DEFAULT '0',
	`TMPSTJStLn` INT NULL DEFAULT '0',
	`TMPSTJPDNo` VARCHAR(30) NULL,
	`TMPSTJPMLn` INT NULL DEFAULT '0',
	`TMPSPriority` SMALLINT NULL DEFAULT '0',
	`TMPSTSecCode` VARCHAR(30) NULL,
	`TMPSTBraCode` VARCHAR(30) NULL,
	`TMPSHour` DOUBLE NULL DEFAULT '0',
	`TMPSES` DATETIME NULL,
	`TMPSLS` DATETIME NULL,
	`TMPSEF` DATETIME NULL,
	`TMPSLF` DATETIME NULL,
	`TMPSTMPSNo` VARCHAR(30) NULL,
	`TMPSStartDate` DATETIME NULL,
	`TMPSEndDate` DATETIME NULL,
	`TMPSYear` INT NULL,
	`TMPSWeek` INT NULL,
	`TMPSDate` DATETIME NULL,
	`TMPSReserveType` VARCHAR(10) NULL,
	`TMPSNote` VARCHAR(30) NULL,
	`TMPSStatus` SMALLINT NULL DEFAULT '0',
	`TMPSFlag1` SMALLINT NULL DEFAULT '0',
	`TMPSFlag2` SMALLINT NULL DEFAULT '0',
	`TMPSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMPSNo`),
	KEY `TMPSNo` (`TMPSNo`),
	KEY `TMPSTBraCode` (`TMPSTBraCode`),
	KEY `TMPSTJStTJbMTJobNo` (`TMPSTJStTJbMTJobNo`),
	KEY `TMPSTJStTSpdStep` (`TMPSTJStTSpdStep`),
	KEY `TMPSTSecCode` (`TMPSTSecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMRPFormula` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMRPFormula`;

# ---------- CREATE TABLE `VS4TMRPFormula` ----------

CREATE TABLE `VS4TMRPFormula` (
	`TMRFID` INT NOT NULL DEFAULT '0',
	`TMRFTMRGCode` VARCHAR(30) NULL,
	`TMRFTAgtCode` VARCHAR(30) NULL,
	`TMRFTPdtCode` VARCHAR(30) NULL,
	`TMRFCode` VARCHAR(30) NULL,
	`TMRFName` VARCHAR(50) NULL,
	`TMRFRemark` VARCHAR(255) NULL,
	`TMRFTMRSCode` VARCHAR(100) NULL,
	`TMRFText1` VARCHAR(50) NULL,
	`TMRFText2` VARCHAR(50) NULL,
	`TMRFText3` VARCHAR(50) NULL,
	`TMRFText4` VARCHAR(50) NULL,
	`TMRFText5` VARCHAR(50) NULL,
	`TMRFText6` VARCHAR(50) NULL,
	`TMRFText7` VARCHAR(50) NULL,
	`TMRFText8` VARCHAR(50) NULL,
	`TMRFText9` VARCHAR(50) NULL,
	`TMRFText10` VARCHAR(50) NULL,
	`TMRFFlag1` SMALLINT NULL DEFAULT '0',
	`TMRFFlag2` SMALLINT NULL DEFAULT '0',
	`TMRFFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMRFID`),
	KEY `TMRFTMGGCode` (`TMRFTMRSCode`),
	KEY `VS4TAssetWorkGroupVS4TMRPFormula` (`TMRFTAgtCode`),
	KEY `VS4TMRPFormulaGroupVS4TMRPFormula` (`TMRFTMRGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMRPFormulaGrp` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMRPFormulaGrp`;

# ---------- CREATE TABLE `VS4TMRPFormulaGrp` ----------

CREATE TABLE `VS4TMRPFormulaGrp` (
	`TMRGCode` VARCHAR(30) NOT NULL,
	`TMRGName` VARCHAR(100) NULL,
	`TMRGName2` VARCHAR(100) NULL,
	`TMRGField1` VARCHAR(50) NULL,
	`TMRGField2` VARCHAR(50) NULL,
	`TMRGField3` VARCHAR(50) NULL,
	`TMRGField4` VARCHAR(50) NULL,
	`TMRGField5` VARCHAR(50) NULL,
	`TMRGField6` VARCHAR(50) NULL,
	`TMRGField7` VARCHAR(50) NULL,
	`TMRGField8` VARCHAR(50) NULL,
	`TMRGField9` VARCHAR(50) NULL,
	`TMRGField10` VARCHAR(50) NULL,
	`TMRGUseSet` SMALLINT NULL DEFAULT '0',
	`TMRGFlag1` SMALLINT NULL DEFAULT '0',
	`TMRGFlag2` SMALLINT NULL DEFAULT '0',
	`TMRGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMRGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMRPFormulaSet` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMRPFormulaSet`;

# ---------- CREATE TABLE `VS4TMRPFormulaSet` ----------

CREATE TABLE `VS4TMRPFormulaSet` (
	`TMRSTMRGCode` VARCHAR(30) NOT NULL,
	`TMRSCode` VARCHAR(100) NOT NULL,
	`TMRSName` VARCHAR(150) NULL,
	`TMRSName2` VARCHAR(150) NULL,
	`TMRSFlag1` SMALLINT NULL DEFAULT '0',
	`TMRSFlag2` SMALLINT NULL DEFAULT '0',
	`TMRSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMRSTMRGCode`, `TMRSCode`),
	KEY `TMRFTMGGCode` (`TMRSCode`),
	KEY `TMRSCode` (`TMRSName`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TMRPStepName` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TMRPStepName`;

# ---------- CREATE TABLE `VS4TMRPStepName` ----------

CREATE TABLE `VS4TMRPStepName` (
	`TSepCode` VARCHAR(30) NOT NULL,
	`TSepName` VARCHAR(50) NULL,
	`TSepDocCode` VARCHAR(30) NULL,
	`TSepTSecCode` VARCHAR(30) NULL,
	`TSepTLctCode` VARCHAR(30) NULL,
	`TSepDescription` VARCHAR(255) NULL,
	`TSepTAPNCode` VARCHAR(30) NULL,
	`TSepCalcQtyAuto` SMALLINT NULL DEFAULT '0',
	`TSepCheckSemiCode` SMALLINT NULL DEFAULT '0',
	`TSepQAStatus` SMALLINT NULL,
	`TSepByPassStock` SMALLINT NULL,
	`TSepTextSort` VARCHAR(30) NULL,
	`TSepFlag1` SMALLINT NULL DEFAULT '0',
	`TSepFlag2` SMALLINT NULL DEFAULT '0',
	`TSepFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSepCode`),
	KEY `TSepCheckSemiCode` (`TSepCheckSemiCode`),
	KEY `TSepCode` (`TSepCode`),
	KEY `TSepTAPNCode` (`TSepTAPNCode`),
	KEY `VS4TSectionVS4TMRPStepName` (`TSepTSecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TNational` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TNational`;

# ---------- CREATE TABLE `VS4TNational` ----------

CREATE TABLE `VS4TNational` (
	`TNalCode` VARCHAR(30) NOT NULL,
	`TNalName` VARCHAR(50) NULL,
	`TNalName2` VARCHAR(50) NULL,
	`TNalLanguage` VARCHAR(50) NULL,
	`TNalFlag1` SMALLINT NULL DEFAULT '0',
	`TNalFlag2` SMALLINT NULL DEFAULT '0',
	`TNalFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TNalCode`),
	KEY `TNalCode` (`TNalCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TNews` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TNews`;

# ---------- CREATE TABLE `VS4TNews` ----------

CREATE TABLE `VS4TNews` (
	`TNewNo` VARCHAR(30) NOT NULL,
	`TNewMode` SMALLINT NULL DEFAULT '0',
	`TNewDate` DATETIME NULL,
	`TNewDateTime` DATETIME NULL,
	`TNewPostBy` VARCHAR(160) NULL,
	`TNewTitle` VARCHAR(150) NULL,
	`TNewMessage` TEXT NULL,
	`TNewFlag1` SMALLINT NULL DEFAULT '0',
	`TNewFlag2` SMALLINT NULL DEFAULT '0',
	`TNewFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TNewNo`),
	KEY `TNewTEmpCode` (`TNewPostBy`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TOpportunity` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TOpportunity`;

# ---------- CREATE TABLE `VS4TOpportunity` ----------

CREATE TABLE `VS4TOpportunity` (
	`TOTNTARNCode` VARCHAR(30) NOT NULL,
	`TOTNLn` INT NOT NULL,
	`TOTNType` SMALLINT NULL,
	`TOTNDescription` VARCHAR(255) NULL,
	`TOTNTPdtCode` VARCHAR(30) NULL,
	`TOTNTARSAlias` VARCHAR(255) NULL,
	`TOTNProspectDate` DATETIME NULL,
	`TOTNFirstQuoteDate` DATETIME NULL,
	`TOTNFirstOrderDate` DATETIME NULL,
	`TOTNOrderStatus` SMALLINT NULL,
	`TOTNJobDate` DATETIME NULL,
	`TOTNJobCloseDate` DATETIME NULL,
	`TOTNActiveDate` DATETIME NULL,
	`TOTNFlag1` SMALLINT NULL,
	`TOTNFlag2` SMALLINT NULL,
	`TOTNFlag3` SMALLINT NULL,
	PRIMARY KEY (`TOTNTARNCode`, `TOTNLn`),
	KEY `TOTNCode` (`TOTNTARNCode`),
	KEY `TOTNTPdtCode` (`TOTNTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TOtherExpense` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TOtherExpense`;

# ---------- CREATE TABLE `VS4TOtherExpense` ----------

CREATE TABLE `VS4TOtherExpense` (
	`TOExCode` VARCHAR(30) NOT NULL,
	`TOExName` VARCHAR(100) NULL,
	`TOExName2` VARCHAR(100) NULL,
	`TOExTACCCode` VARCHAR(30) NULL,
	`TOExFlag1` SMALLINT NULL DEFAULT '0',
	`TOExFlag2` SMALLINT NULL DEFAULT '0',
	`TOExFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TOExCode`),
	KEY `TExpCode` (`TOExCode`),
	KEY `TExpTACCCode` (`TOExTACCCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TOtherIncome` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TOtherIncome`;

# ---------- CREATE TABLE `VS4TOtherIncome` ----------

CREATE TABLE `VS4TOtherIncome` (
	`TOInCode` VARCHAR(30) NOT NULL,
	`TOInName` VARCHAR(100) NULL,
	`TOInName2` VARCHAR(100) NULL,
	`TOInTACCCode` VARCHAR(30) NULL,
	`TOInFlag1` SMALLINT NULL DEFAULT '0',
	`TOInFlag2` SMALLINT NULL DEFAULT '0',
	`TOInFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TOInCode`),
	KEY `TExpCode` (`TOInCode`),
	KEY `TExpTACCCode` (`TOInTACCCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPA` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPA`;

# ---------- CREATE TABLE `VS4TPA` ----------

CREATE TABLE `VS4TPA` (
	`TPADNo` VARCHAR(30) NOT NULL,
	`TPADTPABCode` VARCHAR(30) NULL,
	`TPADDate` DATETIME NULL,
	`TPADSubject` VARCHAR(100) NULL,
	`TPADRefNo` VARCHAR(30) NULL,
	`TPADRefDate` DATETIME NULL,
	`TPADTPrjCode` VARCHAR(30) NULL,
	`TPADTJobNo` VARCHAR(30) NULL,
	`TPADTJbMLn` INT NULL DEFAULT '0',
	`TPADTSecCode` VARCHAR(30) NULL,
	`TPADTDepCode` VARCHAR(30) NULL,
	`TPADTDivCode` VARCHAR(30) NULL,
	`TPADTBraCode` VARCHAR(30) NULL,
	`TPADTaxBase` FLOAT NULL DEFAULT '0',
	`TPADVATTotal` FLOAT NULL,
	`TPADDescription` VARCHAR(255) NULL,
	`TPADCreateCode` VARCHAR(30) NULL,
	`TPADCreateBy` VARCHAR(140) NULL,
	`TPADCreateDate` DATETIME NULL,
	`TPADEditCode` VARCHAR(30) NULL,
	`TPADEditBy` VARCHAR(140) NULL,
	`TPADEditDate` DATETIME NULL,
	`TPADConfirmStatus` SMALLINT NULL,
	`TPADConfirmBy` VARCHAR(140) NULL,
	`TPADConfirmDate` DATETIME NULL,
	`TPADApproveStatus` SMALLINT NULL,
	`TPADApproveBy` VARCHAR(140) NULL,
	`TPADApproveDate` DATETIME NULL,
	`TPADApproveNote` VARCHAR(80) NULL,
	`TPADRevision` SMALLINT NULL,
	`TPADCancelStatus` SMALLINT NULL,
	`TPADCancelNo` VARCHAR(30) NULL,
	`TPADCancelBy` VARCHAR(140) NULL,
	`TPADCancelDate` DATETIME NULL,
	`TPADCancelNote` VARCHAR(80) NULL,
	`TPADFlag1` SMALLINT NULL,
	`TPADFlag2` SMALLINT NULL,
	`TPADFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPADNo`),
	KEY `TPADTDepCode` (`TPADDescription`),
	KEY `TPCNTJbMLn` (`TPADTJbMLn`),
	KEY `TPODTDepCode` (`TPADTDepCode`),
	KEY `TPODTDivCode` (`TPADTDivCode`),
	KEY `TPODTJobNo` (`TPADTJobNo`),
	KEY `TPODTPrjCode` (`TPADTPrjCode`),
	KEY `TPRDTBraCode` (`TPADTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPackingList` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPackingList`;

# ---------- CREATE TABLE `VS4TPackingList` ----------

CREATE TABLE `VS4TPackingList` (
	`TPKLNo` VARCHAR(30) NOT NULL,
	`TPKLDate` DATETIME NULL,
	`TPKLRefNo` VARCHAR(30) NULL,
	`TPKLRefDate` DATETIME NULL,
	`TPKLRefNo2` VARCHAR(30) NULL,
	`TPKLTPrjCode` VARCHAR(30) NULL,
	`TPKLTBraCode` VARCHAR(30) NULL,
	`TPKLTARNCode` VARCHAR(30) NULL,
	`TPKLTShpCode` VARCHAR(30) NULL,
	`TPKLDeliveryCond` SMALLINT NULL,
	`TPKLDeliveryTerm` DOUBLE NULL,
	`TPKLContainerNo` VARCHAR(30) NULL,
	`TPKLShipBy` VARCHAR(30) NULL,
	`TPKLTotalQuantity` DOUBLE NULL,
	`TPKLTotalCarton` DOUBLE NULL,
	`TPKLTotalNW` DOUBLE NULL,
	`TPKLTotalGW` DOUBLE NULL,
	`TPKLTotalVolumeM` DOUBLE NULL,
	`TPKLGrandTotal` FLOAT NULL,
	`TPKLGrandTotalReal` FLOAT NULL,
	`TPKLDescription` VARCHAR(255) NULL,
	`TPKLCreateCode` VARCHAR(30) NULL,
	`TPKLCreateBy` VARCHAR(140) NULL,
	`TPKLCreateDate` DATETIME NULL,
	`TPKLEditCode` VARCHAR(30) NULL,
	`TPKLEditBy` VARCHAR(140) NULL,
	`TPKLEditDate` DATETIME NULL,
	`TPKLConfirmStatus` SMALLINT NULL,
	`TPKLConfirmBy` VARCHAR(140) NULL,
	`TPKLConfirmDate` DATETIME NULL,
	`TPKLApproveStatus` SMALLINT NULL,
	`TPKLApproveBy` VARCHAR(140) NULL,
	`TPKLApproveDate` DATETIME NULL,
	`TPKLApproveNote` VARCHAR(80) NULL,
	`TPKLRevision` SMALLINT NULL,
	`TPKLCancelStatus` SMALLINT NULL,
	`TPKLCancelNo` VARCHAR(30) NULL,
	`TPKLCancelBy` VARCHAR(140) NULL,
	`TPKLCancelDate` DATETIME NULL,
	`TPKLCancelNote` VARCHAR(80) NULL,
	`TPKLFlag1` SMALLINT NULL,
	`TPKLFlag2` SMALLINT NULL,
	`TPKLFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPKLNo`),
	KEY `TAPQTCmpCode` (`TPKLTARNCode`),
	KEY `TIvoTPrjCode` (`TPKLTPrjCode`),
	KEY `TPKLTARNCode` (`TPKLTShpCode`),
	KEY `TPKLTPrjCode` (`TPKLContainerNo`),
	KEY `TPRDTBraCode` (`TPKLTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPackingListMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPackingListMB`;

# ---------- CREATE TABLE `VS4TPackingListMB` ----------

CREATE TABLE `VS4TPackingListMB` (
	`TPKMTPKLNo` VARCHAR(30) NOT NULL,
	`TPKMLn` INT NOT NULL DEFAULT '0',
	`TPKMTPOSCode` VARCHAR(50) NULL,
	`TPKMPOSName` VARCHAR(150) NULL,
	`TPKMQuantity` DOUBLE NULL DEFAULT '0',
	`TPKMTUntCode` VARCHAR(15) NULL,
	`TPKMKindOfPack` VARCHAR(15) NULL,
	`TPKMPerQuantity` DOUBLE NULL DEFAULT '0',
	`TPKMPcsPerCarton` DOUBLE NULL DEFAULT '0',
	`TPKMTotalCarton` DOUBLE NULL DEFAULT '0',
	`TPKMCartonNo` VARCHAR(30) NULL,
	`TPKMToCartonNo` VARCHAR(30) NULL,
	`TPKMWidth` DOUBLE NULL DEFAULT '0',
	`TPKMLength` DOUBLE NULL DEFAULT '0',
	`TPKMHeight` DOUBLE NULL DEFAULT '0',
	`TPKMVolume` DOUBLE NULL DEFAULT '0',
	`TPKMNW` DOUBLE NULL DEFAULT '0',
	`TPKMGW` DOUBLE NULL DEFAULT '0',
	`TPKMVolumeM` DOUBLE NULL DEFAULT '0',
	`TPKMTotalNW` DOUBLE NULL DEFAULT '0',
	`TPKMTotalGW` DOUBLE NULL DEFAULT '0',
	`TPKMTotalVolumeM` DOUBLE NULL DEFAULT '0',
	`TPKMPrice` FLOAT NULL DEFAULT '0',
	`TPKMAmount` FLOAT NULL DEFAULT '0',
	`TPKMRealPrice` FLOAT NULL DEFAULT '0',
	`TPKMRealAmount` FLOAT NULL DEFAULT '0',
	`TPKMRealDate` DATETIME NULL,
	`TPKMSourceNo` VARCHAR(30) NULL,
	`TPKMSourceLn` INT NULL DEFAULT '0',
	`TPKMContainerNo` VARCHAR(30) NULL,
	`TPKMContainerSize` SMALLINT NULL,
	`TPKMContainerLCL` SMALLINT NULL,
	`TPKMFlag1` SMALLINT NULL DEFAULT '0',
	`TPKMFlag2` SMALLINT NULL DEFAULT '0',
	`TPKMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPKMLn`, `TPKMTPKLNo`),
	KEY `TPKMLn` (`TPKMSourceLn`),
	KEY `TPKMToHSCode` (`TPKMCartonNo`),
	KEY `TPKMToHSCode1` (`TPKMToCartonNo`),
	KEY `TPKMTPKLNo` (`TPKMSourceNo`),
	KEY `TPOBTPdtCode` (`TPKMTPOSCode`),
	KEY `TPWBID` (`TPKMLn`),
	KEY `TPWBTUntCode` (`TPKMTUntCode`),
	KEY `TTfMID` (`TPKMTPKLNo`),
	KEY `VS4TPackingListVS4TPackingListMB` (`TPKMTPKLNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPallet` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPallet`;

# ---------- CREATE TABLE `VS4TPallet` ----------

CREATE TABLE `VS4TPallet` (
	`TPltCode` VARCHAR(30) NOT NULL,
	`TPltName` VARCHAR(50) NULL,
	`TPltTBraCode` VARCHAR(30) NULL,
	`TPltWeight` DOUBLE NULL,
	`TPltWidth` DOUBLE NULL,
	`TPltLength` DOUBLE NULL,
	`TPltHeight` DOUBLE NULL,
	`TPltFlag1` SMALLINT NULL,
	`TPltFlag2` SMALLINT NULL,
	`TPltFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPltCode`),
	KEY `TPltTBraCode` (`TPltTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPAMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPAMB`;

# ---------- CREATE TABLE `VS4TPAMB` ----------

CREATE TABLE `VS4TPAMB` (
	`TPAMTPADNo` VARCHAR(30) NOT NULL,
	`TPAMTPSDNo` VARCHAR(30) NOT NULL,
	`TPAMLn` INT NOT NULL DEFAULT '0',
	`TPAMDescription` VARCHAR(250) NULL,
	`TPAMImage1` VARCHAR(50) NULL,
	`TPAMImage2` VARCHAR(50) NULL,
	`TPAMImage3` VARCHAR(50) NULL,
	`TPAMImage4` VARCHAR(50) NULL,
	`TPAMFlag1` SMALLINT NULL DEFAULT '0',
	`TPAMFlag2` SMALLINT NULL DEFAULT '0',
	`TPAMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPAMTPADNo`, `TPAMTPSDNo`, `TPAMLn`),
	KEY `TPWBID` (`TPAMLn`),
	KEY `TQSBTQuoNo` (`TPAMTPSDNo`),
	KEY `TTfMID` (`TPAMTPADNo`),
	KEY `VS4TPAVS4TPAMB` (`TPAMTPADNo`),
	KEY `VS4TPSVS4TPAMB` (`TPAMTPSDNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TParameter` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TParameter`;

# ---------- CREATE TABLE `VS4TParameter` ----------

CREATE TABLE `VS4TParameter` (
	`TParTCmGAlias` VARCHAR(30) NOT NULL,
	`TParAlias` VARCHAR(30) NOT NULL,
	`TParName` VARCHAR(50) NULL,
	`TParName2` VARCHAR(50) NULL,
	`TParShell` VARCHAR(100) NULL,
	`TParSort` INT NULL DEFAULT '0',
	`TParFlag1` SMALLINT NULL DEFAULT '0',
	`TParFlag2` SMALLINT NULL DEFAULT '0',
	`TParFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TParTCmGAlias`, `TParAlias`),
	KEY `TParAlias` (`TParAlias`),
	KEY `TParTCmGAlias` (`TParTCmGAlias`),
	KEY `VS4TCommandGroupVS4TParameter` (`TParTCmGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPayment` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPayment`;

# ---------- CREATE TABLE `VS4TPayment` ----------

CREATE TABLE `VS4TPayment` (
	`TPymCode` VARCHAR(15) NOT NULL,
	`TPymHotChar` VARCHAR(3) NULL,
	`TPymName` VARCHAR(25) NULL,
	`TPymTPyTAlias` VARCHAR(15) NULL,
	`TPymTCurCode` VARCHAR(5) NULL,
	`TPymChargePC` DOUBLE NULL,
	`TPymFee` FLOAT NULL,
	`TPymDescription` VARCHAR(150) NULL,
	`TPymStartDate` DATETIME NULL,
	`TPymEndDate` DATETIME NULL,
	`TPymFlag1` SMALLINT NULL,
	`TPymFlag2` SMALLINT NULL,
	`TPymFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPymCode`),
	KEY `TPymTCurCode` (`TPymTCurCode`),
	KEY `VS4TCurrencyVS4TPayment` (`TPymTCurCode`),
	KEY `VS4TPaymentTypeVS4TPayment` (`TPymTPyTAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPaymentType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPaymentType`;

# ---------- CREATE TABLE `VS4TPaymentType` ----------

CREATE TABLE `VS4TPaymentType` (
	`TPyTAlias` VARCHAR(15) NOT NULL,
	`TPyTName` VARCHAR(25) NULL,
	`TPyTName2` VARCHAR(25) NULL,
	`TPyTGroupSum` SMALLINT NULL DEFAULT '0',
	`TPyTDescription` VARCHAR(50) NULL,
	`TPyTTaccCode` VARCHAR(30) NULL,
	`TPyTTaccCode2` VARCHAR(30) NULL,
	`TPyTFlag1` SMALLINT NULL,
	`TPyTFlag2` SMALLINT NULL,
	`TPyTFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPyTAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPayPeriodType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPayPeriodType`;

# ---------- CREATE TABLE `VS4TPayPeriodType` ----------

CREATE TABLE `VS4TPayPeriodType` (
	`TPPTCode` VARCHAR(30) NOT NULL,
	`TPPTName` VARCHAR(100) NULL,
	`TPPTName2` VARCHAR(100) NULL,
	`TPPTFlag1` SMALLINT NULL DEFAULT '0',
	`TPPTFlag2` SMALLINT NULL DEFAULT '0',
	`TPPTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPPTCode`),
	KEY `TBnkCode` (`TPPTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPCR` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPCR`;

# ---------- CREATE TABLE `VS4TPCR` ----------

CREATE TABLE `VS4TPCR` (
	`TPCRNo` VARCHAR(30) NOT NULL,
	`TPCRDate` DATETIME NULL,
	`TPCRRefNo` VARCHAR(30) NULL,
	`TPCRRefDate` DATETIME NULL,
	`TPCRFromDate` DATETIME NULL,
	`TPCRToDate` DATETIME NULL,
	`TPCRTBraCode` VARCHAR(30) NULL,
	`TPCRTPrjCode` VARCHAR(30) NULL,
	`TPCRTAPNCode` VARCHAR(30) NULL,
	`TPCRTAPUCode` VARCHAR(30) NULL,
	`TPCRSupplierName` VARCHAR(200) NULL,
	`TPCRPaymentStatus` INT NULL DEFAULT '0',
	`TPCRTEmpCode` VARCHAR(30) NULL,
	`TPCRTotalQuantity` DOUBLE NULL,
	`TPCRTotalSale` FLOAT NULL,
	`TPCRTotalVAT` FLOAT NULL,
	`TPCRTotalAmount` FLOAT NULL,
	`TPCRDescription` VARCHAR(255) NULL,
	`TPCRCreateCode` VARCHAR(30) NULL,
	`TPCRCreateBy` VARCHAR(140) NULL,
	`TPCRCreateDate` DATETIME NULL,
	`TPCREditCode` VARCHAR(30) NULL,
	`TPCREditBy` VARCHAR(140) NULL,
	`TPCREditDate` DATETIME NULL,
	`TPCRConfirmStatus` SMALLINT NULL,
	`TPCRConfirmBy` VARCHAR(140) NULL,
	`TPCRConfirmDate` DATETIME NULL,
	`TPCRApproveStatus` SMALLINT NULL,
	`TPCRApproveBy` VARCHAR(140) NULL,
	`TPCRApproveDate` DATETIME NULL,
	`TPCRApproveNote` VARCHAR(80) NULL,
	`TPCRRevision` SMALLINT NULL,
	`TPCRCancelStatus` SMALLINT NULL,
	`TPCRCancelNo` VARCHAR(30) NULL,
	`TPCRCancelBy` VARCHAR(140) NULL,
	`TPCRCancelDate` DATETIME NULL,
	`TPCRCancelNote` VARCHAR(80) NULL,
	`TPCRFlag1` SMALLINT NULL,
	`TPCRFlag2` SMALLINT NULL,
	`TPCRFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPCRNo`),
	KEY `TCBTTBraCode` (`TPCRTBraCode`),
	KEY `TCBTTPrjCode` (`TPCRTPrjCode`),
	KEY `TPdyTEmpCode` (`TPCRTEmpCode`),
	KEY `TPWOTCmpCode` (`TPCRSupplierName`),
	KEY `VS4TAPVS4TPCR` (`TPCRTAPNCode`),
	KEY `VS4TProjectVS4TPCR` (`TPCRTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPCRMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPCRMB`;

# ---------- CREATE TABLE `VS4TPCRMB` ----------

CREATE TABLE `VS4TPCRMB` (
	`TPMBTPCRNo` VARCHAR(30) NOT NULL,
	`TPMBLn` INT NOT NULL DEFAULT '0',
	`TPMBIsSale` SMALLINT NULL DEFAULT '0',
	`TPMBTBraCode` VARCHAR(50) NULL,
	`TPMBDocType` SMALLINT NULL DEFAULT '0',
	`TPMBDocNo` VARCHAR(50) NULL,
	`TPMBDocLn` INT NULL DEFAULT '0',
	`TPMBDocDate` DATETIME NULL,
	`TPMBTARNCode` VARCHAR(30) NULL,
	`TPMBTARDCode` VARCHAR(30) NULL,
	`TPMBCustomerName` VARCHAR(200) NULL,
	`TPMBTPOSCode` VARCHAR(30) NULL,
	`TPMBPOSName` VARCHAR(150) NULL,
	`TPMBSaleQuantity` DOUBLE NULL,
	`TPMBTUntCode` VARCHAR(10) NULL,
	`TPMBInvoiceStatus` INT NULL DEFAULT '0',
	`TPMBPurDocType` SMALLINT NULL DEFAULT '0',
	`TPMBPurDocNo` VARCHAR(50) NULL,
	`TPMBPurDocLn` INT NULL DEFAULT '0',
	`TPMBPurDocDate` DATETIME NULL,
	`TPMBTAPNCode` VARCHAR(30) NULL,
	`TPMBTAPUCode` VARCHAR(30) NULL,
	`TPMBTPdtCode` VARCHAR(30) NULL,
	`TPMBFactoryCode` VARCHAR(50) NULL,
	`TPMBProductName` VARCHAR(150) NULL,
	`TPMBLotNo` VARCHAR(30) NULL,
	`TPMBLotDate` DATETIME NULL,
	`TPMBSerialNo` VARCHAR(30) NULL,
	`TPMBUnitPerSet` DOUBLE NULL,
	`TPMBLOTQuantity` DOUBLE NULL,
	`TPMBQuantity` DOUBLE NULL,
	`TPMBIsPremium` SMALLINT NULL,
	`TPMBPrice` FLOAT NULL,
	`TPMBPerQuantity` DOUBLE NULL,
	`TPMBAmount` FLOAT NULL,
	`TPMBDiscountText` VARCHAR(255) NULL,
	`TPMBDiscountTotal` FLOAT NULL,
	`TPMBNetAmount` FLOAT NULL,
	`TPMBTaxType` DOUBLE NULL,
	`TPMBVATAmount` FLOAT NULL,
	`TPMBGrandTotal` FLOAT NULL,
	`TPMBTotalDaySale` INT NULL,
	`TPMBTotalDayPCR` INT NULL,
	`TPMBDescription` VARCHAR(150) NULL,
	`TPMBFlag1` SMALLINT NULL DEFAULT '0',
	`TPMBFlag2` SMALLINT NULL DEFAULT '0',
	`TPMBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPMBLn`, `TPMBTPCRNo`),
	KEY `VS4TPCRVS4TPCRMB` (`TPMBTPCRNo`),
	KEY `VS4TPOSVS4TPCRMB` (`TPMBTPOSCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPlace` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPlace`;

# ---------- CREATE TABLE `VS4TPlace` ----------

CREATE TABLE `VS4TPlace` (
	`TPlaID` INT NOT NULL DEFAULT '0',
	`TPlaType` VARCHAR(30) NULL,
	`TPlaName` VARCHAR(200) NULL,
	`TPlaFlag1` SMALLINT NULL DEFAULT '0',
	`TPlaFlag2` SMALLINT NULL DEFAULT '0',
	`TPlaFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPlaID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPO` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPO`;

# ---------- CREATE TABLE `VS4TPO` ----------

CREATE TABLE `VS4TPO` (
	`TPODNo` VARCHAR(30) NOT NULL,
	`TPODTPOkCode` VARCHAR(30) NULL,
	`TPODTPCACode` VARCHAR(30) NULL,
	`TPODMode` SMALLINT NULL DEFAULT '0',
	`TPODDOArrears` SMALLINT NULL DEFAULT '0',
	`TPODType` SMALLINT NULL DEFAULT '0',
	`TPODDate` DATETIME NULL,
	`TPODDueDate` DATETIME NULL,
	`TPODLoadingDate` DATETIME NULL,
	`TPODStartAgingDate` DATETIME NULL,
	`TPODRefNo` VARCHAR(30) NULL,
	`TPODRefDate` DATETIME NULL,
	`TPODRefNo2` VARCHAR(30) NULL,
	`TPODAPBODeposit` INT NULL DEFAULT '0',
	`TPODTJobNo` VARCHAR(30) NULL,
	`TPODTJbMLn` INT NULL DEFAULT '0',
	`TPODTPrjCode` VARCHAR(30) NULL,
	`TPODTBraCode` VARCHAR(30) NULL,
	`TPODDeliveryDate` DATETIME NULL,
	`TPODDeliveryTo` VARCHAR(255) NULL,
	`TPODTAPNCode` VARCHAR(30) NULL,
	`TPODTAPUCode` VARCHAR(30) NULL,
	`TPODContactNote` VARCHAR(50) NULL,
	`TPODContactName` VARCHAR(160) NULL,
	`TPODSupplierName` VARCHAR(200) NULL,
	`TPODSupAddress` VARCHAR(255) NULL,
	`TPODConsignee` VARCHAR(255) NULL,
	`TPODNotifyParty` VARCHAR(255) NULL,
	`TPODPriceChannel` SMALLINT NULL DEFAULT '0',
	`TPODChannelName` VARCHAR(30) NULL,
	`TPODDiscountList` FLOAT NULL,
	`TPODSubTotal` FLOAT NULL,
	`TPODDiscountText` VARCHAR(30) NULL,
	`TPODDiscountTotal` FLOAT NULL,
	`TPODNetTotal` FLOAT NULL DEFAULT '0',
	`TPODDepositText` VARCHAR(30) NULL,
	`TPODDeposit` FLOAT NULL DEFAULT '0',
	`TPODTotal` FLOAT NULL,
	`TPODTotalFOB` FLOAT NULL,
	`TPODTCurCode` VARCHAR(5) NULL,
	`TPODExchangeRate` FLOAT NULL DEFAULT '0',
	`TPODTotalInRate` FLOAT NULL,
	`TPODVATType` SMALLINT NULL DEFAULT '0',
	`TPODVATRate` DOUBLE NULL,
	`TPODTaxBase` FLOAT NULL DEFAULT '0',
	`TPODVATTotal` FLOAT NULL,
	`TPODGrandTotal` FLOAT NULL,
	`TPODNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TPODWTaxBase` FLOAT NULL DEFAULT '0',
	`TPODWTaxRate` DOUBLE NULL DEFAULT '0',
	`TPODWTaxTotal` FLOAT NULL DEFAULT '0',
	`TPODNetPayment` FLOAT NULL,
	`TPODAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPODPremiumTotal` FLOAT NULL,
	`TPODBaseIncoType` VARCHAR(3) NULL,
	`TPODIncoType` VARCHAR(3) NULL,
	`TPODIncoterms` VARCHAR(50) NULL,
	`TPODOtherFee` FLOAT NULL DEFAULT '0',
	`TPODTransportFee` FLOAT NULL DEFAULT '0',
	`TPODHandlingFee` FLOAT NULL DEFAULT '0',
	`TPODFreightFee` FLOAT NULL DEFAULT '0',
	`TPODInsurance` FLOAT NULL DEFAULT '0',
	`TPODTransportDesc` FLOAT NULL,
	`TPODDuty` FLOAT NULL,
	`TPODShipBy` VARCHAR(255) NULL,
	`TPODCountryOrigin` VARCHAR(50) NULL,
	`TPODDestination` VARCHAR(255) NULL,
	`TPODCondition` VARCHAR(100) NULL,
	`TPODConditionType` SMALLINT NULL,
	`TPODConditionDay` SMALLINT NULL DEFAULT '0',
	`TPODCondition1` DOUBLE NULL DEFAULT '0',
	`TPODConditionDay1` SMALLINT NULL DEFAULT '0',
	`TPODPaymentNote` VARCHAR(200) NULL,
	`TPODStatementNote` VARCHAR(200) NULL,
	`TPODTShpCode` VARCHAR(30) NULL,
	`TPODDeliveryNote` VARCHAR(200) NULL,
	`TPODPackingNote` VARCHAR(200) NULL,
	`TPODDayAvailable` SMALLINT NULL,
	`TPODDescription` VARCHAR(255) NULL,
	`TPODCustom1` VARCHAR(30) NULL,
	`TPODCustom2` VARCHAR(30) NULL,
	`TPODCustom3` VARCHAR(30) NULL,
	`TPODCustom4` VARCHAR(255) NULL,
	`TPODCustom5` VARCHAR(255) NULL,
	`TPODTInvNo` VARCHAR(30) NULL,
	`TPODTPOTCode` VARCHAR(30) NULL,
	`TPODLinkStatus` SMALLINT NULL,
	`TPODInvoiceStatus` SMALLINT NULL DEFAULT '0',
	`TPODDeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TPODFinishDate` DATETIME NULL,
	`TPODCreateBy` VARCHAR(140) NULL,
	`TPODCreateDate` DATETIME NULL,
	`TPODEditCode` VARCHAR(30) NULL,
	`TPODEditBy` VARCHAR(140) NULL,
	`TPODEditDate` DATETIME NULL,
	`TPODConfirmStatus` SMALLINT NULL,
	`TPODConfirmBy` VARCHAR(140) NULL,
	`TPODConfirmDate` DATETIME NULL,
	`TPODApproveStatus` SMALLINT NULL,
	`TPODApproveBy` VARCHAR(140) NULL,
	`TPODApproveDate` DATETIME NULL,
	`TPODApproveNote` VARCHAR(80) NULL,
	`TPODRevision` SMALLINT NULL,
	`TPODReviseStatus` SMALLINT NULL DEFAULT '0',
	`TPODCancelStatus` SMALLINT NULL,
	`TPODCancelBy` VARCHAR(140) NULL,
	`TPODCancelDate` DATETIME NULL,
	`TPODCancelNote` VARCHAR(80) NULL,
	`TPODFlag1` SMALLINT NULL,
	`TPODFlag2` SMALLINT NULL,
	`TPODFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPODNo`),
	KEY `TAPQTCmpCode` (`TPODTAPNCode`),
	KEY `TIAPTShpCode` (`TPODTShpCode`),
	KEY `TPCNTAPUCode` (`TPODTAPUCode`),
	KEY `TPCNTJbMLn` (`TPODTJbMLn`),
	KEY `TPODTAPNCode` (`TPODContactNote`),
	KEY `TPODTBokCode` (`TPODTPOkCode`),
	KEY `TPODTBokCode1` (`TPODDOArrears`),
	KEY `TPODTPPYCode` (`TPODTPOTCode`),
	KEY `TPRDTBraCode` (`TPODTBraCode`),
	KEY `TPRDTJobCode` (`TPODTJobNo`),
	KEY `TPRDTPrjCode` (`TPODTPrjCode`),
	KEY `TPSDTPCACode` (`TPODTPCACode`),
	KEY `TPWOSupplierName` (`TPODSupAddress`),
	KEY `TPWOTCmpCode` (`TPODSupplierName`),
	KEY `TSODTCurCode` (`TPODTCurCode`),
	KEY `VS4TAPCampaignVS4TPO` (`TPODTPCACode`),
	KEY `VS4TAPVS4TPO` (`TPODTAPNCode`),
	KEY `VS4TPOBookVS4TPO` (`TPODTPOkCode`),
	KEY `VS4TProjectVS4TPO` (`TPODTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOBook` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOBook`;

# ---------- CREATE TABLE `VS4TPOBook` ----------

CREATE TABLE `VS4TPOBook` (
	`TPOKCode` VARCHAR(30) NOT NULL,
	`TPOKName` VARCHAR(140) NULL,
	`TPOKName2` VARCHAR(140) NULL,
	`TPOKDocCode` VARCHAR(30) NULL,
	`TPOKFlag1` SMALLINT NULL DEFAULT '0',
	`TPOKFlag2` SMALLINT NULL DEFAULT '0',
	`TPOKFlag3` SMALLINT NULL DEFAULT '0',
	UNIQUE KEY `TPOKCode` (`TPOKCode`),
	KEY `Index_B0D14894_767D_4A78` (`TPOKCode`),
	KEY `TPRBCode` (`TPOKDocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPODelivery` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPODelivery`;

# ---------- CREATE TABLE `VS4TPODelivery` ----------

CREATE TABLE `VS4TPODelivery` (
	`TPDETPOBTPODNo` VARCHAR(30) NOT NULL,
	`TPDETPOBLn` INT NOT NULL DEFAULT '0',
	`TPDELn` INT NOT NULL DEFAULT '0',
	`TPDEProductCode` VARCHAR(30) NULL,
	`TPDEProductName` VARCHAR(255) NULL,
	`TPDECustom1` VARCHAR(30) NULL,
	`TPDECustom2` VARCHAR(150) NULL,
	`TPDECustom3` VARCHAR(150) NULL,
	`TPDECustom4` VARCHAR(150) NULL,
	`TPDECustom5` VARCHAR(150) NULL,
	`TPDEDate` DATETIME NULL,
	`TPDEDateTime` DATETIME NULL,
	`TPDEQuantity` DOUBLE NULL DEFAULT '0',
	`TPDEQuantity2` DOUBLE NULL DEFAULT '0',
	`TPDEQuantity3` DOUBLE NULL DEFAULT '0',
	`TPDEUnitCode` VARCHAR(15) NULL,
	`TPDEUnitCode2` VARCHAR(15) NULL,
	`TPDEUnitCode3` VARCHAR(15) NULL,
	`TPDETotalDelivery` DOUBLE NULL DEFAULT '0',
	`TPDETotalDelivery2` DOUBLE NULL DEFAULT '0',
	`TPDETotalDelivery3` DOUBLE NULL DEFAULT '0',
	`TPDETotalArrear` DOUBLE NULL DEFAULT '0',
	`TPDETotalArrear2` DOUBLE NULL DEFAULT '0',
	`TPDETotalArrear3` DOUBLE NULL DEFAULT '0',
	`TPDEUnitCalc` SMALLINT NULL DEFAULT '0',
	`TPDEMapTPdtCode` VARCHAR(30) NULL,
	`TPDEMapTUntCode` VARCHAR(50) NULL,
	`TPDEMapUnitRatio` DOUBLE NULL DEFAULT '0',
	`TPDEQuantityBase` DOUBLE NULL DEFAULT '0',
	`TPDEDeliveryBase` DOUBLE NULL DEFAULT '0',
	`TPDEArrearBase` DOUBLE NULL DEFAULT '0',
	`TPDELinkStatus` SMALLINT NULL,
	`TPDELinkBy` VARCHAR(140) NULL,
	`TPDELinkDate` DATETIME NULL,
	`TPDETotalOntime` DOUBLE NULL DEFAULT '0',
	`TPDETotalDelay` DOUBLE NULL DEFAULT '0',
	`TPDETLctCode` VARCHAR(30) NULL,
	`TPDEFlag1` SMALLINT NULL DEFAULT '0',
	`TPDEFlag2` SMALLINT NULL DEFAULT '0',
	`TPDEFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPDETPOBTPODNo`, `TPDETPOBLn`, `TPDELn`),
	KEY `TPOBMapTPdtCode` (`TPDEMapTPdtCode`),
	KEY `TPOBMapTUntCode` (`TPDEMapTUntCode`),
	KEY `TPOLProductCode` (`TPDEProductCode`),
	KEY `TPOLUnitCode` (`TPDEUnitCode`),
	KEY `TPOLUnitCode2` (`TPDEUnitCode2`),
	KEY `TPOLUnitCode3` (`TPDEUnitCode3`),
	KEY `TPWBID` (`TPDETPOBLn`),
	KEY `TSOBTLctCode` (`TPDETLctCode`),
	KEY `TTfMID` (`TPDETPOBTPODNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOMB`;

# ---------- CREATE TABLE `VS4TPOMB` ----------

CREATE TABLE `VS4TPOMB` (
	`TPOBTPODNo` VARCHAR(30) NOT NULL,
	`TPOBLn` INT NOT NULL DEFAULT '0',
	`TPOBType` SMALLINT NULL DEFAULT '0',
	`TPOBJobCode` VARCHAR(30) NULL,
	`TPOBGroupName` VARCHAR(50) NULL,
	`TPOBTOExCode` VARCHAR(50) NULL,
	`TPOBTPdtCode` VARCHAR(50) NULL,
	`TPOBCustom1` VARCHAR(30) NULL,
	`TPOBCustom2` VARCHAR(150) NULL,
	`TPOBCustom3` VARCHAR(150) NULL,
	`TPOBCustom4` VARCHAR(150) NULL,
	`TPOBCustom5` VARCHAR(150) NULL,
	`TPOBShippingMark` VARCHAR(255) NULL,
	`TPOBProductCode` VARCHAR(50) NULL,
	`TPOBFactoryCode` VARCHAR(50) NULL,
	`TPOBProductName` VARCHAR(255) NULL,
	`TPOBUseBom` SMALLINT NULL DEFAULT '0',
	`TPOBDeliveryDate` DATETIME NULL,
	`TPOBDeliveryTime` DATETIME NULL,
	`TPOBMinimumOrder` DOUBLE NULL DEFAULT '0',
	`TPOBCost` FLOAT NULL DEFAULT '0',
	`TPOBPrice` FLOAT NULL DEFAULT '0',
	`TPOBPerQuantity` DOUBLE NULL DEFAULT '1',
	`TPOBUnitFactor` DOUBLE NULL DEFAULT '0',
	`TPOBAcceptError` VARCHAR(30) NULL,
	`TPOBUnitCalc` SMALLINT NULL DEFAULT '0',
	`TPOBQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TPOBQuantityText` VARCHAR(255) NULL,
	`TPOBQuantity` DOUBLE NULL DEFAULT '0',
	`TPOBTUntCode` VARCHAR(50) NULL,
	`TPOBQuantity2` DOUBLE NULL DEFAULT '0',
	`TPOBTUntCode2` VARCHAR(50) NULL,
	`TPOBQuantity3` DOUBLE NULL DEFAULT '0',
	`TPOBTUntCode3` VARCHAR(50) NULL,
	`TPOBDutyAmount` FLOAT NULL DEFAULT '0',
	`TPOBDivideExpense` FLOAT NULL DEFAULT '0',
	`TPOBCostAmount` FLOAT NULL DEFAULT '0',
	`TPOBAmount` FLOAT NULL DEFAULT '0',
	`TPOBDiscountText` VARCHAR(30) NULL,
	`TPOBDiscountTotal` FLOAT NULL,
	`TPOBNetAmount` FLOAT NULL DEFAULT '0',
	`TPOBTaxType` SMALLINT NULL DEFAULT '0',
	`TPOBTaxBase` FLOAT NULL DEFAULT '0',
	`TPOBWTAXBase` FLOAT NULL DEFAULT '0',
	`TPOBAmountVAT` FLOAT NULL DEFAULT '0',
	`TPOBAmountWTAX` FLOAT NULL DEFAULT '0',
	`TPOBAutoSTD` SMALLINT NULL DEFAULT '0',
	`TPOBStandardCost` FLOAT NULL DEFAULT '0',
	`TPOBMargin` DOUBLE NULL DEFAULT '0',
	`TPOBSaleMargin` FLOAT NULL DEFAULT '0',
	`TPOBAutoPrice` SMALLINT NULL DEFAULT '0',
	`TPOBSalePrice` FLOAT NULL DEFAULT '0',
	`TPOBGetNumber` DOUBLE NULL DEFAULT '0',
	`TPOBFreeCode` VARCHAR(30) NULL,
	`TPOBIsPremium` DOUBLE NULL DEFAULT '0',
	`TPOBDescription` VARCHAR(255) NULL,
	`TPOBSourceNo` VARCHAR(30) NULL,
	`TPOBSourceLn` INT NULL DEFAULT '0',
	`TPOBTBraCode` VARCHAR(30) NULL,
	`TPOBTDivCode` VARCHAR(30) NULL,
	`TPOBTDepCode` VARCHAR(30) NULL,
	`TPOBTSecCode` VARCHAR(30) NULL,
	`TPOBTEmpCode` VARCHAR(30) NULL,
	`TPOBStatus` SMALLINT NULL DEFAULT '0',
	`TPOBStockTotal` DOUBLE NULL DEFAULT '0',
	`TPOBPRArrear` DOUBLE NULL DEFAULT '0',
	`TPOBEOQ` DOUBLE NULL DEFAULT '0',
	`TPOBTotalDelivery` DOUBLE NULL DEFAULT '0',
	`TPOBTotalDelivery2` DOUBLE NULL DEFAULT '0',
	`TPOBTotalDelivery3` DOUBLE NULL DEFAULT '0',
	`TPOBTotalArrear` DOUBLE NULL DEFAULT '0',
	`TPOBTotalArrear2` DOUBLE NULL DEFAULT '0',
	`TPOBTotalArrear3` DOUBLE NULL DEFAULT '0',
	`TPOBMapTPdtCode` VARCHAR(30) NULL,
	`TPOBMapTUntCode` VARCHAR(50) NULL,
	`TPOBMapRatioP` DOUBLE NULL DEFAULT '0',
	`TPOBDayProcess` INT NULL DEFAULT '0',
	`TPOBTLctCode` VARCHAR(30) NULL,
	`TPOBManualClose` SMALLINT NULL,
	`TPOBFlag1` SMALLINT NULL DEFAULT '0',
	`TPOBFlag2` SMALLINT NULL DEFAULT '0',
	`TPOBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPOBLn`, `TPOBTPODNo`),
	KEY `TCKMMapTPdtCode` (`TPOBMapTPdtCode`),
	KEY `TCKMMapTUntCode` (`TPOBMapTUntCode`),
	KEY `TPRMRatioP` (`TPOBMapRatioP`),
	KEY `TPSMTOExCode` (`TPOBTOExCode`),
	KEY `TPSMUnitFactor` (`TPOBUnitFactor`),
	KEY `TPWBID` (`TPOBLn`),
	KEY `TSOBFactoryCode` (`TPOBFactoryCode`),
	KEY `TSOBFreeCode` (`TPOBFreeCode`),
	KEY `TSOBJobCode` (`TPOBJobCode`),
	KEY `TSOBPOSCode` (`TPOBProductCode`),
	KEY `TSOBSourceNo` (`TPOBSourceNo`),
	KEY `TSOBTLctCode` (`TPOBTLctCode`),
	KEY `TSOBTPOSCode` (`TPOBTPdtCode`),
	KEY `TSOBTUntCode` (`TPOBTUntCode`),
	KEY `TSOBTUntCode2` (`TPOBTUntCode2`),
	KEY `TSOBTUntCode3` (`TPOBTUntCode3`),
	KEY `TSOBType` (`TPOBType`),
	KEY `TTfMID` (`TPOBTPODNo`),
	KEY `VS4TPWOVS4TPWOMB` (`TPOBTPODNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOPayPeriod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOPayPeriod`;

# ---------- CREATE TABLE `VS4TPOPayPeriod` ----------

CREATE TABLE `VS4TPOPayPeriod` (
	`TPPPTPODNo` VARCHAR(30) NOT NULL,
	`TPPPLn` SMALLINT NOT NULL DEFAULT '0',
	`TPPPDueDate` VARCHAR(7) NULL,
	`TPPPCondition` VARCHAR(50) NULL,
	`TPPPTPPTCode` VARCHAR(30) NULL,
	`TPPPTPyTAlias` VARCHAR(15) NULL,
	`TPPPTCurCode` VARCHAR(4) NULL,
	`TPPPPercent` DOUBLE NULL DEFAULT '0',
	`TPPPAmount` FLOAT NULL DEFAULT '0',
	`TPPPExchangeRate` DOUBLE NULL DEFAULT '0',
	`TPPPAmountInRate` FLOAT NULL DEFAULT '0',
	`TPPPNote` VARCHAR(100) NULL,
	`TPPPFlag1` SMALLINT NULL DEFAULT '0',
	`TPPPFlag2` SMALLINT NULL DEFAULT '0',
	`TPPPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPPPTPODNo`, `TPPPLn`),
	KEY `TPPPTPPTCode` (`TPPPTPPTCode`),
	KEY `TPPyTPTAID` (`TPPPTPODNo`),
	KEY `VS4TPaymentTypeVS4TPOPayPeriod` (`TPPPTPyTAlias`),
	KEY `VS4TPayPeriodTypeVS4TPOPayPeriod` (`TPPPTPPTCode`),
	KEY `VS4TPOVS4TPOPayPeriod` (`TPPPTPODNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOPSaleOut` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOPSaleOut`;

# ---------- CREATE TABLE `VS4TPOPSaleOut` ----------

CREATE TABLE `VS4TPOPSaleOut` (
	`TPPSNo` VARCHAR(30) NOT NULL,
	`TPPSTSODNo` VARCHAR(30) NULL,
	`TPPSTBokCode` VARCHAR(30) NULL,
	`TPPSType` SMALLINT NULL DEFAULT '0',
	`TPPSDate` DATETIME NULL,
	`TPPSRefNo` VARCHAR(30) NULL,
	`TPPSRefDate` DATETIME NULL,
	`TPPSRefNo2` VARCHAR(30) NULL,
	`TPPSRefDate2` DATETIME NULL,
	`TPPSARBODeposit` INT NULL DEFAULT '0',
	`TPPSTPrjCode` VARCHAR(30) NULL,
	`TPPSTSecCode` VARCHAR(30) NULL,
	`TPPSTDepCode` VARCHAR(30) NULL,
	`TPPSTDivCode` VARCHAR(30) NULL,
	`TPPSTBraCode` VARCHAR(30) NULL,
	`TPPSDeliveryDate` DATETIME NULL,
	`TPPSDeliveryTime` DATETIME NULL,
	`TPPSDeliveryTo` VARCHAR(255) NULL,
	`TPPSTARNCode` VARCHAR(30) NULL,
	`TPPSContactNote` VARCHAR(50) NULL,
	`TPPSContactName` VARCHAR(160) NULL,
	`TPPSSupplierName` VARCHAR(200) NULL,
	`TPPSSupAddress` VARCHAR(255) NULL,
	`TPPSCarLicense` VARCHAR(10) NULL,
	`TPPSContainerNo` VARCHAR(30) NULL,
	`TPPSTShpCode` VARCHAR(30) NULL,
	`TPPSInDate` DATETIME NULL,
	`TPPSInTime` DATETIME NULL,
	`TPPSOutDate` DATETIME NULL,
	`TPPSOutTime` DATETIME NULL,
	`TPPSWeightUnit` VARCHAR(30) NULL,
	`TPPSWeight` DOUBLE NULL DEFAULT '0',
	`TPPSWeightCar` DOUBLE NULL DEFAULT '0',
	`TPPSDisWeightPC` DOUBLE NULL DEFAULT '0',
	`TPPSDisWeightText` DOUBLE NULL DEFAULT '0',
	`TPPSDisWeightFix` DOUBLE NULL DEFAULT '0',
	`TPPSWeightTotal` DOUBLE NULL DEFAULT '0',
	`TPPSPriceChannel` SMALLINT NULL DEFAULT '0',
	`TPPSChannelName` VARCHAR(30) NULL,
	`TPPSSubTotal` FLOAT NULL,
	`TPPSDiscountPC` DOUBLE NULL,
	`TPPSDiscPCAmount` DOUBLE NULL,
	`TPPSDiscountFix` FLOAT NULL,
	`TPPSDiscountTotal` FLOAT NULL,
	`TPPSTaxBase` FLOAT NULL DEFAULT '0',
	`TPPSVATRate` DOUBLE NULL,
	`TPPSVATTotal` FLOAT NULL,
	`TPPSNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TPPSZTAXTotal` FLOAT NULL DEFAULT '0',
	`TPPSWTaxRate` DOUBLE NULL DEFAULT '0',
	`TPPSWTaxTotal` FLOAT NULL DEFAULT '0',
	`TPPSGrandTotalVAT` FLOAT NULL,
	`TPPSGrandTotal` FLOAT NULL,
	`TPPSNetPayment` FLOAT NULL,
	`TPPSDepositVAT` SMALLINT NULL DEFAULT '0',
	`TPPSDepositRate` FLOAT NULL DEFAULT '0',
	`TPPSDeposit` FLOAT NULL DEFAULT '0',
	`TPPSTonnage` FLOAT NULL DEFAULT '0',
	`TPPSInsurance` FLOAT NULL DEFAULT '0',
	`TPPSFreightFee` FLOAT NULL DEFAULT '0',
	`TPPSOtherFee` FLOAT NULL DEFAULT '0',
	`TPPSFirstPayment` FLOAT NULL,
	`TPPSTCurCode` VARCHAR(5) NULL,
	`TPPSExchangeRate` FLOAT NULL DEFAULT '0',
	`TPPSAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPPSCountryOrigin` VARCHAR(50) NULL,
	`TPPSCondition` VARCHAR(100) NULL,
	`TPPSConditionDay` SMALLINT NULL DEFAULT '0',
	`TPPSCondition1` DOUBLE NULL DEFAULT '0',
	`TPPSConditionDay1` SMALLINT NULL DEFAULT '0',
	`TPPSDecimalEX` SMALLINT NULL DEFAULT '0',
	`TPPSDecimalUnit` SMALLINT NULL DEFAULT '0',
	`TPPSDecimalCost` SMALLINT NULL DEFAULT '0',
	`TPPSPaymentNote` VARCHAR(200) NULL,
	`TPPSStatementNote` VARCHAR(200) NULL,
	`TPPSDeliveryNote` VARCHAR(200) NULL,
	`TPPSPackingNote` VARCHAR(200) NULL,
	`TPPSDayAvailable` SMALLINT NULL,
	`TPPSSubTotaQty` SMALLINT NULL,
	`TPPSSubDistFix` DATETIME NULL,
	`TPPSStatus` SMALLINT NULL DEFAULT '0',
	`TPPSProductCode` VARCHAR(255) NULL,
	`TPPSProductDetail` VARCHAR(255) NULL,
	`TPPSDescription` VARCHAR(255) NULL,
	`TPPSMultiProject` SMALLINT NULL,
	`TPPSTPOTCode` VARCHAR(30) NULL,
	`TPPSLinkStatus` SMALLINT NULL,
	`TPPSLinkBy` VARCHAR(140) NULL,
	`TPPSLinkDate` DATETIME NULL,
	`TPPSTGLTNo` VARCHAR(30) NULL,
	`TPPSCreateCode` VARCHAR(30) NULL,
	`TPPSCreateBy` VARCHAR(140) NULL,
	`TPPSCreateDate` DATETIME NULL,
	`TPPSEditCode` VARCHAR(30) NULL,
	`TPPSEditBy` VARCHAR(140) NULL,
	`TPPSEditDate` DATETIME NULL,
	`TPPSConfirmStatus` SMALLINT NULL,
	`TPPSConfirmBy` VARCHAR(140) NULL,
	`TPPSConfirmDate` DATETIME NULL,
	`TPPSConfirmNote` VARCHAR(80) NULL,
	`TPPSApproveStatus` SMALLINT NULL,
	`TPPSApproveBy` VARCHAR(140) NULL,
	`TPPSApproveDate` DATETIME NULL,
	`TPPSApproveNote` VARCHAR(80) NULL,
	`TPPSConfidential` SMALLINT NULL,
	`TPPSReviseStatus` SMALLINT NULL DEFAULT '0',
	`TPPSCancelStatus` SMALLINT NULL,
	`TPPSCancelNo` VARCHAR(30) NULL,
	`TPPSCancelBy` VARCHAR(140) NULL,
	`TPPSCancelDate` DATETIME NULL,
	`TPPSCancelNote` VARCHAR(80) NULL,
	`TPPSFlag1` SMALLINT NULL,
	`TPPSFlag2` SMALLINT NULL,
	`TPPSFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPPSNo`),
	KEY `TAPQTCmpCode` (`TPPSTARNCode`),
	KEY `TPODTAPNCode` (`TPPSContactNote`),
	KEY `TPODTBokCode` (`TPPSTBokCode`),
	KEY `TPODTPPYCode` (`TPPSTPOTCode`),
	KEY `TPPDTShpCode` (`TPPSTShpCode`),
	KEY `TPRDTBraCode` (`TPPSTBraCode`),
	KEY `TPRDTDepCode` (`TPPSTDepCode`),
	KEY `TPRDTDivCode` (`TPPSTDivCode`),
	KEY `TPRDTPrjCode` (`TPPSTPrjCode`),
	KEY `TPWOSupplierName` (`TPPSSupAddress`),
	KEY `TPWOTCmpCode` (`TPPSSupplierName`),
	KEY `TSODTCurCode` (`TPPSTCurCode`),
	KEY `VS4TARVS4TPOPSaleOut` (`TPPSTARNCode`),
	KEY `VS4TBranchVS4TPOPSaleOut` (`TPPSTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOPScrap` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOPScrap`;

# ---------- CREATE TABLE `VS4TPOPScrap` ----------

CREATE TABLE `VS4TPOPScrap` (
	`TPScCode` VARCHAR(30) NOT NULL,
	`TPScName` VARCHAR(50) NULL,
	`TPScName2` VARCHAR(50) NULL,
	`TPScAmount` DOUBLE NULL DEFAULT '0',
	`TPScDisValue` SMALLINT NULL DEFAULT '0',
	`TPScStartCharge` DOUBLE NULL DEFAULT '0',
	`TPScChargeAll` SMALLINT NULL DEFAULT '0',
	`TPScCharge` VARCHAR(30) NULL,
	`TPScFlag1` SMALLINT NULL DEFAULT '0',
	`TPScFlag2` SMALLINT NULL DEFAULT '0',
	`TPScFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPScCode`),
	KEY `TLotCode` (`TPScCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOPTrans` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOPTrans`;

# ---------- CREATE TABLE `VS4TPOPTrans` ----------

CREATE TABLE `VS4TPOPTrans` (
	`TPPDNo` VARCHAR(30) NOT NULL,
	`TPPDTBokCode` VARCHAR(30) NULL,
	`TPPDMode` SMALLINT NULL DEFAULT '0',
	`TPPDTaxNo` VARCHAR(30) NULL,
	`TPPDType` SMALLINT NULL DEFAULT '0',
	`TPPDDate` DATETIME NULL,
	`TPPDDueDate` DATETIME NULL,
	`TPPDRefNo` VARCHAR(30) NULL,
	`TPPDRefDate` DATETIME NULL,
	`TPPDRefNo2` VARCHAR(30) NULL,
	`TPPDRefDate2` DATETIME NULL,
	`TPPDAPBODeposit` INT NULL DEFAULT '0',
	`TPPDTPrjCode` VARCHAR(30) NULL,
	`TPPDTBraCode` VARCHAR(30) NULL,
	`TPPDTAPNCode` VARCHAR(30) NULL,
	`TPPDTAPUCode` VARCHAR(30) NULL,
	`TPPDContactNote` VARCHAR(50) NULL,
	`TPPDContactName` VARCHAR(160) NULL,
	`TPPDSupplierName` VARCHAR(200) NULL,
	`TPPDSupAddress` VARCHAR(255) NULL,
	`TPPDCarLicense` VARCHAR(10) NULL,
	`TPPDContainerNo` VARCHAR(30) NULL,
	`TPPDContainerZeal` VARCHAR(30) NULL,
	`TPPDLocation` VARCHAR(100) NULL,
	`TPPDInDate` DATETIME NULL,
	`TPPDInTime` DATETIME NULL,
	`TPPDOutDate` DATETIME NULL,
	`TPPDOutTime` DATETIME NULL,
	`TPPDWeightUnit` VARCHAR(100) NULL,
	`TPPDWeight` DOUBLE NULL DEFAULT '0',
	`TPPDWeightCar` DOUBLE NULL DEFAULT '0',
	`TPPDDisWeightPC` DOUBLE NULL DEFAULT '0',
	`TPPDDisWeightText` DOUBLE NULL DEFAULT '0',
	`TPPDDisWeightFix` DOUBLE NULL DEFAULT '0',
	`TPPDWeightTotal` DOUBLE NULL DEFAULT '0',
	`TPPDPriceChannel` SMALLINT NULL DEFAULT '0',
	`TPPDChannelName` VARCHAR(30) NULL,
	`TPPDDiscountList` FLOAT NULL DEFAULT '0',
	`TPPDSubTotal` FLOAT NULL,
	`TPPDDiscountText` VARCHAR(30) NULL,
	`TPPDDiscPCAmount` DOUBLE NULL,
	`TPPDDiscountFix` FLOAT NULL,
	`TPPDDiscountTotal` FLOAT NULL,
	`TPPDNetTotal` FLOAT NULL DEFAULT '0',
	`TPPDDepositText` VARCHAR(30) NULL,
	`TPPDDeposit` FLOAT NULL DEFAULT '0',
	`TPPDTotal` FLOAT NULL,
	`TPPDTCurCode` VARCHAR(5) NULL,
	`TPPDExchangeRate` FLOAT NULL DEFAULT '0',
	`TPPDTotalInRate` FLOAT NULL,
	`TPPDVATType` SMALLINT NULL DEFAULT '0',
	`TPPDVATRate` DOUBLE NULL,
	`TPPDTaxBase` FLOAT NULL DEFAULT '0',
	`TPPDVATTotal` FLOAT NULL,
	`TPPDGrandTotal` FLOAT NULL,
	`TPPDNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TPPDWTaxBase` FLOAT NULL DEFAULT '0',
	`TPPDWTaxRate` DOUBLE NULL DEFAULT '0',
	`TPPDWTaxTotal` FLOAT NULL DEFAULT '0',
	`TPPDNetPayment` FLOAT NULL,
	`TPPDAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPPDRewardTotal` FLOAT NULL,
	`TPPDCondition` VARCHAR(100) NULL,
	`TPPDConditionDay` SMALLINT NULL DEFAULT '0',
	`TPPDCondition1` DOUBLE NULL DEFAULT '0',
	`TPPDConditionDay1` SMALLINT NULL DEFAULT '0',
	`TPPDPaymentNote` VARCHAR(200) NULL,
	`TPPDStatementNote` VARCHAR(200) NULL,
	`TPPDTShpCode` VARCHAR(30) NULL,
	`TPPDShipName` VARCHAR(200) NULL,
	`TPPDDeliveryNote` VARCHAR(200) NULL,
	`TPPDPackingNote` VARCHAR(200) NULL,
	`TPPDDayAvailable` SMALLINT NULL,
	`TPPDSubTotaQty` SMALLINT NULL,
	`TPPDStatus` SMALLINT NULL DEFAULT '0',
	`TPPDDescription` VARCHAR(255) NULL,
	`TPPDCustom1` VARCHAR(30) NULL,
	`TPPDCustom2` VARCHAR(30) NULL,
	`TPPDCustom3` VARCHAR(30) NULL,
	`TPPDCustom4` VARCHAR(255) NULL,
	`TPPDCustom5` VARCHAR(255) NULL,
	`TPPDBalanceNo` VARCHAR(30) NULL,
	`TPPDTPOTCode` VARCHAR(30) NULL,
	`TPPDLinkStatus` SMALLINT NULL,
	`TPPDLinkBy` VARCHAR(140) NULL,
	`TPPDLinkDate` DATETIME NULL,
	`TPPDDeliveryTo` VARCHAR(255) NULL,
	`TPPDDeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TPPDFinishDate` DATETIME NULL,
	`TPPDSourceNo` VARCHAR(30) NULL,
	`TPPDInvNo` VARCHAR(30) NULL,
	`TPPDTGLTNo` VARCHAR(30) NULL,
	`TPPDCreateCode` VARCHAR(30) NULL,
	`TPPDCreateBy` VARCHAR(140) NULL,
	`TPPDCreateDate` DATETIME NULL,
	`TPPDEditCode` VARCHAR(30) NULL,
	`TPPDEditBy` VARCHAR(140) NULL,
	`TPPDEditDate` DATETIME NULL,
	`TPPDConfirmStatus` SMALLINT NULL,
	`TPPDConfirmBy` VARCHAR(140) NULL,
	`TPPDConfirmDate` DATETIME NULL,
	`TPPDApproveStatus` SMALLINT NULL,
	`TPPDApproveBy` VARCHAR(140) NULL,
	`TPPDApproveDate` DATETIME NULL,
	`TPPDApproveNote` VARCHAR(80) NULL,
	`TPPDRevision` SMALLINT NULL,
	`TPPDReviseStatus` SMALLINT NULL DEFAULT '0',
	`TPPDCancelStatus` SMALLINT NULL,
	`TPPDCancelNo` VARCHAR(30) NULL,
	`TPPDCancelBy` VARCHAR(140) NULL,
	`TPPDCancelDate` DATETIME NULL,
	`TPPDCancelNote` VARCHAR(80) NULL,
	`TPPDFlag1` SMALLINT NULL,
	`TPPDFlag2` SMALLINT NULL,
	`TPPDFlag3` SMALLINT NULL,
	PRIMARY KEY (`TPPDNo`),
	KEY `TAPQTCmpCode` (`TPPDTAPNCode`),
	KEY `TIAPTShpCode` (`TPPDTShpCode`),
	KEY `TPODTAPNCode` (`TPPDContactNote`),
	KEY `TPODTBokCode` (`TPPDTBokCode`),
	KEY `TPODTPPYCode` (`TPPDTPOTCode`),
	KEY `TPPDTShpCode` (`TPPDShipName`),
	KEY `TPRDTBraCode` (`TPPDTBraCode`),
	KEY `TPRDTPrjCode` (`TPPDTPrjCode`),
	KEY `TPTATARDCode` (`TPPDTAPUCode`),
	KEY `TPWOSupplierName` (`TPPDSupAddress`),
	KEY `TPWOTCmpCode` (`TPPDSupplierName`),
	KEY `TSODTCurCode` (`TPPDTCurCode`),
	KEY `VS4TBranchVS4TPOPTrans` (`TPPDTBraCode`),
	KEY `VS4TProjectVS4TPOPTrans` (`TPPDTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOPTransMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOPTransMB`;

# ---------- CREATE TABLE `VS4TPOPTransMB` ----------

CREATE TABLE `VS4TPOPTransMB` (
	`TPTBTPPDNo` VARCHAR(30) NOT NULL,
	`TPTBBalanceNo` VARCHAR(30) NOT NULL,
	`TPTBLn` INT NOT NULL DEFAULT '0',
	`TPTBDate` DATETIME NULL,
	`TPTBType` SMALLINT NULL DEFAULT '0',
	`TPTBTPdtCode` VARCHAR(30) NULL,
	`TPTBCustom1` VARCHAR(30) NULL,
	`TPTBCustom2` VARCHAR(150) NULL,
	`TPTBCustom3` VARCHAR(150) NULL,
	`TPTBCustom4` VARCHAR(150) NULL,
	`TPTBCustom5` VARCHAR(150) NULL,
	`TPTBFactoryCode` VARCHAR(50) NULL,
	`TPTBProductName` VARCHAR(150) NULL,
	`TPTBBalanceUnit` VARCHAR(30) NULL,
	`TPTBWHeadQty` VARCHAR(50) NULL,
	`TPTBGWQuantity` DOUBLE NULL DEFAULT '0',
	`TPTBWQuantity` DOUBLE NULL DEFAULT '0',
	`TPTBTPScCode` VARCHAR(30) NULL,
	`TPTBDisRemark` VARCHAR(100) NULL,
	`TPTBWDisQtyTxt` VARCHAR(50) NULL,
	`TPTBWDisQtyPC` DOUBLE NULL DEFAULT '0',
	`TPTBWDisQtyFix` DOUBLE NULL DEFAULT '0',
	`TPTBWDisQtyTotal` DOUBLE NULL DEFAULT '0',
	`TPTBWDisQtyTxt2` VARCHAR(50) NULL,
	`TPTBWDisQtyPC2` DOUBLE NULL DEFAULT '0',
	`TPTBWDisQtyFix2` DOUBLE NULL DEFAULT '0',
	`TPTBWDisQtyTotal2` DOUBLE NULL DEFAULT '0',
	`TPTBWNetQty` INT NULL,
	`TPTBQuantity` DOUBLE NULL DEFAULT '0',
	`TPTBTUntCode` VARCHAR(15) NULL,
	`TPTBQuantity2` DOUBLE NULL DEFAULT '0',
	`TPTBTUntCode2` VARCHAR(15) NULL,
	`TPTBQuantity3` DOUBLE NULL DEFAULT '0',
	`TPTBTUntCode3` VARCHAR(15) NULL,
	`TPTBUnitType` SMALLINT NULL DEFAULT '0',
	`TPTBUnit2Ratio` DOUBLE NULL DEFAULT '0',
	`TPTBUnit3Ratio` DOUBLE NULL DEFAULT '0',
	`TPTBUnitCalc` SMALLINT NULL DEFAULT '0',
	`TPTBQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TPTBPerQuantity` DOUBLE NULL DEFAULT '1',
	`TPTBUnitFactor` DOUBLE NULL DEFAULT '0',
	`TPTBAcceptError` VARCHAR(30) NULL,
	`TPTBPrice` FLOAT NULL DEFAULT '0',
	`TPTBUnitPrice` FLOAT NULL DEFAULT '0',
	`TPTBSubTotal` FLOAT NULL DEFAULT '0',
	`TPTBAmount` FLOAT NULL DEFAULT '0',
	`TPTBDiscountText` VARCHAR(30) NULL,
	`TPTBDiscountTotal` FLOAT NULL,
	`TPTBNetAmount` FLOAT NULL DEFAULT '0',
	`TPTBTaxType` SMALLINT NULL DEFAULT '0',
	`TPTBTaxBase` FLOAT NULL DEFAULT '0',
	`TPTBWTAXBase` FLOAT NULL DEFAULT '0',
	`TPTBAmountVAT` FLOAT NULL DEFAULT '0',
	`TPTBAmountWTAX` FLOAT NULL DEFAULT '0',
	`TPTBAutoSTD` SMALLINT NULL DEFAULT '0',
	`TPTBStandardCost` FLOAT NULL DEFAULT '0',
	`TPTBMargin` DOUBLE NULL DEFAULT '0',
	`TPTBSaleMargin` FLOAT NULL DEFAULT '0',
	`TPTBAutoPrice` SMALLINT NULL DEFAULT '0',
	`TPTBPromotionType` VARCHAR(15) NULL,
	`TPTBFreeCode` VARCHAR(30) NULL,
	`TPTBIsPremium` DOUBLE NULL DEFAULT '0',
	`TPTBDescription` VARCHAR(255) NULL,
	`TPTBSourceNo` VARCHAR(30) NULL,
	`TPTBSourceLn` INT NULL DEFAULT '0',
	`TPTBSourceDate` DATETIME NULL,
	`TPTBSourceCode1` VARCHAR(30) NULL,
	`TPTBSourceCode2` VARCHAR(30) NULL,
	`TPTBStockTotal` DOUBLE NULL DEFAULT '0',
	`TPTBPRArrear` DOUBLE NULL DEFAULT '0',
	`TPTBEOQ` DOUBLE NULL DEFAULT '0',
	`TPTBTotalDelivery` DOUBLE NULL DEFAULT '0',
	`TPTBTotalDelivery2` DOUBLE NULL DEFAULT '0',
	`TPTBTotalDelivery3` DOUBLE NULL DEFAULT '0',
	`TPTBTotalArrear` DOUBLE NULL DEFAULT '0',
	`TPTBTotalArrear2` DOUBLE NULL DEFAULT '0',
	`TPTBTotalArrear3` DOUBLE NULL DEFAULT '0',
	`TPTBMapTPdtCode` VARCHAR(30) NULL,
	`TPTBMapTPdtName` VARCHAR(150) NULL,
	`TPTBMapTUntCode` VARCHAR(50) NULL,
	`TPTBMapTUntCode2` VARCHAR(30) NULL,
	`TPTBMapTUntCode3` VARCHAR(30) NULL,
	`TPTBStatus` SMALLINT NULL,
	`TPTBAlerted` SMALLINT NULL DEFAULT '0',
	`TPTBCreateCode` VARCHAR(30) NULL,
	`TPTBCreateBy` VARCHAR(150) NULL,
	`TPTBCreateDate` DATETIME NULL,
	`TPTBFlag1` SMALLINT NULL DEFAULT '0',
	`TPTBFlag2` SMALLINT NULL DEFAULT '0',
	`TPTBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPTBTPPDNo`, `TPTBLn`, `TPTBBalanceNo`),
	KEY `TCKMMapTPdtCode` (`TPTBMapTPdtCode`),
	KEY `TCKMMapTUntCode` (`TPTBMapTUntCode`),
	KEY `TPOBMapTPdtCode` (`TPTBMapTPdtName`),
	KEY `TPSMUnitFactor` (`TPTBUnitFactor`),
	KEY `TPTBTPScCode` (`TPTBTPScCode`),
	KEY `TPTBTPScCode1` (`TPTBDisRemark`),
	KEY `TPWBID` (`TPTBLn`),
	KEY `TSOBFactoryCode` (`TPTBFactoryCode`),
	KEY `TSOBFreeCode` (`TPTBFreeCode`),
	KEY `TSOBSourceCode1` (`TPTBSourceCode1`),
	KEY `TSOBSourceCode2` (`TPTBSourceCode2`),
	KEY `TSOBSourceNo` (`TPTBSourceNo`),
	KEY `TSOBTPOSCode` (`TPTBTPdtCode`),
	KEY `TSOBTUntCode` (`TPTBTUntCode`),
	KEY `TSOBTUntCode2` (`TPTBTUntCode2`),
	KEY `TSOBTUntCode3` (`TPTBTUntCode3`),
	KEY `TSOBType` (`TPTBType`),
	KEY `TTfMID` (`TPTBTPPDNo`),
	KEY `VS4TPOPTransVS4TPOPTransMB` (`TPTBTPPDNo`),
	KEY `VS4TProductVS4TPOPTransMB` (`TPTBTPdtCode`),
	KEY `VS4TUnitVS4TPOPTransMB` (`TPTBTUntCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOS` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOS`;

# ---------- CREATE TABLE `VS4TPOS` ----------

CREATE TABLE `VS4TPOS` (
	`TPOSCode` VARCHAR(30) NOT NULL,
	`TPOSType` SMALLINT NULL DEFAULT '0',
	`TPOSName` VARCHAR(150) NULL,
	`TPOSName2` VARCHAR(150) NULL,
	`TPOSAliasName` VARCHAR(30) NULL,
	`TPOSDescription` VARCHAR(255) NULL,
	`TPOSBarCode` VARCHAR(30) NULL,
	`TPOSTPrjCode` VARCHAR(30) NULL,
	`TPOSCustom1` VARCHAR(100) NULL,
	`TPOSCustom2` VARCHAR(100) NULL,
	`TPOSCustom3` VARCHAR(100) NULL,
	`TPOSCustom4` VARCHAR(100) NULL,
	`TPOSPackText1` VARCHAR(255) NULL,
	`TPOSPackText2` VARCHAR(255) NULL,
	`TPOSPackAlias1` VARCHAR(255) NULL,
	`TPOSPackAlias2` VARCHAR(255) NULL,
	`TPOSPackText11` VARCHAR(200) NULL,
	`TPOSPackText12` VARCHAR(200) NULL,
	`TPOSPackText13` VARCHAR(200) NULL,
	`TPOSPackText14` VARCHAR(200) NULL,
	`TPOSPackText15` VARCHAR(200) NULL,
	`TPOSPackText16` VARCHAR(200) NULL,
	`TPOSPackAlias21` VARCHAR(255) NULL,
	`TPOSPackAlias22` VARCHAR(255) NULL,
	`TPOSPackAlias23` VARCHAR(255) NULL,
	`TPOSPackAlias24` VARCHAR(255) NULL,
	`TPOSPackAlias25` VARCHAR(255) NULL,
	`TPOSPackAlias26` VARCHAR(255) NULL,
	`TPOSFactoryCode` VARCHAR(30) NULL,
	`TPOSStdCostCode` VARCHAR(30) NULL,
	`TPOSLeadDay` DOUBLE NULL DEFAULT '0',
	`TPOSMultipleOrder` DOUBLE NULL DEFAULT '0',
	`TPOSMinimumOrder` DOUBLE NULL DEFAULT '1',
	`TPOSUnitType` SMALLINT NULL DEFAULT '0',
	`TPOSTUntCode` VARCHAR(15) NULL,
	`TPOSTUntCode2` VARCHAR(15) NULL,
	`TPOSTUntCode3` VARCHAR(15) NULL,
	`TPOSUseImageCode` SMALLINT NULL DEFAULT '0',
	`TPOSUseIconImage` SMALLINT NULL DEFAULT '0',
	`TPOSCutStock` SMALLINT NULL DEFAULT '0',
	`TPOSPrice` FLOAT NULL DEFAULT '0',
	`TPOSLastPrice` FLOAT NULL DEFAULT '0',
	`TPOSLastPriceDate` DATETIME NULL,
	`TPOSHideAfterSold` SMALLINT NULL DEFAULT '0',
	`TPOSSaleCount` SMALLINT NULL DEFAULT '0',
	`TPOSIcon1` VARCHAR(50) NULL,
	`TPOSImage1` VARCHAR(50) NULL,
	`TPOSFirstSaleDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPOSLastSaleDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPOSDisplaySub` SMALLINT NULL DEFAULT '0',
	`TPOSDisplaySubMB` SMALLINT NULL DEFAULT '0',
	`TPOSOnSale` SMALLINT NULL DEFAULT '0',
	`TPOSRefund` SMALLINT NULL DEFAULT '0',
	`TPOSWarranty` DOUBLE NULL DEFAULT '0',
	`TPOSWarrantyUnit` VARCHAR(1) NULL,
	`TPOSWarrantyType` SMALLINT NULL DEFAULT '2',
	`TPOSSaleStockMinus` SMALLINT NULL DEFAULT '1',
	`TPOSStandardCost` FLOAT NULL DEFAULT '0',
	`TPOSPremiumCost` FLOAT NULL DEFAULT '0',
	`TPOSTotalQuantity` DOUBLE NULL DEFAULT '0',
	`TPOSCreateCode` VARCHAR(30) NULL,
	`TPOSCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPOSEditCode` VARCHAR(30) NULL,
	`TPOSEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPOSTextSort` VARCHAR(30) NULL,
	`TPOSFlag1` SMALLINT NULL DEFAULT '0',
	`TPOSFlag2` SMALLINT NULL DEFAULT '0',
	`TPOSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPOSCode`),
	KEY `TInBTPrjCode` (`TPOSTPrjCode`),
	KEY `TPOSBarCode` (`TPOSBarCode`),
	KEY `TPOSCostCode` (`TPOSStdCostCode`),
	KEY `TPOSEditDiscount` (`TPOSLastPrice`),
	KEY `TPOSEditDiscount1` (`TPOSLastPriceDate`),
	KEY `TPOSFactoryCode` (`TPOSFactoryCode`),
	KEY `TPOSTCurCode` (`TPOSPrice`),
	KEY `TPOSTUntCode` (`TPOSTUntCode2`),
	KEY `TPOSTUntCode2` (`TPOSTUntCode3`),
	KEY `VS4TUnitVS4TPOS` (`TPOSTUntCode`),
	KEY `YPOSTUntID` (`TPOSTUntCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSAssetMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSAssetMB`;

# ---------- CREATE TABLE `VS4TPOSAssetMB` ----------

CREATE TABLE `VS4TPOSAssetMB` (
	`TPM2TPOSCode` VARCHAR(30) NOT NULL,
	`TPM2TAssCode` VARCHAR(30) NOT NULL,
	`TPM2Quantity` DOUBLE NULL DEFAULT '1',
	`TPM2Flag1` SMALLINT NULL DEFAULT '0',
	`TPM2Flag2` SMALLINT NULL DEFAULT '0',
	`TPM2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPM2TPOSCode`, `TPM2TAssCode`),
	KEY `SetSaleID` (`TPM2TPOSCode`),
	KEY `TPoMTPdtCode` (`TPM2TAssCode`),
	KEY `VS4TAssetVS4TPOSAssetMB` (`TPM2TAssCode`),
	KEY `VS4TPOSVS4TPOSMB2` (`TPM2TPOSCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSBook` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSBook`;

# ---------- CREATE TABLE `VS4TPOSBook` ----------

CREATE TABLE `VS4TPOSBook` (
	`TPBKCode` VARCHAR(30) NOT NULL,
	`TPBKName` VARCHAR(140) NULL,
	`TPBKName2` VARCHAR(140) NULL,
	`TPBKDocCode` VARCHAR(30) NULL,
	`TPBKFlag1` SMALLINT NULL DEFAULT '0',
	`TPBKFlag2` SMALLINT NULL DEFAULT '0',
	`TPBKFlag3` SMALLINT NULL DEFAULT '0',
	UNIQUE KEY `TPBKCode` (`TPBKCode`),
	KEY `Index_B0D14894_767D_4A78` (`TPBKCode`),
	KEY `TPRBCode` (`TPBKDocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPosition` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPosition`;

# ---------- CREATE TABLE `VS4TPosition` ----------

CREATE TABLE `VS4TPosition` (
	`TPstCode` VARCHAR(30) NOT NULL,
	`TPstTPsYAlias` VARCHAR(30) NULL,
	`TPstName` VARCHAR(50) NULL,
	`TPstName2` VARCHAR(50) NULL,
	`TPstShortName` VARCHAR(30) NULL,
	`TPstShortName2` VARCHAR(30) NULL,
	`TPstDocCode` VARCHAR(30) NULL,
	`TPstTSecCode` VARCHAR(30) NULL,
	`TPstTDepCode` VARCHAR(30) NULL,
	`TPstTDivCode` VARCHAR(30) NULL,
	`TPstTBraCode` VARCHAR(30) NULL,
	`TPstStructureLevel` VARCHAR(30) NULL,
	`TPstFlag1` SMALLINT NULL DEFAULT '0',
	`TPstFlag2` SMALLINT NULL DEFAULT '0',
	`TPstFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPstCode`),
	KEY `TPdtDocCode` (`TPstDocCode`),
	KEY `TPstCode` (`TPstCode`),
	KEY `TPstTSecCode` (`TPstTSecCode`),
	KEY `TPstTSecCode1` (`TPstTDepCode`),
	KEY `TPstTSecCode2` (`TPstTDivCode`),
	KEY `TPstTSecCode3` (`TPstTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPositionGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPositionGroup`;

# ---------- CREATE TABLE `VS4TPositionGroup` ----------

CREATE TABLE `VS4TPositionGroup` (
	`TPgpCode` VARCHAR(30) NOT NULL,
	`TPgpName` VARCHAR(100) NULL,
	`TPgpFlag1` SMALLINT NULL DEFAULT '0',
	`TPgpFlag2` SMALLINT NULL DEFAULT '0',
	`TPgpFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPgpCode`),
	KEY `TPgpCode` (`TPgpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSLastPrice` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSLastPrice`;

# ---------- CREATE TABLE `VS4TPOSLastPrice` ----------

CREATE TABLE `VS4TPOSLastPrice` (
	`TPLPTPmtCode` VARCHAR(30) NOT NULL,
	`TPLPTPOSCode` VARCHAR(30) NOT NULL,
	`TPLPFromQuantity` DOUBLE NOT NULL DEFAULT '0',
	`TPLPTUntCode` VARCHAR(15) NOT NULL,
	`TPLPBarCode` VARCHAR(30) NULL,
	`TPLPName` VARCHAR(150) NULL,
	`TPLPPriceChannel` SMALLINT NULL DEFAULT '1',
	`TPLPTUntCode2` VARCHAR(15) NULL,
	`TPLPTUntCode3` VARCHAR(15) NULL,
	`TPLPWarranty` DOUBLE NULL DEFAULT '0',
	`TPLPWarrantyUnit` VARCHAR(1) NULL,
	`TPLPWarrantyType` SMALLINT NULL,
	`TPLPRefund` SMALLINT NULL,
	`TPLPTPPMTPPLNo` VARCHAR(30) NULL,
	`TPLPTPPMLn` INT NULL DEFAULT '0',
	`TPLPApproveTime` DATETIME NULL,
	`TPLPUnitCalc` SMALLINT NULL DEFAULT '0',
	`TPLPPrice1` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText1` VARCHAR(30) NULL,
	`TPLPTCurCode1` VARCHAR(5) NULL,
	`TPLPTaxType1` SMALLINT NULL DEFAULT '0',
	`TPLPPrice2` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText2` VARCHAR(30) NULL,
	`TPLPTCurCode2` VARCHAR(5) NULL,
	`TPLPTaxType2` SMALLINT NULL DEFAULT '0',
	`TPLPPrice3` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText3` VARCHAR(30) NULL,
	`TPLPTCurCode3` VARCHAR(5) NULL,
	`TPLPTaxType3` SMALLINT NULL DEFAULT '0',
	`TPLPPrice4` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText4` VARCHAR(30) NULL,
	`TPLPTCurCode4` VARCHAR(5) NULL,
	`TPLPTaxType4` SMALLINT NULL DEFAULT '0',
	`TPLPPrice5` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText5` VARCHAR(30) NULL,
	`TPLPTCurCode5` VARCHAR(5) NULL,
	`TPLPTaxType5` SMALLINT NULL DEFAULT '0',
	`TPLPPrice6` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText6` VARCHAR(30) NULL,
	`TPLPTCurCode6` VARCHAR(5) NULL,
	`TPLPTaxType6` SMALLINT NULL DEFAULT '0',
	`TPLPPrice7` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText7` VARCHAR(30) NULL,
	`TPLPTCurCode7` VARCHAR(5) NULL,
	`TPLPTaxType7` SMALLINT NULL DEFAULT '0',
	`TPLPPrice8` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText8` VARCHAR(30) NULL,
	`TPLPTCurCode8` VARCHAR(5) NULL,
	`TPLPTaxType8` SMALLINT NULL DEFAULT '0',
	`TPLPPrice9` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText9` VARCHAR(30) NULL,
	`TPLPTCurCode9` VARCHAR(5) NULL,
	`TPLPTaxType9` SMALLINT NULL DEFAULT '0',
	`TPLPPrice10` FLOAT NULL DEFAULT '0',
	`TPLPDiscountText10` VARCHAR(30) NULL,
	`TPLPTCurCode10` VARCHAR(5) NULL,
	`TPLPTaxType10` SMALLINT NULL DEFAULT '0',
	`TPLPTPTyAlias` VARCHAR(30) NULL,
	`TPLPDiscountPC` DOUBLE NULL DEFAULT '0',
	`TPLPDiscountFix` FLOAT NULL DEFAULT '0',
	`TPLPReplacePrice` FLOAT NULL DEFAULT '0',
	`TPLPGetNumber` DOUBLE NULL DEFAULT '0',
	`TPLPFreeCode` VARCHAR(30) NULL,
	`TPLPFreeNumber` DOUBLE NULL DEFAULT '0',
	`TPLPSaleCount` SMALLINT NULL DEFAULT '0',
	`TPLPFlag1` SMALLINT NULL DEFAULT '0',
	`TPLPFlag2` SMALLINT NULL DEFAULT '0',
	`TPLPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPLPTPmtCode`, `TPLPTPOSCode`, `TPLPFromQuantity`, `TPLPTUntCode`),
	KEY `TPLPTPOSCode` (`TPLPBarCode`),
	KEY `TPmMFreeTPOSCode` (`TPLPFreeCode`),
	KEY `TPOSPricTPOSCode` (`TPLPTPOSCode`),
	KEY `TPPMTaxType1` (`TPLPTaxType2`),
	KEY `TPPMTaxType11` (`TPLPTaxType3`),
	KEY `TPPMTaxType12` (`TPLPTaxType4`),
	KEY `TPPMTaxType13` (`TPLPTaxType5`),
	KEY `TPPMTaxType14` (`TPLPTaxType6`),
	KEY `TPPMTaxType15` (`TPLPTaxType7`),
	KEY `TPPMTaxType16` (`TPLPTaxType8`),
	KEY `TPPMTaxType17` (`TPLPTaxType9`),
	KEY `TPPMTaxType18` (`TPLPTaxType10`),
	KEY `TPPMTCurCode1` (`TPLPTCurCode6`),
	KEY `TPPMTCurCode11` (`TPLPTaxType1`),
	KEY `TPPMTCurCode2` (`TPLPTCurCode7`),
	KEY `TPPMTCurCode3` (`TPLPTCurCode4`),
	KEY `TPPMTCurCode31` (`TPLPTCurCode5`),
	KEY `TPPMTCurCode32` (`TPLPTCurCode8`),
	KEY `TPPMTCurCode4` (`TPLPTCurCode9`),
	KEY `TPPMTCurCode5` (`TPLPTCurCode10`),
	KEY `TPPMTTuntiCode` (`TPLPTUntCode`),
	KEY `TPPMTUntCode` (`TPLPTUntCode2`),
	KEY `TPPMTUntCode1` (`TPLPTUntCode3`),
	KEY `TPPSPTCurCode` (`TPLPTCurCode1`),
	KEY `TPSPTCurCode` (`TPLPTCurCode2`),
	KEY `TPSPTCurCode1` (`TPLPTCurCode3`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSLPQueue` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSLPQueue`;

# ---------- CREATE TABLE `VS4TPOSLPQueue` ----------

CREATE TABLE `VS4TPOSLPQueue` (
	`TPLQTPOSCode` VARCHAR(30) NOT NULL,
	`TPLQQueueDate` DATETIME NULL,
	`TPLQFlag1` SMALLINT NULL DEFAULT '0',
	`TPLQFlag2` SMALLINT NULL DEFAULT '0',
	`TPLQFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPLQTPOSCode`),
	KEY `TPLQTPOSCode` (`TPLQTPOSCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSMB`;

# ---------- CREATE TABLE `VS4TPOSMB` ----------

CREATE TABLE `VS4TPOSMB` (
	`TPoMTPOSCode` VARCHAR(30) NOT NULL,
	`TPoMTPdtCode` VARCHAR(30) NOT NULL,
	`TPoMLn` INT NULL DEFAULT '0',
	`TPoMQuantity` DOUBLE NULL DEFAULT '1',
	`TPoMQuantity2` DOUBLE NULL DEFAULT '1',
	`TPoMQuantity3` DOUBLE NULL DEFAULT '1',
	`TPoMIsPremium` SMALLINT NULL DEFAULT '0',
	`TPoMFlag1` SMALLINT NULL DEFAULT '0',
	`TPoMFlag2` SMALLINT NULL DEFAULT '0',
	`TPoMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPoMTPOSCode`, `TPoMTPdtCode`),
	KEY `SetSaleID` (`TPoMTPOSCode`),
	KEY `TPoMTPdtCode` (`TPoMTPdtCode`),
	KEY `VS4TPOSVS4TPOSMB` (`TPoMTPOSCode`),
	KEY `VS4TProductVS4TPOSMB` (`TPoMTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSTrans` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSTrans`;

# ---------- CREATE TABLE `VS4TPOSTrans` ----------

CREATE TABLE `VS4TPOSTrans` (
	`TPTANo` VARCHAR(30) NOT NULL,
	`TPTADate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTADateTime` DATETIME NULL DEFAULT '3333-3-3',
	`TPTAMode` SMALLINT NULL DEFAULT '0',
	`TPTAType` SMALLINT NULL DEFAULT '0',
	`TPTASaleInvoiceNo` VARCHAR(30) NULL,
	`TPTARefNo2` VARCHAR(30) NULL,
	`TPTAPOSNo` VARCHAR(15) NULL,
	`TPTACashierCode` VARCHAR(30) NULL,
	`TPTACashierName` VARCHAR(150) NULL,
	`TPTAParkNo` VARCHAR(50) NULL,
	`TPTACardNo` VARCHAR(15) NULL,
	`TPTATAPNCode` VARCHAR(30) NULL,
	`TPTATAPUCode` VARCHAR(30) NULL,
	`TPTATAPNCode2` VARCHAR(30) NULL,
	`TPTAGuideText` VARCHAR(100) NULL,
	`TPTALowPrice` SMALLINT NULL DEFAULT '0',
	`TPTATPBKCode` VARCHAR(30) NULL,
	`TPTATransfer` INT NULL DEFAULT '0',
	`TPTATPTRNo` VARCHAR(30) NULL,
	`TPTADueDate` DATETIME NULL,
	`TPTATaxNo` VARCHAR(30) NULL,
	`TPTATPrjCode` VARCHAR(30) NULL,
	`TPTATBraCode` VARCHAR(30) NULL,
	`TPTATEmpCode` VARCHAR(30) NULL,
	`TPTASaleName` VARCHAR(140) NULL,
	`TPTAEmpText` VARCHAR(100) NULL,
	`TPTADeliveryDate` DATETIME NULL,
	`TPTADeliveryTo` VARCHAR(255) NULL,
	`TPTATARNCode` VARCHAR(30) NULL,
	`TPTATARDCode` VARCHAR(30) NULL,
	`TPTATARCCode` VARCHAR(30) NULL,
	`TPTAContactName` VARCHAR(160) NULL,
	`TPTAContactNote` VARCHAR(50) NULL,
	`TPTACustomerName` VARCHAR(200) NULL,
	`TPTACusAddress` VARCHAR(255) NULL,
	`TPTACostTotal` FLOAT NULL DEFAULT '0',
	`TPTAPriceChannel` SMALLINT NULL DEFAULT '0',
	`TPTAChannelName` VARCHAR(30) NULL,
	`TPTADiscountList` FLOAT NULL DEFAULT '0',
	`TPTASubTotalList` FLOAT NULL DEFAULT '0',
	`TPTASubTotal` FLOAT NULL DEFAULT '0',
	`TPTADiscountText` VARCHAR(30) NULL,
	`TPTADiscountTotal` FLOAT NULL DEFAULT '0',
	`TPTANetTotal` FLOAT NULL DEFAULT '0',
	`TPTADepositText` VARCHAR(30) NULL,
	`TPTADeposit` FLOAT NULL DEFAULT '0',
	`TPTATotal` FLOAT NULL,
	`TPTATCurCode` VARCHAR(5) NULL,
	`TPTAExchangeRate` FLOAT NULL DEFAULT '0',
	`TPTATotalInRate` FLOAT NULL,
	`TPTAVATType` SMALLINT NULL DEFAULT '0',
	`TPTAVATRate` DOUBLE NULL DEFAULT '0',
	`TPTATaxBase` FLOAT NULL DEFAULT '0',
	`TPTAVATTotal` FLOAT NULL DEFAULT '0',
	`TPTAGrandTotal` FLOAT NULL DEFAULT '0',
	`TPTANOTAXTotal` FLOAT NULL DEFAULT '0',
	`TPTAWTaxBase` FLOAT NULL DEFAULT '0',
	`TPTAWTaxRate` DOUBLE NULL DEFAULT '0',
	`TPTAWTaxTotal` FLOAT NULL DEFAULT '0',
	`TPTANetPayment` FLOAT NULL,
	`TPTAChangeTotal` FLOAT NULL DEFAULT '0',
	`TPTAArrears` FLOAT NULL DEFAULT '0',
	`TPTAAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPTARewardTotal` FLOAT NULL,
	`TPTAPremiumTotal` FLOAT NULL DEFAULT '0',
	`TPTACustomTotal1` FLOAT NULL DEFAULT '0',
	`TPTACustomTotal2` FLOAT NULL DEFAULT '0',
	`TPTACustomTotal3` FLOAT NULL DEFAULT '0',
	`TPTACommissionBase` FLOAT NULL DEFAULT '0',
	`TPTACommissionRate` VARCHAR(30) NULL,
	`TPTACommission` FLOAT NULL DEFAULT '0',
	`TPTACondition` VARCHAR(100) NULL,
	`TPTAConditionDay` SMALLINT NULL DEFAULT '0',
	`TPTACondition1` DOUBLE NULL DEFAULT '0',
	`TPTAConditionDay1` SMALLINT NULL DEFAULT '0',
	`TPTAPaymentNote` VARCHAR(100) NULL,
	`TPTAStatementNote` VARCHAR(100) NULL,
	`TPTATShpCode` VARCHAR(30) NULL,
	`TPTADeliveryNote` VARCHAR(100) NULL,
	`TPTADayAvailable` SMALLINT NULL,
	`TPTANote` VARCHAR(80) NULL,
	`TPTADescription` VARCHAR(255) NULL,
	`TPTATSOTCode` VARCHAR(50) NULL,
	`TPTADeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TPTABillStatus` SMALLINT NULL DEFAULT '0',
	`TPTAInvoiceNo` VARCHAR(30) NULL,
	`TPTACreateCode` VARCHAR(30) NULL,
	`TPTACreateBy` VARCHAR(140) NULL,
	`TPTACreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTAEditCode` VARCHAR(30) NULL,
	`TPTAEditBy` VARCHAR(140) NULL,
	`TPTAEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTAConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TPTAConfirmBy` VARCHAR(140) NULL,
	`TPTAConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTAApproveStatus` SMALLINT NULL DEFAULT '0',
	`TPTAApproveBy` VARCHAR(140) NULL,
	`TPTAApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTAApproveNote` VARCHAR(80) NULL,
	`TPTARevision` SMALLINT NULL DEFAULT '0',
	`TPTACancelStatus` SMALLINT NULL DEFAULT '0',
	`TPTACancelNo` VARCHAR(30) NULL,
	`TPTACancelBy` VARCHAR(140) NULL,
	`TPTACancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTACancelNote` VARCHAR(80) NULL,
	`TPTAFlag1` SMALLINT NULL DEFAULT '0',
	`TPTAFlag2` SMALLINT NULL DEFAULT '0',
	`TPTAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPTANo`),
	KEY `TIAPTShpCode` (`TPTATShpCode`),
	KEY `TPTACusAddress` (`TPTACusAddress`),
	KEY `TPTACustomerName` (`TPTACustomerName`),
	KEY `TPTATAPNCode` (`TPTATAPNCode2`),
	KEY `TPTATARCCode` (`TPTATARCCode`),
	KEY `TPTATARCCode2` (`TPTADiscountList`),
	KEY `TPTATARDCode` (`TPTATAPUCode`),
	KEY `TPTATARNCode` (`TPTATARNCode`),
	KEY `TPTATARNCode1` (`TPTATAPNCode`),
	KEY `TPTATaxNo` (`TPTATaxNo`),
	KEY `TPTATBraCode` (`TPTATBraCode`),
	KEY `TPTATCurCode` (`TPTATCurCode`),
	KEY `TPTATEmpCode` (`TPTATEmpCode`),
	KEY `TPTATEmpCode1` (`TPTATARDCode`),
	KEY `TPTATJobNo` (`TPTATPBKCode`),
	KEY `TPTATPrjCode` (`TPTATPrjCode`),
	KEY `VS4TPOSBookVS4TPOSTrans` (`TPTATPBKCode`),
	KEY `VS4TProjectVS4TPOSTrans` (`TPTATPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSTransEmp` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSTransEmp`;

# ---------- CREATE TABLE `VS4TPOSTransEmp` ----------

CREATE TABLE `VS4TPOSTransEmp` (
	`TPTETPTANo` VARCHAR(30) NOT NULL,
	`TPTELn` SMALLINT NOT NULL DEFAULT '0',
	`TPTETEmpCode` VARCHAR(30) NULL,
	`TPTEName` VARCHAR(160) NULL,
	`TPTEPositionName` VARCHAR(50) NULL,
	`TPTEPositionAlias` VARCHAR(15) NULL,
	`TPTETEmGCode` VARCHAR(30) NULL,
	`TPTERate` DOUBLE NULL DEFAULT '0',
	`TPTEFee` FLOAT NULL DEFAULT '0',
	`TPTECustom1` FLOAT NULL DEFAULT '0',
	`TPTECustom2` FLOAT NULL DEFAULT '0',
	`TPTECustom3` FLOAT NULL DEFAULT '0',
	`TPTETCurCode` VARCHAR(5) NULL,
	`TPTENote` VARCHAR(80) NULL,
	`TPTEFlag1` SMALLINT NULL DEFAULT '0',
	`TPTEFlag2` SMALLINT NULL DEFAULT '0',
	`TPTEFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPTETPTANo`, `TPTELn`),
	KEY `TFlETCurCode` (`TPTETCurCode`),
	KEY `TPTAEmpCode` (`TPTETEmpCode`),
	KEY `TPTETEmGCode` (`TPTETEmGCode`),
	KEY `TPTETPOSID` (`TPTETPTANo`),
	KEY `VS4TPOSTransVS4TPOSTransEmp` (`TPTETPTANo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSTransfer` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSTransfer`;

# ---------- CREATE TABLE `VS4TPOSTransfer` ----------

CREATE TABLE `VS4TPOSTransfer` (
	`TPTRNo` VARCHAR(30) NOT NULL,
	`TPTRDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTRDateTime` DATETIME NULL DEFAULT '3333-3-3',
	`TPTRPOSNo` VARCHAR(15) NULL,
	`TPTRTARNCode` VARCHAR(30) NULL,
	`TPTRTPBKCode` VARCHAR(30) NULL,
	`TPTRMode` SMALLINT NULL DEFAULT '0',
	`TPTRGLMethod` SMALLINT NULL DEFAULT '0',
	`TPTRTGLTNo` VARCHAR(30) NULL,
	`TPTRPaymentType` VARCHAR(30) NULL,
	`TPTRPOSTransNo` TEXT NULL,
	`TPTRCostTotal` FLOAT NULL DEFAULT '0',
	`TPTRDiscountList` FLOAT NULL DEFAULT '0',
	`TPTRSubTotalList` FLOAT NULL DEFAULT '0',
	`TPTRSubTotal` FLOAT NULL DEFAULT '0',
	`TPTRDiscountTotal` FLOAT NULL DEFAULT '0',
	`TPTRDiscountAll` FLOAT NULL,
	`TPTRNetTotal` FLOAT NULL,
	`TPTRDeposit` FLOAT NULL DEFAULT '0',
	`TPTRTotal` FLOAT NULL,
	`TPTRTotalInRate` FLOAT NULL,
	`TPTRTaxBase` FLOAT NULL DEFAULT '0',
	`TPTRVATTotal` FLOAT NULL DEFAULT '0',
	`TPTRGrandTotal` FLOAT NULL DEFAULT '0',
	`TPTRNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TPTRWTaxBase` FLOAT NULL DEFAULT '0',
	`TPTRWTaxTotal` FLOAT NULL DEFAULT '0',
	`TPTRNetPayment` FLOAT NULL,
	`TPTRChangeTotal` FLOAT NULL DEFAULT '0',
	`TPTRArrears` FLOAT NULL DEFAULT '0',
	`TPTRAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPTRRewardTotal` FLOAT NULL,
	`TPTRPremiumTotal` FLOAT NULL DEFAULT '0',
	`TPTRRecCash` FLOAT NULL DEFAULT '0',
	`TPTRRecCard` FLOAT NULL DEFAULT '0',
	`TPTRRecRefund` FLOAT NULL DEFAULT '0',
	`TPTRRecBath` FLOAT NULL DEFAULT '0',
	`TPTRRecForeign` FLOAT NULL DEFAULT '0',
	`TPTRRecCheque` FLOAT NULL DEFAULT '0',
	`TPTRRecVoucher` FLOAT NULL DEFAULT '0',
	`TPTRCommissionBase` FLOAT NULL DEFAULT '0',
	`TPTRCommission` FLOAT NULL DEFAULT '0',
	`TPTRTBraCode` VARCHAR(30) NULL,
	`TPTRNetCash` FLOAT NULL DEFAULT '0',
	`TPTRDocStart` VARCHAR(30) NULL,
	`TPTRDocStartDate` DATETIME NULL,
	`TPTRDocEnd` VARCHAR(30) NULL,
	`TPTRDocEndDate` DATETIME NULL,
	`TPTRTotalSlip` INT NULL DEFAULT '0',
	`TPTRTotalCancel` INT NULL DEFAULT '0',
	`TPTRTotalTaxFull` INT NULL DEFAULT '0',
	`TPTRPayCashBill` INT NULL DEFAULT '0',
	`TPTRPayCardBill` INT NULL DEFAULT '0',
	`TPTRPayChequeBill` INT NULL DEFAULT '0',
	`TPTRPayVoucherBill` INT NULL DEFAULT '0',
	`TPTRPayOtherBill` INT NULL DEFAULT '0',
	`TPTRArrearBill` INT NULL DEFAULT '0',
	`TPTRCashStart` FLOAT NULL DEFAULT '0',
	`TPTRCashIn` FLOAT NULL DEFAULT '0',
	`TPTRCashOut` FLOAT NULL DEFAULT '0',
	`TPTRAllCash` FLOAT NULL DEFAULT '0',
	`TPTRCashCount` FLOAT NULL DEFAULT '0',
	`TPTRCashLoss` FLOAT NULL DEFAULT '0',
	`TPTRCreateCode` VARCHAR(30) NULL,
	`TPTRCreateBy` VARCHAR(140) NULL,
	`TPTRCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTREditCode` VARCHAR(30) NULL,
	`TPTREditBy` VARCHAR(140) NULL,
	`TPTREditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTRConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TPTRConfirmBy` VARCHAR(140) NULL,
	`TPTRConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTRApproveStatus` SMALLINT NULL DEFAULT '0',
	`TPTRApproveBy` VARCHAR(140) NULL,
	`TPTRApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTRApproveNote` VARCHAR(80) NULL,
	`TPTRRevision` SMALLINT NULL DEFAULT '0',
	`TPTRCancelStatus` SMALLINT NULL DEFAULT '0',
	`TPTRCancelNo` VARCHAR(30) NULL,
	`TPTRCancelBy` VARCHAR(140) NULL,
	`TPTRCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPTRCancelNote` VARCHAR(80) NULL,
	`TPTRFlag1` SMALLINT NULL DEFAULT '0',
	`TPTRFlag2` SMALLINT NULL DEFAULT '0',
	`TPTRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPTRNo`),
	KEY `TPTRTARNCode` (`TPTRTARNCode`),
	KEY `VS4TPOSBookVS4TPOSTransfer` (`TPTRTPBKCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSTransferMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSTransferMB`;

# ---------- CREATE TABLE `VS4TPOSTransferMB` ----------

CREATE TABLE `VS4TPOSTransferMB` (
	`TPTMTPTRNo` VARCHAR(30) NOT NULL,
	`TPTMLn` SMALLINT NOT NULL DEFAULT '0',
	`TPTMIsChange` SMALLINT NULL DEFAULT '0',
	`TPTMTBCDNo` VARCHAR(30) NULL,
	`TPTMPaymentType` VARCHAR(15) NULL,
	`TPTMCurrency` VARCHAR(4) NULL,
	`TPTMTARNCode` VARCHAR(30) NULL,
	`TPTMCardType` VARCHAR(50) NULL,
	`TPTMCardCode` VARCHAR(50) NULL,
	`TPTMExchangeRate` DOUBLE NULL DEFAULT '0',
	`TPTMAmount` FLOAT NULL DEFAULT '0',
	`TPTMAmountInRate` FLOAT NULL DEFAULT '0',
	`TPTMAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPTMTCBBNo` VARCHAR(30) NULL,
	`TPTMTACCCode` VARCHAR(100) NULL,
	`TPTMTPTANo` VARCHAR(100) NULL,
	`TPTMFlag1` SMALLINT NULL DEFAULT '0',
	`TPTMFlag2` SMALLINT NULL DEFAULT '0',
	`TPTMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPTMTPTRNo`, `TPTMLn`),
	KEY `TPPyTPTANo` (`TPTMTPTRNo`),
	KEY `VS4TARVS4TPOSTransferMB` (`TPTMTARNCode`),
	KEY `VS4TCompanyBankVS4TPOSTransferMB` (`TPTMTCBBNo`),
	KEY `VS4TPaymentTypeVS4TPOSTransferMB` (`TPTMPaymentType`),
	KEY `VS4TPOSTransferVS4TPOSTransferMB` (`TPTMTPTRNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSTransGuide` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSTransGuide`;

# ---------- CREATE TABLE `VS4TPOSTransGuide` ----------

CREATE TABLE `VS4TPOSTransGuide` (
	`TPTGTPTANo` VARCHAR(30) NOT NULL,
	`TPTGLn` SMALLINT NOT NULL DEFAULT '0',
	`TPTGTGCnCode` VARCHAR(30) NULL,
	`TPTGName` VARCHAR(160) NULL,
	`TPTGRate` DOUBLE NULL DEFAULT '0',
	`TPTGFee` FLOAT NULL DEFAULT '0',
	`TPTGCustom1` FLOAT NULL DEFAULT '0',
	`TPTGCustom2` FLOAT NULL DEFAULT '0',
	`TPTGCustom3` FLOAT NULL DEFAULT '0',
	`TPTGTCurCode` VARCHAR(5) NULL,
	`TPTGNote` VARCHAR(80) NULL,
	`TPTGFlag1` SMALLINT NULL DEFAULT '0',
	`TPTGFlag2` SMALLINT NULL DEFAULT '0',
	`TPTGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPTGTPTANo`, `TPTGLn`),
	KEY `TFlGTCurCode` (`TPTGTCurCode`),
	KEY `TPTAEmpCode` (`TPTGTGCnCode`),
	KEY `TPTETPOSID` (`TPTGTPTANo`),
	KEY `VS4TPOSTransVS4TPOSTransGuide` (`TPTGTPTANo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSTransPay` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSTransPay`;

# ---------- CREATE TABLE `VS4TPOSTransPay` ----------

CREATE TABLE `VS4TPOSTransPay` (
	`TPPyTPTANo` VARCHAR(30) NOT NULL,
	`TPPyLn` SMALLINT NOT NULL DEFAULT '0',
	`TPPyIsChange` SMALLINT NULL DEFAULT '0',
	`TPPyPaymentType` VARCHAR(15) NULL,
	`TPPyTBCDNo` VARCHAR(4) NULL,
	`TPPyCurrency` VARCHAR(4) NULL,
	`TPPyTransferDate` DATETIME NULL,
	`TPPyCashDate` DATETIME NULL,
	`TPPyDocNo` VARCHAR(50) NULL,
	`TPPyBankBranch` VARCHAR(50) NULL,
	`TPPyAccountType` VARCHAR(25) NULL,
	`TPPyAccountName` VARCHAR(160) NULL,
	`TPPyAccountNumber` VARCHAR(30) NULL,
	`TPPyCardCode` VARCHAR(30) NULL,
	`TPPyCardType` VARCHAR(50) NULL,
	`TPPyCardName` VARCHAR(50) NULL,
	`TPPyCardNo` VARCHAR(20) NULL,
	`TPPyBackCardNo` VARCHAR(8) NULL,
	`TPPyCardExpire` VARCHAR(7) NULL,
	`TPPyExchangeRate` DOUBLE NULL DEFAULT '0',
	`TPPyAmount` FLOAT NULL DEFAULT '0',
	`TPPyAmountInRate` FLOAT NULL DEFAULT '0',
	`TPPyAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPPyDiscount` FLOAT NULL DEFAULT '0',
	`TPPyFee` FLOAT NULL DEFAULT '0',
	`TPPyFeeProvide` SMALLINT NULL DEFAULT '0',
	`TPPyNetAmount` FLOAT NULL DEFAULT '0',
	`TPPyComBaseAdjust` VARCHAR(30) NULL,
	`TPPyComissionBase` FLOAT NULL DEFAULT '0',
	`TPPyComissionRate` VARCHAR(30) NULL,
	`TPPyComission` FLOAT NULL,
	`TPPyTCBBNo` VARCHAR(30) NULL,
	`TPPyNote` VARCHAR(100) NULL,
	`TPPyFlag1` SMALLINT NULL DEFAULT '0',
	`TPPyFlag2` SMALLINT NULL DEFAULT '0',
	`TPPyFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPPyTPTANo`, `TPPyLn`),
	KEY `TPPyTPTAID` (`TPPyTPTANo`),
	KEY `VS4TPaymentTypeVS4TPOSTransPay` (`TPPyPaymentType`),
	KEY `VS4TPOSTransVS4TPOSPayment` (`TPPyTPTANo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSTransSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSTransSub`;

# ---------- CREATE TABLE `VS4TPOSTransSub` ----------

CREATE TABLE `VS4TPOSTransSub` (
	`TPTSTPTANo` VARCHAR(30) NOT NULL,
	`TPTSLn` SMALLINT NOT NULL DEFAULT '0',
	`TPTSBarCode` VARCHAR(30) NULL,
	`TPTSTPOSCode` VARCHAR(30) NULL,
	`TPTSPOSName` VARCHAR(50) NULL,
	`TPTSDescription` VARCHAR(50) NULL,
	`TPTSPromotionType` VARCHAR(15) NULL,
	`TPTSUnitPrice` FLOAT NULL DEFAULT '0',
	`TPTSPerQuantity` DOUBLE NULL DEFAULT '1',
	`TPTSUnit` VARCHAR(30) NULL,
	`TPTSQuantity` DOUBLE NULL DEFAULT '1',
	`TPTSUnit2` VARCHAR(30) NULL,
	`TPTSQuantity2` DOUBLE NULL DEFAULT '0',
	`TPTSUnit3` VARCHAR(30) NULL,
	`TPTSQuantity3` DOUBLE NULL DEFAULT '0',
	`TPTSFreeCode` VARCHAR(30) NULL,
	`TPTSIsPremium` DOUBLE NULL DEFAULT '0',
	`TPTSNote` VARCHAR(80) NULL,
	`TPTSType` SMALLINT NULL DEFAULT '0',
	`TPTSFactoryCode` VARCHAR(50) NULL,
	`TPTSMinimumOrder` DOUBLE NULL DEFAULT '0',
	`TPTSMaximumOrder` DOUBLE NULL DEFAULT '0',
	`TPTSCost` FLOAT NULL DEFAULT '0',
	`TPTSPrice` FLOAT NULL DEFAULT '0',
	`TPTSAcceptError` VARCHAR(30) NULL,
	`TPTSUnitCalc` SMALLINT NULL DEFAULT '0',
	`TPTSQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TPTSCostAmount` DOUBLE NULL DEFAULT '0',
	`TPTSAmount` FLOAT NULL DEFAULT '0',
	`TPTSDiscountText` VARCHAR(30) NULL,
	`TPTSDiscountTotal` FLOAT NULL,
	`TPTSNetAmount` FLOAT NULL DEFAULT '0',
	`TPTSTaxType` SMALLINT NULL DEFAULT '0',
	`TPTSTaxBase` FLOAT NULL DEFAULT '0',
	`TPTSWTAXBase` FLOAT NULL DEFAULT '0',
	`TPTSAmountVAT` FLOAT NULL DEFAULT '0',
	`TPTSAmountWTAX` FLOAT NULL DEFAULT '0',
	`TPTSCommissionBase` FLOAT NULL DEFAULT '0',
	`TPTSCommissionRate` VARCHAR(30) NULL,
	`TPTSCommission` FLOAT NULL DEFAULT '0',
	`TPTSFlag1` SMALLINT NULL DEFAULT '0',
	`TPTSFlag2` SMALLINT NULL DEFAULT '0',
	`TPTSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPTSTPTANo`, `TPTSLn`),
	KEY `OrderID` (`TPTSLn`),
	KEY `TPTDFreeTPOSID` (`TPTSFreeCode`),
	KEY `TPTSFactoryCode` (`TPTSFactoryCode`),
	KEY `TPTSType` (`TPTSType`),
	KEY `VS4TPOSTransVS4TPOSTransSub` (`TPTSTPTANo`),
	KEY `VS4TPOSVS4TPOSTransSub` (`TPTSTPOSCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPOSUnit` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPOSUnit`;

# ---------- CREATE TABLE `VS4TPOSUnit` ----------

CREATE TABLE `VS4TPOSUnit` (
	`TPOUTPOSCode` VARCHAR(30) NOT NULL,
	`TPOUTUntCode` VARCHAR(15) NOT NULL,
	`TPOURatio` DOUBLE NULL DEFAULT '1',
	`TPOUFlag1` SMALLINT NULL DEFAULT '0',
	`TPOUFlag2` SMALLINT NULL DEFAULT '0',
	`TPOUFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPOUTPOSCode`, `TPOUTUntCode`),
	KEY `SetSaleID` (`TPOUTPOSCode`),
	KEY `VS4TPOSVS4TPOSUnit` (`TPOUTPOSCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPQ` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPQ`;

# ---------- CREATE TABLE `VS4TPQ` ----------

CREATE TABLE `VS4TPQ` (
	`TPQDNo` VARCHAR(30) NOT NULL,
	`TPQDTPRBCode` VARCHAR(30) NULL,
	`TPQDCode` VARCHAR(30) NULL,
	`TPQDType` SMALLINT NULL DEFAULT '0',
	`TPQDDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPQDRefNo` VARCHAR(30) NULL,
	`TPQDRefDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPQDJobCode` VARCHAR(30) NULL,
	`TPQDTJobNo` VARCHAR(30) NULL,
	`TPQDTBraCode` VARCHAR(30) NULL,
	`TPQDDescription` VARCHAR(200) NULL,
	`TPQDProcessStatus` SMALLINT NULL DEFAULT '0',
	`TPQDRequestCode` VARCHAR(30) NULL,
	`TPQDRequestBy` VARCHAR(140) NULL,
	`TPQDCreateCode` VARCHAR(30) NULL,
	`TPQDCreateBy` VARCHAR(140) NULL,
	`TPQDCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPQDEditCode` VARCHAR(30) NULL,
	`TPQDEditBy` VARCHAR(140) NULL,
	`TPQDEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPQDConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TPQDConfirmBy` VARCHAR(140) NULL,
	`TPQDConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPQDApproveStatus` SMALLINT NULL DEFAULT '0',
	`TPQDApproveBy` VARCHAR(140) NULL,
	`TPQDApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPQDApproveNote` VARCHAR(80) NULL,
	`TPQDRevision` SMALLINT NULL DEFAULT '0',
	`TPQDReviseStatus` SMALLINT NULL DEFAULT '0',
	`TPQDCancelStatus` SMALLINT NULL DEFAULT '0',
	`TPQDCancelNo` VARCHAR(30) NULL,
	`TPQDCancelBy` VARCHAR(140) NULL,
	`TPQDCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPQDCancelNote` VARCHAR(80) NULL,
	`TPQDFlag1` SMALLINT NULL DEFAULT '0',
	`TPQDFlag2` SMALLINT NULL DEFAULT '0',
	`TPQDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPQDNo`),
	KEY `TPRDJobCode` (`TPQDJobCode`),
	KEY `TPRDTBokCode` (`TPQDTPRBCode`),
	KEY `TSODCode` (`TPQDCode`),
	KEY `TSTKTShfID` (`TPQDTJobNo`),
	KEY `TTfrFromTLctCode` (`TPQDTBraCode`),
	KEY `TTfrFromTStoCode` (`TPQDRequestBy`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPQMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPQMB`;

# ---------- CREATE TABLE `VS4TPQMB` ----------

CREATE TABLE `VS4TPQMB` (
	`TPQMTPQDNo` VARCHAR(30) NOT NULL,
	`TPQMLn` INT NOT NULL DEFAULT '0',
	`TPQMType` SMALLINT NULL DEFAULT '0',
	`TPQMTJobNo` VARCHAR(30) NULL,
	`TPQMJobCode` VARCHAR(30) NULL,
	`TPQMGroupName` VARCHAR(50) NULL,
	`TPQMProductCode` VARCHAR(50) NULL,
	`TPQMFactoryCode` VARCHAR(50) NULL,
	`TPQMProductName` VARCHAR(150) NULL,
	`TPQMQuantity` DOUBLE NULL DEFAULT '0',
	`TPQMTUntCode` VARCHAR(50) NULL,
	`TPQMDescription` VARCHAR(255) NULL,
	`TPQMDescription2` VARCHAR(255) NULL,
	`TPQMDescription3` VARCHAR(255) NULL,
	`TPQMProcessStatus` SMALLINT NULL DEFAULT '0',
	`TPQMStatus` SMALLINT NULL DEFAULT '0',
	`TPQMFlag1` SMALLINT NULL DEFAULT '0',
	`TPQMFlag2` SMALLINT NULL DEFAULT '0',
	`TPQMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPQMTPQDNo`, `TPQMLn`),
	KEY `TPRMTJobNo` (`TPQMTJobNo`),
	KEY `TPWBID` (`TPQMLn`),
	KEY `TPWBPdtCode` (`TPQMFactoryCode`),
	KEY `TPWBPdtCode1` (`TPQMProductCode`),
	KEY `TPWBTUntCode` (`TPQMTUntCode`),
	KEY `TTfMID` (`TPQMTPQDNo`),
	KEY `TTfrToTShfCode` (`TPQMType`),
	KEY `VS4TPQVS4TPQMB` (`TPQMTPQDNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPR` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPR`;

# ---------- CREATE TABLE `VS4TPR` ----------

CREATE TABLE `VS4TPR` (
	`TPRDNo` VARCHAR(30) NOT NULL,
	`TPRDTPRBCode` VARCHAR(30) NULL,
	`TPRDMode` SMALLINT NULL DEFAULT '0',
	`TPRDCode` VARCHAR(30) NULL,
	`TPRDType` SMALLINT NULL DEFAULT '0',
	`TPRDDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPRDRefNo` VARCHAR(30) NULL,
	`TPRDRefDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPRDJobCode` VARCHAR(30) NULL,
	`TPRDTJobNo` VARCHAR(30) NULL,
	`TPRDTJbMLn` INT NULL DEFAULT '0',
	`TPRDTJPMLn` INT NULL DEFAULT '0',
	`TPRDTJPDNo` VARCHAR(30) NULL,
	`TPRDTPrjCode` VARCHAR(30) NULL,
	`TPRDTSecCode` VARCHAR(30) NULL,
	`TPRDTDepCode` VARCHAR(30) NULL,
	`TPRDTDivCode` VARCHAR(30) NULL,
	`TPRDTBraCode` VARCHAR(30) NULL,
	`TPRDTAPNCode` VARCHAR(30) NULL,
	`TPRDDescription` VARCHAR(255) NULL,
	`TPRDProcessStatus` SMALLINT NULL DEFAULT '0',
	`TPRDDeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TPRDRequestCode` VARCHAR(30) NULL,
	`TPRDRequestBy` VARCHAR(140) NULL,
	`TPRDCreateCode` VARCHAR(30) NULL,
	`TPRDCreateBy` VARCHAR(140) NULL,
	`TPRDCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPRDEditCode` VARCHAR(30) NULL,
	`TPRDEditBy` VARCHAR(140) NULL,
	`TPRDEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPRDConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TPRDConfirmBy` VARCHAR(140) NULL,
	`TPRDConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPRDApproveStatus` SMALLINT NULL DEFAULT '0',
	`TPRDApproveBy` VARCHAR(140) NULL,
	`TPRDApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPRDApproveNote` VARCHAR(80) NULL,
	`TPRDRevision` SMALLINT NULL DEFAULT '0',
	`TPRDReviseStatus` SMALLINT NULL DEFAULT '0',
	`TPRDCancelStatus` SMALLINT NULL DEFAULT '0',
	`TPRDCancelNo` VARCHAR(30) NULL,
	`TPRDCancelBy` VARCHAR(140) NULL,
	`TPRDCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPRDCancelNote` VARCHAR(80) NULL,
	`TPRDFlag1` SMALLINT NULL DEFAULT '0',
	`TPRDFlag2` SMALLINT NULL DEFAULT '0',
	`TPRDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPRDNo`),
	KEY `TPCNTJbMLn` (`TPRDTJbMLn`),
	KEY `TPRDJobCode` (`TPRDJobCode`),
	KEY `TPRDTBokCode` (`TPRDTPRBCode`),
	KEY `TPRMTAPNCode` (`TPRDTAPNCode`),
	KEY `TSODCode` (`TPRDCode`),
	KEY `TSTKTShfID` (`TPRDTJobNo`),
	KEY `TSTKTShfID1` (`TPRDTPrjCode`),
	KEY `TSTKTShfID2` (`TPRDTDepCode`),
	KEY `TTfrFromTLctCode` (`TPRDTBraCode`),
	KEY `TTfrFromTShfCode` (`TPRDTDivCode`),
	KEY `TTfrFromTStoCode` (`TPRDRequestBy`),
	KEY `VS4TPRBookVS4TPR` (`TPRDTPRBCode`),
	KEY `VS4TProjectVS4TPR` (`TPRDTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPRBook` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPRBook`;

# ---------- CREATE TABLE `VS4TPRBook` ----------

CREATE TABLE `VS4TPRBook` (
	`TPRBCode` VARCHAR(30) NOT NULL,
	`TPRBName` VARCHAR(140) NULL,
	`TPRBName2` VARCHAR(140) NULL,
	`TPRBDocCode` VARCHAR(30) NULL,
	`TPRBFlag1` SMALLINT NULL DEFAULT '0',
	`TPRBFlag2` SMALLINT NULL DEFAULT '0',
	`TPRBFlag3` SMALLINT NULL DEFAULT '0',
	UNIQUE KEY `TPRBCode` (`TPRBCode`),
	KEY `Index_B0D14894_767D_4A78` (`TPRBCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPriceFormula` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPriceFormula`;

# ---------- CREATE TABLE `VS4TPriceFormula` ----------

CREATE TABLE `VS4TPriceFormula` (
	`TPFlCode` VARCHAR(30) NOT NULL,
	`TPFlName` VARCHAR(100) NULL,
	`TPFlName2` VARCHAR(100) NULL,
	`TPFlFormula` VARCHAR(30) NULL,
	`TPFlFlag1` SMALLINT NULL DEFAULT '0',
	`TPFlFlag2` SMALLINT NULL DEFAULT '0',
	`TPFlFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPFlCode`),
	KEY `TBnkCode` (`TPFlCode`),
	KEY `TPrjDocCode` (`TPFlFormula`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPricelist` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPricelist`;

# ---------- CREATE TABLE `VS4TPricelist` ----------

CREATE TABLE `VS4TPricelist` (
	`TPPLNo` VARCHAR(30) NOT NULL,
	`TPPLDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPPLRefNo` VARCHAR(30) NULL,
	`TPPLDescription` VARCHAR(200) NULL,
	`TPPLCreateCode` VARCHAR(30) NULL,
	`TPPLCreateBy` VARCHAR(140) NULL,
	`TPPLCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPPLEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPPLEditCode` VARCHAR(30) NULL,
	`TPPLEditBy` VARCHAR(140) NULL,
	`TPPLConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TPPLConfirmBy` VARCHAR(140) NULL,
	`TPPLConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPPLApproveStatus` SMALLINT NULL DEFAULT '0',
	`TPPLApproveBy` VARCHAR(140) NULL,
	`TPPLApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPPLApproveNote` VARCHAR(80) NULL,
	`TPPLRevision` SMALLINT NULL DEFAULT '0',
	`TPPLCancelStatus` SMALLINT NULL DEFAULT '0',
	`TPPLCancelBy` VARCHAR(140) NULL,
	`TPPLCancelNo` VARCHAR(30) NULL,
	`TPPLCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPPLCancelNote` VARCHAR(80) NULL,
	`TPPLFlag1` SMALLINT NULL DEFAULT '0',
	`TPPLFlag2` SMALLINT NULL DEFAULT '0',
	`TPPLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPPLNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPricelistMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPricelistMB`;

# ---------- CREATE TABLE `VS4TPricelistMB` ----------

CREATE TABLE `VS4TPricelistMB` (
	`TPPMTPPLNo` VARCHAR(30) NOT NULL,
	`TPPMLn` INT NOT NULL DEFAULT '0',
	`TPPMTPOSCode` VARCHAR(30) NULL,
	`TPPMFromQuantity` DOUBLE NULL DEFAULT '0',
	`TPPMTUntCode` VARCHAR(15) NULL,
	`TPPMTARGCode` VARCHAR(30) NULL,
	`TPPMTARNCode` VARCHAR(30) NULL,
	`TPPMUnitCost` FLOAT NULL DEFAULT '0',
	`TPPMPrice1` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode1` VARCHAR(5) NULL,
	`TPPMDiscountText1` VARCHAR(255) NULL,
	`TPPMPrice2` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode2` VARCHAR(5) NULL,
	`TPPMDiscountText2` VARCHAR(255) NULL,
	`TPPMPrice3` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode3` VARCHAR(5) NULL,
	`TPPMDiscountText3` VARCHAR(255) NULL,
	`TPPMPrice4` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode4` VARCHAR(5) NULL,
	`TPPMDiscountText4` VARCHAR(255) NULL,
	`TPPMPrice5` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode5` VARCHAR(5) NULL,
	`TPPMDiscountText5` VARCHAR(255) NULL,
	`TPPMPrice6` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode6` VARCHAR(5) NULL,
	`TPPMDiscountText6` VARCHAR(255) NULL,
	`TPPMPrice7` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode7` VARCHAR(5) NULL,
	`TPPMDiscountText7` VARCHAR(255) NULL,
	`TPPMPrice8` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode8` VARCHAR(5) NULL,
	`TPPMDiscountText8` VARCHAR(255) NULL,
	`TPPMPrice9` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode9` VARCHAR(5) NULL,
	`TPPMDiscountText9` VARCHAR(255) NULL,
	`TPPMPrice10` FLOAT NULL DEFAULT '0',
	`TPPMTCurCode10` VARCHAR(5) NULL,
	`TPPMDiscountText10` VARCHAR(255) NULL,
	`TPPMStatus` SMALLINT NULL DEFAULT '0',
	`TPPMFlag1` SMALLINT NULL DEFAULT '0',
	`TPPMFlag2` SMALLINT NULL DEFAULT '0',
	`TPPMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPPMTPPLNo`, `TPPMLn`),
	KEY `TPOSPricTPOSCode` (`TPPMTPOSCode`),
	KEY `TPPMTARNCode` (`TPPMTARGCode`),
	KEY `TPPMTCurCode1` (`TPPMTCurCode6`),
	KEY `TPPMTCurCode2` (`TPPMTCurCode7`),
	KEY `TPPMTCurCode3` (`TPPMTCurCode4`),
	KEY `TPPMTCurCode31` (`TPPMTCurCode5`),
	KEY `TPPMTCurCode32` (`TPPMTCurCode8`),
	KEY `TPPMTCurCode4` (`TPPMTCurCode9`),
	KEY `TPPMTCurCode5` (`TPPMTCurCode10`),
	KEY `TPPMTPOSCode` (`TPPMTARNCode`),
	KEY `TPPMTTuntiCode` (`TPPMTUntCode`),
	KEY `TPPSPTCurCode` (`TPPMTCurCode1`),
	KEY `TPSPTCurCode` (`TPPMTCurCode2`),
	KEY `TPSPTCurCode1` (`TPPMTCurCode3`),
	KEY `VS4TPOSPriceVS4TPOSPriceMB` (`TPPMTPPLNo`),
	KEY `VS4TPOSVS4TPOSPrice` (`TPPMTPOSCode`),
	KEY `VS4TUnitVS4TPricelistMB` (`TPPMTUntCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPRMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPRMB`;

# ---------- CREATE TABLE `VS4TPRMB` ----------

CREATE TABLE `VS4TPRMB` (
	`TPRMTPRDNo` VARCHAR(30) NOT NULL,
	`TPRMLn` INT NOT NULL DEFAULT '0',
	`TPRMType` SMALLINT NULL DEFAULT '0',
	`TPRMTJobNo` VARCHAR(30) NULL,
	`TPRMJobCode` VARCHAR(30) NULL,
	`TPRMMaterialMode` SMALLINT NULL DEFAULT '0',
	`TPRMGroupName` VARCHAR(50) NULL,
	`TPRMTPdtCode` VARCHAR(50) NULL,
	`TPRMProductCode` VARCHAR(50) NULL,
	`TPRMFactoryCode` VARCHAR(50) NULL,
	`TPRMProductName` VARCHAR(255) NULL,
	`TPRMCustom1` VARCHAR(30) NULL,
	`TPRMCustom2` VARCHAR(30) NULL,
	`TPRMCustom3` VARCHAR(30) NULL,
	`TPRMCustom4` VARCHAR(30) NULL,
	`TPRMCustom5` VARCHAR(30) NULL,
	`TPRMPrice` FLOAT NULL DEFAULT '0',
	`TPRMPerQuantity` DOUBLE NULL DEFAULT '0',
	`TPRMDiscountText` VARCHAR(30) NULL,
	`TPRMDiscountTotal` FLOAT NULL,
	`TPRMTaxType` SMALLINT NULL DEFAULT '0',
	`TPRMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TPRMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TPRMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TPRMQuantity` DOUBLE NULL DEFAULT '0',
	`TPRMAmount` DOUBLE NULL DEFAULT '0',
	`TPRMNetAmount` FLOAT NULL DEFAULT '0',
	`TPRMRefill` DOUBLE NULL DEFAULT '0',
	`TPRMMarkTotal` DOUBLE NULL DEFAULT '0',
	`TPRMStockOnHand` DOUBLE NULL DEFAULT '0',
	`TPRMMinStock` DOUBLE NULL DEFAULT '0',
	`TPRMPOArrearCalc` DOUBLE NULL DEFAULT '0',
	`TPRMSuggest` DOUBLE NULL DEFAULT '0',
	`TPRMPOArrear` DOUBLE NULL DEFAULT '0',
	`TPRMTotalDelivery` DOUBLE NULL DEFAULT '0',
	`TPRMTotalArrear` DOUBLE NULL DEFAULT '0',
	`TPRMTUntCode` VARCHAR(50) NULL,
	`TPRMQuantity2` DOUBLE NULL DEFAULT '0',
	`TPRMStockOnHand2` DOUBLE NULL DEFAULT '0',
	`TPRMTotalDelivery2` DOUBLE NULL DEFAULT '0',
	`TPRMTotalArrear2` DOUBLE NULL DEFAULT '0',
	`TPRMTUntCode2` VARCHAR(50) NULL,
	`TPRMQuantity3` DOUBLE NULL DEFAULT '0',
	`TPRMStockOnHand3` DOUBLE NULL DEFAULT '0',
	`TPRMTotalDelivery3` DOUBLE NULL DEFAULT '0',
	`TPRMTotalArrear3` DOUBLE NULL DEFAULT '0',
	`TPRMTUntCode3` VARCHAR(50) NULL,
	`TPRMUseType` SMALLINT NULL DEFAULT '0',
	`TPRMUseDate` DATETIME NULL,
	`TPRMDescription` VARCHAR(255) NULL,
	`TPRMProcessStatus` SMALLINT NULL DEFAULT '0',
	`TPRMStatus` SMALLINT NULL DEFAULT '0',
	`TPRMMapTPdtCode` VARCHAR(30) NULL,
	`TPRMMapTUntCode` VARCHAR(50) NULL,
	`TPRMMapRatioP` DOUBLE NULL DEFAULT '0',
	`TPRMFlag1` SMALLINT NULL DEFAULT '0',
	`TPRMFlag2` SMALLINT NULL DEFAULT '0',
	`TPRMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPRMTPRDNo`, `TPRMLn`),
	KEY `TPOBMapTPdtCode` (`TPRMMapTPdtCode`),
	KEY `TPOBMapTUntCode` (`TPRMMapTUntCode`),
	KEY `TPOBUnitFactor` (`TPRMUnitFactor`),
	KEY `TPRMTJobNo` (`TPRMTJobNo`),
	KEY `TPRMTPdtCode` (`TPRMTPdtCode`),
	KEY `TPRMTUntCode2` (`TPRMTUntCode3`),
	KEY `TPRMUnitFactor` (`TPRMMapRatioP`),
	KEY `TPWBID` (`TPRMLn`),
	KEY `TPWBPdtCode` (`TPRMFactoryCode`),
	KEY `TPWBPdtCode1` (`TPRMProductCode`),
	KEY `TPWBTUntCode` (`TPRMTUntCode`),
	KEY `TPWBTUntCode1` (`TPRMTUntCode2`),
	KEY `TTfMID` (`TPRMTPRDNo`),
	KEY `TTfrToTShfCode` (`TPRMType`),
	KEY `VS4TPWRVS4TPWRMB` (`TPRMTPRDNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProduct` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProduct`;

# ---------- CREATE TABLE `VS4TProduct` ----------

CREATE TABLE `VS4TProduct` (
	`TPdtCode` VARCHAR(30) NOT NULL,
	`TPdtBarcode` VARCHAR(30) NULL,
	`TPdtName` VARCHAR(150) NULL,
	`TPdtName2` VARCHAR(150) NULL,
	`TPdtAliasSlip` VARCHAR(150) NULL,
	`TPdtAliasName` VARCHAR(30) NULL,
	`TPdtTDwgCode` VARCHAR(30) NULL,
	`TPdtTPrjCode` VARCHAR(30) NULL,
	`TPdtDescription` VARCHAR(255) NULL,
	`TPdtUnitType` SMALLINT NULL DEFAULT '0',
	`TPdtTUntCode` VARCHAR(15) NULL,
	`TPdtTUntCode2` VARCHAR(15) NULL,
	`TPdtTUntCode3` VARCHAR(15) NULL,
	`TPdtUnit2Ratio` DOUBLE NULL DEFAULT '0',
	`TPdtUnit3Ratio` DOUBLE NULL DEFAULT '0',
	`TPdtUsage` SMALLINT NULL DEFAULT '0',
	`TPdtUseBOM` SMALLINT NULL DEFAULT '0',
	`TPdtOldCode` VARCHAR(30) NULL,
	`TPdtFactoryCode` VARCHAR(30) NULL,
	`TPdtFactoryOldCode` VARCHAR(30) NULL,
	`TPdtFactoryName` VARCHAR(150) NULL,
	`TPdtTransferCode` VARCHAR(50) NULL,
	`TPdtTransferName` VARCHAR(150) NULL,
	`TPdtTransferName2` VARCHAR(150) NULL,
	`TPdtTAPNCode` VARCHAR(30) NULL,
	`TPdtTPTTCode` VARCHAR(30) NULL,
	`TPdtTPDLCode` VARCHAR(30) NULL,
	`TPdtTPSECode` VARCHAR(30) NULL,
	`TPdtTPS2Code` VARCHAR(30) NULL,
	`TPdtTPS3Code` VARCHAR(30) NULL,
	`TPdtTPS4Code` VARCHAR(30) NULL,
	`TPdtTPG1Code` VARCHAR(30) NULL,
	`TPdtTPG2Code` VARCHAR(30) NULL,
	`TPdtTPG3Code` VARCHAR(30) NULL,
	`TPdtTPG4Code` VARCHAR(30) NULL,
	`TPdtTBndCode` VARCHAR(30) NULL,
	`TPdtTACSCode` VARCHAR(30) NULL,
	`TPdtSceinceName` VARCHAR(150) NULL,
	`TPdtRegisterNo` VARCHAR(30) NULL,
	`TPdtUseMethod` VARCHAR(100) NULL,
	`TPdtWarning` VARCHAR(50) NULL,
	`TPdtGoodsDateLabel` VARCHAR(30) NULL,
	`TPdtExpDateLabel` VARCHAR(30) NULL,
	`TPdtQuantityText` VARCHAR(50) NULL,
	`TPdtIcon1` VARCHAR(50) NULL,
	`TPdtImage1` VARCHAR(50) NULL,
	`TPdtSpec1` VARCHAR(100) NULL,
	`TPdtTPCTAlias` VARCHAR(30) NULL,
	`TPdtCustom1` VARCHAR(100) NULL,
	`TPdtCustom2` VARCHAR(100) NULL,
	`TPdtCustom3` VARCHAR(100) NULL,
	`TPdtCustom4` VARCHAR(100) NULL,
	`TPdtCustom5` VARCHAR(100) NULL,
	`TPdtCustom6` VARCHAR(100) NULL,
	`TPdtCustom7` VARCHAR(100) NULL,
	`TPdtCustom8` VARCHAR(100) NULL,
	`TPdtCustom9` VARCHAR(100) NULL,
	`TPdtCustom10` VARCHAR(100) NULL,
	`TPdtPackText1` VARCHAR(255) NULL,
	`TPdtPackText2` VARCHAR(255) NULL,
	`TPdtPackAlias1` VARCHAR(255) NULL,
	`TPdtPackAlias2` VARCHAR(255) NULL,
	`TPdtSafeDayCalc` SMALLINT NULL DEFAULT '0',
	`TPdtBackDayCalc` SMALLINT NULL DEFAULT '0',
	`TPdtEOQ` DOUBLE NULL DEFAULT '0',
	`TPdtOrderPoint` DOUBLE NULL DEFAULT '0',
	`TPdtMaxUsePerDay` DOUBLE NULL DEFAULT '0',
	`TPdtAvgUsePerDay` DOUBLE NULL DEFAULT '0',
	`TPdtStockType` DOUBLE NULL DEFAULT '0',
	`TPdtStockQuantity` DOUBLE NULL DEFAULT '0',
	`TPdtFirstDate` DATETIME NULL,
	`TPdtLastMoveDate` DATETIME NULL,
	`TPdtFirstCostInStk` FLOAT NULL DEFAULT '0',
	`TPdtLastCost` FLOAT NULL DEFAULT '0',
	`TPdtStandardCost` FLOAT NULL DEFAULT '0',
	`TPdtStdCostCode` VARCHAR(30) NULL,
	`TPdtAutoCostCode` SMALLINT NULL DEFAULT '0',
	`TPdtPremiumCost` FLOAT NULL DEFAULT '0',
	`TPdtAverageCost` FLOAT NULL DEFAULT '0',
	`TPdtAreaCost` FLOAT NULL DEFAULT '0',
	`TPdtAmount` FLOAT NULL DEFAULT '0',
	`TPdtUseImageCode` SMALLINT NULL DEFAULT '0',
	`TPdtUseIconImage` SMALLINT NULL DEFAULT '0',
	`TPdtTPPuCode` VARCHAR(30) NULL,
	`TPdtSerialType` SMALLINT NULL DEFAULT '0',
	`TPdtPurchaseFee` FLOAT NULL DEFAULT '0',
	`TPdtGroupReport` VARCHAR(30) NULL,
	`TPdtSlowDay` SMALLINT NULL DEFAULT '0',
	`TPdtDeadDay` SMALLINT NULL DEFAULT '0',
	`TPdtLastBalDate` DATETIME NULL,
	`TPdtCreateCode` VARCHAR(30) NULL,
	`TPdtCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPdtEditCode` VARCHAR(30) NULL,
	`TPdtEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPdtTextSort` VARCHAR(30) NULL,
	`TPdtFlag1` SMALLINT NULL DEFAULT '0',
	`TPdtFlag2` SMALLINT NULL DEFAULT '0',
	`TPdtFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPdtCode`),
	KEY `TPdtBarcode` (`TPdtBarcode`),
	KEY `TPdtTACSCode` (`TPdtTACSCode`),
	KEY `VS4TProductLineVS4TProduct` (`TPdtTPDLCode`),
	KEY `VS4TProductSectionVS4TProduct` (`TPdtTPSECode`),
	KEY `VS4TUnitVS4TProduct` (`TPdtTUntCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProduct2` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProduct2`;

# ---------- CREATE TABLE `VS4TProduct2` ----------

CREATE TABLE `VS4TProduct2` (
	`TPd2TPdtCode` VARCHAR(30) NOT NULL,
	`TPd2Ln` INT NOT NULL DEFAULT '0',
	`TPd2FillNameStock` SMALLINT NULL DEFAULT '0',
	`TPd2ScrapPCMRP` DOUBLE NULL DEFAULT '0',
	`TPd2ScrapPCReceive` DOUBLE NULL DEFAULT '0',
	`TPd2ScrapPCSend` DOUBLE NULL DEFAULT '0',
	`TPd2TaxType` SMALLINT NULL DEFAULT '0',
	`TPd2TaxRate` DOUBLE NULL DEFAULT '0',
	`TPd2CostFormula` VARCHAR(50) NULL,
	`TPd2Weight` DOUBLE NULL DEFAULT '0',
	`TPd2VendorIncent1` FLOAT NULL DEFAULT '0',
	`TPd2VendorIncent2` FLOAT NULL DEFAULT '0',
	`TPd2TACSCode` VARCHAR(30) NULL,
	`TPd2TACCCode` VARCHAR(30) NULL,
	`TPd2PurTACCCode` VARCHAR(30) NULL,
	`TPd2SaleTACCCode` VARCHAR(30) NULL,
	`TPd2IMTACCCode` VARCHAR(30) NULL,
	`TPd2EXTACCCode` VARCHAR(30) NULL,
	`TPd2CNTACCCode` VARCHAR(30) NULL,
	`TPd2PCNTACCCode` VARCHAR(30) NULL,
	`TPd2COSTACCCode` VARCHAR(30) NULL,
	`TPd2SkipSuggest` SMALLINT NULL DEFAULT '0',
	`TPd2QuantityAlert` DOUBLE NULL DEFAULT '0',
	`TPd2TotalQuantity` DOUBLE NULL DEFAULT '0',
	`TPd2Yield` DOUBLE NULL DEFAULT '0',
	`TPd2OrderQuantity` DOUBLE NULL DEFAULT '0',
	`TPd2HasBOM` SMALLINT NULL DEFAULT '0',
	`TPd2TWRMCode` VARCHAR(30) NULL,
	`TPd2StdDM` DOUBLE NULL,
	`TPd2StdDL` DOUBLE NULL,
	`TPd2StdOH` DOUBLE NULL,
	`TPd2StdOHType` SMALLINT NULL,
	`TPd2ScrapType` SMALLINT NULL,
	`TPd2BulkPOrder` SMALLINT NULL,
	`TPd2MinimumPOrder` DOUBLE NULL,
	`TPd2MultiplePOrder` DOUBLE NULL,
	`TPd2Flag1` SMALLINT NULL DEFAULT '0',
	`TPd2Flag2` SMALLINT NULL DEFAULT '0',
	`TPd2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPd2TPdtCode`, `TPd2Ln`),
	KEY `TPd2EXTACCCode` (`TPd2PCNTACCCode`),
	KEY `TPd2EXTACCCode1` (`TPd2COSTACCCode`),
	KEY `TPd2IMTACCCode` (`TPd2CNTACCCode`),
	KEY `TPd2PurTACCCode` (`TPd2IMTACCCode`),
	KEY `TPd2SaleTACCCode` (`TPd2EXTACCCode`),
	KEY `TPdLPurTACCCode` (`TPd2PurTACCCode`),
	KEY `TPdLSaleTACCCode` (`TPd2SaleTACCCode`),
	KEY `TPdLTACCCode` (`TPd2TACCCode`),
	KEY `TPdLTACSCode` (`TPd2TACSCode`),
	KEY `VS4TProductVS4TProduct2` (`TPd2TPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductCalcTyp` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductCalcTyp`;

# ---------- CREATE TABLE `VS4TProductCalcTyp` ----------

CREATE TABLE `VS4TProductCalcTyp` (
	`TPCTAlias` VARCHAR(30) NOT NULL,
	`TPCTName` VARCHAR(100) NULL,
	`TPCTName2` VARCHAR(100) NULL,
	`TPCTSort` SMALLINT NULL DEFAULT '0',
	`TPCTFlag1` SMALLINT NULL DEFAULT '0',
	`TPCTFlag2` SMALLINT NULL DEFAULT '0',
	`TPCTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPCTAlias`),
	KEY `TACTCode` (`TPCTAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductDL` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductDL`;

# ---------- CREATE TABLE `VS4TProductDL` ----------

CREATE TABLE `VS4TProductDL` (
	`TPLBTPdtCode` VARCHAR(50) NOT NULL,
	`TPLBTSpdStep` INT NOT NULL DEFAULT '0',
	`TPLBLn` INT NOT NULL DEFAULT '0',
	`TPLBTEmpCode` VARCHAR(30) NULL,
	`TPLBEmployeeName` VARCHAR(150) NULL,
	`TPLBPositionName` VARCHAR(150) NULL,
	`TPLBMan` SMALLINT NULL DEFAULT '1',
	`TPLBQuantity` DOUBLE NULL DEFAULT '1',
	`TPLBCost` DOUBLE NULL DEFAULT '1',
	`TPLBTotalCost` DOUBLE NULL DEFAULT '1',
	`TPLBRemark` VARCHAR(50) NULL,
	`TPLBFlag1` SMALLINT NULL DEFAULT '0',
	`TPLBFlag2` SMALLINT NULL DEFAULT '0',
	`TPLBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPLBTPdtCode`, `TPLBTSpdStep`, `TPLBLn`),
	KEY `TJbMTJobNo` (`TPLBTPdtCode`),
	KEY `TJMtTFPSCode` (`TPLBTEmpCode`),
	KEY `TJMtTSpdStep` (`TPLBTSpdStep`),
	KEY `VS4TProductVS4TProductDL` (`TPLBTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductGroup1` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductGroup1`;

# ---------- CREATE TABLE `VS4TProductGroup1` ----------

CREATE TABLE `VS4TProductGroup1` (
	`TPG1Code` VARCHAR(30) NOT NULL,
	`TPG1Name` VARCHAR(150) NULL,
	`TPG1Name2` VARCHAR(150) NULL,
	`TPG1SectionSource` SMALLINT NULL DEFAULT '0',
	`TPG1TPSECode` VARCHAR(30) NULL,
	`TPG1TACSCode` VARCHAR(30) NULL,
	`TPG1TACCCode` VARCHAR(30) NULL,
	`TPG1PurTACCCode` VARCHAR(30) NULL,
	`TPG1SaleTACCCode` VARCHAR(30) NULL,
	`TPG12IMTACCCode` VARCHAR(30) NULL,
	`TPG1EXTACCCode` VARCHAR(30) NULL,
	`TPG1CNTACCCode` VARCHAR(30) NULL,
	`TPG1PCNTACCCode` VARCHAR(30) NULL,
	`TPG1COSTACCCode` VARCHAR(30) NULL,
	`TPG1DocCode` VARCHAR(30) NULL,
	`TPG1Flag1` SMALLINT NULL DEFAULT '0',
	`TPG1Flag2` SMALLINT NULL DEFAULT '0',
	`TPG1Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPG1Code`),
	KEY `ProductMemberCategoryID` (`TPG1Flag1`),
	KEY `ProductMemberProductID1` (`TPG1Name`),
	KEY `TPd2CNTACCCode` (`TPG1CNTACCCode`),
	KEY `TPd2COSTACCCode` (`TPG1COSTACCCode`),
	KEY `TPd2EXTACCCode` (`TPG1EXTACCCode`),
	KEY `TPd2IMTACCCode` (`TPG12IMTACCCode`),
	KEY `TPd2PCNTACCCode` (`TPG1PCNTACCCode`),
	KEY `TPdGCode` (`TPG1Code`),
	KEY `TPdGPdtGroupCode` (`TPG1TPSECode`),
	KEY `TPdLTACSCode` (`TPG1TACSCode`),
	KEY `TPG1Name` (`TPG1Name2`),
	KEY `TPG1TPSECode` (`TPG1TACCCode`),
	KEY `TPGsFlag1` (`TPG1Flag2`),
	KEY `TPGsFlag11` (`TPG1Flag3`),
	KEY `TPSEPurTACCCode` (`TPG1PurTACCCode`),
	KEY `TPSESaleTACCCode` (`TPG1SaleTACCCode`),
	KEY `TPTTDocCode` (`TPG1DocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductGroup2` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductGroup2`;

# ---------- CREATE TABLE `VS4TProductGroup2` ----------

CREATE TABLE `VS4TProductGroup2` (
	`TPG2Code` VARCHAR(30) NOT NULL,
	`TPG2Name` VARCHAR(150) NULL,
	`TPG2Name2` VARCHAR(150) NULL,
	`TPG2SectionSource` SMALLINT NULL DEFAULT '0',
	`TPG2TPSECode` VARCHAR(30) NULL,
	`TPG2DocCode` VARCHAR(30) NULL,
	`TPG2Flag1` SMALLINT NULL DEFAULT '0',
	`TPG2Flag2` SMALLINT NULL DEFAULT '0',
	`TPG2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPG2Code`),
	KEY `ProductMemberCategoryID` (`TPG2Flag1`),
	KEY `ProductMemberProductID1` (`TPG2Name`),
	KEY `TPdGCode` (`TPG2Code`),
	KEY `TPdGPdtGroupCode` (`TPG2TPSECode`),
	KEY `TPG2Name` (`TPG2Name2`),
	KEY `TPGsFlag1` (`TPG2Flag2`),
	KEY `TPGsFlag11` (`TPG2Flag3`),
	KEY `TPTTDocCode` (`TPG2DocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductGroup3` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductGroup3`;

# ---------- CREATE TABLE `VS4TProductGroup3` ----------

CREATE TABLE `VS4TProductGroup3` (
	`TPG3Code` VARCHAR(30) NOT NULL,
	`TPG3Name` VARCHAR(150) NULL,
	`TPG3Name2` VARCHAR(150) NULL,
	`TPG3SectionSource` SMALLINT NULL DEFAULT '0',
	`TPG3TPS2Code` VARCHAR(30) NULL,
	`TPG3DocCode` VARCHAR(30) NULL,
	`TPG3Flag1` SMALLINT NULL DEFAULT '0',
	`TPG3Flag2` SMALLINT NULL DEFAULT '0',
	`TPG3Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPG3Code`),
	KEY `ProductMemberCategoryID` (`TPG3Flag1`),
	KEY `ProductMemberProductID1` (`TPG3Name`),
	KEY `TPdGCode` (`TPG3Code`),
	KEY `TPdGPdtGroupCode` (`TPG3TPS2Code`),
	KEY `TPG3Name` (`TPG3Name2`),
	KEY `TPGsFlag1` (`TPG3Flag2`),
	KEY `TPGsFlag11` (`TPG3Flag3`),
	KEY `TPTTDocCode` (`TPG3DocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductGroup4` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductGroup4`;

# ---------- CREATE TABLE `VS4TProductGroup4` ----------

CREATE TABLE `VS4TProductGroup4` (
	`TPG4Code` VARCHAR(30) NOT NULL,
	`TPG4Name` VARCHAR(150) NULL,
	`TPG4Name2` VARCHAR(150) NULL,
	`TPG4SectionSource` SMALLINT NULL DEFAULT '0',
	`TPG4TPS2Code` VARCHAR(30) NULL,
	`TPG4DocCode` VARCHAR(30) NULL,
	`TPG4Flag1` SMALLINT NULL DEFAULT '0',
	`TPG4Flag2` SMALLINT NULL DEFAULT '0',
	`TPG4Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPG4Code`),
	KEY `ProductMemberCategoryID` (`TPG4Flag1`),
	KEY `ProductMemberProductID1` (`TPG4Name`),
	KEY `TPdGCode` (`TPG4Code`),
	KEY `TPdGPdtGroupCode` (`TPG4TPS2Code`),
	KEY `TPG4Name` (`TPG4Name2`),
	KEY `TPGsFlag1` (`TPG4Flag2`),
	KEY `TPGsFlag11` (`TPG4Flag3`),
	KEY `TPTTDocCode` (`TPG4DocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductImage` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductImage`;

# ---------- CREATE TABLE `VS4TProductImage` ----------

CREATE TABLE `VS4TProductImage` (
	`TPImTPdtCode` VARCHAR(30) NOT NULL,
	`TPImCode` INT NOT NULL DEFAULT '0',
	`TPImImageName` VARCHAR(100) NULL,
	`TPImImageFile` VARCHAR(50) NULL,
	`TPImFlag1` SMALLINT NULL DEFAULT '0',
	`TPImFlag2` SMALLINT NULL DEFAULT '0',
	`TPImFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPImTPdtCode`, `TPImCode`),
	KEY `TAsITAssCode` (`TPImTPdtCode`),
	KEY `VS4TProductVS4TProductImage` (`TPImTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductLeadTim` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductLeadTim`;

# ---------- CREATE TABLE `VS4TProductLeadTim` ----------

CREATE TABLE `VS4TProductLeadTim` (
	`TPLtTPdtCode` VARCHAR(30) NOT NULL,
	`TPLtLn` INT NOT NULL DEFAULT '0',
	`TPLtMinPurchase` INT NULL DEFAULT '0',
	`TPLtMaxPurchase` INT NULL DEFAULT '0',
	`TPLtLastPurchase` INT NULL DEFAULT '0',
	`TPLtCalcPurchase` INT NULL DEFAULT '0',
	`TPLtMinProduction` INT NULL DEFAULT '0',
	`TPLtMaxProduction` INT NULL DEFAULT '0',
	`TPLtLastProduction` INT NULL DEFAULT '0',
	`TPLtCalcProduction` INT NULL DEFAULT '0',
	`TPLtMin` INT NULL DEFAULT '0',
	`TPLtMax` INT NULL DEFAULT '0',
	`TPLtLast` INT NULL DEFAULT '0',
	`TPLtCalc` INT NULL DEFAULT '0',
	`TPLtFlag1` SMALLINT NULL DEFAULT '0',
	`TPLtFlag2` SMALLINT NULL DEFAULT '0',
	`TPLtFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPLtTPdtCode`, `TPLtLn`),
	KEY `TPLtTPdtCode` (`TPLtTPdtCode`),
	KEY `VS4TProductVS4TProductLeadTim` (`TPLtTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductLine` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductLine`;

# ---------- CREATE TABLE `VS4TProductLine` ----------

CREATE TABLE `VS4TProductLine` (
	`TPdLCode` VARCHAR(30) NOT NULL,
	`TPdLName` VARCHAR(50) NULL,
	`TPdLName2` VARCHAR(50) NULL,
	`TPdLTDivCode` VARCHAR(30) NULL,
	`TPdLDocCode` VARCHAR(30) NULL,
	`TPdLTACSCode` VARCHAR(30) NULL,
	`TPdLTACCCode` VARCHAR(30) NULL,
	`TPdLPurTACCCode` VARCHAR(30) NULL,
	`TPdLSaleTACCCode` VARCHAR(30) NULL,
	`TPdLIMTACCCode` VARCHAR(30) NULL,
	`TPdLEXTACCCode` VARCHAR(30) NULL,
	`TPdLCNTACCCode` VARCHAR(30) NULL,
	`TPdLPCNTACCCode` VARCHAR(30) NULL,
	`TPdLCOSTACCCode` VARCHAR(30) NULL,
	`TPdlRequireSec1` SMALLINT NULL DEFAULT '0',
	`TPdlRequireSec2` SMALLINT NULL DEFAULT '0',
	`TPdlRequireSec3` SMALLINT NULL DEFAULT '0',
	`TPdlRequireSec4` SMALLINT NULL DEFAULT '0',
	`TPdlSectionName1` VARCHAR(30) NULL,
	`TPdlSectionName2` VARCHAR(30) NULL,
	`TPdlSectionName3` VARCHAR(30) NULL,
	`TPdlSectionName4` VARCHAR(30) NULL,
	`TPdlRequireGroup1` SMALLINT NULL DEFAULT '0',
	`TPdlRequireGroup2` SMALLINT NULL DEFAULT '0',
	`TPdlRequireGroup3` SMALLINT NULL DEFAULT '0',
	`TPdlRequireGroup4` SMALLINT NULL DEFAULT '0',
	`TPdlGroupName1` VARCHAR(30) NULL,
	`TPdlGroupName2` VARCHAR(30) NULL,
	`TPdlGroupName3` VARCHAR(30) NULL,
	`TPdlGroupName4` VARCHAR(30) NULL,
	`TPdlCustomRequire` VARCHAR(30) NULL,
	`TPdlCustomName` VARCHAR(255) NULL,
	`TPdLFlag1` SMALLINT NULL DEFAULT '0',
	`TPdLFlag2` SMALLINT NULL DEFAULT '0',
	`TPdLFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPdLCode`),
	KEY `ProductMemberCategoryID` (`TPdLFlag1`),
	KEY `ProductMemberProductID1` (`TPdLName`),
	KEY `TPd2CNTACCCode` (`TPdLCNTACCCode`),
	KEY `TPd2COSTACCCode` (`TPdLCOSTACCCode`),
	KEY `TPd2EXTACCCode` (`TPdLEXTACCCode`),
	KEY `TPd2IMTACCCode` (`TPdLIMTACCCode`),
	KEY `TPd2PCNTACCCode` (`TPdLPCNTACCCode`),
	KEY `TPdGCode` (`TPdLCode`),
	KEY `TPdGFlag1` (`TPdLFlag2`),
	KEY `TPdGFlag11` (`TPdLFlag3`),
	KEY `TPdLName` (`TPdLName2`),
	KEY `TPdLTAccCode` (`TPdLTACCCode`),
	KEY `TPdLTACCCode1` (`TPdLTACSCode`),
	KEY `TPdLTDivCode` (`TPdLTDivCode`),
	KEY `TPG1PurTACCCode` (`TPdLPurTACCCode`),
	KEY `TPG1SaleTACCCode` (`TPdLSaleTACCCode`),
	KEY `TPTTDocCode` (`TPdLDocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductLineMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductLineMB`;

# ---------- CREATE TABLE `VS4TProductLineMB` ----------

CREATE TABLE `VS4TProductLineMB` (
	`TPLMTPDLCode` VARCHAR(30) NOT NULL,
	`TPLMTPSECode` VARCHAR(30) NOT NULL,
	`TPLMFlag1` SMALLINT NULL DEFAULT '0',
	`TPLMFlag2` SMALLINT NULL DEFAULT '0',
	`TPLMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPLMTPDLCode`, `TPLMTPSECode`),
	KEY `TPSSTPDLCode` (`TPLMTPDLCode`),
	KEY `TPSSTPDLCode1` (`TPLMTPSECode`),
	KEY `VS4TProductLineVS4TProductLineMB` (`TPLMTPDLCode`),
	KEY `VS4TProductSectionVS4TProductLineMB` (`TPLMTPSECode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductMat` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductMat`;

# ---------- CREATE TABLE `VS4TProductMat` ----------

CREATE TABLE `VS4TProductMat` (
	`TPMtTPdtCode` VARCHAR(30) NOT NULL,
	`TPMtTSpdStep` INT NOT NULL DEFAULT '0',
	`TPMtLn` INT NOT NULL DEFAULT '0',
	`TPMtMatType` SMALLINT NULL DEFAULT '0',
	`TPMtNo` INT NULL DEFAULT '0',
	`TPMtAlternative` SMALLINT NULL DEFAULT '0',
	`TPMtProductCode` VARCHAR(30) NULL,
	`TPMtProductName` VARCHAR(150) NULL,
	`TPMtQuantity` DOUBLE NULL DEFAULT '1',
	`TPMtUnitCode` VARCHAR(15) NULL,
	`TPMtQuantity2` DOUBLE NULL DEFAULT '1',
	`TPMtUnitCode2` VARCHAR(15) NULL,
	`TPMtQuantity3` DOUBLE NULL DEFAULT '1',
	`TPMtUnitCode3` VARCHAR(15) NULL,
	`TPMtScrapPCMRP` DOUBLE NULL DEFAULT '0',
	`TPMtNetQuantity` DOUBLE NULL DEFAULT '0',
	`TPMtRemark` VARCHAR(50) NULL,
	`TPMtFlag1` SMALLINT NULL DEFAULT '0',
	`TPMtFlag2` SMALLINT NULL DEFAULT '0',
	`TPMtFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPMtTPdtCode`, `TPMtTSpdStep`, `TPMtLn`),
	KEY `SetSaleID` (`TPMtTPdtCode`),
	KEY `TPMtProcessNo` (`TPMtTSpdStep`),
	KEY `TPmTUnitCode` (`TPMtUnitCode`),
	KEY `TPmTUnitCode1` (`TPMtUnitCode2`),
	KEY `TPmTUnitCode2` (`TPMtUnitCode3`),
	KEY `TPoMTPdtCode` (`TPMtProductCode`),
	KEY `VS4TProductVS4TProductMat1` (`TPMtTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductMB`;

# ---------- CREATE TABLE `VS4TProductMB` ----------

CREATE TABLE `VS4TProductMB` (
	`TPDMTPdtCode` VARCHAR(30) NOT NULL,
	`TPDMLn` INT NOT NULL DEFAULT '0',
	`TPDMTPdtCode2` VARCHAR(30) NULL,
	`TPDMQuantity` DOUBLE NULL DEFAULT '1',
	`TPDMQuantity2` DOUBLE NULL DEFAULT '1',
	`TPDMQuantity3` DOUBLE NULL DEFAULT '1',
	`TPDMQuantityRange` DOUBLE NULL DEFAULT '1',
	`TPDMQuantityRange2` DOUBLE NULL DEFAULT '1',
	`TPDMQuantityRange3` DOUBLE NULL DEFAULT '1',
	`TPDMCanDepack` SMALLINT NULL DEFAULT '0',
	`TPDMStandardCost` FLOAT NULL DEFAULT '0',
	`TPDMUnitText1` VARCHAR(30) NULL,
	`TPDMUnitText2` VARCHAR(30) NULL,
	`TPDMUnitText3` VARCHAR(30) NULL,
	`TPDMPackText1` VARCHAR(200) NULL,
	`TPDMPackText2` VARCHAR(200) NULL,
	`TPDMPackAlias1` VARCHAR(200) NULL,
	`TPDMPackAlias2` VARCHAR(200) NULL,
	`TPDMRemark` VARCHAR(50) NULL,
	`TPDMFlag1` SMALLINT NULL DEFAULT '0',
	`TPDMFlag2` SMALLINT NULL DEFAULT '0',
	`TPDMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPDMTPdtCode`, `TPDMLn`),
	KEY `SetSaleID` (`TPDMTPdtCode`),
	KEY `TPoMTPdtCode` (`TPDMTPdtCode2`),
	KEY `VS4TProductVS4TProductMat` (`TPDMTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductMethod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductMethod`;

# ---------- CREATE TABLE `VS4TProductMethod` ----------

CREATE TABLE `VS4TProductMethod` (
	`TSpdTPdtCode` VARCHAR(30) NOT NULL,
	`TSpdStep` INT NOT NULL DEFAULT '0',
	`TSpdTSepCode` VARCHAR(30) NULL,
	`TSpdMan` DOUBLE NULL DEFAULT '0',
	`TSpdMachine` DOUBLE NULL DEFAULT '0',
	`TSpdHourPerDay` DOUBLE NULL DEFAULT '0',
	`TSpdCapacity` DOUBLE NULL DEFAULT '0',
	`TSpdCapacityHour` DOUBLE NULL DEFAULT '0',
	`TSpdCapPerHour` DOUBLE NULL DEFAULT '0',
	`TSpdCapPerDay` DOUBLE NULL DEFAULT '0',
	`TSpdEstimateDay` DOUBLE NULL DEFAULT '0',
	`TSpdSetupTime` SMALLINT NULL DEFAULT '0',
	`TSpdLeadIn` SMALLINT NULL DEFAULT '0',
	`TSpdLeadOut` SMALLINT NULL DEFAULT '0',
	`TSpdTime` DOUBLE NULL DEFAULT '0',
	`TSpdTAgtCode` VARCHAR(30) NULL,
	`TSpdLink1` VARCHAR(30) NULL,
	`TSpdFormula1` VARCHAR(50) NULL,
	`TSpdNameFor1` VARCHAR(100) NULL,
	`TSpdLink2` VARCHAR(30) NULL,
	`TSpdFormula2` VARCHAR(50) NULL,
	`TSpdNameFor2` VARCHAR(100) NULL,
	`TSpdFGPC` DOUBLE NULL DEFAULT '0',
	`TSpdDependent` INT NULL DEFAULT '0',
	`TSpdCheckClose` SMALLINT NULL DEFAULT '0',
	`TSpdDescription` VARCHAR(150) NULL,
	`TSpdFlag1` SMALLINT NULL DEFAULT '0',
	`TSpdFlag2` SMALLINT NULL DEFAULT '0',
	`TSpdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSpdTPdtCode`, `TSpdStep`),
	KEY `TSpdStepCode` (`TSpdTSepCode`),
	KEY `TSpdTAseCode` (`TSpdTAgtCode`),
	KEY `TSpdTPG1Code` (`TSpdTPdtCode`),
	KEY `VS4TProductVS4TProductMethod` (`TSpdTPdtCode`),
	KEY `VS4TStepNameVS4TFormulaProduct` (`TSpdTSepCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductMinor` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductMinor`;

# ---------- CREATE TABLE `VS4TProductMinor` ----------

CREATE TABLE `VS4TProductMinor` (
	`TPMrTPdtCode` VARCHAR(30) NOT NULL,
	`TPMrTSpdStep` INT NOT NULL DEFAULT '0',
	`TPMrLn` INT NOT NULL DEFAULT '0',
	`TPMrProductCode` VARCHAR(30) NULL,
	`TPMrProductName` VARCHAR(150) NULL,
	`TPMrQuantity` DOUBLE NULL DEFAULT '1',
	`TPMrUnitCode` VARCHAR(15) NULL,
	`TPMrQuantity2` DOUBLE NULL DEFAULT '1',
	`TPMrUnitCode2` VARCHAR(15) NULL,
	`TPMrQuantity3` DOUBLE NULL DEFAULT '1',
	`TPMrUnitCode3` VARCHAR(15) NULL,
	`TPMrRemark` VARCHAR(50) NULL,
	`TPMrFlag1` SMALLINT NULL DEFAULT '0',
	`TPMrFlag2` SMALLINT NULL DEFAULT '0',
	`TPMrFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPMrTPdtCode`, `TPMrTSpdStep`, `TPMrLn`),
	KEY `SetSaleID` (`TPMrTPdtCode`),
	KEY `TPMtProcessNo` (`TPMrTSpdStep`),
	KEY `TPmTUnitCode` (`TPMrUnitCode`),
	KEY `TPmTUnitCode1` (`TPMrUnitCode2`),
	KEY `TPmTUnitCode2` (`TPMrUnitCode3`),
	KEY `TPoMTPdtCode` (`TPMrProductCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductOH` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductOH`;

# ---------- CREATE TABLE `VS4TProductOH` ----------

CREATE TABLE `VS4TProductOH` (
	`TPOHTPdtCode` VARCHAR(30) NOT NULL,
	`TPOHTSpdStep` INT NOT NULL DEFAULT '0',
	`TPOHLn` INT NOT NULL DEFAULT '0',
	`TPOHType` INT NULL DEFAULT '0',
	`TPOHCode` VARCHAR(30) NULL,
	`TPOHDescription` VARCHAR(150) NULL,
	`TPOHFunctionMode` SMALLINT NULL DEFAULT '1',
	`TPOHBaseSource` SMALLINT NULL DEFAULT '1',
	`TPOHFactor` DOUBLE NULL DEFAULT '1',
	`TPOHQuantity` DOUBLE NULL DEFAULT '1',
	`TPOHCost` DOUBLE NULL DEFAULT '1',
	`TPOHTotalCost` DOUBLE NULL DEFAULT '1',
	`TPOHRemark` VARCHAR(50) NULL,
	`TPOHFlag1` SMALLINT NULL DEFAULT '0',
	`TPOHFlag2` SMALLINT NULL DEFAULT '0',
	`TPOHFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPOHTPdtCode`, `TPOHTSpdStep`, `TPOHLn`),
	KEY `TJbMTJobNo` (`TPOHTPdtCode`),
	KEY `TJMtTFPSCode` (`TPOHCode`),
	KEY `TJMtTSpdStep` (`TPOHTSpdStep`),
	KEY `VS4TProductVS4TProductOH` (`TPOHTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductPURType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductPURType`;

# ---------- CREATE TABLE `VS4TProductPURType` ----------

CREATE TABLE `VS4TProductPURType` (
	`TPPuCode` VARCHAR(30) NOT NULL,
	`TPPuName` VARCHAR(100) NULL,
	`TPPuName2` VARCHAR(100) NULL,
	`TPPuDocCode` VARCHAR(30) NULL,
	`TPPuSort` SMALLINT NULL DEFAULT '0',
	`TPPuFlag1` SMALLINT NULL DEFAULT '0',
	`TPPuFlag2` SMALLINT NULL DEFAULT '0',
	`TPPuFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPPuCode`),
	KEY `ProductMemberCategoryID` (`TPPuFlag1`),
	KEY `ProductMemberProductID1` (`TPPuName`),
	KEY `TPdGID` (`TPPuCode`),
	KEY `TPPuName` (`TPPuName2`),
	KEY `TPTTDocCode` (`TPPuDocCode`),
	KEY `TPTTFlag1` (`TPPuFlag2`),
	KEY `TPTTFlag11` (`TPPuFlag3`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductRelate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductRelate`;

# ---------- CREATE TABLE `VS4TProductRelate` ----------

CREATE TABLE `VS4TProductRelate` (
	`TPdRTPdtCode` VARCHAR(30) NOT NULL,
	`TPdRTPdtCode2` VARCHAR(30) NOT NULL,
	`TPdRRelateType` SMALLINT NULL DEFAULT '1',
	`TPdRNote` VARCHAR(50) NULL,
	`TPdRFlag1` SMALLINT NULL DEFAULT '0',
	`TPdRFlag2` SMALLINT NULL DEFAULT '0',
	`TPdRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPdRTPdtCode`, `TPdRTPdtCode2`),
	KEY `VS4TProductVS4TProductRelate` (`TPdRTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductSafeS` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductSafeS`;

# ---------- CREATE TABLE `VS4TProductSafeS` ----------

CREATE TABLE `VS4TProductSafeS` (
	`TPSSTPdtCode` VARCHAR(30) NOT NULL,
	`TPSSTBraCode` VARCHAR(30) NOT NULL,
	`TPSSLeadDay` DOUBLE NULL DEFAULT '0',
	`TPSSRefill` SMALLINT NULL DEFAULT '0',
	`TPSSSafeDayCalc` SMALLINT NULL DEFAULT '0',
	`TPSSBackDayCalc` SMALLINT NULL DEFAULT '0',
	`TPSSSafePerDay` DOUBLE NULL DEFAULT '0',
	`TPSSSaleArrear` DOUBLE NULL DEFAULT '0',
	`TPSSStock` DOUBLE NULL DEFAULT '0',
	`TPSSTRArrear` DOUBLE NULL DEFAULT '0',
	`TPSSSafeTotalDay` SMALLINT NULL DEFAULT '0',
	`TPSSStockMin` DOUBLE NULL DEFAULT '0',
	`TPSSStockMax` DOUBLE NULL DEFAULT '0',
	`TPSSSuggest` DOUBLE NULL DEFAULT '0',
	`TPSSPURTLctCode` VARCHAR(30) NULL,
	`TPSSSaleTLctCode` VARCHAR(30) NULL,
	`TPSSMainTLctCode` VARCHAR(30) NULL,
	`TPSSRepTLctCode` VARCHAR(30) NULL,
	`TPSSBrkTLctCode` VARCHAR(30) NULL,
	`TPSSFlag1` SMALLINT NULL DEFAULT '0',
	`TPSSFlag2` SMALLINT NULL DEFAULT '0',
	`TPSSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPSSTPdtCode`, `TPSSTBraCode`),
	KEY `TPSSTBraCode` (`TPSSTBraCode`),
	KEY `TPSSTPdtCode` (`TPSSTPdtCode`),
	KEY `VS4TProductVS4TProductSafeS` (`TPSSTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductSec2` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductSec2`;

# ---------- CREATE TABLE `VS4TProductSec2` ----------

CREATE TABLE `VS4TProductSec2` (
	`TPS2Code` VARCHAR(30) NOT NULL,
	`TPS2Name` VARCHAR(50) NULL,
	`TPS2Name2` VARCHAR(50) NULL,
	`TPS2TPdLCode` VARCHAR(30) NULL,
	`TPS2DocCode` VARCHAR(30) NULL,
	`TPS2RequireGroup3` SMALLINT NULL DEFAULT '0',
	`TPS2RequireGroup4` SMALLINT NULL DEFAULT '0',
	`TPS2GroupName3` VARCHAR(30) NULL,
	`TPS2GroupName4` VARCHAR(30) NULL,
	`TPS2Flag1` SMALLINT NULL DEFAULT '0',
	`TPS2Flag2` SMALLINT NULL DEFAULT '0',
	`TPS2Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPS2Code`),
	KEY `ProductMemberCategoryID` (`TPS2Flag1`),
	KEY `ProductMemberProductID1` (`TPS2Name`),
	KEY `TPdGCode` (`TPS2Code`),
	KEY `TPdGPdtGroupCode` (`TPS2TPdLCode`),
	KEY `TPGsFlag1` (`TPS2Flag2`),
	KEY `TPGsFlag11` (`TPS2Flag3`),
	KEY `TPSEName` (`TPS2Name2`),
	KEY `TPTTDocCode` (`TPS2DocCode`),
	KEY `VS4TProductLineVS4TProductSec2` (`TPS2TPdLCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductSec3` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductSec3`;

# ---------- CREATE TABLE `VS4TProductSec3` ----------

CREATE TABLE `VS4TProductSec3` (
	`TPS3Code` VARCHAR(30) NOT NULL,
	`TPS3Name` VARCHAR(50) NULL,
	`TPS3Name2` VARCHAR(50) NULL,
	`TPS3TPdLCode` VARCHAR(30) NULL,
	`TPS3DocCode` VARCHAR(30) NULL,
	`TPS3Flag1` SMALLINT NULL DEFAULT '0',
	`TPS3Flag2` SMALLINT NULL DEFAULT '0',
	`TPS3Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPS3Code`),
	KEY `ProductMemberCategoryID` (`TPS3Flag1`),
	KEY `ProductMemberProductID1` (`TPS3Name`),
	KEY `TPdGCode` (`TPS3Code`),
	KEY `TPdGPdtGroupCode` (`TPS3TPdLCode`),
	KEY `TPGsFlag1` (`TPS3Flag2`),
	KEY `TPGsFlag11` (`TPS3Flag3`),
	KEY `TPSEName` (`TPS3Name2`),
	KEY `TPTTDocCode` (`TPS3DocCode`),
	KEY `VS4TProductLineVS4TProductSec3` (`TPS3TPdLCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductSec4` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductSec4`;

# ---------- CREATE TABLE `VS4TProductSec4` ----------

CREATE TABLE `VS4TProductSec4` (
	`TPS4Code` VARCHAR(30) NOT NULL,
	`TPS4Name` VARCHAR(50) NULL,
	`TPS4Name2` VARCHAR(50) NULL,
	`TPS4TPdLCode` VARCHAR(30) NULL,
	`TPS4DocCode` VARCHAR(30) NULL,
	`TPS4Flag1` SMALLINT NULL DEFAULT '0',
	`TPS4Flag2` SMALLINT NULL DEFAULT '0',
	`TPS4Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPS4Code`),
	KEY `ProductMemberCategoryID` (`TPS4Flag1`),
	KEY `ProductMemberProductID1` (`TPS4Name`),
	KEY `TPdGCode` (`TPS4Code`),
	KEY `TPdGPdtGroupCode` (`TPS4TPdLCode`),
	KEY `TPGsFlag1` (`TPS4Flag2`),
	KEY `TPGsFlag11` (`TPS4Flag3`),
	KEY `TPSEName` (`TPS4Name2`),
	KEY `TPTTDocCode` (`TPS4DocCode`),
	KEY `VS4TProductLineVS4TProductSec4` (`TPS4TPdLCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductSection` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductSection`;

# ---------- CREATE TABLE `VS4TProductSection` ----------

CREATE TABLE `VS4TProductSection` (
	`TPSECode` VARCHAR(30) NOT NULL,
	`TPSEName` VARCHAR(50) NULL,
	`TPSEName2` VARCHAR(50) NULL,
	`TPSETPdLCode` VARCHAR(30) NULL,
	`TPSEDocCode` VARCHAR(30) NULL,
	`TPSERequireGroup1` SMALLINT NULL DEFAULT '0',
	`TPSERequireGroup2` SMALLINT NULL DEFAULT '0',
	`TPSERequireGroup3` SMALLINT NULL DEFAULT '0',
	`TPSERequireGroup4` SMALLINT NULL DEFAULT '0',
	`TPSEGroupName1` VARCHAR(30) NULL,
	`TPSEGroupName2` VARCHAR(30) NULL,
	`TPSEGroupName3` VARCHAR(30) NULL,
	`TPSEGroupName4` VARCHAR(30) NULL,
	`TPSETACSCode` VARCHAR(30) NULL,
	`TPSETACCCode` VARCHAR(30) NULL,
	`TPSEPurTACCCode` VARCHAR(30) NULL,
	`TPSESaleTACCCode` VARCHAR(30) NULL,
	`TPSEIMTACCCode` VARCHAR(30) NULL,
	`TPSEEXTACCCode` VARCHAR(30) NULL,
	`TPSECNTACCCode` VARCHAR(30) NULL,
	`TPSEPCNTACCCode` VARCHAR(30) NULL,
	`TPSECOSTACCCode` VARCHAR(30) NULL,
	`TPSECustomCaption` VARCHAR(255) NULL,
	`TPSEGroupSub` VARCHAR(30) NULL,
	`TPSELevel` SMALLINT NULL DEFAULT '0',
	`TPSECapacity` DOUBLE NULL DEFAULT '0',
	`TPSECapacityHour` SMALLINT NULL DEFAULT '0',
	`TPSEStartWIPPC` DOUBLE NULL DEFAULT '0',
	`TPSEStandardCost` DOUBLE NULL DEFAULT '0',
	`TPSEFlag1` SMALLINT NULL DEFAULT '0',
	`TPSEFlag2` SMALLINT NULL DEFAULT '0',
	`TPSEFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPSECode`),
	KEY `ProductMemberCategoryID` (`TPSEFlag1`),
	KEY `ProductMemberProductID1` (`TPSEName`),
	KEY `TPd2CNTACCCode` (`TPSECNTACCCode`),
	KEY `TPd2COSTACCCode` (`TPSECOSTACCCode`),
	KEY `TPd2EXTACCCode` (`TPSEEXTACCCode`),
	KEY `TPd2IMTACCCode` (`TPSEIMTACCCode`),
	KEY `TPd2PCNTACCCode` (`TPSEPCNTACCCode`),
	KEY `TPdGCode` (`TPSECode`),
	KEY `TPdGPdtGroupCode` (`TPSETPdLCode`),
	KEY `TPdLTACSCode` (`TPSETACSCode`),
	KEY `TPGsFlag1` (`TPSEFlag2`),
	KEY `TPGsFlag11` (`TPSEFlag3`),
	KEY `TPSEGroupSub` (`TPSEGroupSub`),
	KEY `TPSEName` (`TPSEName2`),
	KEY `TPSETACCCode` (`TPSETACCCode`),
	KEY `TPSETACCCode1` (`TPSEPurTACCCode`),
	KEY `TPSETACCCode2` (`TPSESaleTACCCode`),
	KEY `TPTTDocCode` (`TPSEDocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductSecType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductSecType`;

# ---------- CREATE TABLE `VS4TProductSecType` ----------

CREATE TABLE `VS4TProductSecType` (
	`TPETCode` VARCHAR(30) NOT NULL,
	`TPETName` VARCHAR(50) NULL,
	`TPETName2` VARCHAR(50) NULL,
	`TPETLevel` INT NULL DEFAULT '0',
	`TPETFlag1` SMALLINT NULL DEFAULT '0',
	`TPETFlag2` SMALLINT NULL DEFAULT '0',
	`TPETFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPETCode`),
	KEY `TShfCode` (`TPETCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductStat` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductStat`;

# ---------- CREATE TABLE `VS4TProductStat` ----------

CREATE TABLE `VS4TProductStat` (
	`TPMSTPdtCode` VARCHAR(30) NOT NULL,
	`TPMSLn` INT NOT NULL DEFAULT '0',
	`TPMSLastSTUntCode` VARCHAR(10) NULL,
	`TPMSLastSDiscount` VARCHAR(30) NULL,
	`TPMSLastSPrice` FLOAT NULL DEFAULT '0',
	`TPMSLastSRatio` DOUBLE NULL DEFAULT '0',
	`TPMSLastSDate` DATETIME NULL,
	`TPMSLastPTUntCode` VARCHAR(10) NULL,
	`TPMSLastPDiscount` VARCHAR(30) NULL,
	`TPMSLastPPrice` FLOAT NULL DEFAULT '0',
	`TPMSLastPRatio` DOUBLE NULL DEFAULT '0',
	`TPMSLastPDate` DATETIME NULL,
	`TPMSAvailQuantity` DOUBLE NULL DEFAULT '0',
	`TPMSAvailQuantity2` DOUBLE NULL DEFAULT '0',
	`TPMSAvailQuantity3` DOUBLE NULL DEFAULT '0',
	`TPMSFlag1` SMALLINT NULL DEFAULT '0',
	`TPMSFlag2` SMALLINT NULL DEFAULT '0',
	`TPMSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPMSTPdtCode`, `TPMSLn`),
	KEY `TPd2LastSTUntCode` (`TPMSLastSTUntCode`),
	KEY `TPd2LastSTUntCode1` (`TPMSLastPTUntCode`),
	KEY `VS4TProductVS4TProductStat` (`TPMSTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductSub` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductSub`;

# ---------- CREATE TABLE `VS4TProductSub` ----------

CREATE TABLE `VS4TProductSub` (
	`TPdSID` INT NOT NULL DEFAULT '0',
	`TPdSAlias` VARCHAR(30) NULL,
	`TPdSTPdtCode` VARCHAR(30) NULL,
	`TPdSName` VARCHAR(50) NULL,
	`TPdSCapture1` VARCHAR(50) NULL,
	`TPdSType1` SMALLINT NULL DEFAULT '0',
	`TPdSText1` VARCHAR(50) NULL,
	`TPdSValue1` DOUBLE NULL DEFAULT '0',
	`TPdSDecimal1` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit1` VARCHAR(30) NULL,
	`TPdSCapture2` VARCHAR(50) NULL,
	`TPdSType2` SMALLINT NULL DEFAULT '0',
	`TPdSText2` VARCHAR(50) NULL,
	`TPdSValue2` DOUBLE NULL DEFAULT '0',
	`TPdSDecimal2` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit2` VARCHAR(30) NULL,
	`TPdSCapture3` VARCHAR(50) NULL,
	`TPdSType3` SMALLINT NULL DEFAULT '0',
	`TPdSText3` VARCHAR(50) NULL,
	`TPdSValue3` DOUBLE NULL DEFAULT '0',
	`TPdSDecimal3` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit3` VARCHAR(30) NULL,
	`TPdSCapture4` VARCHAR(50) NULL,
	`TPdSType4` SMALLINT NULL DEFAULT '0',
	`TPdSText4` VARCHAR(50) NULL,
	`TPdSValue4` DOUBLE NULL DEFAULT '0',
	`TPdSDecimal4` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit4` VARCHAR(30) NULL,
	`TPdSCapture5` VARCHAR(50) NULL,
	`TPdSType5` SMALLINT NULL DEFAULT '0',
	`TPdSText5` VARCHAR(50) NULL,
	`TPdSValue5` DOUBLE NULL DEFAULT '0',
	`TPdSDecimal5` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit5` VARCHAR(30) NULL,
	`TPdSCapture6` VARCHAR(50) NULL,
	`TPdSType6` SMALLINT NULL DEFAULT '0',
	`TPdSText6` VARCHAR(50) NULL,
	`TPdSValue6` DOUBLE NULL DEFAULT '0',
	`TPdSDecima6` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit6` VARCHAR(30) NULL,
	`TPdSCapture7` VARCHAR(50) NULL,
	`TPdSType7` SMALLINT NULL DEFAULT '0',
	`TPdSText7` VARCHAR(50) NULL,
	`TPdSValue7` DOUBLE NULL DEFAULT '0',
	`TPdSDecimal7` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit7` VARCHAR(30) NULL,
	`TPdSCapture8` VARCHAR(50) NULL,
	`TPdSType8` SMALLINT NULL DEFAULT '0',
	`TPdSText8` VARCHAR(50) NULL,
	`TPdSValue8` DOUBLE NULL DEFAULT '0',
	`TPdSDecimal8` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit8` VARCHAR(30) NULL,
	`TPdSCapture9` VARCHAR(50) NULL,
	`TPdSType9` SMALLINT NULL DEFAULT '0',
	`TPdSText9` VARCHAR(50) NULL,
	`TPdSValue9` DOUBLE NULL DEFAULT '0',
	`TPdSDecimal9` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit9` VARCHAR(30) NULL,
	`TPdSCapture10` VARCHAR(50) NULL,
	`TPdSType10` SMALLINT NULL DEFAULT '0',
	`TPdSText10` VARCHAR(50) NULL,
	`TPdSValue10` DOUBLE NULL DEFAULT '0',
	`TPdSDecimal10` SMALLINT NULL DEFAULT '0',
	`TPdSTUnit10` VARCHAR(30) NULL,
	`TPdSDisplayFormat` VARCHAR(50) NULL,
	`TPdSDisplayText` VARCHAR(50) NULL,
	`TPdSFlag1` SMALLINT NULL DEFAULT '0',
	`TPdSFlag2` SMALLINT NULL DEFAULT '0',
	`TPdSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPdSID`),
	KEY `TAsBTUnit1` (`TPdSTUnit2`),
	KEY `TAsBTUnit11` (`TPdSTUnit3`),
	KEY `TAsBTUnit12` (`TPdSTUnit4`),
	KEY `TAsBTUnit13` (`TPdSTUnit5`),
	KEY `TAsBTUnitCode` (`TPdSTUnit1`),
	KEY `TPdMID` (`TPdSID`),
	KEY `TPdMTPdtID` (`TPdSTPdtCode`),
	KEY `TPdSTUnit4` (`TPdSTUnit6`),
	KEY `TPdSTUnit5` (`TPdSTUnit7`),
	KEY `TPdSTUnit7` (`TPdSTUnit8`),
	KEY `TPdSTUnit8` (`TPdSTUnit10`),
	KEY `TPdSTUnit81` (`TPdSTUnit9`),
	KEY `TPdtSizeFormat` (`TPdSDisplayFormat`),
	KEY `VS4TProductVS4TProductSub2` (`TPdSTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductTime` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductTime`;

# ---------- CREATE TABLE `VS4TProductTime` ----------

CREATE TABLE `VS4TProductTime` (
	`TPTITPdtCode` VARCHAR(30) NOT NULL,
	`TPTILn` INT NOT NULL DEFAULT '0',
	`TPTIPeriodType` SMALLINT NULL DEFAULT '0',
	`TPTIStart` DATETIME NULL,
	`TPTIEnd` DATETIME NULL,
	`TPTINote` VARCHAR(100) NULL,
	`TPTIFlag1` SMALLINT NULL DEFAULT '0',
	`TPTIFlag2` SMALLINT NULL DEFAULT '0',
	`TPTIFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPTITPdtCode`, `TPTILn`),
	KEY `TPTITPdtCode` (`TPTITPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductType`;

# ---------- CREATE TABLE `VS4TProductType` ----------

CREATE TABLE `VS4TProductType` (
	`TPTTCode` VARCHAR(30) NOT NULL,
	`TPTTName` VARCHAR(100) NULL,
	`TPTTName2` VARCHAR(100) NULL,
	`TPTTDocCode` VARCHAR(30) NULL,
	`TPTTStockCost` SMALLINT NULL DEFAULT '0',
	`TPTTSort` SMALLINT NULL DEFAULT '0',
	`TPTTFlag1` SMALLINT NULL DEFAULT '0',
	`TPTTFlag2` SMALLINT NULL DEFAULT '0',
	`TPTTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPTTCode`),
	KEY `ProductMemberCategoryID` (`TPTTFlag1`),
	KEY `ProductMemberProductID1` (`TPTTName`),
	KEY `TPdGID` (`TPTTCode`),
	KEY `TPTTDocCode` (`TPTTDocCode`),
	KEY `TPTTFlag1` (`TPTTFlag2`),
	KEY `TPTTFlag11` (`TPTTFlag3`),
	KEY `TPTTName` (`TPTTName2`),
	KEY `TPTTTACCCode` (`TPTTStockCost`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductUnit` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductUnit`;

# ---------- CREATE TABLE `VS4TProductUnit` ----------

CREATE TABLE `VS4TProductUnit` (
	`TPDUTPdtCode` VARCHAR(30) NOT NULL,
	`TPDUTUntCode` VARCHAR(15) NOT NULL,
	`TPDURatio` DOUBLE NOT NULL DEFAULT '1',
	`TPDUPKI` VARCHAR(2) NULL,
	`TPDUBarcode` VARCHAR(30) NULL,
	`TPDUUsage` SMALLINT NULL DEFAULT '0',
	`TPDUIsMain` SMALLINT NULL DEFAULT '0',
	`TPDUIsLogistic` SMALLINT NULL DEFAULT '0',
	`TPDUShape` SMALLINT NULL DEFAULT '0',
	`TPDUWidth` DOUBLE NULL DEFAULT '0',
	`TPDULength` DOUBLE NULL DEFAULT '0',
	`TPDUHeight` DOUBLE NULL DEFAULT '0',
	`TPDUDimension` VARCHAR(50) NULL,
	`TPDUNW` DOUBLE NULL DEFAULT '0',
	`TPDUGW` DOUBLE NULL DEFAULT '0',
	`TPDUVolumeM` DOUBLE NULL DEFAULT '0',
	`TPDUMaxPer20FT` INT NULL DEFAULT '0',
	`TPDUMaxPer40FT` INT NULL DEFAULT '0',
	`TPDUMaxPer40HC` INT NULL DEFAULT '0',
	`TPDUMaxOver` DOUBLE NULL DEFAULT '0',
	`TPDUFlag1` SMALLINT NULL DEFAULT '0',
	`TPDUFlag2` SMALLINT NULL DEFAULT '0',
	`TPDUFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPDUTPdtCode`, `TPDUTUntCode`, `TPDURatio`),
	KEY `SetSaleID` (`TPDUTPdtCode`),
	KEY `VS4TProductVS4TProductUnit` (`TPDUTPdtCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProductVender` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProductVender`;

# ---------- CREATE TABLE `VS4TProductVender` ----------

CREATE TABLE `VS4TProductVender` (
	`TPdVTPdtcode` VARCHAR(255) NOT NULL,
	`TPdVTAPNCode` VARCHAR(255) NOT NULL,
	`TPdVLastPTUntCode` VARCHAR(10) NOT NULL,
	`TPdVLastPDiscount` VARCHAR(30) NULL,
	`TPdVLastPPrice` FLOAT NULL DEFAULT '0',
	`TPdVLastPRatio` DOUBLE NULL DEFAULT '0',
	`TPdVLastPDate` DATETIME NULL,
	`TPdVFlag1` SMALLINT NULL DEFAULT '0',
	`TPdVFlag2` SMALLINT NULL DEFAULT '0',
	`TPdVFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPdVTPdtcode`, `TPdVTAPNCode`, `TPdVLastPTUntCode`),
	KEY `TPdVTAPNCode` (`TPdVTAPNCode`),
	KEY `TPMSLastPTUntCode` (`TPdVLastPTUntCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProject` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProject`;

# ---------- CREATE TABLE `VS4TProject` ----------

CREATE TABLE `VS4TProject` (
	`TPrjCode` VARCHAR(30) NOT NULL,
	`TPrjTPjTCode` VARCHAR(30) NULL,
	`TPrjName` VARCHAR(100) NULL,
	`TPrjName2` VARCHAR(100) NULL,
	`TPrjShortName` VARCHAR(15) NULL,
	`TPrjShortName2` VARCHAR(15) NULL,
	`TPrjDocCode` VARCHAR(30) NULL,
	`TPrjClient` VARCHAR(160) NULL,
	`TPrjRefNo` VARCHAR(30) NULL,
	`TPrjRefNo2` VARCHAR(30) NULL,
	`TPrjVATRate` DOUBLE NULL DEFAULT '0',
	`TPrjWTAXRate` DOUBLE NULL DEFAULT '0',
	`TPrjMode` SMALLINT NULL DEFAULT '0',
	`TPrjNote` VARCHAR(255) NULL,
	`TPrjES` DATETIME NULL,
	`TPrjLS` DATETIME NULL,
	`TPrjEF` DATETIME NULL,
	`TPrjLF` DATETIME NULL,
	`TPrjTime` DOUBLE NULL DEFAULT '0',
	`TPrjStartDate` DATETIME NULL,
	`TPrjEndDate` DATETIME NULL,
	`TPrjDependLn` INT NULL DEFAULT '0',
	`TPrjBudget` FLOAT NULL,
	`TPrjBudgetOnHand` FLOAT NULL,
	`TPrjCompletePC` DOUBLE NULL,
	`TPrjCostBudget` FLOAT NULL,
	`TPrjCostPay` FLOAT NULL,
	`TPrjCostPayPC` DOUBLE NULL,
	`TPrjStatus` SMALLINT NULL DEFAULT '0',
	`TPrjFlag1` SMALLINT NULL DEFAULT '0',
	`TPrjFlag2` SMALLINT NULL DEFAULT '0',
	`TPrjFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPrjCode`),
	KEY `TPrjTPjTCode` (`TPrjTPjTCode`),
	KEY `VS4TProjectTypeVS4TProject` (`TPrjTPjTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProjectBOQ` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProjectBOQ`;

# ---------- CREATE TABLE `VS4TProjectBOQ` ----------

CREATE TABLE `VS4TProjectBOQ` (
	`TP2QTPHSTPrjCode` VARCHAR(30) NOT NULL,
	`TP2QTPHSLn` INT NOT NULL DEFAULT '0',
	`TP2QTPdtCode` VARCHAR(30) NOT NULL,
	`TP2QFlag1` SMALLINT NULL DEFAULT '0',
	`TP2QFlag2` SMALLINT NULL DEFAULT '0',
	`TP2QFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TP2QTPHSTPrjCode`, `TP2QTPHSLn`, `TP2QTPdtCode`),
	KEY `TP2QTPdtCode` (`TP2QTPdtCode`),
	KEY `VS4TProjectPhaseVS4TProjectBOQ` (`TP2QTPHSTPrjCode`, `TP2QTPHSLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProjectPhase` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProjectPhase`;

# ---------- CREATE TABLE `VS4TProjectPhase` ----------

CREATE TABLE `VS4TProjectPhase` (
	`TPHSTPrjCode` VARCHAR(30) NOT NULL,
	`TPHSLn` INT NOT NULL DEFAULT '0',
	`TPHSName` VARCHAR(255) NULL,
	`TPHSName2` VARCHAR(255) NULL,
	`TPHSNote` VARCHAR(255) NULL,
	`TPHSES` DATETIME NULL,
	`TPHSLS` DATETIME NULL,
	`TPHSEF` DATETIME NULL,
	`TPHSLF` DATETIME NULL,
	`TPHSStartDate` DATETIME NULL,
	`TPHSEndDate` DATETIME NULL,
	`TPHSTime` DOUBLE NULL DEFAULT '0',
	`TPHSDependLn` INT NULL DEFAULT '0',
	`TPHSBudget` FLOAT NULL,
	`TPHSBudgetOnHand` FLOAT NULL,
	`TPHSCompletePC` DOUBLE NULL,
	`TPHSCostBudget` FLOAT NULL,
	`TPHSCostPay` FLOAT NULL,
	`TPHSCostPayPC` DOUBLE NULL,
	`TPHSStatus` SMALLINT NULL DEFAULT '0',
	`TPHSFlag1` SMALLINT NULL DEFAULT '0',
	`TPHSFlag2` SMALLINT NULL DEFAULT '0',
	`TPHSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPHSTPrjCode`, `TPHSLn`),
	KEY `VS4TProjectVS4TProjectPhase` (`TPHSTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProjectType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProjectType`;

# ---------- CREATE TABLE `VS4TProjectType` ----------

CREATE TABLE `VS4TProjectType` (
	`TPjTCode` VARCHAR(30) NOT NULL,
	`TPjTName` VARCHAR(100) NULL,
	`TPjTName2` VARCHAR(100) NULL,
	`TPjTStartDate` DATETIME NULL,
	`TPjTEndDate` DATETIME NULL,
	`TPjTNote` VARCHAR(100) NULL,
	`TPjTFlag1` SMALLINT NULL DEFAULT '0',
	`TPjTFlag2` SMALLINT NULL DEFAULT '0',
	`TPjTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPjTCode`),
	KEY `TPjTCode` (`TPjTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPromotion` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPromotion`;

# ---------- CREATE TABLE `VS4TPromotion` ----------

CREATE TABLE `VS4TPromotion` (
	`TProNo` VARCHAR(30) NOT NULL,
	`TProCode` VARCHAR(30) NULL,
	`TProName` VARCHAR(50) NULL,
	`TProType` SMALLINT NULL DEFAULT '0',
	`TProDate` DATETIME NULL DEFAULT '3333-3-3',
	`TProRefNo` VARCHAR(30) NULL,
	`TProFirstDate` DATETIME NULL DEFAULT '3333-3-3',
	`TProLastDate` DATETIME NULL DEFAULT '3333-3-3',
	`TProDescription` VARCHAR(200) NULL,
	`TProCreateCode` VARCHAR(30) NULL,
	`TProCreateBy` VARCHAR(140) NULL,
	`TProCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TProEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TProEditCode` VARCHAR(30) NULL,
	`TProEditBy` VARCHAR(140) NULL,
	`TProConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TProConfirmBy` VARCHAR(140) NULL,
	`TProConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TProApproveStatus` SMALLINT NULL DEFAULT '0',
	`TProApproveBy` VARCHAR(140) NULL,
	`TProApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TProApproveNote` VARCHAR(80) NULL,
	`TProRevision` SMALLINT NULL DEFAULT '0',
	`TProCancelStatus` SMALLINT NULL DEFAULT '0',
	`TProCancelBy` VARCHAR(140) NULL,
	`TProCancelNo` VARCHAR(30) NULL,
	`TProCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TProCancelNote` VARCHAR(80) NULL,
	`TProFlag1` SMALLINT NULL DEFAULT '0',
	`TProFlag2` SMALLINT NULL DEFAULT '0',
	`TProFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TProNo`),
	KEY `TPmtID` (`TProNo`),
	KEY `TProCode` (`TProCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPromotionMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPromotionMB`;

# ---------- CREATE TABLE `VS4TPromotionMB` ----------

CREATE TABLE `VS4TPromotionMB` (
	`TPMMTProNo` VARCHAR(30) NOT NULL,
	`TPMMLn` INT NOT NULL DEFAULT '0',
	`TPMMTPOSCode` VARCHAR(30) NULL,
	`TPMMFromQuantity` DOUBLE NULL DEFAULT '0',
	`TPMMTUntCode` VARCHAR(15) NULL,
	`TPMMType` SMALLINT NULL DEFAULT '0',
	`TPMMTPSECode` VARCHAR(30) NULL,
	`TPMMTPG1Code` VARCHAR(30) NULL,
	`TPMMTARGCode` VARCHAR(30) NULL,
	`TPMMTARNCode` VARCHAR(30) NULL,
	`TPMMPrice1` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode1` VARCHAR(5) NULL,
	`TPMMTaxType1` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText1` VARCHAR(30) NULL,
	`TPMMPrice2` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode2` VARCHAR(5) NULL,
	`TPMMTaxType2` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText2` VARCHAR(30) NULL,
	`TPMMPrice3` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode3` VARCHAR(5) NULL,
	`TPMMTaxType3` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText3` VARCHAR(30) NULL,
	`TPMMPrice4` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode4` VARCHAR(5) NULL,
	`TPMMTaxType4` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText4` VARCHAR(30) NULL,
	`TPMMPrice5` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode5` VARCHAR(5) NULL,
	`TPMMTaxType5` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText5` VARCHAR(30) NULL,
	`TPMMPrice6` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode6` VARCHAR(5) NULL,
	`TPMMTaxType6` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText6` VARCHAR(30) NULL,
	`TPMMPrice7` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode7` VARCHAR(5) NULL,
	`TPMMTaxType7` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText7` VARCHAR(30) NULL,
	`TPMMPrice8` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode8` VARCHAR(5) NULL,
	`TPMMTaxType8` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText8` VARCHAR(30) NULL,
	`TPMMPrice9` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode9` VARCHAR(5) NULL,
	`TPMMTaxType9` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText9` VARCHAR(30) NULL,
	`TPMMPrice10` FLOAT NULL DEFAULT '0',
	`TPMMTCurCode10` VARCHAR(5) NULL,
	`TPMMTaxType10` SMALLINT NULL DEFAULT '0',
	`TPMMDiscountText10` VARCHAR(30) NULL,
	`TPMMStatus` SMALLINT NULL DEFAULT '0',
	`TPMMFreeTPOSCode1` VARCHAR(30) NULL,
	`TPMMFreeQuantity1` DOUBLE NULL DEFAULT '0',
	`TPMMFreeTPOSCode2` VARCHAR(30) NULL,
	`TPMMFreeQuantity2` DOUBLE NULL DEFAULT '0',
	`TPMMFreeTPOSCode3` VARCHAR(30) NULL,
	`TPMMFreeQuantity3` DOUBLE NULL DEFAULT '0',
	`TPMMFlag1` SMALLINT NULL DEFAULT '0',
	`TPMMFlag2` SMALLINT NULL DEFAULT '0',
	`TPMMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPMMTProNo`, `TPMMLn`),
	KEY `TPPMTARGCode` (`TPMMTARGCode`),
	KEY `TPPMTARNCode` (`TPMMTARNCode`),
	KEY `TPPMTaxType1` (`TPMMTaxType1`),
	KEY `TPPMTaxType10` (`TPMMTaxType10`),
	KEY `TPPMTaxType2` (`TPMMTaxType2`),
	KEY `TPPMTaxType3` (`TPMMTaxType3`),
	KEY `TPPMTaxType4` (`TPMMTaxType4`),
	KEY `TPPMTaxType5` (`TPMMTaxType5`),
	KEY `TPPMTaxType6` (`TPMMTaxType6`),
	KEY `TPPMTaxType7` (`TPMMTaxType7`),
	KEY `TPPMTaxType8` (`TPMMTaxType8`),
	KEY `TPPMTaxType9` (`TPMMTaxType9`),
	KEY `TPPMTCurCode1` (`TPMMTCurCode1`),
	KEY `TPPMTCurCode10` (`TPMMTCurCode10`),
	KEY `TPPMTCurCode2` (`TPMMTCurCode2`),
	KEY `TPPMTCurCode3` (`TPMMTCurCode3`),
	KEY `TPPMTCurCode4` (`TPMMTCurCode4`),
	KEY `TPPMTCurCode5` (`TPMMTCurCode5`),
	KEY `TPPMTCurCode6` (`TPMMTCurCode6`),
	KEY `TPPMTCurCode7` (`TPMMTCurCode7`),
	KEY `TPPMTCurCode8` (`TPMMTCurCode8`),
	KEY `TPPMTCurCode9` (`TPMMTCurCode9`),
	KEY `TPPMTPOSCode` (`TPMMTPOSCode`),
	KEY `TPPMTUntCode` (`TPMMTUntCode`),
	KEY `VS4TPromotionVS4TPromotionMB` (`TPMMTProNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TProvince` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TProvince`;

# ---------- CREATE TABLE `VS4TProvince` ----------

CREATE TABLE `VS4TProvince` (
	`TPrvCode` VARCHAR(3) NOT NULL,
	`TPrvName` VARCHAR(50) NULL,
	`TPrvName2` VARCHAR(50) NULL,
	`TPrvPhoneCode` VARCHAR(3) NULL,
	`TPrvTStaCode` VARCHAR(2) NULL,
	`TPrvTCouCode` VARCHAR(3) NULL,
	`TPrvFlag1` SMALLINT NULL DEFAULT '0',
	`TPrvFlag2` SMALLINT NULL DEFAULT '0',
	`TPrvFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPrvCode`),
	KEY `TPrvID` (`TPrvCode`),
	KEY `TPrvStateCode` (`TPrvTStaCode`),
	KEY `TPrvTCountryCode` (`TPrvTCouCode`),
	KEY `VS4TCountryVS4TProvince` (`TPrvTCouCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPS` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPS`;

# ---------- CREATE TABLE `VS4TPS` ----------

CREATE TABLE `VS4TPS` (
	`TPSDNo` VARCHAR(30) NOT NULL,
	`TPSDTPOKCode` VARCHAR(30) NULL,
	`TPSDTPCACode` VARCHAR(30) NULL,
	`TPSDMode` SMALLINT NULL DEFAULT '0',
	`TPSDType` SMALLINT NULL DEFAULT '0',
	`TPSDDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPSDDocDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPSDExpireDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPSDLoadingDate` DATETIME NULL,
	`TPSDRefNo` VARCHAR(30) NULL,
	`TPSDRefDate` DATETIME NULL,
	`TPSDRefNo2` VARCHAR(30) NULL,
	`TPSDRefDate2` DATETIME NULL,
	`TPSDAPBODeposit` INT NULL DEFAULT '0',
	`TPSDTJobNo` VARCHAR(30) NULL,
	`TPSDTJbMLn` INT NULL DEFAULT '0',
	`TPSDTPrjCode` VARCHAR(30) NULL,
	`TPSDTBraCode` VARCHAR(30) NULL,
	`TPSDSuggestCode` VARCHAR(30) NULL,
	`TPSDSuggestBy` VARCHAR(140) NULL,
	`TPSDDeliveryDate` DATETIME NULL,
	`TPSDDeliveryTo` VARCHAR(255) NULL,
	`TPSDTAPNCode` VARCHAR(30) NULL,
	`TPSDTAPUCode` VARCHAR(30) NULL,
	`TPSDSupplierName` VARCHAR(160) NULL,
	`TPSDContactNote` VARCHAR(50) NULL,
	`TPSDContactName` VARCHAR(140) NULL,
	`TPSDSupAddress` VARCHAR(255) NULL,
	`TPSDConsignee` VARCHAR(255) NULL,
	`TPSDNotifyParty` VARCHAR(255) NULL,
	`TPSDPriceChannel` SMALLINT NULL DEFAULT '0',
	`TPSDChannelName` VARCHAR(30) NULL,
	`TPSDDiscountList` FLOAT NULL,
	`TPSDSubTotal` FLOAT NULL,
	`TPSDDiscountText` VARCHAR(30) NULL,
	`TPSDDiscountTotal` FLOAT NULL,
	`TPSDNetTotal` FLOAT NULL DEFAULT '0',
	`TPSDDepositText` VARCHAR(30) NULL,
	`TPSDDeposit` FLOAT NULL DEFAULT '0',
	`TPSDTotal` FLOAT NULL,
	`TPSDTotalFOB` FLOAT NULL,
	`TPSDTCurCode` VARCHAR(5) NULL,
	`TPSDExchangeRate` FLOAT NULL DEFAULT '0',
	`TPSDTotalInRate` FLOAT NULL,
	`TPSDVATType` SMALLINT NULL DEFAULT '0',
	`TPSDVATRate` DOUBLE NULL,
	`TPSDTaxBase` FLOAT NULL DEFAULT '0',
	`TPSDVATTotal` FLOAT NULL,
	`TPSDGrandTotal` FLOAT NULL,
	`TPSDNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TPSDWTaxBase` FLOAT NULL DEFAULT '0',
	`TPSDWTaxRate` DOUBLE NULL DEFAULT '0',
	`TPSDWTaxTotal` FLOAT NULL DEFAULT '0',
	`TPSDNetPayment` FLOAT NULL,
	`TPSDAdjustTotal` FLOAT NULL DEFAULT '0',
	`TPSDPremiumTotal` FLOAT NULL,
	`TPSDBaseIncoType` VARCHAR(3) NULL,
	`TPSDIncoType` VARCHAR(3) NULL,
	`TPSDIncoterms` VARCHAR(50) NULL,
	`TPSDOtherFee` FLOAT NULL DEFAULT '0',
	`TPSDTransportFee` FLOAT NULL DEFAULT '0',
	`TPSDHandlingFee` FLOAT NULL DEFAULT '0',
	`TPSDFreightFee` FLOAT NULL DEFAULT '0',
	`TPSDInsurance` FLOAT NULL DEFAULT '0',
	`TPSDTransportDesc` FLOAT NULL,
	`TPSDDuty` FLOAT NULL,
	`TPSDShipBy` VARCHAR(255) NULL,
	`TPSDCountryOrigin` VARCHAR(50) NULL,
	`TPSDDestination` VARCHAR(255) NULL,
	`TPSDCondition` VARCHAR(100) NULL,
	`TPSDConditionType` SMALLINT NULL,
	`TPSDConditionDay` SMALLINT NULL DEFAULT '0',
	`TPSDCondition1` DOUBLE NULL DEFAULT '0',
	`TPSDConditionDay1` SMALLINT NULL DEFAULT '0',
	`TPSDPaymentNote` VARCHAR(200) NULL,
	`TPSDStatementNote` VARCHAR(200) NULL,
	`TPSDTShpCode` VARCHAR(30) NULL,
	`TPSDDeliveryNote` VARCHAR(200) NULL,
	`TPSDPackingNote` VARCHAR(200) NULL,
	`TPSDDayAvailable` SMALLINT NULL,
	`TPSDDescription` VARCHAR(255) NULL,
	`TPSDCustom1` VARCHAR(30) NULL,
	`TPSDCustom2` VARCHAR(30) NULL,
	`TPSDCustom3` VARCHAR(30) NULL,
	`TPSDCustom4` VARCHAR(255) NULL,
	`TPSDCustom5` VARCHAR(255) NULL,
	`TPSDMultiProject` SMALLINT NULL,
	`TPSDTPOTCode` VARCHAR(50) NULL,
	`TPSDBargain` VARCHAR(100) NULL,
	`TPSDCreateCode` VARCHAR(30) NULL,
	`TPSDCreateBy` VARCHAR(140) NULL,
	`TPSDCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPSDEditCode` VARCHAR(30) NULL,
	`TPSDEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPSDEditBy` VARCHAR(140) NULL,
	`TPSDConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TPSDConfirmBy` VARCHAR(140) NULL,
	`TPSDConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPSDApproveStatus` SMALLINT NULL DEFAULT '0',
	`TPSDApproveBy` VARCHAR(140) NULL,
	`TPSDApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPSDApproveNote` VARCHAR(80) NULL,
	`TPSDRevision` SMALLINT NULL DEFAULT '0',
	`TPSDCancelStatus` SMALLINT NULL DEFAULT '0',
	`TPSDCancelNo` VARCHAR(30) NULL,
	`TPSDCancelBy` VARCHAR(140) NULL,
	`TPSDCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPSDCancelNote` VARCHAR(80) NULL,
	`TPSDFlag1` SMALLINT NULL DEFAULT '0',
	`TPSDFlag2` SMALLINT NULL DEFAULT '0',
	`TPSDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPSDNo`),
	KEY `TAPQTCmpCode` (`TPSDTAPNCode`),
	KEY `TIAPTShpCode` (`TPSDTShpCode`),
	KEY `TPCNTAPUCode` (`TPSDTAPUCode`),
	KEY `TPCNTJbMLn` (`TPSDTJbMLn`),
	KEY `TPODTPBkCode` (`TPSDTPOKCode`),
	KEY `TPSDTPCACode` (`TPSDTPCACode`),
	KEY `TPWSRecordBy` (`TPSDSuggestBy`),
	KEY `TPWSSuggestBy1` (`TPSDContactName`),
	KEY `TPWSSuggestCode1` (`TPSDContactNote`),
	KEY `TPWSTEmpCode` (`TPSDSuggestCode`),
	KEY `TQuoCusAddress` (`TPSDSupAddress`),
	KEY `TQuoTBraCode` (`TPSDTBraCode`),
	KEY `TQuoTCurCode` (`TPSDTCurCode`),
	KEY `TQuoTJobNo` (`TPSDTJobNo`),
	KEY `TQuoTPrjCode` (`TPSDTPrjCode`),
	KEY `VS4TAPCampaignVS4TPS` (`TPSDTPCACode`),
	KEY `VS4TAPVS4TPS` (`TPSDTAPNCode`),
	KEY `VS4TPOBookVS4TPS` (`TPSDTPOKCode`),
	KEY `VS4TProjectVS4TPS` (`TPSDTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPSMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPSMB`;

# ---------- CREATE TABLE `VS4TPSMB` ----------

CREATE TABLE `VS4TPSMB` (
	`TPSMTPSDNo` VARCHAR(30) NOT NULL,
	`TPSMLn` INT NOT NULL DEFAULT '0',
	`TPSMType` SMALLINT NULL DEFAULT '0',
	`TPSMJobCode` VARCHAR(30) NULL,
	`TPSMGroupName` VARCHAR(30) NULL,
	`TPSMTOExCode` VARCHAR(50) NULL,
	`TPSMTPdtCode` VARCHAR(50) NULL,
	`TPSMCustom1` VARCHAR(30) NULL,
	`TPSMCustom2` VARCHAR(150) NULL,
	`TPSMCustom3` VARCHAR(150) NULL,
	`TPSMCustom4` VARCHAR(150) NULL,
	`TPSMCustom5` VARCHAR(150) NULL,
	`TPSMShippingMark` VARCHAR(255) NULL,
	`TPSMProductCode` VARCHAR(50) NULL,
	`TPSMFactoryCode` VARCHAR(50) NULL,
	`TPSMProductName` VARCHAR(150) NULL,
	`TPSMMinimumOrder` DOUBLE NULL DEFAULT '0',
	`TPSMCost` FLOAT NULL DEFAULT '0',
	`TPSMPrice` FLOAT NULL DEFAULT '0',
	`TPSMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TPSMUnitFactor` DOUBLE NULL DEFAULT '0',
	`TPSMQuantityText` VARCHAR(255) NULL,
	`TPSMQuantity` DOUBLE NULL DEFAULT '0',
	`TPSMAcceptError` VARCHAR(30) NULL,
	`TPSMUnitCalc` SMALLINT NULL DEFAULT '0',
	`TPSMQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TPSMTUntCode` VARCHAR(50) NULL,
	`TPSMQuantity2` DOUBLE NULL DEFAULT '0',
	`TPSMTUntCode2` VARCHAR(50) NULL,
	`TPSMQuantity3` DOUBLE NULL DEFAULT '0',
	`TPSMTUntCode3` VARCHAR(50) NULL,
	`TPSMDutyAmount` FLOAT NULL DEFAULT '0',
	`TPSMDivideExpense` FLOAT NULL DEFAULT '0',
	`TPSMCostAmount` FLOAT NULL DEFAULT '0',
	`TPSMAmount` DOUBLE NULL DEFAULT '0',
	`TPSMDiscountText` VARCHAR(30) NULL,
	`TPSMDiscountTotal` FLOAT NULL,
	`TPSMNetAmount` FLOAT NULL DEFAULT '0',
	`TPSMTaxType` SMALLINT NULL DEFAULT '0',
	`TPSMTaxBase` FLOAT NULL DEFAULT '0',
	`TPSMWTAXBase` FLOAT NULL DEFAULT '0',
	`TPSMAmountVAT` FLOAT NULL DEFAULT '0',
	`TPSMAmountWTAX` FLOAT NULL DEFAULT '0',
	`TPSMGetNumber` DOUBLE NULL DEFAULT '0',
	`TPSMFreeCode` VARCHAR(30) NULL,
	`TPSMIsPremium` SMALLINT NULL DEFAULT '0',
	`TPSMDescription` VARCHAR(255) NULL,
	`TPSMFlag1` SMALLINT NULL DEFAULT '0',
	`TPSMFlag2` SMALLINT NULL DEFAULT '0',
	`TPSMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPSMLn`, `TPSMTPSDNo`),
	KEY `TPSMPriceTUntCode` (`TPSMUnitFactor`),
	KEY `TPSMTPdtCode` (`TPSMProductCode`),
	KEY `TPSMTUntCode2` (`TPSMTUntCode3`),
	KEY `TPWBID` (`TPSMLn`),
	KEY `TPWBPdtCode` (`TPSMFactoryCode`),
	KEY `TPWBPdtCode1` (`TPSMTPdtCode`),
	KEY `TPWBTUntCode` (`TPSMTUntCode`),
	KEY `TPWBTUntCode1` (`TPSMTUntCode2`),
	KEY `TQuBFreeCode` (`TPSMFreeCode`),
	KEY `TSOBJobCode` (`TPSMJobCode`),
	KEY `TSOBTOInCode` (`TPSMTOExCode`),
	KEY `TTfMID` (`TPSMTPSDNo`),
	KEY `TTfrToTShfCode` (`TPSMType`),
	KEY `VS4TPWSVS4TPWSMB` (`TPSMTPSDNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPurPriceList` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPurPriceList`;

# ---------- CREATE TABLE `VS4TPurPriceList` ----------

CREATE TABLE `VS4TPurPriceList` (
	`TPUPNo` VARCHAR(30) NOT NULL,
	`TPUPDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPUPRefNo` VARCHAR(30) NULL,
	`TPUPDescription` VARCHAR(200) NULL,
	`TPUPCreateCode` VARCHAR(30) NULL,
	`TPUPCreateBy` VARCHAR(140) NULL,
	`TPUPCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPUPEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPUPEditCode` VARCHAR(30) NULL,
	`TPUPEditBy` VARCHAR(140) NULL,
	`TPUPConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TPUPConfirmBy` VARCHAR(140) NULL,
	`TPUPConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPUPApproveStatus` SMALLINT NULL DEFAULT '0',
	`TPUPApproveBy` VARCHAR(140) NULL,
	`TPUPApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPUPApproveNote` VARCHAR(80) NULL,
	`TPUPRevision` SMALLINT NULL DEFAULT '0',
	`TPUPCancelStatus` SMALLINT NULL DEFAULT '0',
	`TPUPCancelBy` VARCHAR(140) NULL,
	`TPUPCancelNo` VARCHAR(30) NULL,
	`TPUPCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TPUPCancelNote` VARCHAR(80) NULL,
	`TPUPFlag1` SMALLINT NULL DEFAULT '0',
	`TPUPFlag2` SMALLINT NULL DEFAULT '0',
	`TPUPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPUPNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TPurPriceListMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TPurPriceListMB`;

# ---------- CREATE TABLE `VS4TPurPriceListMB` ----------

CREATE TABLE `VS4TPurPriceListMB` (
	`TPUMTPUPNo` VARCHAR(30) NOT NULL,
	`TPUMLn` INT NOT NULL DEFAULT '0',
	`TPUMTPdtCode` VARCHAR(30) NULL,
	`TPUMFromQuantity` DOUBLE NULL DEFAULT '0',
	`TPUMTUntCode` VARCHAR(15) NULL,
	`TPUMTAPNCode` VARCHAR(30) NULL,
	`TPUMType` SMALLINT NULL DEFAULT '0',
	`TPUMPrice1` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode1` VARCHAR(5) NULL,
	`TPUMDiscountText1` VARCHAR(255) NULL,
	`TPUMPrice2` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode2` VARCHAR(5) NULL,
	`TPUMDiscountText2` VARCHAR(255) NULL,
	`TPUMPrice3` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode3` VARCHAR(5) NULL,
	`TPUMDiscountText3` VARCHAR(255) NULL,
	`TPUMPrice4` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode4` VARCHAR(5) NULL,
	`TPUMDiscountText4` VARCHAR(255) NULL,
	`TPUMPrice5` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode5` VARCHAR(5) NULL,
	`TPUMDiscountText5` VARCHAR(255) NULL,
	`TPUMPrice6` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode6` VARCHAR(5) NULL,
	`TPUMDiscountText6` VARCHAR(255) NULL,
	`TPUMPrice7` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode7` VARCHAR(5) NULL,
	`TPUMDiscountText7` VARCHAR(255) NULL,
	`TPUMPrice8` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode8` VARCHAR(5) NULL,
	`TPUMDiscountText8` VARCHAR(255) NULL,
	`TPUMPrice9` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode9` VARCHAR(5) NULL,
	`TPUMDiscountText9` VARCHAR(255) NULL,
	`TPUMPrice10` FLOAT NULL DEFAULT '0',
	`TPUMTCurCode10` VARCHAR(5) NULL,
	`TPUMDiscountText10` VARCHAR(255) NULL,
	`TPUMStatus` SMALLINT NULL DEFAULT '0',
	`TPUMFlag1` SMALLINT NULL DEFAULT '0',
	`TPUMFlag2` SMALLINT NULL DEFAULT '0',
	`TPUMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TPUMTPUPNo`, `TPUMLn`),
	KEY `TPOSPricTPOSCode` (`TPUMTPdtCode`),
	KEY `TPPMTCurCode1` (`TPUMTCurCode6`),
	KEY `TPPMTCurCode2` (`TPUMTCurCode7`),
	KEY `TPPMTCurCode3` (`TPUMTCurCode4`),
	KEY `TPPMTCurCode31` (`TPUMTCurCode5`),
	KEY `TPPMTCurCode32` (`TPUMTCurCode8`),
	KEY `TPPMTCurCode4` (`TPUMTCurCode9`),
	KEY `TPPMTCurCode5` (`TPUMTCurCode10`),
	KEY `TPPMTPOSCode` (`TPUMTAPNCode`),
	KEY `TPPMTTuntiCode` (`TPUMTUntCode`),
	KEY `TPPSPTCurCode` (`TPUMTCurCode1`),
	KEY `TPSPTCurCode` (`TPUMTCurCode2`),
	KEY `TPSPTCurCode1` (`TPUMTCurCode3`),
	KEY `VS4TProductVS4TPurPriceListMB` (`TPUMTPdtCode`),
	KEY `VS4TPurPriceListVS4TPurPriceListMB` (`TPUMTPUPNo`),
	KEY `VS4TUnitVS4TPurPriceListMB` (`TPUMTUntCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TQuickProduct` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TQuickProduct`;

# ---------- CREATE TABLE `VS4TQuickProduct` ----------

CREATE TABLE `VS4TQuickProduct` (
	`TQPdNo` VARCHAR(30) NOT NULL,
	`TQPdDate` DATETIME NULL DEFAULT '3333-3-3',
	`TQPdRefType` SMALLINT NULL DEFAULT '0',
	`TQPdRefNo` VARCHAR(30) NULL,
	`TQpdTPlnCode` VARCHAR(30) NULL,
	`TQpdTPlnName` VARCHAR(50) NULL,
	`TQpdTPTTCode` VARCHAR(30) NULL,
	`TQpdWarrantyType` INT NULL DEFAULT '0',
	`TQpdTPPuCode` VARCHAR(30) NULL,
	`TQpdTPS1Code` VARCHAR(30) NULL,
	`TQpdTPS1Name` VARCHAR(50) NULL,
	`TQpdTPS2Code` VARCHAR(30) NULL,
	`TQpdTPS2Name` VARCHAR(50) NULL,
	`TQpdTPS3Code` VARCHAR(30) NULL,
	`TQpdTPS3Name` VARCHAR(50) NULL,
	`TQpdTPS4Code` VARCHAR(30) NULL,
	`TQpdTPS4Name` VARCHAR(50) NULL,
	`TQpdTG1Code` VARCHAR(30) NULL,
	`TQpdTG1Name` VARCHAR(50) NULL,
	`TQpdTG2Code` VARCHAR(30) NULL,
	`TQpdTG2Name` VARCHAR(50) NULL,
	`TQpdTG3Code` VARCHAR(30) NULL,
	`TQpdTG3Name` VARCHAR(50) NULL,
	`TQpdTG4Code` VARCHAR(30) NULL,
	`TQpdTG4Name` VARCHAR(50) NULL,
	`TQpdTAPNCode` VARCHAR(30) NULL,
	`TQpdTAPNName` VARCHAR(150) NULL,
	`TQpdTotal` FLOAT NULL DEFAULT '0',
	`TQpdTotalRecord` INT NULL DEFAULT '0',
	`TQpdTotalQuantity` DOUBLE NULL DEFAULT '0',
	`TQPdDescription` VARCHAR(200) NULL,
	`TQPdCreateCode` VARCHAR(30) NULL,
	`TQPdCreateBy` VARCHAR(140) NULL,
	`TQPdCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TQPdEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TQPdEditCode` VARCHAR(30) NULL,
	`TQPdEditBy` VARCHAR(140) NULL,
	`TQPdConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TQPdConfirmBy` VARCHAR(140) NULL,
	`TQPdConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TQPdApproveStatus` SMALLINT NULL DEFAULT '0',
	`TQPdApproveBy` VARCHAR(140) NULL,
	`TQPdApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TQPdApproveNote` VARCHAR(80) NULL,
	`TQPdRevision` SMALLINT NULL DEFAULT '0',
	`TQPdCancelStatus` SMALLINT NULL DEFAULT '0',
	`TQPdCancelBy` VARCHAR(140) NULL,
	`TQPdCancelNo` VARCHAR(30) NULL,
	`TQPdCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TQPdCancelNote` VARCHAR(80) NULL,
	`TQPdFlag1` SMALLINT NULL DEFAULT '0',
	`TQPdFlag2` SMALLINT NULL DEFAULT '0',
	`TQPdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TQPdNo`),
	KEY `TQpdTAPNCode` (`TQpdTAPNCode`),
	KEY `TQpdTG1Code` (`TQpdTG4Code`),
	KEY `TQpdTG1Code1` (`TQpdTG1Code`),
	KEY `TQpdTG1Code2` (`TQpdTG2Code`),
	KEY `TQpdTG1Code3` (`TQpdTG3Code`),
	KEY `TQpdTPlnCode` (`TQpdTPlnCode`),
	KEY `TQpdTPPYCode` (`TQpdTPPuCode`),
	KEY `TQpdTPTTCode` (`TQpdTPTTCode`),
	KEY `VS4TProductPURTypeVS4TQuickProduct` (`TQpdTPPuCode`),
	KEY `VS4TProductSectionVS4TQuickProduct` (`TQpdTPS1Code`),
	KEY `VS4TProductTypeVS4TQuickProduct` (`TQpdTPTTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TQuickProductMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TQuickProductMB`;

# ---------- CREATE TABLE `VS4TQuickProductMB` ----------

CREATE TABLE `VS4TQuickProductMB` (
	`TQPMTQPdNo` VARCHAR(30) NOT NULL,
	`TQPMLn` INT NOT NULL DEFAULT '0',
	`TQPMProductCode` VARCHAR(30) NULL,
	`TQPMProductBarCode` VARCHAR(30) NULL,
	`TQPMProductName` VARCHAR(150) NULL,
	`TQPMProductName2` VARCHAR(150) NULL,
	`TQPMProductAlias` VARCHAR(30) NULL,
	`TQPMFactoryCode` VARCHAR(30) NULL,
	`TQPMTAPNCode` VARCHAR(30) NULL,
	`TQPMUnitType` SMALLINT NULL DEFAULT '0',
	`TQPMTUntCode` VARCHAR(15) NULL,
	`TQPMTUntCode2` VARCHAR(15) NULL,
	`TQPMTUntCode3` VARCHAR(15) NULL,
	`TQPMPriceFormula` VARCHAR(30) NULL,
	`TQPMPrice1` FLOAT NULL DEFAULT '0',
	`TQPMTCurCode1` VARCHAR(5) NULL,
	`TQPMTaxType` SMALLINT NULL DEFAULT '0',
	`TQPMFromQuantity` DOUBLE NULL DEFAULT '0',
	`TQPMStandardCost` FLOAT NULL DEFAULT '0',
	`TQPMStdCostCode` VARCHAR(30) NULL,
	`TQPMPackText1` VARCHAR(255) NULL,
	`TQPMPackText2` VARCHAR(255) NULL,
	`TQPMPackAlias1` VARCHAR(255) NULL,
	`TQPMPackAlias2` VARCHAR(255) NULL,
	`TQPMMatCode1` VARCHAR(30) NULL,
	`TQPMMatCode2` VARCHAR(30) NULL,
	`TQPMMatCode3` VARCHAR(30) NULL,
	`TQPMMatCode4` VARCHAR(30) NULL,
	`TQPMMatCode5` VARCHAR(30) NULL,
	`TQPMMatCode6` VARCHAR(30) NULL,
	`TQPMMatName11` VARCHAR(150) NULL,
	`TQPMMatName21` VARCHAR(150) NULL,
	`TQPMMatName31` VARCHAR(150) NULL,
	`TQPMMatName41` VARCHAR(150) NULL,
	`TQPMMatName51` VARCHAR(150) NULL,
	`TQPMMatName61` VARCHAR(150) NULL,
	`TQPMMatName12` VARCHAR(150) NULL,
	`TQPMMatName22` VARCHAR(150) NULL,
	`TQPMMatName32` VARCHAR(150) NULL,
	`TQPMMatName42` VARCHAR(150) NULL,
	`TQPMMatName52` VARCHAR(150) NULL,
	`TQPMMatName62` VARCHAR(150) NULL,
	`TQPMCustomValue1` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValue2` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValue3` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValue4` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValue5` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValue6` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValueR1` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValueR2` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValueR3` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValueR4` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValueR5` DOUBLE NULL DEFAULT '0',
	`TQPMCustomValueR6` DOUBLE NULL DEFAULT '0',
	`TQPMCustomText1` VARCHAR(255) NULL,
	`TQPMCustomText2` VARCHAR(255) NULL,
	`TQPMCustomText3` VARCHAR(255) NULL,
	`TQPMCustomText4` VARCHAR(255) NULL,
	`TQPMCustomText5` VARCHAR(255) NULL,
	`TQPMCustomText6` VARCHAR(255) NULL,
	`TQPMWeightQty1` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQty2` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQty3` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQty4` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQty5` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQty6` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQtyR1` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQtyR2` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQtyR3` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQtyR4` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQtyR5` DOUBLE NULL DEFAULT '0',
	`TQPMWeightQtyR6` DOUBLE NULL DEFAULT '0',
	`TQPMWeightUnt1` VARCHAR(30) NULL,
	`TQPMWeightUnt2` VARCHAR(30) NULL,
	`TQPMWeightUnt3` VARCHAR(30) NULL,
	`TQPMWeightUnt4` VARCHAR(30) NULL,
	`TQPMWeightUnt5` VARCHAR(30) NULL,
	`TQPMWeightUnt6` VARCHAR(30) NULL,
	`TQPMAmountQty1` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQty2` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQty3` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQty4` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQty5` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQty6` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQtyR1` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQtyR2` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQtyR3` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQtyR4` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQtyR5` DOUBLE NULL DEFAULT '0',
	`TQPMAmountQtyR6` DOUBLE NULL DEFAULT '0',
	`TQPMAmountUnt1` VARCHAR(30) NULL,
	`TQPMAmountUnt2` VARCHAR(30) NULL,
	`TQPMAmountUnt3` VARCHAR(30) NULL,
	`TQPMAmountUnt4` VARCHAR(30) NULL,
	`TQPMAmountUnt5` VARCHAR(30) NULL,
	`TQPMAmountUnt6` VARCHAR(30) NULL,
	`TQPMFlag1` SMALLINT NULL DEFAULT '0',
	`TQPMFlag2` SMALLINT NULL DEFAULT '0',
	`TQPMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TQPMTQPdNo`, `TQPMLn`),
	KEY `TQPMProductCode` (`TQPMProductCode`),
	KEY `TQPMStdCostCode` (`TQPMStdCostCode`),
	KEY `TQPMStdCostCode1` (`TQPMPriceFormula`),
	KEY `TQPMTQPdNo` (`TQPMTQPdNo`),
	KEY `TQPMTUntCode` (`TQPMTUntCode`),
	KEY `TQPMTUntCode1` (`TQPMTUntCode2`),
	KEY `TQPMTUntCode2` (`TQPMTUntCode3`),
	KEY `TQPMTUntCode3` (`TQPMUnitType`),
	KEY `VS4TQuickProductVS4TQuickProductMB` (`TQPMTQPdNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TQuotation` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TQuotation`;

# ---------- CREATE TABLE `VS4TQuotation` ----------

CREATE TABLE `VS4TQuotation` (
	`TQuoNo` VARCHAR(30) NOT NULL,
	`TQuoTSBkCode` VARCHAR(30) NULL,
	`TQuoTRCACode` VARCHAR(30) NULL,
	`TQuoMode` SMALLINT NULL DEFAULT '0',
	`TQuoPotential` DOUBLE NULL,
	`TQuoCode` VARCHAR(30) NULL,
	`TQuoType` SMALLINT NULL DEFAULT '0',
	`TQuoDate` DATETIME NULL,
	`TQuoTDStCode` VARCHAR(30) NULL,
	`TQuoExpireDate` DATETIME NULL,
	`TQuoLoadingDate` DATETIME NULL,
	`TQuoSubject` VARCHAR(100) NULL,
	`TQuoRefNo` VARCHAR(30) NULL,
	`TQuoRefNo2` VARCHAR(30) NULL,
	`TQuoTPrjCode` VARCHAR(30) NULL,
	`TQuoTBraCode` VARCHAR(30) NULL,
	`TQuoTEmpCode` VARCHAR(30) NULL,
	`TQuoSaleName` VARCHAR(140) NULL,
	`TQuoGuideText` VARCHAR(100) NULL,
	`TQuoEmpText` VARCHAR(100) NULL,
	`TQuoDeliveryDate` DATETIME NULL,
	`TQuoDeliveryTo` VARCHAR(255) NULL,
	`TQuoTOTNLn` INT NULL,
	`TQuoTARNCode` VARCHAR(30) NULL,
	`TQuoTARDCode` VARCHAR(30) NULL,
	`TQuoContactNote` VARCHAR(50) NULL,
	`TQuoContactName` VARCHAR(160) NULL,
	`TQuoCustomerName` VARCHAR(200) NULL,
	`TQuoCusAddress` VARCHAR(255) NULL,
	`TQuoConsignee` VARCHAR(255) NULL,
	`TQuoNotifyParty` VARCHAR(255) NULL,
	`TQuoCostTotal` FLOAT NULL DEFAULT '0',
	`TQuoPMCostTotal` FLOAT NULL DEFAULT '0',
	`TQuoPriceChannel` SMALLINT NULL DEFAULT '0',
	`TQuoChannelName` VARCHAR(30) NULL,
	`TQuoDiscountList` FLOAT NULL,
	`TQuoSubTotal` FLOAT NULL,
	`TQuoDiscountText` VARCHAR(30) NULL,
	`TQuoDiscountTotal` FLOAT NULL,
	`TQuoNetTotal` FLOAT NULL,
	`TQuoDepositText` VARCHAR(30) NULL,
	`TQuoDeposit` FLOAT NULL DEFAULT '0',
	`TQuoTotal` FLOAT NULL,
	`TQuoTotalFOB` FLOAT NULL,
	`TQuoTCurCode` VARCHAR(5) NULL,
	`TQuoExchangeRate` FLOAT NULL DEFAULT '0',
	`TQuoTotalInRate` FLOAT NULL,
	`TQuoVATType` SMALLINT NULL DEFAULT '0',
	`TQuoVATRate` DOUBLE NULL,
	`TQuoTaxBase` FLOAT NULL DEFAULT '0',
	`TQuoVATTotal` FLOAT NULL,
	`TQuoGrandTotal` FLOAT NULL,
	`TQuoNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TQuoWTAXBase` FLOAT NULL DEFAULT '0',
	`TQuoWTaxRate` DOUBLE NULL DEFAULT '0',
	`TQuoWTaxTotal` FLOAT NULL DEFAULT '0',
	`TQuoNetPayment` FLOAT NULL,
	`TQuoAdjustTotal` FLOAT NULL DEFAULT '0',
	`TQuoRewardTotal` FLOAT NULL,
	`TQuoPremiumTotal` FLOAT NULL,
	`TQuoCommissionBase` FLOAT NULL DEFAULT '0',
	`TQuoCommissionRate` VARCHAR(30) NULL,
	`TQuoCommission` FLOAT NULL DEFAULT '0',
	`TQuoBaseIncoType` VARCHAR(3) NULL,
	`TQuoIncoType` VARCHAR(3) NULL,
	`TQuoIncoterms` VARCHAR(50) NULL,
	`TQuoOtherFee` FLOAT NULL DEFAULT '0',
	`TQuoTransportFee` FLOAT NULL DEFAULT '0',
	`TQuoHandlingFee` FLOAT NULL DEFAULT '0',
	`TQuoFreightFee` FLOAT NULL DEFAULT '0',
	`TQuoInsurance` FLOAT NULL DEFAULT '0',
	`TQuoTransportDesc` FLOAT NULL,
	`TQuoDuty` FLOAT NULL,
	`TQuoShipBy` VARCHAR(255) NULL,
	`TQuoCountryOrigin` VARCHAR(50) NULL,
	`TQuoDestination` VARCHAR(255) NULL,
	`TQuoCondition` VARCHAR(100) NULL,
	`TQuoConditionDay` SMALLINT NULL DEFAULT '0',
	`TQuoCondition1` DOUBLE NULL DEFAULT '0',
	`TQuoConditionDay1` SMALLINT NULL DEFAULT '0',
	`TQuoCustom1` VARCHAR(30) NULL,
	`TQuoCustom2` VARCHAR(30) NULL,
	`TQuoCustom3` VARCHAR(30) NULL,
	`TQuoCustom4` VARCHAR(255) NULL,
	`TQuoCustom5` VARCHAR(255) NULL,
	`TQuoPaymentNote` VARCHAR(200) NULL,
	`TQuoStatementNote` VARCHAR(200) NULL,
	`TQuoTShpCode` VARCHAR(30) NULL,
	`TQuoDeliveryNote` VARCHAR(200) NULL,
	`TQuoPackingNote` VARCHAR(200) NULL,
	`TQuoDayAvailable` SMALLINT NULL,
	`TQuoDescription` VARCHAR(255) NULL,
	`TQuoTSOTCode` VARCHAR(50) NULL,
	`TQuoCreateBy` VARCHAR(140) NULL,
	`TQuoCreateDate` DATETIME NULL,
	`TQuoEditCode` VARCHAR(30) NULL,
	`TQuoEditBy` VARCHAR(140) NULL,
	`TQuoEditDate` DATETIME NULL,
	`TQuoConfirmStatus` SMALLINT NULL,
	`TQuoConfirmBy` VARCHAR(140) NULL,
	`TQuoConfirmDate` DATETIME NULL,
	`TQuoApproveStatus` SMALLINT NULL,
	`TQuoApproveBy` VARCHAR(140) NULL,
	`TQuoApproveDate` DATETIME NULL,
	`TQuoApproveNote` VARCHAR(80) NULL,
	`TQuoRevision` SMALLINT NULL,
	`TQuoReviseBy` VARCHAR(140) NULL,
	`TQuoReviseStatus` SMALLINT NULL,
	`TQuoCancelStatus` SMALLINT NULL,
	`TQuoCancelBy` VARCHAR(140) NULL,
	`TQuoCancelDate` DATETIME NULL,
	`TQuoCancelNote` VARCHAR(80) NULL,
	`TQuoFlag1` SMALLINT NULL,
	`TQuoFlag2` SMALLINT NULL,
	`TQuoFlag3` SMALLINT NULL,
	PRIMARY KEY (`TQuoNo`),
	KEY `TAPQTCmpCode` (`TQuoTARNCode`),
	KEY `TIAPTShpCode` (`TQuoTShpCode`),
	KEY `TInvTCurCode` (`TQuoTCurCode`),
	KEY `TIvoTARDCode` (`TQuoTARDCode`),
	KEY `TJobCode` (`TQuoCode`),
	KEY `TPODTAPNCode` (`TQuoContactNote`),
	KEY `TPODTPrjCode` (`TQuoTPrjCode`),
	KEY `TPRDTBokCode` (`TQuoTSBkCode`),
	KEY `TPRDTBraCode` (`TQuoTBraCode`),
	KEY `TPWOSupplierName` (`TQuoCusAddress`),
	KEY `TPWOTCmpCode` (`TQuoCustomerName`),
	KEY `TQuoTRCACode` (`TQuoTRCACode`),
	KEY `TSODTEmpCode` (`TQuoTEmpCode`),
	KEY `VS4TARCampaignVS4TQuotation` (`TQuoTRCACode`),
	KEY `VS4TARVS4TQuotation` (`TQuoTARNCode`),
	KEY `VS4TDocumentStatusVS4TQuotation` (`TQuoTDStCode`),
	KEY `VS4TProjectVS4TQuotation` (`TQuoTPrjCode`),
	KEY `VS4TSOBookVS4TQuotation` (`TQuoTSBkCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TQuotationMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TQuotationMB`;

# ---------- CREATE TABLE `VS4TQuotationMB` ----------

CREATE TABLE `VS4TQuotationMB` (
	`TQuBTQuoNo` VARCHAR(30) NOT NULL,
	`TQuBLn` INT NOT NULL DEFAULT '0',
	`TQuBType` SMALLINT NULL DEFAULT '0',
	`TQuBGroupName` VARCHAR(30) NULL,
	`TQuBTOInCode` VARCHAR(50) NULL,
	`TQuBTPOSCode` VARCHAR(50) NULL,
	`TQuBCustom1` VARCHAR(30) NULL,
	`TQuBCustom2` VARCHAR(150) NULL,
	`TQuBCustom3` VARCHAR(150) NULL,
	`TQuBCustom4` VARCHAR(150) NULL,
	`TQuBCustom5` VARCHAR(150) NULL,
	`TQuBShippingMark` VARCHAR(255) NULL,
	`TQuBPOSCode` VARCHAR(50) NULL,
	`TQuBFactoryCode` VARCHAR(50) NULL,
	`TQuBPOSName` VARCHAR(150) NULL,
	`TQuBCost` FLOAT NULL DEFAULT '0',
	`TQuBPremiumCost` FLOAT NULL DEFAULT '0',
	`TQuBPrice` FLOAT NULL DEFAULT '0',
	`TQuBPerQuantity` DOUBLE NULL DEFAULT '1',
	`TQuBUnitFactor` DOUBLE NULL DEFAULT '0',
	`TQuBAcceptError` VARCHAR(30) NULL,
	`TQuBUnitCalc` SMALLINT NULL DEFAULT '0',
	`TQuBQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TQuBQuantityText` VARCHAR(255) NULL,
	`TQuBQuantity` DOUBLE NULL DEFAULT '0',
	`TQuBTUntCode` VARCHAR(50) NULL,
	`TQuBQuantity2` DOUBLE NULL DEFAULT '0',
	`TQuBTUntCode2` VARCHAR(50) NULL,
	`TQuBQuantity3` DOUBLE NULL DEFAULT '0',
	`TQuBTUntCode3` VARCHAR(50) NULL,
	`TQuBCostAmount` DOUBLE NULL DEFAULT '0',
	`TQuBAmount` DOUBLE NULL DEFAULT '0',
	`TQuBDiscountText` VARCHAR(30) NULL,
	`TQuBDiscountTotal` FLOAT NULL,
	`TQuBNetAmount` FLOAT NULL DEFAULT '0',
	`TQuBTaxType` SMALLINT NULL DEFAULT '0',
	`TQuBTaxBase` FLOAT NULL DEFAULT '0',
	`TQuBWTAXBase` FLOAT NULL DEFAULT '0',
	`TQuBAmountVAT` FLOAT NULL DEFAULT '0',
	`TQuBAmountWTAX` FLOAT NULL DEFAULT '0',
	`TQuBPromotionType` VARCHAR(15) NULL,
	`TQuBFreeCode` VARCHAR(30) NULL,
	`TQuBIsPremium` SMALLINT NULL DEFAULT '0',
	`TQuBDescription` VARCHAR(255) NULL,
	`TQuBUseDate` DATETIME NULL,
	`TQuBFlag1` SMALLINT NULL DEFAULT '0',
	`TQuBFlag2` SMALLINT NULL DEFAULT '0',
	`TQuBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TQuBLn`, `TQuBTQuoNo`),
	KEY `TPOBTPdtCode` (`TQuBTPOSCode`),
	KEY `TPSMUnitFactor` (`TQuBUnitFactor`),
	KEY `TPTSFreeTPOSCode` (`TQuBFreeCode`),
	KEY `TPWBID` (`TQuBLn`),
	KEY `TPWBPdtCode1` (`TQuBPOSCode`),
	KEY `TPWBTUntCode` (`TQuBTUntCode`),
	KEY `TPWBTUntCode1` (`TQuBTUntCode2`),
	KEY `TQuBPOSCode` (`TQuBFactoryCode`),
	KEY `TQuBTUntCode2` (`TQuBTUntCode3`),
	KEY `TSOBTOInCode` (`TQuBTOInCode`),
	KEY `TTfMID` (`TQuBTQuoNo`),
	KEY `TTfrToTShfCode` (`TQuBType`),
	KEY `VS4TQuotationVS4TQuotationMB` (`TQuBTQuoNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TQuotationSet` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TQuotationSet`;

# ---------- CREATE TABLE `VS4TQuotationSet` ----------

CREATE TABLE `VS4TQuotationSet` (
	`TQuSNo` VARCHAR(30) NOT NULL,
	`TQuSDate` DATETIME NULL,
	`TQuSSubject` VARCHAR(100) NULL,
	`TQuSRefNo` VARCHAR(30) NULL,
	`TQuSRefDate` DATETIME NULL,
	`TQuSTJobNo` VARCHAR(30) NULL,
	`TQuSTJbMLn` INT NULL DEFAULT '0',
	`TQuSTPrjCode` VARCHAR(30) NULL,
	`TQuSTSecCode` VARCHAR(30) NULL,
	`TQuSTDepCode` VARCHAR(30) NULL,
	`TQuSTDivCode` VARCHAR(30) NULL,
	`TQuSTBraCode` VARCHAR(30) NULL,
	`TQuSTEmpCode` VARCHAR(30) NULL,
	`TQuSTARNCode` VARCHAR(30) NULL,
	`TQuSCustomerName` VARCHAR(200) NULL,
	`TQuSCusAddress` VARCHAR(255) NULL,
	`TQuSTaxBase` FLOAT NULL DEFAULT '0',
	`TQuSVATTotal` FLOAT NULL,
	`TQuSGrandTotal` FLOAT NULL,
	`TQuSDescription` VARCHAR(255) NULL,
	`TQuSCreateCode` VARCHAR(30) NULL,
	`TQuSCreateBy` VARCHAR(140) NULL,
	`TQuSCreateDate` DATETIME NULL,
	`TQuSEditCode` VARCHAR(30) NULL,
	`TQuSEditBy` VARCHAR(140) NULL,
	`TQuSEditDate` DATETIME NULL,
	`TQuSConfirmStatus` SMALLINT NULL,
	`TQuSConfirmBy` VARCHAR(140) NULL,
	`TQuSConfirmDate` DATETIME NULL,
	`TQuSApproveStatus` SMALLINT NULL,
	`TQuSApproveBy` VARCHAR(140) NULL,
	`TQuSApproveDate` DATETIME NULL,
	`TQuSApproveNote` VARCHAR(80) NULL,
	`TQuSRevision` SMALLINT NULL,
	`TQuSCancelStatus` SMALLINT NULL,
	`TQuSCancelNo` VARCHAR(30) NULL,
	`TQuSCancelBy` VARCHAR(140) NULL,
	`TQuSCancelDate` DATETIME NULL,
	`TQuSCancelNote` VARCHAR(80) NULL,
	`TQuSFlag1` SMALLINT NULL,
	`TQuSFlag2` SMALLINT NULL,
	`TQuSFlag3` SMALLINT NULL,
	PRIMARY KEY (`TQuSNo`),
	KEY `TAPQTCmpCode` (`TQuSTARNCode`),
	KEY `TPCNTJbMLn` (`TQuSTJbMLn`),
	KEY `TPODTDepCode` (`TQuSTDepCode`),
	KEY `TPODTDivCode` (`TQuSTDivCode`),
	KEY `TPODTJobNo` (`TQuSTJobNo`),
	KEY `TPODTPrjCode` (`TQuSTPrjCode`),
	KEY `TPRDTBraCode` (`TQuSTBraCode`),
	KEY `TPWOSupplierName` (`TQuSCusAddress`),
	KEY `TPWOTCmpCode` (`TQuSCustomerName`),
	KEY `TQuSTARNCode` (`TQuSTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TQuotationSetMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TQuotationSetMB`;

# ---------- CREATE TABLE `VS4TQuotationSetMB` ----------

CREATE TABLE `VS4TQuotationSetMB` (
	`TQSBTQuSNo` VARCHAR(30) NOT NULL,
	`TQSBTQuoNo` VARCHAR(30) NOT NULL,
	`TQSBLn` INT NOT NULL DEFAULT '0',
	`TQSBDescription` VARCHAR(250) NULL,
	`TQSBFlag1` SMALLINT NULL DEFAULT '0',
	`TQSBFlag2` SMALLINT NULL DEFAULT '0',
	`TQSBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TQSBTQuSNo`, `TQSBTQuoNo`, `TQSBLn`),
	KEY `TPWBID` (`TQSBLn`),
	KEY `TQSBTQuoNo` (`TQSBTQuoNo`),
	KEY `TTfMID` (`TQSBTQuSNo`),
	KEY `VS4TQuotationSetVS4TQuotationSetMB` (`TQSBTQuSNo`),
	KEY `VS4TQuotationVS4TQuotationSetMB` (`TQSBTQuoNo`),
	KEY `VS4TQuotationVS4TQuotationSetMB1` (`TQSBTQuoNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TReceipt` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TReceipt`;

# ---------- CREATE TABLE `VS4TReceipt` ----------

CREATE TABLE `VS4TReceipt` (
	`TRECNo` VARCHAR(30) NOT NULL,
	`TRECDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRECMode` SMALLINT NULL DEFAULT '0',
	`TRECType` DATETIME NULL,
	`TRECRefNo` VARCHAR(30) NULL,
	`TRECRefDate` DATETIME NULL,
	`TRECPayTo` VARCHAR(160) NULL,
	`TRECTBraCode` VARCHAR(30) NULL,
	`TRECTPrjCode` VARCHAR(30) NULL,
	`TRECTGLBCode` VARCHAR(30) NULL,
	`TRECSubTotal` FLOAT NULL DEFAULT '0',
	`TRECWTaxRate` DOUBLE NULL DEFAULT '0',
	`TRECDiscount` FLOAT NULL DEFAULT '0',
	`TRECWTaxTotal` FLOAT NULL DEFAULT '0',
	`TRECTotal` FLOAT NULL DEFAULT '0',
	`TRECNote` VARCHAR(255) NULL,
	`TRECCreateCode` VARCHAR(30) NULL,
	`TRECCreateBy` VARCHAR(140) NULL,
	`TRECCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRECEditCode` VARCHAR(30) NULL,
	`TRECEditBy` VARCHAR(140) NULL,
	`TRECEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRECConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TRECConfirmBy` VARCHAR(140) NULL,
	`TRECConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRECApproveStatus` SMALLINT NULL DEFAULT '0',
	`TRECApproveBy` VARCHAR(140) NULL,
	`TRECApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRECApproveNote` VARCHAR(80) NULL,
	`TRECRevision` SMALLINT NULL DEFAULT '0',
	`TRECCancelStatus` SMALLINT NULL DEFAULT '0',
	`TRECCancelNo` VARCHAR(30) NULL,
	`TRECCancelBy` VARCHAR(140) NULL,
	`TRECCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TRECCancelNote` VARCHAR(80) NULL,
	`TRECFlag1` SMALLINT NULL DEFAULT '0',
	`TRECFlag2` SMALLINT NULL DEFAULT '0',
	`TRECFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRECNo`),
	KEY `TAPVNo` (`TRECNo`),
	KEY `TAPVTGLBCode` (`TRECTGLBCode`),
	KEY `TPCNTBraCode` (`TRECTBraCode`),
	KEY `TRVHTPrjCode` (`TRECTPrjCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TReceivePdu` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TReceivePdu`;

# ---------- CREATE TABLE `VS4TReceivePdu` ----------

CREATE TABLE `VS4TReceivePdu` (
	`TRCPNo` VARCHAR(30) NOT NULL,
	`TRCPType` SMALLINT NULL DEFAULT '0',
	`TRCPDate` DATETIME NULL,
	`TRCPDueDate` DATETIME NULL,
	`TRCPRefNo` VARCHAR(30) NULL,
	`TRCPRefDate` DATETIME NULL,
	`TRCPRefNo2` VARCHAR(30) NULL,
	`TRCPRefDate2` DATETIME NULL,
	`TRCPTJobNo` VARCHAR(30) NULL,
	`TRCPTAolCode` VARCHAR(30) NULL,
	`TRCPTPstCode` VARCHAR(50) NULL,
	`TRCPTPrjCode` VARCHAR(30) NULL,
	`TRCPTSecCode` VARCHAR(30) NULL,
	`TRCPTDepCode` VARCHAR(30) NULL,
	`TRCPTDivCode` VARCHAR(30) NULL,
	`TRCPTBraCode` VARCHAR(30) NULL,
	`TRCPTEmpCode` VARCHAR(30) NULL,
	`TRCPSaleName` VARCHAR(140) NULL,
	`TRCPTEmpCode2` VARCHAR(30) NULL,
	`TRCPSaleName2` VARCHAR(140) NULL,
	`TRCPDeliveryDate` DATETIME NULL,
	`TRCPDeliveryTo` VARCHAR(255) NULL,
	`TRCPTARNCode` VARCHAR(30) NULL,
	`TRCPTARCCode` VARCHAR(30) NULL,
	`TRCPContactName` VARCHAR(160) NULL,
	`TRCPTARCCode2` VARCHAR(30) NULL,
	`TRCPContactName2` VARCHAR(160) NULL,
	`TRCPCustomerName` VARCHAR(200) NULL,
	`TRCPCusAddress` VARCHAR(255) NULL,
	`TRCPCostTotal` FLOAT NULL DEFAULT '0',
	`TRCPPriceChannel` SMALLINT NULL DEFAULT '0',
	`TRCPChannelName` VARCHAR(30) NULL,
	`TRCPSubTotal` FLOAT NULL,
	`TRCPDiscountPC` DOUBLE NULL,
	`TRCPDiscountFix` FLOAT NULL,
	`TRCPDiscountTotal` FLOAT NULL,
	`TRCPTaxBase` FLOAT NULL DEFAULT '0',
	`TRCPVATRate` DOUBLE NULL,
	`TRCPVATTotal` FLOAT NULL,
	`TRCPNOTAXTotal` VARCHAR(50) NULL,
	`TRCPZTAXTotal` VARCHAR(50) NULL,
	`TRCPWTaxRate` VARCHAR(50) NULL,
	`TRCPWTaxTotal` VARCHAR(50) NULL,
	`TRCPGrandTotalVAT` FLOAT NULL,
	`TRCPGrandTotal` FLOAT NULL,
	`TRCPNetPayment` FLOAT NULL,
	`TRCPCommissionBase` FLOAT NULL DEFAULT '0',
	`TRCPDepositRate` FLOAT NULL DEFAULT '0',
	`TRCPDeposit` FLOAT NULL DEFAULT '0',
	`TRCPTonnage` FLOAT NULL DEFAULT '0',
	`TRCPInsurance` FLOAT NULL DEFAULT '0',
	`TRCPFreightFee` FLOAT NULL DEFAULT '0',
	`TRCPOtherFee` FLOAT NULL DEFAULT '0',
	`TRCPFirstPayment` FLOAT NULL,
	`TRCPTCurCode` VARCHAR(5) NULL,
	`TRCPExchangeRate` FLOAT NULL DEFAULT '0',
	`TRCPCountryOrigin` VARCHAR(50) NULL,
	`TRCPCondition` VARCHAR(100) NULL,
	`TRCPConditionDay` SMALLINT NULL DEFAULT '0',
	`TRCPCondition1` DOUBLE NULL DEFAULT '0',
	`TRCPConditionDay1` SMALLINT NULL DEFAULT '0',
	`TRCPCondition2` DOUBLE NULL DEFAULT '0',
	`TRCPConditionDay2` SMALLINT NULL DEFAULT '0',
	`TRCPPaymentNote` VARCHAR(100) NULL,
	`TRCPStatementNote` VARCHAR(100) NULL,
	`TRCPDeliveryNote` VARCHAR(100) NULL,
	`TRCPDayAvailable` SMALLINT NULL,
	`TRCPDescription` VARCHAR(255) NULL,
	`TRCPMultiProject` SMALLINT NULL,
	`TRCPTSOTCode` VARCHAR(50) NULL,
	`TRCPLinkStatus` SMALLINT NULL,
	`TRCPDeliveryStatus` SMALLINT NULL,
	`TRCPFinishDate` DATETIME NULL,
	`TRCPCreateCode` VARCHAR(30) NULL,
	`TRCPCreateBy` VARCHAR(140) NULL,
	`TRCPCreateDate` DATETIME NULL,
	`TRCPEditCode` VARCHAR(30) NULL,
	`TRCPEditBy` VARCHAR(140) NULL,
	`TRCPEditDate` DATETIME NULL,
	`TRCPConfirmStatus` SMALLINT NULL,
	`TRCPConfirmBy` VARCHAR(140) NULL,
	`TRCPConfirmDate` DATETIME NULL,
	`TRCPApproveStatus` SMALLINT NULL,
	`TRCPApproveBy` VARCHAR(140) NULL,
	`TRCPApproveDate` DATETIME NULL,
	`TRCPApproveNote` VARCHAR(80) NULL,
	`TRCPRevision` SMALLINT NULL,
	`TRCPCancelStatus` SMALLINT NULL,
	`TRCPCancelNo` VARCHAR(30) NULL,
	`TRCPCancelBy` VARCHAR(140) NULL,
	`TRCPCancelDate` DATETIME NULL,
	`TRCPCancelNote` VARCHAR(80) NULL,
	`TRCPFlag1` SMALLINT NULL,
	`TRCPFlag2` SMALLINT NULL,
	`TRCPFlag3` SMALLINT NULL,
	PRIMARY KEY (`TRCPNo`),
	KEY `TAPQTCmpCode` (`TRCPTARNCode`),
	KEY `TInvTCurCode` (`TRCPTCurCode`),
	KEY `TPODTAPNCode` (`TRCPTARCCode`),
	KEY `TPODTAPNCode1` (`TRCPTARCCode2`),
	KEY `TPODTDepCode` (`TRCPTDepCode`),
	KEY `TPODTDivCode` (`TRCPTDivCode`),
	KEY `TPRDTBraCode` (`TRCPTBraCode`),
	KEY `TPWOSupplierName` (`TRCPCusAddress`),
	KEY `TPWOTCmpCode` (`TRCPCustomerName`),
	KEY `TQuoTAolCode` (`TRCPTAolCode`),
	KEY `TQuoTJobNo` (`TRCPTJobNo`),
	KEY `TQuoTPrjCode` (`TRCPTPrjCode`),
	KEY `TRCPTPstCode` (`TRCPTPstCode`),
	KEY `TSODTEmpCode` (`TRCPTEmpCode`),
	KEY `TSODTEmpCode1` (`TRCPTEmpCode2`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TReceivePduMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TReceivePduMB`;

# ---------- CREATE TABLE `VS4TReceivePduMB` ----------

CREATE TABLE `VS4TReceivePduMB` (
	`TRPMTRCPNo` VARCHAR(30) NOT NULL,
	`TRPMLn` INT NOT NULL DEFAULT '0',
	`TRPMType` SMALLINT NULL DEFAULT '0',
	`TRPMTPOSCode` VARCHAR(50) NULL,
	`TRPMPOSCode` VARCHAR(50) NULL,
	`TRPMFactoryCode` VARCHAR(50) NULL,
	`TRPMPOSName` VARCHAR(150) NULL,
	`TRPMMinimumOrder` DOUBLE NULL DEFAULT '0',
	`TRPMMaximumOrder` DOUBLE NULL DEFAULT '0',
	`TRPMCost` FLOAT NULL DEFAULT '0',
	`TRPMPrice` FLOAT NULL DEFAULT '0',
	`TRPMPerQuantity` DOUBLE NULL DEFAULT '1',
	`TRPMQuantity` DOUBLE NULL DEFAULT '0',
	`TRPMTUntCode` VARCHAR(50) NULL,
	`TRPMQuantity2` DOUBLE NULL DEFAULT '0',
	`TRPMTUntCode2` VARCHAR(50) NULL,
	`TRPMQuantity3` DOUBLE NULL DEFAULT '0',
	`TRPMTUntCode3` VARCHAR(50) NULL,
	`TRPMCostAmount` DOUBLE NULL DEFAULT '0',
	`TRPMAmount` DOUBLE NULL DEFAULT '0',
	`TRPMTaxType` SMALLINT NULL DEFAULT '0',
	`TRPMAmountVAT` FLOAT NULL DEFAULT '0',
	`TRPMAmountVATIN` FLOAT NULL DEFAULT '0',
	`TRPMAmountWTAX` FLOAT NULL DEFAULT '0',
	`TRPMAmountZTAX` FLOAT NULL DEFAULT '0',
	`TRPMAmountNOTAX` FLOAT NULL DEFAULT '0',
	`TRPMPromotionType` VARCHAR(15) NULL,
	`TRPMDiscountText` VARCHAR(30) NULL,
	`TRPMDiscountPC` DOUBLE NULL,
	`TRPMDiscountFix` FLOAT NULL,
	`TRPMDiscountTotal` FLOAT NULL,
	`TRPMNetAmount` FLOAT NULL DEFAULT '0',
	`TRPMGetNumber` DOUBLE NULL DEFAULT '0',
	`TRPMFreeCode` VARCHAR(30) NULL,
	`TRPMFreeNumber` DOUBLE NULL DEFAULT '0',
	`TRPMDescription` VARCHAR(150) NULL,
	`TRPMDescription2` VARCHAR(150) NULL,
	`TRPMDescription3` VARCHAR(150) NULL,
	`TRPMUseDate` DATETIME NULL,
	`TRPMSourceNo` VARCHAR(30) NULL,
	`TRPMSourceLn` INT NULL DEFAULT '0',
	`TRPMSourceDate` DATETIME NULL,
	`TRPMSourceCode1` VARCHAR(30) NULL,
	`TRPMSourceCode2` VARCHAR(30) NULL,
	`TRPMFlag1` SMALLINT NULL DEFAULT '0',
	`TRPMFlag2` SMALLINT NULL DEFAULT '0',
	`TRPMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRPMLn`, `TRPMTRCPNo`),
	KEY `TJbMSourceNo` (`TRPMSourceNo`),
	KEY `TPOBTPdtCode` (`TRPMTPOSCode`),
	KEY `TPWBID` (`TRPMLn`),
	KEY `TPWBPdtCode1` (`TRPMPOSCode`),
	KEY `TPWBTUntCode` (`TRPMTUntCode`),
	KEY `TPWBTUntCode1` (`TRPMTUntCode2`),
	KEY `TQuBFactoryCode` (`TRPMFactoryCode`),
	KEY `TQuBFreeCode` (`TRPMFreeCode`),
	KEY `TSOBSourceCode1` (`TRPMSourceCode2`),
	KEY `TSOBSourceNo` (`TRPMSourceCode1`),
	KEY `TSOBTUntCode` (`TRPMTUntCode3`),
	KEY `TTfMID` (`TRPMTRCPNo`),
	KEY `TTfrToTShfCode` (`TRPMType`),
	KEY `VS4TReceivePduVS4TReceivePduMB` (`TRPMTRCPNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TRental` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TRental`;

# ---------- CREATE TABLE `VS4TRental` ----------

CREATE TABLE `VS4TRental` (
	`TRenNo` VARCHAR(30) NOT NULL,
	`TRenTBokCode` VARCHAR(30) NULL,
	`TRenCode` VARCHAR(30) NULL,
	`TRenType` SMALLINT NULL DEFAULT '0',
	`TRenDate` DATETIME NULL,
	`TRenDueDate` DATETIME NULL,
	`TRenRefNo` VARCHAR(30) NULL,
	`TRenRefDate` DATETIME NULL,
	`TRenRefNo2` VARCHAR(30) NULL,
	`TRenRefDate2` DATETIME NULL,
	`TRenBODeposit` INT NULL DEFAULT '0',
	`TRenTAssCode` VARCHAR(30) NULL,
	`TRenTPOSCode` VARCHAR(30) NULL,
	`TRenTBraCode` VARCHAR(30) NULL,
	`TRenTPrjCode` VARCHAR(30) NULL,
	`TRenReserveForm` DATETIME NULL,
	`TRenReserveTo` DATETIME NULL,
	`TRenCheckInForm` DATETIME NULL,
	`TRenCheckInTo` DATETIME NULL,
	`TRenCheckOut` DATETIME NULL,
	`TRenActiveStatus` SMALLINT NULL DEFAULT '0',
	`TRenTEmpCode` VARCHAR(30) NULL,
	`TRenSaleName` VARCHAR(140) NULL,
	`TRenTEmpCode2` VARCHAR(30) NULL,
	`TRenSaleName2` VARCHAR(140) NULL,
	`TRenDeliveryDate` DATETIME NULL,
	`TRenDeliveryTo` VARCHAR(255) NULL,
	`TRenTARNCode` VARCHAR(30) NULL,
	`TRenTARCCode` VARCHAR(30) NULL,
	`TRenContactName` VARCHAR(160) NULL,
	`TRenTARCCode2` VARCHAR(30) NULL,
	`TRenContactName2` VARCHAR(160) NULL,
	`TRenCustomerName` VARCHAR(200) NULL,
	`TRenCusAddress` VARCHAR(255) NULL,
	`TRenCostTotal` FLOAT NULL DEFAULT '0',
	`TRenPriceChannel` SMALLINT NULL DEFAULT '0',
	`TRenChannelName` VARCHAR(30) NULL,
	`TRenSubTotal` FLOAT NULL,
	`TRenDiscountPC` DOUBLE NULL,
	`TRenDiscPCAmount` DOUBLE NULL,
	`TRenDiscountFix` FLOAT NULL,
	`TRenDiscountTotal` FLOAT NULL,
	`TRenTaxBase` FLOAT NULL DEFAULT '0',
	`TRenVATRate` DOUBLE NULL,
	`TRenVATTotal` FLOAT NULL,
	`TRenNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TRenZTAXTotal` FLOAT NULL DEFAULT '0',
	`TRenWTaxRate` DOUBLE NULL DEFAULT '0',
	`TRenWTaxTotal` FLOAT NULL DEFAULT '0',
	`TRenGrandTotalVAT` FLOAT NULL,
	`TRenGrandTotal` FLOAT NULL,
	`TRenNetPayment` FLOAT NULL,
	`TRenCommissionBase` FLOAT NULL DEFAULT '0',
	`TRenCommissionRate` DOUBLE NULL DEFAULT '0',
	`TRenCommission` FLOAT NULL DEFAULT '0',
	`TRenDepositVAT` SMALLINT NULL DEFAULT '0',
	`TRenDepositRate` FLOAT NULL DEFAULT '0',
	`TRenDeposit` FLOAT NULL DEFAULT '0',
	`TRenTonnage` FLOAT NULL DEFAULT '0',
	`TRenInsurance` FLOAT NULL DEFAULT '0',
	`TRenFreightFee` FLOAT NULL DEFAULT '0',
	`TRenOtherFee` FLOAT NULL DEFAULT '0',
	`TRenFirstPayment` FLOAT NULL,
	`TRenTCurCode` VARCHAR(5) NULL,
	`TRenExchangeRate` FLOAT NULL DEFAULT '0',
	`TRenAdjustTotal` FLOAT NULL DEFAULT '0',
	`TRenCountryOrigin` VARCHAR(50) NULL,
	`TRenCondition` VARCHAR(100) NULL,
	`TRenConditionDay` SMALLINT NULL DEFAULT '0',
	`TRenCondition1` DOUBLE NULL DEFAULT '0',
	`TRenConditionDay1` SMALLINT NULL DEFAULT '0',
	`TRenDecimalEX` SMALLINT NULL DEFAULT '0',
	`TRenDecimalUnit` SMALLINT NULL DEFAULT '0',
	`TRenDecimalCost` SMALLINT NULL DEFAULT '0',
	`TRenPaymentNote` VARCHAR(200) NULL,
	`TRenStatementNote` VARCHAR(200) NULL,
	`TRenDeliveryNote` VARCHAR(200) NULL,
	`TRenPackingNote` VARCHAR(200) NULL,
	`TRenDayAvailable` SMALLINT NULL,
	`TRenDescription` VARCHAR(255) NULL,
	`TRenIncoterms` VARCHAR(50) NULL,
	`TRenCustom1` VARCHAR(30) NULL,
	`TRenCustom2` VARCHAR(30) NULL,
	`TRenCustom3` VARCHAR(30) NULL,
	`TRenCustom4` VARCHAR(255) NULL,
	`TRenCustom5` VARCHAR(255) NULL,
	`TRenInvoiceStatus` SMALLINT NULL DEFAULT '0',
	`TRenReviseStatus` SMALLINT NULL,
	`TRenVerifyStatus` SMALLINT NULL,
	`TRenTSOTCode` VARCHAR(50) NULL,
	`TRenLinkStatus` SMALLINT NULL,
	`TRenDeliveryStatus` SMALLINT NULL,
	`TRenFinishDate` DATETIME NULL,
	`TRenTGLTNo` VARCHAR(30) NULL,
	`TRenCreateCode` VARCHAR(30) NULL,
	`TRenCreateBy` VARCHAR(140) NULL,
	`TRenCreateDate` DATETIME NULL,
	`TRenEditCode` VARCHAR(30) NULL,
	`TRenEditBy` VARCHAR(140) NULL,
	`TRenEditDate` DATETIME NULL,
	`TRenConfirmStatus` SMALLINT NULL,
	`TRenConfirmBy` VARCHAR(140) NULL,
	`TRenConfirmDate` DATETIME NULL,
	`TRenConfirmNote` VARCHAR(80) NULL,
	`TRenApproveStatus` SMALLINT NULL,
	`TRenApproveBy` VARCHAR(140) NULL,
	`TRenApproveDate` DATETIME NULL,
	`TRenApproveNote` VARCHAR(80) NULL,
	`TRenConfidential` SMALLINT NULL,
	`TRenCancelStatus` SMALLINT NULL,
	`TRenCancelNo` VARCHAR(30) NULL,
	`TRenCancelBy` VARCHAR(140) NULL,
	`TRenCancelDate` DATETIME NULL,
	`TRenCancelNote` VARCHAR(80) NULL,
	`TRenFlag1` SMALLINT NULL,
	`TRenFlag2` SMALLINT NULL,
	`TRenFlag3` SMALLINT NULL,
	PRIMARY KEY (`TRenNo`),
	KEY `TAPQTCmpCode` (`TRenTARNCode`),
	KEY `TInvTCurCode` (`TRenTCurCode`),
	KEY `TJobCode` (`TRenCode`),
	KEY `TPCNTJbMLn` (`TRenTPOSCode`),
	KEY `TPODTAPNCode` (`TRenTARCCode`),
	KEY `TPODTAPNCode1` (`TRenTARCCode2`),
	KEY `TPODTDepCode` (`TRenReserveTo`),
	KEY `TPRDTBokCode` (`TRenTBokCode`),
	KEY `TPRDTBraCode` (`TRenTBraCode`),
	KEY `TPWOSupplierName` (`TRenCusAddress`),
	KEY `TPWOTCmpCode` (`TRenCustomerName`),
	KEY `TQuoTJobNo` (`TRenTAssCode`),
	KEY `TQuoTPrjCode` (`TRenTPrjCode`),
	KEY `TSODTEmpCode` (`TRenTEmpCode`),
	KEY `TSODTEmpCode1` (`TRenTEmpCode2`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TReport` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TReport`;

# ---------- CREATE TABLE `VS4TReport` ----------

CREATE TABLE `VS4TReport` (
	`TRptAlias` VARCHAR(30) NOT NULL,
	`TRptCode` VARCHAR(30) NULL,
	`TRptISOCode` VARCHAR(30) NULL,
	`TRptName` VARCHAR(100) NULL,
	`TRptName2` VARCHAR(100) NULL,
	`TRptIsDefault` SMALLINT NULL DEFAULT '0',
	`TRptTCmdAlias` VARCHAR(30) NULL,
	`TRptTCmdName` VARCHAR(80) NULL,
	`TRptTCmGAlias` VARCHAR(30) NULL,
	`TRptTCmGName` VARCHAR(80) NULL,
	`TRptTCmGShell` VARCHAR(50) NULL,
	`TRptBaseTRptAlias` VARCHAR(30) NULL,
	`TRptSort` DOUBLE NULL DEFAULT '0',
	`TRptTLngID` INT NULL DEFAULT '1',
	`TRptTPpSID` INT NULL DEFAULT '9',
	`TRptTOrtID` INT NULL DEFAULT '1',
	`TRptParam1` VARCHAR(100) NULL,
	`TRptParamE1` VARCHAR(100) NULL,
	`TRptParam2` VARCHAR(100) NULL,
	`TRptParamE2` VARCHAR(100) NULL,
	`TRptTRpTID` INT NULL DEFAULT '0',
	`TRptTPpBID` INT NULL DEFAULT '7',
	`TRptFileName` VARCHAR(50) NULL,
	`TRptPrimary` VARCHAR(30) NULL,
	`TRptTQFmAlias` VARCHAR(30) NULL,
	`TRptManualFieldLst` VARCHAR(255) NULL,
	`TRptManualTable` VARCHAR(50) NULL,
	`TRptFlag1` SMALLINT NULL DEFAULT '0',
	`TRptFlag2` SMALLINT NULL DEFAULT '0',
	`TRptFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRptAlias`),
	KEY `ReportReportGroupID` (`TRptTCmdAlias`),
	KEY `TRptISOCode` (`TRptISOCode`),
	KEY `TRptTCmdAlias` (`TRptTCmGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TReportMap` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TReportMap`;

# ---------- CREATE TABLE `VS4TReportMap` ----------

CREATE TABLE `VS4TReportMap` (
	`TRMpID` INT NOT NULL DEFAULT '0',
	`TRMpTCmdAlias` VARCHAR(30) NULL,
	`TRMpSelectMode` SMALLINT NULL DEFAULT '0',
	`TRMpType` SMALLINT NULL DEFAULT '1',
	`TRMpTRptAlias` VARCHAR(50) NULL,
	`TRMpTURpCode` VARCHAR(50) NULL,
	`TRMpFlag1` SMALLINT NULL DEFAULT '0',
	`TRMpFlag2` SMALLINT NULL DEFAULT '0',
	`TRMpFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRMpID`),
	KEY `RpMID` (`TRMpID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TReviseEffect` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TReviseEffect`;

# ---------- CREATE TABLE `VS4TReviseEffect` ----------

CREATE TABLE `VS4TReviseEffect` (
	`TReETRevDocType` VARCHAR(10) NOT NULL,
	`TReETRevDocNo` VARCHAR(30) NOT NULL,
	`TReETRevNo` SMALLINT NOT NULL DEFAULT '0',
	`TReEDocNo` VARCHAR(30) NOT NULL,
	`TReEStatus` SMALLINT NULL DEFAULT '0',
	`TReENote` VARCHAR(255) NULL,
	`TReEFlag1` SMALLINT NULL DEFAULT '0',
	`TReEFlag2` SMALLINT NULL DEFAULT '0',
	`TReEFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TReETRevDocType`, `TReETRevDocNo`, `TReETRevNo`, `TReEDocNo`),
	UNIQUE KEY `VS4TRevisionVS4TReviseEffect` (`TReETRevDocType`, `TReETRevDocNo`, `TReETRevNo`),
	KEY `TRevDocNo` (`TReETRevNo`),
	KEY `TRevNo` (`TReETRevDocNo`),
	KEY `TRevTReGCode` (`TReEDocNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TRevision` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TRevision`;

# ---------- CREATE TABLE `VS4TRevision` ----------

CREATE TABLE `VS4TRevision` (
	`TRevDocType` VARCHAR(10) NOT NULL,
	`TRevDocNo` VARCHAR(30) NOT NULL,
	`TRevNo` SMALLINT NOT NULL DEFAULT '0',
	`TRevTReGCode` VARCHAR(30) NULL,
	`TRevNote` VARCHAR(255) NULL,
	`TRevFilename` VARCHAR(40) NULL,
	`TRevStatus` SMALLINT NULL DEFAULT '0',
	`TRevFlag1` SMALLINT NULL DEFAULT '0',
	`TRevFlag2` SMALLINT NULL DEFAULT '0',
	`TRevFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRevDocType`, `TRevDocNo`, `TRevNo`),
	KEY `TRevDocNo` (`TRevNo`),
	KEY `TRevNo` (`TRevDocNo`),
	KEY `TRevTReGCode` (`TRevTReGCode`),
	KEY `VS4TRevisionGroupVS4TRevision` (`TRevTReGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TRevisionGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TRevisionGroup`;

# ---------- CREATE TABLE `VS4TRevisionGroup` ----------

CREATE TABLE `VS4TRevisionGroup` (
	`TReGCode` VARCHAR(30) NOT NULL,
	`TReGName` VARCHAR(100) NULL,
	`TReGFlag1` SMALLINT NULL DEFAULT '0',
	`TReGFlag2` SMALLINT NULL DEFAULT '0',
	`TReGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TReGCode`),
	KEY `TBnkCode` (`TReGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TRoute` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TRoute`;

# ---------- CREATE TABLE `VS4TRoute` ----------

CREATE TABLE `VS4TRoute` (
	`TRouCode` VARCHAR(30) NOT NULL,
	`TRouName` VARCHAR(100) NULL,
	`TRouName2` VARCHAR(100) NULL,
	`TRouUsage` SMALLINT NULL DEFAULT '0',
	`TRouFlag1` SMALLINT NULL DEFAULT '0',
	`TRouFlag2` SMALLINT NULL DEFAULT '0',
	`TRouFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TRouCode`),
	KEY `TARECode` (`TRouCode`),
	KEY `TAreFlag1` (`TRouFlag2`),
	KEY `TAreFlag11` (`TRouFlag3`),
	KEY `TCouCode` (`TRouFlag1`),
	KEY `TRouFlag1` (`TRouUsage`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSaleArea` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSaleArea`;

# ---------- CREATE TABLE `VS4TSaleArea` ----------

CREATE TABLE `VS4TSaleArea` (
	`TSAeCode` VARCHAR(30) NOT NULL,
	`TSaeTSZnCode` VARCHAR(30) NULL,
	`TSAeName` VARCHAR(100) NULL,
	`TSAeName2` VARCHAR(100) NULL,
	`TSAeFlag1` SMALLINT NULL DEFAULT '0',
	`TSAeFlag2` SMALLINT NULL DEFAULT '0',
	`TSAeFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSAeCode`),
	KEY `TARECode` (`TSAeCode`),
	KEY `TAreFlag1` (`TSAeFlag2`),
	KEY `TAreFlag11` (`TSAeFlag3`),
	KEY `TCouCode` (`TSAeFlag1`),
	KEY `TSaeTSZnCode` (`TSaeTSZnCode`),
	KEY `VS4TSaleZoneVS4TSaleArea` (`TSaeTSZnCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSaleForecast` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSaleForecast`;

# ---------- CREATE TABLE `VS4TSaleForecast` ----------

CREATE TABLE `VS4TSaleForecast` (
	`TSFCTBraCode` VARCHAR(30) NOT NULL,
	`TSFCYear` INT NOT NULL DEFAULT '0',
	`TSFCMonth` INT NOT NULL DEFAULT '0',
	`TSFCTPdtCode` VARCHAR(30) NOT NULL,
	`TSFCTEmpCode` VARCHAR(30) NOT NULL,
	`TSFCPlanQty` DOUBLE NULL DEFAULT '0',
	`TSFCProduceQty` DOUBLE NULL DEFAULT '0',
	`TSFCArrearQty` DOUBLE NULL DEFAULT '0',
	`TSFCActualQty` DOUBLE NULL DEFAULT '0',
	`TSFCDifQty` DOUBLE NULL DEFAULT '0',
	`TSFCNewPrice` DOUBLE NULL DEFAULT '0',
	`TSFCPlanAmount` DOUBLE NULL DEFAULT '0',
	`TSFCActualAmount` DOUBLE NULL DEFAULT '0',
	`TSFCDifAmount` VARCHAR(50) NULL,
	`TSFCCreateCode` VARCHAR(30) NULL,
	`TSFCCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSFCEditCode` VARCHAR(30) NULL,
	`TSFCEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSFCFlag1` SMALLINT NULL DEFAULT '0',
	`TSFCFlag2` SMALLINT NULL DEFAULT '0',
	`TSFCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSFCTBraCode`, `TSFCYear`, `TSFCMonth`, `TSFCTPdtCode`, `TSFCTEmpCode`),
	KEY `TSFCTBRaCode` (`TSFCTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSaleForecastDL` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSaleForecastDL`;

# ---------- CREATE TABLE `VS4TSaleForecastDL` ----------

CREATE TABLE `VS4TSaleForecastDL` (
	`TSFDTSFCTBraCode` VARCHAR(30) NOT NULL,
	`TSFDTSFCYear` INT NOT NULL DEFAULT '0',
	`TSFDTSFCMonth` INT NOT NULL DEFAULT '0',
	`TSFDTSFCTPdtCode` VARCHAR(30) NOT NULL,
	`TSFDTSFCTEmpCode` VARCHAR(30) NOT NULL,
	`TSFDStep` INT NOT NULL DEFAULT '0',
	`TSFDLn` INT NOT NULL DEFAULT '0',
	`TSFDTSepCode` VARCHAR(30) NULL,
	`TSFDStepName` VARCHAR(50) NULL,
	`TSFDTEmpCode` VARCHAR(30) NULL,
	`TSFDEmployeeName` VARCHAR(150) NULL,
	`TSFDPositionName` VARCHAR(150) NULL,
	`TSFDStartTime` DOUBLE NULL DEFAULT '1',
	`TSFDEndTime` DOUBLE NULL DEFAULT '1',
	`TSFDQuantityCalc` DOUBLE NULL DEFAULT '1',
	`TSFDQuantity` DOUBLE NULL DEFAULT '1',
	`TSFDCost` DOUBLE NULL DEFAULT '1',
	`TSFDTotalCost` DOUBLE NULL DEFAULT '1',
	`TSFDRemark` VARCHAR(50) NULL,
	`TSFDFlag1` SMALLINT NULL DEFAULT '0',
	`TSFDFlag2` SMALLINT NULL DEFAULT '0',
	`TSFDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSFDTSFCTBraCode`, `TSFDTSFCYear`, `TSFDTSFCMonth`, `TSFDTSFCTPdtCode`, `TSFDTSFCTEmpCode`, `TSFDStep`, `TSFDLn`),
	KEY `TJMtStepName` (`TSFDStepName`),
	KEY `TJMtTFPSCode` (`TSFDTEmpCode`),
	KEY `TJMtTSepCode` (`TSFDTSepCode`),
	KEY `TMteStep` (`TSFDStep`),
	KEY `TSFMTSFCTBraCode` (`TSFDTSFCTBraCode`),
	KEY `TSFMTSFCTEmpCode` (`TSFDTSFCTEmpCode`),
	KEY `TSFMTSFCTPdtCode` (`TSFDTSFCTPdtCode`),
	KEY `VS4TSaleForecastVS4TSaleForecastDL` (`TSFDTSFCTBraCode`, `TSFDTSFCYear`, `TSFDTSFCMonth`, `TSFDTSFCTPdtCode`, `TSFDTSFCTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSaleForecastMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSaleForecastMB`;

# ---------- CREATE TABLE `VS4TSaleForecastMB` ----------

CREATE TABLE `VS4TSaleForecastMB` (
	`TSFBTSFCTBraCode` VARCHAR(30) NOT NULL,
	`TSFBTSFCYear` INT NOT NULL DEFAULT '0',
	`TSFBTSFCMonth` INT NOT NULL DEFAULT '0',
	`TSFBTSFCTPdtCode` VARCHAR(30) NOT NULL,
	`TSFBTSFCTEmpCode` VARCHAR(30) NOT NULL,
	`TSFBLn` INT NOT NULL DEFAULT '0',
	`TSFBTSepCode` VARCHAR(30) NULL,
	`TSFBProcessName` VARCHAR(50) NULL,
	`TSFBTSpdId` INT NULL DEFAULT '0',
	`TSFBMan` DOUBLE NULL DEFAULT '0',
	`TSFBMachine` DOUBLE NULL DEFAULT '0',
	`TSFBCapacity` DOUBLE NULL DEFAULT '0',
	`TSFBHourPerDay` DOUBLE NULL DEFAULT '0',
	`TSFBCapacityHour` SMALLINT NULL DEFAULT '0',
	`TSFBCapPerHour` DOUBLE NULL DEFAULT '0',
	`TSFBCapPerDay` DOUBLE NULL DEFAULT '0',
	`TSFBEstimateDay` DOUBLE NULL DEFAULT '0',
	`TSFBTime` DOUBLE NULL DEFAULT '0',
	`TSFBProductBy` SMALLINT NULL DEFAULT '0',
	`TSFBTSecCode` VARCHAR(30) NULL,
	`TSFBTAgtCode` VARCHAR(30) NULL,
	`TSFBEngine` VARCHAR(30) NULL,
	`TSFBDescription` VARCHAR(150) NULL,
	`TSFBFlag1` SMALLINT NULL DEFAULT '0',
	`TSFBFlag2` SMALLINT NULL DEFAULT '0',
	`TSFBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSFBTSFCTBraCode`, `TSFBTSFCYear`, `TSFBTSFCMonth`, `TSFBTSFCTPdtCode`, `TSFBTSFCTEmpCode`, `TSFBLn`),
	KEY `TJPMTAgtCode` (`TSFBEngine`),
	KEY `TJPMTSpdId` (`TSFBTSpdId`),
	KEY `TMtxTAgtCode` (`TSFBTAgtCode`),
	KEY `TMtxTSepCode` (`TSFBTSepCode`),
	KEY `TSFBTSFCTPdtCode` (`TSFBTSFCTEmpCode`),
	KEY `TSFDTSFCTBraCode` (`TSFBTSFCTBraCode`),
	KEY `TSFDTSFCTPdtCode` (`TSFBTSFCTPdtCode`),
	KEY `VS4TSaleForecastVS4TSaleForecastMB` (`TSFBTSFCTBraCode`, `TSFBTSFCYear`, `TSFBTSFCMonth`, `TSFBTSFCTPdtCode`, `TSFBTSFCTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSaleForecastMT` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSaleForecastMT`;

# ---------- CREATE TABLE `VS4TSaleForecastMT` ----------

CREATE TABLE `VS4TSaleForecastMT` (
	`TSFMTSFCTBraCode` VARCHAR(30) NOT NULL,
	`TSFMTSFCYear` INT NOT NULL DEFAULT '0',
	`TSFMTSFCMonth` INT NOT NULL DEFAULT '0',
	`TSFMTSFCTPdtCode` VARCHAR(30) NOT NULL,
	`TSFMTSFCTEmpCode` VARCHAR(30) NOT NULL,
	`TSFMTSpdStep` INT NOT NULL DEFAULT '0',
	`TSFMLn` INT NOT NULL DEFAULT '0',
	`TSFMTSepCode` VARCHAR(30) NULL,
	`TSFMType` SMALLINT NULL DEFAULT '0',
	`TSFMProductCode` VARCHAR(30) NULL,
	`TSFMProductName` VARCHAR(50) NULL,
	`TSFMDescription1` VARCHAR(30) NULL,
	`TSFMDescription2` VARCHAR(30) NULL,
	`TSFMDescription3` VARCHAR(30) NULL,
	`TSFMDescription4` VARCHAR(30) NULL,
	`TSFMDescription5` VARCHAR(30) NULL,
	`TSFMQuantity` DOUBLE NULL DEFAULT '1',
	`TSFMUseStock` DOUBLE NULL DEFAULT '1',
	`TSFMUseOrder` DOUBLE NULL DEFAULT '1',
	`TSFMTotalUsed` DOUBLE NULL DEFAULT '1',
	`TSFMTotalDif` DOUBLE NULL DEFAULT '1',
	`TSFMUnitCode` VARCHAR(15) NULL,
	`TSFMQuantity2` DOUBLE NULL DEFAULT '1',
	`TSFMUseStock2` DOUBLE NULL DEFAULT '1',
	`TSFMUseOrder2` DOUBLE NULL DEFAULT '1',
	`TSFMTotalUsed2` DOUBLE NULL DEFAULT '1',
	`TSFMTotalDif2` DOUBLE NULL DEFAULT '1',
	`TSFMUnitCode2` VARCHAR(15) NULL,
	`TSFMQuantity3` DOUBLE NULL DEFAULT '1',
	`TSFMUseStock3` DOUBLE NULL DEFAULT '1',
	`TSFMUseOrder3` DOUBLE NULL DEFAULT '1',
	`TSFMTotalUsed3` DOUBLE NULL DEFAULT '1',
	`TSFMTotalDif3` DOUBLE NULL DEFAULT '1',
	`TSFMUnitCode3` VARCHAR(15) NULL,
	`TSFMDrawType` SMALLINT NULL DEFAULT '0',
	`TSFMDrawWhen` DOUBLE NULL DEFAULT '0',
	`TSFMDrawTo` DOUBLE NULL DEFAULT '0',
	`TSFMRemark` VARCHAR(50) NULL,
	`TSFMFlag1` SMALLINT NULL DEFAULT '0',
	`TSFMFlag2` SMALLINT NULL DEFAULT '0',
	`TSFMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSFMTSFCTBraCode`, `TSFMTSFCYear`, `TSFMTSFCMonth`, `TSFMTSFCTPdtCode`, `TSFMTSFCTEmpCode`, `TSFMTSpdStep`, `TSFMLn`),
	KEY `TJbMTJobNo` (`TSFMTSFCTPdtCode`),
	KEY `TJMtTSepCode` (`TSFMTSepCode`),
	KEY `TPMtProcessNo` (`TSFMTSpdStep`),
	KEY `TPmTUnitCode` (`TSFMUnitCode`),
	KEY `TPmTUnitCode1` (`TSFMUnitCode2`),
	KEY `TPmTUnitCode2` (`TSFMUnitCode3`),
	KEY `TPoMTPdtCode` (`TSFMProductCode`),
	KEY `TSFMTBraCode` (`TSFMTSFCTBraCode`),
	KEY `TSFMTSFCTPdtCode` (`TSFMTSFCTEmpCode`),
	KEY `VS4TSaleForecastVS4TSaleForecastMT` (`TSFMTSFCTBraCode`, `TSFMTSFCYear`, `TSFMTSFCMonth`, `TSFMTSFCTPdtCode`, `TSFMTSFCTEmpCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSaleTarget` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSaleTarget`;

# ---------- CREATE TABLE `VS4TSaleTarget` ----------

CREATE TABLE `VS4TSaleTarget` (
	`TSTGNo` VARCHAR(30) NOT NULL,
	`TSTGDate` DATETIME NULL,
	`TSTGRefNo` VARCHAR(30) NULL,
	`TSTGTBraCode` VARCHAR(30) NULL,
	`TSTGTDivCode` VARCHAR(50) NULL,
	`TSTGTDepCode` VARCHAR(30) NULL,
	`TSTGTSecCode` VARCHAR(30) NULL,
	`TSTGDescription` VARCHAR(150) NULL,
	`TSTGCreateCode` VARCHAR(30) NULL,
	`TSTGCreateBy` VARCHAR(140) NULL,
	`TSTGCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSTGEditCode` VARCHAR(30) NULL,
	`TSTGEditBy` VARCHAR(140) NULL,
	`TSTGEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSTGConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TSTGConfirmBy` VARCHAR(140) NULL,
	`TSTGConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSTGApproveStatus` SMALLINT NULL DEFAULT '0',
	`TSTGApproveBy` VARCHAR(140) NULL,
	`TSTGApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSTGApproveNote` VARCHAR(80) NULL,
	`TSTGRevision` SMALLINT NULL DEFAULT '0',
	`TSTGCancelStatus` SMALLINT NULL DEFAULT '0',
	`TSTGCancelNo` VARCHAR(30) NULL,
	`TSTGCancelBy` VARCHAR(140) NULL,
	`TSTGCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSTGCancelNote` VARCHAR(80) NULL,
	`TSTGFlag1` SMALLINT NULL DEFAULT '0',
	`TSTGFlag2` SMALLINT NULL DEFAULT '0',
	`TSTGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSTGNo`),
	KEY `TDepCode` (`TSTGNo`),
	KEY `TEpaTBraCode` (`TSTGTBraCode`),
	KEY `TEpaTDivCode` (`TSTGTDivCode`),
	KEY `TEpaTDivCode1` (`TSTGTDepCode`),
	KEY `TEpaTDivCode2` (`TSTGTSecCode`),
	KEY `VS4TBranchVS4TSaleTarget` (`TSTGTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSaleTargetMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSaleTargetMB`;

# ---------- CREATE TABLE `VS4TSaleTargetMB` ----------

CREATE TABLE `VS4TSaleTargetMB` (
	`TSGMTSTGNo` VARCHAR(30) NOT NULL,
	`TSGMLn` INT NOT NULL DEFAULT '0',
	`TSGMTEmpCode` VARCHAR(30) NULL,
	`TSGMType` SMALLINT NULL DEFAULT '0',
	`TSGMTPDLCode` VARCHAR(30) NULL,
	`TSGMTPSECode` VARCHAR(30) NULL,
	`TSGMTPS2Code` VARCHAR(30) NULL,
	`TSGMTPS3Code` VARCHAR(30) NULL,
	`TSGMTPS4Code` VARCHAR(30) NULL,
	`TSGMTPdtCode` VARCHAR(30) NULL,
	`TSGMYear` INT NULL DEFAULT '0',
	`TSGMMonth` INT NULL DEFAULT '0',
	`TSGMTargetQty` FLOAT NULL DEFAULT '0',
	`TSGMActualQty` FLOAT NULL DEFAULT '0',
	`TSGMDifQty` FLOAT NULL DEFAULT '0',
	`TSGMTarget` FLOAT NULL DEFAULT '0',
	`TSGMActual` FLOAT NULL DEFAULT '0',
	`TSGMDif` FLOAT NULL DEFAULT '0',
	`TSGMDescription` VARCHAR(150) NULL,
	`TSGMFlag1` SMALLINT NULL DEFAULT '0',
	`TSGMFlag2` SMALLINT NULL DEFAULT '0',
	`TSGMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSGMLn`, `TSGMTSTGNo`),
	KEY `VS4TSaleTargetVS4TSaleTargetMB` (`TSGMTSTGNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSaleZone` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSaleZone`;

# ---------- CREATE TABLE `VS4TSaleZone` ----------

CREATE TABLE `VS4TSaleZone` (
	`TSZnCode` VARCHAR(30) NOT NULL,
	`TSZnTSZGCode` VARCHAR(30) NULL,
	`TSZnName` VARCHAR(100) NULL,
	`TSZnName2` VARCHAR(100) NULL,
	`TSZnFlag1` SMALLINT NULL DEFAULT '0',
	`TSZnFlag2` SMALLINT NULL DEFAULT '0',
	`TSZnFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSZnCode`),
	KEY `TARECode` (`TSZnCode`),
	KEY `TAreFlag1` (`TSZnFlag2`),
	KEY `TAreFlag11` (`TSZnFlag3`),
	KEY `TCouCode` (`TSZnFlag1`),
	KEY `TSaeTSZnCode` (`TSZnTSZGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSaleZoneGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSaleZoneGroup`;

# ---------- CREATE TABLE `VS4TSaleZoneGroup` ----------

CREATE TABLE `VS4TSaleZoneGroup` (
	`TSZGCode` VARCHAR(30) NOT NULL,
	`TSZGName` VARCHAR(100) NULL,
	`TSZGName2` VARCHAR(100) NULL,
	`TSZGFlag1` SMALLINT NULL DEFAULT '0',
	`TSZGFlag2` SMALLINT NULL DEFAULT '0',
	`TSZGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSZGCode`),
	KEY `TARECode` (`TSZGCode`),
	KEY `TAreFlag1` (`TSZGFlag2`),
	KEY `TAreFlag11` (`TSZGFlag3`),
	KEY `TCouCode` (`TSZGFlag1`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSAR` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSAR`;

# ---------- CREATE TABLE `VS4TSAR` ----------

CREATE TABLE `VS4TSAR` (
	`TSARNo` VARCHAR(30) NOT NULL,
	`TSARDate` DATETIME NULL,
	`TSARRefNo` VARCHAR(30) NULL,
	`TSARTBraCode` VARCHAR(30) NULL,
	`TSARTDivCode` VARCHAR(30) NULL,
	`TSARTDepCode` VARCHAR(30) NULL,
	`TSARTSecCode` VARCHAR(30) NULL,
	`TSARTEmpCode` VARCHAR(30) NULL,
	`TSARTSRPNo` VARCHAR(30) NULL,
	`TSAREmailStatus` SMALLINT NULL DEFAULT '0',
	`TSAREmailStatus2` SMALLINT NULL DEFAULT '0',
	`TSARDescription` VARCHAR(150) NULL,
	`TSARCreateCode` VARCHAR(30) NULL,
	`TSARCreateBy` VARCHAR(140) NULL,
	`TSARCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSAREditCode` VARCHAR(30) NULL,
	`TSAREditBy` VARCHAR(140) NULL,
	`TSAREditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSARConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TSARConfirmBy` VARCHAR(140) NULL,
	`TSARConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSARApproveStatus` SMALLINT NULL DEFAULT '0',
	`TSARApproveBy` VARCHAR(140) NULL,
	`TSARApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSARApproveNote` VARCHAR(80) NULL,
	`TSARRevision` SMALLINT NULL DEFAULT '0',
	`TSARCancelStatus` SMALLINT NULL DEFAULT '0',
	`TSARCancelNo` VARCHAR(30) NULL,
	`TSARCancelBy` VARCHAR(140) NULL,
	`TSARCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSARCancelNote` VARCHAR(80) NULL,
	`TSARFlag1` SMALLINT NULL DEFAULT '0',
	`TSARFlag2` SMALLINT NULL DEFAULT '0',
	`TSARFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSARNo`),
	KEY `TEpsNo` (`TSARNo`),
	KEY `VS4TBranchVS4TSAR` (`TSARTBraCode`),
	KEY `VS4TSARPatternVS4TSAR` (`TSARTSRPNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSARMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSARMB`;

# ---------- CREATE TABLE `VS4TSARMB` ----------

CREATE TABLE `VS4TSARMB` (
	`TSRBTSARNo` VARCHAR(30) NOT NULL,
	`TSRBLn` INT NOT NULL DEFAULT '0',
	`TSRBTSRMTSRGTSRPNo` VARCHAR(30) NULL,
	`TSRB2TSRMTSRGLn` INT NULL DEFAULT '0',
	`TSRBTSRMLn` INT NULL DEFAULT '0',
	`TSRBDescription` VARCHAR(100) NULL,
	`TSRBCustomValue1` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue2` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue3` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue4` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue5` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue6` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue7` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue8` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue9` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue10` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue11` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue12` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue13` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue14` DOUBLE NULL DEFAULT '0',
	`TSRBCustomValue15` DOUBLE NULL DEFAULT '0',
	`TSRBFlag1` SMALLINT NULL DEFAULT '0',
	`TSRBFlag2` SMALLINT NULL DEFAULT '0',
	`TSRBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSRBTSARNo`, `TSRBLn`),
	KEY `TSaTTAMTAlias` (`TSRB2TSRMTSRGLn`),
	KEY `TSmbMoneyCode` (`TSRBTSRMLn`),
	KEY `TSmbTAmyCode` (`TSRBTSRMTSRGTSRPNo`),
	KEY `VS4TSARPatternMBVS4TSARMB` (`TSRBTSRMTSRGTSRPNo`, `TSRB2TSRMTSRGLn`, `TSRBTSRMLn`),
	KEY `VS4TSARVS4TSARMB` (`TSRBTSARNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSARPatGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSARPatGroup`;

# ---------- CREATE TABLE `VS4TSARPatGroup` ----------

CREATE TABLE `VS4TSARPatGroup` (
	`TSRGTSRPNo` VARCHAR(30) NOT NULL,
	`TSRGLn` INT NOT NULL DEFAULT '0',
	`TSRGFlag1` SMALLINT NULL DEFAULT '0',
	`TSRGFlag2` SMALLINT NULL DEFAULT '0',
	`TSRGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSRGTSRPNo`, `TSRGLn`),
	KEY `TSmbCheckGroup` (`TSRGLn`),
	KEY `VS4TSARPatternVS4TSARPatGroup` (`TSRGTSRPNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSARPattern` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSARPattern`;

# ---------- CREATE TABLE `VS4TSARPattern` ----------

CREATE TABLE `VS4TSARPattern` (
	`TSRPNo` VARCHAR(30) NOT NULL,
	`TSRPTBraCode` VARCHAR(30) NULL,
	`TSRPDate` DATETIME NULL,
	`TSRPRefNo` VARCHAR(30) NULL,
	`TSRPDescription` VARCHAR(150) NULL,
	`TSRPCreateCode` VARCHAR(30) NULL,
	`TSRPCreateBy` VARCHAR(140) NULL,
	`TSRPCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSRPEditCode` VARCHAR(30) NULL,
	`TSRPEditBy` VARCHAR(140) NULL,
	`TSRPEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSRPConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TSRPConfirmBy` VARCHAR(140) NULL,
	`TSRPConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSRPConfirmNote` VARCHAR(80) NULL,
	`TSRPApproveStatus` SMALLINT NULL DEFAULT '0',
	`TSRPApproveBy` VARCHAR(140) NULL,
	`TSRPApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSRPApproveNote` VARCHAR(80) NULL,
	`TSRPConfidential` SMALLINT NULL DEFAULT '0',
	`TSRPCancelStatus` SMALLINT NULL DEFAULT '0',
	`TSRPCancelNo` VARCHAR(30) NULL,
	`TSRPCancelBy` VARCHAR(140) NULL,
	`TSRPCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSRPCancelNote` VARCHAR(80) NULL,
	`TSRPFlag1` SMALLINT NULL DEFAULT '0',
	`TSRPFlag2` SMALLINT NULL DEFAULT '0',
	`TSRPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSRPNo`),
	KEY `TEpsNo` (`TSRPNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSARPatternMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSARPatternMB`;

# ---------- CREATE TABLE `VS4TSARPatternMB` ----------

CREATE TABLE `VS4TSARPatternMB` (
	`TSRMTSRGTSRPNo` VARCHAR(30) NOT NULL,
	`TSRMTSRGLn` INT NOT NULL DEFAULT '0',
	`TSRMLn` INT NOT NULL DEFAULT '0',
	`TSRMCode` VARCHAR(30) NULL,
	`TSRMName` VARCHAR(255) NULL,
	`TSRMName2` VARCHAR(255) NULL,
	`TSRMCustomCount` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType1` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType2` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType3` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType4` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType5` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType6` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType7` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType8` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType9` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType10` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType11` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType12` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType13` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType14` SMALLINT NULL DEFAULT '0',
	`TSRMCustomType15` SMALLINT NULL DEFAULT '0',
	`TSRMFlag1` SMALLINT NULL DEFAULT '0',
	`TSRMFlag2` SMALLINT NULL DEFAULT '0',
	`TSRMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSRMTSRGTSRPNo`, `TSRMTSRGLn`, `TSRMLn`),
	KEY `TSmbCheckGroup` (`TSRMTSRGLn`),
	KEY `TSmbMoneyCode` (`TSRMCode`),
	KEY `VS4TSARPatGroupVS4TSARPatternMB` (`TSRMTSRGTSRPNo`, `TSRMTSRGLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TScrap` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TScrap`;

# ---------- CREATE TABLE `VS4TScrap` ----------

CREATE TABLE `VS4TScrap` (
	`TLotCode` VARCHAR(30) NOT NULL,
	`TLotName` VARCHAR(150) NULL,
	`TLotName2` VARCHAR(150) NULL,
	`TLotTPDLCode` VARCHAR(30) NULL,
	`TLotTSecCode` VARCHAR(50) NULL,
	`TLotTDepCode` VARCHAR(30) NULL,
	`TLotTDivCode` VARCHAR(30) NULL,
	`TLotTBraCode` VARCHAR(30) NULL,
	`TLotFixAdd` DOUBLE NULL DEFAULT '0',
	`TLotFixCustom` DOUBLE NULL DEFAULT '0',
	`TLotTAmyCode` VARCHAR(30) NULL,
	`TLotStartCharge` DOUBLE NULL DEFAULT '0',
	`TLotChargeAll` SMALLINT NULL DEFAULT '0',
	`TLotCharge` VARCHAR(30) NULL,
	`TLotFlag1` SMALLINT NULL DEFAULT '0',
	`TLotFlag2` SMALLINT NULL DEFAULT '0',
	`TLotFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TLotCode`),
	KEY `TAssTBraCode` (`TLotTBraCode`),
	KEY `TAssTDepCode` (`TLotTDepCode`),
	KEY `TAssTDivCode` (`TLotTDivCode`),
	KEY `TLotCode` (`TLotCode`),
	KEY `TLotTAmyCode` (`TLotTAmyCode`),
	KEY `TLotTPDLCode` (`TLotTPDLCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSection` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSection`;

# ---------- CREATE TABLE `VS4TSection` ----------

CREATE TABLE `VS4TSection` (
	`TSecCode` VARCHAR(30) NOT NULL,
	`TSecName` VARCHAR(50) NULL,
	`TSecName2` VARCHAR(50) NULL,
	`TSecDocCode` VARCHAR(30) NULL,
	`TSecTDepCode` VARCHAR(30) NULL,
	`TSecWatt` DOUBLE NULL DEFAULT '0',
	`TSecHOffice` DOUBLE NULL,
	`TSecHWithOT1` DOUBLE NULL,
	`TSecHWithOT2` DOUBLE NULL,
	`TSecH2Shift` DOUBLE NULL,
	`TSecHFullDay` DOUBLE NULL,
	`TSecColor` INT NULL,
	`TSecFlag1` SMALLINT NULL DEFAULT '0',
	`TSecFlag2` SMALLINT NULL DEFAULT '0',
	`TSecFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSecCode`),
	KEY `TBraDocCode` (`TSecDocCode`),
	KEY `TDepCode` (`TSecCode`),
	KEY `TDivTBraCode` (`TSecTDepCode`),
	KEY `VS4TDepartmentVS4TSection` (`TSecTDepCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TShipInstruct` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TShipInstruct`;

# ---------- CREATE TABLE `VS4TShipInstruct` ----------

CREATE TABLE `VS4TShipInstruct` (
	`TSPINo` VARCHAR(30) NOT NULL,
	`TSPIDate` DATETIME NULL,
	`TSPIDateTime` DATETIME NULL,
	`TSPIRefNo` VARCHAR(30) NULL,
	`TSPIRefDate` DATETIME NULL,
	`TSPIRefNo2` VARCHAR(30) NULL,
	`TSPITPrjCode` VARCHAR(30) NULL,
	`TSPITBraCode` VARCHAR(30) NULL,
	`TSPITARNCode` VARCHAR(30) NULL,
	`TSPIConsignee` VARCHAR(255) NULL,
	`TSPINotifyParty` VARCHAR(255) NULL,
	`TSPIAttention` VARCHAR(255) NULL,
	`TSPIShippingName` VARCHAR(255) NULL,
	`TSPISender` VARCHAR(255) NULL,
	`TSPIShipBy` VARCHAR(30) NULL,
	`TSPIBookingNo` VARCHAR(30) NULL,
	`TSPIDeliveryTerm` DOUBLE NULL,
	`TSPIContainerNo` VARCHAR(30) NULL,
	`TSPIContainerType` VARCHAR(255) NULL,
	`TSPIOrigin` VARCHAR(100) NULL,
	`TSPIDestination` VARCHAR(100) NULL,
	`TSPIIsLCL` SMALLINT NULL,
	`TSPIConGetDate` DATETIME NULL,
	`TSPIConReturnDate` DATETIME NULL,
	`TSPILoadingType` SMALLINT NULL,
	`TSPILoadingPort` VARCHAR(100) NULL,
	`TSPITShpCode` VARCHAR(30) NULL,
	`TSPIDeliveryCond` SMALLINT NULL,
	`TSPITranship` VARCHAR(30) NULL,
	`TSPIDischarge` VARCHAR(30) NULL,
	`TSPIFeeder` VARCHAR(30) NULL,
	`TSPIVessel` VARCHAR(255) NULL,
	`TSPIFlightNo` VARCHAR(30) NULL,
	`TSPIETDDate` DATETIME NULL,
	`TSPIETADate` DATETIME NULL,
	`TSPIFreightType` SMALLINT NULL,
	`TSPIShippingMark` VARCHAR(255) NULL,
	`TSPITotalQuantity` DOUBLE NULL,
	`TSPITotalCarton` DOUBLE NULL,
	`TSPIIncoTerms` VARCHAR(100) NULL,
	`TSPITotalNW` DOUBLE NULL,
	`TSPITotalGW` DOUBLE NULL,
	`TSPITotalVolumeM` DOUBLE NULL,
	`TSPITotalVolumeN` VARCHAR(255) NULL,
	`TSPIGrandTotal` FLOAT NULL,
	`TSPIGrandTotalReal` FLOAT NULL,
	`TSPIDescription` VARCHAR(255) NULL,
	`TSPICreateCode` VARCHAR(30) NULL,
	`TSPICreateBy` VARCHAR(140) NULL,
	`TSPICreateDate` DATETIME NULL,
	`TSPIEditCode` VARCHAR(30) NULL,
	`TSPIEditBy` VARCHAR(140) NULL,
	`TSPIEditDate` DATETIME NULL,
	`TSPIConfirmStatus` SMALLINT NULL,
	`TSPIConfirmBy` VARCHAR(140) NULL,
	`TSPIConfirmDate` DATETIME NULL,
	`TSPIApproveStatus` SMALLINT NULL,
	`TSPIApproveBy` VARCHAR(140) NULL,
	`TSPIApproveDate` DATETIME NULL,
	`TSPIApproveNote` VARCHAR(80) NULL,
	`TSPIRevision` SMALLINT NULL,
	`TSPICancelStatus` SMALLINT NULL,
	`TSPICancelNo` VARCHAR(30) NULL,
	`TSPICancelBy` VARCHAR(140) NULL,
	`TSPICancelDate` DATETIME NULL,
	`TSPICancelNote` VARCHAR(80) NULL,
	`TSPIFlag1` SMALLINT NULL,
	`TSPIFlag2` SMALLINT NULL,
	`TSPIFlag3` SMALLINT NULL,
	PRIMARY KEY (`TSPINo`),
	KEY `TAPQTCmpCode` (`TSPITARNCode`),
	KEY `TIvoTPrjCode` (`TSPITPrjCode`),
	KEY `TPKLTARNCode` (`TSPITShpCode`),
	KEY `TPRDTBraCode` (`TSPITBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TShipping` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TShipping`;

# ---------- CREATE TABLE `VS4TShipping` ----------

CREATE TABLE `VS4TShipping` (
	`TSHPCode` VARCHAR(30) NOT NULL,
	`TSHPName` VARCHAR(200) NULL,
	`TSHPName2` VARCHAR(200) NULL,
	`TSHPL20CostFee` FLOAT NULL DEFAULT '0',
	`TSHPL20CostRate` FLOAT NULL DEFAULT '0',
	`TSHPL20UPCostFee` FLOAT NULL DEFAULT '0',
	`TSHPL20UPCostRate` FLOAT NULL DEFAULT '0',
	`TSHP20CostFee` FLOAT NULL DEFAULT '0',
	`TSHP20CostRate` FLOAT NULL DEFAULT '0',
	`TSHP20UPCostFee` FLOAT NULL DEFAULT '0',
	`TSHP20UPCostRate` FLOAT NULL DEFAULT '0',
	`TSHP40CostFee` FLOAT NULL DEFAULT '0',
	`TSHP40CostRate` FLOAT NULL DEFAULT '0',
	`TSHP40UPCostFee` FLOAT NULL DEFAULT '0',
	`TSHP40UPCostRate` FLOAT NULL DEFAULT '0',
	`TSHPM40CostFee` FLOAT NULL DEFAULT '0',
	`TSHPM40CostRate` FLOAT NULL DEFAULT '0',
	`TSHPM40UPCostFee` FLOAT NULL DEFAULT '0',
	`TSHPM40UPCostRate` FLOAT NULL DEFAULT '0',
	`TSHPFlag1` SMALLINT NULL DEFAULT '0',
	`TSHPFlag2` SMALLINT NULL DEFAULT '0',
	`TSHPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSHPCode`),
	KEY `TSHPCode` (`TSHPCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSituation` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSituation`;

# ---------- CREATE TABLE `VS4TSituation` ----------

CREATE TABLE `VS4TSituation` (
	`TSitCode` VARCHAR(30) NOT NULL,
	`TSitName` VARCHAR(200) NULL,
	`TSitName2` VARCHAR(200) NULL,
	`TSitEffect` SMALLINT NULL DEFAULT '0',
	`TSitFlag1` SMALLINT NULL DEFAULT '0',
	`TSitFlag2` SMALLINT NULL DEFAULT '0',
	`TSitFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSitCode`),
	KEY `TCmTCode` (`TSitCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSO` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSO`;

# ---------- CREATE TABLE `VS4TSO` ----------

CREATE TABLE `VS4TSO` (
	`TSODNo` VARCHAR(30) NOT NULL,
	`TSODTSBkCode` VARCHAR(30) NULL,
	`TSODTRCACode` VARCHAR(30) NULL,
	`TSODMode` SMALLINT NULL DEFAULT '0',
	`TSODCode` VARCHAR(30) NULL,
	`TSODType` SMALLINT NULL DEFAULT '0',
	`TSODDate` DATETIME NULL,
	`TSODTime` DATETIME NULL,
	`TSODLoadingDate` DATETIME NULL,
	`TSODStartAgingDate` DATETIME NULL,
	`TSODDueDate` DATETIME NULL,
	`TSODRefNo` VARCHAR(30) NULL,
	`TSODRefDate` DATETIME NULL,
	`TSODBODeposit` INT NULL DEFAULT '0',
	`TSODTPrjCode` VARCHAR(30) NULL,
	`TSODTBraCode` VARCHAR(30) NULL,
	`TSODTEmpCode` VARCHAR(30) NULL,
	`TSODSaleName` VARCHAR(140) NULL,
	`TSODGuideText` VARCHAR(100) NULL,
	`TSODEmpText` VARCHAR(100) NULL,
	`TSODDeliveryDate` DATETIME NULL,
	`TSODDeliveryTime` DATETIME NULL,
	`TSODDeliveryTo` VARCHAR(255) NULL,
	`TSODTOTNLn` INT NULL,
	`TSODTARNCode` VARCHAR(30) NULL,
	`TSODTARDCode` VARCHAR(30) NULL,
	`TSODContactNote` VARCHAR(50) NULL,
	`TSODContactName` VARCHAR(160) NULL,
	`TSODCustomerName` VARCHAR(200) NULL,
	`TSODCusAddress` VARCHAR(255) NULL,
	`TSODConsignee` VARCHAR(255) NULL,
	`TSODNotifyParty` VARCHAR(255) NULL,
	`TSODCostTotal` FLOAT NULL DEFAULT '0',
	`TSODPMCostTotal` FLOAT NULL DEFAULT '0',
	`TSODPriceChannel` SMALLINT NULL DEFAULT '0',
	`TSODChannelName` VARCHAR(30) NULL,
	`TSODDiscountList` FLOAT NULL,
	`TSODSubTotal` FLOAT NULL,
	`TSODDiscountText` VARCHAR(30) NULL,
	`TSODDiscountTotal` FLOAT NULL,
	`TSODNetTotal` FLOAT NULL DEFAULT '0',
	`TSODDepositText` VARCHAR(30) NULL,
	`TSODDeposit` FLOAT NULL DEFAULT '0',
	`TSODTotal` FLOAT NULL,
	`TSODTotalFOB` FLOAT NULL,
	`TSODTCurCode` VARCHAR(5) NULL,
	`TSODExchangeRate` FLOAT NULL DEFAULT '0',
	`TSODTotalInRate` FLOAT NULL,
	`TSODVATType` SMALLINT NULL DEFAULT '0',
	`TSODVATRate` DOUBLE NULL,
	`TSODTaxBase` FLOAT NULL DEFAULT '0',
	`TSODVATTotal` FLOAT NULL,
	`TSODGrandTotal` FLOAT NULL,
	`TSODNOTAXTotal` FLOAT NULL DEFAULT '0',
	`TSODWTAXBase` FLOAT NULL DEFAULT '0',
	`TSODWTaxRate` DOUBLE NULL DEFAULT '0',
	`TSODWTaxTotal` FLOAT NULL DEFAULT '0',
	`TSODNetPayment` FLOAT NULL,
	`TSODAdjustTotal` FLOAT NULL DEFAULT '0',
	`TSODRewardTotal` FLOAT NULL,
	`TSODPremiumTotal` FLOAT NULL,
	`TSODCommissionBase` FLOAT NULL DEFAULT '0',
	`TSODCommissionRate` VARCHAR(30) NULL,
	`TSODCommission` FLOAT NULL DEFAULT '0',
	`TSODBaseIncoType` VARCHAR(3) NULL,
	`TSODIncoType` VARCHAR(3) NULL,
	`TSODIncoterms` VARCHAR(50) NULL,
	`TSODOtherFee` FLOAT NULL DEFAULT '0',
	`TSODTransportFee` FLOAT NULL DEFAULT '0',
	`TSODHandlingFee` FLOAT NULL DEFAULT '0',
	`TSODFreightFee` FLOAT NULL DEFAULT '0',
	`TSODInsurance` FLOAT NULL DEFAULT '0',
	`TSODTransportDesc` FLOAT NULL,
	`TSODDuty` FLOAT NULL,
	`TSODShipBy` VARCHAR(255) NULL,
	`TSODCountryOrigin` VARCHAR(50) NULL,
	`TSODDestination` VARCHAR(255) NULL,
	`TSODCondition` VARCHAR(100) NULL,
	`TSODConditionDay` SMALLINT NULL DEFAULT '0',
	`TSODCondition1` DOUBLE NULL DEFAULT '0',
	`TSODConditionDay1` SMALLINT NULL DEFAULT '0',
	`TSODPaymentNote` VARCHAR(200) NULL,
	`TSODStatementNote` VARCHAR(200) NULL,
	`TSODDeliveryNote` VARCHAR(200) NULL,
	`TSODPackingNote` VARCHAR(200) NULL,
	`TSODDayAvailable` SMALLINT NULL,
	`TSODDescription` VARCHAR(255) NULL,
	`TSODCustom1` VARCHAR(30) NULL,
	`TSODCustom2` VARCHAR(30) NULL,
	`TSODCustom3` VARCHAR(30) NULL,
	`TSODCustom4` VARCHAR(255) NULL,
	`TSODCustom5` VARCHAR(255) NULL,
	`TSODVerifyStatus` SMALLINT NULL,
	`TSODStartDate` DATETIME NULL,
	`TSODFinishDate` DATETIME NULL,
	`TSODTSOTCode` VARCHAR(50) NULL,
	`TSODInvoiceStatus` SMALLINT NULL DEFAULT '0',
	`TSODDeliveryStatus` SMALLINT NULL,
	`TSODCreateBy` VARCHAR(140) NULL,
	`TSODCreateDate` DATETIME NULL,
	`TSODEditCode` VARCHAR(30) NULL,
	`TSODEditBy` VARCHAR(140) NULL,
	`TSODEditDate` DATETIME NULL,
	`TSODConfirmStatus` SMALLINT NULL,
	`TSODConfirmBy` VARCHAR(140) NULL,
	`TSODConfirmDate` DATETIME NULL,
	`TSODApproveStatus` SMALLINT NULL,
	`TSODApproveBy` VARCHAR(140) NULL,
	`TSODApproveDate` DATETIME NULL,
	`TSODApproveNote` VARCHAR(80) NULL,
	`TSODRevision` SMALLINT NULL,
	`TSODReviseBy` VARCHAR(140) NULL,
	`TSODCancelStatus` SMALLINT NULL,
	`TSODCancelBy` VARCHAR(140) NULL,
	`TSODCancelDate` DATETIME NULL,
	`TSODCancelNote` VARCHAR(80) NULL,
	`TSODFlag1` SMALLINT NULL,
	`TSODFlag2` SMALLINT NULL,
	`TSODFlag3` SMALLINT NULL,
	PRIMARY KEY (`TSODNo`),
	KEY `TAPQTCmpCode` (`TSODTARNCode`),
	KEY `TInvTCurCode` (`TSODTCurCode`),
	KEY `TIvoTARDCode` (`TSODTARDCode`),
	KEY `TJobCode` (`TSODCode`),
	KEY `TPODTAPNCode` (`TSODContactNote`),
	KEY `TPRDTBokCode` (`TSODTSBkCode`),
	KEY `TPRDTBraCode` (`TSODTBraCode`),
	KEY `TPWOSupplierName` (`TSODCusAddress`),
	KEY `TPWOTCmpCode` (`TSODCustomerName`),
	KEY `TQuoTPrjCode` (`TSODTPrjCode`),
	KEY `TQuoTRCACode` (`TSODTRCACode`),
	KEY `TSODTEmpCode` (`TSODTEmpCode`),
	KEY `VS4TARCampaignVS4TSO` (`TSODTRCACode`),
	KEY `VS4TARVS4TSO` (`TSODTARNCode`),
	KEY `VS4TProjectVS4TSO` (`TSODTPrjCode`),
	KEY `VS4TSOBookVS4TSO` (`TSODTSBkCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSOBook` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSOBook`;

# ---------- CREATE TABLE `VS4TSOBook` ----------

CREATE TABLE `VS4TSOBook` (
	`TSBKCode` VARCHAR(30) NOT NULL,
	`TSBKName` VARCHAR(140) NULL,
	`TSBKName2` VARCHAR(140) NULL,
	`TSBKDocCode` VARCHAR(30) NULL,
	`TSBKFlag1` SMALLINT NULL DEFAULT '0',
	`TSBKFlag2` SMALLINT NULL DEFAULT '0',
	`TSBKFlag3` SMALLINT NULL DEFAULT '0',
	UNIQUE KEY `TSBKCode` (`TSBKCode`),
	KEY `Index_B0D14894_767D_4A78` (`TSBKCode`),
	KEY `TPRBCode` (`TSBKDocCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSODelivery` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSODelivery`;

# ---------- CREATE TABLE `VS4TSODelivery` ----------

CREATE TABLE `VS4TSODelivery` (
	`TMDSTSOBTSODNo` VARCHAR(30) NOT NULL,
	`TMDSTSOBLn` INT NOT NULL DEFAULT '0',
	`TMDSLn` INT NOT NULL DEFAULT '0',
	`TMDSProductCode` VARCHAR(30) NULL,
	`TMDSProductName` VARCHAR(250) NULL,
	`TMDSCustom1` VARCHAR(30) NULL,
	`TMDSCustom2` VARCHAR(30) NULL,
	`TMDSCustom3` VARCHAR(30) NULL,
	`TMDSCustom4` VARCHAR(30) NULL,
	`TMDSCustom5` VARCHAR(30) NULL,
	`TMDSDate` DATETIME NULL,
	`TMDSDateTime` DATETIME NULL,
	`TMDSQuantity` DOUBLE NULL DEFAULT '0',
	`TMDSQuantity2` DOUBLE NULL DEFAULT '0',
	`TMDSQuantity3` DOUBLE NULL DEFAULT '0',
	`TMDSUnitCode` VARCHAR(15) NULL,
	`TMDSUnitCode2` VARCHAR(15) NULL,
	`TMDSUnitCode3` VARCHAR(15) NULL,
	`TMDSTotalDelivery` DOUBLE NULL DEFAULT '0',
	`TMDSTotalDelivery2` DOUBLE NULL DEFAULT '0',
	`TMDSTotalDelivery3` DOUBLE NULL DEFAULT '0',
	`TMDSTotalArrear` DOUBLE NULL DEFAULT '0',
	`TMDSTotalArrear2` DOUBLE NULL DEFAULT '0',
	`TMDSTotalArrear3` DOUBLE NULL DEFAULT '0',
	`TMDSUnitCalc` SMALLINT NULL DEFAULT '0',
	`TMDSMapTPdtCode` VARCHAR(30) NULL,
	`TMDSMapTUntCode` VARCHAR(50) NULL,
	`TMDSMapUnitRatio` DOUBLE NULL DEFAULT '0',
	`TMDSQuantityBase` DOUBLE NULL DEFAULT '0',
	`TMDSDeliveryBase` DOUBLE NULL DEFAULT '0',
	`TMDSArrearBase` DOUBLE NULL DEFAULT '0',
	`TMDSTLctCode` VARCHAR(30) NULL,
	`TMDSFlag1` SMALLINT NULL DEFAULT '0',
	`TMDSFlag2` SMALLINT NULL DEFAULT '0',
	`TMDSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TMDSTSOBTSODNo`, `TMDSTSOBLn`, `TMDSLn`),
	KEY `TPDEMapTPdtCode` (`TMDSMapTPdtCode`),
	KEY `TPDEMapTUntCode` (`TMDSMapTUntCode`),
	KEY `TPDEProductCode` (`TMDSProductCode`),
	KEY `TPDEUnitCode` (`TMDSUnitCode`),
	KEY `TPDEUnitCode2` (`TMDSUnitCode2`),
	KEY `TPDEUnitCode3` (`TMDSUnitCode3`),
	KEY `TPWBID` (`TMDSTSOBLn`),
	KEY `TSOBTLctCode` (`TMDSTLctCode`),
	KEY `TTfMID` (`TMDSTSOBTSODNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSOMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSOMB`;

# ---------- CREATE TABLE `VS4TSOMB` ----------

CREATE TABLE `VS4TSOMB` (
	`TSOBTSODNo` VARCHAR(30) NOT NULL,
	`TSOBLn` INT NOT NULL DEFAULT '0',
	`TSOBType` SMALLINT NULL DEFAULT '0',
	`TSOBJobCode` VARCHAR(30) NULL,
	`TSOBGroupName` VARCHAR(30) NULL,
	`TSOBTOInCode` VARCHAR(50) NULL,
	`TSOBTPOSCode` VARCHAR(50) NULL,
	`TSOBCustom1` VARCHAR(30) NULL,
	`TSOBCustom2` VARCHAR(30) NULL,
	`TSOBCustom3` VARCHAR(30) NULL,
	`TSOBCustom4` VARCHAR(30) NULL,
	`TSOBCustom5` VARCHAR(30) NULL,
	`TSOBShippingMark` VARCHAR(255) NULL,
	`TSOBPOSCode` VARCHAR(30) NULL,
	`TSOBFactoryCode` VARCHAR(30) NULL,
	`TSOBPOSName` VARCHAR(150) NULL,
	`TSOBOLDPOSName` VARCHAR(150) NULL,
	`TSOBCost` FLOAT NULL DEFAULT '0',
	`TSOBPremiumCost` FLOAT NULL DEFAULT '0',
	`TSOBPrice` FLOAT NULL DEFAULT '0',
	`TSOBPerQuantity` DOUBLE NULL DEFAULT '1',
	`TSOBUnitFactor` DOUBLE NULL DEFAULT '0',
	`TSOBQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TSOBUnitCalc` SMALLINT NULL DEFAULT '0',
	`TSOBAcceptError` VARCHAR(30) NULL,
	`TSOBQuantityText` VARCHAR(255) NULL,
	`TSOBQuantity` DOUBLE NULL DEFAULT '0',
	`TSOBTUntCode` VARCHAR(50) NULL,
	`TSOBQuantity2` DOUBLE NULL DEFAULT '0',
	`TSOBTUntCode2` VARCHAR(50) NULL,
	`TSOBQuantity3` DOUBLE NULL DEFAULT '0',
	`TSOBTUntCode3` VARCHAR(50) NULL,
	`TSOBCostAmount` DOUBLE NULL DEFAULT '0',
	`TSOBAmount` DOUBLE NULL DEFAULT '0',
	`TSOBDiscountText` VARCHAR(30) NULL,
	`TSOBDiscountTotal` FLOAT NULL,
	`TSOBNetAmount` FLOAT NULL DEFAULT '0',
	`TSOBTaxType` SMALLINT NULL DEFAULT '0',
	`TSOBTaxBase` FLOAT NULL DEFAULT '0',
	`TSOBWTAXBase` FLOAT NULL DEFAULT '0',
	`TSOBAmountVAT` FLOAT NULL DEFAULT '0',
	`TSOBAmountWTAX` FLOAT NULL DEFAULT '0',
	`TSOBPromotionType` VARCHAR(15) NULL,
	`TSOBFreeCode` VARCHAR(30) NULL,
	`TSOBIsPremium` DOUBLE NULL DEFAULT '0',
	`TSOBDescription` VARCHAR(255) NULL,
	`TSOBUseDate` DATETIME NULL,
	`TSOBSourceNo` VARCHAR(30) NULL,
	`TSOBSourceLn` INT NULL DEFAULT '0',
	`TSOBTIvoNo` VARCHAR(100) NULL,
	`TSOBTotalDelivery` DOUBLE NULL DEFAULT '0',
	`TSOBTotalDelivery2` DOUBLE NULL DEFAULT '0',
	`TSOBTotalDelivery3` DOUBLE NULL DEFAULT '0',
	`TSOBTotalArrear` DOUBLE NULL DEFAULT '0',
	`TSOBTotalArrear2` DOUBLE NULL DEFAULT '0',
	`TSOBTotalArrear3` DOUBLE NULL DEFAULT '0',
	`TSOBTotalJob` DOUBLE NULL DEFAULT '0',
	`TSOBTotalJob2` DOUBLE NULL DEFAULT '0',
	`TSOBTotalJob3` DOUBLE NULL DEFAULT '0',
	`TSOBTotalJobArr` DOUBLE NULL DEFAULT '0',
	`TSOBTotalJobArr2` DOUBLE NULL DEFAULT '0',
	`TSOBTotalJobArr3` DOUBLE NULL DEFAULT '0',
	`TSOBDayProcess` SMALLINT NULL DEFAULT '0',
	`TSOBTLctCode` VARCHAR(30) NULL,
	`TSOBFG` DOUBLE NULL DEFAULT '0',
	`TSOBJobRequest` DOUBLE NULL,
	`TSOBRequestDate` DATETIME NULL,
	`TSOBReadyDate` DATETIME NULL,
	`TSOBStatus` SMALLINT NULL DEFAULT '0',
	`TSOBManualClose` SMALLINT NULL,
	`TSOBFlag1` SMALLINT NULL DEFAULT '0',
	`TSOBFlag2` SMALLINT NULL DEFAULT '0',
	`TSOBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSOBLn`, `TSOBTSODNo`),
	KEY `TJbMSourceNo` (`TSOBSourceNo`),
	KEY `TPOBTPdtCode` (`TSOBTPOSCode`),
	KEY `TPSMUnitFactor` (`TSOBUnitFactor`),
	KEY `TPWBID` (`TSOBLn`),
	KEY `TPWBPdtCode1` (`TSOBPOSCode`),
	KEY `TPWBTUntCode` (`TSOBTUntCode`),
	KEY `TPWBTUntCode1` (`TSOBTUntCode2`),
	KEY `TQuBFreeCode` (`TSOBFreeCode`),
	KEY `TSOBGroupName` (`TSOBGroupName`),
	KEY `TSOBJobCode` (`TSOBJobCode`),
	KEY `TSOBPOSCode` (`TSOBFactoryCode`),
	KEY `TSOBSourceCode1` (`TSOBTIvoNo`),
	KEY `TSOBTPOSCode` (`TSOBTOInCode`),
	KEY `TSOBTUntCode` (`TSOBTUntCode3`),
	KEY `TSOBTWahCode` (`TSOBTLctCode`),
	KEY `TTfMID` (`TSOBTSODNo`),
	KEY `TTfrToTShfCode` (`TSOBType`),
	KEY `VS4TSOVS4TSOMB` (`TSOBTSODNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSOPayPeriod` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSOPayPeriod`;

# ---------- CREATE TABLE `VS4TSOPayPeriod` ----------

CREATE TABLE `VS4TSOPayPeriod` (
	`TSPPTSODNo` VARCHAR(30) NOT NULL,
	`TSPPLn` SMALLINT NOT NULL DEFAULT '0',
	`TSPPDueDate` VARCHAR(7) NULL,
	`TSPPCondition` VARCHAR(50) NULL,
	`TSPPTPPTCode` VARCHAR(30) NULL,
	`TSPPTPyTAlias` VARCHAR(20) NULL,
	`TSPPTCurCode` VARCHAR(4) NULL,
	`TSPPPercent` DOUBLE NULL DEFAULT '0',
	`TSPPmount` FLOAT NULL DEFAULT '0',
	`TSPPExchangeRate` DOUBLE NULL DEFAULT '0',
	`TSPPAmountInRate` FLOAT NULL DEFAULT '0',
	`TSPPNote` VARCHAR(100) NULL,
	`TSPPFlag1` SMALLINT NULL DEFAULT '0',
	`TSPPFlag2` SMALLINT NULL DEFAULT '0',
	`TSPPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSPPTSODNo`, `TSPPLn`),
	KEY `TPPPTPPTCode` (`TSPPTPPTCode`),
	KEY `TPPyTPTAID` (`TSPPTSODNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSOProgress` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSOProgress`;

# ---------- CREATE TABLE `VS4TSOProgress` ----------

CREATE TABLE `VS4TSOProgress` (
	`TSOPID` INT NOT NULL DEFAULT '0',
	`TSOPTSODNo` VARCHAR(30) NULL,
	`TSOPColor` INT NULL DEFAULT '0',
	`TSOPLock` SMALLINT NULL DEFAULT '0',
	`TSOPDescription` VARCHAR(100) NULL,
	`TSOPSOStatus` SMALLINT NULL DEFAULT '0',
	`TSOPDepositStatus` INT NULL DEFAULT '0',
	`TSOPJOBStatus` SMALLINT NULL DEFAULT '0',
	`TSOPProductionStat` SMALLINT NULL DEFAULT '0',
	`TSOPMPSStatus` SMALLINT NULL DEFAULT '0',
	`TSOPMRPStatus` SMALLINT NULL DEFAULT '0',
	`TSOPPRStatus` SMALLINT NULL DEFAULT '0',
	`TSOPPOStatus` SMALLINT NULL DEFAULT '0',
	`TSOPLOTINStatus` SMALLINT NULL DEFAULT '0',
	`TSOPProcessStatus` SMALLINT NULL DEFAULT '0',
	`TSOPFGStatus` SMALLINT NULL DEFAULT '0',
	`TSOPAttachStatus` SMALLINT NULL DEFAULT '0',
	`TSOPDNStatus` SMALLINT NULL DEFAULT '0',
	`TSOPInvoiceStatus` SMALLINT NULL DEFAULT '0',
	`TSOPLogisticStatus` SMALLINT NULL DEFAULT '0',
	`TSOPCNStatus` SMALLINT NULL DEFAULT '0',
	`TSOPDBStatus` SMALLINT NULL DEFAULT '0',
	`TSOPBillStatus` SMALLINT NULL DEFAULT '0',
	`TSOPPaymentStatus` SMALLINT NULL DEFAULT '0',
	`TSOPIncomeStatus` SMALLINT NULL DEFAULT '0',
	`TSOPCustomStatus1` SMALLINT NULL DEFAULT '0',
	`TSOPCustomStatus2` SMALLINT NULL DEFAULT '0',
	`TSOPCustomStatus3` SMALLINT NULL DEFAULT '0',
	`TSOPCustomStatus4` SMALLINT NULL DEFAULT '0',
	`TSOPFlag1` SMALLINT NULL DEFAULT '0',
	`TSOPFlag2` SMALLINT NULL DEFAULT '0',
	`TSOPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSOPID`),
	KEY `TSODID` (`TSOPID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSSORate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSSORate`;

# ---------- CREATE TABLE `VS4TSSORate` ----------

CREATE TABLE `VS4TSSORate` (
	`TSSRCode` VARCHAR(30) NOT NULL,
	`TSSRSort` INT NULL DEFAULT '0',
	`TSSRName` VARCHAR(100) NULL,
	`TSSRRate` DOUBLE NULL DEFAULT '0',
	`TSSRFlag1` SMALLINT NULL DEFAULT '0',
	`TSSRFlag2` SMALLINT NULL DEFAULT '0',
	`TSSRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSSRCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TStandard` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TStandard`;

# ---------- CREATE TABLE `VS4TStandard` ----------

CREATE TABLE `VS4TStandard` (
	`TStdCode` VARCHAR(30) NOT NULL,
	`TStdName` VARCHAR(100) NULL,
	`TStdFlag1` SMALLINT NULL DEFAULT '0',
	`TStdFlag2` SMALLINT NULL DEFAULT '0',
	`TStdFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TStdCode`),
	KEY `TBnkCode` (`TStdCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TState` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TState`;

# ---------- CREATE TABLE `VS4TState` ----------

CREATE TABLE `VS4TState` (
	`TStaCode` VARCHAR(2) NOT NULL,
	`TStaName` VARCHAR(50) NULL,
	`TStaName2` VARCHAR(50) NULL,
	`TStaPhoneCode` VARCHAR(3) NULL,
	`TStaTCouCode` VARCHAR(30) NULL,
	`TStaFlag1` SMALLINT NULL DEFAULT '0',
	`TStaFlag2` SMALLINT NULL DEFAULT '0',
	`TStaFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TStaCode`),
	KEY `StatePhoneCode` (`TStaPhoneCode`),
	KEY `TStaCountryCode` (`TStaTCouCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TStockNow` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TStockNow`;

# ---------- CREATE TABLE `VS4TStockNow` ----------

CREATE TABLE `VS4TStockNow` (
	`TSFNTLctCode` VARCHAR(30) NOT NULL,
	`TSFNTPdtCode` VARCHAR(30) NOT NULL,
	`TSFNCustom1` VARCHAR(30) NOT NULL,
	`TSFNSerialNo` VARCHAR(30) NOT NULL,
	`TSFNLotNo` VARCHAR(30) NOT NULL,
	`TSFNLotDate` DATETIME NOT NULL,
	`TSFNQuantityCalc` DOUBLE NULL DEFAULT '0',
	`TSFNQuantityBase` DOUBLE NULL DEFAULT '0',
	`TSFNAmouQuantity` DOUBLE NULL,
	`TSFNAmouQuantity2` DOUBLE NULL,
	`TSFNAmouQuantity3` DOUBLE NULL,
	`TSFNAmount` FLOAT NULL,
	`TSFNQuantityCut` DOUBLE NULL DEFAULT '0',
	`TSFNQuantityFirst` DOUBLE NULL DEFAULT '0',
	`TSFNFlag1` SMALLINT NULL,
	`TSFNFlag2` SMALLINT NULL,
	`TSFNFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSFNTLctCode`, `TSFNTPdtCode`, `TSFNCustom1`, `TSFNSerialNo`, `TSFNLotNo`, `TSFNLotDate`),
	KEY `TInMLotNo` (`TSFNLotNo`),
	KEY `TInMSerialNo` (`TSFNSerialNo`),
	KEY `TInMTPdtCode` (`TSFNTPdtCode`),
	KEY `TSFNCustom1` (`TSFNCustom1`),
	KEY `TSFNLotDate` (`TSFNLotDate`),
	KEY `TTfrToTLctCode` (`TSFNTLctCode`),
	KEY `VS4TInventoryCostVS4TStockNow` (`TSFNTPdtCode`, `TSFNCustom1`, `TSFNSerialNo`, `TSFNLotNo`, `TSFNLotDate`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSwitchTime` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSwitchTime`;

# ---------- CREATE TABLE `VS4TSwitchTime` ----------

CREATE TABLE `VS4TSwitchTime` (
	`TSwTNo` VARCHAR(30) NOT NULL,
	`TSwTDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSwTRefNo` VARCHAR(30) NULL,
	`TSwTRefDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSwTTBraCode` VARCHAR(30) NULL,
	`TSwTTDivCode` VARCHAR(50) NULL,
	`TSwTTDepCode` VARCHAR(30) NULL,
	`TSwTTSecCode` VARCHAR(30) NULL,
	`TSwTDescription` VARCHAR(200) NULL,
	`TSwTCreateCode` VARCHAR(30) NULL,
	`TSwTCreateBy` VARCHAR(140) NULL,
	`TSwTCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSwTEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSwTEditCode` VARCHAR(30) NULL,
	`TSwTEditBy` VARCHAR(140) NULL,
	`TSwTConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TSwTConfirmBy` VARCHAR(140) NULL,
	`TSwTConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSwTApproveStatus` SMALLINT NULL DEFAULT '0',
	`TSwTApproveBy` VARCHAR(140) NULL,
	`TSwTApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSwTApproveNote` VARCHAR(80) NULL,
	`TSwTRevision` SMALLINT NULL DEFAULT '0',
	`TSwTCancelStatus` SMALLINT NULL DEFAULT '0',
	`TSwTCancelBy` VARCHAR(140) NULL,
	`TSwTCancelNo` VARCHAR(30) NULL,
	`TSwTCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TSwTCancelNote` VARCHAR(80) NULL,
	`TSwTFlag1` SMALLINT NULL DEFAULT '0',
	`TSwTFlag2` SMALLINT NULL DEFAULT '0',
	`TSwTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSwTNo`),
	KEY `TEidTBraCode` (`TSwTTBraCode`),
	KEY `TEidTDepCode` (`TSwTTDepCode`),
	KEY `TEidTDivCode` (`TSwTTDivCode`),
	KEY `TEidTSecCode` (`TSwTTSecCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSwitchTimeMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSwitchTimeMB`;

# ---------- CREATE TABLE `VS4TSwitchTimeMB` ----------

CREATE TABLE `VS4TSwitchTimeMB` (
	`TSTMTSWTNo` VARCHAR(30) NOT NULL,
	`TSTMLn` INT NOT NULL DEFAULT '0',
	`TSTMTEmpCode` VARCHAR(30) NULL,
	`TSTMFromTWPDCode` VARCHAR(50) NULL,
	`TSTMToTWPDCode` VARCHAR(50) NULL,
	`TSTMSwitchFromDate` DATETIME NULL,
	`TSTMSwitchToDate` DATETIME NULL,
	`TSTMPayType` SMALLINT NULL DEFAULT '0',
	`TSTMType` SMALLINT NULL DEFAULT '0',
	`TSTMInTime1` DATETIME NULL,
	`TSTMInTimeAddDay1` SMALLINT NULL DEFAULT '0',
	`TSTMInLate1` DATETIME NULL,
	`TSTMInLateAddDay1` SMALLINT NULL DEFAULT '0',
	`TSTMOutTime1` DATETIME NULL,
	`TSTMOutTimeAddDay1` SMALLINT NULL DEFAULT '0',
	`TSTMInTime2` DATETIME NULL,
	`TSTMInTimeAddDay2` SMALLINT NULL DEFAULT '0',
	`TSTMInLate2` DATETIME NULL,
	`TSTMInLateAddDay2` SMALLINT NULL DEFAULT '0',
	`TSTMOutTime2` DATETIME NULL,
	`TSTMOutTimeAddDay2` SMALLINT NULL DEFAULT '0',
	`TSTMInTime3` DATETIME NULL,
	`TSTMInTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TSTMInLate3` DATETIME NULL,
	`TSTMInLateAddDay3` SMALLINT NULL DEFAULT '0',
	`TSTMOutTime3` DATETIME NULL,
	`TSTMOutTimeAddDay3` SMALLINT NULL DEFAULT '0',
	`TSTMInTime4` DATETIME NULL,
	`TSTMInTimeAddDay4` SMALLINT NULL DEFAULT '0',
	`TSTMInLate4` DATETIME NULL,
	`TSTMInLateAddDay4` SMALLINT NULL DEFAULT '0',
	`TSTMOutTime4` VARCHAR(5) NULL,
	`TSTMOutTimeAddDay4` SMALLINT NULL DEFAULT '0',
	`TSTMPayShift` SMALLINT NULL,
	`TSTMPayFood` SMALLINT NULL,
	`TSTMPayFood2` SMALLINT NULL,
	`TSTMPayVehicle` SMALLINT NULL,
	`TSTMPayStamp` SMALLINT NULL,
	`TSTMPayStamp2` SMALLINT NULL,
	`TSTMPayStamp3` SMALLINT NULL,
	`TSTMFlag1` SMALLINT NULL DEFAULT '0',
	`TSTMFlag2` SMALLINT NULL DEFAULT '0',
	`TSTMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSTMTSWTNo`, `TSTMLn`),
	KEY `TSTMFromTWPDCode` (`TSTMFromTWPDCode`),
	KEY `TSTMTEmpCode` (`TSTMTEmpCode`),
	KEY `TSTMTWPDCode` (`TSTMToTWPDCode`),
	KEY `TTCKTEmpCode` (`TSTMTSWTNo`),
	KEY `VS4TEmployeeVS4TSwitchTimeMB` (`TSTMTEmpCode`),
	KEY `VS4TSwitchTimeVS4TSwitchTimeMB` (`TSTMTSWTNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSystem` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSystem`;

# ---------- CREATE TABLE `VS4TSystem` ----------

CREATE TABLE `VS4TSystem` (
	`TSysID` INT NOT NULL DEFAULT '0',
	`TSysTSyGAlias` VARCHAR(30) NULL,
	`TSysName` VARCHAR(100) NULL,
	`TSysName2` VARCHAR(100) NULL,
	`TSysType` SMALLINT NULL DEFAULT '0',
	`TSysText` VARCHAR(255) NULL,
	`TSysValue` DOUBLE NULL DEFAULT '0',
	`TSysDecimal` SMALLINT NULL DEFAULT '0',
	`TSysLock` SMALLINT NULL DEFAULT '0',
	`TSysFlag1` SMALLINT NULL DEFAULT '0',
	`TSysFlag2` SMALLINT NULL DEFAULT '0',
	`TSysFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSysID`),
	KEY `TaxID` (`TSysID`),
	KEY `TSysName` (`TSysName`),
	KEY `TSysName1` (`TSysName2`),
	KEY `VS4TSystemGroupVS4TSystem` (`TSysTSyGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSystemBranch` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSystemBranch`;

# ---------- CREATE TABLE `VS4TSystemBranch` ----------

CREATE TABLE `VS4TSystemBranch` (
	`TSyBID` INT NOT NULL DEFAULT '0',
	`TSyBTBraCode` VARCHAR(30) NULL,
	`TSyBName` VARCHAR(100) NULL,
	`TSyBName2` VARCHAR(100) NULL,
	`TSyBType` SMALLINT NULL DEFAULT '0',
	`TSyBText` VARCHAR(255) NULL,
	`TSyBValue` DOUBLE NULL DEFAULT '0',
	`TSyBDecimal` SMALLINT NULL DEFAULT '0',
	`TSyBLock` SMALLINT NULL DEFAULT '0',
	`TSyBFlag1` SMALLINT NULL DEFAULT '0',
	`TSyBFlag2` SMALLINT NULL DEFAULT '0',
	`TSyBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSyBID`),
	KEY `TaxID` (`TSyBID`),
	KEY `VS4TBranchVS4TSystemBranch` (`TSyBTBraCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSystemGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSystemGroup`;

# ---------- CREATE TABLE `VS4TSystemGroup` ----------

CREATE TABLE `VS4TSystemGroup` (
	`TSyGAlias` VARCHAR(30) NOT NULL,
	`TSyGName` VARCHAR(50) NULL,
	`TSyGFlag1` SMALLINT NULL DEFAULT '0',
	`TSyGFlag2` SMALLINT NULL DEFAULT '0',
	`TSyGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSyGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TSystemUser` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TSystemUser`;

# ---------- CREATE TABLE `VS4TSystemUser` ----------

CREATE TABLE `VS4TSystemUser` (
	`TSyUID` INT NOT NULL DEFAULT '0',
	`TSyUUserID` INT NULL DEFAULT '0',
	`TSyUName` VARCHAR(100) NULL,
	`TSyUName2` VARCHAR(100) NULL,
	`TSyUType` SMALLINT NULL DEFAULT '0',
	`TSyUText` VARCHAR(255) NULL,
	`TSyUValue` DOUBLE NULL DEFAULT '0',
	`TSyUDecimal` SMALLINT NULL DEFAULT '0',
	`TSyULock` SMALLINT NULL DEFAULT '0',
	`TSyUFlag1` SMALLINT NULL DEFAULT '0',
	`TSyUFlag2` SMALLINT NULL DEFAULT '0',
	`TSyUFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TSyUID`),
	KEY `TaxID` (`TSyUID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTax` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTax`;

# ---------- CREATE TABLE `VS4TTax` ----------

CREATE TABLE `VS4TTax` (
	`TTaxAlias` VARCHAR(30) NOT NULL,
	`TTaxName` VARCHAR(50) NULL,
	`TTaxName2` VARCHAR(50) NULL,
	`TTaxFlag1` SMALLINT NULL DEFAULT '0',
	`TTaxFlag2` SMALLINT NULL DEFAULT '0',
	`TTaxFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTaxAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTaxBaseIncome` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTaxBaseIncome`;

# ---------- CREATE TABLE `VS4TTaxBaseIncome` ----------

CREATE TABLE `VS4TTaxBaseIncome` (
	`TTbCCode` VARCHAR(30) NOT NULL,
	`TTbCName` VARCHAR(50) NULL,
	`TTbCRate` DOUBLE NULL DEFAULT '0',
	`TTbCFlag1` SMALLINT NULL DEFAULT '0',
	`TTbCFlag2` SMALLINT NULL DEFAULT '0',
	`TTbCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTbCCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTaxRate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTaxRate`;

# ---------- CREATE TABLE `VS4TTaxRate` ----------

CREATE TABLE `VS4TTaxRate` (
	`TTxRTTaxAlias` VARCHAR(30) NOT NULL,
	`TTxRFromBase` FLOAT NOT NULL DEFAULT '0',
	`TTxRRate` DOUBLE NULL DEFAULT '0',
	`TTxRFlag1` SMALLINT NULL DEFAULT '0',
	`TTxRFlag2` SMALLINT NULL DEFAULT '0',
	`TTxRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTxRTTaxAlias`, `TTxRFromBase`),
	KEY `VS4TTaxVS4TTaxRate` (`TTxRTTaxAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTaxTrans` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTaxTrans`;

# ---------- CREATE TABLE `VS4TTaxTrans` ----------

CREATE TABLE `VS4TTaxTrans` (
	`TTxTID` INT NOT NULL DEFAULT '0',
	`TTxTNo` VARCHAR(50) NULL,
	`TTxTType` SMALLINT NULL DEFAULT '0',
	`TTxTDefaultTax` INT NULL DEFAULT '0',
	`TTxTBaseModule` VARCHAR(50) NULL,
	`TTxTSaveFrom` VARCHAR(5) NULL,
	`TTxTYear` SMALLINT NULL DEFAULT '0',
	`TTxTMonth` SMALLINT NULL DEFAULT '0',
	`TTxTTGLTNo` VARCHAR(30) NULL,
	`TTxTTGLBCode` VARCHAR(30) NULL,
	`TTxTDocNo` VARCHAR(30) NULL,
	`TTxTDocDate` DATETIME NULL,
	`TTxTTaxNo` VARCHAR(50) NULL,
	`TTxTTaxDate` DATETIME NULL,
	`TTxTLawType` SMALLINT NULL DEFAULT '0',
	`TTxTClientCode` VARCHAR(30) NULL,
	`TTxTClientFullName` VARCHAR(200) NULL,
	`TTxTClientAddress` VARCHAR(255) NULL,
	`TTxTClientCitizen` VARCHAR(30) NULL,
	`TTxTClientTaxNo` VARCHAR(30) NULL,
	`TTxTCondition` SMALLINT NULL DEFAULT '0',
	`TTxTStatus` SMALLINT NULL DEFAULT '0',
	`TTxTCurrrency` VARCHAR(5) NULL,
	`TTxTExceptType` SMALLINT NULL DEFAULT '0',
	`TTxTTaxDesc` VARCHAR(100) NULL,
	`TTxTTaxGroup` VARCHAR(10) NULL,
	`TTxTTTaxAlias` VARCHAR(30) NULL,
	`TTxTTaxPeriodNo` DATETIME NULL,
	`TTxTTaxPeriodType` SMALLINT NULL DEFAULT '0',
	`TTxTTaxRefund` SMALLINT NULL DEFAULT '0',
	`TTxTPayType` SMALLINT NULL DEFAULT '0',
	`TTxTR1ATaxNo` VARCHAR(30) NULL,
	`TTxTSFUNDTotal` FLOAT NULL DEFAULT '0',
	`TTxTSTAXTotal` FLOAT NULL DEFAULT '0',
	`TTxTSubTotal` FLOAT NULL DEFAULT '0',
	`TTxTExchangeRate` DOUBLE NULL DEFAULT '0',
	`TTxTExceptAmount` FLOAT NULL DEFAULT '0',
	`TTxTZeroAmount` FLOAT NULL DEFAULT '0',
	`TTxTSignTaxAmount` FLOAT NULL DEFAULT '0',
	`TTxTGrandTotal` FLOAT NULL DEFAULT '0',
	`TTxTCalcType` SMALLINT NULL DEFAULT '0',
	`TTxTBaseIncome` VARCHAR(30) NULL,
	`TTxTTaxRate` DOUBLE NULL DEFAULT '0',
	`TTxTBaseDate` DATETIME NULL,
	`TTxTBaseAmount` FLOAT NULL DEFAULT '0',
	`TTxTVATAmount` FLOAT NULL DEFAULT '0',
	`TTxTWTaxAmount` FLOAT NULL DEFAULT '0',
	`TTxTBaseIncome1` VARCHAR(30) NULL,
	`TTxTTaxRate1` DOUBLE NULL DEFAULT '0',
	`TTxTBaseDate1` DATETIME NULL,
	`TTxTBaseAmount1` FLOAT NULL DEFAULT '0',
	`TTxTWTaxAmount1` FLOAT NULL DEFAULT '0',
	`TTxTBaseIncome2` VARCHAR(30) NULL,
	`TTxTTaxRate2` DOUBLE NULL DEFAULT '0',
	`TTxTBaseDate2` DATETIME NULL,
	`TTxTBaseAmount2` FLOAT NULL DEFAULT '0',
	`TTxTWTaxAmount2` FLOAT NULL DEFAULT '0',
	`TTxTBaseIncome3` VARCHAR(30) NULL,
	`TTxTTaxRate3` DOUBLE NULL DEFAULT '0',
	`TTxTBaseDate3` DATETIME NULL,
	`TTxTBaseAmount3` FLOAT NULL DEFAULT '0',
	`TTxTWTaxAmount3` FLOAT NULL DEFAULT '0',
	`TTxTBaseIncome4A` VARCHAR(30) NULL,
	`TTxTTaxRate4A` DOUBLE NULL DEFAULT '0',
	`TTxTBaseDate4A` DATETIME NULL,
	`TTxTBaseAmount4A` FLOAT NULL DEFAULT '0',
	`TTxTWTaxAmount4A` FLOAT NULL DEFAULT '0',
	`TTxTBaseIncome4B` VARCHAR(30) NULL,
	`TTxTTaxRate4B` DOUBLE NULL DEFAULT '0',
	`TTxTBaseDate4B` DATETIME NULL,
	`TTxTBaseAmount4B` FLOAT NULL DEFAULT '0',
	`TTxTWTaxAmount4B` FLOAT NULL DEFAULT '0',
	`TTxTBaseIncome5` VARCHAR(30) NULL,
	`TTxTTaxRate5` DOUBLE NULL DEFAULT '0',
	`TTxTBaseDate5` DATETIME NULL,
	`TTxTBaseAmount5` FLOAT NULL DEFAULT '0',
	`TTxTWTaxAmount5` FLOAT NULL DEFAULT '0',
	`TTxTBaseIncome6` VARCHAR(30) NULL,
	`TTxTTaxRate6` DOUBLE NULL DEFAULT '0',
	`TTxTBaseDate6` DATETIME NULL,
	`TTxTBaseAmount6` FLOAT NULL DEFAULT '0',
	`TTxTWTaxAmount6` FLOAT NULL DEFAULT '0',
	`TTxTDescription` VARCHAR(100) NULL,
	`TTxTCreateCode` VARCHAR(30) NULL,
	`TTxTCreateBy` VARCHAR(140) NULL,
	`TTxTCreateDate` DATETIME NULL,
	`TTxTEditCode` VARCHAR(30) NULL,
	`TTxTEditBy` VARCHAR(140) NULL,
	`TTxTEditDate` DATETIME NULL,
	`TTxTConfirmStatus` SMALLINT NULL,
	`TTxTConfirmBy` VARCHAR(140) NULL,
	`TTxTConfirmDate` DATETIME NULL,
	`TTxTApproveStatus` SMALLINT NULL,
	`TTxTApproveBy` VARCHAR(140) NULL,
	`TTxTApproveDate` DATETIME NULL,
	`TTxTApproveNote` VARCHAR(80) NULL,
	`TTxTRevision` SMALLINT NULL,
	`TTxTCancelStatus` SMALLINT NULL,
	`TTxTCancelNo` VARCHAR(30) NULL,
	`TTxTCancelBy` VARCHAR(140) NULL,
	`TTxTCancelDate` DATETIME NULL,
	`TTxTCancelNote` VARCHAR(80) NULL,
	`TTxTFlag1` SMALLINT NULL,
	`TTxTFlag2` SMALLINT NULL,
	`TTxTFlag3` SMALLINT NULL,
	PRIMARY KEY (`TTxTID`),
	KEY `TPOBTPdtCode` (`TTxTTaxDate`),
	KEY `TPWBID` (`TTxTTGLBCode`),
	KEY `TPWBPdtCode1` (`TTxTTTaxAlias`),
	KEY `TTfMID` (`TTxTDocNo`),
	KEY `TTfrToTShfCode` (`TTxTTaxDesc`),
	KEY `TTxTClientCode` (`TTxTClientCode`),
	KEY `TTxTID` (`TTxTID`),
	KEY `TTxTTaxNo` (`TTxTNo`),
	KEY `TYTxTTaxNo` (`TTxTTaxNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTeasuryMove` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTeasuryMove`;

# ---------- CREATE TABLE `VS4TTeasuryMove` ----------

CREATE TABLE `VS4TTeasuryMove` (
	`TTYMTACPTACYID` INT NOT NULL DEFAULT '0',
	`TTYMTACPID` INT NOT NULL DEFAULT '0',
	`TTYMTCBBNo` VARCHAR(30) NOT NULL,
	`TTYMQuarter` FLOAT NULL DEFAULT '0',
	`TTYMBeginBalance` FLOAT NULL DEFAULT '0',
	`TTYMTrans` FLOAT NULL DEFAULT '0',
	`TTYMEndBalance` FLOAT NULL DEFAULT '0',
	`TTYMCheque` FLOAT NULL DEFAULT '0',
	`TTYMBeginCHR` FLOAT NULL DEFAULT '0',
	`TTYMTransCHR` FLOAT NULL DEFAULT '0',
	`TTYMEndCHR` FLOAT NULL DEFAULT '0',
	`TTYMBeginCard` FLOAT NULL DEFAULT '0',
	`TTYMTransCard` FLOAT NULL DEFAULT '0',
	`TTYMEndCard` FLOAT NULL DEFAULT '0',
	`TTYMBeginCHS` FLOAT NULL DEFAULT '0',
	`TTYMTransCHS` FLOAT NULL DEFAULT '0',
	`TTYMEndCHS` FLOAT NULL DEFAULT '0',
	`TTYMBeginNet` FLOAT NULL DEFAULT '0',
	`TTYMTransNet` FLOAT NULL DEFAULT '0',
	`TTYMEndNet` FLOAT NULL DEFAULT '0',
	`TTYMBeginNetSafe` FLOAT NULL DEFAULT '0',
	`TTYMTransNetSAfe` FLOAT NULL DEFAULT '0',
	`TTYMEndNetSafe` FLOAT NULL DEFAULT '0',
	`TTYMFlag1` SMALLINT NULL DEFAULT '0',
	`TTYMFlag2` SMALLINT NULL DEFAULT '0',
	`TTYMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTYMTACPTACYID`, `TTYMTACPID`, `TTYMTCBBNo`),
	KEY `TGTMTACPID` (`TTYMTACPID`),
	KEY `TGTMTACPID1` (`TTYMBeginBalance`),
	KEY `TGTMTACPTACYID` (`TTYMTACPTACYID`),
	KEY `TGTMTGTSTACCCode` (`TTYMTCBBNo`),
	KEY `TTYMBeginBalance` (`TTYMBeginCHR`),
	KEY `TTYMBeginBalance1` (`TTYMBeginNet`),
	KEY `TTYMBeginCHR` (`TTYMBeginCHS`),
	KEY `TTYMBeginCHR1` (`TTYMBeginCard`),
	KEY `TTYMBeginNet` (`TTYMTransNet`),
	KEY `TTYMBeginNet1` (`TTYMBeginNetSafe`),
	KEY `TTYMEndBalance` (`TTYMTransCHR`),
	KEY `TTYMEndBalance1` (`TTYMEndNet`),
	KEY `TTYMEndBalance2` (`TTYMTrans`),
	KEY `TTYMEndBalanceNet` (`TTYMEndNetSafe`),
	KEY `TTYMEndCHQ` (`TTYMEndCHR`),
	KEY `TTYMEndCHR` (`TTYMEndCHS`),
	KEY `TTYMEndCHR1` (`TTYMEndCard`),
	KEY `TTYMQuarter` (`TTYMQuarter`),
	KEY `TTYMQuarter1` (`TTYMEndBalance`),
	KEY `TTYMQuarter2` (`TTYMCheque`),
	KEY `TTYMTranactionCHR` (`TTYMTransCHS`),
	KEY `TTYMTranactionCHR1` (`TTYMTransCard`),
	KEY `TTYMTransNet` (`TTYMTransNetSAfe`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTeasuryTrans` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTeasuryTrans`;

# ---------- CREATE TABLE `VS4TTeasuryTrans` ----------

CREATE TABLE `VS4TTeasuryTrans` (
	`TTeTNo` VARCHAR(30) NOT NULL,
	`TTeTType` SMALLINT NULL DEFAULT '0',
	`TTeTMode` SMALLINT NULL DEFAULT '0',
	`TTeTDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTeTSaveFrom` VARCHAR(10) NULL,
	`TTeTTBraCode` VARCHAR(30) NULL,
	`TTeTTPrjCode` VARCHAR(30) NULL,
	`TTeTTransferDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTeTRefNo` VARCHAR(30) NULL,
	`TTeTRefDate` DATETIME NULL,
	`TTeTRefNo2` VARCHAR(30) NULL,
	`TTeTRefDate2` DATETIME NULL,
	`TTeTDescription` VARCHAR(255) NULL,
	`TTeTFromTCBBNo` VARCHAR(30) NULL,
	`TTeTToTCBBNo` VARCHAR(30) NULL,
	`TTeTToTBraCode` VARCHAR(30) NULL,
	`TTeTTotal` DOUBLE NULL DEFAULT '0',
	`TTeTAdjustTotal` FLOAT NULL DEFAULT '0',
	`TTeTFee` FLOAT NULL DEFAULT '0',
	`TTeTNetTotal` FLOAT NULL DEFAULT '0',
	`TTeTTGLTNo` VARCHAR(30) NULL,
	`TTeTReceiveBy` VARCHAR(160) NULL,
	`TTeTReceiveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTeTCreateCode` VARCHAR(30) NULL,
	`TTeTCreateBy` VARCHAR(140) NULL,
	`TTeTCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTeTEditCode` VARCHAR(30) NULL,
	`TTeTEditBy` VARCHAR(140) NULL,
	`TTeTEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTeTConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TTeTConfirmBy` VARCHAR(140) NULL,
	`TTeTConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTeTApproveStatus` SMALLINT NULL DEFAULT '0',
	`TTeTApproveBy` VARCHAR(140) NULL,
	`TTeTApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTeTApproveNote` VARCHAR(80) NULL,
	`TTeTRevision` SMALLINT NULL DEFAULT '0',
	`TTeTCancelStatus` SMALLINT NULL DEFAULT '0',
	`TTeTCancelNo` VARCHAR(30) NULL,
	`TTeTCancelBy` VARCHAR(140) NULL,
	`TTeTCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTeTCancelNote` VARCHAR(80) NULL,
	`TTeTFlag1` SMALLINT NULL DEFAULT '0',
	`TTeTFlag2` SMALLINT NULL DEFAULT '0',
	`TTeTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTeTNo`),
	KEY `TCBTTBraCode` (`TTeTTBraCode`),
	KEY `TCBTTPrjCode` (`TTeTTPrjCode`),
	KEY `TDPSFee` (`TTeTFee`),
	KEY `TDPSNetTotal` (`TTeTNetTotal`),
	KEY `TSTKTShfID` (`TTeTFromTCBBNo`),
	KEY `TTeTTBraCode` (`TTeTSaveFrom`),
	KEY `TTeTTBraCode1` (`TTeTToTBraCode`),
	KEY `TTfrFromTStoCode` (`TTeTToTCBBNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTeasuryTransMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTeasuryTransMB`;

# ---------- CREATE TABLE `VS4TTeasuryTransMB` ----------

CREATE TABLE `VS4TTeasuryTransMB` (
	`TTTMTTeTNo` VARCHAR(30) NOT NULL,
	`TTTMLn` INT NOT NULL DEFAULT '0',
	`TTTMTCurCode` VARCHAR(5) NULL,
	`TTTMMoney` FLOAT NULL DEFAULT '0',
	`TTTMFromTCBBNo` VARCHAR(30) NULL,
	`TTTMFromRate` FLOAT NULL DEFAULT '0',
	`TTTMMoneyRateFrom` FLOAT NULL DEFAULT '0',
	`TTTMMoneyRate` FLOAT NULL DEFAULT '0',
	`TTTMTACPTACYID` INT NULL DEFAULT '0',
	`TTTMTACPID` INT NULL DEFAULT '0',
	`TTTMToTCBBNo` VARCHAR(30) NULL,
	`TTTMRate` FLOAT NULL DEFAULT '0',
	`TTTMAdjustTotal` FLOAT NULL DEFAULT '0',
	`TTTMFee` FLOAT NULL DEFAULT '0',
	`TTTMNetTotal` FLOAT NULL DEFAULT '0',
	`TTTMMoneyInCard` FLOAT NULL DEFAULT '0',
	`TTTMMoneyInCheque` FLOAT NULL DEFAULT '0',
	`TTTMMoneyOutCheque` FLOAT NULL DEFAULT '0',
	`TTTMChequeNo` VARCHAR(30) NULL,
	`TTTMMoneyIn` FLOAT NULL DEFAULT '0',
	`TTTMMoneyOut` FLOAT NULL DEFAULT '0',
	`TTTMMoneyAmount` FLOAT NULL DEFAULT '0',
	`TTTMMoneyNet` FLOAT NULL DEFAULT '0',
	`TTTMMoneyNetSafe` FLOAT NULL DEFAULT '0',
	`TTTMMode` SMALLINT NULL DEFAULT '0',
	`TTTMValidDate` DATETIME NULL,
	`TTTMChequeStatus` SMALLINT NULL DEFAULT '0',
	`TTTMCutMode` SMALLINT NULL DEFAULT '0',
	`TTTMShow` SMALLINT NULL DEFAULT '0',
	`TTTMStatus` SMALLINT NULL DEFAULT '0',
	`TTTMReconsign` SMALLINT NULL DEFAULT '0',
	`TTTMReconsignDate` DATETIME NULL,
	`TTTMRecTEmpCode` VARCHAR(30) NULL,
	`TTTMReconsignNote` VARCHAR(30) NULL,
	`TTTMTypeList` VARCHAR(255) NULL,
	`TTTMNote` VARCHAR(255) NULL,
	`TTTMFlag1` SMALLINT NULL DEFAULT '0',
	`TTTMFlag2` SMALLINT NULL DEFAULT '0',
	`TTTMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTTMTTeTNo`, `TTTMLn`),
	KEY `TPoMTUntID` (`TTTMTTeTNo`),
	KEY `TTeTFee` (`TTTMFee`),
	KEY `TTeTNetTotal` (`TTTMNetTotal`),
	KEY `TTTMChequeStatus` (`TTTMCutMode`),
	KEY `TTTMChequeStatus1` (`TTTMMode`),
	KEY `TTTMFee` (`TTTMChequeStatus`),
	KEY `TTTMMode` (`TTTMValidDate`),
	KEY `TTTMValidDate` (`TTTMReconsignDate`),
	KEY `VS4TCompanyBankVS4TTeasuryTransMB` (`TTTMToTCBBNo`),
	KEY `VS4TCurrencyVS4TTeasuryTransMB` (`TTTMTCurCode`),
	KEY `VS4TTeasuryTransVS4TTeasuryTransMB` (`TTTMTTeTNo`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTimeInput` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTimeInput`;

# ---------- CREATE TABLE `VS4TTimeInput` ----------

CREATE TABLE `VS4TTimeInput` (
	`TTIPID` INT NOT NULL DEFAULT '0',
	`TTIPTHPfCode` VARCHAR(30) NULL,
	`TTIPType` SMALLINT NULL DEFAULT '0',
	`TTIPCode` VARCHAR(30) NULL,
	`TTIPBarCode` VARCHAR(30) NULL,
	`TTIPPeriod` SMALLINT NULL DEFAULT '0',
	`TTIPTime` DATETIME NULL,
	`TTIPFlag1` SMALLINT NULL DEFAULT '0',
	`TTIPFlag2` SMALLINT NULL DEFAULT '0',
	`TTIPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTIPID`),
	KEY `TTCKID` (`TTIPID`),
	KEY `TTCKTEmpCode` (`TTIPCode`),
	KEY `TTIPCode` (`TTIPBarCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTimeInputCode` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTimeInputCode`;

# ---------- CREATE TABLE `VS4TTimeInputCode` ----------

CREATE TABLE `VS4TTimeInputCode` (
	`TTICType` SMALLINT NOT NULL DEFAULT '0',
	`TTICCode` VARCHAR(30) NOT NULL,
	`TTICBarCode` VARCHAR(30) NULL,
	`TTICName` VARCHAR(160) NULL,
	`TTICFlag1` SMALLINT NULL DEFAULT '0',
	`TTICFlag2` SMALLINT NULL DEFAULT '0',
	`TTICFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTICType`, `TTICCode`),
	KEY `TTCKTEmpCode` (`TTICCode`),
	KEY `TTICCode` (`TTICBarCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTitle` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTitle`;

# ---------- CREATE TABLE `VS4TTitle` ----------

CREATE TABLE `VS4TTitle` (
	`TTtlID` INT NOT NULL DEFAULT '0',
	`TTtlName` VARCHAR(30) NULL,
	`TTtlName2` VARCHAR(30) NULL,
	`TTtlFlag1` SMALLINT NULL DEFAULT '0',
	`TTtlFlag2` SMALLINT NULL DEFAULT '0',
	`TTtlFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTtlID`),
	KEY `PositionID` (`TTtlID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTmpSelectSet` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTmpSelectSet`;

# ---------- CREATE TABLE `VS4TTmpSelectSet` ----------

CREATE TABLE `VS4TTmpSelectSet` (
	`TTSSID` INT NOT NULL DEFAULT '0',
	`TTSSTCmdID` INT NULL DEFAULT '0',
	`TTSSName` VARCHAR(50) NULL,
	`TTSSKeyType` SMALLINT NULL DEFAULT '0',
	`TTSSLinkKeyList` VARCHAR(100) NULL,
	`TTSSLinkTableType` SMALLINT NULL DEFAULT '0',
	`TTSSLinkTableName` VARCHAR(50) NULL,
	`TTSSOrder` VARCHAR(50) NULL,
	`TTSSUserID` INT NULL DEFAULT '0',
	`TTSSFlag1` SMALLINT NULL DEFAULT '0',
	`TTSSFlag2` SMALLINT NULL DEFAULT '0',
	`TTSSFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTSSID`),
	KEY `TmpSelectGroupID` (`TTSSID`),
	KEY `TTSSTTSGID` (`TTSSTCmdID`),
	KEY `TTSUserID` (`TTSSUserID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTmpSelectSetMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTmpSelectSetMB`;

# ---------- CREATE TABLE `VS4TTmpSelectSetMB` ----------

CREATE TABLE `VS4TTmpSelectSetMB` (
	`TTSMID` INT NOT NULL DEFAULT '0',
	`TTSMTSSID` INT NULL DEFAULT '0',
	`TTSMKeyID` INT NULL DEFAULT '0',
	`TTSMKeyID2` INT NULL DEFAULT '0',
	`TTSMKeyID3` INT NULL DEFAULT '0',
	`TTSMKeyCode` VARCHAR(30) NULL,
	`TTSMKeyCode2` VARCHAR(30) NULL,
	`TTSMKeyCode3` VARCHAR(30) NULL,
	`TTSMFlag1` SMALLINT NULL DEFAULT '0',
	`TTSMFlag2` SMALLINT NULL DEFAULT '0',
	`TTSMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTSMID`),
	KEY `TmpSelectGroupID` (`TTSMTSSID`),
	KEY `TmpSelectID` (`TTSMID`),
	KEY `TmpSelectLinkID` (`TTSMKeyID`),
	KEY `TTSMKeyID` (`TTSMKeyID2`),
	KEY `TTSMKeyID2` (`TTSMKeyID3`),
	KEY `VS4TTmpSelectSetVS4TTmpSelectSetMB` (`TTSMTSSID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTR` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTR`;

# ---------- CREATE TABLE `VS4TTR` ----------

CREATE TABLE `VS4TTR` (
	`TTRDNo` VARCHAR(30) NOT NULL,
	`TTRDTIBKCode` VARCHAR(30) NULL,
	`TTRDCode` VARCHAR(30) NULL,
	`TTRDType` SMALLINT NULL DEFAULT '0',
	`TTRDDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTRDRefNo` VARCHAR(30) NULL,
	`TTRDJobCode` VARCHAR(30) NULL,
	`TTRDTJobNo` VARCHAR(30) NULL,
	`TTRDTJbMLn` INT NULL DEFAULT '0',
	`TTRDTJPMLn` INT NULL DEFAULT '0',
	`TTRDTJPDNo` VARCHAR(30) NULL,
	`TTRDTPrjCode` VARCHAR(30) NULL,
	`TTRDTLctCode` VARCHAR(30) NULL,
	`TTRDTBraCode` VARCHAR(30) NULL,
	`TTRDDescription` VARCHAR(200) NULL,
	`TTRDProcessStatus` SMALLINT NULL DEFAULT '0',
	`TTRDDeliveryStatus` SMALLINT NULL DEFAULT '0',
	`TTRDRequestCode` VARCHAR(30) NULL,
	`TTRDRequestBy` VARCHAR(140) NULL,
	`TTRDCreateCode` VARCHAR(30) NULL,
	`TTRDCreateBy` VARCHAR(140) NULL,
	`TTRDCreateDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTRDEditCode` VARCHAR(30) NULL,
	`TTRDEditBy` VARCHAR(140) NULL,
	`TTRDEditDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTRDConfirmStatus` SMALLINT NULL DEFAULT '0',
	`TTRDConfirmBy` VARCHAR(140) NULL,
	`TTRDConfirmDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTRDApproveStatus` SMALLINT NULL DEFAULT '0',
	`TTRDApproveBy` VARCHAR(140) NULL,
	`TTRDApproveDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTRDApproveNote` VARCHAR(80) NULL,
	`TTRDRevision` SMALLINT NULL DEFAULT '0',
	`TTRDReviseStatus` SMALLINT NULL DEFAULT '0',
	`TTRDCancelStatus` SMALLINT NULL DEFAULT '0',
	`TTRDCancelNo` VARCHAR(30) NULL,
	`TTRDCancelBy` VARCHAR(140) NULL,
	`TTRDCancelDate` DATETIME NULL DEFAULT '3333-3-3',
	`TTRDCancelNote` VARCHAR(80) NULL,
	`TTRDFlag1` SMALLINT NULL DEFAULT '0',
	`TTRDFlag2` SMALLINT NULL DEFAULT '0',
	`TTRDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTRDNo`),
	KEY `TPCNTJbMLn` (`TTRDTJbMLn`),
	KEY `TPRDJobCode` (`TTRDJobCode`),
	KEY `TPRDTBokCode` (`TTRDTIBKCode`),
	KEY `TSODCode` (`TTRDCode`),
	KEY `TSTKTShfID` (`TTRDTJobNo`),
	KEY `TSTKTShfID1` (`TTRDTPrjCode`),
	KEY `TSTKTShfID2` (`TTRDTLctCode`),
	KEY `TTfrFromTLctCode` (`TTRDTBraCode`),
	KEY `TTfrFromTStoCode` (`TTRDRequestBy`),
	KEY `VS4TInventBookVS4TTR` (`TTRDTIBKCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTrainingCourse` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTrainingCourse`;

# ---------- CREATE TABLE `VS4TTrainingCourse` ----------

CREATE TABLE `VS4TTrainingCourse` (
	`TTrCCode` VARCHAR(30) NOT NULL,
	`TTrCName` VARCHAR(150) NULL,
	`TTrCName2` VARCHAR(150) NULL,
	`TTrCTTrGCode` VARCHAR(30) NULL,
	`TTrCType` SMALLINT NULL DEFAULT '0',
	`TTrCBudgets` DOUBLE NULL DEFAULT '0',
	`TTrCFee` DOUBLE NULL DEFAULT '0',
	`TTrCOtherCost` DOUBLE NULL DEFAULT '0',
	`TTrCTravel` DOUBLE NULL DEFAULT '0',
	`TTrCEmployCharge` DOUBLE NULL DEFAULT '0',
	`TTrCStartDate` DATETIME NULL,
	`TTrCEndDate` DATETIME NULL,
	`TTrCTotalDay` DOUBLE NULL DEFAULT '0',
	`TTrCTotalHour` DOUBLE NULL DEFAULT '0',
	`TTrCCustomText1` VARCHAR(50) NULL,
	`TTrCCustomText2` VARCHAR(50) NULL,
	`TTrCCustomValue1` DOUBLE NULL DEFAULT '0',
	`TTrCCustomValue2` DOUBLE NULL DEFAULT '0',
	`TTrCFlag1` SMALLINT NULL DEFAULT '0',
	`TTrCFlag2` SMALLINT NULL DEFAULT '0',
	`TTrCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTrCCode`),
	KEY `TETrCode` (`TTrCCode`),
	KEY `VS4TTrainingGroupVS4TTrainingCourse` (`TTrCTTrGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTrainingGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTrainingGroup`;

# ---------- CREATE TABLE `VS4TTrainingGroup` ----------

CREATE TABLE `VS4TTrainingGroup` (
	`TTrGCode` VARCHAR(30) NOT NULL,
	`TTrGName` VARCHAR(150) NULL,
	`TTrGName2` VARCHAR(150) NULL,
	`TTrGFlag1` SMALLINT NULL DEFAULT '0',
	`TTrGFlag2` SMALLINT NULL DEFAULT '0',
	`TTrGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTrGCode`),
	KEY `TETrCode` (`TTrGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TTRMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TTRMB`;

# ---------- CREATE TABLE `VS4TTRMB` ----------

CREATE TABLE `VS4TTRMB` (
	`TTRMTTRDNo` VARCHAR(30) NOT NULL,
	`TTRMLn` INT NOT NULL DEFAULT '0',
	`TTRMTPdtCode` VARCHAR(30) NULL,
	`TTRMRefill` DOUBLE NULL DEFAULT '0',
	`TTRMMarkTotal` DOUBLE NULL DEFAULT '0',
	`TTRMStockOnHand` DOUBLE NULL DEFAULT '0',
	`TTRMMinStock` DOUBLE NULL DEFAULT '0',
	`TTRMTRArrear` DOUBLE NULL DEFAULT '0',
	`TTRMSuggest` DOUBLE NULL DEFAULT '0',
	`TTRMQuantity` DOUBLE NULL DEFAULT '0',
	`TTRMTotalDelivery` DOUBLE NULL DEFAULT '0',
	`TTRMTotalArrear` DOUBLE NULL DEFAULT '0',
	`TTRMTUntCode` VARCHAR(15) NULL,
	`TTRMStockOnHand2` DOUBLE NULL DEFAULT '0',
	`TTRMQuantity2` DOUBLE NULL DEFAULT '0',
	`TTRMTotalDelivery2` DOUBLE NULL DEFAULT '0',
	`TTRMTotalArrear2` DOUBLE NULL DEFAULT '0',
	`TTRMTUntCode2` VARCHAR(15) NULL,
	`TTRMStockOnHand3` DOUBLE NULL DEFAULT '0',
	`TTRMQuantity3` DOUBLE NULL DEFAULT '0',
	`TTRMTotalDelivery3` DOUBLE NULL DEFAULT '0',
	`TTRMTotalArrear3` DOUBLE NULL DEFAULT '0',
	`TTRMTUntCode3` VARCHAR(15) NULL,
	`TTRMUseType` SMALLINT NULL DEFAULT '0',
	`TTRMUseDate` DATETIME NULL,
	`TTRMDescription` VARCHAR(150) NULL,
	`TTRMProcessStatus` SMALLINT NULL DEFAULT '0',
	`TTRMStatus` SMALLINT NULL DEFAULT '0',
	`TTRMFlag1` SMALLINT NULL DEFAULT '0',
	`TTRMFlag2` SMALLINT NULL DEFAULT '0',
	`TTRMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TTRMTTRDNo`, `TTRMLn`),
	KEY `TPRMTPdtCode` (`TTRMTPdtCode`),
	KEY `TPRMTUntCode2` (`TTRMTUntCode3`),
	KEY `TPWBID` (`TTRMLn`),
	KEY `TPWBTUntCode` (`TTRMTUntCode`),
	KEY `TPWBTUntCode1` (`TTRMTUntCode2`),
	KEY `TTfMID` (`TTRMTTRDNo`),
	KEY `VS4TProductVS4TTRMB` (`TTRMTPdtCode`),
	KEY `VS4TTRVS4TTRMB` (`TTRMTTRDNo`),
	KEY `VS4TUnitVS4TTRMB` (`TTRMTUntCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUnit` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUnit`;

# ---------- CREATE TABLE `VS4TUnit` ----------

CREATE TABLE `VS4TUnit` (
	`TUntCode` VARCHAR(15) NOT NULL,
	`TUntTUnGAlias` VARCHAR(30) NULL,
	`TUntName` VARCHAR(25) NULL,
	`TUntName2` VARCHAR(25) NULL,
	`TUntInSlip` VARCHAR(6) NULL,
	`TUntDecimal` SMALLINT NULL DEFAULT '1',
	`TUntSymbol` VARCHAR(2) NULL,
	`TUntMultiCode` VARCHAR(25) NULL,
	`TUntMultiCode2` VARCHAR(25) NULL,
	`TUntFactor` DOUBLE NULL,
	`TUntFlag1` SMALLINT NULL DEFAULT '0',
	`TUntFlag2` SMALLINT NULL DEFAULT '0',
	`TUntFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUntCode`),
	KEY `TPdUDocCode` (`TUntFactor`),
	KEY `TUntCode` (`TUntCode`),
	KEY `TUntTUnGID` (`TUntTUnGAlias`),
	KEY `VS4TUnitGroupVS4TUnit` (`TUntTUnGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUnitGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUnitGroup`;

# ---------- CREATE TABLE `VS4TUnitGroup` ----------

CREATE TABLE `VS4TUnitGroup` (
	`TUnGAlias` VARCHAR(30) NOT NULL,
	`TUnGName` VARCHAR(50) NULL,
	`TUnGFlag1` SMALLINT NULL DEFAULT '0',
	`TUnGFlag2` SMALLINT NULL DEFAULT '0',
	`TUnGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUnGAlias`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUnitTransfer` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUnitTransfer`;

# ---------- CREATE TABLE `VS4TUnitTransfer` ----------

CREATE TABLE `VS4TUnitTransfer` (
	`TUTRTUntCode` VARCHAR(30) NOT NULL,
	`TUTRToTUntCode` VARCHAR(15) NOT NULL,
	`TUTRRatio` DOUBLE NULL DEFAULT '1',
	`TUTRFlag1` SMALLINT NULL DEFAULT '0',
	`TUTRFlag2` SMALLINT NULL DEFAULT '0',
	`TUTRFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUTRTUntCode`, `TUTRToTUntCode`),
	KEY `SetSaleID` (`TUTRTUntCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUser` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUser`;

# ---------- CREATE TABLE `VS4TUser` ----------

CREATE TABLE `VS4TUser` (
	`TUsrID` INT NOT NULL DEFAULT '0',
	`TUsrName` VARCHAR(30) NULL,
	`TUsrPassword` VARCHAR(50) NULL,
	`TUsrTEmpCode` VARCHAR(30) NULL,
	`TUsrFullName` VARCHAR(160) NULL,
	`TUsrDescription` VARCHAR(255) NULL,
	`TUsrDisable` SMALLINT NULL DEFAULT '0',
	`TUsrMobile` VARCHAR(30) NULL,
	`TUsrSecurity` SMALLINT NULL DEFAULT '0',
	`TUsrLevel` SMALLINT NULL DEFAULT '0',
	`TUsrGroupware` VARCHAR(50) NULL,
	`TUsrOwner` INT NULL,
	`TUsrFlag1` SMALLINT NULL DEFAULT '0',
	`TUsrFlag2` SMALLINT NULL DEFAULT '0',
	`TUsrFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUsrID`),
	KEY `UserID` (`TUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUserAlert` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUserAlert`;

# ---------- CREATE TABLE `VS4TUserAlert` ----------

CREATE TABLE `VS4TUserAlert` (
	`TUsATUsrID` INT NOT NULL DEFAULT '0',
	`TUsATCmdID` INT NOT NULL DEFAULT '0',
	`TUsAOnUpdate` SMALLINT NULL,
	`TUsAOnConfirm` SMALLINT NULL,
	`TUsAOnApprove` SMALLINT NULL,
	`TUsAOnRevise` SMALLINT NULL,
	`TUsAOnVerify` SMALLINT NULL,
	`TUsAOnCancel` INT NULL DEFAULT '0',
	`TUsAFlag1` SMALLINT NULL DEFAULT '0',
	`TUsAFlag2` SMALLINT NULL DEFAULT '0',
	`TUsAFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUsATUsrID`, `TUsATCmdID`),
	KEY `TUsCTCmdID` (`TUsATCmdID`),
	KEY `TUsCTCmdID1` (`TUsAOnCancel`),
	KEY `TUsCTUsrID` (`TUsATUsrID`),
	KEY `VS4TCommandVS4TUserAlert` (`TUsATCmdID`),
	KEY `VS4TUserVS4TUserAlert` (`TUsATUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUserBranch` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUserBranch`;

# ---------- CREATE TABLE `VS4TUserBranch` ----------

CREATE TABLE `VS4TUserBranch` (
	`TUsBTUsrID` INT NOT NULL DEFAULT '0',
	`TUsBTBraCode` VARCHAR(30) NOT NULL,
	`TUsBTCmGAlias` VARCHAR(30) NOT NULL,
	`TUsBFlag1` SMALLINT NULL DEFAULT '0',
	`TUsBFlag2` SMALLINT NULL DEFAULT '0',
	`TUsBFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUsBTUsrID`, `TUsBTBraCode`, `TUsBTCmGAlias`),
	KEY `UserID` (`TUsBTUsrID`),
	KEY `VS4TBranchVS4TUserBranch` (`TUsBTBraCode`),
	KEY `VS4TUserVS4TUserBranch` (`TUsBTUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUserCommand` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUserCommand`;

# ---------- CREATE TABLE `VS4TUserCommand` ----------

CREATE TABLE `VS4TUserCommand` (
	`TUsCTUsrID` INT NOT NULL DEFAULT '0',
	`TUsCTCmdID` INT NOT NULL DEFAULT '0',
	`TUsCSort` INT NULL DEFAULT '0',
	`TUsCFlag1` SMALLINT NULL DEFAULT '0',
	`TUsCFlag2` SMALLINT NULL DEFAULT '0',
	`TUsCFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUsCTUsrID`, `TUsCTCmdID`),
	KEY `TUsCTCmdID` (`TUsCTCmdID`),
	KEY `TUsCTCmdID1` (`TUsCSort`),
	KEY `TUsCTUsrID` (`TUsCTUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUserEmployee` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUserEmployee`;

# ---------- CREATE TABLE `VS4TUserEmployee` ----------

CREATE TABLE `VS4TUserEmployee` (
	`TUsETUsrID` INT NOT NULL DEFAULT '0',
	`TUsETEmpCode` VARCHAR(30) NOT NULL,
	`TUsEFlag1` SMALLINT NULL DEFAULT '0',
	`TUsEFlag2` SMALLINT NULL DEFAULT '0',
	`TUsEFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUsETUsrID`, `TUsETEmpCode`),
	KEY `UserID` (`TUsETUsrID`),
	KEY `VS4TEmployeeVS4TUserEmployee` (`TUsETEmpCode`),
	KEY `VS4TUserVS4TUserEmployee` (`TUsETUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUserEmpType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUserEmpType`;

# ---------- CREATE TABLE `VS4TUserEmpType` ----------

CREATE TABLE `VS4TUserEmpType` (
	`TUETTUsrID` INT NOT NULL DEFAULT '0',
	`TUETTEmTCode` VARCHAR(30) NOT NULL,
	`TUETTCmGAlias` VARCHAR(30) NOT NULL,
	`TUETSalary` VARCHAR(50) NULL,
	`TUETFlag1` SMALLINT NULL DEFAULT '0',
	`TUETFlag2` SMALLINT NULL DEFAULT '0',
	`TUETFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUETTUsrID`, `TUETTEmTCode`, `TUETTCmGAlias`),
	KEY `UserID` (`TUETTUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TUserPermiss` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TUserPermiss`;

# ---------- CREATE TABLE `VS4TUserPermiss` ----------

CREATE TABLE `VS4TUserPermiss` (
	`TUsPTCmdID` INT NOT NULL DEFAULT '0',
	`TUsPTUsrID` INT NOT NULL DEFAULT '0',
	`TUsPDisplay` SMALLINT NULL DEFAULT '0',
	`TUsPDatabase` SMALLINT NULL DEFAULT '0',
	`TUsPExport` SMALLINT NULL DEFAULT '0',
	`TUsPPrint` SMALLINT NULL DEFAULT '0',
	`TUsPGrantPermiss` SMALLINT NULL DEFAULT '0',
	`TUsPPassword` VARCHAR(10) NULL,
	`TUsPFlag1` SMALLINT NULL DEFAULT '0',
	`TUsPFlag2` SMALLINT NULL DEFAULT '0',
	`TUsPFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TUsPTCmdID`, `TUsPTUsrID`),
	KEY `SubCommandCommandID` (`TUsPTCmdID`),
	KEY `TPerTUserTypeID` (`TUsPTUsrID`),
	KEY `VS4TUserVS4TUserPermiss` (`TUsPTUsrID`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TVAT30` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TVAT30`;

# ---------- CREATE TABLE `VS4TVAT30` ----------

CREATE TABLE `VS4TVAT30` (
	`TV30TTaxAlias` VARCHAR(30) NOT NULL,
	`TV30Year` INT NOT NULL DEFAULT '0',
	`TV30Month` INT NOT NULL DEFAULT '0',
	`TV30Ln` INT NOT NULL DEFAULT '0',
	`TV30TaxPeriodNo` VARCHAR(15) NULL,
	`TV30BaseAmount` FLOAT NULL DEFAULT '0',
	`TV30ExceptAmount` FLOAT NULL DEFAULT '0',
	`TV30ZeroAmount` FLOAT NULL DEFAULT '0',
	`TV30VATAmount` FLOAT NULL DEFAULT '0',
	`TV30PurchaseAmount` FLOAT NULL DEFAULT '0',
	`TV30VATPurAmount` FLOAT NULL DEFAULT '0',
	`TV30DifAmount` FLOAT NULL DEFAULT '0',
	`TV30DifAmountBal` FLOAT NULL DEFAULT '0',
	`TV30NetAmount` FLOAT NULL DEFAULT '0',
	`TV30OtherFee` FLOAT NULL DEFAULT '0',
	`TV30NetPayment` FLOAT NULL DEFAULT '0',
	`TV30DifAmountEnd` FLOAT NULL DEFAULT '0',
	`TV30Flag1` SMALLINT NULL DEFAULT '0',
	`TV30Flag2` SMALLINT NULL DEFAULT '0',
	`TV30Flag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TV30TTaxAlias`, `TV30Year`, `TV30Month`, `TV30Ln`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TVehicle` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TVehicle`;

# ---------- CREATE TABLE `VS4TVehicle` ----------

CREATE TABLE `VS4TVehicle` (
	`TVehCode` VARCHAR(30) NOT NULL,
	`TVehLicenseNo` VARCHAR(10) NULL,
	`TVehTotalSeat` SMALLINT NULL DEFAULT '0',
	`TVehType` SMALLINT NULL DEFAULT '0',
	`TVehDriverName` VARCHAR(160) NULL,
	`TVehDriverTel` VARCHAR(50) NULL,
	`TVehTVeTCode` VARCHAR(30) NULL,
	`TVehNote` VARCHAR(100) NULL,
	`TVehFlag1` SMALLINT NULL DEFAULT '0',
	`TVehFlag2` SMALLINT NULL DEFAULT '0',
	`TVehFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TVehCode`),
	KEY `TVehCode` (`TVehCode`),
	KEY `VS4TVehicleTypeVS4TVehicle` (`TVehTVeTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TVehicleRate` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TVehicleRate`;

# ---------- CREATE TABLE `VS4TVehicleRate` ----------

CREATE TABLE `VS4TVehicleRate` (
	`TVeRType` INT NOT NULL DEFAULT '0',
	`TVeRTVeTCode` VARCHAR(30) NOT NULL,
	`TVeRFromQuantity` INT NOT NULL DEFAULT '0',
	`TVerRate1` FLOAT NULL DEFAULT '0',
	`TVerRate2` FLOAT NULL DEFAULT '0',
	`TVerRate3` FLOAT NULL DEFAULT '0',
	`TVerFlag1` SMALLINT NULL DEFAULT '0',
	`TVerFlag2` SMALLINT NULL DEFAULT '0',
	`TVerFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TVeRTVeTCode`, `TVeRFromQuantity`, `TVeRType`),
	KEY `TVeRTVeTCode` (`TVeRTVeTCode`),
	KEY `VS4TVehicleTypeVS4TVehicleRate` (`TVeRTVeTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TVehicleType` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TVehicleType`;

# ---------- CREATE TABLE `VS4TVehicleType` ----------

CREATE TABLE `VS4TVehicleType` (
	`TVeTCode` VARCHAR(30) NOT NULL,
	`TVeTName` VARCHAR(50) NULL,
	`TVeTName2` VARCHAR(50) NULL,
	`TVeTFlag1` SMALLINT NULL DEFAULT '0',
	`TVeTFlag2` SMALLINT NULL DEFAULT '0',
	`TVeTFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TVeTCode`),
	KEY `TVeTCode` (`TVeTCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TWarehouse` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TWarehouse`;

# ---------- CREATE TABLE `VS4TWarehouse` ----------

CREATE TABLE `VS4TWarehouse` (
	`TWahCode` VARCHAR(30) NOT NULL,
	`TWahName` VARCHAR(50) NULL,
	`TWahName2` VARCHAR(50) NULL,
	`TWahSystem` SMALLINT NULL DEFAULT '0',
	`TWahFlag1` SMALLINT NULL DEFAULT '0',
	`TWahFlag2` SMALLINT NULL DEFAULT '0',
	`TWahFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TWahCode`),
	KEY `TShfCode` (`TWahCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TWelfare` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TWelfare`;

# ---------- CREATE TABLE `VS4TWelfare` ----------

CREATE TABLE `VS4TWelfare` (
	`TWelCode` VARCHAR(30) NOT NULL,
	`TWelName` VARCHAR(150) NULL,
	`TWelName2` VARCHAR(150) NULL,
	`TWelTWfGCode` VARCHAR(30) NULL,
	`TWelTAmyCode` VARCHAR(30) NULL,
	`TWelSide` SMALLINT NULL DEFAULT '0',
	`TWelType` SMALLINT NULL DEFAULT '0',
	`TWelFee` DOUBLE NULL DEFAULT '0',
	`TWelOtherCost` DOUBLE NULL DEFAULT '0',
	`TWelOfficeRate` DOUBLE NULL DEFAULT '0',
	`TWelOfficePay` DOUBLE NULL DEFAULT '0',
	`TWelEmployeeRate` DOUBLE NULL DEFAULT '0',
	`TWelEmployeePay` DOUBLE NULL DEFAULT '0',
	`TWelStartDate` DOUBLE NULL DEFAULT '0',
	`TWelEndDate` DOUBLE NULL DEFAULT '0',
	`TWelCustomText1` VARCHAR(50) NULL,
	`TWelCustomText2` VARCHAR(50) NULL,
	`TWelCustomValue1` DOUBLE NULL DEFAULT '0',
	`TWelCustomValue2` DOUBLE NULL DEFAULT '0',
	`TWelFlag1` SMALLINT NULL DEFAULT '0',
	`TWelFlag2` SMALLINT NULL DEFAULT '0',
	`TWelFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TWelCode`),
	KEY `TETrCode` (`TWelCode`),
	KEY `TWelTAmyCode` (`TWelTAmyCode`),
	KEY `VS4TEmpAddMoneyVS4TWelfare` (`TWelTAmyCode`),
	KEY `VS4TWelfareGroupVS4TWelfare` (`TWelTWfGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TWelfareGroup` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TWelfareGroup`;

# ---------- CREATE TABLE `VS4TWelfareGroup` ----------

CREATE TABLE `VS4TWelfareGroup` (
	`TWfGCode` VARCHAR(30) NOT NULL,
	`TWfGName` VARCHAR(150) NULL,
	`TWfGName2` VARCHAR(150) NULL,
	`TWfGFlag1` SMALLINT NULL DEFAULT '0',
	`TWfGFlag2` SMALLINT NULL DEFAULT '0',
	`TWfGFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TWfGCode`),
	KEY `TETrCode` (`TWfGCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TWorkflow` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TWorkflow`;

# ---------- CREATE TABLE `VS4TWorkflow` ----------

CREATE TABLE `VS4TWorkflow` (
	`TWFWCode` VARCHAR(30) NOT NULL,
	`TWFWDocType` VARCHAR(5) NULL,
	`TWFWName` VARCHAR(100) NULL,
	`TWFWName2` VARCHAR(100) NULL,
	`TWFWFlag1` SMALLINT NULL DEFAULT '0',
	`TWFWFlag2` SMALLINT NULL DEFAULT '0',
	`TWFWFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TWFWCode`),
	UNIQUE KEY `VS4TWorkflowMBVS4TWorkflow` (`TWFWCode`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TWorkflowData` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TWorkflowData`;

# ---------- CREATE TABLE `VS4TWorkflowData` ----------

CREATE TABLE `VS4TWorkflowData` (
	`TWFDDocNo` VARCHAR(30) NOT NULL,
	`TWFDTWFMTWFWCode` VARCHAR(30) NOT NULL,
	`TWFDTWFMLn` INT NOT NULL,
	`TWFDDocType` VARCHAR(5) NULL,
	`TWFDStatus` SMALLINT NULL DEFAULT '0',
	`TWFDFirstDate` DATETIME NULL,
	`TWFDStatusDate` DATETIME NULL,
	`TWFDNote` VARCHAR(100) NULL,
	`TWFDFlag1` SMALLINT NULL DEFAULT '0',
	`TWFDFlag2` SMALLINT NULL DEFAULT '0',
	`TWFDFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TWFDDocNo`, `TWFDTWFMTWFWCode`, `TWFDTWFMLn`),
	KEY `TWFDTWFMTWFWCode` (`TWFDTWFMTWFWCode`),
	KEY `VS4TWorkflowMBVS4TWorkflowData` (`TWFDTWFMTWFWCode`, `TWFDTWFMLn`)
) TYPE=InnoDB;

# ---------- DROP TABLE `VS4TWorkflowMB` BEFORE (RE)CREATION ----------

DROP TABLE IF EXISTS `VS4TWorkflowMB`;

# ---------- CREATE TABLE `VS4TWorkflowMB` ----------

CREATE TABLE `VS4TWorkflowMB` (
	`TWFMTWFWCode` VARCHAR(30) NOT NULL,
	`TWFMLn` INT NOT NULL,
	`TWFMSubject` VARCHAR(100) NULL,
	`TWFMNote` VARCHAR(255) NULL,
	`TWFMType` SMALLINT NULL,
	`TWFMCond1` VARCHAR(10) NULL,
	`TWFMCondValue1` DOUBLE NULL DEFAULT '0',
	`TWFMCond2` VARCHAR(10) NULL,
	`TWFMCondValue2` DOUBLE NULL DEFAULT '0',
	`TWFMActionGOTO` SMALLINT NULL,
	`TWFMRejectGOTO` SMALLINT NULL,
	`TWFMExpireGOTO` SMALLINT NULL,
	`TWFMIsEnd` SMALLINT NULL DEFAULT '0',
	`TWFMFlag1` SMALLINT NULL DEFAULT '0',
	`TWFMFlag2` SMALLINT NULL DEFAULT '0',
	`TWFMFlag3` SMALLINT NULL DEFAULT '0',
	PRIMARY KEY (`TWFMTWFWCode`, `TWFMLn`),
	UNIQUE KEY `TWFWCode` (`TWFMTWFWCode`)
) TYPE=InnoDB;

# ---------- END OF IMPORT FROM `D:\MyPrgs\Vision4\BizSol1\DataSample\DataRC\Data\VS4Database.mdb` ----------
