Skip to content

Commit 5ea2716

Browse files
authored
Merge pull request #1083 from itflow-org/tax-report-tidy
Tidy up the tax report + perms
2 parents 3bc9b28 + 90fb28e commit 5ea2716

File tree

1 file changed

+39
-38
lines changed

1 file changed

+39
-38
lines changed

report_tax_summary.php

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require_once "inc_all_reports.php";
44

5-
validateAccountantRole();
5+
enforceUserPermission('module_financial');
66

77
$year = isset($_GET['year']) ? intval($_GET['year']) : date('Y');
88

@@ -69,47 +69,48 @@
6969
</tr>
7070
</thead>
7171
<tbody>
72-
<?php
73-
while ($row = mysqli_fetch_array($sql_tax)) {
74-
echo "<tr>";
75-
echo "<td>" . $row['tax_name'] . "</td>";
76-
77-
if ($view == 'monthly') {
78-
for ($i = 1; $i <= 12; $i++) {
79-
$monthly_tax = getMonthlyTax($row['tax_name'], $i, $year, $mysqli);
80-
echo "<td class='text-right'>" . numfmt_format_currency($currency_format, $monthly_tax, $company_currency) . "</td>";
81-
}
82-
} else {
83-
for ($q = 1; $q <= 4; $q++) {
84-
$quarterly_tax = getQuarterlyTax($row['tax_name'], $q, $year, $mysqli);
85-
echo "<td class='text-right'>" . numfmt_format_currency($currency_format, $quarterly_tax, $company_currency) . "</td>";
86-
}
72+
<?php
73+
while ($row = mysqli_fetch_array($sql_tax)) {
74+
$tax_name = sanitizeInput($row['tax_name']);
75+
echo "<tr>";
76+
echo "<td>" . $row['tax_name'] . "</td>";
77+
78+
if ($view == 'monthly') {
79+
for ($i = 1; $i <= 12; $i++) {
80+
$monthly_tax = getMonthlyTax($tax_name, $i, $year, $mysqli);
81+
echo "<td class='text-right'>" . numfmt_format_currency($currency_format, $monthly_tax, $company_currency) . "</td>";
8782
}
83+
} else {
84+
for ($q = 1; $q <= 4; $q++) {
85+
$quarterly_tax = getQuarterlyTax($tax_name, $q, $year, $mysqli);
86+
echo "<td class='text-right'>" . numfmt_format_currency($currency_format, $quarterly_tax, $company_currency) . "</td>";
87+
}
88+
}
8889

89-
// Calculate total for row and echo bold
90-
$total_tax = getTotalTax($row['tax_name'], $year, $mysqli);
91-
echo "<td class='text-right text-bold'>" . numfmt_format_currency($currency_format, $total_tax, $company_currency) . "</td>";
92-
echo "</tr>";
90+
// Calculate total for row and echo bold
91+
$total_tax = getTotalTax($tax_name, $year, $mysqli);
92+
echo "<td class='text-right text-bold'>" . numfmt_format_currency($currency_format, $total_tax, $company_currency) . "</td>";
93+
echo "</tr>";
94+
}
95+
?>
96+
<tr>
97+
<th>Total</th>
98+
<?php
99+
if ($view == 'monthly') {
100+
for ($i = 1; $i <= 12; $i++) {
101+
$monthly_tax = getMonthlyTax($tax_name, $i, $year, $mysqli);
102+
echo "<th class='text-right'>" . numfmt_format_currency($currency_format, $monthly_tax, $company_currency) . "</th>";
103+
}
104+
} else {
105+
for ($q = 1; $q <= 4; $q++) {
106+
$quarterly_tax = getQuarterlyTax($tax_name, $q, $year, $mysqli);
107+
echo "<th class='text-right'>" . numfmt_format_currency($currency_format, $quarterly_tax, $company_currency) . "</th>";
108+
}
93109
}
94110
?>
95-
<tr>
96-
<th>Total</th>
97-
<?php
98-
if ($view == 'monthly') {
99-
for ($i = 1; $i <= 12; $i++) {
100-
$monthly_tax = getMonthlyTax($row['tax_name'], $i, $year, $mysqli);
101-
echo "<th class='text-right'>" . numfmt_format_currency($currency_format, $monthly_tax, $company_currency) . "</th>";
102-
}
103-
} else {
104-
for ($q = 1; $q <= 4; $q++) {
105-
$quarterly_tax = getQuarterlyTax($row['tax_name'], $q, $year, $mysqli);
106-
echo "<th class='text-right'>" . numfmt_format_currency($currency_format, $quarterly_tax, $company_currency) . "</th>";
107-
}
108-
}
109-
?>
110-
<td></td>
111-
</tr>
112-
111+
<td></td>
112+
</tr>
113+
113114
</tbody>
114115
</table>
115116
</div>

0 commit comments

Comments
 (0)