예제 #1
0
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);
}
예제 #2
0
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();
}
예제 #3
0
         $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 = '******'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 = '******'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);
예제 #4
0
파일: api.php 프로젝트: rhartness/slc24
         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);
예제 #5
0
?>
</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>
예제 #6
0
파일: index.php 프로젝트: anujjaha/ncybera
	<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>
예제 #7
0
파일: rep708.php 프로젝트: M-Shahbaz/FA
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);
    }
}
예제 #8
0
파일: search.php 프로젝트: netSys0/MoneyIO
 * 
 * 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> &euro;</span></td>";
예제 #9
0
//$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);
예제 #10
0
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);
    }
}
예제 #11
0
    // 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
}
예제 #12
0
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();
}
예제 #13
0
파일: index.php 프로젝트: enikesha/v_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);
}
예제 #14
0
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();
}
예제 #15
0
</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">
예제 #16
0
파일: utils.php 프로젝트: enikesha/v_order
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;
}
예제 #17
0
 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") {
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 "";
}
예제 #19
0
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";
}
예제 #20
0
파일: Ajax.php 프로젝트: anujjaha/ncybera
    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;
                }
                if ($result['t_type'] == DEBIT) {
                    $total_debit = $total_debit + $result['amount'];
                    $balance = $balance - $result['amount'];
                } else {
                    $total_credit = $total_credit + $result['amount'];
                    $balance = $balance + $result['amount'];
                }
                $print .= '<tr>
					<td style="border:1px solid">' . date('d-m-y', strtotime($result['created'])) . '</td>
					<td style="border:1px solid">' . date('H:i A', strtotime($result['created'])) . '</td>
					<td style="border:1px solid">';
                if ($result['job_id']) {
                    $print .= $result['job_id'];
                } else {
                    $print .= "-";
                }
                //echo $print;
                $print .= '</td><td style="border:1px solid">' . $result['jobname'] . '</td>
				  <td align="right" style="border:1px solid">';
                $show = "-";
                if ($result['t_type'] == DEBIT) {
                    $show = $result['amount'];
                }
                $print .= $show;
                $print .= '</td><td align="right" style="border:1px solid">';
                $show = "-";
                if ($result['t_type'] != DEBIT) {
                    $show = $result['amount'];
                }
                $print .= $show;
                $print .= '</td><td align="right" style="border:1px solid">' . $balance . '
		</td><td style="border:1px solid">';
                if (!empty($result['j_receipt'])) {
                    $print .= "Receipt : " . $result['j_receipt'];
                }
                if (!empty($result['j_bill_number'])) {
                    $print .= "Bill  : " . $result['j_bill_number'];
                }
                if (!empty($result['cheque_number'])) {
                    $print .= "Cheque Number  : " . $result['cheque_number'];
                }
                $print .= '</td><td style="border:1px solid">';
                if (!empty($result['receipt'])) {
                    $print .= "Receipt : " . $result['receipt'];
                }
                if (!empty($result['bill_number'])) {
                    $print .= "Bill No. : " . $result['bill_number'];
                }
                $print .= '</td><td style="border:1px solid">';
                $print .= $result['receivedby'];
                $print .= '-' . $result['amountby'];
                $print .= '</td><td style="border:1px solid">' . $result['notes'] . '
		</td></tr>';
            }
            $monthly_balance = $total_credit - $total_debit;
            $print .= "<tr><td style='border:1px solid' colspan='4' align='right'>Total Debit</td><td style='border:1px solid'  align='right'><h3>" . $total_debit . "</h3></td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td></tr>";
            $print .= "<tr><td style='border:1px solid' colspan='4' align='right'>Total Credit</td><td style='border:1px solid'>-</td><td style='border:1px solid'  align='right'><h3>" . $total_credit . "</h3></td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td></tr>";
            $print .= "<tr><td style='border:1px solid' colspan='4' align='right'>Monthly Balance</td><td style='border:1px solid'>-</td><td style='border:1px solid'>-</td><td style='border:1px solid' align='right'><h3>" . $monthly_balance . "</h3></td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td><td style='border:1px solid'>&nbsp;</td></tr>";
            $print .= "</table>";
            $pdf = create_pdf($print, 'A4');
            echo $pdf;
        }
    }
