MoK: Reports werden alle in einem einzigen PartialView angezeigt und das AbstractModel von dem alle Model erben, hat die Report- und ReportTitle-Eigenschaften.
ServiceRecords werden wie im FaC validiert, d.h. dass Arbeitszeiten und Pausenzeiten keine Überschneidungswarnung bekommen.
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using BeWo.Report;
|
||||
using BeWo.Service.Plugins;
|
||||
using BeWo.View.Navigation.Filter;
|
||||
using BeWoPlanerMobil.Models;
|
||||
using BeWoPlanerMobil.Service;
|
||||
using BeWoPlanerMobil.Util;
|
||||
@@ -14,7 +15,7 @@ using BS.Shared.DataContracts.Compact;
|
||||
|
||||
namespace BeWoPlanerMobil.Controllers
|
||||
{
|
||||
public class ReportViewerController : AbstractBaseController
|
||||
public class ReportViewerController : ReportBaseController
|
||||
{
|
||||
private ReportViewerModel _Model;
|
||||
|
||||
@@ -79,6 +80,7 @@ namespace BeWoPlanerMobil.Controllers
|
||||
|
||||
Model.ReportTypes = new List<SelectListItem>();
|
||||
|
||||
#if DEBUG
|
||||
//if(AbstractModel.HasRightToViewReports)
|
||||
//{
|
||||
// Model.ReportTypes.Add(new SelectListItem
|
||||
@@ -87,6 +89,7 @@ namespace BeWoPlanerMobil.Controllers
|
||||
// Value = "0"
|
||||
// });
|
||||
//}
|
||||
#endif
|
||||
|
||||
if(AbstractModel.HasRightToViewMitarbeiterstundenkonto)
|
||||
{
|
||||
@@ -97,11 +100,38 @@ namespace BeWoPlanerMobil.Controllers
|
||||
});
|
||||
}
|
||||
|
||||
// ToDo: Bis auf weiteres nur Mitarbeiterstundenkonto anzeigen!
|
||||
Model.SelectedReportType = ReportType.Mitarbeiterstundenkonto;//ReportType.Berichte;
|
||||
Model.SelectedReportType = ReportType.Mitarbeiterstundenkonto;
|
||||
|
||||
#if DEBUG
|
||||
//Model.SelectedReportType = ReportType.Berichte;
|
||||
#endif
|
||||
|
||||
Model.Queries = QueryService.GetAllQueriesOfType(QueryType.Public);
|
||||
|
||||
if(Model.Employee?.EmployeeOid.HasValue ?? false)
|
||||
{
|
||||
Model.SupportConcepts = EmployeeService.GetActiveSupportConceptsForEmployee(Model.Employee.EmployeeOid, CustomerFilterEnum.All);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.SupportConcepts = new List<SupportConceptDC>();
|
||||
}
|
||||
|
||||
if(Model.SelectedCostBearer2SupportConceptRelListObject is null)
|
||||
{
|
||||
Model.SelectedCostBearer2SupportConceptRelListObject = Model.CostBearer2SupportConceptRelListObjects.FirstOrDefault(f => f.CostBearer2SupportConceptOid == "-1") ?? Model.CostBearer2SupportConceptRelListObjects.First();
|
||||
}
|
||||
|
||||
if(Model.SelectedMonthForBericht is null)
|
||||
{
|
||||
Model.SelectedMonthForBericht = Model.Months.FirstOrDefault(m => m.Value.Equals(DateTime.Today.Month.ToString()));
|
||||
}
|
||||
|
||||
if(Model.SelectedYearForBericht is null || Model.SelectedYearForBericht.Value < DateTime.Today.AddYears(-10).Year)
|
||||
{
|
||||
Model.SelectedYearForBericht = DateTime.Today.Year;
|
||||
}
|
||||
|
||||
return View(Model);
|
||||
}
|
||||
|
||||
@@ -113,7 +143,7 @@ namespace BeWoPlanerMobil.Controllers
|
||||
TempData[TempDataConstants.DoLogoutKey] = true;
|
||||
}
|
||||
|
||||
return PartialView("DocumentWebViewerPartial", Model);
|
||||
return PartialView("BeWoReportPartial", Model);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
@@ -121,42 +151,74 @@ namespace BeWoPlanerMobil.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Model?.Employee?.EmployeeOid is null || reportOid is null)
|
||||
if(Model?.Employee?.EmployeeOid is null || reportOid is null)
|
||||
{
|
||||
TempData[TempDataConstants.DoLogoutKey] = true;
|
||||
return PartialView("DocumentWebViewerPartial");
|
||||
return PartialView("BeWoReportPartial");
|
||||
}
|
||||
|
||||
var selectedQuery = Model.Queries.FirstOrDefault(query => query.Oid.Equals(reportOid.Value));
|
||||
|
||||
var queryParameter = selectedQuery?.Parameter ?? new List<QueryParamDC>();
|
||||
|
||||
if (selectedQuery is null)
|
||||
if(selectedQuery is null)
|
||||
{
|
||||
Model.Report = null;
|
||||
return PartialView("DocumentWebViewerPartial", Model);
|
||||
return PartialView("BeWoReportPartial", Model);
|
||||
}
|
||||
|
||||
Model.SelectedQuery = selectedQuery;
|
||||
|
||||
var dcid = $"{MobileSessionFacade.Tenant}queryeoid{Model.Employee.EmployeeOid.Value}";
|
||||
|
||||
var test = QueryService.ExecuteQuery(selectedQuery.Oid, null);
|
||||
var queryResult = QueryService.ExecuteQuery(selectedQuery.Oid, null);
|
||||
|
||||
if (test is null)
|
||||
if(queryResult is null)
|
||||
{
|
||||
return PartialView("DocumentWebViewerPartial", Model);
|
||||
return PartialView("BeWoReportPartial", Model);
|
||||
}
|
||||
|
||||
QueryService.PrepareQueryReport(test, dcid);
|
||||
QueryService.PrepareQueryReport(queryResult, dcid);
|
||||
var queryReport = Model.ReportCreator.CreateQueryReport(selectedQuery.Oid, dcid);
|
||||
|
||||
Model.Report = queryReport;
|
||||
Model.ReportName = selectedQuery.Title;
|
||||
}
|
||||
catch (Exception e)
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
TempData[TempDataConstants.ErrorMessageKey] = e.Message;
|
||||
if(Model != null)
|
||||
{
|
||||
Model.ReportName = "Fehler";
|
||||
}
|
||||
TempData[TempDataConstants.ReportErrorMessageKey] = e.Message;
|
||||
}
|
||||
|
||||
return PartialView("DocumentWebViewerPartial", Model);
|
||||
return PartialView("BeWoReportPartial", Model);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public ActionResult LoadBerichteForm(long? reportOid)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(Model?.Employee?.EmployeeOid is null || reportOid is null)
|
||||
{
|
||||
TempData[TempDataConstants.DoLogoutKey] = true;
|
||||
return PartialView("BerichteFormPartialView");
|
||||
}
|
||||
|
||||
var selectedQuery = Model.Queries.FirstOrDefault(query => query.Oid.Equals(reportOid.Value));
|
||||
|
||||
Model.SelectedQuery = selectedQuery;
|
||||
|
||||
return PartialView("BerichteFormPartialView", Model);
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
Log.Error(exception);
|
||||
TempData[TempDataConstants.ReportErrorMessageKey] = exception.Message;
|
||||
}
|
||||
|
||||
return PartialView("BerichteFormPartialView", Model);
|
||||
}
|
||||
|
||||
//[Authorize]
|
||||
@@ -214,7 +276,7 @@ namespace BeWoPlanerMobil.Controllers
|
||||
if(Model?.Employee?.EmployeeOid is null)
|
||||
{
|
||||
TempData[TempDataConstants.DoLogoutKey] = true;
|
||||
return PartialView("DocumentWebViewerPartial");
|
||||
return PartialView("BeWoReportPartial");
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(parameters))
|
||||
@@ -290,7 +352,7 @@ namespace BeWoPlanerMobil.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
return PartialView("DocumentWebViewerPartial", Model);
|
||||
return PartialView("BeWoReportPartial", Model);
|
||||
}
|
||||
|
||||
private static AbstractReportCreator GetReportCreator()
|
||||
@@ -305,5 +367,88 @@ namespace BeWoPlanerMobil.Controllers
|
||||
#endif
|
||||
return creator;
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public override string ResetReport()
|
||||
{
|
||||
if(Model is null)
|
||||
{
|
||||
TempData[TempDataConstants.DoLogoutKey] = true;
|
||||
return LeerzeichenFuerGetMethoden;
|
||||
}
|
||||
|
||||
Model.Report = null;
|
||||
Model.ReportName = null;
|
||||
|
||||
return LeerzeichenFuerGetMethoden;
|
||||
}
|
||||
|
||||
// ToDo: Parameter hinzufügen
|
||||
[Authorize]
|
||||
public ActionResult CreateBerichtWithParameters()
|
||||
{
|
||||
if(Model?.SelectedQuery is null)
|
||||
{
|
||||
TempData[TempDataConstants.DoLogoutKey] = true;
|
||||
return PartialView("BeWoReportPartial");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return PartialView("BeWoReportPartial", Model);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public ActionResult SelectCostBearer2SupportConceptRel(long? relOid)
|
||||
{
|
||||
if(Model?.SelectedQuery is null)
|
||||
{
|
||||
TempData[TempDataConstants.DoLogoutKey] = true;
|
||||
return PartialView("BerichteFormPartialView", Model);
|
||||
}
|
||||
|
||||
if(relOid != null)
|
||||
{
|
||||
Model.SelectedCostBearer2SupportConceptRelListObject = Model.CostBearer2SupportConceptRelListObjects.FirstOrDefault(f => f.CostBearer2SupportConceptOid != null && f.CostBearer2SupportConceptOid.Equals(relOid.Value.ToString()));
|
||||
}
|
||||
|
||||
return PartialView("BerichteFormPartialView", Model);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public ActionResult SelectMonth(string selectedMonth)
|
||||
{
|
||||
if(Model?.SelectedQuery is null)
|
||||
{
|
||||
TempData[TempDataConstants.DoLogoutKey] = true;
|
||||
return PartialView("BerichteFormPartialView");
|
||||
}
|
||||
|
||||
var month = Model.Months.FirstOrDefault(f => f.Value.Equals(selectedMonth));
|
||||
|
||||
if(month != null)
|
||||
{
|
||||
Model.SelectedMonthForBericht = month;
|
||||
}
|
||||
|
||||
return PartialView("BerichteFormPartialView", Model);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public ActionResult SelectYear(string selectedYear)
|
||||
{
|
||||
if(Model?.SelectedQuery is null)
|
||||
{
|
||||
TempData[TempDataConstants.DoLogoutKey] = true;
|
||||
return PartialView("BerichteFormPartialView");
|
||||
}
|
||||
|
||||
if(int.TryParse(selectedYear, out var year))
|
||||
{
|
||||
Model.SelectedYearForBericht = year;
|
||||
}
|
||||
|
||||
return PartialView("BerichteFormPartialView", Model);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user