/**Begin D:\PDM_UPGRADE\PDM1\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_PAYAPPLYBILL') 
 CREATE TABLE T_CAS_PAYAPPLYBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FAPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FAPPLYDATE DATETIME,
FAPPLYCAUSE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FPAYCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FPAYEECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL,
FEXRATEDATE DATETIME,
FEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYEEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYMENTTYPEID BIGINT DEFAULT 0 NOT NULL,
FPAYERACCTBANKID BIGINT DEFAULT 0 NOT NULL,
FISDIFFCUR CHAR(1) DEFAULT '0' NOT NULL,
FPAIDSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_PAYAPPLYENTRY') 
 CREATE TABLE T_CAS_PAYAPPLYENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FEPAYEE BIGINT DEFAULT 0 NOT NULL,
FEPAYEEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FEPAYDATE DATETIME,
FSETTLEMENTTYPEID BIGINT DEFAULT 0 NOT NULL,
FEPAYEEACCBANK BIGINT DEFAULT 0 NOT NULL,
FEPAYEENAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEPAYEEACCBANKNUM NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEPAYEEBANKID BIGINT DEFAULT 0 NOT NULL,
FEPAIDAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FELOCKEDAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FEREMARK NVARCHAR(512),
FEPAYEETYPE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEUSERACCBANK BIGINT DEFAULT 0 NOT NULL,
FEPAYEEID BIGINT DEFAULT 0 NOT NULL,
FEPAYEEACCBANKID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_PAYAPPLYPAIDENTRY') 
 CREATE TABLE T_CAS_PAYAPPLYPAIDENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPAYEDAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYMENTID BIGINT DEFAULT 0 NOT NULL,
FAPPLYID BIGINT DEFAULT 0 NOT NULL,
FWBTIME DATETIME
);



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