123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Web.Controls.Mvc;
- using EMIS.CommonLogic.TeachingMaterial;
- using EMIS.ViewModel;
- using EMIS.ViewModel.TeachingMaterial;
- using EMIS.Web.Controls;
- using Bowin.Common.Data;
- using EMIS.CommonLogic.CalendarManage;
- namespace EMIS.Web.Controllers.TeachingMaterial
- {
- public class StockOutStatisticsController : Controller
- {
- public IStockOutDetailServices StockOutDetailServices { get; set; }
- public ISchoolYearServices SchoolYearServices { get; set; }
- /// <summary>
- /// 出库统计页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult List()
- {
- //默认当前学年
- var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
- ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();
- return View();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
-
- //避开全选值
- Guid? publishID = null;
- Guid? schoolyearID = null;
- Guid? teachingMaterialID = null;
- int? stockOutType = 0;
- publishID = pararms.getExtraGuid("PublishDropdown");
- schoolyearID = pararms.getExtraGuid("SchoolYearDropdown");
- var teachingMaterialType = pararms.getExtraInt("TeachingMaterialTypeDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("TeachingMaterialTypeDropdown");
- teachingMaterialID = pararms.getExtraGuid("TeachingMaterialDropdown");
- if (pararms.getExtraInt("StockOutTypeDropdown") != null && pararms.getExtraInt("StockOutTypeDropdown") != DropdownList.SELECT_ALL)
- {
- stockOutType = pararms.getExtraInt("StockOutTypeDropdown");
- }
- return base.Json(StockOutDetailServices.GetStockOutStatisticsViewGrid(configuretView, schoolyearID, publishID,teachingMaterialID, teachingMaterialType,stockOutType,(int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- Guid? publishID = null;
- Guid? schoolyearID = null;
- Guid? teachingMaterialID = null;
- int? stockOutType = 0;
- publishID = Request.Form["PublishDropdown"].ParseStrTo<Guid>();
- schoolyearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>();
- teachingMaterialID = Request.Form["TeachingMaterialDropdown"].ParseStrTo<Guid>();
- if (Request.Form["StockOutTypeDropdown"].ParseStrTo<int>() != null && Request.Form["StockOutTypeDropdown"].ParseStrTo<int>() != DropdownList.SELECT_ALL)
- {
- stockOutType = Request.Form["StockOutTypeDropdown"].ParseStrTo<int>();
- }
- var teachingMaterialType = Request.Form["TeachingMaterialTypeDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["TeachingMaterialTypeDropdown"].ParseStrTo<int>();
- var dt = StockOutDetailServices.GetStockOutStatisticsViewList(configuretView, schoolyearID, publishID, teachingMaterialID, teachingMaterialType, stockOutType).Select(x => new
- {
- x.SchoolyearName,
- // x.StockInDocumentNo,
- // x.StockInType,
- x.TeachingMaterialCode,
- x.TeachingMaterialName,
- x.PublishName,
- x.SupplierName,
- x.PublishTime,
- x.Author,
- x.StockOutTypeName,
- x.Quantity,
- x.Price,
- x.DiscountStr,
- x.DiscountPriceStr,
- x.TotalPriceStr,
- x.TotalDollarStr
- //x.HandlerUserName,
- //x.StockInUserName,
- //x.StockInTime
- }).ToTable();
- string[] liststring = { "学年学期", "教材编号", "教材名称", "供应商",
- "出版单位", "版本时间", "作者", "出库类型","数量", "单价", "折扣率", "折合价", "码洋", "实洋" };
- neh.Export(dt, liststring, "出库明细信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/StockOutStatistics/List").AddMenuParameter()
- });
- }
- }
- }
|