This commit is contained in:
NyanLinHtut
2019-12-20 15:48:38 +06:30
parent 26edf23b46
commit 10c1ba12af
15 changed files with 709 additions and 100 deletions

View File

@@ -1,16 +1,16 @@
App.checkin = App.cable.subscriptions.create('SecondDisplayChannel', {
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
connected: function() {},
disconnected: function() {},
received: function(data) {
received: function(data) {
var hostname = location.hostname.trim();
if(data.from == "" || hostname == data.from){
if(data.from == "" || hostname == data.from){
var data_obj = data.data;
var status = data.status;
var count = 0
var count = 0
var sub_total = 0
if (data.status == "order") {
for(var i in data_obj) {
@@ -26,16 +26,15 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayChannel', {
$(".second_display_items").append(row);
}//end looping
}else{
$('#s_sub_total').empty();
$('#s_sub_total').empty();
$('#s_sub_total').append(data_obj.total_amount);
$('#s_total_discount').empty();
$('#s_total_discount').empty();
$('#s_total_discount').append(data_obj.total_discount);
$('#s_tatal_tax').empty();
$('#s_tatal_tax').empty();
$('#s_tatal_tax').append(data_obj.total_tax);
$('#s_grand_total').empty();
$('#s_grand_total').empty();
$('#s_grand_total').append(data_obj.grand_total);
}
}
}
});

View File

@@ -225,3 +225,10 @@ i.logout_icon{
width: 100% !important;
}
}
.report-table-header {
font-size: .95rem;
font-weight: 500;
color: rgba(0, 0, 0, 0.54);
padding: 10px;
}

View File

@@ -34,6 +34,8 @@ class BaseReportController < ActionController::Base
if params[:from].present? && params[:to].present?
from = Time.parse(params[:from])
to = Time.parse(params[:to])
puts "from - to<<<<<<<<<<<<<<<<<<<<"
puts "#{from},#{to}"
else
case period.to_i
when PERIOD["today"]

View File

@@ -86,7 +86,7 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
inventory = InventoryDefinition.find_by_item_code(params[:item_code])
@inventory_definition.destroy
respond_to do |format|
format.html { redirect_to inventory_definitions_url, notice: 'Inventory definition was successfully destroyed.' }
format.html { redirect_to inventory_inventory_definitions_url, notice: 'Inventory definition was successfully destroyed.' }
format.json { head :no_content }
end

View File

@@ -22,6 +22,13 @@ class Origami::FoodCourtController < ApplicationController
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@cashier_type = "food_court"
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i ==2
@display_type = display_type.value
else
@display_type = nil
end
#checked quick_service only
@quick_service_only = true
lookup_dine_in = Lookup.collection_of('dinein_cashier')

View File

@@ -5,6 +5,9 @@ class Reports::HourlySaleitemController < BaseReportController
@account = Account.all
from, to = get_date_range_from_params
@start_time = params[:start_time]
@end_time = params[:end_time]
shift_sale_range = ''
shift = ''
@@ -24,9 +27,10 @@ class Reports::HourlySaleitemController < BaseReportController
end
end
filter = params[:filter]
account_type = params[:account_type]
@type = params[:sale_type]
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type,filter,@start_time,@end_time)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@@ -57,7 +61,7 @@ class Reports::HourlySaleitemController < BaseReportController
# @hourly_total_qty = @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"date" => key , "total_qty" => qty.sum{|d| d.qty.to_i}}}
@hourly_total_qty = @sale_data.group_by(&:date_format).map { |k,v|{"date" => k , "total_qty" => v.count }}
respond_to do |format|
format.html
format.xls

View File

@@ -38,20 +38,20 @@ class Printer::PrinterWorker
end
def print(file_path,printer_destination = nil )
if printer_destination.nil?
printer_destination = self.printer_destination
end
puts printer_destination
puts '........Printer Destination..........'
copy = self.print_copies
#Print only when printer information is not null
if !self.printer_destination.nil?
(1..copy).each do
page = Cups::PrintJob.new(file_path, printer_destination)
page.print
end
end
# if printer_destination.nil?
# printer_destination = self.printer_destination
# end
#
# puts printer_destination
# puts '........Printer Destination..........'
#
# copy = self.print_copies
# #Print only when printer information is not null
# if !self.printer_destination.nil?
# (1..copy).each do
# page = Cups::PrintJob.new(file_path, printer_destination)
# page.print
# end
# end
end
end

