/**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_INTERPAYPLAN') 
 CREATE TABLE T_CAS_INTERPAYPLAN (
ID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(10) 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,
FPAYERACCTBANK BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPE BIGINT DEFAULT 0 NOT NULL,
FPAYMENTCHANNEL NVARCHAR(30) DEFAULT ' ' NOT NULL,
FUSAGE NVARCHAR(200) DEFAULT ' ' NOT NULL,
FFILTERCON NCLOB,
FFILTERCON_TAG NCLOB
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILLENTRY' AND KSQL_COL_NAME ='FCONTRACTNUMBER') 
 ALTER TABLE T_CAS_PAYMENTBILLENTRY ADD (FCONTRACTNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECEIVINGBILLENTRY' AND KSQL_COL_NAME ='FCONTRACTNUMBER') 
 ALTER TABLE T_CAS_RECEIVINGBILLENTRY ADD (FCONTRACTNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL );

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