本文整理汇总了PHP中pg_fetch_array函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_fetch_array函数的具体用法?PHP pg_fetch_array怎么用?PHP pg_fetch_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pg_fetch_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirm
function confirm($cashid)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($cashid, "num", 1, 20, "Invalid Reference number.");
# 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;
}
# Connect to database
db_Connect();
$sql = "SELECT * FROM pettycashbook WHERE cashid = '{$cashid}' AND div = '" . USER_DIV . "'";
$cashRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve cashbook entry details from database.", SELF);
if (pg_numrows($cashRslt) < 1) {
$OUTPUT = "<li clss=err>Requisistion not found in Cubit.";
return $OUTPUT;
}
$cash = pg_fetch_array($cashRslt);
# Get account name for the account involved
$accRslt = get("core", "accname,accnum,topacc", "accounts", "accid", $cash['accid']);
$acc = pg_fetch_array($accRslt);
// Layout
$confirm = "<h3>Cancel Requisistion</h3>\r\n\t<h4>Confirm entry</h4>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<input type=hidden name=key value=cancel>\r\n\t<input type=hidden name=cashid value='{$cash['cashid']}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>Date</td><td>{$cash['date']}</td></tr>\r\n\t<tr class='bg-even'><td>Paid to</td><td>{$cash['name']}</td></tr>\r\n\t<tr class='bg-odd'><td>Details</td><td><pre>{$cash['det']}</pre></td></tr>\r\n\t<tr class='bg-even'><td>Amount</td><td>" . CUR . " {$cash['amount']}</td></tr>\r\n\t<tr class='bg-odd'><td>Account</td><td>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t<tr><td\t><input type=button value='« Back' onClick='javascript:history.back()'></td><td align=right><input type=submit value='Cancel »'></td></tr>\r\n\t</table></form>\r\n\t<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='pettycashbook-view.php'>View Petty Cash Requisitions</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>";
return $confirm;
}
示例2: edit
function edit($div)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($div, "num", 1, 50, "Invalid branch 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 Branch
db_connect();
$sql = "SELECT * FROM branches WHERE div = '{$div}'";
$branRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
if (pg_numrows($branRslt) < 1) {
return "<li> Invalid Branch ID.";
} else {
$bran = pg_fetch_array($branRslt);
}
// layout
$edit = "<h3>Edit Branch Branch</h3>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<input type=hidden name=key value=confirm>\r\n\t<input type=hidden name=div value='{$div}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>Branch code</td><td><input type=text size=20 name='brancod' value='{$bran['brancod']}'></td></tr>\r\n\t<tr class='bg-even'><td>" . REQ . "Branch name</td></td><td><input type=text size=20 name='branname' value='{$bran['branname']}'></td></tr>\r\n\t<tr class='bg-odd'><td valign=top>Details</td><td><textarea cols=18 rows=5 name='brandet'>{$bran['brandet']}</textarea></td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t<tr><td></td><td align=right><input type=submit value='Confirm »'></td></tr>\r\n\t</form>\r\n\t</table>\r\n\t<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Quick Links</th></tr>\r\n\t<tr class='bg-odd'><td><a href='admin-branview.php'>View Branches</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
return $edit;
}
示例3: Row
/**
* Get a row from the RecordSet.
*
* Case $row is set, return that row, case else, return the next row.
*
* @param int $row Row to return, defaults to next.
* @param int $type Type of array to return (RS_ROW_NUM | RS_ROW_ASSOC | RS_ROW_BOTH).
* @return array Returns the row from the RecordSet, or FALSE if EOF.
*/
function Row($row = -1, $type = RS_ROW_ASSOC)
{
if ($row != -1) {
$this->row = $row + 1;
switch ($type) {
case RS_ROW_NUM:
return pg_fetch_row($this->result, $this->row - 1);
break;
case RS_ROW_ASSOC:
return pg_fetch_assoc($this->result, $this->row - 1);
break;
case RS_ROW_BOTH:
return pg_fetch_array($this->result, $this->row - 1);
break;
}
return FALSE;
}
$this->row++;
switch ($type) {
case RS_ROW_NUM:
return pg_fetch_row($this->result);
break;
case RS_ROW_ASSOC:
return pg_fetch_assoc($this->result);
break;
case RS_ROW_BOTH:
return pg_fetch_array($this->result);
break;
}
return FALSE;
}
示例4: view
function view($_GET)
{
foreach ($_GET as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($docid, "num", 1, 100, "Invalid num.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
db_conn('cubit');
$user = USER_NAME;
# write to db
$Sql = "SELECT * FROM documents WHERE docid='{$docid}'";
$Rslt = db_exec($Sql) or errDie("Unable to access database.");
if (pg_numrows($Rslt) < 1) {
return "Document not Found";
}
$Data = pg_fetch_array($Rslt);
$view = "<h3>Document details</h3>\r\n<br>\r\n<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n<form action='" . SELF . "' method=post>\r\n<input type=hidden name=key value=confirm>\r\n<input type=hidden name=id value={$docid}>\r\n<tr><th colspan=2>Document details</th></tr>\r\n\t<tr class='bg-odd'><td>Typeid</td><td>{$Data['typeid']}</td></tr>\r\n\t<tr class='bg-odd'><td>TypeName</td><td>{$Data['typename']}</td></tr>\r\n\t<tr class='bg-odd'><td>xin/td><td>{$Data['xin']}</td></tr>\r\n\t<tr class='bg-odd'><td>docref</td><td>{$Data['docref']}</td></tr>\r\n\t<tr class='bg-odd'><td>Date</td><td>{$Data['docdate']}</td></tr>\r\n\t<tr class='bg-even'><td>Docname</td><td align=center>{$Data['docname']}</td></tr>\r\n\t<tr class='bg-odd'><td>File</td><td>{$Data['filename']}</td></tr>\r\n\t<tr class='bg-odd'><td>MimeType</td><td>{$Data['mimetype']}</td></tr>\r\n\t<tr class='bg-even'><td>Description</td><td>{$Data['descrip']}</td></tr>\r\n\t<tr class='bg-odd'><td>Doc</td><td>{$Data['docu']}</td></tr>\r\n\t<tr class='bg-odd'><td>Div</td><td>{$Data['div']}</td></tr> \r\n\t\r\n\t<tr><td colspan=2 align=right><input type=submit value='Remove »'></td></tr>\r\n</table>\r\n<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Quick Links</th></tr>\r\n\t<tr class='bg-odd'><td><a href='tlist-docview.php'>List Removed Documents</a></td></tr>\r\n <tr class='bg-odd'><td><a href='tdocadd.php'>Add New Document</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>\r\n ";
db_conn('cubit');
# write to db
$Sql = "INSERT INTO document(typeid,typename,xin,docref,docdate,docname,filename,mimetype,descrip,docu,div) VALUES ('{$Data['typeid']}','{$Data['typename']}','{$Data['xin']}','{$Data['docref']}','{$Data['docdate']}','{$Data['docname']}','{$Data['filename']}','{$Data['mimetype']}','{$Data['descrip']}','{$Data['docu']}','{$Data['div']}')";
$Rslt = db_exec($Sql) or errDie("Unable to access database.");
return view;
}
示例5: display
function display()
{
$sql = "SELECT * FROM cubit.stock ORDER BY stkcod ASC";
$stock_rslt = db_exec($sql) or errDie("Unable to retrieve stock.");
$stock_out = "";
while ($stock_data = pg_fetch_array($stock_rslt)) {
// Retrieve units on order
$sql = "SELECT sum(qty) FROM cubit.sorders_items WHERE stkid='{$stock_data['stkid']}'";
$order_rslt = db_exec($sql) or errDie("Unable to retrieve orders.");
$order_qty = pg_fetch_result($order_rslt, 0);
if (empty($stock_data["minlvl"])) {
continue;
}
if (empty($order_qty)) {
$order_qty = 0;
}
$units = $stock_data["units"] - $order_qty;
$required = abs($units - $stock_data["minlvl"]);
// We're not required to purchase this item
if ($units > $stock_data["minlvl"]) {
continue;
}
$stock_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$stock_data['stkcod']}</td>\n\t\t\t\t<td>{$stock_data['stkdes']}</td>\n\t\t\t\t<td align='center'>" . sprint3($stock_data['units']) . "</td>\n\t\t\t\t<td align='center'>" . sprint3($order_qty) . "</td>\n\t\t\t\t<td align='center'>" . sprint3($stock_data['minlvl']) . "</td>\n\t\t\t\t<td align='center'><b>" . sprint3($required) . "</b></td>\n\t\t\t\t<td><a href='purchase-new.php'>Purchase</a></td>\n\t\t\t</tr>";
}
if (empty($stock_out)) {
$stock_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='7'>No items required for purchase.</td>\n\t\t\t</tr>";
}
$OUTPUT = "\n\t\t<center>\n\t\t<h3>Required Purchases</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Stock Code</th>\n\t\t\t\t<th>Stock Description</th>\n\t\t\t\t<th>Current Units</th>\n\t\t\t\t<th>Units on Order</th>\n\t\t\t\t<th>Minimum Level</th>\n\t\t\t\t<th>Minimum Required</th>\n\t\t\t\t<th>Options</th>\n\t\t\t</tr>\n\t\t\t{$stock_out}\n\t\t</table>\n\t\t</center>";
return $OUTPUT;
}
示例6: get_tags
/** Ota tagit tietokannasta
* @return array
*/
function get_tags()
{
/* $result_tags array
* $end_array array
*/
$dbconn = pg_connect("host=localhost port=5432 dbname=noaa user=noaa password=123");
$result_tags = pg_query_params($dbconn, 'SELECT question_id, tag
FROM tags
WHERE question_id IN
(
SELECT question_id
FROM tags
WHERE tag = $1
)
ORDER BY question_id', array($_GET['tag']));
while ($tags_and_Qid = pg_fetch_array($result_tags)) {
// Add the Tag to an array of tags for that question
$end_array[$tags_and_Qid['question_id']]['tag'][] = $tags_and_Qid['tag'];
}
// to check if 0 messages
if (count($end_array) == 0) {
header("Location: index.php?" . "no_question_found");
} else {
return $end_array;
}
}
示例7: select
function select($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# Set uppercase
$ALPHA = strtoupper($alpha);
# Connect to database
db_connect();
# Query server for customer info
$sql = "SELECT * FROM customers WHERE cusname LIKE '{$alpha}%' OR cusname LIKE '{$ALPHA}%' ORDER BY cusname";
$prnCustRslt = db_exec($sql) or errDie("Unable to view customers");
$numrows = pg_numrows($prnCustRslt);
if ($numrows < 1) {
return "<li class=err>No customer names starting with <b>{$ALPHA}</b> in database.";
}
$select = "<h4>Select a customer</h4>\r\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t\t<tr><th>Customer no.</th><th>Customer name</th></tr>";
// display customers to choose from
for ($i = 0; $i < $numrows; $i++) {
$myCust = pg_fetch_array($prnCustRslt);
$select .= "<tr class='" . bg_class() . "'><td align=center>{$myCust['cusnum']}</td><td align=center><a href='quote-new.php?cusnum={$myCust['cusnum']}'>{$myCust['cusname']}</a></td></tr>";
}
$select .= "</table>\r\n\t\t<p>\r\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=100>\r\n\t\t\t<tr><th>Quick Links</th></tr>\r\n\t\t\t<tr bgcolor='#88BBFF'><td><a href='customers-new.php'>New Customer</a></td></tr>\r\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t\t<tr bgcolor='#88BBFF'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t\t</table>";
return $select;
}
示例8: confirmPaye
function confirmPaye($_GET)
{
# get vars
foreach ($_GET as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid PAYE ID.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
# connect to db
db_connect();
# select paye bracket
$sql = "SELECT * FROM paye WHERE id='{$id}'";
$payeRslt = db_exec($sql) or errDie("Unable to select PAYE bracket from database.", SELF);
if (pg_numrows($payeRslt) < 1) {
return "No PAYE brackets found in database.";
}
# get result
$myPaye = pg_fetch_array($payeRslt);
$confirmPaye = "\n<h3>Confirm removal of PAYE bracket</h3>\n\n<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n<form action='" . SELF . "' method=post>\n<input type=hidden name=key value=write>\n<input type=hidden name=id value='{$myPaye['id']}'>\n<tr><th>Field</th><th>Value</th></tr>\n<tr class='bg-odd'><td>Minimum gross</td><td align=right>" . CUR . " {$myPaye['min']}</td></tr>\n<tr class='bg-even'><td>Maximum gross</td><td align=right>" . CUR . " {$myPaye['max']}</td></tr>\n<tr class='bg-odd'><td>Percentage</td><td align=right>{$myPaye['percentage']}%</td></tr>\n<tr class='bg-even'><td>Cash amount extra</td><td align=right>" . CUR . " {$myPaye['extra']}</td></tr>\n<tr><td><br></td><td align=right><input type=submit value='Remove PAYE bracket »'></td></tr>\n</form>\n</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
return $confirmPaye;
}
示例9: printInv
function printInv()
{
# Set up table to display in
$printQuo = "\n\t\t\t\t\t<h3>View previous POS Quotes</h3>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Department</th>\n\t\t\t\t\t\t\t<th>Sales Person</th>\n\t\t\t\t\t\t\t<th>Quote No.</th>\n\t\t\t\t\t\t\t<th>Quote Date</th>\n\t\t\t\t\t\t\t<th>Customer Name</th>\n\t\t\t\t\t\t\t<th>Order No</th>\n\t\t\t\t\t\t\t<th>Grand Total</th>\n\t\t\t\t\t\t\t<th colspan='6'>Options</th>\n\t\t\t\t\t\t\t<th>Email</th>\n\t\t\t\t\t\t</tr>";
# connect to database
db_connect();
# Query server
$i = 0;
$sql = "SELECT * FROM pos_quotes WHERE accepted != 'c' AND done = 'y' AND div = '" . USER_DIV . "' ORDER BY quoid DESC";
$quoRslt = db_exec($sql) or errDie("Unable to retrieve quotes from database.");
if (pg_numrows($quoRslt) < 1) {
$printQuo = "<li>No previous quotes.</li>";
} else {
while ($quo = pg_fetch_array($quoRslt)) {
# format date
$quo['odate'] = explode("-", $quo['odate']);
$quo['odate'] = $quo['odate'][2] . "-" . $quo['odate'][1] . "-" . $quo['odate'][0];
$printQuo .= "\n\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t<td>{$quo['deptname']}</td>\n\t\t\t\t\t\t\t\t\t<td>{$quo['salespn']}</td>\n\t\t\t\t\t\t\t\t\t<td>{$quo['quoid']}</td>\n\t\t\t\t\t\t\t\t\t<td align='center'>{$quo['odate']}</td>\n\t\t\t\t\t\t\t\t\t<td>{$quo['cusname']} {$quo['surname']}</td>\n\t\t\t\t\t\t\t\t\t<td align=right>{$quo['ordno']}</td>\n\t\t\t\t\t\t\t\t\t<td>" . CUR . " {$quo['total']}</td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-details.php?quoid={$quo['quoid']}'>Details</a></td>";
if ($quo['accepted'] == 'n') {
$printQuo .= "\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-new.php?quoid={$quo['quoid']}&cont=true&done='>Edit</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-cancel.php?quoid={$quo['quoid']}'>Cancel</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-accept.php?quoid={$quo['quoid']}'>Accept</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-print.php?quoid={$quo['quoid']}' target='_blank'>Print</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pdf/pos-quote-pdf-print.php?quoid={$quo['quoid']}' target='_blank'>Print in PDF</a></td>\n\t\t\t\t\t\t\t\t\t<td><input type='checkbox' name='evs[]' value='{$quo['quoid']}'></td>\n\t\t\t\t\t\t\t\t</tr>";
} else {
$printQuo .= "\n\t\t\t\t\t\t\t\t\t<td colspan='3'>Accepted</td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-print.php?quoid={$quo['quoid']}' target='_blank'>Print</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pdf/pos-quote-pdf-print.php?quoid={$quo['quoid']}' target='_blank'>Print in PDF</a></td>\n\t\t\t\t\t\t\t\t\t<td><input type='checkbox' name='evs[]' value='{$quo['quoid']}'></td>\n\t\t\t\t\t\t\t\t</tr>";
}
$i++;
}
$printQuo .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td colspan='14' align='right'><input type='submit' name='key' value='Send Emails'></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
}
// Layout
$printQuo .= "\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t\t\t\t\t<td align='center'><a href='pos-quote-new.php'>New POS Quote</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t\t\t\t\t<td align='center'><a href='main.php'>Main Menu</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>";
return $printQuo;
}
示例10: confirm
function confirm($catid)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($catid, "num", 1, 50, "Invalid stock category id.");
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>-" . $e["msg"] . "<br>";
}
return $confirm;
}
# Select Stock
db_connect();
$sql = "SELECT * FROM stockcat WHERE catid = '{$catid}' AND div = '" . USER_DIV . "'";
$catRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
if (pg_numrows($catRslt) < 1) {
return "<li> Invalid Stock ID.";
} else {
$cat = pg_fetch_array($catRslt);
}
# get stock vars
foreach ($cat as $key => $value) {
${$key} = $value;
}
// Layout
$confirm = "<h3>Stock Category</h3>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t\t\t<tr><th width=40%>Field</th><th width=60%>Value</th></tr>\n\t\t\t<tr class='bg-odd'><td>Category Code</td><td>{$catcod}</td></tr>\n\t\t\t<tr class='bg-even'><td>Category Name</td></td><td>{$cat}</td></tr>\n\t\t\t<tr class='bg-odd'><td valign=top>Description</td><td><pre>{$descript}</pre></td></tr>\n\t\t</table>\n\t\t<p>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=100>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<tr class='bg-odd'><td><a href='stockcat-edit.php?catid={$catid}'>Edit</a></td></tr>\n\t\t\t<tr class='bg-even'><td><a href='stockcat-view.php'>View Stock Category</a></td></tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
return $confirm;
}
示例11: 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 = "SELECT assets.id, assets.des AS asset_des, asset_svdates.svdate,\r\n\t\t\t\tasset_svdates.des AS sv_des\r\n\t\t\tFROM cubit.asset_svdates\r\n\t\t\t\tLEFT JOIN cubit.assets\r\n\t\t\t\t\tON asset_svdates.asset_id=assets.id\r\n\t\t\tWHERE asset_svdates.svdate BETWEEN '{$from_date}' AND '{$to_date}'";
$sv_rslt = db_exec($sql) or errDie("Unable to retrieve asset services.");
$service_out = "";
while ($sv_data = pg_fetch_array($sv_rslt)) {
if (empty($sv_data["id"])) {
continue;
}
$service_out .= "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$sv_data['asset_des']}</td>\r\n\t\t\t<td>" . getSerial($sv_data["id"]) . "</td>\r\n\t\t\t<td>{$sv_data['sv_des']}</td>\r\n\t\t\t<td>{$sv_data['svdate']}</td>\r\n\t\t</tr>";
}
if (empty($service_out)) {
$service_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No results found</li></td>\r\n\t\t</tr>";
}
$OUTPUT = "<center>\r\n\t<h3>Service Report</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='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td> <b>To</b> </td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<input type='submit' value='Select' style='font-weight: bold' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Asset</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t\t<th>Service Description</th>\r\n\t\t\t<th>Service Date</th>\r\n\t\t</tr>\r\n\t\t{$service_out}\r\n\t</table>";
return $OUTPUT;
}
示例12: posttake_display
function posttake_display()
{
extract($_REQUEST);
$fields = array();
$fields["page"] = 1;
extract($fields, EXTR_SKIP);
$sql = "\n\t\tSELECT stock.stkid, stock.whid, stkcod, stkdes, bar, adjusted, qty \n\t\tFROM cubit.stock_take \n\t\t\tLEFT JOIN cubit.stock ON stock_take.stkid=stock.stkid \n\t\tWHERE page='{$page}' AND (adjusted='0' OR adjusted IS NULL) \n\t\tORDER BY stkcod ASC, whid";
$stock_rslt = db_exec($sql) or errDie("Unable to retrieve stock.");
$stock_out = "";
while ($stock_data = pg_fetch_array($stock_rslt)) {
db_conn("exten");
$get_wh = "SELECT whname FROM warehouses WHERE whid = '{$stock_data['whid']}' LIMIT 1";
$run_wh = db_exec($get_wh) or errDie("Unable to get warehouse information.");
if (pg_numrows($run_wh) < 1) {
$whname = "Default";
} else {
$whname = trim(pg_fetch_result($run_wh, 0, 0));
}
$stock_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$stock_data['bar']}</td>\n\t\t\t\t<td>{$whname}</td>\n\t\t\t\t<td>{$stock_data['stkcod']}</td>\n\t\t\t\t<td>{$stock_data['stkdes']}</td>\n\t\t\t\t<td align='center'><input type='text' name='qty[{$stock_data['stkid']}]' value='{$stock_data['qty']}' size='3' style='text-align: center' /></td>\n\t\t\t\t<td><input type='submit' name='update[{$stock_data['stkid']}]' value='OK' /></td>\n\t\t\t</tr>";
}
if (empty($stock_out)) {
$stock_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='5'>No results found.</td>\n\t\t\t</tr>";
}
$OUTPUT = "\n\t\t<center>\n\t\t<h3>Stock Take</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='2'>Page</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='text' name='page' value='{$page}' size='3' style='font-weight: bold; text-align: center' /></td>\n\t\t\t\t<td><input type='submit' value='OK' /></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<form method='POST' action='" . SELF . "'>\n\t\t\t<input type='hidden' name='key' value='take_update' />\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Barcode</th>\n\t\t\t\t<th>Store</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>Quantity</th>\n\t\t\t\t<th> </th>\n\t\t\t</tr>\n\t\t\t{$stock_out}\n\t\t</table>\n\t\t<input type='submit' name='button[adjustments]' value='Adjustments' />\n\t\t</form>\n\t\t</center>";
return $OUTPUT;
}
示例13: get_current_setting
function get_current_setting()
{
db_connect();
$get_list = "SELECT * FROM non_purchases_account_list";
$run_list = db_exec($get_list) or errDie("Unable to get account lisit information.");
if (pg_numrows($run_list) > 0) {
$account_list = "\n\t\t\t<tr>\n\t\t\t\t<th>Account</th>\n\t\t\t\t<th>Options</th>\n\t\t\t</tr>";
while ($aarr = pg_fetch_array($run_list)) {
$account_list .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>{$aarr['accname']}</td>\n\t\t\t\t\t<td><input type='submit' name='remove[{$aarr['accid']}]' value='Remove'></td>\n\t\t\t\t</tr>";
}
}
$cur_setting = getCsetting("USE_NON_PURCHASES_ACCOUNTS");
$yes_setting = "";
$no_setting = "";
if (!isset($cur_setting) or strlen($cur_setting) < 1) {
$no_setting = "checked='yes'";
} else {
if ($cur_setting == "yes") {
$yes_setting = "checked";
} else {
$no_setting = "checked";
}
}
$display = "\n\t\t<h2>Accounts to Display for Non Stock Purchases</h2>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Use These Accounts Only</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>\n\t\t\t\t\t<input type='radio' name='setting' value='yes' {$yes_setting}> Yes\n\t\t\t\t\t<input type='radio' name='setting' value='no' {$no_setting}> No\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align='right'><input type='submit' name='save' value='Save'></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<br>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Add Account</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'>" . mkAccSelect("newaccount", $newaccount) . " <input type='submit' name='add' value='Add Account'></td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t{$account_list}\n\t\t</table>\n\t\t</form>";
return $display;
}
示例14: remove
function remove($_POST)
{
extract($_POST);
$id += 0;
db_conn('crm');
$Sl = "SELECT * FROM tokens WHERE id='{$id}'";
$Ry = db_exec($Sl) or errDie("Unable to get data from system.");
if (pg_numrows($Ry) < 1) {
return "Invalid query.";
}
$data = pg_fetch_array($Ry);
$Sl = "SELECT * FROM token_actions WHERE token='{$id}'";
$Rs = db_exec($Sl) or errDie("Unable to get data from system.");
$Sl = "SELECT * FROM archived_actions WHERE token='{$id}'";
$Ri = db_exec($Sl) or errDie("Unable to get data from system.");
$Sl = "INSERT INTO closedtokens (tid,userid,username,teamid,cat,catid,openby,opendate,lastdate,csct,csc,name,accnum,\r\n\tcon,tel,cell,fax,email,address,sub,notes,closedate,closeby,closebyid)\r\n\tVALUES ('{$id}','{$data['userid']}','{$data['username']}','{$data['teamid']}','{$data['cat']}','{$data['catid']}','{$data['openby']}',\r\n\t'{$data['opendate']}','{$data['lastdate']}','{$data['csct']}','{$data['csc']}','{$data['name']}','{$data['accnum']}','{$data['con']}',\r\n\t'{$data['tel']}','{$data['cell']}','{$data['fax']}','{$data['email']}','{$data['address']}','{$data['sub']}','{$data['notes']}',\r\n\t'" . date("Y-m-d") . "','" . USER_NAME . "','" . USER_ID . "')";
$Ry = db_exec($Sl) or errDie("Unable to insert query record.");
while ($adata = pg_fetch_array($Rs)) {
$Sl = "INSERT INTO closed_token_actions (token,action,donedate,donetime,doneby,donebyid)\r\n\t\tVALUES ('{$id}','{$adata['action']}','{$adata['donedate']}','{$adata['donetime']}','{$adata['doneby']}','{$adata['donebyid']}')";
$Ry = db_exec($Sl) or errDie("Unable to insert token action.");
}
while ($adata = pg_fetch_array($Ri)) {
$Sl = "INSERT INTO closed_token_actions (token,action,donedate,donetime,doneby,donebyid)\r\n\t\tVALUES ('{$id}','{$adata['action']}','{$adata['donedate']}','{$adata['donetime']}','{$adata['doneby']}','{$adata['donebyid']}')";
$Ry = db_exec($Sl) or errDie("Unable to insert token action(archived).");
}
$Sl = "DELETE FROM tokens WHERE id='{$id}'";
$Ry = db_exec($Sl) or errDie("Unable to remove query.");
$Sl = "DELETE FROM token_actions WHERE token='{$id}'";
$Ry = db_exec($Sl) or errDie("Unable to remove query actions.");
$Sl = "DELETE FROM archived_actions WHERE token='{$id}'";
$Ry = db_exec($Sl) or errDie("Unable to remove archived query actions.");
header("Location: tokens-manage.php");
exit;
}
示例15: rem
function rem($clasid)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($clasid, "num", 1, 50, "Invalid Classification id.");
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>-" . $e["msg"] . "<br>";
}
return $confirm;
}
# Select Stock
db_connect();
$sql = "SELECT * FROM stockclass WHERE clasid = '{$clasid}' AND div = '" . USER_DIV . "'";
$clasRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
if (pg_numrows($clasRslt) < 1) {
return "<li> Invalid Category ID.";
} else {
$clas = pg_fetch_array($clasRslt);
}
$enter = "<h3>Remove Classification</h3>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<input type=hidden name=key value=write>\r\n\t<input type=hidden name=clasid value='{$clas['clasid']}'>\r\n\t<input type=hidden name=classname value='{$clas['classname']}'>\r\n\t<input type=hidden name=classcode value='{$clas['classcode']}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>Classification Code</td><td align=center>{$clas['classcode']}</td></tr>\r\n\t<tr class='bg-even'><td>Classification</td><td align=center>{$clas['classname']}</td></tr>\r\n\t<tr><td colspan=2 align=right><input type=submit value='Remove »'></td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t</table></form>\r\n\t<p>\r\n\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t<tr><th>Quick Links</th></tr>\r\n\t<tr class='bg-odd'><td><a href='stockclass-view.php'>View Classifications</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
return $enter;
}