<? include('includes/main.php'); ?>
<?
echo texttitle('CHART OF ACCOUNTS for '.$companyname);
echo texttitle('Chart of Accounts');
if ($description) {
$queryord="glaccount.description";
} elseif ($account) {
$queryord="glaccount.name";
} else {
$queryord="accounttype.description, glaccount.name";
};
$recordSet = &$conn->Execute("select glaccount.name, glaccount.description, accounttype.description,glaccount.id from glaccount, accounttype where (glaccount.companyid=0 or glaccount.companyid=".sqlprep($active_company).") and accounttype.id=glaccount.accounttypeid order by ".$queryord);
if ($recordSet->EOF) die(texterror('No matching GL accounts found.'));
echo '<table border="1"><tr><th width="10%"><a href="glacctlst.php?account=1" class="blacklink">ACCOUNT</a></th><th><a href="glacctlst.php?description=1" class="blacklink">DESCRIPTION</a></th><th><a href="glacctlst.php" class="blacklink">ACCOUNT TYPE</a></th></tr>';
while (!$recordSet->EOF) {
echo '<tr><td width="10%" align="center"><a href="glacctlst1.php?glaccountid='.$recordSet->fields[3].'">'.$recordSet->fields[0].'</a></td><td align="left">'.$recordSet->fields[1].'</td><td align="left">'.$recordSet->fields[2]."</td></tr>";
$recordSet->MoveNext();
};
?>
<? include('includes/footer.php'); ?>