Dont show Template or Client Vendors under Vendor Select in Expenses Filter

This commit is contained in:
johnnyq 2024-06-03 18:12:57 -04:00
parent 5b594813c4
commit 9f73b13dcf
2 changed files with 29 additions and 1 deletions

View File

@ -136,7 +136,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<option value="" <?php if ($vendor == "") { echo "selected"; } ?>>- All Vendors -</option>
<?php
$sql_vendors_filter = mysqli_query($mysqli, "SELECT * FROM vendors ORDER BY vendor_name ASC");
$sql_vendors_filter = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id = 0 AND vendor_template = 0 ORDER BY vendor_name ASC");
while ($row = mysqli_fetch_array($sql_vendors_filter)) {
$vendor_id = intval($row['vendor_id']);
$vendor_name = nullable_htmlentities($row['vendor_name']);

View File

@ -6,6 +6,14 @@ $order = "DESC";
require_once "inc_all.php";
// Account Filter
if (isset($_GET['account']) & !empty($_GET['account'])) {
$account_query = 'AND (payment_account_id = ' . intval($_GET['account']) . ')';
$account = intval($_GET['account']);
} else {
// Default - any
$account_query = '';
}
//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
@ -73,6 +81,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<input onchange="this.form.submit()" type="date" class="form-control" name="dtt" max="2999-12-31" value="<?php echo nullable_htmlentities($dtt); ?>">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>Account</label>
<select class="form-control select2" name="account" onchange="this.form.submit()">
<option value="" <?php if ($account == "") { echo "selected"; } ?>>- All Accounts -</option>
<?php
$sql_accounts_filter = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
while ($row = mysqli_fetch_array($sql_accounts_filter)) {
$account_id = intval($row['account_id']);
$account_name = nullable_htmlentities($row['account_name']);
?>
<option <?php if ($account == $account_id) { echo "selected"; } ?> value="<?php echo $account_id; ?>"><?php echo $account_name; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
</div>
</form>