First major version of the project
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.
This commit is contained in:
20
OpheliasOasis/Reporting/Accommodation.cs
Normal file
20
OpheliasOasis/Reporting/Accommodation.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ophelias.Reporting
|
||||
{
|
||||
internal class Accomodation
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ophelias.Reporting
|
||||
namespace Ophelias.Reporting
|
||||
{
|
||||
internal class Email
|
||||
{
|
||||
private readonly string to;
|
||||
private readonly string subject = "Your payment is due soon!";
|
||||
private readonly string body = "Hello valued customer, this is a reminder that your payment for your reservation is due soon, please login to the system and pay for your reservation. If you do not it will be canceled.";
|
||||
private readonly string from = "no-reply@ophelias.oasis";
|
||||
|
||||
internal Email(string to)
|
||||
{
|
||||
this.to = to;
|
||||
}
|
||||
internal void Send()
|
||||
{
|
||||
File.AppendAllText(Path.GetFullPath("Emails.txt"),
|
||||
$"TO: {to}\n" +
|
||||
$"FROM: {from}\n" +
|
||||
$"SUBJECT: {subject}\n" +
|
||||
$"MESSAGE: {body}\n" +
|
||||
$"\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Ophelias.Models;
|
||||
using Ophelias.Managers;
|
||||
|
||||
|
||||
namespace Ophelias.Reporting
|
||||
{
|
||||
internal class Management
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Ophelias.Models;
|
||||
|
||||
|
||||
namespace Ophelias.Reporting
|
||||
{
|
||||
internal class Operational
|
||||
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" +
|
||||
$"{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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user