Rename original distfiles to distfiles-old
This commit is contained in:
237
distfiles-old/maintform.php
Normal file
237
distfiles-old/maintform.php
Normal file
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
/*
|
||||
maintform.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
if (isset($_SESSION['login'])) $techid = $_SESSION['login'];
|
||||
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
$histdays = $_REQUEST['histdays'] ?? NULL;
|
||||
$submit = $_REQUEST['submit'] ?? NULL;
|
||||
|
||||
$logname = LOG_NAME;
|
||||
$uidtext = UID_TEXT;
|
||||
|
||||
if ($histdays == "") $histdays = 30;
|
||||
|
||||
if ($print) {
|
||||
$sbcolor = P_SIDEBAR_COLOR;
|
||||
$mbgcolor = P_MENUBG_COLOR;
|
||||
} else {
|
||||
$sbcolor = SIDEBAR_COLOR;
|
||||
$mbgcolor = MENUBG_COLOR;
|
||||
}
|
||||
|
||||
// define pendtable function
|
||||
function pendtable($tech_id, $db)
|
||||
{
|
||||
$uidtext = UID_TEXT;
|
||||
// print section header
|
||||
if ($tech_id) {
|
||||
echo "
|
||||
<b><font size=\"+1\">Your Pending Maintenance Forms</font></b><br>
|
||||
";
|
||||
$pmf = mysqli_query($db, "select * from maintforms where mftech=\"$tech_id\" and pending=\"1\" order by mfdate desc, mftime desc");
|
||||
} else {
|
||||
echo "
|
||||
<b><font size=\"+1\">All Pending Maintenance Forms</font></b><br>
|
||||
";
|
||||
$pmf = mysqli_query($db, "select * from maintforms where pending=\"1\" order by mfdate desc, mftime desc");
|
||||
}
|
||||
echo "
|
||||
<br><table border=\"1\" width=\"100%\">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Date</th>
|
||||
";
|
||||
if (!$tech_id) echo "<th>Tech</th>";
|
||||
echo "
|
||||
<th>$uidtext</th>
|
||||
<th>Part Number</th>
|
||||
<th>Serial Number</th>
|
||||
<th>Part Name</th>
|
||||
<th>Logbook<br>Note ID</th>
|
||||
</tr>
|
||||
";
|
||||
while ($pendrow = mysqli_fetch_assoc($pmf)) {
|
||||
// look up part data
|
||||
$uid = dblookup($db, "parts", "partid", "uid", $pendrow["mfpart"]);
|
||||
if ($uid == "") $uid = " ";
|
||||
$partno = dblookup($db, "parts", "partid", "partnum", $pendrow["mfpart"]);
|
||||
if ($partno == "") $partno = " ";
|
||||
$serno = dblookup($db, "parts", "partid", "sernum", $pendrow["mfpart"]);
|
||||
if ($serno == "") $serno = " ";
|
||||
$partname = dblookup($db, "parts", "partid", "partname", $pendrow["mfpart"]);
|
||||
if ($partname == "") $partname = " ";
|
||||
// look up tech name
|
||||
$tname = dblookup($db, "techs", "techid", "techname", $pendrow["mftech"]);
|
||||
if ($pendrow["lognoteid"] == 0) {
|
||||
$noteidval = " ";
|
||||
$notetag = "%s%s";
|
||||
} else {
|
||||
$noteidval = $pendrow["lognoteid"];
|
||||
$notetag = "<a href=\"logentry.php?edit=1¬eid=%s\">%s</a>";
|
||||
}
|
||||
if (!$tech_id) {
|
||||
printf(
|
||||
"<tr>
|
||||
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">$notetag</td>
|
||||
</tr>",
|
||||
$pendrow["maintformid"],
|
||||
$pendrow["maintformid"],
|
||||
$pendrow["mfdate"],
|
||||
$tname,
|
||||
$uid,
|
||||
$partno,
|
||||
$serno,
|
||||
$partname,
|
||||
$noteidval,
|
||||
$noteidval
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
"<tr>
|
||||
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">$notetag</td>
|
||||
</tr>",
|
||||
$pendrow["maintformid"],
|
||||
$pendrow["maintformid"],
|
||||
$pendrow["mfdate"],
|
||||
$uid,
|
||||
$partno,
|
||||
$serno,
|
||||
$partname,
|
||||
$noteidval,
|
||||
$noteidval
|
||||
);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</table>
|
||||
";
|
||||
}
|
||||
|
||||
// define histtable function
|
||||
function histtable($hist_days, $db)
|
||||
{
|
||||
$uidtext = UID_TEXT;
|
||||
$dayopts = array(30, 90, 180, 365);
|
||||
// print section header
|
||||
echo "
|
||||
<form method=\"post\" action=\"maintform.php\">
|
||||
<b><font size=\"+1\">All Maintenance Forms From the Past </font></b>
|
||||
<select name=\"histdays\">
|
||||
";
|
||||
foreach ($dayopts as $chunk) {
|
||||
if ($chunk == $hist_days) {
|
||||
echo "<option value=\"$chunk\" selected>$chunk</option>";
|
||||
} else {
|
||||
echo "<option value=\"$chunk\">$chunk</option>";
|
||||
}
|
||||
}
|
||||
$histqry = mysqli_query($db, "select * from maintforms where mfdate > subdate(now(), interval $hist_days day) order by mfdate desc, mftime desc");
|
||||
echo "
|
||||
</select>
|
||||
<b><font size=\"+1\"> Days</font></b>
|
||||
<input type=\"submit\" name=\"submit\" value=\"Update List\"></form><br>
|
||||
<table border=\"1\" width=\"100%\">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Date</th>
|
||||
<th>Tech</th>
|
||||
<th>$uidtext</th>
|
||||
<th>Part Number</th>
|
||||
<th>Serial Number</th>
|
||||
<th>Part Name</th>
|
||||
<th>Logbook<br>Note ID</th>
|
||||
</tr>
|
||||
";
|
||||
while ($histrow = mysqli_fetch_assoc($histqry)) {
|
||||
// look up part data
|
||||
$uid = dblookup($db, "parts", "partid", "uid", $histrow["mfpart"]);
|
||||
$partno = dblookup($db, "parts", "partid", "partnum", $histrow["mfpart"]);
|
||||
if ($partno == "") $partno = " ";
|
||||
$serno = dblookup($db, "parts", "partid", "sernum", $histrow["mfpart"]);
|
||||
if ($serno == "") $serno = " ";
|
||||
$partname = dblookup($db, "parts", "partid", "partname", $histrow["mfpart"]);
|
||||
if ($partname == "") $partname = " ";
|
||||
// look up tech name
|
||||
$tname = dblookup($db, "techs", "techid", "techname", $histrow["mftech"]);
|
||||
if ($histrow["lognoteid"] == 0) {
|
||||
$noteidval = " ";
|
||||
$notetag = "%s%s";
|
||||
} else {
|
||||
$noteidval = $histrow["lognoteid"];
|
||||
$notetag = "<a href=\"logentry.php?edit=1¬eid=%s\">%s</a>";
|
||||
}
|
||||
printf(
|
||||
"<tr>
|
||||
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">$notetag</td>
|
||||
</tr>",
|
||||
$histrow["maintformid"],
|
||||
$histrow["maintformid"],
|
||||
$histrow["mfdate"],
|
||||
$tname,
|
||||
$uid,
|
||||
$partno,
|
||||
$serno,
|
||||
$partname,
|
||||
$noteidval,
|
||||
$noteidval
|
||||
);
|
||||
}
|
||||
echo "
|
||||
</table>
|
||||
";
|
||||
}
|
||||
|
||||
framework("begin", "$logname", "Maintenance Forms", $print);
|
||||
|
||||
pagetable("begin");
|
||||
if (!$print) {
|
||||
pageblock("left", "begin");
|
||||
sidemenu();
|
||||
pageblock("left", "end");
|
||||
}
|
||||
pageblock("right", "begin");
|
||||
banner($print);
|
||||
echo "<br>";
|
||||
$haspending = mysqli_num_rows(mysqli_query($db, "select maintformid from maintforms where mftech=\"$techid\" and pending=\"1\""));
|
||||
if ($haspending) {
|
||||
pendtable($techid, $db);
|
||||
echo "<br><hr><br>";
|
||||
}
|
||||
pendtable(0, $db);
|
||||
echo "<br><hr><br>";
|
||||
histtable($histdays, $db);
|
||||
echo "<br><br>";
|
||||
banner($print);
|
||||
pageblock("right", "end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
Reference in New Issue
Block a user