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.
21 lines
847 B
C#
21 lines
847 B
C#
using Ophelias.Models;
|
|
namespace Ophelias.Reporting
|
|
{
|
|
internal static class Accommodation
|
|
{
|
|
internal static void GenerateAccommodationBills(List<Reservation> reservations)
|
|
{
|
|
foreach (Reservation? r in reservations)
|
|
{
|
|
string report = $"ACCOMMODATION BILL - GENERATED ON {DateTime.Now.Date.ToString("yyyy-MM-dd")}\n" +
|
|
$"Name: {r.Guest.LastName}, {r.Guest.FirstName}\n" +
|
|
$"Arrival Date: {r.StartDate}\n" +
|
|
$"Departure Date: {r.EndDate}\n" +
|
|
$"Length of Stay: {(int)(r.EndDate.Date - r.StartDate.Date).TotalDays} days\n" +
|
|
$"Charged: ${r.Transaction.Owed}\n\n";
|
|
File.AppendAllText(Path.GetFullPath("AccommodationBills.txt"), report);
|
|
}
|
|
}
|
|
}
|
|
}
|