This is a small commit to include the feature for paying for a reservation, specifically only the 60-day-in-advance reservation type as the others are paid for at specific periods. Other fixes include just some formatting for reports.
63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
using Ophelias.Models;
|
|
|
|
|
|
namespace Ophelias.Reporting
|
|
{
|
|
internal static class Operational
|
|
{
|
|
internal static void FetchDailyArriavals(List<Reservation> reservations)
|
|
{
|
|
List<string> entries = new();
|
|
foreach (Reservation r in reservations)
|
|
{
|
|
string roominfo;
|
|
if (!r.RoomNum.HasValue)
|
|
{
|
|
roominfo = "N/A";
|
|
}
|
|
else
|
|
{
|
|
|
|
roominfo = r.RoomNum.Value.ToString();
|
|
}
|
|
|
|
entries.Add($"{r.Guest.LastName}, {r.Guest.FirstName}\t{r.Type}\t{roominfo}\t{r.EndDate}");
|
|
}
|
|
string report = $"DAILY ARRIVAL REPORT - GENERATED ON {DateTime.Now.Date.ToString("yyyy-MM-dd")}\n" +
|
|
$"Last, First\tType\tRoom\tDeparture\n" +
|
|
$"{string.Join("\n", entries)}\n\n";
|
|
|
|
File.AppendAllText(Path.GetFullPath("DailyArrivals.txt"), report);
|
|
}
|
|
internal static void FetchDailyOccupancy(List<(DateTime, int, string, string)> cop, List<int> pop)
|
|
{
|
|
List<string> entries = new();
|
|
foreach (var c in cop)
|
|
{
|
|
string lastOccupied;
|
|
string sameDayLeave = "";
|
|
if (pop.Contains(c.Item2))
|
|
{
|
|
lastOccupied = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
|
|
} else
|
|
{
|
|
lastOccupied = "N/A";
|
|
}
|
|
|
|
if(DateTime.Now.Date == c.Item1.Date)
|
|
{
|
|
sameDayLeave = "*";
|
|
}
|
|
entries.Add($"{c.Item2}\t{lastOccupied}\t{sameDayLeave}{c.Item3}, {c.Item4}");
|
|
}
|
|
string report = $"DAILY OCCUPANCY REPORT - GENERATED ON {DateTime.Now.Date.ToString("yyyy-MM-dd")}\n" +
|
|
$"An * means that the guest is leaving the same day.\n" +
|
|
$"Room #\tPrev. Occupied\tCurrent Occupant\n" +
|
|
$"{string.Join("\n", entries)}\n\n";
|
|
|
|
File.AppendAllText(Path.GetFullPath("DailyOccupancy.txt"), report);
|
|
}
|
|
|
|
}
|
|
}
|