IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_PAYACCEPTANCE_E' AND KSQL_COL_NAME IN ('FBASECURRENCYID'))
 ALTER TABLE T_IFM_PAYACCEPTANCE_E ADD (FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_PAYACCEPTANCE_E' AND KSQL_COL_NAME IN ('FEXRATETABLEID'))
 ALTER TABLE T_IFM_PAYACCEPTANCE_E ADD (FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_PAYACCEPTANCE_E' AND KSQL_COL_NAME IN ('FEXRATE'))
 ALTER TABLE T_IFM_PAYACCEPTANCE_E ADD (FEXRATE DECIMAL(23,10) DEFAULT 1 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_PAYACCEPTANCE_E' AND KSQL_COL_NAME IN ('FLOCALAMT'))
 ALTER TABLE T_IFM_PAYACCEPTANCE_E ADD (FLOCALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_PAYACCEPTANCE_E' AND KSQL_COL_NAME IN ('FQUOTATION'))
 ALTER TABLE T_IFM_PAYACCEPTANCE_E ADD (FQUOTATION CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_TRANSHANDLE_E' AND KSQL_COL_NAME IN ('FBASECURRENCYID'))
 ALTER TABLE T_IFM_TRANSHANDLE_E ADD (FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_TRANSHANDLE_E' AND KSQL_COL_NAME IN ('FEXRATETABLEID'))
 ALTER TABLE T_IFM_TRANSHANDLE_E ADD (FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_TRANSHANDLE_E' AND KSQL_COL_NAME IN ('FEXRATE'))
 ALTER TABLE T_IFM_TRANSHANDLE_E ADD (FEXRATE DECIMAL(23,10) DEFAULT 1 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_TRANSHANDLE_E' AND KSQL_COL_NAME IN ('FLOCALAMT'))
 ALTER TABLE T_IFM_TRANSHANDLE_E ADD (FLOCALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_TRANSHANDLE_E' AND KSQL_COL_NAME IN ('FQUOTATION'))
 ALTER TABLE T_IFM_TRANSHANDLE_E ADD (FQUOTATION CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_TRANSHANDLE_E' AND KSQL_COL_NAME IN ('FACREFUNDAMT'))
 ALTER TABLE T_IFM_TRANSHANDLE_E ADD (FACREFUNDAMT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IFM_TRANSHANDLE_E' AND KSQL_COL_NAME IN ('FACREFUNDRESON'))
 ALTER TABLE T_IFM_TRANSHANDLE_E ADD (FACREFUNDRESON NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_DEDUCTION_E')
 CREATE TABLE T_IFM_DEDUCTION_E (
FID BIGINT DEFAULT 0 NOT NULL,
FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL,
FEXRATE DECIMAL(23,10) DEFAULT 1 NOT NULL,
FLOCALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQUOTATION CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_RECTRANSBILL_E')
 CREATE TABLE T_IFM_RECTRANSBILL_E (
FID BIGINT DEFAULT 0 NOT NULL,
FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL,
FEXRATE DECIMAL(23,10) DEFAULT 1 NOT NULL,
FLOCALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQUOTATION CHAR(1) DEFAULT '0' NOT NULL
);