5 include_once($path_to_root . "/includes/session.inc");
7 page(_("General Ledger Transaction Details"), true);
9 include_once($path_to_root . "/includes/date_functions.inc");
10 include_once($path_to_root . "/includes/ui.inc");
12 include_once($path_to_root . "/gl/includes/gl_db.inc");
14 if (!isset($_GET['type_id']) || !isset($_GET['trans_no']))
15 { /*Script was not passed the correct parameters */
17 echo "<p>" . _("The script must be called with a valid transaction type and transaction number to review the general ledger postings for.") . "</p>";
21 function display_gl_heading($myrow)
24 $trans_name = systypes::name($_GET['type_id']);
25 start_table("$table_style width=95%");
26 $th = array(_("General Ledger Transaction Details"),
27 _("Date"), _("Person/Item"));
30 label_cell("$trans_name #" . $_GET['trans_no']);
31 label_cell(sql2date($myrow["tran_date"]));
32 label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]));
36 comments_display_row($_GET['type_id'], $_GET['trans_no']);
41 $sql = "SELECT ".TB_PREF."gl_trans.*, account_name FROM ".TB_PREF."gl_trans, ".TB_PREF."chart_master WHERE ".TB_PREF."gl_trans.account = ".TB_PREF."chart_master.account_code AND type= " . $_GET['type_id'] . " AND type_no = " . $_GET['trans_no'] . " ORDER BY counter";
42 $result = db_query($sql,"could not get transactions");
43 //alert("sql = ".$sql);
45 if (db_num_rows($result) == 0)
47 echo "<p><center>" . _("No general ledger transactions have been created for") . " " .systypes::name($_GET['type_id'])." " . _("number") . " " . $_GET['trans_no'] . "</center></p><br><br>";
52 /*show a table of the transactions returned by the sql */
53 $dim = get_company_pref('use_dimension');
56 $th = array(_("Account Code"), _("Account Name"), _("Dimension")." 1", _("Dimension")." 2",
57 _("Debit"), _("Credit"), _("Memo"));
59 $th = array(_("Account Code"), _("Account Name"), _("Dimension"),
60 _("Debit"), _("Credit"), _("Memo"));
62 $th = array(_("Account Code"), _("Account Name"),
63 _("Debit"), _("Credit"), _("Memo"));
64 $k = 0; //row colour counter
65 $heading_shown = false;
67 while ($myrow = db_fetch($result))
71 display_gl_heading($myrow);
72 start_table("$table_style width=95%");
74 $heading_shown = true;
77 alt_table_row_color($k);
79 label_cell($myrow['account']);
80 label_cell($myrow['account_name']);
82 label_cell(get_dimension_string($myrow['dimension_id'], true));
84 label_cell(get_dimension_string($myrow['dimension2_id'], true));
86 display_debit_or_credit_cells($myrow['amount']);
87 label_cell($myrow['memo_']);
95 is_voided_display($_GET['type_id'], $_GET['trans_no'], _("This transaction has been voided."));