diff --git a/dashboard.php b/dashboard.php index 18d67ead..cca68d5e 100644 --- a/dashboard.php +++ b/dashboard.php @@ -128,7 +128,7 @@ if ($user_config_dashboard_financial_enable == 1) { ORDER BY expense_id DESC LIMIT 5 "); - // Get recurring totals + // Get recurring invoice totals $sql_recurring_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_amount) AS recurring_yearly_total FROM recurring WHERE recurring_status = 1 AND recurring_frequency = 'year' AND YEAR(recurring_created_at) <= $year"); $row = mysqli_fetch_array($sql_recurring_yearly_total); $recurring_yearly_total = floatval($row['recurring_yearly_total']); @@ -137,14 +137,16 @@ if ($user_config_dashboard_financial_enable == 1) { $row = mysqli_fetch_array($sql_recurring_monthly_total); $recurring_monthly_total = floatval($row['recurring_monthly_total']) + ($recurring_yearly_total / 12); - $sql_recurring_expense_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_expense_amount) AS recurring_expense_yearly_total FROM recurring_expenses WHERE recurring_expense_status = 1 AND recurring_expense_frequency = 'year' AND YEAR(recurring_expense_created_at) <= $year"); + // Recurring expenses totals + $sql_recurring_expense_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_expense_amount) AS recurring_expense_yearly_total FROM recurring_expenses WHERE recurring_expense_status = 1 AND recurring_expense_frequency = 2 AND YEAR(recurring_expense_created_at) <= $year"); $row = mysqli_fetch_array($sql_recurring_expense_yearly_total); $recurring_expense_yearly_total = floatval($row['recurring_expense_yearly_total']); - $sql_recurring_expense_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_expense_amount) AS recurring_expense_monthly_total FROM recurring_expenses WHERE recurring_expense_status = 1 AND recurring_expense_frequency = 'month' AND YEAR(recurring_expense_created_at) <= $year"); + $sql_recurring_expense_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_expense_amount) AS recurring_expense_monthly_total FROM recurring_expenses WHERE recurring_expense_status = 1 AND recurring_expense_frequency = 1 AND YEAR(recurring_expense_created_at) <= $year"); $row = mysqli_fetch_array($sql_recurring_expense_monthly_total); $recurring_expense_monthly_total = floatval($row['recurring_expense_monthly_total']) + ($recurring_expense_yearly_total / 12); + // Get miles driven $sql_miles_driven = mysqli_query($mysqli, "SELECT SUM(trip_miles) AS total_miles FROM trips WHERE YEAR(trip_date) = $year"); $row = mysqli_fetch_array($sql_miles_driven); $total_miles = floatval($row['total_miles']); @@ -165,6 +167,7 @@ if ($user_config_dashboard_financial_enable == 1) { $vendors_added = intval($row['vendors_added']); ?>