예제 #21
0
function print_user_panel($page)
{
    echo "<h1>Welcome " . $_SESSION['name'] . "! Your last login was " . get_last_login($_SESSION['username']) . "</h1>\n    <h2>Welcome to the User Panel</h2>\n    Account Number: " . htmlspecialchars(get_accountNum($_SESSION['username'])) . "<br>\n    Balance: " . htmlspecialchars(get_balance(get_accountNum($_SESSION['username']))) . "\n    <br>\n    <ul>\n      <li><a href=\"/user/panel.php?page=transfer_money\">Transfer Money</a></li>\n      <li><a href=\"/user/panel.php?page=transaction_history\">Transaction History</a></li>\n      <li><a href=\"/user/panel.php?page=schedule_transfer\">Schedule Transfer</a></li>\n      <li><a href=\"/user/panel.php?page=check_transfer_schedule\">Check Transfer Schedule</a></li>\n      <li><a href=\"/user/panel.php?page=change_pin\">Change PIN</a></li>\n    </ul>";
    get_content($page);
}
예제 #22
0
function display_trial_balance($type, $typename)
{
    global $path_to_root, $clear_trial_balance_opening;
    global $k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;
    $printtitle = 0;
    //Flag for printing type name
    $k = 0;
    //$accounts = get_gl_accounts();
    //Get Accounts directly under this group/type
    $accounts = get_gl_accounts(null, null, $type);
    $begin = get_fiscalyear_begin_for_date($_POST['TransFromDate']);
    //$begin = begin_fiscalyear();
    if (date1_greater_date2($begin, $_POST['TransFromDate'])) {
        $begin = $_POST['TransFromDate'];
    }
    $begin = add_days($begin, -1);
    while ($account = db_fetch($accounts)) {
        //Print Type Title if it has atleast one non-zero account
        if (!$printtitle) {
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_("Group") . " - " . $type . " - " . $typename, "colspan=8");
            end_row();
            $printtitle = 1;
        }
        // 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"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $begin, false, true);
            $offset = min($open['debit'], $open['credit']);
        } else {
            $offset = 0;
        }
        $prev = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransFromDate'], false, false);
        $curr = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $_POST['TransFromDate'], $_POST['TransToDate'], true, true);
        $tot = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransToDate'], false, true);
        if (check_value("NoZero") && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) {
            continue;
        }
        alt_table_row_color($k);
        $url = "<a href='{$path_to_root}/gl/inquiry/gl_account_inquiry.php?TransFromDate=" . $_POST["TransFromDate"] . "&TransToDate=" . $_POST["TransToDate"] . "&account=" . $account["account_code"] . "&Dimension=" . $_POST["Dimension"] . "&Dimension2=" . $_POST["Dimension2"] . "'>" . $account["account_code"] . "</a>";
        label_cell($url);
        label_cell($account["account_name"]);
        if (check_value('Balance')) {
            display_debit_or_credit_cells($prev['balance']);
            display_debit_or_credit_cells($curr['balance']);
            display_debit_or_credit_cells($tot['balance']);
        } else {
            amount_cell($prev['debit'] - $offset);
            amount_cell($prev['credit'] - $offset);
            amount_cell($curr['debit']);
            amount_cell($curr['credit']);
            amount_cell($tot['debit'] - $offset);
            amount_cell($tot['credit'] - $offset);
            $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'];
        end_row();
    }
    //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) {
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_("Group") . " - " . $type . " - " . $typename, "colspan=8");
            end_row();
            $printtitle = 1;
        }
        display_trial_balance($accounttype["id"], $accounttype["name"] . ' (' . $typename . ')');
    }
}
예제 #23
0
<?php 
    }
} elseif ($_GET["step"] == 2) {
    $address = mysql_real_escape_string($_POST["address"], $db);
    $amount = floor(mysql_real_escape_string($_POST["amount"], $db) * 10000) / 10000;
    $errors = array();
    if (!is_numeric($amount) || $amount < 0.5 && $amount != "0.5") {
        $errors[] = "Please enter a valid amount above 0.5.";
    }
    if (!check_slc_address($address)) {
        $errors[] = "Please enter a valid address.";
    }
    if (!get_lock("global")) {
        die("Too many queries. Please try again later.");
    }
    $balance = get_balance($_SESSION["user_id"], "SLC");
    if (count($errors) == 0) {
        $result = withdraw_slc($address);
        if ($result["type"] == "extern") {
            $amountwithfee = floor(($amount + $staticfee) * 10000) / 10000;
        } else {
            $amountwithfee = floor($amount * 10000) / 10000;
        }
        if ($amountwithfee > floor($balance * 10000) / 10000) {
            $errors[] = "You don't have that much.";
        }
    }
    $server_balance = $solidcoin->sc_getbalance("main") / 10000;
    if (count($errors) == 0 && $server_balance < $amountwithfee * 1.05 + 1) {
        $errors[] = "There's currently not enough Solidcoins on the Solidcoin24 servers to fulfill your withdrawal request. Don't worry, a Solidcoin24 admin has been informed and will resolve this for you. You will get an email as soon as the Solidcoins are available. Sorry for the inconvenience, but remember that a big part of the amounts are stored in a seperate wallets for your own security.";
        send_mail("Emergency! Solidcoin balance exhausted ({$server_balance} left)!", "A user with the email address " . $_SESSION["user_email"] . " legitimately tried to withdraw {$amount} Solidcoins. There are still {$server_balance} Solidcoins on the server. The request was denied. Please resolve this and make sure to inform the user.", "*****@*****.**");
예제 #24
0
        $result = json_decode($body, true);
    } else {
        // Get error msg
        $http_message = curl_error($curl);
        $result = json_decode($body, true);
    }
    curl_close($curl);
    return $result;
}
//////////////////////////////////////////////////////////////////////////////////////
if (TESTING_MODE == true) {
    $card_number = "111111111111111";
    // Enter the test card number here
    $retailer_id = '7';
    // Retailer ID will be provided by CardQuiry for all supported retailers.
    $pin = "20723803";
    // Enter test card pin number here
} else {
    $card_number = "6080326049539584";
    // Enter the test card number here
    $retailer_id = '7';
    // Retailer ID will be provided by CardQuiry for all supported retailers.
    $pin = "3643";
    // Enter test card pin number here
}
$version = '2';
$result = get_balance($retailer_id, $card_number, trim($pin), $version);
print_r($result);
// echo "REQUEST ID " . $result["requestId"] . "\n";
// $delayedResult  = get_delayed_balance($result["requestId"]);
// print_r($delayedResult);
예제 #25
0
파일: index.php 프로젝트: rhartness/slc24
        echo $_LANG[$l]["g_deposit"];
        ?>
