/**Begin D:\PDM_UPGRADE\PDM1\BEI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_UPDATEPAYSTAT_ENTRY' AND KSQL_COL_NAME IN ('FERRMSG'))
 ALTER TABLE T_BEI_UPDATEPAYSTAT_ENTRY ADD (FERRMSG NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG' AND KSQL_COL_NAME IN ('FPAYTOTALAMT'))
 ALTER TABLE T_BEI_BANKLOG ADD (FPAYTOTALAMT DECIMAL(19,6) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG' AND KSQL_COL_NAME IN ('FPAYCURRENCYID'))
 ALTER TABLE T_BEI_BANKLOG ADD (FPAYCURRENCYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG_H' AND KSQL_COL_NAME IN ('FPAYTOTALAMT'))
 ALTER TABLE T_BEI_BANKLOG_H ADD (FPAYTOTALAMT DECIMAL(19,6) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG_H' AND KSQL_COL_NAME IN ('FPAYCURRENCYID'))
 ALTER TABLE T_BEI_BANKLOG_H ADD (FPAYCURRENCYID BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_BANKLOGENTRY')
 CREATE TABLE T_BEI_BANKLOGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBILLORGID BIGINT DEFAULT 0 NOT NULL,
FBANKLOGTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLTYPEID NVARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FBILLNUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL,
FACCTBANKID BIGINT DEFAULT 0 NOT NULL,
FPAYBILLTYPEID NVARCHAR(60) DEFAULT ' ' NOT NULL,
FPAYBILLID BIGINT DEFAULT 0 NOT NULL,
FBANKPAYSTATE NVARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_BANKLOGENTRY_H')
 CREATE TABLE T_BEI_BANKLOGENTRY_H (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBILLORGID BIGINT DEFAULT 0 NOT NULL,
FBANKLOGTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLTYPEID NVARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FBILLNUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL,
FACCTBANKID BIGINT DEFAULT 0 NOT NULL,
FPAYBILLTYPEID NVARCHAR(60) DEFAULT ' ' NOT NULL,
FPAYBILLID BIGINT DEFAULT 0 NOT NULL,
FBANKPAYSTATE NVARCHAR(30) DEFAULT ' ' NOT NULL
);


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