// sortstring = sortstring.Replace("APPLICANTNAME", "(select ShowName from [user] where GID=cm.APPLICANT)");
// sortstring = sortstring.Replace("SETTLETYPEREF", "(select STLNAME from [code_stlmode] where STLCODE=cm.SETTLETYPE)");
// sortstring = sortstring.Replace("RMBDOAMOUNT", "(select SUM(CASE FEETYPE WHEN 1 THEN -DOAMOUNT ELSE DOAMOUNT END) from ch_fee_do where CURRENCY='RMB' AND BILLNO=cm.BILLNO)");
// sortstring = sortstring.Replace("USDDOAMOUNT", "(select SUM(CASE FEETYPE WHEN 1 THEN -DOAMOUNT ELSE DOAMOUNT END) from ch_fee_do where CURRENCY='USD' AND BILLNO=cm.BILLNO)");
//strSql.Append(",(select SUM(CASE FEETYPE WHEN 1 THEN -DOAMOUNT ELSE DOAMOUNT END) from ch_fee_do WITH (NOLOCK) where CURRENCY='RMB' AND BILLNO=cm.BILLNO AND CATEGORY=4) as RMBDOAMOUNT ");
//strSql.Append(",(select SUM(CASE FEETYPE WHEN 1 THEN -DOAMOUNT ELSE DOAMOUNT END) from ch_fee_do WITH (NOLOCK) where CURRENCY='USD' AND BILLNO=cm.BILLNO AND CATEGORY=4) as USDDOAMOUNT ");
//strSql.Append(",(select SUM(CASE FEETYPE WHEN 1 THEN -DOAMOUNT ELSE DOAMOUNT END) from ch_fee_do WITH (NOLOCK) where CURRENCY!='RMB' AND CURRENCY!='USD' AND BILLNO=cm.BILLNO AND CATEGORY=4) as OTDOAMOUNT ");
//strSql.Append(",(select CODENAME+'_'+bankname from info_client_bank where gid=cm.CUSTACCOUNTGID) CUSTBANKNAME");
//strSql.Append(",(select ACCOUNT from info_client_bank where gid=cm.CUSTACCOUNTGID) CUSTACCOUNT");
//strSql.Append(",ISNULL((select sum(isnull(amount,0)-isnull(invoice,0)) as noinvoice from ch_fee WITH (NOLOCK) where isnull(ISINVOICE,0)<>1 and EXISTS (select 1 from ch_fee_do WITH (NOLOCK) where ch_fee_do.FEEID=ch_fee.gid and ch_fee_do.BILLNO=cm.BILLNO)),0) as NOINVOICE");