Exemple #1
0
 function preprocess()
 {
     global $FANNIE_OP_DB;
     // custom: can delete items from report results
     if (isset($_REQUEST['deleteItem'])) {
         $upc = FormLib::get_form_value('deleteItem', '');
         if (is_numeric($upc)) {
             $upc = BarcodeLib::padUPC($upc);
         }
         $dbc = FannieDB::get($FANNIE_OP_DB);
         $model = new ProductsModel($dbc);
         $model->upc($upc);
         $model->store_id(1);
         $model->delete();
         echo 'Deleted';
         return false;
     } elseif (FormLib::get('deactivate') !== '') {
         $upc = BarcodeLib::padUPC(FormLib::get('deactivate'));
         $dbc = FannieDB::get($FANNIE_OP_DB);
         $model = new ProductsModel($dbc);
         $model->upc($upc);
         $model->store_id(1);
         $model->inUse(0);
         $model->save();
         echo 'Deactivated';
     }
     $ret = parent::preprocess();
     // custom: needs extra JS for delete option
     if ($this->content_function == 'report_content' && $this->report_format == 'html') {
         $this->add_script("../../src/javascript/jquery.js");
         $this->add_script('delete.js');
     }
     return $ret;
 }
Exemple #2
0
 public function preprocess()
 {
     parent::preprocess();
     if ($this->content_function == 'report_content' && $this->report_format == 'html') {
         $this->add_script('../../src/javascript/d3.js/d3.v3.min.js');
     }
     return true;
 }
 public function report_content()
 {
     $default = parent::report_content();
     if ($this->report_format == 'html') {
         $default .= '<div id="chartDiv"></div>';
         $this->add_onload_command('showGraph()');
     }
     return $default;
 }
 public function preprocess()
 {
     // custom: ajax lookup up feeds into form fields
     if (FormLib::get('lookup') !== '') {
         echo $this->ajaxCallback();
         return false;
     }
     return parent::preprocess();
 }
 public function preprocess()
 {
     $this->report_headers = array(_('Member'), '$Total Purchased', '$Average per Receipt', '#Receipts');
     $this->title = "Fannie : Patronage over Date Range Report";
     $this->header = "Patronage over Date Range Report";
     if (is_numeric(FormLib::get_form_value('top_n', 0))) {
         $this->top_n = FormLib::get_form_value('top_n', 0);
     }
     return parent::preprocess();
 }
 function preprocess()
 {
     // custom: optional sorting
     if (FormLib::get_form_value('sortable') !== '') {
         $this->sortable = true;
     } else {
         $this->sortable = false;
     }
     $this->cellTextAlign = 'right';
     return parent::preprocess();
 }
Exemple #7
0
 public function preprocess()
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $o = new OriginsModel($dbc);
     $o->local(1);
     foreach ($o->find('originID') as $origin) {
         $this->localSettings[$origin->originID()] = $origin->shortName();
         $this->report_headers[] = '# ' . $origin->shortName();
     }
     return parent::preprocess();
 }
Exemple #8
0
 /**
   Report has variable inputs so change
   required fields before calling default preprocess
 */
 public function preprocess()
 {
     if (FormLib::get('upc') !== '') {
         $this->required_fields[] = 'upc';
     }
     if (FormLib::get('manufacturer') !== '') {
         $this->required_fields[] = 'manufacturer';
     }
     if (FormLib::get('dept1') !== '') {
         $this->required_fields[] = 'dept1';
     }
     if (count($this->required_fields) == 0) {
         $this->required_fields[] = '_no_valid_input';
     }
     return parent::preprocess();
 }
Exemple #9
0
 public function report_content()
 {
     $default = parent::report_content();
     if ($this->report_format == 'html') {
         $default .= '<div id="chartArea" style="border: 1px solid black;padding: 2em;">';
         $default .= 'Graph: <select onchange="showGraph(this.value);">';
         for ($i = count($this->report_headers) - 1; $i >= 1; $i--) {
             $default .= sprintf('<option value="%d">%s</option>', $i, $this->report_headers[$i]);
         }
         $default .= '</select>';
         $default .= '<div id="chartDiv"></div>';
         $default .= '</div>';
         $this->add_onload_command('showGraph(' . (count($this->report_headers) - 1) . ')');
     }
     return $default;
 }
Exemple #10
0
 function preprocess()
 {
     // dynamic column headers
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $typeQ = $dbc->prepare_statement("SELECT memtype,memDesc FROM memtype ORDER BY memtype");
     $typeR = $dbc->exec_statement($typeQ);
     $this->memtypes = array();
     $this->report_headers = array('Date');
     while ($typeW = $dbc->fetch_row($typeR)) {
         $this->report_headers[] = $typeW['memDesc'];
         $this->memtypes[$typeW['memtype']] = $typeW['memDesc'];
     }
     $this->report_headers[] = 'Total';
     return parent::preprocess();
 }
 function preprocess()
 {
     parent::preprocess();
     if ($this->content_function == 'report_content') {
         $this->report_headers = array('#', 'Description');
         // build headers and keys off span of months
         $this->months = array();
         $stamp1 = mktime(0, 0, 0, FormLib::get_form_value('month1', 1), 1, FormLib::get_form_value('year1', 1));
         $stamp2 = mktime(0, 0, 0, FormLib::get_form_value('month2', 1), 1, FormLib::get_form_value('year2', 1));
         while ($stamp1 <= $stamp2) {
             $this->report_headers[] = date('F Y', $stamp1);
             $this->months[] = date('Y-n', $stamp1);
             $stamp1 = mktime(0, 0, 0, date('n', $stamp1) + 1, 1, date('Y', $stamp1));
         }
     }
     return true;
 }
