function printFundsTable() { global $_pinkie; if (count($_pinkie->a_Expenses) == 0) { echo '<tr> <td>No Funds attached to this Pinkie!</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>'; return; } $_fund = 0; foreach ($_pinkie->a_Expenses as $_e) { $_fund = new Fund(); $_fund->i_FundID = $_e->f_FundID; $_fund->fromDatabase(); printf('<tr> <td>%s</td> <td>$%.2f</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>$%.2f</td> </tr>', $_fund->s_FundName, $_e->d_Amount, $_fund->s_Activity, $_fund->s_Fund, $_fund->s_Function, $_fund->s_CostCenter, $_fund->s_ProjectCode, $_fund->s_Balance); } }
public function fundSelectBox() { $fund_id = $this->read('fund_id'); $ret = '<select name="fund_id" id="fund_id">' . '<option value="0"' . ($fund_id == 0 ? 'selected="selected"' : '') . '>Not funded</option>'; foreach (Fund::getFunds() as $fund) { $ret .= '<option value="' . $fund['id'] . '" ' . ($fund_id == $fund['id'] ? 'selected="selected"' : '') . '>' . $fund['name'] . '</option>'; } $ret .= '</select>'; return $ret; }
public function funds() { $funds = Fund::getFunds(); $ret = array(); $default = isset($_REQUEST['fund_id']) ? $_REQUEST['fund_id'] : -1; $ret[] = array('id' => -1, 'name' => 'ALL', 'selected' => $default == -1); foreach ($funds as $fund) { $fund['selected'] = $default == $fund['id']; $ret[] = $fund; } $ret[] = array('id' => 0, 'name' => 'Not Funded', 'selected' => $default == 0); return $ret; }
function printFundsTable() { global $_pinkie; if (count($_pinkie->a_Expenses) == 0) { echo '<tr> <td>No Funds attached to this Pinkie!</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>'; return; } $_fund = 0; foreach ($_pinkie->a_Expenses as $_e) { $_fund = new Fund(); $_fund->i_FundID = $_e->f_FundID; $_fund->fromDatabase(); printf('<tr id="%s" amt="%s" fname="%s"> <td>%s</td> <td>$%.2f</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>$%.2f</td> </tr>', $_e->i_ExpenseID, $_e->d_Amount, $_fund->s_FundName, $_fund->s_FundName, $_e->d_Amount, $_fund->s_Activity, $_fund->s_Fund, $_fund->s_Function, $_fund->s_CostCenter, $_fund->s_ProjectCode, $_fund->s_Balance); // printf('<input type="hidden" id="expenseID[]" name="expenseID" value="%s">', $_e->i_ExpenseID); // printf('<input type="hidden" id="fund[]" value="%s">', $_e->f_FundID); // printf('<input type="hidden" id="amount[]" value="%s">', $_e->d_Amount); } }
public function censorBooth($id) { $check = Input::get('check', 0); $remark = Input::get('remark', ''); $interview = Input::get('interview', 0); DB::beginTransaction(); try { $booth = Booth::find($id); if (empty($booth)) { throw new Exception("无法获取到店铺信息", 10001); } // get fund if there is one if ($booth->b_with_fund) { $fund = Fund::where('b_id', '=', $id)->first(); if (empty($fund)) { throw new Exception("基金数据不匹配", 10001); } } else { $fund = false; } if ($check == 1) { if ($booth->b_status == 1) { throw new Exception("店铺已经审核过了", 10002); } if ($interview != 1) { $booth->b_status = 1; } if ($fund) { $fund->censorPass($interview); } } elseif ($check == 0) { $booth->b_status = 2; $booth->remark = $remark; if ($fund) { $fund->censorFailed(); } } $booth->censor(); $re = Tools::reTrue('审核店铺成功'); DB::commit(); } catch (Exception $e) { $re = Tools::reFalse($e->getCode(), '审核店铺失败:' . $e->getMessage()); DB::rollback(); } return Response::json($re); }
public function allocate($comment) { if ($this->f_status == 1) { throw new Exception("该借款已放", 10001); } $this->f_status = 1; $fund = Fund::find($this->f_id); if (empty($fund)) { throw new Exception("没有找到相关的基金信息", 10001); } // do transaction $userBankCard = UserProfileBankcard::find($fund->u_id); if (empty($userBankCard)) { throw new Exception("没有找到用户相关的银行卡信息", 10001); } $this->addAllocLog($comment); return $this->save(); }
function saveFund() { $response = new Response(); try { $id = $this->input->post("scheme-id"); $name = $this->input->post("fund-name"); $amount = $this->input->post("fund-amt"); $scheme = $this->findById("Scheme", $id); if ($scheme == null) { throw new RuntimeException("Invalid Request..!"); } $fund = new Fund(); $fund->setScheme($scheme); $fund->setCreated(new DateTime()); $fund->setUsedAmount(0); $fund->setName($name); $fund->setAmount($amount); $this->save($fund); } catch (Exception $e) { $response->setStatus(false); $response->setErrorMessage($e->getMessage()); } $this->output->set_content_type('application/json')->set_output(json_encode($response)); }
/** * Declares an association between this object and a Fund object. * * @param Fund $v * @return Donation The current object (for fluent API support) * @throws PropelException */ public function setFund(Fund $v = null) { if ($v === null) { $this->setFundId(NULL); } else { $this->setFundId($v->getId()); } $this->aFund = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Fund object, it will not be re-added. if ($v !== null) { $v->addDonation($this); } return $this; }
</body> </html> <?php } elseif ($s_reason == 'view') { // --------------------------------------------------------------------------- // The user can view all the variables associated with a single Fund. // --------------------------------------------------------------------------- // Error catching. if (!isset($_GET['fid'])) { header("Location: ./fund.php?reason=list"); } // Get the Funds $_fid = $_GET['fid']; $_fund = new Fund(); $_fund->i_FundID = $_fid; $_fund->fromDatabase(); ?> <!DOCTYPE html> <html> <head> <?php printHeaderInfo(); ?> <title>ePinkies2 Fund</title> <script type="text/javascript" src="js/functions.js"></script> <script type="text/javascript" src="js/fund.js"></script> </head>
<?php header('Content-Type:text/html;charset=utf-8'); /* * 外观模式【股票】 * Author: Kaysen */ define('ROOT_PATH', dirname(__FILE__)); require_once ROOT_PATH . '/../../Loader.php'; $jijin = new Fund(); $jijin->buyFund(); $jijin->sellFund();
' class='date-pick changeInput subscriptionStartDate costHistorySubStart' /> </td> <td> <input type='text' value='<?php echo normalize_date($payment['subscriptionEndDate']); ?> ' class='date-pick changeInput subscriptionEndDate costHistorySubEnd' /> </td> <?php } ?> <td> <select class='changeDefaultWhite changeInput fundID costHistoryFund' id='searchFundID'> <option value=''></option> <?php $FundType = new Fund(); $Funds = array(); if (array_key_exists('fundID', $payment) && isset($payment['fundID'])) { $Funds = $FundType->getUnArchivedFundsForCostHistory($payment['fundID']); } else { $Funds = $FundType->getUnArchivedFunds(); } foreach ($Funds as $fund) { $fundCodeLength = strlen($fund['fundCode']) + 3; $combinedLength = strlen($fund['shortName']) + $fundCodeLength; $fundName = $combinedLength <= 50 ? $fund['shortName'] : substr($fund['shortName'], 0, 49 - $fundCodeLength) . "…"; $fundName .= " [" . $fund['fundCode'] . "]</option>"; echo "<option"; if ($payment['fundID'] == $fund['fundID']) { echo " selected"; }
$available_columns[$value] = $key; } } else { $error = _("Unable to get columns headers from the file"); } } else { $error = _("Unable to open the uploaded file"); } if ($error) { print "<p>" . _("Error: ") . $error . "</p>"; } else { // Let's analyze this file if (($handle = fopen($uploadfile, "r")) !== FALSE) { $row = 0; while (($data = fgetcsv($handle)) !== FALSE) { $Fund = new Fund(); $funds = $Fund->allAsArray(); // Convert to UTF-8 $data = array_map(function ($row) { return mb_convert_encoding($row, 'UTF-8'); }, $data); $Fund->fundCode = array_values($data)['0']; $Fund->shortName = array_values($data)['1']; $Fund->save(); $row++; } print "<h2>" . _("Results") . "</h2>"; print "<p> {$row} " . _("rows have been processed.") . "</p>"; } } } else {
<?php $instanceArray = array(); $obj = new Fund(); $instanceArray = $obj->allAsArray(); echo "<div class='adminRightHeader'>Fund</div>"; if (count($instanceArray) > 0) { ?> <table class='linedDataTable' > <tr> <th>Code</th> <th>Name</th> <th style='width:20px;'> </th> <th style='width:20px;'> </th> <th style='width:20px;'> </th> </tr> <?php foreach ($instanceArray as $instance) { echo "<tr>"; echo "<td>" . $instance['fundCode'] . "</td>"; echo "<td id='fund-short-name'>" . $instance['shortName'] . "</td>"; echo "<td><a href='ajax_forms.php?action=getAdminFundUpdateForm&updateID=" . $instance['fundID'] . "&height=178&width=260&modal=true' class='thickbox'><img src='images/edit.gif' alt='edit' title='edit'></a></td>"; echo "<td><a href='javascript:deleteFund(\"Fund\", \"" . $instance['fundID'] . "\");'><img src='images/cross.gif' alt='remove' title='remove'></a></td>"; if ($instance['archived'] == 1) { echo "<td><input type='checkbox' title='Archive' id='archived' checked value=" . $instance['archived'] . " onclick='javascript:archiveFund(this.checked, \"" . $instance['fundID'] . "\", \"" . $instance['fundCode'] . "\", \"" . $instance['shortName'] . "\");' > </input></td>"; } else { echo "<td><input type='checkbox' title='Archive' id='archived' onclick='javascript:archiveFund( this.checked, \"" . $instance['fundID'] . "\", \"" . $instance['fundCode'] . "\", \"" . $instance['shortName'] . "\");' > </input></td>"; } echo "</tr>"; } ?>
public function confirm() { $this->getSummary(); foreach ($this->_bills as $key => $bill) { $booth = Booth::find($key); $wallet = UsersWalletBalances::find($booth->u_id); if ($booth->b_with_fund) { $fund = Fund::where('b_id', '=', $key)->where('t_is_close', '=', 0)->first(); if (empty($fund)) { $wallet->putIn($bill['total']['paied']); } } else { $wallet->putIn($bill['total']['paied']); } } $this->o_shipping_status = 10; return $this->save(); }
public static function clearByUser($u_id) { $record = Fund::where('u_id', '=', $u_id)->where('t_status', '=', 0)->first(); $f_id = 0; if (!empty($record)) { $f_id = $record->t_id; $record->delete(); } return $f_id; }
public static function getById($fund_id) { $fund = new Fund(); $fund->loadById($fund_id); return $fund; }
<?php $fundID = $_POST['fundID']; $fundCode = $_POST['fundCode']; $shortName = $_POST['shortName']; $archived = $_POST['archived']; if ($fundID != '') { $instance = new Fund(new NamedArguments(array('primaryKey' => $fundID))); } else { $instance = new Fund(); } $instance->fundCode = $fundCode; $instance->shortName = $shortName; if ($archived == 'true') { $archived = 1; } else { $archived = 0; } $instance->archived = $archived; try { $instance->save(); } catch (Exception $e) { echo $e->getMessage(); }
public function postBooth() { // base infos $token = Input::get('token', ''); $u_id = Input::get('u_id', ''); // booth type $boothType = Input::get('type'); // product category $productCate = Input::get('prod_cate'); // booth title $boothTitle = Input::get('title'); // booth position $boothLng = Input::get('lng'); $boothLat = Input::get('lat'); // product source $productSource = Input::get('prod_source'); // customer group $cusomerGroup = Input::get('cust_group'); // promo strategy $promoStratege = Input::get('promo_strategy'); // with fund $withFund = Input::get('fund', 0); $booth_cate = Input::get('cate', 0); // profit ratio $profitRate = Input::get('profit'); // loan amount $loan = Input::get('loan'); // how to drow loan $loanSchema = Input::get('loan_schema', ''); DB::beginTransaction(); try { $user = User::chkUserByToken($token, $u_id); $user->load(['school']); $booth = Booth::where('u_id', '=', $u_id)->first(); if (empty($booth)) { $booth = new Booth(); } else { if ($booth->b_status == 1) { throw new Exception("您已经申请过店铺了", 7001); } } $school = $user->school; $booth->s_id = $school->t_id; $booth->c_id = $school->t_city; $booth->pv_id = $school->t_province; $booth->u_id = $u_id; $booth->b_title = $boothTitle; $booth->b_desc = ''; $booth->latitude = $boothLat; $booth->longitude = $boothLng; $booth->b_product_source = $productSource; $booth->b_product_category = $productCate; $booth->b_customer_group = $cusomerGroup; $booth->b_promo_strategy = $promoStratege; $booth->b_with_fund = $withFund; $booth->b_type = $boothType; $booth->b_cate = $booth_cate; $b_id = $booth->register(); if ($withFund == 1) { $fund = Fund::where('b_id', '=', $booth->b_id)->first(); if (empty($fund)) { $fund = new Fund(); } else { if ($fund->t_status > 2) { throw new Exception("基金已经发放", 1); } } $fund->u_id = $u_id; $fund->t_apply_money = $loan; $fund->b_id = $b_id; $fund->t_profit_rate = $profitRate; $f_id = $fund->apply(); $schema = 0; $allotedAmount = 0; $loanSchema = json_decode($loanSchema, true); if (!is_array($loanSchema)) { throw new Exception("请传入正确的提款计划", 7001); } // clear all exists schema DB::table('repayments')->where('f_id', '=', $f_id)->delete(); foreach ($loanSchema as $key => $percentage) { $percentage = $percentage / 100; $schema++; if ($schema == count($loanSchema)) { $amount = $loan - $allotedAmount; } else { $amount = $loan * $percentage; $allotedAmount += $amount; } $repayment = new Repayment(); $repayment->f_id = $f_id; $repayment->f_re_money = $amount; $repayment->f_schema = $schema; $repayment->f_percentage = $percentage * 100; $repayment->apply(); } } else { // if without fund, no need to censor $booth->b_status = 1; $booth->save(); } $re = Tools::reTrue('申请成功'); DB::commit(); } catch (Exception $e) { $re = Tools::reFalse($e->getCode(), '申请失败:' . $e->getMessage()); DB::rollback(); } return Response::json($re); }
public function retriveLoan($id) { DB::beginTransaction(); $now = new DateTime(); try { $current_loan = Repayment::find($id); if (empty($current_loan)) { throw new Exception("没有找到请求的放款", 6001); } $fund = Fund::find($current_loan->f_id); if (empty($fund)) { throw new Exception("没有找到相关的基金", 6001); } $fund->load('loans'); $current_income = $fund->getCurrentPeriodIncome(); $current_loan->f_income = $current_income; $profit = $current_income - $current_loan->f_re_money; if ($profit > 0) { $wallet = UsersWalletBalances::find($fund->u_id); if (empty($wallet)) { throw new Exception("没有获取到用户钱包", 6001); } $wallet->putIn($profit); $current_loan->f_status = 4; $current_loan->f_money = $current_loan->f_re_money; } elseif ($profit == 0) { $current_loan->f_status = 3; $current_loan->f_money = $current_loan->f_re_money; } elseif ($profit < 0) { $current_loan->f_status = 2; $current_loan->f_money = $current_loan->f_income; } $current_loan->repaied_at = $now->format('Y-m-d H:i:s'); $current_loan->save(); $fund->load('loans'); $all_repaied = true; $total_loan = 0; $total_repay = 0; foreach ($fund->loans as $key => $loan) { if ($loan->f_status < 3) { $all_repaied = false; } $total_loan += $loan->f_re_money; $total_repay += $loan->f_money; } if ($all_repaied) { $total_profit = $total_repay - $total_loan; if ($profit > 0) { $qnck_profit = $total_loan * (100 + $fund->t_profit_rate) / 500; $wallet = UsersWalletBalances::find($fund->u_id); if (empty($wallet)) { throw new Exception("没有获取到用户钱包", 6001); } $wallet->getOut($qnck_profit); } $fund->t_is_close = 1; $fund->closed_at = $now->format('Y-m-d H:i:s'); } else { $fund->t_is_close = 0; } $msg = new MessageDispatcher($fund->u_id); $msg->fireTextToUser('您基金的第' . $current_loan->f_schema . '次已结账, 金额:' . $current_income); $fund->save(); $re = Tools::reTrue('回收放款成功'); DB::commit(); } catch (Exception $e) { $re = Tools::reFalse($e->getCode(), '回收放款失败:' . $e->getMessage()); DB::rollback(); } return Response::json($re); }
<tr> <td class='searchRow'><label for='searchFund'><b><?php echo _("Fund"); ?> </b></label> <br /> <select name='search[fund]' id='searchFund' style='width:150px' class ='changeInput'> <option value=''>All</option> <?php if ($search['fund'] == "none") { echo "<option value='none' selected>" . _("(none)") . "</option>"; } else { echo "<option value='none'>" . _("(none)") . "</option>"; } $fundType = new Fund(); foreach ($fundType->allAsArray() as $fund) { $fundCodeLength = strlen($fund['fundCode']) + 3; $combinedLength = strlen($fund['shortName']) + $fundCodeLength; $fundName = $combinedLength <= 50 ? $fund['shortName'] : substr($fund['shortName'], 0, 49 - $fundCodeLength) . "…"; $fundName .= " [" . $fund['fundCode'] . "]</option>"; echo "<option value='" . $fund['fundID'] . "'>" . $fundName . "</option>"; } ?> </select> </td> </tr> <tr>
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Fund $value A Fund object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Fund $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
} public function index() { $view_page = "fundview/index"; include_once ROOT_PATH . "admin/views/admin/container.php"; } public function donations() { $id = $_GET['id']; $thisFund = $this->fundrepository->get_by_id($id); $view_page = "fundview/donations"; include_once ROOT_PATH . "admin/views/admin/container.php"; } } //OBJECT OF adminusercontroller $fund = new Fund(); //IF m IS SET, SET IT TO $method, ELSE DEFAULT IT TO index if (isset($_GET['m'])) { $method = $_GET['m']; } else { $method = "index"; } switch ($method) { case "index": $fund->index(); break; case "donations": $fund->donations(); break; default: $fund->index();
<?php include_once 'includes/functions.php'; include_once 'includes/sessionFunctions.php'; include_once 'includes/fund_object.php'; secureSessionStart(); if (!isset($_POST['fundName']) || $_POST['fundName'] == '') { onError("Fund Submission Error!", "No Fund name set! Can not update database without Fund name"); } $_fund = new Fund(); if (isset($_POST['fundID'])) { $_fund->i_fundID = $_POST['fundID']; } $_fund->s_FundName = $_POST['fundName']; $_fund->s_Activity = $_POST['activity']; $_fund->s_Fund = $_POST['fund']; $_fund->s_Function = $_POST['function']; $_fund->s_CostCenter = $_POST['costCenter']; $_fund->s_ProjectCode = $_POST['projectCode']; $_fund->s_Balance = $_POST['balance']; $_fund->b_Active = $_POST['active']; $_fund->toDatabase(); // All done, redirect to the vendor list page. header("Location: ./fund.php?reason=list");