/**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_APITUDEINFOSBB') 
 CREATE TABLE T_TCCIT_APITUDEINFOSBB (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FAPITUDETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FEXPORTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCOMPANYTYPE BIGINT DEFAULT 0 NOT NULL,
FCREDITRATING VARCHAR(50) DEFAULT ' ' NOT NULL,
FWORKERTOTAL BIGINT DEFAULT 0 NOT NULL,
FPROFITMYEAR VARCHAR(50) DEFAULT ' ' NOT NULL,
FANNUALCOME VARCHAR(50) DEFAULT ' ' NOT NULL,
FPROFITTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSOCIETYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSOCIETYTOTAL BIGINT DEFAULT 0 NOT NULL,
FYXSY CHAR(1) DEFAULT ' ' NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_POLICY_ORGSSBB') 
 CREATE TABLE T_TCCIT_POLICY_ORGSSBB (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FDECLARATION VARCHAR(50) DEFAULT ' ' NOT NULL,
FSHAREID CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_POLICYSBB') 
 CREATE TABLE T_TCCIT_POLICYSBB (
FID BIGINT DEFAULT 0 NOT NULL,
FENDDATE DATETIME,
FSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSTARTDATE DATETIME,
FREGISTERTYPE BIGINT DEFAULT 0 NOT NULL,
FACCOUNTCRITERION BIGINT DEFAULT 0 NOT NULL,
FDECLARETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCODEANDNAME BIGINT DEFAULT 0 NOT NULL,
FILLEGAL VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_GETRE_DETAIL' AND KSQL_COL_NAME ='FMONTH') 
 ALTER TABLE T_TCCIT_GETRE_DETAIL ADD (FMONTH VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_TECHTRANS_ACCDET') 
 CREATE TABLE T_TCCIT_TECHTRANS_ACCDET (
FID BIGINT DEFAULT 0 NOT NULL,
FTAXACCOUNTSERIALNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
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
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_TECHTRANS_SUMMARY') 
 CREATE TABLE T_TCCIT_TECHTRANS_SUMMARY (
FID BIGINT DEFAULT 0 NOT NULL,
FSERIALNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FRULEID BIGINT DEFAULT 0 NOT NULL,
FDISCOUNTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FINCREDPRESENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINCREDTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FITEMTYPEID BIGINT DEFAULT 0 NOT NULL
);


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


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

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