本文整理汇总了PHP中get_balance函数的典型用法代码示例。如果您正苦于以下问题:PHP get_balance函数的具体用法?PHP get_balance怎么用?PHP get_balance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_balance函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display_trial_balance
function display_trial_balance()
{
global $table_style, $path_to_root;
start_table($table_style);
$tableheader = "<tr>\n <td rowspan=2 class='tableheader'>" . tr("Account") . "</td>\n <td rowspan=2 class='tableheader'>" . tr("Account Name") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Brought Forward") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("This Period") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Balance") . "</td>\n\t\t</tr><tr>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n <td class='tableheader'>" . tr("Credit") . "</td>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n\t\t<td class='tableheader'>" . tr("Credit") . "</td>\n <td class='tableheader'>" . tr("Debit") . "</td>\n <td class='tableheader'>" . tr("Credit") . "</td>\n </tr>";
echo $tableheader;
$k = 0;
$accounts = get_gl_accounts();
while ($account = db_fetch($accounts)) {
if (is_account_balancesheet($account["account_code"])) {
$begin = null;
} else {
$begin = begin_fiscalyear();
if ($_POST['TransFromDate'] < $begin) {
$begin = $_POST['TransFromDate'];
}
$begin = add_days($begin, -1);
}
$prev_balance = get_balance($account["account_code"], $begin, $_POST['TransFromDate'], false, false);
$curr_balance = get_balance($account["account_code"], $_POST['TransFromDate'], $_POST['TransToDate']);
if (check_value("NoZero") && !$prev_balance && !$curr_balance) {
continue;
}
alt_table_row_color($k);
$url = "<a href='{$path_to_root}/gl/inquiry/gl_account_inquiry.php?" . SID . "TransFromDate=" . $_POST["TransFromDate"] . "&TransToDate=" . $_POST["TransToDate"] . "&account=" . $account["account_code"] . "'>" . $account["account_code"] . "</a>";
label_cell($url);
label_cell($account["account_name"]);
display_debit_or_credit_cells($prev_balance);
display_debit_or_credit_cells($curr_balance);
display_debit_or_credit_cells($prev_balance + $curr_balance);
end_row();
}
end_table(1);
}
开发者ID:ravenii,项目名称:guardocs,代码行数:34,代码来源:gl_trial_balance.php
示例2: create_cost
function create_cost($arg1, $arg2, $arg3)
{
require_once __DIR__ . "/../../moneyio.php";
require_once __DIR__ . "/../../query.php";
$prepare = db_connect();
$query = $prepare->prepare(new_cost);
$query->bind_param('ssi', $arg1, $arg2, $arg3);
$query->execute();
$value = get_balance($arg3, $arg3, $arg3);
new_balance($value, $arg3);
return $query;
$prepare->close();
}
开发者ID:netSys0,项目名称:MoneyIO,代码行数:13,代码来源:cost_func.php
示例3: ROUND
$slt_trade_order_a = "SELECT * FROM trade_order WHERE active = 'yes' AND finished = 'no' AND type = 'sell' AND ROUND(price * 100000000) = ROUND({$price} * 100000000) AND currency = '{$currency}' AND user = '{$_SESSION['user_id']}'";
$rlt_trade_order_a = mysql_query($slt_trade_order_a);
if (mysql_num_rows($rlt_trade_order_a) == 0) {
$ins_trade_order_a = "INSERT INTO trade_order (type, user, currency, price, amount, completed, active, finished, filing_time, change_time, finishing_time) " . "VALUES ('sell', '{$_SESSION['user_id']}', '{$currency}', '{$price}', '{$slc_amount}', '0', 'yes', 'no', NOW(), NOW(), '0000-00-00 00:00:00')";
mysql_query($ins_trade_order_a);
$tid = mysql_insert_id();
add_transaction($_SESSION["user_id"], "out", "intern", $slc_amount, "SLC", "trade_placement", $tid);
} else {
$row_trade_order_a = mysql_fetch_assoc($rlt_trade_order_a);
$udt_trade_order_a = "UPDATE trade_order SET amount = amount + {$slc_amount}, change_time = NOW() WHERE id = {$row_trade_order_a['id']}";
mysql_query($udt_trade_order_a);
add_transaction($_SESSION["user_id"], "out", "intern", $slc_amount, "SLC", "trade_increase", $row_trade_order_a["id"]);
}
}
} elseif ($_POST["type"] == "buy") {
if ($cur_amount * 1.004 > get_balance($_SESSION["user_id"], $currency)) {
$errors[] = "You don't have that much.";
}
if (count($errors) == 0) {
$slt_trade_order_a = "SELECT * FROM trade_order WHERE active = 'yes' AND finished = 'no' AND type = 'buy' AND ROUND(price * 100000000) = ROUND({$price} * 100000000) AND currency = '{$currency}' AND user = '{$_SESSION['user_id']}'";
$rlt_trade_order_a = mysql_query($slt_trade_order_a);
if (mysql_num_rows($rlt_trade_order_a) == 0) {
$ins_trade_order_a = "INSERT INTO trade_order (type, user, currency, price, amount, completed, active, finished, filing_time, change_time, finishing_time) " . "VALUES ('buy', '{$_SESSION['user_id']}', '{$currency}', '{$price}', '{$slc_amount}', '0', 'yes', 'no', NOW(), NOW(), '0000-00-00 00:00:00')";
mysql_query($ins_trade_order_a);
$tid = mysql_insert_id();
add_transaction($_SESSION["user_id"], "out", "intern", $cur_amount * 1.004, $currency, "trade_placement", $tid, $cur_amount * 0.004);
} else {
$row_trade_order_a = mysql_fetch_assoc($rlt_trade_order_a);
$udt_trade_order_a = "UPDATE trade_order SET amount = amount + {$slc_amount}, change_time = NOW() WHERE id = {$row_trade_order_a['id']}";
mysql_query($udt_trade_order_a);
add_transaction($_SESSION["user_id"], "out", "intern", $cur_amount * 1.004, $currency, "trade_increase", $row_trade_order_a["id"], $cur_amount * 0.004);
开发者ID:rhartness,项目名称:slc24,代码行数:31,代码来源:new_order_cont.php
示例4: json_success
json_success($transactions);
}
json_error("Please provide an address, an array of addresses or an id.");
}
if (isset($_GET["id"])) {
// 4.2.4 Withdraw to withdrawal address by ID
$id = $_GET["id"];
if (!is_numeric($id)) {
json_error("Invalid id.");
}
$amount = $_GET["am"];
if (!is_numeric($amount) || $amount < 0.0001) {
json_error("Invalid amount.");
}
$amount = round($amount * 10000) / 10000;
if (withdrawal_with_fee($amount, 0, $user_id) > get_balance($user_id, "SLC")) {
json_error("You don't have that much.");
}
//mysql_query("LOCK TABLES transfer_withdrawal_address WRITE, transfer_withdrawal, transaction WRITE, transaction WRITE");
$slt_transfer_withdrawal_address_a = "SELECT * FROM transfer_withdrawal_address WHERE id = '{$id}'";
$rlt_transfer_withdrawal_address_a = mysql_query($slt_transfer_withdrawal_address_a);
$row_transfer_withdrawal_address_a = mysql_fetch_assoc($rlt_transfer_withdrawal_address_a);
if ($row_transfer_withdrawal_address_a["user"] != $user_id) {
json_error("Invalid id.");
}
// START
$type = $row_transfer_withdrawal_address_a["type"];
$address = $row_transfer_withdrawal_address_a["address"];
// NO TRANSACTION, NO WITHDRAWAL UNTIL HERE
if ($type == "extern") {
$itxid = add_transaction($user_id, "out", "extern", withdrawal_with_fee($amount, 1, $user_id), "SLC", "transfer_withdrawal", 0, withdrawal_with_fee($amount, 0, $user_id) - $amount);
开发者ID:rhartness,项目名称:slc24,代码行数:31,代码来源:api.php
示例5: lang_temp
?>
</span></h2>
<?php
if ($_SESSION["li"] != 1) {
echo lang_temp("?c=sign_up{$___l}", $_LANG[$l]["e_log_in"]);
}
?>
<table style="width: 100%; border-collapse: collapse;">
<?php
if ($_SESSION["li"] == 1) {
get_connection();
$slc_balance = get_balance($_SESSION["user_id"], "SLC");
$cur_balance = get_balance($_SESSION["user_id"], $currency);
$slt_trade_order_buy = "SELECT MAX(price) as price FROM trade_order WHERE currency = '{$currency}' AND type = 'buy' AND active = 'yes' AND finished = 'no'";
$rlt_trade_order_buy = mysql_query($slt_trade_order_buy);
$row_trade_order_buy = mysql_fetch_assoc($rlt_trade_order_buy);
$slt_trade_order_sell = "SELECT MIN(price) as price FROM trade_order WHERE currency = '{$currency}' AND type = 'sell' AND active = 'yes' AND finished = 'no'";
$rlt_trade_order_sell = mysql_query($slt_trade_order_sell);
$row_trade_order_sell = mysql_fetch_assoc($rlt_trade_order_sell);
?>
<tr>
<td style="vertical-align: top;">
<h3><a href="#" onclick="if (document.getElementById('buy_window').style.display == 'none') { document.getElementById('buy_window').style.display = 'block'; this.style.color = 'inherit'; selected = 'buy'; } else { document.getElementById('buy_window').style.display = 'none'; this.style.color = ''; selected = 'sell'; }"><?php
echo lang_temp("Solidcoins", $_LANG[$l]["e_header_buy"]);
?>
</a></h3>
开发者ID:rhartness,项目名称:slc24,代码行数:31,代码来源:exchange_cont.php
示例6: get_balance
<tbody>
<?php
$sr =1;
foreach($jobs as $job) { ?>
<tr>
<td><?php echo $sr;?></td>
<td><?php echo $job['job_id'];?></td>
<td><?php echo $job['companyname'] ? $job['companyname'] : $job['name'] ;?></td>
<td><?php echo $job['jobname'];?></td>
<td><?php echo $job['mobile'];?></td>
<td><?php echo $job['total'];?></td>
<td><?php echo $job['advance'];?></td>
<td>
<?php //echo $job['jpaid'] ? "<span class='paid'>Paid</span>" :$job['due'];?>
<?php
$user_bal = get_balance($job['customer_id']) ;
if($user_bal > 0 ) {
$due_amt = $job['due'] - $job['discount'];
echo $due_amt?$due_amt:"<span style='color:green;font-weight:bold;'>Paid</span>";
} else {
echo "-";
} ?>
</td>
<td width="60px;"><?php echo date('d-m-y',strtotime($job['created']));?>
</td>
<td width="50px;"><?php echo date('h:i A',strtotime($job['created']));?>
</td>
<td><?php echo $job['jstatus'];?></td>
<td><?php echo $job['receipt'];?></td>
<td><?php echo $job['bill_number'];?></td>
开发者ID:anujjaha,项目名称:ncybera,代码行数:31,代码来源:index.php
示例7: display_type
function display_type($type, $typename, &$dec, &$rep, $from, $to, $zero, $balances, $dimension, $dimension2)
{
global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal, $clear_trial_balance_opening;
$printtitle = 0;
//Flag for printing type name
//Get Accounts directly under this group/type
$accounts = get_gl_accounts(null, null, $type);
$begin = get_fiscalyear_begin_for_date($from);
if (date1_greater_date2($begin, $from)) {
$begin = $from;
}
$begin = add_days($begin, -1);
while ($account = db_fetch($accounts)) {
//Print Type Title if it has atleast one non-zero account
if (!$printtitle) {
$rep->row -= 4;
$rep->TextCol(0, 8, _("Group") . " - " . $type . " - " . $typename);
$printtitle = 1;
$rep->row -= 4;
$rep->Line($rep->row);
$rep->NewLine();
}
// FA doesn't really clear the closed year, therefore the brought forward balance includes all the transactions from the past, even though the balance is null.
// If we want to remove the balanced part for the past years, this option removes the common part from from the prev and tot figures.
if (@$clear_trial_balance_opening) {
$open = get_balance($account["account_code"], $dimension, $dimension2, $begin, $begin, false, true);
$offset = min($open['debit'], $open['credit']);
} else {
$offset = 0;
}
$prev = get_balance($account["account_code"], $dimension, $dimension2, $begin, $from, false, false);
$curr = get_balance($account["account_code"], $dimension, $dimension2, $from, $to, true, true);
$tot = get_balance($account["account_code"], $dimension, $dimension2, $begin, $to, false, true);
if ($zero == 0 && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) {
continue;
}
$rep->TextCol(0, 1, $account['account_code']);
$rep->TextCol(1, 2, $account['account_name']);
if ($balances != 0) {
if ($prev['balance'] >= 0.0) {
$rep->AmountCol(2, 3, $prev['balance'], $dec);
} else {
$rep->AmountCol(3, 4, abs($prev['balance']), $dec);
}
if ($curr['balance'] >= 0.0) {
$rep->AmountCol(4, 5, $curr['balance'], $dec);
} else {
$rep->AmountCol(5, 6, abs($curr['balance']), $dec);
}
if ($tot['balance'] >= 0.0) {
$rep->AmountCol(6, 7, $tot['balance'], $dec);
} else {
$rep->AmountCol(7, 8, abs($tot['balance']), $dec);
}
} else {
$rep->AmountCol(2, 3, $prev['debit'] - $offset, $dec);
$rep->AmountCol(3, 4, $prev['credit'] - $offset, $dec);
$rep->AmountCol(4, 5, $curr['debit'], $dec);
$rep->AmountCol(5, 6, $curr['credit'], $dec);
$rep->AmountCol(6, 7, $tot['debit'] - $offset, $dec);
$rep->AmountCol(7, 8, $tot['credit'] - $offset, $dec);
$pdeb += $prev['debit'] - $offset;
$pcre += $prev['credit'] - $offset;
$cdeb += $curr['debit'];
$ccre += $curr['credit'];
$tdeb += $tot['debit'] - $offset;
$tcre += $tot['credit'] - $offset;
}
$pbal += $prev['balance'];
$cbal += $curr['balance'];
$tbal += $tot['balance'];
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
$rep->Line($rep->row - 2);
$rep->NewPage();
}
}
//Get Account groups/types under this group/type
$result = get_account_types(false, false, $type);
while ($accounttype = db_fetch($result)) {
//Print Type Title if has sub types and not previously printed
if (!$printtitle) {
$rep->row -= 4;
$rep->TextCol(0, 8, _("Group") . " - " . $type . " - " . $typename);
$printtitle = 1;
$rep->row -= 4;
$rep->Line($rep->row);
$rep->NewLine();
}
display_type($accounttype["id"], $accounttype["name"] . ' (' . $typename . ')', $dec, $rep, $from, $to, $zero, $balances, $dimension, $dimension2);
}
}
开发者ID:M-Shahbaz,项目名称:FA,代码行数:92,代码来源:rep708.php
示例8: open_session
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
require_once __DIR__ . "/../../../../session.php";
require_once __DIR__ . "/../../../../moneyio.php";
require_once __DIR__ . "/../../../../mio-wallet/show/wallet_func.php";
require_once __DIR__ . "/../../../../mio-lang/list.php";
open_session();
$user_id = $_SESSION["mio-username_id"];
$wallet_id = $_POST["wallet_id"];
$balance = get_balance($wallet_id);
if (isset($_SESSION) && !empty($_SESSION)) {
?>
<h1>Balances</h1>
<table class="table">
<tr>
<th>ID</th>
<th>Balance</th>
<th>Fecha</th>
<tr>
<?php
for ($x = 0; $x < count($balance); $x++) {
echo "<tr>";
echo "<td>" . $balance[$x]->balance_id . "</td>";
echo "<td>" . $balance[$x]->balance . "<span> €</span></td>";
开发者ID:netSys0,项目名称:MoneyIO,代码行数:31,代码来源:search.php
示例9: date_diff
//$first, $first_stamp, $mid, $mid_stamp, $last, $last_stamp -> for the dates
//$total_days
//going to establish the amount of days b/w first pay day and mid pay day for proration purposes
$first_half_days = date_diff($mid_stamp, $first_stamp);
//$monthly_estimate is the monthly estimate of all (paid & unpaid) income less (paid & unpaid) expenses
//calculates approx. disposable income based on the estimates...
?>
<div class= "wrapper">
<div class = "exp_title">
<h3>Disposable Income</h3>
</div>
<div class = "summary">
<p><strong>Summary</strong></p>
<?php
//previous month will calculate the balance at the end of the previous budget month.
$prev_month = get_balance($first_stamp, FALSE);
//initial amt is calculating the fixed income less the fixed expenses (NOT including those that are
//span more than one month)
$initial_amt = monthly_estimate($total_days, $thismonth);
//multi will calculate the amount that needs to be set aside for mutli-month expenses
$multi = estimate_multi_month($thismonth);
//intial will figure the previous months balance plus the initital budget surplus (income less expenses)
$initial = $prev_month + $initial_amt - $multi;
?>
<p>Beginning Amount this month: <?php
echo my_money_format($initial);
?>
<br/>
<?php
$this_month_bf_mid = get_this_month_total($first_stamp, $mid_stamp);
$this_month = get_this_month_total($first_stamp, $last_stamp);
开发者ID:rcmoret,项目名称:personal_site,代码行数:31,代码来源:variable_expenses.php
示例10: display_type
function display_type($type, $typename, &$dec, &$rep, $from, $to, $zero, $balances, $dimension, $dimension2)
{
global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;
$printtitle = 0;
//Flag for printing type name
//Get Accounts directly under this group/type
$accounts = get_gl_accounts(null, null, $type);
$begin = get_fiscalyear_begin_for_date($from);
if (date1_greater_date2($begin, $from)) {
$begin = $from;
}
$begin = add_days($begin, -1);
while ($account = db_fetch($accounts)) {
//Print Type Title if it has atleast one non-zero account
if (!$printtitle) {
$rep->row -= 4;
$rep->TextCol(0, 8, _("Group") . " - " . $type . " - " . $typename);
$printtitle = 1;
$rep->row -= 4;
$rep->Line($rep->row);
$rep->NewLine();
}
$prev = get_balance($account["account_code"], $dimension, $dimension2, $begin, $from, false, false);
$curr = get_balance($account["account_code"], $dimension, $dimension2, $from, $to, true, true);
$tot = get_balance($account["account_code"], $dimension, $dimension2, $begin, $to, false, true);
if ($zero == 0 && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) {
continue;
}
$rep->TextCol(0, 1, $account['account_code']);
$rep->TextCol(1, 2, $account['account_name']);
if ($balances != 0) {
if ($prev['balance'] >= 0.0) {
$rep->AmountCol(2, 3, $prev['balance'], $dec);
} else {
$rep->AmountCol(3, 4, abs($prev['balance']), $dec);
}
if ($curr['balance'] >= 0.0) {
$rep->AmountCol(4, 5, $curr['balance'], $dec);
} else {
$rep->AmountCol(5, 6, abs($curr['balance']), $dec);
}
if ($tot['balance'] >= 0.0) {
$rep->AmountCol(6, 7, $tot['balance'], $dec);
} else {
$rep->AmountCol(7, 8, abs($tot['balance']), $dec);
}
} else {
$rep->AmountCol(2, 3, $prev['debit'], $dec);
$rep->AmountCol(3, 4, $prev['credit'], $dec);
$rep->AmountCol(4, 5, $curr['debit'], $dec);
$rep->AmountCol(5, 6, $curr['credit'], $dec);
$rep->AmountCol(6, 7, $tot['debit'], $dec);
$rep->AmountCol(7, 8, $tot['credit'], $dec);
$pdeb += $prev['debit'];
$pcre += $prev['credit'];
$cdeb += $curr['debit'];
$ccre += $curr['credit'];
$tdeb += $tot['debit'];
$tcre += $tot['credit'];
}
$pbal += $prev['balance'];
$cbal += $curr['balance'];
$tbal += $tot['balance'];
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
$rep->Line($rep->row - 2);
$rep->NewPage();
}
}
//Get Account groups/types under this group/type
$result = get_account_types(false, false, $type);
while ($accounttype = db_fetch($result)) {
//Print Type Title if has sub types and not previously printed
if (!$printtitle) {
$rep->row -= 4;
$rep->TextCol(0, 8, _("Group") . " - " . $type . " - " . $typename);
$printtitle = 1;
$rep->row -= 4;
$rep->Line($rep->row);
$rep->NewLine();
}
display_type($accounttype["id"], $accounttype["name"] . ' (' . $typename . ')', $dec, $rep, $from, $to, $zero, $balances, $dimension, $dimension2);
}
}
开发者ID:pthdnq,项目名称:ivalley-svn,代码行数:84,代码来源:rep708.php
示例11: get_balance
// if me, check to see if the dest account is a valid account
if (!($stmt = $mysqli->prepare("SELECT accountNum FROM accounts where accountNum = ?"))) {
echo "acct check Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
// bind new account num param
if (!$stmt->bind_param("i", $dst_account_num)) {
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
// bind the results of the query to each field
// if $dst_routing_num === $my_routing_num
$stmt->bind_result($dst_acct);
// if the account number is invalid in the local database, die
$result = $stmt->store_result();
if ($stmt->num_rows() !== 1) {
echo "Unable to validate account number.";
die;
}
// subtract the amount from the current balance, and set the new account balance
$new_src_bal = get_balance(get_accountNum($_SESSION['username'])) - $amount;
update_balance(get_accountNum($_SESSION['username']), $new_src_bal);
// add new amount to dest balance
$new_dst_bal = get_balance($dst_account_num) + $amount;
update_balance($dst_account_num, $new_dst_bal);
// write transaction log to the DB
log_transaction("12345", get_accountNum($_SESSION['username']), $dst_routing_num, 3988282199, $amount);
echo "Done processing transaction.";
// if different bank, ask fed if account num is valid
}
开发者ID:bjh7242,项目名称:ISTS14-Stuff,代码行数:31,代码来源:transfer.php
示例12: update_ingress
function update_ingress($arg1, $arg2, $arg3, $arg4, $arg5)
{
require_once __DIR__ . "/../../moneyio.php";
require_once __DIR__ . "/../../query.php";
$prepare = db_connect();
$query = $prepare->prepare(update_ingress);
$query->bind_param('sssii', $arg1, $arg2, $arg3, $arg4, $arg5);
$query->execute();
$value = get_balance($arg4, $arg4, $arg4);
new_balance($value, $arg4);
//$arg4 = wallet_id
return $query;
$prepare->close();
}
开发者ID:netSys0,项目名称:MoneyIO,代码行数:14,代码来源:ingress_func.php
示例13: route_post_order
function route_post_order()
{
$member = authOpenAPIMember();
if ($member === FALSE) {
status(HTTP_FORBIDDEN);
exit;
}
$uid = $member['id'];
$title = str_replace("\t", ' ', trim($_POST['title']));
$description = str_replace("\t", ' ', trim($_POST['description']));
$price = parseMoney($_POST['price']);
if (!$title || strlen($title) > 140 || !$description || strlen($description) > 2000 || $price === FALSE) {
return json_error('BAD_ORDER');
}
// Pre-validate balance
$balance = get_balance("USR", $uid, null);
if (!$balance) {
return json_error('NO_BALANCE');
}
list($bal, $cur, $lock) = explode(':', $balance);
if ($bal < $price) {
return json_error('INSUFFICIENT_FUNDS');
}
// Start and lock 'order' transaction
$temp = start_order_transaction($uid, $price);
if ($temp === FALSE) {
return json_error('START_TRANS');
}
// Create 'order' text
$local_id = post_order($uid, $title, $description, $price);
if ($local_id === FALSE) {
// Cancel transaction
delete_temp_transaction($temp);
return json_error('POST_ORDER');
}
// Commit order transaction
$res = commit_transaction($temp);
if (explode(':', $res)[0] != 1) {
// Cancel transaction
delete_temp_transaction($temp);
return json_error('COMMIT_TRANS');
}
// Render user's html
global $i;
global $page;
$i = get_order($local_id);
$page = array('member' => $member);
ob_start();
include 'templates/_order.php';
$html = ob_get_clean();
$response = array('order' => $i, 'html' => $html, 'balance' => formatBalance('USR', $uid));
// Send to user's queue
enqueue($response, $uid);
// Render common html
$page['member']['id'] = 0;
ob_start();
include 'templates/_order.php';
$html = ob_get_clean();
// Send to common queue
enqueue(array('order' => $i, 'html' => $html), '');
send_header('Content-Type: application/json; charset=utf-8');
echo json_encode($response);
}
开发者ID:enikesha,项目名称:v_order,代码行数:63,代码来源:index.php
示例14: delete_ingress
function delete_ingress($arg1, $arg2)
{
require_once __DIR__ . "/../../moneyio.php";
require_once __DIR__ . "/../../query.php";
$prepare = db_connect();
$query = $prepare->prepare(delete_ingress);
$query->bind_param('ii', $arg1, $arg2);
$query->execute();
//$get_wallet_id = get_ingress($arg2);
$value = get_balance($arg2, $arg2, $arg2);
// Solved issue, It taken $arg1 as ingress_id so, does not perform balance
// Does not need because, It parse wallet_id auto via $_GET
new_balance($value, $arg2);
//$arg2 = wallet_id
return $query;
$prepare->close();
}
开发者ID:netSys0,项目名称:MoneyIO,代码行数:17,代码来源:ingress_func.php
示例15: get_balance
</div>
<label for="dogeamount">Withdraw to: <span class="fineprint">(<?php
echo $loggedInUser->dogeaddress;
?>
)</span></label>
<form action=' <?php
echo $_SERVER['PHP_SELF'];
?>
' method="post">
<input type="text" name="withdrawdogeamount" placeholder="amount" id="dogeamount">
<input type="submit" name="submit" class="btn small" value="Withdraw Doge">
</form>
</div>
<div class="grid_5 push_1 box grid_box">
<div class="balance">BTC Balance: <?php
echo get_balance($loggedInUser->user_id, "BTC");
?>
</div>
<label for="btcamount">Withdraw to: <span class="fineprint">(<?php
echo $loggedInUser->btcaddress;
?>
)</span></label>
<form action=' <?php
echo $_SERVER['PHP_SELF'];
?>
' method="post">
<input type="text" name="withdrawbtcamount" placeholder="amount" id="btcamount">
<input type="submit" name="submit" class="btn small" value="Withdraw BTC">
</form>
</div>
<div class="grid_10 push_1 box grid_box">
开发者ID:khalid-ali,项目名称:DogePos,代码行数:31,代码来源:transactions.php
示例16: start_order_transaction
function start_order_transaction($mid, $amount)
{
// Ensure 'order' account
if (get_balance("ORD", $mid, null) == 'NO_ACCOUNT') {
if (!create_account("ORD", $mid, null, $mid, ip2long(getRealIpAddr()), null, null, '')) {
return FALSE;
}
}
$date = time();
$temp = mt_rand() + 1;
$res = create_temp_transaction($temp, array(k_transaction_party("ORD", $mid, 1, $amount, $temp, $date, null), k_transaction_party("USR", $mid, 1, -$amount, $temp, $date, null)), ip2long(getRealIpAddr()), $date, '');
if ($res < 1) {
return FALSE;
}
$res = lock_transaction($temp);
return $res == "2" ? $temp : FALSE;
}
开发者ID:enikesha,项目名称:v_order,代码行数:17,代码来源:utils.php
示例17: round
if (!in_array($currency, $currencies)) {
$errors[] = "No such currency.";
}
if (!is_numeric($amount) || $currency == "SLC" && $amount < 0.0001 || $currency != "SLC" && $amount < 1.0E-8) {
$errors[] = "Wrong amount.";
}
if (count($errors) == 0) {
if ($currency == "SLC") {
$amount = round($amount * 10000) / 10000;
} else {
$amount = round($amount * 100000000) / 100000000;
}
if (!get_lock("global")) {
die("Too many queries. Please try again later.");
}
if ($amount > get_balance($_SESSION["user_id"], $currency)) {
$errors[] = "You don't have that much.";
}
$slt_user_a = "SELECT * FROM user WHERE email = '{$recipient}'";
$rlt_user_a = mysql_query($slt_user_a);
if (!($row_user_a = mysql_fetch_assoc($rlt_user_a))) {
$errors[] = "A user with that email address does not exist.";
}
if (count($errors) == 0) {
add_transaction($_SESSION["user_id"], "out", "intern", $amount, $currency, "internal_transfer");
add_transaction($row_user_a["id"], "in", "intern", $amount, $currency, "internal_transfer");
if ($currency == "SLC") {
echo nice_format($amount, false, 0, 4) . " Solidcoins were transferred to " . htmlentities($_POST["recipient"]) . ".";
} elseif ($currency == "BTC") {
echo nice_format($amount, false, 0, 8) . " Bitcoins were transferred to " . htmlentities($_POST["recipient"]) . ".";
} elseif ($currency == "NMC") {
开发者ID:rhartness,项目名称:slc24,代码行数:31,代码来源:internal_transfer_cont.php
示例18: claimUser_func
function claimUser_func($method_name, $params, $app_data)
{
$req = $params[0];
$agentid = $req['agentId'];
$sessionid = $req['secureSessionId'];
$regionid = $req['regionId'];
$secret = $req['secret'];
#
# Validate region secret
#
$db = new DB();
$sql = "select UUID from " . C_REGIONS_TBL . " " . "where UUID='" . $db->escape($regionid) . "' and " . "regionSecret='" . $db->escape($secret) . "'";
$db->query($sql);
list($region_id) = $db->next_record();
if ($region_id) {
# We have a region, check agent session
$sql = "select UUID from " . C_AGENTS_TBL . " " . "where UUID='" . $db->escape($agentid) . "' and " . "secureSessionID='" . $db->escape($sessionid) . "' and " . "agentOnline=1";
$db->query($sql);
list($user_id) = $db->next_record();
if ($user_id) {
$sql = "update " . C_AGENTS_TBL . " set " . "currentRegion='" . $db->escape($regionid) . "' " . "where UUID='" . $db->escape($agentid) . "'";
$db->query($sql);
$db->next_record();
$response_xml = xmlrpc_encode(array('success' => True, 'agentId' => $agentid, 'funds' => (int) get_balance($agentid), 'currencySecret' => " "));
} else {
$response_xml = xmlrpc_encode(array('success' => False, 'errorMessage' => "Unable to authenticate avatar. Money operations may be unavailable", 'errorURI' => " "));
}
} else {
$response_xml = xmlrpc_encode(array('success' => False, 'errorMessage' => "This region is not authorized to manage your money. Money operations may be unavailable", 'errorURI' => " "));
}
header("Content-type: text/xml");
print $response_xml;
return "";
}
开发者ID:RitsuTainaka,项目名称:Slackdog-OpenSim-Admin,代码行数:34,代码来源:currency.php
示例19: auto_withdraw
function auto_withdraw($currency)
{
global $mysqli, $db_table_prefix, $errors;
$query = "Select userid, {$currency}_last_balance, {$currency}address, currency from uc_users INNER JOIN user_receive_address ON uc_users.id = user_receive_address.userid where auto{$currency} = 1";
$stmtwithdraw = $mysqli->prepare($query);
$stmtwithdraw->execute();
$stmtwithdraw->bind_result($userid, $balance, $address, $fiatcurrency);
$count = 0;
if ($currency == 'doge') {
$min = 100;
$reserve = 50;
} else {
if ($currency == 'btc') {
$min = 0.005;
$reserve = 0.001;
}
}
while ($stmtwithdraw->fetch()) {
$withdraws[$count]['userid'] = $userid;
$withdraws[$count]['balance'] = $balance;
$withdraws[$count]['address'] = $address;
$withdraws[$count]['fiatcurrency'] = $fiatcurrency;
$count++;
}
$stmtwithdraw->close();
foreach ($withdraws as $w) {
echo "\r\n===";
if ($realbalance = get_balance($w['userid'], $currency)) {
if ($realbalance > $min) {
echo "{balance for " . $w['userid'] . " is" . $realbalance . "}";
withdraw($w['userid'], $currency, $realbalance - $reserve, $w['address'], $w['fiatcurrency']);
echo "withdraw";
}
}
}
echo "done";
}
开发者ID:khalid-ali,项目名称:DogePos,代码行数:37,代码来源:cryptofunctions.php
示例20: ajax_account_statstics
public function ajax_account_statstics()
{
if ($this->input->post()) {
$this->load->model('account_model');
$this->load->model('job_model');
$user_id = $this->input->post('customer_id');
$customer_details = $this->job_model->get_customer_details($user_id);
$c_balance = get_balance($user_id);
$month = $this->input->post('month');
$year = $this->input->post('year');
$jmonth = $month . "-" . $year;
$all = false;
if ($month == "all") {
$all = true;
}
$customer_name = $customer_details->companyname ? $customer_details->companyname : $customer_details->name;
$data = $this->account_model->account_statstics($user_id, $jmonth, $all);
$print = '<table border="2" width="100%">
<tr>
<td colspan="10" align="center">
<h2>' . $customer_name . ' (Total Due - ' . $c_balance . ' ) </h2>
</td>
</tr>
<tr>
<td style="border:1px solid">Date</td>
<td style="border:1px solid">Time</td>
<td style="border:1px solid">Job No.</td>
<td style="border:1px solid">Job Name</td>
<td style="border:1px solid">Debit</td>
<td style="border:1px solid">Credit</td>
<td style="border:1px solid">Balance</td>
<td style="border:1px solid">Reference</td>
<td style="border:1px solid">Credit Note</td>
<td style="border:1px solid">Received By</td>
<td style="border:1px solid">Details</td>
</tr>';
$total_debit = $total_credit = 0;
foreach ($data as $result) {
if ($result['t_type'] == CREDIT and $result['amount'] == 0) {
continue;
}
|
请发表评论