/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCTB_table.sql **/
/**IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCVAT_NSRXX') 
 CREATE TABLE T_TCVAT_NSRXX (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FNSRSBH VARCHAR(100) DEFAULT ' ' NOT NULL,
FNSRMC VARCHAR(100) DEFAULT ' ' NOT NULL,
FNSRTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FTEMPLATEID VARCHAR(100) DEFAULT ' ' NOT NULL,
FORGID VARCHAR(100) DEFAULT ' ' NOT NULL,
FDECLARESTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FEWBLXH VARCHAR(30) DEFAULT ' ' NOT NULL,
FSSHYMC VARCHAR(100) DEFAULT ' ' NOT NULL,
FFDDBRXM VARCHAR(300) DEFAULT ' ' NOT NULL,
FZCDZ VARCHAR(600) DEFAULT ' ' NOT NULL,
FSCJYDZ VARCHAR(600) DEFAULT ' ' NOT NULL,
FYHZH VARCHAR(100) DEFAULT ' ' NOT NULL,
FKHYH VARCHAR(100) DEFAULT ' ' NOT NULL,
FREGISTERTYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FPHONENUM VARCHAR(100) DEFAULT ' ' NOT NULL,
FBQYBTSE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYSSR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FBILLNO VARCHAR(300) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL
);**/


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_DECLARE_HIS') 
 CREATE TABLE T_TCTB_DECLARE_HIS (
FID BIGINT DEFAULT 0 NOT NULL,
FCELLID VARCHAR(100) DEFAULT ' ' NOT NULL,
FSBBID VARCHAR(100) DEFAULT ' ' NOT NULL,
FTARGETVALUE VARCHAR(100) DEFAULT ' ' NOT NULL,
FREMARK VARCHAR(100) DEFAULT ' ' NOT NULL,
FMODIFYTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FORIGINALVALUE VARCHAR(100) DEFAULT ' ' NOT NULL,
FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATEFIELD DATETIME
);

/**
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_FORMULA') 
 CREATE TABLE T_TCTB_FORMULA (
FID BIGINT DEFAULT 0 NOT NULL,
FFORMULAKEY VARCHAR(200) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(200) DEFAULT ' ' NOT NULL,
FFORMULA VARCHAR(4000) DEFAULT ' ' NOT NULL,
FFORMULANAME VARCHAR(4000) DEFAULT ' ' NOT NULL,
FDESCRIBE VARCHAR(200) DEFAULT ' ' NOT NULL,
FTEMPLATEID VARCHAR(100) DEFAULT ' ' NOT NULL,
FTABLE VARCHAR(100) DEFAULT ' ' NOT NULL,
FROW VARCHAR(100) DEFAULT ' ' NOT NULL,
FCOLUMN VARCHAR(100) DEFAULT ' ' NOT NULL,
FTAXTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FFORMULATYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FTITLE VARCHAR(100) DEFAULT ' ' NOT NULL,
FCONTENT VARCHAR(500) DEFAULT ' ' NOT NULL
);**/


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_TEMPLATE') 
 CREATE TABLE T_TCTB_TEMPLATE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FCONTENT VARCHAR(510) DEFAULT ' ' NOT NULL,
FCONTENT_TAG NCLOB,
FHTML VARCHAR(510) DEFAULT ' ' NOT NULL,
FHTML_TAG NCLOB,
FUPDATETIME DATETIME
);

/**
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_TEMPLATE_TYPE') 
 CREATE TABLE T_TCTB_TEMPLATE_TYPE (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FMAINTABLE VARCHAR(100) DEFAULT ' ' NOT NULL,
FUNIQUETYPE VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_TEMPLATE_TYPE_DET') 
 CREATE TABLE T_TCTB_TEMPLATE_TYPE_DET (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTRYID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FENTITYID VARCHAR(100) DEFAULT ' ' NOT NULL,
FENTITYNAME VARCHAR(100) DEFAULT ' ' NOT NULL
);
**/


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_INVOICE_SETTING') 
 CREATE TABLE T_TCTB_INVOICE_SETTING (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(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,
FORG BIGINT DEFAULT 0 NOT NULL,
FURL VARCHAR(100) DEFAULT ' ' NOT NULL,
FCLIENTID VARCHAR(100) DEFAULT ' ' NOT NULL,
FSECRET VARCHAR(100) DEFAULT ' ' NOT NULL,
FPASSWORD VARCHAR(100) DEFAULT ' ' NOT NULL
);



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