Merge pull request #1083 from itflow-org/tax-report-tidy

Tidy up the tax report + perms
This commit is contained in:
Johnny 2024-10-03 16:52:18 -04:00 committed by GitHub
commit 5ea271662b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 38 additions and 37 deletions

View File

@ -2,7 +2,7 @@
require_once "inc_all_reports.php";
validateAccountantRole();
enforceUserPermission('module_financial');
$year = isset($_GET['year']) ? intval($_GET['year']) : date('Y');
@ -69,47 +69,48 @@ $sql_tax = mysqli_query($mysqli, "SELECT `tax_name` FROM `taxes`");
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($sql_tax)) {
echo "<tr>";
echo "<td>" . $row['tax_name'] . "</td>";
<?php
while ($row = mysqli_fetch_array($sql_tax)) {
$tax_name = sanitizeInput($row['tax_name']);
echo "<tr>";
echo "<td>" . $row['tax_name'] . "</td>";
if ($view == 'monthly') {
for ($i = 1; $i <= 12; $i++) {
$monthly_tax = getMonthlyTax($row['tax_name'], $i, $year, $mysqli);
echo "<td class='text-right'>" . numfmt_format_currency($currency_format, $monthly_tax, $company_currency) . "</td>";
}
} else {
for ($q = 1; $q <= 4; $q++) {
$quarterly_tax = getQuarterlyTax($row['tax_name'], $q, $year, $mysqli);
echo "<td class='text-right'>" . numfmt_format_currency($currency_format, $quarterly_tax, $company_currency) . "</td>";
}
if ($view == 'monthly') {
for ($i = 1; $i <= 12; $i++) {
$monthly_tax = getMonthlyTax($tax_name, $i, $year, $mysqli);
echo "<td class='text-right'>" . numfmt_format_currency($currency_format, $monthly_tax, $company_currency) . "</td>";
}
} else {
for ($q = 1; $q <= 4; $q++) {
$quarterly_tax = getQuarterlyTax($tax_name, $q, $year, $mysqli);
echo "<td class='text-right'>" . numfmt_format_currency($currency_format, $quarterly_tax, $company_currency) . "</td>";
}
}
// Calculate total for row and echo bold
$total_tax = getTotalTax($row['tax_name'], $year, $mysqli);
echo "<td class='text-right text-bold'>" . numfmt_format_currency($currency_format, $total_tax, $company_currency) . "</td>";
echo "</tr>";
// Calculate total for row and echo bold
$total_tax = getTotalTax($tax_name, $year, $mysqli);
echo "<td class='text-right text-bold'>" . numfmt_format_currency($currency_format, $total_tax, $company_currency) . "</td>";
echo "</tr>";
}
?>
<tr>
<th>Total</th>
<?php
if ($view == 'monthly') {
for ($i = 1; $i <= 12; $i++) {
$monthly_tax = getMonthlyTax($tax_name, $i, $year, $mysqli);
echo "<th class='text-right'>" . numfmt_format_currency($currency_format, $monthly_tax, $company_currency) . "</th>";
}
} else {
for ($q = 1; $q <= 4; $q++) {
$quarterly_tax = getQuarterlyTax($tax_name, $q, $year, $mysqli);
echo "<th class='text-right'>" . numfmt_format_currency($currency_format, $quarterly_tax, $company_currency) . "</th>";
}
}
?>
<tr>
<th>Total</th>
<?php
if ($view == 'monthly') {
for ($i = 1; $i <= 12; $i++) {
$monthly_tax = getMonthlyTax($row['tax_name'], $i, $year, $mysqli);
echo "<th class='text-right'>" . numfmt_format_currency($currency_format, $monthly_tax, $company_currency) . "</th>";
}
} else {
for ($q = 1; $q <= 4; $q++) {
$quarterly_tax = getQuarterlyTax($row['tax_name'], $q, $year, $mysqli);
echo "<th class='text-right'>" . numfmt_format_currency($currency_format, $quarterly_tax, $company_currency) . "</th>";
}
}
?>
<td></td>
</tr>
<td></td>
</tr>
</tbody>
</table>
</div>