Removed unused functions and documented reporting
This commit is contained in:
@@ -6,49 +6,68 @@ namespace Ophelias.Reporting
|
||||
{
|
||||
internal static class Management
|
||||
{
|
||||
/*
|
||||
* The management class is a collection of functions used in management
|
||||
* reporting. Specifically, the expected incomes, losses, and occupancy.
|
||||
* All of these functions share similar functionality with different
|
||||
* strings.
|
||||
*/
|
||||
internal static void CalculateExpectedOccupancy(List<(DateTime, int, int, int, int, int)> items, double average)
|
||||
{
|
||||
/*
|
||||
* This function formats the data provided into a string that details the Date, Rooms Filled, # of Conventional,
|
||||
* # of Prepaid, # of 60-day, and # of Incentive reservations. These are what the five ints are in the
|
||||
* List items. The average is the calcualted average expected occupancy.
|
||||
*/
|
||||
List<string> entries = new();
|
||||
foreach (var x in items)
|
||||
foreach (var x in items) // Build a list of entries
|
||||
{
|
||||
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" +
|
||||
$"{string.Join("\n", entries)}\n" + // Combine entries at this location in the string
|
||||
$"Average Occupancy Rate: {average}\n\n";
|
||||
|
||||
File.AppendAllText(Path.GetFullPath("ExpectedOccupancy.txt"), report);
|
||||
File.AppendAllText(Path.GetFullPath("ExpectedOccupancy.txt"), report); // Write to file
|
||||
}
|
||||
internal static void CalculateExpectedIncome(List<(DateTime, double)> items, double totalIncome, double average)
|
||||
{
|
||||
/*
|
||||
* This function formats the expected income into a string with the details Date and Income as columns.
|
||||
* The total income and average are appended after the columns as per the design doc.
|
||||
*/
|
||||
List<string> entries = new();
|
||||
foreach (var x in items)
|
||||
foreach (var x in items) // Build a list of entries
|
||||
{
|
||||
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" +
|
||||
$"{string.Join("\n", entries)}\n" + // Combine entries at this location in the string
|
||||
$"Average Income: {average}\n" +
|
||||
$"Total Income: {totalIncome}\n\n";
|
||||
|
||||
File.AppendAllText(Path.GetFullPath("ExpectedIncome.txt"), report);
|
||||
File.AppendAllText(Path.GetFullPath("ExpectedIncome.txt"), report); // Write to file
|
||||
}
|
||||
internal static void CalculateIncentiveLosses(List<(DateTime, double)> items, double totalLosses, double average)
|
||||
{
|
||||
/*
|
||||
* This function formats the expected income into a string with the details Date and Losses as columns.
|
||||
* The total losses and average losses are appended after the columns as per the design doc.
|
||||
*/
|
||||
List<string> entries = new();
|
||||
foreach (var x in items)
|
||||
foreach (var x in items) // Build a list of entries
|
||||
{
|
||||
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" +
|
||||
$"{string.Join("\n", entries)}\n" + // Combine entries at this location in the string
|
||||
$"Average Losses (Due to incentive): {average}\n" +
|
||||
$"Total Losses (Due to incentive): {totalLosses}\n\n";
|
||||
|
||||
File.AppendAllText(Path.GetFullPath("IncentiveLosses.txt"), report);
|
||||
File.AppendAllText(Path.GetFullPath("IncentiveLosses.txt"), report); // Write to file
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user