Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
 public function preprocess()
 {
     // custom: ajax lookup up feeds into form fields
     if (FormLib::get('lookup') !== '') {
         echo $this->ajaxCallback();
         return false;
     }
     return parent::preprocess();
 }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
0
 function preprocess()
 {
     // custom: optional sorting
     if (FormLib::get_form_value('sortable') !== '') {
         $this->sortable = true;
     } else {
         $this->sortable = false;
     }
     $this->cellTextAlign = 'right';
     return parent::preprocess();
 }
Ejemplo n.º 6
0
 public function preprocess()
 {
     $ret = parent::preprocess();
     // custom: needs graphing JS/CSS
     if ($this->content_function == 'report_content' && $this->report_format == 'html') {
         $this->add_script('../../../../src/javascript/d3.js/d3.v3.min.js');
         $this->add_script('../../../../src/javascript/d3.js/charts/singleline/singleline.js');
         $this->add_css_file('../../../../src/javascript/d3.js/charts/singleline/singleline.css');
     }
     return $ret;
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 9
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();
 }
Ejemplo n.º 10
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;
 }
Ejemplo n.º 11
0
 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;
 }
Ejemplo n.º 12
0
 public function preprocess()
 {
     $ret = parent::preprocess();
     $this->content_function = 'report_content';
     return $ret;
 }
Ejemplo n.º 13
0
 public function preprocess()
 {
     return FannieReportPage::preprocess();
 }
Ejemplo n.º 14
0
 public function preprocess()
 {
     $this->mode = FormLib::get('sort', 'PLU');
     return parent::preprocess();
 }
Ejemplo n.º 15
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();
 }
Ejemplo n.º 16
0
 public function preprocess()
 {
     $this->header = 'Loan and Equity Mailing List';
     $this->title = 'Loan and Equity Mailing List';
     return parent::preprocess();
 }
Ejemplo n.º 17
0
 public function preprocess()
 {
     $this->header = 'Issued Dividend Report';
     $this->title = 'Issued Dividend Report';
     return parent::preprocess();
 }
Ejemplo n.º 18
0
 public function preprocess()
 {
     $this->header = 'Active Loan Report';
     $this->title = 'Active Loan Report';
     return parent::preprocess();
 }
Ejemplo n.º 19
0
 public function preprocess()
 {
     $this->title = _("Fannie") . " : " . _("WIC Product Sales Report");
     $this->header = _("WIC Product Sales Report");
     return parent::preprocess();
 }
Ejemplo n.º 20
0
 public function preprocess()
 {
     $this->title = _("Fannie") . " : " . _("Manufacturer Movement Report");
     $this->header = _("Manufacturer Movement Report");
     return parent::preprocess();
 }