/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCCIT_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DG_B105037_SUM') 
 CREATE TABLE T_TCCIT_DG_B105037_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FTZBDNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FINVESTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCYSYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FMSSRJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTZSSYHJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPAYERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FQDDBTZZC DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINCOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FNUMORRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLABEL BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DG_B105038_DET') 
 CREATE TABLE T_TCCIT_DG_B105038_DET (
FID BIGINT DEFAULT 0 NOT NULL,
FTAXACCOUNTSERIALNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FSUBJECTID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTABLE BIGINT DEFAULT 0 NOT NULL,
FAMOUNTFIELD BIGINT DEFAULT 0 NOT NULL,
FTABLETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATATYPE BIGINT DEFAULT 0 NOT NULL,
FDATADIRECTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFETCHAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFILTERCONDITION VARCHAR(2000) DEFAULT ' ' NOT NULL,
FRULEID BIGINT DEFAULT 0 NOT NULL,
FENTRYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FABSOLUTE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DG_B105038_SUM') 
 CREATE TABLE T_TCCIT_DG_B105038_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FZZJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSSYHBL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSSYHJE DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DG_B105036_SUM') 
 CREATE TABLE T_TCCIT_DG_B105036_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FINVESTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXPAYERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FNUMORRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINCOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTRANSTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FXSMSYHDJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTZMSJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTZHDMSYHJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTZBDNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FCZSHCSTZCB DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCZQDZCZCG DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLJWFPLR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQDDBTZZC DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCZJSTZBL VARCHAR(50) DEFAULT ' ' NOT NULL,
FLEBEL BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_SOFT_IC_QTZB') 
 CREATE TABLE T_TCCIT_SOFT_IC_QTZB (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FZBZ DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNAME VARCHAR(200) DEFAULT ' ' NOT NULL,
FCDTITLE VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_SOFT_IC_QYYH') 
 CREATE TABLE T_TCCIT_SOFT_IC_QYYH (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(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,
FORGID BIGINT DEFAULT 0 NOT NULL,
FYEAR DATETIME,
FBNYPJZGZRS BIGINT DEFAULT 0 NOT NULL,
FJYDXZKYSXLZGRS BIGINT DEFAULT 0 NOT NULL,
FYJKFRYRS BIGINT DEFAULT 0 NOT NULL,
FYFFYZE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FJNYFFYJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQYSRZE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFHTJDXSSR DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_GOVDEFER_MIDD' AND KSQL_COL_NAME ='FBILLSTATUS') 
 ALTER TABLE T_TCCIT_GOVDEFER_MIDD ADD (FBILLSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_NOTTACC_MIDD' AND KSQL_COL_NAME ='FBILLSTATUS') 
 ALTER TABLE T_TCCIT_NOTTACC_MIDD ADD (FBILLSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL );

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