<input type="submit" class="tab_add_button" value="+"> </div> <table class="table_view" id="table" border="1px" > <tr class="option_bar"> <th colspan="2" id="button_th"> <button class="button_flat" id="add_item_button">Add</button> <div class="divider"></div> <button id="delete_item" class="button_flat">Delete</button> </th> <th colspan="2" id="th_sales"> <div class="none" id="div_quantity_sales"> Quantity for sales ($) <form action="edit_items.php" method="post" class="inline middle"> <input type="number" name="base_sales" value="<?php echo VariablesTable::get_base_sales(); ?> " onchange="this.form.submit()" class="align_center"> </form> </div> </th> <th> <input class="search_bar" id="search_bar" type="search" placeholder="search" oninput=searchBar(this)> </th> </tr> <tr class="tr_confirm"> <td class="td_checkbox"><input type="checkbox" class="item_checkbox" id="select_all"></td> <td id="td_cancel">Cancel <td id="td_done">Done</th> </tr> <tr>
$current_category = null; while ($row = $result->fetch_assoc()) { if ($row["category_name"] != $current_category and $row["category_name"] != null) { $current_category = $row["category_name"]; echo '<tbody class="print_tbody" id="print_tbody"> <tr id="category"><td colspan="5" class="table_heading"><h4 class="none">' . $row["category_name"] . '</h4></td></tr> <tr id="category_columns"> <th>Item</th> <th>Unit</th> <th>Quantity Present</th> <th>Quantity Required</th> <th>Notes</th> </tr>'; } echo '<tr id="column_data" class="row">'; $sales_factor = VariablesTable::get_expected_sales() / VariablesTable::get_base_sales(); $quantity = is_numeric($row["quantity"]) ? BaseQuantityTable::get_estimated_quantity($sales_factor, $row["item_name"]) - $row["quantity"] : "-"; if ($quantity != "-") { $quantity = eval("return " . str_replace('x', $quantity, $row["factor"]) . ";"); if ($row["rounding_option"] == "up") { $quantity = ceil($quantity / $row["rounding_factor"]) * $row["rounding_factor"]; } else { if ($row["rounding_option"] == "down") { $quantity = floor($quantity / $row["rounding_factor"]) * $row["rounding_factor"]; } } } echo ' <td>' . $row["item_name"] . '</td> <td>' . $row["unit"] . '</td> <td>' . $row["quantity"] . '</td> <td class="quantity_required">' . ($quantity == '-0' ? abs($quantity) : $quantity) . '</td>
<div class="divider"></div> <div class="toolbar_div"> <label class="switch float_left" id="toolbar_toggle"> <input class="switch-input" type="checkbox" onclick=checkRequired() /> <span class="switch-label" data-on="Required" data-off="All"></span> <span class="switch-handle"></span> </label> </div> <div class="divider"></div> <?php if ($_SESSION["userrole"] == "admin") { ?> <div class="toolbar_div"> <form action="print_preview.php" method="post"> <span >Expected Sales ($):</span> <input class="print_expected" type="number" name="expected_sales" value="<?php echo VariablesTable::get_expected_sales(); ?> " onchange="this.form.submit()"> </form> </div> <div class="divider"></div> <?php } ?> <div class="toolbar_div"> <a id="print_share" class="option" onclick=sendPrint()>Share</a> </div> <div class="divider"></div> <div class="toolbar_div"> <a id="print_pdf" class="option" onclick=printPdf()>PDF</a> </div>