function dopayments($data, $user) { $btc = 'https://www.blocktrail.com/BTC/address/'; $btcn = 'blocktrail'; $addr1 = '1KzFJddTvK9TQWsmWFKYJ9fRx9QeSATyrT'; $addr2 = '16dRhawxuR3BmdmkzdzUdgEfGAQszgmtbc'; $addr3 = '1N6LrEDiHuFwSyJYj2GedZM2FGk7kkLjn'; $addr4 = '1CVVn6sC46aZdokEnU1LThmi8WsMV4qzgh'; $addr5 = '13pucx6gHP2vyBLc88QfcGivjkhK63PeVg'; $pg = '<h1>Payments</h1>'; $pg .= "The payment transactions on {$btcn} are here:"; $pg .= " <a href='{$btc}{$addr1}' target=_blank>BTCa</a>,"; $pg .= " <a href='{$btc}{$addr2}' target=_blank>BTCb</a>,"; $pg .= " <a href='{$btc}{$addr3}' target=_blank>BTCc</a>,"; $pg .= " <a href='{$btc}{$addr4}' target=_blank>BTCd</a> and"; $pg .= " <a href='{$btc}{$addr5}' target=_blank>BTCe</a><br>"; $pg .= "The payments below don't yet show when they have been sent.<br>"; $pg .= "Dust payments below 0.00010000 BTC are not sent out yet.<br><br>"; $ans = getPayments($user); $pg .= "<table cellpadding=0 cellspacing=0 border=0>\n"; $pg .= '<thead><tr class=title>'; $pg .= '<td class=dl>Block</td>'; $pg .= '<td class=dl>Address</td>'; $pg .= '<td class=dl>Status</td>'; $pg .= '<td class=dr>BTC</td>'; $pg .= '<td class=dl></td>'; $pg .= "</tr></thead>\n"; if ($ans['STATUS'] == 'ok') { $pg .= '<tbody>'; $all = array(); $count = $ans['rows']; for ($i = 0; $i < $count; $i++) { $all[] = array('payoutid' => $ans['payoutid:' . $i], 'height' => $ans['height:' . $i], 'payaddress' => $ans['payaddress:' . $i], 'amount' => $ans['amount:' . $i], 'paydate' => $ans['paydate:' . $i]); } usort($all, 'sortheight'); $hasdust = false; for ($i = 0; $i < $count; $i++) { if ($i % 2 == 0) { $row = 'even'; } else { $row = 'odd'; } $pg .= "<tr class={$row}>"; $pg .= '<td class=dl>' . $all[$i]['height'] . '</td>'; $pg .= '<td class=dl>' . $all[$i]['payaddress'] . '</td>'; $pg .= '<td class=dl> </td>'; $amount = $all[$i]['amount']; if ($amount < '10000') { $dust = '<span class=st1>*</span>'; $hasdust = true; } else { $dust = ' '; } $pg .= '<td class=dr>' . btcfmt($amount) . '</td>'; $pg .= "<td class=dl>{$dust}</td>"; $pg .= "</tr>\n"; } $pg .= '</tbody>'; if ($hasdust === true) { $pg .= '<tfoot><tr><td colspan=5 class=dc>'; $pg .= '<font size=-1><span class=st1>*</span> '; $pg .= 'Dust payments are not automatically sent out'; $pg .= '</font></td></tr></tfoot>'; } } $pg .= "</table>\n"; return $pg; }
//all was selected require_once '../includes/db.php'; $items = oci_parse($conn, "SELECT coa.account_ref_id\n" . " FROM chart_of_account coa\n" . " INNER JOIN party p ON p.account_ref_id = coa.account_ref_id\n" . " WHERE p.party_city = '{$_GET['city']}'\n" . " AND coa.company_ref_id = {$_SESSION['company_id']}\n" . "ORDER BY account_name"); oci_execute($items); while ($row = oci_fetch_assoc($items)) { $accounts[] = $row['account_ref_id']; } } $ndata = array(); foreach ($accounts as $account) { $party = getIVal("party_name", "party", "account_ref_id = {$account}"); $party_hidden = getIVal("party_code", "party", "account_ref_id = {$account}"); $days_limit = getIVal("days_limit", "party", "account_ref_id = {$account}"); $payment_term = getIVal("payment_term", "party", "account_ref_id = {$account}") * 1; $aob = getInitialOpeningBalance($account); $pay = getPayments($account, $date_start, $date_end, true); $balance = $aob - $pay; if ($balance < 0) { $balance = $balance * -1; } else { $balance = 0; } $sql = "" . "SELECT sa.invoice, sa.seq,\n" . " sa.remarks,\n" . " DATE_FORMAT(sa.sale_date, '%d-%b-%y') sale_date,\n" . " DATEDIFF(now(), sa.sale_date) days,\n" . " sa.net\n" . " FROM vu_sales_age sa\n" . " WHERE sa.party_code = {$party_hidden}\n" . " AND sa.company_ref_id = {$_SESSION['company_id']}\n"; if (strlen($date_start) > 0) { $sql .= " AND TO_DAYS(sa.sale_date) >= TO_DAYS('" . my_sql_date($date_start) . "')\n"; } if (strlen($date_end) > 0) { $sql .= " AND TO_DAYS(sa.sale_date) <= TO_DAYS('" . my_sql_date($date_end) . "')\n"; } if (strlen($date_start) + strlen($date_end) < 1) { $d = date('Y') . "-01-01";
//stop the direct browsing to this file - let index.php handle which files get displayed checkLogin(); //TODO - replace get..Payments with simple count - as data is got by xml.php now $query = null; $inv_id = null; $c_id = null; #if coming from another page where you want to filter by just one invoice if (!empty($_GET['id'])) { $inv_id = $_GET['id']; $query = getInvoicePayments($_GET['id']); $invoice = getInvoice($_GET['id']); $preference = getPreference($invoice['preference_id']); $subPageActive = "payment_filter_invoice"; } elseif (!empty($_GET['c_id'])) { $c_id = $_GET['c_id']; $query = getCustomerPayments($_GET['c_id']); $customer = getCustomer($_GET['c_id']); $subPageActive = "payment_filter_customer"; } else { $query = getPayments(); $subPageActive = "payment_manage"; } $payments = progressPayments($query); $smarty->assign("payments", $payments); $smarty->assign("preference", $preference); $smarty->assign("customer", $customer); $smarty->assign("c_id", $c_id); $smarty->assign("inv_id", $inv_id); $smarty->assign('subPageActive', $subPageActive); $smarty->assign('pageActive', 'payment'); $smarty->assign('active_tab', '#money');