This commit is contained in:
ns77@siliconpin.com
2025-08-23 12:29:35 +00:00
parent 3e9f90dbbe
commit 45a9baf3fa
2 changed files with 17 additions and 17 deletions

View File

@@ -12,7 +12,7 @@
</div>
<?php
// ---- শুধুমাত্র Admin হলে Agent dropdown দেখানো হবে ----
// ---- if Admin then Agent dropdown and filter with agent----
if($_SESSION['type'] === 'admin'){
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
@@ -84,11 +84,12 @@ function report_view($type, $dt) {
<thead class="table-light">
<tr>
<th>Transaction ID</th>
<th>Agent</th>
'.($_SESSION['type'] === 'admin' ? "<th>Agent</th>" : "").'
<th>Time</th>
<th>AC No</th>
<th>Name</th>
<th>Amount</th>
'.($_SESSION['type'] === 'admin' ? "<th>Remarks</th>" : "").'
</tr>
</thead>
<tbody>';
@@ -96,12 +97,12 @@ function report_view($type, $dt) {
// ----- base query -----
$sql = "SELECT * FROM `".$GLOBALS['arif_tran']."` INNER JOIN `".$GLOBALS['arif_ac']."` ON `".$GLOBALS['arif_tran']."`.`AT_ACID`=`".$GLOBALS['arif_ac']."`.`AA_ACNO` WHERE `AT_TIMESTAMP` BETWEEN '".$dateFrom." 00:00:00' AND '".$dateTo." 00:00:00'";
// ----- agent হলে নিজের report -----
// ----- individual agent report -----
if($_SESSION['type'] === 'agent') {
$sql .= " AND `AA_AGENT`='".$_SESSION['user_id']."'";
}
// ----- admin হলে filter option -----
// ----- if admin filter option -----
if($_SESSION['type'] === 'admin' && isset($_GET['agent']) && $_GET['agent']!="") {
$agentId = $conn->real_escape_string($_GET['agent']);
$sql .= " AND `AA_AGENT`='".$agentId."'";
@@ -113,14 +114,15 @@ function report_view($type, $dt) {
if ($result && $result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "
<tr>
<td>".$row["AT_ID"]."</td>
<td>".$row["AA_AGENT"]."</td>
<td>".$row["AT_TIMESTAMP"]."</td>
<td>".$row["AT_ACID"]."</td>
<td>".$row["AA_NAME"]."</td>
<td>".$row["AT_AMOUNT"]."</td>
</tr>";
<tr>
<td>".$row["AT_ID"]."</td>
".($_SESSION['type'] === 'admin' ? "<td>".$row["AA_AGENT"]."</td>" : "")."
<td>".$row["AT_TIMESTAMP"]."</td>
<td>".$row["AT_ACID"]."</td>
<td>".$row["AA_NAME"]."</td>
<td>".$row["AT_AMOUNT"]."</td>
".($_SESSION['type'] === 'admin' ? "<td style='font-size: 12px;'>".($row["REMARKS"] ?? '')."</td>" : "")."
</tr>";
$totalAmount += $row["AT_AMOUNT"];
$rowsData[] = [$row["AT_ID"], $row["AT_TIMESTAMP"], $row["AT_ACID"], $row["AA_NAME"], $row["AT_AMOUNT"]];
}