View File

@@ -2118,7 +2118,7 @@ def self.employee_sale(shift=nil,from=nil,to=nil,from_time=nil,to_time=nil)
end
# Start hourly sale item report
def self.get_by_hourly_items(shift_sale_range, shift, from, to, status,type,account_type)
def self.get_by_hourly_items(shift_sale_range, shift, from, to, status,type,account_type,filter,start_time,end_time)
# date_type_selection = get_sql_function_for_report_type(report_type)
if account_type.blank?
account_type = ''
@@ -2126,7 +2126,21 @@ def self.get_by_hourly_items(shift_sale_range, shift, from, to, status,type,acco
account_type = " and acc.title = '#{account_type}'"
end
query = self.get_hourly_item_query(type)
if start_time.blank? || end_time.blank?
receipt_date = "sales.receipt_date between '#{from}' and '#{to}'"
query = self.get_hourly_item_query(type,filter,true)
else
start_time = Time.parse(start_time).utc
end_time = Time.parse(end_time).utc
receipt_date = "sales.receipt_date between '#{start_time}' and '#{end_time}'"
query = self.get_hourly_item_query(type,filter,false)
end
puts "start time - end time >>>>>>>>>"
puts "#{start_time},#{end_time}"
# query = self.get_hourly_item_query(type,filter)
discount_query = 0
total_card_amount = 0
@@ -2187,7 +2201,7 @@ def self.get_by_hourly_items(shift_sale_range, shift, from, to, status,type,acco
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
else
query = query.where("sales.receipt_date between ? and ? #{account_type} and sale_status='completed'",from,to)
query = query.where("#{receipt_date} #{account_type} and sale_status='completed'")
if type.nil? || type == 'all' || type == "other"
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
end
@@ -2214,11 +2228,16 @@ def self.get_by_hourly_items(shift_sale_range, shift, from, to, status,type,acco
return query,other_charges, product, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
end
def self.get_hourly_item_query(type)
def self.get_hourly_item_query(type,filter,status)
if status
group_by = "acc.title,i.account_id,i.menu_category_code,i.item_instance_code,i.product_name,i.unit_price,hour"
else
group_by = "acc.title,i.account_id,i.menu_category_code,i.item_instance_code,i.product_name,i.unit_price"
end
check_product = "i.menu_category_name != 'product'"
if type == "revenue"
sale_type = "i.qty > 0 and status IS NULL"
elsif type == "all" || type.nil?
elsif type == "all" || type.nil? || type.empty?
sale_type = "#{check_product}"
elsif type == "discount"
sale_type = "#{check_product} and i.status = 'Discount'"
@@ -2246,8 +2265,8 @@ def self.get_hourly_item_query(type)
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id")
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
query = query.joins(" JOIN accounts acc ON acc.id = i.account_id")
query = query.where("#{sale_type}")
query = query.group("acc.title,i.account_id,i.menu_category_code,i.item_instance_code,i.product_name,i.unit_price,hour")
query = query.where("#{sale_type} and i.product_name LIKE '%#{filter}%'" )
query = query.group("#{group_by}")
.order("hour asc")
# query = query.order("i.menu_category_name asc, SUM(i.qty) desc")
end

View File

@@ -11,15 +11,14 @@
<div class="row ">
<div class="col-lg-4 col-md-4 col-sm-4" style="padding-left: 17px;">
<%= form_tag inventory_path, :id => "filter_form", :method => :get do %>
<!-- col-lg-4 col-md-4 col-sm-4 -->
<!-- <label class="font-14"><%= t("views.right_panel.detail.product") %></label> -->
<input type="text" class="form-control" name="filter" id="Product" type="text" placeholder="Product" style="height: 32px;">
</div>
<!-- col-lg-4 col-md-4 col-sm-4 -->
<!-- <label class="font-14"><%= t("views.right_panel.detail.product") %></label> -->
<input type="text" class="form-control" name="filter" id="Product" type="text" placeholder="Product" style="height: 32px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 text-">
<input type="submit" value="Filter" class='btn btn-primary'>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 text-">
<input type="submit" value="Filter" class='btn btn-primary'>
</div>
<% end %>
<div class="col-lg-6 col-md-6 col-sm-6" style="padding-right: 15px;">

View File

@@ -2,6 +2,31 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4" style="padding-left: 17px;">
<%= form_tag reports_hourly_saleitem_index_path, :id => "filter_form", :method => :get do %>
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.product") %></label>
<input type="text" class="form-control" name="filter" id="Product" type="text" placeholder="Product" style="height: 32px;">
</div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2 text-">
<input type="submit" value="Filter" class='btn btn-primary'>
</div> -->
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.start_time") %></label>
<input data-behaviour='timepicker' class="form-control m-t-3 timepicker" name="start_time" id="start_time" type="text" placeholder="From Time" style="height: 32px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.end_time") %></label>
<input data-behaviour='timepicker' class="form-control m-t-3 timepicker" name="end_time" id="end_time" type="text" placeholder="To Time" style="height: 32px;">
</div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.start_time") %></label>
<input data-behaviour='timepicker' type="text" name="start_time" id="start_time" class="timepicker form-control col-md-8" placeholder="Start Time">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.end_time") %></label>
<input data-behaviour='timepicker' type="text" name="end_time" id="end_time" class="timepicker form-control col-md-8" placeholder="End Time">
</div> -->
<% end %>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control">
@@ -43,7 +68,6 @@
</select>
</div> -->
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> -->
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div>

View File

@@ -18,7 +18,10 @@
</div>
<div class="margin-top-20">
<div class="card">
<div colspan="7" class="report-table-header">
<%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
</div>
<% if @start_time.blank? || @end_time.blank? %>
<table class="table table-striped" border="0">
<% time_arr = Array.new %>
<% acc_arr = Array.new %>
@@ -32,17 +35,21 @@
<% grand_total = 0 %>
<% @sale_data.each do |sale| %>
<% if !time_arr.include?(sale.date_format) %>
<% sale_item_count =1 %>
<% sale_item_count =1 %>
<% time_count = time_count + 1 %>
<thead>
<td>&nbsp;</td>
<!-- <td>&nbsp;</td> -->
<tr>
<td>
<strong>Time :<%= sale.date_format %></strong>
</td>
<td>
<% if @start_time.blank? || @end_time.blank? %>
<strong>Time :<%= sale.date_format %></strong>
<% else %>
<strong>Time : <%= "#{@start_time} - #{@end_time}" %></strong>
<% end %>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong></strong></td>
<td colspan="3" style="text-align:right"><strong></strong></td>
</tr>
<tr>
<td><strong>Menu Category</strong></td>
@@ -51,7 +58,7 @@
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</tr>
</thead>
<% time_arr.push(sale.date_format) %>
<% menu_cat_arr.clear %>
@@ -88,24 +95,24 @@
end %>
<% grand_total += sale.grand_total %>
<% if !sale.item_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.menu_category_name) %>
<% if !sale.item_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.menu_category_name) %>
<td><%= sale.menu_category_name %></td>
<% menu_cat_arr.push(sale.menu_category_name) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code %></td>
<td><%= sale.product_name %></td>
<td><%= sale.total_item.to_i %></td>
<td><%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= sale.item_code %></td>
<td><%= sale.product_name %></td>
<td><%= sale.total_item.to_i %></td>
<td><%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<!-- <td><%= sale.date_format %></td> -->
</tr>
<% end %>
</tr>
<% end %>
<!-- new tr -->
<% count = count + 1 %>
<% @hourly_total_qty.each do |hr| %>
@@ -134,6 +141,272 @@
</tbody>
<% end %>
</table>
<% else %>
<table class="table table-striped" id="items_table" border="0">
<thead>
<tr>
<th colspan="7"> <%= t("views.right_panel.detail.from_time") %> : <%= @start_time rescue '-' %> - <%= t("views.right_panel.detail.to_time") %> : <%= @end_time rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="7"> <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th>&nbsp;</th>
<th><%= t("views.right_panel.header.menu_category") %></th>
<th><%= t("views.right_panel.detail.code") %></th>
<th><%= t("views.right_panel.detail.product") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
<th><%= t("views.right_panel.detail.unit_price") %></th>
<th><%= t("views.right_panel.detail.revenue") %></th>
</tr>
</thead>
<tbody>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% p_qty = 0 %>
<% sub_qty = 0 %>
<% sub_total = 0 %>
<% other_sub_total = 0 %>
<% product_sub_total = 0 %>
<% count = 0 %>
<% row_count = 0 %>
<% total_price = 0 %>
<% cate_count = 0 %>
<% acc_count = 0 %>
<% grand_total = 0 %>
<% total_qty = 0 %>
<% total_amount = 0 %>
<% discount = 0 %>
<% total_item_foc = 0 %>
<% total_item_dis = 0.0 %>
<% total_tax = 0 %>
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<% row_count += 1 %>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<% if sale.status_type =="promotion" && @type == "promotion"
total_qty += sale.total_item*(-1)
end %>
<!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1)
end %>
<% if sale.status_type == "Discount" && sale.grand_total < 0
total_item_dis += sale.grand_total*(-1)
end %>
<% if !acc_arr.include?(sale.account_id) %>
<tr>
<td><b><%= sale.account_name %></b></td>
<td colspan="4">&nbsp;</td>
<td><%= t("views.right_panel.detail.total_price_by") %> <%= sale.account_name %></td>
<td>
<% @totalByAccount.each do |account, total| %>
<% if sale.account_id == account %>
<b><%= number_format(total, precision:precision.to_i,delimiter:delimiter) %></b>
<% grand_total += total %>
<% end %>
<% end %>
</td>
</tr>
<% acc_arr.push(sale.account_id) %>
<% end %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<% if sale.status_type != "Discount" %>
<td><%= sale.total_item rescue '-' %></td>
<%else%>
<td><%= sale.total_item*(-1) rescue '-' %></td>
<% end %>
<td><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% @menu_cate_count.each do |key,value| %>
<% if sale.account_id == key %>
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC") && sale.status_type != "promotion"
sub_qty += sale.total_item
end %>
<% if sale.status_type =="Discount"
sub_qty += sale.total_item*(-1)
end %>
<% if sale.status_type == "promotion" && @type == "promotion"
sub_qty += sale.total_item*(-1)
end %>
<% if count == value %>
<tr>
<td colspan="3">&nbsp;</td>
<td><b>Total <%= sale.account_name %> Qty </b> </td>
<td><b><%= sub_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= number_format(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
</tr>
<% sub_total = 0.0%>
<% sub_qty = 0 %>
<% count = 0%>
<% end %>
<% end %>
<% end %>
<!-- end sub total -->
<% end %>
<!--Product Sale -->
<% if @product.present?%>
<tr>
<td><b>Product</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @product.each do |product| %>
<% if product.total_item > 0
total_qty += product.total_item
end %>
<% grand_total +=product.grand_total
p_qty += product.total_item%>
<tr>
<td>&nbsp;</td>
<td>Product</td>
<td><%= product.product_code rescue '-' %></td>
<td><%= product.product_name rescue '-' %></td>
<td><%= product.total_item rescue '-' %></td>
<td> <%= number_format(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_format(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% product_sub_total += product.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="3">&nbsp;</td>
<td><b>Total Product Qty </b> </td>
<td><b><%= p_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Product Sale -->
<!--Other Charges -->
<% if @type == "other" || @other_charges.present?%>
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% other_sub_total += other.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Other Charges -->
<tr style="border-top:2px solid grey;">
<td colspan="3">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
<td><span><%= total_qty%></span></td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% if @type =="" || @type =="all" || @type.nil? %>
<tr class="foc_payment">
<td colspan="5">&nbsp;</td>
<td>Total FOC Amount</td>
<td><span><%= number_format(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<tr class="foc_payment" style="border-top:2px solid grey;border-bottom:2px solid grey;">
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_format(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<% end %>
<% if @type == "other"%>
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% other_sub_total += other.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
</tbody>
</table>
<% end %>
</div>
</div>
</div>

View File

@@ -8,7 +8,11 @@
<div class="row">
<div class="col-md-12">
<div class="margin-top-20">
<div class="card">
<div class="card">
<div colspan="7" class="report-table-header">
<%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
</div>
<% if @start_time.blank? || @end_time.blank? %>
<table class="table table-striped" border="0">
<% time_arr = Array.new %>
<% acc_arr = Array.new %>
@@ -22,17 +26,21 @@
<% grand_total = 0 %>
<% @sale_data.each do |sale| %>
<% if !time_arr.include?(sale.date_format) %>
<% sale_item_count =1 %>
<% sale_item_count =1 %>
<% time_count = time_count + 1 %>
<thead>
<td>&nbsp;</td>
<!-- <td>&nbsp;</td> -->
<tr>
<td>
<strong>Time :<%= sale.date_format %></strong>
</td>
<td>
<% if @start_time.blank? || @end_time.blank? %>
<strong>Time :<%= sale.date_format %></strong>
<% else %>
<strong>Time : <%= "#{@start_time} - #{@end_time}" %></strong>
<% end %>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong></strong></td>
<td colspan="3" style="text-align:right"><strong></strong></td>
</tr>
<tr>
<td><strong>Menu Category</strong></td>
@@ -41,7 +49,7 @@
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</tr>
</thead>
<% time_arr.push(sale.date_format) %>
<% menu_cat_arr.clear %>
@@ -78,24 +86,24 @@
end %>
<% grand_total += sale.grand_total %>
<% if !sale.item_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.menu_category_name) %>
<% if !sale.item_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.menu_category_name) %>
<td><%= sale.menu_category_name %></td>
<% menu_cat_arr.push(sale.menu_category_name) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code %></td>
<td><%= sale.product_name %></td>
<td><%= sale.total_item.to_i %></td>
<td><%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= sale.item_code %></td>
<td><%= sale.product_name %></td>
<td><%= sale.total_item.to_i %></td>
<td><%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<!-- <td><%= sale.date_format %></td> -->
</tr>
<% end %>
</tr>
<% end %>
<!-- new tr -->
<% count = count + 1 %>
<% @hourly_total_qty.each do |hr| %>
@@ -118,11 +126,278 @@
</tr>
<% footer_arr.push(sale.sale_id) %>
<% else %>
<% end %>
<% end %>
</tbody>
<% end %>
</table>
<% else %>
<table class="table table-striped" id="items_table" border="0">
<thead>
<tr>
<th colspan="7"> <%= t("views.right_panel.detail.from_time") %> : <%= @start_time rescue '-' %> - <%= t("views.right_panel.detail.to_time") %> : <%= @end_time rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="7"> <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th>&nbsp;</th>
<th><%= t("views.right_panel.header.menu_category") %></th>
<th><%= t("views.right_panel.detail.code") %></th>
<th><%= t("views.right_panel.detail.product") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
<th><%= t("views.right_panel.detail.unit_price") %></th>
<th><%= t("views.right_panel.detail.revenue") %></th>
</tr>
</thead>
<tbody>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% p_qty = 0 %>
<% sub_qty = 0 %>
<% sub_total = 0 %>
<% other_sub_total = 0 %>
<% product_sub_total = 0 %>
<% count = 0 %>
<% row_count = 0 %>
<% total_price = 0 %>
<% cate_count = 0 %>
<% acc_count = 0 %>
<% grand_total = 0 %>
<% total_qty = 0 %>
<% total_amount = 0 %>
<% discount = 0 %>
<% total_item_foc = 0 %>
<% total_item_dis = 0.0 %>
<% total_tax = 0 %>
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<% row_count += 1 %>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<% if sale.status_type =="promotion" && @type == "promotion"
total_qty += sale.total_item*(-1)
end %>
<!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1)
end %>
<% if sale.status_type == "Discount" && sale.grand_total < 0
total_item_dis += sale.grand_total*(-1)
end %>
<% if !acc_arr.include?(sale.account_id) %>
<tr>
<td><b><%= sale.account_name %></b></td>
<td colspan="4">&nbsp;</td>
<td><%= t("views.right_panel.detail.total_price_by") %> <%= sale.account_name %></td>
<td>
<% @totalByAccount.each do |account, total| %>
<% if sale.account_id == account %>
<b><%= number_format(total, precision:precision.to_i,delimiter:delimiter) %></b>
<% grand_total += total %>
<% end %>
<% end %>
</td>
</tr>
<% acc_arr.push(sale.account_id) %>
<% end %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<% if sale.status_type != "Discount" %>
<td><%= sale.total_item rescue '-' %></td>
<%else%>
<td><%= sale.total_item*(-1) rescue '-' %></td>
<% end %>
<td><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% @menu_cate_count.each do |key,value| %>
<% if sale.account_id == key %>
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC") && sale.status_type != "promotion"
sub_qty += sale.total_item
end %>
<% if sale.status_type =="Discount"
sub_qty += sale.total_item*(-1)
end %>
<% if sale.status_type == "promotion" && @type == "promotion"
sub_qty += sale.total_item*(-1)
end %>
<% if count == value %>
<tr>
<td colspan="3">&nbsp;</td>
<td><b>Total <%= sale.account_name %> Qty </b> </td>
<td><b><%= sub_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= number_format(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
</tr>
<% sub_total = 0.0%>
<% sub_qty = 0 %>
<% count = 0%>
<% end %>
<% end %>
<% end %>
<!-- end sub total -->
<% end %>
<!--Product Sale -->
<% if @product.present?%>
<tr>
<td><b>Product</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @product.each do |product| %>
<% if product.total_item > 0
total_qty += product.total_item
end %>
<% grand_total +=product.grand_total
p_qty += product.total_item%>
<tr>
<td>&nbsp;</td>
<td>Product</td>
<td><%= product.product_code rescue '-' %></td>
<td><%= product.product_name rescue '-' %></td>
<td><%= product.total_item rescue '-' %></td>
<td> <%= number_format(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_format(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% product_sub_total += product.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="3">&nbsp;</td>
<td><b>Total Product Qty </b> </td>
<td><b><%= p_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Product Sale -->
<!--Other Charges -->
<% if @type == "other" || @other_charges.present?%>
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% other_sub_total += other.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Other Charges -->
<tr style="border-top:2px solid grey;">
<td colspan="3">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
<td><span><%= total_qty%></span></td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% if @type =="" || @type =="all" || @type.nil? %>
<tr class="foc_payment">
<td colspan="5">&nbsp;</td>
<td>Total FOC Amount</td>
<td><span><%= number_format(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<tr class="foc_payment" style="border-top:2px solid grey;border-bottom:2px solid grey;">
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_format(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<% end %>
<% if @type == "other"%>
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% other_sub_total += other.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
</tbody>
</table>
<% end %>
</div>
</div>
</div>

View File

@@ -121,7 +121,7 @@
<td><%= sale.total_item rescue '-' %></td>
<%else%>
<td><%= sale.total_item*(-1) rescue '-' %></td>
<% end %>
<% end %>
<td><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>

View File

@@ -21,11 +21,11 @@ class ActionController::Base
end
else
# check for license file
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
# if check_license
# current_license(ENV["SX_PROVISION_URL"])
# else
# redirect_to activate_path
# end
end
end

View File

@@ -1,11 +1,11 @@
application_path="#{File.expand_path("../..", __FILE__)}"
directory application_path
#environment ENV.fetch("RAILS_ENV") { "production" }
environment "production"
pidfile "#{application_path}/tmp/puma/pid"
state_path "#{application_path}/tmp/puma/state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
port ENV.fetch("PORT") { 62158 }
workers 2
preload_app!
threads 1,1
# application_path="#{File.expand_path("../..", __FILE__)}"
# directory application_path
# #environment ENV.fetch("RAILS_ENV") { "production" }
# environment "production"
# pidfile "#{application_path}/tmp/puma/pid"
# state_path "#{application_path}/tmp/puma/state"
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
# port ENV.fetch("PORT") { 62158 }
# workers 2
# preload_app!
# threads 1,1