当前位置: 首页>>代码示例>>PHP>>正文


PHP validate::isError方法代码示例

本文整理汇总了PHP中validate::isError方法的典型用法代码示例。如果您正苦于以下问题:PHP validate::isError方法的具体用法?PHP validate::isError怎么用?PHP validate::isError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在validate的用法示例。


在下文中一共展示了validate::isError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: printStk

function printStk($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $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;
    }
    # connect to database
    db_connect();
    // Layout
    $report = "\n\t<h3>Non-Stock Sales Report</h3>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n    <tr><th>Invoice no.</th><th>Date</th><th>Vat</th><th>SubTotal</th><th>Total</th></tr>";
    # Get all relevant records
    db_connect();
    $sql = "SELECT * FROM salesrec WHERE edate >= '{$fromdate}' AND edate <= '{$todate}' AND typ = 'non' AND div = '" . USER_DIV . "'";
    $recRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
    $i = 0;
    $tot = 0;
    $totvat = 0;
    $totexc = 0;
    while ($rec = pg_fetch_array($recRslt)) {
        # Calculate profit
        $tot += $rec['total'];
        $totvat += $rec['vat'];
        $excvat = sprint($rec['total'] - $rec['vat']);
        $totexc += $excvat;
        $report .= "<tr class='" . bg_class() . "'><td>{$rec['invnum']}</td><td>{$rec['edate']}</td><td>" . CUR . " {$rec['vat']}</td><td>" . CUR . " {$excvat}</td><td>" . CUR . " {$rec['total']}</td></tr>";
        $i++;
    }
    $tot = sprint($tot);
    $totvat = sprint($totvat);
    $totexc = sprint($totexc);
    $report .= "<tr class='bg-even'><td colspan=2><b>Totals</b></td><td>" . CUR . " {$totvat}</td><td>" . CUR . " {$totexc}</td><td>" . CUR . " {$tot}</td></tr>\n\t</table>\n    <p>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\n        <tr><td><br></td></tr>\n        <tr><th>Quick Links</th></tr>\n\t\t<tr class='bg-odd'><td><a href='sales-reports.php'>Sales Reports</a></td></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
    return $report;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:60,代码来源:nons-sales.php

示例2: 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

示例3: 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='&laquo; 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

示例4: details

