/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_table.sql **/
 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILLENTRY', 'FPAYEENAME', 'NVARCHAR(255)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILLENTRY', 'FPAYEEACCTBANK', 'NVARCHAR(255)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILLENTRY', 'FPAYEEBANKNAME', 'NVARCHAR(255)', 'NOT NULL', '0100', ''' ''';

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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANG_E' AND KSQL_COL_NAME ='FREASON') 
 ALTER TABLE T_CAS_RECBILLCHANG_E ADD (FREASON NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANG_E' AND KSQL_COL_NAME ='FBACKDATE') 
 ALTER TABLE T_CAS_RECBILLCHANG_E ADD (FBACKDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANG_E' AND KSQL_COL_NAME ='FBACKUSERID') 
 ALTER TABLE T_CAS_RECBILLCHANG_E ADD (FBACKUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECBILLCHANG_E' AND KSQL_COL_NAME ='FHOTACCOUNT') 
 ALTER TABLE T_CAS_RECBILLCHANG_E ADD (FHOTACCOUNT CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL' AND KSQL_COL_NAME ='FISUNCLAIM') 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL ADD (FISUNCLAIM CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_RECPAYRULE_UORG') 
 CREATE TABLE T_CAS_RECPAYRULE_UORG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FUORGID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_SMARTMATCH_UORG') 
 CREATE TABLE T_CAS_SMARTMATCH_UORG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FUORGID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECEIVINGBILL_E' AND KSQL_COL_NAME ='FCONFIRMLOGO') 
 ALTER TABLE T_CAS_RECEIVINGBILL_E ADD (FCONFIRMLOGO CHAR(1) DEFAULT '0' NOT NULL );

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