日期:2014-05-18 浏览次数:20404 次
public void qudiaoduoyu() { public DataTable dt = new DataTable(); int aa = 0; string row1 = myDataSet.Tables[0].Rows[0]["订单号码"].ToString();//取表的第一行 string row2 = myDataSet.Tables[0].Rows[0]["邮件号"].ToString();//取表的第一行 DataRow[] drr = myDataSet.Tables[0].Select(" 订单号码='"+row1 + "'"); DataRow[] drr1 = myDataSet.Tables[0].Select(" 订单号码='"+row2 + "'"); BLL.kuaidifeiyong mykuaidifeiyong = new BLL.kuaidifeiyong(); DataRow dr = myDataSet.Tables[0].NewRow();//临时新的行 dr["收寄日期"] = drr1[0]["收寄日期"].ToString(); dr["订单号码"] = drr1[0]["订单号码"].ToString(); if (drr1[0]["订单金额"] != null && drr1[0]["订单金额"].ToString() != "") dr["订单金额"] = decimal.Parse(drr1[0]["订单金额"].ToString()); if (drr1[0]["单位"] != null) dr["单位"] = drr1[0]["单位"].ToString(); if (drr1[0]["寄达地"] != null) dr["寄达地"] = drr1[0]["寄达地"].ToString(); if (drr1[0]["省"] != null) dr["省"] = drr1[0]["省"].ToString(); dr["快递公司"] = drr1[0]["快递公司"].ToString(); dr["邮件号"] = drr1[0]["邮件号"].ToString(); dr["重量"] = decimal.Parse(drr1[0]["重量"].ToString()); dr["件数"] = int.Parse(drr1[0]["件数"].ToString()); dr["邮费"] = decimal.Parse(drr1[0]["邮费"].ToString()); dr["备注"] = drr1[0]["备注"].ToString(); if (drr1[0]["省"] != null) dr["我算运费"] = feiyongjisuan(drr1[0]["邮件号"].ToString(), drr1[0]["省"].ToString(), decimal.Parse(drr1[0]["重量"].ToString())); if (drr.Length > 1 && drr[0]["邮件号"].ToString() != "") { aa += 1; drr1 = myDataSet.Tables[0].Select(" 邮件号='-1'"); dr["订单号码"] = drr[0]["订单号码"].ToString(); dr["订单金额"] = decimal.Parse(drr[0]["订单金额"].ToString()); decimal zl = 0; int js = 0; decimal yf = 0; decimal wsyf = 0; foreach (DataRow dr11 in drr) { if (dr["邮件号"].ToString().IndexOf(dr11["邮件号"].ToString()) == -1) dr["邮件号"] = dr["邮件号"] + "," + dr11["邮件号"].ToString(); zl += decimal.Parse(dr11["重量"].ToString()); js += int.Parse(dr11["件数"].ToString()); yf += decimal.Parse(dr11["邮费"].ToString()); wsyf += feiyongjisuan(dr11["邮件号"].ToString(), dr11["省"].ToString(), decimal.Parse(dr11["重量"].ToString())); myDataSet.Tables[0].Rows.Remove(dr11);//清除此类的行 } dr["重量"] = zl; dr["件数"] = js; dr["邮费"] = yf; dr["我算运费"] = wsyf; dr["比例"] = wsyf / decimal.Parse(dr["订单金额"].ToString()); } decimal ddje = 0; if (drr1.Length > 1 &&am