/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_table.sql **/

--对公报销单增加字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PUBREIMINVOICEINFO' AND KSQL_COL_NAME ='FINVOICENOTAXAMOUNT') 
 ALTER TABLE T_ER_PUBREIMINVOICEINFO ADD (FINVOICENOTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PUBREIMINVOICEINFO' AND KSQL_COL_NAME ='FTRANSPORTNOTE') 
 ALTER TABLE T_ER_PUBREIMINVOICEINFO ADD (FTRANSPORTNOTE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PUBREIMINVOICEINFO' AND KSQL_COL_NAME ='FREASONFORTRANSFEROUT') 
 ALTER TABLE T_ER_PUBREIMINVOICEINFO ADD (FREASONFORTRANSFEROUT VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PUBREIMINVOICEINFO' AND KSQL_COL_NAME ='FINVOICEISCHANGE') 
 ALTER TABLE T_ER_PUBREIMINVOICEINFO ADD (FINVOICEISCHANGE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PUBREIMINVOICEINFO' AND KSQL_COL_NAME ='FBUYERTAXNO') 
 ALTER TABLE T_ER_PUBREIMINVOICEINFO ADD (FBUYERTAXNO NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 --商旅付款申请单增加字段
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFOCP' AND KSQL_COL_NAME ='FINVOICENOTAXAMOUNT') 
 ALTER TABLE T_ER_INVOICEINFOCP ADD (FINVOICENOTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFOCP' AND KSQL_COL_NAME ='FTRANSPORTNOTE') 
 ALTER TABLE T_ER_INVOICEINFOCP ADD (FTRANSPORTNOTE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFOCP' AND KSQL_COL_NAME ='FREASONFORTRANSFEROUT') 
 ALTER TABLE T_ER_INVOICEINFOCP ADD (FREASONFORTRANSFEROUT VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFOCP' AND KSQL_COL_NAME ='FINVOICEISCHANGE') 
 ALTER TABLE T_ER_INVOICEINFOCP ADD (FINVOICEISCHANGE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_INVOICEINFOCP' AND KSQL_COL_NAME ='FBUYERTAXNO') 
 ALTER TABLE T_ER_INVOICEINFOCP ADD (FBUYERTAXNO NVARCHAR(50) DEFAULT ' ' NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_table.sql **/
