/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTSCHEME' AND KSQL_COL_NAME ='FFREEZEOUTIN') 
 ALTER TABLE T_IM_INVCOUNTSCHEME ADD (FFREEZEOUTIN CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTSCHEME' AND KSQL_COL_NAME ='FENABLECHECK') 
 ALTER TABLE T_IM_INVCOUNTSCHEME ADD (FENABLECHECK CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTSCHEME' AND KSQL_COL_NAME ='FBACKUPCONDITION') 
 ALTER TABLE T_IM_INVCOUNTSCHEME ADD (FBACKUPCONDITION VARCHAR(30) DEFAULT 'invacc' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTSCHEME' AND KSQL_COL_NAME ='FENDDATE') 
 ALTER TABLE T_IM_INVCOUNTSCHEME ADD (FENDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTSCHEME' AND KSQL_COL_NAME ='FCOMPLETESTATUS') 
 ALTER TABLE T_IM_INVCOUNTSCHEME ADD (FCOMPLETESTATUS VARCHAR(30) DEFAULT 'B' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTSCHEME' AND KSQL_COL_NAME ='FFILTERSTRING') 
 ALTER TABLE T_IM_INVCOUNTSCHEME ADD (FFILTERSTRING NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILL' AND KSQL_COL_NAME ='FCHECKERID') 
 ALTER TABLE T_IM_INVCOUNTBILL ADD (FCHECKERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILL' AND KSQL_COL_NAME ='FCHECKER2NDID') 
 ALTER TABLE T_IM_INVCOUNTBILL ADD (FCHECKER2NDID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILL' AND KSQL_COL_NAME ='FENABLECHECK') 
 ALTER TABLE T_IM_INVCOUNTBILL ADD (FENABLECHECK CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILL' AND KSQL_COL_NAME ='FBACKUPCONDITION') 
 ALTER TABLE T_IM_INVCOUNTBILL ADD (FBACKUPCONDITION VARCHAR(30) DEFAULT 'invacc' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILLENTRY_X' AND KSQL_COL_NAME ='FCHECKQTY') 
 ALTER TABLE T_IM_INVCOUNTBILLENTRY_X ADD (FCHECKQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILLENTRY_X' AND KSQL_COL_NAME ='FCHECKBASEQTY') 
 ALTER TABLE T_IM_INVCOUNTBILLENTRY_X ADD (FCHECKBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILLENTRY_X' AND KSQL_COL_NAME ='FCHECKQTYUNIT2ND') 
 ALTER TABLE T_IM_INVCOUNTBILLENTRY_X ADD (FCHECKQTYUNIT2ND DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILLENTRY_X' AND KSQL_COL_NAME ='FADJUSTQTY') 
 ALTER TABLE T_IM_INVCOUNTBILLENTRY_X ADD (FADJUSTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILLENTRY_X' AND KSQL_COL_NAME ='FADJUSTQTYUNIT2ND') 
 ALTER TABLE T_IM_INVCOUNTBILLENTRY_X ADD (FADJUSTQTYUNIT2ND DECIMAL(23,10) DEFAULT 0 NOT NULL );

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