function DisplayTable() { $username = $_SESSION["username"]; $idnum = $_SESSION["idnum"]; $conn = new mysqli($_SESSION["servername"], $_SESSION["Dusername"], $_SESSION["Dpassword"], $_SESSION["dbname"]); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT * FROM numbers WHERE AssignedUser='******' AND Response='CB' ORDER BY CBDate;"; $result = mysqli_query($conn, $sql); echo "<form action='updatecallback.php' method='post'>"; echo "<input type='submit' value='Edit'>"; echo "<table border='6' style='width:100%' class='sortable'>"; if (mysqli_num_rows($result) > 0) { echo "<tr>"; echo "<td>X</td>"; echorow("First Name"); echorow("Last Name"); echorow("Phone#"); echorow("Address"); echorow("Zone"); echorow("CB Date"); echorow("CB time"); echorow("Transfered"); echorow("Notes1"); echorow("Notes2"); echo "</tr>"; RowTicker("start"); while ($row = $result->fetch_assoc()) { RowTicker("next"); $idkey = $row["IDNKey"]; echo "<td><input type='radio' name='rad' value='{$idkey}'></td>"; $nsql = "SELECT * FROM notes WHERE IDNKey='{$idkey}' AND AgentID='{$idnum}'"; $nresult = mysqli_query($conn, $nsql); $nrow = $nresult->fetch_assoc(); $text = $nrow["Text"]; $nrow = $nresult->fetch_assoc(); $text2 = $nrow["Text"]; echorow($row["Fname"]); echorow($row["Lname"]); echorow($row["Pnumber"]); echorow($row["Address"]); echorow($row["Zone"]); echorow($row["CBDate"]); echorow($row["CBTime"]); echorow($row["OriginalCaller"]); echorow($text); echorow($text2); echo "</tr>"; } $_SESSION["IDNKey"] = $row["MIN(IDNKey)"]; } echo "</table>"; echo "<input type='submit' value='Edit'>"; echo "</form>"; }
} $sql = "SELECT items.IDKey,items.Description,items.ModelNum,items.BooneKey,categories.Symbol as Csym,units.Symbol AS Usym FROM items INNER JOIN categories ON items.CatID=categories.IDKey INNER JOIN units ON items.UnitID=units.IDKey;"; $result = mysqli_query($conn, $sql); echo "<form action='updatecallback.php' method='post'>"; echo "<table border='6' style='width:100%' class='sortable'>"; echo "<tr>"; echo "<td>X</td>"; echorow("Description"); echorow("ModelNum"); echorow("Boone ID"); echorow("Category"); echorow("Unit"); echo "</tr>"; RowTicker("start"); while ($row = $result->fetch_assoc()) { RowTicker("next"); $id = $row["IDKey"]; echo "<td><input type='radio' name='rad' value='{$id}'></td>"; echorow($row["Description"]); echorow($row["ModelNum"]); echorow($row["BooneKey"]); echorow($row["Csym"]); echorow($row["Usym"]); echo "</tr>"; } echo "</table>"; echo "<input type='submit' value='Edit'>"; echo "</form>"; function echorow($p) { echo "<td>{$p}</td>";
function DisplayTable($sid) { $conn = new mysqli($_SESSION["servername"], $_SESSION["Dusername"], $_SESSION["Dpassword"], $_SESSION["dbname"]); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $bsql = "SELECT * FROM bookings WHERE SalesmanID='{$sid}'"; $bresult = mysqli_query($conn, $bsql); echo "<table border='6' style='width:100%' class='sortable'>"; echo "<tr>"; echo "<td>X</td>"; echo "<td title='Phone Number'>Pnumber</td>"; echo "<td title='Customer First Name'>First Name</td>"; echo "<td title='Customer Last Name'>Last Name</td>"; echo "<td title='Customer Address'>Address</td>"; echo "<td title='Date of the appointment'>Booking Date</td>"; echo "<td title='Time of the Appointment'>Appointment Time</td>"; echo "<td title='Age of the current A/C'>AC Age</td>"; echo "<td title='Age of the current Furnace'>F Age</td>"; echo "<td title='Whether this is a Furnace call'>F</td>"; echo "<td title='Whether this is a A/C call'>A/C</td>"; echo "<td title='Whether this is a Hot Water Tank call'>T</td>"; echo "<td title='Whether this is a Boiler call'>B</td>"; echo "<td title='Customers Cellphone Number'>CellNumber</td>"; echo "<td title='Booking Agents Name'>First Contact</td>"; echo "</tr>"; RowTicker("start"); while ($brow = $bresult->fetch_assoc()) { RowTicker("next"); $appID = $brow["AppointmentID"]; $idkey = $brow["IDKey"]; $idnkey = $brow["IDNKey"]; $ff = $brow["Fflag"]; $af = $brow["Aflag"]; $bf = $brow["Bflag"]; $tf = $brow["Tflag"]; $sql = "SELECT Fname,Lname,Address,Pnumber,Zone,FAge,ACAge,CellNumber,AssignedUser FROM numbers WHERE IDNKey='{$idnkey}';"; $res2 = mysqli_query($conn, $sql); $row2 = $res2->fetch_assoc(); $asql = "SELECT Date,Start,End FROM shifts WHERE IDKey='{$appID}';"; $ares = mysqli_query($conn, $asql); $arow = $ares->fetch_assoc(); $appdata = $arow["Date"] . ":" . $arow["Start"] . "-" . $arow["End"]; $address = $row2["Address"]; echo "<td><input type='radio' name='rad' value='{$idkey}'></td>"; $address = "<a href='https://maps.google.com?saddr=Current+Location&daddr={$address}'>{$address}</a>"; echorow($row2["Pnumber"]); echorow($row2["Fname"]); echorow($row2["Lname"]); echorow($address); echorow($brow["DateofBooking"]); echorow($appdata); echorow($row2["ACAge"]); echorow($row2["FAge"]); echocheck($ff); echocheck($af); echocheck($tf); echocheck($bf); echorow($row2["CellNumber"]); $id = $row2["AssignedUser"]; $tsql = "SELECT FName,LName FROM agents WHERE IDKey='{$id}'"; $res = mysqli_query($conn, $tsql); $trow = $res->fetch_assoc(); echorow($trow["FName"] . $trow["LName"]); echo "</tr>"; } echo "</table>"; }