function edit($accid, $err = "") { require_lib("validate"); $v = new validate(); $v->isOk($accid, "num", 1, 50, "Invalid Account number."); if ($v->isError()) { return $v->genErrors(); } $acc = qryAccounts($accid); $acctypes = array("I" => "Income", "E" => "Expense", "B" => "Balance"); $size = strlen($acc['accname']); if ($size < 20) { $size = 20; } $OUT = "\n\t<h3>Edit Account</h3>\n\t{$err}\n\t<form action='" . SELF . "' method=post>\n\t<table " . TMPL_tblDflts . ">\n\t\t<input type='hidden' name='key' value='confirm' />\n\t\t<input type='hidden' name='accid' value='{$acc['accid']}' />\n\t\t<input type='hidden' name='fcatid' value='{$acc['catid']}' />\n\t\t<input type='hidden' name='acctype' value='{$acc['acctype']}' />\n\t\t<tr>\n\t\t\t<th>Field</th>\n\t\t\t<th>Value</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Account Name</td>\n\t\t\t<td>{$acc['accname']}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Account Type</td>\n\t\t\t<td>" . $acctypes[$acc["acctype"]] . "</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>To Category</td>\n\t\t\t<td>\n\t\t\t\t<select name=catid>"; $sql = "SELECT 'I' AS acctype, * FROM core.income WHERE div = '" . USER_DIV . "'\n\t\t\t\tUNION\n\t\t\t\tSELECT 'E' AS acctype, * FROM core.expenditure WHERE div='" . USER_DIV . "'\n\t\t\t\tUNION\n\t\t\t\tSELECT 'B' AS acctype, * FROM core.balance WHERE div='" . USER_DIV . "'"; $cats = new dbSql($sql); $cats->run(); if ($cats->num_rows() < 1) { return "There are no Account Categories in Cubit."; } $pgroup = false; while ($cat = $cats->fetch_array()) { if ($pgroup != $cat["acctype"]) { if ($pgroup) { $OUT .= "</optgroup>"; } $OUT .= "<optgroup label='" . $acctypes[$cat["acctype"]] . "'>"; } if ($cat["catid"] == $acc["catid"]) { $sel = "selected"; } else { $sel = ""; } $OUT .= "<option {$sel} value='{$cat['catid']}'>{$cat['catname']}</option>"; } $OUT .= "\n\t\t\t\t</optgroup>\n\t\t\t</select>\n\t\t</td></tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Account Number</td>\n\t\t\t<td valign='center'><input type='text' name='topacc' size='4' maxlength='4' value='{$acc['topacc']}' /> / <input type='text' name='accnum' size='3' maxlength='3' value='{$acc['accnum']}' /></td>\n\t\t</tr>\n\t\t" . TBL_BR . "\n\t\t<tr>\n\t\t\t<td colspan='2' align='right'><input type='submit' value='Confirm »' /></td>\n\t\t</tr>\n\t</table>\n\t</form>" . mkQuickLinks(ql("acc-view.php", "View Accounts")); return $OUT; }
function add() { extract($_REQUEST); $qry = new dbSelect("batch_cashbook", "cubit", grp(m("where", wgrp(m("cashid", "{$id}"))))); $qry->run(); if ($qry->num_rows() <= 0) { invalid_use("Invalid batch cashbook entry."); } $bcb = $qry->fetch_array(); if ($bcb["chrgvat"] == "exc") { $bcb["amount"] -= $bcb["vat"]; } extract($bcb, EXTR_SKIP); core_connect(); $accs = qryAccounts(); if ($accs->num_rows() <= 0) { $glacc = "There are no Income accounts in Cubit."; } $glacc = "<select name='accinv'>"; while ($acc = $accs->fetch_array()) { if (isDisabled($acc['accid'])) { continue; } if ($accinv == $acc['accid']) { $sel = "selected"; } else { $sel = ""; } $glacc .= "<option value='{$acc['accid']}' {$sel}>{$acc['accname']}</option>"; } $glacc .= "</select>"; $OUT = "\n\t\t\t\t<h3>Edit Bank Receipt</h3>\n\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t\t\t<input type='hidden' name='id' value='{$id}'>\n\t\t\t\t\t<input type='hidden' name='vat' value='{$bcb['vat']}' />\n\t\t\t\t\t<input type='hidden' name='orig_vatcode' value='{$bcb['vatcode']}' />\n\t\t\t\t\t<input type='hidden' name='orig_chrgvat' value='{$bcb['chrgvat']}' />\n\t\t\t\t\t<input type='hidden' name='orig_amount' value='{$bcb['amount']}' />\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Field</th>\n\t\t\t\t\t\t<th>Value</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Bank Account</td>\n\t\t\t\t\t\t<td valign='center'>\n\t\t\t\t\t\t\t<select name='bankid'>"; db_connect(); $qry->setTable("bankacct", "cubit"); $qry->setOpt(grp(m("where", "btype!='int' AND div='" . USER_DIV . "'"))); $qry->run(); if ($qry->num_rows() <= 0) { return "<li class='err'> There are no accounts held at the selected Bank.\n\t\t\t<p><input type='button' onClick='JavaScript:history.back();' value='« Correct Selection'>"; } while ($acc = $qry->fetch_array()) { if (isset($bankid) && $bankid == $acc['bankid']) { $sel = "selected"; } else { $sel = ""; } $OUT .= "<option value='{$acc['bankid']}' {$sel}>{$acc['accname']} - {$acc['bankname']} ({$acc['acctype']})</option>"; } if (!isset($name)) { $name = ""; $descript = ""; $cheqnum = ""; $amount = ""; $chrgvat = ""; } db_conn('cubit'); $Sl = "SELECT * FROM vatcodes ORDER BY code"; $Ri = db_exec($Sl) or errDie("Unable to get vat codes"); $Vatcodes = "\n\t\t\t<select name='vatcode'>\n\t\t\t\t<option value='0'>Select</option>"; $vacs = qryVatcode(); $Vatcodes = db_mksel($vacs, "vatcode", $vatcode, "#id", "#code", "0:Select"); list($o_year, $o_month, $o_day) = explode('-', $date); $sel1 = ""; $sel2 = ""; $sel3 = ""; if ($chrgvat == "inc") { $sel1 = "checked=yes"; } else { if ($chrgvat == "exc") { $sel2 = "checked=yes"; } else { if ($chrgvat == "nov") { $sel3 = "checked=yes"; } else { $sel1 = "checked=yes"; } } } $OUT .= "\n\t\t</select>\n\t\t</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Date</td>\n\t\t<td>\n\t\t\t" . mkDateSelect("o", $o_year, $o_month, $o_day) . "\n\t\t</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='{$name}'></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Description</td>\n\t\t<td valign='center'><textarea col='18' rows='3' name='descript'>{$descript}</textarea></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Reference</td>\n\t\t<td valign='center'><input size='20' name='reference' value='{$reference}'></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='20' name='cheqnum' value='{$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' value='" . sprint($amount) . "'></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>VAT </td>\n\t\t<td>\n\t\t\t<input type='radio' name='chrgvat' value='inc' {$sel1}>Inclusive \n\t\t\t<input type='radio' name='chrgvat' value='exc' {$sel2}>Exclusive \n\t\t\t<input type='radio' name='chrgvat' value='nov' {$sel3}>No VAT\n\t\t</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>VAT Code</td>\n\t\t<td>{$Vatcodes}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td valign='top'>Select Contra Account</td>\n\t\t<td>{$glacc}</td>\n\t</tr>\n\t<tr>\n\t\t<td> </td>\n\t\t<td valign='center' align='right'><input type='submit' value='Confirm »'></td>\n\t</tr>\n\t</table>"; # main table (layout with menu) $OUT .= mkQuickLinks(); return $OUT; }
function viewtran($_POST) { # get vars foreach ($_POST as $key => $value) { ${$key} = $value; } # validate input require_lib("validate"); $v = new validate(); $v->isOk($prd, "string", 1, 14, "Invalid Period number."); if (isset($details)) { $v->isOk($accid, "string", 1, 20, "Invalid Account number."); } else { $v->isOk($topacc, "num", 1, 20, "Invalid Account number."); $v->isOk($accnum, "num", 0, 20, "Invalid Account number."); } # display errors, if any if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class=err>" . $e["msg"]; } $confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>"; return $confirm; } if (isset($details)) { $acc = qryAccounts($accid); } else { if (strlen($accnum) < 2) { $acc = qryAccountsNum($topacc, "000"); if ($acc === false) { return "<li> Accounts number {$topacc}/000 does not exist"; } } else { $acc = qryAccountsNum($topacc, $accnum); if ($acc === false) { return "<li> Accounts number {$topacc}/{$accnum} does not exist"; } $acc = pg_fetch_array($accRs); } } db_conn($prd); // Set up table to display in $OUTPUT = "<center>\n\t<h3>Journal Entries for Account : {$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</h3>\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th>Date</th>\n\t\t<th>Reference</th>\n\t\t<th>Contra Acc</th>\n\t\t<th>Description</th>\n\t\t<th>Debit</th>\n\t\t<th>Credit</th>\n\t\t<th>User</th>\n\t</tr>"; $sql = "SELECT * FROM transect WHERE debit = '{$acc['accid']}' OR credit = '{$acc['accid']}'"; $tranRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve Transaction details from database.", SELF); if (pg_numrows($tranRslt) < 1) { $OUTPUT .= "<tr class='bg-odd'><td colspan=10>No Transactions found</td></tr>"; } else { $credtot = 0; $debtot = 0; # display all transactions while ($tran = pg_fetch_array($tranRslt)) { extract($tran); if ($debit == $accid) { $cacc = $credit; $debitamt = CUR . " {$amount}"; $debtot += $amount; $creditamt = ""; } else { $debitamt = ""; $creditamt = CUR . " {$amount}"; $credtot += $amount; $cacc = $debit; } # get contra account name $caccRs = get("core", "accname,topacc,accnum", "accounts", "accid", $cacc); $cacc = pg_fetch_array($caccRs); $OUTPUT .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$date}</td>\n\t\t\t\t<td>{$refnum}</td>\n\t\t\t\t<td>{$cacc['topacc']}/{$cacc['accnum']} - {$cacc['accname']}</td>\n\t\t\t\t<td>{$details}</td>\n\t\t\t\t<td>{$debitamt}</td>\n\t\t\t\t<td>{$creditamt}</td>\n\t\t\t\t<td>{$author}</td>\n\t\t\t</tr>"; } } if ($acc["acctype"] == "I") { $accbal = $credtot - $debtot; } else { if ($acc["acctype"] == "E") { $accbal = $debtot - $credtot; } else { if ($acc["acctype"] == "B") { $accbal = $debtot - $credtot; } else { return "<li class=err>Account number is beyond limits."; } } } $OUTPUT .= "\n\t<tr class='" . bg_class() . "'>\n\t\t<td colspan='4'><b>Total</b></td>\n\t\t<td><b>" . CUR . " {$debtot}</b></td>\n\t\t<td><b>" . CUR . " {$credtot}</b></td>\n\t\t<td> </td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td colspan='4'><b>Balance</b></td>\n\t\t<td colspan='2'><b>" . CUR . " {$accbal}</b></td>\n\t\t<td> </td>\n\t</tr>\n\t</table>" . mkQuickLinks(); return $OUTPUT; }
function viewtran($_POST) { # get vars foreach ($_POST as $key => $value) { ${$key} = $value; } # validate input require_lib("validate"); $v = new validate(); $v->isOk($prd, "string", 1, 14, "Invalid Period number."); if (isset($details)) { $v->isOk($accid, "string", 1, 20, "Invalid Account number."); } else { $v->isOk($topacc, "num", 1, 20, "Invalid Account number."); } # 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; } if (isset($details)) { $acc = qryAccounts($accid); } else { if (strlen($topacc) > 2) { $acc = qryAccountsNum($topacc, "000"); } else { return "<li> Accounts number : {$topacc}/000 does not exist"; } } db_conn($prd); // Set up table to display in $OUTPUT = "\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan='7'><h3>Journal Entries for Account : {$acc['topacc']}/{$acc['accnum']} - {$acc['accname']} and Sub Accounts</h3></th>\n\t\t\t\t</tr>\n\t\t\t\t<tr><th colspan='7'></th></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='3' align='left'>" . COMP_NAME . "</td>\n\t\t\t\t\t<td colspan='4' align='right'>" . date("Y-m-d") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t<th>Reference</th>\n\t\t\t\t\t<th>Contra Acc</th>\n\t\t\t\t\t<th>Description</th>\n\t\t\t\t\t<th>Debit</th>\n\t\t\t\t\t<th>Credit</th>\n\t\t\t\t\t<th>User</th>\n\t\t\t\t</tr>"; # get all sub accounts core_connect(); $sql = "SELECT * FROM accounts WHERE topacc = '{$acc['topacc']}' AND div = '" . USER_DIV . "' ORDER BY accnum ASC"; $subRs = db_exec($sql); # all totals $allcredtot = 0; $alldebtot = 0; while ($subacc = pg_fetch_array($subRs)) { $OUTPUT .= "\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='10'><h4>Account : {$subacc['topacc']}/{$subacc['accnum']} - {$subacc['accname']}</h4></td>\n\t\t\t\t</tr>"; # get Transactions db_conn($prd); $sql = "SELECT * FROM transect WHERE debit = '{$subacc['accid']}' AND div = '" . USER_DIV . "' OR credit = '{$subacc['accid']}' AND div = '" . USER_DIV . "'"; $tranRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve Transaction details from database.", SELF); if (pg_numrows($tranRslt) < 1) { # counts $credtot = 0; $debtot = 0; $OUTPUT .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='10'>No Transactions found</td>\n\t\t\t\t\t</tr>"; $OUTPUT .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='4'><b>Total</b></td>\n\t\t\t\t\t\t\t<td><b>" . CUR . " {$debtot}</b></td>\n\t\t\t\t\t\t\t<td><b>" . CUR . " {$credtot}</b></td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t</tr>"; } else { # counts $credtot = 0; $debtot = 0; # display all transactions while ($tran = pg_fetch_array($tranRslt)) { extract($tran); if ($debit == $subacc['accid']) { $cacc = $credit; $debitamt = "R " . $amount; $debtot += $amount; $alldebtot += $amount; $creditamt = ""; } else { $debitamt = ""; $creditamt = "R " . $amount; $credtot += $amount; $allcredtot += $amount; $cacc = $debit; } # get contra account name $caccRs = get("core", "accname,topacc,accnum", "accounts", "accid", $cacc); $cacc = pg_fetch_array($caccRs); $OUTPUT .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>{$date}</td>\n\t\t\t\t\t\t\t<td>{$refnum}</td>\n\t\t\t\t\t\t\t<td>{$cacc['topacc']}/{$cacc['accnum']} - {$cacc['accname']}</td>\n\t\t\t\t\t\t\t<td>{$details}</td>\n\t\t\t\t\t\t\t<td>{$debitamt}</td>\n\t\t\t\t\t\t\t<td>{$creditamt}</td>\n\t\t\t\t\t\t\t<td>{$author}</td>\n\t\t\t\t\t\t</tr>"; } if ($acc["acctype"] == "I") { $accbal = $credtot - $debtot; } else { if ($acc["acctype"] == "E") { $accbal = $debtot - $credtot; } else { if ($acc["acctype"] == "B") { $accbal = $debtot - $credtot; } else { return "<li class='err'>Account number is beyond limits.</li>"; } } } $OUTPUT .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='4'><b>Total</b></td>\n\t\t\t\t\t\t<td><b>" . CUR . " {$debtot}</b></td>\n\t\t\t\t\t\t<td><b>" . CUR . " {$credtot}</b></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='4'><b>Balance</b></td>\n\t\t\t\t\t\t<td colspan='2'><b>" . CUR . " {$accbal}</b></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t</tr>"; } } $OUTPUT .= "\n\t\t\t\t<tr><td colspan='7'></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='4'><b>Total</b></td>\n\t\t\t\t\t<td><b>" . CUR . " {$alldebtot}</b></td>\n\t\t\t\t\t<td><b>" . CUR . " {$allcredtot}</b></td>\n\t\t\t\t\t<td></td>\n\t\t\t\t</tr>\n\t\t\t</table>"; $acc['accname'] = str_replace(" ", "_", $acc['accname']); # Send the stream include "temp.xls.php"; Stream("AllTrans-{$acc['accname']}_And_Subacc", $OUTPUT); }
function viewtran($_POST) { # get vars extract($_POST); # validate input require_lib("validate"); $v = new validate(); $v->isOk($prd, "string", 1, 14, "Invalid Period number."); if (isset($details)) { $v->isOk($accid, "string", 1, 20, "Invalid Account number."); $hide = "\n\t\t\t<input type='hidden' name='prd' value='{$prd}'>\n\t\t\t<input type='hidden' name='details' value='{$details}'>\n\t\t\t<input type='hidden' name='accid' value='{$accid}'>"; } else { $v->isOk($topacc, "num", 1, 4, "Invalid Account number."); $hide = "\n\t\t\t<input type='hidden' name='prd' value='{$prd}'>\n\t\t\t<input type='hidden' name='topacc' value='{$topacc}'>"; } # display errors, if any if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>" . $e["msg"] . "</li>"; } return $confirm . slctAcc(); } if (isset($details)) { $acc = qryAccounts($accid); } else { if (strlen($topacc) > 2) { $acc = qryAccountsNum($topacc, "000"); } else { return "<li> Accounts number : {$topacc}/000 does not exist.</li>"; } } db_conn($prd); // Set up table to display in $OUTPUT = "\n\t\t<center>\n\t\t<h3>Journal Entries for Account : {$acc['topacc']}/{$acc['accnum']} - {$acc['accname']} and Sub Accounts</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Reference</th>\n\t\t\t\t<th>Contra Acc</th>\n\t\t\t\t<th>Description</th>\n\t\t\t\t<th>Debit</th>\n\t\t\t\t<th>Credit</th>\n\t\t\t\t<th>User</th>\n\t\t\t</tr>"; # get all sub accounts core_connect(); $sql = "SELECT * FROM accounts WHERE topacc = '{$acc['topacc']}' AND div = '" . USER_DIV . "' ORDER BY accnum ASC"; $subRs = db_exec($sql); # all totals $allcredtot = 0; $alldebtot = 0; while ($subacc = pg_fetch_array($subRs)) { $OUTPUT .= "\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='10'><h2>Account : {$subacc['topacc']}/{$subacc['accnum']} - {$subacc['accname']}</h2></td>\n\t\t\t</tr>"; # get Transactions db_conn($prd); $sql = "SELECT * FROM transect WHERE debit = '{$subacc['accid']}' AND div = '" . USER_DIV . "' OR credit = '{$subacc['accid']}' AND div = '" . USER_DIV . "'"; $tranRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve Transaction details from database.", SELF); if (pg_numrows($tranRslt) < 1) { # counts $credtot = 0; $debtot = 0; $OUTPUT .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='10'>No Transactions found</td>\n\t\t\t\t</tr>"; $debtot = sprint($debtot); $credtot = sprint($credtot); $OUTPUT .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='4'><b>Total</b></td>\n\t\t\t\t\t<td><b>" . CUR . " {$debtot}</b></td>\n\t\t\t\t\t<td><b>" . CUR . " {$credtot}</b></td>\n\t\t\t\t\t<td></td>\n\t\t\t\t</tr>"; } else { # counts $credtot = 0; $debtot = 0; # display all transactions while ($tran = pg_fetch_array($tranRslt)) { extract($tran); $amount = sprint($amount); if ($debit == $subacc['accid']) { $cacc['accname'] = $caccname; $cacc['accnum'] = $caccnum; $cacc['topacc'] = $ctopacc; $debitamt = "R " . $amount; $debtot += $amount; $alldebtot += $amount; $creditamt = ""; } else { $debitamt = ""; $creditamt = "R " . $amount; $credtot += $amount; $allcredtot += $amount; $cacc['accname'] = $daccname; $cacc['accnum'] = $daccnum; $cacc['topacc'] = $dtopacc; } /* # get contra account name $caccRs = get("core","accname,topacc,accnum","accounts","accid",$cacc); $cacc = pg_fetch_array($caccRs); */ $OUTPUT .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$date}</td>\n\t\t\t\t\t\t<td>{$custom_refnum}</td>\n\t\t\t\t\t\t<td>{$cacc['topacc']}/{$cacc['accnum']} - {$cacc['accname']}</td>\n\t\t\t\t\t\t<td>{$details}</td>\n\t\t\t\t\t\t<td align='right'>{$debitamt}</td>\n\t\t\t\t\t\t<td align='right'>{$creditamt}</td>\n\t\t\t\t\t\t<td>{$author}</td>\n\t\t\t\t\t</tr>"; } if ($acc["acctype"] == "I") { $accbal = $credtot - $debtot; } else { if ($acc["acctype"] == "E") { $accbal = $debtot - $credtot; } else { if ($acc["acctype"] == "B") { $accbal = $debtot - $credtot; } else { return "<li class='err'>Account number is beyond limits.</li>"; } } } $debtot = sprint($debtot); $credtot = sprint($credtot); $accbal = sprint($accbal); $OUTPUT .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='4'><b>Total</b></td>\n\t\t\t\t\t<td><b>" . CUR . " {$debtot}</b></td>\n\t\t\t\t\t<td><b>" . CUR . " {$credtot}</b></td>\n\t\t\t\t\t<td></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='4'><b>Balance</b></td>\n\t\t\t\t\t<td colspan='2'><b>" . CUR . " {$accbal}</b></td>\n\t\t\t\t\t<td></td>\n\t\t\t\t</tr>"; } } $alldebtot = sprint($alldebtot); $allcredtot = sprint($allcredtot); $OUTPUT .= "\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='4'><b>Total</b></td>\n\t\t\t\t<td><b>" . CUR . " {$alldebtot}</b></td>\n\t\t\t\t<td><b>" . CUR . " {$allcredtot}</b></td>\n\t\t\t\t<td></td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td align='center' colspan='10'>\n\t\t\t\t\t<form action='../xls/accsub-trans-xls.php' method='POST' name='form'>\n\t\t\t\t\t\t<input type='hidden' name='key' value='viewtran'>\n\t\t\t\t\t\t{$hide}\n\t\t\t\t\t\t<input type='submit' name='xls' value='Export to spreadsheet'>\n\t\t\t\t\t</form>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<p>\n\t\t<table " . TMPL_tblDflts . " width='25%'>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<tr class='datacell'><td align='center'><a target=_blank href='../core/acc-new2.php'>Add account (New Window)</a></td></tr>\n\t\t\t<tr class='datacell'>\n\t\t\t\t<td align='center'><a href='index-reports.php'>Financials</a></td>\n\t\t\t</tr>\n\t\t\t<tr class='datacell'>\n\t\t\t\t<td align='center'><a href='index-reports-journal.php'>Current Year Details General Ledger Reports</a></td>\n\t\t\t</tr>\n\t\t\t<tr class='datacell'>\n\t\t\t\t<td align='center'><a href='../main.php'>Main Menu</td>\n\t\t\t</tr>\n\t\t</table>"; return $OUTPUT; }