s11
This commit is contained in:
86
customers/.hta_slug/additional-payment.php
Normal file
86
customers/.hta_slug/additional-payment.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<!-- additional-payment -->
|
||||
|
||||
<?php
|
||||
require('../.hta_config/conf.php');
|
||||
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] === 'POST'){
|
||||
|
||||
try{
|
||||
$stmt3 = $db->prepare("INSERT INTO emi (customerId, invoiceId, adPaymentAmount, adPaymentDate, adPaymentSource, adPaymentTran, adPaymentRemarks, payStatus) VALUES (:customerId, :invoiceId, :adPaymentAmount, :adPaymentDate, :adPaymentSource, :adPaymentTran, :adPaymentRemarks, 1)");
|
||||
$stmt3->bindParam(':customerId', $_GET['customerId']);
|
||||
$stmt3->bindParam(':invoiceId', $_GET['invoiceId']);
|
||||
$stmt3->bindParam(':adPaymentAmount', $_POST['adPaymentAmount']);
|
||||
$stmt3->bindParam(':adPaymentDate', $_POST['adPaymentDate']);
|
||||
$stmt3->bindParam(':adPaymentSource', $_POST['adPaymentSource']);
|
||||
$stmt3->bindParam(':adPaymentTran', $_POST['adPaymentTran']);
|
||||
$stmt3->bindParam(':adPaymentRemarks', $_POST['adPaymentRemarks']);
|
||||
if($stmt3->execute()){
|
||||
echo '<div class="alert alert-success">Additional Payment <strong>' . htmlspecialchars($_POST['adPaymentAmount']) . '</strong> Paid Successfully.</div>';
|
||||
}else{
|
||||
echo '<div class="alert alert-danger">Additional Payment <strong>' . htmlspecialchars($_POST['adPaymentAmount']) . '</strong> Payment Faild.</div>';
|
||||
}
|
||||
} catch(PDOException $e){
|
||||
echo '<div class="alert alert-danger">Error: ' . $e->getMessage() . '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
try {
|
||||
$stmt = $db->prepare("SELECT * FROM invoice WHERE customerId = :customerId");
|
||||
$stmt->bindParam(':customerId', $_GET['customerId']);
|
||||
$stmt->execute();
|
||||
$invoiceData = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$stmt2 = $db->prepare("SELECT * FROM emi WHERE customerId = :customerId");
|
||||
$stmt2->bindParam(':customerId', $_GET['customerId']);
|
||||
$stmt2->execute();
|
||||
$emiData = $stmt2->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// var_dump($emiData);
|
||||
} catch (PDOException $e) {
|
||||
echo '<div class="alert alert-danger">Error: ' . $e->getMessage() . '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<div class="card shadow-lg">
|
||||
<div class="card-header bg-primary text-white text-center">
|
||||
<h4>Additional Payment</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST">
|
||||
<div class="form-group">
|
||||
<label for="name">Full Name:</label>
|
||||
<input type="text" id="name" name="name" class="form-control" value="<?= htmlspecialchars($invoiceData['customerName']); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="adPaymentAmount">Payment Amount:</label>
|
||||
<input type="text" id="adPaymentAmount" name="adPaymentAmount" class="form-control" value="<?= $emiData['emiAmount']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="adPaymentDate">Payment Date:</label>
|
||||
<input type="date" id="adPaymentDate" name="adPaymentDate" class="form-control" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="adPaymentTran">Transaction ID:</label>
|
||||
<input type="text" id="adPaymentTran" name="adPaymentTran" class="form-control" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="adPaymentSource">Payment Source:</label>
|
||||
<input type="text" id="adPaymentSource" name="adPaymentSource" class="form-control" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="adPaymentRemarks">Remarks:</label>
|
||||
<input type="text" id="adPaymentRemarks" name="adPaymentRemarks" class="form-control" >
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success btn-block mt-2">Save Payment</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- adPaymentAmount, adPaymentDate, adPaymentSource, adPaymentTran, adPaymentRemarks -->
|
||||
Reference in New Issue
Block a user