diff --git a/agent/dashboard.php b/agent/dashboard.php index c020f993..92e88950 100644 --- a/agent/dashboard.php +++ b/agent/dashboard.php @@ -179,7 +179,7 @@ if ($user_config_dashboard_financial_enable == 1) {
Income
diff --git a/agent/includes/client_side_nav.php b/agent/includes/client_side_nav.php index 320a14cf..0a7a7747 100644 --- a/agent/includes/client_side_nav.php +++ b/agent/includes/client_side_nav.php @@ -304,13 +304,13 @@ = 1) { ?>- Payments + Income 0) { ?> - + if ($num_income > 0) { ?> +
diff --git a/agent/includes/inc_all_client.php b/agent/includes/inc_all_client.php index 24c01b7b..cc676179 100644 --- a/agent/includes/inc_all_client.php +++ b/agent/includes/inc_all_client.php @@ -201,8 +201,11 @@ if (isset($_GET['client_id'])) { $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('recurring_invoice_id') AS num FROM recurring_invoices WHERE recurring_invoice_archived_at IS NULL AND recurring_invoice_client_id = $client_id")); $num_recurring_invoices = $row['num']; - $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('payment_id') AS num FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $client_id")); - $num_payments = $row['num']; + $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT + (SELECT COUNT(payment_id) FROM payments, invoices WHERE payment_invoice_id = invoice_id AND payment_archived_at IS NULL AND invoice_client_id = $client_id) + + (SELECT COUNT(revenue_id) FROM revenues LEFT JOIN transfers ON transfer_revenue_id = revenue_id WHERE transfer_id IS NULL AND revenue_archived_at IS NULL AND revenue_client_id = $client_id) + AS num")); + $num_income = $row['num']; $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('file_id') AS num FROM files WHERE file_archived_at IS NULL AND file_client_id = $client_id")); $num_files = $row['num']; diff --git a/agent/includes/side_nav.php b/agent/includes/side_nav.php index 2680b350..abbf9fd1 100644 --- a/agent/includes/side_nav.php +++ b/agent/includes/side_nav.php @@ -139,15 +139,9 @@Payments
- -Revenues
+Income
Invoice Payments
+Other Revenue
+Total Income
+| + + Date + + | ++ + Type + + | ++ + Source + + | + ++ + Client + + | + ++ + Amount + + | ++ + Method + + | ++ + Reference + + | ++ + Account + + | +Action | +
|---|---|---|---|---|---|---|---|---|
| + + + + | ++ | + + + + + + + + | + ++ + + + - + + | + ++ | + | + | + |
+ = 3) { ?>
+
+
+
+
+
+ |
+
Income
+diff --git a/agent/includes/client_side_nav.php b/agent/includes/client_side_nav.php +index 320a14c..0a7a774 100644 +--- a/agent/includes/client_side_nav.php ++++ b/agent/includes/client_side_nav.php +@@ -304,13 +304,13 @@ + + = 1) { ?> ++- Payments ++ Income + 0) { ?> +- ++ if ($num_income > 0) { ?> ++ + +
+ +diff --git a/agent/includes/inc_all_client.php b/agent/includes/inc_all_client.php +index 24c01b7..cc67617 100644 +--- a/agent/includes/inc_all_client.php ++++ b/agent/includes/inc_all_client.php +@@ -201,8 +201,11 @@ if (isset($_GET['client_id'])) { + $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('recurring_invoice_id') AS num FROM recurring_invoices WHERE recurring_invoice_archived_at IS NULL AND recurring_invoice_client_id = $client_id")); + $num_recurring_invoices = $row['num']; + +- $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('payment_id') AS num FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $client_id")); +- $num_payments = $row['num']; ++ $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ++ (SELECT COUNT(payment_id) FROM payments, invoices WHERE payment_invoice_id = invoice_id AND payment_archived_at IS NULL AND invoice_client_id = $client_id) ++ + (SELECT COUNT(revenue_id) FROM revenues LEFT JOIN transfers ON transfer_revenue_id = revenue_id WHERE transfer_id IS NULL AND revenue_archived_at IS NULL AND revenue_client_id = $client_id) ++ AS num")); ++ $num_income = $row['num']; + + $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('file_id') AS num FROM files WHERE file_archived_at IS NULL AND file_client_id = $client_id")); + $num_files = $row['num']; +diff --git a/agent/includes/side_nav.php b/agent/includes/side_nav.php +index 2680b35..abbf9fd 100644 +--- a/agent/includes/side_nav.php ++++ b/agent/includes/side_nav.php +@@ -139,15 +139,9 @@ +Payments
+- +-Revenues
++Income
+ +Invoice Payments
++Other Revenue
++Total Income
++| ++ ++ Date ++ ++ | ++++ ++ Type ++ ++ | ++++ ++ Source ++ ++ | ++ ++++ ++ Client ++ ++ | ++ ++++ ++ Amount ++ ++ | ++++ ++ Method ++ ++ | ++++ ++ Reference ++ ++ | ++++ ++ Account ++ ++ | ++Action | ++
|---|---|---|---|---|---|---|---|---|
| ++ ++ ++ ++ | ++++ | ++ ++ ++ ++ ++ ++ ++ ++ | ++ ++++ ++ ++ ++ - ++ ++ | ++ ++++ | ++ | ++ | ++ |
++ = 3) { ?>
++
++
++
++
++
++ |
++