299 lines
11 KiB
C#
299 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using BeWo.Report;
|
|
using BeWoPlanerMobil.Controllers;
|
|
using BeWoPlanerMobil.Util.ReportUtils;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace BeWoPlanerMobil.Models
|
|
{
|
|
public class ReportModel : AbstractModel
|
|
{
|
|
public ReportModel()
|
|
{
|
|
SessionModel = new ReportSessionModel();
|
|
}
|
|
|
|
public ReportSessionModel ReportSessionModel
|
|
{
|
|
get
|
|
{
|
|
return SessionModel as ReportSessionModel;
|
|
}
|
|
}
|
|
|
|
public QbSignatureIntervalSelection SelectedIntervalSelection { get; set; }
|
|
|
|
public List<SelectListItem> IntervalSelections => new List<SelectListItem>
|
|
{
|
|
new SelectListItem
|
|
{
|
|
Text = QbSignatureIntervalSelection.FirstHalf.GetEnumDescription(),
|
|
Value = ((int) QbSignatureIntervalSelection.FirstHalf).ToString(),
|
|
Selected = SelectedIntervalSelection == QbSignatureIntervalSelection.FirstHalf
|
|
},
|
|
new SelectListItem
|
|
{
|
|
Text = QbSignatureIntervalSelection.SecondHalf.GetEnumDescription(),
|
|
Value = ((int) QbSignatureIntervalSelection.SecondHalf).ToString(),
|
|
Selected = SelectedIntervalSelection == QbSignatureIntervalSelection.SecondHalf
|
|
},
|
|
new SelectListItem
|
|
{
|
|
Text = QbSignatureIntervalSelection.WholeMonth.GetEnumDescription(),
|
|
Value = ((int) QbSignatureIntervalSelection.WholeMonth).ToString(),
|
|
Selected = SelectedIntervalSelection == QbSignatureIntervalSelection.WholeMonth
|
|
}
|
|
};
|
|
|
|
[Display(Name = "Klient")]
|
|
public long? SelectedCustomerOid { get { return ReportSessionModel.SelectedCustomerOid; } set { ReportSessionModel.SelectedCustomerOid = value; } }
|
|
|
|
public CompactCustomerDC SelectedCustomer { get; set; }
|
|
|
|
[Display(Name = "Monat")]
|
|
public int? SelectedMonth { get { return ReportSessionModel.SelectedMonth; } set { ReportSessionModel.SelectedMonth = value; } }
|
|
|
|
[Display(Name = "Jahr")]
|
|
public int? SelectedYear { get { return ReportSessionModel.SelectedYear; } set { ReportSessionModel.SelectedYear = value; } }
|
|
|
|
public List<SelectListItem> Months
|
|
{
|
|
get
|
|
{
|
|
var result = new List<SelectListItem>();
|
|
|
|
for(var i = 1; i < 13; i++)
|
|
{
|
|
result.Add(new SelectListItem
|
|
{
|
|
Value = i.ToString(),
|
|
Text = new DateTime(DateTime.Now.Year, i, 1).ToString("MMMM")
|
|
});
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
public List<SelectListItem> Years
|
|
{
|
|
get
|
|
{
|
|
var result = new List<SelectListItem>();
|
|
|
|
for(var i = DateTime.Today.Year; i > DateTime.Today.Year - 11; i--)
|
|
{
|
|
result.Add(new SelectListItem
|
|
{
|
|
Value = i.ToString(),
|
|
Text = i.ToString()
|
|
});
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
public List<SelectListItem> Days
|
|
{
|
|
get
|
|
{
|
|
var result = new List<SelectListItem>();
|
|
|
|
var month = SelectedMonth ?? DateTime.Today.Month;
|
|
var year = SelectedYear ?? DateTime.Today.Year;
|
|
|
|
var last = new DateTime(year, month, 1).AddMonths(1).AddDays(-1).Day;
|
|
|
|
for(var i = 1; i <= last; i++)
|
|
{
|
|
result.Add(new SelectListItem
|
|
{
|
|
Value = i.ToString(),
|
|
Text = i.ToString()
|
|
});
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
[Display(Name = "Vom")]
|
|
public int? SelectedStartDay { get { return ReportSessionModel.SelectedStartDay; } set { ReportSessionModel.SelectedStartDay = value; } }
|
|
|
|
[Display(Name = "Bis")]
|
|
public int? SelectedEndDay { get { return ReportSessionModel.SelectedEndDay; } set { ReportSessionModel.SelectedEndDay = value; } }
|
|
|
|
public ConfirmationReceiptObject ConfirmationReceiptObject { get { return ReportSessionModel.ConfirmationReceiptObject; } set { ReportSessionModel.ConfirmationReceiptObject = value; } }
|
|
|
|
[Display(Name = "Mitarbeiter")]
|
|
public long? SelectedEmployeeOid { get { return ReportSessionModel.SelectedEmployeeOid; } set { ReportSessionModel.SelectedEmployeeOid = value; } }
|
|
|
|
public CompactEmployeeDC SelectedEmployee { get; set; }
|
|
|
|
[Display(Name="Kostenträger")]
|
|
public long? SelectedOrganisationOid { get { return ReportSessionModel.SelectedOrganisationOid; } set { ReportSessionModel.SelectedOrganisationOid = value; } }
|
|
|
|
public CompactOrganisationDC SelectedOrganisation { get; set; }
|
|
|
|
public List<CompactOrganisationDC> Organisations { get; set; } = new List<CompactOrganisationDC>();
|
|
|
|
[Display(Name="Leistungskategorie")]
|
|
public long? SelectedServiceCategoryOid { get { return ReportSessionModel.SelectedServiceCategoryOid; } set { ReportSessionModel.SelectedServiceCategoryOid = value; } }
|
|
|
|
public ServiceCategoryDC SelectedServiceCategory { get; set; }
|
|
|
|
public List<ServiceCategoryDC> ServiceCategories { get; set; } = new List<ServiceCategoryDC>();
|
|
|
|
public List<SelectListItem> ServiceCategoryItems
|
|
{
|
|
get
|
|
{
|
|
var result = new List<SelectListItem>();
|
|
|
|
foreach(var serviceCategory in ServiceCategories)
|
|
{
|
|
if(serviceCategory.ServiceCategoryOid == null)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
result.AddIfNotIn(new SelectListItem
|
|
{
|
|
Value = serviceCategory.ServiceCategoryOid.ToString(),
|
|
Text = serviceCategory.Name
|
|
});
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
[Display(Name="Filter")]
|
|
|
|
|
|
public QbFilterItem SelectedFilterItem
|
|
{
|
|
get
|
|
{
|
|
if (QbFilters == null || !SelectedFilterItemId.HasValue)
|
|
{
|
|
return null;
|
|
}
|
|
return QbFilters.FirstOrDefault(f => f.FilterEnum == SelectedFilterItemId.Value);
|
|
}
|
|
}
|
|
|
|
public QBFilterEnum? SelectedFilterItemId { get { return ReportSessionModel.SelectedFilterItemId; } set { ReportSessionModel.SelectedFilterItemId = value; } }
|
|
//{
|
|
// get
|
|
// {
|
|
// if(SelectedFilterItem is null)
|
|
// {
|
|
// return null;
|
|
// }
|
|
|
|
// return (int)SelectedFilterItem.FilterEnum;
|
|
// }
|
|
//}
|
|
|
|
public List<QbFilterItem> QbFilters { get; set; } = new List<QbFilterItem>();
|
|
|
|
public List<SelectListItem> QbFilterItems
|
|
{
|
|
get
|
|
{
|
|
var result = new List<SelectListItem>();
|
|
|
|
foreach(var qbFilter in QbFilters)
|
|
{
|
|
result.AddIfNotIn(new SelectListItem
|
|
{
|
|
Value = ((int) qbFilter.FilterEnum).ToString(),
|
|
Text = qbFilter.Name
|
|
});
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
[Display(Name = "Team")]
|
|
public long? SelectedTeamOid { get { return ReportSessionModel.SelectedTeamOid; } set { ReportSessionModel.SelectedTeamOid = value; } }
|
|
|
|
public CompactTeamDC SelectedTeam { get; set; }
|
|
|
|
public List<CompactTeamDC> AllTeams { get; set; }
|
|
|
|
public List<SelectListItem> Teams
|
|
{
|
|
get
|
|
{
|
|
var result = new List<SelectListItem>();
|
|
|
|
AllTeams?.DoForEach(team =>
|
|
{
|
|
result.Add(new SelectListItem
|
|
{
|
|
Value = team.TeamOid.ToString(),
|
|
Text = team.Name
|
|
});
|
|
});
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
public List<long> ReportServiceRecordOids { get; set; }
|
|
|
|
public List<ConfirmationReceiptSignatureDC> ConfirmationReceiptSignatures { get; set; } = new List<ConfirmationReceiptSignatureDC>();
|
|
|
|
public ConfirmationReceiptSignatureDC GetConfirmationReceiptSignatureByOid(long confirmationReceiptSignatureOid)
|
|
{
|
|
return ConfirmationReceiptSignatures.FirstOrDefault(crs => crs.ConfirmationReceiptSignatureOid == confirmationReceiptSignatureOid);
|
|
}
|
|
|
|
public List<ConfirmationReceiptSignatureDC> GetConfirmationReceitSignaturesByOids(List<long> confirmationReceiptSignatureOids)
|
|
{
|
|
return confirmationReceiptSignatureOids == null ?
|
|
new List<ConfirmationReceiptSignatureDC>() :
|
|
ConfirmationReceiptSignatures.Where(crs => crs.ConfirmationReceiptSignatureOid != null && confirmationReceiptSignatureOids.Contains(crs.ConfirmationReceiptSignatureOid.Value)).ToList();
|
|
}
|
|
|
|
public bool IsForSelectedEmployeesOnly { get { return ReportSessionModel.IsForSelectedEmployeesOnly; } set { ReportSessionModel.IsForSelectedEmployeesOnly = value; } }
|
|
public bool IsForSelectedCostbearersOnly { get { return ReportSessionModel.IsForSelectedCostbearersOnly; } set { ReportSessionModel.IsForSelectedCostbearersOnly = value; } }
|
|
public bool IsForSelectedCategoryOnly { get { return ReportSessionModel.IsForSelectedCategoryOnly; } set { ReportSessionModel.IsForSelectedCategoryOnly = value; } }
|
|
|
|
public List<ConfirmationReceiptSignatureObject> SelectedConfirmationReceiptSignatures { get { return ReportSessionModel.SelectedConfirmationReceiptSignatures; } set { ReportSessionModel.SelectedConfirmationReceiptSignatures = value; } }
|
|
|
|
public Quittierungsbelegsunterschriftenobjekt Quittierungsbelegsunterschriftenobjekt { get { return ReportSessionModel.Quittierungsbelegsunterschriftenobjekt; } set { ReportSessionModel.Quittierungsbelegsunterschriftenobjekt = value; } }
|
|
|
|
public AbstractReportCreator ReportCreator { get; set; }
|
|
|
|
public QuittierungsbelegsReportSettings QuittierungsbelegsReportSettings { get { return ReportSessionModel.QuittierungsbelegsReportSettings; } set { ReportSessionModel.QuittierungsbelegsReportSettings = value; } }
|
|
|
|
public XtraReport QuittierungsbelegsReport { get; set; }
|
|
|
|
public int QbEntryCount { get; set; }
|
|
public int MaxResults { get; set; } = 10;
|
|
public int QbEntryPageCount { get; set; }
|
|
public int CurrentQbEntryPage { get; set; }
|
|
|
|
public List<RatingTypeDC> GoalRatingTypes { get; set; } = new List<RatingTypeDC>();
|
|
|
|
public Dictionary<long, List<string>> ServiceRecordOids2GoalHeader { get; set; }
|
|
|
|
public ValueListEntryDC[] Dokutypes { get; set; }
|
|
|
|
public int NumberOfDokuTypes => Dokutypes?.Length ?? 0;
|
|
}
|
|
} |