function cronlevel_toadd($data, $level) { $parent = $data['accounts_id']; $query = "SELECT cd.code_referrer as parent,act.accounts_id as child FROM tbl_accounts as act JOIN tbl_code as cd WHERE act.code_id=cd.code_value AND cd.code_referrer='{$parent}' AND act.accounts_id NOT IN(SELECT child FROM tbl_referdata WHERE parent='{$parent}') AND act.accounts_id!=cd.code_referrer"; if (countrows($query) > 0) { $rows = mysql_query($query); while ($row = mysql_fetch_assoc($rows)) { $parent_row = $row['parent']; $child_row = $row['child']; if ($parent_row != $child_row && countrows("SELECT id FROM tbl_referdata WHERE parent='{$parent_row}' AND child='{$child_row}'") == 0) { $sqlx = "INSERT INTO tbl_referdata SET parent='{$parent_row}',parent_main='{$parent_row}',child='{$child_row}',level='{$level}'"; echo "{$sqlx}<br>"; mysql_query("INSERT INTO tbl_referdata SET parent='{$parent_row}',parent_main='{$parent_row}',child='{$child_row}',level='{$level}'"); } } } return mysql_query($query); }
} } else { $_GET['sort'] = "1posted"; $sortby = "posted"; $order = "DESC"; } //offset and paging calculations if (isset($_GET['nr'])) { $currsite = $_GET['nr']; $offset = $currsite * $settings['showpostings'] - $settings['showpostings']; } else { $offset = 0; $currsite = 1; } $numbsite = round(countrows("lb_postings") / $settings['showpostings']); if ($numbsite < countrows("lb_postings") / $settings['showpostings']) { $numbsite += 1; } $pagingstring = ""; if ($numbsite > 1) { $pagingstring = "<span class=\"pages\">Pages :"; for ($i = 1; $i <= $numbsite; $i++) { if ($i == $currsite) { $pagingstring .= "<span class=\"active\">" . $i . "</span> \n"; } else { $pagingstring .= "<a href=\"index.php" . addToUrl("nr", $i) . "\">" . $i . "</a> \n"; } } $pagingstring = $pagingstring . "</span>"; } echo "<h1>" . bla("hl_postings") . " " . $pagingstring . "</h1>\n";
$sqlstring .= "details = '{$details}', "; $sqlstring .= "remarks = '{$remarks}', "; $sqlstring .= "effective = '{$effective}' "; $sqlstring .= "WHERE id = '{$master_id}'"; $rows = query($sqlstring); $sqlstring = "SELECT * FROM equip_types WHERE equip_type = ?"; $rows = query($sqlstring, $_POST["equip_type"]); $row = $rows[0]; $equip_id = $row["id"]; $masterlink = "/edit_wins.php?master_id=" . $master_id . "&equip_id=" . $equip_id; redirect_to($masterlink); } else { $rows = query("SELECT * FROM maint_master WHERE id= ?", $_GET["id"]); $row = $rows[0]; $checks = query("SELECT * FROM work_ins WHERE master_id= ?", $_GET["id"]); $checkresult = countrows("SELECT * FROM work_ins WHERE master_id= ?", $_GET["id"]); $countresult = 0; foreach ($checks as $check) { if ($check["equip_subtype"] === "") { $countresult++; } } $checkflag = 0; if ($countresult === $checkresult) { $checkflag = 1; } $equiptypes = query("SELECT * FROM equip_types"); require "../templates/header.php"; ?> <div style="width:600px; margin:0 auto;">
require "../includes/constants.php"; confirm_logged(); // if form was submitted if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["description"])) { apologize("You must provide a description for the equipment type."); } $description = $_POST["description"]; $editid = $_POST["id"]; $subdescription = $_POST["subdescription"]; $subid = $_POST["subid"]; $sqlstring = "UPDATE equip_types SET "; $sqlstring .= "description = '{$description}' "; $sqlstring .= "WHERE id = '{$editid}' "; $rows = query($sqlstring); $subtypes_count = countrows("SELECT * FROM equip_subtypes WHERE parent_id = ?", $editid); for ($i = 0; $i < $subtypes_count; $i++) { $sqlstring = "UPDATE equip_subtypes SET "; $sqlstring .= "description = '{$subdescription[$i]}'"; $sqlstring .= "WHERE id = '{$subid[$i]}' "; $rows = query($sqlstring); } redirect_to("/"); } else { $rows = query("SELECT * FROM equip_types WHERE id= ?", $_GET["id"]); $subtypes = query("SELECT * FROM equip_subtypes WHERE parent_id = ?", $_GET["id"]); if (count($rows) == 1) { // first (and only) row $row = $rows[0]; // render header require "../templates/header.php";
$i = 0; foreach ($_POST['workins'] as $workins) { if ($workins['instruction'] !== "") { $sqlstring = "INSERT INTO `work_ins`(`equip_subtype`, `instruction`,`master_id`,`section`,`freq`) "; $sqlstring .= "VALUES(?,?,?,?,?)"; $rows = query($sqlstring, $workins['equip_subtype'], $workins['instruction'], $workins['master_id'], $i, $workins['freq']); $i++; } } redirect_to("/"); } else { $sqlstring = "SELECT * FROM equip_subtypes WHERE parent_id = ?"; $rows = query($sqlstring, $_GET["equip_id"]); $sqlstring = "SELECT * FROM work_ins WHERE master_id = ?"; $subtypes = query($sqlstring, $_GET["master_id"]); $countwins = countrows($sqlstring, $_GET["master_id"]); require "../templates/header.php"; ?> <div style="width:800px; margin:0 auto;"> <form action="edit_wins.php?master_id=<?php echo $_GET["master_id"]; ?> " method="post" role="form" class="form-inline"> <fieldset> <table align="center"> <thead> <tr> <td>Equip subtype</td>
require_once "../includes/validation_functions.php"; require "../includes/constants.php"; confirm_logged(); // if form was submitted if ($_SERVER["REQUEST_METHOD"] == "POST") { $ser_code = $_POST["ser_code"]; $tag_id = $_POST["tag_id"]; $sqlstring = "UPDATE serials SET tag_id = NULL "; $sqlstring .= "WHERE tag_id = '{$tag_id}'"; $rows = query($sqlstring); $sqlstring = "UPDATE serials SET tag_id = '{$tag_id}' "; $sqlstring .= "WHERE ser_code = '{$ser_code}'"; $rows = query($sqlstring); redirect_to("/"); } else { $rowcount = countrows("SELECT ser_code FROM serials WHERE tag_id = ?", $_GET["id"]); if ($rowcount !== 0) { $serials = query("SELECT ser_code FROM serials WHERE tag_id = ?", $_GET["id"]); $serial = $serials[0]; $currentserial = $serial['ser_code']; } else { $currentserial = ""; } $serials = query("SELECT ser_code FROM serials WHERE tag_id IS NULL"); // render header require "../templates/header.php"; ?> <div style="width:800px; margin:0 auto;"> <form action="switch_serial.php" method="post" role="form"> <fieldset>
$owner = $_POST["owner"]; $closedate = $_POST["closedate"]; $comment = $_POST["comment"]; $sqlstring = "UPDATE service_call SET "; $sqlstring .= "opened = '{$opened}', "; $sqlstring .= "whours = '{$whours}', "; $sqlstring .= "owner = '{$owner}', "; $sqlstring .= "closedate = '{$closedate}', "; $sqlstring .= "comment = '{$comment}' "; $sqlstring .= "WHERE id = '{$editid}' "; $rows = query($sqlstring); redirect_to("service.php"); } else { $rows = query("SELECT * FROM service_call WHERE id= ?", $_GET["id"]); $wins = query("SELECT * FROM service_wins WHERE service_id = ?", $_GET["id"]); $winscount = countrows("SELECT * FROM service_wins WHERE service_id = ?", $_GET["id"]); if (count($rows) == 1) { // first (and only) row $row = $rows[0]; // render header require "../templates/header.php"; ?> <div style="width:800px; overflow:auto; margin:0 auto; "> <form action="edit_scall.php" method="post" role="form"> <fieldset> <input type="hidden" name="id" value="<?php echo $row["id"]; ?> "/> <div class="form-group">