This finishes the first iteration of the project. Reports have been tested and are functional in terms of writing out and outputting some form of text. There are still a few bugs here and there that are found but ultimately this commit is so testing can begin. Since the changes are too large to individually summarize, here is the generalization: Reports have been integrated into the admin mode. They write out to text files rather than export to say email or a printer as it was not to be considered for this version. The files are appended too and exist in the debug director of the project. I made this easier to find by outputting where the files were output to after running the report. Other changes included some bug fixes, optimizations, and a few bit of automatic cleanup. This may lead to sylistic inconsistencies. Documentation will come in a later commit.
55 lines
2.4 KiB
C#
55 lines
2.4 KiB
C#
using Ophelias.Models;
|
|
using Ophelias.Managers;
|
|
|
|
|
|
namespace Ophelias.Reporting
|
|
{
|
|
internal static class Management
|
|
{
|
|
internal static void CalculateExpectedOccupancy(List<(DateTime, int, int, int, int, int)> items, double average)
|
|
{
|
|
List<string> entries = new();
|
|
foreach (var x in items)
|
|
{
|
|
entries.Add($"{x.Item1.Date.ToString("yyyy-MM-dd")}\t{x.Item2}\t{x.Item3}\t{x.Item4}\t{x.Item5}\t{x.Item6}");
|
|
}
|
|
string report = $"EXPECTED 30 DAY OCCUPANCY REPORT - GENERATED ON {DateTime.Now.Date.ToString("yyyy-MM-dd")}\n" +
|
|
$"Date\tRooms Filled\tConventional\tPrepaid\t60-Day\tIncentive\n" +
|
|
$"{string.Join("\n", entries)}\n" +
|
|
$"Average Occupancy Rate: {average}\n\n";
|
|
|
|
File.AppendAllText(Path.GetFullPath("ExpectedOccupancy.txt"), report);
|
|
}
|
|
internal static void CalculateExpectedIncome(List<(DateTime, double)> items, double totalIncome, double average)
|
|
{
|
|
List<string> entries = new();
|
|
foreach (var x in items)
|
|
{
|
|
entries.Add($"{x.Item1.Date.ToString("yyyy-MM-dd")}\t{x.Item2}");
|
|
}
|
|
string report = $"EXPECTED 30 DAY INCOME REPORT - GENERATED ON {DateTime.Now.Date.ToString("yyyy-MM-dd")}\n" +
|
|
$"Date\tIncome\n" +
|
|
$"{string.Join("\n", entries)}\n" +
|
|
$"Average Income: {average}\n" +
|
|
$"Total Income: {totalIncome}\n\n";
|
|
|
|
File.AppendAllText(Path.GetFullPath("ExpectedIncome.txt"), report);
|
|
}
|
|
internal static void CalculateIncentiveLosses(List<(DateTime, double)> items, double totalLosses, double average)
|
|
{
|
|
List<string> entries = new();
|
|
foreach (var x in items)
|
|
{
|
|
entries.Add($"{x.Item1.Date.ToString("yyyy-MM-dd")}\t{x.Item2}");
|
|
}
|
|
string report = $"EXPECTED 30 DAY LOSSES (TO INCENTIVE) REPORT - GENERATED ON {DateTime.Now.Date.ToString("yyyy-MM-dd")}\n" +
|
|
$"Date\tLosses\n" +
|
|
$"{string.Join("\n", entries)}\n" +
|
|
$"Average Losses (Due to incentive): {average}\n" +
|
|
$"Total Losses (Due to incentive): {totalLosses}\n\n";
|
|
|
|
File.AppendAllText(Path.GetFullPath("IncentiveLosses.txt"), report);
|
|
}
|
|
}
|
|
}
|