Example #1
0
require_once "db.inc.php";
require_once "facilities.inc.php";
$subheader = __("Data Center Stockroom Supplies");
if (!$person->SiteAdmin) {
    // No soup for you.
    header('Location: ' . redirect());
    exit;
}
$sup = new Supplies();
$bc = new BinContents();
$inventory = array();
if (isset($_REQUEST["supplyid"]) && $_REQUEST["supplyid"] > 0) {
    $sup->SupplyID = $_REQUEST["supplyid"];
    $sup->GetSupplies();
    $bc->SupplyID = $sup->SupplyID;
    $inventory = $bc->FindSupplies();
}
$status = "";
if (isset($_POST["action"]) && ($_POST["action"] == "Create" || $_POST["action"] == "Update")) {
    $sup->SupplyID = $_REQUEST["supplyid"];
    $sup->PartNum = $_REQUEST["partnum"];
    $sup->PartName = $_REQUEST["partname"];
    $sup->MinQty = $_REQUEST["minqty"];
    $sup->MaxQty = $_REQUEST["maxqty"];
    if ($_REQUEST["action"] == "Create") {
        if ($sup->PartNum != null && $sup->PartNum != "") {
            $sup->CreateSupplies();
        }
    } else {
        $status = "Updated";
        $sup->UpdateSupplies();
<table class="items" width="100%" style="font-size: 9pt; border-collapse: collapse;" cellpadding="8">
<thead>
<tr>
<td width="20%">' . __("Part Number") . '</td>
<td width="50%">' . __("Part Name") . '</td>
<td width="10%">' . __("Min Qty") . '</td>
<td width="10%">' . __("Max Qty") . '</td>
<td width="10%">' . __("On Hand") . '</td>
</tr>
</thead>
<tbody>
<!-- ITEMS HERE -->';
foreach ($SupplyList as $Supply) {
    $html .= sprintf('<tr><td align="center">%s</td><td>%s</td><td align="right">%d</td><td align="right">%d</td><td align="right">%d</td></tr>\\n', $Supply->PartNum, $Supply->PartName, $Supply->MinQty, $Supply->MaxQty, Supplies::GetSupplyCount($Supply->SupplyID));
    $bc->SupplyID = $Supply->SupplyID;
    $binList = $bc->FindSupplies();
    foreach ($binList as $sb) {
        $bin->BinID = $sb->BinID;
        $bin->GetBin();
        $html .= sprintf('<tr><td>&nbsp;</td><td>%s: %s</td><td>&nbsp;</td><td>&nbsp;</td><td align="right">%d</td></tr>\\n', __("Location"), $bin->Location, $sb->Count);
    }
}
$html .= '<!-- END ITEMS HERE -->
<tr>
<td class="bottom" colspan=5>&nbsp;</td>
</tbody>
</table>
</body>
</html>
';
$mpdf->WriteHTML($html);