protected string GetTransportOrderItems(string transportOrderId) { BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); string shippers = string.Empty; string goods = string.Empty; string loadingAddress = string.Empty; string unloadingAddress = string.Empty; DataSet ds = itemBll.GetList(0, "TransportOrderId = " + transportOrderId + "", "Shipper, Goods, LoadingAddress, UnloadingAddress"); if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { shippers += dr["Shipper"].ToString() + ","; goods += dr["Goods"].ToString() + ","; loadingAddress += dr["LoadingAddress"].ToString() + ","; unloadingAddress += dr["UnloadingAddress"].ToString() + ","; } shippers = shippers.TrimEnd(','); goods = goods.TrimEnd(','); loadingAddress = loadingAddress.TrimEnd(','); unloadingAddress = unloadingAddress.TrimEnd(','); } string html = string.Format("<td align=\"center\">{0}</td><td align=\"center\">{1}</td><td align=\"center\">{2}</td><td align=\"center\">{3}</td>", shippers, goods, loadingAddress, unloadingAddress); return(html); }
protected string GetTransportOrderItems(string transportOrderId) { BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); string shippers = string.Empty; string goods = string.Empty; string loadingAddress = string.Empty; string unloadingAddress = string.Empty; DataSet ds = itemBll.GetList(0, "TransportOrderId = " + transportOrderId + "", "Shipper, Goods, LoadingAddress, UnloadingAddress"); if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { shippers += dr["Shipper"].ToString() + ","; goods += dr["Goods"].ToString() + ","; loadingAddress += dr["LoadingAddress"].ToString() + ","; unloadingAddress += dr["UnloadingAddress"].ToString() + ","; } shippers = shippers.TrimEnd(','); goods = goods.TrimEnd(','); loadingAddress = loadingAddress.TrimEnd(','); unloadingAddress = unloadingAddress.TrimEnd(','); } string html = string.Format("<td align=\"center\">{0}</td><td align=\"center\">{1}</td><td align=\"center\">{2}</td><td align=\"center\">{3}</td>", shippers, goods, loadingAddress, unloadingAddress); return html; }
private void ShowInfo(int _id) { BLL.TransportOrder bll = new BLL.TransportOrder(); Model.TransportOrder model = bll.GetModel(_id); labCode.Text = model.Code; labFactDispatchTime.Text = model.FactDispatchTime.Value.ToString("yyyy-MM-dd"); labMotorcadeName.Text = model.MotorcadeName; labCarNumber.Text = model.CarNumber; labDriver.Text = model.Driver; labPayee.Text = model.Payee; labAdvance.Text = model.Advance.ToString(); BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0]; foreach (DataRow dr in dt.Rows) { transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\">"; transportOrderItems += "<td></td>"; transportOrderItems += "<td align=\"left\">" + dr["OrderCode"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["BillNumber"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>"; transportOrderItems += "<td width=\"9%\" align=\"center\">" + dr["Unit"].ToString() + "</td>"; transportOrderItems += "<td width=\"6%\">" + dr["DispatchCount"].ToString() + "</td>"; transportOrderItems += "<td width=\"5%\">" + dr["FactDispatchCount"].ToString() + "</td>"; transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}", dr["UnitPrice"].ToString()) + "</td>"; transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}", dr["TotalPrice"].ToString()) + "</td>"; transportOrderItems += "</tr>"; } }
private void ShowInfo(int _id) { BLL.TransportOrder bll = new BLL.TransportOrder(); Model.TransportOrder model = bll.GetModel(_id); labMotorcade.Text = model.MotorcadeName; labCarNumber.Text = model.CarNumber; labDriver.Text = model.Driver; labPayee.Text = model.Driver; BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0]; foreach (DataRow dr in dt.Rows) { string dispatchCount = dr["DispatchCount"].ToString().Equals("0.00") ? "包车" : dr["DispatchCount"].ToString(); transportOrderItems += "<tr data-value=\"" + dr["OrderId"].ToString() + "\">"; transportOrderItems += "<td width=\"5%\"><input type=\"hidden\" name=\"transportOrderItemId\" value=\"" + dr["Id"].ToString() + "\"/></td>"; transportOrderItems += "<td align=\"left\">" + dr["OrderCode"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["BillNumber"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>"; transportOrderItems += "<td width=\"9%\" align=\"center\">" + dr["Unit"].ToString() + "</td>"; transportOrderItems += "<td width=\"6%\">" + dispatchCount + "</td>"; transportOrderItems += "<td width=\"5%\">" + dr["FactDispatchCount"].ToString() + "</td>"; transportOrderItems += "<td width=\"5%\">¥" + dr["UnitPrice"].ToString() + "</td>"; transportOrderItems += "<td width=\"5%\">¥" + dr["TotalPrice"].ToString() + "</td>"; transportOrderItems += "</tr>"; } }
private void ShowInfo(int _id) { BLL.TransportOrder bll = new BLL.TransportOrder(); Model.TransportOrder model = bll.GetModel(_id); txtDispatchTime.Text = model.DispatchTime.ToString("yyyy-MM-dd"); txtBackTime.Text = model.BackTime.ToString("yyyy-MM-dd"); ddlMotorcade.SelectedValue = model.MotorcadeName; ddlCarNumber.SelectedValue = model.CarNumber; txtDriver.Text = model.Driver; txtRemarks.Text = model.Remarks; BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0]; foreach (DataRow dr in dt.Rows) { string dispatchCount = dr["DispatchCount"].ToString().Equals("0.00") ? "包车" : dr["DispatchCount"].ToString(); transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\" data-order-id=\"" + dr["OrderId"].ToString() + "\">"; transportOrderItems += "<td width=\"5%\"><input type=\"hidden\" name=\"orderId\" value=\"" + dr["OrderId"].ToString() + "\"/></td>"; transportOrderItems += "<td width=\"10%\">" + dr["BillNumber"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>"; transportOrderItems += "<td width=\"9%\">" + dr["Unit"].ToString() + "</td>"; transportOrderItems += "<td width=\"6%\">" + dispatchCount + "</td>"; transportOrderItems += "<td width=\"5%\"><input type=\"text\" name=\"factDispatchCount\" value=\"" + dr["FactDispatchCount"].ToString() + "\" class=\"input small\"/></td>"; transportOrderItems += "<td width=\"5%\">" + dr["UnitPrice"].ToString() + "</td>"; transportOrderItems += "<td width=\"5%\">" + dr["TotalPrice"].ToString() + "</td>"; transportOrderItems += "</tr>"; } }
private void ShowInfo(int _id) { BLL.TransportOrder bll = new BLL.TransportOrder(); Model.TransportOrder model = bll.GetModel(_id); labFactDispatchTime.Text = model.FactDispatchTime.Value.ToString("yyyy-MM-dd"); txtFactBackTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); labMotorcade.Text = model.MotorcadeName; labCarNumber.Text = model.CarNumber; labDriver.Text = model.Driver; labAdvance.Text = model.Advance.ToString(); labPayee.Text = model.Driver; txtRepayment.Text = model.Advance.ToString(); txtFactRepayment.Text = "0.00"; BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0]; foreach (DataRow dr in dt.Rows) { transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\">"; transportOrderItems += "<td width=\"5%\"><input type=\"hidden\" name=\"transportOrderItemId\" value=\"" + dr["Id"].ToString() + "\"/></td>"; transportOrderItems += "<td align=\"left\">" + dr["OrderCode"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\"><select name='roundStatus'>"; transportOrderItems += "<option value='往'>往</option>"; transportOrderItems += "<option value='返'>返</option>"; transportOrderItems += "<option value='往返'>往返</option>"; transportOrderItems += "</select></td>"; transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>"; transportOrderItems += "<td width=\"9%\">" + dr["Unit"].ToString() + "</td>"; transportOrderItems += "<td width=\"6%\"><input type=\"text\" name=\"factDispatchCount\" class=\"input small\" value=\"" + dr["FactDispatchCount"].ToString() + "\" style='width:50px'/></td>"; transportOrderItems += "<td width=\"5%\"><input type=\"text\" name=\"factReceivedCount\" class=\"input small\" value=\"" + dr["FactReceivedCount"].ToString() + "\" style='width:50px'/></td>"; transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}", dr["UnitPrice"].ToString()) + "</td>"; transportOrderItems += "<td width=\"5%\">¥<input type=\"text\" name=\"totalPrice\" value=\"" + dr["TotalPrice"].ToString() + "\" style='width:50px'/></td>"; transportOrderItems += "</tr>"; } BLL.CostItem costItemBll = new BLL.CostItem(); DataTable costItemDT = costItemBll.GetAllList().Tables[0]; foreach (DataRow dr in costItemDT.Rows) { consumptions += "<tr data-value=\"" + dr["Id"].ToString() + "\">"; consumptions += "<td width=\"5%\"><input type=\"hidden\" name=\"costItemName\" value=\"" + dr["Name"].ToString() + "\"/></td>"; consumptions += "<td width=\"5%\">" + dr["Name"].ToString() + "</td>"; consumptions += "<td width=\"50%\">¥<input type=\"text\" name=\"money\" class=\"input small\" value=\"0.00\"/></td>"; consumptions += "</tr>"; } }
protected string GetTransportOrderItems(string transportOrderId, string advance, string factRepayment, string carriage) { decimal totalMoney = 0.00M; BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataSet ds = itemBll.GetList(0, "TransportOrderId = " + transportOrderId + "", "TotalPrice"); if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { totalMoney += Utils.StrToDecimal(dr["TotalPrice"].ToString(), 0.00M); } } decimal totalCost = 0.00M; BLL.Consumption consumptionBll = new BLL.Consumption(); DataSet consumptionDS = consumptionBll.GetList(0, "TransportOrderId = " + transportOrderId + "", "Money"); if (ds != null && consumptionDS.Tables[0].Rows.Count > 0) { foreach (DataRow dr in consumptionDS.Tables[0].Rows) { totalCost += Utils.StrToDecimal(dr["Money"].ToString(), 0.00M); } } decimal gain = totalMoney - Utils.StrToDecimal(advance, 0.00M) + Utils.StrToDecimal(factRepayment, 0.00M) - Utils.StrToDecimal(carriage, 0.00M) - totalCost; string html = string.Format("<td align=\"center\">¥{0}</td><td align=\"center\">¥{1}</td><td align=\"center\">¥{2}</td><td align=\"center\">¥{3}</td><td align=\"center\">¥{4}</td><td align=\"center\">¥{5}</td>", string.Format("{0:N2}", advance), string.Format("{0:N2}", factRepayment), string.Format("{0:N2}", carriage), string.Format("{0:N2}", totalMoney), string.Format("<a href=\"javascript:void(0);\" onclick=\"showCost(" + transportOrderId + ");\">{0:N2}</a>", totalCost), string.Format("{0:N2}", gain)); return(html); }
protected string GetTransportOrderItems(string transportOrderId, string advance, string factRepayment, string carriage) { decimal totalMoney = 0.00M; BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataSet ds = itemBll.GetList(0, "TransportOrderId = " + transportOrderId + "", "TotalPrice"); if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { totalMoney += Utils.StrToDecimal(dr["TotalPrice"].ToString(), 0.00M); } } decimal totalCost = 0.00M; BLL.Consumption consumptionBll = new BLL.Consumption(); DataSet consumptionDS = consumptionBll.GetList(0, "TransportOrderId = " + transportOrderId + "", "Money"); if (ds != null && consumptionDS.Tables[0].Rows.Count > 0) { foreach (DataRow dr in consumptionDS.Tables[0].Rows) { totalCost += Utils.StrToDecimal(dr["Money"].ToString(), 0.00M); } } decimal gain = totalMoney - Utils.StrToDecimal(advance, 0.00M) + Utils.StrToDecimal(factRepayment, 0.00M) - Utils.StrToDecimal(carriage, 0.00M) - totalCost; string html = string.Format("<td align=\"center\">¥{0}</td><td align=\"center\">¥{1}</td><td align=\"center\">¥{2}</td><td align=\"center\">¥{3}</td><td align=\"center\">¥{4}</td><td align=\"center\">¥{5}</td>", string.Format("{0:N2}", advance), string.Format("{0:N2}", factRepayment), string.Format("{0:N2}", carriage), string.Format("{0:N2}", totalMoney), string.Format("<a href=\"javascript:void(0);\" onclick=\"showCost(" + transportOrderId + ");\">{0:N2}</a>", totalCost), string.Format("{0:N2}", gain)); return html; }
private void ShowInfo(int _id) { BLL.TransportOrder bll = new BLL.TransportOrder(); Model.TransportOrder model = bll.GetModel(_id); labFactDispatchTime.Text = model.FactDispatchTime.Value.ToString("yyyy-MM-dd"); txtFactBackTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); labMotorcade.Text = model.MotorcadeName; labCarNumber.Text = model.CarNumber; labDriver.Text = model.Driver; labAdvance.Text = model.Advance.ToString(); labPayee.Text = model.Driver; txtRepayment.Text = model.Advance.ToString(); txtFactRepayment.Text = "0.00"; BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0]; foreach (DataRow dr in dt.Rows) { transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\">"; transportOrderItems += "<td width=\"5%\"><input type=\"hidden\" name=\"transportOrderItemId\" value=\"" + dr["Id"].ToString() + "\"/></td>"; transportOrderItems += "<td align=\"left\">" + dr["OrderCode"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\"><select name='roundStatus'>"; transportOrderItems += "<option value='往'>往</option>"; transportOrderItems += "<option value='返'>返</option>"; transportOrderItems += "<option value='往返'>往返</option>"; transportOrderItems += "</select></td>"; transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>"; transportOrderItems += "<td width=\"9%\">" + dr["Unit"].ToString() + "</td>"; transportOrderItems += "<td width=\"6%\"><input type=\"text\" name=\"factDispatchCount\" class=\"input small\" value=\"" + dr["FactDispatchCount"].ToString() + "\" style='width:50px'/></td>"; transportOrderItems += "<td width=\"5%\"><input type=\"text\" name=\"factReceivedCount\" class=\"input small\" value=\"" + dr["FactReceivedCount"].ToString() + "\" style='width:50px'/></td>"; transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}",dr["UnitPrice"].ToString())+ "</td>"; transportOrderItems += "<td width=\"5%\">¥<input type=\"text\" name=\"totalPrice\" value=\"" + dr["TotalPrice"].ToString() + "\" style='width:50px'/></td>"; transportOrderItems += "</tr>"; } BLL.CostItem costItemBll = new BLL.CostItem(); DataTable costItemDT = costItemBll.GetAllList().Tables[0]; foreach (DataRow dr in costItemDT.Rows) { consumptions += "<tr data-value=\"" + dr["Id"].ToString() + "\">"; consumptions += "<td width=\"5%\"><input type=\"hidden\" name=\"costItemName\" value=\"" + dr["Name"].ToString() + "\"/></td>"; consumptions += "<td width=\"5%\">" + dr["Name"].ToString() + "</td>"; consumptions += "<td width=\"50%\">¥<input type=\"text\" name=\"money\" class=\"input small\" value=\"0.00\"/></td>"; consumptions += "</tr>"; } }
private void RptBind() { string sql = " Status = 3 "; if (!string.IsNullOrEmpty(_beginTime)) { sql += " AND FactBackTime >= '" + _beginTime + "' "; txtBeginTime.Text = _beginTime; } else { sql += " AND FactBackTime >= '" + DateTime.Now.AddMonths(-1) + "' "; txtBeginTime.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"); } if (!string.IsNullOrEmpty(_endTime)) { sql += " AND FactBackTime <= '" + _endTime + "' "; txtEndTime.Text = _endTime; } else { sql += " AND FactBackTime <= '" + DateTime.Now + "' "; txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); } string ids = string.Empty; BLL.TransportOrder bll = new BLL.TransportOrder(); DataSet tods = bll.GetList(sql); if (tods != null && tods.Tables[0].Rows.Count > 0) { foreach (DataRow dr in tods.Tables[0].Rows) { ids += dr["Id"].ToString() + ","; totalFactRepayment += Utils.StrToDecimal(dr["FactRepayment"].ToString(), 0.00M); totalCarriage += Utils.StrToDecimal(dr["Carriage"].ToString(), 0.00M); totalAdvance += Utils.StrToDecimal(dr["Advance"].ToString(), 0.00M); } if (ids.EndsWith(",")) { ids = ids.TrimEnd(','); } } if (!string.IsNullOrEmpty(ids)) { BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataSet itemds = itemBll.GetList(" TransportOrderId IN (" + ids + ") "); if (itemds != null && itemds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in itemds.Tables[0].Rows) { totalIncome += Utils.StrToDecimal(dr["TotalPrice"].ToString(), 0.00M); } } BLL.Consumption cBll = new BLL.Consumption(); DataSet cds = cBll.GetSumList(" TransportOrderId IN (" + ids + ") "); if (cds != null && cds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in cds.Tables[0].Rows) { totalCostItem += Utils.StrToDecimal(dr["TotalMoney"].ToString(), 0.00M); costItem += "<tr><td width=\"20%\" style=\"text-align:right\">"+dr["Name"].ToString()+" : </td>"; costItem += "<td>¥" + string.Format("{0:N2}", dr["TotalMoney"]) + "</td></tr>"; } } } //throw new Exception("totalIncome:" + totalIncome.ToString() // + "totalFactRepayment:" + totalFactRepayment.ToString() // + "totalCarriage:" + totalCarriage.ToString() // + "totalAdvance:" + totalAdvance.ToString() // + "totalCostItem:" + totalCostItem.ToString() // ); totalGain = totalIncome + totalFactRepayment - totalCarriage - totalAdvance - totalCostItem; }
private void ShowInfo(int _id) { BLL.TransportOrder bll = new BLL.TransportOrder(); Model.TransportOrder model = bll.GetModel(_id); labCode.Text = model.Code; labFactDispatchTime.Text = model.FactDispatchTime.Value.ToString("yyyy-MM-dd"); labMotorcadeName.Text = model.MotorcadeName; labCarNumber.Text = model.CarNumber; labDriver.Text = model.Driver; labPayee.Text = model.Payee; labAdvance.Text = model.Advance.ToString(); BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0]; foreach (DataRow dr in dt.Rows) { transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\">"; transportOrderItems += "<td></td>"; transportOrderItems += "<td align=\"left\">" + dr["OrderCode"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["BillNumber"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>"; transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>"; transportOrderItems += "<td width=\"9%\" align=\"center\">" + dr["Unit"].ToString() + "</td>"; transportOrderItems += "<td width=\"6%\">" + dr["DispatchCount"].ToString() + "</td>"; transportOrderItems += "<td width=\"5%\">" + dr["FactDispatchCount"].ToString() + "</td>"; transportOrderItems += "<td width=\"5%\">¥" +string.Format("{0:N2}", dr["UnitPrice"].ToString())+ "</td>"; transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}",dr["TotalPrice"].ToString()) + "</td>"; transportOrderItems += "</tr>"; } }
private void RptBind() { string sql = " Status = 3 "; if (!string.IsNullOrEmpty(_beginTime)) { sql += " AND FactBackTime >= '" + _beginTime + "' "; txtBeginTime.Text = _beginTime; } else { sql += " AND FactBackTime >= '" + DateTime.Now.AddMonths(-1) + "' "; txtBeginTime.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"); } if (!string.IsNullOrEmpty(_endTime)) { sql += " AND FactBackTime <= '" + _endTime + "' "; txtEndTime.Text = _endTime; } else { sql += " AND FactBackTime <= '" + DateTime.Now + "' "; txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); } string ids = string.Empty; BLL.TransportOrder bll = new BLL.TransportOrder(); DataSet tods = bll.GetList(sql); if (tods != null && tods.Tables[0].Rows.Count > 0) { foreach (DataRow dr in tods.Tables[0].Rows) { ids += dr["Id"].ToString() + ","; totalFactRepayment += Utils.StrToDecimal(dr["FactRepayment"].ToString(), 0.00M); totalCarriage += Utils.StrToDecimal(dr["Carriage"].ToString(), 0.00M); totalAdvance += Utils.StrToDecimal(dr["Advance"].ToString(), 0.00M); } if (ids.EndsWith(",")) { ids = ids.TrimEnd(','); } } if (!string.IsNullOrEmpty(ids)) { BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem(); DataSet itemds = itemBll.GetList(" TransportOrderId IN (" + ids + ") "); if (itemds != null && itemds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in itemds.Tables[0].Rows) { totalIncome += Utils.StrToDecimal(dr["TotalPrice"].ToString(), 0.00M); } } BLL.Consumption cBll = new BLL.Consumption(); DataSet cds = cBll.GetSumList(" TransportOrderId IN (" + ids + ") "); if (cds != null && cds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in cds.Tables[0].Rows) { totalCostItem += Utils.StrToDecimal(dr["TotalMoney"].ToString(), 0.00M); costItem += "<tr><td width=\"20%\" style=\"text-align:right\">" + dr["Name"].ToString() + " : </td>"; costItem += "<td>¥" + string.Format("{0:N2}", dr["TotalMoney"]) + "</td></tr>"; } } } //throw new Exception("totalIncome:" + totalIncome.ToString() // + "totalFactRepayment:" + totalFactRepayment.ToString() // + "totalCarriage:" + totalCarriage.ToString() // + "totalAdvance:" + totalAdvance.ToString() // + "totalCostItem:" + totalCostItem.ToString() // ); totalGain = totalIncome + totalFactRepayment - totalCarriage - totalAdvance - totalCostItem; }