207 lines
5.4 KiB
Plaintext
207 lines
5.4 KiB
Plaintext
<div class="page-header">
|
|
<ul class="breadcrumb">
|
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
|
<li>Receipt List Report</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<%= render :partial=>'shift_sale_report_filter',
|
|
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_receipt_no_index_path} %>
|
|
<hr />
|
|
</div>
|
|
|
|
<!-- <div class="container">
|
|
<div class="row">
|
|
<div class="col-md-12 text-right">
|
|
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
|
</div>
|
|
</div>
|
|
</div> -->
|
|
|
|
<div class="container margin-top-20">
|
|
<div class="card row">
|
|
<table class="table table-striped" border="0">
|
|
<thead>
|
|
<% if !params[:from].blank?%>
|
|
<tr>
|
|
<th colspan="7">From Date : <%= params[:from] rescue '-' %> , To Date : <%= params[:to] rescue '-'%></th>
|
|
</tr>
|
|
<% end %>
|
|
<% if @shift_from %>
|
|
<tr>
|
|
<% if @shift.employee %>
|
|
<% cashier_name = !@shift.nil? ? @shift.employee.name : '-' %>
|
|
<% end %>
|
|
<th colspan="7">Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
|
|
</tr>
|
|
<% end %>
|
|
|
|
<tr>
|
|
<th>Recipt No</th>
|
|
<th>Cashier Name</th>
|
|
<th>Total Amount</th>
|
|
<th>Discount Amount </th>
|
|
<th>Tax Amount</th>
|
|
<!-- <th>Other Amount</th> -->
|
|
<th>Grand Total</th>
|
|
<th>Rounding Adj.</th>
|
|
<th>Grand Total +<br/>
|
|
Rounding Adj.
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% grand_total = 0 %>
|
|
<% total_tax = 0 %>
|
|
<% guest_count = 0 %>
|
|
<% total_sum = 0 %>
|
|
<% discount_amt = 0 %>
|
|
<% other_amt = 0 %>
|
|
<% total_nett = 0 %>
|
|
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
|
|
|
<%
|
|
if @sale_data!=nil
|
|
@sale_data.each do |result| %>
|
|
|
|
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
|
<% total_tax += result.total_tax.to_f %>
|
|
<% total_sum += result.total_amount.to_f %>
|
|
<% discount_amt += result.total_discount.to_f %>
|
|
<% rounding_adj += result.rounding_adjustment.to_f %>
|
|
|
|
<tr>
|
|
|
|
<td><%= result.receipt_no rescue '-' %> </td>
|
|
<td><%= result.cashier_name rescue '-' %></td>
|
|
<td><%= result.total_amount rescue '-' %></td>
|
|
<td><%= result.total_discount rescue '-' %></td>
|
|
<td><%= sprintf "%.2f",result.total_tax rescue '-' %></td>
|
|
|
|
|
|
<td><%= result.grand_total %></td>
|
|
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
|
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
|
</tr>
|
|
|
|
<%
|
|
end
|
|
end
|
|
%>
|
|
<tr style="border-top:4px double #666;">
|
|
<td colspan="2"> </td>
|
|
<td><b><%= total_sum rescue '-'%></b></td>
|
|
<td><b><%= discount_amt rescue '-'%></b></td>
|
|
<td><b><%= sprintf "%.2f",total_tax rescue '-'%></b></td><!--
|
|
<td><b><%= sprintf "%.2f",service_charge rescue '-'%></b></td> -->
|
|
<!-- <td><b><%= other_amt rescue '-'%></b></td> -->
|
|
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
|
|
<td><b><%= rounding_adj rescue '-'%></b></td>
|
|
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2"> </td>
|
|
<td>Total Amount</td>
|
|
<td>Discount Amount</td>
|
|
<td>Tax Amount</td>
|
|
<td>Grand Total</td>
|
|
<td>Rounding Adj.</td>
|
|
<td>Grand Total +<br/>
|
|
Rounding Adj.
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
$(function(){
|
|
|
|
var check_arr = [];
|
|
|
|
$('#sel_period').change(function(){
|
|
|
|
search_by_period();
|
|
|
|
});
|
|
|
|
function search_by_period(){
|
|
var period = $('#sel_period').val();
|
|
var period_type = 0;
|
|
var from = "";
|
|
var to = "";
|
|
|
|
show_shift_name(period,period_type,from,to,'shift_item');
|
|
}
|
|
|
|
$('#from').change(function(){
|
|
search_by_date();
|
|
});
|
|
|
|
$('#to').change(function(){
|
|
search_by_date();
|
|
});
|
|
|
|
function search_by_date(){
|
|
var from = $('#from').val();
|
|
var to = $('#to').val();
|
|
var period = 0;
|
|
var period_type = 1;
|
|
|
|
if(to != '' && from != ''){
|
|
shift_name = from + ',' + to;
|
|
|
|
check_arr.push(to);
|
|
|
|
console.log(check_arr.length)
|
|
if(check_arr.length == 1){
|
|
show_shift_name(period,period_type,from,to,'shift_item');
|
|
}
|
|
if(check_arr.length == 3){
|
|
check_arr = [];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function show_shift_name(period,period_type,from,to,shift_item){
|
|
var shift = $('#shift_name');
|
|
|
|
shift.empty();
|
|
|
|
var str = '';
|
|
var param_shift = '';
|
|
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
|
|
|
url = '<%= reports_get_shift_by_date_path %>';
|
|
|
|
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
|
|
|
str = '<option value="0">--- All Shift ---</option>';
|
|
$(data.message).each(function(index){
|
|
|
|
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
|
|
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
|
|
|
|
if(param_shift != ''){
|
|
if(sh_date == param_shift){
|
|
selected = 'selected = "selected"';
|
|
}
|
|
else{
|
|
selected = '';
|
|
}
|
|
}else{
|
|
selected = '';
|
|
}
|
|
str += '<option value="'+ sh_date +'" '+ selected +'>' + local_date + '</option>';
|
|
|
|
// console.log(sh_date)
|
|
})
|
|
shift.append(str);
|
|
});
|
|
}
|
|
|
|
});
|
|
</script> |