public JsonResult LoadBillList(LBRForMonthPayOffFilter filter) { DataTablesRequest parm = new DataTablesRequest(this.Request); //处理对象 int pageIndex = parm.iDisplayLength == 0 ? 0 : parm.iDisplayStart / parm.iDisplayLength; filter.PageIndex = pageIndex; //页索引 filter.PageSize = parm.iDisplayLength; //页行数 var DataSource = LoadBillReconciliation.GetByMonthPayOffFilter(filter); int i = parm.iDisplayLength * pageIndex; List <LoadBillReconciliation> queryData = DataSource.ToList(); var data = queryData.Select(u => new { Index = ++i, //行号 ID = u.ID, CusName = u.CusName, //客户简称 LoadBillNum = u.LoadBillNum, //提单号 FeeWeight = u.FeeWeight, //提单重量 ExpressCount = u.ExpressCount, //提单包裹数量 CompletionTime = u.CompletionTime.ToStringDate(), //清关完成时间 GroundHandlingFee = u.GroundHandlingFee, //邮政地勤费 CostStoreFee = u.CostStoreFee, //邮政仓租 CostExpressFee = u.CostExpressFee, //邮政邮资 CostOperateFee = u.CostOperateFee, //邮件处理费 CostOtherFee = u.CostOtherFee, //邮政其他费用 CostTotalFee = u.GroundHandlingFee + u.CostStoreFee + u.CostExpressFee + u.CostOperateFee + u.CostOtherFee, //邮政总成本 CostStatus = u.CostStatus.ToChinese(), //邮政结算状态 InComeLoadFee = u.InComeLoadFee, //客户提货费 InComeStoreFee = u.InComeStoreFee, //客户仓租 InComeExpressFee = u.InComeExpressFee, //客户运费 InComeOperateFee = u.InComeOperateFee, //客户操作费 InComeOtherFee = u.InComeOtherFee, //其他费用 InComeTotalFee = u.InComeLoadFee + u.InComeStoreFee + u.InComeExpressFee + u.InComeOperateFee + u.InComeOtherFee, //总收入 InComeStatus = u.InComeStatus.ToChinese(), //结算状态 TotalGrossProfit = (u.InComeLoadFee + u.InComeStoreFee + u.InComeExpressFee + u.InComeOperateFee + u.InComeOtherFee) - (u.GroundHandlingFee + u.CostStoreFee + u.CostExpressFee + u.CostOperateFee + u.CostOtherFee), //总毛利 GrossProfitRate = Math.Round((u.InComeLoadFee + u.InComeStoreFee + u.InComeExpressFee + u.InComeOperateFee + u.InComeOtherFee) == 0 ? 0 : (1 - (u.GroundHandlingFee + u.CostStoreFee + u.CostExpressFee + u.CostOperateFee + u.CostOtherFee) / (u.InComeLoadFee + u.InComeStoreFee + u.InComeExpressFee + u.InComeOperateFee + u.InComeOtherFee)) * 100, 2), //毛利率 Status = u.Status, IsReal = u.IsReal, ExpressWeight = u.ExpressWeight, IsAddMonthPayOff = u.IsAddMonthPayOff, ReconcileDate = u.ReconcileDate.ToStringDate() }); //构造成Json的格式传递 var result = new { iTotalRecords = DataSource.Count, iTotalDisplayRecords = DataSource.RecordTotal, data = data }; return(Json(result)); }
public static void ExportExcel(string excelPath, MonthPayOffExportFilter filter) { var dataSource = Core.Receivable.MonthPayOff.GetById(filter); List <MonthPayOff> queryData = dataSource.ToList(); var loadBillData = LoadBillReconciliation.GetByMonthPayOffExportFilter(new LBRForMonthPayOffExportFilter() { MonthPayOffIDList = filter.ListID }); List <LoadBillReconciliation> loadBillList = loadBillData.ToList(); GenerateExcel genExcel = new GenerateExcel(); genExcel.SheetList.Add(new MonthPayOffSheet(queryData, "总表")); genExcel.SheetList.Add(new LoadBillSheet(loadBillList, "提单汇总")); genExcel.SheetList.Add(new WayBillSummarySheet(new List <WayBillReconciliation>(), "运单汇总")); genExcel.ExportExcel(excelPath); }