</a> | <a href="?c=balance/withdraw_slc<?php 
        echo $___l;
        ?>
" <?php 
        if ($content == "balance/withdraw_slc") {
            echo " class=\"active\"";
        }
        ?>
><?php 
        echo $_LANG[$l]["g_withdraw"];
        ?>
</a></li>
            <li style="font-size: 0.9em"><?php 
        echo nice_format(get_balance($_SESSION["user_id"], "BTC"), false, 0, 8);
        ?>
 <?php 
        echo $_LANG[$l]["g_bitcoins"];
        ?>
<br /><a href="?c=balance/deposit_btc<?php 
        echo $___l;
        ?>
" <?php 
        if ($content == "balance/deposit_btc") {
            echo " class=\"active\"";
        }
        ?>
><?php 
        echo $_LANG[$l]["g_deposit"];
        ?>
예제 #26
0
	</tr>
	<tr>
		<td align="right">
			Total :
		</td>
		<td align="right"><?php if(!empty($job_data->total)) { echo $job_data->total; }?></td>
	</tr>
	<tr>
		<td align="right">
			Advance :
		</td>
		<td align="right"><?php if(!empty($job_data->advance)) { echo $job_data->advance; }?></td>
	</tr>
	<?php 
	$show_due = $job_data->due - $job_data->discount;
	$u_balance = get_balance($job_data->user_id);
	//if(1==2 && $job_data->jpaid == 1 && $show_due > 0  && $u_balance > 0 ){
	if($show_due > 0 && $u_balance < 1 ){
		?>
	<tr>
		<td colspan="5" align="right">
			Due :
		</td>
		<td align="right"> <?php 
		
		 echo $show_due; ?></td>
	</tr> <?php } else {
		echo "2";
		
		 ?>
	<tr>
예제 #27
0
	function sql_upd_client($is_query=1) { // update record

		// ***********************************************************
		$this->add_field('login_upd', TIME, 'int');
		$this->add_field('contact_upd', TIME, 'int');
		$this->add_field('account_upd', TIME, 'int');
		$this->add_field('account_balance', get_balance($this->client_id));
		$this->add_field('account_hpsp', get_hpsp($this->client_id));
		$this->add_field('account_lcsp', get_lcsp($this->client_id));
		$this->add_field('account_trades', get_nof_rec('trades', 'trade_account='.$this->client_id.' AND trade_status>0'));
		$this->add_field('account_lastfnd', get_first_value('fund_valdate', 'funds', 'fund_account='.$this->client_id, 'DESC'));
		$this->add_field('account_lasttrd', get_first_value('trade_valdate', 'trades', 'trade_account='.$this->client_id, 'DESC'));
		$this->add_field('account_options', get_total_options($this->client_id));
		$this->add_field('bank_upd', TIME, 'int');
		
		// account_status
		if (($this->account_trades>1)&&($this->account_status>1)){
			$this->add_field('account_status', 9);
		}elseif (($this->account_trades==1)&&($this->account_status>1)){
			$this->add_field('account_status', 3);
		}elseif ($this->account_status>1){
			$this->add_field('account_status', 2);
		}elseif (($this->account_logged<(TIME-DAYS_TILL_EXPIRY))&&($this->account_status>1)){
			$this->add_field('account_status', 1);
		}
		
		$sql_login='******';
		foreach ($this->field_value as $key=>$val){
			if ('login'==substr($key, 0, 5)){
				$val=set_insql($val, $this->field_type[$key]);
				$sql_login.=$key.'='.$val.', ';
			}
		}
		$sql_login=substr($sql_login, 0, -2);
		$sql_login.=' WHERE login_id='.$this->login_id;
		
		$sql_contact='UPDATE contacts SET ';
		foreach ($this->field_value as $key=>$val){
			if ('contact'==substr($key, 0, 7)){
				$val=set_insql($val, $this->field_type[$key]);
				$sql_contact.=$key.'='.$val.', ';
			}
		}
		$sql_contact=substr($sql_contact, 0, -2);
		$sql_contact.=' WHERE contact_id='.$this->contact_id;
		
		$sql_account='UPDATE accounts SET ';
		foreach ($this->field_value as $key=>$val){
			if ('account'==substr($key, 0, 7)){
				$val=set_insql($val, $this->field_type[$key]);
				$sql_account.=$key.'='.$val.', ';
			}
		}
		$sql_account=substr($sql_account, 0, -2);
		$sql_account.=' WHERE account_id='.$this->account_id;
		
		$sql_bank='UPDATE banks SET ';
		foreach ($this->field_value as $key=>$val){
			if ('bank'==substr($key, 0, 4)){
				$val=set_insql($val, $this->field_type[$key]);
				$sql_bank.=$key.'='.$val.', ';
			}
		}
		$sql_bank=substr($sql_bank, 0, -2);
		$sql_bank.=' WHERE bank_id='.$this->bank_id;
		
		if ($is_query){ // process query 
			mysql_query($sql_login);
			mysql_query($sql_contact);
			mysql_query($sql_account);
			mysql_query($sql_bank);
		}else{
			echo $sql_login.'<br/>'.$sql_contact.'<br/>'.$sql_account.'<br/>'.$sql_bank;
		}
	}
예제 #28
0
function display_trial_balance($type, $typename)
{
    global $path_to_root;
    global $k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;
    $printtitle = 0;
    //Flag for printing type name
    $k = 0;
    //$accounts = get_gl_accounts();
    //Get Accounts directly under this group/type
    $accounts = get_gl_accounts(null, null, $type);
    $begin = get_fiscalyear_begin_for_date($_POST['TransFromDate']);
    //$begin = begin_fiscalyear();
    if (date1_greater_date2($begin, $_POST['TransFromDate'])) {
        $begin = $_POST['TransFromDate'];
    }
    $begin = add_days($begin, -1);
    while ($account = db_fetch($accounts)) {
        //Print Type Title if it has atleast one non-zero account
        if ($type == 3502) {
            continue;
        }
        if (!$printtitle) {
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_("Group") . " - " . $type . " - " . $typename, "colspan=8");
            end_row();
            $printtitle = 1;
        }
        $prev = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransFromDate'], false, false);
        $curr = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $_POST['TransFromDate'], $_POST['TransToDate'], true, true);
        $tot = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransToDate'], false, true);
        if (check_value("NoZero") && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) {
            continue;
        }
        alt_table_row_color($k);
        $url = "<a href='{$path_to_root}/gl/inquiry/gl_account_inquiry.php?TransFromDate=" . $_POST["TransFromDate"] . "&TransToDate=" . $_POST["TransToDate"] . "&account=" . $account["account_code"] . "&Dimension=" . $_POST["Dimension"] . "&Dimension2=" . $_POST["Dimension2"] . "'>" . $account["account_code"] . "</a>";
        label_cell($url);
        label_cell($account["account_name"]);
        if (check_value('Balance')) {
            display_debit_or_credit_cells($prev['balance']);
            display_debit_or_credit_cells($curr['balance']);
            display_debit_or_credit_cells($tot['balance']);
        } else {
            amount_cell($prev['debit']);
            amount_cell($prev['credit']);
            amount_cell($curr['debit']);
            amount_cell($curr['credit']);
            amount_cell($tot['debit']);
            amount_cell($tot['credit']);
            $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'];
        end_row();
    }
    //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) {
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_("Group") . " - " . $type . " - " . $typename, "colspan=8");
            end_row();
            $printtitle = 1;
        }
        display_trial_balance($accounttype["id"], $accounttype["name"] . ' (' . $typename . ')');
    }
}
예제 #29
0
<?php

