/**
   2、机票酒店火车用车用餐 结算单增加退票费税率、退票费税额
   3、商旅付款申请单明细上增加父订单号、订单类型（原始单、改签单、退票单、调整单）、票价税额、服务费税额、退票费税额
   4、费用报销单订单信息分录增加退票费税额
   5、机票订单、机票结算单、火车订单、火车结算单增加票价开票类型
  **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBURSEENTRY_A' AND KSQL_COL_NAME IN ('FORDERAMOUNTTAX'))
ALTER TABLE T_ER_REIMBURSEENTRY_A ADD (FORDERAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBURSEENTRY_A' AND KSQL_COL_NAME IN ('FREFUNDAMOUNTTAX'))
ALTER TABLE T_ER_REIMBURSEENTRY_A ADD (FREFUNDAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBURSEENTRY_A' AND KSQL_COL_NAME IN ('FSERVICEAMOUNTTAX'))
ALTER TABLE T_ER_REIMBURSEENTRY_A ADD (FSERVICEAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_TRAINCHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDDEDUCTRATE'))
ALTER TABLE T_ER_TRAINCHECKINGBILL ADD (FREFUNDDEDUCTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_TRAINCHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDAMOUNTTAX'))
ALTER TABLE T_ER_TRAINCHECKINGBILL ADD (FREFUNDAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_TRAINCHECKINGBILL' AND KSQL_COL_NAME IN ('FPRICEBILLINGTYPE'))
ALTER TABLE T_ER_TRAINCHECKINGBILL ADD (FPRICEBILLINGTYPE VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FPARENTORDERNUM'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FPARENTORDERNUM VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FORDERTYPE'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FORDERTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FORDERAMOUNTTAX'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FORDERAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FSERVICEAMOUNTTAX'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FSERVICEAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FREFUNDAMOUNTTAX'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FREFUNDAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_VEHICLECHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDDEDUCTRATE'))
ALTER TABLE T_ER_VEHICLECHECKINGBILL ADD (FREFUNDDEDUCTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_VEHICLECHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDAMOUNTTAX'))
ALTER TABLE T_ER_VEHICLECHECKINGBILL ADD (FREFUNDAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_HOTELCHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDDEDUCTRATE'))
ALTER TABLE T_ER_HOTELCHECKINGBILL ADD (FREFUNDDEDUCTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_HOTELCHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDAMOUNTTAX'))
ALTER TABLE T_ER_HOTELCHECKINGBILL ADD (FREFUNDAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_TRAINBILL' AND KSQL_COL_NAME IN ('FPRICEBILLINGTYPE'))
ALTER TABLE T_ER_TRAINBILL ADD (FPRICEBILLINGTYPE VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDDEDUCTRATE'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FREFUNDDEDUCTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDAMOUNTTAX'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FREFUNDAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PLANECHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDDEDUCTRATE'))
ALTER TABLE T_ER_PLANECHECKINGBILL ADD (FREFUNDDEDUCTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PLANECHECKINGBILL' AND KSQL_COL_NAME IN ('FREFUNDAMOUNTTAX'))
ALTER TABLE T_ER_PLANECHECKINGBILL ADD (FREFUNDAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PLANECHECKINGBILL' AND KSQL_COL_NAME IN ('FPRICEBILLINGTYPE'))
ALTER TABLE T_ER_PLANECHECKINGBILL ADD (FPRICEBILLINGTYPE VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PLANEBILL' AND KSQL_COL_NAME IN ('FPRICEBILLINGTYPE'))
ALTER TABLE T_ER_PLANEBILL ADD (FPRICEBILLINGTYPE VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_DAILYREMORDERENTRY' AND KSQL_COL_NAME IN ('FREFUNDAMOUNTTAX'))
ALTER TABLE T_ER_DAILYREMORDERENTRY ADD (FREFUNDAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );



IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FINVOICETOTALAMOUNT'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FINVOICETOTALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FINVOICEDIFFERENT'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FINVOICEDIFFERENT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FINVOICETAX'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FINVOICETAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FINVOICETAXDIFFERENT'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FINVOICETAXDIFFERENT DECIMAL(23,10) DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FOABILLNUM'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FOABILLNUM VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAYENTRY' AND KSQL_COL_NAME IN ('FREIMBURSENUM'))
ALTER TABLE T_ER_CHECKINGPAYENTRY ADD (FREIMBURSENUM VARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFOCP' AND KSQL_COL_NAME IN ('FORDERNUM'))
ALTER TABLE T_ER_INVOICEINFOCP ADD (FORDERNUM VARCHAR(255) );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFOCP' AND KSQL_COL_NAME IN ('FORDERNUM_TAG'))
ALTER TABLE T_ER_INVOICEINFOCP ADD (FORDERNUM_TAG NCLOB );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAY' AND KSQL_COL_NAME ='FPAYCOMPANY')
ALTER TABLE T_ER_CHECKINGPAY ADD (FPAYCOMPANY BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PUBLICREMORDERENTRY' AND KSQL_COL_NAME ='FREFUNDAMOUNTTAX')
ALTER TABLE T_ER_PUBLICREMORDERENTRY ADD (FREFUNDAMOUNTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAY' AND KSQL_COL_NAME ='FINVAMOUNT')
ALTER TABLE T_ER_CHECKINGPAY ADD (FINVAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAY' AND KSQL_COL_NAME ='FSETTAXAMOUNT')
ALTER TABLE T_ER_CHECKINGPAY ADD (FSETTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAY' AND KSQL_COL_NAME ='FINVFFSETTAXAMOUNT')
ALTER TABLE T_ER_CHECKINGPAY ADD (FINVFFSETTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_CHECKINGPAY' AND KSQL_COL_NAME ='FDIFFERENTFFSETTAX')
ALTER TABLE T_ER_CHECKINGPAY ADD (FDIFFERENTFFSETTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );


