-- kd_1.5.179_genBeforeShareBill_temp.sql

-- 费用报销单A拆分表增加字段“自动生成分摊单”
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_DAILYREIMBURSEBILL_A' AND KSQL_COL_NAME ='FAUTOGENSHARE') 
ALTER TABLE T_ER_DAILYREIMBURSEBILL_A ADD (FAUTOGENSHARE CHAR(1) DEFAULT '0' NOT NULL );

-- 差旅报销单A拆分表增加字段“自动生成分摊单”
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBURSEBILL_A' AND KSQL_COL_NAME ='FAUTOGENSHARE') 
ALTER TABLE T_ER_REIMBURSEBILL_A ADD (FAUTOGENSHARE CHAR(1) DEFAULT '0' NOT NULL );

-- 对公报销单增加字段“自动生成分摊单”
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PUBREIMBILL' AND KSQL_COL_NAME ='FAUTOGENSHARE') 
ALTER TABLE T_ER_PUBREIMBILL ADD (FAUTOGENSHARE CHAR(1) DEFAULT '0' NOT NULL );

-- 费用分摊单增加字段“分摊方式”
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_EXPENSESHAREBILL' AND KSQL_COL_NAME ='FSHAREWAY') 
ALTER TABLE T_ER_EXPENSESHAREBILL ADD (FSHAREWAY CHAR(1) DEFAULT 'B' NOT NULL );