本文整理汇总了PHP中db_exec函数的典型用法代码示例。如果您正苦于以下问题:PHP db_exec函数的具体用法?PHP db_exec怎么用?PHP db_exec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_exec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
extract($_REQUEST);
$sql = "SELECT * FROM cubit.documents WHERE id='{$id}'";
$doc_rslt = db_exec($sql) or errDie("Unable to retrieve documents.");
$doc_data = pg_fetch_array($doc_rslt);
extract($doc_data);
if (!empty($doc_type)) {
$sql = "SELECT type_name FROM cubit.document_types WHERE id='{$doc_type}'";
$type_rslt = db_exec($sql) or errDie("Unable to retrieve document type.");
$type_name = pg_fetch_result($type_rslt, 0);
} else {
$type_name = "";
}
if (!empty($team_id)) {
$sql = "SELECT team_name FROM cubit.teams WHERE id='{$team_id}'";
$team_rslt = db_exec($sql) or errDie("Unable to retrieve team.");
$team_name = pg_fetch_result($team_rslt, 0);
} else {
$team_name = "";
}
$OUTPUT = "<table " . TMPL_tblDflts . ">\n\t<tr><td valign='top'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='2'>Details</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Title</td>\n\t\t\t<td>{$title}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Project</td>\n\t\t\t<td>{$project}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Area</td>\n\t\t\t<td>{$area}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Discipline</td>\n\t\t\t<td>{$discipline}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Document Type</td>\n\t\t\t<td>{$type_name}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Revision</td>\n\t\t\t<td>{$revision}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Drawing Number</td>\n\t\t\t<td>{$drawing_num}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Sheet Number</td>\n\t\t\t<td>{$sheet_num}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>File Location</td>\n\t\t\t<td>{$location}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Contract</td>\n\t\t\t<td>{$contract}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Contractor</td>\n\t\t\t<td>{$contractor}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Code</td>\n\t\t\t<td>{$code}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Issue For</td>\n\t\t\t<td>{$issue_for}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Comments</td>\n\t\t\t<td>{$comments}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>QS</td>\n\t\t\t<td>{$qs}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Team Permissions</td>\n\t\t\t<td>{$team_name}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Status</td>\n\t\t\t<td>{$status}</td>\n\t\t</tr>\n\t</table>\n\t</td><td valign='top'>";
$sql = "SELECT * FROM document_files WHERE doc_id='{$id}'";
$df_rslt = db_exec($sql) or errDie("Unable to retrieve files.");
$file_out = "";
while ($df_data = pg_fetch_array($df_rslt)) {
$file_out .= "<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='getfile.php?key=doc&id={$df_data['id']}'>{$df_data['filename']}</a></td>\n\t\t\t<td>" . getFilesize($df_data["size"]) . "</td>\n\t\t</tr>";
}
if (empty($file_out)) {
$file_out = "<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='2'>No files found.</td>\n\t\t</tr>";
}
$OUTPUT .= "<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='2'>Files</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th>File</th>\n\t\t\t<th>Size</th>\n\t\t</tr>\n\t\t{$file_out}\n\t</table>\n\t</td></tr>\n\t</table>";
return $OUTPUT;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: show_image
function show_image($_POST)
{
extract($_POST);
if (!isset($picid)) {
return "";
}
db_connect();
$get_img = "SELECT type,ident_id FROM display_images WHERE id = '{$picid}' LIMIT 1";
$run_img = db_exec($get_img) or errDie("Unable to get image information.");
if (pg_numrows($run_img) < 1) {
#image not found ??
$previous = "";
$next = "";
} else {
$arr = pg_fetch_array($run_img);
$previous = "";
$next = "";
#check for any additional images for this member
#get prev button
$get_other = "SELECT id FROM display_images WHERE type = '{$arr['type']}' AND ident_id = '{$arr['ident_id']}' AND id < '{$picid}' ORDER BY id desc LIMIT 1";
$run_other = db_exec($get_other) or errDie("Unable to get images information.");
if (pg_numrows($run_other) > 0) {
$previous = "<input type='button' onCLick=\"document.location='view_image.php?picid=" . pg_fetch_result($run_other, 0, 0) . "'\" value='Previous'>";
}
$get_other = "SELECT id FROM display_images WHERE type = '{$arr['type']}' AND ident_id = '{$arr['ident_id']}' AND id > '{$picid}' LIMIT 1";
$run_other = db_exec($get_other) or errDie("Unable to get images information.");
if (pg_numrows($run_other) > 0) {
$next = "<input type='button' onCLick=\"document.location='view_image.php?picid=" . pg_fetch_result($run_other, 0, 0) . "'\" value='Next'>";
}
}
$buttons = "<tr height='20%' valign='bottom'><td width='40%' align='right'>{$previous}</td><td>{$next}</td></tr>";
$display = "\n\t\t\t\t\t<table " . TMPL_tblDflts . " height='95%' width='100%'>\n\t\t\t\t\t\t<tr height='80%'>\n\t\t\t\t\t\t\t<td colspan='2'><img src='show_dimg.php?picid={$picid}' width='160' height='185' border='1'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t{$buttons}\n\t\t\t\t\t</table>\n\t\t\t\t";
return $display;
}
示例7: 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;
}
示例8: printcheq
function printcheq()
{
// Set up table to display in
$OUTPUT = "<h3>View Cheque Records</h3>\r\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n <form action='../bank/bank-bankall.php' method=post>\r\n <tr><th>Bank Name</th><th>Account Name</th><th>Date</th><th>Paid to/Received from</th><th>Description</th><th>Transaction Type</th><th>Amount</th><th>Account paid<br>/received from</th></tr>";
// Connect to database
db_Connect();
$sql = "SELECT * FROM cashbook WHERE cheqnum > 0 and banked='no' AND div = '" . USER_DIV . "' ORDER BY date DESC";
$accntRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve bank cheqque transaction details from database.", SELF);
$numrows = pg_numrows($accntRslt);
if ($numrows < 1) {
$OUTPUT = "<li class=err> There are no outstanding bank cheque Records yet in Cubit.";
require "../template.php";
}
# display all bank cheques
for ($i = 0; $i < $numrows; $i++) {
$accnt = pg_fetch_array($accntRslt, $i);
# get account name for account involved
$accRslt = get("core", "accname", "accounts", "accid", $accnt['accinv']);
$acc = pg_fetch_array($accRslt);
# get account name for bank account
db_connect();
$sql = "SELECT accname,bankname FROM bankacct WHERE bankid= '{$accnt['bankid']}' AND div = '" . USER_DIV . "'";
$bankRslt = db_exec($sql);
$bank = pg_fetch_array($bankRslt);
$OUTPUT .= "<tr class='" . bg_class() . "'><td>{$bank['bankname']}</td><td align=center>{$bank['accname']}</td><td align=center>{$accnt['date']}</td><td align=center>{$accnt['name']}</td><td>{$accnt['descript']}</td><td align=center>{$accnt['trantype']}</td><td align=center>" . CUR . " {$accnt['amount']}<td align=center>{$acc['accname']}</td></td>";
if ($accnt['banked'] == "no") {
$OUTPUT .= "<td><input type=checkbox name='bank[]' value='{$accnt['cashid']}'> <a href='../bank/bank-bank.php?cashid={$accnt['cashid']}'>Bank</td><td><a href='../bank/cheq-cancel.php?cashid={$accnt['cashid']}'>Cancel</td></tr>";
} else {
$OUTPUT .= "</tr>";
}
}
$OUTPUT .= "<tr><td colspan=8><br></td><td colspan=2><input type=submit value='Bank all selected'></td></tr></form></table>";
// all template to display the info and die
require "../template.php";
}
示例9: archive
function archive($_GET)
{
extract($_GET);
$id += 0;
db_conn('crm');
$Sl = "SELECT * FROM crms WHERE userid='" . USER_ID . "'";
$Ri = db_exec($Sl) or errDie("Unable to get data from system.");
if (pg_num_rows($Ri) < 1) {
return "Invalid.";
}
$crmdata = pg_fetch_array($Ri);
$teams = explode("|", $crmdata['teams']);
$Sl = "SELECT * FROM tokens WHERE id='{$id}'";
$Ri = db_exec($Sl) or errDie("Unable to get query.");
if (pg_num_rows($Ri) < 1) {
return "Invalid query.";
}
$tokendata = pg_fetch_array($Ri);
if (!in_array($tokendata['teamid'], $teams)) {
return "Declined.";
}
$Sl = "SELECT * FROM token_actions WHERE token='{$id}'";
$Ri = db_exec($Sl) or errDie("Unable to get actions from db.");
while ($data = pg_fetch_array($Ri)) {
$Sl = "INSERT INTO archived_actions (token,action,donedate,donetime,doneby,donebyid)\r\n\t\tVALUES ('{$id}','{$data['action']}','{$data['donedate']}','{$data['donetime']}','{$data['doneby']}','{$data['donebyid']}')";
$Ro = db_exec($Sl) or errDie("Unable to archive action.");
}
$Sl = "DELETE FROM token_actions WHERE token='{$id}'";
$Rl = db_exec($Sl) or errDie("Unable to delete actions.");
$OUTPUT = "<script> window.opener.parent.mainframe.location.reload(); window.close(); </script>";
return $OUTPUT;
}
示例10: update
function update()
{
extract($_REQUEST);
pglib_transaction("BEGIN");
if (isset($rem)) {
foreach ($rem as $type_id => $accid) {
$sql = "DELETE FROM cubit.ratio_account_owners\n\t\t\t\t\tWHERE type_id='{$type_id}' AND accid='{$accid}'";
db_exec($sql) or errDie("Unable to remove entries.");
}
}
if (isset($account)) {
foreach ($account as $type_id => $accid) {
if ($accid) {
$sql = "SELECT id FROM cubit.ratio_account_owners\n\t\t\t\t\t\tWHERE type_id='{$type_id}' AND accid='{$accid}'";
$own_rslt = db_exec($sql) or errDie("Unable to retrieve owners.");
if (!pg_num_rows($own_rslt)) {
$sql = "INSERT INTO cubit.ratio_account_owners (type_id, accid)\n\t\t\t\t\t\t\tVALUES ('{$type_id}', '{$accid}')";
db_exec($sql) or errDie("Unable to add new entries.");
}
}
}
}
pglib_transaction("COMMIT");
return display();
}
示例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 invid, invnum, customers.surname, hire_invid,\r\n\t\t\t\textract('epoch' FROM reprint_invoices.odate) AS e_date\r\n\t\t\t\tFROM hire.reprint_invoices\r\n\t\t\t\t\tLEFT JOIN cubit.customers\r\n\t\t\t\t\t\tON reprint_invoices.cusnum=customers.cusnum\r\n\t\t\tWHERE reprint_invoices.odate BETWEEN '{$from_date}' AND '{$to_date}'\r\n\t\t\tORDER BY invnum DESC";
$reprint_rslt = db_exec($sql) or errDie("Unable to retrieve reprints.");
$reprint_out = "";
while ($reprint_data = pg_fetch_array($reprint_rslt)) {
if (!$reprint_data["invnum"]) {
continue;
}
$reprint_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>H{$reprint_data['invnum']}" . rrev($reprint_data["invid"]) . "</td>\r\n\t\t\t<td>{$reprint_data['surname']}</td>\r\n\t\t\t<td>" . date("d-m-Y", $reprint_data["e_date"]) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='javascript:printer" . "(\"hire/hire_note_reprint.php?invid={$reprint_data['invid']}\")'>\r\n\t\t\t\t\tReprint\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>";
}
if (empty($reprint_out)) {
$reprint_out = "\r\n\t\t<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>View Hire Note Reprints</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='4'>Date Range</th></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>Hire No</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Date</th>\r\n\t\t\t<th>Reprint</th>\r\n\t\t</tr>\r\n\t\t{$reprint_out}\r\n\t</table>";
return $OUTPUT;
}
示例12: 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 = dateFmt($from_year, $from_month, $from_day);
$to_date = dateFmt($to_year, $to_month, $to_day);
// Retrieve hires
$sql = "\r\n\tSELECT *,\r\n\t\t(SELECT username FROM cubit.users WHERE userid=user_id) AS username,\r\n\t\t(SELECT surname FROM cubit.customers WHERE cusnum=cust_id) AS surname,\r\n\t\t(SELECT cusname FROM cubit.customers WHERE cusnum=cust_id) AS cusname,\r\n\t\t(SELECT EXTRACT('EPOCH' FROM from_time)) AS e_from,\r\n\t\t(SELECT EXTRACT('EPOCH' FROM to_time)) AS e_to\r\n\tFROM hire.hires\r\n\tWHERE from_time BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59' OR\r\n\t\tto_time BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59'\r\n\tORDER BY e_from ASC";
$hire_rslt = db_exec($sql) or errDie("Unable to retrieve hires.");
$hire_out = "";
while ($hire_data = pg_fetch_array($hire_rslt)) {
$time = date("d-m-Y G:i:s", $hire_data["e_from"]);
$hire_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$time}</td>\r\n\t\t\t<td>{$hire_data['inv_id']}</td>\r\n\t\t\t<td>{$hire_data['username']}</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='../cust-det.php?cusnum={$hire_data['cust_id']}'>\r\n\t\t\t\t\t{$hire_data['cusname']} {$hire_data['surname']}\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>";
}
if (empty($hire_out)) {
$hire_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No items found for this date range</li></td>\r\n\t\t</tr>";
}
if (empty($invoice_out)) {
$invoice_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No items found for this date range</li></td>\r\n\t\t</tr>";
}
$OUTPUT = "<center>\r\n\t<h3>Daily 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><input type='submit' value='Select' /></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 colspan='4' style='font-size: 16px'>HIRES</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Time</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Sales Person</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t</tr>\r\n\t\t{$hire_out}\r\n\t\t<tr>\r\n\t\t\t<th colspan='4' style='font-size: 16px'>INVOICES</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Time</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Sales Person</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t</tr>\r\n\t\t{$invoice_out}\r\n\t</table>\r\n\t</center>";
return $OUTPUT;
}
示例13: printInv
function printInv()
{
# Set up table to display in
$printCallout = "\r\n\t<h3>View Call Out Documents For Invoicing.</h3>\r\n\t<table border='0' cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Department</th><th>Call Out Person</th><th>Job No.</th><th>Service Date</th><th>Customer Name</th><th colspan='6'>Options</th></tr>";
# connect to database
db_connect();
# Query server
$i = 0;
$sql = "SELECT * FROM callout_docs WHERE accepted != 'c' AND done = 'y' AND div = '" . USER_DIV . "' AND invoiced != 'yes' ORDER BY calloutid DESC";
$calloutRslt = db_exec($sql) or errDie("Unable to retrieve call out documents from database.");
if (pg_numrows($calloutRslt) < 1) {
$printCallout = "<li>No previous call out documents.";
} else {
while ($callout = pg_fetch_array($calloutRslt)) {
# format date
$callout['odate'] = explode("-", $callout['odate']);
$callout['odate'] = $callout['odate'][2] . "-" . $callout['odate'][1] . "-" . $callout['odate'][0];
#check if this doc has been uploaded
$get_doc = "SELECT * FROM callout_docs_scanned WHERE calloutid = '{$callout['calloutid']}' AND div = '" . USER_DIV . "'";
$run_doc = db_exec($get_doc) or errDie("Unable to get call out document information");
if (pg_numrows($run_doc) < 1) {
$uploaddoc = "<td colspan='2'><a href='callout-uploaddoc.php?calloutid={$callout['calloutid']}'>Upload Scanned Document</a></td>";
} else {
$uploaddoc = "<td><a href='callout-uploaddoc.php?calloutid={$callout['calloutid']}'>Change Uploaded Document</a></td><td><a href='images/callout-showdoc.php?calloutid={$callout['calloutid']}'>View Document</a></td>";
}
$printCallout .= "\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td>{$callout['deptname']}</td>\r\n\t\t\t\t\t<td>{$callout['calloutp']}</td>\r\n\t\t\t\t\t<td>{$callout['calloutid']}</td>\r\n\t\t\t\t\t<td align=center>{$callout['odate']}</td>\r\n\t\t\t\t\t<td>{$callout['cusname']} {$callout['surname']}</td>\r\n\t\t\t\t\t<td><a href='callout-new.php?calloutid={$callout['calloutid']}&cont=true&letters=&done='>Edit</a></td>\r\n\t\t\t\t\t<td><a href='callout-cancel.php?calloutid={$callout['calloutid']}'>Cancel</a></td>\r\n\t\t\t\t\t<td><a href='callout-print.php?calloutid={$callout['calloutid']}' target='_blank'>Print</a></td>\r\n\t\t\t\t\t{$uploaddoc}\r\n\t\t\t\t\t<td><a href='callout-invoiced.php?calloutid={$callout['calloutid']}'>Complete (Invoiced)</a></td>\r\n\t\t\t\t</tr>";
$i++;
}
}
// Layout
$printCallout .= "\r\n\t\t\t</table>\r\n\t\t\t<p>\r\n\t\t\t<table border='0' cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t\t\t\t<tr><td><br></td></tr>\r\n\t\t\t\t<tr><th>Quick Links</th></tr>\r\n\t\t\t\t<tr class='datacell'><td align='center'><a href='cust-credit-stockinv.php'>New Invoice</a></td></tr>\r\n\t\t\t\t<tr class='datacell'><td align='center'><a href='callout-new.php'>New Call Out Document</td></tr>\r\n\t\t\t\t<tr class='datacell'><td align='center'><a href='main.php'>Main Menu</td></tr>\r\n\t\t\t</table>";
return $printCallout;
}
示例14: printQuo
function printQuo()
{
# Set up table to display in
$printQuo = "\n <h3>Incomplete POS Quotes</h3>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n <tr><th>Username</th><th>Department</th><th>Sales Person</th><th>Quote No.</th><th>Quote Date</th><th>Customer Name</th><th>Order No</th><th>Grand Total</th><th>Balance</th><th colspan=3>Options</th></tr>";
# connect to database
db_connect();
# Query server
$i = 0;
$sql = "SELECT * FROM pos_quotes WHERE done = 'n' 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 incomplete quotes.";
} else {
while ($quo = pg_fetch_array($quoRslt)) {
# get department
db_conn("exten");
$sql = "SELECT * FROM departments WHERE deptid = '{$quo['deptid']}' AND div = '" . USER_DIV . "'";
$deptRslt = db_exec($sql);
if (pg_numrows($deptRslt) < 1) {
$dept['deptname'] = "<i class=err>Not Found</i>";
} else {
$dept = pg_fetch_array($deptRslt);
}
# format date
$quo['odate'] = explode("-", $quo['odate']);
$quo['odate'] = $quo['odate'][2] . "-" . $quo['odate'][1] . "-" . $quo['odate'][0];
$printQuo .= "<tr class='" . bg_class() . "'><td>{$quo['username']}</td><td>{$dept['deptname']}</td><td>{$quo['salespn']}</td><td>{$quo['quoid']}</td><td align=center>{$quo['odate']}</td><td>{$quo['cusname']}</td><td align=right>{$quo['ordno']}</td><td>" . CUR . " {$quo['total']}</td>\n\t\t\t\t<td>" . CUR . " {$quo['balance']}</td>\n\t\t\t\t<td><a href='pos-quote-new.php?quoid={$quo['quoid']}&cont=true&done='>Continue</a></td>\n\t\t\t\t<td><a href='pos-quote-unf-cancel.php?quoid={$quo['quoid']}'>Cancel</a></td></tr>";
$i++;
}
}
// Layout
$printQuo .= "</table>\n <p>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n <tr><td><br></td></tr>\n <tr><th>Quick Links</th></tr>\n\t\t<tr class=datacell><td><a href='pos-quote-canc-view.php'>View Cancelled POS Quotes</td></tr>\n <tr class=datacell><td><a href='pos-quote-new.php'>New POS Quote</td></tr>\n <tr class=datacell><td><a href='main.php'>Main Menu</td></tr>\n </table>";
return $printQuo;
}
示例15: remove
function remove()
{
extract($_REQUEST);
$sql = "DELETE FROM cubit.cust_dates WHERE id='{$id}'";
db_exec($sql) or errDie("Unable to remove date.");
return display();
}