本文整理汇总了PHP中sprint函数的典型用法代码示例。如果您正苦于以下问题:PHP sprint函数的具体用法?PHP sprint怎么用?PHP sprint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sprint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: display
function display()
{
extract($_REQUEST);
$fields = array();
$fields["search"] = "";
extract($fields, EXTR_SKIP);
$sql = "SELECT supno, supname, suppliers.balance AS sup_balance,\n\t\t\t\trecon_creditor_balances.balance AS recon_balance,\n\t\t\t\t(SELECT sum(amount) FROM cubit.recon_balance_ct \n\t\t\t\tWHERE supid=suppliers.supid) AS reason_total\n\t\t\tFROM cubit.suppliers\n\t\t\t\tLEFT JOIN cubit.recon_creditor_balances\n\t\t\t\t\tON suppliers.supid=recon_creditor_balances.supid\n\t\t\tWHERE supno ILIKE '{$search}%' OR supname ILIKE '{$search}%'\n\t\t\tORDER BY supno ASC";
$ct_rslt = db_exec($sql) or errDie("Unable to retrieve suppliers.");
$ct_out = "";
while ($ct_data = pg_fetch_array($ct_rslt)) {
if ($ct_data["recon_balance"] > $ct_data["reason_total"]) {
$variance = $ct_data["reason_total"] - $ct_data["recon_balance"];
} else {
$variance = $ct_data["recon_balance"] - $ct_data["reason_total"];
}
if ($variance == 0) {
continue;
}
$ct_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$ct_data['supno']}</td>\n\t\t\t<td>{$ct_data['supname']}</td>\n\t\t\t<td>{$ct_data['reason_total']}</td>\n\t\t\t<td>{$ct_data['recon_balance']}</td>\n\t\t\t<td>" . sprint($variance) . "</td>\n\t\t</tr>";
}
if (empty($ct_out)) {
$ct_out = "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='6'><li>No results found</li></td>\n\t\t</tr>";
}
$OUTPUT = "\n\t<h3>Creditor Reason Recon Variance Report</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='2'>Search</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><input type='text' name='search' value='{$search}' /></td>\n\t\t\t<td><input type='submit' value='Search' /></td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Supplier No.</th>\n\t\t\t<th>Supplier Name</th>\n\t\t\t<th>Reason Total</th>\n\t\t\t<th>Balance According to Creditor</th>\n\t\t\t<th>Variance</th>\n\t\t</tr>\n\t\t{$ct_out}\n\t</table>";
return $OUTPUT;
}
示例3: display
function display()
{
extract($_REQUEST);
$fields = array();
$fields["search"] = "";
extract($fields, EXTR_SKIP);
if (is_numeric($search)) {
$invnum_w = "OR invnum='{$search}'";
} else {
$invnum_w = "";
}
$sql = "SELECT invid, invnum, cusname, total, hire_invid, accepted, hire_invnum\r\n\t\t\tFROM cubit.nons_invoices\r\n\t\t\tWHERE done='y' AND hire_invid>0 AND cusname ILIKE '%{$search}%' {$invnum_w}";
$inv_rslt = db_exec($sql) or errDie("Unable to retrieve hire invoices.");
$inv_out = "";
while ($inv_data = pg_fetch_array($inv_rslt)) {
if ($inv_data["accepted"] != "note") {
$cnote = "\r\n\t\t\t<td>\r\n\t\t\t\t<a href='hire-invoice-note.php?invid={$inv_data['invid']}'>\r\n\t\t\t\t\tCredit Note\r\n\t\t\t\t</a>\r\n\t\t\t</td>";
} else {
$cnote = "<td> </td>";
}
$inv_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='javascript:printer(\"hire/hire_note_reprint.php?invid={$inv_data['hire_invid']}\")'>\r\n\t\t\t\t\tH{$inv_data['hire_invnum']}\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t\t<td>{$inv_data['invnum']}</td>\r\n\t\t\t<td>{$inv_data['cusname']}</td>\r\n\t\t\t<td>" . CUR . sprint($inv_data["total"]) . "</td>\r\n\t\t\t<td><a href='javascript:popupOpen(\"nons-invoice-reprint.php?invid={$inv_data['invid']}\")'>Reprint</a></td>\r\n\t\t\t{$cnote}\r\n\t\t</tr>";
}
if (empty($inv_out)) {
$inv_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='5'><li>Please enter customer name or hire no.</li></td>\r\n\t\t</tr>";
}
$OUTPUT = "<h3>View Hire Invoices</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='2'>Enter Hire No or Customer Name</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td><input type='text' name='search' value='{$search}' /></td>\r\n\t\t\t<td><input type='submit' value='Search' style='width: 100%' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Total</th>\r\n\t\t\t<th colspan='2'>Options</th>\r\n\t\t</tr>\r\n\t\t{$inv_out}\r\n\t</table>";
return $OUTPUT;
}
示例4: confirm
function confirm()
{
extract($_REQUEST);
$sql = "DROP TABLE cubit.import_assets";
db_exec($sql);
$sql = "CREATE TABLE cubit.import_assets (\r\n\t\t\t\tid serial,\r\n\t\t\t\tserial varchar,\r\n\t\t\t\tlocat varchar,\r\n\t\t\t\tdes varchar,\r\n\t\t\t\tdate date,\r\n\t\t\t\tbdate date,\r\n\t\t\t\tamount numeric default 0,\r\n\t\t\t\tdiv numeric default 2,\r\n\t\t\t\tgrpid numeric default 0,\r\n\t\t\t\taccdep numeric default 0,\r\n\t\t\t\tdep_perc numeric default 0,\r\n\t\t\t\tdep_month varchar,\r\n\t\t\t\tserial2 varchar,\r\n\t\t\t\tteam_id numeric default 0,\r\n\t\t\t\tpuramt numeric default 0,\r\n\t\t\t\tconacc numeric default 0,\r\n\t\t\t\tsaledate date,\r\n\t\t\t\tsaleamt numeric default 0,\r\n\t\t\t\tinvid numeric default 0,\r\n\t\t\t\tautodepr_date date,\r\n\t\t\t\tsdate date,\r\n\t\t\t\ttemp_asset varchar default 'n',\r\n\t\t\t\tnonserial varchar,\r\n\t\t\t\ttype_id numeric default 0,\r\n\t\t\t\tsplit_from numeric default 1,\r\n\t\t\t\tdays numeric default 0,\r\n\t\t\t\ton_hand numeric default 0,\r\n\t\t\t\tsvdate date,\r\n\t\t\t\tprice numeric(16,2) default 0,\r\n\t\t\t\tper_day numeric(16,2) default 0,\r\n\t\t\t\tper_hour numeric(16,2) default 0,\r\n\t\t\t\tper_week numeric(16,2) default 0\r\n\t\t\t)";
@db_exec($sql);
$sql = "DELETE FROM import_assets";
db_exec($sql) or errDie("Unable to clear import table.");
$lines = file($_FILES["filename"]["tmp_name"]);
$counter = 0;
$items_out = "";
foreach ($lines as $line) {
$line_arr = explode("|", trim($line));
$sql = "\r\n\t\t\tINSERT INTO import_assets (\r\n\t\t\t\tserial, locat, des, date, bdate, \r\n\t\t\t\tamount, div, grpid, accdep, dep_perc, dep_month, \r\n\t\t\t\tserial2, team_id, puramt, conacc, saledate, saleamt, \r\n\t\t\t\tinvid, autodepr_date, sdate, temp_asset, nonserial, type_id, \r\n\t\t\t\tsplit_from, days, on_hand, svdate, price, per_day, \r\n\t\t\t\tper_hour, per_week\r\n\t\t\t) VALUES (\r\n\t\t\t\t'{$line_arr['1']}', '', '{$line_arr['2']}', '{$line_arr['38']}', '{$line_arr['32']}', \r\n\t\t\t\t'{$line_arr['30']}', '2', '4', '0', '{$line_arr['41']}', 'no', \r\n\t\t\t\t'{$line_arr['36']}', '0', '{$line_arr['30']}', '0', 'now', '0.00', \r\n\t\t\t\t'0', 'now', 'now', 'n', '0', '0', \r\n\t\t\t\t'1', '0', '0', 'now', '{$line_arr['9']}', '{$line_arr['9']}', \r\n\t\t\t\t'{$line_arr['13']}', '{$line_arr['11']}'\r\n\t\t\t)";
db_exec($sql) or errDie("Unable to add asset {$line_arr['1']} {$line_arr['2']}.");
$line_id = pglib_lastid("cubit.import_assets", "id");
// Convert the date from YYYYMMDD to YYYY-MM-DD
if (strlen($line_arr[32]) == 8 && !preg_match("/\\-/", $line_arr["32"])) {
$line_arr[32] = substr($line_arr['32'], 0, 4) . "-" . substr($line_arr['32'], 4, 2) . "-" . substr($line_arr['32'], 6, 2);
}
if (strlen($line_arr[38]) == 8 && !preg_match("/\\-/", $line_arr["32"])) {
$line_arr[38] = substr($line_arr['38'], 0, 4) . "-" . substr($line_arr['38'], 4, 2) . "-" . substr($line_arr['38'], 6, 2);
}
if (empty($line_arr[1])) {
$line_arr[36] = $line_arr[6];
}
$items_out .= "\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td><input type='hidden' name='serial[]' value='{$line_arr['1']}' />{$line_arr['1']}</td>\r\n\t\t\t\t<td><input type='hidden' name='locat[]' value='' /></td>\r\n\t\t\t\t<td><input type='hidden' name='des' value='{$line_arr['2']}' />{$line_arr['2']}</td>\r\n\t\t\t\t<td><input type='hidden' name='date' value='{$line_arr['38']}' />{$line_arr['38']}</td>\r\n\t\t\t\t<td><input type='hidden' name='bdate' value='{$line_arr['32']}' />{$line_arr['32']}</td>\r\n\t\t\t\t<td align='right'><input type='hidden' name='puramt' value='{$line_arr['30']}' />" . sprint($line_arr[30]) . "</td>\r\n\t\t\t\t<td align='right'><input type='text' name='per_hour[{$line_id}]' value='" . sprint($line_arr[13]) . "' size='5' /></td>\r\n\t\t\t\t<td align='right'><input type='text' name='per_day[{$line_id}]' value='" . sprint($line_arr[9]) . "' size='5' /></td>\r\n\t\t\t\t<td align='right'><input type='text' name='per_week[{$line_id}]' value='" . sprint($line_arr[11]) . "' size='5' /></td>\r\n\t\t\t</tr>";
}
$OUTPUT = "\r\n\t\t<center>\r\n\t\t<h3>Import Assets</h3>\r\n\t\t<form method='POST' action='" . SELF . "'>\r\n\t\t\t<input type='hidden' name='key' value='write' />\r\n\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Serial</th>\r\n\t\t\t\t<th>Location</th>\r\n\t\t\t\t<th>Description</th>\r\n\t\t\t\t<th>Date Received/Purchased</th>\r\n\t\t\t\t<th>Date Added</th>\r\n\t\t\t\t<th>Cost Amount</th>\r\n\t\t\t\t<th>Per Hour</th>\r\n\t\t\t\t<th>Per Day</th>\r\n\t\t\t\t<th>Per Week</th>\r\n\t\t\t</tr>\r\n\t\t\t{$items_out}\r\n\t\t</table>\r\n\t\t\t<input type='submit' value='Write »' />\r\n\t\t</form>\r\n\t\t</center>";
return $OUTPUT;
}
示例5: display
function display($msg = "")
{
extract($_REQUEST);
$fields = array();
$fields["search"] = "";
extract($fields, EXTR_SKIP);
$sql = "SELECT assets.id, des, locat, per_day, per_hour, per_week, serial\r\n\t\t\t\tFROM cubit.assets\r\n\t\t\t\t\tLEFT JOIN hire.basis_prices\r\n\t\t\t\t\t\tON assets.id = basis_prices.assetid\r\n\t\t\t\tWHERE remaction IS NULL AND (assets.id ILIKE '{$search}%' OR\r\n\t\t\t\t\tdes ILIKE '{$search}%' OR locat ILIKE '{$search}%' OR\r\n\t\t\t\t\tper_day ILIKE '%{$search}%' OR per_hour ILIKE '%{$search}%' OR\r\n\t\t\t\t\tper_week ILIKE '%{$search}%' OR serial ILIKE '{$search}%')\r\n\t\t\t\tORDER BY des ASC";
$asset_rslt = db_exec($sql);
$basis_out = "";
while ($asset_data = pg_fetch_array($asset_rslt)) {
if (empty($asset_data["per_hour"])) {
$asset_data["per_hour"] = "0.00";
}
if (empty($asset_data["per_day"])) {
$asset_data["per_day"] = "0.00";
}
if (empty($asset_data["per_week"])) {
$asset_data["per_week"] = "0.00";
}
$basis_out .= "\r\n\t\t<input type='hidden' name='asset[]' value='{$asset_data['id']}' />\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$asset_data['des']}</td>\r\n\t\t\t<td>{$asset_data['serial']}</td>\r\n\t\t\t<td>{$asset_data['locat']}</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . CUR . "\r\n\t\t\t\t<input type='text' name='hour[{$asset_data['id']}]'\r\n\t\t\t\tvalue='" . sprint($asset_data["per_hour"]) . "' size='5'\r\n\t\t\t\tstyle='text-align: right' />\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . CUR . "\r\n\t\t\t\t<input type='text' name='day[{$asset_data['id']}]'\r\n\t\t\t\tvalue='" . sprint($asset_data["per_day"]) . "' size='5'\r\n\t\t\t\tstyle='text-align: right' />\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . CUR . "\r\n\t\t\t\t<input type='text' name='week[{$asset_data['id']}]'\r\n\t\t\t\tvalue='" . sprint($asset_data["per_week"]) . "' size='5'\r\n\t\t\t\tstyle='text-align: right' />\r\n\t\t\t</td>\r\n\t\t</tr>";
}
if (empty($basis_out)) {
$basis_out = "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='6'><li>No results found.</li></td>\r\n\t\t</tr>";
}
$OUTPUT = "<center>\r\n\t<h3>Default Basis Prices</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='2'>Search</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td><input type='text' name='search' value='{$search}' /></td>\r\n\t\t\t<td><input type='submit' value='Search' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<input type='hidden' name='key' value='save' />\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t{$msg}\r\n\t\t<tr>\r\n\t\t\t<th>Plant</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t\t<th>Location</th>\r\n\t\t\t<th>Hour</th>\r\n\t\t\t<th>Day</th>\r\n\t\t\t<th>Week</th>\r\n\t\t</tr>\r\n\t\t{$basis_out}\r\n\t\t<tr>\r\n\t\t\t<td colspan='6' align='center'>\r\n\t\t\t\t<input type='submit' value='Set Basis »'\r\n\t\t\t\tstyle='font-weight: bold' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>";
return $OUTPUT;
}
示例6: adjust_display
function adjust_display()
{
extract($_REQUEST);
$fields = array();
$fields["page"] = 1;
extract($fields, EXTR_SKIP);
$sql = "SELECT stock.stkid, bar, stkcod, stkdes, catname, csprice,\n\t\t\t\t(qty-units) AS adjust_qty\n\t\t\tFROM cubit.stock_take\n\t\t\t\tLEFT JOIN cubit.stock ON stock.stkid=stock_take.stkid\n\t\t\tWHERE adjusted='0' AND page='{$page}'\n\t\t\tORDER BY stkcod ASC";
$adjust_rslt = db_exec($sql) or errDie("Unable to retrieve adjustments.");
$adjust_out = "";
while ($adjust_data = pg_fetch_array($adjust_rslt)) {
if ($adjust_data["adjust_qty"] == 0) {
continue;
}
$value = $adjust_data["csprice"] * $adjust_data["adjust_qty"];
$adjust_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$adjust_data['bar']}</td>\n\t\t\t<td>{$adjust_data['catname']}</td>\n\t\t\t<td>{$adjust_data['stkcod']}</td>\n\t\t\t<td>{$adjust_data['stkdes']}</td>\n\t\t\t<td align='center'>" . sprint3($adjust_data['adjust_qty']) . "</td>\n\t\t\t<td align='right'>" . sprint($value) . "</th>\n\t\t\t<td>\n\t\t\t\t<input type='hidden' name='adjust_qty[{$adjust_data['stkid']}]'\n\t\t\t\tvalue='{$adjust_data['adjust_qty']}' />\n\t\t\t\t<input type='submit' name='update[{$adjust_data['stkid']}]'\n\t\t\t\tvalue='Adjust' />\n\t\t\t</td>\n\t\t</tr>";
}
if (empty($adjust_out)) {
$adjust_out = "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='7'>\n\t\t\t\t<li>No results found for this page.</li>\n\t\t\t</td>\n\t\t</tr>";
}
$sql = "SELECT max(page) FROM cubit.stock_take";
$mp_rslt = db_exec($sql) or errDie("Unable to retrieve total pages.");
$max_page = pg_fetch_result($mp_rslt, 0);
if ($page < $max_page) {
$adjust_btn = "\n\t\t\t<a href='" . SELF . "?key=adjust_display&page=" . ($page + 1) . "'>\n\t\t\t\tNext »\n\t\t\t</a>";
} else {
$adjust_btn = "";
}
$OUTPUT = "\n\t<center>\n\t<h3>Stock Take - Adjustments</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='2'>Page</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>\n\t\t\t\t<input type='text' name='page' value='{$page}' size='3'\n\t\t\t\tstyle='font-weight: bold; text-align: center' />\n\t\t\t</td>\n\t\t\t<td><input type='submit' value='OK' /></td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t<form method='post' action='" . SELF . "'>\n\t<input type='hidden' name='key' value='adjust_update' />\n\t<input type='hidden' name='page' value='{$page}' />\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Barcode</th>\n\t\t\t<th>Category</th>\n\t\t\t<th>Stock Code</th>\n\t\t\t<th>Stock Description</th>\n\t\t\t<th>Adjustment</th>\n\t\t\t<th>Value</th>\n\t\t\t<th> </th>\n\t\t</tr>\n\t\t{$adjust_out}\n\t</table>\n\t<input type='submit' name='button[page_complete]' value='Adjust Page' />\n\t<br />\n\t{$adjust_btn}\n\t</center>";
return $OUTPUT;
}
示例7: display
function display()
{
extract($_REQUEST);
$fields = array();
$fields["from_year"] = date("Y");
$fields["from_month"] = date("m");
$fields["from_day"] = date("d");
$fields["to_year"] = date("Y");
$fields["to_month"] = date("m");
$fields["to_day"] = date("d");
extract($fields, EXTR_SKIP);
$from_date = "{$from_year}-{$from_month}-{$from_day}";
$to_date = "{$to_year}-{$to_month}-{$to_day}";
$sql = "\n\tSELECT invnum, cash, cheque, credit, sdate, cusname\n\tFROM cubit.nons_invoices\n\tWHERE sdate BETWEEN '{$from_date}' AND '{$to_date}' AND hire_invnum!='0'";
$inv_rslt = db_exec($sql) or errDie("Unable to retrieve invoices.");
$total_cash = 0;
$total_cheque = 0;
$total_credit = 0;
$inv_out = "";
while ($inv_data = pg_fetch_array($inv_rslt)) {
$inv_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$inv_data['sdate']}</td>\n\t\t\t<td align='center'>{$inv_data['invnum']}</td>\n\t\t\t<td>{$inv_data['cusname']}</td>\n\t\t\t<td align='right'>" . sprint($inv_data["cash"]) . "</td>\n\t\t\t<td align='right'>" . sprint($inv_data["cheque"]) . "</td>\n\t\t\t<td align='right'>" . sprint($inv_data["credit"]) . "</td>\n\t\t</tr>";
$total_cash += $inv_data["cash"];
$total_cheque += $inv_data["cheque"];
$total_credit += $inv_data["credit"];
}
if (empty($inv_out)) {
$inv_out = "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='6'><li>No results found.</li></td>\n\t\t</tr>";
}
$OUTPUT = "\n\t<center>\n\t<h3>Daily Hire Cashup Report</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='4'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t<td> <b>To</b> </td>\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t<td><input type='submit' value='Select' /></td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Date</th>\n\t\t\t<th>Invoice No</th>\n\t\t\t<th>Customer</th>\n\t\t\t<th>Cash</th>\n\t\t\t<th>Cheque</th>\n\t\t\t<th>Credit Card</th>\n\t\t</tr>\n\t\t{$inv_out}\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='3'><b>Total</b></td>\n\t\t\t<td align='right'><b>" . sprint($total_cash) . "</b></td>\n\t\t\t<td align='right'><b>" . sprint($total_cheque) . "</b></td>\n\t\t\t<td align='right'><b>" . sprint($total_credit) . "</b></td>\n\t</table>\n\t</center>";
return $OUTPUT;
}
示例8: display
function display()
{
extract($_REQUEST);
$fields = array();
$fields["from_year"] = date("Y");
$fields["from_month"] = date("m");
$fields["from_day"] = "01";
$fields["to_year"] = date("Y");
$fields["to_month"] = date("m");
$fields["to_day"] = date("d");
extract($fields, EXTR_SKIP);
$from_date = "{$from_year}-{$from_month}-{$from_day}";
$to_date = "{$to_year}-{$to_month}-{$to_day}";
$sql = "\n\tSELECT id, stock.stkcod, stock.stkdes, qty, cost_per_unit, (qty*cost_per_unit) AS total,\n\t\textract('epoch' FROM timestamp) AS e_time\n\tFROM cubit.manu_hist_main\n\t\tLEFT JOIN cubit.stock ON manu_hist_main.stkid=stock.stkid\n\tWHERE timestamp BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59'\n\tORDER BY timestamp DESC";
$main_rslt = db_exec($sql) or errDie("Unable to retrieve main items.");
$hist_out = "";
while ($main_data = pg_fetch_array($main_rslt)) {
$hist_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><b>" . date("d-m-Y", $main_data["e_time"]) . "</b></td>\n\t\t\t\t<td><b>({$main_data['stkcod']}) {$main_data['stkdes']}</b></td>\n\t\t\t\t<td align='center'><b>{$main_data['qty']}</b></td>\n\t\t\t\t<td align='right'><b>" . sprint($main_data["cost_per_unit"]) . "</b></td>\n\t\t\t\t<td align='right'><b>" . sprint($main_data["total"]) . "</b></td>\n\t\t\t</tr>";
$sql = "\n\t\tSELECT stkcod, stkdes, qty, cost_per_unit, (qty*cost_per_unit) AS total\n\t\tFROM cubit.manu_hist_sub\n\t\t\tLEFT JOIN cubit.stock ON manu_hist_sub.stkid=stock.stkid\n\t\tWHERE main_id='{$main_data['id']}'\n\t\tORDER BY timestamp ASC";
$sub_rslt = db_exec($sql) or errDie("Unable to retrieve sub items.");
while ($sub_data = pg_fetch_array($sub_rslt)) {
$hist_out .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td>({$sub_data['stkcod']}) {$sub_data['stkdes']}</td>\n\t\t\t\t\t<td align='center'>{$sub_data['qty']}</td>\n\t\t\t\t\t<td align='right'>" . sprint($sub_data["cost_per_unit"]) . "</td>\n\t\t\t\t\t<td align='right'>" . sprint($sub_data["total"]) . "</td>\n\t\t\t\t</tr>";
}
}
if (empty($hist_out)) {
$hist_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='5'><li>No results found.</li></td>\n\t\t\t</tr>";
}
$OUTPUT = "\n\t\t<center>\n\t\t<h3>Manufacturing Cost Report</h3>\n\t\t<form method='post' action='" . SELF . "'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th colspan='4'>Date Range</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t\t<td> <b>To</b> </td>\n\t\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t\t<td><input type='submit' value='Select' style='font-weight:bold' /></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Stock</th>\n\t\t\t\t<th>Qty</th>\n\t\t\t\t<th>Cost per Unit</th>\n\t\t\t\t<th>Total</th>\n\t\t\t</tr>\n\t\t\t{$hist_out}\n\t\t</table>\n\t\t</center>";
return $OUTPUT;
}
示例9: view
function view($frm)
{
extract($_REQUEST);
if ($msg = cForm::validateValue($supid, "num", 1, 10)) {
return "<li class='err'>The supplier ID is invalid. {$msg}</li>\n\t\t\t<input type='button' onclick='window.history.back();' value='« Correction' />";
}
/* @var frm cForm */
$frm->settitle("Supplier Pricelist");
$frm->setkey("import");
$frm->add_heading("Import New Pricelist");
$frm->add_message("\n\t\t\t<li class='err'>Pricelists has to be in CSV format and to import them\n\t\t\t\tyou have to specify the order and format of the fields<br />\n\t\t\t\tby selecting what each of them are in the same order as they appear\n\t\t\t\tin the file. Only the stock code<br />\n\t\t\t\tand the price is needed, so for the other fields you simply\n\t\t\t\tselect the '-' options.\n\t\t\t</li>", "inst");
$frm->add_message("\n\t\t\t<li class='err'>Note that the stock codes of the supplier should be added\n\t\t\t\tby editing the stock item and selecting the<br />\n\t\t\t\t'Add/Edit/Remove' button below the stock code input field.\n\t\t\t</li>", "suppstkcod");
$frm->add_hidden("supid", $supid, "num");
$frm->add_file("Pricelist", "supplist");
$frm->add_checkbox("VAT Inclusive", "vatinc", true, true);
$frm->add_heading("Comma Seperated Volume (CSV) Fields");
$frm->add_layout("\n\t<tr %bgc>\n\t\t<td colspan='2' nowrap='t'>\n\t\t\t<strong>\n\t\t\t\t%fldonly ,\n\t\t\t\t%fldonly ,\n\t\t\t\t%fldonly ,\n\t\t\t\t%fldonly ,\n\t\t\t\t%fldonly ,\n\t\t\t\t%fldonly\n\t\t\t</strong>\n\t\t</td>\n\t</tr>");
// field types
$ft = array("ignore" => "-", "stkcod" => "Stock Code", "price" => "Price");
$frm->add_select("", "fld[0]", "stkcod", $ft, "string", "5:6");
$frm->add_select("", "fld[1]", "price", $ft, "string", "5:6");
$frm->add_select("", "fld[2]", "ignore", $ft, "string", "5:6");
$frm->add_select("", "fld[3]", "ignore", $ft, "string", "5:6");
$frm->add_select("", "fld[4]", "ignore", $ft, "string", "5:6");
$frm->add_select("", "fld[5]", "ignore", $ft, "string", "5:6");
$frm->add_ctrlbtn("Import", "submit", "btn_import");
$OUT = $frm->getfrm_input();
/* supplier info */
$suppinfo = qrySupplier($supid);
$supcur = qryCurrency($suppinfo["fcid"]);
$supcur = $supcur["symbol"];
/* list current pricelist */
$OUT .= "\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th>Stock Code</td>\n\t\t<th>Supplier Stock Code</th>\n\t\t<th>Current Supplier Price</th>\n\t\t<th>Current Selling Price</th>\n\t</tr>";
$sql = "SELECT pli.*\n\t\t\tFROM exten.spricelist pl INNER JOIN exten.splist_prices pli\n\t\t\t\tON pl.listid=pli.listid\n\t\t\tWHERE pl.suppid='{$supid}'";
$qry = new dbSql($sql);
$qry->run();
if ($qry->num_rows() <= 0) {
$OUT .= "\n\t\t<tr bgcolor='" . bgcolorc(0) . "'>\n\t\t\t<td colspan='4'>No pricelist.</td>\n\t\t</tr>";
}
$i = 0;
while ($row = $qry->fetch_array()) {
if (empty($row["supstkcod"])) {
$our_stkcod = "No supplier stock code";
$our_price = "";
} else {
if (($stkid = suppStkid($supid, $row["supstkcod"])) === false) {
$our_stkcod = "<li class='err'>No such stock item.\n\t\t\t\t<a href='stock-add.php?stkcod={$row['supstkcod']}&supid={$supid}&supstkcod={$row['supstkcod']}'>Add Stock</a> /\n\t\t\t\t<a href='stock-view.php'>Edit Stock</li>";
$our_price = "";
} else {
$stkrow = qryStock($stkid, "stkcod, selamt");
$our_stkcod = "<strong>{$stkrow['stkcod']}</strong>";
$our_price = CUR . " " . sprint($stkrow["selamt"]);
}
}
$OUT .= "\n\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t<td>{$our_stkcod}</td>\n\t\t\t<td>{$row['supstkcod']}</td>\n\t\t\t<td align='right'>{$supcur} " . sprint($row["price"]) . "</td>\n\t\t\t<td align='right'>{$our_price}</td>\n\t\t</tr>";
}
$OUT .= "\n\t</table>";
return $OUT;
}
示例10: set
/**
* Set a required item.
*
* @param string $key
* @param mixed $value
* @return Factory
*/
public function set($key, $value)
{
if (!in_array($key, $this->_requires)) {
throw new Exception(sprint("Can not set key that is not required: '%s'", $key));
}
$this->_items[$key] = $value;
return $this;
}
示例11: display
function display()
{
extract($_REQUEST);
$fields = array();
$fields["from_year"] = date("Y");
$fields["from_month"] = date("m");
$fields["from_day"] = date("d");
$fields["to_year"] = date("Y");
$fields["to_month"] = date("m");
$fields["to_day"] = date("d");
$fields["group_id"] = 0;
$fields["type_id"] = 0;
extract($fields, EXTR_SKIP);
$sql = "SELECT grpid, grpname FROM cubit.assetgrp ORDER BY grpname ASC";
$group_rslt = db_exec($sql) or errDie("Unable to retrieve groups.");
$group_sel = "\n\t<select name='group_id' style='width: 100%'>\n\t\t<option value='0'>[All]</option>";
while ($group_data = pg_fetch_array($group_rslt)) {
$sel = $group_id == $group_data["grpid"] ? "selected='t'" : "";
$group_sel .= "\n\t\t<option value='{$group_data['grpid']}'>\n\t\t\t{$group_data['grpname']}\n\t\t</option>";
}
$group_sel .= "</select>";
$sql = "SELECT id, name FROM cubit.asset_types ORDER BY name ASC";
$type_rslt = db_exec($sql) or errDie("Unable to retrieve asset types.");
$type_sel = "\n\t<select name='type_id' style='width: 100%'>\n\t\t<option value='0'>[All]</option>";
while ($type_data = pg_fetch_array($type_rslt)) {
$sel = $type_id == $type_data["id"] ? "selected='t'" : "";
$type_sel .= "\n\t\t<option value='{$type_data['id']}'>\n\t\t\t{$type_data['name']}\n\t\t</option>";
}
$type_sel .= "</select>";
$OUTPUT = "\n\t<center>\n\t<h3>Asset Sale Report</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='4'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><b>From</b> </td>\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t<td> <b>To</b> </td>\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th colspan='2'>Group</th>\n\t\t\t<th colspan='2'>Type</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='2'>{$group_sel}</td>\n\t\t\t<td colspan='2'>{$type_sel}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='4' align='center'>\n\t\t\t\t<input type='submit' value='Select' style='font-weight: bold' />\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t</form>";
$where_ar = array();
if ($group_id > 0) {
$where_ar[] = "grpid='{$group_id}'";
}
if ($type_id > 0) {
$where_ar[] = "type_id='{$type_id}'";
}
$where_sql = implode(" AND ", $where_ar);
if (!empty($where_sql)) {
$where_sql .= " AND ";
}
$sql = "\n\tSELECT id, des, serial, serial2, nonserial, saledate, saleamt\n\tFROM cubit.assets_prev\n\tWHERE {$where_sql} div='" . USER_DIV . "' AND remaction='Sale'";
$sale_rslt = db_exec($sql) or errDie("Unable to retrieve sales.");
$sale_out = "";
while ($sale_data = pg_fetch_array($sale_rslt)) {
if ($sale_data["nonserial"]) {
$qty_sold = $sale_data["serial2"];
} else {
$qty_sold = 1;
}
$sale_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$sale_data['des']}</td>\n\t\t\t<td>{$sale_data['serial']}</td>\n\t\t\t<td align='center'>{$qty_sold}</td>\n\t\t\t<td align='center'>{$sale_data['saledate']}</td>\n\t\t\t<td align='right'>" . sprint($sale_data["saleamt"]) . "</td>\n\t\t\t<td align='right'>{$sale_data['accdep']}</td>\n\t\t</tr>";
}
if (empty($sale_out)) {
$sale_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='5'>\n\t\t\t\t<li>No results found from your current selection</li>\n\t\t\t</td>\n\t\t</tr>";
}
$OUTPUT .= "\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Asset</th>\n\t\t\t<th>Serial</th>\n\t\t\t<th>Qty Sold</th>\n\t\t\t<th>Sale Date</th>\n\t\t\t<th>Amount</th>\n\t\t\t<th>Accumulated Depreciation</th>\n\t\t\t<th>Profit / Loss</th>\n\t\t</tr>\n\t\t{$sale_out}\n\t</table>\n\t</center>";
return $OUTPUT;
}
示例12: details
function details($_GET)
{
# get vars
extract($_GET);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($purid, "num", 1, 20, "Invalid Order number.");
# display errors, if any
if ($v->isError()) {
$err = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$err .= "<li class='err'>" . $e["msg"] . "</li>";
}
$confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# Get Order info
db_connect();
$sql = "SELECT * FROM nons_purchases WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
$purRslt = db_exec($sql) or errDie("Unable to get Order information");
if (pg_numrows($purRslt) < 1) {
return "<i class='err'>Not Found</i>";
}
$pur = pg_fetch_array($purRslt);
/* --- Start Products Display --- */
# Products layout
$products = "\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>ITEM NUMBER</th>\n\t\t\t\t\t\t\t<th>DESCRIPTION</th>\n\t\t\t\t\t\t\t<th>QTY OUTSTANDING</th>\n\t\t\t\t\t\t\t<th>UNIT PRICE</th>\n\t\t\t\t\t\t\t<th>DELIVERY DATE</th>\n\t\t\t\t\t\t\t<th>AMOUNT</th>\n\t\t\t\t\t\t<tr>";
# get selected stock in this Order
db_connect();
$sql = "SELECT * FROM nons_pur_items WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
$stkdRslt = db_exec($sql);
while ($stkd = pg_fetch_array($stkdRslt)) {
# format date
list($dyear, $dmon, $dday) = explode("-", $stkd['ddate']);
# put in product
$products .= "\n\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t<td>{$stkd['cod']}</td>\n\t\t\t\t\t\t\t\t<td>{$stkd['des']}</td>\n\t\t\t\t\t\t\t\t<td>{$stkd['qty']}</td>\n\t\t\t\t\t\t\t\t<td nowrap>" . CUR . " {$stkd['unitcost']}</td>\n\t\t\t\t\t\t\t\t<td>{$dday}-{$dmon}-{$dyear}</td>\n\t\t\t\t\t\t\t\t<td nowrap>" . CUR . " {$stkd['amt']}</td>\n\t\t\t\t\t\t\t</tr>";
}
$products .= "</table>";
/* --- Start Some calculations --- */
# Get subtotal
$SUBTOT = sprint($pur['subtot']);
# Get Total
$TOTAL = sprint($pur['total']);
# Get vat
$VAT = sprint($pur['vat']);
/* --- End Some calculations --- */
# format date
list($pyear, $pmon, $pday) = explode("-", $pur['pdate']);
// format the vat inclusive variable for nicer display
if ($pur['vatinc'] == "novat") {
$pur['vatinc'] = "No Vat";
}
/* -- Final Layout -- */
$details = "\n\t\t\t\t\t<center>\n\t\t\t\t\t<h3>Non-Stock Order Details</h3>\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='95%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td valign='top'>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th colspan='2'> Supplier Details </th>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Supplier</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['supplier']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Account number</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'><pre>{$pur['supaddr']}</pre></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td valign='top' align='right'>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th colspan='2'> Non-Stock Order Details </th>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Non-Stock Order No.</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['purnum']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Order No.</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['ordernum']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Supplier Invoice No</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['supinv']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Delivery Ref No.</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['refno']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Terms</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['terms']} Days</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Date</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pday}-{$pmon}-{$pyear}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>VAT Inclusive</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['vatinc']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Delivery Charges</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>" . CUR . " {$pur['shipchrg']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'>{$products}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th width='40%'>Quick Links</th>\n\t\t\t\t\t\t\t\t\t\t<th width='45%'>Remarks</th>\n\t\t\t\t\t\t\t\t\t\t<td rowspan='5' valign='top' width='15%'><br></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td class='" . bg_class() . "'><a href='nons-purchase-new.php'>New Non-Stock Order</a></td>\n\t\t\t\t\t\t\t\t\t\t<td class='" . bg_class() . "' rowspan='4' align='center' valign='top'>" . nl2br($pur['remarks']) . "</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td><a href='nons-purchase-view.php'>View Non-Stock Orders</a></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td align='right'>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='80%'>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>SUBTOTAL</td>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$pur['subtot']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Delivery Charges</td>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$pur['shipping']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>VAT @ " . TAX_VAT . " %</td>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$pur['vat']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<th>GRAND TOTAL</th>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$pur['total']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</form>\n\t\t\t\t\t</center>";
return $details;
}
示例13: show_listing
function show_listing()
{
db_connect();
#######################[ LOANS APPLICATIONS ]##########################
$get_loans = "SELECT * FROM loan_requests ORDER BY loanamt";
$run_loans = db_exec($get_loans) or errDie("Unable to get loan applications.");
if (pg_numrows($run_loans) < 1) {
$listing = "<tr class='" . bg_class() . "'><td colspan='8'>No Loan Applications Found.</td></tr>";
} else {
$listing = "";
while ($larr = pg_fetch_array($run_loans)) {
$get_emp = "SELECT fnames,sname FROM employees WHERE empnum = '{$larr['empnum']}' LIMIT 1";
$run_emp = db_exec($get_emp) or errDie("Unable to get employee information.");
if (pg_numrows($run_emp) < 1) {
$showemp = "<li class='err'>Invalid Employee For Loan Selected</li>";
} else {
$earr = pg_fetch_array($run_emp);
$showemp = "{$earr['fnames']} {$earr['sname']}";
}
$get_type = "SELECT * FROM loan_types WHERE id = '{$larr['loan_type']}' LIMIT 1";
$run_type = db_exec($get_type) or errDie("Unable to get loan type information.");
if (pg_numrows($run_type) < 1) {
$showloantype = "Invalid Loan Type Selected";
} else {
$tarr = pg_fetch_array($run_type);
$showloantype = $tarr['loan_type'];
}
$listing .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$showemp}</td>\n\t\t\t\t\t\t<td>{$larr['loanamt']}</td>\n\t\t\t\t\t\t<td>{$larr['loaninstall']}</td>\n\t\t\t\t\t\t<td>{$larr['loanint']}</td>\n\t\t\t\t\t\t<td>{$larr['loanperiod']}</td>\n\t\t\t\t\t\t<td>{$larr['loandate']}</td>\n\t\t\t\t\t\t<td>{$showloantype}</td>\n\t\t\t\t\t\t<td><a href='loan_apply_approve.php?id={$larr['id']}&deny=t'>Deny</a></td>\n\t\t\t\t\t\t<td><a href='loan_apply_approve.php?id={$larr['id']}'>Approve</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
}
}
########################################################################
#####################[ CURRENT LOANS ]##################################
$employees = "";
$i = 0;
db_connect();
$sql = "SELECT * FROM employees WHERE gotloan='t'::bool AND div = '" . USER_DIV . "' ORDER BY sname";
$empRslt = db_exec($sql) or errDie("Unable to select employees with loans from database.");
if (pg_numrows($empRslt) < 1) {
$employees .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td colspan='7'>No Employees With Loans Found.</td>\n\t\t\t\t\t</tr>";
// return "No employee-loans found in database.<p>"
// .mkQuickLinks(
// ql("loan_apply.php", "Apply For New Loan"),
// ql("../admin-employee-add.php", "Add Employee"),
// ql("../admin-employee-view.php", "View Employees")
// );
} else {
while ($myEmp = pg_fetch_array($empRslt)) {
$totloan = sprint($myEmp['loaninstall'] * $myEmp['loanperiod']);
$totout = sprint($myEmp['loanamt']);
$employees .= "\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>{$myEmp['sname']}, {$myEmp['fnames']} ({$myEmp['enum']})</td>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$totloan}</td>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$totout}</td>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$myEmp['loaninstall']}</td>\n\t\t\t\t\t\t\t<td align='right'>{$myEmp['loanint']} %</td>\n\t\t\t\t\t\t\t<td align='right'>{$myEmp['loanperiod']} months</td>\n\t\t\t\t\t\t\t<td><a href='loan-edit.php?empnum={$myEmp['empnum']}'>Edit</a></td>\n\t\t\t\t\t\t</tr>\n";
$i++;
}
}
########################################################################
$display = "\n\t\t\t<h2>Summary Of Present Loans</h2>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<input type='hidden' name='key' value='input'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Employee</th>\n\t\t\t\t\t<th>Loan amount(incl interest)</th>\n\t\t\t\t\t<th>Amount outstanding</th>\n\t\t\t\t\t<th>Monthly installment</th>\n\t\t\t\t\t<th>Loan interest</th>\n\t\t\t\t\t<th>Payback period</th>\n\t\t\t\t\t<th colspan='2'>Options</th>\n\t\t\t\t</tr>\n\t\t\t\t{$employees}\n\t\t\t</table>\n\t\t\t<br><br>\n\t\t\t<h2>Current Loan Applications</h2>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Employee</th>\n\t\t\t\t\t<th>Loan Amount</th>\n\t\t\t\t\t<th>Installments</th>\n\t\t\t\t\t<th>Loan Interest Rate</th>\n\t\t\t\t\t<th>Loan Period</th>\n\t\t\t\t\t<th>Loan Date</th>\n\t\t\t\t\t<th>Loan Type</th>\n\t\t\t\t\t<th colspan='2'>Options</th>\n\t\t\t\t</tr>\n\t\t\t\t{$listing}\n\t\t\t</table><br>" . mkQuickLinks(ql("loan_apply.php", "New Loan Application"));
return $display;
}
示例14: add
function add()
{
core_connect();
# Get Petty cash account
$cashacc = gethook("accnum", "bankacc", "name", "Petty Cash");
# Get account name for thy lame User's Sake
$accRslt = get("core", "*", "accounts", "accid", $cashacc);
if (pg_numrows($accRslt) < 1) {
return "<li class='err'> Petty Cash Account not found.</li>";
}
$acc = pg_fetch_array($accRslt);
# Check available funds
$cashacc = gethook("accnum", "bankacc", "name", "Petty Cash");
core_connect();
$sql = "SELECT (debit - credit) as bal FROM trial_bal WHERE month='" . PRD_DB . "' AND accid = '{$cashacc}' AND div = '" . USER_DIV . "'";
$accbRslt = db_exec($sql);
if (pg_numrows($accbRslt) < 1) {
return "<li class='err'> Petty Cash Account not found.</li>";
}
$accb = pg_fetch_array($accbRslt);
$accb['bal'] = sprint($accb['bal']);
# mourn if the is no money
if ($accb['bal'] < 1) {
return "\n\t\t\t<li class='err'> There are no Petty Cash funds available.</li>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\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='petty-trans.php'>Transfer funds to petty cash account</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>";
}
// Layout
$add = "\n\t\t<h3>Funds transfer to Bank</h3>\n\t\t<table " . TMPL_tblDflts . " width='300'>\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Bank Account</td>\n\t\t\t\t<td valign='center'>\n\t\t\t\t\t<select name='bankid'>";
db_connect();
$sql = "SELECT * FROM bankacct WHERE btype != 'int' AND div = '" . USER_DIV . "'";
$banks = db_exec($sql);
if (pg_numrows($banks) < 1) {
return "<li class='err'> There are no accounts held at the selected Bank.</li>\n\t\t<p><input type='button' onClick='JavaScript:history.back();' value='« Correct Selection'>";
}
while ($bacc = pg_fetch_array($banks)) {
$add .= "<option value='{$bacc['bankid']}'>({$bacc['acctype']}) {$bacc['accname']} - {$bacc['bankname']}</option>";
}
if (!isset($date_day)) {
$trans_date_setting = getCSetting("USE_TRANSACTION_DATE");
if (isset($trans_date_setting) and $trans_date_setting == "yes") {
$trans_date_value = getCSetting("TRANSACTION_DATE");
$date_arr = explode("-", $trans_date_value);
$date_year = $date_arr[0];
$date_month = $date_arr[1];
$date_day = $date_arr[2];
} else {
$date_year = date("Y");
$date_month = date("m");
$date_day = date("d");
}
}
$add .= "\n\t\t\t\t\t</select>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Date</td>\n\t \t<td>" . mkDateSelect("date", $date_year, $date_month, $date_day) . "</td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Received from</td>\n\t \t<td valign='center'><input size='20' name='name' value='Petty Cash'></td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Description</td>\n\t \t<td valign='center'><textarea cols='18' rows='2' name='descript'></textarea></td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Cheque Number</td>\n\t \t<td valign='center'><input size='10' name='cheqnum'></td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Amount</td>\n\t \t<td valign='center'>" . CUR . " <input type='text' size='10' name='amount'> Max : " . CUR . " {$accb['bal']}<input type='hidden' name='max' value='{$accb['bal']}'></td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Petty Cash Account</td>\n\t \t<td><input type='hidden' name='accinv' value='{$acc['accid']}'>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</td>\n\t </tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td><input type='button' value='< Cancel' onClick='javascript:history.back();'></td>\n\t\t\t\t<td valign='center'><input type='submit' value='Confirm >'></td>\n\t\t\t</tr>\n\t\t</table>";
# main table (layout with menu)
$OUTPUT = "\n\t\t\t<center>\n\t <table width='100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width='65%' align='left'>{$add}</td>\n\t\t\t\t\t<td valign='top' align='center'>\n\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='65%'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t </table>";
return $OUTPUT;
}
示例15: confirm
function confirm($_POST, $_FILES)
{
extract($_POST);
$importfile = tempnam("/tmp", "cubitimport_");
$file = fopen($_FILES["compfile"]["tmp_name"], "r");
if ($file == false) {
return "<li class='err'>Cannot read file.</li>" . select_file();
}
db_conn('cubit');
$Sl = "\n\t\tCREATE TABLE import_data (\n\t\t\tdes1 varchar, des2 varchar,\n\t\t\tdes3 varchar, des4 varchar,\n\t\t\tdes5 varchar, des6 varchar,\n\t\t\tdes7 varchar, des8 varchar,\n\t\t\tdes9 varchar, des10 varchar,\n\t\t\tdes11 varchar, des12 varchar,\n\t\t\tdes13 varchar, des14 varchar,\n\t\t\tdes15 varchar, des16 varchar\n\t\t)";
$Ri = @db_exec($Sl);
$Sl = "DELETE FROM import_data";
$Ri = db_exec($Sl) or errDie("Unable to clear import table");
while (!feof($file)) {
$data = safe(fgets($file, 4096));
$datas = explode(",", $data);
if (!isset($datas[2])) {
continue;
}
$code = safe($datas[0]);
$description = safe($datas[1]);
$amount = sprint($datas[3]);
$camount = sprint($datas[2]);
$balance = sprint($datas[5]);
$units = safe($datas[4]);
$Sl = "\n\t\t\tINSERT INTO import_data (\n\t\t\t\tdes1, des2, des3, des4, des5, des6\n\t\t\t) VALUES (\n\t\t\t\t'{$code}', '{$description}', '{$amount}', '{$balance}', '{$units}', '{$camount}'\n\t\t\t)";
$Rl = db_exec($Sl) or errDie("Unable to insert data.");
}
fclose($file);
#get stores
db_conn('exten');
$get_stores = "SELECT * FROM warehouses WHERE div = '" . USER_DIV . "' ORDER BY whname";
$run_stores = db_exec($get_stores) or errDie("Unable to get stores information.");
if (pg_numrows($run_stores) < 1) {
return "Unable to get stores information.";
} else {
$storedrop = "<select name='store'>";
while ($sarr = pg_fetch_array($run_stores)) {
$storedrop .= "<option value='{$sarr['whid']}'>{$sarr['whname']}</option>";
}
$storedrop .= "</select>";
}
$out = "\n\t\t<h3>Stock Import</h3>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='write'>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan='3'>Select Store</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='3'>{$storedrop}</td>\n\t\t\t\t</tr>\n\t\t\t\t" . TBL_BR . "\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Stock Code</th>\n\t\t\t\t\t<th>Description</th>\n\t\t\t\t\t<th>Cost Price</th>\n\t\t\t\t\t<th>Selling Price</th>\n\t\t\t\t</tr>";
db_conn('cubit');
$Sl = "SELECT * FROM import_data";
$Ri = db_exec($Sl);
$i = 0;
while ($fd = pg_fetch_array($Ri)) {
$out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$fd['des1']}</td>\n\t\t\t\t<td>{$fd['des2']}</td>\n\t\t\t\t<td>{$fd['des6']}</td>\n\t\t\t\t<td>{$fd['des3']}</td>\n\t\t\t</tr>";
$i++;
}
$out .= "\n\t\t\t<tr>\n\t\t\t\t<td colspan='3' align='right'><input type='submit' value='Write »'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>";
return $out;
}