/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\AR_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_INVOICE_E' AND KSQL_COL_NAME ='FEXRATETABLEID') 
 ALTER TABLE T_AR_INVOICE_E ADD (FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_INVOICE_E' AND KSQL_COL_NAME ='FEXRATEDATE') 
 ALTER TABLE T_AR_INVOICE_E ADD (FEXRATEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_FINARBILL_E' AND KSQL_COL_NAME ='FEXRATETABLEID') 
 ALTER TABLE T_AR_FINARBILL_E ADD (FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_FINARBILL_E' AND KSQL_COL_NAME ='FEXRATEDATE') 
 ALTER TABLE T_AR_FINARBILL_E ADD (FEXRATEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_RECEIVEDBILL' AND KSQL_COL_NAME ='FEXRATETABLEID') 
 ALTER TABLE T_AR_RECEIVEDBILL ADD (FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_RECEIVEDBILL' AND KSQL_COL_NAME ='FEXRATEDATE') 
 ALTER TABLE T_AR_RECEIVEDBILL ADD (FEXRATEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_BUSBILL_E') 
 CREATE TABLE T_AR_BUSBILL_E (
FID BIGINT DEFAULT 0 NOT NULL,
FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL,
FEXRATEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BUSBILL' AND KSQL_COL_NAME ='FPAYPROPERTYID') 
 ALTER TABLE T_AR_BUSBILL ADD (FPAYPROPERTYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BUSBILL' AND KSQL_COL_NAME ='FSRCFINBILLID') 
 ALTER TABLE T_AR_BUSBILL ADD (FSRCFINBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BUSBILLENTRY' AND KSQL_COL_NAME ='FSRCBILLID') 
 ALTER TABLE T_AR_BUSBILLENTRY ADD (FSRCBILLID BIGINT DEFAULT 0 NOT NULL );

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