/// <summary> /// 绑定散货报表 /// </summary> private void BindRentReport(int pageIndex) { string shipID = MonthAndShipNavigate1.ShipID; string year = MonthAndShipNavigate1.Year; string month = MonthAndShipNavigate1.Month; DataSet ds = new RentShipReport().GetList(year, month, shipID, pGridV.PageSize, pageIndex); gvRentReport.DataSource = ds; gvRentReport.DataBind(); CustomDataSet cDS = ds as CustomDataSet; if (cDS == null) { pGridV.TotalAmout = 0; return; } pGridV.TotalAmout = cDS.TotalAmout; }
private void RentShipReportInitial(string id) { RentShipReportInfo rInfo = new RentShipReport().GetByID(id); if (rInfo != null && string.IsNullOrEmpty(rInfo.ID) == false) { tbUser1.Text = rInfo.User1; tbUser2.Text = rInfo.User2; tbUser3.Text = rInfo.User3; ddlShipName.SelectedValue = rInfo.ShipID; ddlRentType.SelectedValue = rInfo.RentTypeID; tbCustomer.Text = rInfo.Customer; tbTaxNo.Text = rInfo.TaxNo; tbStartTime.Text = rInfo.BeginDate.ToShortDateString(); tbEndTime.Text = rInfo.EndDate.ToShortDateString(); lbDays.Text = (rInfo.EndDate - rInfo.BeginDate).Days.ToString(); tbDiscountDays.Text = rInfo.DiscountDays; tbRealDays.Text = rInfo.RealDays; ddlCurrency.SelectedValue = rInfo.CurrencyID; tbPrice.Text = rInfo.Price; tbRentFee.Text = rInfo.RentFee; tbCommunicateFee.Text = rInfo.CommunicateFee; tbLockFee.Text = rInfo.LockFee; tbOtherFee.Text = rInfo.OtherFee; tbRemark.Text = rInfo.Remark; lbTotal.Text = new RentShipReport().GetAmout(rInfo); lbCName.Text = rInfo.CurrencyName; lbTotalRMB.Text = new ExchangeRate().GetRMB(lbTotal.Text, rInfo.CurrencyID, rInfo.CreateTime).ToString(); } }
protected void gvRentReport_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView dv = e.Row.DataItem as DataRowView; if (dv.Row["ID"] == null) { return; } string reportID = dv.Row["ID"].ToString(); if (string.IsNullOrEmpty(reportID)) { return; } RentShipReportInfo vInfo = new RentShipReport().GetByID(reportID); Label lbTotal = (Label)e.Row.FindControl("lbTotal"); Label lbTotalRMB = (Label)e.Row.FindControl("lbTotalRMB"); lbTotal.Text = new RentShipReport().GetAmout(reportID); ; lbTotalRMB.Text = new RentShipReport().GetRMBAmout(reportID); } if (e.Row.RowIndex >= 0) { Label lbTotal = (Label)e.Row.FindControl("lbTotal"); double result = 0; bool isDouble = Double.TryParse(lbTotal.Text, out result); if (isDouble) { sum += Convert.ToDouble(lbTotal.Text); } } else if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[8].Text = "总额相当于人民币:" + sum.ToString() + "元"; } } catch (ArgumentException ae) { this.ShowMsg(ae.Message); } catch (Exception exc) { ShowMsg(exc.Message); } }
protected void btnSaveVoyage_Click(object sender, EventArgs e) { try { RentShipReportInfo rInfo = new RentShipReportInfo(); if (string.IsNullOrEmpty(this.RentShipReportID) == false) { rInfo = new RentShipReport().GetByID(this.RentShipReportID); } rInfo.User1 = tbUser1.Text; rInfo.User2 = tbUser2.Text; rInfo.User3 = tbUser3.Text; rInfo.ShipID = ddlShipName.SelectedValue; rInfo.RentTypeID = ddlRentType.SelectedValue; rInfo.Customer = tbCustomer.Text; rInfo.Customer = tbCustomer.Text; rInfo.TaxNo = tbTaxNo.Text; rInfo.BeginDate = Convert.ToDateTime(tbStartTime.Text); rInfo.EndDate = Convert.ToDateTime(tbEndTime.Text); rInfo.DiscountDays = tbDiscountDays.Text; rInfo.RealDays = tbRealDays.Text; rInfo.CurrencyID = ddlCurrency.SelectedValue; rInfo.Price = tbPrice.Text; rInfo.CommunicateFee = tbCommunicateFee.Text; rInfo.LockFee = tbLockFee.Text; rInfo.OtherFee = tbOtherFee.Text; rInfo.RentFee = tbRentFee.Text; rInfo.Remark = tbRemark.Text; if (string.IsNullOrEmpty(this.RentShipReportID)) { this.RentShipReportID = new RentShipReport().Add(rInfo); } else { new RentShipReport().Update(rInfo); } RentShipReportInitial(this.RentShipReportID); ShowMsg("保存成功。"); } catch (ArgumentNullException aex) { ShowMsg(aex.Message); } catch (Exception ex) { ShowMsg(ex.Message); Log(ex); } }