/**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_DEV_JJKC_DET') 
 CREATE TABLE T_TCCIT_DEV_JJKC_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,
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_DEV_JJKC_SUM') 
 CREATE TABLE T_TCCIT_DEV_JJKC_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,
FORIGINALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_YH_TAXCREDIT_DATA') 
 CREATE TABLE T_TCCIT_YH_TAXCREDIT_DATA (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FND VARCHAR(50) DEFAULT ' ' NOT NULL,
FBNDMQYNSE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNYXDMDZYSBTZE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FKDMSE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQWNDDME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQSINDDME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQSNDDME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQENDDME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQYNDDME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FXJ DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNSJDMDGNDSE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FKJZYHNDDMDSE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBNKDMSE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FITEMNO BIGINT DEFAULT 0 NOT NULL,
FSJDMAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYNAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_YH_TAXCREDIT_DET') 
 CREATE TABLE T_TCCIT_YH_TAXCREDIT_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,
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_YH_TAXCREDIT_SUM') 
 CREATE TABLE T_TCCIT_YH_TAXCREDIT_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,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FRULEID BIGINT DEFAULT 0 NOT NULL,
FTAXAMOUNT 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_JMYHHZ_SUMMARY') 
 CREATE TABLE T_TCCIT_JMYHHZ_SUMMARY (
FID BIGINT DEFAULT 0 NOT NULL,
FITEMNO BIGINT DEFAULT 0 NOT NULL,
FSKSSQZ DATETIME,
FSKSSQQ DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FFTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFTSDE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FJMRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FJMSE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCOMPANYTYPE BIGINT DEFAULT 0 NOT NULL,
FTAXORG BIGINT DEFAULT 0 NOT NULL,
FTAXORGNAME VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_POLICY_A' AND KSQL_COL_NAME ='FTAXCREDIT') 
 ALTER TABLE T_TCCIT_POLICY_A ADD (FTAXCREDIT 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 ='FYHSX5') 
 ALTER TABLE T_TCCIT_POLICY_A ADD (FYHSX5 CHAR(1) DEFAULT ' ' NOT NULL );

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