private string GetYskmStr(string code) { string result = ""; if (!string.IsNullOrEmpty(code)) { DataTable dt = server.GetDataTable(" select billcode,(select xmmc from bill_ysgc where gcbh=f.gcbh) as ysgc ,yskm as yskmCode,(select '['+yskmCode+']'+yskmMc as yskm from bill_yskm where yskmCode=f.yskm ) as yskmMc,isnull(ysje ,0) as je,sm from bill_ysmxb f where billCode='"+ code + "'", null); if (dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); DataTable ddt = PubMethod.GetNewDataTable(dt, "je>0"); sb.Append(SetKm(ddt, "调整入")); ddt = PubMethod.GetNewDataTable(dt, "je<0"); sb.Append(SetKm(ddt, "调整出")); result = sb.ToString(); } } return(result); }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer) { HiddenField hf = e.Item.FindControl("hfCode") as HiddenField; string code = hf.Value.Trim(); if (!string.IsNullOrEmpty(code)) { DataTable dt = server.GetDataTable(" select billcode,(select xmmc from bill_ysgc where gcbh=f.gcbh) as ysgc ,yskm as yskmCode,(select '['+yskmCode+']'+yskmMc as yskm from bill_yskm where yskmCode=f.yskm ) as yskmMc,isnull(ysje ,0) as je,sm from bill_ysmxb f where billCode='"+ code + "'", null); if (dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); DataTable ddt = PubMethod.GetNewDataTable(dt, "je>0"); //sb.Append(SetKm(null, "调整入")); sb.Append(SetKm(ddt, "调整入")); ddt = PubMethod.GetNewDataTable(dt, "je<0"); // sb.Append(SetKm(null, "调整出")); sb.Append(SetKm(ddt, "调整出")); Label lb = e.Item.FindControl("lbmx") as Label; lb.Text = sb.ToString(); } } } }