s11
parent
ce1dace3fb
commit
a6522f589d
|
@ -1,7 +1,7 @@
|
|||
<div class="container mt-4">
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quibusdam mollitia quidem sint dolores nostrum, similique nulla consequuntur. Animi neque labore praesentium ratione a? Facere, quasi ea reprehenderit eum tempora voluptatum.
|
||||
<h2>Welcome: <?php echo $_SESSION['userName']; ?></h2>
|
||||
</div>
|
||||
<?php
|
||||
var_dump($_SESSION);
|
||||
// var_dump($_SESSION);
|
||||
// echo $_SESSION['userName'] . $_SESSION['userEmail'] . $_SESSION['userType'] . $_SESSION['isLogedin'];
|
||||
?>
|
|
@ -9,15 +9,28 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link active" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/customers/new">New Customer</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/customers/list">Customer List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin/stat">Stat</a>
|
||||
</li>
|
||||
<?php
|
||||
if(isset($_SESSION['isLogedin']) && $_SESSION['isLogedin'] === true){
|
||||
if(isset($_SESSION['userType']) && $_SESSION['userType'] === 'admin'){
|
||||
echo '
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/customers/new">New Customer</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/customers/list">Customer List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin/stat">Stat</a>
|
||||
</li>
|
||||
|
||||
';
|
||||
} elseif(isset($_SESSION['userType']) && $_SESSION['userType'] === 'user')
|
||||
echo '
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/my-account">My Account</a>
|
||||
</li>';
|
||||
}
|
||||
?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/contact-us">Contact</a>
|
||||
</li>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
echo $_SESSION['customerId'];
|
||||
try {
|
||||
// Connect to the database
|
||||
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
|
@ -61,7 +60,7 @@
|
|||
|
||||
<td>
|
||||
<a href="/my-account/emi-details/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn btn-primary btn-sm">EMI Details</a>
|
||||
<a href="/customers/print-invoice/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn btn-primary btn-sm">Print</a>
|
||||
<a href="/my-account/print-invoice/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn btn-primary btn-sm">Print</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
@ -76,7 +75,7 @@
|
|||
<td><?php echo htmlspecialchars($customer['email']); ?></td>
|
||||
<td colspan="3">No invoice available</td>
|
||||
<td>
|
||||
<a href="/customers/billing-details/?customerId=<?php echo $customer['customerId']; ?>" class="btn btn-primary btn-sm">EMI Details</a>
|
||||
<a href="/my-account/emi-details/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn btn-primary btn-sm">EMI Details</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
require('../.hta_config/conf.php');
|
||||
|
||||
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$stmt = $db->prepare("SELECT * FROM invoice WHERE customerId = :customerId AND invoiceId = :invoiceId");
|
||||
$stmt->bindParam(':customerId', $_GET['customerId']);
|
||||
$stmt->bindParam(':invoiceId', $_GET['invoiceId']);
|
||||
$stmt->execute();
|
||||
$invoiceInfo = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$emiPlans = [];
|
||||
if ($invoiceInfo['tenure'] > 1) {
|
||||
$stmt = $db->prepare("SELECT * FROM emi WHERE customerId = :customerId AND invoiceId = :invoiceId ORDER BY emiDate ASC");
|
||||
$stmt->bindParam(':customerId', $_GET['customerId']);
|
||||
$stmt->bindParam(':invoiceId', $_GET['invoiceId']);
|
||||
$stmt->execute();
|
||||
$emiPlans = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="container my-5">
|
||||
<div class="invoice-box">
|
||||
<h2 class="text-center text-blue">Invoice</h2><hr>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100">
|
||||
<h6>Invoice ID: <?= $invoiceInfo['invoiceId'] ?></h6>
|
||||
<h6>Customer: <?= $invoiceInfo['customerName'] ?></h6>
|
||||
<p style="width: 70%;"><strong>Address:</strong> <?= $invoiceInfo['address'] ?></p>
|
||||
</div>
|
||||
<div class="w-100 d-flex flex-column align-items-end">
|
||||
<h6>Invoice Date: <?= $invoiceInfo['invoiceDate'] ?></h6>
|
||||
<h6>Payment Mode: <?= $invoiceInfo['paymentMode'] ?></h6>
|
||||
<p><strong>Agent:</strong> <?= $invoiceInfo['salesAgent'] ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-bordered mt-3">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Item</th>
|
||||
<th>Description</th>
|
||||
<th>Qty</th>
|
||||
<th>Rate</th>
|
||||
<th>Tax(%)</th>
|
||||
<th>Tax</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><?= $invoiceInfo['item'] ?></td>
|
||||
<td><?= $invoiceInfo['description'] ?></td>
|
||||
<td><?= $invoiceInfo['qty'] ?></td>
|
||||
<td><?= $invoiceInfo['rate'] ?></td>
|
||||
<td><?= $invoiceInfo['tax'] ?>%</td>
|
||||
<td>₹<?= $invoiceInfo['taxAmount'] ?></td>
|
||||
<td>₹<?= number_format($invoiceInfo['totalAmount'], 2) ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- EMI Table (if tenure > 1) -->
|
||||
<?php if ($invoiceInfo['tenure'] > 1): ?>
|
||||
<h4 class="mt-4 text-blue">EMI Payment Plan</h4>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>EMI No.</th>
|
||||
<th>EMI Date</th>
|
||||
<th>EMI Amount</th>
|
||||
<th>Outstanding</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($emiPlans as $emi): ?>
|
||||
<tr>
|
||||
<td><?= $emi['emiNumber'] ?></td>
|
||||
<td><?= $emi['emiDate'] ?></td>
|
||||
<td>₹<?= number_format($emi['emiAmount'], 2) ?></td>
|
||||
<td>₹<?= number_format($emi['outstanding'], 2) ?></td>
|
||||
<td>
|
||||
<?= ($emi['payStatus'] == 1) ? '<span class="badge bg-success">Paid</span>' : '<span class="badge bg-danger">Pending</span>' ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
|
||||
<p class="text-muted mt-3"><strong>Admin Note:</strong> <?= $invoiceInfo['adminNote'] ?></p>
|
||||
|
||||
<!-- Print Button -->
|
||||
<button onclick="window.print()" class="btn btn-primary btn-print w-100">Print Invoice</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
body {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
.invoice-box {
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
padding: 30px;
|
||||
border: 1px solid #ddd;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.text-blue { color: #007bff; }
|
||||
.btn-print { margin-top: 20px; }
|
||||
|
||||
@media print {
|
||||
body * {
|
||||
visibility: hidden;
|
||||
}
|
||||
.invoice-box, .invoice-box * {
|
||||
visibility: visible;
|
||||
}
|
||||
.invoice-box {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.btn-print {
|
||||
display: none; /* Hide print button */
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue