/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_BALANCEINVCALSTEP') 
 CREATE TABLE T_IM_BALANCEINVCALSTEP (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FIMPLCLASS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTEP BIGINT DEFAULT 0 NOT NULL,
FCALCTYPE CHAR(1) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_BALANCEINVLOGENTRY') 
 CREATE TABLE T_IM_BALANCEINVLOGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCALSTEPID BIGINT DEFAULT 0 NOT NULL,
FPROCESSDATA NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTEPTIMESPAN NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTEPRESULT CHAR(1) DEFAULT ' ' NOT NULL,
FDETAILMSG NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDETAILMSG_TAG NCLOB
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_BALANCEINVLOG') 
 CREATE TABLE T_IM_BALANCEINVLOG (
FID BIGINT DEFAULT 0 NOT NULL,
FBALANCEORGID BIGINT DEFAULT 0 NOT NULL,
FSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FCALCNUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FSTARTTIME DATETIME,
FENDTIME DATETIME,
FTIMESPAN NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATEDATE DATETIME,
FEXECUTEIP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPROCESSRATE BIGINT DEFAULT 0 NOT NULL
);



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