Converted add payment to a dropdown under invoice to allow for the standard manaual add payment and to pay with a saved card or by entering a card manully

This commit is contained in:
johnnyq 2025-07-14 17:36:03 -04:00
parent da3a1d2ce4
commit 46c4a62046
4 changed files with 51 additions and 14 deletions

View File

@ -132,7 +132,7 @@ ob_start();
<option value="">- Method of Payment -</option>
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM payment_methods WHERE payment_method_provider_id = 0 ORDER BY payment_method_name ASC");
$sql = mysqli_query($mysqli, "SELECT * FROM payment_methods ORDER BY payment_method_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$payment_method_name = nullable_htmlentities($row['payment_method_name']);
?>

13
includes/inc_xcustom.php Normal file
View File

@ -0,0 +1,13 @@
<?php
require_once "../config.php";
require_once "../functions.php";
require_once "check_login.php";
require_once "page_title.php";
require_once "header.php";
require_once "top_nav.php";
require_once "get_side_nav_counts.php";
require_once "side_nav.php";
require_once "inc_wrapper.php";
require_once "inc_alert_feedback.php";
require_once "filter_header.php";

View File

@ -163,6 +163,15 @@ if (isset($_GET['invoice_id'])) {
$json_products = json_encode($products);
}
// Saved Payment Methods
$sql_saved_payment_methods = mysqli_query($mysqli, "
SELECT * 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
AND payment_provider_active = 1;
");
// Payment with saved card (auto-pay)
if ($config_stripe_enable) {
$stripe_client_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM client_stripe WHERE client_id = $client_id LIMIT 1"));
@ -225,13 +234,28 @@ if (isset($_GET['invoice_id'])) {
<?php } ?>
<?php if ($invoice_status !== 'Paid' && $invoice_status !== 'Cancelled' && $invoice_status !== 'Draft' && $invoice_status !== 'Non-Billable' && $invoice_amount != 0) { ?>
<a class="btn btn-success" href="#"
data-toggle = "ajax-modal"
data-ajax-url = "ajax/ajax_invoice_pay.php"
data-ajax-id = "<?php echo $invoice_id; ?>"
>
<i class="fa fa-fw fa-credit-card mr-2"></i>Add Payment
</a>
<div class="btn-group">
<button type="button" class="btn btn-success" data-toggle="ajax-modal" data-ajax-url="ajax/ajax_invoice_pay.php" data-ajax-id="<?php echo $invoice_id; ?>"><i class="fa fa-fw fa-credit-card mr-2"></i>Add Payment</button>
<button type="button" class="btn btn-success dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
<div class="dropdown-menu">
<a class="dropdown-item" href="guest/guest_pay_invoice_stripe.php?invoice_id=<?php echo "$invoice_id&url_key=$invoice_url_key"; ?>">Enter Card Manually</a>
<?php
if (mysqli_num_rows($sql_saved_payment_methods) > 0) { ?>
<h6 class="dropdown-header text-left">Pay with a Saved Card</h6>
<?php
while ($row = mysqli_fetch_array($sql_saved_payment_methods)) {
$saved_payment_id = intval($row['saved_payment_id']);
$saved_payment_description = nullable_htmlentities($row['saved_payment_description']);
$payment_provider_name = nullable_htmlentities($row['payment_provider_name']);
?>
<a class="dropdown-item confirm-link" href="post.php?add_payment_by_provider=<?php echo $saved_payment_provider_id; ?>&invoice_id=<?php echo $invoice_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token']; ?>"><?php echo "$payment_provider_name | $saved_payment_description"; ?></a>
<?php }
} ?>
</div>
</div>
<?php if ($invoice_status !== 'Partial' && $config_stripe_enable && $stripe_id && $stripe_pm) { ?>
<a class="btn btn-primary confirm-link" href="post.php?add_payment_stripe&invoice_id=<?php echo $invoice_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token']; ?>">
<i class="fa fa-fw fa-credit-card mr-2"></i>Pay via Payment Provider

View File

@ -199,12 +199,12 @@ $sql_categories_filter = mysqli_query(
</div>
</div>
</div>
<div class="col-sm-1"></div>
<div class="col-sm-3">
<div class="form-group">
<div class="input-group mb-3 mb-sm-0">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-layer-group"></i></span>
<span class="input-group-text bg-light"><i class="fas fa-layer-group"></i></span>
</div>
<select class="form-control select2" name="category" onchange="this.form.submit()">
<option value="">- All Categories -</option>
@ -224,7 +224,7 @@ $sql_categories_filter = mysqli_query(
</div>
</div>
</div>
<div class="col-sm-4">
<div class="col-sm-5">
<div class="btn-group float-right">
<div class="btn-group">
<button class="btn btn-outline-dark dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown">
@ -372,7 +372,7 @@ $sql_categories_filter = mysqli_query(
<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="col-md-3">
<div class="form-group">
<label>Ticket Status</label>
<select onchange="this.form.submit()" class="form-control select2" name="status[]" data-placeholder="Select Status" multiple>
@ -388,7 +388,7 @@ $sql_categories_filter = mysqli_query(
</select>
</div>
</div>
<div class="col-md-2">
<div class="col-md-3">
<div class="form-group">
<label>Assigned to</label>
<select onchange="this.form.submit()" class="form-control select2" name="assigned">