HOWTO Change Default Date Range for Date Picker in ExpenseManager 
This post shows how to alter the default date range in the ExpenseManager software.

You will need access to the software's files on the http server to make this adjustment, which might require FTP access or SSH access to the http server.

1. Log into the server by whatever access means you have
2. Find the file:
<http server root>/<expensemanager root>/application/modules/expenses/views/index.php
and open it in a text editor
3. Search the file to find the follow section of code, it should be about line 152 in the file:
$(".daterange-picker").daterangepicker(
{
locale: {
format: "DD-MM-YYYY"
},
startDate: "<?php echo $sDate = "01-07-".date("Y"); ?>",
endDate: "<?php echo date("d-m-Y", strtotime($sDate. " + 364 day")); ?>"
});


4. Alter the values gained in the startDate and endDate lines.<br/>
NOTE: The values might be different to what is shown here, I think I already edited the values once before this note was made.

Example: I found that after the new year ticked over, my expense manager page was not displaying any records. The problem was that it was using the current year to decide what to show. Because the data I want to see is for a financial year (in Australia the financial year goes from July 1 to June 30 the next year) I needed to add an if {...} else {...} condition to pick up when we were in the first 6 months of a year and make it use the previous year's value. I changes my startDate line to:

startDate: "<?php if (date("m") >= 7) {echo $sDate = "01-07-".date("Y");} else {echo $sDate = "01-07-".date("Y",strtotime("-1 year"));} ?>",

It checks if the month is >= 7 (July), if it is, $sDate is built using the current year as the year value.
If the month is _not_ >= 7 (one of the first six months of the year Jan-Jun) then the else clause will build $sDate and make the year value last year.

Evernote: https://www.evernote.com/shard/s158/sh/b22c6fb0-007e-4083-beb9-319bf946eef2/f456bb1b87b0cedc2f4c71f9895daa19 new=true]HOWTO Change Default Date Range for Date Picker in ExpenseManager

Comments 
Comments are not available for this entry.