本文整理汇总了PHP中ql函数的典型用法代码示例。如果您正苦于以下问题:PHP ql函数的具体用法?PHP ql怎么用?PHP ql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printGrp
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;
}
示例2: edit
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 »'></td></tr>\n\t</table></form>" . mkQuickLinks(ql("salesp-add.php", "Add Sales Person"), ql("salesp-view.php", "View Sales People"));
return $enter;
}
示例3: viewEmp
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;
}
示例4: viewDeducts
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;
}
示例5: view
function view()
{
extract($_GET);
require_lib("validate");
$v = new validate();
$v->isOk($empnum, "num", 1, 20, "Invalid employee number.");
$v->isOk($id, "num", 1, 20, "Invalid payslip number.");
if ($v->isError()) {
$confirmCust = $v->genErrors() . "<br><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
if (($emp = qryEmployee($empnum, "*")) === false) {
$emp = qryLEmployee($empnum, "*");
}
if (isset($rev)) {
$tbl = "salr";
} else {
$tbl = "salpaid";
}
$sql = "SELECT * FROM cubit.{$tbl} WHERE empnum='{$empnum}' AND id = '{$id}' AND div = '" . USER_DIV . "'";
$rslt = db_exec($sql) or errDie("Unable to read employee salary details from Cubit.");
if (pg_numrows($rslt) < 1) {
return "<li>Employee payment not found.</li>";
}
$pay = pg_fetch_array($rslt);
# Calculate gross salary from nettpay
$gross = $pay['salary'] - $pay['totallow'] - $pay['comm'] + $pay['totded'] + $pay['uif'] + $pay['paye'] + $pay['loanins'];
vsprint($gross);
# Layout
$slip = "\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<td align='right'><font size='3' color='white'><b>Employee: </b></font></td>\n\t\t<td align='left'><b>{$emp['empnum']}</b></td>\n\t\t<td align='right'><font size='3' color='white'><b>Name: </b></font></td>\n\t\t<td align='left'><b>{$emp['fnames']}</b></td>\n\t\t<td align='right'><font size='3' color='white'><b>Surname: </b></font></td>\n\t\t<td align='left'><b>{$emp['sname']}</b></td>\n\t</tr>\n\t" . TBL_BR . "\n\t</table>\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th>Description</th>\n\t\t<th>Amount</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Gross Basic salary</td>\n\t\t<td align='center'>" . CUR . " {$gross}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Commission</td>\n\t\t<td align='center'>" . CUR . " {$pay['comm']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Low or interest-free loan</td>\n\t\t<td align='center'>" . CUR . " {$pay['loanins']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Interest rate charged by company</td>\n\t\t<td align='center'>{$emp['loanint']} %</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Deductions</td>\n\t\t<td align='center'>" . CUR . " {$pay['totded']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>UIF</td>\n\t\t<td align='center'>" . CUR . " {$pay['uif']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>PAYE</td>\n\t\t<td align='center'>" . CUR . " {$pay['paye']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Allowances</td>\n\t\t<td align='center'>" . CUR . " {$pay['totallow']}</td>\n\t</tr>\n\t" . TBL_BR . "\n\t<tr class='" . bg_class() . "'>\n\t\t<td><h3>Nett Income</h3></td>\n\t\t<td align='center'><b>" . CUR . " {$pay['salary']}</b></td>\n\t</tr>\n\t</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"));
return $slip;
}
示例6: Emplea
function Emplea($_GET)
{
# Get vars
extract($_GET);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($empnum, "num", 1, 20, "Invalid employee number.");
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "-" . $e["msg"] . "<br>";
}
$confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# Connect to db
db_connect();
# Get employee info to edit
$sql = "SELECT * FROM employees WHERE empnum='{$empnum}'";
$empRslt = db_exec($sql) or errDie("Unable to select employee info from database.");
if (pg_numrows($empRslt) < 1) {
return "Invalid employee number.";
}
$emp = pg_fetch_array($empRslt);
# Get the arrays
$lvac = getLeave($empnum, "leave_vac");
$lsick = getLeave($empnum, "leave_sick");
$lstudy = getLeave($empnum, "leave_study");
$lea = "\n\t\t<h3>Employee Leave Available</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Employee</td>\n\t\t\t\t<td align='center'>{$emp['sname']}, {$emp['fnames']} ({$emp['enum']})</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Paid Vacation Leave</td>\n\t\t\t\t<td align='center'>{$lvac['1']} days</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Paid Sick Leave</td>\n\t\t\t\t<td align='center'>{$lsick['1']} days</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Paid Study Leave</td>\n\t\t\t\t<td align='center'>{$lstudy['1']} days</td>\n\t\t\t</tr>\n\t\t<table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
return $lea;
}
示例7: confirm_details
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;
}
示例8: 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;
}
示例9: write_burs
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"));
}
示例10: write_burs
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"));
}
示例11: write_loan
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"));
}
示例12: write_loan
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"));
}
示例13: show_listing
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;
}
示例14: 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: slct
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;
}