using Ninject; using System; using System.Collections.Generic; using System.Web.Mvc; using WX.CRM.Common; using WX.CRM.IBLL.QH; using WX.CRM.Model.Entity; using WX.CRM.WebHelper; namespace WX.CRM.WEB.Controllers.QH { public class DiscrepancyGoldController : BaseController { [Inject] public IQH_DISCREPANCYGOLD QH_DiscrepancyGold_BL { get; set; } public DiscrepancyGoldController() { } [AuthorizeRedirect(Roles = InitRights.CONST_期货出入金明细列表)] public ActionResult Index() { ToolBar tool = new ToolBar(); string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.期货出入金明细列表, userRightId); tool.AllowButton(toolbtn); tool.AddOtherButton("Other1", "导出", "icon-export", "export_Click", true); ViewBag.ToolBar = tool; Pager pager = new Pager() { page = 1, rows = 20 }; string tableId = "tablist"; Table tab = new Table(tableId); tab.AddHiddenHeadCol("PKID", "PKID"); tab.AddHeadCol("TEAM", "", "所属组"); tab.AddHeadCol("USERACCOUNT", "", "账户"); tab.AddHeadCol("ACCOUNTNAME", "", "账户名称"); tab.AddHeadCol("BZ", "", "币种"); tab.AddHeadCol("CRJLX", "", "出入金类型"); tab.AddHeadCol("JE", "", "金额"); tab.AddHeadCol("ZYZJ", "", "自有资金"); tab.AddHeadCol("BJ", "", "本金"); tab.AddHeadCol("RQ", "", "日期"); tab.AddHeadCol("CZ", "", "操作"); tab.AddHeadRow(); ViewBag.List = tab.GetTable() + Pagination.GetPage(pager, tableId, "10,20,30,50"); return View(); } public ActionResult GetHtml(Pager pager, string userAccount, string accountName, string resId, DateTime? starttime, DateTime? endtime, string columns) { try { List list = QH_DiscrepancyGold_BL.GetList(ref pager, userAccount, accountName, resId, starttime, endtime); Table table = new Table(columns, true); table.gridPager = pager; foreach (var model in list) { table.AddHiddenCol(model.PKID); table.AddCol(model.TEAM); table.AddCol(model.USERACCOUNT); table.AddCol(model.ACCOUNTNAME); table.AddCol(model.BZ); table.AddCol(model.CRJLX); table.AddCol(model.JE); table.AddCol(model.ZYZJ); table.AddCol(model.BJ); table.AddCol(model.RQ.HasValue ? model.RQ.Value.ToString("yyyy-MM-dd HH:mm") : ""); table.AddCol(model.CZ); table.AddRow(); } var json = new { totalPages = pager.totalPages, totalRows = pager.totalRows, rowsList = table.GetRows() }; return Json(json, JsonRequestBehavior.AllowGet); } catch (Exception ex) { LogHelper.Error(ex.ToString()); return JsonHandler.ManageMessage(ex.Message, false); } } #region 客户成交明细列表导出 public FileResult Export(string userAccount, string accountName, string resId, DateTime? starttime, DateTime? endtime) { string checkedFilds = PageRequest.GetQueryString("checkedFilds"); checkedFilds = checkedFilds.Replace("[]", ""); string checkedTitles = PageRequest.GetQueryString("checkedTitles"); Pager pager = new Pager() { page = 1, rows = int.MaxValue }; List list = QH_DiscrepancyGold_BL.GetList(ref pager, userAccount, accountName, resId, starttime, endtime); return File(ExcelHelper.ExportListModelToExcel(list, "期货出入金明细列表", 10000, checkedFilds, checkedTitles, null), "application/ms-excel", PageRequest.GetDlownLoadName("期货出入金明细列表.xls")); } #endregion } }