/**Begin D:\PDM_UPGRADE\PDM1\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVCASEENTITY') 
 CREATE TABLE T_BCM_INVCASEENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FDESCRIPTION NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FCHANGETYPE VARCHAR(5) DEFAULT ' ' NOT NULL,
FCATALOGID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FSCENARIOID BIGINT DEFAULT 0 NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FSPREADJSON NCLOB,
FDATA NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVCASEENTITY_L') 
 CREATE TABLE T_BCM_INVCASEENTITY_L (
FPKID VARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVCASEDISTRIBUTE') 
 CREATE TABLE T_BCM_INVCASEDISTRIBUTE (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCSLSCHEME BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVCASEENTRY') 
 CREATE TABLE T_BCM_INVCASEENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FINVCHANGECASE BIGINT DEFAULT 0 NOT NULL,
FSORT INT DEFAULT 0 NOT NULL,
FCOMPUTETYPE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVDIMENTRY') 
 CREATE TABLE T_BCM_INVDIMENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FMEMBID BIGINT DEFAULT 0 NOT NULL,
FDIMID BIGINT DEFAULT 0 NOT NULL,
FMEMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FISSRC CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVCASEPAGEDIM') 
 CREATE TABLE T_BCM_INVCASEPAGEDIM (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FYEARID BIGINT DEFAULT 0 NOT NULL,
FPERIODID BIGINT DEFAULT 0 NOT NULL,
FSCENARIOID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCASEID BIGINT DEFAULT 0 NOT NULL,
FSOURCETYPE CHAR(1) DEFAULT '1' NOT NULL,
FTARPERIODID BIGINT DEFAULT 0 NOT NULL,
FTARORGID BIGINT DEFAULT 0 NOT NULL,
FTARPARENTORG BIGINT DEFAULT 0 NOT NULL,
FTARORGNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT '3' NOT NULL,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVHANDLELOG') 
 CREATE TABLE T_BCM_INVHANDLELOG (
FID BIGINT DEFAULT 0 NOT NULL,
FCASEPAGEDIMID BIGINT DEFAULT 0 NOT NULL,
FCASEID BIGINT DEFAULT 0 NOT NULL,
FSTATUS CHAR(1) DEFAULT '1' NOT NULL,
FREASON NCLOB,
FUSER BIGINT DEFAULT 0 NOT NULL,
FHANDLEDATE DATETIME,
FBEGINTIME DATETIME,
FENDTIME DATETIME,
FCOSTTIME BIGINT DEFAULT 0 NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\BCM_table.sql **/
