General tidy/spacing cleanups
This commit is contained in:
+10
-10
@@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
if (!empty($_GET['sb'])) {
|
if (!empty($_GET['sb'])) {
|
||||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||||
}else{
|
} else {
|
||||||
$sb = "account_name";
|
$sb = "account_name";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Rebuild URL
|
//Rebuild URL
|
||||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM accounts
|
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM accounts
|
||||||
WHERE account_name LIKE '%$q%' AND company_id = $session_company_id
|
WHERE account_name LIKE '%$q%' AND company_id = $session_company_id
|
||||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||||
|
|
||||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-piggy-bank"></i> Accounts</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-piggy-bank"></i> Accounts</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
@@ -54,15 +54,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||||||
$account_currency_code = htmlentities($row['account_currency_code']);
|
$account_currency_code = htmlentities($row['account_currency_code']);
|
||||||
$account_notes = htmlentities($row['account_notes']);
|
$account_notes = htmlentities($row['account_notes']);
|
||||||
|
|
||||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_payments);
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
$total_payments = $row['total_payments'];
|
$total_payments = $row['total_payments'];
|
||||||
|
|
||||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_revenues);
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
$total_revenues = $row['total_revenues'];
|
$total_revenues = $row['total_revenues'];
|
||||||
|
|
||||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
$total_expenses = $row['total_expenses'];
|
$total_expenses = $row['total_expenses'];
|
||||||
|
|
||||||
@@ -99,12 +99,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
<?php include("pagination.php"); ?>
|
<?php include("pagination.php"); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include("account_add_modal.php");
|
include("account_add_modal.php");
|
||||||
|
|
||||||
include("footer.php");
|
include("footer.php");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
+11
-11
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
if (isset($_GET['category'])) {
|
if (isset($_GET['category'])) {
|
||||||
$category = strip_tags(mysqli_real_escape_string($mysqli,$_GET['category']));
|
$category = strip_tags(mysqli_real_escape_string($mysqli,$_GET['category']));
|
||||||
}else{
|
} else {
|
||||||
$category = "Expense";
|
$category = "Expense";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET['sb'])) {
|
if (!empty($_GET['sb'])) {
|
||||||
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||||
}else{
|
} else {
|
||||||
$sb = "category_name";
|
$sb = "category_name";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,12 +35,12 @@ $sql_colors_used = mysqli_query($mysqli,"SELECT category_color FROM categories
|
|||||||
while ($color_used_row = mysqli_fetch_array($sql_colors_used)) {
|
while ($color_used_row = mysqli_fetch_array($sql_colors_used)) {
|
||||||
$colors_used_array[] = $color_used_row['category_color'];
|
$colors_used_array[] = $color_used_row['category_color'];
|
||||||
}
|
}
|
||||||
$colors_diff = array_diff($colors_array,$colors_used_array);
|
$colors_diff = array_diff($colors_array, $colors_used_array);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-list"></i> <?php echo htmlentities($category); ?> Categories</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-list"></i> <?php echo htmlentities($category); ?> Categories</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
@@ -61,10 +61,10 @@ $colors_diff = array_diff($colors_array,$colors_used_array);
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="btn-group float-right">
|
<div class="btn-group float-right">
|
||||||
<a href="?category=Expense" class="btn <?php if ($category == 'Expense') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Expense</a>
|
<a href="?category=Expense" class="btn <?php if ($category == 'Expense') { echo 'btn-primary'; } else { echo 'btn-default'; } ?>">Expense</a>
|
||||||
<a href="?category=Income" class="btn <?php if ($category == 'Income') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Income</a>
|
<a href="?category=Income" class="btn <?php if ($category == 'Income') { echo 'btn-primary'; } else { echo 'btn-default'; } ?>">Income</a>
|
||||||
<a href="?category=Referral" class="btn <?php if ($category == 'Referral') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Referral</a>
|
<a href="?category=Referral" class="btn <?php if ($category == 'Referral') { echo 'btn-primary'; } else { echo 'btn-default'; } ?>">Referral</a>
|
||||||
<a href="?category=Payment Method" class="btn <?php if ($category == 'Payment Method') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Payment Method</a>
|
<a href="?category=Payment Method" class="btn <?php if ($category == 'Payment Method') { echo 'btn-primary'; } else { echo 'btn-default'; } ?>">Payment Method</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -121,12 +121,12 @@ $colors_diff = array_diff($colors_array,$colors_used_array);
|
|||||||
</div>
|
</div>
|
||||||
<?php include("pagination.php"); ?>
|
<?php include("pagination.php"); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include("category_add_modal.php");
|
include("category_add_modal.php");
|
||||||
|
|
||||||
include("footer.php");
|
include("footer.php");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
+3
-5
@@ -1,10 +1,8 @@
|
|||||||
<?php include("inc_all_client.php"); ?>
|
<?php include("inc_all_client.php");
|
||||||
|
|
||||||
<?php
|
$sql_files_images = mysqli_query($mysqli, "SELECT * FROM files WHERE file_client_id = $client_id AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG') ORDER BY file_name ASC");
|
||||||
|
|
||||||
$sql_files_images = mysqli_query($mysqli,"SELECT * FROM files WHERE file_client_id = $client_id AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG') ORDER BY file_name ASC");
|
$sql_files_other = mysqli_query($mysqli, "SELECT * FROM files WHERE file_client_id = $client_id AND file_ext NOT LIKE 'JPG' AND file_ext NOT LIKE 'jpg' AND file_ext NOT LIKE 'jpeg' AND file_ext NOT LIKE 'JPEG' AND file_ext NOT LIKE 'webp' AND file_ext NOT LIKE 'WEBP' AND file_ext NOT LIKE 'png' AND file_ext NOT LIKE 'PNG' ORDER BY file_name ASC");
|
||||||
|
|
||||||
$sql_files_other = mysqli_query($mysqli,"SELECT * FROM files WHERE file_client_id = $client_id AND file_ext NOT LIKE 'JPG' AND file_ext NOT LIKE 'jpg' AND file_ext NOT LIKE 'jpeg' AND file_ext NOT LIKE 'JPEG' AND file_ext NOT LIKE 'webp' AND file_ext NOT LIKE 'WEBP' AND file_ext NOT LIKE 'png' AND file_ext NOT LIKE 'PNG' ORDER BY file_name ASC");
|
|
||||||
|
|
||||||
$num_of_files = mysqli_num_rows($sql_files_images) + mysqli_num_rows($sql_files_other);
|
$num_of_files = mysqli_num_rows($sql_files_images) + mysqli_num_rows($sql_files_other);
|
||||||
|
|
||||||
|
|||||||
+12
-14
@@ -1,23 +1,21 @@
|
|||||||
<?php include("inc_all_client.php"); ?>
|
<?php include("inc_all_client.php");
|
||||||
|
|
||||||
<?php
|
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL AND contacts.company_id = $session_company_id ORDER BY contact_updated_at, contact_created_at DESC LIMIT 5");
|
||||||
|
|
||||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL AND contacts.company_id = $session_company_id ORDER BY contact_updated_at, contact_created_at DESC LIMIT 5");
|
$sql_important_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_important = 1 AND contact_archived_at IS NULL AND contacts.company_id = $session_company_id ORDER BY contact_updated_at, contact_name DESC");
|
||||||
|
|
||||||
$sql_important_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_important = 1 AND contact_archived_at IS NULL AND contacts.company_id = $session_company_id ORDER BY contact_updated_at, contact_name DESC");
|
$sql_vendors = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id = $client_id AND vendor_template = 0 AND vendor_archived_at IS NULL AND company_id = $session_company_id ORDER BY vendor_updated_at DESC LIMIT 5");
|
||||||
|
|
||||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id AND vendor_template = 0 AND vendor_archived_at IS NULL AND company_id = $session_company_id ORDER BY vendor_updated_at DESC LIMIT 5");
|
|
||||||
|
|
||||||
$sql_documents = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id = $client_id AND document_archived_at IS NULL AND documents.company_id = $session_company_id ORDER BY document_updated_at DESC LIMIT 5");
|
$sql_documents = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id = $client_id AND document_archived_at IS NULL AND documents.company_id = $session_company_id ORDER BY document_updated_at DESC LIMIT 5");
|
||||||
|
|
||||||
$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_client_id = $client_id AND tickets.company_id = $session_company_id ORDER BY ticket_updated_at DESC LIMIT 5");
|
$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_client_id = $client_id AND tickets.company_id = $session_company_id ORDER BY ticket_updated_at DESC LIMIT 5");
|
||||||
|
|
||||||
$sql_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE login_client_id = $client_id AND company_id = $session_company_id ORDER BY login_updated_at DESC LIMIT 5");
|
$sql_logins = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_client_id = $client_id AND company_id = $session_company_id ORDER BY login_updated_at DESC LIMIT 5");
|
||||||
|
|
||||||
// Expiring Items
|
// Expiring Items
|
||||||
|
|
||||||
// Get Domains Expiring
|
// Get Domains Expiring
|
||||||
$sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
|
$sql_domains_expiring = mysqli_query($mysqli, "SELECT * FROM domains
|
||||||
WHERE domain_client_id = $client_id
|
WHERE domain_client_id = $client_id
|
||||||
AND domain_expire != '0000-00-00'
|
AND domain_expire != '0000-00-00'
|
||||||
AND domain_archived_at IS NULL
|
AND domain_archived_at IS NULL
|
||||||
@@ -44,7 +42,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (mysqli_num_rows($sql_important_contacts) > 0 ) { ?>
|
<?php if (mysqli_num_rows($sql_important_contacts) > 0) { ?>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
|
||||||
@@ -92,9 +90,9 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if (mysqli_num_rows($sql_contacts) > 0 || mysqli_num_rows($sql_vendors) > 0 ) { ?>
|
<?php if (mysqli_num_rows($sql_contacts) > 0 || mysqli_num_rows($sql_vendors) > 0) { ?>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|
||||||
<div class="card card-dark mb-3">
|
<div class="card card-dark mb-3">
|
||||||
@@ -138,9 +136,9 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if (mysqli_num_rows($sql_contacts) > 0 || mysqli_num_rows($sql_vendors) > 0 ) { ?>
|
<?php if (mysqli_num_rows($sql_contacts) > 0 || mysqli_num_rows($sql_vendors) > 0) { ?>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|
||||||
@@ -186,7 +184,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
|
||||||
|
|||||||
+38
-40
@@ -1,6 +1,4 @@
|
|||||||
<?php include("inc_all.php"); ?>
|
<?php include("inc_all.php");
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// Quick fix to prevent non-admins (i.e. techs) seeing financials - redirect to client list
|
// Quick fix to prevent non-admins (i.e. techs) seeing financials - redirect to client list
|
||||||
// To be removed when we have a proper technical dashboard for techs
|
// To be removed when we have a proper technical dashboard for techs
|
||||||
@@ -25,7 +23,7 @@ if (isset($_GET['year'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//GET unique years from expenses, payments invoices and revenues
|
//GET unique years from expenses, payments invoices and revenues
|
||||||
$sql_years_select = mysqli_query($mysqli,"SELECT YEAR(expense_date) AS all_years FROM expenses WHERE company_id = $session_company_id
|
$sql_years_select = mysqli_query($mysqli, "SELECT YEAR(expense_date) AS all_years FROM expenses WHERE company_id = $session_company_id
|
||||||
UNION DISTINCT SELECT YEAR(payment_date) FROM payments WHERE company_id = $session_company_id
|
UNION DISTINCT SELECT YEAR(payment_date) FROM payments WHERE company_id = $session_company_id
|
||||||
UNION DISTINCT SELECT YEAR(revenue_date) FROM revenues WHERE company_id = $session_company_id
|
UNION DISTINCT SELECT YEAR(revenue_date) FROM revenues WHERE company_id = $session_company_id
|
||||||
UNION DISTINCT SELECT YEAR(invoice_date) FROM invoices WHERE company_id = $session_company_id
|
UNION DISTINCT SELECT YEAR(invoice_date) FROM invoices WHERE company_id = $session_company_id
|
||||||
@@ -36,32 +34,32 @@ $sql_years_select = mysqli_query($mysqli,"SELECT YEAR(expense_date) AS all_years
|
|||||||
$largest_income_month = 0;
|
$largest_income_month = 0;
|
||||||
|
|
||||||
//Get Total income
|
//Get Total income
|
||||||
$sql_total_payments_to_invoices = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments_to_invoices FROM payments WHERE YEAR(payment_date) = $year AND company_id = $session_company_id");
|
$sql_total_payments_to_invoices = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments_to_invoices FROM payments WHERE YEAR(payment_date) = $year AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_total_payments_to_invoices);
|
$row = mysqli_fetch_array($sql_total_payments_to_invoices);
|
||||||
$total_payments_to_invoices = $row['total_payments_to_invoices'];
|
$total_payments_to_invoices = $row['total_payments_to_invoices'];
|
||||||
//Do not grab transfer payment as these have a category_id of 0
|
//Do not grab transfer payment as these have a category_id of 0
|
||||||
$sql_total_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE YEAR(revenue_date) = $year AND revenue_category_id > 0 AND company_id = $session_company_id");
|
$sql_total_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE YEAR(revenue_date) = $year AND revenue_category_id > 0 AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_total_revenues);
|
$row = mysqli_fetch_array($sql_total_revenues);
|
||||||
$total_revenues = $row['total_revenues'];
|
$total_revenues = $row['total_revenues'];
|
||||||
|
|
||||||
$total_income = $total_payments_to_invoices + $total_revenues;
|
$total_income = $total_payments_to_invoices + $total_revenues;
|
||||||
|
|
||||||
//Get Total expenses and do not grab transfer expenses as these have a vendor of 0
|
//Get Total expenses and do not grab transfer expenses as these have a vendor of 0
|
||||||
$sql_total_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_vendor_id > 0 AND YEAR(expense_date) = $year AND company_id = $session_company_id");
|
$sql_total_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_vendor_id > 0 AND YEAR(expense_date) = $year AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_total_expenses);
|
$row = mysqli_fetch_array($sql_total_expenses);
|
||||||
$total_expenses = $row['total_expenses'];
|
$total_expenses = $row['total_expenses'];
|
||||||
|
|
||||||
//Total up all the Invoices that are not draft or cancelled
|
//Total up all the Invoices that are not draft or cancelled
|
||||||
$sql_invoice_totals = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_totals FROM invoices WHERE invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' AND YEAR(invoice_date) = $year AND company_id = $session_company_id");
|
$sql_invoice_totals = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_totals FROM invoices WHERE invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' AND YEAR(invoice_date) = $year AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_invoice_totals);
|
$row = mysqli_fetch_array($sql_invoice_totals);
|
||||||
$invoice_totals = $row['invoice_totals'];
|
$invoice_totals = $row['invoice_totals'];
|
||||||
|
|
||||||
//Quaeries from Receivables
|
//Quaeries from Receivables
|
||||||
$sql_total_payments_to_invoices_all_years = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments_to_invoices_all_years FROM payments WHERE company_id = $session_company_id");
|
$sql_total_payments_to_invoices_all_years = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments_to_invoices_all_years FROM payments WHERE company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_total_payments_to_invoices_all_years);
|
$row = mysqli_fetch_array($sql_total_payments_to_invoices_all_years);
|
||||||
$total_payments_to_invoices_all_years = $row['total_payments_to_invoices_all_years'];
|
$total_payments_to_invoices_all_years = $row['total_payments_to_invoices_all_years'];
|
||||||
|
|
||||||
$sql_invoice_totals_all_years = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_totals_all_years FROM invoices WHERE invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' AND company_id = $session_company_id");
|
$sql_invoice_totals_all_years = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_totals_all_years FROM invoices WHERE invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_invoice_totals_all_years);
|
$row = mysqli_fetch_array($sql_invoice_totals_all_years);
|
||||||
$invoice_totals_all_years = $row['invoice_totals_all_years'];
|
$invoice_totals_all_years = $row['invoice_totals_all_years'];
|
||||||
|
|
||||||
@@ -69,16 +67,16 @@ $receivables = $invoice_totals_all_years - $total_payments_to_invoices_all_years
|
|||||||
|
|
||||||
$profit = $total_income - $total_expenses;
|
$profit = $total_income - $total_expenses;
|
||||||
|
|
||||||
$sql_accounts = mysqli_query($mysqli,"SELECT * FROM accounts WHERE company_id = $session_company_id");
|
$sql_accounts = mysqli_query($mysqli, "SELECT * FROM accounts WHERE company_id = $session_company_id");
|
||||||
|
|
||||||
$sql_latest_invoice_payments = mysqli_query($mysqli,"SELECT * FROM payments, invoices, clients
|
$sql_latest_invoice_payments = mysqli_query($mysqli, "SELECT * FROM payments, invoices, clients
|
||||||
WHERE payment_invoice_id = invoice_id
|
WHERE payment_invoice_id = invoice_id
|
||||||
AND invoice_client_id = client_id
|
AND invoice_client_id = client_id
|
||||||
AND clients.company_id = $session_company_id
|
AND clients.company_id = $session_company_id
|
||||||
ORDER BY payment_id DESC LIMIT 5"
|
ORDER BY payment_id DESC LIMIT 5"
|
||||||
);
|
);
|
||||||
|
|
||||||
$sql_latest_expenses = mysqli_query($mysqli,"SELECT * FROM expenses, vendors, categories
|
$sql_latest_expenses = mysqli_query($mysqli, "SELECT * FROM expenses, vendors, categories
|
||||||
WHERE expense_vendor_id = vendor_id
|
WHERE expense_vendor_id = vendor_id
|
||||||
AND expense_category_id = category_id
|
AND expense_category_id = category_id
|
||||||
AND expenses.company_id = $session_company_id
|
AND expenses.company_id = $session_company_id
|
||||||
@@ -86,26 +84,26 @@ $sql_latest_expenses = mysqli_query($mysqli,"SELECT * FROM expenses, vendors, ca
|
|||||||
);
|
);
|
||||||
|
|
||||||
//Get Monthly Recurring Total
|
//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 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 company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_recurring_monthly_total);
|
$row = mysqli_fetch_array($sql_recurring_monthly_total);
|
||||||
$recurring_monthly_total = $row['recurring_monthly_total'];
|
$recurring_monthly_total = $row['recurring_monthly_total'];
|
||||||
|
|
||||||
//Get Yearly Recurring 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 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 company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_recurring_yearly_total);
|
$row = mysqli_fetch_array($sql_recurring_yearly_total);
|
||||||
$recurring_yearly_total = $row['recurring_yearly_total'];
|
$recurring_yearly_total = $row['recurring_yearly_total'];
|
||||||
|
|
||||||
//Get Total Miles Driven
|
//Get Total Miles Driven
|
||||||
$sql_miles_driven = mysqli_query($mysqli,"SELECT SUM(trip_miles) AS total_miles FROM trips WHERE YEAR(trip_date) = $year AND company_id = $session_company_id");
|
$sql_miles_driven = mysqli_query($mysqli, "SELECT SUM(trip_miles) AS total_miles FROM trips WHERE YEAR(trip_date) = $year AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_miles_driven);
|
$row = mysqli_fetch_array($sql_miles_driven);
|
||||||
$total_miles = $row['total_miles'];
|
$total_miles = $row['total_miles'];
|
||||||
|
|
||||||
//Get Total Clients added
|
//Get Total Clients added
|
||||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_id') AS clients_added FROM clients WHERE YEAR(client_created_at) = $year AND company_id = $session_company_id"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('client_id') AS clients_added FROM clients WHERE YEAR(client_created_at) = $year AND company_id = $session_company_id"));
|
||||||
$clients_added = $row['clients_added'];
|
$clients_added = $row['clients_added'];
|
||||||
|
|
||||||
//Get Total Vendors added
|
//Get Total Vendors added
|
||||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('vendor_id') AS vendors_added FROM vendors WHERE YEAR(vendor_created_at) = $year AND vendor_client_id = 0 AND vendor_template = 0 AND company_id = $session_company_id"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('vendor_id') AS vendors_added FROM vendors WHERE YEAR(vendor_created_at) = $year AND vendor_client_id = 0 AND vendor_template = 0 AND company_id = $session_company_id"));
|
||||||
$vendors_added = $row['vendors_added'];
|
$vendors_added = $row['vendors_added'];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -335,15 +333,15 @@ $vendors_added = $row['vendors_added'];
|
|||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $account_name; ?></a></td>
|
<td><?php echo $account_name; ?></a></td>
|
||||||
<?php
|
<?php
|
||||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_payments);
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
$total_payments = $row['total_payments'];
|
$total_payments = $row['total_payments'];
|
||||||
|
|
||||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_revenues);
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
$total_revenues = $row['total_revenues'];
|
$total_revenues = $row['total_revenues'];
|
||||||
|
|
||||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
$total_expenses = $row['total_expenses'];
|
$total_expenses = $row['total_expenses'];
|
||||||
|
|
||||||
@@ -495,11 +493,11 @@ var myLineChart = new Chart(ctx, {
|
|||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
for($month = 1; $month<=12; $month++) {
|
for($month = 1; $month<=12; $month++) {
|
||||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_payments);
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
$payments_for_month = $row['payment_amount_for_month'];
|
$payments_for_month = $row['payment_amount_for_month'];
|
||||||
|
|
||||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND company_id = $session_company_id");
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_revenues);
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
$revenues_for_month = $row['revenue_amount_for_month'];
|
$revenues_for_month = $row['revenue_amount_for_month'];
|
||||||
|
|
||||||
@@ -534,11 +532,11 @@ var myLineChart = new Chart(ctx, {
|
|||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
for($month = 1; $month<=12; $month++) {
|
for($month = 1; $month<=12; $month++) {
|
||||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year-1 AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year-1 AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_payments);
|
$row = mysqli_fetch_array($sql_payments);
|
||||||
$payments_for_month = $row['payment_amount_for_month'];
|
$payments_for_month = $row['payment_amount_for_month'];
|
||||||
|
|
||||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year-1 AND MONTH(revenue_date) = $month AND company_id = $session_company_id");
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year-1 AND MONTH(revenue_date) = $month AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_revenues);
|
$row = mysqli_fetch_array($sql_revenues);
|
||||||
$revenues_for_month = $row['revenue_amount_for_month'];
|
$revenues_for_month = $row['revenue_amount_for_month'];
|
||||||
|
|
||||||
@@ -576,7 +574,7 @@ var myLineChart = new Chart(ctx, {
|
|||||||
$largest_invoice_month = 0;
|
$largest_invoice_month = 0;
|
||||||
|
|
||||||
for($month = 1; $month<=12; $month++) {
|
for($month = 1; $month<=12; $month++) {
|
||||||
$sql_projected = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amount_for_month FROM invoices WHERE YEAR(invoice_due) = $year AND MONTH(invoice_due) = $month AND invoice_status NOT LIKE 'Cancelled' AND invoice_status NOT LIKE 'Draft' AND company_id = $session_company_id");
|
$sql_projected = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amount_for_month FROM invoices WHERE YEAR(invoice_due) = $year AND MONTH(invoice_due) = $month AND invoice_status NOT LIKE 'Cancelled' AND invoice_status NOT LIKE 'Draft' AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_projected);
|
$row = mysqli_fetch_array($sql_projected);
|
||||||
$invoice_for_month = $row['invoice_amount_for_month'];
|
$invoice_for_month = $row['invoice_amount_for_month'];
|
||||||
|
|
||||||
@@ -612,7 +610,7 @@ var myLineChart = new Chart(ctx, {
|
|||||||
$largest_expense_month = 0;
|
$largest_expense_month = 0;
|
||||||
|
|
||||||
for($month = 1; $month<=12; $month++) {
|
for($month = 1; $month<=12; $month++) {
|
||||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND expenses.company_id = $session_company_id");
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND expenses.company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
$expenses_for_month = $row['expense_amount_for_month'];
|
$expenses_for_month = $row['expense_amount_for_month'];
|
||||||
|
|
||||||
@@ -688,7 +686,7 @@ var myLineChart = new Chart(ctx, {
|
|||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
for($month = 1; $month<=12; $month++) {
|
for($month = 1; $month<=12; $month++) {
|
||||||
$sql_trips = mysqli_query($mysqli,"SELECT SUM(trip_miles) AS trip_miles_for_month FROM trips WHERE YEAR(trip_date) = $year AND MONTH(trip_date) = $month AND trips.company_id = $session_company_id");
|
$sql_trips = mysqli_query($mysqli, "SELECT SUM(trip_miles) AS trip_miles_for_month FROM trips WHERE YEAR(trip_date) = $year AND MONTH(trip_date) = $month AND trips.company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_trips);
|
$row = mysqli_fetch_array($sql_trips);
|
||||||
$trip_miles_for_month = $row['trip_miles_for_month'];
|
$trip_miles_for_month = $row['trip_miles_for_month'];
|
||||||
$largest_trip_miles_month = 0;
|
$largest_trip_miles_month = 0;
|
||||||
@@ -751,7 +749,7 @@ var myPieChart = new Chart(ctx, {
|
|||||||
data: {
|
data: {
|
||||||
labels: [
|
labels: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_id FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
$sql_categories = mysqli_query($mysqli, "SELECT DISTINCT category_name, category_id FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
$category_name = json_encode($row['category_name']);
|
$category_name = json_encode($row['category_name']);
|
||||||
echo "$category_name,";
|
echo "$category_name,";
|
||||||
@@ -763,11 +761,11 @@ var myPieChart = new Chart(ctx, {
|
|||||||
datasets: [{
|
datasets: [{
|
||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_id FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
$sql_categories = mysqli_query($mysqli, "SELECT DISTINCT category_name, category_id FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
$category_id = $row['category_id'];
|
$category_id = $row['category_id'];
|
||||||
|
|
||||||
$sql_invoices = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS income_amount_for_year FROM invoices WHERE invoice_category_id = $category_id AND YEAR(invoice_date) = $year AND company_id = $session_company_id");
|
$sql_invoices = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS income_amount_for_year FROM invoices WHERE invoice_category_id = $category_id AND YEAR(invoice_date) = $year AND company_id = $session_company_id");
|
||||||
$row = mysqli_fetch_array($sql_invoices);
|
$row = mysqli_fetch_array($sql_invoices);
|
||||||
$income_amount_for_year = $row['income_amount_for_year'];
|
$income_amount_for_year = $row['income_amount_for_year'];
|
||||||
echo "$income_amount_for_year,";
|
echo "$income_amount_for_year,";
|
||||||
@@ -778,7 +776,7 @@ var myPieChart = new Chart(ctx, {
|
|||||||
],
|
],
|
||||||
backgroundColor: [
|
backgroundColor: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_id, category_color FROM categories, invoices WHERE invoice_category_id = category_id AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
$sql_categories = mysqli_query($mysqli, "SELECT DISTINCT category_name, category_id, category_color FROM categories, invoices WHERE invoice_category_id = category_id AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
$category_color = json_encode($row['category_color']);
|
$category_color = json_encode($row['category_color']);
|
||||||
echo "$category_color,";
|
echo "$category_color,";
|
||||||
@@ -808,7 +806,7 @@ var myPieChart = new Chart(ctx, {
|
|||||||
data: {
|
data: {
|
||||||
labels: [
|
labels: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
$sql_categories = mysqli_query($mysqli, "SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
$category_name = json_encode($row['category_name']);
|
$category_name = json_encode($row['category_name']);
|
||||||
echo "$category_name,";
|
echo "$category_name,";
|
||||||
@@ -820,11 +818,11 @@ var myPieChart = new Chart(ctx, {
|
|||||||
datasets: [{
|
datasets: [{
|
||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
$sql_categories = mysqli_query($mysqli, "SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
$category_id = $row['category_id'];
|
$category_id = $row['category_id'];
|
||||||
|
|
||||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year");
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
$expense_amount_for_year = $row['expense_amount_for_year'];
|
$expense_amount_for_year = $row['expense_amount_for_year'];
|
||||||
echo "$expense_amount_for_year,";
|
echo "$expense_amount_for_year,";
|
||||||
@@ -835,7 +833,7 @@ var myPieChart = new Chart(ctx, {
|
|||||||
],
|
],
|
||||||
backgroundColor: [
|
backgroundColor: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expense_category_id = categories.category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
$sql_categories = mysqli_query($mysqli, "SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expense_category_id = categories.category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
$category_color = json_encode($row['category_color']);
|
$category_color = json_encode($row['category_color']);
|
||||||
echo "$category_color,";
|
echo "$category_color,";
|
||||||
@@ -861,7 +859,7 @@ var myPieChart = new Chart(ctx, {
|
|||||||
data: {
|
data: {
|
||||||
labels: [
|
labels: [
|
||||||
<?php
|
<?php
|
||||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendor_id FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
$sql_vendors = mysqli_query($mysqli, "SELECT DISTINCT vendor_name, vendor_id FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||||
$vendor_name = json_encode($row['vendor_name']);
|
$vendor_name = json_encode($row['vendor_name']);
|
||||||
echo "$vendor_name,";
|
echo "$vendor_name,";
|
||||||
@@ -873,11 +871,11 @@ var myPieChart = new Chart(ctx, {
|
|||||||
datasets: [{
|
datasets: [{
|
||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendor_id FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
$sql_vendors = mysqli_query($mysqli, "SELECT DISTINCT vendor_name, vendor_id FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
while ($row = mysqli_fetch_array($sql_vendors)) {
|
||||||
$vendor_id = $row['vendor_id'];
|
$vendor_id = $row['vendor_id'];
|
||||||
|
|
||||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE expense_vendor_id = $vendor_id AND YEAR(expense_date) = $year");
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE expense_vendor_id = $vendor_id AND YEAR(expense_date) = $year");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_array($sql_expenses);
|
||||||
$expense_amount_for_year = $row['expense_amount_for_year'];
|
$expense_amount_for_year = $row['expense_amount_for_year'];
|
||||||
echo "$expense_amount_for_year,";
|
echo "$expense_amount_for_year,";
|
||||||
@@ -888,7 +886,7 @@ var myPieChart = new Chart(ctx, {
|
|||||||
],
|
],
|
||||||
backgroundColor: [
|
backgroundColor: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expense_category_id = category_id AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
$sql_categories = mysqli_query($mysqli, "SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expense_category_id = category_id AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||||
$category_color = json_encode($row['category_color']);
|
$category_color = json_encode($row['category_color']);
|
||||||
echo "$category_color,";
|
echo "$category_color,";
|
||||||
|
|||||||
+19
-21
@@ -1,13 +1,11 @@
|
|||||||
<?php include("guest_header.php"); ?>
|
<?php include("guest_header.php");
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if (isset($_GET['invoice_id'], $_GET['url_key'])) {
|
if (isset($_GET['invoice_id'], $_GET['url_key'])) {
|
||||||
|
|
||||||
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
|
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
|
||||||
$invoice_id = intval($_GET['invoice_id']);
|
$invoice_id = intval($_GET['invoice_id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices
|
$sql = mysqli_query($mysqli, "SELECT * FROM invoices
|
||||||
LEFT JOIN clients ON invoice_client_id = client_id
|
LEFT JOIN clients ON invoice_client_id = client_id
|
||||||
LEFT JOIN locations ON primary_location = location_id
|
LEFT JOIN locations ON primary_location = location_id
|
||||||
LEFT JOIN contacts ON primary_contact = contact_id
|
LEFT JOIN contacts ON primary_contact = contact_id
|
||||||
@@ -90,20 +88,20 @@ if (isset($_GET['invoice_id'], $_GET['url_key'])) {
|
|||||||
|
|
||||||
//Update status to Viewed only if invoice_status = "Sent"
|
//Update status to Viewed only if invoice_status = "Sent"
|
||||||
if ($invoice_status == 'Sent') {
|
if ($invoice_status == 'Sent') {
|
||||||
mysqli_query($mysqli,"UPDATE invoices SET invoice_status = 'Viewed' WHERE invoice_id = $invoice_id");
|
mysqli_query($mysqli, "UPDATE invoices SET invoice_status = 'Viewed' WHERE invoice_id = $invoice_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Mark viewed in history
|
//Mark viewed in history
|
||||||
mysqli_query($mysqli,"INSERT INTO history SET history_status = '$invoice_status', history_description = 'Invoice viewed - $ip - $os - $browser', history_created_at = NOW(), history_invoice_id = $invoice_id, company_id = $company_id");
|
mysqli_query($mysqli, "INSERT INTO history SET history_status = '$invoice_status', history_description = 'Invoice viewed - $ip - $os - $browser', history_created_at = NOW(), history_invoice_id = $invoice_id, company_id = $company_id");
|
||||||
|
|
||||||
//Prevent SQL Error if client_name has ' in their name example Bill's Market
|
//Prevent SQL Error if client_name has ' in their name example Bill's Market
|
||||||
$client_name_escaped = mysqli_escape_string($mysqli,$row['client_name']);
|
$client_name_escaped = mysqli_escape_string($mysqli,$row['client_name']);
|
||||||
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Invoice Viewed', notification = 'Invoice $invoice_prefix$invoice_number has been viewed by $client_name_escaped - $ip - $os - $browser', notification_timestamp = NOW(), notification_client_id = $client_id, company_id = $company_id");
|
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Viewed', notification = 'Invoice $invoice_prefix$invoice_number has been viewed by $client_name_escaped - $ip - $os - $browser', notification_timestamp = NOW(), notification_client_id = $client_id, company_id = $company_id");
|
||||||
|
|
||||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
$sql_payments = mysqli_query($mysqli, "SELECT * FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
||||||
|
|
||||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id");
|
$sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id");
|
||||||
$row = mysqli_fetch_array($sql_amount_paid);
|
$row = mysqli_fetch_array($sql_amount_paid);
|
||||||
$amount_paid = $row['amount_paid'];
|
$amount_paid = $row['amount_paid'];
|
||||||
|
|
||||||
@@ -193,7 +191,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key'])) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php $sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC"); ?>
|
<?php $sql_invoice_items = mysqli_query($mysqli, "SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC"); ?>
|
||||||
|
|
||||||
<div class="row mb-4">
|
<div class="row mb-4">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@@ -296,10 +294,10 @@ if (isset($_GET['invoice_id'], $_GET['url_key'])) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src='plugins/pdfmake/pdfmake.min.js'></script>
|
<script src='plugins/pdfmake/pdfmake.min.js'></script>
|
||||||
<script src='plugins/pdfmake/vfs_fonts.js'></script>
|
<script src='plugins/pdfmake/vfs_fonts.js'></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var docDefinition = {
|
var docDefinition = {
|
||||||
info: {
|
info: {
|
||||||
title: <?php echo json_encode(html_entity_decode($company_name) . "- Invoice") ?>,
|
title: <?php echo json_encode(html_entity_decode($company_name) . "- Invoice") ?>,
|
||||||
author: <?php echo json_encode(html_entity_decode($company_name)) ?>
|
author: <?php echo json_encode(html_entity_decode($company_name)) ?>
|
||||||
@@ -441,7 +439,7 @@ var docDefinition = {
|
|||||||
$total_tax = 0;
|
$total_tax = 0;
|
||||||
$sub_total = 0;
|
$sub_total = 0;
|
||||||
|
|
||||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC");
|
$sql_invoice_items = mysqli_query($mysqli, "SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC");
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_invoice_items)) {
|
while ($row = mysqli_fetch_array($sql_invoice_items)) {
|
||||||
$item_name = $row['item_name'];
|
$item_name = $row['item_name'];
|
||||||
@@ -714,12 +712,12 @@ var docDefinition = {
|
|||||||
defaultStyle: {
|
defaultStyle: {
|
||||||
columnGap: 20
|
columnGap: 20
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_due < CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_date DESC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_due < CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_date DESC");
|
||||||
|
|
||||||
if (mysqli_num_rows($sql) > 1) {
|
if (mysqli_num_rows($sql) > 1) {
|
||||||
|
|
||||||
@@ -779,7 +777,7 @@ var docDefinition = {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_due > CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_number DESC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_due > CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_number DESC");
|
||||||
|
|
||||||
if (mysqli_num_rows($sql) > 1) {
|
if (mysqli_num_rows($sql) > 1) {
|
||||||
|
|
||||||
@@ -840,7 +838,7 @@ var docDefinition = {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_status = 'Paid' ORDER BY invoice_date DESC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_status = 'Paid' ORDER BY invoice_date DESC");
|
||||||
|
|
||||||
if (mysqli_num_rows($sql) > 1) {
|
if (mysqli_num_rows($sql) > 1) {
|
||||||
|
|
||||||
@@ -890,7 +888,7 @@ var docDefinition = {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments WHERE payment_invoice_id = $invoice_id ORDER BY payment_date DESC");
|
$sql_payments = mysqli_query($mysqli, "SELECT * FROM payments WHERE payment_invoice_id = $invoice_id ORDER BY payment_date DESC");
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_payments)) {
|
while ($row = mysqli_fetch_array($sql_payments)) {
|
||||||
$payment_id = $row['payment_id'];
|
$payment_id = $row['payment_id'];
|
||||||
@@ -935,7 +933,7 @@ var docDefinition = {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}else{
|
}else{
|
||||||
echo "GTFO";
|
echo "GTFO";
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-24
@@ -6,7 +6,7 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
|
|
||||||
$invoice_id = intval($_GET['invoice_id']);
|
$invoice_id = intval($_GET['invoice_id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices
|
$sql = mysqli_query($mysqli, "SELECT * FROM invoices
|
||||||
LEFT JOIN clients ON invoice_client_id = client_id
|
LEFT JOIN clients ON invoice_client_id = client_id
|
||||||
LEFT JOIN locations ON primary_location = location_id
|
LEFT JOIN locations ON primary_location = location_id
|
||||||
LEFT JOIN contacts ON primary_contact = contact_id
|
LEFT JOIN contacts ON primary_contact = contact_id
|
||||||
@@ -16,7 +16,7 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
|
|
||||||
if (mysqli_num_rows($sql) == 0) {
|
if (mysqli_num_rows($sql) == 0) {
|
||||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1></center>";
|
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1></center>";
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$invoice_id = $row['invoice_id'];
|
$invoice_id = $row['invoice_id'];
|
||||||
@@ -62,12 +62,12 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
if (!empty($company_logo)) {
|
if (!empty($company_logo)) {
|
||||||
$company_logo_base64 = base64_encode(file_get_contents("uploads/settings/$company_id/$company_logo"));
|
$company_logo_base64 = base64_encode(file_get_contents("uploads/settings/$company_id/$company_logo"));
|
||||||
}
|
}
|
||||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE history_invoice_id = $invoice_id ORDER BY history_id DESC");
|
$sql_history = mysqli_query($mysqli, "SELECT * FROM history WHERE history_invoice_id = $invoice_id ORDER BY history_id DESC");
|
||||||
|
|
||||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
$sql_payments = mysqli_query($mysqli, "SELECT * FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
||||||
|
|
||||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id");
|
$sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id");
|
||||||
$row = mysqli_fetch_array($sql_amount_paid);
|
$row = mysqli_fetch_array($sql_amount_paid);
|
||||||
$amount_paid = $row['amount_paid'];
|
$amount_paid = $row['amount_paid'];
|
||||||
|
|
||||||
@@ -84,20 +84,20 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
//Set Badge color based off of invoice status
|
//Set Badge color based off of invoice status
|
||||||
if ($invoice_status == "Sent") {
|
if ($invoice_status == "Sent") {
|
||||||
$invoice_badge_color = "warning text-white";
|
$invoice_badge_color = "warning text-white";
|
||||||
}elseif ($invoice_status == "Viewed") {
|
} elseif ($invoice_status == "Viewed") {
|
||||||
$invoice_badge_color = "info";
|
$invoice_badge_color = "info";
|
||||||
}elseif ($invoice_status == "Partial") {
|
} elseif ($invoice_status == "Partial") {
|
||||||
$invoice_badge_color = "primary";
|
$invoice_badge_color = "primary";
|
||||||
}elseif ($invoice_status == "Paid") {
|
} elseif ($invoice_status == "Paid") {
|
||||||
$invoice_badge_color = "success";
|
$invoice_badge_color = "success";
|
||||||
}elseif ($invoice_status == "Cancelled") {
|
} elseif ($invoice_status == "Cancelled") {
|
||||||
$invoice_badge_color = "danger";
|
$invoice_badge_color = "danger";
|
||||||
}else{
|
} else {
|
||||||
$invoice_badge_color = "secondary";
|
$invoice_badge_color = "secondary";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Product autocomplete
|
//Product autocomplete
|
||||||
$products_sql = mysqli_query($mysqli,"SELECT product_name AS label, product_description AS description, product_price AS price FROM products WHERE company_id = $session_company_id");
|
$products_sql = mysqli_query($mysqli, "SELECT product_name AS label, product_description AS description, product_price AS price FROM products WHERE company_id = $session_company_id");
|
||||||
|
|
||||||
if (mysqli_num_rows($products_sql) > 0) {
|
if (mysqli_num_rows($products_sql) > 0) {
|
||||||
while ($row = mysqli_fetch_array($products_sql)) {
|
while ($row = mysqli_fetch_array($products_sql)) {
|
||||||
@@ -106,9 +106,9 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
$json_products = json_encode($products);
|
$json_products = json_encode($products);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<ol class="breadcrumb d-print-none">
|
<ol class="breadcrumb d-print-none">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="invoices.php">Invoices</a>
|
<a href="invoices.php">Invoices</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -119,9 +119,9 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
<?php if (isset($invoice_overdue)) { ?>
|
<?php if (isset($invoice_overdue)) { ?>
|
||||||
<span class="p-2 ml-2 badge badge-danger"><?php echo $invoice_overdue; ?></span>
|
<span class="p-2 ml-2 badge badge-danger"><?php echo $invoice_overdue; ?></span>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|
||||||
<div class="card-header d-print-none">
|
<div class="card-header d-print-none">
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php $sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC"); ?>
|
<?php $sql_invoice_items = mysqli_query($mysqli, "SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC"); ?>
|
||||||
|
|
||||||
<div class="row mb-4">
|
<div class="row mb-4">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@@ -304,7 +304,7 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
<option value="0">None</option>
|
<option value="0">None</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$taxes_sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC");
|
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC");
|
||||||
while ($row = mysqli_fetch_array($taxes_sql)) {
|
while ($row = mysqli_fetch_array($taxes_sql)) {
|
||||||
$tax_id = $row['tax_id'];
|
$tax_id = $row['tax_id'];
|
||||||
$tax_name = htmlentities($row['tax_name']);
|
$tax_name = htmlentities($row['tax_name']);
|
||||||
@@ -379,9 +379,9 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
|
|
||||||
<center class="d-none d-print-block" style="white-space:pre-line"><?php echo htmlentities($config_invoice_footer); ?></center>
|
<center class="d-none d-print-block" style="white-space:pre-line"><?php echo htmlentities($config_invoice_footer); ?></center>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row d-print-none mb-3">
|
<div class="row d-print-none mb-3">
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
@@ -480,9 +480,9 @@ if (isset($_GET['invoice_id'])) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include("invoice_payment_add_modal.php");
|
include("invoice_payment_add_modal.php");
|
||||||
include("invoice_copy_modal.php");
|
include("invoice_copy_modal.php");
|
||||||
include("invoice_recurring_add_modal.php");
|
include("invoice_recurring_add_modal.php");
|
||||||
@@ -521,7 +521,7 @@ include("footer.php");
|
|||||||
<script src='plugins/pdfmake/vfs_fonts.js'></script>
|
<script src='plugins/pdfmake/vfs_fonts.js'></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var docDefinition = {
|
var docDefinition = {
|
||||||
info: {
|
info: {
|
||||||
title: <?php echo json_encode(html_entity_decode($company_name) . "- Invoice") ?>,
|
title: <?php echo json_encode(html_entity_decode($company_name) . "- Invoice") ?>,
|
||||||
author: <?php echo json_encode(html_entity_decode($company_name)) ?>
|
author: <?php echo json_encode(html_entity_decode($company_name)) ?>
|
||||||
@@ -663,7 +663,7 @@ var docDefinition = {
|
|||||||
$total_tax = 0;
|
$total_tax = 0;
|
||||||
$sub_total = 0;
|
$sub_total = 0;
|
||||||
|
|
||||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC");
|
$sql_invoice_items = mysqli_query($mysqli, "SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC");
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_invoice_items)) {
|
while ($row = mysqli_fetch_array($sql_invoice_items)) {
|
||||||
$item_name = $row['item_name'];
|
$item_name = $row['item_name'];
|
||||||
@@ -936,5 +936,5 @@ var docDefinition = {
|
|||||||
defaultStyle: {
|
defaultStyle: {
|
||||||
columnGap: 20
|
columnGap: 20
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
if (!isset($_SESSION)) {
|
if (!isset($_SESSION)) {
|
||||||
// HTTP Only cookies
|
// HTTP Only cookies
|
||||||
ini_set("session.cookie_httponly", True);
|
ini_set("session.cookie_httponly", true);
|
||||||
if ($config_https_only) {
|
if ($config_https_only) {
|
||||||
// Tell client to only send cookie(s) over HTTPS
|
// Tell client to only send cookie(s) over HTTPS
|
||||||
ini_set("session.cookie_secure", True);
|
ini_set("session.cookie_secure", true);
|
||||||
}
|
}
|
||||||
session_start();
|
session_start();
|
||||||
}
|
}
|
||||||
@@ -36,10 +36,10 @@ $session_company_id = $_SESSION['company_id'];
|
|||||||
$contact_sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_id = '$session_contact_id' AND contact_client_id = '$session_client_id'");
|
$contact_sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_id = '$session_contact_id' AND contact_client_id = '$session_client_id'");
|
||||||
$contact = mysqli_fetch_array($contact_sql);
|
$contact = mysqli_fetch_array($contact_sql);
|
||||||
|
|
||||||
$session_contact_name = strip_tags(mysqli_real_escape_string($mysqli,$contact['contact_name']));
|
$session_contact_name = strip_tags(mysqli_real_escape_string($mysqli, $contact['contact_name']));
|
||||||
$session_contact_initials = initials($session_contact_name);
|
$session_contact_initials = initials($session_contact_name);
|
||||||
$session_contact_title = strip_tags(mysqli_real_escape_string($mysqli,$contact['contact_title']));
|
$session_contact_title = strip_tags(mysqli_real_escape_string($mysqli, $contact['contact_title']));
|
||||||
$session_contact_email = strip_tags(mysqli_real_escape_string($mysqli,$contact['contact_email']));
|
$session_contact_email = strip_tags(mysqli_real_escape_string($mysqli, $contact['contact_email']));
|
||||||
$session_contact_photo = $contact['contact_photo'];
|
$session_contact_photo = $contact['contact_photo'];
|
||||||
|
|
||||||
// Get client info
|
// Get client info
|
||||||
|
|||||||
+16
-18
@@ -1,12 +1,10 @@
|
|||||||
<?php include("inc_all.php"); ?>
|
<?php include("inc_all.php");
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if (isset($_GET['recurring_id'])) {
|
if (isset($_GET['recurring_id'])) {
|
||||||
|
|
||||||
$recurring_id = intval($_GET['recurring_id']);
|
$recurring_id = intval($_GET['recurring_id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM recurring
|
$sql = mysqli_query($mysqli, "SELECT * FROM recurring
|
||||||
LEFT JOIN clients ON recurring_client_id = client_id
|
LEFT JOIN clients ON recurring_client_id = client_id
|
||||||
LEFT JOIN locations ON primary_location = location_id
|
LEFT JOIN locations ON primary_location = location_id
|
||||||
LEFT JOIN contacts ON primary_contact = contact_id
|
LEFT JOIN contacts ON primary_contact = contact_id
|
||||||
@@ -48,7 +46,7 @@ if (isset($_GET['recurring_id'])) {
|
|||||||
if ($recurring_status == 1) {
|
if ($recurring_status == 1) {
|
||||||
$status = "Active";
|
$status = "Active";
|
||||||
$status_badge_color = "success";
|
$status_badge_color = "success";
|
||||||
}else{
|
} else {
|
||||||
$status = "Inactive";
|
$status = "Inactive";
|
||||||
$status_badge_color = "secondary";
|
$status_badge_color = "secondary";
|
||||||
}
|
}
|
||||||
@@ -64,10 +62,10 @@ if (isset($_GET['recurring_id'])) {
|
|||||||
$company_website = htmlentities($row['company_website']);
|
$company_website = htmlentities($row['company_website']);
|
||||||
$company_logo = htmlentities($row['company_logo']);
|
$company_logo = htmlentities($row['company_logo']);
|
||||||
|
|
||||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE history_recurring_id = $recurring_id ORDER BY history_id DESC");
|
$sql_history = mysqli_query($mysqli, "SELECT * FROM history WHERE history_recurring_id = $recurring_id ORDER BY history_id DESC");
|
||||||
|
|
||||||
//Product autocomplete
|
//Product autocomplete
|
||||||
$products_sql = mysqli_query($mysqli,"SELECT product_name AS label, product_description AS description, product_price AS price FROM products WHERE company_id = $session_company_id");
|
$products_sql = mysqli_query($mysqli, "SELECT product_name AS label, product_description AS description, product_price AS price FROM products WHERE company_id = $session_company_id");
|
||||||
|
|
||||||
if (mysqli_num_rows($products_sql) > 0) {
|
if (mysqli_num_rows($products_sql) > 0) {
|
||||||
while ($row = mysqli_fetch_array($products_sql)) {
|
while ($row = mysqli_fetch_array($products_sql)) {
|
||||||
@@ -76,9 +74,9 @@ if (isset($_GET['recurring_id'])) {
|
|||||||
$json_products = json_encode($products);
|
$json_products = json_encode($products);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<ol class="breadcrumb d-print-none">
|
<ol class="breadcrumb d-print-none">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="recurring_invoices.php"> Recurring Invoices</a>
|
<a href="recurring_invoices.php"> Recurring Invoices</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -87,9 +85,9 @@ if (isset($_GET['recurring_id'])) {
|
|||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item active"><?php echo "$recurring_prefix$recurring_number"; ?></li>
|
<li class="breadcrumb-item active"><?php echo "$recurring_prefix$recurring_number"; ?></li>
|
||||||
<span class="ml-3 p-2 badge badge-<?php echo $status_badge_color; ?>"><?php echo $status; ?></span>
|
<span class="ml-3 p-2 badge badge-<?php echo $status_badge_color; ?>"><?php echo $status; ?></span>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header d-print-none">
|
<div class="card-header d-print-none">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -116,7 +114,7 @@ if (isset($_GET['recurring_id'])) {
|
|||||||
|
|
||||||
<div class="row mb-4">
|
<div class="row mb-4">
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<img class="img-fluid" src="<?php echo "uploads/settings/$company_id/$company_logo"; ?>">
|
<img class="img-fluid" alt="Company logo" src="<?php echo "uploads/settings/$company_id/$company_logo"; ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<h3 class="text-right"><strong>Recurring Invoice</strong><br><small class="text-secondary"><?php echo ucwords($recurring_frequency); ?>ly</small></h3>
|
<h3 class="text-right"><strong>Recurring Invoice</strong><br><small class="text-secondary"><?php echo ucwords($recurring_frequency); ?>ly</small></h3>
|
||||||
@@ -164,7 +162,7 @@ if (isset($_GET['recurring_id'])) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_id = $recurring_id ORDER BY item_id ASC"); ?>
|
<?php $sql_items = mysqli_query($mysqli, "SELECT * FROM invoice_items WHERE item_recurring_id = $recurring_id ORDER BY item_id ASC"); ?>
|
||||||
|
|
||||||
<div class="row mb-4">
|
<div class="row mb-4">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@@ -237,7 +235,7 @@ if (isset($_GET['recurring_id'])) {
|
|||||||
<option value="0">None</option>
|
<option value="0">None</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$taxes_sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC");
|
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC");
|
||||||
while ($row = mysqli_fetch_array($taxes_sql)) {
|
while ($row = mysqli_fetch_array($taxes_sql)) {
|
||||||
$tax_id = $row['tax_id'];
|
$tax_id = $row['tax_id'];
|
||||||
$tax_name = htmlentities($row['tax_name']);
|
$tax_name = htmlentities($row['tax_name']);
|
||||||
@@ -302,9 +300,9 @@ if (isset($_GET['recurring_id'])) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-sm d-print-none">
|
<div class="col-sm d-print-none">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
@@ -348,9 +346,9 @@ if (isset($_GET['recurring_id'])) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include("recurring_invoice_edit_modal.php");
|
include("recurring_invoice_edit_modal.php");
|
||||||
include("recurring_invoice_note_modal.php");
|
include("recurring_invoice_note_modal.php");
|
||||||
|
|||||||
+5
-8
@@ -1,19 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
include("inc_all_settings.php");
|
include("inc_all_settings.php");
|
||||||
include("database_version.php");
|
include("database_version.php");
|
||||||
include("config.php")
|
include("config.php");
|
||||||
?>
|
|
||||||
|
|
||||||
<?php
|
// Fetch the latest code changes but don't apply them
|
||||||
|
|
||||||
//fetch the latest code changes but don't apply them
|
|
||||||
exec("git fetch", $output, $result);
|
exec("git fetch", $output, $result);
|
||||||
$latest_version = exec("git rev-parse origin/$repo_branch");
|
$latest_version = exec("git rev-parse origin/$repo_branch");
|
||||||
$current_version = exec("git rev-parse HEAD");
|
$current_version = exec("git rev-parse HEAD");
|
||||||
|
|
||||||
if ($current_version == $latest_version) {
|
if ($current_version == $latest_version) {
|
||||||
$update_message = "No Updates available";
|
$update_message = "No Updates available";
|
||||||
}else{
|
} else {
|
||||||
$update_message = "New Updates are Available [$latest_version]";
|
$update_message = "New Updates are Available [$latest_version]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +35,7 @@ $git_log = shell_exec("git log $repo_branch..origin/$repo_branch --pretty=format
|
|||||||
<?php if (!empty($git_log)) { ?>
|
<?php if (!empty($git_log)) { ?>
|
||||||
<a class="btn btn-primary btn-lg my-4" href="post.php?update"><i class="fas fa-fw fa-4x fa-arrow-alt-circle-up mb-1"></i><h5>Update App</h5></a>
|
<a class="btn btn-primary btn-lg my-4" href="post.php?update"><i class="fas fa-fw fa-4x fa-arrow-alt-circle-up mb-1"></i><h5>Update App</h5></a>
|
||||||
<?php
|
<?php
|
||||||
}else{
|
} else {
|
||||||
if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { ?>
|
if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { ?>
|
||||||
<div class="alert alert-warning" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
<strong>Ensure you have a current app & database backup before updating!</strong>
|
<strong>Ensure you have a current app & database backup before updating!</strong>
|
||||||
@@ -50,7 +47,7 @@ $git_log = shell_exec("git log $repo_branch..origin/$repo_branch --pretty=format
|
|||||||
<br>
|
<br>
|
||||||
<small class="text-secondary">Latest DB Version: <?php echo LATEST_DATABASE_VERSION; ?></small>
|
<small class="text-secondary">Latest DB Version: <?php echo LATEST_DATABASE_VERSION; ?></small>
|
||||||
<?php }
|
<?php }
|
||||||
else{ ?>
|
else { ?>
|
||||||
<h3 class="text-success"><i class="fas fa-check-square"></i> Latest version!</h3>
|
<h3 class="text-success"><i class="fas fa-check-square"></i> Latest version!</h3>
|
||||||
<small class="text-secondary">Current DB Version: <?php echo CURRENT_DATABASE_VERSION; ?></small>
|
<small class="text-secondary">Current DB Version: <?php echo CURRENT_DATABASE_VERSION; ?></small>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
+13
-15
@@ -1,6 +1,4 @@
|
|||||||
<?php include("inc_all.php"); ?>
|
<?php include("inc_all.php");
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if (isset($_GET['ticket_id'])) {
|
if (isset($_GET['ticket_id'])) {
|
||||||
$ticket_id = intval($_GET['ticket_id']);
|
$ticket_id = intval($_GET['ticket_id']);
|
||||||
@@ -17,9 +15,9 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
if (mysqli_num_rows($sql) == 0) {
|
if (mysqli_num_rows($sql) == 0) {
|
||||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='tickets.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='tickets.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||||
|
|
||||||
include("footer.php");
|
include_once("footer.php");
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$client_id = $row['client_id'];
|
$client_id = $row['client_id'];
|
||||||
@@ -47,20 +45,20 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
|
|
||||||
if ($ticket_status == "Open") {
|
if ($ticket_status == "Open") {
|
||||||
$ticket_status_display = "<span class='p-2 badge badge-primary'>$ticket_status</span>";
|
$ticket_status_display = "<span class='p-2 badge badge-primary'>$ticket_status</span>";
|
||||||
}elseif ($ticket_status == "Working") {
|
} elseif ($ticket_status == "Working") {
|
||||||
$ticket_status_display = "<span class='p-2 badge badge-success'>$ticket_status</span>";
|
$ticket_status_display = "<span class='p-2 badge badge-success'>$ticket_status</span>";
|
||||||
}else{
|
} else {
|
||||||
$ticket_status_display = "<span class='p-2 badge badge-secondary'>$ticket_status</span>";
|
$ticket_status_display = "<span class='p-2 badge badge-secondary'>$ticket_status</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set Ticket Bage Color based of priority
|
//Set Ticket Bage Color based of priority
|
||||||
if ($ticket_priority == "High") {
|
if ($ticket_priority == "High") {
|
||||||
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
|
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
|
||||||
}elseif ($ticket_priority == "Medium") {
|
} elseif ($ticket_priority == "Medium") {
|
||||||
$ticket_priority_display = "<span class='p-2 badge badge-warning'>$ticket_priority</span>";
|
$ticket_priority_display = "<span class='p-2 badge badge-warning'>$ticket_priority</span>";
|
||||||
}elseif ($ticket_priority == "Low") {
|
} elseif ($ticket_priority == "Low") {
|
||||||
$ticket_priority_display = "<span class='p-2 badge badge-info'>$ticket_priority</span>";
|
$ticket_priority_display = "<span class='p-2 badge badge-info'>$ticket_priority</span>";
|
||||||
}else{
|
} else {
|
||||||
$ticket_priority_display = "-";
|
$ticket_priority_display = "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +90,7 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
$ticket_assigned_to = $row['ticket_assigned_to'];
|
$ticket_assigned_to = $row['ticket_assigned_to'];
|
||||||
if (empty($ticket_assigned_to)) {
|
if (empty($ticket_assigned_to)) {
|
||||||
$ticket_assigned_to_display = "<span class='text-danger'>Not Assigned</span>";
|
$ticket_assigned_to_display = "<span class='text-danger'>Not Assigned</span>";
|
||||||
}else{
|
} else {
|
||||||
$ticket_assigned_to_display = htmlentities($row['user_name']);
|
$ticket_assigned_to_display = htmlentities($row['user_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +103,7 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
//Ticket Assigned To
|
//Ticket Assigned To
|
||||||
if (empty($ticket_assigned_to)) {
|
if (empty($ticket_assigned_to)) {
|
||||||
$ticket_assigned_to_display = "<span class='text-danger'>Not Assigned</span>";
|
$ticket_assigned_to_display = "<span class='text-danger'>Not Assigned</span>";
|
||||||
}else{
|
} else {
|
||||||
$ticket_assigned_to_display = htmlentities($row['user_name']);
|
$ticket_assigned_to_display = htmlentities($row['user_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +153,7 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
|
|
||||||
if ($dt_value <= $date) {
|
if ($dt_value <= $date) {
|
||||||
$dt_value = "Expired on $asset_warranty_expire"; $warranty_status_color ='red';
|
$dt_value = "Expired on $asset_warranty_expire"; $warranty_status_color ='red';
|
||||||
}else{
|
} else {
|
||||||
$warranty_status_color = 'green';
|
$warranty_status_color = 'green';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,7 +307,7 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="card card-outline <?php if ($ticket_reply_type == 'Internal') { echo "card-dark"; } elseif ($ticket_reply_type == 'Client') {echo "card-warning"; } else{ echo "card-info"; } ?> mb-3">
|
<div class="card card-outline <?php if ($ticket_reply_type == 'Internal') { echo "card-dark"; } elseif ($ticket_reply_type == 'Client') {echo "card-warning"; } else { echo "card-info"; } ?> mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">
|
<h3 class="card-title">
|
||||||
<div class="media">
|
<div class="media">
|
||||||
@@ -580,7 +578,7 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php include("footer.php");
|
<?php include_once("footer.php");
|
||||||
|
|
||||||
if ($ticket_status !== "Closed") { ?>
|
if ($ticket_status !== "Closed") { ?>
|
||||||
<!-- Ticket Time Tracking JS -->
|
<!-- Ticket Time Tracking JS -->
|
||||||
|
|||||||
+9
-11
@@ -1,12 +1,10 @@
|
|||||||
<?php include("inc_all.php"); ?>
|
<?php include("inc_all.php");
|
||||||
|
|
||||||
<?php
|
$sql_recent_logins = mysqli_query($mysqli, "SELECT * FROM logs
|
||||||
|
|
||||||
$sql_recent_logins = mysqli_query($mysqli,"SELECT * FROM logs
|
|
||||||
WHERE log_type = 'Login' OR log_type = 'Login 2FA' AND log_action = 'Success' AND log_user_id = $session_user_id
|
WHERE log_type = 'Login' OR log_type = 'Login 2FA' AND log_action = 'Success' AND log_user_id = $session_user_id
|
||||||
ORDER BY log_id DESC LIMIT 3");
|
ORDER BY log_id DESC LIMIT 3");
|
||||||
|
|
||||||
$sql_recent_logs = mysqli_query($mysqli,"SELECT * FROM logs
|
$sql_recent_logs = mysqli_query($mysqli, "SELECT * FROM logs
|
||||||
WHERE log_user_id = $session_user_id AND log_type NOT LIKE 'Login'
|
WHERE log_user_id = $session_user_id AND log_type NOT LIKE 'Login'
|
||||||
ORDER BY log_id DESC LIMIT 5");
|
ORDER BY log_id DESC LIMIT 5");
|
||||||
|
|
||||||
@@ -27,8 +25,8 @@ $sql_recent_logs = mysqli_query($mysqli,"SELECT * FROM logs
|
|||||||
<center class="mb-3 px-5">
|
<center class="mb-3 px-5">
|
||||||
<?php if (empty($session_avatar)) { ?>
|
<?php if (empty($session_avatar)) { ?>
|
||||||
<i class="fas fa-user-circle fa-8x text-secondary"></i>
|
<i class="fas fa-user-circle fa-8x text-secondary"></i>
|
||||||
<?php }else{ ?>
|
<?php } else { ?>
|
||||||
<img src="<?php echo "uploads/users/$session_user_id/$session_avatar"; ?>" class="img-fluid">
|
<img alt="User avatar" src="<?php echo "uploads/users/$session_user_id/$session_avatar"; ?>" class="img-fluid">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<h4 class="text-secondary mt-2"><?php echo htmlentities($session_user_role_display); ?></h4>
|
<h4 class="text-secondary mt-2"><?php echo htmlentities($session_user_role_display); ?></h4>
|
||||||
</center>
|
</center>
|
||||||
@@ -97,7 +95,7 @@ $sql_recent_logs = mysqli_query($mysqli,"SELECT * FROM logs
|
|||||||
|
|
||||||
<?php if (empty($session_token)) { ?>
|
<?php if (empty($session_token)) { ?>
|
||||||
<button type="submit" name="enable_2fa" class="btn btn-success btn-block mt-3"><i class="fa fa-fw fa-lock"></i><br> Enable 2FA</button>
|
<button type="submit" name="enable_2fa" class="btn btn-success btn-block mt-3"><i class="fa fa-fw fa-lock"></i><br> Enable 2FA</button>
|
||||||
<?php }else{ ?>
|
<?php } else { ?>
|
||||||
<p>You have set up 2FA. Your QR code is below.</p>
|
<p>You have set up 2FA. Your QR code is below.</p>
|
||||||
<button type="submit" name="disable_2fa" class="btn btn-danger btn-block mt-3"><i class="fa fa-fw fa-unlock"></i><br>Disable 2FA</button>
|
<button type="submit" name="disable_2fa" class="btn btn-danger btn-block mt-3"><i class="fa fa-fw fa-unlock"></i><br>Disable 2FA</button>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -200,11 +198,11 @@ $sql_recent_logs = mysqli_query($mysqli,"SELECT * FROM logs
|
|||||||
|
|
||||||
if ($log_action == 'Create') {
|
if ($log_action == 'Create') {
|
||||||
$log_icon = "plus text-success";
|
$log_icon = "plus text-success";
|
||||||
}elseif ($log_action == 'Modify') {
|
} elseif ($log_action == 'Modify') {
|
||||||
$log_icon = "edit text-info";
|
$log_icon = "edit text-info";
|
||||||
}elseif ($log_action == 'Delete') {
|
} elseif ($log_action == 'Delete') {
|
||||||
$log_icon = "trash-alt text-danger";
|
$log_icon = "trash-alt text-danger";
|
||||||
}else{
|
} else {
|
||||||
$log_icon = "pencil";
|
$log_icon = "pencil";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user