function form_content() { global $FANNIE_OP_DB, $FANNIE_URL; $dbc = FannieDB::get($FANNIE_OP_DB); $depts = "<option value=\"\">Select one...</option>"; $prep = $dbc->prepare_statement("SELECT dept_no,dept_name from departments order by dept_name"); $res = $dbc->exec_statement($prep); while ($row = $dbc->fetch_row($res)) { $depts .= sprintf("<option value=%d>%s</option>", $row[0], $row[1]); } ob_start(); ?> <form action=ReprintReceiptPage.php method=get> <div class="container"> <div class="row form-group form-inline"> <label>Date*</label> <input type="text" name="date" class="form-control date-field" id="date" placeholder="Date" /> <input type="text" name="date2" class="form-control date-field" id="date2" placeholder="2nd Date (optional)" /> <label>Receipt #</label> <input type="text" name="trans_num" class="form-control" /> </div> <div class="row form-group form-inline"> <label>Member #</label> <input type="text" name="card_no" class="form-control" /> <label>Cashier #</label> <input type="text" name="emp_no" class="form-control" /> <label>Lane #</label> <input type="text" name="register_no" class="form-control" /> </div> <div class="row form-group form-inline"> <label> Refund <input type="checkbox" class="checkbox-inline" name="is_refund" value="1" /> </label> <label> Mem Discount <input type="checkbox" class="checkbox-inline" name="mem_discount" value="1" /> </label> <label> Exclude Canceled <input type="checkbox" class="checkbox-inline" name="no-canceled" value="1" checked /> </label> <label> Exclude Training <input type="checkbox" class="checkbox-inline" name="no-training" value="1" checked /> </label> </div> <div class="row form-group form-inline"> <label>Tender Type</label> <select name="trans_subtype" class="form-control"> <option value="">Select one...</option> <?php $numsQ = $dbc->prepare_statement("SELECT TenderCode,TenderName FROM tenders \n ORDER BY TenderName"); $numsR = $dbc->exec_statement($numsQ); while ($numsW = $dbc->fetch_row($numsR)) { printf("<option value=%s>%s</option>", $numsW[0], $numsW[1]); } ?> </select> <label>Tender Amount</label> <div class="input-group"> <span class="input-group-addon">$</span> <input type="text" name="tenderTotal" class="form-control" /> </div> </div> <div class="row form-group form-inline"> <label>Department</label> <select name="department" class="form-control"> <?php echo $depts; ?> </select> <button type="submit" name="submit" value="1" class="btn btn-default">Find Receipts</button> </div> </div> <div class="well"> <b>Tips</b>:<br /> <ul> <li>If no date is given, all matching receipts from the past 15 days will be returned</li> <li>A date and a receipt number is sufficient to find any receipt</li> <li>If you have a receipt number, you don't need to specify a lane or cashier number</li> <li>ALL fields are optional. You can specify a tender type without an amount (or vice versa)</li> </ul> </div> </form> <?php if (FormLib::get('json') !== '') { $init = FormLib::fieldJSONtoJavascript(base64_decode(FormLib::get('json'))); $this->addOnloadCommand($init); } return ob_get_clean(); }
/** Check for input and display the page */ function drawPage() { if (!$this->config instanceof FannieConfig) { $this->config = FannieConfig::factory(); } if (!$this->checkAuth() && $this->must_authenticate) { $this->loginRedirect(); } elseif ($this->preprocess()) { /** Use FanniePage::drawPage for the plain old html version of the page */ if ($this->content_function == 'form_content') { if (FormLib::get('json') !== '') { $this->addOnloadCommand(FormLib::fieldJSONtoJavascript(base64_decode(FormLib::get('json')))); } return parent::drawPage(); } /** Global setting overrides default behavior to force the menu to appear. Unlike normal pages, the override is only applied when the output format is HTML. */ if (($this->config->get('WINDOW_DRESSING') || $this->new_tablesorter) && $this->report_format == 'html') { $this->window_dressing = true; } if ($this->window_dressing) { echo $this->getHeader(); } if ($this->readinessCheck() !== false) { $func = $this->content_function; echo $this->{$func}(); } else { echo $this->errorContent(); } if ($this->window_dressing) { $footer = $this->getFooter(); $footer = str_ireplace('</html>', '', $footer); $footer = str_ireplace('</body>', '', $footer); echo $footer; } if ($this->report_format == 'html') { foreach ($this->scripts as $s_url => $s_type) { printf('<script type="%s" src="%s"></script>', $s_type, $s_url); echo "\n"; } $js_content = $this->javascriptContent(); if (!empty($js_content) || !empty($this->onload_commands)) { echo '<script type="text/javascript">'; echo $js_content; echo "\n\$(document).ready(function(){\n"; foreach ($this->onload_commands as $oc) { if (strstr($oc, 'standardFieldMarkup()')) { continue; } echo $oc . "\n"; } echo "});\n"; echo '</script>'; } $page_css = $this->cssContent(); if (!empty($page_css)) { echo '<style type="text/css">'; echo $page_css; echo '</style>'; } echo array_reduce($this->css_files, function ($carry, $css_url) { return $carry . sprintf('<link rel="stylesheet" type="text/css" href="%s">' . "\n", $css_url); }, ''); } if ($this->window_dressing || $this->report_format == 'html') { echo '</body></html>'; } } // drawPage() }