/*  机票订单、酒店订单、用车订单、火车订单 增加记账日期 */
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PLANEBILL' AND KSQL_COL_NAME ='FBOOKEDDATE')
ALTER TABLE T_ER_PLANEBILL ADD (FBOOKEDDATE DATETIME);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_TRAINBILL' AND KSQL_COL_NAME ='FBOOKEDDATE')
ALTER TABLE T_ER_TRAINBILL ADD (FBOOKEDDATE DATETIME);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_VEHICLEBILL' AND KSQL_COL_NAME ='FBOOKEDDATE')
ALTER TABLE T_ER_VEHICLEBILL ADD (FBOOKEDDATE DATETIME);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_HOTELBILL' AND KSQL_COL_NAME ='FBOOKEDDATE')
ALTER TABLE T_ER_HOTELBILL ADD (FBOOKEDDATE DATETIME);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_ALLORDERBILL' AND KSQL_COL_NAME ='FBOOKEDDATE')
ALTER TABLE T_ER_ALLORDERBILL ADD (FBOOKEDDATE DATETIME);
/*  机票订单、酒店订单、用车订单、火车订单 增加差旅报销单号 */
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PLANEBILL' AND KSQL_COL_NAME ='FREIMBURSENUM')
ALTER TABLE T_ER_PLANEBILL ADD (FREIMBURSENUM VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_TRAINBILL' AND KSQL_COL_NAME ='FREIMBURSENUM')
ALTER TABLE T_ER_TRAINBILL ADD (FREIMBURSENUM VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_VEHICLEBILL' AND KSQL_COL_NAME ='FREIMBURSENUM')
ALTER TABLE T_ER_VEHICLEBILL ADD (FREIMBURSENUM VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_HOTELBILL' AND KSQL_COL_NAME ='FREIMBURSENUM')
ALTER TABLE T_ER_HOTELBILL ADD (FREIMBURSENUM VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_ALLORDERBILL' AND KSQL_COL_NAME ='FREIMBURSENUM')
ALTER TABLE T_ER_ALLORDERBILL ADD (FREIMBURSENUM VARCHAR(100) DEFAULT ' ' NOT NULL );

EXEC p_AlterColumn 't_er_vehiclecheckingbill', 'fbookeddatebu', 'NULL', 'NULL', '1001', 'NULL';
EXEC p_AlterColumn 't_er_vehiclecheckingbill', 'freimbursenumbu', 'NULL', 'NULL', '1001', 'NULL';
EXEC p_AlterColumn 't_er_vehiclecheckingbill', 'freimbursenum', 'NULL', 'NULL', '1001', 'NULL';
EXEC p_AlterColumn 't_er_vehiclecheckingbill', 'fbookeddate', 'NULL', 'NULL', '1001', 'NULL';
EXEC p_AlterColumn 't_er_traincheckingbill', 'fbookeddatebu', 'NULL', 'NULL', '1001', 'NULL';
EXEC p_AlterColumn 't_er_traincheckingbill', 'freimbursenumbu', 'NULL', 'NULL', '1001', 'NULL';
EXEC p_AlterColumn 't_er_traincheckingbill', 'freimbursenum', 'NULL', 'NULL', '1001', 'NULL';
EXEC p_AlterColumn 't_er_traincheckingbill', 'fbookeddate', 'NULL', 'NULL', '1001', 'NULL';


