/**Begin D:\PDM_UPGRADE\PDM1\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FPDDATE')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FPDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FAVDDATE')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FAVDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FSYSDATE')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FSYSDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FSETTLEMENTTYPE')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FSETTLEMENTTYPE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FOPPACCTNUMBER')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FOPPACCTNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FBALANCEAMT')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FBALANCEAMT DECIMAL(20,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FSOURCEBILLNUMBER')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FSOURCEBILLNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FTRADENUMBER')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FTRADENUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FBANKVOUVHERNO')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FBANKVOUVHERNO NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FISCHECK')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FISCHECK CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FSOURCE')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FSOURCE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CHECKEDRESULTENTRY' AND KSQL_COL_NAME IN ('FCASHIER')) 
 ALTER TABLE T_CAS_CHECKEDRESULTENTRY ADD (FCASHIER BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_BANKSTATEMENT' AND KSQL_COL_NAME IN ('FRATESDATE')) 
 ALTER TABLE T_CAS_BANKSTATEMENT ADD (FRATESDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_BANKJOURNAL' AND KSQL_COL_NAME IN ('FAVDDATE')) 
 ALTER TABLE T_CAS_BANKJOURNAL ADD (FAVDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_BANKJOURNAL' AND KSQL_COL_NAME IN ('FPDDATE')) 
 ALTER TABLE T_CAS_BANKJOURNAL ADD (FPDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_BANKJOURNAL' AND KSQL_COL_NAME IN ('FFEEPAYER')) 
 ALTER TABLE T_CAS_BANKJOURNAL ADD (FFEEPAYER NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_BANKJOURNAL' AND KSQL_COL_NAME IN ('FPREPARATIONDATE')) 
 ALTER TABLE T_CAS_BANKJOURNAL ADD (FPREPARATIONDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CASHJOURNAL' AND KSQL_COL_NAME IN ('FAVDDATE')) 
 ALTER TABLE T_CAS_CASHJOURNAL ADD (FAVDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CASHJOURNAL' AND KSQL_COL_NAME IN ('FPDDATE')) 
 ALTER TABLE T_CAS_CASHJOURNAL ADD (FPDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CASHJOURNAL' AND KSQL_COL_NAME IN ('FFEEPAYER')) 
 ALTER TABLE T_CAS_CASHJOURNAL ADD (FFEEPAYER NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_CASHJOURNAL' AND KSQL_COL_NAME IN ('FPREPARATIONDATE')) 
 ALTER TABLE T_CAS_CASHJOURNAL ADD (FPREPARATIONDATE DATETIME );

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