/// <summary> /// 获得货柜出租报表各个类型货柜的总租金 /// </summary> /// <param name="reportID"></param> /// <returns></returns> public string GetAmout(string reportID) { // RentContainerReportInfo rpInfo = new RentContainerReport().GetByID(reportID); decimal total = 0; IList<RentContainerInfo> rList = new RentContainer().GetList(reportID); foreach (RentContainerInfo rInfo in rList) { total += Convert.ToDecimal(rInfo.RentFee); } //decimal dTotal = dPrice * dDays + dComun + dLockFee + dOtherFee; //return dTotal.ToString(); return total.ToString(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (string.IsNullOrEmpty(this.RentContainerReportID)) { ShowMsg("货柜租金报表未保存,无法为特定箱种的租金进行编辑。"); return; } string id = e.CommandArgument.ToString(); GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; if (e.CommandName == "btnDel") { new InstalmentOfCompensation().Delete(id); } else { #region 控件 DropDownList rblContainerTypeID = (DropDownList)gvr.FindControl("rblContainerTypeID"); TextBox tbAmount = (TextBox)gvr.FindControl("tbAmount"); TextBox tbPrice = (TextBox)gvr.FindControl("tbPrice"); TextBox tbRentFee = (TextBox)gvr.FindControl("tbRentFee"); TextBox tbRemark = (TextBox)gvr.FindControl("tbRemark"); #endregion RentContainerInfo info = new RentContainerInfo(); if (string.IsNullOrEmpty(id) == false) { info = new RentContainer().GetByID(id); } info.ReportID = this.RentContainerReportID; info.ContainerTypeID = rblContainerTypeID.SelectedValue; info.Amount = tbAmount.Text; info.Price = tbPrice.Text; info.RentFee = tbRentFee.Text; info.Remark = tbRemark.Text; if (e.CommandName == "btnEdit") { new RentContainer().Update(info); } if (e.CommandName == "btnAdd") { new RentContainer().Add(info); } } gvList.DataSource = new RentContainer().GetList(this.RentContainerReportID); gvList.DataBind(); RentContainerReportInfo rInfo = new RentContainerReport().GetByID(this.RentContainerReportID); lbTotal.Text = new RentContainerReport().GetAmout(rInfo.ID); lbCName.Text = rInfo.CurrencyName; lbTotalRMB.Text = new ExchangeRate().GetRMB(lbTotal.Text, rInfo.CurrencyID, rInfo.CreateTime).ToString(); ShowMsg("更新成功!"); } catch (ArgumentNullException aex) { ShowMsg(aex.Message); } catch (Exception ex) { ShowMsg(ex.Message); Log(ex); } }