Пример #1
1
 function preprocess()
 {
     if (FormLib::get_form_value('start', False) !== False) {
         $pdf = new FPDF('P', 'in', 'Letter');
         $pdf->SetMargins(0.5, 0.5, 0.5);
         $pdf->SetAutoPageBreak(False, 0.5);
         $pdf->AddPage();
         $start = FormLib::get_form_value('start');
         $x = 0.5;
         $y = 0.5;
         $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
         $pdf->SetFont('Gill', '', 16);
         for ($i = 0; $i < 40; $i++) {
             $current = $start + $i;
             $pdf->SetXY($x, $y);
             $pdf->Cell(1.75, 0.5, $current, 0, 0, 'C');
             $pdf->Cell(1.75, 0.5, $current, 0, 0, 'C');
             if ($i % 2 == 0) {
                 $x += 1.75 * 2 + 0.5;
             } else {
                 $x = 0.5;
                 $y += 0.5;
             }
         }
         $pdf->Close();
         $pdf->Output("mem stickers {$start}.pdf", "I");
         return False;
     }
     return True;
 }
Пример #2
0
 public function preprocess()
 {
     $acct = FormLib::get('id');
     $this->header = 'Loan Schedule' . ' : ' . $acct;
     $this->title = 'Loan Schedule' . ' : ' . $acct;
     return parent::preprocess();
 }
Пример #3
0
 private function ajaxCallback()
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $m = FormLib::get('month', 1);
     $y = FormLib::get('year', date('Y'));
     if (!is_numeric($y)) {
         return "Error: Invalid year";
     } elseif (!is_numeric($m)) {
         return "Error: Invalid month";
     }
     $ret = "<form action=\"SalePerformanceReport.php\" method=\"get\">\n                <p>\n                <button type=submit class=\"btn btn-default\">Get Report</button>\n                </p>";
     $ret .= sprintf("<input type=hidden name=month value=%d />\n                <input type=hidden name=year value=%d />", $m, $y);
     $ret .= "<table class=\"table\">";
     $ret .= "<tr><th>&nbsp;</th><th>Batch</th><th>Start</th><th>End</th></tr>";
     $q = $dbc->prepare_statement("SELECT batchID,batchName,startDate,endDate FROM\n                                batches WHERE discounttype <> 0 AND (\n                                (year(startDate)=? and month(startDate)=?) OR\n                                (year(endDate)=? and month(endDate)=?)\n                                ) ORDER BY startDate,batchType,batchName");
     $r = $dbc->exec_statement($q, array($y, $m, $y, $m));
     while ($w = $dbc->fetch_row($r)) {
         list($start, $time) = explode(' ', $w[2], 2);
         list($end, $time) = explode(' ', $w[3], 2);
         $ret .= sprintf("<tr>\n                    <td><input type=checkbox name=ids[] value=%d id=\"batch-checkbox-%d\" /></td>\n                    <td><label for=\"batch-checkbox-%d\">%s</label></td>\n                    <td>%s</td><td>%s</td>\n                    <input type=hidden name=bnames[] value=\"%s\" /></tr>", $w['batchID'], $w['batchID'], $w['batchID'], $w['batchName'], $start, $end, $w['batchName'] . " (" . $start . " " . $end . ")");
     }
     $ret .= "</table>\n                <p>\n                <button type=submit class=\"btn btn-default\">Get Report</button>\n                </p>\n            </form>";
     return $ret;
 }
