$start = strtotime("now") > strtotime("April 6th") ? date("Y") : date("Y")+1;
$end = strtotime("now") > strtotime("April 6th") ? date("Y")+1 : date("Y");
Which will then be used to do something like:
echo '<hr><table>
<thead>
<tr>
<th>Expense Type</th>
<th>Date</th>
<th>Invoice #</th>
<th>Supplier</th>
<th>Total</th>
</tr>
</thead>
<tbody>';
$inInvoices = $db->prepare("
SELECT
*
FROM
".SQL_TBL_PREFIX."suppliers
WHERE
`Date` BETWEEN ? AND ?
");
$inInvoices->execute([ $start.'-04-06', $end.'-04-05' ]);
while( $r = $inInvoices->fetch() ) {
echo '<tr>
<td>', $r['Expenses Type'],'</td>
<td>', $r['Date'],'</td>
<td>', $r['Invoice #'],'</td>
<td>', $r['Supplier Name'],'</td>
<td>', number_format($r['Total Paid'], 2), '</td>
</tr>';
}
echo '</tbody>
</table>';
As I am trying to predict the tax year(s) by using the above code... Is it really that easy?
At a later stage we may be able to change the tax year to calculate other years from the DB...