diff --git a/app/assets/javascripts/channels/second_display.js b/app/assets/javascripts/channels/second_display.js
index cfe2de8f..c557af61 100644
--- a/app/assets/javascripts/channels/second_display.js
+++ b/app/assets/javascripts/channels/second_display.js
@@ -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);
}
}
}
});
-
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index e0308d12..3440afbe 100755
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -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;
+}
diff --git a/app/controllers/base_report_controller.rb b/app/controllers/base_report_controller.rb
index 021d29c6..cab046ad 100755
--- a/app/controllers/base_report_controller.rb
+++ b/app/controllers/base_report_controller.rb
@@ -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"]
diff --git a/app/controllers/inventory/inventory_definitions_controller.rb b/app/controllers/inventory/inventory_definitions_controller.rb
index fca0bb07..863c35c8 100755
--- a/app/controllers/inventory/inventory_definitions_controller.rb
+++ b/app/controllers/inventory/inventory_definitions_controller.rb
@@ -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
diff --git a/app/controllers/origami/food_court_controller.rb b/app/controllers/origami/food_court_controller.rb
index 1157bb44..1ccc9b86 100644
--- a/app/controllers/origami/food_court_controller.rb
+++ b/app/controllers/origami/food_court_controller.rb
@@ -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')
diff --git a/app/controllers/reports/hourly_saleitem_controller.rb b/app/controllers/reports/hourly_saleitem_controller.rb
index a08c24e4..9ea04d23 100644
--- a/app/controllers/reports/hourly_saleitem_controller.rb
+++ b/app/controllers/reports/hourly_saleitem_controller.rb
@@ -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
diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb
index e0d4fc85..39cbb431 100755
--- a/app/models/printer/printer_worker.rb
+++ b/app/models/printer/printer_worker.rb
@@ -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
diff --git a/app/models/sale.rb b/app/models/sale.rb
index d9fa7db4..720c815a 100644
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -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
diff --git a/app/views/inventory/inventory/index.html.erb b/app/views/inventory/inventory/index.html.erb
index 58b960f5..06396dba 100755
--- a/app/views/inventory/inventory/index.html.erb
+++ b/app/views/inventory/inventory/index.html.erb
@@ -11,15 +11,14 @@
-
-
-
-
+
+
+
<% end %>
diff --git a/app/views/reports/hourly_saleitem/_hourly_saleitem_report_filter.html.erb b/app/views/reports/hourly_saleitem/_hourly_saleitem_report_filter.html.erb
index 3814746e..7658748e 100644
--- a/app/views/reports/hourly_saleitem/_hourly_saleitem_report_filter.html.erb
+++ b/app/views/reports/hourly_saleitem/_hourly_saleitem_report_filter.html.erb
@@ -2,6 +2,31 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %>
-
+
+ <% if @start_time.blank? || @end_time.blank? %>
<% 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 %>
- | |
+
- |
- Time :<%= sale.date_format %>
- |
+
+ <% if @start_time.blank? || @end_time.blank? %>
+ Time :<%= sale.date_format %>
+ <% else %>
+ Time : <%= "#{@start_time} - #{@end_time}" %>
+ <% end %>
+ |
|
|
- |
+ |
| Menu Category |
@@ -51,7 +58,7 @@
Qty |
Price |
Total Price |
-
+
<% 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 %>
-
- <% if !menu_cat_arr.include?(sale.menu_category_name) %>
+ <% if !sale.item_code.nil?%>
+ <% waste_and_spoil_item_count += sale.qty.to_i %>
+
+ <% if !menu_cat_arr.include?(sale.menu_category_name) %>
| <%= sale.menu_category_name %> |
<% menu_cat_arr.push(sale.menu_category_name) %>
<% else %>
|
<% end %>
- <%= sale.item_code %> |
- <%= sale.product_name %> |
- <%= sale.total_item.to_i %> |
- <%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %> |
- <%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %> |
+ <%= sale.item_code %> |
+ <%= sale.product_name %> |
+ <%= sale.total_item.to_i %> |
+ <%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %> |
+ <%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %> |
-
- <% end %>
+
+ <% end %>
+
<% count = count + 1 %>
<% @hourly_total_qty.each do |hr| %>
@@ -134,6 +141,272 @@
<% end %>
+ <% else %>
+
+
+
+ | <%= t("views.right_panel.detail.from_time") %> : <%= @start_time rescue '-' %> - <%= t("views.right_panel.detail.to_time") %> : <%= @end_time rescue '-'%> |
+
+ <% if @shift_from %>
+
+ <% if @shift_data.employee %>
+ <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
+ <% end %>
+ | <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> ) |
+
+ <% end %>
+
+ | |
+ <%= t("views.right_panel.header.menu_category") %> |
+ <%= t("views.right_panel.detail.code") %> |
+ <%= t("views.right_panel.detail.product") %> |
+ <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %> |
+ <%= t("views.right_panel.detail.unit_price") %> |
+ <%= t("views.right_panel.detail.revenue") %> |
+
+
+
+ <% 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 %>
+
+
+ <% 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 %>
+
+ <% 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) %>
+
+ | <%= sale.account_name %> |
+ |
+ <%= t("views.right_panel.detail.total_price_by") %> <%= sale.account_name %> |
+
+ <% @totalByAccount.each do |account, total| %>
+ <% if sale.account_id == account %>
+ <%= number_format(total, precision:precision.to_i,delimiter:delimiter) %>
+ <% grand_total += total %>
+ <% end %>
+ <% end %>
+ |
+
+ <% acc_arr.push(sale.account_id) %>
+ <% end %>
+
+ | |
+ <% if !cate_arr.include?(sale.menu_category_id) %>
+ <%= sale.menu_category_name %> |
+ <% cate_arr.push(sale.menu_category_id) %>
+ <% else %>
+ |
+ <% end %>
+ <%= sale.item_code rescue '-' %> |
+ <%= sale.product_name rescue '-' %> |
+ <% if sale.status_type != "Discount" %>
+ <%= sale.total_item rescue '-' %> |
+ <%else%>
+ <%= sale.total_item*(-1) rescue '-' %> |
+ <% end %>
+
+ <%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+ <%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+
+
+
+ <% @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 %>
+
+ | |
+ Total <%= sale.account_name %> Qty |
+ <%= sub_qty %> |
+ <%= t("views.right_panel.detail.sub_total") %> |
+ <%= number_format(sub_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <% sub_total = 0.0%>
+ <% sub_qty = 0 %>
+ <% count = 0%>
+ <% end %>
+ <% end %>
+ <% end %>
+
+ <% end %>
+
+ <% if @product.present?%>
+
+
+ | Product |
+ |
+ |
+
+ <% @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%>
+
+ | |
+ Product |
+ <%= product.product_code rescue '-' %> |
+ <%= product.product_name rescue '-' %> |
+ <%= product.total_item rescue '-' %> |
+ <%= number_format(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+ <%= number_format(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+
+
+
+ <% product_sub_total += product.grand_total %>
+
+ <% end %>
+
+ | |
+ Total Product Qty |
+ <%= p_qty %> |
+
+ <%= t("views.right_panel.detail.sub_total") %> |
+ <%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <%end%>
+
+
+
+ <% if @type == "other" || @other_charges.present?%>
+
+
+ | Other Charges |
+ |
+ |
+
+ <% @other_charges.each do |other| %>
+ <% if other.total_item > 0
+ total_qty += other.total_item
+ end %>
+ <% grand_total +=other.grand_total%>
+
+ | |
+ Other Charges |
+ <%= other.item_code rescue '-' %> |
+ <%= other.product_name rescue '-' %> |
+ <%= other.total_item rescue '-' %> |
+ <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+ <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+
+
+
+ <% other_sub_total += other.grand_total %>
+
+ <% end %>
+
+ | |
+ <%= t("views.right_panel.detail.sub_total") %> |
+ <%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <%end%>
+
+
+ | |
+ <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %> |
+ <%= total_qty%> |
+ <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> |
+ <%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <% if @type =="" || @type =="all" || @type.nil? %>
+
+ | |
+ Total FOC Amount |
+ <%= number_format(@foc_data , precision:precision.to_i,delimiter:delimiter)%> |
+
+
+ | |
+ <%= t("views.right_panel.detail.net_amount") %> |
+ <%= number_format(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <% end %>
+ <% end %>
+ <% if @type == "other"%>
+
+
+ | Other Charges |
+ |
+ |
+
+ <% @other_charges.each do |other| %>
+ <% if other.total_item > 0
+ total_qty += other.total_item
+ end %>
+ <% grand_total +=other.grand_total%>
+
+ | |
+ Other Charges |
+ <%= other.item_code rescue '-' %> |
+ <%= other.product_name rescue '-' %> |
+ <%= other.total_item rescue '-' %> |
+ <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+ <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+
+
+
+ <% other_sub_total += other.grand_total %>
+
+ <% end %>
+
+ | |
+ <%= t("views.right_panel.detail.sub_total") %> |
+ <%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <%end%>
+
+
+ <% end %>
diff --git a/app/views/reports/hourly_saleitem/index.xls.erb b/app/views/reports/hourly_saleitem/index.xls.erb
index f6686978..9bfeb1ad 100644
--- a/app/views/reports/hourly_saleitem/index.xls.erb
+++ b/app/views/reports/hourly_saleitem/index.xls.erb
@@ -8,7 +8,11 @@
-
+
+
+ <% if @start_time.blank? || @end_time.blank? %>
<% 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 %>
- | |
+
- |
- Time :<%= sale.date_format %>
- |
+
+ <% if @start_time.blank? || @end_time.blank? %>
+ Time :<%= sale.date_format %>
+ <% else %>
+ Time : <%= "#{@start_time} - #{@end_time}" %>
+ <% end %>
+ |
|
|
- |
+ |
| Menu Category |
@@ -41,7 +49,7 @@
Qty |
Price |
Total Price |
-
+
<% 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 %>
-
- <% if !menu_cat_arr.include?(sale.menu_category_name) %>
+ <% if !sale.item_code.nil?%>
+ <% waste_and_spoil_item_count += sale.qty.to_i %>
+
+ <% if !menu_cat_arr.include?(sale.menu_category_name) %>
| <%= sale.menu_category_name %> |
<% menu_cat_arr.push(sale.menu_category_name) %>
<% else %>
|
<% end %>
- <%= sale.item_code %> |
- <%= sale.product_name %> |
- <%= sale.total_item.to_i %> |
- <%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %> |
- <%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %> |
+ <%= sale.item_code %> |
+ <%= sale.product_name %> |
+ <%= sale.total_item.to_i %> |
+ <%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %> |
+ <%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %> |
-
- <% end %>
+
+ <% end %>
+
<% count = count + 1 %>
<% @hourly_total_qty.each do |hr| %>
@@ -118,11 +126,278 @@
<% footer_arr.push(sale.sale_id) %>
<% else %>
+
<% end %>
<% end %>
<% end %>
+ <% else %>
+
+
+
+ | <%= t("views.right_panel.detail.from_time") %> : <%= @start_time rescue '-' %> - <%= t("views.right_panel.detail.to_time") %> : <%= @end_time rescue '-'%> |
+
+ <% if @shift_from %>
+
+ <% if @shift_data.employee %>
+ <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
+ <% end %>
+ | <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> ) |
+
+ <% end %>
+
+ | |
+ <%= t("views.right_panel.header.menu_category") %> |
+ <%= t("views.right_panel.detail.code") %> |
+ <%= t("views.right_panel.detail.product") %> |
+ <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %> |
+ <%= t("views.right_panel.detail.unit_price") %> |
+ <%= t("views.right_panel.detail.revenue") %> |
+
+
+
+ <% 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 %>
+
+
+ <% 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 %>
+
+ <% 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) %>
+
+ | <%= sale.account_name %> |
+ |
+ <%= t("views.right_panel.detail.total_price_by") %> <%= sale.account_name %> |
+
+ <% @totalByAccount.each do |account, total| %>
+ <% if sale.account_id == account %>
+ <%= number_format(total, precision:precision.to_i,delimiter:delimiter) %>
+ <% grand_total += total %>
+ <% end %>
+ <% end %>
+ |
+
+ <% acc_arr.push(sale.account_id) %>
+ <% end %>
+
+ | |
+ <% if !cate_arr.include?(sale.menu_category_id) %>
+ <%= sale.menu_category_name %> |
+ <% cate_arr.push(sale.menu_category_id) %>
+ <% else %>
+ |
+ <% end %>
+ <%= sale.item_code rescue '-' %> |
+ <%= sale.product_name rescue '-' %> |
+ <% if sale.status_type != "Discount" %>
+ <%= sale.total_item rescue '-' %> |
+ <%else%>
+ <%= sale.total_item*(-1) rescue '-' %> |
+ <% end %>
+
+ <%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+ <%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+
+
+
+ <% @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 %>
+
+ | |
+ Total <%= sale.account_name %> Qty |
+ <%= sub_qty %> |
+ <%= t("views.right_panel.detail.sub_total") %> |
+ <%= number_format(sub_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <% sub_total = 0.0%>
+ <% sub_qty = 0 %>
+ <% count = 0%>
+ <% end %>
+ <% end %>
+ <% end %>
+
+ <% end %>
+
+ <% if @product.present?%>
+
+
+ | Product |
+ |
+ |
+
+ <% @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%>
+
+ | |
+ Product |
+ <%= product.product_code rescue '-' %> |
+ <%= product.product_name rescue '-' %> |
+ <%= product.total_item rescue '-' %> |
+ <%= number_format(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+ <%= number_format(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+
+
+
+ <% product_sub_total += product.grand_total %>
+
+ <% end %>
+
+ | |
+ Total Product Qty |
+ <%= p_qty %> |
+
+ <%= t("views.right_panel.detail.sub_total") %> |
+ <%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <%end%>
+
+
+
+ <% if @type == "other" || @other_charges.present?%>
+
+
+ | Other Charges |
+ |
+ |
+
+ <% @other_charges.each do |other| %>
+ <% if other.total_item > 0
+ total_qty += other.total_item
+ end %>
+ <% grand_total +=other.grand_total%>
+
+ | |
+ Other Charges |
+ <%= other.item_code rescue '-' %> |
+ <%= other.product_name rescue '-' %> |
+ <%= other.total_item rescue '-' %> |
+ <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+ <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+
+
+
+ <% other_sub_total += other.grand_total %>
+
+ <% end %>
+
+ | |
+ <%= t("views.right_panel.detail.sub_total") %> |
+ <%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <%end%>
+
+
+ | |
+ <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %> |
+ <%= total_qty%> |
+ <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> |
+ <%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <% if @type =="" || @type =="all" || @type.nil? %>
+
+ | |
+ Total FOC Amount |
+ <%= number_format(@foc_data , precision:precision.to_i,delimiter:delimiter)%> |
+
+
+ | |
+ <%= t("views.right_panel.detail.net_amount") %> |
+ <%= number_format(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <% end %>
+ <% end %>
+ <% if @type == "other"%>
+
+
+ | Other Charges |
+ |
+ |
+
+ <% @other_charges.each do |other| %>
+ <% if other.total_item > 0
+ total_qty += other.total_item
+ end %>
+ <% grand_total +=other.grand_total%>
+
+ | |
+ Other Charges |
+ <%= other.item_code rescue '-' %> |
+ <%= other.product_name rescue '-' %> |
+ <%= other.total_item rescue '-' %> |
+ <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+ <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
+
+
+
+ <% other_sub_total += other.grand_total %>
+
+ <% end %>
+
+ | |
+ <%= t("views.right_panel.detail.sub_total") %> |
+ <%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
+
+ <%end%>
+
+
+ <% end %>
diff --git a/app/views/reports/saleitem/index.html.erb b/app/views/reports/saleitem/index.html.erb
index c9b44db4..62bfc497 100644
--- a/app/views/reports/saleitem/index.html.erb
+++ b/app/views/reports/saleitem/index.html.erb
@@ -121,7 +121,7 @@
<%= sale.total_item rescue '-' %> |
<%else%>
<%= sale.total_item*(-1) rescue '-' %> |
- <% end %>
+ <% end %>
<%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb
index 205c330a..85f38ec5 100644
--- a/config/initializers/action_controller.rb
+++ b/config/initializers/action_controller.rb
@@ -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
diff --git a/config/puma.rb b/config/puma.rb
index d24425ae..f0013d25 100755
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -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