$t = 30;
$x = $today - 60 * 60 * 24 * $t;
//this will get the most recent transactions
$recent = recent_trans($x);
$a = recent_trans($x);
//this will get the balance from the previous transactions
$balance = get_balance($x);
//this will produced the earliest date...
$pull_date = mysql_fetch_array($a);
$earliest_date = date("n/j", strtotime($pull_date['date']));
//this will get the entire check book balance
$book_bal = get_balance($x, 1);
?>
<!DOCTYPE HTML>
<html>
    <header>
        <title>Family Budget</title>
        <link rel="stylesheet" type="text/css" href= "budget.css">
    </header>
    <body>
        <h1 style="text-align: center;">Family Budget</h1>

        <?php 
if ($_GET['error'] == 1) {
    echo "<p><strong>Could not find the item you were trying to edit!</strong></p>";
}
if ($_GET['del'] == 1) {
    echo "<p><strong>One record was deleted.</strong></p>";
}
예제 #30
0
function delete_cost($arg1, $arg2)
{
    require_once __DIR__ . "/../../moneyio.php";
    require_once __DIR__ . "/../../query.php";
    $prepare = db_connect();
    $query = $prepare->prepare(delete_cost);
    $query->bind_param('ii', $arg1, $arg2);
    $query->execute();
    //$get_wallet_id = get_cost($arg1); Does not needed
    //because wallet_id is request by $_GET at disable.php page
    $value = get_balance($arg2, $arg2, $arg2);
    new_balance($value, $arg2);
    //$arg2 = wallet_id
    return $query;
    $prepare->close();
}