/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCCIT_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_POLICY_A' AND KSQL_COL_NAME ='FASSETEXPENSE') 
 ALTER TABLE T_TCCIT_POLICY_A ADD (FASSETEXPENSE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_ZCTZ_EXPENSE_DET') 
 CREATE TABLE T_TCCIT_ZCTZ_EXPENSE_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(36) 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,2) DEFAULT 0 NOT NULL,
FFETCHAMOUNT DECIMAL(23,2) DEFAULT 0 NOT NULL,
FFILTERCONDITION VARCHAR(255) 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
);


 EXEC p_AlterColumn 'T_TCCIT_INVEST_CYSY_ENT', 'FMSSRJE', 'DECIMAL(23,10)', 'NOT NULL', '0011', '0';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DEV_JJKC') 
 CREATE TABLE T_TCCIT_DEV_JJKC (
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,
FKXSSL BIGINT DEFAULT 0 NOT NULL,
FNOTE VARCHAR(20) DEFAULT ' ' NOT NULL,
FZZYFHJJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWTYFHJJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYXKCDYFFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNDYFFYJJKCZE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRYRGFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZJTRFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZJFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWXZCTXFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FXCPSJFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTXGFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FXETZHQTXGFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZJCSYFRYGZXJ DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZJCSYFRYWXYJ DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWPYFRYDLWFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYFHDZJXHCLFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYFHDZJXHRLFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYFHDZJXHDLFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMJGYZBKFZZF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBGCZCYPYJYBCSSDGZF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYYSZCPDJYF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYQSBWHTZJYWXDFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZRDYFHDYQSBZLF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDYQDZJF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDSBDZJF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRJDTXFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZLQDTXFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFZLJSDTXFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FXCPSJF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FXGYGCZDF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FXYYZDLCSYF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FKTKFJSDXCSYF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZLFFYFZXFBXF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYFCGFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZSCQSQZCDLF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZGFLBCYLBCYL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCLFHYF DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DEV_JJKC_A') 
 CREATE TABLE T_TCCIT_DEV_JJKC_A (
FID BIGINT DEFAULT 0 NOT NULL,
FWTJNJGHGRYFFSFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWTJWJGYFFSDFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYXJJKCDJWJGYFFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWTJWGRYFFSDFY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNDYFFYXJ DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNFYHJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNZBHJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNXCWXZCTXE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYQNDXCWXZCBNTXE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FXKCDTSSR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYXKCYFFYDJTSSR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDNXSYFZJXCCPDCLBF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYQXSYFZJXCCPDCLBF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FJJKCBL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FXSYFHDXCCPYHNDKJ DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_ZCTZ_EXPENSE_SUM') 
 CREATE TABLE T_TCCIT_ZCTZ_EXPENSE_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO BIGINT DEFAULT 0 NOT NULL,
FITEMTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FRULEID BIGINT DEFAULT 0 NOT NULL,
FZZJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNSTZJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_HZDG_TSSXTZ_SUM') 
 CREATE TABLE T_TCCIT_HZDG_TSSXTZ_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_SEFT_FZJG_ENTRY') 
 CREATE TABLE T_TCCIT_SEFT_FZJG_ENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FYYSR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZGXC DECIMAL(23,10) DEFAULT 0 NOT NULL,
FZCZE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFPBL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFPSDSE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTYSHXYDM VARCHAR(50) DEFAULT ' ' NOT NULL,
FFZJGMC VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMNO VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_SEFT_FZJG_SUM') 
 CREATE TABLE T_TCCIT_SEFT_FZJG_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FFZJGDYDYNSSDSE DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_SEFT_HZNSQY_SUM') 
 CREATE TABLE T_TCCIT_SEFT_HZNSQY_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNTORRATIO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_JMSD_MIDD_APITUDE') 
 CREATE TABLE T_TCCIT_JMSD_MIDD_APITUDE (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMNAME VARCHAR(200) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FSUMAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPARENTCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCODE VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_SEASONAL_POLICY' AND KSQL_COL_NAME ='FSUITTYPE') 
 ALTER TABLE T_TCCIT_SEASONAL_POLICY ADD (FSUITTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_NONTAX_SUMMARY_M') 
 CREATE TABLE T_TCCIT_NONTAX_SUMMARY_M (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FNONTAXTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRULENAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FDISCOUNTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FRULEID BIGINT DEFAULT 0 NOT NULL
);



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