/**Begin D:\PDM_UPGRADE\PDM1\BEI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_ELECSTATEMENT') 
 CREATE TABLE T_BEI_ELECSTATEMENT (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACCOUNTBANKID BIGINT DEFAULT 0 NOT NULL,
FBANKID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FAUDITDATE DATETIME,
FSOURCEBILLID BIGINT DEFAULT 0 NOT NULL,
FLOCAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FEXCHANGERATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACCOUNTBANKNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPRINTCOUNT BIGINT DEFAULT 0 NOT NULL,
FPRINTDATE DATETIME,
FDATASOURCE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCOUNTCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FIDENTIFICATIONISSUER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBANKBRANCHNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBANKCUSTOMERCODE NVARCHAR(80) DEFAULT ' ' NOT NULL,
FJOINDATE DATETIME,
FENDRETAINAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FENDFREEZEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FENDOVERDRAFTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FENDACCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FENDAVAILABLEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISCOMPLETED CHAR(1) DEFAULT '0' NOT NULL,
FISFILE CHAR(1) DEFAULT '0' NOT NULL,
FFILESUFFIX NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFILESERVICEPATH NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISARCHIVE CHAR(1) DEFAULT '0' NOT NULL,
FARCHIVECONTENT NVARCHAR(30) DEFAULT ' ' NOT NULL,
FJOINTIME DATETIME,
FPERIOD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_ELECSTATEMENT_ENTRY') 
 CREATE TABLE T_BEI_ELECSTATEMENT_ENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDEBITAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCREDITAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBOOKJOURNAL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBOOKDATE DATETIME,
FBOOKTIME DATETIME,
FBALANCEDIRECTION NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FOPPOSITEACCT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPPOSITEACCTNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPPOSITEBANK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FELECRECEIPTNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZPRODUCT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCEDOCUMENT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCEDOCUMENTNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTRANSACTIONCODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBOOKKEEPER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOTHERBOOKINFO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISMATCHDETAIL CHAR(1) DEFAULT '0' NOT NULL,
FTRANSDETAILNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISCHECK CHAR(1) DEFAULT '0' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_ELECSTATEMENT_L')
 CREATE TABLE T_BEI_ELECSTATEMENT_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);

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