public function get_id_handler() { global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB; $bridge = GumLib::getSetting('posLayer'); $this->custdata = $bridge::getCustdata($this->id); $this->meminfo = $bridge::getMeminfo($this->id); // bridge may change selected database $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']); $this->maillog = new GumEmailLogModel($dbc); $this->maillog->card_no($this->id); $this->loans = array(); $model = new GumLoanAccountsModel($dbc); $model->card_no($this->id); foreach ($model->find('loanDate') as $obj) { $this->loans[] = $obj; } $this->equity = array(); $model = new GumEquitySharesModel($dbc); $model->card_no($this->id); foreach ($model->find('tdate') as $obj) { $this->equity[] = $obj; } $this->dividends = array(); $model = new GumDividendsModel($dbc); $model->card_no($this->id); foreach ($model->find('yearEndDate') as $obj) { $this->dividends[] = $obj; } $this->settings = new GumSettingsModel($dbc); return true; }
function post_confirmEndDate_confirmRate_handler() { global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']); $num_days = $this->fyLength($this->confirmEndDate); $info = $this->calculateHoldings($this->confirmEndDate); $model = new GumDividendsModel($dbc); foreach ($info as $cn => $shares) { foreach ($shares as $days => $value) { $model->reset(); $model->card_no($cn); $model->yearEndDate($this->confirmEndDate); $model->equityAmount($value); $model->daysHeld($days); $model->dividendRate($this->confirmRate / 100.0); $dividend = $value * ($this->confirmRate / 100.0) * ($days / (double) $num_days); $model->dividendAmount($dividend); $model->save(); } } header('Location: GumIssueDividendPage.php?done=1'); return false; }