-- 废弃发票类型下拉列表,增加发票类型基础资料字段

-- 发票合并规则
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEMERGERULE' AND KSQL_COL_NAME ='FINVOICETYPEF7')
ALTER TABLE T_ER_INVOICEMERGERULE ADD (FINVOICETYPEF7 BIGINT DEFAULT 0 NOT NULL );

-- 映射费用项目/映射差旅项目
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REL_EXP_RATETYPE' AND KSQL_COL_NAME ='FINVOICETYPEF7')
ALTER TABLE T_ER_REL_EXP_RATETYPE ADD (FINVOICETYPEF7 BIGINT DEFAULT 0 NOT NULL );

-- 费用报销单费用明细
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_EXPENSEDETAIL' AND KSQL_COL_NAME ='FINVOICETYPEIDITEM')
ALTER TABLE T_ER_EXPENSEDETAIL ADD (FINVOICETYPEIDITEM BIGINT DEFAULT 0 NOT NULL );
-- 费用报销单摊销明细
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_DAILYRESHAREDETAIL' AND KSQL_COL_NAME ='FINVOICETYPEIDITEM')
ALTER TABLE T_ER_DAILYRESHAREDETAIL ADD (FINVOICETYPEIDITEM BIGINT DEFAULT 0 NOT NULL );

-- 对公报销单费用明细
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PUBREIMEXPDET' AND KSQL_COL_NAME ='FINVOICETYPEIDITEM')
ALTER TABLE T_ER_PUBREIMEXPDET ADD (FINVOICETYPEIDITEM BIGINT DEFAULT 0 NOT NULL );
-- 对公报销单摊销明细
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PUBLICRESHAREDETAIL' AND KSQL_COL_NAME ='FINVOICETYPEIDITEM')
ALTER TABLE T_ER_PUBLICRESHAREDETAIL ADD (FINVOICETYPEIDITEM BIGINT DEFAULT 0 NOT NULL );

-- 差旅报销单差旅明细
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_REIMBURSEENTRY' AND KSQL_COL_NAME ='FINVOICETYPEIDITEM')
ALTER TABLE T_ER_REIMBURSEENTRY ADD (FINVOICETYPEIDITEM BIGINT DEFAULT 0 NOT NULL );
-- 差旅报销单摊销明细
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_TRIPRESHAREDETAIL' AND KSQL_COL_NAME ='FINVOICETYPEIDITEM')
ALTER TABLE T_ER_TRIPRESHAREDETAIL ADD (FINVOICETYPEIDITEM BIGINT DEFAULT 0 NOT NULL );

-- 费用分摊单摊销明细
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_EXPENSESHAREDETAIL' AND KSQL_COL_NAME ='FINVOICETYPEIDITEM')
ALTER TABLE T_ER_EXPENSESHAREDETAIL ADD (FINVOICETYPEIDITEM BIGINT DEFAULT 0 NOT NULL );
-- 费用分摊单待摊明细
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_EXPENSESHAREWAIT' AND KSQL_COL_NAME ='FINVOICETYPEIDITEM')
ALTER TABLE T_ER_EXPENSESHAREWAIT ADD (FINVOICETYPEIDITEM BIGINT DEFAULT 0 NOT NULL );