本文整理汇总了PHP中extlib_rstr函数的典型用法代码示例。如果您正苦于以下问题:PHP extlib_rstr函数的具体用法?PHP extlib_rstr怎么用?PHP extlib_rstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了extlib_rstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
function edit($listid)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($listid, "num", 1, 50, "Invalid Price List id.");
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class='err'>-" . $e["msg"] . "</li>";
}
return $confirm;
}
# Select Stock
db_conn("exten");
$sql = "SELECT * FROM pricelist WHERE listid = '{$listid}' AND div = '" . USER_DIV . "'";
$listRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
if (pg_numrows($listRslt) < 1) {
return "<li> Invalid Price List ID.";
} else {
$list = pg_fetch_array($listRslt);
}
$vattype = getSetting("SELAMT_VAT") == 'inc' ? "Including Vat" : "Excluding Vat";
$enter = "\r\n\t\t<h3>Price List</h3>\r\n\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Field</th>\r\n\t\t\t\t<th>Value</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>Price list</td>\r\n\t\t\t\t<td align='center'>{$list['listname']}</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr><td><br></td></tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan='2'><h3>Prices</h3><td>\r\n\t\t\t<tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Item</th>\r\n\t\t\t\t<th>Price Amount</th>\r\n\t\t\t</tr>";
# Query server
$i = 0;
db_conn('exten');
$sql = "SELECT * FROM plist_prices WHERE listid = '{$listid}' AND div = '" . USER_DIV . "' AND show='Yes' ORDER BY stkid ASC";
$stkpRslt = db_exec($sql) or errDie("Unable to retrieve stock items from database.");
if (pg_numrows($stkpRslt) < 1) {
return "<li class='err'> There are no stock item on the selected pricelist.</li>";
}
while ($stkp = pg_fetch_array($stkpRslt)) {
db_connect();
# get stock details
$sql = "SELECT stkid, stkcod, stkdes FROM stock WHERE stkid = '{$stkp['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql) or errDie("Unable to retrieve stocks from database.");
$stk = pg_fetch_array($stkRslt);
$enter .= "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td>{$stk['stkcod']} - " . extlib_rstr($stk['stkdes'], 30) . "</td>\r\n\t\t\t\t\t<td align='right'>" . CUR . " " . sprint($stkp['price']) . " {$vattype}</td>\r\n\t\t\t\t</tr>";
}
$enter .= "\r\n\t\t\t</table>";
$OUTPUT = $enter;
require "temp.xls.php";
Stream("Pricelist", $OUTPUT);
return $OUTPUT;
}
示例2: edit
function edit($listid)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($listid, "num", 1, 50, "Invalid Price List id.");
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>-" . $e["msg"] . "<br>";
}
return $confirm;
}
# Select Stock
db_conn("exten");
$sql = "SELECT * FROM spricelist WHERE listid = '{$listid}' AND div = '" . USER_DIV . "'";
$listRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
if (pg_numrows($listRslt) < 1) {
return "<li> Invalid Price List ID.";
} else {
$list = pg_fetch_array($listRslt);
}
$vattype = getSetting("SELAMT_VAT") == 'inc' ? "Including Vat" : "Excluding Vat";
$enter = "<h3>Supplier Price List</h3>\r\n\t\t<form action='" . SELF . "' method=post>\r\n\t\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t\t<tr><th>Field</th><th>Value</th></tr>\r\n\t\t<tr class='bg-odd'><td>Price list</td><td align=center>{$list['listname']}</td></tr>\r\n\t\t<tr><td><br></td></tr>\r\n\t\t<tr><td colspan=2><h3>Prices</h3><td><tr>\r\n\t\t<tr><th>Item</th><th>Price Amount</th></tr>";
# Query server
$i = 0;
db_conn('exten');
$sql = "SELECT * FROM splist_prices WHERE listid = '{$listid}' AND div = '" . USER_DIV . "' ORDER BY stkid ASC";
$stkpRslt = db_exec($sql) or errDie("Unable to retrieve stock items from database.");
if (pg_numrows($stkpRslt) < 1) {
return "<li class=err> There are no stock item on the selected pricelist.";
}
while ($stkp = pg_fetch_array($stkpRslt)) {
db_connect();
# get stock details
$sql = "SELECT stkid, stkcod, stkdes FROM stock WHERE stkid = '{$stkp['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql) or errDie("Unable to retrieve stocks from database.");
$stk = pg_fetch_array($stkRslt);
$enter .= "<tr class='" . bg_class() . "'><td>{$stk['stkcod']} - " . extlib_rstr($stk['stkdes'], 30) . "</td><td align=right>" . CUR . " {$stkp['price']} {$vattype}</td></tr>";
}
$enter .= "\r\n\t\t</table></form>\r\n\t\t<p>\r\n\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='sup-pricelist-view.php'>View Supplier Price Lists</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t\t</table>";
return $enter;
}
示例3: printStk
function printStk($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($whid, "num", 1, 50, "Invalid Warehouse.");
$v->isOk($fday, "num", 1, 2, "Invalid from Date day.");
$v->isOk($fmon, "num", 1, 2, "Invalid from Date month.");
$v->isOk($fyear, "num", 1, 4, "Invalid from Date Year.");
$v->isOk($today, "num", 1, 2, "Invalid to Date day.");
$v->isOk($tomon, "num", 1, 2, "Invalid to Date month.");
$v->isOk($toyear, "num", 1, 4, "Invalid to Date Year.");
# mix dates
$fromdate = $fyear . "-" . $fmon . "-" . $fday;
$todate = $toyear . "-" . $tomon . "-" . $today;
if (!checkdate($fmon, $fday, $fyear)) {
$v->isOk($fromdate, "num", 1, 1, "Invalid from date.");
}
if (!checkdate($tomon, $today, $toyear)) {
$v->isOk($todate, "num", 1, 1, "Invalid to date.");
}
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>-" . $e["msg"] . "<br>";
}
return $confirm;
}
# Get Stock
db_connect();
$searchs = "SELECT * FROM stock WHERE whid = '{$whid}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($searchs) or errDie("Unable to retrieve stocks from database.");
if (pg_numrows($stkRslt) < 1) {
return "<li class=err> There are no stock items found.</li>\r\n\t\t<p>\r\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n\t\t\t<tr><td><br></td></tr>\r\n\t\t\t<tr><th>Quick Links</th></tr>\r\n\t\t\t<tr class='bg-odd'><td><a href='sales-reports.php'>Sales Reports</a></td></tr>\r\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t\t<tr class='bg-even'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t\t</table>";
}
db_conn("exten");
# Get warehouse
$sql = "SELECT whname FROM warehouses WHERE whid = '{$whid}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
$totprof = 0;
$totqty = 0;
$totpqty = 0;
$totcsprice = 0;
$items = array();
while ($stk = pg_fetch_array($stkRslt)) {
# Get all relevant records
db_connect();
$sql = "SELECT sum(qty) as qty, sum(csprice) as csprice, sum(csamt) as csamt FROM stockrec WHERE edate >= '{$fromdate}' AND edate <= '{$todate}' AND stkid = '{$stk['stkid']}' AND trantype = 'invoice' AND div = '" . USER_DIV . "'";
$recRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
$rec = pg_fetch_array($recRslt);
# Get all relevant records
db_connect();
$sql = "SELECT sum(qty) as qty, sum(csprice) as csprice, sum(csamt) as csamt FROM stockrec WHERE edate >= '{$fromdate}' AND edate <= '{$todate}' AND stkid = '{$stk['stkid']}' AND trantype = 'note' AND div = '" . USER_DIV . "'";
$recRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
$nrec = pg_fetch_array($recRslt);
# Get all relevant records
db_connect();
$sql = "SELECT sum(qty) as qty, sum(csprice) as csprice, sum(csamt) as csamt FROM stockrec WHERE edate >= '{$fromdate}' AND edate <= '{$todate}' AND stkid = '{$stk['stkid']}' AND trantype = 'purchase' AND div = '" . USER_DIV . "'";
$precRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
$prec = pg_fetch_array($precRslt);
# less credit notes
$rec['qty'] -= $nrec['qty'];
$rec['csprice'] -= $nrec['csprice'];
$rec['csamt'] -= $nrec['csamt'];
# zeros
$rec['qty'] += 0;
$rec['csprice'] += 0;
$rec['csamt'] += 0;
# zeros
$prec['qty'] += 0;
$prec['csprice'] += 0;
$prec['csamt'] += 0;
# Calculate profit
$prof = $rec['csprice'] - $rec['csamt'];
$totprof += $prof;
$totcsprice += $rec['csprice'];
$totqty += $rec['qty'];
$totpqty += $prec['qty'];
# Limit to 30 chars
$stk['stkdes'] = extlib_rstr($stk['stkdes'], 30);
$item['stkcod'] = $stk['stkcod'];
$item['stkdes'] = $stk['stkdes'];
$item['pqty'] = $prec['qty'];
$item['qty'] = $rec['qty'];
$item['csprice'] = sprint($rec['csprice']);
$item['profit'] = sprint($prof);
$items[] = $item;
}
# bubble sorting
$sortarr =& $items;
// where $out = array name to sort
for ($j = 0; $j < count($sortarr); $j++) {
for ($i = 0; $i < count($sortarr) - 1; $i++) {
//.........这里部分代码省略.........
示例4: confirm
function confirm($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($listname, "string", 1, 255, "Invalid Price list name.");
$v->isOk($listid, "num", 1, 50, "Invalid Price List id.");
if (isset($stkids)) {
foreach ($stkids as $key => $value) {
$v->isOk($stkids[$key], "num", 1, 20, "Invalid Stock Item number.");
$v->isOk($prices[$key], "float", 1, 20, "Invalid Stock Item price.");
}
} else {
return "<li class=err> there is not stock for the price list.";
}
$vattype = getSetting("SELAMT_VAT") == 'inc' ? "Including Vat" : "Excluding Vat";
# 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;
}
# Select Stock
db_conn("exten");
$sql = "SELECT * FROM spricelist WHERE listid = '{$listid}' AND div = '" . USER_DIV . "'";
$listRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
if (pg_numrows($listRslt) < 1) {
return "<li> Invalid Price List ID.";
} else {
$list = pg_fetch_array($listRslt);
}
$confirm = "<h3>Confirm Copy Supplier Price list</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=listname value='{$listname}'>\r\n\t<input type=hidden name=listid value='{$listid}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>From Price list</td><td align=center>{$list['listname']}</td></tr>\r\n\t<tr class='bg-even'><td>To Price list</td><td align=center>{$listname}</td></tr>\r\n\t<tr><td colspan=2><br><td><tr>\r\n\t<tr><td align=right><input type=button value='Back' onclick='javascript:history.back();'></td><td valign=left><input type=submit value='Write »'></td></tr>\r\n\t<tr><td colspan=2><h3>Prices</h3><td><tr>\r\n\t<tr><th>Item</th><th>Price Amount</th></tr>";
# Query server
foreach ($stkids as $key => $value) {
db_connect();
$sql = "SELECT stkid, stkcod, stkdes FROM stock WHERE stkid = '{$stkids[$key]}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql) or errDie("Unable to retrieve stocks from database.");
$stk = pg_fetch_array($stkRslt);
$confirm .= "<tr class='" . bg_class() . "'><td><input type=hidden name=stkids[] value='{$stk['stkid']}'>{$stk['stkcod']} - " . extlib_rstr($stk['stkdes'], 30) . "</td><td>" . CUR . " <input type=hidden name=prices[] size=8 value='{$prices[$key]}'>{$prices[$key]} {$vattype}</td></tr>";
}
$confirm .= "\r\n\t<tr><td><br></td></tr>\r\n\t<tr><td align=right><input type=button value='Back' onclick='javascript:history.back();'></td><td valign=left><input type=submit value='Write »'></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='sup-pricelist-view.php'>View Supplier Price Lists</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 $confirm;
}
示例5: details
//.........这里部分代码省略.........
# Put in product
$products .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='2'>{$Accounts}<input type='hidden' name='whids[]' value='{$stkd['whid']}'></td>\n\t\t\t\t\t<td><input type='hidden' name='stkids[]' value='{$stkd['stkid']}'>{$Vatcodes}</td>\n\t\t\t\t\t<td><input type='text' size='20' name='descriptions[]' value='{$stkd['description']}'> {$sernos}</td>\n\t\t\t\t\t<td>{$qtyin}</td>\n\t\t\t\t\t<td>{$viewcost}</td>\n\t\t\t\t\t<td><input type='hidden' name='disc[]' value='{$stkd['disc']}'><input type='hidden' name='discp[]' value='{$stkd['discp']}'></td>\n\t\t\t\t\t<td nowrap><input type='hidden' name='amt[]' value='{$stkd['amt']}'> " . CUR . " {$stkd['amt']}</td>\n\t\t\t\t\t<td><input type='checkbox' name='remprod[]' value='{$key}'><input type='hidden' name='SCROLL' value='yes'></td>\n\t\t\t\t</tr>";
$key++;
} else {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$i++;
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkd['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
# get warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$stk['whid']}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
$Ri = db_exec($Sl) or errDie("Unable to get vat codes");
$Vatcodes = "\n\t\t\t\t<select name='vatcodes[]'>\n\t\t\t\t\t<option value='0'>Select</option>";
while ($vd = pg_fetch_array($Ri)) {
if ($stkd['vatcode'] == $vd['id']) {
$sel = "selected";
} else {
$sel = "";
}
$Vatcodes .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
}
$Vatcodes .= "</select>";
$stkd['unitcost'] = sprint($stkd['unitcost']);
$stkd['amt'] = sprint($stkd['amt']);
# put in product
$products .= "\n\t\t\t\t<input type='hidden' name='accounts[]' value='0'>\n\t\t\t\t<input type='hidden' name='descriptions[]' value=''>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><input type='hidden' name='whids[]' value='{$stkd['whid']}'>{$wh['whname']}</td>\n\t\t\t\t\t<td><input type='hidden' name='stkids[]' value='{$stkd['stkid']}'><a href='#' onclick='openwindow(\"stock-amt-det.php?stkid={$stk['stkid']}\")'>{$stk['stkcod']}</a></td>\n\t\t\t\t\t<td>{$Vatcodes}</td>\n\t\t\t\t\t<td>" . extlib_rstr($stk['stkdes'], 30) . "</td>\n\t\t\t\t\t<td><input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'></td>\n\t\t\t\t\t<td><input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'></td>\n\t\t\t\t\t<td><input type='text' size='4' name='disc[]' value='{$stkd['disc']}'> OR <input type='text' size='4' name='discp[]' value='{$stkd['discp']}' maxlength=5>%</td>\n\t\t\t\t\t<td nowrap><input type='hidden' name='amt[]' value='{$stkd['amt']}'> " . CUR . " {$stkd['amt']}</td>\n\t\t\t\t\t<td><input type='checkbox' name='remprod[]' value='{$key}'><input type='hidden' name='SCROLL' value='yes'></td>\n\t\t\t\t</tr>";
$key++;
}
}
# Look above(remprod keys)
$keyy = $key;
# look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
}
# check if stock warehouse was selected
if (isset($whidss)) {
foreach ($whidss as $key => $whid) {
if (isset($stkidss[$key]) && $stkidss[$key] != "-S" && isset($cust['pricelist'])) {
# skip if not selected
if ($whid == "-S") {
continue;
}
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkidss[$key]}' AND div = '" . USER_DIV . "' ORDER BY stkcod ASC";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
# get selected warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$stk['whid']}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# get price from price list if it is set
if (isset($cust['pricelist'])) {
# get selected stock in this warehouse
db_conn("exten");
$sql = "SELECT price FROM plist_prices WHERE listid = '{$cust['pricelist']}' AND stkid = '{$stk['stkid']}' AND div = '" . USER_DIV . "'";
示例6: confirm
function confirm($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($listid, "num", 1, 50, "Invalid Price List id.");
if (isset($stkids)) {
foreach ($stkids as $key => $value) {
$v->isOk($stkids[$key], "num", 1, 20, "Invalid Stock Item number.");
$v->isOk($prices[$key], "float", 1, 20, "Invalid Stock Item price.");
}
} else {
return "<li class=err> there is not stock for the price list.";
}
# 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;
}
# Select Stock
db_conn("exten");
$sql = "SELECT * FROM pricelist WHERE listid = '{$listid}'";
$listRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
if (pg_numrows($listRslt) < 1) {
return "<li> Invalid Price List ID.";
} else {
$list = pg_fetch_array($listRslt);
}
$confirm = "<h3>Confirm Stock Selling Prices Increase</h3>\n\t<form action='" . SELF . "' method=post>\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<input type=hidden name=key value=write>\n\t<input type=hidden name=listid value='{$listid}'>\n\t<tr><th>Field</th><th>Value</th></tr>\n\t<tr class='bg-odd'><td>Price list</td><td align=center>{$list['listname']}</td></tr>\n\t<tr><td colspan=2><br><td><tr>\n\t<tr><td align=right><input type=button value='Back' onclick='javascript:history.back();'></td><td valign=left><input type=submit value='Write »'></td></tr>\n\t<tr><td colspan=2><h3>Prices</h3><td><tr>\n\t<tr><th>Item</th><th>Old Price</th><th>New Price</th></tr>";
# Query server
foreach ($stkids as $key => $value) {
# format price
$prices[$key] = sprint($prices[$key]);
db_connect();
$sql = "SELECT stkid, stkcod, stkdes FROM stock WHERE stkid = '{$stkids[$key]}'";
$stkRslt = db_exec($sql) or errDie("Unable to retrieve stocks from database.");
$stk = pg_fetch_array($stkRslt);
db_conn("exten");
$sql = "SELECT price FROM plist_prices WHERE stkid = '{$stkids[$key]}' AND listid = '{$listid}'";
$rslt = db_exec($sql) or errDie("Unable to fetch price list items from Cubit.", SELF);
$stkp = pg_fetch_array($rslt);
$confirm .= "<tr class='" . bg_class() . "'><td><input type=hidden name=stkids[] value='{$stk['stkid']}'>{$stk['stkcod']} - " . extlib_rstr($stk['stkdes'], 30) . "</td><td>" . CUR . " {$stkp['price']}</td><td>" . CUR . " <input type=hidden name=prices[] size=8 value='{$prices[$key]}'>{$prices[$key]}</td></tr>";
}
$confirm .= "\n\t<tr><td><br></td></tr>\n\t<tr><td align=right><input type=button value='Back' onclick='javascript:history.back();'></td><td valign=left><input type=submit value='Write »'></td></tr>\n\t</table></form>\n\t<p>\n\t<table border=0 cellpadding='2' cellspacing='1'>\n\t<tr><th>Quick Links</th></tr>\n\t<tr class='bg-odd'><td><a href='toms/pricelist-view.php'>View Price Lists</a></td></tr>\n\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
return $confirm;
}
示例7: details
//.........这里部分代码省略.........
$amts[$i] = $stkd['amt'];
$i++;
# Get warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$stkd['whid']}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# Get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkd['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
$sernos = "<input type='hidden' name='sernos[]' value='{$stkd['serno']}'>{$stkd['serno']}";
# check permissions
if (perm("invoice-unitcost-edit.php")) {
$viewcost = "<input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'>";
} else {
$viewcost = "<input type='hidden' size='8' name='unitcost[]' value='{$stkd['unitcost']}'>{$stkd['unitcost']}";
}
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
$Ri = db_exec($Sl) or errDie("Unable to get vat codes");
$Vatcodes = "\n\t\t\t\t<select name='vatcodes[]'>\n\t\t\t\t\t<option value='0'>Select</option>";
while ($vd = pg_fetch_array($Ri)) {
if ($stkd['vatcode'] == $vd['id']) {
$sel = "selected";
} else {
$sel = "";
}
$Vatcodes .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
}
$Vatcodes .= "</select>";
# Put in product
$products .= "\n\t\t\t\t<input type='hidden' name='accounts[]' value='0'>\n\t\t\t\t<input type='hidden' name='descriptions[]' value=''>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><input type='hidden' name='whids[]' value='{$stkd['whid']}'>{$wh['whname']}</td>\n\t\t\t\t\t<td><input type='hidden' name='stkids[]' value='{$stkd['stkid']}'><a href='#bottom' onclick='openwindow(\"stock-amt-det.php?stkid={$stk['stkid']}\")'>{$stk['stkcod']}</a></td>\n\t\t\t\t\t{$sernos}\n\t\t\t\t\t<td>{$Vatcodes}</td>\n\t\t\t\t\t<td>" . extlib_rstr($stk['stkdes'], 30) . "</td>\n\t\t\t\t\t<td><input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'></td>\n\t\t\t\t\t<td>{$viewcost}</td>\n\t\t\t\t\t<td><input type='text' size='4' name='disc[]' value='{$stkd['disc']}'> OR <input type='text' size='4' name='discp[]' value='{$stkd['discp']}' maxlength='5'>%</td>\n\t\t\t\t\t<td nowrap><input type='hidden' name='amt[]' value='{$stkd['amt']}'> " . CUR . " " . sprint($stkd['amt']) . "</td>\n\t\t\t\t\t<td><input type='checkbox' name='remprod[]' value='{$key}'><input type='hidden' name='SCROLL' value='yes'></td>\n\t\t\t\t</tr>";
$key++;
}
}
# Look above(remprod keys)
$keyy = $key;
# Look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
} else {
$SCROLL = "yes";
}
# check if stock warehouse was selected
if (isset($whidss)) {
foreach ($whidss as $key => $whid) {
if (isset($stkidss[$key]) && $stkidss[$key] != "-S" && isset($cust['pricelist'])) {
# skip if not selected
if ($whid == "-S") {
continue;
}
# Get selected warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$whid}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# Get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkidss[$key]}' AND div = '" . USER_DIV . "' ORDER BY stkcod ASC";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
$sernos = "<input type='hidden' name='sernos[]' value=''>";
# Get price from price list if it is set
if (isset($cust['pricelist'])) {
示例8: details
//.........这里部分代码省略.........
$sernos .= "<option value='{$ser['serno']}'>{$ser['serno']}</option>";
}
$sernos .= "</select>";
} else {
$sernos = "<input type='hidden' name='sernos[]' value='{$stkd['serno']}'>{$stkd['serno']}";
}
# Input qty if not serialised
$qtyin = "<input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'>";
if ($stk['serd'] == 'yes') {
$qtyin = "<input type='hidden' size='3' name='qtys[]' value='{$stkd['qty']}'>{$stkd['qty']}";
}
# check permissions
if (perm("invoice-unitcost-edit.php")) {
$viewcost = "<input type='text' size='8' name='unitcost[]' value='{$stkd['funitcost']}'>";
$cunitcost = "<input type='text' size='8' name='cunitcost[]' value='{$stkd['unitcost']}'>";
} else {
$viewcost = "<input type='hidden' size='8' name='unitcost[]' value='{$stkd['funitcost']}'>{$stkd['funitcost']}";
$cunitcost = "<input type='hidden' size='8' name='cunitcost[]' value='{$stkd['unitcost']}'>{$stkd['unitcost']}";
}
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
$Ri = db_exec($Sl) or errDie("Unable to get vat codes");
$Vatcodes = "\n\t\t\t<select name='vatcodes[]'>\n\t\t\t\t<option value='0'>Select</option>";
while ($vd = pg_fetch_array($Ri)) {
if ($stkd['vatcode'] == $vd['id']) {
$sel = "selected";
} else {
$sel = "";
}
$Vatcodes .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
}
$Vatcodes .= "</select>";
# Put in product
$products .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='hidden' name='whids[]' value='{$stkd['whid']}'>{$wh['whname']}</td>\n\t\t\t\t<td><input type='hidden' name='stkids[]' value='{$stkd['stkid']}'><a href='#bottom' onclick='openwindow(\"stock-amt-det.php?stkid={$stk['stkid']}\")'>{$stk['stkcod']}</a></td>\n\t\t\t\t<td>{$Vatcodes}</td>\n\t\t\t\t<td>{$sernos}</td>\n\t\t\t\t<td>" . extlib_rstr($stk['stkdes'], 30) . "</td>\n\t\t\t\t<td>{$qtyin}</td>\n\t\t\t\t<td>" . CUR . " {$viewcost}</td>\n\t\t\t\t<td>{$inv['currency']} {$cunitcost}</td>\n\t\t\t\t<td>{$inv['currency']}<input type='text' size='4' name='disc[]' value='{$stkd['disc']}'> OR <input type='text' size='4' name='discp[]' value='{$stkd['discp']}' maxlength='5'>%</td>\n\t\t\t\t<td><input type='hidden' name='amt[]' value='{$stkd['amt']}'> {$inv['currency']} {$stkd['amt']}</td>\n\t\t\t\t<td><input type='checkbox' name='remprod[]' value='{$key}'><input type='hidden' name='SCROLL' value='yes'></td>\n\t\t\t</tr>";
$key++;
}
# Look above(remprod keys)
$keyy = $key;
# Look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
} else {
$SCROLL = "yes";
}
# check if stock warehouse was selected
if (isset($whidss)) {
foreach ($whidss as $key => $whid) {
if (isset($stkidss[$key]) && $stkidss[$key] != "-S" && isset($cust['pricelist'])) {
# skip if not selected
if ($whid == "-S") {
continue;
}
# Get selected warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$whid}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# Get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkidss[$key]}' AND div = '" . USER_DIV . "' ORDER BY stkcod ASC";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
if ($stk['serd'] == 'yes') {
$sers = ext_getavserials($stkidss[$key]);
$sernos = "<select class='width : 15'name='sernos[]' onChange='javascript:document.form.submit();'>";
foreach ($sers as $skey => $ser) {
示例9: details
//.........这里部分代码省略.........
if (isb($ad['accid'])) {
continue;
}
if ($ad['accid'] == $stkd['account']) {
$sel = "selected";
} else {
$sel = "";
}
$Accounts .= "<option value='{$ad['accid']}' {$sel}>{$ad['accname']}</option>";
}
$Accounts .= "</select>";
$sernos = "";
# Input qty if not serialised
$qtyin = "<input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'>";
$viewcost = "<input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'>";
# Put in product
$products .= "\n\t\t\t\t<input type='hidden' name='whids[]' value='{$stkd['whid']}'>\n\t\t\t\t<input type='hidden' name='stkids[]' value='{$stkd['stkid']}'>\n\t\t\t\t<input type='hidden' name='SCROLL' value='yes'>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='2'>{$Accounts}</td>\n\t\t\t\t\t<td><input type='text' size='20' name='descriptions[]' value='{$stkd['description']}'> {$sernos}</td>\n\t\t\t\t\t<td>{$qtyin}</td>\n\t\t\t\t\t<td>{$viewcost}</td>\n\t\t\t\t\t<td><input type='checkbox' name='remprod[]' value='{$key}'></td>\n\t\t\t\t</tr>";
$key++;
} else {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$i++;
# get warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$stkd['whid']}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkd['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
# put in product
$products .= "\n\t\t\t\t<input type='hidden' name='accounts[]' value='0'>\n\t\t\t\t<input type='hidden' name='descriptions[]' value=''>\n\t\t\t\t<input type='hidden' name='stkids[]' value='{$stkd['stkid']}'>\n\t\t\t\t<input type='hidden' name='whids[]' value='{$stkd['whid']}'>\n\t\t\t\t<input type='hidden' name='SCROLL' value='yes'>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>{$wh['whname']}</td>\n\t\t\t\t\t<td><a href='#' onclick='openwindow(\"stock-amt-det.php?stkid={$stk['stkid']}\")'>{$stk['stkcod']}</a></td>\n\t\t\t\t\t<td>" . extlib_rstr($stk['stkdes'], 30) . "</td>\n\t\t\t\t\t<td><input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'></td>\n\t\t\t\t\t<td><input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'></td>\n\t\t\t\t\t<td><input type='checkbox' name='remprod[]' value='{$key}'></td>\n\t\t\t\t</tr>";
$key++;
}
}
# Look above(remprod keys)
$keyy = $key;
# look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
}
# check if stock warehouse was selected
if (isset($whidss)) {
foreach ($whidss as $key => $whid) {
if (isset($stkidss[$key]) && $stkidss[$key] != "-S" && isset($cust['pricelist'])) {
# skip if not selected
if ($whid == "-S") {
continue;
}
# get selected warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$whid}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkidss[$key]}' AND div = '" . USER_DIV . "' ORDER BY stkcod ASC";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
# get price from price list if it is set
if (isset($cust['pricelist'])) {
# get selected stock in this warehouse
db_conn("exten");
$sql = "SELECT price FROM plist_prices WHERE listid = '{$cust['pricelist']}' AND stkid = '{$stk['stkid']}' AND div = '" . USER_DIV . "'";
示例10: details
//.........这里部分代码省略.........
$sel = "selected";
} else {
$sel = "";
}
$Vatcodes .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
}
$Vatcodes .= "</select>";
$stkd['unitcost'] = sprint($stkd['unitcost']);
$stkd['amt'] = sprint($stkd['amt']);
// $sql = "SELECT * FROM manufact.jobcards WHERE recipe!='yes' AND completion!='1'";
// $job_rslt = db_exec($sql) or errDie("Unable to retrieve jobs.");
//
// $job_sel = "<select name='job_id[]' style='width: 100%'>";
// while ($job_data = pg_fetch_array($job_rslt)) {
// if ($stkd["jobcard_id"] == $job_data["id"]) {
// $sel = "selected";
// } else {
// $sel = "";
// }
//
// $job_sel .= "<option value='$job_data[id]' $sel>
// $job_data[id] $job_data[description]
// </option>";
// }
// $job_sel .= "</select>";
// <tr>
// <td bgcolor='#ff0000' width='10%'>
// $job_sel<br />
// <input type='submit' name='pur[]' value='Add To Purchase Resource Planning'>
// </td>
// </tr>
// rowspan='2'
# put in product
$products .= "\n\t\t\t\t<input type='hidden' name='accounts[]' value='0'>\n\t\t\t\t<input type='hidden' name='descriptions[]' value=''>\n\t\t\t\t<input type='hidden' name='amt[]' value='{$stkd['amt']}'>\n\t\t\t\t<input type='hidden' name='pqty[{$stk['stkid']}]' value='{$stkd['qty']}' />\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><input type='hidden' name='whids[]' value='{$stkd['whid']}'>{$wh['whname']}</td>\n\t\t\t\t\t<td><input type='hidden' name='stkids[]' value='{$stkd['stkid']}'><a href='#' onclick='openwindow(\"stock-amt-det.php?stkid={$stk['stkid']}\")'>{$stk['stkcod']}</a></td>\n\t\t\t\t\t<td>{$Vatcodes}</td>\n\t\t\t\t\t<td>" . extlib_rstr($stk['stkdes'], 30) . "</td>\n\t\t\t\t\t<td><input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'></td>\n\t\t\t\t\t<td><input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'></td>\n\t\t\t\t\t<td><input type='text' size='4' name='disc[]' value='{$stkd['disc']}'> OR <input type='text' size='4' name='discp[]' value='{$stkd['discp']}' maxlength=5>%</td>\n\t\t\t\t\t<td>" . CUR . " {$stkd['amt']}</td>\n\t\t\t\t\t<td><input type='checkbox' name='remprod[]' value='{$key}'><input type='hidden' name='SCROLL' value='yes'></td>\n\t\t\t\t</tr>";
$key++;
}
}
# Look above(remprod keys)
$keyy = $key;
# look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
}
#get negative stock setting
$neg_setting = getCsetting("SORDER_NEG_STOCK");
if (!isset($neg_setting) or strlen($neg_setting) < 1) {
$neg_setting = "yes";
}
if ($neg_setting == "yes") {
$search_neg_stock = "";
} else {
$search_neg_stock = " AND (units > 0) ";
}
# check if stock warehouse was selected
if (isset($whidss)) {
foreach ($whidss as $key => $whid) {
if (isset($stkidss[$key]) && $stkidss[$key] != "-S" && isset($cust['pricelist'])) {
# skip if not selected
if ($whid == "-S") {
continue;
}
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkidss[$key]}' AND div = '" . USER_DIV . "' ORDER BY stkcod ASC";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
示例11: details
//.........这里部分代码省略.........
$Vatcodes .= "</select>";
//print "fo";
# Put in product
$products .= "<tr class='bg-odd'><td colspan=2>{$Accounts}<input type=hidden name=whids[] value='{$stkd['whid']}'></td><td><input type=hidden name=stkids[] value='{$stkd['stkid']}'>{$Vatcodes}</td><td><input type=text size=20 name=descriptions[] value='{$stkd['description']}'> {$sernos}</td><td>{$qtyin}</td><td>{$viewcost}</td><td><input type=hidden name=disc[] value='{$stkd['disc']}'><input type=hidden name=discp[] value='{$stkd['discp']}'></td><td><input type=hidden name=amt[] value='{$stkd['amt']}'> " . CUR . " {$stkd['amt']}</td><td><input type=checkbox name=remprod[] value='{$key}'><input type=hidden name=SCROLL value=yes></td></tr>";
$key++;
} else {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$i++;
# get warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$stkd['whid']}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkd['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
$Ri = db_exec($Sl) or errDie("Unable to get vat codes");
$Vatcodes = "<select name=vatcodes[]>\n\t\t\t<option value='0'>Select</option>";
while ($vd = pg_fetch_array($Ri)) {
if ($stkd['vatcode'] == $vd['id']) {
$sel = "selected";
} else {
$sel = "";
}
$Vatcodes .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
}
$Vatcodes .= "</select>";
# put in product
$products .= "<input type=hidden name=accounts[] value=0>\n\t\t\t<input type=hidden name=descriptions[] value=''>\n\t\t\t<tr class='bg-odd'><td><input type=hidden name=whids[] value='{$stkd['whid']}'>{$wh['whname']}</td><td><input type=hidden name=stkids[] value='{$stkd['stkid']}'><a href='#' onclick='openwindow(\"stock-amt-det.php?stkid={$stk['stkid']}\")'>{$stk['stkcod']}</a></td><td>{$Vatcodes}</td><td>" . extlib_rstr($stk['stkdes'], 30) . "</td><td><input type=text size=3 name=qtys[] value='{$stkd['qty']}'></td><td><input type=text size=8 name=unitcost[] value='{$stkd['unitcost']}'></td><td><input type=text size=4 name=disc[] value='{$stkd['disc']}'> OR <input type=text size=4 name=discp[] value='{$stkd['discp']}' maxlength=5>%</td><td><input type=hidden name=amt[] value='{$stkd['amt']}'> " . CUR . " {$stkd['amt']}</td><td><input type=checkbox name=remprod[] value='{$key}'><input type=hidden name=SCROLL value=yes></td></tr>";
$key++;
}
}
# Look above(remprod keys)
$keyy = $key;
# look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
}
# check if stock warehouse was selected
if (isset($whidss)) {
foreach ($whidss as $key => $whid) {
if (isset($stkidss[$key]) && $stkidss[$key] != "-S" && isset($cust['pricelist'])) {
# skip if not selected
if ($whid == "-S") {
continue;
}
# get selected warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$whid}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkidss[$key]}' AND div = '" . USER_DIV . "' ORDER BY stkcod ASC";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
# get price from price list if it is set
if (isset($cust['pricelist'])) {
# get selected stock in this warehouse
db_conn("exten");
$sql = "SELECT price FROM plist_prices WHERE listid = '{$cust['pricelist']}' AND stkid = '{$stk['stkid']}' AND div = '" . USER_DIV . "'";
示例12: details
function details($_POST, $error = "")
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($purid, "num", 1, 20, "Invalid Order number.");
# display errors, if any
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$error .= "<li class=err>" . $e["msg"];
}
$confirm .= "{$error}<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# Get Order info
db_connect();
$sql = "SELECT * FROM purch_int WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
$purRslt = db_exec($sql) or errDie("Unable to get Order information");
if (pg_numrows($purRslt) < 1) {
return "<li class=err>Order Not Found</li>";
}
$pur = pg_fetch_array($purRslt);
# check if Order has been printed
if ($pur['received'] == "y") {
$error = "<li class=err> Error : International Order number <b>{$purid}</b> has already been received.";
$error .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $error;
}
# get department
db_conn("exten");
$sql = "SELECT * FROM departments WHERE deptid = '{$pur['deptid']}' AND div = '" . USER_DIV . "'";
$deptRslt = db_exec($sql);
if (pg_numrows($deptRslt) < 1) {
$dept['deptname'] = "<li class=err>Department not Found.";
} else {
$dept = pg_fetch_array($deptRslt);
}
# Get selected supplier info
db_connect();
$sql = "SELECT * FROM suppliers WHERE supid = '{$pur['supid']}' AND div = '" . USER_DIV . "'";
$supRslt = db_exec($sql) or errDie("Unable to view customer");
if (pg_numrows($supRslt) < 1) {
$sup['supname'] = "<li class=err> Supplier not Found.";
$sup['supaddr'] = "<br><br><br>";
} else {
$sup = pg_fetch_array($supRslt);
$supaddr = $sup['supaddr'];
}
/* --- Start Drop Downs --- */
# format date
list($pyear, $pmon, $pday) = explode("-", $pur['pdate']);
list($dyear, $dmon, $dday) = explode("-", $pur['ddate']);
/* --- End Drop Downs --- */
/* --- Start Products Display --- */
# Select all products
$products = "\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=100%>\n\t<tr><th>WAREHOUSE</th><th>ITEM NUMBER</th><th>DESCRIPTION</th><th>QTY</th><th>UNIT PRICE</th><th>DUTY</th><th>AMT</th><tr>";
# Get selected stock in this Order
db_connect();
$sql = "SELECT * FROM purint_items WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
$stkdRslt = db_exec($sql);
$i = 0;
$key = 0;
while ($stkd = pg_fetch_array($stkdRslt)) {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$i++;
# get warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$stkd['whid']}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkd['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
# put in product
$products .= "<tr class='bg-odd'><td>{$wh['whname']}</td><td><a href='#' onclick='openwindow(\"stock-amt-det.php?stkid={$stk['stkid']}\")'>{$stk['stkcod']}</a></td><td>" . extlib_rstr($stk['stkdes'], 30) . "</td><td>{$stkd['qty']}</td><td>{$pur['curr']} {$stkd['cunitcost']} or R {$stkd['unitcost']}</td><td>" . CUR . " {$stkd['duty']} or {$stkd['dutyp']}%</td><td>" . CUR . " {$stkd['amt']}</td></tr>";
}
$products .= "</table>";
/* --- End Products Display --- */
/* -- Final Layout -- */
$details = "<center><h3>International Order Cancel</h3>\n\t<form action='" . SELF . "' method=post name=form>\n\t<input type=hidden name=key value=update>\n\t<input type=hidden name=purid value='{$purid}'>\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=95%>\n\t<tr><td valign=top>\n\t\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0>\n\t\t\t<tr><th colspan=2> Supplier Details </th></tr>\n\t\t\t<tr class='bg-odd'><td>Department</td><td valign=center>{$dept['deptname']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Supplier</td><td valign=center>{$sup['supname']}</td></tr>\n\t\t\t<tr class='bg-odd'><td valign=top>Supplier Address</td><td valign=center>" . nl2br($pur['supaddr']) . "</td></tr>\n\t\t</table>\n\t</td><td valign=top align=right>\n\t\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0>\n\t\t\t<tr><th colspan=2> Order Details </th></tr>\n\t\t\t<tr class='bg-even'><td>Order No.</td><td valign=center>{$pur['purnum']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Terms</td><td valign=center>{$pur['terms']} Days</td></tr>\n\t\t\t<tr class='bg-even'><td>Date</td><td valign=center>{$pday}-{$pmon}-{$pyear}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Foreign Currency</td><td valign=center>{$pur['curr']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Exchange rate</td><td>" . CUR . " {$pur['xrate']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Tax</td><td valign=center>" . CUR . " {$pur['tax']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Shipping Charges</td><td valign=center>{$pur['curr']} {$pur['fshipchrg']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Delivery Date</td><td valign=center>{$dday}-{$dmon}-{$dyear}</td></tr>\n\t\t</table>\n\t</td></tr>\n\t<tr><td><br></td></tr>\n\t<tr><td colspan=2>\n\t{$products}\n\t</td></tr>\n\t<tr><td>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t\t\t<tr><th width=40%>Quick Links</th><th width=45%>Remarks</th><td rowspan=5 valign=top width=15%><br></td></tr>\n\t\t\t<tr class='bg-odd'><td><a href='purch-int-new.php'>New International Order</a></td><td class='bg-odd' rowspan=4 align=center valign=top>" . nl2br($pur['remarks']) . "</td></tr>\n\t\t\t<tr class='bg-odd'><td><a href='purch-int-view.php'>View International Orders</a></td></tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>\n\t</td><td align=right>\n\t\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=80%>\n\t\t\t<tr class='bg-odd'><td>SUBTOTAL</td><td align=right>" . CUR . " {$pur['subtot']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Shipping Charges</td><td align=right>" . CUR . " {$pur['shipchrg']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Tax </td><td align=right>" . CUR . " {$pur['tax']}</td></tr>\n\t\t\t<tr class='bg-even'><th>GRAND TOTAL</th><td align=right>" . CUR . " {$pur['total']}</td></tr>\n\t\t</table>\n\t</td></tr>\n\t<tr><td align=right><input type=button value='« Back' onClick='javascript:history.back()'> | <input type=submit name='upBtn' value='Cancel »'></td></tr>\n\t</table></form>\n\t</center>";
return $details;
}
示例13: details
//.........这里部分代码省略.........
$sers = ext_getavserials($stkd['stkid']);
$sernos = "<select class='width : 15' name='sernos[]'>";
foreach ($sers as $skey => $ser) {
$sernos .= "<option value='{$ser['serno']}'>{$ser['serno']}</option>";
}
$sernos .= "</select>\n\t\t\t\t\t\t\t<input type='hidden' name='sernos_ss[]' value='*_*_*CUBIT_SERIAL_SELECT_BOX*_*_*' />";
} else {
$sernos = "\n\t\t\t\t\t<input type='hidden' name='sernos_ss[{$key}]' value='{$stkd['ss']}' />\n\t\t\t\t\t<input type='hidden' name='sernos[]' value='{$stkd['serno']}'>{$stkd['ss']}";
}
# Input qty if not serialised
$qtyin = "<input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'>";
if ($stk['serd'] == 'yes') {
$qtyin = "<input type='hidden' size='3' name='qtys[]' value='{$stkd['qty']}'>{$stkd['qty']}";
}
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
$Ri = db_exec($Sl) or errDie("Unable to get vat codes");
$Vatcodes = "\n\t\t\t\t\t\t\t<select name='vatcodes[]'>\n\t\t\t\t\t\t\t\t<option value='0'>Select</option>";
while ($vd = pg_fetch_array($Ri)) {
if ($stkd['vatcode'] == $vd['id']) {
$sel = "selected";
} else {
$sel = "";
}
$Vatcodes .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
}
$Vatcodes .= "</select>";
if ($ped) {
$editp = "<input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'>";
} else {
$editp = "<input type='hidden' size='8' name='unitcost[]' value='{$stkd['unitcost']}'>{$stkd['unitcost']}";
}
# put in product
$products .= "\n\t\t\t\t\t\t\t<input type='hidden' name='accounts[]' value='0'>\n\t\t\t\t\t\t\t<input type='hidden' name='descriptions[]' value=''>\n\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t<td><input type='hidden' name='whids[]' value='{$stkd['whid']}'>{$wh['whname']}</td>\n\t\t\t\t\t\t\t\t<td><input type='hidden' name='stkids[]' value='{$stkd['stkid']}'><a href='#bottom' onclick='openwindow(\"stock-amt-det.php?stkid={$stk['stkid']}\")'>{$stk['stkcod']}</a></td>\n\t\t\t\t\t\t\t\t<td>{$Vatcodes}</td>\n\t\t\t\t\t\t\t\t<td>{$sernos}</td>\n\t\t\t\t\t\t\t\t<td>" . extlib_rstr($stk['stkdes'], 30) . "</td>\n\t\t\t\t\t\t\t\t<td>{$qtyin}</td>\n\t\t\t\t\t\t\t\t<td>{$editp}</td>\n\t\t\t\t\t\t\t\t<input type='hidden' size='4' name='disc[]' value='{$stkd['disc']}'>\n\t\t\t\t\t\t\t\t<input type='hidden' size='4' name='discp[]' value='{$stkd['discp']}' maxlength=5>\n\t\t\t\t\t\t\t\t<td><input type='hidden' name='amt[]' value='{$stkd['amt']}'> " . CUR . " {$stkd['amt']}</td>\n\t\t\t\t\t\t\t\t<td><input type='checkbox' name='remprod[]' value='{$key}'><input type='hidden' name='SCROLL' value='yes'></td>\n\t\t\t\t\t\t\t</tr>";
$key++;
}
}
# Look above(remprod keys)
$keyy = $key;
# Look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
} else {
$SCROLL = "yes";
}
# check if stock warehouse was selected
if (isset($whidss)) {
foreach ($whidss as $key => $whid) {
if (isset($stkidss[$key]) && $stkidss[$key] != "-S") {
# skip if not selected
if ($whid == "-S") {
continue;
}
# get selected warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$whid}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkidss[$key]}' AND div = '" . USER_DIV . "' ORDER BY stkcod ASC";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
if ($stk['serd'] == 'yes') {
$sers = ext_getavserials($stkidss[$key]);
$sernos = "<select class='width : 15'name='sernos[]' onChange='javascript:document.form.submit();'>";
示例14: details
//.........这里部分代码省略.........
$customers .= "<option value='-S' selected>Select Customer</option>";
while ($cust = pg_fetch_array($custRslt)) {
$customers .= "<option value='{$cust['cusnum']}'>{$cust['cusname']} {$cust['surname']}</option>";
}
$customers .= "</select>";
}
# take care of the unset vars
$cust['addr1'] = "";
$cust['cusnum'] = "";
$cust['accno'] = "";
} else {
$cust = pg_fetch_array($custRslt);
# moarn if customer account has been blocked
if ($cust['blocked'] == 'yes') {
return "<li class=err>Error : Selected customer account has been blocked.</li>";
}
$customers = "<input type=hidden name=cusnum value='{$cust['cusnum']}'>{$cust['cusname']} {$cust['surname']}";
$cusnum = $cust['cusnum'];
}
/* --- Start Drop Downs --- */
# Select warehouse
db_conn("exten");
$whs = "<select name='whidss[]' onChange='javascript:document.form.submit();'>";
$sql = "SELECT * FROM warehouses WHERE div = '" . USER_DIV . "' ORDER BY whname ASC";
$whRslt = db_exec($sql);
if (pg_numrows($whRslt) < 1) {
return "<li class=err> There are no Stores found in Cubit.</li>";
} else {
$whs .= "<option value='-S' disabled selected>Select Store</option>";
while ($wh = pg_fetch_array($whRslt)) {
$whs .= "<option value='{$wh['whid']}'>({$wh['whno']}) {$wh['whname']}</option>";
}
}
$whs .= "</select>";
# days drop downs
$days = array("0" => "0", "7" => "7", "14" => "14", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
# format date
list($oyear, $omon, $oday) = explode("-", $doc['odate']);
/* --- End Drop Downs --- */
// get the ID of the first warehouse
db_conn("exten");
$sql = "SELECT whid FROM warehouses ORDER BY whid ASC LIMIT 1";
$rslt = db_exec($sql) or errDie("Error reading warehouses (FWH).");
if (pg_num_rows($rslt) > 0) {
$FIRST_WH = pg_fetch_result($rslt, 0, 0);
} else {
$FIRST_WH = "-S";
}
/* --- Start Products Display --- */
# select all products
$products = "\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=100%>\n\t<tr><th>STORE</th><th>ITEM NUMBER</th><th>DESCRIPTION</th><th>QTY</th><th>ITEM PRICE</th><tr>";
# get selected stock in this callout document
db_connect();
$sql = "SELECT * FROM callout_docs_items WHERE calloutid = '{$calloutid}' AND div = '" . USER_DIV . "'";
$stkdRslt = db_exec($sql);
$i = 0;
$key = 0;
while ($stkd = pg_fetch_array($stkdRslt)) {
$stkd['account'] += 0;
$stkd['unitcost'] = sprint($stkd['unitcost']);
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$i++;
# get warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$stkd['whid']}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkd['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
# put in product
$products .= "<input type=hidden name=accounts[] value=0>\n\t\t\t<input type=hidden name=descriptions[] value=''>\n\t\t\t<tr class='bg-odd'><td><input type=hidden name=whids[] value='{$stkd['whid']}'>{$wh['whname']}</td><td><input type=hidden name=stkids[] value='{$stkd['stkid']}'><a href='#' onclick='openwindow(\"stock-amt-det.php?stkid={$stk['stkid']}\")'>{$stk['stkcod']}</a></td><td>" . extlib_rstr($stk['stkdes'], 30) . "</td><td>{$stkd['qty']}</td><td>{$stkd['unitcost']}</td></tr>";
$key++;
}
# Look above(remprod keys)
$keyy = $key;
# look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
}
# check if stock warehouse was selected
/* -- start Listeners -- */
/* -- End Listeners -- */
$products .= "</table>";
/* --- End Products Display --- */
/* --- Start Some calculations --- */
# Calculate subtotal
$SUBTOT = sprint($doc['subtot']);
# Calculate subtotal
$SUBTOT = sprint($doc['subtot']);
/* --- End Some calculations --- */
/*--- Start checks --- */
$details_begin = "\n\t<center><h3>Confirm Call Out Document Has Been Invoiced</h3>\n\t<form action='" . SELF . "' method='post' name='form'>\n\t<input type='hidden' name='key' value='update'>\n\t<input type='hidden' name='calloutid' value='{$calloutid}'>\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border='0' width=95%>\n \t<tr><td valign=top>\n \t<div id='cust_selection'>";
$ajaxOut = "\n\t\t<input type=hidden name=stkerr value='{$stkerr}'>\n\t\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0>\n\t\t\t<tr>\n\t\t\t\t<th colspan=2> Customer Details </th>\n\t\t\t</tr>\n\t\t\t<tr class='bg-odd'>\n\t\t\t\t<td>Department</td>\n\t\t\t\t<td valign=center>{$dept['deptname']}</td>\n\t\t\t</tr>\n\t\t\t<tr class='bg-even'>\n\t\t\t\t<td>Customer</td>\n\t\t\t\t<td valign=center>{$customers}</td>\n\t\t\t</tr>\n\t\t\t<tr class='bg-odd'>\n\t\t\t\t<td valign=top>Customer Address</td>\n\t\t\t\t<td valign=center>" . nl2br($cust['addr1']) . "</td>\n\t\t\t</tr>\n\t\t\t<tr class='bg-even'>\n\t\t\t\t<td>Customer VAT Number</td>\n\t\t\t\t<td>11</td>\n\t\t\t</tr>\n\t\t</table>";
$details_end = "\n\t</div>\n\t</td><td valign=top align=right>\n\t\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0>\n\t\t\t<tr><th colspan=2> Callout Document Details </th></tr>\n\t\t\t<tr class='bg-even'><td>Job Number</td><td valign=center>{$doc['calloutid']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Call Out Person</td><td valign=center>{$doc['calloutp']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Date Service Required</td><td valign=center>{$oday}-{$omon}-{$oyear}</td></tr>\n\t\t\t<tr class='bg-even'><td>Default Travel or Call Out</td><td valign=center>{$doc['def_travel']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Default Labour</td><td valign=center>{$doc['def_labour']}</td></tr>\n\t\t</table>\n\t</td></tr>\n\t<tr><td><br></td></tr>\n\t<tr><td colspan=2>{$products}</td></tr>\n\t<tr>\n\t\t<td colspan='4'>" . nl2br($doc['sign']) . "</td>\n\t</tr>\n\t<tr><td>\n\t\t<p>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t\t\t<tr><th width=25%>Quick Links</th><th width=25%>Description Of Callout</th><th width=25%>Comments</th><td rowspan=5 valign=top width=50%>{$error}</td></tr>\n\t\t\t<tr><td class='bg-odd'><a href='callout-new.php'>New Callout Document</a></td><td class='bg-odd' rowspan=4 align=center valign=top>" . nl2br($doc['calloutdescrip']) . "</td><td class='bg-odd' rowspan=4 align=center valign=top>" . nl2br($doc['comm']) . "</td></tr>\n\t\t\t<tr class='bg-odd'><td><a href='callout-view.php'>View Callout Documents</a></td></tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>\n\t</td><td align=right>\n\t</td></tr>\n\t<tr><td align='right'><input type='submit' value='Next'></td></tr>\n\t</table>\n\t</form>\n\t</center>";
return "{$details_begin}{$ajaxOut}{$details_end}";
}
示例15: 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 purch_int 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'>Order Not Found</i>";
}
$pur = pg_fetch_array($purRslt);
/* --- Start Products Display --- */
# select all products
$products = "\n\t\t<table cellpadding='2' cellspacing='0' border='1' width='100%'>\n\t\t\t<tr>\n\t\t\t\t<th>WAREHOUSE</th>\n\t\t\t\t<th>ITEM NUMBER</th>\n\t\t\t\t<th>DESCRIPTION</th>\n\t\t\t\t<th>QTY</th>\n\t\t\t\t<th>UNIT PRICE</th>\n\t\t\t\t<th>DUTY</th>\n\t\t\t\t<th>AMT</th>\n\t\t\t\t<th>TOTAL COST AMT</th>\n\t\t\t<tr>";
# get selected stock in this Order
db_connect();
$sql = "SELECT * FROM purint_items WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
$stkdRslt = db_exec($sql);
$i = 0;
$key = 0;
while ($stkd = pg_fetch_array($stkdRslt)) {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$i++;
# get warehouse name
db_conn("exten");
$sql = "SELECT whname FROM warehouses WHERE whid = '{$stkd['whid']}' AND div = '" . USER_DIV . "'";
$whRslt = db_exec($sql);
$wh = pg_fetch_array($whRslt);
# get selected stock in this warehouse
db_connect();
$sql = "SELECT * FROM stock WHERE stkid = '{$stkd['stkid']}' AND div = '" . USER_DIV . "'";
$stkRslt = db_exec($sql);
$stk = pg_fetch_array($stkRslt);
/* -- Calculations -- */
# Calculate cost amount bought
$totamt = $stkd['qty'] * $stkd['unitcost'];
// Prevent division by zero
if ($totamt && $pur["subtot"]) {
# Calculate percentage from subtotal
$perc = $totamt / $pur['subtot'] * 100;
} else {
$perc = 0;
}
# Get percentage from shipping charges
$shipchrg = $perc / 100 * $pur['shipchrg'];
# add shipping charges to amt
$totamt = round($totamt + $shipchrg, 2);
/* -- End Calculations --*/
# put in product//<a href='#' onclick='openwindow(\"stock-amt-det.php?stkid=$stk[stkid]\")'></a>
$products .= "\n\t\t\t<tr>\n\t\t\t\t<td>{$wh['whname']}</td>\n\t\t\t\t<td>{$stk['stkcod']}</td>\n\t\t\t\t<td>" . extlib_rstr($stk['stkdes'], 30) . "</td>\n\t\t\t\t<td>" . sprint3($stkd['qty']) . "</td>\n\t\t\t\t<td nowrap>{$pur['curr']} " . sprint($stkd['cunitcost']) . " or R " . sprint($stkd['unitcost']) . "</td>\n\t\t\t\t<td nowrap>{$pur['curr']} {$stkd['duty']} or {$stkd['dutyp']}%</td>\n\t\t\t\t<td nowrap>{$pur['curr']} " . sprint($stkd["amt"]) . "</td>\n\t\t\t\t<td align='right' nowrap>{$pur['curr']} " . sprint($totamt) . "</td>\n\t\t\t</tr>";
}
$products .= "</table>";
# Get supplier
db_connect();
$sql = "SELECT supname,supno FROM suppliers WHERE supid = '{$pur['supid']}' AND div = '" . USER_DIV . "'";
$supRslt = db_exec($sql);
if (pg_numrows($supRslt) < 1) {
$sup['supname'] = "<li class='err'>Supplier not found.</li>";
$sup['supno'] = "";
} else {
$sup = pg_fetch_array($supRslt);
}
# Get department
db_conn("exten");
$sql = "SELECT * FROM departments WHERE deptid = '{$pur['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
list($pyear, $pmon, $pday) = explode("-", $pur['pdate']);
list($dyear, $dmon, $dday) = explode("-", $pur['ddate']);
/* -- Final Layout -- */
$details = "\n\t\t\t\t\t<center>\n\t\t\t\t\t<h3>International Order Details</h3>\n\t\t\t\t\t<table cellpadding='0' cellspacing='4' border='0' 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 cellpadding='2' cellspacing='0' border='1'>\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>\n\t\t\t\t\t\t\t\t\t\t<td>Department</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$dept['deptname']}</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>Supplier</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$sup['supname']}</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>Account number</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$sup['supno']}</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 valign='top'>Supplier Address</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>" . nl2br($pur['supaddr']) . "</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'>\n\t\t\t\t\t\t\t\t" . COMP_NAME . "<br>\n\t\t\t\t\t\t\t\t" . COMP_ADDRESS . "<br>\n\t\t\t\t\t\t\t\t" . COMP_PADDR . "<br>\n\t\t\t\t\t\t\t\t" . COMP_TEL . "<br>\n\t\t\t\t\t\t\t\t" . COMP_FAX . "<br>\n\t\t\t\t\t\t\t\tReg No. " . COMP_REGNO . "<br>\n\t\t\t\t\t\t\t\tVAT No. " . COMP_VATNO . "<br>\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 cellpadding='2' cellspacing='0' border='1'>\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'> 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>\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['purnum']}</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>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>\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>\n\t\t\t\t\t\t\t\t\t\t<td>Foreign Currency</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['curr']}</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>Exchange rate</td>\n\t\t\t\t\t\t\t\t\t\t<td>" . CUR . " {$pur['xrate']}</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>Tax</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['curr']} {$pur['tax']}</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>Shipping Charges</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['curr']} {$pur['fshipchrg']}</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>Delivery Date</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$dday}-{$dmon}-{$dyear}</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='3'>{$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 colspan='2'></td>\n\t\t\t\t\t\t\t<td align='right'>\n\t\t\t\t\t\t\t\t<table cellpadding='2' cellspacing='0' border='1' width='80%'>\n\t\t\t\t\t\t\t\t\t<tr>\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'>{$pur['curr']} {$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>\n\t\t\t\t\t\t\t\t\t\t<td>Shipping Charges</td>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>{$pur['curr']} {$pur['shipchrg']}</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>Tax </td>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>{$pur['curr']} {$pur['tax']}</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<th>GRAND TOTAL</th>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>{$pur['curr']} {$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>";
$OUTPUT = $details;
require "tmpl-print.php";
}