Пример #4
0
 function preprocess()
 {
     global $FANNIE_OP_DB;
     if (FormLib::get_form_value('deptStart', False) !== false) {
         $start = FormLib::get_form_value('deptStart');
         $end = FormLib::get_form_value('deptEnd');
         $pageID = FormLib::get_form_value('sID', 0);
         $dbc = FannieDB::get($FANNIE_OP_DB);
         $prodP = $dbc->prepare_statement("\n                SELECT p.upc\n                FROM products AS p\n                WHERE p.department BETWEEN ? AND ?\n            ");
         $prodR = $dbc->exec_statement($prodP, array($start, $end));
         $tag = new ShelftagsModel($dbc);
         $product = new ProductsModel($dbc);
         while ($row = $dbc->fetch_row($prodR)) {
             $product->upc($row['upc']);
             $info = $product->getTagData();
             $tag->id($pageID);
             $tag->upc($row['upc']);
             $tag->setData($info);
             $tag->save();
         }
         $this->msgs = sprintf('<em>Created tags for departments #%d through #%d</em>
                 <br /><a href="ShelfTagIndex.php">Home</a>', $start, $end);
     }
     return true;
 }
Пример #5
0
 function preprocess()
 {
     global $FANNIE_OP_DB;
     $this->title = _("Fannie") . ' : ' . _("Manufacturer Shelf Tags");
     $this->header = _("Manufacturer Shelf Tags");
     if (FormLib::get_form_value('manufacturer', False) !== false) {
         $manu = FormLib::get_form_value('manufacturer');
         $pageID = FormLib::get_form_value('sID', 0);
         $cond = "";
         if (is_numeric($_REQUEST['manufacturer'])) {
             $cond = " p.upc LIKE ? ";
         } else {
             $cond = " p.brand LIKE ? ";
         }
         $dbc = FannieDB::get($FANNIE_OP_DB);
         $prodP = $dbc->prepare_statement("\n                SELECT\n                    p.upc\n                FROM\n                    products AS p\n                WHERE {$cond}\n            ");
         $prodR = $dbc->exec_statement($prodP, array('%' . $manu . '%'));
         $tag = new ShelftagsModel($dbc);
         $product = new ProductsModel($dbc);
         while ($prodW = $dbc->fetch_row($prodR)) {
             $product->upc($prodW['upc']);
             $info = $product->getTagData();
             $tag->id($pageID);
             $tag->upc($prodW['upc']);
             $tag->setData($info);
             $tag->save();
         }
         $this->msgs = '<em>Created tags for manufacturer</em>
                 <br /><a href="ShelfTagIndex.php">Home</a>';
     }
     return true;
 }
Пример #6
0
 function saveFormData($memNum)
 {
     /* entry blank. do not save */
     $note = FormLib::get_form_value('Notes_text');
     if ($note == "") {
         return "";
     }
     /* entry has note changed. this means it's already
        in memberNotes as the most recent entry */
     $current = FormLib::get_form_value('Notes_current');
     if ($note == base64_decode($current)) {
         return "";
     }
     $dbc = $this->db();
     $insertNote = $dbc->prepare_statement("INSERT into memberNotes\n                (cardno, note, stamp, username)\n                VALUES (?, ?, " . $dbc->now() . ", 'Admin')");
     // convert newlines back to br tags
     // so displayed notes have user's
     // paragraph formatting
     $note = str_replace("\n", '<br />', $note);
     $test1 = $dbc->exec_statement($insertNote, array($memNum, $note));
     if ($test1 === False) {
         return "Error: problem saving Notes<br />";
     } else {
         return "";
     }
 }
Пример #7
0
 function preprocess()
 {
     global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
     $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
     $this->emp_no = FormLib::get_form_value('emp_no', 0);
     $this->periodID = FormLib::get_form_value('periodID', 0);
     if (!headers_sent() && ($this->emp_no == 0 || $this->periodID == 0 || $this->emp_no < 0)) {
         header('Location: TsAdminMain.php');
         return False;
     }
     if ($_GET['function'] == 'edit' && isset($_GET['submitted']) && isset($_GET['emp_no']) && isset($_GET['periodID']) && isset($_GET['id'])) {
         $oneP = $ts_db->prepare_statement("UPDATE timesheet\n                SET time_in=?, time_out=?, area=?\n                WHERE ID=?");
         $twoP = $ts_db->prepare_statement("UPDATE timesheet\n                SET time_in=?\n                WHERE ID=?");
         foreach ($_GET['id'] as $key => $id) {
             $area = (int) $_GET['area'][$id];
             $date = $_GET['date'][$id];
             $timein = $this->parseTime($_GET['time_in'][$id], $_GET['inmeridian'][$id]);
             $timeout = $this->parseTime($_GET['time_out'][$id], $_GET['outmeridian'][$id]);
             $result = False;
             if ($area != 0) {
                 $args = array($date . ' ' . $timein, $date . ' ' . $timeout, $area, $id);
                 $result = $ts_db->exec_statement($oneP, $args);
             } else {
                 $args = array('2008-01-01 ' . $timein, $id);
                 $result = $ts_db->exec_statement($twoP, $args);
             }
             if (!$result) {
                 $this->errors[] = "<p>Query: {$query}</p>";
                 $this->errors[] = "<p>MySQL Error: " . $ts_db->error() . "</p>";
             }
         }
     }
     return True;
 }
Пример #8
0
 public function fetch_report_data()
 {
     global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
     $month = FormLib::get('month', date('n'));
     $year = FormLib::get('year', date('Y'));
     $end_of_last_month = mktime(0, 0, 0, $month, 0, $year);
     $ts = mktime(0, 0, 0, $month, 1, $year);
     $end_of_next_month = mktime(0, 0, 0, $month, date('t', $ts), $year);
     $end_last_dt = new DateTime(date('Y-m-d', $end_of_last_month));
     $end_next_dt = new DateTime(date('Y-m-d', $end_of_next_month));
     $loans = new GumLoanAccountsModel($dbc);
     $data = array();
     foreach ($loans->find('loanDate') as $loan) {
         $record = array($loan->accountNumber(), number_format($loan->principal(), 2), number_format($loan->interestRate() * 100, 2) . '%', $loan->termInMonths(), date('Y-m-d', strtotime($loan->loanDate())));
         $loanDT = new DateTime(date('Y-m-d', strtotime($loan->loanDate())));
         $days1 = $loanDT->diff($end_last_dt)->format('%r%a');
         $days2 = $loanDT->diff($end_next_dt)->format('%r%a');
         $bal_before = $loan->principal() * pow(1.0 + $loan->interestRate(), $days1 / 365.25);
         if ($days1 < 0) {
             $bal_before = $loan->principal();
         }
         $bal_after = $loan->principal() * pow(1.0 + $loan->interestRate(), $days2 / 365.25);
         if ($days2 < 0) {
             $bal_after = $loan->principal();
         }
         $record[] = number_format($bal_before, 2);
         $record[] = number_format($bal_after, 2);
         $record[] = number_format($bal_after - $bal_before, 2);
         $data[] = $record;
     }
     return $data;
 }
Пример #9
0
 public function fetch_report_data()
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $upc = $this->form->upc;
     $upc = BarcodeLib::padUPC($upc);
     $query = 'SELECT i.sku, i.quantity, i.unitCost, i.caseSize,
                     i.quantity * i.unitCost * i.caseSize AS ttl,
                     o.vendorInvoiceID, v.vendorName, o.placedDate
                     FROM PurchaseOrderItems AS i
                         LEFT JOIN PurchaseOrder AS o ON i.orderID=o.orderID
                         LEFT JOIN vendors AS v ON o.vendorID=v.vendorID
                     WHERE i.internalUPC = ?
                         AND o.placedDate >= ?
                     ORDER BY o.placedDate';
     $prep = $dbc->prepare($query);
     $args = array($upc);
     if (FormLib::get('all')) {
         $args[] = '1900-01-01 00:00:00';
     } else {
         $args[] = date('Y-m-d', strtotime('92 days ago'));
     }
     $result = $dbc->execute($prep, $args);
     $data = array();
     while ($row = $dbc->fetch_row($result)) {
         $record = array($row['placedDate'], $row['vendorName'], $row['vendorInvoiceID'], $row['sku'], $row['quantity'], $row['caseSize'], $row['unitCost'], $row['ttl']);
         $data[] = $record;
     }
     return $data;
 }
