diff --git a/guest_view_invoice.php b/guest_view_invoice.php index 0eff51ce..7576fa27 100644 --- a/guest_view_invoice.php +++ b/guest_view_invoice.php @@ -1,4 +1,6 @@ -
@@ -53,8 +46,10 @@ $invoices_sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_clie # Scope - Date Amount + Date + Due + Status @@ -65,15 +60,52 @@ $invoices_sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_clie $invoice_prefix = htmlentities($row['invoice_prefix']); $invoice_number = htmlentities($row['invoice_number']); $invoice_scope = htmlentities($row['invoice_scope']); + $invoice_status = htmlentities($row['invoice_status']); $invoice_date = $row['invoice_date']; + $invoice_due = $row['invoice_due']; $invoice_amount = floatval($row['invoice_amount']); + $invoice_url_key = htmlentities($row['invoice_url_key']); + + if (empty($invoice_scope)) { + $invoice_scope_display = "-"; + } else { + $invoice_scope_display = $invoice_scope; + } + + $now = time(); + if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) + 86400 < $now ) { + $overdue_color = "text-danger font-weight-bold"; + } else { + $overdue_color = ""; + } + + if ($invoice_status == "Sent") { + $invoice_badge_color = "warning text-white"; + } elseif ($invoice_status == "Viewed") { + $invoice_badge_color = "info"; + } elseif ($invoice_status == "Partial") { + $invoice_badge_color = "primary"; + } elseif ($invoice_status == "Paid") { + $invoice_badge_color = "success"; + } elseif ($invoice_status == "Cancelled") { + $invoice_badge_color = "danger"; + } else{ + $invoice_badge_color = "secondary"; + } ?> - - + "> + + - + + + + + + + " href="tickets.php">Tickets - + diff --git a/portal/profile.php b/portal/profile.php index 7f8b76e0..26ff7058 100644 --- a/portal/profile.php +++ b/portal/profile.php @@ -4,16 +4,21 @@ * User profile */ -require('inc_portal.php'); +require_once('inc_portal.php'); ?> -

Profile

+

Profile

-

Name:

-

Email:

-

Client:

-

Client Primary Contact:

-

Login via:

+

Name:

+

Email:

+

Client:

+
+

Client Primary Contact:

+

Client Technical Contact:

+

Client Billing Contact:

+ + +

Login via:

@@ -34,8 +39,7 @@ require('inc_portal.php');
-

