Merge branch 'crm' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
3
app/assets/javascripts/reports/shiftsale.coffee
Normal file
3
app/assets/javascripts/reports/shiftsale.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
.selected-item {
|
||||
color: #fff !important;
|
||||
background-color: #54A5AF !important;
|
||||
background-color: #7a62d3 !important;
|
||||
}
|
||||
|
||||
.assign {
|
||||
@@ -23,6 +23,14 @@
|
||||
.assign .text-muted{
|
||||
color: #fff !important;
|
||||
}
|
||||
.normal{
|
||||
color: #fff !important;
|
||||
background-color: #54A5AF;
|
||||
}
|
||||
.cancel {
|
||||
color: #fff !important;
|
||||
background-color: #FF0000;
|
||||
}
|
||||
.red{
|
||||
color: #fff !important;
|
||||
background-color: red;
|
||||
@@ -39,9 +47,9 @@
|
||||
}
|
||||
.card-columns {
|
||||
@include media-breakpoint-only(lg) {
|
||||
column-count: 6;
|
||||
column-count: 5;
|
||||
}
|
||||
@include media-breakpoint-only(xl) {
|
||||
column-count: 6;
|
||||
column-count: 5;
|
||||
}
|
||||
}
|
||||
3
app/assets/stylesheets/reports/shiftsale.scss
Normal file
3
app/assets/stylesheets/reports/shiftsale.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the reports/shiftsale controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -7,7 +7,7 @@ class BaseOrigamiController < ActionController::Base
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
redirect_to origami_root_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
|
||||
@@ -96,6 +96,17 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
end
|
||||
end
|
||||
|
||||
def cancel_queue
|
||||
queue = DiningQueue.find(params[:id])
|
||||
|
||||
status = queue.update_attributes(id: params[:id],status:"Cancel")
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true , notice: 'Dining queue was successfully canceled .'})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
|
||||
@@ -9,7 +9,12 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
sale_items = SaleItem.where("sale_id=?",sale_id)
|
||||
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
rounding_adj = sale_data.grand_total - new_total
|
||||
|
||||
sale_data.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj)
|
||||
# Print for First Bill to Customer
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Origami::SaleEditController < BaseOrigamiController
|
||||
|
||||
authorize_resource :class => false
|
||||
# Index for sale item void OR edit
|
||||
def edit
|
||||
sale_id = params[:sale_id]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
authorize_resource :class => false
|
||||
def overall_void
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
|
||||
18
app/controllers/reports/shiftsale_controller.rb
Normal file
18
app/controllers/reports/shiftsale_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class Reports::ShiftsaleController < ApplicationController
|
||||
# authorize_resource :class => false
|
||||
|
||||
def index
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
@sale_data = Sale.get_by_shiftsales(from,to)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
2
app/helpers/reports/shiftsale_helper.rb
Normal file
2
app/helpers/reports/shiftsale_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Reports::ShiftsaleHelper
|
||||
end
|
||||
@@ -47,6 +47,7 @@ class Ability
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
|
||||
can :first_bill, :payment
|
||||
can :show, :payment
|
||||
can :create, :payment
|
||||
can :reprint, :payment
|
||||
@@ -56,6 +57,14 @@ class Ability
|
||||
|
||||
can :move_dining, :moveroom
|
||||
|
||||
can :edit, :sale_edit
|
||||
can :item_void, :sale_edit
|
||||
can :item_void_cancel, :sale_edit
|
||||
can :cancel_all_void, :sale_edit
|
||||
can :apply_void, :sale_edit
|
||||
|
||||
can :overall_void, :void
|
||||
|
||||
elsif user.role == "cashier"
|
||||
|
||||
can :read, Order
|
||||
|
||||
@@ -322,6 +322,41 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_rounding_adjustment(num)
|
||||
## 0 -- 25 -- 50 -- 75 -- 100
|
||||
# if get_rounded_amt == true
|
||||
value = 0
|
||||
|
||||
num = num.to_f.round
|
||||
get_last_no = num.to_s.last(2).to_f
|
||||
if get_last_no.between?(0,25)
|
||||
## down to 0
|
||||
num -= get_last_no
|
||||
else
|
||||
if get_last_no.between?(26,50)
|
||||
## up to 50
|
||||
value = 50 - get_last_no.to_f
|
||||
num += value
|
||||
puts 'up to 50'
|
||||
else
|
||||
if get_last_no.between?(51, 75)
|
||||
## down to 50
|
||||
value = get_last_no.to_f - 50
|
||||
num -= value
|
||||
puts 'down to 50'
|
||||
else
|
||||
## up to 100
|
||||
value = 100 - get_last_no.to_f
|
||||
num += value
|
||||
puts 'up to 100'
|
||||
end
|
||||
end
|
||||
end
|
||||
# end
|
||||
return num
|
||||
end
|
||||
|
||||
|
||||
def self.daily_sales_list(from,to)
|
||||
payments_total = Sale.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
||||
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||
@@ -387,13 +422,13 @@ def self.get_by_range_by_saleitems(from,to,status,report_type)
|
||||
.group('mi.id')
|
||||
.order("mi.menu_category_id")
|
||||
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id
|
||||
JOIN menu_items mi ON i.product_code = mi.item_code" +
|
||||
" JOIN menu_categories mc ON mc.id = mi.menu_category_id
|
||||
JOIN employees ea ON ea.id = sales.cashier_id")
|
||||
|
||||
|
||||
query = query.where("receipt_date between ? and ? and sale_status=?",from,to,status)
|
||||
query = query.where("receipt_date between ? and ? and sale_status=?",from,to,status)
|
||||
|
||||
|
||||
|
||||
@@ -409,6 +444,10 @@ def self.get_by_range_by_saleitems(from,to,status,report_type)
|
||||
|
||||
end
|
||||
|
||||
def self.get_by_shiftsales(from,to)
|
||||
return ShiftSale.where("(shift_started_at between ? and ? OR shift_closed_at between ? and ? )", from, to, from, to)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
|
||||
@@ -18,19 +18,25 @@
|
||||
<div class="active" role="tabpanel">
|
||||
<div class="tab-pane" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @i =0 %>
|
||||
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" data-id="<%= queue.id %>" style="width: 17.5rem;">
|
||||
<% if queue.status == "Assign"
|
||||
@bg_color = "assign"
|
||||
elsif queue.status == "Cancel"
|
||||
@bg_color = "cancel"
|
||||
else
|
||||
@bg_color = "normal"
|
||||
end
|
||||
%>
|
||||
<div class="card select-queue <%= @bg_color %>" data-id="<%= queue.id %>" style="width: 21.5rem;">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<span class="card-title">
|
||||
<%= @i += 1 %> . Queue No </span>
|
||||
<span class="card-title pull-right">Seater : <%= queue.seater %> </span>
|
||||
<p style="font-size: 30px ;text-align: center;">
|
||||
<strong><%= queue.queue_no %></strong>
|
||||
</p>
|
||||
|
||||
<span class="card-title"><strong> Queue No : <%= queue.queue_no %></strong></span>
|
||||
<span class="card-title pull-right"><strong> Seater : <%= queue.seater %></strong></span><br>
|
||||
<span class="card-title"> Name : <%= queue.name %></span><br>
|
||||
<span class="card-title"> Contact No : <%= queue.contact_no %></span>
|
||||
<span class="card-title"> Remark : <%= queue.remark %></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,7 +49,7 @@
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
||||
|
||||
<button type="button" id="cancel" class="btn btn-warning btn-lg btn-block" disabled>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
@@ -53,20 +59,61 @@ $(function(){
|
||||
$('.select-queue').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var status = $(this).find(".queue-status").text();
|
||||
if(status != "Assign"){
|
||||
if(status != "Assign" && status != "Cancel"){
|
||||
$("#assign").removeAttr("disabled");
|
||||
$("#cancel").removeAttr("disabled");
|
||||
}else{
|
||||
$("#assign").attr("disabled","disabled");
|
||||
$("#cancel").attr("disabled","disabled");
|
||||
}
|
||||
$("#assign").val($(this).find(".queue-id").text());
|
||||
$("#cancel").val($(this).find(".queue-id").text());
|
||||
}); //End Click
|
||||
|
||||
|
||||
});
|
||||
$('#assign').click(function() {
|
||||
var id = $(this).val();
|
||||
window.location.href = "dining_queues/"+id + "/assign"
|
||||
var id = $(this).val();
|
||||
window.location.href = "dining_queues/"+id + "/assign"
|
||||
});
|
||||
|
||||
});
|
||||
$('#cancel').click(function() {
|
||||
var id = $(this).val();
|
||||
url = '<%= crm_cancel_queue_path %>';
|
||||
cancel_queue(id,url);
|
||||
});
|
||||
|
||||
|
||||
function cancel_queue(id,url) {
|
||||
$.confirm({
|
||||
title: 'Confirm!',
|
||||
content: 'Are You Sure to cancel this Queue!',
|
||||
buttons: {
|
||||
cancel: function () {
|
||||
},
|
||||
confirm: {
|
||||
text: 'Confirm',
|
||||
btnClass: 'btn-green',
|
||||
keys: ['enter', 'shift'],
|
||||
action: function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url ,
|
||||
data: {id:id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
location.reload();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><%= link_to "Daily Sale Report", reports_dailysale_index_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Sales Item Report", reports_saleitem_index_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
||||
<!-- <li><%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %></li> -->
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
<%= render 'layouts/header_orgiami' %>
|
||||
<div class="container-fluid">
|
||||
<% flash.each do |type, message| %>
|
||||
<% if !flash["errors"]%>
|
||||
<div class="alert fade in">
|
||||
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||
<%=message%>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !flash["errors"]%>
|
||||
<div class="alert fade in">
|
||||
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||
<%=message%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
|
||||
</div>
|
||||
|
||||
127
app/views/reports/shiftsale/_shift_sale_report_filter.html.erb
Normal file
127
app/views/reports/shiftsale/_shift_sale_report_filter.html.erb
Normal file
@@ -0,0 +1,127 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||
<% if period_type != false %>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-2">
|
||||
<label>Select Period</label>
|
||||
<select name="period" id="sel_period" class="form-control">
|
||||
<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>
|
||||
</div>
|
||||
<!-- <input type="hidden" name="report_type" value="daily_sale" id="sel_sale_type"> -->
|
||||
<!-- <div class="form-group col-md-2">
|
||||
<label>Select Type</label>
|
||||
<select name="sale_type" id="sel_sale_type" class="form-control">
|
||||
<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>
|
||||
</div> -->
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="">From</label>
|
||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="">To</label>
|
||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
160
app/views/reports/shiftsale/index.html.erb
Normal file
160
app/views/reports/shiftsale/index.html.erb
Normal file
@@ -0,0 +1,160 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Shift Sale Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_shiftsale_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_shiftsale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<!-- <div class="span11">
|
||||
<div id="report_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
|
||||
</div> -->
|
||||
<div class="card row">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<% if params[:from]%>
|
||||
<tr>
|
||||
<th colspan="7">From Date : <%= params[:from] rescue '-'%> ,To Date : <%= params[:to] rescue '-'%></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<th>Cashier Station</th>
|
||||
<th>Shift Name</th>
|
||||
<th>Void Amount</th>
|
||||
<th>Cash Payment</th>
|
||||
<th>Credit Charges</th>
|
||||
<th>Credit Payment</th>
|
||||
<th>FOC Payment</th>
|
||||
<th>Card Payment</th>
|
||||
<th>Grand Total +
|
||||
<br/>Rounding Adj</th>
|
||||
<th>Rounding Adj</th>
|
||||
<th>Grand Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% void = 0%>
|
||||
<% cash = 0%>
|
||||
<% credit = 0%>
|
||||
<% accept_credit = 0%>
|
||||
<% foc = 0%>
|
||||
<% card = 0%>
|
||||
<% total = 0%>
|
||||
<% rounding_adj = 0%>
|
||||
<% g_total = 0 %>
|
||||
|
||||
<% @sale_data.each do |result| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= result[:cashier_station_name] rescue '-'%>
|
||||
</td>
|
||||
<td><%= result[:shift_started_at].strftime("%e %b %I:%M%p") rescue '-' %> -
|
||||
<%= result[:shift_closed_at].strftime("%e %b %I:%M%p") rescue '-' %>
|
||||
</td>
|
||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result[:void_amount].to_f.to_d rescue '-'%>)</td> -->
|
||||
<td><%= sprintf "%.2f",result[:cash_amount].to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result[:credit_amount].to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result[:accept_credit_amount].to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result[:foc_amount].to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result[:card_amount].to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result[:grand_total].to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result[:rounding_adj].to_f.to_d rescue '-'%></td>
|
||||
<% grand_total = result[:grand_total].to_f - result[:rounding_adj].to_f %>
|
||||
<td><%= sprintf "%.2f",grand_total.to_f.to_d rescue '-'%></td>
|
||||
</tr>
|
||||
<% void += result[:void_amount].to_f %>
|
||||
<% cash += result[:cash_amount].to_f %>
|
||||
<% credit += result[:credit_amount].to_f %>
|
||||
<% accept_credit += result[:accept_credit_amount].to_f %>
|
||||
<% foc += result[:foc_amount].to_f %>
|
||||
<% card += result[:card_amount].to_f %>
|
||||
<% total += result[:grand_total].to_f %>
|
||||
<% rounding_adj += result[:rounding_adj].to_f %>
|
||||
<% g_total += grand_total.to_f %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="2"></td>
|
||||
<td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td>
|
||||
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",total) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<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>
|
||||
@@ -1,26 +1,4 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Daily Sale Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_daily_sales_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<div class="card row">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
@@ -135,56 +113,4 @@
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<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>
|
||||
</div>
|
||||
@@ -173,6 +173,7 @@ Rails.application.routes.draw do
|
||||
|
||||
get "/dining_queues/:id/assign" =>"dining_queues#assign", :as => "assign"
|
||||
post "/dining_queues/assign_table" =>"dining_queues#assign_table", :as => "assign_table"
|
||||
post "/dining_queues/cancel_queue" =>"dining_queues#cancel_queue", :as => "cancel_queue"
|
||||
|
||||
end
|
||||
|
||||
@@ -268,6 +269,7 @@ Rails.application.routes.draw do
|
||||
resources :receipt_no, :only => [:index, :show]
|
||||
resources :dailysale, :only => [:index, :show]
|
||||
resources :saleitem, :only => [:index, :show]
|
||||
resources :shiftsale, :only => [:index, :show]
|
||||
# resources :sales, :only => [:index, :show]
|
||||
# resources :orders, :only => [:index, :show]
|
||||
# resources :customers, :only => [:index, :show]
|
||||
|
||||
5
spec/controllers/reports/shiftsale_controller_spec.rb
Normal file
5
spec/controllers/reports/shiftsale_controller_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Reports::ShiftsaleController, type: :controller do
|
||||
|
||||
end
|
||||
15
spec/helpers/reports/shiftsale_helper_spec.rb
Normal file
15
spec/helpers/reports/shiftsale_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Reports::ShiftsaleHelper. For example:
|
||||
#
|
||||
# describe Reports::ShiftsaleHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe Reports::ShiftsaleHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
Reference in New Issue
Block a user