diff --git a/.idea/sxrestaurant.iml b/.idea/sxrestaurant.iml
index 7db49a58..6c1240f7 100644
--- a/.idea/sxrestaurant.iml
+++ b/.idea/sxrestaurant.iml
@@ -52,6 +52,7 @@
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e3687c57..1c0d6110 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,18 +5,8 @@
-
-
-
-
-
-
-
-
-
-
@@ -58,10 +48,10 @@
-
+
-
+
@@ -82,34 +72,21 @@
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -125,36 +102,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -189,7 +136,6 @@
@@ -264,10 +211,9 @@
-
-
-
+
+
@@ -336,6 +282,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -741,12 +702,12 @@
-
+
-
+
@@ -758,19 +719,20 @@
-
+
+
-
+
-
+
-
+
-
+
@@ -788,25 +750,11 @@
-
-
- file://$PROJECT_DIR$/app/controllers/reports/commission_controller.rb
- 4
-
-
-
-
-
-
-
-
-
-
@@ -860,14 +808,6 @@
-
-
-
-
-
-
-
-
@@ -1126,26 +1066,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1160,14 +1084,6 @@
-
-
-
-
-
-
-
-
@@ -1176,28 +1092,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1205,5 +1102,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/controllers/reports/commission_controller.rb b/app/controllers/reports/commission_controller.rb
index df484589..98f98457 100644
--- a/app/controllers/reports/commission_controller.rb
+++ b/app/controllers/reports/commission_controller.rb
@@ -2,9 +2,15 @@ class Reports::CommissionController < BaseReportController
# authorize_resource :class => false
def index
- from_date = Date.parse(params[:daterange].split(' - ')[0]).beginning_of_day.utc.getlocal
- to_date = Date.parse(params[:daterange].split(' - ')[1]).end_of_day.utc.getlocal
+ from_date = DateTime.now.beginning_of_day.utc.getlocal
+ to_date = DateTime.now.end_of_day.utc.getlocal
+ unless params[:daterange].blank?
+ from_date = Date.parse(params[:daterange].split(' - ')[0]).beginning_of_day.utc.getlocal
+ to_date = Date.parse(params[:daterange].split(' - ')[1]).end_of_day.utc.getlocal
+ @daterange = params[:daterange]
+ end
commissioner = params[:commissioner].to_i
+ @com_id = commissioner
@commissioner = Commissioner.active.all
@transaction = ProductCommission.get_transaction(from_date, to_date, commissioner)
diff --git a/app/views/reports/commission/_commission_report_filter.html.erb b/app/views/reports/commission/_commission_report_filter.html.erb
index acfcef25..b7ac154e 100644
--- a/app/views/reports/commission/_commission_report_filter.html.erb
+++ b/app/views/reports/commission/_commission_report_filter.html.erb
@@ -6,20 +6,31 @@
-
+ <% if @daterange %>
+
+ <% else %>
+
+ <% end %>
+
+
+
<% end %>
@@ -35,21 +46,26 @@
placeholder: 'Select Commissioner'
});
+ $('#clear_filter').click(function () {
+ $('#daterange').val('');
+ $('#commissioner').val('').text('');
+ });
+
$('input[name="daterange"]').daterangepicker({
- autoUpdateInput: false,
- ranges: {
- 'Today': [moment(), moment()],
- 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
- 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
- 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
- 'This Month': [moment().startOf('month'), moment().endOf('month')],
- 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
+ autoUpdateInput: false,
+ ranges: {
+ 'Today': [moment(), moment()],
+ 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
+ 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
+ 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
+ 'This Month': [moment().startOf('month'), moment().endOf('month')],
+ 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
+ },
+ locale: {
+ format: 'YYYY-MM-DD'
+ }
},
- locale: {
- format: 'YYYY-MM-DD'
- }
- },
- function(start, end, label) {
+ function (start, end, label) {
$('input[name="daterange"]').val(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD'));
});
diff --git a/dump.rdb b/dump.rdb
index 56908672..dfef99fa 100644
Binary files a/dump.rdb and b/dump.rdb differ