Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Last 12 months" as a preset #34

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
define('SEARCH_DATE_LAST_MONTH', ' Last Month (%s)');
define('SEARCH_DATE_THIS_MONTH', ' This Month (%s)');
define('SEARCH_DATE_LAST_YEAR', ' Last Year (%s)');
define('SEARCH_DATE_LAST_12_MONTHS', ' Last 12 Months');
define('SEARCH_DATE_YTD', ' YTD (%s)');
define('SEARCH_START_DATE', 'Start Date');
define('SEARCH_END_DATE', 'End Date (inclusive)');
Expand Down
7 changes: 7 additions & 0 deletions YOUR_ADMIN/stats_sales_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@
$start_date = date(DATE_FORMAT, strtotime('last year January 1st', $today_timestamp));
$end_date = date(DATE_FORMAT, strtotime('last year December 31st', $today_timestamp));
break;
case 'last_12_months':
$start_date = date(DATE_FORMAT, strtotime('1 year ago', $today_timestamp));
$end_date = date(DATE_FORMAT, $today_timestamp);
break;
default:
$_GET['date_preset'] = 'YTD';
$start_date = date(DATE_FORMAT, strtotime('first day of January this year', $today_timestamp));
Expand Down Expand Up @@ -569,6 +573,9 @@ function init()
<tr>
<td class="smallText" id="td_last_year"><?php echo zen_draw_radio_field('date_preset', 'last_year', ($date_preset == 'last_year')) . sprintf(SEARCH_DATE_LAST_YEAR, date("Y") - 1); ?></td>
</tr>
<tr>
<td class="smallText" id="td_last_12_months"><?php echo zen_draw_radio_field('date_preset', 'last_12_months', ($date_preset == 'last_12_months')) . SEARCH_DATE_LAST_12_MONTHS; ?></td>
</tr>
<tr>
<td class="smallText" id="td_YTD"><?php echo zen_draw_radio_field('date_preset', 'YTD', ($date_preset == 'YTD' || !empty($date_custom))) . sprintf(SEARCH_DATE_YTD, "Jan 1 to " . date("M. j Y", mktime(0, 0, 0, date("m"), date("d"), date("Y")))); ?></td>
</tr>
Expand Down