272 lines
8.9 KiB
C#
272 lines
8.9 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 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 => SelectedCustomer?.CustomerOid;
|
|
|
|
public CompactCustomerDC SelectedCustomer { get; set; }
|
|
|
|
[Display(Name = "Monat")]
|
|
public int? SelectedMonth { get; set; }
|
|
|
|
[Display(Name = "Jahr")]
|
|
public int? SelectedYear { get; set; }
|
|
|
|
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; set; }
|
|
|
|
[Display(Name = "Bis")]
|
|
public int? SelectedEndDay { get; set; }
|
|
|
|
public ConfirmationReceiptObject ConfirmationReceiptObject { get; set; }
|
|
|
|
[Display(Name = "Mitarbeiter")]
|
|
public long? SelectedEmployeeOid => SelectedEmployee?.EmployeeOid;
|
|
|
|
public CompactEmployeeDC SelectedEmployee { get; set; }
|
|
|
|
[Display(Name="Kostenträger")]
|
|
public long? SelectedOrganisationOid => SelectedOrganisation?.OrganisationOid;
|
|
|
|
public CompactOrganisationDC SelectedOrganisation { get; set; }
|
|
|
|
public List<CompactOrganisationDC> Organisations { get; set; } = new List<CompactOrganisationDC>();
|
|
|
|
[Display(Name="Leistungskategorie")]
|
|
public long? SelectedServiceCategoryOid => SelectedServiceCategory?.ServiceCategoryOid;
|
|
|
|
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; set; }
|
|
|
|
public int? SelectedFilterItemId
|
|
{
|
|
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 => SelectedTeam?.TeamOid;
|
|
|
|
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; set; }
|
|
public bool IsForSelectedCostbearersOnly { get; set; }
|
|
public bool IsForSelectedCategoryOnly { get; set; }
|
|
|
|
public List<ConfirmationReceiptSignatureObject> SelectedConfirmationReceiptSignatures { get; set; }
|
|
|
|
public Quittierungsbelegsunterschriftenobjekt Quittierungsbelegsunterschriftenobjekt { get; set; }
|
|
|
|
public AbstractReportCreator ReportCreator { get; set; }
|
|
|
|
public XtraReport QuittierungsbelegsReportObject { 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;
|
|
}
|
|
} |