251 lines
7.4 KiB
C#
251 lines
7.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using BeWoPlanerMobil.Util.ReportUtils;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWoPlanerMobil.Models
|
|
{
|
|
public class ReportModel : AbstractModel
|
|
{
|
|
[Display(Name = "Klient")]
|
|
public long? SelectedCustomerOid => SelectedCustomer?.CustomerOid;
|
|
|
|
public CompactCustomerDC SelectedCustomer { get; set; }
|
|
|
|
public List<CompactCustomerDC> Customers { get; set; }
|
|
|
|
public IEnumerable<SelectListItem> CustomerListItems
|
|
{
|
|
get
|
|
{
|
|
var result = new List<SelectListItem>();
|
|
|
|
result.AddRange(Customers.Select(customer => new SelectListItem {Value = customer.CustomerOid.ToString(), Text = customer.ToString()}));
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
[Display(Name = "Monat")] public int SelectedMonth { get; set; } = 1;
|
|
|
|
[Display(Name = "Jahr")] public int SelectedYear { get; set; } = 2021;
|
|
|
|
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;
|
|
var year = SelectedYear;
|
|
|
|
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; }
|
|
|
|
public List<CompactEmployeeDC> Employees { get; set; } = new List<CompactEmployeeDC>();
|
|
|
|
public List<SelectListItem> EmployeeItems
|
|
{
|
|
get
|
|
{
|
|
var result = new List<SelectListItem>();
|
|
|
|
foreach(var employee in Employees)
|
|
{
|
|
result.AddIfNotIn(new SelectListItem
|
|
{
|
|
Value = employee.EmployeeOid.ToString(),
|
|
Text = employee.ToString()
|
|
});
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
[Display(Name="Kostenträger")]
|
|
public long? SelectedOrganisationOid => SelectedOrganisation?.OrganisationOid;
|
|
|
|
public CompactOrganisationDC SelectedOrganisation { get; set; }
|
|
|
|
public List<CompactOrganisationDC> Organisations { get; set; } = new List<CompactOrganisationDC>();
|
|
|
|
public List<SelectListItem> OrganisationItems
|
|
{
|
|
get
|
|
{
|
|
var result = new List<SelectListItem>();
|
|
|
|
foreach(var organisation in Organisations)
|
|
{
|
|
result.AddIfNotIn(new SelectListItem()
|
|
{
|
|
Value = organisation.OrganisationOid.ToString(),
|
|
Text = organisation.Name
|
|
});
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
[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 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>();
|
|
|
|
foreach(var team in AllTeams)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
} |