Skip to content

Commit

Permalink
#40: Add "Last 12 Months" preset
Browse files Browse the repository at this point in the history
  • Loading branch information
lat9 committed Apr 25, 2023
1 parent b889d61 commit 79d54af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
// certificates, it will have a total of 0. In this
// situation, the order will not be displayed in the results.
//
// EXAMPLE: 'EXCLUDE_PRODUCTS' => serialize(array(25, 14, 43)) );
// EXAMPLE: 'EXCLUDE_PRODUCTS' => serialize([25, 14, 43]) );
//
'EXCLUDE_PRODUCTS' => serialize([]),

Expand All @@ -114,10 +114,10 @@
'HEADING_TITLE_SORT' => '2. Sort & Specify Results',
'HEADING_TITLE_PROCESS' => '3. Generate Report',
'SEARCH_TIMEFRAME' => 'Timeframe',
'SEARCH_TIMEFRAME_DAY' => 'Daily',
'SEARCH_TIMEFRAME_WEEK' => 'Weekly',
'SEARCH_TIMEFRAME_MONTH' => 'Monthly',
'SEARCH_TIMEFRAME_YEAR' => 'Annually',
'SEARCH_TIMEFRAME_DAY' => ' Daily',
'SEARCH_TIMEFRAME_WEEK' => ' Weekly',
'SEARCH_TIMEFRAME_MONTH' => ' Monthly',
'SEARCH_TIMEFRAME_YEAR' => ' Annually',
'SEARCH_TIMEFRAME_SORT' => 'Timeframe Sort',
'SEARCH_DATE_PRESET' => 'Preset Date Range',
'SEARCH_DATE_CUSTOM' => 'Custom Date Range',
Expand All @@ -126,6 +126,7 @@
'SEARCH_DATE_LAST_MONTH' => ' Last Month (%s)',
'SEARCH_DATE_THIS_MONTH' => ' This Month (%s)',
'SEARCH_DATE_LAST_YEAR' => ' Last Year (%s)',
'SEARCH_DATE_LAST_12_MONTHS' => ' Last 12 Months',
'SEARCH_DATE_YTD' => ' YTD (%s)',
'SEARCH_START_DATE' => 'Start Date',
'SEARCH_END_DATE' => 'End Date (inclusive)',
Expand Down
9 changes: 9 additions & 0 deletions zc_plugins/SalesReport/v4.0.0/admin/stats_sales_report2.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,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 @@ -542,6 +546,11 @@
<?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')))); ?>
Expand Down

0 comments on commit 79d54af

Please sign in to comment.