fixed conflict
This commit is contained in:
4
Gemfile
4
Gemfile
@@ -93,4 +93,8 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
|
||||
gem 'httparty', '~> 0.15.5'
|
||||
|
||||
# gem 'momentjs-rails', '>= 2.9.0'
|
||||
# gem 'bootstrap-datepicker-rails'
|
||||
# gem 'momentjs-rails', '>= 2.9.0'
|
||||
# gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
|
||||
gem 'bootstrap-datepicker-rails'
|
||||
|
||||
@@ -17,5 +17,11 @@
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
//= require settings/processing_items
|
||||
//= require bootstrap-datepicker
|
||||
//= require bootstrap-datepicker/core
|
||||
//= require bootstrap-datepicker/locales/bootstrap-datepicker.es
|
||||
|
||||
|
||||
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
|
||||
$('.dropdown-toggle').dropdown();
|
||||
});
|
||||
|
||||
@@ -188,11 +188,17 @@ $(document).ready(function(){
|
||||
|
||||
function show_customer_details(customer_id){
|
||||
|
||||
$('.customer_detail').removeClass('hide');
|
||||
if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
|
||||
var url = customer_id+"/get_customer/"
|
||||
}else{
|
||||
var url = "origami/"+customer_id+"/get_customer/"
|
||||
}
|
||||
|
||||
$('.customer_detail').removeClass('hide');
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "origami/"+customer_id+"/get_customer/",
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
@@ -201,10 +207,10 @@ $(document).ready(function(){
|
||||
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||
var balance = data["response_data"]["data"][i]["balance"];
|
||||
console.log(balance);
|
||||
if (balance) {
|
||||
$("#customer_amount").text(balance);
|
||||
if (balance == "0.0") {
|
||||
$("#customer_amount").text('0.0');
|
||||
}else{
|
||||
$("#customer_amount").text('00');
|
||||
$("#customer_amount").text(balance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
@import "bootstrap";
|
||||
@import "font-awesome";
|
||||
@import "theme";
|
||||
@import "bootstrap-datepicker3";
|
||||
@import 'bootstrap-datepicker';
|
||||
|
||||
/* Show it is fixed to the top */
|
||||
// body {
|
||||
|
||||
@@ -63,7 +63,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
name = customer_params[:name]
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
date_of_birth = customer_params[:date_of_birth]
|
||||
dob = customer_params[:date_of_birth]
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
@@ -72,7 +72,9 @@ class Crm::CustomersController < BaseCrmController
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: date_of_birth,
|
||||
|
||||
dob: dob,
|
||||
|
||||
member_group_id: member_group_id,merchant_uid:merchant_uid}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
@@ -123,8 +125,8 @@ end
|
||||
name = customer_params[:name]
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
date_of_birth = customer_params[:date_of_birth]
|
||||
id = customer_params[:membership_id]
|
||||
dob = customer_params[:date_of_birth]
|
||||
id = @crm_customer.membership_id
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
@@ -133,7 +135,7 @@ end
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
date_of_birth: date_of_birth,
|
||||
dob: dob,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
|
||||
@@ -28,8 +28,8 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
# if @membership["status"] == true
|
||||
# @member_group = @membership["data"]
|
||||
# end
|
||||
puts "Errrrrrrrrrrrrrrrrr"
|
||||
puts @crm_customer.new_record?
|
||||
# puts "Errrrrrrrrrrrrrrrrr"
|
||||
# puts @crm_customer.valid?
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
@@ -1,9 +1,85 @@
|
||||
class Reports::ReceiptNoController < BaseReportController
|
||||
class Reports::ReceiptNoController < ApplicationController
|
||||
PERIOD = {
|
||||
"today" => 0,
|
||||
"yesterday" => 1,
|
||||
"this_week" => 2,
|
||||
"last_week" => 3,
|
||||
"last_7" => 4,
|
||||
"this_month" => 5,
|
||||
"last_month" => 6,
|
||||
"last_30" => 7,
|
||||
"this_year" => 8,
|
||||
"last_year" => 9
|
||||
}
|
||||
|
||||
def index
|
||||
@hi = "hi"
|
||||
from, to = get_date_range_from_params
|
||||
puts "from..."
|
||||
puts from
|
||||
puts "to..."
|
||||
puts to
|
||||
@sale_data = Sale.get_receipt_no_list(from,to)
|
||||
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
def get_date_range_from_params
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
day_ref = Time.now
|
||||
if period_type.to_i == 1
|
||||
if params[:from] && params[:to]
|
||||
if params[:from] != "" && params[:to] !=""
|
||||
from = DateTime.strptime(params[:from], "%m/%d/%Y")
|
||||
to = DateTime.strptime(params[:to], "%m/%d/%Y")
|
||||
else
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
end
|
||||
end
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
return from, to
|
||||
end
|
||||
end
|
||||
@@ -263,4 +263,8 @@ class Sale < ApplicationRecord
|
||||
def generate_custom_id
|
||||
self.sale_id = SeedGenerator.generate_id(self.class.name, "SAL")
|
||||
end
|
||||
|
||||
def self.get_receipt_no_list(from,to)
|
||||
sale = Sale.where("sale_status=? and receipt_date between ? and ?","completed",from,to)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li><%= link_to "Daily Sale Report", origami_root_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Sales Item Report", origami_root_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Receipt Report", origami_root_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
246
app/views/reports/receipt_no/_shift_sale_report_filter.html.erb
Normal file
246
app/views/reports/receipt_no/_shift_sale_report_filter.html.erb
Normal file
@@ -0,0 +1,246 @@
|
||||
<%= form_tag report_path, :method => :get, :id=>"frm_report" do %>
|
||||
<div class="row">
|
||||
<div class="span3">
|
||||
<% if defined? product_account %>
|
||||
<%= select_tag "account", options_from_collection_for_select(@accounts,"id","title", :selected => params[:account])%>
|
||||
<% end %>
|
||||
<% if defined? shift_product_account %>
|
||||
<%= select_tag "account", options_from_collection_for_select(@accounts,"id","title", :selected => params[:account]), :prompt => 'All Group'%>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="span3">
|
||||
<% if period_type != false %>
|
||||
<label class="radio inline top-valign">
|
||||
<input type="radio" id="rd_period_type_0" name="period_type" value="0" checked></input>
|
||||
</label>
|
||||
<select name="period" id="sel_period">
|
||||
<option value="0">Today</option>
|
||||
<option value="1">Yesterday</option>
|
||||
<option value="2">This week</option>
|
||||
<option value="3">Last week</option>
|
||||
<option value="4">Last 7 days</option>
|
||||
<option value="5">This month</option>
|
||||
<option value="6">Last month</option>
|
||||
<option value="7">Last 30 days</option>
|
||||
<option value="8">This year</option>
|
||||
<option value="9">Last year</option>
|
||||
</select>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="span3">
|
||||
<div class="btn-group">
|
||||
<a href="javascript:export_to('<%=report_path%>.xls')" class = "btn" >Export to Excel</a>
|
||||
<button class="btn dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<!-- <ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="javascript:export_to('<%=report_path%>.pdf')" class = "btn" >Export to Pdf</a>
|
||||
</li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
<!-- <div class="span3">
|
||||
<% url = url_for(:format => 'xls')%>
|
||||
<div class="btn-group">
|
||||
<div id="default_excel">
|
||||
<a href="javascript:export_to('<%=report_path%>.xls')" class = "btn" >Export to Excel</a>
|
||||
</div>
|
||||
|
||||
<div id="custom_excel" data-url="<%= url %>">
|
||||
<a href="#" class="btn">Export to Excel</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span3">
|
||||
<% if defined? show_sale_type %>
|
||||
<select name="sale_type" id="sel_sale_type">
|
||||
<option value="0">All Sale Type</option>
|
||||
<option value="1">Revenue Only</option>
|
||||
<option value="2">Discount Only</option>
|
||||
<option value="3">Void Only</option>
|
||||
<option value="4">Taxes Only</option>
|
||||
<option value="5">Other Amount Only</option>
|
||||
</select>
|
||||
<% end %>
|
||||
|
||||
<% if defined? promotions %>
|
||||
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]) %>
|
||||
<% end %>
|
||||
|
||||
<% if defined? menu_types %>
|
||||
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]) %>
|
||||
<% end %>
|
||||
|
||||
<% if defined? payments %>
|
||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]) %>
|
||||
<% end %>
|
||||
|
||||
<% if defined? shift_name %>
|
||||
<select name="shift_name" id="shift_name">
|
||||
</select>
|
||||
<% end %>
|
||||
<% if defined? cashiers %>
|
||||
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations" %>
|
||||
<% end %>
|
||||
|
||||
<% if defined? singer %>
|
||||
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List" %>
|
||||
<% end %>
|
||||
|
||||
<% if defined? bsm %>
|
||||
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List" %>
|
||||
<% end %>
|
||||
|
||||
<% if defined? guest_role %>
|
||||
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List" %>
|
||||
<% end %>
|
||||
|
||||
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
|
||||
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]) %>
|
||||
<% end %>
|
||||
|
||||
<% if defined? products %>
|
||||
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products" %>
|
||||
<% end %>
|
||||
<% if defined? items %>
|
||||
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="span3">
|
||||
|
||||
<label class="radio inline top-valign">
|
||||
<input type="radio" id="rd_period_type_1" name="period_type" value="1">
|
||||
<div class="input-prepend margin-left-3">
|
||||
<span class="add-on">From</span>
|
||||
<input data-behaviour='datepicker' class="span2" name="from" id="from" type="text" placeholder="From date">
|
||||
</div>
|
||||
</label>
|
||||
<div class="input-prepend margin-left-23">
|
||||
<span class="add-on">To    </span>
|
||||
<input data-behaviour='datepicker' class="span2" name="to" id="to" type="text" placeholder="To date">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<% if defined? show_monthly %>
|
||||
<div class="span3" style="margin-bottom:10px;">
|
||||
<input type="hidden" id="report_type" name="report_type" value="0">
|
||||
<div class="btn-group" data-toggle="buttons-radio">
|
||||
<!-- <button id="btn_report_type_0" onclick="$('#report_type').val(0)" type="button" class="btn btn-inverse active">Daily</button> -->
|
||||
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
|
||||
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="span3">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</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>
|
||||
-->
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('#custom_excel').hide();
|
||||
|
||||
$('#custom_excel').click(function(){
|
||||
var url = $('#custom_excel').attr('data-url');
|
||||
$('#frm_report').attr('action',url)
|
||||
$('#frm_report').submit();
|
||||
// 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>
|
||||
@@ -1,3 +1,95 @@
|
||||
<div class="row">
|
||||
<%= @hi %>
|
||||
</div>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Receipt List Report</li>
|
||||
<span style="float: center">
|
||||
<%= render :partial=>'shift_sale_report_filter',:locals=>{ :period_type => true,
|
||||
:shift_name => true, :report_path => reports_receipt_no_index_path} %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<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>
|
||||
<th style='text-align:center;'>CT</th>
|
||||
<th style='text-align:center;'>Nett Sales</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<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;'><%=sale.cashier_id 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>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_tax.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%= paginate @sale_data %>
|
||||
<script>
|
||||
$(function(){
|
||||
var check_arr = [];
|
||||
var search = '<%= params[:period_type] %>';
|
||||
if(search){
|
||||
if(parseInt(search) == 0){
|
||||
search_by_period();
|
||||
}
|
||||
else{
|
||||
search_by_date();
|
||||
}
|
||||
}else{
|
||||
search_by_period();
|
||||
}
|
||||
$('#sel_period').change(function(){
|
||||
search_by_period();
|
||||
});
|
||||
function search_by_period(){
|
||||
var period = $('#sel_period').val();
|
||||
var period_type = 0;
|
||||
var from = "";
|
||||
var to = "";
|
||||
}
|
||||
|
||||
$('#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){
|
||||
}
|
||||
if(check_arr.length == 3){
|
||||
check_arr = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
135
app/views/reports/receipt_no/index.xls.erb
Normal file
135
app/views/reports/receipt_no/index.xls.erb
Normal file
@@ -0,0 +1,135 @@
|
||||
<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 %>
|
||||
|
||||
<% 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>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user