commission report export excel

This commit is contained in:
Zin Lin Phyo
2017-08-29 23:05:03 +06:30
parent 5fcfbdc020
commit 4b97cd530e
5 changed files with 139 additions and 159 deletions

View File

@@ -6,20 +6,31 @@
<div class="form-group col-md-3">
<label class="">Select Date Range</label>
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
<% if @daterange %>
<input class="form-control" name="daterange" id="daterange" value="<%= @daterange %>" type="text" placeholder="Date Range" readonly="true">
<% else %>
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
<% end %>
</div>
<div class="form-group col-md-3">
<label class="">Commissioner</label>
<select class="form-control" name="commissioner" id="commissioner">
<option value=""></option>
<% @commissioner.each do |c| %>
<option value="<%= c.id %>"><%= c.name %></option>
<% if @com_id == c.id %>
<option value="<%= c.id %>" selected><%= c.name %></option>
<% else %>
<option value="<%= c.id %>"><%= c.name %></option>
<% end %> %>
<% end %>
</select>
</div>
<div class="form-group col-md-2 margin-top-20">
<input type="submit" value="Generate Report" class='btn btn-primary'>
</div>
<div class="form-group col-md-2 margin-top-20">
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
</div>
</div>
<% 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'));
});