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 ***********************************************************************/
13 $path_to_root="../..";
14 include_once($path_to_root . "/includes/session.inc");
17 include_once($path_to_root . "/includes/date_functions.inc");
18 include_once($path_to_root . "/includes/ui.inc");
19 include_once($path_to_root . "/includes/data_checks.inc");
21 include_once($path_to_root . "/gl/includes/gl_db.inc");
25 if ($use_popup_windows)
26 $js .= get_js_open_window(800, 500);
28 $js .= get_js_date_picker();
30 page(_("Tax Inquiry"), false, false, '', $js);
32 //----------------------------------------------------------------------------------------------------
37 $Ajax->activate('trans_tbl');
40 if (get_post('TransFromDate') == "" && get_post('TransToDate') == "")
43 $row = get_company_prefs();
44 $edate = add_months($date, -$row['tax_last']);
45 $edate = end_month($edate);
46 $bdate = add_months($edate, -$row['tax_prd'] + 1);
47 $_POST["TransFromDate"] = begin_month($bdate);
48 $_POST["TransToDate"] = $edate;
51 //----------------------------------------------------------------------------------------------------
53 function tax_inquiry_controls()
59 //start_table($table_style2);
60 start_table("class='tablestyle_noborder'");
63 date_cells(_("from:"), 'TransFromDate', '', null, -30);
64 date_cells(_("to:"), 'TransToDate');
65 submit_cells('Show',_("Show"),'','', true);
74 //----------------------------------------------------------------------------------------------------
76 function show_results()
78 global $path_to_root, $table_style;
80 /*Now get the transactions */
81 div_start('trans_tbl');
82 start_table($table_style);
84 $th = array(_("Type"), _("Description"), _("Amount"), _("Outputs")."/"._("Inputs"));
88 $bdate = date2sql($_POST['TransFromDate']);
89 $edate = date2sql($_POST['TransToDate']);
91 $taxes = get_tax_summary($_POST['TransFromDate'], $_POST['TransToDate']);
93 while ($tx = db_fetch($taxes))
96 $payable = $tx['payable'];
97 $collectible = $tx['collectible'];
98 $net = $collectible + $payable;
100 alt_table_row_color($k);
101 label_cell($tx['name'] . " " . $tx['rate'] . "%");
102 label_cell(_("Charged on sales") . " (" . _("Output Tax")."):");
103 amount_cell($payable);
104 amount_cell($tx['net_output']);
106 alt_table_row_color($k);
107 label_cell($tx['name'] . " " . $tx['rate'] . "%");
108 label_cell(_("Paid on purchases") . " (" . _("Input Tax")."):");
109 amount_cell($collectible);
110 amount_cell($tx['net_input']);
112 alt_table_row_color($k);
113 label_cell("<b>".$tx['name'] . " " . $tx['rate'] . "%</b>");
114 label_cell("<b>"._("Net payable or collectible") . ":</b>");
115 amount_cell($net, true);
119 alt_table_row_color($k);
121 label_cell("<b>"._("Total payable or refund") . ":</b>");
122 amount_cell($total, true);
130 //----------------------------------------------------------------------------------------------------
132 tax_inquiry_controls();
136 //----------------------------------------------------------------------------------------------------