本文整理汇总了PHP中core_connect函数的典型用法代码示例。如果您正苦于以下问题:PHP core_connect函数的具体用法?PHP core_connect怎么用?PHP core_connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了core_connect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: slctAcc
function slctAcc()
{
// Layout
$slctAcc = "\n\t\t\t<h3>Select Account</h3>\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='viewtran'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Field</th>\n\t\t\t\t\t<th>Value</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Account Name</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<select name='accid'>";
core_connect();
$sql = "SELECT * FROM accounts WHERE div = '" . USER_DIV . "' ORDER BY accname ASC";
$accRslt = db_exec($sql) or errDie("Could not retrieve Categories Information from the Database.", SELF);
if (pg_numrows($accRslt) < 1) {
return "<li class='err'> There are no Accounts in Cubit.</li>";
}
while ($acc = pg_fetch_array($accRslt)) {
$slctAcc .= "<option value='{$acc['accid']}'>{$acc['accname']}</option>";
}
$slctAcc .= "\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td><input type='submit' name='details' value='View Transactions'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='3'><br></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Account Number</td>\n\t\t\t\t\t<td><input type='text' name='topacc' size='3' maxlength='3'> / <input type='text' name='accnum' size='3' maxlength='3'></td>\n\t\t\t\t\t<td><input type='submit' value='View Transactions'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Select Period</td>\n\t\t\t\t\t<td valign='center' colspan='3'>\n\t\t\t\t\t\t<select name='prd'>";
db_conn(YR_DB);
$sql = "SELECT * FROM info WHERE prdname !=''";
$prdRslt = db_exec($sql);
if (pg_numrows($prdRslt) < 1) {
return "<li class='err'>ERROR : There are no periods set for the current year</li>";
}
while ($prd = pg_fetch_array($prdRslt)) {
if ($prd['prddb'] == PRD_DB) {
$sel = "selected";
} else {
$sel = "";
}
$slctAcc .= "<option value='{$prd['prddb']}' {$sel}>{$prd['prdname']}</option>";
}
$slctAcc .= "\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='center'><input type='button' value='« Back' onClick='javascript:history.back()'></td>\n\t\t\t\t</tr>\n\t\t</form>\n\t\t</table>\n\t\t<table " . TMPL_tblDflts . " width='100'>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
return $slctAcc;
}
示例2: printBran
function printBran()
{
# Set up table to display in
$printBran = "\r\n <h3>View Branches</h3>\r\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n <tr><th>Branch Code</th><th>Branch Name</th><th>Details</th><th colspan=2>Options</th></tr>";
# connect to database
db_connect();
# Query server
$i = 0;
$sql = "SELECT * FROM branches ORDER BY branname ASC";
$branRslt = db_exec($sql) or errDie("Unable to retrieve branches from database.");
if (pg_numrows($branRslt) < 1) {
return "<li>There are no branches in Cubit.";
}
while ($bran = pg_fetch_array($branRslt)) {
$printBran .= "<tr class='" . bg_class() . "'><td>{$bran['brancod']}</td><td align=center>{$bran['branname']}</td><td>{$bran['brandet']}</td><td><a href='admin-branedit.php?div={$bran['div']}'>Edit</a></td>";
core_connect();
$sql = "SELECT accid FROM accounts WHERE div = '{$bran['div']}' AND accnum != '999'";
$cRslt = db_exec($sql) or errDie("Unable to retrieve branches from database.");
if (pg_numrows($cRslt) < 1) {
$printBran .= "<td><a href='admin-branrem.php?div={$bran['div']}'>Remove</a></td>";
} else {
$printBran .= "<td><br></td></tr>";
}
$printBran .= "</tr>";
$i++;
}
$printBran .= "</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='admin-branadd.php'>Add Branch</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
return $printBran;
}
示例3: bal
function bal($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid Cash Flow Statement number.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to core DB
core_connect();
# get the Trial Balance
$cf = new dbSelect("save_cashflow", "core", grp(m("cols", "output, date_trunc('day', gentime) as gentime"), m("where", "id='{$id}'")));
$cf->run();
if ($cf->num_rows() < 1) {
return "<center><li> Invalid Cash Flow Statement Number.</li></center>";
}
$stmnt = $cf->fetch_array();
$OUTPUT = base64_decode($stmnt['output']);
if (isset($_GET["xls"])) {
$cftime = preg_replace("/ 00:00.*/", "", $stmnt["gentime"]);
require_lib("xls");
Stream("cashflow-{$cftime}", $OUTPUT);
} else {
require "../tmpl-print.php";
}
}
示例4: enterAllow
function enterAllow($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid reimbursement ID.");
# display errors, if any
if ($v->isError()) {
$confirmCust = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirmCust .= "<li class=err>" . $e["msg"];
}
$confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
# get deduction info
db_connect();
$sql = "SELECT * FROM rbs WHERE id='{$id}' AND div = '" . USER_DIV . "'";
$allowRslt = db_exec($sql) or errDie("Unable to select allowance info from database.");
if (pg_numrows($allowRslt) < 1) {
return "Invalid reimbursement ID.";
}
$myAllow = pg_fetch_array($allowRslt);
# get ledger account name
core_connect();
$sql = "SELECT accname FROM accounts WHERE accid = '{$myAllow['account']}' AND div = '" . USER_DIV . "'";
$accRslt = db_exec($sql);
$acc = pg_fetch_array($accRslt);
$enterAllow = "<h3>Edit reimbursement</h3>\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<form action='" . SELF . "' method=post>\n\t<input type=hidden name=key value=confirm>\n\t<input type=hidden name=id value='{$id}'>\n\t<tr><th>Field</th><th>Value</th></tr>\n\t<tr class='bg-odd'><td>Name of reimbursement</td><td align=center><input type=text size=20 name=name value='{$myAllow['name']}'></td></tr>\n\t<tr class='bg-even'><td>Account</td><td align=center>{$acc['accname']}</td></tr>\n\t<tr><td colspan=2 align=right><input type=submit value='Confirm »'></td></tr>\n\t</form>\n\t</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
return $enterAllow;
}
示例5: inc
function inc($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid Income Statement number.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to core DB
core_connect();
# get the income statement
$sql = "SELECT * FROM save_income_stmnt WHERE id = '{$id}' AND div = '" . USER_DIV . "'";
$incRslt = db_exec($sql) or errDie("Unable to retrieve income statement from the Database", SELF);
if (pg_numrows($incRslt) < 1) {
return "<center><li> Invalid Income Statement Number.";
}
$inc = pg_fetch_array($incRslt);
$income = base64_decode($inc['output']);
$OUTPUT = $income;
require "../tmpl-print.php";
}
示例6: printDept
function printDept()
{
# Set up table to display in
$printDept = "\r\n <h3>Departments</h3>\r\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n <tr><th>Dept No</th><th>Department</th><th>Income Account</th><th>Debtors Control Account</th><th>Creditors Control Account</th></tr>";
# connect to database
db_conn("exten");
# Query server
$i = 0;
$sql = "SELECT * FROM departments WHERE div = '" . USER_DIV . "' ORDER BY deptname ASC";
$deptRslt = db_exec($sql) or errDie("Unable to retrieve Departments from database.");
if (pg_numrows($deptRslt) < 1) {
return "<li>There are no Departments in Cubit.";
}
while ($dept = pg_fetch_array($deptRslt)) {
# get ledger account name
core_connect();
$sql = "SELECT accname FROM accounts WHERE accid = '{$dept['incacc']}' AND div = '" . USER_DIV . "'";
$accRslt = db_exec($sql);
$accinc = pg_fetch_array($accRslt);
# get debtors account name
$sql = "SELECT accname FROM accounts WHERE accid = '{$dept['debtacc']}' AND div = '" . USER_DIV . "'";
$accRslt = db_exec($sql);
$accdebt = pg_fetch_array($accRslt);
# get creditors account name
$sql = "SELECT accname FROM accounts WHERE accid = '{$dept['credacc']}' AND div = '" . USER_DIV . "'";
$accRslt = db_exec($sql);
$acccred = pg_fetch_array($accRslt);
$printDept .= "<tr class='" . bg_class() . "'><td>{$dept['deptno']}</td><td>{$dept['deptname']}</td><td>{$accinc['accname']}</td><td>{$accdebt['accname']}</td><td>{$acccred['accname']}</td><td><a href='dept-edit.php?deptid={$dept['deptid']}'>Edit</a></td>";
$printDept .= "<td><a href='dept-rem.php?deptid={$dept['deptid']}'>Remove</a></td></tr>";
$i++;
}
$printDept .= "</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='dept-add.php'>Add Department</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>";
return $printDept;
}
示例7: view
function view()
{
$view = "<center><table width=90%>\n <tr><td width=80%><h3>View Returned Purchases</h3></td>\n <td class='bg-even'><a href='purchase-new.php'>Add New Purchase</a><br>\n <a href='purchase-ret.php'>Return Purchases</a>\n </td></tr>\n </table><br>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=90%>\n <tr><th>Item Name</th><th>Description</th><th>Quantity</th><th>Total Cost</th><th>Payment Method</th><th>Item Account</th><th>Account Used</th></tr>";
core_connect();
$sql = "SELECT * FROM purch_ret ORDER BY purchid DESC";
$purchRslt = db_exec($sql);
if (pg_numrows($purchRslt) < 1) {
return "<li class=err> There are no returned purchases in Cubit yet";
} else {
$i = 0;
// for bgcolor
while ($purch = pg_fetch_array($purchRslt)) {
foreach ($purch as $key => $value) {
${$key} = $value;
}
# get used account name
$sql = "SELECT accname FROM accounts WHERE accid = '{$usedacc}'";
$accRslt = db_exec($sql);
$acc = pg_fetch_array($accRslt);
$usedaccname = $acc['accname'];
# get paid account name
$sql = "SELECT accname FROM accounts WHERE accid = '{$paidacc}'";
$accRslt = db_exec($sql);
$acc = pg_fetch_array($accRslt);
$paidaccname = $acc['accname'];
$view .= "<tr class='" . bg_class() . "'><td>{$itemname}</td><td>{$descript}</td><td>{$quantity}</td><td>" . CUR . " {$tlcost}</td><td>{$paytype}</td><td>{$paidaccname}</td><td>{$usedaccname}</td></tr>";
$i++;
}
}
$view .= "</table>\n\t\t<p>\n\t\t<table border=0 cellpadding='2' cellspacing='1'>\n\t\t<tr><th>Quick Links</th></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
return $view;
}
示例8: add
function add($id)
{
db_conn('cubit');
$sql = "SELECT * FROM batch_cashbook WHERE cashid='{$id}'";
$accntRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve bank deposits details from database.", SELF);
$cd = pg_fetch_array($accntRslt);
extract($cd);
# Accounts Drop down selections
core_connect();
# Income accounts ($inc)
$glacc = "<select name='accinv'>";
$sql = "SELECT * FROM accounts WHERE accid='{$accinv}'";
$accRslt = db_exec($sql);
$numrows = pg_numrows($accRslt);
$acc = pg_fetch_array($accRslt);
# Check Disable
$glacc = $acc['accname'];
db_connect();
$sql = "SELECT * FROM bankacct WHERE bankid='{$bankid}'";
$banks = db_exec($sql);
if (pg_numrows($banks) < 1) {
return "<li class=err> There are no accounts held at the selected Bank.\n <p><input type=button onClick='JavaScript:history.back();' value='« Correct Selection'>";
}
$acc = pg_fetch_array($banks);
$bank = "{$acc['accname']} - {$acc['bankname']} ({$acc['acctype']})";
# layout
$add = "\n \t\t\t<h3>Delete BAtch cashbook entry</h3>\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='80%'>\n\t\t\t\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t\t\t\t<input type='hidden' name='key' value='remove'>\n\t\t\t\t\t\t<input type='hidden' name='id' value='{$id}'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Field</th>\n\t\t\t\t\t\t\t<th>Value</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>Bank Account</td>\n\t\t\t\t\t\t\t<td valign='center'>{$bank}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Paid to/Received From</td>\n\t\t\t\t\t\t\t<td valign='center'>{$name}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td valign='top'>Description</td>\n\t\t\t\t\t\t\t<td>{$descript}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Cheque Number</td>\n\t\t\t\t\t\t\t<td valign='center'>{$cheqnum}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Amount</td>\n\t\t\t\t\t\t\t<td valign='center'>" . CUR . " {$amount}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td valign='top'>Contra Account</td>\n\t\t\t\t\t\t\t<td>{$glacc}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td valign='center' align='right'><input type='submit' value='Delete »'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>";
# main table (layout with menu)
$OUTPUT = "\n \t\t\t<center>\n\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'>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='65%'>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t </table>";
return $OUTPUT;
}
示例9: bal
function bal($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid Trial Balance number.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to core DB
core_connect();
# get the Trial Balance
$sql = "SELECT * FROM save_trial_bal WHERE id = '{$id}' AND div = '" . USER_DIV . "'";
$balRslt = db_exec($sql) or errDie("Unable to retrieve Trial Balance from the Database", SELF);
if (pg_numrows($balRslt) < 1) {
return "<center><li> Invalid Trial Balance Number.";
}
$bal = pg_fetch_array($balRslt);
$balance = base64_decode($bal['output']);
$OUTPUT = $balance;
include "temp.xls.php";
Stream("TB", $OUTPUT);
}
示例10: 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;
}
示例11: 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;
}
示例12: slctacc
function slctacc()
{
// connect
db_conn(PRD_DB);
$refnum = getrefnum();
/*refnum*/
// Accounts (debit)
$view = "<center>\n <h3> Journal transaction </h3>\n <br><br>\n <form action='" . SELF . "' method=post name=form>\n <input type=hidden name=key value=details>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' align=center>\n <tr><th>Field</th><th>Value</th></tr>\n <tr class='bg-odd'><td>Date</td><td><input type=text size=2 name=day maxlength=2 value='" . date("d") . "'>-<input type=text size=2 name=mon maxlength=2 value='" . date("m") . "'>-<input type=text size=4 name=year maxlength=4 value='" . date("Y") . "'></td></tr>\n <tr class='bg-odd'><td>Reference Number</td><td><input type=text size=10 name=refnum value='" . $refnum++ . "'></td></tr>\n <tr><td><br></td></tr>\n <tr><td align=center>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n <tr><td><h4>Debit</h4></td></tr>\n <tr><th>Select Account</th></tr>\n <tr class='bg-even'>\n <td valign=center>\n <select name='dtaccid'>";
core_connect();
$sql = "SELECT * FROM accounts WHERE div = '" . USER_DIV . "' ORDER BY accname ASC";
$accRslt = db_exec($sql);
if (pg_numrows($accRslt) < 1) {
return "<li>There are No accounts in Cubit.";
}
while ($acc = pg_fetch_array($accRslt)) {
$view .= "<option value='{$acc['accid']}'>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</option>";
}
$view .= "</select></td></tr>\n </table>\n </td>\n <td align=center>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n <tr><td><h4>Credit</h4></td></tr>\n <tr><th>Select Account</th></tr>\n <tr class='bg-even'>\n <td valign=center>\n <select name=ctaccid>";
$sql = "SELECT * FROM accounts WHERE div = '" . USER_DIV . "' ORDER BY accname ASC";
$accRslt = db_exec($sql);
if (pg_numrows($accRslt) < 1) {
return "<li>There are No accounts in Cubit.";
}
while ($acc = pg_fetch_array($accRslt)) {
$view .= "<option value='{$acc['accid']}'>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</option>";
}
$view .= "</select>\n </td><td><input name=details type=submit value='Enter Details >'></td></tr>\n </table>\n </td></tr>\n </table><br><br><br>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' align=center>\n <td align=center>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n <tr><td><h4>Debit</h4></td></tr>\n <tr><th>Account number</th></tr>\n <tr class='bg-even'><td valign=center><input type=text name=dtaccnum size=20></td></tr>\n </table>\n </td>\n <td align=center>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n <tr><td><h4>Credit</h4></td></tr>\n <tr><th>Account number</th></tr>\n <tr class='bg-even'>\n <td valign=center><input type=text name=ctaccnum size=20></td><td><input type=submit value='Enter Details >'></td></tr></table>\n </td></tr>\n </table>\n <br>\n <input type=button value='< Go Back' onClick='javascript:history.back();'>\n </form>\n <table border=0 cellpadding='2' cellspacing='1' width=15%>\n\t<tr><td><br></td></tr>\n\t<tr><th>Quick Links</th></tr>\n\t<tr class=datacell><td align=center><a href='trans-new.php'>Journal Transactions</td></tr>\n\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table></center>";
return $view;
}
示例13: slctAcc
function slctAcc()
{
// Layout
$slctAcc = "<h3>Select Account</h3>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<form action='" . SELF . "' method=post>\n\t<input type=hidden name=key value=viewtran>\n\t<tr><th>Field</th><th>Value</th></tr>\n\t<tr class='bg-even'><td>Account Name</td><td><select name=accid>";
core_connect();
$sql = "SELECT * FROM accounts ORDER BY accname ASC";
$accRslt = db_exec($sql) or errDie("Could not retrieve Categories Information from the Database.", SELF);
if (pg_numrows($accRslt) < 1) {
return "<li class=err> There are no Accounts in Cubit.";
}
while ($acc = pg_fetch_array($accRslt)) {
$branname = branname($acc['div']);
$slctAcc .= "<option value='{$acc['accid']}'>{$acc['accname']} - {$branname}</option>";
}
$slctAcc .= "</select></td><td><input type=submit name=details value='View Transactions'></td></tr>\n\t<tr class='bg-odd'><td colspan=3><br></td></tr>\n\t<tr class='bg-even'><td>Account Number</td><td><input type=text name=topacc size=3 maxlength=3> / <input type=text name=accnum size=3 maxlength=3></td><td><input type=submit value='View Transactions'></td></tr>\n\t<tr class='bg-odd'><td>Select Period</td><td valign=center colspan=3>\n\t<select name=prd>";
db_conn(YR_DB);
$sql = "SELECT * FROM info WHERE prdname !=''";
$prdRslt = db_exec($sql);
if (pg_numrows($prdRslt) < 1) {
return "<li class=err>ERROR : There are no periods set for the current year";
}
while ($prd = pg_fetch_array($prdRslt)) {
if ($prd['prddb'] == PRD_DB) {
$sel = "selected";
} else {
$sel = "";
}
$slctAcc .= "<option value='{$prd['prddb']}' {$sel}>{$prd['prdname']}</option>";
}
$slctAcc .= "\n\t</select></td></tr>\n\t<tr><td align=center><input type=button value='« Back' onClick='javascript:history.back()'></td></tr>\n\t</form>\n\t</table>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=100>\n\t\t<tr><th>Quick Links</th></tr>\n\t\t<tr class=datacell><td align=center><a target=_blank href='../core/acc-new2.php'>Add account (New Window)</a></td></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
return $slctAcc;
}
示例14: add
function add()
{
core_connect();
# Get Petty cash account
$cashacc = gethook("accnum", "bankacc", "name", "Petty Cash");
# Get account name for thy lame User's Sake
$accRslt = get("core", "*", "accounts", "accid", $cashacc);
if (pg_numrows($accRslt) < 1) {
return "<li class='err'> Petty Cash Account not found.</li>";
}
$acc = pg_fetch_array($accRslt);
# Check available funds
$cashacc = gethook("accnum", "bankacc", "name", "Petty Cash");
core_connect();
$sql = "SELECT (debit - credit) as bal FROM trial_bal WHERE month='" . PRD_DB . "' AND accid = '{$cashacc}' AND div = '" . USER_DIV . "'";
$accbRslt = db_exec($sql);
if (pg_numrows($accbRslt) < 1) {
return "<li class='err'> Petty Cash Account not found.</li>";
}
$accb = pg_fetch_array($accbRslt);
$accb['bal'] = sprint($accb['bal']);
# mourn if the is no money
if ($accb['bal'] < 1) {
return "\n\t\t\t<li class='err'> There are no Petty Cash funds available.</li>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='petty-trans.php'>Transfer funds to petty cash account</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>";
}
// Layout
$add = "\n\t\t<h3>Funds transfer to Bank</h3>\n\t\t<table " . TMPL_tblDflts . " width='300'>\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t<input type='hidden' name='key' value='confirm'>\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>Bank Account</td>\n\t\t\t\t<td valign='center'>\n\t\t\t\t\t<select name='bankid'>";
db_connect();
$sql = "SELECT * FROM bankacct WHERE btype != 'int' AND div = '" . USER_DIV . "'";
$banks = db_exec($sql);
if (pg_numrows($banks) < 1) {
return "<li class='err'> There are no accounts held at the selected Bank.</li>\n\t\t<p><input type='button' onClick='JavaScript:history.back();' value='« Correct Selection'>";
}
while ($bacc = pg_fetch_array($banks)) {
$add .= "<option value='{$bacc['bankid']}'>({$bacc['acctype']}) {$bacc['accname']} - {$bacc['bankname']}</option>";
}
if (!isset($date_day)) {
$trans_date_setting = getCSetting("USE_TRANSACTION_DATE");
if (isset($trans_date_setting) and $trans_date_setting == "yes") {
$trans_date_value = getCSetting("TRANSACTION_DATE");
$date_arr = explode("-", $trans_date_value);
$date_year = $date_arr[0];
$date_month = $date_arr[1];
$date_day = $date_arr[2];
} else {
$date_year = date("Y");
$date_month = date("m");
$date_day = date("d");
}
}
$add .= "\n\t\t\t\t\t</select>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Date</td>\n\t \t<td>" . mkDateSelect("date", $date_year, $date_month, $date_day) . "</td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Received from</td>\n\t \t<td valign='center'><input size='20' name='name' value='Petty Cash'></td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Description</td>\n\t \t<td valign='center'><textarea cols='18' rows='2' name='descript'></textarea></td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Cheque Number</td>\n\t \t<td valign='center'><input size='10' name='cheqnum'></td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Amount</td>\n\t \t<td valign='center'>" . CUR . " <input type='text' size='10' name='amount'> Max : " . CUR . " {$accb['bal']}<input type='hidden' name='max' value='{$accb['bal']}'></td>\n\t </tr>\n\t <tr class='" . bg_class() . "'>\n\t \t<td>Petty Cash Account</td>\n\t \t<td><input type='hidden' name='accinv' value='{$acc['accid']}'>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</td>\n\t </tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td><input type='button' value='< Cancel' onClick='javascript:history.back();'></td>\n\t\t\t\t<td valign='center'><input type='submit' value='Confirm >'></td>\n\t\t\t</tr>\n\t\t</table>";
# main table (layout with menu)
$OUTPUT = "\n\t\t\t<center>\n\t <table width='100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width='65%' align='left'>{$add}</td>\n\t\t\t\t\t<td valign='top' align='center'>\n\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='65%'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t </table>";
return $OUTPUT;
}
示例15: viewLedg
function viewLedg($_POST)
{
# get vars
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
# Search by refnum
if ($search == "lname") {
$v->isOk($lname, "string", 1, 255, "Invalid Search String.");
$lname = strtolower($lname);
# Create the Search SQL
$search = "SELECT * FROM in_ledgers WHERE lower(lname) LIKE '%{$lname}%' AND div = '" . USER_DIV . "' ORDER BY lname ASC";
}
# View all
if ($search == "all") {
# create the Search SQL
$search = "SELECT * FROM in_ledgers WHERE div = '" . USER_DIV . "' ORDER BY lname ASC";
}
# display errors, if any
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class='err'>" . $e["msg"] . "</li>";
}
$confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
core_connect();
// Layout
$viewLedg = "\r\n\t\t<center>\r\n\t\t<h3>View High Speed Input Ledgers</h3>\r\n\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Ledger Name</th>\r\n\t\t\t\t<th>Debit</th>\r\n\t\t\t\t<th>Credit</th>\r\n\t\t\t\t<th colspan='10'>Options</th>\r\n\t\t\t</tr>";
$ledRslt = db_exec($search) or errDie("ERROR: Unable to retrieve High Speed Input ledgers from database.", SELF);
if (pg_numrows($ledRslt) < 1) {
return "\r\n\t\t<li> No High Speed input ledgers found.<br><br>\r\n\t\t<table " . TMPL_tblDflts . " width='25%'>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Quick Links</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td align='center'><a href='ledger-new.php'>New High Speed Input Ledger</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td align='center'><a href='../main.php'>Main Menu</td>\r\n\t\t\t</tr>\r\n\t\t</table>";
}
# display all transaction
$i = 0;
while ($led = pg_fetch_array($ledRslt)) {
#get vars from tran as the are in db
foreach ($led as $key => $value) {
${$key} = $value;
}
# get account names
$deb = get("core", "accname, topacc, accnum", "accounts", "accid", $dtaccid);
$debacc = pg_fetch_array($deb);
$ct = get("core", "accname, topacc,accnum", "accounts", "accid", $ctaccid);
$ctacc = pg_fetch_array($ct);
$viewLedg .= "\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td><a href='ledger-run.php?ledgid={$ledgid}'>{$led['lname']}</a></td>\r\n\t\t\t\t<td>{$debacc['topacc']}/{$debacc['accnum']} - {$debacc['accname']}</td>\r\n\t\t\t\t<td>{$ctacc['topacc']}/{$ctacc['accnum']} - {$ctacc['accname']}</td>\r\n\t\t\t\t<td><a href='ledger-det.php?ledgid={$ledgid}'>View Details</a></td>\r\n\t\t\t\t<td> <a href='ledger-run.php?ledgid={$ledgid}'>Run</a> </td>\r\n\t\t\t\t<td><a href='ledger-edit.php?ledgid={$ledgid}'>Edit</a></td>\r\n\t\t\t\t<td><a href='ledger-rem.php?ledgid={$ledgid}'>Delete</a></td>\r\n\t\t\t</tr>";
$i++;
}
$viewLedg .= "\r\n\t\t</table>\r\n\t\t<p>\r\n\t\t<table " . TMPL_tblDflts . " width='25%'>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Quick Links</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td align='center'><a href='ledger-new.php'>New High Speed Input Ledger</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td align='center'><a href='ledger-view.php'>View High Speed Input Ledger</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td align='center'><a href='../main.php'>Main Menu</td>\r\n\t\t\t</tr>\r\n\t\t</table>";
return $viewLedg;
}