/**Begin D:\PDM_UPGRADE\PDM1\BEI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_ELECSTATEMENT_B') 
 CREATE TABLE T_BEI_ELECSTATEMENT_B (
FID BIGINT DEFAULT 0 NOT NULL,
FISBALANCESTATE CHAR(1) DEFAULT '0' NOT NULL,
FBANKTYPEID BIGINT DEFAULT 0 NOT NULL,
FPROTOCOL NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATENO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFEEDBACKSTATE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBANKRETURNMSG NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFEEDBACKPERSON BIGINT DEFAULT 0 NOT NULL,
FFEEDBACKTIME DATETIME,
FMATCHRESULT NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_ORGPROTOCOL')
 CREATE TABLE T_BEI_ORGPROTOCOL (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) 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,
FBANKTYPEID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FACCOUNTORGID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_ORGPROTOCOL_L')
 CREATE TABLE T_BEI_ORGPROTOCOL_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(30) 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_BANKPAYINGBILL' AND KSQL_COL_NAME IN ('FPAYBILLCREATOR'))
ALTER TABLE T_BEI_BANKPAYINGBILL ADD (FPAYBILLCREATOR BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKPAYINGBILL' AND KSQL_COL_NAME IN ('FPAYBILLAUDITOR'))
ALTER TABLE T_BEI_BANKPAYINGBILL ADD (FPAYBILLAUDITOR BIGINT DEFAULT 0 NOT NULL );

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