Feature - Accounting: Added option in account transfer to add selectable payments to transfer notes which is useful to keep track what checks were deposited in a bank transaction such as a deposit as most banks don't display each check in a deposit.

This commit is contained in:
johnnyq 2023-07-03 16:18:01 -04:00
parent cf494a2f4e
commit 457bc7d471
2 changed files with 56 additions and 17 deletions

View File

@ -12,22 +12,22 @@ $url_query_strings_sb = http_build_query(array_merge($_GET, array('sb' => $sb, '
$sql = mysqli_query(
$mysqli,
"
SELECT SQL_CALC_FOUND_ROWS clients.*, contacts.*, locations.*, GROUP_CONCAT(tags.tag_name) AS tag_names
FROM clients
LEFT JOIN contacts ON clients.primary_contact = contacts.contact_id AND contacts.contact_archived_at IS NULL
LEFT JOIN locations ON clients.primary_location = locations.location_id AND locations.location_archived_at IS NULL
LEFT JOIN client_tags ON client_tags.client_tag_client_id = clients.client_id
LEFT JOIN tags ON tags.tag_id = client_tags.client_tag_tag_id
WHERE (clients.client_name LIKE '%$q%' OR clients.client_type LIKE '%$q%' OR clients.client_referral LIKE '%$q%'
OR contacts.contact_email LIKE '%$q%' OR contacts.contact_name LIKE '%$q%' OR contacts.contact_phone LIKE '%$phone_query%'
OR contacts.contact_mobile LIKE '%$phone_query%' OR locations.location_address LIKE '%$q%'
OR locations.location_city LIKE '%$q%' OR locations.location_state LIKE '%$q%' OR locations.location_zip LIKE '%$q%'
OR tags.tag_name LIKE '%$q%' OR clients.client_tax_id_number LIKE '%$q%')
AND clients.client_archived_at IS NULL
AND DATE(clients.client_created_at) BETWEEN '$dtf' AND '$dtt'
GROUP BY clients.client_id
ORDER BY $sb $o
LIMIT $record_from, $record_to
SELECT SQL_CALC_FOUND_ROWS clients.*, contacts.*, locations.*, GROUP_CONCAT(tags.tag_name) AS tag_names
FROM clients
LEFT JOIN contacts ON clients.primary_contact = contacts.contact_id AND contacts.contact_archived_at IS NULL
LEFT JOIN locations ON clients.primary_location = locations.location_id AND locations.location_archived_at IS NULL
LEFT JOIN client_tags ON client_tags.client_tag_client_id = clients.client_id
LEFT JOIN tags ON tags.tag_id = client_tags.client_tag_tag_id
WHERE (clients.client_name LIKE '%$q%' OR clients.client_type LIKE '%$q%' OR clients.client_referral LIKE '%$q%'
OR contacts.contact_email LIKE '%$q%' OR contacts.contact_name LIKE '%$q%' OR contacts.contact_phone LIKE '%$phone_query%'
OR contacts.contact_mobile LIKE '%$phone_query%' OR locations.location_address LIKE '%$q%'
OR locations.location_city LIKE '%$q%' OR locations.location_state LIKE '%$q%' OR locations.location_zip LIKE '%$q%'
OR tags.tag_name LIKE '%$q%' OR clients.client_tax_id_number LIKE '%$q%')
AND clients.client_archived_at IS NULL
AND DATE(clients.client_created_at) BETWEEN '$dtf' AND '$dtt'
GROUP BY clients.client_id
ORDER BY $sb $o
LIMIT $record_from, $record_to
");
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));

View File

@ -111,7 +111,36 @@
</div>
<div class="form-group">
<textarea class="form-control" rows="5" name="notes" placeholder="Enter some notes"></textarea>
<textarea class="form-control" rows="5" name="notes" id="transferNotes" placeholder="Enter some notes"></textarea>
</div>
<div class="form-group">
<div class="input-group">
<select class="form-control" id="paymentSelect">
<option value="">Select a Payment to Add to Notes</option>
<?php
$sql = mysqli_query($mysqli, "SELECT client_name, payment_method, payment_reference, payment_amount FROM payments
LEFT JOIN invoices ON payment_invoice_id = invoice_id
LEFT JOIN clients ON invoice_client_id = client_id
ORDER BY payment_id DESC LIMIT 25
");
while ($row = mysqli_fetch_array($sql)) {
$client_name = nullable_htmlentities($row['client_name']);
$payment_method = nullable_htmlentities($row['payment_method']);
$payment_reference = nullable_htmlentities($row['payment_reference']);
$payment_amount = floatval($row['payment_amount']);
?>
<option><?php echo "$client_name - $payment_method - $payment_reference - " . numfmt_format_currency($currency_format, $payment_amount, $session_company_currency); ?></option>
<?php } ?>
</select>
<div class="input-group-append">
<button type="button" class="btn btn-secondary" onclick="addOptionToTextbox()"><i class="fas fa-fw fa-plus"></i></button>
</div>
</div>
</div>
</div>
@ -124,3 +153,13 @@
</div>
</div>
</div>
<script>
function addOptionToTextbox() {
var selectElement = document.getElementById("paymentSelect");
var selectedOption = selectElement.options[selectElement.selectedIndex];
var textboxElement = document.getElementById("transferNotes");
textboxElement.value += selectedOption.value + "\n";
}
</script>