2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 $page_security = 'SA_ACCRUALS';
13 $path_to_root = "../..";
14 include_once($path_to_root . "/includes/session.inc");
16 $_SESSION['page_title'] = _($help_context = _("Search General Ledger Transactions for account: ").$_GET['act']);
18 page($_SESSION['page_title'], true);
20 include_once($path_to_root . "/includes/date_functions.inc");
21 include_once($path_to_root . "/includes/ui.inc");
23 include_once($path_to_root . "/gl/includes/gl_db.inc");
25 $js ="\n<script type='text/javascript'>\n"
27 . " function WindowClose(amount_, date__)\n"
29 . " opener.document.getElementsByName('amount')[0].value = amount_; \n"
30 . " opener.document.getElementsByName('date_')[0].value = date__; \n"
31 . " window.close();\n"
38 if (!isset($_GET['act']) || !isset($_GET['date']))
39 { /*Script was not passed the correct parameters */
41 echo "<p>" . _("The script must be called with a valid transaction type and transaction number to review the general ledger postings for.") . "</p>";
45 display_heading($_SESSION['page_title']. " ".get_gl_account_name($_GET['act']));
49 start_table(TABLESTYLE);
50 $dim = get_company_pref('use_dimension');
52 $first_cols = array(_("Type"), "#", _("Date"));
54 $dim_cols = array(_("Dimension")." 1", _("Dimension")." 2");
56 $dim_cols = array(_("Dimension"));
60 $remaining_cols = array(_("Person/Item"), _("Debit"), _("Credit"), _("Memo"));
62 $th = array_merge($first_cols, $dim_cols, $remaining_cols);
66 $account = $_GET['act'];
67 $begin = add_days($end, -user_transaction_days());
69 $result = get_gl_transactions($begin, $end, -1, $account, 0, 0, null);
72 while ($myrow = db_fetch($result))
74 alt_table_row_color($k);
76 $trandate = sql2date($myrow["tran_date"]);
78 label_cell($systypes_array[$myrow["type"]]);
79 $amount = price_format($myrow["amount"]);
80 $str = "<a href='#' onclick='return WindowClose(\"$amount\", \"$trandate\");' >".$myrow['type_no']."</a>";
82 label_cell($trandate);
85 label_cell(get_dimension_string($myrow['dimension_id'], true));
87 label_cell(get_dimension_string($myrow['dimension2_id'], true));
88 label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
89 display_debit_or_credit_cells($myrow["amount"]);
90 label_cell($myrow['memo_']);