Example #1
0
 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;
 }