CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: Trying to predict where we are in the (tax) year...  (Read 21 times)

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 653
  • Karma: +8/-0
    • GrumpyYoungMan
Trying to predict where we are in the (tax) year...
« on: 23 Nov 2022, 07:18:17 am »
Code: [Select]
$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:
Code: [Select]
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...
« Last Edit: 23 Nov 2022, 07:38:34 am by GrumpyYoungMan »
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 854
  • Karma: +162/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Trying to predict where we are in the (tax) year...
« Reply #1 on: 23 Nov 2022, 11:16:43 pm »
Considering tax years are either calendar years or arbitrary "fiscal years" ending on the last day of a particular month, I'm not sure why you're checking for the filing due date which should be completely unrelated when looking at customer invoices.
I'll fix every flaw, I'll break every law, I'll tear up the rulebook if that's what it takes. You will see, I will crush this cold machine.

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 653
  • Karma: +8/-0
    • GrumpyYoungMan
Re: Trying to predict where we are in the (tax) year...
« Reply #2 on: 24 Nov 2022, 02:24:40 pm »
Considering tax years are either calendar years or arbitrary "fiscal years" ending on the last day of a particular month, I'm not sure why you're checking for the filing due date which should be completely unrelated when looking at customer invoices.
In the UK the tax year starts April 6th and runs until the following April 05th… don’t ask me why… they are also now forcing all businesses to change to this too…

This is only going to generate a year report of sales/expenses
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

 

SMF spam blocked by CleanTalk

Advertisement