public ActionResult ExportEnterOutBalanceSummary() { //读取条件 var request = HttpContext.Request; string strStartTime = request.QueryString["startTime"] ?? string.Empty; string strEndTime = request.QueryString["endTime"] ?? string.Empty; string strCustomerName = request.QueryString["customerName"] ?? string.Empty; string strDeliveryNo = request.QueryString["deliveryNo"] ?? string.Empty; string strEnterWarehouseBillNo = request.QueryString["enterWarehouseBillNo"] ?? string.Empty; string strGoodsNo = request.QueryString["goodsNo"] ?? string.Empty; string strBatchNo = request.QueryString["batchNo"] ?? string.Empty; string strWarehouse = request.QueryString["warehouse"] ?? string.Empty; string strIsConsigning = request.QueryString["isConsigning"] ?? "false"; //读取数据 string strErrText; StockSystem stock = new StockSystem(); List<EnterOutBalanceSummary> listSummary = stock.LoadEnterOutBalanceSummariesByConditions(strStartTime, strEndTime, strCustomerName, strDeliveryNo, strEnterWarehouseBillNo, strGoodsNo, strBatchNo, strWarehouse, strIsConsigning, LoginAccountId, LoginStaffName, out strErrText); if (listSummary == null) { throw new Exception(strErrText); } //生成结果数据 List<EnterOutBalanceSummary> listRet = new List<EnterOutBalanceSummary>(); { //按客户分组 var grpCustomerNames = listSummary.GroupBy(f => f.CustomerName).OrderBy(f => f.Key); foreach (var grpCustomerName in grpCustomerNames) { List<EnterOutBalanceSummary> data = grpCustomerName.ToList<EnterOutBalanceSummary>(); listRet.AddRange(data); //生成小计行 EnterOutBalanceSummary subtotal = new EnterOutBalanceSummary(); subtotal.CustomerName = grpCustomerName.Key; subtotal.GoodsNo = InnoSoft.LS.Resources.Labels.Subtotal; subtotal.StartPackages = data.Sum(s => s.StartPackages); subtotal.StartTunnages = data.Sum(s => s.StartTunnages); subtotal.StartPiles = data.Sum(s => s.StartPiles); subtotal.StartTenThousands = data.Sum(s => s.StartTenThousands); subtotal.TotalEnterWarehousePackages = data.Sum(s => s.TotalEnterWarehousePackages); subtotal.TotalEnterWarehouseTunnages = data.Sum(s => s.TotalEnterWarehouseTunnages); subtotal.TotalEnterWarehousePiles = data.Sum(s => s.TotalEnterWarehousePiles); subtotal.TotalEnterWarehouseTenThousands = data.Sum(s => s.TotalEnterWarehouseTenThousands); subtotal.TotalOutWarehousePackages = data.Sum(s => s.TotalOutWarehousePackages); subtotal.TotalOutWarehouseTunnages = data.Sum(s => s.TotalOutWarehouseTunnages); subtotal.TotalOutWarehousePiles = data.Sum(s => s.TotalOutWarehousePiles); subtotal.TotalOutWarehouseTenThousands = data.Sum(s => s.TotalOutWarehouseTenThousands); subtotal.EndPackages = data.Sum(s => s.EndPackages); subtotal.EndTunnages = data.Sum(s => s.EndTunnages); subtotal.EndPiles = data.Sum(s => s.EndPiles); subtotal.EndTenThousands = data.Sum(s => s.EndTenThousands); subtotal.TotalAllocateEnterWarehousePackages = data.Sum(s => s.TotalAllocateEnterWarehousePackages); subtotal.TotalAllocateEnterWarehouseTunnages = data.Sum(s => s.TotalAllocateEnterWarehouseTunnages); subtotal.TotalAllocateEnterWarehousePiles = data.Sum(s => s.TotalAllocateEnterWarehousePiles); subtotal.TotalAllocateEnterWarehouseTenThousands = data.Sum(s => s.TotalAllocateEnterWarehouseTenThousands); subtotal.TotalAllocateOutWarehousePackages = data.Sum(s => s.TotalAllocateOutWarehousePackages); subtotal.TotalAllocateOutWarehouseTunnages = data.Sum(s => s.TotalAllocateOutWarehouseTunnages); subtotal.TotalAllocateOutWarehousePiles = data.Sum(s => s.TotalAllocateOutWarehousePiles); subtotal.TotalAllocateOutWarehouseTenThousands = data.Sum(s => s.TotalAllocateOutWarehouseTenThousands); listRet.Add(subtotal); } //生成合计行 EnterOutBalanceSummary total = new EnterOutBalanceSummary(); total.CustomerName = InnoSoft.LS.Resources.Labels.Total; total.StartPackages = listSummary.Sum(s => s.StartPackages); total.StartTunnages = listSummary.Sum(s => s.StartTunnages); total.StartPiles = listSummary.Sum(s => s.StartPiles); total.StartTenThousands = listSummary.Sum(s => s.StartTenThousands); total.TotalEnterWarehousePackages = listSummary.Sum(s => s.TotalEnterWarehousePackages); total.TotalEnterWarehouseTunnages = listSummary.Sum(s => s.TotalEnterWarehouseTunnages); total.TotalEnterWarehousePiles = listSummary.Sum(s => s.TotalEnterWarehousePiles); total.TotalEnterWarehouseTenThousands = listSummary.Sum(s => s.TotalEnterWarehouseTenThousands); total.TotalOutWarehousePackages = listSummary.Sum(s => s.TotalOutWarehousePackages); total.TotalOutWarehouseTunnages = listSummary.Sum(s => s.TotalOutWarehouseTunnages); total.TotalOutWarehousePiles = listSummary.Sum(s => s.TotalOutWarehousePiles); total.TotalOutWarehouseTenThousands = listSummary.Sum(s => s.TotalOutWarehouseTenThousands); total.EndPackages = listSummary.Sum(s => s.EndPackages); total.EndTunnages = listSummary.Sum(s => s.EndTunnages); total.EndPiles = listSummary.Sum(s => s.EndPiles); total.EndTenThousands = listSummary.Sum(s => s.EndTenThousands); total.TotalAllocateEnterWarehousePackages = listSummary.Sum(s => s.TotalAllocateEnterWarehousePackages); total.TotalAllocateEnterWarehouseTunnages = listSummary.Sum(s => s.TotalAllocateEnterWarehouseTunnages); total.TotalAllocateEnterWarehousePiles = listSummary.Sum(s => s.TotalAllocateEnterWarehousePiles); total.TotalAllocateEnterWarehouseTenThousands = listSummary.Sum(s => s.TotalAllocateEnterWarehouseTenThousands); total.TotalAllocateOutWarehousePackages = listSummary.Sum(s => s.TotalAllocateOutWarehousePackages); total.TotalAllocateOutWarehouseTunnages = listSummary.Sum(s => s.TotalAllocateOutWarehouseTunnages); total.TotalAllocateOutWarehousePiles = listSummary.Sum(s => s.TotalAllocateOutWarehousePiles); total.TotalAllocateOutWarehouseTenThousands = listSummary.Sum(s => s.TotalAllocateOutWarehouseTenThousands); listRet.Add(total); } //生成GridView BoundField colCustomerName = new BoundField(); colCustomerName.HeaderText = InnoSoft.LS.Resources.Labels.CustomerName; colCustomerName.DataField = "CustomerName"; BoundField colGoodsNo = new BoundField(); colGoodsNo.HeaderText = InnoSoft.LS.Resources.Labels.GoodsNo; colGoodsNo.DataField = "GoodsNo"; BoundField colGoodsName = new BoundField(); colGoodsName.HeaderText = InnoSoft.LS.Resources.Labels.GoodsName; colGoodsName.DataField = "GoodsName"; BoundField colBrand = new BoundField(); colBrand.HeaderText = InnoSoft.LS.Resources.Labels.Brand; colBrand.DataField = "Brand"; BoundField colSpecModel = new BoundField(); colSpecModel.HeaderText = InnoSoft.LS.Resources.Labels.Specification; colSpecModel.DataField = "SpecModel"; BoundField colGWeight = new BoundField(); colGWeight.HeaderText = InnoSoft.LS.Resources.Labels.GrammeWeight; colGWeight.DataField = "GWeight"; BoundField colGrade = new BoundField(); colGrade.HeaderText = InnoSoft.LS.Resources.Labels.Grade; colGrade.DataField = "Grade"; BoundField colBatchNo = new BoundField(); colBatchNo.HeaderText = InnoSoft.LS.Resources.Labels.BatchNo; colBatchNo.DataField = "BatchNo"; BoundField colWarehouse = new BoundField(); colWarehouse.HeaderText = InnoSoft.LS.Resources.Labels.Warehouse; colWarehouse.DataField = "Warehouse"; BoundField colLocation = new BoundField(); colLocation.HeaderText = InnoSoft.LS.Resources.Labels.Location; colLocation.DataField = "Location"; BoundField colStartPackages = new BoundField(); colStartPackages.HeaderText = InnoSoft.LS.Resources.Labels.BeginningBalance + InnoSoft.LS.Resources.Labels.Pieces; colStartPackages.DataField = "StartPackages"; BoundField colStartTunnages = new BoundField(); colStartTunnages.HeaderText = InnoSoft.LS.Resources.Labels.BeginningBalance + InnoSoft.LS.Resources.Labels.Tunnages; colStartTunnages.DataField = "StartTunnages"; BoundField colStartPiles = new BoundField(); colStartPiles.HeaderText = InnoSoft.LS.Resources.Labels.BeginningBalance + InnoSoft.LS.Resources.Labels.Piles; colStartPiles.DataField = "StartPiles"; BoundField colStartTenThousands = new BoundField(); colStartTenThousands.HeaderText = InnoSoft.LS.Resources.Labels.BeginningBalance + InnoSoft.LS.Resources.Labels.TenThousands; colStartTenThousands.DataField = "StartTenThousands"; BoundField colTotalEnterWarehousePackages = new BoundField(); colTotalEnterWarehousePackages.HeaderText = InnoSoft.LS.Resources.Labels.TotalEnterWarehouse + InnoSoft.LS.Resources.Labels.Pieces; colTotalEnterWarehousePackages.DataField = "TotalEnterWarehousePackages"; BoundField colTotalEnterWarehouseTunnages = new BoundField(); colTotalEnterWarehouseTunnages.HeaderText = InnoSoft.LS.Resources.Labels.TotalEnterWarehouse + InnoSoft.LS.Resources.Labels.Tunnages; colTotalEnterWarehouseTunnages.DataField = "TotalEnterWarehouseTunnages"; BoundField colTotalEnterWarehousePiles = new BoundField(); colTotalEnterWarehousePiles.HeaderText = InnoSoft.LS.Resources.Labels.TotalEnterWarehouse + InnoSoft.LS.Resources.Labels.Piles; colTotalEnterWarehousePiles.DataField = "TotalEnterWarehousePiles"; BoundField colTotalEnterWarehouseTenThousands = new BoundField(); colTotalEnterWarehouseTenThousands.HeaderText = InnoSoft.LS.Resources.Labels.TotalEnterWarehouse + InnoSoft.LS.Resources.Labels.TenThousands; colTotalEnterWarehouseTenThousands.DataField = "TotalEnterWarehouseTenThousands"; BoundField colTotalOutWarehousePackages = new BoundField(); colTotalOutWarehousePackages.HeaderText = InnoSoft.LS.Resources.Labels.TotalOutWarehouse + InnoSoft.LS.Resources.Labels.Pieces; colTotalOutWarehousePackages.DataField = "TotalOutWarehousePackages"; BoundField colTotalOutWarehouseTunnages = new BoundField(); colTotalOutWarehouseTunnages.HeaderText = InnoSoft.LS.Resources.Labels.TotalOutWarehouse + InnoSoft.LS.Resources.Labels.Tunnages; colTotalOutWarehouseTunnages.DataField = "TotalOutWarehouseTunnages"; BoundField colTotalOutWarehousePiles = new BoundField(); colTotalOutWarehousePiles.HeaderText = InnoSoft.LS.Resources.Labels.TotalOutWarehouse + InnoSoft.LS.Resources.Labels.Piles; colTotalOutWarehousePiles.DataField = "TotalOutWarehousePiles"; BoundField colTotalOutWarehouseTenThousands = new BoundField(); colTotalOutWarehouseTenThousands.HeaderText = InnoSoft.LS.Resources.Labels.TotalOutWarehouse + InnoSoft.LS.Resources.Labels.TenThousands; colTotalOutWarehouseTenThousands.DataField = "TotalOutWarehouseTenThousands"; BoundField colEndPackages = new BoundField(); colEndPackages.HeaderText = InnoSoft.LS.Resources.Labels.EndingBalance + InnoSoft.LS.Resources.Labels.Pieces; colEndPackages.DataField = "EndPackages"; BoundField colEndTunnages = new BoundField(); colEndTunnages.HeaderText = InnoSoft.LS.Resources.Labels.EndingBalance + InnoSoft.LS.Resources.Labels.Tunnages; colEndTunnages.DataField = "EndTunnages"; BoundField colEndPiles = new BoundField(); colEndPiles.HeaderText = InnoSoft.LS.Resources.Labels.EndingBalance + InnoSoft.LS.Resources.Labels.Piles; colEndPiles.DataField = "EndPiles"; BoundField colEndTenThousands = new BoundField(); colEndTenThousands.HeaderText = InnoSoft.LS.Resources.Labels.EndingBalance + InnoSoft.LS.Resources.Labels.TenThousands; colEndTenThousands.DataField = "EndTenThousands"; BoundField colTotalAllocateEnterWarehousePackages = new BoundField(); colTotalAllocateEnterWarehousePackages.HeaderText = InnoSoft.LS.Resources.Labels.TotalAllocateEnterWarehouse + InnoSoft.LS.Resources.Labels.Pieces; colTotalAllocateEnterWarehousePackages.DataField = "TotalAllocateEnterWarehousePackages"; BoundField colTotalAllocateEnterWarehouseTunnages = new BoundField(); colTotalAllocateEnterWarehouseTunnages.HeaderText = InnoSoft.LS.Resources.Labels.TotalAllocateEnterWarehouse + InnoSoft.LS.Resources.Labels.Tunnages; colTotalAllocateEnterWarehouseTunnages.DataField = "TotalAllocateEnterWarehouseTunnages"; BoundField colTotalAllocateEnterWarehousePiles = new BoundField(); colTotalAllocateEnterWarehousePiles.HeaderText = InnoSoft.LS.Resources.Labels.TotalAllocateEnterWarehouse + InnoSoft.LS.Resources.Labels.Piles; colTotalAllocateEnterWarehousePiles.DataField = "TotalAllocateEnterWarehousePiles"; BoundField colTotalAllocateEnterWarehouseTenThousands = new BoundField(); colTotalAllocateEnterWarehouseTenThousands.HeaderText = InnoSoft.LS.Resources.Labels.TotalAllocateEnterWarehouse + InnoSoft.LS.Resources.Labels.TenThousands; colTotalAllocateEnterWarehouseTenThousands.DataField = "TotalAllocateEnterWarehouseTenThousands"; BoundField colTotalAllocateOutWarehousePackages = new BoundField(); colTotalAllocateOutWarehousePackages.HeaderText = InnoSoft.LS.Resources.Labels.TotalAllocateOutWarehouse + InnoSoft.LS.Resources.Labels.Pieces; colTotalAllocateOutWarehousePackages.DataField = "TotalAllocateOutWarehousePackages"; BoundField colTotalAllocateOutWarehouseTunnages = new BoundField(); colTotalAllocateOutWarehouseTunnages.HeaderText = InnoSoft.LS.Resources.Labels.TotalAllocateOutWarehouse + InnoSoft.LS.Resources.Labels.Tunnages; colTotalAllocateOutWarehouseTunnages.DataField = "TotalAllocateOutWarehouseTunnages"; BoundField colTotalAllocateOutWarehousePiles = new BoundField(); colTotalAllocateOutWarehousePiles.HeaderText = InnoSoft.LS.Resources.Labels.TotalAllocateOutWarehouse + InnoSoft.LS.Resources.Labels.Piles; colTotalAllocateOutWarehousePiles.DataField = "TotalAllocateOutWarehousePiles"; BoundField colTotalAllocateOutWarehouseTenThousands = new BoundField(); colTotalAllocateOutWarehouseTenThousands.HeaderText = InnoSoft.LS.Resources.Labels.TotalAllocateOutWarehouse + InnoSoft.LS.Resources.Labels.TenThousands; colTotalAllocateOutWarehouseTenThousands.DataField = "TotalAllocateOutWarehouseTenThousands"; BoundField colProductionDate = new BoundField(); colProductionDate.HeaderText = InnoSoft.LS.Resources.Labels.ProductionDate; colProductionDate.DataField = "ProductionDate"; var grid = new GridView(); grid.Columns.Add(colCustomerName); grid.Columns.Add(colGoodsNo); grid.Columns.Add(colGoodsName); grid.Columns.Add(colBrand); grid.Columns.Add(colSpecModel); grid.Columns.Add(colGWeight); grid.Columns.Add(colGrade); grid.Columns.Add(colBatchNo); grid.Columns.Add(colWarehouse); grid.Columns.Add(colLocation); grid.Columns.Add(colStartPackages); grid.Columns.Add(colStartTunnages); grid.Columns.Add(colStartPiles); grid.Columns.Add(colStartTenThousands); grid.Columns.Add(colTotalEnterWarehousePackages); grid.Columns.Add(colTotalEnterWarehouseTunnages); grid.Columns.Add(colTotalEnterWarehousePiles); grid.Columns.Add(colTotalEnterWarehouseTenThousands); grid.Columns.Add(colTotalOutWarehousePackages); grid.Columns.Add(colTotalOutWarehouseTunnages); grid.Columns.Add(colTotalOutWarehousePiles); grid.Columns.Add(colTotalOutWarehouseTenThousands); grid.Columns.Add(colEndPackages); grid.Columns.Add(colEndTunnages); grid.Columns.Add(colEndPiles); grid.Columns.Add(colEndTenThousands); grid.Columns.Add(colTotalAllocateEnterWarehousePackages); grid.Columns.Add(colTotalAllocateEnterWarehouseTunnages); grid.Columns.Add(colTotalAllocateEnterWarehousePiles); grid.Columns.Add(colTotalAllocateEnterWarehouseTenThousands); grid.Columns.Add(colTotalAllocateOutWarehousePackages); grid.Columns.Add(colTotalAllocateOutWarehouseTunnages); grid.Columns.Add(colTotalAllocateOutWarehousePiles); grid.Columns.Add(colTotalAllocateOutWarehouseTenThousands); grid.Columns.Add(colProductionDate); grid.AutoGenerateColumns = false; grid.DataSource = from r in listRet select new { CustomerName = r.CustomerName, GoodsNo = r.GoodsNo, GoodsName = r.GoodsName, Brand = r.Brand, SpecModel = r.SpecModel, GWeight = r.GWeight, Grade = r.Grade, BatchNo = r.BatchNo, Warehouse = r.Warehouse, Location = r.Location, StartPackages = r.StartPackages != 0 ? r.StartPackages.ToString() : string.Empty, StartTunnages = r.StartTunnages != 0 ? r.StartTunnages.ToString("#0.######") : string.Empty, StartPiles = r.StartPiles != 0 ? r.StartPiles.ToString("#0.######") : string.Empty, StartTenThousands = r.StartTenThousands != 0 ? r.StartTenThousands.ToString("#0.######") : string.Empty, TotalEnterWarehousePackages = r.TotalEnterWarehousePackages != 0 ? r.TotalEnterWarehousePackages.ToString() : string.Empty, TotalEnterWarehouseTunnages = r.TotalEnterWarehouseTunnages != 0 ? r.TotalEnterWarehouseTunnages.ToString("#0.######") : string.Empty, TotalEnterWarehousePiles = r.TotalEnterWarehousePiles != 0 ? r.TotalEnterWarehousePiles.ToString("#0.######") : string.Empty, TotalEnterWarehouseTenThousands = r.TotalEnterWarehouseTenThousands != 0 ? r.TotalEnterWarehouseTenThousands.ToString("#0.######") : string.Empty, TotalOutWarehousePackages = r.TotalOutWarehousePackages != 0 ? r.TotalOutWarehousePackages.ToString() : string.Empty, TotalOutWarehouseTunnages = r.TotalOutWarehouseTunnages != 0 ? r.TotalOutWarehouseTunnages.ToString("#0.######") : string.Empty, TotalOutWarehousePiles = r.TotalOutWarehousePiles != 0 ? r.TotalOutWarehousePiles.ToString("#0.######") : string.Empty, TotalOutWarehouseTenThousands = r.TotalOutWarehouseTenThousands != 0 ? r.TotalOutWarehouseTenThousands.ToString("#0.######") : string.Empty, EndPackages = r.EndPackages != 0 ? r.EndPackages.ToString() : string.Empty, EndTunnages = r.EndTunnages != 0 ? r.EndTunnages.ToString("#0.######") : string.Empty, EndPiles = r.EndPiles != 0 ? r.EndPiles.ToString("#0.######") : string.Empty, EndTenThousands = r.EndTenThousands != 0 ? r.EndTenThousands.ToString("#0.######") : string.Empty, TotalAllocateEnterWarehousePackages = r.TotalAllocateEnterWarehousePackages != 0 ? r.TotalAllocateEnterWarehousePackages.ToString() : string.Empty, TotalAllocateEnterWarehouseTunnages = r.TotalAllocateEnterWarehouseTunnages != 0 ? r.TotalAllocateEnterWarehouseTunnages.ToString("#0.######") : string.Empty, TotalAllocateEnterWarehousePiles = r.TotalAllocateEnterWarehousePiles != 0 ? r.TotalAllocateEnterWarehousePiles.ToString("#0.######") : string.Empty, TotalAllocateEnterWarehouseTenThousands = r.TotalAllocateEnterWarehouseTenThousands != 0 ? r.TotalAllocateEnterWarehouseTenThousands.ToString("#0.######") : string.Empty, TotalAllocateOutWarehousePackages = r.TotalAllocateOutWarehousePackages != 0 ? r.TotalAllocateOutWarehousePackages.ToString() : string.Empty, TotalAllocateOutWarehouseTunnages = r.TotalAllocateOutWarehouseTunnages != 0 ? r.TotalAllocateOutWarehouseTunnages.ToString("#0.######") : string.Empty, TotalAllocateOutWarehousePiles = r.TotalAllocateOutWarehousePiles != 0 ? r.TotalAllocateOutWarehousePiles.ToString("#0.######") : string.Empty, TotalAllocateOutWarehouseTenThousands = r.TotalAllocateOutWarehouseTenThousands != 0 ? r.TotalAllocateOutWarehouseTenThousands.ToString("#0.######") : string.Empty, ProductionDate = r.ProductionDate }; grid.DataBind(); //导出GridView Response.ClearContent(); Response.Charset = InnoSoft.LS.Resources.Encoding.ExcelCharset; Response.ContentEncoding = System.Text.Encoding.GetEncoding(InnoSoft.LS.Resources.Encoding.ExcelContent); Response.ContentType = "application/ms-excel"; Response.Write("<meta http-equiv=Content-Type content=text/html charset=" + InnoSoft.LS.Resources.Encoding.ExcelCharset + ">"); Response.AddHeader("content-disposition", "attachment; filename=EnterOutBalanceSummary.xls"); StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); grid.RenderControl(htw); Response.Write(sw.ToString()); Response.End(); return View("EnterOutBalanceSummary"); }
public JsonResult LoadEnterOutBalanceSummaryGrid(string sidx, string sord, int page, int rows, string startTime, string endTime, string customerName, string deliveryNo, string enterWarehouseBillNo, string goodsNo, string batchNo, string warehouse, string isConsigning) { //读取数据 string strErrText; StockSystem stock = new StockSystem(); List<EnterOutBalanceSummary> listSummary = stock.LoadEnterOutBalanceSummariesByConditions(startTime, endTime, customerName, deliveryNo, enterWarehouseBillNo, goodsNo, batchNo, warehouse, isConsigning, LoginAccountId, LoginStaffName, out strErrText); if (listSummary == null) { throw new Exception(strErrText); } //记录编号 for (int i = 0; i < listSummary.Count; i++) { listSummary[i].Id = i + 1; } //提取当前页面数据 int nTotalRows = listSummary.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) nTotalPages++; string sortExpression = (sidx ?? "CustomerName") + " " + (sord ?? "ASC"); var data = listSummary.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList(); //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from s in data select new { id = s.Id, cell = new string[] { s.CustomerName, s.GoodsNo, s.GoodsName, s.Brand, s.SpecModel, s.GWeight, s.Grade, s.BatchNo, s.Warehouse, s.Location, s.StartPackages.ToString(), s.StartTunnages.ToString("#0.######"), s.StartPiles.ToString("#0.######"), s.StartTenThousands.ToString("#0.######"), s.TotalEnterWarehousePackages.ToString(), s.TotalEnterWarehouseTunnages.ToString("#0.######"), s.TotalEnterWarehousePiles.ToString("#0.######"), s.TotalEnterWarehouseTenThousands.ToString("#0.######"), s.TotalOutWarehousePackages.ToString(), s.TotalOutWarehouseTunnages.ToString("#0.######"), s.TotalOutWarehousePiles.ToString("#0.######"), s.TotalOutWarehouseTenThousands.ToString("#0.######"), s.EndPackages.ToString(), s.EndTunnages.ToString("#0.######"), s.EndPiles.ToString("#0.######"), s.EndTenThousands.ToString("#0.######"), s.TotalAllocateEnterWarehousePackages.ToString(), s.TotalAllocateEnterWarehouseTunnages.ToString("#0.######"), s.TotalAllocateEnterWarehousePiles.ToString("#0.######"), s.TotalAllocateEnterWarehouseTenThousands.ToString("#0.######"), s.TotalAllocateOutWarehousePackages.ToString(), s.TotalAllocateOutWarehouseTunnages.ToString("#0.######"), s.TotalAllocateOutWarehousePiles.ToString("#0.######"), s.TotalAllocateOutWarehouseTenThousands.ToString("#0.######"), s.ProductionDate } }).ToArray(), userdata = new { CustomerName = InnoSoft.LS.Resources.Labels.Total, StartPackages = data.Sum(s => s.StartPackages), StartTunnages = data.Sum(s => s.StartTunnages), StartPiles = data.Sum(s => s.StartPiles), StartTenThousands = data.Sum(s => s.StartTenThousands), TotalEnterWarehousePackages = data.Sum(s => s.TotalEnterWarehousePackages), TotalEnterWarehouseTunnages = data.Sum(s => s.TotalEnterWarehouseTunnages), TotalEnterWarehousePiles = data.Sum(s => s.TotalEnterWarehousePiles), TotalEnterWarehouseTenThousands = data.Sum(s => s.TotalEnterWarehouseTenThousands), TotalOutWarehousePackages = data.Sum(s => s.TotalOutWarehousePackages), TotalOutWarehouseTunnages = data.Sum(s => s.TotalOutWarehouseTunnages), TotalOutWarehousePiles = data.Sum(s => s.TotalOutWarehousePiles), TotalOutWarehouseTenThousands = data.Sum(s => s.TotalOutWarehouseTenThousands), EndPackages = data.Sum(s => s.EndPackages), EndTunnages = data.Sum(s => s.EndTunnages), EndPiles = data.Sum(s => s.EndPiles), EndTenThousands = data.Sum(s => s.EndTenThousands), TotalAllocateEnterWarehousePackages = data.Sum(s => s.TotalAllocateEnterWarehousePackages), TotalAllocateEnterWarehouseTunnages = data.Sum(s => s.TotalAllocateEnterWarehouseTunnages), TotalAllocateEnterWarehousePiles = data.Sum(s => s.TotalAllocateEnterWarehousePiles), TotalAllocateEnterWarehouseTenThousands = data.Sum(s => s.TotalAllocateEnterWarehouseTenThousands), TotalAllocateOutWarehousePackages = data.Sum(s => s.TotalAllocateOutWarehousePackages), TotalAllocateOutWarehouseTunnages = data.Sum(s => s.TotalAllocateOutWarehouseTunnages), TotalAllocateOutWarehousePiles = data.Sum(s => s.TotalAllocateOutWarehousePiles), TotalAllocateOutWarehouseTenThousands = data.Sum(s => s.TotalAllocateOutWarehouseTenThousands) } }; return Json(ret, JsonRequestBehavior.AllowGet); }