/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($for = null, $mass_id = null) { $model = new MassBooking(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['MassBooking'])) { $tr = Yii::app()->db->beginTransaction(); $acct = Account::get('Mass Bookings'); $trans = new Transaction(); $trans->type = 'credit'; $trans->account_id = $acct->id; $trans->amount = $_POST['amount']; $trans->created = Yii::app()->dateFormatter->formatDateTime(time(), 'short', 'medium'); $trans->creator = Yii::app()->user->id; $trans->descr = "Mass booking"; if ($trans->save()) { $model->attributes = $_POST['MassBooking']; $model->trans_id = $trans->id; if ($model->save()) { $trans->saveAttributes(array('descr' => "Mass booking #" . $model->id)); $tr->commit(); $this->redirect(array('view', 'id' => $model->id)); return; } } $tr->rollback(); } $parms = array('model' => $model); $parms['mass_dt'] = isset($for) ? $for : ''; $parms['mass_id'] = isset($mass_id) ? $mass_id : ''; $this->render('create', $parms); }
/** * Get the account information for this user. * * @throws \Exception * * @return Account */ public function getAccount() { $uuid = $this->getProperty('id'); $url = $this->makeAbsoluteUrl('/api/users'); $account = Account::get($uuid, $url, $this->client); if (!$account) { throw new \Exception("Account not found for user: " . $uuid); } return $account; }
public function accountCharts() { $accounts = Account::get(); $AC = new AccountController(); $date = new Carbon('today'); $count = 0; foreach ($accounts as $account) { Auth::loginUsingId($account->fireflyuser_id); // remove cached entry: $key = cacheKey('Account', 'homeOverviewChart', $account->id, $date); Cache::forget($key); $AC->homeOverviewChart($account->id, $date); $count++; Auth::logout(); } return 'Regenerated ' . $count . ' account charts.'; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $accounts = $this->account->get(); return View::make('accounts.index', compact('accounts')); }
function get_balances() { if (!$this->auth->logged_in()) { $this->auth->login(); return; } $balances = array(); $accounts = new Account(); $accounts->get(); foreach ($accounts->all as $account) { $balances[$account->id]['id'] = $account->id; $balances[$account->id]['name'] = $account->name; $balances[$account->id]['number'] = $account->number; $transaction = new Transaction(); $transaction->select_sum('credit', 'total_credit'); $transaction->select_sum('debit', 'total_debit'); $transaction->where_related_account('id', $account->id)->get(); $balances[$account->id]['balance'] = $transaction->total_credit - $transaction->total_debit; } return $balances; }
/** * Get the account for the project's owner. * * @return Account|false */ public function getOwner() { $uuid = $this->getProperty('owner'); $url = $this->makeAbsoluteUrl('/api/users', $this->getLink('project')); return Account::get($uuid, $url, $this->client); }
public function actionIndex() { $dataProvider = new CActiveDataProvider('Transaction', array('criteria' => array('condition' => "account_id = " . Account::get("Collection")->id))); $this->render('index', array('dataProvider' => $dataProvider)); }
public function getAccount() { $accountController = new Account($this->user, $this->token); $account = $accountController->get(); return $account; }
function account_get() { $filter = $this->get('filter')["filters"]; $obj = new Account(null, $this->entity); $obj->where($filter[0]["field"], $filter[0]["value"]); $obj->get(); $data = array(); foreach ($obj as $value) { $data[] = array("id" => $value->id, "name" => $value->name); } $this->response($data, 200); }
private function account_summary($xml) { if (!$this->bind_check($xml)) { return; } $uid = $this->user_profile->id; $from = $xml->FromUserName; $to = $xml->ToUserName; $url = _url('/user'); if (ENV == 'dev') { $url = preg_replace('/^https/', 'http', $url); } $account = Account::get($uid); if (!$account) { $account = new Account(); } $unuse_coupon = Coupon::total_available($uid); // $my_profit = $account->my_profit(); $repay_sum_need = Repay::get_sum_amount_by_uid($uid, Repay::STATUS_NEW); $prj_count = Order::get_prj_count_by_uid($uid, array(Order::STATUS_PAYDONE, Order::STATUS_NEW, Order::STATUS_BLOCK)); // $platform_interest_done = PlatformInterest::get_total_amount_by_uid($uid, Trade::STATUS_DONE); $platform_interest_new = PlatformInterest::get_total_amount_by_uid($uid, Trade::STATUS_NEW); // $stock_transfer_done = StockTransfer::get_total_amount_by_uid($uid, Trade::STATUS_DONE); $lqjh_account = LqjhAccount::get($uid); // $qxjh_amount = ApolloOrder::get_amount_by_uid($uid, ApolloOrder::STATUS_PAYDONE); if ($lqjh_account) { $lqjh_amount = $lqjh_account->get_amount(); } else { $lqjh_amount = 0; } $bxjh_repay_new = BxjhRepay::get_sum_amount_by_uid($uid, BxjhRepay::STATUS_NEW); // $bxjh_platform_interest_new = BxjhPlatformInterest::get_sum_amount_by_uid($uid, BxjhPlatformInterest::STATUS_NEW); $repay_sum_already = Account::get_total_profit($uid); $asset = Account::get_total_asset($uid); $remain_amount = Account::get_remain_amount($uid); $ret_text = ''; $ret_text .= "总资产 (元): " . Money::show_money($asset) . "\n"; $ret_text .= "账户余额(元): " . Money::show_money($remain_amount) . "\n"; $ret_text .= "累计收益(元): " . Money::show_money($repay_sum_already) . "\n"; $ret_text .= "\n"; // $ret_text .= "在投项目(个): " . $prj_count . "\n"; $ret_text .= "待收本金(元): " . Money::show_money($repay_sum_need->total_amount - $repay_sum_need->total_interest + $bxjh_repay_new->total_amount - $bxjh_repay_new->total_interest) . "\n"; $ret_text .= "零钱金额(元): " . Money::show_money($lqjh_amount) . "\n"; // $ret_text .= "待收利息(元): " . Money::show_money($repay_sum_need->total_interest+ $platform_interest_new) . "\n"; $ret_text .= "\n"; $ret_text .= "未用投资券总价值(元): " . Money::show_money($unuse_coupon) . "\n\n"; $ret_text = preg_replace('/<\\/?span>/', '', $ret_text); $news_arr = array(array('title' => '账户概览', 'desc' => $ret_text, 'link' => $url)); $this->wx_reply->imm_reply_news($to, $from, $news_arr); }
$thedate = "{$day}.{$month}.{$year}"; $smarty->assign('tpl_thedate', $thedate); $smarty->assign("tpl_title", "Gast Konto"); if ($request->GetVar('type', 'get') == "edit") { $smarty->assign('tpl_nav', 'gast'); $smarty->assign('tpl_type', 'edit'); } else { $smarty->assign('tpl_nav', 'showgast'); $smarty->assign('tpl_type', 'show'); } if ($request->GetVar('do', 'get') == "del") { $account->del($request->GetVar('id', 'get')); } $smarty->assign('tpl_subnav', 'account'); if ($request->GetVar('guestid', 'get') !== $request->undefined) { $guestid = $request->GetVar('guestid', 'get'); } $smarty->assign('tpl_guestid', $guestid); if ($request->GetVar('showall', 'get') == 'true') { $number = 0; } else { $number = 10; } if ($request->GetVar('frm_description', 'post') !== $request->undefined) { $account->book($guestid, $request->GetVar('frm_bookingid', 'post'), $request->GetVar('frm_date_payment', 'post'), $request->GetVar('frm_description', 'post'), $request->GetVar('frm_amount', 'post'), $request->GetVar('frm_paycat', 'post'), -1, false); } $smarty->assign('tpl_gast', $guest->getGuest($guestid)); $smarty->assign('tpl_accounts', $account->get($guestid, $number)); $smarty->assign('tpl_openbookings', $account->getOpenBookings($guestid)); $smarty->assign('tpl_pcats', $pcat->getall()); $smarty->display('account.tpl');
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($fid = null) { $model = new Subscription(); $parms = array(); if (isset($_POST['Subscription']) and isset($_POST['Subscription']['family_id'])) { $fid = $_POST['Subscription']['family_id']; } if (isset($fid)) { $family = Families::model()->findByPk($fid); $parms['family'] = $family; $dt = $this->getStartDate($family); $parms['start_dt'] = $dt; Yii::trace("SC.create: fid:" . $family->id . ", dt=" . date_format($dt, 'Y-m-d'), 'application.controllers.SubscriptionController'); } // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Subscription'])) { $till = $_POST['Subscription']['till']; $amt = $_POST['Subscription']['amount']; $start_dt = new DateTime(date_format($dt, 'Y-m-d')); $end_dt = new DateTime(date_format($dt, 'Y-m-d')); $end_dt->add(new DateInterval('P' . $till . 'M')); $tr = Yii::app()->db->beginTransaction(); $trans = new Transaction(); $acct = Account::get('Family Subscriptions'); $trans->account_id = $acct->id; $trans->type = 'credit'; if ('total' == $_POST['duration']) { $total = $amt; $amt = $amt / $till; } else { $total = $till * $amt; } $trans->amount = $total; $trans->created = Yii::app()->dateFormatter->formatDateTime(time(), 'short', 'medium'); $trans->creator = Yii::app()->user->id; $trans->descr = "Family #" . $family->id . ' subscription from ' . date_format($start_dt, 'M Y') . ' to ' . date_format($end_dt, 'M Y'); if ($trans->save()) { $model = new Subscription(); $model->paid_by = $_POST['Subscription']['paid_by']; $model->family_id = $family->id; $model->start_month = date_format($start_dt, 'n'); $model->start_year = date_format($start_dt, 'Y'); $model->end_month = date_format($end_dt, 'n'); $model->end_year = date_format($end_dt, 'Y'); $model->amount = $amt; $model->trans_id = $trans->id; if ($model->save()) { $tr->commit(); $this->redirect(array('view', 'id' => $model->id)); return; } } $tr->rollback(); } $parms['model'] = $model; $this->render('create', $parms); }