mirror of https://github.com/itflow-org/itflow
Added Payment Method and Account Dropdown Filters to Payments
This commit is contained in:
parent
1070449450
commit
c2b7d03c22
|
|
@ -13,6 +13,7 @@ if (isset($_GET['user']) & !empty($_GET['user'])) {
|
|||
} else {
|
||||
// Default - any
|
||||
$user_query = '';
|
||||
$user = '';
|
||||
}
|
||||
|
||||
// Log Type Filter
|
||||
|
|
@ -22,6 +23,7 @@ if (isset($_GET['type']) & !empty($_GET['type'])) {
|
|||
} else {
|
||||
// Default - any
|
||||
$log_type_query = '';
|
||||
$type = '';
|
||||
}
|
||||
|
||||
// Log Action Filter
|
||||
|
|
@ -31,6 +33,7 @@ if (isset($_GET['action']) & !empty($_GET['action'])) {
|
|||
} else {
|
||||
// Default - any
|
||||
$log_action_query = '';
|
||||
$action = '';
|
||||
}
|
||||
|
||||
//Rebuild URL
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ if (isset($_GET['industry']) & !empty($_GET['industry'])) {
|
|||
} else {
|
||||
// Default - any
|
||||
$industry_query = '';
|
||||
$industry = '';
|
||||
}
|
||||
|
||||
// Referral Filter
|
||||
|
|
@ -52,6 +53,7 @@ if (isset($_GET['referral']) & !empty($_GET['referral'])) {
|
|||
} else {
|
||||
// Default - any
|
||||
$referral_query = '';
|
||||
$referral = '';
|
||||
}
|
||||
|
||||
//Rebuild URL
|
||||
|
|
|
|||
72
payments.php
72
payments.php
|
|
@ -6,6 +6,17 @@ $order = "DESC";
|
|||
|
||||
require_once "inc_all.php";
|
||||
|
||||
|
||||
// Payment Method Filter
|
||||
if (isset($_GET['method']) & !empty($_GET['method'])) {
|
||||
$payment_method_query = "AND (payment_method = '" . sanitizeInput($_GET['method']) . "')";
|
||||
$method = nullable_htmlentities($_GET['method']);
|
||||
} else {
|
||||
// Default - any
|
||||
$payment_method_query = '';
|
||||
$method = '';
|
||||
}
|
||||
|
||||
// Account Filter
|
||||
if (isset($_GET['account']) & !empty($_GET['account'])) {
|
||||
$account_query = 'AND (payment_account_id = ' . intval($_GET['account']) . ')';
|
||||
|
|
@ -13,6 +24,7 @@ if (isset($_GET['account']) & !empty($_GET['account'])) {
|
|||
} else {
|
||||
// Default - any
|
||||
$account_query = '';
|
||||
$account = '';
|
||||
}
|
||||
|
||||
//Rebuild URL
|
||||
|
|
@ -26,6 +38,8 @@ $sql = mysqli_query(
|
|||
LEFT JOIN accounts ON payment_account_id = account_id
|
||||
WHERE DATE(payment_date) BETWEEN '$dtf' AND '$dtt'
|
||||
AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR client_name LIKE '%$q%' OR account_name LIKE '%$q%' OR payment_method LIKE '%$q%' OR payment_reference LIKE '%$q%')
|
||||
$account_query
|
||||
$payment_method_query
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
|
|
@ -50,6 +64,44 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<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 class="col-sm-2">
|
||||
<div class="form-group">
|
||||
<select class="form-control select2" name="method" onchange="this.form.submit()">
|
||||
<option value="" <?php if ($method == "") { echo "selected"; } ?>>- All Payment Methods -</option>
|
||||
|
||||
<?php
|
||||
$sql_payment_methods_filter = mysqli_query($mysqli, "SELECT DISTINCT payment_method FROM payments ORDER BY payment_method ASC");
|
||||
while ($row = mysqli_fetch_array($sql_payment_methods_filter)) {
|
||||
$payment_method = nullable_htmlentities($row['payment_method']);
|
||||
?>
|
||||
<option <?php if ($method == $payment_method) { echo "selected"; } ?>><?php echo $payment_method; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse mt-3 <?php if (!empty($_GET['dtf']) || $_GET['canned_date'] !== "custom" ) { echo "show"; } ?>" id="advancedFilter">
|
||||
<div class="row">
|
||||
|
|
@ -81,26 +133,6 @@ $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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue