Suvodip 2025-03-03 14:30:57 +05:30
parent 11187345d5
commit d0ba11be1c
8 changed files with 103 additions and 6 deletions

View File

@ -15,6 +15,9 @@
<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>
<li class="nav-item">
<a class="nav-link" href="/contact-us">Contact</a>
</li>

0
admin/.hta_slug/_404.php Normal file
View File

View File

@ -0,0 +1 @@
sample route home

60
admin/.hta_slug/stat.php Normal file
View File

@ -0,0 +1,60 @@
<?php
require('../.hta_config/conf.php');
try {
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$currentMonth = date('Y-m');
$stmt = $db->prepare(" SELECT e.customerId, c.name, e.emiAmount, e.emiDate, e.payStatus, e.outstanding FROM emi e JOIN customers c ON e.customerId = c.customerId WHERE DATE_FORMAT(e.emiDate, '%Y-%m') = :currentMonth ORDER BY e.emiDate ASC");
$stmt->bindParam(':currentMonth', $currentMonth);
$stmt->execute();
$emiPlans = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Calculate total demand amount
$totalDemand = array_sum(array_column($emiPlans, 'emiAmount'));
} catch (PDOException $e) {
die("Database error: " . $e->getMessage());
}
?>
<div class="container mt-5">
<h2 class="mb-4">Pending EMIs for <?php echo date('F Y'); ?></h2>
<table class="table table-bordered table-striped table-hover">
<thead class="bg-primary text-white text-center">
<tr>
<th>Customer Name</th>
<th>EMI Amount</th>
<th>EMI Date</th>
<th>Pay Status</th>
<th>Outstanding</th>
</tr>
</thead>
<tbody>
<?php if (!empty($emiPlans)) : ?>
<?php foreach ($emiPlans as $emi) : ?>
<tr>
<td><?php echo htmlspecialchars($emi['name']); ?></td>
<td><?php echo number_format($emi['emiAmount'], 2); ?></td>
<td><?php echo date('d M Y', strtotime($emi['emiDate'])); ?></td>
<td>
<?php if ($emi['payStatus'] == 0) : ?>
<span class="badge bg-danger">Pending</span>
<?php else : ?>
<span class="badge bg-success">Paid</span>
<?php endif; ?>
</td>
<td><?php echo number_format($emi['outstanding'], 2); ?></td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="5" class="text-center">No pending EMIs this month</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<div class="mt-3">
<h4>Total Demand EMI Amount: <?php echo number_format($totalDemand, 2); ?></h4>
</div>
</div>

8
admin/.htaccess Normal file
View File

@ -0,0 +1,8 @@
RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php

18
admin/index.php Normal file
View File

@ -0,0 +1,18 @@
<?php
require('../.hta_slug/_header.php');
require('../.hta_slug/_nav.php');
require_once('../.hta_config/var.php');
$url = explode('/', $_SERVER['REQUEST_URI']);
if (strpos($url[1], "?") !== false) {
$url2 = explode('?', $url[1]);
$slug=$url2[0];
} else $slug=$url[2];
require_once('../.hta_slug/_header.php');
if($slug=="") require_once('.hta_slug/_home.php');
elseif(file_exists(".hta_slug/".$slug.".php")) include ".hta_slug/".$slug.".php";
else require_once('.hta_slug/_404.php');
require_once('../.hta_slug/_footer.php');

1
admin/sample-page.php Normal file
View File

@ -0,0 +1 @@
sample-page

View File

@ -16,7 +16,8 @@
$invoiceId = $_POST['invoiceId'];
$customerName = $_POST['customerName'];
$customerAddress = $_POST['customerAddress'];
$marketingAgent = $_POST['marketingAgent'];
$marketingAgents = $_POST['marketingAgent'];
$marketingAgentList = implode(", ", $marketingAgents);
$item = $_POST['item'];
$description = $_POST['description'];
$quantity = $_POST['quantity'];
@ -64,7 +65,7 @@
$stmt2->bindParam(':invoiceDate', $bookingDate);
$stmt2->bindParam(':paymentMode', $paymentMode);
$stmt2->bindParam(':salesAgent', $salesAgent);
$stmt2->bindParam(':marketingAgent', $marketingAgent);
$stmt2->bindParam(':marketingAgent', $marketingAgentList);
$stmt2->bindParam(':tenure', $tenure);
$stmt2->bindParam(':item', $item);
$stmt2->bindParam(':description', $description);
@ -174,8 +175,13 @@
</div>
<div class="mb-3">
<label for="marketingAgent" class="form-label">Marketing Agent:</label>
<select name="marketingAgent" class="form-control"required>
<option value="">-Select-</option>
<select name="marketingAgent[]" class="form-control"required multiple>
<option value="Prabhat Mishra">Prabhat Mishra</option>
<option value="Suvojit Mishra">Suvojit Mishra</option>
<option value="Prabhat Mishra">Prabhat Mishra</option>
<option value="Suvojit Mishra">Suvojit Mishra</option>
<option value="Prabhat Mishra">Prabhat Mishra</option>
<option value="Suvojit Mishra">Suvojit Mishra</option>
<option value="Prabhat Mishra">Prabhat Mishra</option>
<option value="Suvojit Mishra">Suvojit Mishra</option>
</select>
@ -215,10 +221,10 @@
<tbody>
<tr>
<td>
<textarea class="form-control w-100" name="item" id="item" rows="3"></textarea>
<input type="text" class="form-control w-100" name="item" id="item" rows="3" />
</td>
<td>
<textarea class="form-control w-100" name="description" id="description" rows="3"></textarea>
<input type="text" class="form-control w-100" name="description" id="description" rows="3" />
</td>
<td>
<input class="form-control w-100" name="quantity" id="quantity" />