PHP validate Code Examples

This page contains top rated real world PHP examples of validate extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: allowance-rem.php Project: andrecoetzee/accounting-123.com
0
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='&laquo; 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;
}
Example #2
Show file File: fringeben-add.php Project: andrecoetzee/accounting-123.com
0
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='&laquo; 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;
}
Example #3
Show file File: cash-flow-print.php Project: andrecoetzee/accounting-123.com
0
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";
    }
}
Example #4
Show file File: report-type-add.php Project: andrecoetzee/accounting-123.com
0
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='&laquo; 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;
}
Example #5
Show file File: income-stmnt-print.php Project: andrecoetzee/accounting-123.com
0
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";
}
Example #6
Show file File: cust-branch-del.php Project: andrecoetzee/accounting-123.com
0
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>";
}
Example #7
Show file File: payslip-view.php Project: andrecoetzee/accounting-123.com
0
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;
}
Example #8
Show file File: nons-intinvoice-det.php Project: andrecoetzee/accounting-123.com
0
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;
}
Example #9
Show file File: intbrac-add.php Project: andrecoetzee/accounting-123.com
0
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='&laquo; 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;
}
Example #10
Show file File: class-add.php Project: andrecoetzee/accounting-123.com
0
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='&laquo; 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;
}
Example #11
Show file File: invoice-search.php Project: andrecoetzee/accounting-123.com
0
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;
}
Example #12
Show file File: salded-rem.php Project: andrecoetzee/accounting-123.com
0
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;
}
Example #13
Show file File: employee-leave-avail.php Project: andrecoetzee/accounting-123.com
0
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;
}
Example #14
Show file File: login.php Project: ddavisgraphics/LearningApp
0
 /**
  * =========================================================
  * 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;
     }
 }
Example #15
Show file File: doctype-rem.php Project: andrecoetzee/accounting-123.com
0
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='&laquo; 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;
}
Example #16
Show file File: invoice-no-neg-edit-price.php Project: andrecoetzee/accounting-123.com
0
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();
}
Example #17
Show file File: tb-xls.php Project: andrecoetzee/accounting-123.com
0
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='&laquo; 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);
}
Example #18
Show file File: cfe-rem.php Project: andrecoetzee/accounting-123.com
0
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='&laquo; 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;
}
Example #19
Show file File: complogin.php Project: kumarsivarajan/accounting-123
0
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");
}
Example #20
Show file File: grpedit.php Project: andrecoetzee/accounting-123.com
0
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;
}
Example #21
Show file File: calloutp-add.php Project: andrecoetzee/accounting-123.com
0
function write($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($calloutp, "string", 1, 255, "Invalid Call Out Person name.");
    $v->isOk($telno, "string", 1, 255, "Invalid Call Out Person Contact 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_conn("exten");
    # write to db
    $sql = "INSERT INTO calloutpeople(calloutp,telno,div) VALUES ('{$calloutp}','{$telno}','" . USER_DIV . "')";
    $salespRslt = db_exec($sql) or errDie("Unable to add warehouse to system.", SELF);
    if (pg_cmdtuples($salespRslt) < 1) {
        return "<li class=err>Unable to add Call Out Person to database.";
    }
    $write = "\r\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t\t\t<tr><th>Call Out Person added to system</th></tr>\r\n\t\t\t<tr class=datacell><td>New Call Out Person <b>{$calloutp}</b>, has been successfully added to the system.</td></tr>\r\n\t\t</table>\r\n\t\t<p>\r\n\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t\t<tr><th>Quick Links</th></tr>\r\n\t\t\t<tr class='bg-odd'><td><a href='calloutp-view.php'>View Call Out People</a></td></tr>\r\n\t\t\t<tr class='bg-odd'><td><a href='../callout-new.php'>New Call Out Document</a></td></tr>\r\n\t\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t\t</table>";
    return $write;
}
Example #22
Show file File: stockcat-det.php Project: andrecoetzee/accounting-123.com
0
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;
}
Example #23
Show file File: nons-purch-int-det.php Project: andrecoetzee/accounting-123.com
0
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;
}
Example #24
Show file File: paye-rem.php Project: andrecoetzee/accounting-123.com
0
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;
}
Example #25
Show file File: cust-det.php Project: andrecoetzee/accounting-123.com
0
function view($custid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($custid, "num", 1, 50, "Invalid customer 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
    db_conn("toms");
    $sql = "SELECT * FROM customers WHERE custid = '{$custid}'";
    $custRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
    if (pg_numrows($custRslt) < 1) {
        return "<li> Invalid Customer ID.";
    } else {
        $cust = pg_fetch_array($custRslt);
        # get vars
        foreach ($cust as $key => $value) {
            ${$key} = $value;
        }
    }
    # get Category
    $sql = "SELECT * FROM categories WHERE catid = '{$category}'";
    $catRslt = db_exec($sql);
    if (pg_numrows($catRslt) < 1) {
        $category = "<li class=err>Category not Found.";
    } else {
        $cat = pg_fetch_array($catRslt);
        $category = $cat['category'];
    }
    # get Classification
    $sql = "SELECT * FROM class WHERE clasid = '{$class}'";
    $clasRslt = db_exec($sql);
    if (pg_numrows($clasRslt) < 1) {
        $class = "<li class=err>Class not Found.";
    } else {
        $clas = pg_fetch_array($clasRslt);
        $class = $clas['classname'];
    }
    # get Price List
    $sql = "SELECT * FROM pricelist WHERE listid = '{$pricelist}'";
    $listRslt = db_exec($sql);
    if (pg_numrows($listRslt) < 1) {
        $plist = "<li class=err>Class not Found.";
    } else {
        $list = pg_fetch_array($listRslt);
        $plist = $list['listname'];
    }
    // layout
    $confirm = "<h3>Customer Details</h3>\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>Acc No</td><td>{$accno}</td></tr>\r\n\t<tr class='bg-odd'><td>Surname/Company</td><td>{$surname}</td></tr>\r\n\t<tr class='bg-odd'><td>Title</td><td>{$title}</td></tr>\r\n\t<tr class='bg-odd'><td>Initials</td><td>{$init}</td></tr>\r\n\t<tr class='bg-odd'><td>First Name</td><td>{$firstname}</td></tr>\r\n\t<tr class='bg-odd'><td>Category</td><td>{$category}</td></tr>\r\n\t<tr class='bg-odd'><td>Classification</td><td>{$class}</td></tr>\r\n\t<tr class='bg-odd'><td>Postal Address</td><td><pre>{$paddr}</pre></td></tr>\r\n\t<tr class='bg-odd'><td>Delivery Address</td><td><pre>{$daddr}</pre></td></tr>\r\n\t<tr class='bg-odd'><td>Contact Name</td><td>{$contname}</td></tr>\r\n\t<tr class='bg-odd'><td>Business Tel.</td><td>{$bustel}</td></tr>\r\n\t<tr class='bg-odd'><td>Home Tel.</td><td>{$hometel}</td></tr>\r\n\t<tr class='bg-odd'><td>Cell No.</td><td>{$cellno}</td></tr>\r\n\t<tr class='bg-odd'><td>Fax No.</td><td>{$faxno}</td></tr>\r\n\t<tr class='bg-odd'><td>E-mail</td><td>{$email}</td></tr>\r\n\t<tr class='bg-odd'><td>Sale Term</td><td>{$saleterm}</td></tr>\r\n\t<tr class='bg-odd'><td>Trade Discount</td><td>{$traddisc}</td></tr>\r\n\t<tr class='bg-odd'><td>Settlement Discount</td><td>{$setdisc}</td></tr>\r\n\t<tr class='bg-odd'><td>Price List</td><td>{$plist}</td></tr>\r\n\t<tr class='bg-odd'><td>Charge Interest</td><td>{$chrgint}</td></tr>\r\n\t<tr class='bg-odd'><td>Overdue</td><td>{$overdue}</td></tr>\r\n\t<tr class='bg-odd'><td>Charge Vat</td><td>{$chrgvat}</td></tr>\r\n\t<tr class='bg-odd'><td>Vat Inclusive</td><td>{$vatinc}</td></tr>\r\n\t<tr class='bg-odd'><td>Account Open Date</td><td>{$odate}</td></tr>\r\n\t<tr class='bg-odd'><td>Credit Term</td><td>{$credterm}</td></tr>\r\n\t<tr class='bg-odd'><td>Credit Limit</td><td>{$credlimit}</td></tr>\r\n\t<tr class='bg-odd'><td>Block Account</td><td>{$blocked}</td></tr>\r\n\t<tr><td colspan=2 align=right><br></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='cust-view.php'>View Customers</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='index.php'>Index</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='toms-settings.php'>Settings</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $confirm;
}
Example #26
Show file File: nons-purch-det.php Project: andrecoetzee/accounting-123.com
0
function details($_GET)
{
    # get vars
    extract($_GET);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($purid, "num", 1, 20, "Invalid Order number.");
    # display errors, if any
    if ($v->isError()) {
        $err = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $err .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; 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 "<i class='err'>Not Found</i>";
    }
    $pur = pg_fetch_array($purRslt);
    /* --- Start Products Display --- */
    # Products layout
    $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>DESCRIPTION</th>\n\t\t\t\t\t\t\t<th>QTY OUTSTANDING</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<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);
    while ($stkd = pg_fetch_array($stkdRslt)) {
        # format date
        list($dyear, $dmon, $dday) = explode("-", $stkd['ddate']);
        # put in product
        $products .= "\n\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t<td>{$stkd['cod']}</td>\n\t\t\t\t\t\t\t\t<td>{$stkd['des']}</td>\n\t\t\t\t\t\t\t\t<td>{$stkd['qty']}</td>\n\t\t\t\t\t\t\t\t<td nowrap>" . CUR . " {$stkd['unitcost']}</td>\n\t\t\t\t\t\t\t\t<td>{$dday}-{$dmon}-{$dyear}</td>\n\t\t\t\t\t\t\t\t<td nowrap>" . CUR . " {$stkd['amt']}</td>\n\t\t\t\t\t\t\t</tr>";
    }
    $products .= "</table>";
    /* --- Start Some calculations --- */
    # Get subtotal
    $SUBTOT = sprint($pur['subtot']);
    # Get Total
    $TOTAL = sprint($pur['total']);
    # Get vat
    $VAT = sprint($pur['vat']);
    /* --- End Some calculations --- */
    # format date
    list($pyear, $pmon, $pday) = explode("-", $pur['pdate']);
    // format the vat inclusive variable for nicer display
    if ($pur['vatinc'] == "novat") {
        $pur['vatinc'] = "No Vat";
    }
    /* -- Final Layout -- */
    $details = "\n\t\t\t\t\t<center>\n\t\t\t\t\t<h3>Non-Stock Order Details</h3>\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='95%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td valign='top'>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th colspan='2'> Supplier Details </th>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Supplier</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['supplier']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Account number</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'><pre>{$pur['supaddr']}</pre></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td valign='top' align='right'>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th colspan='2'> Non-Stock Order Details </th>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Non-Stock Order No.</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['purnum']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Order No.</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['ordernum']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Supplier Invoice No</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['supinv']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Delivery Ref No.</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['refno']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Terms</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['terms']} Days</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Date</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pday}-{$pmon}-{$pyear}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>VAT Inclusive</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['vatinc']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Delivery Charges</td>\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>" . CUR . " {$pur['shipchrg']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'>{$products}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th width='40%'>Quick Links</th>\n\t\t\t\t\t\t\t\t\t\t<th width='45%'>Remarks</th>\n\t\t\t\t\t\t\t\t\t\t<td rowspan='5' valign='top' width='15%'><br></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td class='" . bg_class() . "'><a href='nons-purchase-new.php'>New Non-Stock Order</a></td>\n\t\t\t\t\t\t\t\t\t\t<td class='" . bg_class() . "' rowspan='4' align='center' valign='top'>" . nl2br($pur['remarks']) . "</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td><a href='nons-purchase-view.php'>View Non-Stock Orders</a></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td align='right'>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='80%'>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>SUBTOTAL</td>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$pur['subtot']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>Delivery Charges</td>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$pur['shipping']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<td>VAT @ " . TAX_VAT . " %</td>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$pur['vat']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t\t<th>GRAND TOTAL</th>\n\t\t\t\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$pur['total']}</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</form>\n\t\t\t\t\t</center>";
    return $details;
}
Example #27
Show file File: nons-purch-int-print.php Project: andrecoetzee/accounting-123.com
0
function details($_GET)
{
    # get vars
    extract($_GET);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($purid, "num", 1, 20, "Invalid Order number.");
    # display errors, if any
    if ($v->isError()) {
        $err = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $err .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='&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 = "\r\n\t\t\t\t\t<table cellpadding='2' cellspacing='0' border='1' width='100%'>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th>ITEM NUMBER</th>\r\n\t\t\t\t\t\t\t<th>DESCRIPTION</th>\r\n\t\t\t\t\t\t\t<th>QTY</th>\r\n\t\t\t\t\t\t\t<th colspan='2'>UNIT PRICE</th>\r\n\t\t\t\t\t\t\t<th colspan='2'>DUTY</th>\r\n\t\t\t\t\t\t\t<th>LINE TOTAL</th>\r\n\t\t\t\t\t\t<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 .= "\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td>{$stkd['cod']}</td>\r\n\t\t\t\t\t\t\t\t<td>{$stkd['des']}</td>\r\n\t\t\t\t\t\t\t\t<td>{$stkd['qty']}</td>\r\n\t\t\t\t\t\t\t\t<td>{$pur['curr']} {$stkd['cunitcost']} or </td>\r\n\t\t\t\t\t\t\t\t<td nowrap>" . CUR . " {$stkd['unitcost']}</td>\r\n\t\t\t\t\t\t\t\t<td>{$pur['curr']} {$stkd['duty']} or </td>\r\n\t\t\t\t\t\t\t\t<td>{$stkd['dutyp']}%</td>\r\n\t\t\t\t\t\t\t\t<td nowrap>{$pur['curr']} {$stkd['amt']}</td>\r\n\t\t\t\t\t\t\t</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 = "\r\n\t\t\t\t\t<center>\r\n\t\t\t\t\t<h3>International Non-Stock Order Details</h3>\r\n\t\t\t\t\t<table cellpadding='0' cellspacing='4' border='0' width='95%'>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td valign='top'>\r\n\t\t\t\t\t\t\t\t<table cellpadding='2' cellspacing='0' border='1'>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th colspan='2'> Supplier Details </th>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Supplier</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['supplier']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Supplier Address</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'><pre>{$pur['supaddr']}</pre></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td valign='top' align='right'>\r\n\t\t\t\t\t\t\t\t<table cellpadding='2' cellspacing='0' border='1'>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th colspan='2'> Non-Stock Order Details </th>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Non-Stock Order No.</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['purnum']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Order No.</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['ordernum']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Terms</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['terms']} Days</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Date</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pday}-{$pmon}-{$pyear}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Foreign Currency</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$currsel} &nbsp;&nbsp;Exchange rate {$pur['curr']} {$pur['xrate']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Tax</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['curr']} {$pur['tax']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Shipping Charges</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$pur['curr']} {$pur['shipchrg']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Delivery Date</td>\r\n\t\t\t\t\t\t\t\t\t\t<td valign='center'>{$dday}-{$dmon}-{$dyear}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr><td><br></td></tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td colspan='2'>{$products}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<table cellpadding='2' cellspacing='0' border='1'>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th width='40%'>Remarks</th>\r\n\t\t\t\t\t\t\t\t\t\t<td rowspan='5' valign='top' width='15%'><br></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td rowspan='4' align='center' valign='top'>" . nl2br($pur['remarks']) . "</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td align='right'>\r\n\t\t\t\t\t\t\t\t<table cellpadding='2' cellspacing='0' border='1' width='40%'>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>SUBTOTAL</td>\r\n\t\t\t\t\t\t\t\t\t\t<td align='right' nowrap>{$pur['curr']} {$pur['subtot']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Delivery Charges</td>\r\n\t\t\t\t\t\t\t\t\t\t<td align='right' nowrap>{$pur['curr']} {$pur['shipping']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td>Tax </td>\r\n\t\t\t\t\t\t\t\t\t\t<td align='right' nowrap>{$pur['curr']} {$pur['tax']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th>GRAND TOTAL</th>\r\n\t\t\t\t\t\t\t\t\t\t<td align='right' nowrap>{$pur['curr']} {$pur['total']}</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t\t</form>\r\n\t\t\t\t\t</center>";
    return $details;
}
Example #28
Show file File: rec-nons-invoice-rem.php Project: andrecoetzee/accounting-123.com
0
function details($_GET)
{
    # get vars
    extract($_GET);
    # 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"] . "</li>";
        }
        $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    # Get purchase info
    db_connect();
    $sql = "SELECT * FROM rnons_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);
    /* --- Start Products Display --- */
    # Products layout
    $products = "\n\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t<tr>\n\t\t\t\t<th width='5%'>#</th>\n\t\t\t\t<th width='65%'>DESCRIPTION</th>\n\t\t\t\t<th width='10%'>QTY</th>\n\t\t\t\t<th width='10%'>UNIT PRICE</th>\n\t\t\t\t<th width='10%'>AMOUNT</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)) {
        $i++;
        # put in product
        $products .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center'>{$i}</td>\n\t\t\t\t<td>{$stkd['description']}</td>\n\t\t\t\t<td>{$stkd['qty']}</td>\n\t\t\t\t<td>{$stkd['unitcost']}</td>\n\t\t\t\t<td>" . CUR . " {$stkd['amt']}</td>\n\t\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 = "\n\t\t<center>\n\t\t<h3>Delete Recurring Non-Stock Invoice</h3>\n\t\t<table " . TMPL_tblDflts . " width='95%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>\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 colspan='2'> Customer Details </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>Customer</td>\n\t\t\t\t\t\t\t<td valign='center'>{$inv['cusname']}</td>\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>Customer Address</td>\n\t\t\t\t\t\t\t<td valign='center'><pre>{$inv['cusaddr']}</pre></td>\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>Customer Vat Number</td>\n\t\t\t\t\t\t\t<td valign='center'>{$inv['cusvatno']}</td>\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>Customer Order number</td>\n\t\t\t\t\t\t\t<td valign='center'>{$inv['cordno']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t<td valign='top' align='right'>\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 colspan='2'> Non-Stock Invoice Details </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>Non-Stock Invoice No.</td>\n\t\t\t\t\t\t\t<td valign='center'>{$inv['invnum']}</td>\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>Proforma Inv No.</td>\n\t\t\t\t\t\t\t<td valign='center'>{$inv['docref']}</td>\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>Date</td>\n\t\t\t\t\t\t\t<td valign='center'>{$sday}-{$smon}-{$syear}</td>\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>VAT Inclusive</td>\n\t\t\t\t\t\t\t<td valign='center'>{$inv['chrgvat']}</td>\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>Terms</td>\n\t\t\t\t\t\t\t<td valign='center'>{$inv['terms']} Days</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'>{$products}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\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 width='40%'>Quick Links</th>\n\t\t\t\t\t\t\t<th width='45%'>Remarks</th>\n\t\t\t\t\t\t\t<td rowspan='5' valign='top' width='15%'><br></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='" . bg_class() . "'><a href='rec-nons-invoice-new.php'>New Recurring Non-Stock Invoices</a></td>\n\t\t\t\t\t\t\t<td class='" . bg_class() . "' rowspan='4' align='center' valign='top'>" . nl2br($inv['remarks']) . "</td>\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><a href='rec-nons-invoice-view.php'>View Recurring Non-Stock Invoices</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t<td align='right'>\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='80%'>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>SUBTOTAL</td>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$inv['subtot']}</td>\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>VAT @ " . TAX_VAT . " %</td>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$inv['vat']}</td>\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<th>GRAND TOTAL</th>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$inv['total']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='id' value='{$invid}'>\n\t\t\t<input type='submit' value='Delete &raquo;'>\n\t\t</form>\n\t\t</center>";
    return $details;
}
Example #29
Show file File: bank-recon-saved.php Project: andrecoetzee/accounting-123.com
0
function viewsaved($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($bankid, "num", 1, 30, "Invalid Bank Account.");
    $v->isOk($from_day, "num", 1, 2, "Invalid Day for the 'From' date.");
    $v->isOk($from_month, "num", 1, 2, "Invalid month for the 'From' date..");
    $v->isOk($from_year, "num", 1, 4, "Invalid year for the 'From' date..");
    $v->isOk($to_day, "num", 1, 2, "Invalid Day for the 'To' date.");
    $v->isOk($to_month, "num", 1, 2, "Invalid month for the 'To' date..");
    $v->isOk($to_year, "num", 1, 4, "Invalid year for the 'To' date..");
    # Lets mix the date
    $from = sprintf("%02.2d", $from_year) . "-" . sprintf("%02.2d", $from_month) . "-" . $from_day;
    $to = sprintf("%02.2d", $to_year) . "-" . sprintf("%02.2d", $to_month) . "-" . $to_day;
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    # get bank details
    $bankRslt = get("cubit", "accname,bankname", "bankacct", "bankid", $bankid);
    $bank = pg_fetch_array($bankRslt);
    // Query server
    core_connect();
    $sql = "SELECT * FROM save_bank_recon WHERE bankid = '{$bankid}' AND gendate >= '{$from}' AND gendate <= '{$to}' AND div = '" . USER_DIV . "'";
    $Rslt = db_exec($sql) or errDie("ERROR: Unable to view saved Trial balances", SELF);
    // Die with custom error if failed
    if (pg_numrows($Rslt) < 1) {
        $OUTPUT = "<li> There are no saved Bank Reconciliations.";
    } else {
        // Layout
        $OUTPUT = "\n\t\t\t\t<h3>View Saved Bank Reconciliations</h3>\n\t\t\t\t<table " . TMPL_tblDflts . " width='300'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Bank Recon No.</th>\n\t\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t</tr>";
        // Display all statements
        for ($i = 0; $recon = pg_fetch_array($Rslt); $i++) {
            # Date format
            $date = explode("-", $recon['gendate']);
            $date = $date[2] . "-" . $date[1] . "-" . $date[0];
            $OUTPUT .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$recon['id']}</td>\n\t\t\t\t\t\t<td>{$date}</td>\n\t\t\t\t\t\t<td><a target='_blank' href='bank-recon-print.php?id={$recon['id']}'>Print</a></td>\n\t\t\t\t\t</tr>";
        }
        $OUTPUT .= "\t</table>";
    }
    // 			.mkQuickLinks(
    // 				ql("public_holiday_add.php", "Add Public Holiday"),
    // 				ql("public_holiday_list.php", "View Public Holidays")
    // 			);
    $OUTPUT .= "\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td align=center><a target=_blank href='../core/acc-new2.php'>Add account (New Window)</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='index-reports.php'>Financials</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='index-reports-banking.php'>Banking Reports</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='../main.php'>Main Menu</a></td>\n\t\t\t\t</tr>\n\t\t\t</table>";
    // Call template to display the info and die
    return $OUTPUT;
}
Example #30
Show file File: purch-recv-purnum.php Project: andrecoetzee/accounting-123.com
0
function printPurch($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($purnum, "num", 1, 10, "Invalid Purchase number.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>-" . $e["msg"] . "</li>";
        }
        return slct($purnum, $confirm);
    }
    db_connect();
    # local
    $sql = "SELECT * FROM purchases WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
    $purRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
    if (pg_numrows($purRslt) > 0) {
        $pur = pg_fetch_array($purRslt);
        if ($pur['supid'] != 0) {
            $recv = "purch-recv.php?purid={$pur['purid']}";
        } else {
            $recv = "purch-recv-cash.php?purid={$pur['purid']}";
        }
        header("Location: {$recv}");
    }
    # inter
    $sql = "SELECT * FROM purch_int WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
    $purRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
    if (pg_numrows($purRslt) > 0) {
        $pur = pg_fetch_array($purRslt);
        $recv = "purch-int-recv.php?purid={$pur['purid']}";
        header("Location: {$recv}");
    }
    # nons
    $sql = "SELECT * FROM nons_purchases WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
    $purRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
    if (pg_numrows($purRslt) > 0) {
        $pur = pg_fetch_array($purRslt);
        $recv = "nons-purch-recv.php?purid={$pur['purid']}";
        header("Location: {$recv}");
    }
    # inter nons
    $sql = "SELECT * FROM nons_purch_int WHERE purnum = '{$purnum}' AND div = '" . USER_DIV . "'";
    $purRslt = db_exec($sql) or errDie("Unable to retrieve purchases from database.");
    if (pg_numrows($purRslt) > 0) {
        $pur = pg_fetch_array($purRslt);
        $recv = "nons-purch-int-recv.php?purid={$pur['purid']}";
        header("Location: {$recv}");
    }
    return slct($purnum, "<li class=err> - Purchase number not found in outstanding purchases.");
}
Frequently Used Methods