/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILLENTRY' AND KSQL_COL_NAME ='FSETTLEORGID') 
 ALTER TABLE T_CAS_PAYMENTBILLENTRY ADD (FSETTLEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILLENTRY' AND KSQL_COL_NAME ='FPROJECTID') 
 ALTER TABLE T_CAS_PAYMENTBILLENTRY ADD (FPROJECTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_RECEIVINGBILLENTRY' AND KSQL_COL_NAME ='FPROJECTID') 
 ALTER TABLE T_CAS_RECEIVINGBILLENTRY ADD (FPROJECTID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL', 'FEXPECTDEALTIME', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL', 'FREASON', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL', 'FBACKUSERID', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL', 'FBACKDATE', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_CAS_RECEIVINGBILL', 'FREFUNDBATCHSEQID', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_CAS_RECEIVINGBILL', 'FISREFUND', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_CAS_RECEIVINGBILL', 'FISFULLREFUND', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILL' AND KSQL_COL_NAME ='FDELEGORGID') 
 ALTER TABLE T_CAS_AGENTPAYBILL ADD (FDELEGORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILL' AND KSQL_COL_NAME ='FAPPLYORGID') 
 ALTER TABLE T_CAS_AGENTPAYBILL ADD (FAPPLYORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_RECEIVINGBILL_E') 
 CREATE TABLE T_CAS_RECEIVINGBILL_E (
FID BIGINT DEFAULT 0 NOT NULL,
FREFUNDBATCHSEQID VARCHAR(80) DEFAULT ' ' NOT NULL,
FISREFUND CHAR(1) DEFAULT '0' NOT NULL,
FISFULLREFUND CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_PAYMENTBILL_E') 
 CREATE TABLE T_CAS_PAYMENTBILL_E (
FID BIGINT DEFAULT 0 NOT NULL,
FREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBACKUSERID BIGINT DEFAULT 0 NOT NULL,
FBACKDATE DATETIME,
FENTRUSTORGID BIGINT DEFAULT 0 NOT NULL,
FAPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FEXPECTDATE DATETIME
);



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