本文整理汇总了PHP中slct函数的典型用法代码示例。如果您正苦于以下问题:PHP slct函数的具体用法?PHP slct怎么用?PHP slct使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slct函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printInv
function printInv($_POST)
{
# get vars
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($from_day, "num", 1, 2, "Invalid from Date day.");
$v->isOk($from_month, "num", 1, 2, "Invalid from Date month.");
$v->isOk($from_year, "num", 1, 4, "Invalid from Date Year.");
$v->isOk($to_day, "num", 1, 2, "Invalid to Date day.");
$v->isOk($to_month, "num", 1, 2, "Invalid to Date month.");
$v->isOk($to_year, "num", 1, 4, "Invalid to Date Year.");
# mix dates
$fromdate = $from_year . "-" . $from_month . "-" . $from_day;
$todate = $to_year . "-" . $to_month . "-" . $to_day;
if (!checkdate($from_month, $from_day, $from_year)) {
$v->isOk($fromdate, "num", 1, 1, "Invalid from date.");
}
if (!checkdate($to_month, $to_day, $to_year)) {
$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"] . "</li>";
}
return $confirm;
}
$accnum = remval($accnum);
if (strlen($accnum) > 0) {
db_conn('cubit');
$Sl = "SELECT * FROM customers WHERE lower(accno)=lower('{$accnum}')";
$Ri = db_exec($Sl);
if (pg_num_rows($Ri) < 1) {
return "<li class='err'>Invalid account number</li>" . slct();
}
$cd = pg_fetch_array($Ri);
$cusnum = $cd['cusnum'];
}
/* make named r2s snapshop */
r2sListSet("invoice_stk_view");
# Set up table to display in
$printInv = "\n\t\t<h3>View invoices. Date Range {$fromdate} to {$todate}</h3>\n\t\t<form action='invoice-proc.php' method='GET'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Department</th>\n\t\t\t\t<th>No.</th>\n\t\t\t\t<th>Invoice Date</th>\n\t\t\t\t<th>Customer Name</th>\n\t\t\t\t<th>Order No</th>\n\t\t\t\t<th>Customer Order No</th>\n\t\t\t\t<th>Grand Total</th>\n\t\t\t\t<th colspan='2'>Balance</th>\n\t\t\t\t<th>Documents</th>\n\t\t\t\t<th colspan='6'>Options</th>\n\t\t\t</tr>";
# connect to database
db_connect();
# Query server
$i = 0;
$tot1 = 0;
$tot2 = 0;
if (isset($all)) {
$sql = "SELECT * FROM invoices WHERE done = 'y' AND odate>='{$fromdate}' AND odate <= '{$todate}' AND div = '" . USER_DIV . "' ORDER BY invid DESC";
} else {
$sql = "SELECT * FROM invoices WHERE done = 'y' AND odate>='{$fromdate}' AND odate <= '{$todate}' AND cusnum = {$cusnum} AND div = '" . USER_DIV . "' ORDER BY invid DESC";
}
$invRslt = db_exec($sql) or errDie("Unable to retrieve invoices from database.");
// Retrieve the reprint setting
db_conn("cubit");
$sql = "SELECT filename FROM template_settings WHERE template='reprints' AND div='" . USER_DIV . "'";
$tsRslt = db_exec($sql) or errDie("Unable to retrieve template settings from Cubit.");
$template = pg_fetch_result($tsRslt, 0);
if (pg_numrows($invRslt) < 1) {
$printInv = "<li class='err'> No Outstanding Invoices found for the selected customer.</li><br>";
} else {
while ($inv = pg_fetch_array($invRslt)) {
$inv['total'] = sprint($inv['total']);
$inv['balance'] = sprint($inv['balance']);
$tot1 = $tot1 + $inv['total'];
$tot2 = $tot2 + $inv['balance'];
# Get documents
$docs = doclib_getdocs("inv", $inv['invnum']);
# Format date
$inv['odate'] = explode("-", $inv['odate']);
$inv['odate'] = $inv['odate'][2] . "-" . $inv['odate'][1] . "-" . $inv['odate'][0];
if ($inv['printed'] == "n") {
$Dis = "TI {$inv['invid']}";
} else {
$Dis = "{$inv['invnum']}";
}
$det = "invoice-details.php";
$print = "invoice-print.php";
$edit = "cust-credit-stockinv.php";
$reprint = "invoice-reprint.php";
if (isset($mode) && $mode == "creditnote") {
$note = "<input type='button' onClick='document.location.href=\"invoice-note.php?invid={$inv['invid']}\";' value='Credit Note'>";
} else {
$note = "<a href='invoice-note.php?invid={$inv['invid']}'>Credit Note</a>";
}
if ($template == "default") {
$template = "invoice-pdf-reprint.php";
} elseif ($template == "new") {
$template = "pdf-tax-invoice.php";
}
$pdfreprint = $template;
$chbox = "<input type=checkbox name='invids[]' value='{$inv['invid']}' checked=yes>";
if ($inv['location'] == 'int') {
$det = "intinvoice-details.php";
$print = "intinvoice-print.php";
//.........这里部分代码省略.........
示例2: details
function details($_POST, $error = "")
{
# Get vars
extract($_POST);
if (!isset($button) && isset($starting)) {
return slct();
}
# validate input
require_lib("validate");
$v = new validate();
if (isset($invid)) {
$v->isOk($invid, "num", 1, 20, "Invalid Non-Stock Invoice number.");
} elseif (isset($ctyp)) {
$val = $ctyp . "val";
if (isset(${$val})) {
$tval = ${$val};
$v->isOk($tval, "num", 1, 20, "Invalid Selection.");
}
}
if (isset($cusnum) && customer_overdue($cusnum)) {
$v->addError(0, "Customer is overdue, account blocked!");
}
# display errors, if any
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$error .= "<li class='err'>" . $e["msg"] . "</li>";
}
return slct($error);
$confirm = "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
if (!isset($invid) && isset($ctyp)) {
$val = $ctyp . "val";
if (!isset(${$val})) {
${$val} = "";
}
$tval = ${$val};
if (isset($bankid)) {
$bankid += 0;
$acc = $bankid;
} else {
$acc = 0;
}
$invid = create_dummy(0, $ctyp, $tval, $acc);
}
# Get invoice info
db_connect();
$sql = "SELECT * FROM nons_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$invRslt = db_exec($sql) or errDie("Unable to get invoice information");
if (pg_numrows($invRslt) < 1) {
return "<li class='err'>Invoice Not Found</li>";
}
$inv = pg_fetch_array($invRslt);
# check if invoice has been printed
if ($inv['done'] == "y") {
$error = "<li class='err'> Error : invoice number <b>{$invid}</b> has already been printed.</li>";
$error .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $error;
}
/* --- Start Drop Downs --- */
# format date
list($ninv_year, $ninv_month, $ninv_day) = explode("-", $inv['odate']);
# keep the charge vat option stable
if ($inv['chrgvat'] == "yes") {
$chy = "checked=yes";
$chn = "";
$chnone = "";
} elseif ($inv['chrgvat'] == "no") {
$chy = "";
$chn = "checked=yes";
$chnone = "";
} else {
$chy = "";
$chn = "";
$chnone = "checked=yes";
}
# Days drop downs
$days = array("0" => "0", "7" => "7", "14" => "14", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
$termssel = extlib_cpsel("terms", $days, $inv['terms']);
/* --- End Drop Downs --- */
/* --- Start Products Display --- */
# Select all products
$products = "\n\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t<tr>\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>AMOUNT</th>\n\t\t\t\t<th>VAT Code</th>\n\t\t\t\t<th>Remove</th>\n\t\t\t<tr>";
# get selected stock in this purchase
db_connect();
$sql = "SELECT * FROM nons_inv_items WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$stkdRslt = db_exec($sql);
$i = 0;
while ($stkd = pg_fetch_array($stkdRslt)) {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$stkd['amt'] = round($stkd['amt'], 2);
$chk = "";
if ($stkd['vatex'] == 'y') {
$chk = "checked=yes";
}
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
$Ri = db_exec($Sl);
//.........这里部分代码省略.........
示例3: switch
if (isset($_POST["key"])) {
switch ($_POST["key"]) {
case "view":
require_lib("docman");
$OUTPUT = printPurch($_POST);
break;
case "export":
$OUTPUT = export($_POST);
break;
default:
$OUTPUT = slct();
break;
}
} else {
# Display default output
$OUTPUT = slct();
}
require "template.php";
# Default view
function slct()
{
db_conn(YR_DB);
$sql = "SELECT * FROM info WHERE prdname !=''";
$prdRslt = db_exec($sql);
if (pg_numrows($prdRslt) < 1) {
return "<li class='err'>ERROR : There are no periods set for the current year.</li>";
}
$Prds = "<select name='prd'>";
while ($prd = pg_fetch_array($prdRslt)) {
if ($prd['prddb'] == PRD_DB) {
$sel = "selected";
示例4: printStk
function printStk($_POST, $errs = "")
{
extract($_POST);
$fields = array();
$fields["search_val"] = "[_BLANK_]";
extract($fields, EXTR_SKIP);
if (!isset($whid) or count($whid) < 1) {
return slct();
}
if (!is_array($whid)) {
$temp = $whid;
$whid = array();
$whid[] = $temp;
}
if (!isset($sortby)) {
$sortby = "normal";
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($catid, "num", 1, 50, "Invalid Category.");
$v->isOk($clasid, "num", 1, 50, "Invalid Classification.");
$v->isOk($sortby, "string", 1, 10, "Invalid Sort Selection.");
foreach ($whid as $temp) {
$v->isOk($temp, "num", 1, 50, "Invalid Warehouse.");
}
$Whe = "";
if ($catid != 0) {
$Whe .= " AND catid = '{$catid}'";
}
if ($clasid != 0) {
$Whe .= " AND prdcls = '{$clasid}'";
}
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class='err'>{$e['msg']}</li><br>";
}
return $confirm;
}
if (!isset($sortby)) {
$sel1 = "";
$sel2 = "";
$sel3 = "";
} elseif ($sortby == "cat") {
$sel1 = "";
$sel2 = "checked='yes'";
$sel3 = "";
} elseif ($sortby == "class") {
$sel1 = "";
$sel2 = "";
$sel3 = "checked='yes'";
} else {
$sel1 = "checked='yes'";
$sel2 = "";
$sel3 = "";
}
$whids = "";
foreach ($whid as $temp) {
$whids .= "<input type='hidden' name='whid[]' value='{$temp}'>";
}
if ($key == "export") {
$pure = true;
} else {
$pure = false;
}
$Whe .= " AND ((lower(stkcod) LIKE lower('%{$search_val}%')) OR (lower(stkdes) LIKE lower('%{$search_val}%')))";
if ($search_val == "[_BLANK_]") {
$search_val = "";
}
# Set up table to display in
if ($pure) {
$OUT = "<table " . TMPL_tblDflts . ">";
} else {
$OUT = "\n\t\t<h3>View Stock</h3>\n\t\t{$errs}\n\t\t<table " . TMPL_tblDflts . " width='30%'>\n\t\t<form action='" . SELF . "' method='POST' name='form1'>\n\t\t\t<input type='hidden' name='key' value='view'>\n\t\t\t<input type='hidden' name='catid' value='{$catid}'>\n\t\t\t<input type='hidden' name='clasid' value='{$clasid}'>\n\t\t\t<input type='hidden' name='search_val' value='{$search_val}'>\n\t\t\t{$whids}\n\t\t\t<tr>\n\t\t\t\t<th>Sort By:</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>\n\t\t\t\t\t<input type='radio' name='sortby' {$sel1} value='normal' onChange='javascript:document.form1.submit();'> Normal\n\t\t\t\t\t<input type='radio' name='sortby' {$sel2} value='cat' onChange='javascript:document.form1.submit();'> Category\n\t\t\t\t\t<input type='radio' name='sortby' {$sel3} value='class' onChange='javascript:document.form1.submit();'> Classification\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<th>Search</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>\n\t\t\t\t\t<input type='text' size='25' name='search_val' value='{$search_val}'> \n\t\t\t\t\t<input type='submit' value='Search'>\n\t\t\t\t</tr>\n\t\t\t" . TBL_BR . "\n\t\t</form>\n\t\t</table>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST' name='form2'>\n\t\t\t<input type='hidden' name='key' value='remove'>";
}
#search parms
if ($sortby == "cat") {
$Ord = "catname,stkcod";
} elseif ($sortby == "class") {
$Ord = "classname,stkcod";
} else {
$Ord = "stkcod";
}
$stores = array();
if ($whid != "0") {
foreach ($whid as $temp) {
if ($temp != 0) {
$stores[] = " whid = '{$temp}'";
}
}
if (count($stores) > 0) {
$stores = implode(" OR ", $stores);
} else {
$stores = "true";
}
} else {
$stores = "true";
//.........这里部分代码省略.........
示例5: details
function details($_POST, $error = "")
{
# get vars
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
if (isset($purid)) {
$v->isOk($purid, "num", 1, 20, "Invalid Non-Stock Order number.");
} else {
$v->isOk($supid, "num", 1, 20, "Invalid Supplier number.");
}
# display errors, if any
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$error .= "<li class='err'>" . $e["msg"] . "</li>";
}
$confirm = $error . slct();
return $confirm;
}
if (!isset($purid)) {
$purid = create_dummy(0, $supid);
}
# Get Order info
db_connect();
$sql = "SELECT * FROM nons_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'>purchase Not Found</li>";
}
$pur = pg_fetch_array($purRslt);
# check if Order has been printed
if ($pur['received'] == "y") {
$error = "<li class='err'> Error : Order number <b>{$purid}</b> has already been received.</li>";
$error .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $error;
}
if ($pur['xrate'] == 0) {
$pur['xrate'] = 1;
}
# 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 Supplier");
if (pg_numrows($supRslt) < 1) {
db_connect();
# Query server for supplier info
$sql = "SELECT * FROM suppliers WHERE location = 'int' AND div = '" . USER_DIV . "' ORDER BY supname ASC";
$supRslt = db_exec($sql) or errDie("Unable to view suppliers");
if (pg_numrows($supRslt) < 1) {
$err = "<li class='err'>No Supplier found in database.</li>";
return view_err($_POST, $err);
} else {
$suppliers = "<select name='supid' onChange='javascript:document.form.submit();'>";
$suppliers .= "<option value='-S' selected>Select Supplier</option>";
while ($sup = pg_fetch_array($supRslt)) {
$suppliers .= "<option value='{$sup['supid']}'>{$sup['supname']}</option>";
}
$suppliers .= "</select>";
}
# take care of the uset vars
$supaddr = "";
$accno = "";
$fcid = $pur['fcid'];
} else {
db_connect();
# Query server for supplier info
$sql = "SELECT * FROM suppliers WHERE location = 'int' AND div = '" . USER_DIV . "' ORDER BY supname ASC";
$supRslt = db_exec($sql) or errDie("Unable to view suppliers");
if (pg_numrows($supRslt) < 1) {
$err = "<li class='err'>No Supplier found in database.</li>";
return view_err($_POST, $err);
} else {
$supid = $pur['supid'];
$suppliers = "<select name='supid' onChange='javascript:document.form.submit();'>";
$sel = "";
$fcid = $pur['fcid'];
while ($sup = pg_fetch_array($supRslt)) {
if ($sup['supid'] == $supid) {
$sel = "selected";
$supaddr = "{$sup['supaddr']}";
$accno = $sup['supno'];
$fcid = $sup['fcid'];
$listid = $sup['listid'];
} else {
$sel = "";
$supaddr = "";
$accno = "";
}
$suppliers .= "<option value='{$sup['supid']}' {$sel}>{$sup['supname']}</option>";
}
$suppliers .= "</select>";
}
}
$currs = getSymbol($fcid);
$curr = $currs['symbol'];
$currsel = "{$currs['symbol']} - {$currs['descrip']}";
if (!isset($ordernum)) {
$ordernum = '';
//.........这里部分代码省略.........
示例6: 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 Non-Stock Order number.");
if (isset($ctyp) && $ctyp == 's') {
$v->isOk($supid, "num", 1, 20, "Invalid supplier account number.");
} elseif (isset($ctyp) && $ctyp == 'c') {
$v->isOk($deptid, "num", 1, 20, "Invalid Department.");
}
# display errors, if any
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$error .= "<li class=err>" . $e["msg"];
}
return slct($_POST, $error);
$confirm = "{$error}<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# Get Order info
db_connect();
$sql = "SELECT * FROM nons_purchases WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
$purRslt = db_exec($sql) or errDie("Unable to get Order information");
if (pg_numrows($purRslt) < 1) {
return "<li class=err>purchase Not Found</li>";
}
$pur = pg_fetch_array($purRslt);
# check if Order has been printed
if ($pur['received'] == "y") {
$error = "<li class=err> Error : Order number <b>{$purid}</b> has already been received.";
$error .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $error;
}
/* --- Start Drop Downs --- */
# days drop downs
$days = array("30" => "30", "60" => "60", "90" => "90", "120" => "120");
$termssel = extlib_cpsel("terms", $days, $pur['terms']);
# format date
list($pyear, $pmon, $pday) = explode("-", $pur['pdate']);
$supacc = "<select name='supacc'>";
core_connect();
$sql = "SELECT * FROM accounts WHERE div = '" . USER_DIV . "' ORDER BY accname ASC";
$accRslt = db_exec($sql);
if (pg_numrows($accRslt) < 1) {
return "<li>There are No accounts in Cubit.";
}
while ($acc = pg_fetch_array($accRslt)) {
# Check Disable
if (isDisabled($acc['accid'])) {
continue;
}
$supacc .= "<option value='{$acc['accid']}'>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</option>";
}
$supacc .= "</select>";
# Get selected supplier info
db_connect();
$hide = "";
if (isset($ctyp) && $ctyp == 's') {
$sql = "SELECT * FROM suppliers WHERE supid = '{$supid}' AND div = '" . USER_DIV . "'";
$supRslt = db_exec($sql) or errDie("Unable to get supplier");
if (pg_numrows($supRslt) < 1) {
$error = "<li class=err> Supplier not Found.";
$confirm .= "{$error}<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
} else {
$sup = pg_fetch_array($supRslt);
$pur['supplier'] = $sup['supname'];
$pur['supaddr'] = $sup['supaddr'];
$supacc = $sup['supno'];
$hide = "<input type=hidden name=supid value='{$supid}'><input type=hidden name=ctyp value='{$ctyp}'>";
}
} elseif (isset($ctyp) && $ctyp == 'c') {
db_conn("exten");
$sql = "SELECT * FROM departments WHERE deptid = '{$deptid}'";
$deptRslt = db_exec($sql) or errDie("Unable to view customers");
if (pg_numrows($deptRslt) < 1) {
$error = "<li class=err> Department not Found.";
$confirm .= "{$error}<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
} else {
$dept = pg_fetch_array($deptRslt);
$supacc = "{$dept['deptname']} - Cash on Hand";
$hide = "<input type=hidden name=deptid value='{$deptid}'><input type=hidden name=ctyp value='{$ctyp}'>";
}
} elseif (isset($ctyp) && $ctyp == 'p') {
core_connect();
# Get Petty cash account
$cashacc = gethook("accnum", "bankacc", "name", "Petty Cash");
# Get account name for thy lame User's Sake
$accRslt = get("core", "*", "accounts", "accid", $cashacc);
if (pg_numrows($accRslt) < 1) {
return "<li class=err> Petty Cash Account not found.";
}
$acc = pg_fetch_array($accRslt);
//.........这里部分代码省略.........
示例7: viewtran
function viewtran($_POST)
{
extract($_POST);
global $MONPRD, $PRDMON;
require_lib("validate");
$v = new validate();
$v->isOk($accnt, "string", 1, 10, "Invalid Accounts Selection.");
if ($accnt == 'slct') {
if (isset($accids)) {
foreach ($accids as $accid) {
$v->isOk($accid, "num", 1, 20, "Invalid Account number.");
}
} else {
return "<li class='err'>Please select at least one account.</li>" . slctacc();
}
}
# display errors, if any
if ($v->isError()) {
$err = $v->genErrors();
return slct($err);
}
if ($accnt == 'all') {
$accids = array();
core_connect();
$sql = "SELECT accid FROM accounts WHERE div = '" . USER_DIV . "'";
$rs = db_exec($sql);
while ($ac = pg_fetch_array($rs)) {
$accids[] = $ac['accid'];
}
} else {
if ($accnt == "allactive") {
$accids = array();
$sql = "SELECT accid FROM core.trial_bal\n\t\t\t\tWHERE (debit!=0 OR credit!=0) AND div='" . USER_DIV . "'\n\t\t\t\t\tAND period>='" . $MONPRD[$fprd] . "' AND period<='" . $MONPRD[$tprd] . "'\n\t\t\t\tGROUP BY accid";
$qry = new dbSql($sql);
$qry->run();
while ($macc_data = $qry->fetch_array()) {
$accids[] = $macc_data["accid"];
}
}
}
if ($key == "spreadsheet") {
$pure = true;
} else {
$pure = false;
}
# Get all Closed Periods
db_conn("audit");
// $sql = "SELECT * FROM closedprd";
// $clsRs = db_exec($sql) or errDie("Could not get closed periods from audit DB",SELF);
$trans = "";
$hide = "";
//while($cls = pg_fetch_array($clsRs)){
foreach ($accids as $key => $accid) {
$accRs = get("core", "accname, accid, topacc, accnum", "accounts", "accid", $accid);
$acc = pg_fetch_array($accRs);
$sql = "SELECT debit,credit FROM core.trial_bal WHERE accid='{$accid}' AND month='{$tprd}'";
$qry = new dbSql($sql);
$qry->run();
$tb = $qry->fetch_array();
$tbbal = $tb["debit"] - $tb["credit"];
$hide .= "<input type='hidden' name='accids[]' value='{$acc['accid']}'>";
$trans .= "\n\t\t\t<tr>\n\t\t\t\t<th> </th>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Reference</th>\n\t\t\t\t<th>Description</th>\n\t\t\t\t<th>Debit</th>\n\t\t\t\t<th>Credit</th>\n\t\t\t\t<th>Balance</th>\n\t\t\t\t<th>Contra Acc</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='8'><b>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</b></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='4' align='right'><b>Balance at end of " . getMonthName($tprd) . "</b></td>\n\t\t\t\t<td align='right'><b>" . money($tb["debit"]) . "</b></td>\n\t\t\t\t<td align='right'><b>" . money($tb["credit"]) . "</b></td>\n\t\t\t\t<td align='right' nowrap='t'><b>" . ($tbbal > 0 ? money($tbbal) . " DT" : money(-$tbbal) . " CT") . "</b></td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>";
$cp = $fprd;
$fs = 0;
if ($fprd == $tprd + 1) {
$f = true;
} else {
$f = false;
}
while ($cp != $tprd + 1 || $f) {
$prd = $cp;
$cp++;
if ($cp == 13) {
$cp = 1;
}
$fs++;
if ($fs > 13) {
break;
}
$f = false;
# Period name
$prdname = prdname($prd);
$trans .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='8' align='center'><h3>{$prdname}</h3></td>\n\t\t\t\t</tr>";
if (isset($t)) {
unset($t);
}
# Get balances
$idRs = get($prd, "max(id), min(id)", "ledger", "acc", $accid);
$id = pg_fetch_array($idRs);
if ($id['min'] != 0) {
$balRs = get($prd, "(cbalance-credit) as cbalance,(dbalance-debit) as dbalance", "ledger", "id", $id['min']);
$bal = pg_fetch_array($balRs);
$cbalRs = get($prd, "cbalance,dbalance", "ledger", "id", $id['max']);
$cbal = pg_fetch_array($cbalRs);
} else {
if (!isset($t)) {
$trans .= "\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td colspan='8' align='center'><li> There are no transactions in this period.</td>\n\t\t\t\t\t\t</tr>";
}
continue;
$balRs = get("core", "credit as cbalance, debit as dbalance", "trial_bal", "accid", $accid);
//.........这里部分代码省略.........
示例8: details
function details($_POST, $error = "")
{
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
if (isset($invid)) {
$v->isOk($invid, "num", 1, 20, "Invalid Non-Stock Invoice number.");
} elseif (isset($cusnum)) {
$v->isOk($cusnum, "num", 1, 20, "Invalid Customer number.");
}
# display errors, if any
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$error .= "<li class='err'>" . $e["msg"] . "</li>";
}
return slct($error);
$confirm = "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
if (!isset($invid)) {
$invid = create_dummy(0, $cusnum);
}
# Get invoice info
db_connect();
$sql = "SELECT * FROM nons_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$invRslt = db_exec($sql) or errDie("Unable to get invoice information");
if (pg_numrows($invRslt) < 1) {
return "<li class='err'>Invoice Not Found</li>";
}
$inv = pg_fetch_array($invRslt);
# check if invoice has been printed
if ($inv['done'] == "y") {
$error = "<li class='err'> Error : invoice number <b>{$invid}</b> has already been printed</li>.";
$error .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $error;
}
$currs = getSymbol($inv['fcid']);
/* --- Start Drop Downs --- */
# format date
list($s_year, $s_month, $s_day) = explode("-", $inv['sdate']);
# keep the charge vat option stable
if ($inv['chrgvat'] == "yes") {
$chy = "checked=yes";
$chn = "";
$chnone = "";
} elseif ($inv['chrgvat'] == "no") {
$chy = "";
$chn = "checked=yes";
$chnone = "";
} else {
$chy = "";
$chn = "";
$chnone = "checked=yes";
}
/* --- End Drop Downs --- */
/* --- Start Products Display --- */
# Select all products
$products = "\n\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t<tr>\n\t\t\t\t<th>DESCRIPTION</th>\n\t\t\t\t<th>QTY</th>\n\t\t\t\t<th colspan='2'>UNIT PRICE</th>\n\t\t\t\t<th>AMOUNT</th>\n\t\t\t\t<th>VAT Code</th>\n\t\t\t\t<th>Remove</th>\n\t\t\t<tr>";
# get selected stock in this purchase
db_connect();
$sql = "SELECT * FROM nons_inv_items WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$stkdRslt = db_exec($sql);
$i = 0;
while ($stkd = pg_fetch_array($stkdRslt)) {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$stkd['amt'] = round($stkd['amt'], 2);
$chk = "";
if ($stkd['vatex'] == 'y') {
$chk = "checked=yes";
}
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
$Ri = db_exec($Sl);
$vats = "<select name='vatcodes[]'>";
while ($vd = pg_fetch_array($Ri)) {
if ($stkd['vatex'] == $vd['id']) {
$sel = "selected";
} else {
$sel = "";
}
$vats .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
}
$vats .= "</option>";
$stkd['amt'] = sprint($stkd['amt']);
# put in product
$products .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center'><input type='text' size='50' name='des[]' value='{$stkd['description']}'></td>\n\t\t\t\t<td align='center'><input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'></td>\n\t\t\t\t<td align='center'> " . CUR . " <input type='text' size='8' name='cunitcost[]' value='{$stkd['cunitcost']}'></td>\n\t\t\t\t<td align='center'> {$inv['currency']} <input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'></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 align='center'>{$vats}</td>\n\t\t\t\t<td align='center'><input type='checkbox' name='remprod[]' value='{$i}'><input type='hidden' name='SCROLL' value='yes'></td>\n\t\t\t</tr>";
$i++;
}
# Look above(remprod keys)
$keyy = $i;
# look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
}
if ($i == 0 || isset($diffwhBtn)) {
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
//.........这里部分代码省略.........
示例9: details
//.........这里部分代码省略.........
if ($sup['supid'] == $pur['supplier']) {
$sel = "selected";
} else {
$sel = "";
}
$sups .= "<option value='{$sup['supid']}' {$sel}>{$sup['supno']} {$sup['supname']}</option>";
}
$sups .= "</select>";
$sdata = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Supplier</td>\n\t\t\t\t<td>{$sups}</td>\n\t\t\t</tr>\n\t\t\t<input type='hidden' name='supaddr' value=''>";
} elseif ($pur['ctyp'] == "cb") {
$sdata = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Supplier</td>\n\t\t\t\t<td valign='center'><input type='text' name='supplier' value='{$pur['supplier']}'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td valign='top'>Supplier Address</td>\n\t\t\t\t<td valign='center'><textarea name='supaddr' cols='18' rows='3'>{$pur['supaddr']}</textarea></td>\n\t\t\t</tr>";
} elseif ($pur['ctyp'] == "c") {
if (strlen($pur['supplier']) < 1) {
$pur['supplier'] = "Cash Order";
}
//Cash Order
$sdata = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Supplier</td>\n\t\t\t\t<td valign='center'><input type='text' name='supplier' value='{$pur['supplier']}'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td valign='top'>Supplier Address</td>\n\t\t\t\t<td valign='center'><textarea name='supaddr' cols='18' rows='3'>{$pur['supaddr']}</textarea></td>\n\t\t\t</tr>";
} elseif ($pur['ctyp'] == "p") {
if (strlen($pur['supplier']) < 1) {
$pur['supplier'] = "Petty Cash Order";
}
//Petty Cash Order
$sdata = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Supplier</td>\n\t\t\t\t<td valign='center'><input type='text' name='supplier' value='{$pur['supplier']}'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td valign='top'>Supplier Address</td>\n\t\t\t\t<td valign='center'><textarea name='supaddr' cols='18' rows='3'>{$pur['supaddr']}</textarea></td>\n\t\t\t</tr>";
} elseif ($pur['ctyp'] == "ac") {
//<input type='text' name='supplier' value='$pur[supplier]'>
if (strlen($pur['supplier']) < 1) {
$pur['supplier'] = "Ledger Account Order";
}
//Ledger Account Order
$sdata = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Supplier</td>\n\t\t\t\t<td valign='center'><input type='text' name='supplier' value='{$pur['supplier']}'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td valign='top'>Supplier Address</td>\n\t\t\t\t<td valign='center'><textarea name='supaddr' cols='18' rows='3'>{$pur['supaddr']}</textarea></td>\n\t\t\t</tr>";
} elseif ($pur['ctyp'] == "c") {
$sdata = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Supplier</td>\n\t\t\t\t<td valign='center'><input type='text' name='supplier' value='{$pur['supplier']}'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td valign='top'>Supplier Address</td>\n\t\t\t\t<td valign='center'><textarea name='supaddr' cols='18' rows='3'>{$pur['supaddr']}</textarea></td>\n\t\t\t</tr>";
} else {
return slct($_POST);
}
$pur['delvat'] += 0;
if ($pur['delvat'] == 0) {
$Sl = "SELECT * FROM vatcodes WHERE del='Yes'";
$Ri = db_exec($Sl) or errDie("Unable to get data.");
$vd = pg_fetch_array($Ri);
$pur['delvat'] = $vd['id'];
}
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<select name='delvat'>\n\t\t\t<option value='0'>Select</option>";
while ($vd = pg_fetch_array($Ri)) {
if ($vd['id'] == $pur['delvat']) {
$sel = "selected";
} else {
$sel = "";
}
$Vatcodes .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
}
$ex = "";
if (strlen($pur['supinv']) and $pur['ctyp'] == "s") {
db_conn('cubit');
$Sl = "SELECT purnum,pdate FROM nons_purchases WHERE supplier='{$pur['supplier']}' AND supinv='{$pur['supinv']}' AND purid != '{$purid}'";
$Ri = db_exec($Sl);
if (pg_num_rows($Ri) > 0) {
$pd = pg_fetch_array($Ri);
$ex .= "<li class='err'>Non Stock Purchase {$pd['purnum']} on {$pd['pdate']} has the same supplier invoice number.</li>";
}
for ($i = 1; $i < 13; $i++) {
db_conn($i);
$Sl = "SELECT purnum,pdate FROM nons_purchases WHERE supplier='{$pur['supplier']}' AND supinv='{$pur['supinv']}'";
示例10: search
function search($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($purnum, "string", 1, 20, "Invalid Purchase number.");
# display errors, if any
$error = "";
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$error .= "<li class=err>" . $e["msg"];
}
return slct($_POST, $error);
}
$purs = explode(",", $purnum);
foreach ($purs as $pur) {
print $pur . "<br>";
}
# Send search squad
db_connect();
$sql = "SELECT * FROM purchases WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
$srchRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
if (pg_numrows($srchRslt) > 0) {
$purid = create_dummy(0, $purnum, 'loc', 'cubit');
$send['purid'] = $purid;
return details($send);
}
$sql = "SELECT * FROM purch_int WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
$srchRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
if (pg_numrows($srchRslt) > 0) {
$purid = create_dummy(0, $purnum, 'int', 'cubit');
$send['purid'] = $purid;
return details($send);
}
$sql = "SELECT * FROM movpurch WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
$srchRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
if (pg_numrows($srchRslt) > 0) {
$res = pg_fetch_array($srchRslt);
$purid = create_dummy(0, $purnum, $res['purtype'], $res['prd']);
$send['purid'] = $purid;
return details($send);
}
return slct($_POST, "<li class=err> - Purchase No. {$purnum} not found.");
}
示例11: update
function update($_POST)
{
extract($_POST);
require_lib("validate");
$v = new validate();
$v->isOk($nincome_code, "string", 0, 5, "Invalid income code specified.");
$v->isOk($nincome_description, "string", 0, 255, "Invalid income description.");
$v->isOk($nincome_rfind, "string", 0, 60, "Invalid RF IND.");
$v->isOk($nincome_amount, "string", 0, 9, "Invalid income amount.");
$v->isOk($directive_number, "num", 0, 9, "Invalid directive number.");
$v->isOk($over_deduction, "float", 0, 20, "Invalid over deduction.");
if (isset($income_code)) {
foreach ($income_code as $id => $value) {
$v->isOk($income_code[$id], "string", 0, 5, "Invalid income code specified.");
$v->isOk($income_description[$id], "string", 0, 255, "Invalid income description.");
$v->isOk($income_rfind[$id], "string", 0, 60, "Invalid RF IND.");
$v->isOk($income_amount[$id], "string", 0, 9, "Invalid income amount.");
}
}
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>{$e['msg']}</li>";
}
return slct($confirm);
}
// New income sources
if ($nincome_code != 0 || !empty($nincome_description) || $nincome_rfind != "N" || !empty($nincome_amount)) {
db_conn("cubit");
$sql = "INSERT INTO emp_income_sources (empnum, code, description, rf_ind, amount) VALUES\n\t\t\t('{$empnum}', '{$nincome_code}', '{$nincome_description}', '{$nincome_rfind}', '{$nincome_amount}')";
$rslt = db_exec($sql) or errDie("Unable to save income sources to Cubit.");
}
// Update old income sources
if (isset($income_code)) {
foreach ($income_code as $id => $value) {
db_conn("cubit");
$sql = "UPDATE emp_income_sources SET code='{$income_code[$id]}', description='{$income_description[$id]}', rf_ind='{$income_rfind[$id]}', amount='{$income_amount[$id]}' WHERE id='{$id}'";
$rslt = db_exec($sql) or errDie("Unable to update income sources to Cubit.");
}
}
// Anything to remove
if (isset($income_rem)) {
foreach ($income_rem as $id => $value) {
db_conn("cubit");
$sql = "DELETE FROM emp_income_sources WHERE id='{$id}'";
$rslt = db_exec($sql) or errDie("Unable to remove selected items from Cubit.");
}
}
// Where to go from here?
if (isset($display)) {
export($_POST);
} else {
return slct();
}
}
示例12: details
function details($_POST, $error = "")
{
# Get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
if (!isset($button) && isset($starting)) {
return slct();
}
# validate input
require_lib("validate");
$v = new validate();
if (isset($invid)) {
$v->isOk($invid, "num", 1, 20, "Invalid Non-Stock Invoice number.");
} elseif (isset($ctyp)) {
$val = $ctyp . "val";
if (isset(${$val})) {
$tval = ${$val};
$v->isOk($tval, "num", 1, 20, "Invalid Selection.");
}
}
# display errors, if any
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$error .= "<li class=err>" . $e["msg"];
}
return slct($error);
$confirm = "{$error}<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
if (!isset($invid) && isset($ctyp)) {
$val = $ctyp . "val";
if (!isset(${$val})) {
${$val} = "";
}
$tval = ${$val};
if (isset($bankid)) {
$bankid += 0;
$acc = $bankid;
} else {
$acc = 0;
}
$invid = create_dummy(0, $ctyp, $tval, $acc);
}
# Get invoice info
db_connect();
$sql = "SELECT * FROM nons_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$invRslt = db_exec($sql) or errDie("Unable to get invoice information");
if (pg_numrows($invRslt) < 1) {
return "<li class=err>Invoice Not Found</li>";
}
$inv = pg_fetch_array($invRslt);
# check if invoice has been printed
if ($inv['done'] == "y") {
$error = "<li class=err> Error : invoice number <b>{$invid}</b> has already been printed.";
$error .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $error;
}
/* --- Start Drop Downs --- */
# format date
list($ninv_year, $ninv_month, $ninv_day) = explode("-", $inv['odate']);
# keep the charge vat option stable
if ($inv['chrgvat'] == "yes") {
$chy = "checked=yes";
$chn = "";
$chnone = "";
} elseif ($inv['chrgvat'] == "no") {
$chy = "";
$chn = "checked=yes";
$chnone = "";
} else {
$chy = "";
$chn = "";
$chnone = "checked=yes";
}
# Days drop downs
$days = array("0" => "0", "7" => "7", "14" => "14", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
$termssel = extlib_cpsel("terms", $days, $inv['terms']);
/* --- End Drop Downs --- */
/* --- Start Products Display --- */
# Select all products
$products = "\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=100%>\r\n\t<tr>\r\n\t\t<th>DESCRIPTION</th>\r\n\t\t<th>QTY</th>\r\n\t\t<th>AMOUNT</th>\r\n\t\t<th>VAT Code</th>\r\n\t\t<th>Remove</th>\r\n\t<tr>";
# get selected stock in this purchase
db_connect();
$sql = "SELECT * FROM nons_inv_items WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$stkdRslt = db_exec($sql);
$i = 0;
while ($stkd = pg_fetch_array($stkdRslt)) {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$stkd['amt'] = round($stkd['amt'], 2);
$chk = "";
if ($stkd['vatex'] == 'y') {
$chk = "checked=yes";
}
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
$Ri = db_exec($Sl);
$vats = "<select name=vatcodes[]>";
//.........这里部分代码省略.........
示例13: details
function details($_POST, $error = "")
{
# Get vars
extract($_POST);
if (!isset($button) && isset($starting)) {
return slct();
}
# validate input
require_lib("validate");
$v = new validate();
if (isset($invid)) {
$v->isOk($invid, "num", 1, 20, "Invalid Non-Stock Invoice number.");
} elseif (isset($ctyp)) {
$val = $ctyp . "val";
if (isset(${$val})) {
$tval = ${$val};
$v->isOk($tval, "num", 1, 20, "Invalid Selection.");
}
}
# display errors, if any
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$error .= "<li class='err'>" . $e["msg"] . "</li>";
}
return slct($error);
$confirm = "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
if (!isset($invid) && isset($ctyp)) {
$val = $ctyp . "val";
if (!isset(${$val})) {
${$val} = "";
}
$tval = ${$val};
if (isset($bankid)) {
$bankid += 0;
$acc = $bankid;
} else {
$acc = 0;
}
// Retrieve default comments
db_conn("cubit");
$sql = "SELECT value FROM settings WHERE constant='DEFAULT_COMMENTS'";
$commRslt = db_exec($sql) or errDie("Unable to retrieve default comments from Cubit.");
$comment = base64_decode(pg_fetch_result($commRslt, 0));
$invid = create_dummy(0, $ctyp, $tval, $acc, $comment);
}
# Get invoice info
db_connect();
$sql = "SELECT * FROM rnons_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$invRslt = db_exec($sql) or errDie("Unable to get invoice information");
if (pg_numrows($invRslt) < 1) {
return "<li class='err'>Invoice Not Found</li>";
}
$inv = pg_fetch_array($invRslt);
/* --- Start Drop Downs --- */
# format date
list($rinv_year, $rinv_month, $rinv_day) = explode("-", $inv['sdate']);
# keep the charge vat option stable
if ($inv['chrgvat'] == "yes") {
$chy = "checked=yes";
$chn = "";
$chnone = "";
} elseif ($inv['chrgvat'] == "no") {
$chy = "";
$chn = "checked=yes";
$chnone = "";
} else {
$chy = "";
$chn = "";
$chnone = "checked=yes";
}
# Days drop downs
$days = array("0" => "0", "7" => "7", "14" => "14", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
$termssel = extlib_cpsel("terms", $days, $inv['terms']);
/* --- End Drop Downs --- */
/* --- Start Products Display --- */
# Select all products
$products = "\n\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t<tr>\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>AMOUNT</th>\n\t\t\t\t<th>Account</th>\n\t\t\t\t<th>VAT Code</th>\n\t\t\t\t<th>Remove</th>\n\t\t\t<tr>";
# get selected stock in this purchase
db_connect();
$sql = "SELECT * FROM rnons_inv_items WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$stkdRslt = db_exec($sql);
$i = 0;
while ($stkd = pg_fetch_array($stkdRslt)) {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$stkd['amt'] = round($stkd['amt'], 2);
$chk = "";
if ($stkd['vatex'] == 'y') {
$chk = "checked=yes";
}
db_conn('cubit');
$Sl = "SELECT * FROM vatcodes ORDER BY code";
$Ri = db_exec($Sl);
$vats = "<select name='vatcodes[]'>";
while ($vd = pg_fetch_array($Ri)) {
if ($stkd['vatex'] == $vd['id']) {
$sel = "selected";
//.........这里部分代码省略.........
示例14: details
function details($_POST, $error = "")
{
# get vars
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($purid, "num", 1, 20, "Invalid Purchase number.");
# display errors, if any
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$error .= "<li class='err'>" . $e["msg"] . "</li>";
}
$confirm .= "{$error}<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# Get purchase info
db_connect();
$sql = "SELECT * FROM nons_purchases WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
$purRslt = db_exec($sql) or errDie("Unable to get purchase information");
if (pg_numrows($purRslt) < 1) {
return slct($_POST, "<li class='err'>No Non Stock Purchase Found</li>");
}
$pur = pg_fetch_array($purRslt);
# check if purchase has been printed
if ($pur['received'] == "y") {
$error = "<li class='err'> Error : purchase number <b>{$purid}</b> has already been received.</li>";
$error .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $error;
}
if (!isset($ordernum)) {
$ordernum = '';
}
/* --- Start Drop Downs --- */
# days drop downs
$days = array("0" => "0", "7" => "7", "30" => "30", "60" => "60", "90" => "90", "120" => "120");
$termssel = extlib_cpsel("terms", $days, $pur['terms']);
# format date
list($lnpur_year, $lnpur_month, $lnpur_day) = explode("-", $pur['pdate']);
# keep the charge vat option stable
if ($pur['vatinc'] == "yes") {
$chy = "checked=yes";
$chn = "";
$chnv = "";
} else {
if ($pur['vatinc'] == 'novat') {
$chy = "";
$chn = "";
$chnv = "checked=yes";
} else {
$chy = "";
$chn = "checked=yes";
$chnv = "";
}
}
/* --- End Drop Downs --- */
/* --- Start Products Display --- */
# Select all products
$products = "\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>ITEM NUMBER</th>\n\t\t\t\t\t\t\t<th>VAT CODE</th>\n\t\t\t\t\t\t\t<th>DESCRIPTION</th>\n\t\t\t\t\t\t\t<th>QTY</th>\n\t\t\t\t\t\t\t<th>UNIT PRICE</th>\n\t\t\t\t\t\t\t<th>DELIVERY DATE</th>\n\t\t\t\t\t\t\t<th>AMOUNT</th>\n\t\t\t\t\t\t\t<th>VAT</th>\n\t\t\t\t\t\t\t<th>Remove</th>\n\t\t\t\t\t\t<tr>";
# get selected stock in this Order
db_connect();
$sql = "SELECT * FROM nons_pur_items WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
$stkdRslt = db_exec($sql);
$i = 0;
$key = 0;
while ($stkd = pg_fetch_array($stkdRslt)) {
# keep track of selected stock amounts
$amts[$i] = $stkd['amt'];
$i++;
list($d_year, $d_month, $d_day) = explode("-", $stkd['ddate']);
$stkd['amt'] = round($stkd['amt'], 2);
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<select name='vatcodes[]'>\n\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>";
$stkd['amt'] = sprint($stkd['amt']);
# put in product
$products .= "\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td align='center'><input type='text' size='10' name='cod[]' value='{$stkd['cod']}'></td>\n\t\t\t\t\t\t\t<td>{$Vatcodes}</td>\n\t\t\t\t\t\t\t<td align='center'><input type='text' size='20' name='des[]' value='{$stkd['des']}'></td>\n\t\t\t\t\t\t\t<td align='center'><input type='text' size='3' name='qtys[]' value='{$stkd['qty']}'></td>\n\t\t\t\t\t\t\t<td align='center'><input type='text' size='8' name='unitcost[]' value='{$stkd['unitcost']}'></td>\n\t\t\t\t\t\t\t<td align='center'>" . mkDateSelecta("d", $key, $d_year, $d_month, $d_day) . "</td>\n\t\t\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\t\t<td><input type='text' name='vat[]' size='9' value='{$stkd['svat']}'></td>\n\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</tr>";
$key++;
}
# Look above(remprod keys)
$keyy = $key;
# look above(if i = 0 then there are no products)
if ($i == 0) {
$done = "";
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<select name='vatcodes[]'>\n\t\t\t\t\t\t\t<option value='0'>Select</option>";
while ($vd = pg_fetch_array($Ri)) {
//.........这里部分代码省略.........
示例15: printStmnt
case "view":
$OUTPUT = printStmnt($_POST);
break;
default:
# decide what to do
if (isset($_GET["cusnum"])) {
$OUTPUT = slct($_GET);
} else {
$OUTPUT = "<li class=err>Invalid use of module.";
}
break;
}
} else {
# decide what to do
if (isset($_GET["cusnum"])) {
$OUTPUT = slct($_GET);
} else {
$OUTPUT = "<li class='err'>Invalid use of module.</li>";
}
}
require "template.php";
# Default view
function slct($_GET)
{
# get vars
extract($_GET);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($cusnum, "num", 1, 20, "Invalid Customer number.");
# display errors, if any