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:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user