allow and disallow multiple payment

main
Subhodip Ghosh 2025-09-27 07:25:55 +00:00
parent ab034aeb72
commit 5e6bbd14ff
2 changed files with 39 additions and 2 deletions

View File

@ -83,6 +83,26 @@
}
}
if (isset($_POST['allowMultiple_submit']) && !empty($_POST['allowMultiple_acno'])) {
$acno = $_POST['allowMultiple_acno'];
$action = $_POST['allowMultiple_action']; // will be 1 or 0
$sql = "UPDATE `{$GLOBALS['arif_ac']}` SET allowMultiple = ? WHERE AA_ACNO = ?";
$stmt = $conn->prepare($sql);
if ($stmt->bind_param("is", $action, $acno) && $stmt->execute()) {
if ($action == 1) {
echo "<div class='alert alert-success'>Multiple payments <strong>allowed</strong> for A/C {$acno}.</div>";
} else {
echo "<div class='alert alert-info'>Multiple payments <strong>disallowed</strong> for A/C {$acno}.</div>";
}
} else {
echo "<div class='alert alert-danger'>Failed to update multiple payment setting for A/C {$acno}.</div>";
}
$stmt->close();
}
// Get agent list for dropdown
$getAgentListsQuery = "SELECT * FROM " . $GLOBALS['arif_users'] . "";
$agentResult = $conn->query($getAgentListsQuery);
@ -199,7 +219,19 @@
<input type='hidden' name='maturity_action' value='".($isMatured ? 'unmature' : 'mature')."'>
<button type='submit' name='recurring_maturity_submit' class='btn " . ($isMatured ? 'btn-warning' : 'btn-info') . "'>" . ($isMatured ? 'Mark as Active' : 'Mark as Matured') . "</button>
" . ($isMatured ? "<br/><span>Matured on: " . date('d-m-Y', strtotime($row["CLOSING_DATE"])) . "</span>" : "") . "
</form>
</form>";
if (isset($_SESSION['type']) && $_SESSION['type'] === 'admin') {
echo "
<form method='post' style='display:inline;'>
<input type='hidden' name='allowMultiple_acno' value='" . $row['AA_ACNO'] . "'>
<input type='hidden' name='allowMultiple_action' value='" . ($row["allowMultiple"] == 0 ? 1 : 0) . "'>
<button type='submit' name='allowMultiple_submit'
class='btn " . ($row["allowMultiple"] == 0 ? 'btn-warning' : 'btn-primary') . "'>
" . ($row["allowMultiple"] == 0 ? 'Allow Multiple' : 'Disallow Multiple') . "
</button>
</form>";
}
echo "
</td>
</tr>
<tr>

View File

@ -29,7 +29,7 @@ if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
<input class="btn btn-primary" type="submit" value="Receive Now" style="margin-top: 20px;" />
</form>
</div>
<!-- GVW20250722L1718 -->
<script>
function showMessage(msg, type = "success") {
let box = document.getElementById("userMessage");
@ -67,6 +67,11 @@ if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
document.getElementById("PAYMENT_RECEIVE_FORM").style.display = "block";
document.getElementById("ACCOUNT_NUMBER").value = data.data[0].AA_ACNO;
document.getElementById("ACCOUNT_HOLDER_NAME").value = data.data[0].AA_NAME;
const input = document.getElementById("INSTALLMENT_AMOUNT");
input && Number(data.data[0].allowMultiple) === 0 ? input.readOnly = true : input.readOnly = false;
document.getElementById("INSTALLMENT_AMOUNT").value = data.data[0].AA_INSTALLMENT;
showMessage("Account found: " + data.data[0].AA_NAME, "success");