function details($_GET)
{
    # get vars
    foreach ($_GET 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()) {
        $err = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $err .= "<li class=err>" . $e["msg"];
        }
        $confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    # 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 "<i class=err>Not Found</i>";
    }
    $pur = pg_fetch_array($purRslt);
    # Currency
    $currs = getSymbol($pur['fcid']);
    $curr = $currs['symbol'];
    $currsel = "{$currs['symbol']} - {$currs['descrip']}";
    /* --- Start Products Display --- */
    # Products layout
    $products = "\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' border=0 width=100%>\n\t<tr><th>ITEM NUMBER</th><th>DESCRIPTION</th><th>QTY</th><th colspan=2>UNIT PRICE</th><th colspan=2>DUTY</th><th>LINE TOTAL</th><tr>";
    # get selected stock in this Order
    db_connect();
    $sql = "SELECT * FROM nons_purint_items  WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
    $stkdRslt = db_exec($sql);
    while ($stkd = pg_fetch_array($stkdRslt)) {
        # put in product
        $products .= "<tr class='bg-odd'><td>{$stkd['cod']}</td><td>{$stkd['des']}</td><td>{$stkd['qty']}</td><td>{$pur['curr']} {$stkd['cunitcost']} or </td><td>" . CUR . " {$stkd['unitcost']}</td><td>{$pur['curr']} {$stkd['duty']} or </td><td>{$stkd['dutyp']}%</td><td>{$pur['curr']} {$stkd['amt']}</td></tr>";
    }
    $products .= "</table>";
    /* --- End Products Display --- */
    /* --- Start Some calculations --- */
    # Get subtotal
    $SUBTOT = sprint($pur['subtot']);
    # Get Total
    $TOTAL = sprint($pur['total']);
    # Get tax
    $tax = sprint($pur['tax']);
    /* --- End Some calculations --- */
    # format date
    list($pyear, $pmon, $pday) = explode("-", $pur['pdate']);
    list($dyear, $dmon, $dday) = explode("-", $pur['ddate']);
    /* -- Final Layout -- */
    $details = "<center><h3>International Non-Stock Order 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> Supplier Details </th></tr>\n\t\t\t<tr class='bg-odd'><td>Supplier</td><td valign=center>{$pur['supplier']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Supplier Address</td><td valign=center><pre>{$pur['supaddr']}</pre></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 Order Details </th></tr>\n\t\t\t<tr class='bg-odd'><td>Non-Stock Order No.</td><td valign=center>{$pur['purnum']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Order No.</td><td valign=center>{$pur['ordernum']}</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>{$currsel} &nbsp;&nbsp;Exchange rate {$pur['curr']} {$pur['xrate']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Tax</td><td valign=center>{$pur['curr']} {$pur['tax']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Shipping Charges</td><td valign=center>{$pur['curr']} {$pur['shipchrg']}</td></tr>\n\t\t\t<tr class='bg-even'><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><td class='bg-odd'><a href='nons-purch-int-new.php'>New International Non-Stock 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='nons-purch-int-view.php'>View International Non-Stock 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>{$pur['curr']} {$pur['subtot']}</td></tr>\n\t\t\t<tr class='bg-even'><td>Delivery Charges</td><td align=right>{$pur['curr']} {$pur['shipping']}</td></tr>\n\t\t\t<tr class='bg-odd'><td>Tax </td><td align=right>{$pur['curr']} {$pur['tax']}</td></tr>\n\t\t\t<tr class='bg-even'><th>GRAND TOTAL</th><td align=right>{$pur['curr']} {$pur['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-purch-int-det.php

示例5: write_details

function write_details($_POST)
{
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($branch_ip, "url", 1, 50, "Invalid Branch IP.");
    $v->isOk($branch_company, "url", 4, 4, "Invalid Branch Company Code.");
    $v->isOk($branch_username, "string", 1, 50, "Invalid Branch Username.");
    //	$v->isOk ($branch_password, "url", 1, 50, "Invalid Branch Password.");
    //	$v->isOk ($branch_passwordconfirm, "url", 1, 50, "Invalid Branch Password.");
    //	$v->isOk ($branch_ip, "url", 1, 50, "Invalid Branch IP.");
    if ($branch_password != $branch_passwordconfirm) {
        $v->addError($branch_password, "Passwords do not match.");
    }
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        return get_details($_POST, $confirmCust);
    }
    db_connect();
    $add_sql = "\n\t\tINSERT INTO branches_data (\n\t\t\tbranch_name, branch_desc, branch_contact, branch_ip, \n\t\t\tdate_added, last_online, branch_username, branch_password, \n\t\t\tlast_login_from, branch_localuser, branch_company\n\t\t) VALUES (\n\t\t\t'{$branch_name}', '{$branch_desc}', '{$branch_contact}', '{$branch_ip}', \n\t\t\t'now', '1990-01-01', '{$branch_username}', md5('{$branch_password}'), \n\t\t\t'1990-01-01', '{$branch_localuser}', '{$branch_company}'\n\t\t)";
    $run_add = pg_exec($add_sql) or errDie("Unable to add branch information.");
    $display = "\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Branch Added</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Branch Has Been Added.</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t";
    return $display;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:30,代码来源:branches-add.php

示例6: 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 WHERE code = '{$code}'";
    $compRslt = db_exec($sql) or errDie("Unable to access database.", SELF);
    if (pg_numrows($compRslt) < 1) {
        $comp['name'] = "";
    } else {
        $comp = pg_fetch_array($compRslt);
    }
    $_SESSION["code"] = $code;
    $_SESSION["comp"] = $comp['name'];
    header("Location: doc-index.php");
}
开发者ID:kumarsivarajan,项目名称:accounting-123,代码行数:34,代码来源:complogin.php

