| Server IP : 3.111.61.48 / Your IP : 216.73.216.67 Web Server : Apache System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.2.31 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/vhost/itms.arukustech.com/public/ |
Upload File : |
<?php
require_once __DIR__ . '/../app/db.php';
require_once __DIR__ . '/../app/helpers/auth.php';
auth();
$pdo = db();
/* Assigned Items */
$assigned = $pdo->query("
SELECT a.id, a.remarks, a.assigned_on,
i.item_name, i.serial_no, i.brand, i.model,
u.name AS user_name, u.email
FROM inventory_assignments a
JOIN inventory_items i ON a.item_id = i.id
JOIN users u ON a.user_id = u.id
WHERE a.unassigned_on IS NULL
ORDER BY a.assigned_on DESC
")->fetchAll(PDO::FETCH_ASSOC);
/* Unassigned Items (available only) */
$unassigned = $pdo->query("
SELECT i.*, c.name AS category_name
FROM inventory_items i
LEFT JOIN inv_categories c ON c.id = i.category_id
WHERE i.status = 'available'
ORDER BY i.id DESC
")->fetchAll(PDO::FETCH_ASSOC);
include __DIR__ . '/header.php';
?>
<style>
.table thead th {
background:#1e293b !important;
color:white !important;
}
</style>
<div class="main-content-inner px-4 py-3">
<h3>Assigned / Unassigned Inventory Report</h3>
<h4 class="mt-4">Assigned Items</h4>
<table id="assignedTable" class="table table-bordered table-striped mt-3">
<thead>
<tr>
<th>SR#</th> <th>Item</th>
<th>Serial</th>
<th>User</th>
<th>Remarks</th>
<th>Assigned On</th>
</tr>
</thead>
<tbody>
<?php
$sr1 = 1; // Counter for first table
foreach ($assigned as $a):
?>
<tr>
<td><?= $sr1++ ?></td> <td><?= htmlspecialchars($a['item_name']) ?></td>
<td><?= htmlspecialchars($a['serial_no']) ?></td>
<td><?= htmlspecialchars($a['user_name']) ?> (<?= $a['email'] ?>)</td>
<td><?= htmlspecialchars($a['remarks']) ?></td>
<td><?= $a['assigned_on'] ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<hr class="my-5">
<h4 class="mt-4">Unassigned (Available) Items</h4>
<table id="unassignedTable" class="table table-bordered table-striped mt-3">
<thead>
<tr>
<th>SR#</th> <th>Category</th>
<th>Item</th>
<th>Brand</th>
<th>Model</th>
<th>Serial</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
$sr2 = 1; // Counter for second table
foreach ($unassigned as $u):
?>
<tr>
<td><?= $sr2++ ?></td> <td><?= htmlspecialchars($u['category_name']) ?></td>
<td><?= htmlspecialchars($u['item_name']) ?></td>
<td><?= htmlspecialchars($u['brand']) ?></td>
<td><?= htmlspecialchars($u['model']) ?></td>
<td><?= htmlspecialchars($u['serial_no']) ?></td>
<td><span class="badge bg-success">Available</span></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<script>
$(document).ready(function () {
$('#assignedTable').DataTable({
dom: 'Bfrtip',
"ordering": false, // Keep sequential SR# as generated by PHP
buttons: [
{ extend: 'excel', className: 'btn btn-success btn-sm' },
{ extend: 'pdf', className: 'btn btn-danger btn-sm' },
{ extend: 'print', className: 'btn btn-info btn-sm' }
]
});
$('#unassignedTable').DataTable({
dom: 'Bfrtip',
"ordering": false, // Keep sequential SR# as generated by PHP
buttons: [
{ extend: 'excel', className: 'btn btn-success btn-sm' },
{ extend: 'pdf', className: 'btn btn-danger btn-sm' },
{ extend: 'print', className: 'btn btn-info btn-sm' }
]
});
});
</script>
<?php include __DIR__ . '/footer.php'; ?>