- Ticket + Ticket - Close ticket - + if ($ticket_status !== "Closed") { ?> + Close ticket +

@@ -61,7 +58,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
Priority:

- Issue: + @@ -69,7 +66,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) { - +
@@ -77,7 +74,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
- + @@ -138,18 +135,18 @@ if (isset($_GET['id']) && intval($_GET['id'])) {

- + User Avatar - + - diff --git a/portal/ticket_add.php b/portal/ticket_add.php index 31fc6b94..d788f723 100644 --- a/portal/ticket_add.php +++ b/portal/ticket_add.php @@ -4,57 +4,57 @@ * New ticket form */ -require('inc_portal.php'); +require_once('inc_portal.php'); ?> - + -

Raise a new ticket

+

Raise a new ticket

-
-
+
+ -
- -
-
- +
+ +
+
+ +
+
-
-
-
- -
-
- +
+ +
+
+ +
+
-
-
-
- - -
+
+ + +
- + - -
+ +
- + @@ -92,17 +92,17 @@ $total_tickets = $row['total_tickets']; - - +
+
- +
@@ -117,11 +117,11 @@ $total_tickets = $row['total_tickets']; All my tickets | - +
- + All Tickets
- \ No newline at end of file + diff --git a/post.php b/post.php index 5682173c..1ae6990a 100644 --- a/post.php +++ b/post.php @@ -4597,14 +4597,14 @@ if(isset($_POST['edit_contact'])){ mysqli_query($mysqli,"UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_phone = '$phone', contact_extension = '$extension', contact_mobile = '$mobile', contact_email = '$email', contact_notes = '$notes', contact_important = $contact_important, contact_billing = $contact_billing, contact_technical = $contact_technical, contact_auth_method = '$auth_method', contact_department = '$department', contact_location_id = $location_id WHERE contact_id = $contact_id AND company_id = $session_company_id"); // Update Primary contact in clients if primary contact is checked - if($primary_contact > 0){ + if ($primary_contact > 0){ mysqli_query($mysqli,"UPDATE clients SET primary_contact = $contact_id WHERE client_id = $client_id"); } // Set password if(!empty($_POST['contact_password'])){ $password_hash = mysqli_real_escape_string($mysqli,password_hash($_POST['contact_password'], PASSWORD_DEFAULT)); - mysqli_query($mysqli, "UPDATE contacts SET contact_password_hash = '$password_hash' WHERE contact_client_id = '$client_id'"); + mysqli_query($mysqli, "UPDATE contacts SET contact_password_hash = '$password_hash' WHERE contact_id = '$contact_id' AND contact_client_id = '$client_id'"); } // Send contact a welcome e-mail, if specified diff --git a/report_expense_by_vendor.php b/report_expense_by_vendor.php index 132c5432..694b4391 100644 --- a/report_expense_by_vendor.php +++ b/report_expense_by_vendor.php @@ -9,12 +9,6 @@ if (isset($_GET['year'])) { $year = date('Y'); } -if (isset($_GET['year'])) { - $year = intval($_GET['year']); -} else { - $year = date('Y'); -} - $sql_payment_years = mysqli_query($mysqli,"SELECT DISTINCT YEAR(payment_date) AS payment_year FROM payments WHERE company_id = $session_company_id UNION SELECT DISTINCT YEAR(revenue_date) AS payment_year FROM revenues WHERE company_id = $session_company_id ORDER BY payment_year DESC"); $sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE company_id = $session_company_id"); diff --git a/report_expense_summary.php b/report_expense_summary.php index 20674a4e..11d162b4 100644 --- a/report_expense_summary.php +++ b/report_expense_summary.php @@ -9,12 +9,6 @@ if (isset($_GET['year'])) { $year = date('Y'); } -if (isset($_GET['year'])) { - $year = intval($_GET['year']); -} else { - $year = date('Y'); -} - $sql_expense_years = mysqli_query($mysqli,"SELECT DISTINCT YEAR(expense_date) AS expense_year FROM expenses WHERE expense_category_id > 0 AND company_id = $session_company_id ORDER BY expense_year DESC"); $sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Expense' AND company_id = $session_company_id ORDER BY category_name ASC"); @@ -140,7 +134,6 @@ $sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_ Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif'; Chart.defaults.global.defaultFontColor = '#292b2c'; - // Area Chart Example var ctx = document.getElementById("cashFlow"); var myLineChart = new Chart(ctx, { type: 'line', diff --git a/report_income_by_client.php b/report_income_by_client.php index b4a774c6..e5a7a7fa 100644 --- a/report_income_by_client.php +++ b/report_income_by_client.php @@ -9,12 +9,6 @@ if (isset($_GET['year'])) { $year = date('Y'); } -if (isset($_GET['year'])) { - $year = intval($_GET['year']); -} else { - $year = date('Y'); -} - $sql_payment_years = mysqli_query($mysqli,"SELECT DISTINCT YEAR(payment_date) AS payment_year FROM payments WHERE company_id = $session_company_id UNION SELECT DISTINCT YEAR(revenue_date) AS payment_year FROM revenues WHERE company_id = $session_company_id ORDER BY payment_year DESC"); $sql_clients = mysqli_query($mysqli,"SELECT * FROM clients WHERE company_id = $session_company_id"); @@ -59,7 +53,7 @@ $sql_clients = mysqli_query($mysqli,"SELECT * FROM clients WHERE company_id = $s $client_id = $row['client_id']; $client_name = htmlentities($row['client_name']); - $sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND invoice_client_id = $client_id"); + $sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND invoice_client_id = $client_id"); $row = mysqli_fetch_array($sql_amount_paid); $amount_paid = floatval($row['amount_paid']); diff --git a/report_income_summary.php b/report_income_summary.php index 2bc59ac0..dfffedc7 100644 --- a/report_income_summary.php +++ b/report_income_summary.php @@ -9,12 +9,6 @@ if (isset($_GET['year'])) { $year = date('Y'); } -if (isset($_GET['year'])) { - $year = intval($_GET['year']); -} else { - $year = date('Y'); -} - $sql_payment_years = mysqli_query($mysqli, "SELECT DISTINCT YEAR(payment_date) AS payment_year FROM payments WHERE company_id = $session_company_id UNION SELECT DISTINCT YEAR(revenue_date) AS payment_year FROM revenues WHERE company_id = $session_company_id ORDER BY payment_year DESC"); $sql_categories = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND company_id = $session_company_id ORDER BY category_name ASC"); diff --git a/report_recurring_by_client.php b/report_recurring_by_client.php index aeb295cd..3a493a70 100644 --- a/report_recurring_by_client.php +++ b/report_recurring_by_client.php @@ -3,7 +3,7 @@ require_once("inc_all_reports.php"); validateAccountantRole(); -$sql_clients = mysqli_query($mysqli,"SELECT * FROM clients WHERE company_id = $session_company_id"); +$sql_clients = mysqli_query($mysqli, "SELECT * FROM clients WHERE company_id = $session_company_id"); ?> @@ -31,13 +31,13 @@ $sql_clients = mysqli_query($mysqli,"SELECT * FROM clients WHERE company_id = $s $client_name = htmlentities($row['client_name']); //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"); + $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"); + $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; diff --git a/report_tax_summary.php b/report_tax_summary.php index 3c8438ef..a2ce2b84 100644 --- a/report_tax_summary.php +++ b/report_tax_summary.php @@ -10,9 +10,9 @@ if (isset($_GET['year'])) { } //GET unique years from expenses, payments and revenues -$sql_all_years = mysqli_query($mysqli,"SELECT DISTINCT(YEAR(item_created_at)) AS all_years FROM invoice_items WHERE company_id = $session_company_id ORDER BY all_years DESC"); +$sql_all_years = mysqli_query($mysqli, "SELECT DISTINCT(YEAR(item_created_at)) AS all_years FROM invoice_items WHERE company_id = $session_company_id ORDER BY all_years DESC"); -$sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC"); +$sql_tax = mysqli_query($mysqli, "SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC"); ?> @@ -67,7 +67,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session for($month = 1; $month<=3; $month++) { - $sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month + $sql_tax_collected = mysqli_query($mysqli, "SELECT SUM(item_tax) AS tax_collected_for_month FROM invoices, invoice_items WHERE item_invoice_id = invoice_id AND invoice_status LIKE 'Paid' @@ -91,7 +91,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session for($month = 4; $month <= 6; $month ++) { - $sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month + $sql_tax_collected = mysqli_query($mysqli, "SELECT SUM(item_tax) AS tax_collected_for_month FROM invoices, invoice_items WHERE item_invoice_id = invoice_id AND invoice_status LIKE 'Paid' @@ -115,7 +115,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session for($month = 7; $month <= 9; $month ++) { - $sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month + $sql_tax_collected = mysqli_query($mysqli, "SELECT SUM(item_tax) AS tax_collected_for_month FROM invoices, invoice_items WHERE item_invoice_id = invoice_id AND invoice_status LIKE 'Paid' @@ -139,7 +139,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session for($month = 10; $month <= 12; $month ++) { - $sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month + $sql_tax_collected = mysqli_query($mysqli, "SELECT SUM(item_tax) AS tax_collected_for_month FROM invoices, invoice_items WHERE item_invoice_id = invoice_id AND invoice_status LIKE 'Paid' @@ -176,7 +176,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session for($month = 1; $month <= 3; $month ++) { - $sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month + $sql_tax_collected = mysqli_query($mysqli, "SELECT SUM(item_tax) AS tax_collected_for_month FROM invoices, invoice_items WHERE item_invoice_id = invoice_id AND invoice_status LIKE 'Paid' @@ -199,7 +199,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session for($month = 4; $month <= 6; $month ++) { - $sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month + $sql_tax_collected = mysqli_query($mysqli, "SELECT SUM(item_tax) AS tax_collected_for_month FROM invoices, invoice_items WHERE item_invoice_id = invoice_id AND invoice_status LIKE 'Paid' @@ -222,7 +222,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session for($month = 7; $month <= 9; $month ++) { - $sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month + $sql_tax_collected = mysqli_query($mysqli, "SELECT SUM(item_tax) AS tax_collected_for_month FROM invoices, invoice_items WHERE item_invoice_id = invoice_id AND invoice_status LIKE 'Paid' @@ -245,7 +245,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session for($month = 10; $month <= 12; $month ++) { - $sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month + $sql_tax_collected = mysqli_query($mysqli, "SELECT SUM(item_tax) AS tax_collected_for_month FROM invoices, invoice_items WHERE item_invoice_id = invoice_id AND invoice_status LIKE 'Paid' diff --git a/report_ticket_by_client.php b/report_ticket_by_client.php new file mode 100644 index 00000000..f2bf4941 --- /dev/null +++ b/report_ticket_by_client.php @@ -0,0 +1,74 @@ + + +
+
+

Tickets By Client

+
+ +
+
+
+
+ +
+ +
+ + + + + + + + + 0) { + + ?> + + + + + + + +
ClientTicket Count
+
+
+
+ + + +
+
+

Ticket Summary

+
+ +
+
+
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecemberTotal
+
+
+
+ + + + diff --git a/reports_side_nav.php b/reports_side_nav.php index 5e51c493..7ad1ec57 100644 --- a/reports_side_nav.php +++ b/reports_side_nav.php @@ -63,6 +63,23 @@ + + + + + + +