示例7: confirm

function confirm($catid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($catid, "num", 1, 50, "Invalid stock category id.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>-" . $e["msg"] . "<br>";
        }
        return $confirm;
    }
    # Select Stock
    db_connect();
    $sql = "SELECT * FROM stockcat WHERE catid = '{$catid}' AND div = '" . USER_DIV . "'";
    $catRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
    if (pg_numrows($catRslt) < 1) {
        return "<li> Invalid Stock ID.";
    } else {
        $cat = pg_fetch_array($catRslt);
    }
    # get stock vars
    foreach ($cat as $key => $value) {
        ${$key} = $value;
    }
    // Layout
    $confirm = "<h3>Stock Category</h3>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t\t\t<tr><th width=40%>Field</th><th width=60%>Value</th></tr>\n\t\t\t<tr class='bg-odd'><td>Category Code</td><td>{$catcod}</td></tr>\n\t\t\t<tr class='bg-even'><td>Category Name</td></td><td>{$cat}</td></tr>\n\t\t\t<tr class='bg-odd'><td valign=top>Description</td><td><pre>{$descript}</pre></td></tr>\n\t\t</table>\n\t\t<p>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=100>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<tr class='bg-odd'><td><a href='stockcat-edit.php?catid={$catid}'>Edit</a></td></tr>\n\t\t\t<tr class='bg-even'><td><a href='stockcat-view.php'>View Stock Category</a></td></tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
    return $confirm;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:32,代码来源:stockcat-det.php

示例8: con_data

function con_data($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    //confirm inserted data
    # validate input
    require_lib("validate");
    $v = new validate();
    # Limit field lengths as per database settings
    $v->isOk($grpname, "string", 0, 15, "Invalid  group name.");
    $v->isOk($unit, "string", 1, 15, "Invalid group unit.");
    # display errors, if any
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "<li class=err>" . $e["msg"] . "</li>";
        }
        $theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $theseErrors;
    }
    $con_data = "<h3>Confirm Group Details</h3>\r\n\t\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t\t<form action='" . SELF . "' method=post>\r\n\t\t<input type=hidden name=key value='write'>\r\n\t\t<input type=hidden name=grpname value='{$grpname}'>\r\n\t\t<input type=hidden name=unit value='{$unit}'>\r\n\t\t<input type=hidden name=id  value='{$id}'>\r\n\t\t\r\n\t\t<tr><th colspan=2>Group Details</th></tr>\r\n\t\t<tr class='bg-odd'><td>Group Name</td><td align=center>{$grpname}</td></tr>\r\n\t\t<tr class='bg-odd'><td>Document type</td><td align=center>{$unit}</td></tr>\r\n\t\t<tr><td colspan=2 align=left><input type=submit value='Write &raquo;'></td></tr>\r\n\t</form>\r\n\t</table>";
    return $con_data;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:26,代码来源:grpedit.php

示例9: remPaye

function remPaye($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($id, "num", 1, 20, "Invalid PAYE ID.");
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class=err>" . $e["msg"];
        }
        $confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirmCust;
    }
    # connect to db
    db_connect();
    # remove job
    $sql = "DELETE FROM paye WHERE id='{$id}'";
    $payeRslt = db_exec($sql) or errDie("Unable to remove PAYE bracket.", SELF);
    if (pg_cmdtuples($payeRslt) < 1) {
        return "Failed to delete PAYE bracket.";
    }
    $remPaye = "\n<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\n<tr><th>PAYE bracket removed</th></tr>\n<tr class=datacell><td>PAYE bracket has been successfully removed.</td></tr>\n</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    return $remPaye;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:31,代码来源:paye-rem.php

示例10: 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='&laquo; 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

示例11: 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='&laquo; 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

示例12: 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='&laquo; 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

示例13: 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='&laquo; 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

示例14: 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='&laquo; 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']} &nbsp;&nbsp;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

示例15: 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='&laquo; 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


注:本文中的validate::isError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。