6 include_once($path_to_root . "/includes/session.inc");
8 include_once($path_to_root . "/includes/date_functions.inc");
9 include_once($path_to_root . "/includes/ui.inc");
10 include_once($path_to_root . "/includes/data_checks.inc");
12 include_once($path_to_root . "/reporting/includes/reporting.inc");
14 if ($use_popup_windows)
15 $js .= get_js_open_window(800, 500);
16 page(_("View Transactions"), false, false, "", $js);
18 //----------------------------------------------------------------------------------------
20 function viewing_controls()
22 start_form(false, true);
24 start_table("class='tablestyle_noborder'");
27 systypes_list_cells(_("Type:"), 'filterType', null, true);
29 if (!isset($_POST['FromTransNo']))
30 $_POST['FromTransNo'] = "1";
31 if (!isset($_POST['ToTransNo']))
32 $_POST['ToTransNo'] = "999999";
34 ref_cells(_("from #:"), 'FromTransNo');
36 ref_cells(_("to #:"), 'ToTransNo');
38 submit_cells('ProcessSearch', _("Search"));
46 //----------------------------------------------------------------------------------------
48 function check_valid_entries()
50 if (!is_numeric($_POST['FromTransNo']) OR $_POST['FromTransNo'] <= 0)
52 display_note(_("The starting transaction number is expected to be numeric and greater than zero."));
56 if (!is_numeric($_POST['ToTransNo']) OR $_POST['ToTransNo'] <= 0)
58 echo _("The ending transaction number is expected to be numeric and greater than zero.");
61 if ($_POST['filterType'] == "")
67 //----------------------------------------------------------------------------------------
69 function handle_search()
72 if (check_valid_entries()==true)
74 $db_info = get_systype_db_info($_POST['filterType']);
79 $table_name = $db_info[0];
80 $type_name = $db_info[1];
81 $trans_no_name = $db_info[2];
82 $trans_ref = $db_info[3];
84 $sql = "SELECT DISTINCT $trans_no_name ";
87 $sql .= " ,$trans_ref ";
89 $sql .= " FROM $table_name
90 WHERE $trans_no_name >= " . $_POST['FromTransNo']. "
91 AND $trans_no_name <= " . $_POST['ToTransNo'];
93 if ($type_name != null)
94 $sql .= " AND $type_name = " . $_POST['filterType'];
96 $sql .= " ORDER BY $trans_no_name";
98 $result = db_query($sql, "could not query transactions on $table_name");
100 if (db_num_rows($result) == 0)
102 echo _("There are no transactions for the given parameters.");
106 start_table($table_style);
108 $th = array(_("#"), _("Reference"), _("View"), _("GL"));
110 $th = array(_("#"), _("View"), _("GL"));
113 while ($line = db_fetch($result))
116 alt_table_row_color($k);
118 label_cell($line[$trans_no_name]);
120 label_cell($line[$trans_ref]);
121 label_cell(get_trans_view_str($_POST['filterType'],$line[$trans_no_name], _("View")));
122 label_cell(get_gl_view_str($_POST['filterType'], $line[$trans_no_name], _("View GL")));
132 //----------------------------------------------------------------------------------------
134 if (isset($_POST['ProcessSearch']))
136 if (!check_valid_entries())
137 unset($_POST['ProcessSearch']);
140 //----------------------------------------------------------------------------------------