本文整理汇总了PHP中Stream函数的典型用法代码示例。如果您正苦于以下问题:PHP Stream函数的具体用法?PHP Stream怎么用?PHP Stream使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Stream函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bal
function bal($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid Cash Flow Statement number.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to core DB
core_connect();
# get the Trial Balance
$cf = new dbSelect("save_cashflow", "core", grp(m("cols", "output, date_trunc('day', gentime) as gentime"), m("where", "id='{$id}'")));
$cf->run();
if ($cf->num_rows() < 1) {
return "<center><li> Invalid Cash Flow Statement Number.</li></center>";
}
$stmnt = $cf->fetch_array();
$OUTPUT = base64_decode($stmnt['output']);
if (isset($_GET["xls"])) {
$cftime = preg_replace("/ 00:00.*/", "", $stmnt["gentime"]);
require_lib("xls");
Stream("cashflow-{$cftime}", $OUTPUT);
} else {
require "../tmpl-print.php";
}
}
示例2: AssetLedg
function AssetLedg()
{
# Set up table to display in
$Assets = "\r\n\t<h3>Asset Ledger</h3>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Group</th><th>Serial</th><th>Location</th><th>Description</th><th>Date Bought</th><th>Date Added</th><th>Cost Amount</th><th>Net Value</th></tr>";
db_connect();
$i = 0;
$tot = 0;
$totnet = 0;
$Sl = "SELECT * FROM assets WHERE div = '" . USER_DIV . "' ORDER BY serial";
$Rs = db_exec($Sl) or errDie("Unable to retrieve Asset Ledger from database.");
if (pg_numrows($Rs) < 1) {
return "<li>There are no Assets recorded on Cubit.";
}
while ($Led = pg_fetch_array($Rs)) {
$netval = sprint($Led['amount'] - $Led['accdep']);
$Led['amount'] = sprint($Led['amount']);
# Get group
db_connect();
$sql = "SELECT * FROM assetgrp WHERE grpid = '{$Led['grpid']}' AND div = '" . USER_DIV . "'";
$grpRslt = db_exec($sql);
$grp = pg_fetch_array($grpRslt);
$tot = $tot + $Led['amount'];
$totnet = $totnet + $netval;
$Assets .= "<tr><td>{$grp['grpname']}</td><td>{$Led['serial']}</td><td>{$Led['locat']}</td><td>{$Led['des']}</td><td>{$Led['bdate']}</td><td>{$Led['date']}</td><td align=right>" . CUR . " {$Led['amount']}</td><td align=right>" . CUR . " {$netval}</td></tr>";
$i++;
}
$tot = sprint($tot);
$totnet = sprint($totnet);
$Assets .= "<tr><td colspan=6>Total Assets: {$i} </td><td align=right>" . CUR . " {$tot}</td><td align=right>" . CUR . " {$totnet}</td></tr>";
$Assets .= "</table>";
include "temp.xls.php";
Stream("Assets", $Assets);
return $Assets;
}
示例3: bal
function bal($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid Trial Balance number.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to core DB
core_connect();
# get the Trial Balance
$sql = "SELECT * FROM save_trial_bal WHERE id = '{$id}' AND div = '" . USER_DIV . "'";
$balRslt = db_exec($sql) or errDie("Unable to retrieve Trial Balance from the Database", SELF);
if (pg_numrows($balRslt) < 1) {
return "<center><li> Invalid Trial Balance Number.";
}
$bal = pg_fetch_array($balRslt);
$balance = base64_decode($bal['output']);
$OUTPUT = $balance;
include "temp.xls.php";
Stream("TB", $OUTPUT);
}
示例4: cashbook
function cashbook($bankid)
{
$OUTPUT = printdep($bankid);
$OUTPUT .= "<br>";
$OUTPUT .= printrep($bankid);
# Send the stream
include "temp.xls.php";
Stream("Oustanding", $OUTPUT);
}
示例5: edit
function edit($listid)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($listid, "num", 1, 50, "Invalid Price List id.");
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class='err'>-" . $e["msg"] . "</li>";
}
return $confirm;
}
# Select Stock
db_conn("exten");
$sql = "SELECT * FROM pricelist WHERE listid = '{$listid}' AND div = '" . USER_DIV . "'";
$listRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
if (pg_numrows($listRslt) < 1) {
return "<li> Invalid Price List ID.";
} else {
$list = pg_fetch_array($listRslt);
}
$vattype = getSetting("SELAMT_VAT") == 'inc' ? "Including Vat" : "Excluding Vat";
$enter = "\r\n\t\t<h3>Price List</h3>\r\n\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Field</th>\r\n\t\t\t\t<th>Value</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>Price list</td>\r\n\t\t\t\t<td align='center'>{$list['listname']}</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr><td><br></td></tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan='2'><h3>Prices</h3><td>\r\n\t\t\t<tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Item</th>\r\n\t\t\t\t<th>Price Amount</th>\r\n\t\t\t</tr>";
# Query server
$i = 0;
db_conn('exten');
$sql = "SELECT * FROM plist_prices WHERE listid = '{$listid}' AND div = '" . USER_DIV . "' AND show='Yes' ORDER BY stkid ASC";
$stkpRslt = db_exec($sql) or errDie("Unable to retrieve stock items from database.");
if (pg_numrows($stkpRslt) < 1) {
return "<li class='err'> There are no stock item on the selected pricelist.</li>";
}
while ($stkp = pg_fetch_array($stkpRslt)) {
db_connect();
# get stock details
$sql = "SELECT stkid, stkcod, stkdes FROM stock WHERE stkid = '{$stkp['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql) or errDie("Unable to retrieve stocks from database.");
$stk = pg_fetch_array($stkRslt);
$enter .= "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td>{$stk['stkcod']} - " . extlib_rstr($stk['stkdes'], 30) . "</td>\r\n\t\t\t\t\t<td align='right'>" . CUR . " " . sprint($stkp['price']) . " {$vattype}</td>\r\n\t\t\t\t</tr>";
}
$enter .= "\r\n\t\t\t</table>";
$OUTPUT = $enter;
require "temp.xls.php";
Stream("Pricelist", $OUTPUT);
return $OUTPUT;
}
示例6: printSupp
function printSupp()
{
# Set up table to display in
$printSupp = "\r\n\t\t<table>\r\n\t\t\t<tr><th colspan='3'><h3>Creditors Age Analysis</h3></th></tr>\r\n\t\t\t<tr><th></th></tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<th><u>Acc no.</u></th>\r\n\t\t\t\t<th><u>Suppliers</u></th>\r\n\t\t\t\t<th><u>Current</u></th>\r\n\t\t\t\t<th><u>30 days</u></th>\r\n\t\t\t\t<th><u>60 days</u></th>\r\n\t\t\t\t<th><u>90 days</u></th>\r\n\t\t\t\t<th><u>120 days</u></th>\r\n\t\t\t\t<th><u>Total Outstanding</u></th>\r\n\t\t\t</tr>";
# connect to database
db_connect();
# Query server
$i = 0;
$sql = "SELECT * FROM suppliers WHERE div = '" . USER_DIV . "' ORDER BY supname ASC";
$suppRslt = db_exec($sql) or errDie("Unable to retrieve Suppliers from database.");
if (pg_numrows($suppRslt) < 1) {
return "<li>There are no Suppliers in Cubit.</li>";
}
# totals
$totcurr = 0;
$tot30 = 0;
$tot60 = 0;
$tot90 = 0;
$tot120 = 0;
$alltot = 0;
while ($supp = pg_fetch_array($suppRslt)) {
# Get all ages
$curr = age($supp['supid'], 29);
$age30 = age($supp['supid'], 59);
$age60 = age($supp['supid'], 89);
$age90 = age($supp['supid'], 119);
$age120 = age($supp['supid'], 149);
# Suppliers total
$supptot = $curr + $age30 + $age60 + $age90 + $age120;
if ($supptot < $supp['balance']) {
$curr = sprint($curr + ($supp['balance'] - $supptot));
$supptot = sprint($supptot + $supp['balance'] - $supptot);
}
$printSupp .= "\r\n\t\t\t<tr>\r\n\t\t\t\t<td>{$supp['supno']}</td>\r\n\t\t\t\t<td>{$supp['supname']}</td>\r\n\t\t\t\t<td>" . CUR . " {$curr}</td>\r\n\t\t\t\t<td>" . CUR . " {$age30}</td>\r\n\t\t\t\t<td>" . CUR . " {$age60}</td>\r\n\t\t\t\t<td>" . CUR . " {$age90}</td>\r\n\t\t\t\t<td>" . CUR . " {$age120}</td>\r\n\t\t\t\t<td>" . CUR . " {$supptot}</td>\r\n\t\t\t</tr>";
# hold totals
$totcurr += $curr;
$tot30 += $age30;
$tot60 += $age60;
$tot90 += $age90;
$tot120 += $age120;
$alltot += $supptot;
$i++;
}
$printSupp .= "\r\n\t\t\t<tr><td><br></td></tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan='2'><b>Totals</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$totcurr}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$tot30}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$tot60}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$tot90}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$tot120}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$alltot}</b></td>\r\n\t\t\t</tr>\r\n\t\t</table>";
# Send the stream
include "temp.xls.php";
Stream("CredAgeAnalysis", $printSupp);
}
示例7: viewtran
//.........这里部分代码省略.........
}
$hide = "";
# Period name
$prds = array();
if ($tprd < $fprd) {
for ($i = $fprd; $i <= 12; ++$i) {
$prds[] = $i;
}
for ($i = 1; $i <= $tprd; ++$i) {
$prds[] = $i;
}
} else {
for ($i = $fprd; $i <= $tprd; ++$i) {
$prds[] = $i;
}
}
$trans = "";
foreach ($stkids as $key => $stkid) {
$stkRs = get("cubit", "*", "stock", "stkid", $stkid);
$stk = pg_fetch_array($stkRs);
$trans .= "\n\t\t\t<tr>\n\t\t\t\t<td colspan='8' align='center'><h3>{$stk['stkcod']} - {$stk['stkdes']}</h3></td>\n\t\t\t</tr>";
$hide .= "<input type='hidden' name='stkids[]' value='{$stkid}'>";
foreach ($prds as $prd) {
# Period name
$prdname = prdname($prd);
# Get balances
$idRs = get($prd, "max(id), min(id)", "stkledger", "yrdb='{$year}' AND stkid", $stkid);
$id = pg_fetch_array($idRs);
if ($id['min'] != 0) {
$balRs = get($prd, "qty, (bqty - qty) as bqty, trantype, (balance - csamt) as balance", "stkledger", "id", $id['min']);
$bal = pg_fetch_array($balRs);
$cbalRs = get($prd, "balance", "stkledger", "id", $id['max']);
$cbal = pg_fetch_array($cbalRs);
/*
if($bal['trantype'] == 'dt'){
$bal['bqty'] = ($bal['bqty'] + $bal['qty']);
}else{
$bal['bqty'] = ($bal['bqty'] - $bal['qty']);
}
*/
} else {
if ($prd != PRD_DB) {
continue;
}
$balRs = get("cubit", "csamt as balance, units as bqty", "stock", "stkid", $stkid);
$bal = pg_fetch_array($balRs);
$cbal['balance'] = 0;
$cbal['bqty'] = 0;
}
$balance = sprint($bal['balance']);
$get_yr = "SELECT yrname FROM core.year WHERE yrdb = '{$year}' LIMIT 1";
$run_yr = db_exec($get_yr) or errDie("Unable to get year information.");
if (pg_numrows($run_yr) > 0) {
$yarr = pg_fetch_array($run_yr);
$tmpyear = substr($yarr['yrname'], 1);
} else {
$tmpyear = date("Y") - 1;
}
$get_last_prdmap = "SELECT period FROM core.prdmap WHERE month = '12'";
$run_last_prdmap = db_exec($get_last_prdmap) or errDie("Unable to get last month period");
if (pg_numrows($run_last_prdmap) > 0) {
$lastperiod = pg_fetch_result($run_last_prdmap, 0, 0);
}
$get_current_prd = "SELECT period FROM core.prdmap WHERE month = '{$prd}' LIMIT 1";
$run_current_prd = db_exec($get_current_prd) or errDie("Unable to get period information.");
if (pg_fetch_array($run_current_prd) > 0) {
$currentperiod = pg_fetch_result($run_current_prd, 0, 0);
if ((int) $lastperiod >= (int) $currentperiod) {
$show_year = $tmpyear - 1;
} else {
$show_year = $tmpyear;
}
}
$trans .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='5'><b>({$stk['stkcod']}) {$stk['stkdes']}</b></td>\n\t\t\t\t</tr>";
$trans .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$show_year}-{$prd}-01<br></td>\n\t\t\t\t\t<td>Balance Brought Forward</td>\n\t\t\t\t\t<td align='right'>{$bal['bqty']}</td>\n\t\t\t\t\t<td align='right'>{$balance} </td>\n\t\t\t\t\t<td align='right'>{$balance} </td>\n\t\t\t\t</tr>";
# --> transactio reding comes here <--- #
$dbal['balance'] = 0;
$dbal['bqty'] = 0;
$tranRs = nget($prd, "*", "stkledger", "yrdb='{$year}' AND stkid", $stkid . " ORDER BY id ASC");
while ($tran = pg_fetch_array($tranRs)) {
$dbal['balance'] += $tran['csamt'];
$dbal['bqty'] += $tran['qty'];
# sprinting
$tran['csamt'] = sprint($tran['csamt']);
$tran['balance'] = sprint($tran['balance']);
# Format date
$tran['edate'] = explode("-", $tran['edate']);
$tran['edate'] = $tran['edate'][2] . "-" . $tran['edate'][1] . "-" . $tran['edate'][0];
$trans .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>{$tran['edate']}</td>\n\t\t\t\t\t\t<td>{$tran['details']}</td>\n\t\t\t\t\t\t<td>{$tran['qty']}</td>\n\t\t\t\t\t\t<td align='right'>{$tran['csamt']}</td>\n\t\t\t\t\t\t<td align='right'>{$tran['balance']}</td>\n\t\t\t\t\t</tr>";
}
$dbal['balance'] = sprint($dbal['balance']);
$trans .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td><br></td>\n\t\t\t\t\t<td>Total for period {$prdname} to Date :</td>\n\t\t\t\t\t<td align='right'>{$dbal['bqty']}</td>\n\t\t\t\t\t<td align='right'>{$dbal['balance']} </td>\n\t\t\t\t\t<td align='right'>{$dbal['balance']} </td>\n\t\t\t\t</tr>";
$trans .= "<tr><td colspan='5'><br></td></tr>";
}
}
$sp = " ";
$view = "\n\t\t<center>\n\t\t<h3>Inventory Ledger</h3>\n\t\t<table " . TMPL_tblDflts . " width='75%'>\n\t\t\t<tr>\n\t\t\t\t<th>DATE</th>\n\t\t\t\t<th>DETAILS</th>\n\t\t\t\t<th>QTY</th>\n\t\t\t\t<th>COST AMOUNT</th>\n\t\t\t\t<th>BALANCE</th>\n\t\t\t</tr>\n\t\t\t{$trans}\n\t\t</table>";
include "temp.xls.php";
Stream("Ledger", $view);
}
示例8: details
function details($_GET)
{
# Get vars
foreach ($_GET as $key => $value) {
${$key} = $value;
}
# Query server
db_connect();
$sql = "SELECT * FROM budgets WHERE budid = '{$budid}'";
$budRslt = db_exec($sql) or errDie("Unable to retrieve Budgets from database.");
if (pg_numrows($budRslt) < 1) {
return "<li class=err> - Invalid Budget.";
}
$bud = pg_fetch_array($budRslt);
require "budget.lib.php";
$vbudtype = $TYPES[$bud['budtype']];
$vbudfor = $BUDFOR[$bud['budfor']];
$vfromyr = $YEARS[$bud['fromprd']];
$vtoyr = $YEARS[$bud['toprd']];
$bud['edate'] = ext_rdate($bud['edate']);
/* Toggle Options */
$list = "";
$totamt = 0;
db_connect();
# budget for
if ($bud['budfor'] == 'cost') {
$head = "<tr><th>Cost Centers</th>";
$sql = "SELECT DISTINCT id FROM buditems WHERE budid = '{$budid}'";
$bitRslt = db_exec($sql) or errDie("Unable to retrieve Budgets from database.");
while ($bit = pg_fetch_array($bitRslt)) {
$ccRs = get("cubit", "*", "costcenters", "ccid", $bit['id']);
$cc = pg_fetch_array($ccRs);
$list .= "<tr><td>{$cc['centercode']} - {$cc['centername']}</td>";
db_connect();
$lstRs = db_exec("SELECT * FROM buditems WHERE id = '{$bit['id']}' AND budid = '{$budid}'");
while ($lst = pg_fetch_array($lstRs)) {
$list .= "<td align=right>" . CUR . " {$lst['amt']}</td>";
}
$list .= "</tr>";
}
} elseif ($bud['budfor'] == 'acc') {
$head = "<tr><th>Accounts</th>";
$sql = "SELECT DISTINCT id FROM buditems WHERE budid = '{$budid}'";
$bitRslt = db_exec($sql) or errDie("Unable to retrieve Budgets from database.");
while ($bit = pg_fetch_array($bitRslt)) {
$accRs = get("core", "*", "accounts", "accid", $bit['id']);
$acc = pg_fetch_array($accRs);
$list .= "<tr><td>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</td>";
db_connect();
$lstRs = db_exec("SELECT * FROM buditems WHERE id = '{$bit['id']}' AND budid = '{$budid}'");
while ($lst = pg_fetch_array($lstRs)) {
$list .= "<td align=right>" . CUR . " {$lst['amt']}</td>";
}
$list .= "</tr>";
}
}
# Budget headings
if ($bud['fromprd'] < $bud['toprd']) {
for ($i = $bud['fromprd']; $i <= $bud['toprd']; $i++) {
$head .= "<th>{$YEARS[$i]}</th>";
}
} elseif ($bud['fromprd'] > $bud['toprd']) {
for ($i = $bud['fromprd']; $i < 10; $i++) {
$head .= "<th>{$YEARS[$i]}</th>";
}
for ($i = 0; $i <= $bud['toprd']; $i++) {
$head .= "<th>{$YEARS[$i]}</th>";
}
} else {
$i = $bud['toprd'];
$head .= "<th>{$YEARS[$i]}</th>";
}
$head .= "</tr>";
// $totamt = sprint($totamt);
// $list .= "<tr class='bg-even'><td><b>Total Budget Amount</b></td><td align=right><b>".CUR." $totamt</b></td></tr>";
/* End Toggle Options */
$details = "<center><h3> Yearly Budget Details </h3>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' align=center>\r\n\t<tr><th colspan=2>Details</th></tr>\r\n\t<tr><td>Budget Name</td><td>{$bud['budname']}</td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t<tr><th colspan=2>Options</th></tr>\r\n\t<tr><td>Budget For</td><td>{$vbudfor}</td>\r\n\t<tr><td>Budget Type</td><td>{$vbudtype}</td>\r\n\t<tr><td>Budget Year</td><td>{$vfromyr} to {$vtoyr}</td>\r\n\t<tr><td><br></td></tr>\r\n\t</table>\r\n\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' align=center>\r\n\t{$head}\r\n\t{$list}\r\n\t</table>";
include "../xls/temp.xls.php";
Stream("Budget.xls", $details);
}
示例9: viewtran
function viewtran($_POST)
{
# get vars
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($fprd, "string", 1, 14, "Invalid Starting Period number.");
$v->isOk($tprd, "string", 1, 14, "Invalid Ending Period number.");
if (isset($details)) {
$v->isOk($accid, "string", 1, 20, "Invalid Account number.");
} else {
$v->isOk($topacc, "num", 1, 20, "Invalid Account number.");
$v->isOk($accnum, "num", 0, 20, "Invalid Account number.");
}
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class='err'>" . $e["msg"] . "</li>";
}
$confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# dates drop downs
$months = array("1" => "January", "2" => "February", "3" => "March", "4" => "April", "5" => "May", "6" => "June", "7" => "July", "8" => "August", "9" => "September", "10" => "October", "11" => "November", "12" => "December");
if ($tprd < $fprd) {
return "<li class='err'> Invalid Period range : {$months[$fprd]} to {$months[$tprd]}";
}
if (isset($details)) {
$accRs = get("core", "accname, accid, topacc, accnum", "accounts", "accid", $accid);
$acc = pg_fetch_array($accRs);
} else {
if (strlen($accnum) < 2) {
// account numbers
$accRs = get("core", "accname, accid, topacc, accnum", "accounts", "topacc", "{$topacc}' AND accnum = '000");
if (pg_numrows($accRs) < 1) {
return "<li> Accounts number : {$accnum} does not exist";
}
$acc = pg_fetch_array($accRs);
} else {
// account numbers
$accRs = get("core", "accname, accid, topacc, accnum", "accounts", "topacc", "{$topacc}' AND accnum = '{$accnum}");
if (pg_numrows($accRs) < 1) {
return "<li> Accounts number : {$topacc}/{$accnum} does not exist";
}
$acc = pg_fetch_array($accRs);
}
}
// Set up table to display in
$OUTPUT = "\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan='7'><h3>Journal Entries for Account : {$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</h3></th>\n\t\t\t\t</tr>\n\t\t\t\t<tr><th colspan='7'></th></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th><u>Period</u></th>\n\t\t\t\t\t<th><u>Date</u></th>\n\t\t\t\t\t<th><u>Reference</u></th>\n\t\t\t\t\t<th><u>Contra Acc</u></th>\n\t\t\t\t\t<th><u>Description</u></th>\n\t\t\t\t\t<th><u>Debit</u></th>\n\t\t\t\t\t<th><u>Credit</u></th>\n\t\t\t\t\t<th><u>User</u></th>\n\t\t\t\t</tr>";
# counts
$credtot = 0;
$debtot = 0;
# Get Transactions
for ($i = $fprd; $i <= $tprd; $i++) {
db_conn($i);
$sql = "SELECT * FROM transect WHERE debit = '{$acc['accid']}' AND div = '" . USER_DIV . "' OR credit = '{$acc['accid']}' AND div = '" . USER_DIV . "'";
$tranRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve Transaction details from database.", SELF);
if (pg_numrows($tranRslt) < 1) {
continue;
} else {
# display all transactions
while ($tran = pg_fetch_array($tranRslt)) {
#get vars from tran as the are in db
foreach ($tran as $key => $value) {
${$key} = $value;
}
if ($debit == $acc['accid']) {
$cacc = $credit;
$debitamt = "R " . $amount;
$debtot += $amount;
$creditamt = "";
} else {
$debitamt = "";
$creditamt = "R " . $amount;
$credtot += $amount;
$cacc = $debit;
}
# format date
$date = explode("-", $date);
$date = $date[2] . "-" . $date[1] . "-" . $date[0];
# get contra account name
$caccRs = get("core", "accname,topacc,accnum", "accounts", "accid", $cacc);
$cacc = pg_fetch_array($caccRs);
$OUTPUT .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>{$months[$i]}</td>\n\t\t\t\t\t\t\t<td>{$date}</td>\n\t\t\t\t\t\t\t<td>{$refnum}</td>\n\t\t\t\t\t\t\t<td>{$cacc['topacc']}/{$cacc['accnum']} - {$cacc['accname']}</td>\n\t\t\t\t\t\t\t<td>{$details}</td>\n\t\t\t\t\t\t\t<td>{$debitamt}</td>\n\t\t\t\t\t\t\t<td>{$creditamt}</td>\n\t\t\t\t\t\t\t<td>{$author}</td>\n\t\t\t\t\t\t</tr>";
}
}
}
$OUTPUT .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='5'><b>Total</b></td>\n\t\t\t\t\t<td><b>" . CUR . " {$debtot}</b></td>\n\t\t\t\t\t<td><b>" . CUR . " {$credtot}</b></td>\n\t\t\t\t\t<td></td>\n\t\t\t\t</tr>\n\t\t\t</table>";
$acc['accname'] = str_replace(" ", "", $acc['accname']);
# Send the stream
include "temp.xls.php";
Stream("AllTrans-{$acc['accname']}", $OUTPUT);
}
示例10: export
//.........这里部分代码省略.........
# display errors, if any
if ($v->isError()) {
$err = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$err .= "<li class=err>" . $e["msg"];
}
$confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
db_conn('cubit');
if ($cid != "all") {
$whe = " AND cid='{$cid}'";
} else {
$whe = "";
}
if ($cid != "all") {
if ($report == "sum") {
$Sl = "SELECT sum(exl) AS exl,sum(vat) AS vat,sum(inc) AS inc FROM sj WHERE date>='{$date}' AND date<='{$tdate}' {$whe}";
$Ry = db_exec($Sl) or errDie("Unable to get sales journal.");
$data = pg_fetch_array($Ry);
$exl = sprint($data['exl']);
$vat = sprint($data['vat']);
$inc = sprint($data['inc']);
$out = "<tr><th>Description</th><th>Amount exl VAT</th><th>VAT</th><th>Amount inc VAT</th></tr>\n\t\t\t<tr><td>Total</td><td align=right>" . CUR . " {$exl}</td><td align=right>" . CUR . " {$vat}</td><td align=right>" . CUR . " {$inc}</td></tr>";
} else {
$Sl = "SELECT * FROM sj WHERE date>='{$date}' AND date<='{$tdate}' {$whe} ORDER BY id";
$Ry = db_exec($Sl) or errDie("Unable to get sales journal.");
$out = "<tr><th>Date</th><th>Description</th><th>Amount exl VAT</th><th>VAT</th><th>Amount inc VAT</th></tr>";
$i = 0;
$totexl = 0;
$totvat = 0;
$totinc = 0;
while ($vd = pg_fetch_array($Ry)) {
$out .= "<tr><td>{$vd['date']}</td><td>{$vd['des']}</td>\n\t\t\t\t<td align=right>" . CUR . " {$vd['exl']}</td><td align=right>" . CUR . " {$vd['vat']}</td><td align=right>" . CUR . " {$vd['inc']}</td></tr>";
$i++;
$totexl += $vd['exl'];
$totvat += $vd['vat'];
$totinc += $vd['inc'];
}
$totexl = sprint($totexl);
$totvat = sprint($totvat);
$totinc = sprint($totinc);
$out .= "<tr><td colspan=2>Total</td><td align=right>" . CUR . " {$totexl}</td><td align=right>" . CUR . " {$totvat}</td><td align=right>" . CUR . " {$totinc}</td></tr>";
}
} else {
if ($report == "sum") {
$Sl = "SELECT DISTINCT cid,name FROM sj ORDER BY name";
$Ri = db_exec($Sl) or errDie("Unable to get sales journal.");
$totexl = 0;
$totvat = 0;
$totinc = 0;
$out = "<tr><th>Customer</th><th>Amount exl VAT</th><th>VAT</th><th>Amount inc VAT</th></tr>";
$i = 1;
while ($vd = pg_fetch_array($Ri)) {
$Sl = "SELECT sum(exl) AS exl,sum(vat) AS vat, sum(inc) AS inc FROM sj WHERE date>='{$date}' AND date<='{$tdate}' {$whe} AND cid='{$vd['cid']}'";
$Ry = db_exec($Sl) or errDie("Unable to get sales journal.");
$data = pg_fetch_array($Ry);
$exl = sprint($data['exl']);
$vat = sprint($data['vat']);
$inc = sprint($data['inc']);
$totexl += $exl;
$totvat += $vat;
$totinc += $inc;
$out .= "<tr><td>{$vd['name']}</td><td align=right>" . CUR . " {$exl}</td><td align=right>" . CUR . " {$vat}</td><td align=right>" . CUR . " {$inc}</td></tr>";
$i++;
}
$totexl = sprint($totexl);
$totvat = sprint($totvat);
$totinc = sprint($totinc);
$out .= "<tr><td>Total</td><td align=right>" . CUR . " {$totexl}</td><td align=right>" . CUR . " {$totvat}</td><td align=right>" . CUR . " {$totinc}</td></tr>";
} else {
$Sl = "SELECT * FROM sj WHERE date>='{$date}' AND date<='{$tdate}' {$whe} ORDER BY id";
$Ry = db_exec($Sl) or errDie("Unable to get vat rec.");
$out = "<tr><th>Date</th><th>Description</th><th>Amount exl VAT</th><th>VAT</th><th>Amount inc VAT</th></tr>";
$i = 0;
$totexl = 0;
$totvat = 0;
$totinc = 0;
while ($vd = pg_fetch_array($Ry)) {
$exl = sprint($vd['exl']);
$vat = sprint($vd['vat']);
$inc = sprint($vd['inc']);
$out .= "<tr><td>{$vd['date']}</td><td>{$vd['des']}</td>\n\t\t\t\t<td align=right>" . CUR . " {$exl}</td><td align=right>" . CUR . " {$vat}</td><td align=right>" . CUR . " {$inc}</td></tr>";
$i++;
$totexl += $vd['exl'];
$totvat += $vd['vat'];
$totinc += $vd['inc'];
}
$totexl = sprint($totexl);
$totvat = sprint($totvat);
$totinc = sprint($totinc);
$out .= "<tr><td colspan=2>Total</td><td align=right>" . CUR . " {$totexl}</td><td align=right>" . CUR . " {$totvat}</td><td align=right>" . CUR . " {$totinc}</td></tr>";
}
}
$Report = "<h3>Sales Journal: {$date} TO {$tdate}</h3>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t{$out}\n\t</table>";
$OUTPUT = $Report;
include "xls/temp.xls.php";
Stream("Report", $OUTPUT);
}
示例11: viewtran
//.........这里部分代码省略.........
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($prd, "string", 1, 14, "Invalid Period number.");
$v->isOk($accnt, "string", 1, 5, "Invalid Accounts Selection.");
if ($accnt == 'slct') {
if (isset($stkids)) {
foreach ($stkids as $key => $stkid) {
$v->isOk($stkid, "num", 1, 20, "Invalid Stock code.");
}
} else {
return "<li class=err>ERROR : Please select at least one Stock Item.</li>" . slctacc();
}
}
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>" . $e["msg"];
}
$confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# Get the ids
if ($accnt == 'all') {
$stkids = array();
db_connect();
$sql = "SELECT stkid FROM stock WHERE div = '" . USER_DIV . "'";
$rs = db_exec($sql);
if (pg_num_rows($rs) > 0) {
while ($ac = pg_fetch_array($rs)) {
$stkids[] = $ac['stkid'];
}
} else {
return "<li calss=err> There are no Stock Items yet in Cubit.";
}
}
# Period name
$prdname = prdname($prd);
$hide = "";
$trans = "";
foreach ($stkids as $key => $stkid) {
$stkRs = get("cubit", "*", "stock", "stkid", $stkid);
$stk = pg_fetch_array($stkRs);
# Get balances
$idRs = get($prd, "max(id), min(id)", "stkledger", "yrdb='" . YR_DB . "' AND stkid", $stkid);
$id = pg_fetch_array($idRs);
if ($id['min'] != 0) {
$balRs = get($prd, "qty, (bqty - qty) as bqty, trantype, (balance - csamt) as balance", "stkledger", "id", $id['min']);
$bal = pg_fetch_array($balRs);
$cbalRs = get($prd, "balance", "stkledger", "id", $id['max']);
$cbal = pg_fetch_array($cbalRs);
/*
if($bal['trantype'] == 'dt'){
$bal['bqty'] = ($bal['bqty'] + $bal['qty']);
}else{
$bal['bqty'] = ($bal['bqty'] - $bal['qty']);
}
*/
} else {
if ($prd != PRD_DB) {
continue;
}
$balRs = get("cubit", "csamt as balance, units as bqty", "stock", "stkid", $stkid);
$bal = pg_fetch_array($balRs);
$cbal['balance'] = 0;
$cbal['bqty'] = 0;
}
$balance = sprint($bal['balance']);
$hide .= "<input type=hidden name=stkids[] value='{$stkid}'>";
$trans .= "<tr><td colspan=5><b>({$stk['stkcod']}) {$stk['stkdes']}</b></td></tr>";
$trans .= "<tr><td><br></td><td>Balance Brought Forward</td><td align=right>{$bal['bqty']}</td><td align=right>{$balance} </td><td align=right>{$balance} </td></tr>";
# --> transactio reding comes here <--- #
$dbal['balance'] = 0;
$dbal['bqty'] = 0;
$tranRs = nget($prd, "*", "stkledger", "yrdb='" . YR_DB . "' AND stkid", $stkid . " ORDER BY id ASC");
while ($tran = pg_fetch_array($tranRs)) {
$dbal['balance'] += $tran['csamt'];
$dbal['bqty'] += $tran['qty'];
# sprinting
$tran['csamt'] = sprint($tran['csamt']);
$tran['balance'] = sprint($tran['balance']);
# Format date
$tran['edate'] = explode("-", $tran['edate']);
$tran['edate'] = $tran['edate'][2] . "-" . $tran['edate'][1] . "-" . $tran['edate'][0];
$trans .= "<tr><td>{$tran['edate']}</td><td>{$tran['details']}</td><td>{$tran['qty']}</td><td align=right>{$tran['csamt']}</td><td align=right>{$tran['balance']}</td></tr>";
}
$dbal['balance'] = sprint($dbal['balance']);
$trans .= "<tr><td><br></td><td>Total for period {$prdname} to Date :</td><td align=right>{$dbal['bqty']}</td><td align=right>{$dbal['balance']} </td><td align=right>{$dbal['balance']} </td></tr>";
$trans .= "<tr><td colspan=5><br></td></tr>";
}
$sp = " ";
$view = "\n\t<center>\n\t<h3>Inventory Ledger</h3>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=75%>\n\t<tr><th>DATE</th><th>DETAILS</th><th>QTY</th><th>COST AMOUNT</th><th>BALANCE</th></tr>\n\t{$trans}\n\t</table>\n\t<p>";
include "temp.xls.php";
Stream("Ledger", $view);
}
示例12: sheet
#
#
#
#
#
#
#
#
#
# get settings
require "../settings.php";
require "../core-settings.php";
require "../libs/ext.lib.php";
$OUTPUT = sheet();
include "temp.xls.php";
Stream("TrialBalance", $OUTPUT);
exit;
# details
function sheet()
{
$rep = new grp_report();
$report = $rep->getReport();
$selected = $rep->selected;
$gdebit = $rep->totdebit;
$gcredit = $rep->totcredit;
$totdebit = 0;
$totcredit = 0;
$sql = "SELECT * FROM trial_bal WHERE div = '" . USER_DIV . "' order by topacc,accnum ASC";
$accRslt = db_exec($sql) or errDie("Unable to get group accounts information.");
while ($acc = pg_fetch_array($accRslt)) {
if (in_array($acc['accid'], $selected)) {
示例13: export
function export()
{
# Set up table to display in
$printStk = "\n\t\t<center>\n\t\t<h3>Available Stock</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Store</th>\n\t\t\t\t<th>Category</th>\n\t\t\t\t<th>Stock Code</th>\n\t\t\t\t<th>Stock Description</th>\n\t\t\t\t<th>Product class</th>\n\t\t\t\t<th>Available units</th>\n\t\t\t\t<th>Cost Amount</th>\n\t\t\t\t<th>Minimun Level</th>\n\t\t\t\t<th>Maximum Level</th>\n\t\t\t\t<th>Selling Price</th>\n\t\t\t</tr>";
# connect to database
db_connect();
# Query server
$i = 0;
$tot_avail = 0;
$tot_cost = 0;
$tot_sell = 0;
$sql = "SELECT * FROM stock WHERE units > 0 AND div = '" . USER_DIV . "' ORDER BY stkdes ASC";
$stkRslt = db_exec($sql) or errDie("Unable to retrieve stocks from database.");
if (pg_numrows($stkRslt) < 1) {
return "\n\t\t\t<li>There are no available stock found in Cubit.\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . " width='15%'>\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='main.php'>Main Menu</a></td>\n\t\t\t\t</tr>\n\t\t\t</table>";
}
while ($stk = pg_fetch_array($stkRslt)) {
$stk['units'] = $stk['units'] - $stk['alloc'];
# alternate bgcolor
# get warehouse
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$stk['whid']}'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
$printStk .= "\n\t\t\t<tr>\n\t\t\t\t<td>{$wh['whname']}</td>\n\t\t\t\t<td>{$stk['catname']}</td>\n\t\t\t\t<td>{$stk['stkcod']}</td>\n\t\t\t\t<td align='center'>{$stk['stkdes']}</td>\n\t\t\t\t<td>{$stk['prdcls']}</td>\n\t\t\t\t<td align='right'>" . sprint3($stk['units']) . "</td>\n\t\t\t\t<td align='right'>" . CUR . " " . sprint($stk['csamt']) . "</td>\n\t\t\t\t<td align='right'>{$stk['minlvl']}</td>\n\t\t\t\t<td align='right'>{$stk['maxlvl']}</td>\n\t\t\t\t<td align='left'>" . CUR . " " . sprint($stk['selamt'] * $stk['units']) . " (" . CUR . " {$stk['selamt']} each)</td>\n\t\t\t</tr>";
#handle totals
if ($stk['units'] > 0) {
$tot_avail += $stk['units'];
}
if ($stk['csamt'] > 0) {
$tot_cost += $stk['csamt'];
}
if ($stk['selamt'] > 0) {
$tot_sell += $stk['selamt'] * $stk['units'];
}
}
$printStk .= "\n\t\t<tr>\n\t\t\t<td colspan='5'>Totals:</td>\n\t\t\t<td align='right'>" . sprint3($tot_avail) . "</td>\n\t\t\t<td align='right'>" . CUR . " " . sprint($tot_cost) . "</td>\n\t\t\t<td colspan='2'></td>\n\t\t\t<td align='left'>" . CUR . " " . sprint($tot_sell) . "</td>\n\t\t</tr>\n\t\t</table>";
$OUTPUT = $printStk;
include "xls/temp.xls.php";
Stream("Report", $OUTPUT);
return $printStk;
}
示例14: report
function report($_POST)
{
extract($_POST);
$date = $year . "-" . $mon . "-" . $day;
$amount += 0;
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($user, "string", 1, 50, "Invalid user.");
$v->isOk($amount, "float", 1, 10, "Invalid amount.");
if (!checkdate($mon, $day, $year)) {
$v->isOk($date, "num", 1, 1, "Invalid order date.");
}
$met = remval($met);
# display errors, if any
if ($v->isError()) {
$err = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$err .= "<li class=err>{$e['msg']}</li>";
}
return $confirm;
}
if ($user != "0") {
$whe = " AND by='{$user}'";
} else {
$whe = "";
}
if ($met != "all") {
$whe .= " AND method='{$met}'";
} else {
$whe .= "";
}
db_conn("cubit");
$sql = "SELECT * FROM payrec WHERE date='{$date}' {$whe}";
$rslt = db_exec($sql) or errDie("Unable to retrieve pos report from Cubit.");
$cash = $cheque = $credit_card = $credit = $sales = 0;
while ($rec_data = pg_fetch_array($rslt)) {
switch (strtolower($rec_data["method"])) {
case "cash":
$cash += $rec_data["amount"];
break;
case "cheque":
$cheque += $rec_data["amount"];
break;
case "credit card":
$credit_card += $rec_data["amount"];
break;
case "credit":
$credit += $rec_data["amount"];
break;
}
$sales += $rec_data["amount"];
}
db_conn('cubit');
$Sl = "SELECT sum(amount) FROM payrec WHERE date='{$date}' {$whe}";
$Ry = db_exec($Sl) or errDie("Unable to get pos rec.");
$data = pg_fetch_array($Ry);
$amount = sprint($amount);
$expected = sprint($amount + $sales);
$Report = "<h3>POS Report: {$date}</h3>\n\t<table " . TMPL_tblDflts . " style='width: 100%'>\n\t<tr>\n\t\t<th colspan=2>Report</th>\n\t</tr>\n\t<tr class='bg-odd'>\n\t\t<td>Starting Amount</td>\n\t\t<td align='right'>" . CUR . " {$amount}</td>\n\t</tr>\n\t<tr class='bg-even'>\n\t\t<td>Cash</td>\n\t\t<td align='right'>" . sprint($cash) . "</td>\n\t</tr>\n\t<tr class='bg-odd'>\n\t\t<td>Cheque</td>\n\t\t<td align='right'>" . sprint($cheque) . "</td>\n\t</tr>\n\t<tr class='bg-even'>\n\t\t<td>Credit Card</td>\n\t\t<td align='right'>" . sprint($credit_card) . "</td>\n\t</tr>\n\t<tr class='bg-odd'>\n\t\t<td>Credit</td>\n\t\t<td align='right'>" . sprint($credit) . "</td>\n\t</td>\n\t<tr class='bg-even'>\n\t\t<td>Expected Amount</td>\n\t\t<td align='right'>" . CUR . " {$expected}</td>\n\t</tr>\n\t</table>";
include "temp.xls.php";
Stream("Report", $Report);
return $Report;
}
示例15: export
function export($_POST)
{
# Get vars
extract($_POST);
# Validate input
require_lib("validate");
$v = new validate();
$v->isOk($fday, "num", 1, 2, "Invalid from Date day.");
$v->isOk($fmon, "num", 1, 2, "Invalid from Date month.");
$v->isOk($fyear, "num", 1, 4, "Invalid from Date Year.");
$v->isOk($today, "num", 1, 2, "Invalid to Date day.");
$v->isOk($tomon, "num", 1, 2, "Invalid to Date month.");
$v->isOk($toyear, "num", 1, 4, "Invalid to Date Year.");
# mix dates
$fromdate = $fyear . "-" . $fmon . "-" . $fday;
$todate = $toyear . "-" . $tomon . "-" . $today;
if (!checkdate($fmon, $fday, $fyear)) {
$v->isOk($fromdate, "num", 1, 1, "Invalid from date.");
}
if (!checkdate($tomon, $today, $toyear)) {
$v->isOk($todate, "num", 1, 1, "Invalid to date.");
}
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>-" . $e["msg"] . "<br>";
}
return $confirm;
}
# Set up table to display in
$printOrd = "\n\t\t\t\t\t<center>\n\t\t\t\t\t<h3>Returned International Stock Orders</h3>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Purchase No.</th>\n\t\t\t\t\t\t\t<th>Return Date</th>\n\t\t\t\t\t\t\t<th>Supplier</th>\n\t\t\t\t\t\t\t<th>Total Cost Returned</th>\n\t\t\t\t\t\t</tr>";
# Connect to database
db_conn($prd);
# Query server
$i = 0;
$tot = 0;
$sql = "SELECT * FROM purchint_ret WHERE rdate >= '{$fromdate}' AND rdate <= '{$todate}' AND div = '" . USER_DIV . "' ORDER BY rdate DESC";
$stkpRslt = db_exec($sql) or errDie("Unable to retrieve stock Order from database.");
if (pg_numrows($stkpRslt) < 1) {
return "\n\t\t\t\t\t<li> There are no Returned Stock Orders found.</li>\n\t\t\t\t\t<p>\n\t\t\t\t\t<table border='0' cellpadding='2' cellspacing='1'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><a href='purchase-new.php'>New Purchase</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><a href='purchase-view.php'>View Purchases</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t</table>";
}
while ($stkp = pg_fetch_array($stkpRslt)) {
# date format
$date = explode("-", $stkp['rdate']);
$date = $date[2] . "-" . $date[1] . "-" . $date[0];
$tot += $stkp['subtot'];
$printOrd .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>{$stkp['purnum']}</td>\n\t\t\t\t\t\t\t<td>{$date}</td>\n\t\t\t\t\t\t\t<td>{$stkp['supname']}</td>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$stkp['subtot']}</td>\n\t\t\t\t\t\t</tr>";
$i++;
}
$tot = sprint($tot);
$printOrd .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='3'>Totals</td>\n\t\t\t\t\t\t<td align='right'>" . CUR . " {$tot}</td>\n\t\t\t\t\t\t<td><br></td>\n\t\t\t\t\t</tr>\n\t</table>";
include "xls/temp.xls.php";
Stream("Purchases", $printOrd);
return $printOrd;
}