/**Begin D:\PDM_UPGRADE\PDM1\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL' AND KSQL_COL_NAME IN ('FPAYAMOUNT')) 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL ADD (FPAYAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL' AND KSQL_COL_NAME IN ('FPAYTYPE')) 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL ADD (FPAYTYPE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL' AND KSQL_COL_NAME IN ('FPAYEETYPE')) 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL ADD (FPAYEETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL' AND KSQL_COL_NAME IN ('FRECBASETYPE')) 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL ADD (FRECBASETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL' AND KSQL_COL_NAME IN ('FRECPAYEE')) 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL ADD (FRECPAYEE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL' AND KSQL_COL_NAME IN ('FRECBASEPAYEE')) 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL ADD (FRECBASEPAYEE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMNOTICEBILL' AND KSQL_COL_NAME IN ('FSINGLESTREAM')) 
 ALTER TABLE T_CAS_CLAIMNOTICEBILL ADD (FSINGLESTREAM CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME IN ('FPAYAMOUNT')) 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FPAYAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME IN ('FPAYTYPE')) 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FPAYTYPE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME IN ('FPAYEETYPE')) 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FPAYEETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME IN ('FRECBASETYPE')) 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FRECBASETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME IN ('FRECBASEPAYEE')) 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FRECBASEPAYEE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME IN ('FRECPAYEE')) 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FRECPAYEE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME IN ('FFEE')) 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FFEE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME IN ('FSINGLESTREAM')) 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FSINGLESTREAM CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CLAIMBILL' AND KSQL_COL_NAME IN ('FRECVIEWPAYEE')) 
 ALTER TABLE T_CAS_CLAIMBILL ADD (FRECVIEWPAYEE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMPAYENTRY') 
 CREATE TABLE T_CAS_CLAIMPAYENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPAYSETTLEORG BIGINT DEFAULT 0 NOT NULL,
FPAYCOREBILLTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYCOREBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYCOREBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FPAYMATERIAL BIGINT DEFAULT 0 NOT NULL,
FPAYABLEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPAYCONBILLENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
FPAYCONBILLNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPAYCONBILLROWNUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYCONBILLID BIGINT DEFAULT 0 NOT NULL,
FPAYCONBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FMOBILEDELDONEFLAG1 BIGINT DEFAULT 0 NOT NULL,
FEXPENSEITEMID BIGINT DEFAULT 0 NOT NULL,
FPAYDISCOUNTAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYACTAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPROJECT BIGINT DEFAULT 0 NOT NULL,
FPAYFUNDFLOWITEM BIGINT DEFAULT 0 NOT NULL,
FCONTRACTNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPAYCOREBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FPAYCOREBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMNOTICEBILLP_E') 
 CREATE TABLE T_CAS_CLAIMNOTICEBILLP_E (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPAYCLAIMBILL NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYCLAIMPERSON BIGINT DEFAULT 0 NOT NULL,
FPAYCLAIMTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYSETTLEORG BIGINT DEFAULT 0 NOT NULL,
FPAYCOREBILLTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYMATERIAL BIGINT DEFAULT 0 NOT NULL,
FPAYHANDLESTATUS CHAR(1) DEFAULT '0' NOT NULL,
FPAYBILLSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FEXPENSEITEMID BIGINT DEFAULT 0 NOT NULL,
FPAYABLEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYDISCOUNTAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYACTAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPROJECT BIGINT DEFAULT 0 NOT NULL,
FPAYFUNDFLOWITEM BIGINT DEFAULT 0 NOT NULL,
FCONTRACTNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPAYCOREBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYCOREBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FPAYCOREBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYCOREBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FPAYREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPAYCONBILLENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
FPAYCONBILLNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPAYCONBILLROWNUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYCONBILLID BIGINT DEFAULT 0 NOT NULL,
FPAYCONBILLENTRYID BIGINT DEFAULT 0 NOT NULL
);



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