コード例 #1
0
ファイル: StaffArAccountsPage.php プロジェクト: phpsmith/IS4C
 public function get_add_payid_handler()
 {
     global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_ROOT;
     $ret = array();
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $model = new CustdataModel($dbc);
     $model->CardNo($this->add);
     if (count($model->find()) == 0) {
         $ret['error'] = 'Mem# ' . $this->add . ' does not exist!';
     } else {
         $model->personNum(1);
         $model->load();
         $ret['name'] = $model->LastName() . ', ' . $model->FirstName();
         $dbc = FannieDB::get($FANNIE_TRANS_DB);
         $model = new ArLiveBalanceModel($dbc);
         $model->card_no($this->add);
         $balance = 0;
         if ($model->load()) {
             $balance = $model->balance();
         }
         $ret['balance'] = $balance;
         $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['StaffArPayrollDB']);
         $model = new StaffArAccountsModel($dbc);
         $model->card_no($this->add);
         $model->nextPayment(0);
         $model->payrollIdentifier($this->payid);
         $model->save();
     }
     echo json_encode($ret);
     return false;
 }
コード例 #2
0
 function recreate_views($con)
 {
     $db_name = $this->config->get('TRANS_DB');
     $con->query("DROP VIEW ar_history_today", $db_name);
     $model = new ArHistoryTodayModel($con);
     $model->createIfNeeded($db_name);
     $con->query("DROP VIEW ar_history_today_sum", $db_name);
     $model = new ArHistoryTodaySumModel($con);
     $model->createIfNeeded($db_name);
     $con->query("DROP VIEW ar_live_balance", $db_name);
     $model = new ArLiveBalanceModel($con);
     $model->addExtraDB($this->config->get('OP_DB'));
     $model->createIfNeeded($db_name);
     $con->query("DROP VIEW stockSumToday", $db_name);
     $model = new StockSumTodayModel($con);
     $model->createIfNeeded($db_name);
     $con->query("DROP VIEW equity_live_balance", $db_name);
     $model = new EquityLiveBalanceModel($con);
     $model->addExtraDB($this->config->get('OP_DB'));
     $model->createIfNeeded($db_name);
 }