</ul> </div> <div class="wrapper"> <div class="center"> <?php require 'functions/get_uploaded_transaction_function.php'; require_once 'functions/open_file_function.php'; require 'functions/get_accounts_function.php'; require 'functions/get_customers_function.php'; require 'functions/get_transactions_function.php'; /* --------------------------------------------------------------------------- Getting all the customers, accounts and transactions and puts them in arrays ----------------------------------------------------------------------------*/ $customersArray = get_customers(); $accountsArray = get_accounts(); $transactionsArray = get_transactions(); /* --------------------------------------------------------------------------- Counting the arrays ----------------------------------------------------------------------------*/ $customersArrayLength = count($customersArray); $accountsArrayLength = count($accountsArray); $transactionsArrayLength = count($transactionsArray); $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $FileType = pathinfo($target_file, PATHINFO_EXTENSION); $fileName = basename($_FILES["fileToUpload"]["name"]); // Only account.csv files allowed if ($fileName == "transaction_deposit.csv" or $fileName == "transaction_withdrawal.csv") { } else { echo "Sorry, only 'transaction_withdrawal.csv' or 'transaction_deposit.csv' files allowed. <br>";
function action_get_transactions_table($db) { $modifiers = extract_date_modifiers($_GET['modifiers']); // todo $transactions = get_transactions($db, $modifiers); $categories = get_categories($db); return generate_transactions_table($transactions, $categories); }
<?php include_once 'includes/db_connect.php'; include_once 'includes/functions.php'; sec_session_start(); ?> <!DOCTYPE html> <html> <body> <?php print_r(get_transactions($mysqli)); ?> </body> </html>
if ($_POST['filterType'] == '2') { $today = date2sql(Today()); $sql .= " AND debtor_trans.due_date < '{$today}' " . "AND (debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight_tax + debtor_trans.ov_freight + " . "debtor_trans.ov_discount - debtor_trans.alloc > 0) "; } } $sql .= " ORDER BY debtor_trans.tran_date DESC,debtor_trans.type," . "debtor_trans.trans_no "; return db_query($sql, "No transactions were returned"); } //------------------------------------------------------------------------------------------------ if ($_POST['customer_id'] != "" && $_POST['customer_id'] != reserved_words::get_all()) { $customer_record = get_customer_details($_POST['customer_id']); display_customer_summary($customer_record); echo "<br>"; } //------------------------------------------------------------------------------------------------ $result = get_transactions(); if (db_num_rows($result) == 0) { display_note(tr("The selected customer has no transactions for the given dates."), 0, 2); end_page(); exit; } //------------------------------------------------------------------------------------------------ print_hidden_script(10); start_table("{$table_style} width='80%'"); $th = array(tr("Type"), tr("#"), tr("Order"), tr("Reference"), tr("Date"), tr("Due Date"), tr("Customer"), tr("Branch"), tr("Currency"), tr("Debit"), tr("Credit"), "", "", "", ""); if ($_POST['customer_id'] != reserved_words::get_all()) { unset($th[6], $th[8]); } table_header($th); $j = 1; $k = 0;
function print_customer_balances() { global $path_to_root, $systypes_array; $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $fromcust = $_POST['PARAM_2']; $show_balance = $_POST['PARAM_3']; $currency = $_POST['PARAM_4']; $no_zeros = $_POST['PARAM_5']; $comments = $_POST['PARAM_6']; $orientation = $_POST['PARAM_7']; $destination = $_POST['PARAM_8']; if ($destination) { include_once $path_to_root . "/reporting/includes/excel_report.inc"; } else { include_once $path_to_root . "/reporting/includes/pdf_report.inc"; } $orientation = $orientation ? 'L' : 'P'; if ($fromcust == ALL_TEXT) { $cust = _('All'); } else { $cust = get_customer_name($fromcust); } $dec = user_price_dec(); if ($currency == ALL_TEXT) { $convert = true; $currency = _('Balances in Home Currency'); } else { $convert = false; } if ($no_zeros) { $nozeros = _('Yes'); } else { $nozeros = _('No'); } $cols = array(0, 100, 130, 190, 250, 320, 385, 450, 515); $headers = array(_('Trans Type'), _('#'), _('Date'), _('Due Date'), _('Charges'), _('Credits'), _('Allocated'), _('Outstanding')); if ($show_balance) { $headers[7] = _('Balance'); } $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right'); $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Customer'), 'from' => $cust, 'to' => ''), 3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''), 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); $rep = new FrontReport(_('Customer Balances'), "CustomerBalances", user_pagesize(), 9, $orientation); if ($orientation == 'L') { recalculate_cols($cols); } $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->NewPage(); $grandtotal = array(0, 0, 0, 0); $sql = "SELECT debtor_no, name, curr_code FROM " . TB_PREF . "debtors_master "; if ($fromcust != ALL_TEXT) { $sql .= "WHERE debtor_no=" . db_escape($fromcust); } $sql .= " ORDER BY name"; $result = db_query($sql, "The customers could not be retrieved"); while ($myrow = db_fetch($result)) { if (!$convert && $currency != $myrow['curr_code']) { continue; } $accumulate = 0; $rate = $convert ? get_exchange_rate_from_home_currency($myrow['curr_code'], Today()) : 1; $bal = get_open_balance($myrow['debtor_no'], $from, $convert); $init[0] = $init[1] = 0.0; $init[0] = round2(abs($bal['charges'] * $rate), $dec); $init[1] = round2(Abs($bal['credits'] * $rate), $dec); $init[2] = round2($bal['Allocated'] * $rate, $dec); if ($show_balance) { $init[3] = $init[0] - $init[1]; $accumulate += $init[3]; } else { $init[3] = round2($bal['OutStanding'] * $rate, $dec); } $res = get_transactions($myrow['debtor_no'], $from, $to); if ($no_zeros && db_num_rows($res) == 0) { continue; } $rep->fontSize += 2; $rep->TextCol(0, 2, $myrow['name']); if ($convert) { $rep->TextCol(2, 3, $myrow['curr_code']); } $rep->fontSize -= 2; $rep->TextCol(3, 4, _("Open Balance")); $rep->AmountCol(4, 5, $init[0], $dec); $rep->AmountCol(5, 6, $init[1], $dec); $rep->AmountCol(6, 7, $init[2], $dec); $rep->AmountCol(7, 8, $init[3], $dec); $total = array(0, 0, 0, 0); for ($i = 0; $i < 4; $i++) { $total[$i] += $init[$i]; $grandtotal[$i] += $init[$i]; } $rep->NewLine(1, 2); $rep->Line($rep->row + 4); if (db_num_rows($res) == 0) { $rep->NewLine(1, 2); continue; } while ($trans = db_fetch($res)) { if ($no_zeros && floatcmp($trans['TotalAmount'], $trans['Allocated']) == 0) { continue; } $rep->NewLine(1, 2); $rep->TextCol(0, 1, $systypes_array[$trans['type']]); $rep->TextCol(1, 2, $trans['reference']); $rep->DateCol(2, 3, $trans['tran_date'], true); if ($trans['type'] == ST_SALESINVOICE) { $rep->DateCol(3, 4, $trans['due_date'], true); } $item[0] = $item[1] = 0.0; if ($trans['type'] == ST_CUSTCREDIT || $trans['type'] == ST_CUSTPAYMENT || $trans['type'] == ST_BANKDEPOSIT) { $trans['TotalAmount'] *= -1; } if ($trans['TotalAmount'] > 0.0) { $item[0] = round2(abs($trans['TotalAmount']) * $rate, $dec); $rep->AmountCol(4, 5, $item[0], $dec); $accumulate += $item[0]; } else { $item[1] = round2(Abs($trans['TotalAmount']) * $rate, $dec); $rep->AmountCol(5, 6, $item[1], $dec); $accumulate -= $item[1]; } $item[2] = round2($trans['Allocated'] * $rate, $dec); $rep->AmountCol(6, 7, $item[2], $dec); if ($trans['type'] == ST_SALESINVOICE || $trans['type'] == ST_BANKPAYMENT) { $item[3] = $item[0] + $item[1] - $item[2]; } else { $item[3] = $item[0] - $item[1] + $item[2]; } if ($show_balance) { $rep->AmountCol(7, 8, $accumulate, $dec); } else { $rep->AmountCol(7, 8, $item[3], $dec); } for ($i = 0; $i < 4; $i++) { $total[$i] += $item[$i]; $grandtotal[$i] += $item[$i]; } if ($show_balance) { $total[3] = $total[0] - $total[1]; } } $rep->Line($rep->row - 8); $rep->NewLine(2); $rep->TextCol(0, 3, _('Total')); for ($i = 0; $i < 4; $i++) { $rep->AmountCol($i + 4, $i + 5, $total[$i], $dec); } $rep->Line($rep->row - 4); $rep->NewLine(2); } $rep->fontSize += 2; $rep->TextCol(0, 3, _('Grand Total')); $rep->fontSize -= 2; if ($show_balance) { $grandtotal[3] = $grandtotal[0] - $grandtotal[1]; } for ($i = 0; $i < 4; $i++) { $rep->AmountCol($i + 4, $i + 5, $grandtotal[$i], $dec); } $rep->Line($rep->row - 4); $rep->NewLine(); $rep->End(); }
function print_customer_balances() { global $path_to_root; include_once $path_to_root . "reporting/includes/pdf_report.inc"; $to = $_REQUEST['PARAM_0']; $fromcust = $_REQUEST['PARAM_1']; $currency = $_REQUEST['PARAM_2']; $comments = $_REQUEST['PARAM_3']; if ($fromcust == reserved_words::get_all_numeric()) { $from = tr('All'); } else { $from = get_customer_name($fromcust); } $dec = user_price_dec(); if ($currency == reserved_words::get_all()) { $convert = true; $currency = tr('Balances in Home Currency'); } else { $convert = false; } $cols = array(0, 100, 130, 190, 250, 320, 385, 450, 515); $headers = array(tr('Trans Type'), tr('#'), tr('Date'), tr('Due Date'), tr('Charges'), tr('Credits'), tr('Allocated'), tr('Outstanding')); $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right'); $params = array(0 => $comments, 1 => array('text' => tr('End Date'), 'from' => $to, 'to' => ''), 2 => array('text' => tr('Customer'), 'from' => $from, 'to' => ''), 3 => array('text' => tr('Currency'), 'from' => $currency, 'to' => '')); $rep = new FrontReport(tr('Customer Balances'), "CustomerBalances.pdf", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->Header(); $grandtotal = array(0, 0, 0, 0); $sql = "SELECT debtor_no, name, curr_code FROM debtors_master "; if ($fromcust != reserved_words::get_all_numeric()) { $sql .= "WHERE debtor_no={$fromcust} "; } $sql .= "ORDER BY name"; $result = db_query($sql, "The customers could not be retrieved"); while ($myrow = db_fetch($result)) { if (!$convert && $currency != $myrow['curr_code']) { continue; } $rep->fontSize += 2; $rep->TextCol(0, 3, $myrow['name']); if ($convert) { $rep->TextCol(3, 4, $myrow['curr_code']); } $rep->fontSize -= 2; $rep->NewLine(1, 2); $res = get_transactions($myrow['debtor_no'], $to); if (db_num_rows($res) == 0) { continue; } $rep->Line($rep->row + 4); $total = array(0, 0, 0, 0); while ($trans = db_fetch($res)) { $rep->NewLine(1, 2); $rep->TextCol(0, 1, $trans['type_name']); $rep->TextCol(1, 2, $trans['reference']); $date = sql2date($trans['tran_date']); $rep->TextCol(2, 3, $date); if ($trans['type'] == 10) { $rep->TextCol(3, 4, sql2date($trans['due_date'])); } $item[0] = $item[1] = 0.0; if ($convert) { $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $date); } else { $rate = 1.0; } if ($trans['type'] == 11 || $trans['type'] == 12 || $trans['type'] == 2) { $trans['TotalAmount'] *= -1; } if ($trans['TotalAmount'] > 0.0) { $item[0] = abs($trans['TotalAmount']) * $rate; $rep->TextCol(4, 5, number_format2($item[0], $dec)); } else { $item[1] = Abs($trans['TotalAmount']) * $rate; $rep->TextCol(5, 6, number_format2($item[1], $dec)); } $item[2] = $trans['Allocated'] * $rate; $rep->TextCol(6, 7, number_format2($item[2], $dec)); if ($trans['type'] == 10) { $item[3] = ($trans['TotalAmount'] - $trans['Allocated']) * $rate; } else { $item[3] = ($trans['TotalAmount'] + $trans['Allocated']) * $rate; } $rep->TextCol(7, 8, number_format2($item[3], $dec)); for ($i = 0; $i < 4; $i++) { $total[$i] += $item[$i]; $grandtotal[$i] += $item[$i]; } } $rep->Line($rep->row - 8); $rep->NewLine(2); $rep->TextCol(0, 3, tr('Total')); for ($i = 0; $i < 4; $i++) { $rep->TextCol($i + 4, $i + 5, number_format2($total[$i], $dec)); } $rep->Line($rep->row - 4); $rep->NewLine(2); } $rep->fontSize += 2; $rep->TextCol(0, 3, tr('Grand Total')); $rep->fontSize -= 2; for ($i = 0; $i < 4; $i++) { $rep->TextCol($i + 4, $i + 5, number_format2($grandtotal[$i], $dec)); } $rep->Line($rep->row - 4); $rep->End(); }
<div class="row-fluid"> <div class="span3"> <?php print embed("tpl/add_product.tpl.php", array()); ?> </div> </div> <div class="row-fluid"> <div class="span6"> <div class = "page-header"> <h1><small>Registered Users</small></h1> </div> <?php print embed("tpl/users.tpl.php", array('result' => get_all_user())); ?> </div> <div class="span6"> <div class = "page-header"> <h1><small>Transactions</small></h1> </div> <?php print embed("tpl/transaction.tpl.php", array('result' => get_transactions())); ?> </div> </div> </div> <script type = "text/javascript" src = "js/admin.js"></script> <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="js/bootstrap.min.js"></script> </body>
)</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"> <div class="left"><h2>Doge Transactions</h2> <?php //withdraw($loggedInUser->user_id, 4153, 'btc', .001); ?> <?php get_transactions($loggedInUser->user_id, 'DOGE', 0, 'afdt'); ?> </div> <div class="right"><h2>BTC Transactions</h2> <?php get_transactions($loggedInUser->user_id, 'BTC', 0, 'afdt'); ?> </div> </div> </div> <div id='bottom'></div> </div> <?php include "footer.php";
<!-- PIE CHART --> <!-- PIE CHART --> <!-- PIE CHART --> <!-- PIE CHART --> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Task', 'Hours per Day'], <?php echo json_encode(get_transactions($mysqli)[0]); ?> // ['Work', 11], // ['Eat', 2], // ['Commute', 2], // ['Watch TV', 2], // ['Sleep', 7] ]); var options = { title: 'My Daily Activities' }; var chart = new google.visualization.PieChart(document.getElementById('piechart')); chart.draw(data, options);