/**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_A301010201_DEVE') 
 CREATE TABLE T_TCCIT_A301010201_DEVE (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FDEVELOPTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCURRYEAR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPREONEYEAR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRETWOYEAR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_A301010201_LEVEL') 
 CREATE TABLE T_TCCIT_A301010201_LEVEL (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FLEVELTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FLEVELDESC VARCHAR(50) DEFAULT ' ' NOT NULL
);


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


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_POLICY_SHAREHOLD') 
 CREATE TABLE T_TCCIT_POLICY_SHAREHOLD (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FGDNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FIDNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FINVESTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURRYEARDIVIDEND DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNATIONALITY BIGINT DEFAULT 0 NOT NULL,
FFIDTYPE VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_POLICY_A' AND KSQL_COL_NAME ='FDEDUCTWAY') 
 ALTER TABLE T_TCCIT_POLICY_A ADD (FDEDUCTWAY VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_POLICY_A' AND KSQL_COL_NAME ='FSOFTTYPE') 
 ALTER TABLE T_TCCIT_POLICY_A ADD (FSOFTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_POLICY_A' AND KSQL_COL_NAME ='FMBKSTYPE') 
 ALTER TABLE T_TCCIT_POLICY_A ADD (FMBKSTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_POLICY_A' AND KSQL_COL_NAME ='FSELECTALL') 
 ALTER TABLE T_TCCIT_POLICY_A ADD (FSELECTALL CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_POLICY_A' AND KSQL_COL_NAME ='FCURRYEARDIVIDENDSUM') 
 ALTER TABLE T_TCCIT_POLICY_A ADD (FCURRYEARDIVIDENDSUM DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_POLICY_A' AND KSQL_COL_NAME ='FDKSSZBJTZ') 
 ALTER TABLE T_TCCIT_POLICY_A ADD (FDKSSZBJTZ CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_SPEC_DKSS_TZ_DETA') 
 CREATE TABLE T_TCCIT_SPEC_DKSS_TZ_DETA (
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,10) DEFAULT 0 NOT NULL,
FFETCHAMOUNT DECIMAL(23,10) 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
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DKSSZBJ_SUMMARY') 
 CREATE TABLE T_TCCIT_DKSSZBJ_SUMMARY (
FID BIGINT DEFAULT 0 NOT NULL,
FEWBLXH VARCHAR(50) DEFAULT ' ' NOT NULL,
FEWBLNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSNMDKYE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNMDKYE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSNMSSZBJYE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNMSSZBJYE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSNMDKZCYE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNMDKZCYE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FJTBL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FJSZBJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDKSSZBJYE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDKSSZBJ DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNSTZJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSBBID VARCHAR(50) DEFAULT ' ' NOT NULL
);


 EXEC p_AlterColumn 'T_TCCIT_QYSDS_A106000', 'FQSNDYNBE', 'VARCHAR(30)', 'NOT NULL', '1111', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DG_A100000_1_DET') 
 CREATE TABLE T_TCCIT_DG_A100000_1_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,
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_A100000_1_SUM') 
 CREATE TABLE T_TCCIT_DG_A100000_1_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO BIGINT DEFAULT 0 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_DG_A101020_DET') 
 CREATE TABLE T_TCCIT_DG_A101020_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,
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_A101020_SUM') 
 CREATE TABLE T_TCCIT_DG_A101020_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO BIGINT DEFAULT 0 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_DG_A102020_DET') 
 CREATE TABLE T_TCCIT_DG_A102020_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,
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_A102020_SUM') 
 CREATE TABLE T_TCCIT_DG_A102020_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO BIGINT DEFAULT 0 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_DG_A103000_DET') 
 CREATE TABLE T_TCCIT_DG_A103000_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,
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_A103000_SUM') 
 CREATE TABLE T_TCCIT_DG_A103000_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO BIGINT DEFAULT 0 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_QYCZJDYNS_SUM') 
 CREATE TABLE T_TCCIT_QYCZJDYNS_SUM (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FYBSWCLZZJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTSCZLX VARCHAR(200) DEFAULT ' ' NOT NULL,
FYBSWCLSSJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYBSWCLNSTZJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTSSWCLZZJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTSSWCLSSJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTSSWCLNSTZJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNSTZHJJE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FRULEID BIGINT DEFAULT 0 NOT NULL,
FTSCZLXNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_QYCZJDYNS_TZ_DET') 
 CREATE TABLE T_TCCIT_QYCZJDYNS_TZ_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,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,
FITEMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FABSOLUTE CHAR(1) DEFAULT ' ' NOT NULL
);



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