function printGrp()
{
    # Set up table to display in
    $printGrp = "\r\n    <h3>Asset Groups</h3>\r\n    <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n    <tr><th>Group</th><th>Cost Account</th><th>Accumulated Depreciation Account</th><th>Depreciation Account</th><th colspan=2>Options</th></tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM assetgrp WHERE div = '" . USER_DIV . "' ORDER BY grpname ASC";
    $GrpRslt = db_exec($sql) or errDie("Unable to retrieve Asset Groups from database.");
    if (pg_numrows($GrpRslt) < 1) {
        return "\r\n\t\t\t\t<li> There are no Assets Groups in Cubit.</li><br>" . mkQuickLinks(ql("assetgrp-new.php", "Add Asset Group"), ql("assetgrp-view.php", "View Asset Groups"));
    }
    while ($Grp = pg_fetch_array($GrpRslt)) {
        # get ledger account name(cost)
        core_connect();
        $sql = "SELECT accname FROM accounts WHERE accid = '{$Grp['costacc']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $acccost = pg_fetch_array($accRslt);
        # get ledger account name(accum dep)
        $sql = "SELECT accname FROM accounts WHERE accid = '{$Grp['accdacc']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $acdacc = pg_fetch_array($accRslt);
        # get ledger account name(dep)
        $sql = "SELECT accname FROM accounts WHERE accid = '{$Grp['depacc']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $accdep = pg_fetch_array($accRslt);
        # alternate bgcolor
        $printGrp .= "<tr class='" . bg_class() . "'><td>{$Grp['grpname']}</td><td>{$acccost['accname']}</td><td>{$acdacc['accname']}</td><td>{$accdep['accname']}</td><td><a href='assetgrp-edit.php?grpid={$Grp['grpid']}'>Edit</a></td>";
        $printGrp .= "<td><a href='assetgrp-rem.php?grpid={$Grp['grpid']}'>Remove</a></td></tr>";
        $i++;
    }
    $printGrp .= "</table>\r\n    <p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n        <tr><td><br></td></tr>\r\n        <tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='assetgrp-new.php'>Add Asset Group</a></td></tr>\r\n\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t</table>";
    return $printGrp;
}
function edit($salespid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($salespid, "num", 1, 50, "Invalid Sales Person id.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>-" . $e["msg"] . "<br>";
        }
        return $confirm;
    }
    # Select Stock
    db_conn("exten");
    $sql = "SELECT * FROM salespeople WHERE salespid = '{$salespid}' AND div = '" . USER_DIV . "'";
    $salespRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
    if (pg_numrows($salespRslt) < 1) {
        return "<li> Invalid Sales Person ID.";
    } else {
        $salesp = pg_fetch_array($salespRslt);
    }
    $enter = "<h3>Edit Sales Person</h3>\n\t<form action='" . SELF . "' method=post>\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<input type=hidden name=key value=confirm>\n\t<input type=hidden name=salespid value='{$salesp['salespid']}'>\n\t<tr><th>Field</th><th>Value</th></tr>\n\t<tr class='bg-odd'><td>Number</td><td align=center><input type=text size=20 name=salespno value='{$salesp['salespno']}'></td></tr>\n\t<tr class='bg-even'><td>Sales Person</td><td align=center><input type=text size=20 name=salesp value='{$salesp['salesp']}'></td></tr>\n\t<tr class='bg-odd'><td>Commission</td><td align=center><input type=text size=10 name=com value='{$salesp['com']}'></td></tr>\n\t<tr><td colspan=2 align=right><input type=submit value='Confirm &raquo;'></td></tr>\n\t</table></form>" . mkQuickLinks(ql("salesp-add.php", "Add Sales Person"), ql("salesp-view.php", "View Sales People"));
    return $enter;
}
function viewEmp($empnum)
{
    if (empty($empnum)) {
        return "Employee number missing.{$empnum}";
    }
    $empnum = preg_replace("/[^\\w\\s-]/", "", substr($empnum, 0, 20));
    # connect to db
    db_connect();
    # get employee info to edit
    $sql = "SELECT * FROM lemployees WHERE empnum='{$empnum}' AND div = '" . USER_DIV . "'";
    $empRslt = db_exec($sql) or errDie("Unable to select employee info from database.");
    if (pg_numrows($empRslt) < 1) {
        return "Invalid clock number.";
    }
    $myEmpl = pg_fetch_array($empRslt);
    if ($myEmpl['resident'] == "t") {
        $myEmpl['resident'] = "Yes";
    } else {
        $myEmpl['resident'] = "No";
    }
    if ($myEmpl['sex'] == "M") {
        $myEmpl['sex'] = "Male";
    } else {
        $myEmpl['sex'] = "Female";
    }
    # Set up table & form
    $viewEmp = "\n\t<h3>Employee Details</h3>\n\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><td valign=top><table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th colspan=2>Employee Details</th></tr>\n\t<tr class='bg-odd'><td>Emp Num</td><td>{$myEmpl['enum']}</td></tr>\n\t<tr class='bg-even'><td>Surname</td><td valign=center>{$myEmpl['sname']}</td></tr>\n\t<tr class='bg-odd'><td>First Names</td><td valign=center>{$myEmpl['fnames']}</td></tr>\n\t<tr class='bg-even'><td>Sex</td><td valign=center>{$myEmpl['sex']}</td></tr>\n\t<tr class='bg-odd'><td>Marital Status</td><td valign=center>{$myEmpl['marital']}</td></tr>\n\t<tr class='bg-even'><td>Resident</td><td valign=center>{$myEmpl['resident']}</td></tr>\n\t<tr class='bg-odd'><td>Hire Date</td><td valign=center>{$myEmpl['hiredate']}</td></tr>\n\t<tr class='bg-even'><td>Telephone No</td><td valign=center>{$myEmpl['telno']}</td></tr>\n\t<tr class='bg-odd'><td>E-mail</td><td valign=center>{$myEmpl['email']}</td></tr>\n\t<tr class='bg-even'><td>Basic Salary</td><td valign=center>" . CUR . " {$myEmpl['basic_sal']}</td></tr>\n\t<tr class='bg-odd'><td>Pay Type</td><td valign=center>{$myEmpl['paytype']}</td></tr>\n\t<tr class='bg-even'><td>Bank Name</td><td valign=center>{$myEmpl['bankname']}</td></tr>\n\t<tr class='bg-odd'><td>Branch Code</td><td valign=center>{$myEmpl['bankcode']}</td></tr>\n\t<tr class='bg-even'><td>Bank Account Type</td><td valign=center>{$myEmpl['bankacctype']}</td></tr>\n\t<tr class='bg-odd'><td>Bank Account No</td><td valign=center>{$myEmpl['bankaccno']}</td></tr>\n\t<tr class='bg-even'><td>Leave Reason</td><td>{$myEmpl['leavereason']}</td></tr>\n\t<tr class='bg-odd'><td>Date</td><td>{$myEmpl['leavedate']}</td></tr>\n\t<tr class='bg-even'><td>Description</td><td>{$myEmpl['leavedescription']}</td></tr>\n\t</table></td>\n\t<td valign=top><table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n        <tr><th colspan=2>Employee Details</th></tr>\n\t<tr class='bg-even'><td>ID Num</td><td>{$myEmpl['idnum']}</td></tr>\n\t<tr class='bg-odd'><td>Income Tax Ref No.</td><td>{$myEmpl['taxref']}</td></tr>\n\t<tr class='bg-even'><td>Residential Address</td><td valign=center>{$myEmpl['res1']}</td></tr>\n\t<tr class='bg-odd'><td><br></td><td valign=center>{$myEmpl['res2']}</td></tr>\n\t<tr class='bg-even'><td><br></td><td valign=center>{$myEmpl['res3']}</td></tr>\n\t<tr class='bg-odd'><td><br></td><td valign=center>{$myEmpl['res4']}</td></tr>\n\t<tr class='bg-even'><td>Postal Address</td><td valign=center>{$myEmpl['pos1']}</td></tr>\n\t<tr class='bg-odd'><td><br></td><td valign=center>{$myEmpl['pos2']}</td></tr>\n\t<tr class='bg-even'><td>Postal Code</td><td valign=center>{$myEmpl['pcode']}</td></tr>\n\t<tr><th colspan=2>Friend Not Living With Employee</th></tr>\n\t<tr class='bg-odd'><td>Surname</td><td valign=center>{$myEmpl['contsname']}</td></tr>\n\t<tr class='bg-even'><td>First Names</td><td valign=center>{$myEmpl['contfnames']}</td></tr>\n\t<tr class='bg-odd'><td>Residential Address</td><td valign=center>{$myEmpl['contres1']}</td></tr>\n\t<tr class='bg-even'><td><br></td><td valign=center>{$myEmpl['contres2']}</td></tr>\n\t<tr class='bg-odd'><td><br></td><td valign=center>{$myEmpl['contres3']}</td></tr>\n\t<tr class='bg-even'><td>Telephone No</td><td valign=center>{$myEmpl['conttelno']}</td></tr>\n\t</table></td></tr>\n\t</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"));
    return $viewEmp;
}
function viewDeducts()
{
    # connect to db
    db_connect();
    # select entries from db
    $i = 0;
    $viewDeducts = "\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Reference no</th>\n\t\t\t\t<th>Deduction name</th>\n\t\t\t\t<th>Creditor name</th>\n\t\t\t\t<th>Account</th>\n\t\t\t\t<th>Expense Account</th>\n\t\t\t\t<th>Creditor details</th>\n\t\t\t\t<th>Type</th>\n\t\t\t</tr>";
    $sql = "SELECT * FROM salded WHERE div = '" . USER_DIV . "' ORDER BY refno";
    $salRslt = db_exec($sql) or errDie("Unable to select salary deductions from database.");
    if (pg_numrows($salRslt) < 1) {
        return "\n\t\t\t<li class='err'>No salary deductions found in database.</li><br>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    }
    while ($mySal = pg_fetch_array($salRslt)) {
        # get ledger account name
        core_connect();
        $sql = "SELECT accname FROM accounts WHERE accid = '{$mySal['accid']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $acc = pg_fetch_array($accRslt);
        if (isset($mySal["expaccid"])) {
            $sql = "SELECT accname FROM accounts WHERE accid='{$mySal['expaccid']}' AND div = '" . USER_DIV . "'";
            $expRslt = db_exec($sql);
            $exp = pg_fetch_array($expRslt);
        } else {
            $exp["accname"] = "";
        }
        $viewDeducts .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$mySal['refno']}</td>\n\t\t\t\t<td>{$mySal['deduction']}</td>\n\t\t\t\t<td>{$mySal['creditor']}</td>\n\t\t\t\t<td>{$acc['accname']}</td>\n\t\t\t\t<td>{$exp['accname']}</td>\n\t\t\t\t<td>{$mySal['details']}</td>\n\t\t\t\t<td>{$mySal['type']}</td>\n\t\t\t\t<td><a href='salded-edit.php?refno={$mySal['refno']}'>Edit</a></td>\n\t\t\t</tr>\n";
        $i++;
    }
    $viewDeducts .= "</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    return $viewDeducts;
}
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;
}
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;
}
function confirm_details($_POST)
{
    global $_GET;
    extract($_POST);
    if (!isset($_GET["id"])) {
        return "Invalid use of module. Invalid ID.";
    }
    db_connect();
    $get_burs = "SELECT * FROM active_bursaries WHERE id = '{$_GET['id']}' LIMIT 1";
    $run_burs = db_exec($get_burs) or errDie("Unable to get bursaries information.");
    if (pg_numrows($run_burs) < 1) {
        return "<li class='err'>Invalid Use Of Module. Invalid Bursary Recipient.</li>";
    }
    $barr = pg_fetch_array($run_burs);
    extract($barr);
    $get_bur = "SELECT * FROM bursaries WHERE id = '{$bursary}' LIMIT 1";
    $run_bur = db_exec($get_bur) or errDie("Unable to get bursary information.");
    if (pg_numrows($run_bur) < 1) {
        return "<li class='err'>Invalid Use Of Module. Invalid Bursary.</li>";
    }
    $burarr = pg_fetch_array($run_bur);
    $showburs = $burarr['bursary_name'];
    $display = "\n\t\t\t<h2>Grant Bursary</h2>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t<input type='hidden' name='key' value='write'>\n\t\t\t\t<input type='hidden' name='id' value='{$_GET['id']}'>\n\t\t\t\t<input type='hidden' name='bursary' value='{$bursary}'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan='2'>Recipient Information</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Bursary</td>\n\t\t\t\t\t<td>{$showbursary}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Name</td>\n\t\t\t\t\t<td>{$rec_name}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Address</td>\n\t\t\t\t\t<td>{$rec_add1}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td>{$rec_add2}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td>{$rec_add3}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td>{$rec_add4}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>ID Number</td>\n\t\t\t\t\t<td>{$rec_idnum}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Telephone</td>\n\t\t\t\t\t<td>{$rec_telephone}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Date From</td>\n\t\t\t\t\t<td>{$from_date}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Date To</td>\n\t\t\t\t\t<td>{$to_date}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Notes</td>\n\t\t\t\t\t<td>" . nl2br($notes) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='2' align='right'><input type='submit' value='Remove'></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t</table><br>" . mkQuickLinks(ql("bursary_type_add.php", "Add Bursary"), ql("bursary_type_view.php", "View Bursaries"));
    return $display;
}
function display()
{
    extract($_REQUEST);
    $fields = array();
    $fields["section_id"] = 0;
    $fields["id"] = 0;
    extract($fields, EXTR_SKIP);
    // Create the sections dropdown
    $sql = "SELECT * FROM cubit.today_sections ORDER BY name ASC";
    $section_rslt = db_exec($sql) or errDie("Unable to retrieve section.");
    $section_sel = "\n\t\t<select name='section_id' onchange='javascript:document.form.submit()' style='width: 100%'>\n\t\t\t<option value='0'>[None]</option>";
    while ($section_data = pg_fetch_array($section_rslt)) {
        if ($section_id == $section_data["id"]) {
            $sel = "selected";
        } else {
            $sel = "";
        }
        $section_sel .= "<option value='{$section_data['id']}' {$sel}>{$section_data['name']}</option>";
    }
    // Retrieve the section
    if ($section_id) {
        $sql = "SELECT * FROM cubit.today_sections WHERE id='{$section_id}'";
        $section_rslt = db_exec($sql) or errDie("Unable to retrieve section.");
        $section_data = pg_fetch_array($section_rslt);
        $section_name = $section_data["name"];
        $sql = "SELECT * FROM {$section_data['table_name']} ORDER BY {$section_data['title_column']} ASC";
        $id_rslt = db_exec($sql) or errDie("Unable to retieve {$section_data['name']}");
        $id_sel = "\n\t\t\t<select name='id' onchange='javascript:document.form.submit()' style='width: 100%'>\n\t\t\t\t<option value='0'>[None]</option>";
        while ($id_data = pg_fetch_array($id_rslt)) {
            if ($id == $id_data[$section_data["id_column"]]) {
                $sel = "selected";
            } else {
                $sel = "";
            }
            $id_sel .= "\n\t\t\t\t<option value='" . $id_data[$section_data["id_column"]] . "' {$sel}>\n\t\t\t\t\t" . $id_data[$section_data["title_column"]] . "\n\t\t\t\t</option>";
        }
        $id_sel .= "</select>";
    } else {
        $section_name = "";
        $id_sel = "Please Select a Section";
    }
    $OUTPUT = "\n\t\t<h3>{$section_name} Brought Forward Dates</h3>\n\t\t<form method='POST' action='" . SELF . "' name='form' />\n\t\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t\t<tr>\n\t\t\t\t<th>Section</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$section_sel}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$id_sel}</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<p></p>";
    if ($section_id && $id) {
        // if section id already exists section_data should be available
        // retrieve the title
        $sql = "\n\t\t\tSELECT {$section_data['title_column']} \n\t\t\tFROM {$section_data['table_name']} \n\t\t\tWHERE {$section_data['id_column']}='{$id}'";
        $title_rslt = db_exec($sql) or errDie("Unable to retrieve title.");
        $title = pg_fetch_result($title_rslt, 0);
        $sql = "\n\t\t\tSELECT *,extract('epoch' FROM date) as e_date \n\t\t\tFROM cubit.today \n\t\t\tWHERE section_id='{$section_id}' AND title='{$title}' AND user_id='" . USER_ID . "' \n\t\t\tORDER BY id DESC";
        $today_rslt = db_exec($sql) or errDie("Unable to retrieve today entries.");
        $today_out = "";
        while ($today_data = pg_fetch_array($today_rslt)) {
            $date = date("d-m-Y", $today_data["e_date"]);
            $today_out .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td nowrap>{$date}</td>\n\t\t\t\t\t<td>{$today_data['info']}</td>\n\t\t\t\t\t<td align='center'>\n\t\t\t\t\t\t<input type='checkbox' name='rem' value='{$today_data['id']}'\n\t\t\t\t\t\tonchange='javascript:document.remfrm.submit()' />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>";
        }
        $OUTPUT .= "\n\t\t\t<table cellpadding='5' cellspacing='0' class='shtable'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t<th>Info</th>\n\t\t\t\t\t<th>Options</th>\n\t\t\t\t</tr>\n\t\t\t<form method='POST' action='" . SELF . "'>\n\t\t\t\t<input type='hidden' name='section_id' value='{$section_id}' />\n\t\t\t\t<input type='hidden' name='id' value='{$id}' />\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td nowrap>" . mkDateSelect("date") . "</td>\n\t\t\t\t\t<td><input type='text' name='info' style='width: 100%' /></td>\n\t\t\t\t\t<td><input type='submit' name='key' value='Add' style='width:100%' /></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t<form method='post' action='" . SELF . "' name='remfrm' />\n\t\t\t\t<input type='hidden' name='section_id' value='{$section_id}' />\n\t\t\t\t<input type='hidden' name='id' value='{$id}' />\n\t\t\t\t<input type='hidden' name='key' value='remove' />\n\t\t\t\t{$today_out}\n\t\t\t</form>\n\t\t\t</table>";
    }
    $OUTPUT .= "\n\t\t<p></p>\n\t\t<a href='today.php' style='font-size: 12pt; font-weight: bold;'>Today Action Display</a><br><br>" . mkQuickLinks(ql("../crmsystem/leads_list.php", "Return To View Leads"));
    return $OUTPUT;
}
function write_burs($_POST)
{
    extract($_POST);
    db_connect();
    $write_sql = "DELETE FROM bursaries WHERE id = '{$id}'";
    $runwrite = db_exec($write_sql) or errDie("Unable to remove bursary information.");
    return "\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Information Updated.</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Bursary Has Been Removed</td>\n\t\t\t\t</tr>\n\t\t\t</table><br>" . mkQuickLinks(ql("bursary_type_add.php", "Add Bursary"), ql("bursary_type_view.php", "View Bursaries"));
}
function write_burs($_POST)
{
    extract($_POST);
    db_connect();
    $write_sql = "INSERT INTO bursaries (bursary_name,bursary_details,date_added,used) VALUES ('{$bursary_name}','{$bursary_details}','now','no')";
    $runwrite = db_exec($write_sql) or errDie("Unable to add bursary information.");
    return "\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Information Updated.</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Bursary Has Been Added</td>\n\t\t\t\t</tr>\n\t\t\t</table><br>" . mkQuickLinks(ql("bursary_type_add.php", "Add Bursary"), ql("bursary_type_view.php", "View Bursaries"));
}
function write_loan($_POST)
{
    extract($_POST);
    db_connect();
    $insert_sql = "DELETE FROM loan_types WHERE id = '{$id}' AND loan_type = '{$loan_type}'";
    $run_insert = db_exec($insert_sql) or errDie("Unable to store loan type information");
    return "\n\t\t\t<table " . TMPL_Dflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Information Updated</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Loan Type Has Been Removed</td>\n\t\t\t\t</tr>\n\t\t\t</table><br>" . mkQuickLinks(ql("loan_type_add.php", "Add Loan Type"), ql("loan_type_view.php", "View Loan Types"));
}
function write_loan($_POST)
{
    extract($_POST);
    db_connect();
    $insert_sql = "INSERT INTO loan_types (loan_type) VALUES ('{$loan_type}')";
    $run_insert = db_exec($insert_sql) or errDie("Unable to store loan type information");
    return "\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Information Saved</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Loan Type Has Been Added</td>\n\t\t\t\t</tr>\n\t\t\t</table><br>" . mkQuickLinks(ql("salwages/loan_apply.php", "Add Loan Application"), ql("loan_type_add.php", "Add Loan Type"), ql("loan_type_view.php", "View Loan Types"));
}
function show_listing()
{
    db_connect();
    #######################[ LOANS APPLICATIONS ]##########################
    $get_loans = "SELECT * FROM loan_requests ORDER BY loanamt";
    $run_loans = db_exec($get_loans) or errDie("Unable to get loan applications.");
    if (pg_numrows($run_loans) < 1) {
        $listing = "<tr class='" . bg_class() . "'><td colspan='8'>No Loan Applications Found.</td></tr>";
    } else {
        $listing = "";
        while ($larr = pg_fetch_array($run_loans)) {
            $get_emp = "SELECT fnames,sname FROM employees WHERE empnum = '{$larr['empnum']}' LIMIT 1";
            $run_emp = db_exec($get_emp) or errDie("Unable to get employee information.");
            if (pg_numrows($run_emp) < 1) {
                $showemp = "<li class='err'>Invalid Employee For Loan Selected</li>";
            } else {
                $earr = pg_fetch_array($run_emp);
                $showemp = "{$earr['fnames']} {$earr['sname']}";
            }
            $get_type = "SELECT * FROM loan_types WHERE id = '{$larr['loan_type']}' LIMIT 1";
            $run_type = db_exec($get_type) or errDie("Unable to get loan type information.");
            if (pg_numrows($run_type) < 1) {
                $showloantype = "Invalid Loan Type Selected";
            } else {
                $tarr = pg_fetch_array($run_type);
                $showloantype = $tarr['loan_type'];
            }
            $listing .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$showemp}</td>\n\t\t\t\t\t\t<td>{$larr['loanamt']}</td>\n\t\t\t\t\t\t<td>{$larr['loaninstall']}</td>\n\t\t\t\t\t\t<td>{$larr['loanint']}</td>\n\t\t\t\t\t\t<td>{$larr['loanperiod']}</td>\n\t\t\t\t\t\t<td>{$larr['loandate']}</td>\n\t\t\t\t\t\t<td>{$showloantype}</td>\n\t\t\t\t\t\t<td><a href='loan_apply_approve.php?id={$larr['id']}&deny=t'>Deny</a></td>\n\t\t\t\t\t\t<td><a href='loan_apply_approve.php?id={$larr['id']}'>Approve</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
        }
    }
    ########################################################################
    #####################[ CURRENT LOANS ]##################################
    $employees = "";
    $i = 0;
    db_connect();
    $sql = "SELECT * FROM employees WHERE gotloan='t'::bool AND div = '" . USER_DIV . "' ORDER BY sname";
    $empRslt = db_exec($sql) or errDie("Unable to select employees with loans from database.");
    if (pg_numrows($empRslt) < 1) {
        $employees .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td colspan='7'>No Employees With Loans Found.</td>\n\t\t\t\t\t</tr>";
        // 		return "No employee-loans found in database.<p>"
        // 		.mkQuickLinks(
        // 			ql("loan_apply.php", "Apply For New Loan"),
        // 			ql("../admin-employee-add.php", "Add Employee"),
        // 			ql("../admin-employee-view.php", "View Employees")
        // 		);
    } else {
        while ($myEmp = pg_fetch_array($empRslt)) {
            $totloan = sprint($myEmp['loaninstall'] * $myEmp['loanperiod']);
            $totout = sprint($myEmp['loanamt']);
            $employees .= "\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>{$myEmp['sname']}, {$myEmp['fnames']} ({$myEmp['enum']})</td>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$totloan}</td>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$totout}</td>\n\t\t\t\t\t\t\t<td align='right'>" . CUR . " {$myEmp['loaninstall']}</td>\n\t\t\t\t\t\t\t<td align='right'>{$myEmp['loanint']} %</td>\n\t\t\t\t\t\t\t<td align='right'>{$myEmp['loanperiod']} months</td>\n\t\t\t\t\t\t\t<td><a href='loan-edit.php?empnum={$myEmp['empnum']}'>Edit</a></td>\n\t\t\t\t\t\t</tr>\n";
            $i++;
        }
    }
    ########################################################################
    $display = "\n\t\t\t<h2>Summary Of Present Loans</h2>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<input type='hidden' name='key' value='input'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Employee</th>\n\t\t\t\t\t<th>Loan amount(incl interest)</th>\n\t\t\t\t\t<th>Amount outstanding</th>\n\t\t\t\t\t<th>Monthly installment</th>\n\t\t\t\t\t<th>Loan interest</th>\n\t\t\t\t\t<th>Payback period</th>\n\t\t\t\t\t<th colspan='2'>Options</th>\n\t\t\t\t</tr>\n\t\t\t\t{$employees}\n\t\t\t</table>\n\t\t\t<br><br>\n\t\t\t<h2>Current Loan Applications</h2>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Employee</th>\n\t\t\t\t\t<th>Loan Amount</th>\n\t\t\t\t\t<th>Installments</th>\n\t\t\t\t\t<th>Loan Interest Rate</th>\n\t\t\t\t\t<th>Loan Period</th>\n\t\t\t\t\t<th>Loan Date</th>\n\t\t\t\t\t<th>Loan Type</th>\n\t\t\t\t\t<th colspan='2'>Options</th>\n\t\t\t\t</tr>\n\t\t\t\t{$listing}\n\t\t\t</table><br>" . mkQuickLinks(ql("loan_apply.php", "New Loan Application"));
    return $display;
}
function display()
{
    extract($_REQUEST);
    $reports = array("acid_test", "customers_turnover", "daily_sales_in_receivables", "inventory_turnover", "days_cost_of_sales_in_inventory", "accounts_receivable_turnover", "accounts_payable_turnover", "days_cost_of_sales_in_accounts_payable", "assets_turnover", "debt_ratio", "depreciation_expense_gross_depreciable_property", "current_ratio", "working_captial", "accounts_receivable_working_capital", "inventory_working_capital", "long_term_liabilities_working_capital", "sales_working_capital", "gross_profit_turnover", "net_profit_turnover", "return_on_assets", "return_on_investment", "repairs_and_maintenance_gross_depreciation_of_property", "owners_equity", "debt_equity", "financial_leverage", "interest_net_income_excluding_interest", "operating_cycle_days");
    $not_percentage = array("daily_sales_in_receivables", "days_cost_of_sales_in_inventory", "days_cost_of_sales_in_accounts_payable", "working_capital", "operating_cycle_days");
    $i = 1;
    $reports_out = "";
    foreach ($reports as $name) {
        if ($i == 1) {
            $reports_out .= "<tr><td width='20%' valign='top'>";
        } else {
            $reports_out .= "<td width='20%' valign='top'>";
        }
        if (function_exists($name)) {
            list($description, $calculation) = call_user_func($name);
        } else {
            $description = "Not implemented.";
        }
        $calculation = sprint($calculation);
        if (!in_array($name, $not_percentage)) {
            $calculation .= "%";
        }
        $reports_out .= "\n\t\t<table " . TMPL_tblDflts . " width='100%' style='border: 1px solid #fff'>\n\t\t\t<tr><th>" . nice_name($name) . "</th></tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>\n\t\t\t\t\t<span style='font-size: 0.9em; letter-spacing: -0.065em'>\n\t\t\t\t\t\t{$description}\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr bgcolor='#ffffff'>\n\t\t\t\t<td align='center'>\n\t\t\t\t\t<span style='font-size: 1.2em; color: #f00; font-weight:bold'>\n\t\t\t\t\t\t{$calculation}\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>";
        if ($i == 5) {
            $reports_out .= "</td></tr>";
            $i = 0;
        } else {
            $reports_out .= "</td>";
        }
        $i++;
    }
    if (!isset($heart)) {
        $sql = "SELECT value FROM cubit.settings WHERE constant='HEART'";
        $heart_rslt = db_exec($sql) or errDie("Unable to retrieve heart display value.");
        $heart = pg_fetch_result($heart_rslt, 0);
    } else {
        $sql = "UPDATE cubit.settings SET value='{$heart}' WHERE constant='HEART'";
        db_exec($sql) or errDie("Unable to update heart status");
    }
    if ($heart) {
        $heart_yes = "checked";
        $heart_no = "";
    } else {
        $heart_yes = "";
        $heart_no = "checked";
    }
    $bgcolor = bgcolorg();
    $ql = mkQuickLinks(ql("ratio_settings.php", "Link Accounts to Ratios"));
    $OUTPUT = "\n\t<table cellpadding='5' cellspacing='2'>{$reports_out}</table>\n\t<center>\n\t<form method='post' action='" . SELF . "' name='form'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr><th colspan='2'>Display Heart on Main Menu</th></tr>\n\t\t<tr>\n\t\t\t<td class='" . bg_class() . "' align='center'>\n\t\t\t\tYes <input type='radio' name='heart' value='1'\n\t\t\t\tonchange='javascript:document.form.submit()' {$heart_yes} />\n\t\t\t</td>\n\t\t\t<td class='" . bg_class() . "' align='center'>\n\t\t\t\tNo <input type='radio' name='heart' value='0'\n\t\t\t\tonchange='javascript:document.form.submit()' {$heart_no} />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr><td colspan='2' align='center'>{$ql}</td></tr>\n\t</table>\n\t</form>\n\t</center>";
    return $OUTPUT;
}
Пример #15
0
function slct()
{
    extract($_GET);
    if (!isset($empnum)) {
        $msg = ", for all Employees";
        $fld = "";
    } else {
        $msg = "";
        $empnum += 0;
        $fld = "<input type='hidden' name='empnum' value='{$empnum}'>";
    }
    //layout
    $slct = "\n\t\t<h3>Print Year to Date (Payslip){$msg}<h3>\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t{$fld}\n\t\t\t<input type='hidden' name='key' value='view' />\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th colspan='5'>Date Range</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>From</td>\n\t\t\t\t<td>" . mkDateSelect("f", DATE_YEAR, DATE_MONTH, 1) . "</td>\n\t\t\t\t<td>to</td>\n\t\t\t\t<td>" . mkDateSelect("to", DATE_YEAR, DATE_MONTH, DATE_DAYS) . "</td>\n\t\t\t\t<td><input type='submit' value='View' /></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    return $slct;
}
function do_setting()
{
    extract($_GET);
    $inv_set = getCSetting("NEWINV_SETTING");
    if (isset($vol) && $vol == "yes") {
        $script = "calc-cust-credit-stockinv.php";
    } else {
        $script = "cust-credit-stockinv.php";
    }
    if ($inv_set == "no") {
        return mkQuickLinks(ql("../{$script}", "Make Another Invoice"), ql("cust-credit-stockinv-newsetting.php?change=yes", "Change Setting To Create A New Invoice After Processing One."), ql("../invoice-view.php", "View Invoices"));
    } else {
        header("Location: ../{$script}");
    }
}
function show_listing()
{
    db_connect();
    $get_list = "SELECT * FROM public_holidays ORDER BY holiday_date";
    $run_list = db_exec($get_list) or errDie("Unable to get public holiday list.");
    if (pg_numrows($run_list) < 1) {
        $listing = "<tr class='" . bg_class() . "'><td colspan='4'>No Public Holidays Have Been Added.</td></tr>";
    } else {
        $listing = "";
        while ($parr = pg_fetch_array($run_list)) {
            $listing .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$parr['holiday_name']}</td>\n\t\t\t\t\t\t<td>{$parr['holiday_type']}</td>\n\t\t\t\t\t\t<td>{$parr['holiday_date']}</td>\n\t\t\t\t\t\t<td><a href='public_holiday_rem.php?id={$parr['id']}'>Remove</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
        }
    }
    $display = "\n\t\t\t\t<h2>Public Holiday Listing</h2>\n\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Holiday Name</th>\n\t\t\t\t\t\t<th>Holiday Type</th>\n\t\t\t\t\t\t<th>Holiday Date</th>\n\t\t\t\t\t\t<th>Options</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t{$listing}\n\t\t\t\t</table><br>" . mkQuickLinks(ql("public_holiday_add.php", "Add Public Holiday"));
    return $display;
}
function show_listing()
{
    db_connect();
    $get_burs = "SELECT * FROM bursaries ORDER BY bursary_name";
    $run_burs = db_exec($get_burs) or errDie("Unable to get bursaries information.");
    if (pg_numrows($run_burs) < 1) {
        return "No bursaries found.";
    } else {
        $listing = "";
        while ($barr = pg_fetch_array($run_burs)) {
            $listing .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$barr['bursary_name']}</td>\n\t\t\t\t\t\t<td>" . nl2br($barr['bursary_details']) . "</td>\n\t\t\t\t\t\t<td><a href='bursary_type_rem.php?id={$barr['id']}'>Remove</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
        }
    }
    $display = "\n\t\t\t<h2>Bursaries View</h2>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Bursary Name</th>\n\t\t\t\t\t<th>Bursary Details</th>\n\t\t\t\t\t<th>Options</th>\n\t\t\t\t</tr>\n\t\t\t\t{$listing}\n\t\t\t</table><br>" . mkQuickLinks(ql("bursary_type_add.php", "Add Bursary"), ql("bursary_type_view.php", "View Bursaries"));
    return $display;
}
function show_listing()
{
    db_connect();
    $get_loans = "SELECT * FROM loan_types ORDER BY loan_type";
    $run_loans = db_exec($get_loans) or errDie("Unable to get loan types information");
    if (pg_numrows($run_loans) < 1) {
        $listing = "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='2'>No Entries Were Found.</td>\n\t\t\t\t</tr>\n\t\t\t";
    } else {
        $listing = "";
        while ($larr = pg_fetch_array($run_loans)) {
            $listing .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$larr['loan_type']}</td>\n\t\t\t\t\t\t<td><a href='loan_type_rem.php?id={$larr['id']}'>Remove</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
        }
    }
    $display = "\n\t\t\t<h2>Loan Types Listing</h2>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Loan Type</th>\n\t\t\t\t\t<th>Options</th>\n\t\t\t\t</tr>\n\t\t\t\t{$listing}\n\t\t\t</table><br>" . mkQuickLinks(ql("loan_type_add.php", "Add Loan Type"), ql("loan_type_view.php", "View Loan Types"));
    return $display;
}
function printSalesp()
{
    $OUT = "\n    <h3>Sales People</h3>\n    <table " . TMPL_tblDflts . ">\n    <tr>\n    \t<th>Number</th>\n    \t<th>Sales Person</th>\n    \t<th>Commission</th>\n    </tr>";
    $sp = qrySalesPerson();
    while ($salesp = $sp->fetch_array()) {
        $bgColor = bgcolorg();
        if ($salesp["com"] != 0) {
            $com_disp = "{$salesp['com']} %";
        } else {
            $com_disp = "Using Commission Set Under Stock Settings";
        }
        $OUT .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$salesp['salespno']}</td>\n\t\t\t<td>{$salesp['salesp']}</td>\n\t\t\t<td>{$com_disp}</td>\n\t\t\t<td><a href='salesp-edit.php?salespid={$salesp['salespid']}'>Edit</a></td>\n\t\t\t<td><a href='salesp-rem.php?salespid={$salesp['salespid']}'>Remove</a></td>\n\t\t</tr>";
    }
    $OUT .= "\n\t</table>\n\t<br />";
    $OUT .= mkQuickLinks(ql("salesp-add.php", "Add Sales Person"));
    return $OUT;
}
function get_supplier()
{
    db_connect();
    $get_supp = "SELECT * FROM suppliers ORDER BY supname";
    $run_supp = db_exec($get_supp) or errDie("Unable to get suppliers information.");
    if (pg_numrows($run_supp) < 1) {
        return "\n\t\t\t\t\t<li class='err'>No Suppliers Could Be Found.</li>" . mkQuickLinks(ql("../core/trans-new.php", "Journal Transactions"), ql("../cupp-new.php", "New Supplier"), ql("../supp-view.php", "View Suppliers"));
    } else {
        $supplier_drop = "<select name='supid'>";
        while ($sarr = pg_fetch_array($run_supp)) {
            $supplier_drop .= "<option value='{$sarr['supid']}'>{$sarr['supname']}</option>";
        }
        $supplier_drop .= "</select>";
    }
    $display = "\n\t\t\t\t\t<h2>Select Creditor</h2>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<form action='" . SELF . "' method='GET'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Supplier</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>{$supplier_drop}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><input type='submit' value='Next'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</form>\n\t\t\t\t\t</table>\n\t\t\t\t";
    return $display;
}
function edit($errors = "")
{
    extract($_REQUEST);
    $sql = "\n\tSELECT id, whname, stkcod, stkdes, description, qty, unitcost\n\tFROM cubit.inv_items\n\t\tLEFT JOIN cubit.stock ON inv_items.stkid=stock.stkid\n\t\tLEFT JOIN exten.warehouses ON stock.whid=warehouses.whid\n\tWHERE invid='{$invid}'";
    $items_rslt = db_exec($sql) or errDie("Unable to retrieve items.");
    $items_out = "";
    while ($items_data = pg_fetch_array($items_rslt)) {
        if (!empty($items_data["description"])) {
            $description = "{$items_data['description']}";
        } else {
            $description = "({$items_data['stkcod']}) {$items_data['stkdes']}";
        }
        $items_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$items_data['whname']}</td>\n\t\t\t<td>{$description}</td>\n\t\t\t<td>{$items_data['qty']}</td>\n\t\t\t<td>\n\t\t\t\t<input type='text' name='unitprices[{$items_data['id']}]'\n\t\t\t\tvalue='{$items_data['unitcost']}' style='text-align: right' />\n\t\t\t</td>\n\t\t</tr>";
    }
    $OUTPUT = "\n\t<h3>Edit Invoice Prices</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<input type='hidden' name='key' value='write' />\n\t<input type='hidden' name='invid' value='{$invid}' />\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<td colspan='3'>{$errors}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th>Store</th>\n\t\t\t<th>Stock</th>\n\t\t\t<th>Qty</th>\n\t\t\t<th>Cost Per Unit</th>\n\t\t</tr>\n\t\t{$items_out}\n\t\t<tr>\n\t\t\t<td colspan='4' align='center'>\n\t\t\t\t<input type='submit' value='Update' />\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t</form>";
    $OUTPUT .= mkQuickLinks(ql("cust-credit-stockinv-no-neg.php?invid={$invid}&cont=true", "Continue Invoice"), ql(SELF, "Edit Invoice Prices"));
    return $OUTPUT;
}
Пример #23
0
function slctemp()
{
    extract($_GET);
    db_connect();
    $sql = "SELECT enum as empnum,empnum as e, sname, fnames FROM employees WHERE div = '" . USER_DIV . "' ORDER BY sname";
    $empRslt = db_exec($sql) or errDie("Unable to select employees from database.");
    if (pg_numrows($empRslt) < 1) {
        return "No employees found in database.<p>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    }
    $employees = "<select size='1' name='empnum'>\n";
    while ($myEmp = pg_fetch_array($empRslt)) {
        $employees .= "<option value='{$myEmp['e']}'>{$myEmp['sname']}, {$myEmp['fnames']} ({$myEmp['empnum']})</option>\n";
    }
    $employees .= "</select>";
    //layout
    $slct = "\n\t\t<h3>Select Employee for IRP5<h3>\n\t\t<form action='" . SELF . "' method='post' name='form'>\n\t\t\t<input type='hidden' name='key' value='slct' />\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th colspan='5'>Select Employee</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$employees}\n\t\t\t\t<td><input type='submit' value='Configure IRP5 for Printing' /></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    return $slct;
}
function printComp()
{
    $OUT = "\n    <h3>View Companies</h3>\n    <table " . TMPL_tblDflts . ">\n    <tr>\n    \t<th>Company Code</th>\n    \t<th>Company Name</th>\n    \t<th>Status</th>\n    \t<th>Options</th>\n    </tr>";
    $qry = new dbSelect("companies", DB_MCUBIT, grp(m("order", "name ASC")));
    $qry->run();
    $i = 0;
    while ($comp = $qry->fetch_array()) {
        $bgcolor = bgcolor($i);
        $status = ucfirst($comp["status"]);
        $OUT .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$comp['code']}</td>\n\t\t\t<td>{$comp['name']}</td>\n\t\t\t<td>{$status}</td>";
        if ($comp["status"] == "removed") {
            $OUT .= "\n\t\t\t<td><a href='company-rem.php?key=recover&code={$comp['code']}'>Recover</a></td>";
        }
        $OUT .= "\n\t\t\t<td><a href='company-rem.php?key=confirm&perm=t&code={$comp['code']}'>" . ($comp["status"] == "removed" ? "Remove Permanently (CAN NOT BE RECOVERED)" : "Remove") . "</a></td>\n\t\t</tr>";
    }
    $OUT .= "\n\t</table>" . mkQuickLinks(ql("company-new.php", "Add New Company"));
    return $OUT;
}
function viewEmp()
{
    db_connect();
    # Get employees from db
    $employees = "";
    $i = 0;
    $sql = "SELECT * FROM lemployees WHERE div = '" . USER_DIV . "' ORDER BY sname,fnames";
    $empRslt = db_exec($sql) or errDie("Unable to select employees from database.");
    if (pg_numrows($empRslt) < 1) {
        return "No Past Employees Found.<p>" . mkQuickLinks(ql("admin-employee-add.php", "Add Employee"));
    }
    while ($myEmp = pg_fetch_array($empRslt)) {
        $employees .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$myEmp['empnum']}</td>\n\t\t\t\t<td>{$myEmp['fnames']}</td>\n\t\t\t\t<td>{$myEmp['sname']}</td>\n\t\t\t\t<td>{$myEmp['leavereason']}</td>\n\t\t\t\t<td>{$myEmp['leavedate']}</td>\n\t\t\t\t<td><a href='admin-lemployee-detail.php?empnum={$myEmp['empnum']}'>Details</a></td>\n\t\t\t\t<td><a target=_blank href='salwages/irp5-data.php?empnum={$myEmp['empnum']}'>Year to Date</a></td>\n\t\t\t\t<td><a href=# onClick=openwindowbg('docman/doc-view-type.php?xin={$myEmp['enum']}&type=empl');>View Documents</a></td>\n\t\t\t</tr>";
        $i++;
    }
    # Set up table & form
    $enterEmp = "\n\t\t<h3>Employees</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Nr.</th>\n\t\t\t\t<th>First names</th>\n\t\t\t\t<th>Last name</th>\n\t\t\t\t<th>Reason for Leaving</th>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th colspan='3'>Options</th>\n\t\t\t</tr>\n\t\t\t{$employees}\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='8'>Total: {$i}</td>\n\t\t\t</tr>\n\t\t</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"));
    return $enterEmp;
}
function printSord()
{
    # Set up table to display in
    $printSord = "\n        <h3>View Canceled Sales Orders</h3>\n        <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n        <tr>\n        \t<th>Department</th>\n        \t<th>Sales Person</th>\n        \t<th>Sales Order No.</th>\n        \t<th>Sales Order Date</th>\n        \t<th>Customer Name</th>\n        \t<th>Order No</th>\n        \t<th>Grand Total</th>\n        \t<th colspan=6>Options</th>\n        </tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM cancelled_sord WHERE div = '" . USER_DIV . "' ORDER BY sordid DESC";
    $sordRslt = db_exec($sql) or errDie("Unable to retrieve Sales Orders from database.");
    if (pg_numrows($sordRslt) < 1) {
        $printSord = "<li>No Sales Orders.";
    } else {
        while ($sord = pg_fetch_array($sordRslt)) {
            # format date
            $sord['odate'] = explode("-", $sord['odate']);
            $sord['odate'] = $sord['odate'][2] . "-" . $sord['odate'][1] . "-" . $sord['odate'][0];
            $det = "sorder-cancel-details.php";
            $cancel = "sorder-cancel.php";
            $accept = "sorder-accept.php";
            $print = "sorder-print.php";
            $edit = "sorder-new.php";
            if ($sord['location'] == 'int') {
                $det = "intsorder-details.php";
                $cancel = "intsorder-cancel.php";
                $accept = "intsorder-accept.php";
                $print = "intsorder-print.php";
                $edit = "intsorder-new.php";
            }
            $sp4 = "&nbsp;&nbsp;&nbsp;&nbsp;";
            $bcurr = CUR;
            if ($sord['location'] == 'int') {
                $bcurr = $sord['currency'];
            }
            $printSord .= "<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>{$sord['deptname']}</td>\n\t\t\t\t\t<td>{$sord['salespn']}</td>\n\t\t\t\t\t<td>{$sord['sordid']}</td>\n\t\t\t\t\t<td align=center>{$sord['odate']}</td>\n\t\t\t\t\t<td>{$sord['cusname']} {$sord['surname']}</td>\n\t\t\t\t\t<td align=right>{$sord['ordno']}</td>\n\t\t\t\t\t<td align=right>{$bcurr} {$sord['total']}</td>\n\t\t\t\t\t<td><a href='{$det}?sordid={$sord['sordid']}'>Details</a></td>\n\t\t\t\t\t<td><a href='sorder-cancel-print.php?invid={$sord['sordid']}'>Print</a></td>";
            $i++;
        }
    }
    // Layout
    $printSord .= "</table>" . mkQuickLinks(ql("sorder-unf-view.php", "View Incomplete Sales Orders"), ql("sorder-new.php", "New Sales Order"), ql("customers-new.php", "New Customer"));
    return $printSord;
}
Пример #27
0
function viewLoans()
{
    # select employees with loans
    $employees = "";
    $i = 0;
    db_connect();
    $sql = "SELECT * FROM employees WHERE gotloan='t'::bool AND div = '" . USER_DIV . "' ORDER BY sname";
    $empRslt = db_exec($sql) or errDie("Unable to select employees with loans from database.");
    if (pg_numrows($empRslt) < 1) {
        return "No employee-loans found in database.<p>" . mkQuickLinks(ql("loan-add.php", "Add New Loan"), ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    }
    while ($myEmp = pg_fetch_array($empRslt)) {
        $totloan = sprint($myEmp['loaninstall'] * $myEmp['loanperiod']);
        $totout = sprint($myEmp['loanamt']);
        $employees .= "<tr class='" . bg_class() . "'><td>{$myEmp['sname']}, {$myEmp['fnames']} ({$myEmp['empnum']})</td><td align=right>" . CUR . " {$totloan}</td><td align=right>" . CUR . " {$totout}</td><td align=right>" . CUR . " {$myEmp['loaninstall']}</td><td align=right>{$myEmp['loanint']} %</td><td align=right>{$myEmp['loanperiod']} months</td><td><a href='loan-edit.php?empnum={$myEmp['empnum']}'>Edit</a></td></tr>\n";
        $i++;
    }
    $viewLoans = "\n<h3>View current employee loans</h3>\n\n<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n<input type=hidden name=key value=input>\n<tr><th>Employee</th><th>Loan amount(incl interest)</th><th>Amount outstanding</th><th>Monthly installment</th><th>Loan interest</th><th>Payback period</th></tr>\n{$employees}\n</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    return $viewLoans;
}
Пример #28
0
function showPaye()
{
    # connect to db
    db_connect();
    # start table, etc
    $showPaye = "<h3>View PAYE brackets</h3>\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th>Minimum gross</th><th>Maximum gross</th><th>Percentage</th><th>Exstra Amount</th></tr>";
    # select jobs
    $i = 0;
    $sql = "SELECT * FROM paye ORDER BY min, max";
    $payeRslt = db_exec($sql) or errDie("Unable to select PAYE brackets from database.", SELF);
    if (pg_numrows($payeRslt) > 0) {
        while ($myPaye = pg_fetch_array($payeRslt)) {
            $showPaye .= "<tr class='" . bg_class() . "'><td align=right>" . CUR . " {$myPaye['min']}</td><td align=right>" . CUR . " {$myPaye['max']}</td><td align=right>{$myPaye['percentage']}%</td><td align=right>" . CUR . " {$myPaye['extra']}</td></tr>\n";
            $i++;
        }
    } else {
        return "No PAYE brackets found in database.";
    }
    $showPaye .= "</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    return $showPaye;
}
function viewEmp($empnum)
{
    if (empty($empnum)) {
        return "Employee number missing.{$empnum}";
    }
    $empnum = preg_replace("/[^\\w\\s-]/", "", substr($empnum, 0, 20));
    # connect to db
    db_connect();
    # get employee info to edit
    $sql = "SELECT * FROM employees WHERE empnum='{$empnum}' AND div = '" . USER_DIV . "'";
    $empRslt = db_exec($sql) or errDie("Unable to select employee info from database.");
    if (pg_numrows($empRslt) < 1) {
        return "Invalid clock number.";
    }
    $myEmpl = pg_fetch_array($empRslt);
    if ($myEmpl['resident'] == "t") {
        $myEmpl['resident'] = "Yes";
    } else {
        $myEmpl['resident'] = "No";
    }
    if ($myEmpl['sex'] == "M") {
        $myEmpl['sex'] = "Male";
    } else {
        $myEmpl['sex'] = "Female";
    }
    # Set up table & form
    //$logoimage = "<br><img src='salwages/employee-view-image.php?id=$myEmpl[empnum]' width=230 height=47><br><br>";
    //$image="employee-view-image.php?id=$myEmpl[empnum]";
    //print $logoimage;
    db_conn('cubit');
    $Sl = "SELECT * FROM eimgs WHERE emp='{$myEmpl['empnum']}'";
    $Ry = db_exec($Sl) or errDie("Unable to get emp image.");
    if (pg_numrows($Ry) > 0) {
        $img = "<img src='employee-view-image.php?id={$myEmpl['empnum']}' width=300 height=300>";
    } else {
        $img = "To add a photo for this employee, use '<a href='admin-employee-edit.php?empnum={$myEmpl['empnum']}'>Edit Employee</a>'";
    }
    $viewEmp = "\n\t<h3>Employee Details</h3>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><td valign=top><table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th colspan=2>Employee Details</th></tr>\n\t<tr class='bg-odd'><td>Emp Num</td><td>{$myEmpl['enum']}</td></tr>\n\t<tr class='bg-even'><td>Surname</td><td valign=center>{$myEmpl['sname']}</td></tr>\n\t<tr class='bg-odd'><td>First Names</td><td valign=center>{$myEmpl['fnames']}</td></tr>\n\t<tr class='bg-even'><td>Sex</td><td valign=center>{$myEmpl['sex']}</td></tr>\n\t<tr class='bg-odd'><td>Race</td><td>{$myEmpl['race']}</td></tr>\n\t<tr class='bg-even'><td>Disabled Status</td><td>{$myEmpl['disabled_stat']}</td></tr>\n\t<tr class='bg-odd'><td>Marital Status</td><td valign=center>{$myEmpl['marital']}</td></tr>\n\t<tr class='bg-even'><td>Resident</td><td valign=center>{$myEmpl['resident']}</td></tr>\n\t<tr class='bg-odd'><td>Nature</td><td valign=center>{$myEmpl['nature']}</td></tr>\n\t<tr class='bg-even'><td>Company/CC/Trust number</td><td valign=center>{$myEmpl['cc_number']}</td></tr>\n\t<tr class='bg-odd'><td>Income Tax number</td><td valign=center>{$myEmpl['tax_number']}</td></tr>\n\t<tr class='bg-odd'><td>Hire Date</td><td valign=center>{$myEmpl['hiredate']}</td></tr>\n\t<tr class='bg-even'><td>Telephone No</td><td valign=center>{$myEmpl['telno']}</td></tr>\n\t<tr class='bg-odd'><td>E-mail</td><td valign=center>{$myEmpl['email']}</td></tr>\n\t<tr class='bg-even'><td>Basic Salary</td><td valign=center>" . CUR . " {$myEmpl['basic_sal']}</td></tr>\n\t<tr class='bg-odd'><td>Pay Type</td><td valign=center>{$myEmpl['paytype']}</td></tr>\n\t<tr class='bg-even'><td>Bank Name</td><td valign=center>{$myEmpl['bankname']}</td></tr>\n\t<tr class='bg-odd'><td>Branch Code</td><td valign=center>{$myEmpl['bankcode']}</td></tr>\n\t<tr class='bg-even'><td>Bank Account Type</td><td valign=center>{$myEmpl['bankacctype']}</td></tr>\n\t<tr class='bg-odd'><td>Bank Account No</td><td valign=center>{$myEmpl['bankaccno']}</td></tr>\n\t</table></td>\n\t<td valign=top><table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n        <tr><th colspan=2>Employee Details</th></tr>\n\t<tr class='bg-odd'><td>Designation (Job Title)</td><td>{$myEmpl['designation']}</td></tr>\n\t<tr class='bg-even'><td>Department</td><td>{$myEmpl['department']}</td></tr>\n\t<tr class='bg-odd'><td>Occupational Category</td><td>{$myEmpl['occ_cat']}</td></tr>\n\t<tr class='bg-even'><td>Occupational Level</td><td>{$myEmpl['occ_level']}</td></tr>\n\t<tr class='bg-odd'><td>This Position Filled</td><td>{$myEmpl['pos_filled']}</td></tr>\n\t<tr class='bg-even'><td>Temporary (Employee or Contract)</td><td>{$myEmpl['temporary']}</td></tr>\n\t<tr class='bg-odd'><td>If Temporary: Termination Date</td><td>{$myEmpl['termination_date']}</td></tr>\n\t<tr class='bg-even'><td>Recruitment From</td><td>{$myEmpl['recruitment_from']}</td></tr>\n\t<tr class='bg-odd'><td>Reason for Employment</td><td>{$myEmpl['employment_reason']}</td></tr>\n\t<tr class='bg-even'><td>Union Name</td><td>{$myEmpl['union_name']}</td></tr>\n\t<tr class='bg-odd'><td>Union Membership Number</td><td>{$myEmpl['union_mem_num']}</td></tr>\n\t<tr class='bg-even'><td>Union Position</td><td>{$myEmpl['union_pos']}</td></tr>\n\t<tr class='bg-odd'><td>ID Num</td><td>{$myEmpl['idnum']}</td></tr>\n\t<tr class='bg-even'><td>Passport Num</td><td>{$myEmpl['passportnum']}</td></tr>\n\t<tr class='bg-odd'><td>Income Tax Ref No.</td><td>{$myEmpl['taxref']}</td></tr>\n\t<tr class='bg-even'><td>Residential Address</td><td valign=center>{$myEmpl['res1']}</td></tr>\n\t<tr class='bg-odd'><td><br></td><td valign=center>{$myEmpl['res2']}</td></tr>\n\t<tr class='bg-even'><td><br></td><td valign=center>{$myEmpl['res3']}</td></tr>\n\t<tr class='bg-odd'><td><br></td><td valign=center>{$myEmpl['res4']}</td></tr>\n\t<tr class='bg-even'><td>Postal Address</td><td valign=center>{$myEmpl['pos1']}</td></tr>\n\t<tr class='bg-odd'><td><br></td><td valign=center>{$myEmpl['pos2']}</td></tr>\n\t<tr class='bg-even'><td>Postal Code</td><td valign=center>{$myEmpl['pcode']}</td></tr>\n\t<tr><th colspan=2>Friend Not Living With Employee</th></tr>\n\t<tr class='bg-odd'><td>Surname</td><td valign=center>{$myEmpl['contsname']}</td></tr>\n\t<tr class='bg-even'><td>First Names</td><td valign=center>{$myEmpl['contfnames']}</td></tr>\n\t<tr class='bg-odd'><td>Residential Address</td><td valign=center>{$myEmpl['contres1']}</td></tr>\n\t<tr class='bg-even'><td><br></td><td valign=center>{$myEmpl['contres2']}</td></tr>\n\t<tr class='bg-odd'><td><br></td><td valign=center>{$myEmpl['contres3']}</td></tr>\n\t<tr class='bg-even'><td>Telephone No</td><td valign=center>{$myEmpl['conttelno']}</td></tr>\n\t</table></td>\n\t<td valign=top><table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th>Employee Photo</th></tr>\n\t<tr><td>{$img}</td></tr>\n\t</table>\n\t</td>\n\t</tr>\n\t</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    return $viewEmp;
}
function sel_sup()
{
    global $_POST;
    extract($_POST);
    if (!isset($supid)) {
        $supid = 0;
    }
    // suppliers Drop down selections
    db_connect();
    $sql = "SELECT * FROM suppliers WHERE div = '" . USER_DIV . "' AND location = 'loc' ORDER BY supname,supno";
    $supRslt = db_exec($sql);
    if (pg_numrows($supRslt) < 1) {
        return "\n\t\t\t\t\t<li> There are no Creditors in Cubit.</li>\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>Quick Links</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><a href='bank-pay-supp.php'>Add supplier payment</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";
    }
    //				<input type='hidden' size='5' name='pur' value=''>
    //				<input type='hidden' size='5' name='inv' value=''>
    // layout
    $add = "\n\t\t\t<h3>New Bank Payment</h3>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t\t<input type='hidden' name='key' value='method'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Select Amount Of Payments</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'><input type='text' name='rec_amount' size='3'></td>\n\t\t\t\t</tr>\n\t\t\t\t" . TBL_BR . "\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><input type='submit' value='Enter Details &raquo;'></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t</table>";
    # main table (layout with menu)
    $OUTPUT = "\n\t\t\t\t\t<center>\n\t\t\t\t\t<table width='100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='65%' align='left'>{$add}</td>\n\t\t\t\t\t\t\t<td valign='top' align='center'>" . mkQuickLinks(ql("bank-pay-supp.php", "Add Supplier Payment")) . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>";
    return $OUTPUT;
}