Пример #10
0
    public function form_content()
    {
        ob_start();
        ?>
<form method ="get" action="CashierRecordsReport.php">
<div class="col-sm-4">
    <div class="form-group">
    <label>Date Start</label>
    <input type=text id=date1 name=date1 class="form-control date-field" />
    </div>
    <div class="form-group">
    <label>Date End</label>
    <input type=text id=date2 name=date2 class="form-control date-field" />
    </div>
    <p>
    <button type=submit name=submit class="btn btn-default btn-core">Submit</button>
    <button type=reset name=reset class="btn btn-default btn-reset">Start Over</button>
    </p>
</div>
<div class="col-sm-4">
    <?php 
        echo FormLib::date_range_picker();
        ?>
</div>
</form>
<?php 
        return ob_get_clean();
    }
Пример #11
0
 function saveFormData($memNum)
 {
     $dbc = $this->db();
     /**
       Use primary member for default column values
     */
     $account = self::getAccount();
     if (!$account) {
         return "Error: Problem saving household members<br />";
     }
     $json = array('cardNo' => $memNum, 'customerTypeID' => $account['customerTypeID'], 'memberStatus' => $account['memberStatus'], 'activeStatus' => $account['activeStatus'], 'customers' => array());
     $primary = array('discount' => 0, 'staff' => 0, 'lowIncomeBenefits' => 0, 'chargeAllowed' => 0, 'checksAllowed' => 0);
     foreach ($account['customers'] as $c) {
         if ($c['accountHolder']) {
             $primary = $c;
             break;
         }
     }
     $fns = FormLib::get_form_value('HouseholdMembers_fn', array());
     $lns = FormLib::get_form_value('HouseholdMembers_ln', array());
     $ids = FormLib::get('HouseholdMembers_ID', array());
     for ($i = 0; $i < count($lns); $i++) {
         $json['customers'][] = array('customerID' => $ids[$i], 'firstName' => $fns[$i], 'lastName' => $lns[$i], 'accountHolder' => 0, 'discount' => $primary['discount'], 'staff' => $primary['staff'], 'lowIncomeBenefits' => $primary['lowIncomeBenefits'], 'chargeAllowed' => $primary['chargeAllowed'], 'checksAllowed' => $primary['checksAllowed']);
     }
     $resp = \COREPOS\Fannie\API\member\MemberREST::post($memNum, $json);
     if ($resp['errors'] > 0) {
         return "Error: Problem saving household members<br />";
     }
     return '';
 }
