/**Begin D:\tool\PDM\PDM_UPGRADE_1.3\PDM_UPGRADE\PDM1\ER_table.sql **/
--费用报销单费用分录和发票分录新增源单字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFO' AND KSQL_COL_NAME ='FINVOICESRCBILLID') 
 ALTER TABLE T_ER_INVOICEINFO ADD (FINVOICESRCBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFO' AND KSQL_COL_NAME ='FINVOICESRCENTRYID') 
 ALTER TABLE T_ER_INVOICEINFO ADD (FINVOICESRCENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFO' AND KSQL_COL_NAME ='FINVOICESRCBILLTYPE') 
 ALTER TABLE T_ER_INVOICEINFO ADD (FINVOICESRCBILLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_EXPENSEDETAIL' AND KSQL_COL_NAME ='FWBSRCBILLTYPE') 
 ALTER TABLE T_ER_EXPENSEDETAIL ADD (FWBSRCBILLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_EXPENSEDETAIL' AND KSQL_COL_NAME ='FWBSRCENTRYID') 
 ALTER TABLE T_ER_EXPENSEDETAIL ADD (FWBSRCENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_EXPENSEDETAIL' AND KSQL_COL_NAME ='FWBSRCBILLID') 
 ALTER TABLE T_ER_EXPENSEDETAIL ADD (FWBSRCBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_EXPENSEDETAIL' AND KSQL_COL_NAME ='FWBSRCBILLNO') 
 ALTER TABLE T_ER_EXPENSEDETAIL ADD (FWBSRCBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL );
/**End D:\tool\PDM\PDM_UPGRADE_1.3\PDM_UPGRADE\PDM1\ER_table.sql **/
