/**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_BALANCE' AND KSQL_COL_NAME ='FPERIODFINAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FPERIODFINAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FPERIODBUSAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FPERIODBUSAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FPERIODRECEIVEDAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FPERIODRECEIVEDAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FLOCALPERIODFINAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FLOCALPERIODFINAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FLOCALPERIODBUSAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FLOCALPERIODBUSAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FLOCALPERIODRECEIVEDAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FLOCALPERIODRECEIVEDAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FFINAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FFINAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FBUSAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FBUSAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FLOCALFINAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FLOCALFINAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FLOCALBUSAMT') 
 ALTER TABLE T_AR_BALANCE ADD (FLOCALBUSAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FFINBALANCE') 
 ALTER TABLE T_AR_BALANCE ADD (FFINBALANCE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FBUSBALANCE') 
 ALTER TABLE T_AR_BALANCE ADD (FBUSBALANCE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FRECEIVEDBALANCE') 
 ALTER TABLE T_AR_BALANCE ADD (FRECEIVEDBALANCE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FLOCALFINBALANCE') 
 ALTER TABLE T_AR_BALANCE ADD (FLOCALFINBALANCE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FLOCALBUSBALANCE') 
 ALTER TABLE T_AR_BALANCE ADD (FLOCALBUSBALANCE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BALANCE' AND KSQL_COL_NAME ='FLOCALRECEIVEDBALANCE') 
 ALTER TABLE T_AR_BALANCE ADD (FLOCALRECEIVEDBALANCE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_BUSBILLENTRY' AND KSQL_COL_NAME ='FISWRITEOFF') 
 ALTER TABLE T_AR_BUSBILLENTRY ADD (FISWRITEOFF CHAR(1) DEFAULT '0' NOT NULL );

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