/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_DEPOSIT_ACCESS') 
 CREATE TABLE T_TM_DEPOSIT_ACCESS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FACCTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCDATE DATETIME,
FACCAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACCREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_DEPOSIT_RATE') 
 CREATE TABLE T_TM_DEPOSIT_RATE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FRATEEFFDATE DATETIME,
FINTAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FADDPOINT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREFINDEXID BIGINT DEFAULT 0 NOT NULL,
FHOOKTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTHROUGHTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FHOOKCURRENCY BIGINT DEFAULT 0 NOT NULL,
FHOOKUPRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHOOKDOWNRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHOOKRATESOURCE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FHOOKUPFOREX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHOOKDOWNFOREX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHOOKFOREXSOURCE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FUPRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDOWNRATE DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_C') 
 CREATE TABLE T_TM_TRADE_C (
FID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FRATETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBANKACCT BIGINT DEFAULT 0 NOT NULL,
FFEE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFIRSTCOUPON DATETIME,
FRESETFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FINTDATEADJMETHOD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMARKETID BIGINT DEFAULT 0 NOT NULL,
FINTFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FINTERVALRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEPOSITTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FINTDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE') 
 CREATE TABLE T_TM_TRADE (
FID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FENABLE NVARCHAR(30) DEFAULT '1' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FPROTECTTYPEID BIGINT DEFAULT 0 NOT NULL,
FCONTRACTNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCONTRACTNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FDATEADJUSTMETHOD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FADJUSTSETTLEDATE DATETIME,
FCOUNTERPARTYID BIGINT DEFAULT 0 NOT NULL,
FSETTLEDATE DATETIME,
FSETTLEDELAY BIGINT DEFAULT 0 NOT NULL,
FCONTRACTSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FREFERDATE DATETIME,
FPRICERULEID BIGINT DEFAULT 0 NOT NULL,
FPORTFOLIOID BIGINT DEFAULT 0 NOT NULL,
FTRADEDIRECT NVARCHAR(30) DEFAULT ' ' NOT NULL,
FFINASSETTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSOURCE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSOURCEBILLID BIGINT DEFAULT 0 NOT NULL,
FISLOCKCASHFLOW CHAR(1) DEFAULT '0' NOT NULL,
FCOMPOSEAUDIT CHAR(1) DEFAULT '0' NOT NULL,
FCOMPOSENO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBASIS NVARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_L') 
 CREATE TABLE T_TM_TRADE_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FDESC NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_SWC') 
 CREATE TABLE T_TM_TRADE_SWC (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_WC') 
 CREATE TABLE T_TM_TRADE_WC (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_LOWRISK') 
 CREATE TABLE T_TM_LOWRISK (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FFOREXQUOTEID BIGINT DEFAULT 0 NOT NULL,
FEXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFWBUYEXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFWSELLEXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOPPCOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FINFLOW DECIMAL(19,6) DEFAULT 0 NOT NULL,
FOUTFLOW DECIMAL(19,6) DEFAULT 0 NOT NULL,
FFRINFLOW DECIMAL(19,6) DEFAULT 0 NOT NULL,
FFROUTFLOW DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCOSTLOST DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINCOME DECIMAL(19,6) DEFAULT 0 NOT NULL,
FYIELD DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_LOWRISK_ENTRYS') 
 CREATE TABLE T_TM_LOWRISK_ENTRYS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FTRADEBILLID BIGINT DEFAULT 0 NOT NULL,
FTRADEBILLENTITY NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTRADEBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTRADEBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FCONTRACTNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCOUNTERPARTYID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDIRECTION NVARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_LOWRISK_L') 
 CREATE TABLE T_TM_LOWRISK_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_OPTIONCOMB') 
 CREATE TABLE T_TM_OPTIONCOMB (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCONTRACTNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCONTRACTNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBIZDATE DATETIME,
FASSETTYPE NVARCHAR(80) DEFAULT ' ' NOT NULL,
FASSET NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FMARKETID BIGINT DEFAULT 0 NOT NULL,
FPV DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDELTA DECIMAL(19,6) DEFAULT 0 NOT NULL,
FGAMMA DECIMAL(19,6) DEFAULT 0 NOT NULL,
FVEGA DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTHETA DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICERULEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_OPTIONCOMB_ENTRY') 
 CREATE TABLE T_TM_OPTIONCOMB_ENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTRADENO BIGINT DEFAULT 0 NOT NULL,
FOPTIONTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTRIKEPRICE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FNAMEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTRADENUM NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPREMIUM DECIMAL(19,6) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_STRUCTDEPOSIT_O') 
 CREATE TABLE T_TM_STRUCTDEPOSIT_O (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FOBSDATE DATETIME,
FOBSSYSTIME DATETIME,
FISOBSFINISH CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_STRUCTDEPOSIT_WC') 
 CREATE TABLE T_TM_STRUCTDEPOSIT_WC (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_STRUCTDEPOSIT_Z') 
 CREATE TABLE T_TM_STRUCTDEPOSIT_Z (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBWSYMBOLID BIGINT DEFAULT 0 NOT NULL,
FPRICEX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICEY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOBSTACLE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_D') 
 CREATE TABLE T_TM_TRADE_D (
FID BIGINT DEFAULT 0 NOT NULL,
FMARKETID BIGINT DEFAULT 0 NOT NULL,
FINTDATE DATETIME,
FHOOKTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FHOOKMARK NVARCHAR(80) DEFAULT ' ' NOT NULL,
FMARKPRICE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMARKTIME BIGINT DEFAULT 0 NOT NULL,
FMARKZONEID BIGINT DEFAULT 0 NOT NULL,
FPRICEMETHOD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FINITIALPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREDEEMTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPREDICTMARK DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPREDICTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFIRSTOBSDATE DATETIME,
FOBSFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FLASTOBSDATE DATETIME,
FDATEADJUSTMETHOD2 NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISSTOPOBS CHAR(1) DEFAULT ' ' NOT NULL,
FDISPLAYFORM NVARCHAR(30) DEFAULT ' ' NOT NULL,
FREDEEMDATE DATETIME,
FTERM NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTRUCTTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FFIRSTBREAKDATE DATETIME,
FZONEOBSDATE DATETIME,
FDAYTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_R') 
 CREATE TABLE T_TM_TRADE_R (
FID BIGINT DEFAULT 0 NOT NULL,
FBUYPV DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBUYDELTA DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSELLPV DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSELLDELTA DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPV DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDELTA DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FSWAPTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISMARKET CHAR(1) DEFAULT ' ' NOT NULL,
FCONTRACTRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FPREMCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FPREMIUM DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FPREMIUMDATE DATETIME,
FSINGLEVOLATILITYUP DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FSINGLEVOLATILITYDOWN DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FCURVALUE_DOWN DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURVALUE_UP DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FCONTRACTREFERID BIGINT DEFAULT 0 NOT NULL,
FPERCENTAMT_UP DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FPERCENTAMT_DOWN DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISSINGLE CHAR(1) DEFAULT ' ' NOT NULL,
FMARKETID BIGINT DEFAULT 0 NOT NULL,
FRESETOFFSET BIGINT DEFAULT 0 NOT NULL,
FLOANPERIOD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FFRAPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYRULE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FADJUSTENDDATE DATETIME,
FRATERESETOFFSET BIGINT DEFAULT 0 NOT NULL,
FFRA NVARCHAR(30) DEFAULT ' ' NOT NULL,
FREFERINDEXID BIGINT DEFAULT 0 NOT NULL,
FINTERPINDEXID BIGINT DEFAULT 0 NOT NULL,
FRESETFREQUENCY NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDELTA_DOWN DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRESETTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FVEGA DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVEGA_DOWN DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_S') 
 CREATE TABLE T_TM_TRADE_S (
FID BIGINT DEFAULT 0 NOT NULL,
FSWAPTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FINITPRIEXTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FENDPRIEXTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTERM NVARCHAR(30) DEFAULT ' ' NOT NULL,
FENDADJMETHOD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FADJUSTEDENDDATE DATETIME,
FRATETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMARKETID BIGINT DEFAULT 0 NOT NULL,
FINITEXAMOUNT DECIMAL(23,10) DEFAULT 0.00000000 NOT NULL,
FENDEXAMOUNT DECIMAL(23,10) DEFAULT 0.00000000 NOT NULL,
FVALUEDATE DATETIME,
FFIXEDRATE DECIMAL(23,10) DEFAULT 0.00000000 NOT NULL,
FPAYTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYFREQUENCY NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYDATETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDISCOUNT CHAR(1) DEFAULT ' ' NOT NULL,
FDELAY INT DEFAULT 0 NOT NULL,
FREFINDEXID BIGINT DEFAULT 0 NOT NULL,
FRATEMARGIN DECIMAL(23,10) DEFAULT 0.00000000 NOT NULL,
FRATERESETTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRATEQUOTAFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRATERESETFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBEFOREINITDATE DATETIME,
FRATEADJUSTMETHOD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRATERESETOFFSET BIGINT DEFAULT 0 NOT NULL,
FFIRSTFIXEDDATE DATETIME,
FFIRSTFIXEDRATE DECIMAL(23,10) DEFAULT 0.00000000 NOT NULL,
FSTUB CHAR(1) DEFAULT ' ' NOT NULL,
FSTUBTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FFIRSTPAYCOPDATE DATETIME,
FFIRSTREFERRATE BIGINT DEFAULT 0 NOT NULL,
FPENUPAYCOPDATE DATETIME,
FPENUREFERRATE BIGINT DEFAULT 0 NOT NULL,
FNOMINALRATE DECIMAL(23,10) DEFAULT 0.00000000 NOT NULL,
FCURRENTRATE1 DECIMAL(23,10) DEFAULT 0.00000000 NOT NULL,
FCURRENTRATE2 DECIMAL(23,10) DEFAULT 0.00000000 NOT NULL,
FCURRENTRATE3 DECIMAL(23,10) DEFAULT 0.00000000 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_P') 
 CREATE TABLE T_TM_TRADE_P (
FID BIGINT DEFAULT 0 NOT NULL,
FISBUYSETTLE CHAR(1) DEFAULT '0' NOT NULL,
FPAYSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FPAYBANKACCTID BIGINT DEFAULT 0 NOT NULL,
FPAYBANKID BIGINT DEFAULT 0 NOT NULL,
FOPPPAYBANKACCT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPPPAYBANKID BIGINT DEFAULT 0 NOT NULL,
FBUYSETTLEDATE DATETIME,
FBUYSETTLEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRECSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FRECBANKACCTID BIGINT DEFAULT 0 NOT NULL,
FRECBANKID BIGINT DEFAULT 0 NOT NULL,
FOPPRECBANKACCT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPPRECBANKID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_O') 
 CREATE TABLE T_TM_TRADE_O (
FID BIGINT DEFAULT 0 NOT NULL,
FEXDATE DATETIME,
FOPTIONSETTLEOFFSET DATETIME,
FOPTIONSETTLEDATE DATETIME,
FBONDTRADETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOPTIONTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPREMIUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEXPIREADJMETHOD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FEXPIREDATE DATETIME,
FADJEXPIREDATE DATETIME,
FPREMIUMDATE DATETIME,
FPREMCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FISSPECRATE CHAR(1) DEFAULT ' ' NOT NULL,
FVOLATILITY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISSPECVOL CHAR(1) DEFAULT ' ' NOT NULL,
FEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCALCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FCALCULATEPV DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPVPERCENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPVCENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHEDGEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCALVOL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHEDGERATIO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVEGA DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCALTHETA DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDELTA DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGAMMA DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURRENCYPAIR NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPTIONNUM INT DEFAULT 0 NOT NULL,
FFIRSTEXEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_F') 
 CREATE TABLE T_TM_TRADE_F (
FID BIGINT DEFAULT 0 NOT NULL,
FTRADETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDELIVERYWAY NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBUYMARKETID BIGINT DEFAULT 0 NOT NULL,
FFXQUOTE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSPOTRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFORWRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FSELLCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FSELLMARKETID BIGINT DEFAULT 0 NOT NULL,
FSELLAMOUNT DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FFIXEDDATE DATETIME,
FREFERRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FBUYNALAMT DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FSETTLECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FSELLNALAMT DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FSETTLEAMT DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FSETTLEAMTPV DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FPIPS DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FLENDRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FBORROWRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FBUYAMTPV DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FSELLAMTPV DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FREFERRATE_END NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTERM NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSETTLERATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFORWARDPIPS DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FMATURITYRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FDEPOSITRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FSETTLEDATE_FAR DATETIME,
FADJSETTLEDATE_FAR DATETIME,
FBUYCURRENCY_FAR BIGINT DEFAULT 0 NOT NULL,
FBUYMARKET_FAR BIGINT DEFAULT 0 NOT NULL,
FBUYAMOUNT_FAR DECIMAL(19,6) DEFAULT 0 NOT NULL,
FFXQUOTE_FAR NVARCHAR(80) DEFAULT ' ' NOT NULL,
FEXCHANGERATE_FAR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSELLCURRENCY_FAR BIGINT DEFAULT 0 NOT NULL,
FSELLMARKET_FAR BIGINT DEFAULT 0 NOT NULL,
FSELLAMOUNT_FAR DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTERM_FAR NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDEFERRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEYNUM INT DEFAULT 0 NOT NULL,
FDEFERNUM INT DEFAULT 0 NOT NULL,
FISCFGRATE CHAR(1) DEFAULT '0' NOT NULL,
FDEFERSETTLEDATE DATETIME,
FVALIDBUYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FVALIDSELLAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FFLATNUM INT DEFAULT 0 NOT NULL,
FISNEARDEY INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_CASHFLOW') 
 CREATE TABLE T_TM_CASHFLOW (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYAMOUNT DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FDISCFACTOR DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FPV DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FTHETA DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FPID BIGINT DEFAULT 0 NOT NULL,
FPAYDATE DATETIME,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FINTEREST DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FAMORTIZATION DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FPRINCIPAL DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FOSPRINCIPAL DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FANNUITY DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FEXCHANGERATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FDEALRIVAL BIGINT DEFAULT 0 NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FUNADJPAYDATE DATETIME,
FPAYFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPROTECTTYPEID BIGINT DEFAULT 0 NOT NULL,
FDIRECTION NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FISPAY CHAR(1) DEFAULT '0' NOT NULL,
FISEXCFG CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_CASHFLOW_BAK') 
 CREATE TABLE T_TM_CASHFLOW_BAK (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYAMOUNT DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FDISCFACTOR DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FPV DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FTHETA DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FPID BIGINT DEFAULT 0 NOT NULL,
FPAYDATE DATETIME,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FINTEREST DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FAMORTIZATION DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FPRINCIPAL DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FOSPRINCIPAL DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FANNUITY DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FEXCHANGERATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FDEALRIVAL BIGINT DEFAULT 0 NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FUNADJPAYDATE DATETIME,
FPAYFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPROTECTTYPEID BIGINT DEFAULT 0 NOT NULL,
FDIRECTION NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FISPAY CHAR(1) DEFAULT '0' NOT NULL,
FISEXCFG CHAR(1) DEFAULT '0' NOT NULL,
FBIZBILLID BIGINT DEFAULT 0 NOT NULL,
FUSEDID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_CASHFLOW_ENTRYS') 
 CREATE TABLE T_TM_CASHFLOW_ENTRYS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FRATEFIXDATE DATETIME,
FRESETPAYDATE DATETIME,
FUNADJSTARTDATE DATETIME,
FADJSTARTDATE DATETIME,
FUNADJENDDATE DATETIME,
FADJENDDATE DATETIME,
FISADJUST CHAR(1) DEFAULT ' ' NOT NULL,
FPERIODDAYS BIGINT DEFAULT 0 NOT NULL,
FNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISCAPPED CHAR(1) DEFAULT ' ' NOT NULL,
FCAP DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FISFLOORED CHAR(1) DEFAULT ' ' NOT NULL,
FFLOORED DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FRATEMULT DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FUSERATEMULT CHAR(1) DEFAULT ' ' NOT NULL,
FRATECONST DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FBASIS VARCHAR(30) DEFAULT ' ' NOT NULL,
FRATEMARGIN DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFIXRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FRESETPREDICTRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FUSERATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FMARGINAMT DECIMAL(19,4) DEFAULT 0.0000000000 NOT NULL,
FSTRIKEPRICE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FISBARRIER CHAR(1) DEFAULT ' ' NOT NULL,
FBARRIERUPDOWN NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBARRIERUPLEVEL NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBARRIERDOWNLEVEL NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBARRIERINOROUT NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRESETFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRATEFIXINDEXID BIGINT DEFAULT 0 NOT NULL,
FRATEFIXINSERTINDEXID BIGINT DEFAULT 0 NOT NULL,
FINDEXBASIS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISRATECFG CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_CASHFLOW_ENTRYS_BAK') 
 CREATE TABLE T_TM_CASHFLOW_ENTRYS_BAK (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FRATEFIXDATE DATETIME,
FRESETPAYDATE DATETIME,
FUNADJSTARTDATE DATETIME,
FADJSTARTDATE DATETIME,
FUNADJENDDATE DATETIME,
FADJENDDATE DATETIME,
FISADJUST CHAR(1) DEFAULT ' ' NOT NULL,
FPERIODDAYS BIGINT DEFAULT 0 NOT NULL,
FNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISCAPPED CHAR(1) DEFAULT ' ' NOT NULL,
FCAP DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FISFLOORED CHAR(1) DEFAULT ' ' NOT NULL,
FFLOORED DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FRATEMULT DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FUSERATEMULT CHAR(1) DEFAULT ' ' NOT NULL,
FRATECONST DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FBASIS VARCHAR(30) DEFAULT ' ' NOT NULL,
FRATEMARGIN DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFIXRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FRESETPREDICTRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FUSERATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FMARGINAMT DECIMAL(19,4) DEFAULT 0.0000000000 NOT NULL,
FSTRIKEPRICE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FISBARRIER CHAR(1) DEFAULT ' ' NOT NULL,
FBARRIERUPDOWN NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBARRIERUPLEVEL NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBARRIERDOWNLEVEL NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBARRIERINOROUT NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRESETFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRATEFIXINDEXID BIGINT DEFAULT 0 NOT NULL,
FRATEFIXINSERTINDEXID BIGINT DEFAULT 0 NOT NULL,
FINDEXBASIS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISRATECFG CHAR(1) DEFAULT '0' NOT NULL,
FUSEDENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_BUSINESSBILL') 
 CREATE TABLE T_TM_BUSINESSBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBIZDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FOPERATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FEXRATEDEY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPIPS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEXECEXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBILLTYPE BIGINT DEFAULT 0 NOT NULL,
FTRADEBILLID BIGINT DEFAULT 0 NOT NULL,
FPAYBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FRECBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROTECTTYPEID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FRESTAMT1 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBIZAMT1 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRESTAMT2 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBIZAMT2 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEXRATECALMTD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPLCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FPLAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEFQ NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBASEEXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEPLAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPLSETTLEDATE DATETIME,
FDELIVERYDATE DATETIME,
FBIZRECORDID BIGINT DEFAULT 0 NOT NULL,
FEXPIREDDATE DATETIME,
FEXPIREDSTART DATETIME,
FEXPIREDEND DATETIME,
FDEYDATESTART DATETIME,
FDEYDATEEND DATETIME,
FISDATERANGE CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_BUSINESSBILL_E') 
 CREATE TABLE T_TM_BUSINESSBILL_E (
FID BIGINT DEFAULT 0 NOT NULL,
FPAYSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FPAYCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FPAYBANKACCTID BIGINT DEFAULT 0 NOT NULL,
FPAYBANKID BIGINT DEFAULT 0 NOT NULL,
FOPPPAYBANKACCT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPPPAYBANK BIGINT DEFAULT 0 NOT NULL,
FRECSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FRECCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FRECBANKACCTID BIGINT DEFAULT 0 NOT NULL,
FRECBANKID BIGINT DEFAULT 0 NOT NULL,
FOPPRECBANKACCT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPPRECBANK BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_BUSINESSBILL_L') 
 CREATE TABLE T_TM_BUSINESSBILL_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FDESC NVARCHAR(255) DEFAULT ' ' NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_TRADE_B') 
 CREATE TABLE T_TM_TRADE_B (
FID BIGINT DEFAULT 0 NOT NULL,
FBONDISSUEID BIGINT DEFAULT 0 NOT NULL,
FTRADEMARKET NVARCHAR(30) DEFAULT ' ' NOT NULL,
FYEARRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FHYEARRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FSEASONRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FMONTHRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FCLEANPRICE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFULLPRICE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFULLPRINCIPAL DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FACCRUAL DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FTOTALPROCEEDS DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FCLEANPRICE4SHOW DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFULLPRICE4SHOW DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FDCFM DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FCDPRICE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FCDPDCFM DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FCURCOUPON DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFUNDSRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FASSUMEDLIBOR DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FRUNNINGACCRUAL DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FMARKETPRICE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFWDCLEANPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFWDFULLPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFWDYIELD DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSTRIKECLEANPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSTRIKEFULLPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSTRIKEYIELD DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVOLSURFACE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSPECIFIEDVOL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICEVOL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPV DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FPVPERCENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHEDGERATIO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDELTA DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FGAMMA DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FTHETA DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FDELTAPERCENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGAMMAPERCENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVEGA DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVEGAPERCENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTHETAPERCENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMARKETID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_BONDISSUE') 
 CREATE TABLE T_TM_BONDISSUE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FDESC NVARCHAR(255),
FBIZTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FMARKETID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FCOUNTERPARTYID BIGINT DEFAULT 0 NOT NULL,
FMATURITYDATE DATETIME,
FTRADINGOFFSET BIGINT DEFAULT 0 NOT NULL,
FUNITISSUEVALUE DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FTOTALISSUEAMT DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FCOUPONRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FPAYFREQ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACTIVERED NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDUALPAYTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDUALCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FDUALMARKETID BIGINT DEFAULT 0 NOT NULL,
FFXRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FTERM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FACCRUALBASIS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCRUALADJUSTMENT NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCRUEFROM DATETIME,
FACCRUALEXDIVMETHOD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FEXDIVDAYS BIGINT DEFAULT 0 NOT NULL,
FDAYSTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCOUPONMONTHEND CHAR(1) DEFAULT ' ' NOT NULL,
FCOUPONBASIS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FADJUSTMETHOD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBONDQUOTETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBONDPRICETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FYIELDBASIS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISSUEPRICE DECIMAL(19,6) DEFAULT 0.0000000000 NOT NULL,
FPRICERULEID BIGINT DEFAULT 0 NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FPROTECTTYPEID BIGINT DEFAULT 0 NOT NULL,
FISMARK CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_BONDISSUE_E') 
 CREATE TABLE T_TM_BONDISSUE_E (
FID BIGINT DEFAULT 0 NOT NULL,
FISSTUB CHAR(1) DEFAULT ' ' NOT NULL,
FSTUBTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FFIRSTCOUPON DATETIME,
FPENUCOUPON DATETIME,
FISANNUITY CHAR(1) DEFAULT ' ' NOT NULL,
FMATURITYAMT DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FAMTPERPAYMENT DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FCALCULATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISAMORT2ACCRET CHAR(1) DEFAULT ' ' NOT NULL,
FAMORT2ACCRET NVARCHAR(30) DEFAULT ' ' NOT NULL,
FA2ATYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FAMT4AA DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FAMTPER4AA DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FPCTPER4AA DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FFREQ4AA NVARCHAR(30) DEFAULT ' ' NOT NULL,
FFIRSTDATE4AA DATETIME,
FLASTDATE4AA DATETIME,
FFIRSTINTERPINDEXID BIGINT DEFAULT 0 NOT NULL,
FPENUINTERPINDEXID BIGINT DEFAULT 0 NOT NULL,
FFIRSTINDEXID BIGINT DEFAULT 0 NOT NULL,
FPENUINDEXID BIGINT DEFAULT 0 NOT NULL,
FREFERINDEXID BIGINT DEFAULT 0 NOT NULL,
FRATEMARGIN DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FRATERESETOFFSET INT DEFAULT 0 NOT NULL,
FFIRSTFIXING DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FISRANGEHIGH CHAR(1) DEFAULT ' ' NOT NULL,
FRANGEHIGH DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FISRANGELOW CHAR(1) DEFAULT ' ' NOT NULL,
FRANGELOW DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FISRATEMULT CHAR(1) DEFAULT ' ' NOT NULL,
FRATEMULT DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FRATECONST DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_BONDISSUE_ENTRYS') 
 CREATE TABLE T_TM_BONDISSUE_ENTRYS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FEXDATE DATETIME,
FNOTICEDAY BIGINT DEFAULT 0 NOT NULL,
FPAYDATE DATETIME,
FEXPRICE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FNOTICEDATE DATETIME,
FEXERCISED CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_BONDISSUE_INDEXWC') 
 CREATE TABLE T_TM_BONDISSUE_INDEXWC (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_BONDISSUE_L') 
 CREATE TABLE T_TM_BONDISSUE_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_BONDISSUE_WC') 
 CREATE TABLE T_TM_BONDISSUE_WC (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_APPHOME_ENTRY') 
 CREATE TABLE T_TM_APPHOME_ENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPROJECTCONDITION NCLOB,
FPROJECTTYPE BIGINT DEFAULT 0 NOT NULL,
FCONDITIONNUMBER NCLOB,
FENTITY NVARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_APPHOME_SETTING') 
 CREATE TABLE T_TM_APPHOME_SETTING (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FPROJECTDEFAULT CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_APPHOME_SETTING_L') 
 CREATE TABLE T_TM_APPHOME_SETTING_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPROJECTNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TM_table.sql **/
