varblUpSQL=" update ch_fee_payapplication SET INVNO='"+headData.INVOICENO+"',INVDATE='"+headData.INVOICEDATE+"',INVOICEAMOUNT='"+headData.INVOICEAMOUNT+"' where billno in (select PAYBILLNO FROM CH_FEE_DO_PAYAPPLICATION WHERE BILLNO='"+headData.BILLNO+"')";
strSql.Append(" ,i.PAYABLETIME,i.AMOUNTRMB,i.RATE,i.AMOUNTUSD,i.AMOUNTOT,i.SETTLERMB as RMBDOAMOUNT,i.SETTLEUSD as USDDOAMOUNT,i.SETTLEOT as OTDOAMOUNT,i.SETTLERATE");
strSql.Append(" ,i.PAYABLETIME,i.AMOUNTRMB,i.RATE,i.AMOUNTUSD,i.AMOUNTOT,i.SETTLERMB as RMBDOAMOUNT,i.SETTLEUSD as USDDOAMOUNT,i.SETTLEOT as OTDOAMOUNT,i.SETTLERATE");
//strSql.Append(",ISNULL((select sum((isnull(amount,0)-isnull(invoice,0))) as noinvoice from ch_fee where ISINVOICE<>1 AND CURRENCY='RMB' and gid in (select feeid from ch_fee_do where BILLNO=cm.BILLNO)),0) as NOINVOICE");
//strSql.Append(",ISNULL((select sum((isnull(amount,0)-isnull(invoice,0))) as noinvoice from ch_fee where ISINVOICE<>1 AND CURRENCY='RMB' and gid in (select feeid from ch_fee_do where BILLNO=cm.BILLNO)),0) as NOINVOICE");
strSql.Append(",dbo.GetFeeNoInvByStlNo(cm.BILLNO) as NOINVOICE");
strSql.Append(",dbo.GetFeeNoInvByStlNo(cm.BILLNO) as NOINVOICE");
//strSql.Append(",ISNULL((select sum((isnull(amount,0)-isnull(invoice,0))) as noinvoice from ch_fee where ISINVOICE<>1 AND CURRENCY='RMB' and gid in (select feeid from ch_fee_do where BILLNO=cm.BILLNO)),0) as NOINVOICE");
//strSql.Append(",ISNULL((select sum((isnull(amount,0)-isnull(invoice,0))) as noinvoice from ch_fee where ISINVOICE<>1 AND CURRENCY='RMB' and gid in (select feeid from ch_fee_do where BILLNO=cm.BILLNO)),0) as NOINVOICE");
varcmdupdateAPP=db.GetSqlStringCommand("update ch_fee_payapplication SET INVNO='"+bill.INVOICENO+"',INVDATE='"+bill.INVOICEDATE+"',INVOICEAMOUNT='"+bill.INVOICEAMOUNT+"' where billno in (select PAYBILLNO FROM CH_FEE_DO_PAYAPPLICATION WHERE BILLNO=@BILLNO)");