Пример #12
0
 public function post_upc_description_department_cost_price_qty_reason_handler()
 {
     global $FANNIE_TRANS_DB, $FANNIE_EMP_NO, $FANNIE_REGISTER_NO;
     $dbc = FannieDB::get($FANNIE_TRANS_DB);
     $record = DTrans::$DEFAULTS;
     $record['emp_no'] = $FANNIE_EMP_NO;
     $record['register_no'] = $FANNIE_REGISTER_NO;
     $record['trans_no'] = DTrans::getTransNo($dbc, $FANNIE_EMP_NO, $FANNIE_REGISTER_NO);
     $record['trans_id'] = 1;
     $record['upc'] = $this->upc;
     $record['description'] = $this->description;
     $record['department'] = $this->department;
     $record['trans_type'] = 'I';
     $record['quantity'] = $this->qty;
     $record['ItemQtty'] = $this->qty;
     $record['unitPrice'] = $this->price;
     $record['regPrice'] = $this->price;
     $record['total'] = $this->qty * $this->price;
     $record['cost'] = $this->qty * $this->cost;
     $record['numflag'] = $this->reason;
     $record['charflag'] = strlen(FormLib::get('type')) > 0 ? strtoupper(substr(FormLib::get('type'), 0, 1)) : '';
     $record['trans_status'] = 'Z';
     $info = DTrans::parameterize($record, 'datetime', $dbc->now());
     $query = 'INSERT INTO dtransactions
         (' . $info['columnString'] . ')
         VALUES
         (' . $info['valueString'] . ')';
     $prep = $dbc->prepare($query);
     $result = $dbc->execute($prep, $info['arguments']);
     header('Location: ' . $_SERVER['PHP_SELF'] . '?msg=1');
     return false;
 }
Пример #13
0
 public function form_content()
 {
     ob_start();
     ?>
     <form method=get class="form-horizontal">
     <div class="row">
         <div class="col-sm-6">
             <p>
                 <label>Start Date</label>
                 <input class="form-control date-field" required type=text id=date1 name=date1 />
             </p>
             <p>
                 <label>End Date</label>
                 <input class="form-control date-field" required type=text id=date2 name=date2 />
             </p>
         </div>
         <div class="col-sm-6">
             <p>
             <?php 
     echo FormLib::date_range_picker();
     ?>
             </p>
         </div>
     </div>
     <p>
         <button type=submit name=submit value="Submit" class="btn btn-default">Submit</button>
         <label><input type=checkbox name=excel /> Excel</label>
     </p>
     </form>
     <?php 
     return ob_get_clean();
 }
Пример #14
0
 public function post_download_handler()
 {
     header('Content-Type: application/ms-excel');
     header('Content-Disposition: attachment; filename="PDFasCSV.csv"');
     echo FormLib::get('download');
     return false;
 }
Пример #15
0
 public function post_handler()
 {
     global $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $amount = FormLib::get('amount');
     $paid = FormLib::get('paid') / 100.0;
     $retained = FormLib::get('retained') / 100.0;
     $netQ = '
         SELECT SUM(p.net_purch) AS ttl
         FROM patronage_workingcopy AS p
             INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
         WHERE c.Type=\'PC\'';
     $netR = $dbc->query($netQ);
     $netW = $dbc->fetch_row($netR);
     $purchases = $netW['ttl'];
     $personQ = '
         SELECT p.net_purch,
             c.cardno
         FROM patronage_workingcopy AS p
             INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
         WHERE c.Type=\'PC\'';
     $personR = $dbc->query($personQ);
     $this->insertRecords($dbc, $personR, $purchases, $paid, $retained, $amount);
     $finishQ = '
         INSERT INTO patronage
         (cardno, purchase, discounts, rewards, net_purch, tot_pat, cash_pat, equit_pat, FY)
         SELECT 
             p.cardno, purchase, discounts, rewards, net_purch, tot_pat, cash_pat, equit_pat, FY
         FROM patronage_workingcopy AS p
             INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
         WHERE c.Type=\'PC\'';
     $dbc->query($finishQ);
     return true;
 }
