/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_AGENTPAYBILLENTRY_E') 
 CREATE TABLE T_CAS_AGENTPAYBILLENTRY_E (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FRECADDRESS VARCHAR(400) DEFAULT ' ' NOT NULL,
FEFEE DECIMAL(19,6) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILL_C' AND KSQL_COL_NAME ='FRECADDRESS') 
 ALTER TABLE T_CAS_PAYMENTBILL_C ADD (FRECADDRESS VARCHAR(400) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_RECPAYRULE') 
 CREATE TABLE T_CAS_RECPAYRULE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_RECPAYRULE_E') 
 CREATE TABLE T_CAS_RECPAYRULE_E (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FRULESNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDATAFILTERDESC NVARCHAR(1024) DEFAULT ' ' NOT NULL,
FDATAFILTER NCLOB,
FDATAFILTER_TAG NCLOB,
FRECEIVINGTYPEID BIGINT DEFAULT 0 NOT NULL,
FPAYERTYPEID NVARCHAR(100) DEFAULT ' ' NOT NULL,
FPAYMENTTYPEID BIGINT DEFAULT 0 NOT NULL,
FPAYEETYPEID NVARCHAR(100) DEFAULT ' ' NOT NULL,
FFUNDFLOWITEMID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_table.sql **/
