public ActionResult CommissionsReport(int idPeriod = 0, int page = 1) { var period = new Period().GetAll(Settings.AutenticationKeyEarningSystem).OrderByDescending(m => m.DataInicio).Where(m => m.IdStatusPeriodo == 2 || m.IdStatusPeriodo == 3).ToList(); ViewBag.Periods = GetPeriodSelectListItem(period, idPeriod); if (idPeriod != 0) { ViewBag.SelectedPeriod = idPeriod; } else { var periodAnterior = period.FirstOrDefault(m => m.DataTermino < DateTime.Today); if (periodAnterior == null || periodAnterior == new PeriodModel()) { periodAnterior = period.FirstOrDefault() ?? new PeriodModel(); } ViewBag.SelectedPeriod = periodAnterior.IdPeriodo; } var consolidatedCommissionModel = new List<ConsolidatedCommissionModel>(); if (idPeriod != 0) { consolidatedCommissionModel = new Commissions().SelectConsolidatedCommissions(Settings.AutenticationKeyEarningSystem, idPeriod).ToList(); ViewBag.TotalComissoes = consolidatedCommissionModel.Sum(m => m.ValorComissionamento); ViewBag.TotalComissoesPagas = consolidatedCommissionModel.Where(m => m.IsPago).Sum(m => m.ValorComissionamento); ViewBag.TotalCompras = consolidatedCommissionModel.Sum(m => m.ValorPedido); ViewBag.IsPartial = period.Any(m => m.IdPeriodo == idPeriod && m.IdStatusPeriodo == 3); } return View(CreateMvcList(consolidatedCommissionModel, page)); }
public ActionResult AnalyticalReport(int idPeriod = 0) { var periods = new Period().GetAll(Settings.AutenticationKeyEarningSystem).OrderByDescending(m => m.DataInicio).ToList(); ViewBag.Periods = GetPeriodSelectListItem(periods, idPeriod); var orders = new List<OrderModels>(); if (idPeriod != 0) { var period = periods.FirstOrDefault(m => m.IdPeriodo == idPeriod); orders = SetValues(idPeriod, period); } return View(orders); }
public ActionResult PrintAnalyticalReport(int idPeriod = 0) { var period = new Period().Get(Settings.AutenticationKeyEarningSystem, idPeriod); if (idPeriod != 0) { ViewBag.Period = period.DataInicio.ToString(Resource.Date_Format_EN_US) + Resource.GS_Hifem + period.DataTermino.ToString(Resource.Date_Format_EN_US); } var orders = new List<OrderModels>(); if (idPeriod != 0) { orders = SetValues(idPeriod, period); } return View(orders); }
public ActionResult PrintCommissionsReport(int idPeriod = 0) { if (idPeriod != 0) { var period = new Period().Get(Settings.AutenticationKeyEarningSystem, idPeriod); ViewBag.Period = period.DataInicio.ToString(Resources.Resource.GS_CommissionsReport_DateFormat) + " - " + period.DataTermino.ToString(Resources.Resource.GS_CommissionsReport_DateFormat); if (period.IdStatusPeriodo == 3) { ViewBag.Partial = Resources.Resource.GS_CommissionsReport_PartialMsg; } } else { return View(new List<ConsolidatedCommissionModel>()); } var consolidatedCommissionModel = new List<ConsolidatedCommissionModel>(); if (idPeriod != 0) { consolidatedCommissionModel = new Commissions().SelectConsolidatedCommissions(Settings.AutenticationKeyEarningSystem, idPeriod).ToList(); ViewBag.TotalComissoes = consolidatedCommissionModel.Sum(m => m.ValorComissionamento); ViewBag.TotalComissoesPagas = consolidatedCommissionModel.Where(m => m.IsPago).Sum(m => m.ValorComissionamento); ViewBag.TotalCompras = consolidatedCommissionModel.Sum(m => m.ValorPedido); } return View(consolidatedCommissionModel); }