Пример #16
0
 public function fetch_report_data()
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $FANNIE_URL = $this->config->get('URL');
     $super = $this->form->submit == "by_sd" ? 1 : 0;
     $join = "";
     $where = "";
     $args = array();
     if ($super == 1) {
         $superID = FormLib::get('superdept');
         $join = "LEFT JOIN superdepts AS s ON d.dept_no=s.dept_ID\n                LEFT JOIN superDeptNames AS m ON s.superID=m.superID ";
         $where = "s.superID = ?";
         $args[] = $superID;
     } else {
         $d1 = FormLib::get('dept1');
         $d2 = FormLib::get('dept2');
         $join = " LEFT JOIN MasterSuperDepts AS m ON d.dept_no=m.dept_ID";
         $where = "d.dept_no BETWEEN ? AND ?";
         $args = array($d1, $d2);
     }
     $query = $dbc->prepare_statement("SELECT d.dept_no,d.dept_name,d.salesCode,d.margin,\n            CASE WHEN d.dept_tax=0 THEN 'NoTax' ELSE t.description END as tax,\n            CASE WHEN d.dept_fs=1 THEN 'Yes' ELSE 'No' END as fs,\n            m.super_name\n            FROM departments AS d \n                LEFT JOIN taxrates AS t ON d.dept_tax = t.id \n            {$join}\n            WHERE {$where}\n            ORDER BY d.dept_no");
     $result = $dbc->exec_statement($query, $args);
     $data = array();
     while ($row = $dbc->fetch_row($result)) {
         $record = array($row[0], isset($_REQUEST['excel']) ? $row[1] : "<a href=\"{$FANNIE_URL}item/departments/DepartmentEditor.php?did={$row['0']}\">{$row['1']}</a>", $row['super_name'], $row[2], sprintf('%.2f%%', $row[3] * 100), $row[4], $row[5]);
         if (empty($row['super_name'])) {
             $record['meta'] = FannieReportPage::META_COLOR;
             $record['meta_background'] = '#ff9999';
         }
         $data[] = $record;
     }
     return $data;
 }
Пример #17
0
 public function post_id_superID_growth_handler()
 {
     $lib_class = $this->lib_class;
     $dbc = $lib_class::getDB();
     $map = $lib_class::getCategoryMap($dbc);
     for ($i = 0; $i < count($this->id); $i++) {
         if (!isset($this->superID[$i])) {
             continue;
         }
         $map->obfCategoryID($this->id[$i]);
         $map->superID($this->superID[$i]);
         $map->growthTarget(isset($this->growth[$i]) ? $this->growth[$i] / 100.0 : 0);
         $map->save();
     }
     $delete = FormLib::get('delete', array());
     if (is_array($delete)) {
         foreach ($delete as $ids) {
             list($cat, $super) = explode(':', $ids, 2);
             $map->obfCategoryID($cat);
             $map->superID($super);
             $map->delete();
         }
     }
     header('Location: ' . filter_input(INPUT_SERVER, 'PHP_SELF'));
     return false;
 }
Пример #18
0
 public function fetch_report_data()
 {
     global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
     $dt = FormLib::get('endDate', date('Y-m-d'));
     $dividends = new GumDividendsModel($dbc);
     $dividends->yearEndDate($dt);
     $map = new GumDividendPayoffMapModel($dbc);
     $check = new GumPayoffsModel($dbc);
     $data = array();
     foreach ($dividends->find('card_no') as $dividend) {
         $record = array($dividend->card_no(), sprintf('%.2f', $dividend->equityAmount()), $dividend->daysHeld(), sprintf('%.2f%%', $dividend->dividendRate() * 100), sprintf('%.2f', $dividend->dividendAmount()));
         $checkID = false;
         $map->reset();
         $map->gumDividendID($dividend->gumDividendID());
         foreach ($map->find('gumPayoffID', true) as $obj) {
             $checkID = $obj->gumPayoffID();
         }
         if (!$checkID) {
             $record[] = '?';
         } else {
             $check->gumPayoffID($checkID);
             $check->load();
             $record[] = $check->checkNumber();
         }
         $data[] = $record;
     }
     return $data;
 }
