Fixed an incorrect calulation

The calculations used in the reports were calulating based off the
owed column which mathematically did not make sense since we are looking
for the daily.
This commit is contained in:
雲華
2022-04-17 17:44:41 -04:00
parent e13b0f8740
commit 0ce34d9d23
3 changed files with 18 additions and 7 deletions

View File

@@ -190,7 +190,7 @@ namespace Ophelias.Managers
{
using (SQLiteCommand cmd = Manager.con.CreateCommand()) // Create a new command to execute
{
cmd.CommandText = "SELECT sum(((julianday(EndDate) - julianday(StartDate)) * transactions.Rate) - transactions.Owed) AS Loss " +
cmd.CommandText = "SELECT sum(transactions.Rate - (transactions.Rate * transactions.Multiplier)) AS Loss " +
"FROM reservations " +
"INNER JOIN transactions ON reservations.TransactionID = transactions.ID " +
"WHERE (DATE(@Date) BETWEEN StartDate AND EndDate) AND STATUS IN (@Status1,@Status2) AND Type = @Type";
@@ -234,7 +234,7 @@ namespace Ophelias.Managers
{
using (SQLiteCommand cmd = Manager.con.CreateCommand()) // Create a new command to execute
{
cmd.CommandText = "SELECT sum(transactions.Owed) FROM reservations " +
cmd.CommandText = "SELECT sum(transactions.Rate * Multiplier) FROM reservations " +
"INNER JOIN transactions ON reservations.TransactionID = transactions.ID " +
"WHERE (DATE(@Date) BETWEEN StartDate AND EndDate) AND Status IN (@Status1,@Status2);";
cmd.Parameters.AddWithValue("@Date", dt.AddDays(i).Date.ToString("yyyy-MM-dd"));