Settings page finished, filter gui improved

This commit is contained in:
2026-07-07 11:23:16 +02:00
parent 42df35f1a0
commit 2177834b39
12 changed files with 241 additions and 51 deletions
+21 -8
View File
@@ -185,7 +185,7 @@ form_view_buttons($g_scriptname, $id);
// Inventory in box
// WIP
$sql = "SELECT invid, invname, weight FROM inventory WHERE conttype='box' AND boxid=?";
$sql = "SELECT invid, invname, weight, number FROM inventory WHERE conttype='box' AND boxid=?";
$sth = $pdo->prepare($sql);
$sth->execute([$id]);
$res = $sth->fetchAll();
@@ -195,21 +195,34 @@ $weight_total = 0.0;
if ($res) {
echo '<table class="table table-striped">', "\n";
echo "<thead>\n";
echo "<tr>";
echo '<tr>';
echo '<th>#</th>';
echo '<th>', _('Inventory'), "</th>";
echo '<th>', _('Number'), "</th>";
echo '<th>', _('Weight'), "</th>";
echo "<td></td>";
echo "</thead>\n";
echo "</tr>\n";
$i = 1;
foreach ($res as $row) {
echo "<tr>\n";
echo "<td>", $row['invname'], "</td>\n";
echo "<td>", format_float($row['weight'], 2, 'kg'), "</td>\n";
form_action_buttons('inventory.php', $row['invid']);
echo '<td>', $i++, ' ';
echo '<a class="text-nowrap" title="', _('View'), '" href="inventory.php?f=view&id=', $row['invid'], '"><i class="bi bi-eye ms-2"></i></a>';
echo "</td>\n";
echo '<td>', $row['invname'], "</td>\n";
echo '<td>', $row['number'], "</td>\n";
echo '<td>';
$weight_item = $row['weight'] * $row['number'];
if ($weight_item > 0) {
$weight_total += $weight_item;
echo format_float($weight_item, 2, 'kg');
} else {
echo '-';
}
echo "</td>\n";
echo "</tr>\n";
$weight_total += $row['weight'];
}
echo "<tfoot>";
echo '<tr><td></td><td>', format_float($weight_total, 2, 'kg'), '</td>', "\n";
echo '<tr><td colspan="3"></td><td>', format_float($weight_total, 2, 'kg'), '</td>', "\n";
echo "</tfoot>\n";
echo "</table>\n";
} else {