Пример #19
0
 function post_id_handler()
 {
     global $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $upc = BarcodeLib::padUPC($this->id);
     $model = new ProductsModel($dbc);
     $model->upc($upc);
     $model->store_id(1);
     $model->discounttype(0);
     $model->special_price(0);
     $model->modified(date('Y-m-d H:i:s'));
     $model->save();
     $batchID = FormLib::get_form_value('batchID');
     $batchUPC = FormLib::get_form_value('batchUPC');
     if ($batchID !== '' && $batchUPC !== '') {
         if (substr($batchUPC, 0, 2) != 'LC') {
             $batchUPC = BarcodeLib::padUPC($batchUPC);
         }
         $batchP = $dbc->prepare_statement('DELETE FROM batchList
                 WHERE upc=? AND batchID=?');
         $batchR = $dbc->exec_statement($batchP, array($batchUPC, $batchID));
     }
     require 'laneUpdates.php';
     updateProductAllLanes($upc);
     header('Location: ItemEditorPage.php?searchupc=' . $upc);
     return False;
 }
Пример #20
0
 public function draw_page()
 {
     include dirname(__FILE__) . '/../../config.php';
     $dbc = FannieDB::get($FANNIE_TRANS_DB);
     $id = FormLib::get('id', 0);
     $prep = $dbc->prepare('SELECT filetype, filecontents FROM CapturedSignature WHERE capturedSignatureID=?');
     $result = $dbc->execute($prep, array($id));
     if ($dbc->num_rows($result) > 0) {
         $row = $dbc->fetch_row($result);
         switch (strtoupper($row['filetype'])) {
             case 'BMP':
                 header('Content-type: image/bmp');
                 break;
             case 'PNG':
                 header('Content-type: image/png');
                 break;
             case 'JPG':
                 header('Content-type: image/jpeg');
                 break;
             case 'GIF':
                 header('Content-type: image/gif');
                 break;
             default:
                 // Content-type: application/octet-stream
                 // may be helpful in this scenario but appears
                 // to be technically incorrect. in any event
                 // it really should not occur
                 break;
         }
         echo $row['filecontents'];
     }
 }
Пример #21
0
 function saveFormData($memNum)
 {
     $dbc = $this->db();
     $formPref = FormLib::get_form_value('MemContactPref', -1);
     // Does a preference for this member exist?
     $infoQ = $dbc->prepare_statement("SELECT pref\n                FROM memContact\n                WHERE card_no=?");
     $infoR = $dbc->exec_statement($infoQ, array($memNum));
     // If no preference exists, add one if one was chosen.
     if ($dbc->num_rows($infoR) == 0) {
         if ($formPref > -1) {
             $upQ = $dbc->prepare_statement("INSERT INTO memContact (card_no, pref)\n                    VALUES (?, ?)");
             $upR = $dbc->exec_statement($upQ, array($memNum, $formPref));
             if ($upR === False) {
                 return "Error: problem adding Contact Preference.";
             } else {
                 return "";
             }
         }
     } else {
         $row = $dbc->fetch_row($infoR);
         $dbPref = $row['pref'];
         if ($formPref != $dbPref) {
             $upQ = $dbc->prepare_statement("UPDATE memContact SET pref = ?\n                    WHERE card_no = ?");
             $upR = $dbc->exec_statement($upQ, array($formPref, $memNum));
             if ($upR === False) {
                 return "Error: problem updating Contact Preference.";
             } else {
                 return "";
             }
         }
     }
     return "";
     // saveFormData
 }
Пример #22
0
 public function preprocess()
 {
     $acct = FormLib::get('id');
     $this->header = 'Promissory Note' . ' : ' . $acct;
     $this->title = 'Promissory Note' . ' : ' . $acct;
     $this->__routes[] = 'get<id><pdf>';
     return parent::preprocess();
 }
Пример #23
0
 function preprocess()
 {
     global $FANNIE_OP_DB;
     $id = FormLib::get_form_value('id', 0);
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $tags = new ShelftagsModel($dbc);
     $tags->id($id);
     $current_set = $tags->find();
     if (count($current_set) == 0) {
         $this->messages = '<div class="alert alert-info">
             Barcode table is already empty. <a href="ShelfTagIndex.php">Click here to continue</a>
             </div>';
         return true;
     }
     if (FormLib::get('submit', false) === '1') {
         /**
           Shelftags are not actually delete immediately
           Instead, the id field is negated so they disappear
           from view but can be manually retreived by IT if 
           someone comes complaining that they accidentally
           delete their tags (not that such a thing would
           ever occur). They're properly deleted by the 
           nightly.clipboard cron job.
         
           If the same user deletes the same UPC from tags
           multiple times in a day, the above procedure creates
           a primary key conflict. So any negative-id records
           that will create conflicts must be removed first.
         */
         $new_id = -1 * $id;
         if ($id == 0) {
             $new_id = -999;
         }
         $clear = new ShelftagsModel($dbc);
         $clear->id($new_id);
         foreach ($current_set as $tag) {
             // delete existing negative id tag for upc
             $clear->upc($tag->upc());
             $clear->delete();
             // save tag as negative id
             $old_id = $tag->id();
             $tag->id($new_id);
             $tag->save();
             $tag->id($old_id);
             $tag->delete();
         }
         $this->messages = '<div class="alert alert-success">
             Barcode table cleared <a href="ShelfTagIndex.php">Click here to continue</a>
             </div>';
         return true;
     } else {
         $this->messages = '<div class="alert alert-danger">
             <a href="DeleteShelfTags.php?id=' . $id . '&submit=1">Click 
             here to clear barcodes</a></div>';
         return true;
     }
     return true;
 }
Пример #24
0
 public function preprocess()
 {
     $acct = FormLib::get('id');
     $this->header = 'Tax Identification' . ' : ' . $acct;
     $this->title = 'Tax Identification' . ' : ' . $acct;
     $this->__routes[] = 'post<id><new1><new2>';
     $this->__routes[] = 'post<id><key>';
     return parent::preprocess();
 }
Пример #25
0
 function preprocess()
 {
     $this->tpath = sys_get_temp_dir() . "/misc/";
     $this->mode = 'form';
     /* Is this a request-to-upload or an initial display of the form? */
     if (FormLib::get_form_value('MAX_FILE_SIZE') != '' && FormLib::get_form_value('doUpload') != '') {
         $this->mode = 'process';
     }
     return True;
 }
Пример #26
0
 function saveFormData($memNum)
 {
     $json = array('cardNo' => $memNum, 'startDate' => FormLib::get('MemDates_start'), 'endDate' => FormLib::get('MemDates_end'));
     $resp = \COREPOS\Fannie\API\member\MemberREST::post($memNum, $json);
     if ($resp['errors'] > 0) {
         return "Error: problem saving start/end dates<br />";
     } else {
         return "";
     }
 }
Пример #27
0
 public function form_content()
 {
     return '<form method="get">
         <div class="container row">' . FormLib::standardDateFields() . '
         </div>
         <p>
             <button type="submit" class="btn btn-default btn-core">Submit</button>
         </p>
         </form>';
 }
Пример #28
0
 public function fetch_report_data()
 {
     $item = array();
     $batchID = array();
     $upc = array();
     $salePrice = array();
     $owner = array();
     $size = array();
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     //procure batchIDs from 'batches'
     $query = "select batchID, owner from batches where startDate='{$this->form->startdate} 00:00:00';";
     if (FormLib::get('dept') == 2) {
         $query = "select batchID, owner from batches where startDate='{$this->form->startdate} 00:00:00' and (owner='Bulk' or owner='BULK');";
     }
     if (FormLib::get('dept') == 3) {
         $query = "select batchID, owner from batches where startDate='{$this->form->startdate} 00:00:00' and (owner='Cool' or owner='COOL');";
     }
     if (FormLib::get('dept') == 4) {
         $query = "select batchID, owner from batches where startDate='{$this->form->startdate} 00:00:00' and (owner='Grocery' or owner='GROCERY');";
     }
     if (FormLib::get('dept') == 5) {
         $query = "select batchID, owner from batches where startDate='{$this->form->startdate} 00:00:00' and (owner='HBC');";
     }
     $result = $dbc->query($query);
     while ($row = $dbc->fetch_row($result)) {
         $batchID[] = $row['batchID'];
         $owner[] = $row['owner'];
     }
     echo count($batchID) . " batches found\n";
     //procure upcs from 'batchList' --this is going to pull every upc of every item that is going on sale
     for ($i = 0; $i < count($batchID); $i++) {
         $query = "SELECT upc, salePrice \n            FROM batchList where batchID='{$batchID[$i]}';\n            ";
         $result = $dbc->query($query);
         while ($row = $dbc->fetch_row($result)) {
             $upc[] = $row['upc'];
             $salePrice[] = $row['salePrice'];
         }
     }
     echo count($upc) . " items found for this sales period <br>";
     //procure description of items based on 'upc's, and return their descriptions, organized by department and brand
     for ($i = 0; $i < count($upc); $i++) {
         $query = "SELECT p.upc, u.brand, u.description, v.size from products as p\n                    LEFT JOIN productUser as u ON p.upc=u.upc\n                    LEFT JOIN vendorItems as v ON v.upc=p.upc\n                    WHERE p.upc = '{$upc[$i]}' order by 'brand';";
         $result = $dbc->query($query);
         while ($row = $dbc->fetch_row($result)) {
             $item[$i][0] = $row['brand'];
             $item[$i][1] = $row['description'];
             $item[$i][2] = $row['size'];
             $item[$i][3] = $salePrice[$i];
             $item[$i][4] = $row['upc'];
         }
     }
     sort($item);
     return $item;
 }
Пример #29
0
 protected function get_id_handler()
 {
     $this->card_no = $this->id;
     $my = FormLib::get_form_value('my', date('Ym'));
     $start = date("Y-m-d", mktime(0, 0, 0, substr($my, 4), 1, substr($my, 0, 4)));
     $end = date("Y-m-t", mktime(0, 0, 0, substr($my, 4), 1, substr($my, 0, 4)));
     $table = DTransactionsModel::selectDlog($start, $end);
     $this->__models['start'] = $start;
     $this->__models['end'] = $end;
     return True;
 }
Пример #30
0
 private function writeICal($id, $filename)
 {
     global $FANNIE_OP_DB;
     $dbc = CalendarPluginDB::get();
     $cal = new CalendarsModel($dbc);
     $cal->calendarID($id);
     $cal->load();
     $query = '
         SELECT m.eventID,
             m.eventDate,
             m.eventText,
             m.uid,
             u.real_name,
             u.name
         FROM monthview_events AS m
             LEFT JOIN ' . $FANNIE_OP_DB . $dbc->sep() . 'Users AS u ON m.uid=u.uid
         WHERE m.calendarID = ?';
     if (FormLib::get('export') != 1) {
         $query .= ' AND m.eventDate >= ' . $dbc->curdate();
     }
     $query .= ' ORDER BY eventDate DESC';
     $prep = $dbc->prepare($query);
     $res = $dbc->execute($prep, array($id));
     $fp = fopen($filename, 'w');
     fwrite($fp, "BEGIN:VCALENDAR\r\n");
     fwrite($fp, "VERSION:2.0\r\n");
     fwrite($fp, "PRODID:-//FannieCalendarPlugin//NONSGML v1.0//EN\r\n");
     fwrite($fp, "X-WR-CALNAME:" . $cal->name() . "\r\n");
     fwrite($fp, "CALSCALE:GREGORIAN\r\n");
     $now = gmdate('Ymd') . 'T' . gmdate('His') . 'Z';
     while ($row = $dbc->fetch_row($res)) {
         $times = $this->getTime($row['eventText']);
         $date_stem = date('Y-m-d', strtotime($row['eventDate']));
         fwrite($fp, "BEGIN:VEVENT\r\n");
         fwrite($fp, "UID:" . sha1($row['eventID']) . '@' . $_SERVER['HTTP_HOST'] . "\r\n");
         if ($times && strtotime($date_stem . ' ' . $times['start'] . ':00') && strtotime($date_stem . ' ' . $times['end'] . ':00')) {
             $startTime = strtotime($date_stem . ' ' . $times['start'] . ':00');
             $endTime = strtotime($date_stem . ' ' . $times['end'] . ':00');
             fwrite($fp, "DTSTART:" . gmdate('Ymd\\THis\\Z', $startTime) . "\r\n");
             fwrite($fp, "DTEND:" . gmdate('Ymd\\THis\\Z', $endTime) . "\r\n");
         } else {
             fwrite($fp, "DTSTART;VALUE=DATE:" . date('Ymd', strtotime($row['eventDate'])) . "\r\n");
         }
         fwrite($fp, "DTSTAMP:" . $now . "\r\n");
         $row['eventText'] = $this->br2nl($row['eventText']);
         fwrite($fp, "DESCRIPTION:" . $this->escapeString($row['eventText']) . "\r\n");
         $summary = explode("\n", $row['eventText'], 2);
         fwrite($fp, "SUMMARY:" . $this->escapeString($summary[0]) . "\r\n");
         fwrite($fp, "ORGANIZER;CN=" . $row['real_name'] . ":" . $row['name'] . '@' . $_SERVER['HTTP_HOST'] . "\r\n");
         fwrite($fp, "LAST-MODIFIED:" . $now . "\r\n");
         fwrite($fp, "END:VEVENT\r\n");
     }
     fwrite($fp, "END:VCALENDAR\r\n");
 }