/**Begin D:\PDM_UPGRADE\PDM1\BEI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FRECFILE')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FRECFILE NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_TRANSDETAIL_FILEREG') 
 CREATE TABLE T_BEI_TRANSDETAIL_FILEREG (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS NVARCHAR(5) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FREQUESTID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FACCOUNTBANKID BIGINT DEFAULT 0 NOT NULL,
FCOUNT INT DEFAULT 0 NOT NULL,
FDEBITAMOUNTTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCREDITAMOUNTTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURRENCYTOTALID BIGINT DEFAULT 0 NOT NULL,
FACCOUNTVALIDATE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_TRANSDETAILFR_ENTRY')
 CREATE TABLE T_BEI_TRANSDETAILFR_ENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDEBITAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCREDITAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTRANSBALANCE DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_TRANSDETAIL_FLOG')
 CREATE TABLE T_BEI_TRANSDETAIL_FLOG (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS NVARCHAR(5) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FREQUESTID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FFILENAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFILEURL NVARCHAR(255) DEFAULT ' ' NOT NULL,
FIMPORTTIME DATETIME
);


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


/**Begin D:\PDM_UPGRADE\PDM1\BEI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_OCRBANKSTATE_SET')
 CREATE TABLE T_BEI_OCRBANKSTATE_SET (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FENABLEDATE DATETIME,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FKEYWORD NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEXECLASSPATH NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_OCRBANKSTATE_SET_L')
 CREATE TABLE T_BEI_OCRBANKSTATE_SET_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);



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

/**Begin D:\PDM_UPGRADE\PDM1\BEI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAILFR_ENTRY' AND KSQL_COL_NAME IN ('FSUBSUM'))
 ALTER TABLE T_BEI_TRANSDETAILFR_ENTRY ADD (FSUBSUM NVARCHAR(1) DEFAULT ' ' NOT NULL );

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