/**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_ITEM_ENTRY' AND KSQL_COL_NAME ='FADVANCEDCONF') 
 ALTER TABLE T_TCCIT_ITEM_ENTRY ADD (FADVANCEDCONF NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_ITEM_ENTRY' AND KSQL_COL_NAME ='FADVANCEDCONFJSON') 
 ALTER TABLE T_TCCIT_ITEM_ENTRY ADD (FADVANCEDCONFJSON NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_DEPRECIATE_ACCOUN' AND KSQL_COL_NAME ='FADVANCEDCONF') 
 ALTER TABLE T_TCCIT_DEPRECIATE_ACCOUN ADD (FADVANCEDCONF NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_DEPRECIATE_ACCOUN' AND KSQL_COL_NAME ='FADVANCEDCONFJSON') 
 ALTER TABLE T_TCCIT_DEPRECIATE_ACCOUN ADD (FADVANCEDCONFJSON NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_DEPRECIATE_NORMAL' AND KSQL_COL_NAME ='FADVANCEDCONF') 
 ALTER TABLE T_TCCIT_DEPRECIATE_NORMAL ADD (FADVANCEDCONF NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_DEPRECIATE_NORMAL' AND KSQL_COL_NAME ='FADVANCEDCONFJSON') 
 ALTER TABLE T_TCCIT_DEPRECIATE_NORMAL ADD (FADVANCEDCONFJSON NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_DEPRECIATE_QUICK' AND KSQL_COL_NAME ='FADVANCEDCONF') 
 ALTER TABLE T_TCCIT_DEPRECIATE_QUICK ADD (FADVANCEDCONF NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_DEPRECIATE_QUICK' AND KSQL_COL_NAME ='FADVANCEDCONFJSON') 
 ALTER TABLE T_TCCIT_DEPRECIATE_QUICK ADD (FADVANCEDCONFJSON NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_ITEM_FETCHENTRY' AND KSQL_COL_NAME ='FADVANCEDCONF') 
 ALTER TABLE T_TCCIT_ITEM_FETCHENTRY ADD (FADVANCEDCONF NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_ITEM_FETCHENTRY' AND KSQL_COL_NAME ='FADVANCEDCONFJSON') 
 ALTER TABLE T_TCCIT_ITEM_FETCHENTRY ADD (FADVANCEDCONFJSON NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_PROFITS_ITEMS') 
 CREATE TABLE T_TCCIT_PROFITS_ITEMS (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FRULETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FITEMID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_PROFITS_ITEMS_L') 
 CREATE TABLE T_TCCIT_PROFITS_ITEMS_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_PROFITS_ENTRY') 
 CREATE TABLE T_TCCIT_PROFITS_ENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDATADIRECTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATATYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FFCONDITIONJSON NCLOB,
FFILTERCONDITION NCLOB,
FAMOUNTFIELD BIGINT DEFAULT 0 NOT NULL,
FTABLE BIGINT DEFAULT 0 NOT NULL,
FABSOLUTE CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DEPRECIATE_ORIGIN') 
 CREATE TABLE T_TCCIT_DEPRECIATE_ORIGIN (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FTABLE BIGINT DEFAULT 0 NOT NULL,
FAMOUNTFIELD BIGINT DEFAULT 0 NOT NULL,
FABSOLUTE CHAR(1) DEFAULT '0' NOT NULL,
FDATATYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATADIRECTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FFILTERCONDITION NCLOB,
FCONDITIONJSON NCLOB,
FADVANCEDCONF NCLOB,
FADVANCEDCONFJSON NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_YJ_PROFITS_ACCDET') 
 CREATE TABLE T_TCCIT_YJ_PROFITS_ACCDET (
FID BIGINT DEFAULT 0 NOT NULL,
FTAXACCOUNTSERIALNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FTAXORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FBIZNAME 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(255) 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 '0' NOT NULL
);


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

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