|
2 | 2 |
|
3 | 3 | require_once "inc_all_reports.php"; |
4 | 4 |
|
5 | | -validateAccountantRole(); |
| 5 | +enforceUserPermission('module_financial'); |
6 | 6 |
|
7 | 7 | $year = isset($_GET['year']) ? intval($_GET['year']) : date('Y'); |
8 | 8 |
|
|
69 | 69 | </tr> |
70 | 70 | </thead> |
71 | 71 | <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>"; |
87 | 82 | } |
| 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 | + } |
88 | 89 |
|
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 | + } |
93 | 109 | } |
94 | 110 | ?> |
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 | + |
113 | 114 | </tbody> |
114 | 115 | </table> |
115 | 116 | </div> |
|
0 commit comments