/// <summary> /// 控件显示全年的费用汇总 /// </summary> /// <param name="year"></param> public void ShowWholeYear(string year) { if (string.IsNullOrEmpty(year) == false) { IList<CommonFeeInfo> ilist = new CommonFee().GetList(year, string.Empty, this.DepartmentID); gvList.DataSource = ilist; gvList.DataBind(); this.DimTimeID = string.Empty; } }
/// <summary> /// 获取发票的等额人民币价值,汇率按照开票时间计算 /// </summary> /// <param name="ID"></param> /// <returns></returns> public string GetRMBAmout(string ID) { if (string.IsNullOrEmpty(ID)) { throw new ArgumentNullException("发票主键不能为空。"); } CommonFeeInfo vInfo = new CommonFee().GetByID(ID); ExchangeRateInfo eInfo = new ExchangeRate().GetInfo(vInfo.CurrencyID, vInfo.Year, vInfo.MonthNumOfYear); string strRate = (eInfo.CurrencyID == "1") ? "1" : eInfo.Rate; decimal amout = Convert.ToDecimal(vInfo.Amount); decimal rate = Convert.ToDecimal(strRate); //四舍六入五成双 decimal localAmout = Math.Round(amout / rate, 2); return localAmout.ToString(); }
protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e) { try { string strIndex = e.CommandArgument.ToString(); int index = Convert.ToInt32(strIndex); GridViewRow gvr = (GridViewRow)gvList.Rows[index]; Label lblID = (Label)gvr.FindControl("lblID"); string tID = lblID.Text; if (e.CommandName == "btnDel") { new CommonFee().Delete(tID); } else { Label lbFeeCatalogID = (Label)gvr.FindControl("lbFeeCatalogID"); Label lbName = (Label)gvr.FindControl("lbName"); TextBox tbAmout = (TextBox)gvr.FindControl("tbAmout"); DropDownList ddlListCurrency = (DropDownList)gvr.FindControl("ddlListCurrency"); DropDownList ddlFeeCatalog = (DropDownList)gvr.FindControl("ddlFeeCatalog"); TextBox tbCreateTime = (TextBox)gvr.FindControl("tbCreateTime"); TextBox tbRemark = (TextBox)gvr.FindControl("tbRemark"); CommonFeeInfo info = new CommonFeeInfo(tID); if (string.IsNullOrEmpty(tID) == false) { info = new CommonFee().GetByID(tID); } info.Amount = tbAmout.Text; WebBasePage page = this.Page as WebBasePage; if (null == page) { this.ShowMsg("无法获取当前用户信息,请返回登录页重新登录。"); return; } info.ApproveUserID = page.UserCacheInfo.ID; info.CurrencyID = ddlListCurrency.SelectedValue; if (string.IsNullOrEmpty(this.DimTimeID) == false) { info.DimTimeID = this.DimTimeID; } info.FeeCatalogID = ddlFeeCatalog.SelectedValue; info.备注 = tbRemark.Text; if (e.CommandName == "btnEdit") { new CommonFee().Update(info); } if (e.CommandName == "btnAdd") { new CommonFee().Add(info); } ShowMsg("操作成功!"); } BindGrid(this.DimTimeID, this.DepartmentID); } catch (ArgumentException ae) { this.ShowMsg(ae.Message); } catch (Exception exc) { ShowMsg(exc.Message); //Log(exc); } }
/// <summary> /// /// </summary> /// <param name="dimTimeID"></param> /// <param name="departmentID"></param> private void BindGrid(string dimTimeID, string departmentID) { IList<CommonFeeInfo> ilist = new List<CommonFeeInfo>(); if (string.IsNullOrEmpty(this.DimTimeID) == false) { DimTimeInfo dInfo = new DimTime().GetDimTimeInfo(dimTimeID); string year = dInfo.Year.ToString(); string month = dInfo.MonthNumOfYear.ToString(); if (string.IsNullOrEmpty(departmentID) == false) { ilist = new CommonFee().GetListAddBlank(year, month, departmentID); } } else if (string.IsNullOrEmpty(this.Year) == false) { if (string.IsNullOrEmpty(departmentID) == false) { ilist = new CommonFee().GetList(this.Year, string.Empty, this.DepartmentID); } } gvList.DataSource = ilist; gvList.DataBind(); }
/// <summary> /// /// </summary> /// <param name="dimTimeID"></param> /// <param name="departmentID"></param> private void BindGrid(string departmentID) { DataSet ds = new DataSet(); if (string.IsNullOrEmpty(this.Year) == false) { if (string.IsNullOrEmpty(departmentID) == false) { int year = Convert.ToInt16(this.Year); ds = new CommonFee().GetStatistic(this.DepartmentID, year); } } gvList.DataSource = ds; gvList.DataBind(); }