diff --git a/accounts.php b/accounts.php
index 3397a380..30b6bcca 100644
--- a/accounts.php
+++ b/accounts.php
@@ -1,51 +1,19 @@
-
+ $sb, 'o' => $o)));
- if(isset($_GET['o'])){
- if($_GET['o'] == 'ASC'){
- $o = "ASC";
- $disp = "DESC";
- }else{
- $o = "DESC";
- $disp = "ASC";
- }
- }else{
- $o = "ASC";
- $disp = "DESC";
- }
+$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM accounts
+ WHERE account_name LIKE '%$q%' AND company_id = $session_company_id
+ ORDER BY $sb $o LIMIT $record_from, $record_to");
- //Rebuild URL
- $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
- WHERE account_name LIKE '%$q%' AND company_id = $session_company_id
- 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()"));
?>
diff --git a/assets.php b/assets.php
index da003db9..621b418f 100644
--- a/assets.php
+++ b/assets.php
@@ -1,23 +1,5 @@
">
-
+
@@ -170,7 +140,7 @@
diff --git a/categories.php b/categories.php
index 27e14ea8..b33a42af 100644
--- a/categories.php
+++ b/categories.php
@@ -1,27 +1,10 @@
$sb, 'o' => $o)));
diff --git a/client_assets.php b/client_assets.php
index ea76d271..187149e5 100644
--- a/client_assets.php
+++ b/client_assets.php
@@ -29,42 +29,12 @@ $row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT(*) AS count FROM as
AND asset_archived_at IS NULL AND asset_client_id = $client_id"));
$other_count = $row['count'];
-//Paging
-if(isset($_GET['p'])){
- $p = intval($_GET['p']);
- $record_from = (($p)-1)*$_SESSION['records_per_page'];
- $record_to = $_SESSION['records_per_page'];
-}else{
- $record_from = 0;
- $record_to = $_SESSION['records_per_page'];
- $p = 1;
-}
-
-if(isset($_GET['q'])){
- $q = mysqli_real_escape_string($mysqli,$_GET['q']);
-}else{
- $q = "";
-}
-
if(!empty($_GET['sb'])){
$sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
}else{
$sb = "asset_name";
}
-if(isset($_GET['o'])){
- if($_GET['o'] == 'ASC'){
- $o = "ASC";
- $disp = "DESC";
- }else{
- $o = "DESC";
- $disp = "ASC";
- }
-}else{
- $o = "ASC";
- $disp = "DESC";
-}
-
//Asset Type from GET
if(isset($_GET['type']) && ($_GET['type']) == 'workstation'){
$type_query = "asset_type = 'desktop' OR asset_type = 'laptop'";
diff --git a/client_certificates.php b/client_certificates.php
index fc71297b..65c2ad82 100644
--- a/client_certificates.php
+++ b/client_certificates.php
@@ -1,21 +1,5 @@
$sb, 'o' => $o)));
diff --git a/client_contacts.php b/client_contacts.php
index 965eb4db..679ceb36 100644
--- a/client_contacts.php
+++ b/client_contacts.php
@@ -1,16 +1,5 @@
$sb, 'o' => $o)));
diff --git a/client_departments.php b/client_departments.php
index 3c02af01..80386750 100644
--- a/client_departments.php
+++ b/client_departments.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/client_documents.php b/client_documents.php
index 5b1e9c70..7a3f797e 100644
--- a/client_documents.php
+++ b/client_documents.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/client_invoices.php b/client_invoices.php
index 01bd405a..01e146c6 100644
--- a/client_invoices.php
+++ b/client_invoices.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/client_locations.php b/client_locations.php
index ab9f0d70..47288f7c 100644
--- a/client_locations.php
+++ b/client_locations.php
@@ -1,16 +1,5 @@
$sb, 'o' => $o)));
diff --git a/client_logins.php b/client_logins.php
index 83c037b9..74c7bd52 100644
--- a/client_logins.php
+++ b/client_logins.php
@@ -2,42 +2,12 @@
require_once("rfc6238.php");
-//Paging
-if(isset($_GET['p'])){
- $p = intval($_GET['p']);
- $record_from = (($p)-1)*$_SESSION['records_per_page'];
- $record_to = $_SESSION['records_per_page'];
-}else{
- $record_from = 0;
- $record_to = $_SESSION['records_per_page'];
- $p = 1;
-}
-
-if(isset($_GET['q'])){
- $q = mysqli_real_escape_string($mysqli,$_GET['q']);
-}else{
- $q = "";
-}
-
if(!empty($_GET['sb'])){
$sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
}else{
$sb = "login_name";
}
-if(isset($_GET['o'])){
- if($_GET['o'] == 'ASC'){
- $o = "ASC";
- $disp = "DESC";
- }else{
- $o = "DESC";
- $disp = "ASC";
- }
-}else{
- $o = "ASC";
- $disp = "DESC";
-}
-
//Rebuild URL
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
diff --git a/client_logs.php b/client_logs.php
index 80401c8b..b03da127 100644
--- a/client_logs.php
+++ b/client_logs.php
@@ -1,37 +1,13 @@
$sb, 'o' => $o)));
diff --git a/client_payments.php b/client_payments.php
index 716664fe..3b57e0d6 100644
--- a/client_payments.php
+++ b/client_payments.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/client_quotes.php b/client_quotes.php
index 1e8b3a49..24236166 100644
--- a/client_quotes.php
+++ b/client_quotes.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/client_recurring_invoices.php b/client_recurring_invoices.php
index b3980b45..4e5148db 100644
--- a/client_recurring_invoices.php
+++ b/client_recurring_invoices.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/client_routes.php b/client_routes.php
index 7a969f5a..fdb2a232 100644
--- a/client_routes.php
+++ b/client_routes.php
@@ -1,6 +1,9 @@
$sb, 'o' => $o)));
diff --git a/client_tickets.php b/client_tickets.php
index 39e6df9b..edf9866e 100644
--- a/client_tickets.php
+++ b/client_tickets.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/client_trips.php b/client_trips.php
index d170fadc..79a18944 100644
--- a/client_trips.php
+++ b/client_trips.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/companies.php b/companies.php
index eeaab81a..fb71a6b2 100644
--- a/companies.php
+++ b/companies.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/custom_links.php b/custom_links.php
index dbbe09a6..f0543f64 100644
--- a/custom_links.php
+++ b/custom_links.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/expenses.php b/expenses.php
index a98fb242..807c687e 100644
--- a/expenses.php
+++ b/expenses.php
@@ -1,41 +1,11 @@
\ No newline at end of file
diff --git a/inc_all_admin.php b/inc_all_admin.php
index 122c9782..eb158605 100644
--- a/inc_all_admin.php
+++ b/inc_all_admin.php
@@ -16,5 +16,6 @@ include("top_nav.php");
include("admin_side_nav.php");
include("inc_wrapper.php");
include("inc_alert_feedback.php");
+include("pagination_head.php");
?>
\ No newline at end of file
diff --git a/invoices.php b/invoices.php
index 68a96e21..6716927b 100644
--- a/invoices.php
+++ b/invoices.php
@@ -51,22 +51,6 @@
$real_overdue_amount = $total_overdue - $total_overdue_partial;
- //Paging
- if(isset($_GET['p'])){
- $p = intval($_GET['p']);
- $record_from = (($p)-1)*$_SESSION['records_per_page'];
- $record_to = $_SESSION['records_per_page'];
- }else{
- $record_from = 0;
- $record_to = $_SESSION['records_per_page'];
- $p = 1;
- }
-
- if(isset($_GET['q'])){
- $q = mysqli_real_escape_string($mysqli,$_GET['q']);
- }else{
- $q = "";
- }
if(!empty($_GET['sb'])){
$sb = strip_tags(mysqli_real_escape_string($mysqli, $_GET['sb']));
@@ -74,15 +58,8 @@
$sb = "invoice_number";
}
- if(isset($_GET['o'])){
- if($_GET['o'] == 'ASC'){
- $o = "ASC";
- $disp = "DESC";
- }else{
- $o = "DESC";
- $disp = "ASC";
- }
- }else{
+ // Reverse default sort
+ if(!isset($_GET['o'])){
$o = "DESC";
$disp = "ASC";
}
diff --git a/logs.php b/logs.php
index 1803d974..ca8765cf 100644
--- a/logs.php
+++ b/logs.php
@@ -1,37 +1,13 @@
$sb, 'o' => $o)));
diff --git a/quotes.php b/quotes.php
index fc16a0f7..9c67d5da 100644
--- a/quotes.php
+++ b/quotes.php
@@ -1,39 +1,13 @@
$sb, 'o' => $o)));
diff --git a/settings-api.php b/settings-api.php
index efbfbec4..e3af4810 100644
--- a/settings-api.php
+++ b/settings-api.php
@@ -1,41 +1,11 @@
$sb, 'o' => $o)));
diff --git a/tags.php b/tags.php
index bad8bcb9..d944f3a5 100644
--- a/tags.php
+++ b/tags.php
@@ -1,21 +1,4 @@
- $sb, 'o' => $o)));
diff --git a/taxes.php b/taxes.php
index bb9c1f1f..34ada9f0 100644
--- a/taxes.php
+++ b/taxes.php
@@ -6,19 +6,6 @@ if(!empty($_GET['sb'])){
$sb = "tax_name";
}
-if(isset($_GET['o'])){
- if($_GET['o'] == 'ASC'){
- $o = "ASC";
- $disp = "DESC";
- }else{
- $o = "DESC";
- $disp = "ASC";
- }
-}else{
- $o = "ASC";
- $disp = "DESC";
-}
-
//Rebuild URL
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
diff --git a/transfers.php b/transfers.php
index 87765d2c..3a8b3721 100644
--- a/transfers.php
+++ b/transfers.php
@@ -1,23 +1,5 @@
$sb, 'o' => $o)));
-
- //Paging
- if(isset($_GET['p'])){
- $p = intval($_GET['p']);
- $record_from = (($p)-1)*$_SESSION['records_per_page'];
- $record_to = $_SESSION['records_per_page'];
- }else{
- $record_from = 0;
- $record_to = $_SESSION['records_per_page'];
- $p = 1;
- }
-
- if(isset($_GET['q'])){
- $q = mysqli_real_escape_string($mysqli,$_GET['q']);
- }else{
- $q = "";
- }
-
- if(!empty($_GET['sb'])){
- $sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
- }else{
- $sb = "log_id";
- }
-
- if(isset($_GET['o'])){
- if($_GET['o'] == 'ASC'){
- $o = "ASC";
- $disp = "DESC";
- }else{
- $o = "DESC";
- $disp = "ASC";
- }
- }else{
- $o = "DESC";
- $disp = "ASC";
- }
-
- $sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM logs, users
- WHERE log_type LIKE '%$q%' OR log_action LIKE '%$q%' OR log_description LIKE '%$q%'
- AND (logs.user_id = users.user_id)
- ORDER BY $sb $o LIMIT $record_from, $record_to");
-
- $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
- $total_found_rows = $num_rows[0];
- $total_pages = ceil($total_found_rows / 10);
-
-?>
-
-
-
- $sb, 'o' => $o)));
diff --git a/vendors.php b/vendors.php
index de0f4606..f9f47214 100644
--- a/vendors.php
+++ b/vendors.php
@@ -1,16 +1,5 @@