mirror of
https://github.com/itflow-org/itflow
synced 2026-08-10 09:37:15 +00:00
Move more select * to column select for further optimization
This commit is contained in:
@@ -11,7 +11,7 @@ enforceUserPermission('module_financial');
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM accounts
|
||||
"SELECT SQL_CALC_FOUND_ROWS account_currency_code, account_id, account_name, account_notes, opening_balance FROM accounts
|
||||
WHERE (account_name LIKE '%$q%')
|
||||
AND account_archived_at IS NULL
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
|
||||
@@ -122,7 +122,7 @@ if (isset($_GET['asset_id'])) {
|
||||
$recurring_ticket_count = mysqli_num_rows($sql_related_recurring_tickets);
|
||||
|
||||
// Related Documents
|
||||
$sql_related_documents = mysqli_query($mysqli, "SELECT * FROM asset_documents
|
||||
$sql_related_documents = mysqli_query($mysqli, "SELECT 1 FROM asset_documents
|
||||
LEFT JOIN documents ON asset_documents.document_id = documents.document_id
|
||||
WHERE asset_documents.asset_id = $asset_id
|
||||
AND document_archived_at IS NULL
|
||||
@@ -252,7 +252,9 @@ if (isset($_GET['asset_id'])) {
|
||||
// Related Software Query
|
||||
$sql_related_software = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM software_assets
|
||||
"SELECT software_expire, software_assets.software_id, software_key, software_license_type,
|
||||
software_name, software_notes, software_purchase, software_seats, software_type,
|
||||
software_version FROM software_assets
|
||||
LEFT JOIN software ON software_assets.software_id = software.software_id
|
||||
WHERE software_assets.asset_id = $asset_id
|
||||
AND software_archived_at IS NULL
|
||||
|
||||
@@ -641,7 +641,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$location_name_display = $location_name;
|
||||
}
|
||||
|
||||
$sql_credentials = mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_asset_id = $asset_id");
|
||||
$sql_credentials = mysqli_query($mysqli, "SELECT 1 FROM credentials WHERE credential_asset_id = $asset_id");
|
||||
$credential_count = mysqli_num_rows($sql_credentials);
|
||||
|
||||
// Tags
|
||||
|
||||
@@ -83,7 +83,9 @@ if (isset($_GET['contact_id'])) {
|
||||
$asset_count = mysqli_num_rows($sql_related_assets);
|
||||
|
||||
// Linked Software Licenses
|
||||
$sql_linked_software = mysqli_query($mysqli, "SELECT * FROM software_contacts, software
|
||||
$sql_linked_software = mysqli_query($mysqli, "SELECT software_expire, software_contacts.software_id, software_key, software_license_type,
|
||||
software_name, software_notes, software_purchase, software_seats, software_type,
|
||||
software_version FROM software_contacts, software
|
||||
WHERE software_contacts.contact_id = $contact_id
|
||||
AND software_contacts.software_id = software.software_id
|
||||
AND software_archived_at IS NULL
|
||||
|
||||
@@ -117,7 +117,7 @@ if ($user_config_dashboard_financial_enable == 1) {
|
||||
|
||||
$profit = $total_income - $total_expenses;
|
||||
|
||||
$sql_accounts = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
$sql_accounts = mysqli_query($mysqli, "SELECT account_id, account_name, opening_balance FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
|
||||
$sql_latest_invoice_payments = mysqli_query($mysqli, "
|
||||
SELECT client_name, invoice_number, invoice_prefix, payment_amount, payment_date FROM payments
|
||||
|
||||
@@ -130,8 +130,7 @@ if (isset($_GET['invoice_id'])) {
|
||||
//Get billable, and unbilled tickets to add to invoice
|
||||
$sql_tickets_billable = mysqli_query(
|
||||
$mysqli, "
|
||||
SELECT
|
||||
*
|
||||
SELECT 1
|
||||
FROM
|
||||
tickets
|
||||
WHERE
|
||||
@@ -199,7 +198,7 @@ if (isset($_GET['invoice_id'])) {
|
||||
|
||||
// Saved Payment Methods
|
||||
$sql_saved_payment_methods = mysqli_query($mysqli, "
|
||||
SELECT * FROM client_saved_payment_methods
|
||||
SELECT 1 FROM client_saved_payment_methods
|
||||
LEFT JOIN payment_providers
|
||||
ON client_saved_payment_methods.saved_payment_provider_id = payment_providers.payment_provider_id
|
||||
WHERE saved_payment_client_id = $client_id
|
||||
|
||||
@@ -219,7 +219,9 @@ $file_count = mysqli_num_rows($sql_related_files);
|
||||
// Related Software Query
|
||||
$sql_related_software = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM software_assets
|
||||
"SELECT software_expire, software_assets.software_id, software_key, software_license_type,
|
||||
software_name, software_notes, software_purchase, software_seats, software_type,
|
||||
software_version FROM software_assets
|
||||
LEFT JOIN software ON software_assets.software_id = software.software_id
|
||||
WHERE software_assets.asset_id = $asset_id
|
||||
AND software_archived_at IS NULL
|
||||
|
||||
@@ -158,7 +158,7 @@ while ($row = mysqli_fetch_assoc($sql_note_type_icons)) {
|
||||
}
|
||||
|
||||
// Linked Services
|
||||
$sql_linked_services = mysqli_query($mysqli, "SELECT * FROM service_contacts, services
|
||||
$sql_linked_services = mysqli_query($mysqli, "SELECT 1 FROM service_contacts, services
|
||||
WHERE service_contacts.contact_id = $contact_id
|
||||
AND service_contacts.service_id = services.service_id
|
||||
ORDER BY service_name ASC"
|
||||
|
||||
@@ -93,7 +93,7 @@ ob_start();
|
||||
<option value="">- Select an Account -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT account_currency_code, account_id, account_name, opening_balance FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = escapeHtml($row['account_name']);
|
||||
|
||||
@@ -95,7 +95,7 @@ ob_start();
|
||||
<option value="">- Select an Account -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT account_id, account_name, opening_balance FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = escapeHtml($row['account_name']);
|
||||
|
||||
@@ -75,7 +75,7 @@ ob_start();
|
||||
<option value="">- Select an Account -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT account_id, account_name, opening_balance FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = escapeHtml($row['account_name']);
|
||||
|
||||
@@ -51,7 +51,7 @@ ob_start();
|
||||
<option value="">- Account -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT account_currency_code, account_id, account_name, opening_balance FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = escapeHtml($row['account_name']);
|
||||
|
||||
@@ -72,7 +72,7 @@ ob_start();
|
||||
<option value="">- Select Account -</option>
|
||||
<?php
|
||||
|
||||
$sql_accounts = mysqli_query($mysqli, "SELECT * FROM accounts WHERE (account_archived_at > '$revenue_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||
$sql_accounts = mysqli_query($mysqli, "SELECT account_archived_at, account_currency_code, account_id, account_name, opening_balance FROM accounts WHERE (account_archived_at > '$revenue_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_accounts)) {
|
||||
$account_id_select = intval($row['account_id']);
|
||||
$account_name_select = escapeHtml($row['account_name']);
|
||||
|
||||
@@ -50,7 +50,7 @@ ob_start();
|
||||
<option value="">- Account From -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT account_id, account_name, opening_balance FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = escapeHtml($row['account_name']);
|
||||
@@ -88,7 +88,7 @@ ob_start();
|
||||
<option value="">- Account To -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT account_id, account_name, opening_balance FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = escapeHtml($row['account_name']);
|
||||
|
||||
@@ -75,7 +75,7 @@ ob_start();
|
||||
<select class="form-control select2" name="account_from" required>
|
||||
<?php
|
||||
|
||||
$sql_accounts = mysqli_query($mysqli, "SELECT * FROM accounts WHERE (account_archived_at > '$transfer_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||
$sql_accounts = mysqli_query($mysqli, "SELECT account_archived_at, account_id, account_name, opening_balance FROM accounts WHERE (account_archived_at > '$transfer_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_accounts)) {
|
||||
$account_id_select = intval($row['account_id']);
|
||||
$account_name_select = escapeHtml($row['account_name']);
|
||||
@@ -119,7 +119,7 @@ ob_start();
|
||||
<select class="form-control select2" name="account_to" required>
|
||||
<?php
|
||||
|
||||
$sql2 = mysqli_query($mysqli, "SELECT * FROM accounts WHERE (account_archived_at > '$transfer_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||
$sql2 = mysqli_query($mysqli, "SELECT account_archived_at, account_id, account_name, opening_balance FROM accounts WHERE (account_archived_at > '$transfer_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql2)) {
|
||||
$account_id2 = intval($row['account_id']);
|
||||
$account_name = escapeHtml($row['account_name']);
|
||||
|
||||
@@ -111,7 +111,7 @@ if (isset($_POST['edit_asset'])) {
|
||||
|
||||
mysqli_query($mysqli,"UPDATE assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_uri = '$uri', asset_uri_2 = '$uri_2', asset_uri_client = '$uri_client', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_reference = '$purchase_reference', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_physical_location = '$physical_location', asset_notes = '$notes', asset_favorite = $favorite WHERE asset_id = $asset_id");
|
||||
|
||||
$sql_interfaces = mysqli_query($mysqli, "SELECT * FROM asset_interfaces WHERE interface_asset_id = $asset_id AND interface_primary = 1");
|
||||
$sql_interfaces = mysqli_query($mysqli, "SELECT 1 FROM asset_interfaces WHERE interface_asset_id = $asset_id AND interface_primary = 1");
|
||||
|
||||
if(mysqli_num_rows($sql_interfaces) == 0 ) {
|
||||
// Add Primary Interface
|
||||
@@ -1174,7 +1174,7 @@ if (isset($_POST["import_assets_csv"])) {
|
||||
// Name
|
||||
if (isset($column[0])) {
|
||||
$name = escapeSql($column[0]);
|
||||
if (mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_name = '$name' AND asset_client_id = $client_id")) > 0) {
|
||||
if (mysqli_num_rows(mysqli_query($mysqli,"SELECT 1 FROM assets WHERE asset_name = '$name' AND asset_client_id = $client_id")) > 0) {
|
||||
$duplicate_detect = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ if (isset($_POST["import_clients_csv"])) {
|
||||
$duplicate_detect = 0;
|
||||
if (isset($column[0])) {
|
||||
$name = escapeSql($column[0]);
|
||||
if (mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM clients WHERE client_name = '$name'")) > 0) {
|
||||
if (mysqli_num_rows(mysqli_query($mysqli,"SELECT 1 FROM clients WHERE client_name = '$name'")) > 0) {
|
||||
$duplicate_detect = 1;
|
||||
}
|
||||
}
|
||||
@@ -1245,7 +1245,7 @@ if (isset($_POST["export_client_pdf"])) {
|
||||
$sql_locations = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL ORDER BY location_name ASC");
|
||||
$sql_vendors = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id = $client_id AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||
$sql_credentials = mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_client_id = $client_id ORDER BY credential_name ASC");
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT 1 FROM assets
|
||||
LEFT JOIN contacts ON asset_contact_id = contact_id
|
||||
LEFT JOIN locations ON asset_location_id = location_id
|
||||
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||
|
||||
@@ -1428,7 +1428,7 @@ if (isset($_POST["import_contacts_csv"])) {
|
||||
$duplicate_detect = 0;
|
||||
if (isset($column[0])) {
|
||||
$name = escapeSql($column[0]);
|
||||
if (mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_name = '$name' AND contact_client_id = $client_id")) > 0) {
|
||||
if (mysqli_num_rows(mysqli_query($mysqli,"SELECT 1 FROM contacts WHERE contact_name = '$name' AND contact_client_id = $client_id")) > 0) {
|
||||
$duplicate_detect = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ if (isset($_POST["import_credentials_csv"])) {
|
||||
// Name
|
||||
if (isset($column[0])) {
|
||||
$name = escapeSql($column[0]);
|
||||
if (mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM credentials WHERE credential_name = '$name' AND credential_client_id = $client_id")) > 0){
|
||||
if (mysqli_num_rows(mysqli_query($mysqli,"SELECT 1 FROM credentials WHERE credential_name = '$name' AND credential_client_id = $client_id")) > 0){
|
||||
$duplicate_detect = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ if (isset($_POST["import_locations_csv"])) {
|
||||
$duplicate_detect = 0;
|
||||
if(isset($column[0])){
|
||||
$name = escapeSql($column[0]);
|
||||
if(mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM locations WHERE location_name = '$name' AND location_client_id = $client_id")) > 0){
|
||||
if(mysqli_num_rows(mysqli_query($mysqli,"SELECT 1 FROM locations WHERE location_name = '$name' AND location_client_id = $client_id")) > 0){
|
||||
$duplicate_detect = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ if (isset($_POST['add_project'])) {
|
||||
// If project template is selected add Ticket Templates and convert them to real tickets
|
||||
if($project_template_id) {
|
||||
// Get Associated Ticket Templates
|
||||
$sql_ticket_templates = mysqli_query($mysqli, "SELECT * FROM ticket_templates, project_template_ticket_templates
|
||||
$sql_ticket_templates = mysqli_query($mysqli, "SELECT ticket_template_details, project_template_ticket_templates.ticket_template_id,
|
||||
ticket_template_order, ticket_template_subject FROM ticket_templates, project_template_ticket_templates
|
||||
WHERE ticket_templates.ticket_template_id = project_template_ticket_templates.ticket_template_id
|
||||
AND project_template_ticket_templates.project_template_id = $project_template_id");
|
||||
$ticket_template_count = mysqli_num_rows($sql_ticket_templates);
|
||||
|
||||
@@ -211,7 +211,7 @@ if (isset($_POST['add_rack_unit'])) {
|
||||
}
|
||||
|
||||
// Check if the unit range is already occupied
|
||||
$check_sql = mysqli_query($mysqli, "SELECT * FROM rack_units WHERE unit_rack_id = $rack_id AND unit_start_number <= $unit_end AND unit_end_number >= $unit_start");
|
||||
$check_sql = mysqli_query($mysqli, "SELECT 1 FROM rack_units WHERE unit_rack_id = $rack_id AND unit_start_number <= $unit_end AND unit_end_number >= $unit_start");
|
||||
|
||||
if (mysqli_num_rows($check_sql) > 0) {
|
||||
// If there is an overlap, return an error message;
|
||||
|
||||
@@ -436,7 +436,8 @@ if (isset($_GET['force_recurring'])) {
|
||||
$new_invoice_id = mysqli_insert_id($mysqli);
|
||||
|
||||
//Copy Items from original invoice to new invoice
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM recurring_invoice_items WHERE item_recurring_invoice_id = $recurring_invoice_id ORDER BY item_id ASC");
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT item_description, item_id, item_name, item_order, item_price, item_quantity, item_subtotal,
|
||||
item_tax_id FROM recurring_invoice_items WHERE item_recurring_invoice_id = $recurring_invoice_id ORDER BY item_id ASC");
|
||||
|
||||
while($row = mysqli_fetch_assoc($sql_invoice_items)) {
|
||||
$item_id = intval($row['item_id']);
|
||||
|
||||
@@ -84,7 +84,10 @@ if (isset($_GET['project_id'])) {
|
||||
$page_title = $row['project_name'];
|
||||
|
||||
// Get Tickets
|
||||
$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets
|
||||
$sql_tickets = mysqli_query($mysqli, "SELECT client_id, client_name, ticket_assigned_to, ticket_billable, ticket_closed_at,
|
||||
ticket_created_at, ticket_id, ticket_number, ticket_prefix, ticket_priority,
|
||||
ticket_project_id, ticket_status, ticket_status_color, ticket_status_name, ticket_subject,
|
||||
ticket_updated_at, user_name FROM tickets
|
||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
LEFT JOIN clients ON ticket_client_id = client_id
|
||||
LEFT JOIN users ON ticket_assigned_to = user_id
|
||||
@@ -94,11 +97,11 @@ if (isset($_GET['project_id'])) {
|
||||
$ticket_count = mysqli_num_rows($sql_tickets);
|
||||
|
||||
// Get Closed Ticket Count
|
||||
$sql_closed_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_project_id = $project_id AND ticket_closed_at IS NOT NULL");
|
||||
$sql_closed_tickets = mysqli_query($mysqli, "SELECT 1 FROM tickets WHERE ticket_project_id = $project_id AND ticket_closed_at IS NOT NULL");
|
||||
$closed_ticket_count = mysqli_num_rows($sql_closed_tickets);
|
||||
|
||||
// Get Resolved Ticket Count
|
||||
$sql_resolved_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_project_id = $project_id AND ticket_resolved_at IS NOT NULL");
|
||||
$sql_resolved_tickets = mysqli_query($mysqli, "SELECT 1 FROM tickets WHERE ticket_project_id = $project_id AND ticket_resolved_at IS NOT NULL");
|
||||
|
||||
$resolved_ticket_count = mysqli_num_rows($sql_resolved_tickets);
|
||||
|
||||
@@ -123,7 +126,7 @@ if (isset($_GET['project_id'])) {
|
||||
|
||||
// Get Completed Task Count
|
||||
$sql_tasks_completed = mysqli_query($mysqli,
|
||||
"SELECT * FROM tickets, tasks
|
||||
"SELECT 1 FROM tickets, tasks
|
||||
WHERE ticket_id = task_ticket_id
|
||||
AND ticket_project_id = $project_id
|
||||
AND task_completed_at IS NOT NULL"
|
||||
|
||||
@@ -31,7 +31,9 @@ if (isset($_GET['status']) && $_GET['status'] == 1) {
|
||||
|
||||
$sql_projects = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM projects
|
||||
"SELECT SQL_CALC_FOUND_ROWS client_id, client_name, project_archived_at, project_completed_at, project_created_at,
|
||||
project_description, project_due, project_id, project_name, project_number, project_prefix,
|
||||
project_updated_at, user_id, user_name FROM projects
|
||||
LEFT JOIN clients ON client_id = project_client_id
|
||||
LEFT JOIN users ON user_id = project_manager
|
||||
WHERE DATE(project_created_at) BETWEEN '$dtf' AND '$dtt'
|
||||
|
||||
@@ -29,7 +29,13 @@ if (isset($_GET['status']) && $_GET['status'] == "inactive") {
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM recurring_invoices
|
||||
"SELECT SQL_CALC_FOUND_ROWS category_id, category_name, client_currency_code, client_id, client_name,
|
||||
recurring_invoice_amount, recurring_invoice_created_at, recurring_invoice_currency_code,
|
||||
recurring_invoice_discount_amount, recurring_invoice_frequency, recurring_invoice_id,
|
||||
recurring_invoice_last_sent, recurring_invoice_next_date, recurring_invoice_number,
|
||||
recurring_invoice_prefix, recurring_invoice_scope, recurring_invoice_status,
|
||||
recurring_payment_id, recurring_payment_recurring_invoice_id,
|
||||
recurring_payment_saved_payment_id FROM recurring_invoices
|
||||
LEFT JOIN clients ON recurring_invoice_client_id = client_id
|
||||
LEFT JOIN categories ON recurring_invoice_category_id = category_id
|
||||
LEFT JOIN recurring_payments ON recurring_payment_recurring_invoice_id = recurring_invoice_id
|
||||
|
||||
@@ -17,9 +17,9 @@ $sql_all_years = mysqli_query($mysqli, "SELECT YEAR(expense_date) AS all_years F
|
||||
ORDER BY all_years DESC"
|
||||
);
|
||||
|
||||
$sql_categories_income = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' ORDER BY category_name ASC");
|
||||
$sql_categories_income = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' ORDER BY category_name ASC");
|
||||
|
||||
$sql_categories_expense = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Expense' ORDER BY category_name ASC");
|
||||
$sql_categories_expense = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Expense' ORDER BY category_name ASC");
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -63,7 +63,9 @@ if (!$client_url) {
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM software
|
||||
"SELECT SQL_CALC_FOUND_ROWS client_id, client_name, software_created_at, software_description, software_expire,
|
||||
software_id, software_license_type, software_name, software_seats, software_type,
|
||||
software_version, vendor_id, vendor_name FROM software
|
||||
LEFT JOIN clients ON client_id = software_client_id
|
||||
LEFT JOIN vendors ON vendor_id = software_vendor_id
|
||||
WHERE (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%' OR client_name LIKE '%$q%')
|
||||
|
||||
Reference in New Issue
Block a user