本文整理汇总了PHP中validate类的典型用法代码示例。如果您正苦于以下问题:PHP validate类的具体用法?PHP validate怎么用?PHP validate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了validate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: remAllow
function remAllow($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid allowance ID.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
# connect to db
db_connect();
# delete from db
$sql = "DELETE FROM allowances WHERE id='{$id}' AND div = '" . USER_DIV . "'";
$allowRslt = db_exec($sql) or errDie("Unable to delete allowance from database.");
if (pg_cmdtuples($allowRslt) < 1) {
return "Unable to delete allowance from database.";
}
$sql = "DELETE FROM empallow WHERE allowid='{$id}'";
$rslt = db_exec($sql) or errDie("Error deleting allowances assigned to employees.");
$writeAllow = "\n<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n<tr><th>Allowance deleted</th></tr>\n<tr class=datacell><td>Allowance, {$id}, has been successfully deleted.</td></tr>\n</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
return $writeAllow;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:29,代码来源:allowance-rem.php
示例2: writeFringe
function writeFringe()
{
global $_POST;
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($fringeben, "string", 1, 100, "Invalid fringe benefit name.");
$v->isOk($type, "string", 1, 15, "Invalid type.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
# connect to db
db_connect();
# write to db
$sql = "INSERT INTO fringebens(fringeben, type, div)\n\t\t\tVALUES ('{$fringeben}', '{$type}', '" . USER_DIV . "')";
$rslt = db_exec($sql) or errDie("Unable to add Fringe Benefit to database (DBE).");
if (pg_cmdtuples($rslt) < 1) {
return "Unable to add Fringe Benefit to database (CNT).";
}
$OUTPUT = "<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n\t<tr><th>Fringe Benefit added to system</th></tr>\n\t<tr class=datacell><td>New Fringe Benefit, {$fringeben}, has been successfully added to Cubit.</td></tr>\n\t</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
return $OUTPUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:30,代码来源:fringeben-add.php
示例3: bal
function bal($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid Cash Flow Statement number.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to core DB
core_connect();
# get the Trial Balance
$cf = new dbSelect("save_cashflow", "core", grp(m("cols", "output, date_trunc('day', gentime) as gentime"), m("where", "id='{$id}'")));
$cf->run();
if ($cf->num_rows() < 1) {
return "<center><li> Invalid Cash Flow Statement Number.</li></center>";
}
$stmnt = $cf->fetch_array();
$OUTPUT = base64_decode($stmnt['output']);
if (isset($_GET["xls"])) {
$cftime = preg_replace("/ 00:00.*/", "", $stmnt["gentime"]);
require_lib("xls");
Stream("cashflow-{$cftime}", $OUTPUT);
} else {
require "../tmpl-print.php";
}
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:34,代码来源:cash-flow-print.php
示例4: writeType
function writeType($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($type, "string", 1, 20, "Invalid report type.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
# connect to db
db_connect();
# write to db
$sql = "INSERT INTO report_types (type, div) VALUES ('{$type}', '" . USER_DIV . "')";
$typeRslt = db_exec($sql) or errDie("Unable to add report type to database.");
if (pg_cmdtuples($typeRslt) < 1) {
return "Unable to add report type to database.";
}
$writeType = "\n<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n<tr><th>Report type added to system</th></tr>\n<tr class=datacell><td>New report type has been successfully added to Cubit.</td></tr>\n</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
return $writeType;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:31,代码来源:report-type-add.php
示例5: inc
function inc($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid Income Statement number.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to core DB
core_connect();
# get the income statement
$sql = "SELECT * FROM save_income_stmnt WHERE id = '{$id}' AND div = '" . USER_DIV . "'";
$incRslt = db_exec($sql) or errDie("Unable to retrieve income statement from the Database", SELF);
if (pg_numrows($incRslt) < 1) {
return "<center><li> Invalid Income Statement Number.";
}
$inc = pg_fetch_array($incRslt);
$income = base64_decode($inc['output']);
$OUTPUT = $income;
require "../tmpl-print.php";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:29,代码来源:income-stmnt-print.php
示例6: write
function write($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($cusnum, "num", 1, 10, "Invalid Customer Number.");
$v->isOk($editid, "num", 1, 10, "Invalid Customer ID.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
db_conn("cubit");
$insert_sql = "DELETE FROM customer_branches WHERE cusnum = '{$cusnum}' AND div = '" . USER_DIV . "' AND id = '{$editid}'";
$run_insert = db_exec($insert_sql);
return "<script>\n\t\t\twindow.close ();\n\t\t</script>";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:26,代码来源:cust-branch-del.php
示例7: view
function view()
{
extract($_GET);
require_lib("validate");
$v = new validate();
$v->isOk($empnum, "num", 1, 20, "Invalid employee number.");
$v->isOk($id, "num", 1, 20, "Invalid payslip number.");
if ($v->isError()) {
$confirmCust = $v->genErrors() . "<br><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
if (($emp = qryEmployee($empnum, "*")) === false) {
$emp = qryLEmployee($empnum, "*");
}
if (isset($rev)) {
$tbl = "salr";
} else {
$tbl = "salpaid";
}
$sql = "SELECT * FROM cubit.{$tbl} WHERE empnum='{$empnum}' AND id = '{$id}' AND div = '" . USER_DIV . "'";
$rslt = db_exec($sql) or errDie("Unable to read employee salary details from Cubit.");
if (pg_numrows($rslt) < 1) {
return "<li>Employee payment not found.</li>";
}
$pay = pg_fetch_array($rslt);
# Calculate gross salary from nettpay
$gross = $pay['salary'] - $pay['totallow'] - $pay['comm'] + $pay['totded'] + $pay['uif'] + $pay['paye'] + $pay['loanins'];
vsprint($gross);
# Layout
$slip = "\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<td align='right'><font size='3' color='white'><b>Employee: </b></font></td>\n\t\t<td align='left'><b>{$emp['empnum']}</b></td>\n\t\t<td align='right'><font size='3' color='white'><b>Name: </b></font></td>\n\t\t<td align='left'><b>{$emp['fnames']}</b></td>\n\t\t<td align='right'><font size='3' color='white'><b>Surname: </b></font></td>\n\t\t<td align='left'><b>{$emp['sname']}</b></td>\n\t</tr>\n\t" . TBL_BR . "\n\t</table>\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th>Description</th>\n\t\t<th>Amount</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Gross Basic salary</td>\n\t\t<td align='center'>" . CUR . " {$gross}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Commission</td>\n\t\t<td align='center'>" . CUR . " {$pay['comm']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Low or interest-free loan</td>\n\t\t<td align='center'>" . CUR . " {$pay['loanins']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Interest rate charged by company</td>\n\t\t<td align='center'>{$emp['loanint']} %</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Deductions</td>\n\t\t<td align='center'>" . CUR . " {$pay['totded']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>UIF</td>\n\t\t<td align='center'>" . CUR . " {$pay['uif']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>PAYE</td>\n\t\t<td align='center'>" . CUR . " {$pay['paye']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Allowances</td>\n\t\t<td align='center'>" . CUR . " {$pay['totallow']}</td>\n\t</tr>\n\t" . TBL_BR . "\n\t<tr class='" . bg_class() . "'>\n\t\t<td><h3>Nett Income</h3></td>\n\t\t<td align='center'><b>" . CUR . " {$pay['salary']}</b></td>\n\t</tr>\n\t</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"));
return $slip;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:32,代码来源:payslip-view.php
示例8: details
function details($_GET)
{
# get vars
foreach ($_GET as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($invid, "num", 1, 20, "Invalid purchase number.");
# display errors, if any
if ($v->isError()) {
$err = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$err .= "<li class=err>" . $e["msg"];
}
$confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# Get purchase info
db_connect();
$sql = "SELECT * FROM nons_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$invRslt = db_exec($sql) or errDie("Unable to get invoices information");
if (pg_numrows($invRslt) < 1) {
return "<i class=err>Not Found</i>";
}
$inv = pg_fetch_array($invRslt);
$currs = getSymbol($inv['fcid']);
/* --- Start Products Display --- */
# Products layout
$products = "\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=100%>\n\t<tr>\n\t\t<th width='5%'>#</th>\n\t\t<th width='65%'>DESCRIPTION</th>\n\t\t<th width='10%'>QTY</th>\n\t\t<th width='10%' colspan=2>UNIT PRICE</th>\n\t\t<th width='10%'>AMOUNT</th>\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)) {
$i++;
# put in product
$products .= "<tr class='bg-odd'>\n\t\t\t<td align=center>{$i}</td>\n\t\t\t<td>{$stkd['description']}</td>\n\t\t\t<td>{$stkd['qty']}</td>\n\t\t\t<td>" . CUR . " {$stkd['cunitcost']}</td>\n\t\t\t<td>{$inv['currency']} {$stkd['unitcost']}</td>\n\t\t\t<td>{$inv['currency']} {$stkd['amt']}</td>\n\t\t</tr>";
}
$products .= "</table>";
/* --- Start Some calculations --- */
# Get subtotal
$SUBTOT = sprint($inv['subtot']);
# Get Total
$TOTAL = sprint($inv['total']);
# Get vat
$VAT = sprint($inv['vat']);
/* --- End Some calculations --- */
# format date
list($syear, $smon, $sday) = explode("-", $inv['sdate']);
if ($inv['invnum'] == 0) {
$inv['invnum'] = $inv['invid'];
}
/* -- Final Layout -- */
$details = "<center><h3>Non-Stock Invoice Details</h3>\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> Customer Details </th></tr>\n\t\t\t<tr class='bg-odd'><td>Customer</td><td valign=center>{$inv['cusname']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Customer Address</td><td valign=center><pre>{$inv['cusaddr']}</pre></td></tr>\n\t\t\t<tr class='bg-odd'><td>Customer Vat Number</td><td valign=center>{$inv['cusvatno']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Customer Order number</td><td valign=center>{$inv['cordno']}</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> Non-Stock Invoice Details </th></tr>\n\t\t\t<tr class='bg-odd'><td>Non-Stock Invoice No.</td><td valign=center>{$inv['invnum']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Proforma Inv No.</td><td valign=center>{$inv['docref']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Date</td><td valign=center>{$sday}-{$smon}-{$syear}</td></tr>\n\t\t\t<tr class='bg-even'><td>Foreign Currency</td><td valign=center>{$currs['symbol']} - {$currs['name']} Exchange rate " . CUR . " {$inv['xrate']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>VAT Inclusive</td><td valign=center>{$inv['chrgvat']}</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><td class='bg-odd'><a href='nons-invoice-new.php'>New Non-Stock Invoices</a></td><td class='bg-odd' rowspan=4 align=center valign=top>" . nl2br($inv['remarks']) . "</td></tr>\n\t\t\t<tr class='bg-odd'><td><a href='nons-invoice-view.php'>View Non-Stock Invoices</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>{$inv['currency']} {$inv['subtot']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>VAT @ " . TAX_VAT . " %</td><td align=right>{$inv['currency']} {$inv['vat']}</td></tr>\n\t\t\t<tr class='bg-even'><th>GRAND TOTAL</th><td align=right>{$inv['currency']} {$inv['total']}</td></tr>\n\t\t</table>\n\t</td></tr>\n\t</table></form>\n\t</center>";
return $details;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:60,代码来源:nons-intinvoice-det.php
示例9: write
function write($_POST)
{
# get vars
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($min, "num", 1, 9, "Invalid minimum amount.");
$v->isOk($max, "num", 1, 9, "Invalid maximum amount.");
$v->isOk($percentage, "float", 1, 6, "Invalid interest percentage.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class='err'>" . $e["msg"];
}
$confirmCust .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
# connect to db
db_connect();
# add PAYE to db
$sql = "INSERT INTO intbracs (min, max, percentage) VALUES ('{$min}', '{$max}', '{$percentage}')";
$pRslt = db_exec($sql) or errDie("Unable to add Interest bracket to database.", SELF);
$write = "\r\n\t\t\t\t<table " . TMPL_tblDflts . " width='50%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Interest bracket added to database</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='datacell'>\r\n\t\t\t\t\t\t<td>New Interest bracket has been successfully added to Cubit.</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t\t<p>\r\n\t\t\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Quick Links</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr bgcolor='#88BBFF'>\r\n\t\t\t\t\t\t<td><a href='intbrac-view.php'>View Interest Brackets</a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr bgcolor='#88BBFF'>\r\n\t\t\t\t\t\t<td><a href='main.php'>Main Menu</a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</tr>";
return $write;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:28,代码来源:intbrac-add.php
示例10: write
function write($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($classname, "string", 1, 255, "Invalid Classification name.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
# connect to db
db_conn("exten");
# write to db
$sql = "INSERT INTO class(classname, div) VALUES ('{$classname}', '" . USER_DIV . "')";
$catRslt = db_exec($sql) or errDie("Unable to add fringe benefit to system.", SELF);
if (pg_cmdtuples($catRslt) < 1) {
return "<li class=err>Unable to add classname to database.";
}
$write = "<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t<tr><th>Classification added to system</th></tr>\r\n\t<tr class=datacell><td>New Classification <b>{$classname}</b>, has been successfully added to the system.</td></tr>\r\n\t</table>\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='class-view.php'>View Classifications</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>";
return $write;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:31,代码来源:class-add.php
示例11: printInv
function printInv($_POST)
{
# get vars
extract($_POST);
$invnum = trim($invnum);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($invnum, "num", 1, 20, "Invalid invoice number.");
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class='err'>-" . $e["msg"] . "</li>";
}
return $confirm . slct();
}
#get us a matching invoice plz
$invdata = find_invoice($invnum);
if (strlen($invdata) < 1) {
#nothing found ...
$invdata = "<li class='err'>No Matching Invoices Found.</li>";
}
$display = "\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t{$invdata}\n\t\t</table>\n\t\t<p>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<tr class='datacell'>\n\t\t\t\t<td><a href='" . SELF . "'>Find Invoice</a></td>\n\t\t\t</tr>\n\t\t\t<tr class='datacell'>\n\t\t\t\t<td><a href='cust-credit-stockinv.php'>New Invoice</td>\n\t\t\t</tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
return $display;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:27,代码来源:invoice-search.php
示例12: remDeduct
function remDeduct($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "string", 1, 20, "Invalid reference number.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
# connect to db
db_connect();
# delete from db
$sql = "DELETE FROM salded WHERE id='{$id}' AND div = '" . USER_DIV . "'";
$salRslt = db_exec($sql) or errDie("Unable to delete salary deduction from database.");
# delete from db
$sql = "DELETE FROM empdeduct WHERE dedid='{$id}' AND div = '" . USER_DIV . "'";
$salRslt = db_exec($sql) or errDie("Unable to delete salary deduction from employee lists.");
$writeDeduct = "\n<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n<tr><th>Salary deduction deleted</th></tr>\n<tr class=datacell><td>Salary deduction has been successfully deleted.</td></tr>\n</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
return $writeDeduct;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:27,代码来源:salded-rem.php
示例13: Emplea
function Emplea($_GET)
{
# Get vars
extract($_GET);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($empnum, "num", 1, 20, "Invalid employee number.");
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "-" . $e["msg"] . "<br>";
}
$confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# Connect to db
db_connect();
# Get employee info to edit
$sql = "SELECT * FROM employees WHERE empnum='{$empnum}'";
$empRslt = db_exec($sql) or errDie("Unable to select employee info from database.");
if (pg_numrows($empRslt) < 1) {
return "Invalid employee number.";
}
$emp = pg_fetch_array($empRslt);
# Get the arrays
$lvac = getLeave($empnum, "leave_vac");
$lsick = getLeave($empnum, "leave_sick");
$lstudy = getLeave($empnum, "leave_study");
$lea = "\n\t\t<h3>Employee Leave Available</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Employee</td>\n\t\t\t\t<td align='center'>{$emp['sname']}, {$emp['fnames']} ({$emp['enum']})</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Paid Vacation Leave</td>\n\t\t\t\t<td align='center'>{$lvac['1']} days</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Paid Sick Leave</td>\n\t\t\t\t<td align='center'>{$lsick['1']} days</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Paid Study Leave</td>\n\t\t\t\t<td align='center'>{$lstudy['1']} days</td>\n\t\t\t</tr>\n\t\t<table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
return $lea;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:34,代码来源:employee-leave-avail.php
示例14: registerUser
/**
* =========================================================
* Registers the users and puts them into the db
* =========================================================
**/
public static function registerUser($username, $password, $email)
{
$engine = EngineAPI::singleton();
$localvars = localvars::getInstance();
$db = db::get($localvars->get('dbConnectionName'));
$sql = "INSERT INTO `users`(username,password,emailAddress,ipAddr) VALUES(?,?,?,?)";
$validate = new validate();
$ip = $_SERVER['REMOTE_ADDR'];
$db->beginTransaction();
try {
// prep for database
$email = dbSanitize($email);
$password = dbSanitize($password);
$username = dbSanitize($username);
$password = self::protectPassword($password);
if (!$validate->emailAddr($email)) {
throw new Exception('Email is invalid');
}
if (self::checkEmail($email)) {
throw new Exception('Email is already being used please login instead');
}
if (!self::checkUsername($username)) {
$sqlResult = $db->query($sql, array($username, $password, $email, $ip));
if ($sqlResult->error()) {
throw new Exception("Error Getting Entries");
}
$db->commit();
return true;
}
} catch (Exception $e) {
$db->rollback();
errorHandle::errorMsg($e->getMessage());
return false;
}
}
开发者ID:ddavisgraphics,项目名称:LearningApp,代码行数:40,代码来源:login.php
示例15: write
function write($_POST)
{
# Get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# Validate input
require_lib("validate");
$v = new validate();
$v->isOk($typeid, "string", 1, 20, "Invalid document type number.");
# Display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
$doctRs = get("yr2", "*", "doctypes", "typeid", $typeid);
$doct = pg_feTch_array($doctRs);
# Write to db
db_conn("yr2");
$sql = "DELETE FROM doctypes WHERE typeid = '{$typeid}'";
$dRslt = db_exec($sql) or errDie("Unable to remove {$doct['typename']} to system.", SELF);
$write = "<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t<tr><th>Document type removed</th></tr>\r\n\t<tr class=datacell><td>Document type <b>{$doct['typename']}</b>, has been successfully removed from the system.</td></tr>\r\n\t</table>\r\n\t<p>\r\n\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='doctype-view.php'>View Document types</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>";
return $write;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:29,代码来源:doctype-rem.php
示例16: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($invid, "num", 1, 20, "Invalid invoice selection.");
if ($v->isError()) {
return edit($v->genErrors());
}
pglib_transaction("BEGIN");
$subtotal = 0;
if (isset($unitprices) && is_array($unitprices)) {
foreach ($unitprices as $id => $unitprice) {
$sql = "SELECT qty FROM cubit.inv_items WHERE id='{$id}'";
$qty_rslt = db_exec($sql) or errDie("Unable to retrieve qty.");
$qty = pg_fetch_result($qty_rslt, 0);
$sql = "\n\t\t\tUPDATE cubit.inv_items SET unitcost='{$unitprice}'\n\t\t\tWHERE id='{$id}'";
db_exec($sql) or errDie("Unable to update unit cost.");
$subtotal += $unitprice * $qty;
}
}
$vat = $subtotal / 100 * 14;
$total = $subtotal + $vat;
$sql = "\n\tUPDATE cubit.invoices SET total='{$total}', subtot='{$subtotal}', vat='{$vat}'\n\tWHERE invid='{$invid}'";
db_exec($sql) or errDie("Unable to update invoice totals.");
pglib_transaction("COMMIT");
return edit();
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:28,代码来源:invoice-no-neg-edit-price.php
示例17: bal
function bal($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid Trial Balance number.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to core DB
core_connect();
# get the Trial Balance
$sql = "SELECT * FROM save_trial_bal WHERE id = '{$id}' AND div = '" . USER_DIV . "'";
$balRslt = db_exec($sql) or errDie("Unable to retrieve Trial Balance from the Database", SELF);
if (pg_numrows($balRslt) < 1) {
return "<center><li> Invalid Trial Balance Number.";
}
$bal = pg_fetch_array($balRslt);
$balance = base64_decode($bal['output']);
$OUTPUT = $balance;
include "temp.xls.php";
Stream("TB", $OUTPUT);
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:30,代码来源:tb-xls.php
示例18: con_data
function con_data($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 0, 100, "Invalid number.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
db_conn('cubit');
$Sql = "DELETE FROM cf WHERE id='{$id}' AND div = '" . USER_DIV . "'";
$Rslt = db_exec($Sql) or errDie("Unable to access database.");
$write = "<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n\t<tr><th>Cash flow budget entry Removed</th></tr>\n\t<tr class=datacell><td>Entry has been deleted from the system.</td></tr>\n\t</table>\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='cfe-add.php'>New cash flow budget entry</a></td></tr>\n\t<tr class='bg-odd'><td><a href='cfe-view.php'>View cash flow budget entries</a></td></tr>\n\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
return $write;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:26,代码来源:cfe-rem.php
示例19: login
function login($_POST)
{
global $_SESSION;
extract($_POST);
require_lib("validate");
$v = new validate();
$v->isOk($code, "string", 1, 5, "Invalid company name.");
# Display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class='err'>" . $e["msg"] . "</li>";
}
return slctcomp($confirm);
}
# Change code to lowercase
$code = strtolower($code);
if (!db_check("cubit_" . $code)) {
return slctcomp("<li class='err'>Invalid Company. Select another company or<br />\n\t\t\tclick <a href='company-new.php?key=recover'>here</a> to see if Cubit can recover from this error.</li>");
}
# Get Company Name
db_conn("cubit");
$sql = "SELECT name FROM companies
|
请发表评论