using Ophelias.Models; namespace Ophelias.Reporting { internal static class Accommodation { internal static void GenerateAccommodationBills(List reservations) { /* * This function is used to format and create a new entry in the AccommodationBills.txt * file. The accommodation bill details the guests Last, First name, the date they arrived, * the date they depart/ departed, the length of their stay in days, and the amount they * were charged. */ 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.Date.ToString("yyyy-MM-dd")}\n" + $"Departure Date: {r.EndDate.Date.ToString("yyyy-MM-dd")}\n" + $"Length of Stay: {(int)(r.EndDate.Date - r.StartDate.Date).TotalDays} days\n" + $"Charged: ${Math.Round(r.Transaction.Owed, 2)}\n\n"; File.AppendAllText(Path.GetFullPath("AccommodationBills.txt"), report); } } } }