From 47755ee7c537243f8981c747954c31f918f2b85b Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 9 Jan 2023 14:47:25 -0500 Subject: [PATCH] Added Recurring Monthly Billing stat to client header --- inc_all_client.php | 14 ++++++++++++++ inc_client_top_head.php | 1 + 2 files changed, 15 insertions(+) diff --git a/inc_all_client.php b/inc_all_client.php index 1c62ed2c..17b04c00 100644 --- a/inc_all_client.php +++ b/inc_all_client.php @@ -89,6 +89,20 @@ if(isset($_GET['client_id'])){ $balance = $invoice_amounts - $amount_paid; + //Get Monthly Recurring Total + $sql_recurring_monthly_total = mysqli_query($mysqli,"SELECT SUM(recurring_amount) AS recurring_monthly_total FROM recurring WHERE recurring_status = 1 AND recurring_frequency = 'month' AND recurring_client_id = $client_id AND company_id = $session_company_id"); + $row = mysqli_fetch_array($sql_recurring_monthly_total); + + $recurring_monthly_total = $row['recurring_monthly_total']; + + //Get Yearly Recurring Total + $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 recurring_client_id = $client_id AND company_id = $session_company_id"); + $row = mysqli_fetch_array($sql_recurring_yearly_total); + + $recurring_yearly_total = $row['recurring_yearly_total'] / 12; + + $recurring_monthly = $recurring_monthly_total + $recurring_yearly_total; + //Badge Counts $row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('contact_id') AS num FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id")); diff --git a/inc_client_top_head.php b/inc_client_top_head.php index 881733a5..5582e69e 100644 --- a/inc_client_top_head.php +++ b/inc_client_top_head.php @@ -87,6 +87,7 @@ $location_phone = formatPhoneNumber($location_phone);

Billing

Paid
Balance
float-right">
+
Monthly Recurring
Net Terms
Days