Exemple #12
0
 public function preprocess()
 {
     // custom: one of the fields is required but not both
     $this->upc = BarcodeLib::padUPC(FormLib::get('upc'));
     $this->lc = FormLib::get('likecode');
     if ($this->upc != '0000000000000' || $this->lc !== '') {
         if ($this->lc !== '') {
             $this->report_headers[0] = 'Like Code #' . $this->lc;
             $this->required_fields = array('likecode');
         } else {
             $this->report_headers[0] = 'UPC #' . $this->upc;
             $this->required_fields = array('upc');
         }
         parent::preprocess();
     }
     return true;
 }
Exemple #13
0
 public function report_content()
 {
     $default = parent::report_content();
     if ($this->report_format == 'html') {
         $default .= '<div id="chartArea" style="border: 1px solid black;padding: 2em;">';
         $default .= 'Graph: <select onchange="showGraph(this.value);">';
         $default .= '<option value="1"># of Transactions</option>';
         $default .= '<option value="4"># of Items</option>';
         $default .= '<option value="7">Total Spending</option>';
         $default .= '<option value="10">Average Spending</option>';
         $default .= '</select>';
         $default .= '<div id="chartDiv"></div>';
         $default .= '</div>';
         $this->add_onload_command('showGraph(1)');
     }
     return $default;
 }
 public function preprocess()
 {
     $this->title = _("Fannie") . " : " . _("Manufacturer Movement Report");
     $this->header = _("Manufacturer Movement Report");
     return parent::preprocess();
 }
Exemple #15
0
 public function preprocess()
 {
     $ret = parent::preprocess();
     $this->content_function = 'report_content';
     return $ret;
 }
Exemple #16
0
 public function preprocess()
 {
     $this->mode = FormLib::get('sort', 'PLU');
     return parent::preprocess();
 }
 public function preprocess()
 {
     $this->header = 'Issued Dividend Report';
     $this->title = 'Issued Dividend Report';
     return parent::preprocess();
 }
Exemple #18
0
 public function preprocess()
 {
     $this->header = 'Active Loan Report';
     $this->title = 'Active Loan Report';
     return parent::preprocess();
 }
Exemple #19
0
 public function preprocess()
 {
     $this->header = 'Loan and Equity Mailing List';
     $this->title = 'Loan and Equity Mailing List';
     return parent::preprocess();
 }
Exemple #20
0
 public function preprocess()
 {
     $this->title = _("Fannie") . " : " . _("WIC Product Sales Report");
     $this->header = _("WIC Product Sales Report");
     return parent::preprocess();
 }
Exemple #21
0
 public function preprocess()
 {
     global $FANNIE_OP_DB, $FANNIE_PLUGIN_LIST, $FANNIE_PLUGIN_SETTINGS;
     if (!isset($FANNIE_PLUGIN_LIST) || !in_array('CoopCred', $FANNIE_PLUGIN_LIST)) {
         $this->errors[] = "The Coop Cred plugin is not enabled.";
         return False;
     }
     if (array_key_exists('CoopCredDatabase', $FANNIE_PLUGIN_SETTINGS) && $FANNIE_PLUGIN_SETTINGS['CoopCredDatabase'] != "") {
         $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);
     } else {
         $this->errors[] = "The Coop Cred database is not assigned in the " . "Coop Cred plugin configuration.";
         return False;
     }
     $this->cardNo = (int) FormLib::get('memNum', 0);
     $this->programID = (int) FormLib::get('programID', 0);
     $ccpModel = new CCredProgramsModel($dbc);
     $ccpModel->programID($this->programID);
     $prog = array_pop($ccpModel->find());
     if ($prog != null) {
         $this->programName = $prog->programName();
         $this->programBankID = $prog->bankID();
     } else {
         $this->errors[] = "Error: Program ID {$this->programID} is not known.";
         return False;
     }
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $cdModel = new CustdataModel($dbc);
     $cdModel->CardNo($this->cardNo);
     $cdModel->personNum(1);
     $mem = array_pop($cdModel->find());
     if ($mem != null) {
         $this->memberFullName = $mem->FirstName() . " " . $mem->LastName();
     } else {
         $noop = 1;
         $this->errors[] = "Error: Member {$this->cardNo} is not known.";
         return False;
     }
     /* 25Mar2015 Under bootstrap the non-sortable format doesn't really work.
      */
     $this->sortable = True;
     return parent::preprocess();
 }
Exemple #22
0
 public function preprocess()
 {
     return FannieReportPage::preprocess();
 }
 public function report_content()
 {
     if (FormLib::get('excel') == '1099') {
         $data = $this->fetch_report_data();
         $pdf = new FPDF('P', 'mm', 'Letter');
         $bridge = GumLib::getSetting('posLayer');
         $year = date('Y', strtotime(FormLib::get('endDate')));
         foreach ($data as $row) {
             $custdata = $bridge::getCustdata($row[0]);
             $meminfo = $bridge::getMeminfo($row[0]);
             $ssn = $row[10] == 'No key' ? $row[9] : $row[10];
             $amount = array(1 => $row[8]);
             $form = new GumTaxFormTemplate($custdata, $meminfo, $ssn, $tax_year, $amount);
             $pdf->addPage();
             $form->renderAsPDF($pdf, 15);
         }
         $pdf->Output('taxform.pdf', 'I');
     } else {
         return parent::report_content();
     }
 }