update pull master

This commit is contained in:
Aung Myo
2017-06-27 16:48:05 +06:30
28 changed files with 1639 additions and 329 deletions

View File

@@ -117,23 +117,6 @@
</div>
</div>
<!--
<div class = "row">
<div class = "span3">
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
</div>
<div class = "span3">
<select name="shift" id="shift">
<option value="">All Shift</option>
</select>
</div>
<div class = "span3">
</div>
</div>
-->
<script type="text/javascript">
$(function(){
$('#custom_excel').hide();
@@ -145,7 +128,68 @@ $(function(){
// window.location = url;
});
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
});
//Reset the form to pervious values
$("#branch").val(<%=params[:branch]%>);
$("#waiter").val("<%=params[:waiter]%>");
$("#cashier").val(<%=params[:cashier]%>);
$("#product").val(<%=params[:product]%>);
$("#singer").val(<%=params[:singer]%>);
$("#item").val('<%=params[:item]%>');
$("#guest_role").val('<%=params[:guest_role]%>');
$("#from").val("<%=params[:from]%>");
$("#to").val("<%=params[:to]%>");
$("#sel_period").val(<%=params[:period]%>);
$("#sel_sale_type").val(<%=params[:sale_type]%>);
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
</script>

View File

@@ -1,135 +1,43 @@
<div class="span12">
<div class="table-responsive">
<% unless @sale_data.empty? %>
<h3 align="center"><%=current_active_location.name%></h3>
<h3 align="center">Sales Summary Report (BreadTalk)</h3>
<% if params[:from]%>
<h4>From Date : <%= params[:from] %> , To Date : <%= params[:to] %></h4>
<% end %>
<table class="table table-bordered" border="1">
<thead>
<tr>
<!-- <th style='text-align:center;'>Sr.no</th> -->
<th style='text-align:center;'>Location Name</th>
<th style='text-align:center;'>Date</th>
<th style='text-align:center;'>Cash Sales</th>
<th style='text-align:center;'>Credit Sales</th>
<th style='text-align:center;'>Credit Received</th>
<!-- <th style='text-align:center;'>Other Payment</th> -->
<th style='text-align:center;'>Card Payment</th>
<th style='text-align:center;'>Total Discount</th>
<th style='text-align:center;'>Total Taxes</th>
<th style='text-align:center;'>Total Other Charges</th>
<th style='text-align:center;'>FOC Sales</th>
<th style='text-align:center;'>Void Sales</th>
<th style='text-align:center;'>Grand Total</th>
</tr>
</thead>
<tbody>
<% void = 0 %>
<% card = 0 %>
<% credit_payment = 0 %>
<% cash = 0 %>
<% credit = 0 %>
<% foc = 0 %>
<% discount = 0 %>
<% total = 0 %>
<% count = 1 %>
<% discount_rev = 0 %>
<% total_rev = 0 %>
<% grand_rev = 0 %>
<% total_other_charges=0 %>
<% total_tax=0 %>
<% cash_received = 0 %>
<% total_cash_received = 0 %>
<% today_credit_payment_amount = 0 %>
<% old_location_id = 0%>
<% sub_total = 0 %>
<% count_of_void = 0 %>
<% flag = false %>
<% @sale_data.each do |sale| %>
<% credit_payment += sale[:credit_payment].to_f %>
<% card += sale[:card_amount].to_f %>
<% cash += sale[:cash_amount].to_f %>
<% credit += sale[:credit_amount].to_f %>
<% foc += sale[:foc_amount].to_f %>
<% discount += sale[:total_discount].to_f %>
<% total += sale[:grand_total].to_f %>
<% total_other_charges +=sale[:other_charges].to_f %>
<% total_tax +=sale[:total_tax].to_f %>
<table class="table table-striped">
<thead>
<tr>
<th style='text-align:center;'>Date</th>
<th style='text-align:center;'>Receipt No</th>
<th style='text-align:center;'>Cashier Name</th>
<th style='text-align:center;'>Gross Sales</th>
<th style='text-align:center;'>Discount</th>
<th style='text-align:center;'>Total Sales</th>
<% TaxProfile.all.each do |r|%>
<th style='text-align:center;'><%=r.name%></th>
<% end %>
<th style='text-align:center;'>Nett Sales</th>
</tr>
</thead>
<% cash_received = sale[:cash_amount].to_f + sale[:credit_payment].to_f%>
<% total_cash_received = cash.to_f + credit_payment.to_f%>
<% today_credit_payment_amount += sale[:today_credit_payment].to_f %>
<tr>
<!-- <td style='text-align:right;'><%= count %></td> -->
<td style='text-align:right;'><%= sale[:location].to_s rescue '-' %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_payment].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:card_amount].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:total_discount].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:total_tax].to_f), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:other_charges].to_f), :delimiter => ',') %></td>
<td style='text-align:right;color: pink;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount].to_f), :delimiter => ',') %></td>
<% total_void_amount = 0 %>
<% if !@daily_void.nil? %>
<% @daily_void.each do |d_v|%>
<% if d_v[:daily_void_amt].to_i > 0 %>
<% if d_v[:location_id] == sale[:location_id] %>
<% if d_v[:date].utc.getlocal.strftime("%Y-%m-%d").to_s == sale[:sale_date].to_s%>
<%count_of_void+=1%>
<%total_void_amount += d_v[:daily_void_amt].to_f%>
<% flag = true %>
<%end %>
<% end%>
<% end%>
<% end%>
<% end%>
<% if flag == true%>
<% void += total_void_amount.to_f %>
<td style='color:red;text-align:right;'> <%= number_with_delimiter(sprintf("%.2f",total_void_amount.to_f), :delimiter => ',') %></td>
<% flag = false %>
<% end%>
<%if count_of_void == 0%>
<td style='color:red;text-align:right;'> <%= number_with_delimiter(sprintf("%.2f",0.to_f), :delimiter => ',') %></td>
<%end %>
<td style='text-align:right;'>
<%= number_with_delimiter(sprintf("%.2f",((sale[:cash_amount].to_f + sale[:credit_amount].to_f + sale[:card_amount].to_f + sale[:credit_payment].to_f) - sale[:today_credit_payment].to_f) ).to_f, :delimiter => ',') %>
</td>
</tr>
<%count_of_void= 0%>
<% count = count + 1 %>
<% end %>
<tr style="font-weight:600;">
<td colspan="2" style='text-align:center;'>Grand Total</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit_payment ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",card ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",discount ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total_tax ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total_other_charges ), :delimiter => ',') %></td>
<td style='text-align:right;color: pink;'><%= number_with_delimiter(sprintf("%.2f",foc ), :delimiter => ',') %></td>
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",void ), :delimiter => ',') %></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f", (cash.to_f + credit.to_f + card.to_f + credit_payment.to_f) - today_credit_payment_amount.to_f ).to_f, :delimiter => ',') %></td>
</tr>
</tbody>
<% end %>
</table>
<tbody>
<% total_sales = 0 %>
<% net_sales = 0 %>
<% @sale_data.each do |sale| %>
<% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%>
<% net_sales = total_sales.to_f + sale.total_tax.to_f%>
<tr>
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
<% sale.sale_taxes.each do |sale|%>
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
<% end %>
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>