$whereclause = ""; $res = mysql_query($q); $num = mysql_num_rows($res); $i = 0; while ($i < $num) { $id = mysql_result($res, $i, "t_id"); $c_id = mysql_result($res, $i, "t_cid"); $cat = runQuery("SELECT c_name from f_categories where c_id={$c_id}", 'c_name'); $date = mysql_result($res, $i, "t_date"); $name = mysql_result($res, $i, "t_name"); $amt = mysql_result($res, $i, "t_amount"); $credit = mysql_result($res, $i, "t_credit"); if ($credit) { addRowData($date, $name, $cat, $amt, ''); } else { addRowData($date, $name, $cat, '', $amt); } } echo "</table>"; } } function printTitle($t) { echo "<div align=center><h2>{$t}</h2></div><P>"; } function addFormRow($name, $type, $ph) { $lname = strtolower($name); if ($type == 'text') { echo "<tr><td class=pcells>{$name}</td><td><input type={$type} size=40 name={$lname} placeholder=\"{$ph}\"></td></tr>"; } else {
$id = mysql_result($res, $i, "t_id"); $c_id = mysql_result($res, $i, "t_cid"); $cat = runQuery("SELECT c_name from f_categories where c_id={$c_id}", 'c_name'); $date = mysql_result($res, $i, "t_date"); $name = mysql_result($res, $i, "t_name"); $mode = mysql_result($res, $i, "t_mode"); $event = mysql_result($res, $i, "t_event"); $from = mysql_result($res, $i, "t_entity"); $amt = mysql_result($res, $i, "t_amount"); $credit = mysql_result($res, $i, "t_credit"); if ($credit) { $bal = $bal - $amt; addRowData($id, $date, $name, $from, $mode, $event, $cat, $amt, '', $bal); } else { $bal = $bal + $amt; addRowData($id, $date, $name, $from, $mode, $event, $cat, '', $amt, $bal); } $i++; } echo "</table>"; function printTitle($t) { echo "<div align=center><h2>{$t}</h2></div><P>"; } function addSelectRows($t, $table, $column, $default) { echo "<tr><td class=pcells>Category</td><td class=pcells>"; $entries = buildArrayFromQuery("SELECT DISTINCT {$column} FROM {$table}", "{$column}"); sort($entries); echo "<select name=category>\n"; if ($default) {
$q = "SELECT * FROM f_receivables order by r_date"; $whereclause = ""; $res = mysql_query($q); $num = mysql_num_rows($res); $i = 0; printHeaderRow(); while ($i < $num) { $id = mysql_result($res, $i, "r_id"); $c_id = mysql_result($res, $i, "r_cid"); $cat = runQuery("SELECT c_name from f_categories where c_id={$c_id}", 'c_name'); $date = mysql_result($res, $i, "r_date"); $rdate = mysql_result($res, $i, "r_rdate"); $name = mysql_result($res, $i, "r_from"); $amt = mysql_result($res, $i, "r_amount"); $bal = $bal + $amt; addRowData($id, $date, $cat, $name, $rdate, $amt, $bal); $i++; } echo "</table>"; function printTitle($t) { echo "<div align=center><h2>{$t}</h2></div><P>"; } function addSelectRows($t, $table, $column, $default) { echo "<tr><td class=pcells>Category</td><td class=pcells>"; $entries = buildArrayFromQuery("SELECT DISTINCT {$column} FROM {$table}", "{$column}"); sort($entries); echo "<select name=category>\n"; if ($default) { $cid = runQuery("SELECT c_id from {$table} where c_name=\"{$default}\"", 'c_id');