public function amortize() { global $frequency; $type = getAccountType($this->type, true); $amortTable = array(); if ($type == 'installment') { for ($d = 0; $d < $this->term; $d++) { $amortData = array('payment-date' => $this->due_date->add(new DateInterval("P{$frequencyD}"))); } } else { if ($type == 'revolving') { } } }
public function calculate() { $transaction = array(); $fundsAvail = false; //make sure source account has sufficient funds switch (getAccountType($this->srcAccount['type'], true)) { //cash accounts case 'asset': if ($this->srcAccount['balance'] > $this->transAmount) { $fundsAvail = true; } break; //credit accounts //credit accounts case 'revolving': if ($this->srcAccount['credit_limit'] - $this->srcAccount['balance'] > $this->transAmount) { $fundsAvail = true; } break; } if ($fundsAvail) { //debit transaction amount from source account $transaction['srcAccount']['balance'] = $this->srcAcount['balance'] - $this->transAmount; //get account type switch (getAccountType($this->transAccount['type'], true)) { case 'expense': //debit transaction amount from transaction account $transaction['transAccount']['balance'] = $this->transAccount['balance'] - $this->transAmount; //update transaction account due date $transaction['transAccount']['due_date'] = date('Y-m-d', strtotime($this->transAccount['due_date'], getFrequencyOffest($this->transAccount['repeat']))); break; case 'asset': case 'installment': case 'credit': case 'revolving': //credit transaction amount to transaction account $transaction['transAccount']['balance'] = $this->transAccount['balance'] + $this->transAmount; break; } } foreach ($transaction as $array => $account) { $errors = array(); $query = "UPDATE accounts SET "; $count = 0; foreach ($account as $key => $value) { if ($count < count($account)) { $query .= $key . ' = ?, '; } else { $query .= $key . ' = ? '; } ++$count; } $params = getQueryParams($account); $query .= "WHERE ID = " . $account['ID']; $queryData[$array]['query'] = $query; $queryData[$array]['params'] = $params; } $transaction['transaction'] = array('transaction_account' => $this->transAccount['ID'], 'transaction_source' => $this->srcAccount['ID'], 'transaction_amount' => $this->transAccount, 'transaction_date' => $this->transDate, 'transaction_memo' => $this->transMemo, 'user' => $_SESSION['user_id']); $query = 'INSERT INTO transactions ( '; $count = 0; foreach ($transactions as $key => $value) { if ($count < count($transaction)) { $params .= $key . ', '; $vars .= '?, '; } else { $params .= $key; $vars .= '?'; } } $query .= $params . ' ) VALUES ( ' . $vars . ' )'; $params = getQueryParams($transaction); $queryData['transaction']['query'] = $query; $queryData['transaction']['params'] = $params; if ($result = processQuery($queryData, false)) { //An errors has occured if (isset($result['errors'])) { $transaction['errors'] = $result['errors']; return $transaction; } $_SESSION['transaction'] = $transaction; } return $transaction; }
$tao_uid = $accountinfo['uid']; //会员名 $membername = $accountinfo['nick']; //客户买家信用 if (is_array($accountinfo['buyer_credit'])) { $account_buyer_credit_tmp = $accountinfo['buyer_credit']['level']; $account_buyer_credit = getHuangGuanInfo($account_buyer_credit_tmp); } //客户卖家信用 if (is_array($accountinfo['seller_credit'])) { $account_seller_credit_tmp = $accountinfo['seller_credit']['level']; $account_seller_credit = getHuangGuanInfo($account_seller_credit_tmp); } //客户类型 $account_type_tmp = $accountinfo['type']; $account_type = getAccountType($account_type_tmp); //支付宝账号 $alipay_account = $buyer_alipay_no; //VIP信息 $vipinfo_tmp = $accountinfo['vip_info']; $vipinfo = getVipInfo($vipinfo_tmp); //手机 $phone = $receiver_phone; //电话 $tel = $receiver_tel; //Email $email = $buyer_email; //客户最新订单时间 $lastorderdate = $createdtime_order; //订单金额 $ordertotal = $total;
<?php include_once '../../php/config.php'; include_once '../../php/ajax.php'; include_once '../../php/class-account.php'; sec_session_start(); if (isset($_SESSION['xcp_id'], $_SESSION['cipher']) && $_SESSION['xcp_id'] == hash('sha512', $_SESSION['cipher'], $_SERVER['HTTP_USER_AGENT'])) { $account = new Account($_SESSION['account_id']); $title = $account->getName() . ' Amoritzation Schedule'; include_once '../../php/xcp-head.php'; ?> <body> <h2><?php echo ucwords($account->getName() . ' ' . getAccountType($account->getType())); ?> </h2> <table id="amort" width="100%"> <thead> <th>Payment</th> <th>Payment Date</th> <th>Payment Amount</th> <th>Interest Portion</th> <th>Other Charges</th> <th>Prinicpal Portion</th> <th>Prinicpal Balance</th> </thead> <tbody> <?php foreach ($data as $key => $payment) { ?>
public function account() { $account = new AccountModel(); $type = trim($_GET['type']); $account_type = getAccountType(); $sql = "select * from account where 1=1"; if (strlen($type) != 0) { $sql .= " and type='{$type}'"; } $account_res = $account->query($sql); $this->assign('type_sel', $type); $this->assign('account_res', $account_res); $this->assign('account_type', $account_type); $this->display(); }
/** * getAccountCos * @param string $idOrNameAccount account id or account name * @param string $returnType get the COS ID or NAME * @param string $type value of the account (auto, name, id) * @return string COS id or name */ function getAccountCos($idOrNameAccount, $returnType = "NAME", $type = "auto") { if ($type == "auto") { $realType = getAccountType($idOrNameAccount); } else { $realType = $type; } if ($realType == "name") { $accountId = $this->getAccountId($idOrNameAccount); } else { $accountId = $idOrNameAccount; } $result = null; $params = array(new SoapVar('<account by="' . $realType . '">' . $idOrNameAccount . '</account>', XSD_ANYXML)); try { $result = $this->auth->execSoapCall("GetAccountInfoRequest", $params); $result = $result['SOAP:ENVELOPE']['SOAP:BODY']['GETACCOUNTINFORESPONSE']['COS'][$returnType]; } catch (SoapFault $exception) { $result = $exception; } return $result; }