diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index 831f2f5f..2f670146 100755 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -25,7 +25,6 @@ //= require custom.js $(document).on('turbolinks:load', function() { - $(".nav-completed").on("click", function(){ $("#completed").removeClass('hide') $(".oqs_append").addClass('hide') @@ -96,7 +95,7 @@ $(document).on('turbolinks:load', function() { +'' +'' diff --git a/app/assets/stylesheets/OQS.scss b/app/assets/stylesheets/OQS.scss index 8258a2df..12fbd548 100755 --- a/app/assets/stylesheets/OQS.scss +++ b/app/assets/stylesheets/OQS.scss @@ -9,6 +9,37 @@ @import "BSBMaterial/style"; @import "BSBMaterial/themes/all-themes"; @import "reset"; + +/* Reset */ +.col-lg-1, .col-md-1, .col-sm-1,col-xl-1{ + padding-left: 1px ; + padding-right: 1px ; +} + +.table { + margin-bottom: 0px; +} + +select.form-control { + height: inherit !important; +} + +.form-horizontal .form-group { + margin-right: 0px !important; +} + +.card-columns { + font-size: 18px !important; +} + +@media (min-width:769px) and (max-width:1024px) { + .btn-block { + font-size: 11px !important; + } +} + +/* End Reset */ + .order-completed { background-color: #CCFFDD; } diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 74cc9ba9..bc621bd7 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -68,6 +68,7 @@ class HomeController < ApplicationController @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() @top_products = Sale.top_products(today).sum('i.qty') + @bottom_products = Sale.bottom_products(today).sum('i.qty') @hourly_sales = Sale.hourly_sales(today).sum(:grand_total) # .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p') # .sum(:grand_total) @@ -91,7 +92,7 @@ class HomeController < ApplicationController end end @summ_sale = Sale.summary_sale_receipt(today) - + p @summ_sale @total_customer = Sale.total_customer(today) @total_dinein = Sale.total_dinein(today) @total_takeaway = Sale.total_takeaway(today) diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index c1319bfe..f3bd218f 100755 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -114,7 +114,8 @@ class Origami::DiscountsController < BaseOrigamiController if Sale.exists?(sale_id) sale = Sale.find(sale_id) table_id = sale.bookings[0].dining_facility_id - table_type = DiningFacility.find(table_id).type + dining = DiningFacility.find(table_id) + table_type = dining.type discount_items = [] #destroy all discount sale item @@ -133,14 +134,14 @@ class Origami::DiscountsController < BaseOrigamiController sale.sale_items.destroy(discount_items) action_by = current_user.id - remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{table.name} " + remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{dining.name} " sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEALLDISCOUNT" ) # Re-calc All Amount in Sale sale.compute_by_sale_items(sale_id, sale.sale_items, 0) - result = {:status=> "Success", :table_id => table_id, :table_type => table_type } + result = {:status=> "Success", :table_id => table_id, :dining => dining.name, :table_type => table_type } else - result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type } + result = {:status=> "Please, Check Again!", :table_id => table_id, :dining => dining.name, :table_type => table_type } end render :json => result.to_json diff --git a/app/models/sale.rb b/app/models/sale.rb index 696e0598..7e68e771 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -907,7 +907,17 @@ end .where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+ "and payment_status='paid' and sale_status= 'completed'") .group('mi.name') - .order("SUM(i.qty) DESC").limit(5) + .order("SUM(i.qty) DESC").limit(10) + end + + def self.bottom_products(today) + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + .where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+ + "and payment_status='paid' and sale_status= 'completed'") + .group('mi.name') + .order("SUM(i.qty) ASC").limit(10) end def self.hourly_sales(today) @@ -954,7 +964,7 @@ end end def self.summary_sale_receipt(today) - query = Sale.select('count(sale_id) as total_receipt, sum(total_amount) as total_amount, sum(grand_total) as grand_total, sum(total_discount) as total_discount, sum(total_tax) as total_tax') + query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') .where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today) .first() end diff --git a/app/models/sale_item.rb b/app/models/sale_item.rb index c4aae1fa..d4aaf5ee 100755 --- a/app/models/sale_item.rb +++ b/app/models/sale_item.rb @@ -39,7 +39,7 @@ class SaleItem < ApplicationRecord # Check for actual sale items sale_items.each do |si| - if si.account_id == a.id + if si.account_id == a.id account_price[:price] = account_price[:price] + si.price end end diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb index 71969440..1f456a07 100755 --- a/app/pdf/close_cashier_pdf.rb +++ b/app/pdf/close_cashier_pdf.rb @@ -22,7 +22,7 @@ class CloseCashierPdf < Prawn::Document super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) # db font setup - if printer_settings.font != nil + if printer_settings.font != "" font_families.update("#{printer_settings.font}" => { :normal => "public/fonts/#{printer_settings.font}.ttf", :italic => "public/fonts/#{printer_settings.font}.ttf", diff --git a/app/pdf/crm_order_pdf.rb b/app/pdf/crm_order_pdf.rb index dca0ab9b..a33b5fce 100755 --- a/app/pdf/crm_order_pdf.rb +++ b/app/pdf/crm_order_pdf.rb @@ -20,7 +20,7 @@ class CrmOrderPdf < Prawn::Document super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height]) # db font setup - if printer_settings.font != nil + if printer_settings.font != "" font_families.update("#{printer_settings.font}" => { :normal => "public/fonts/#{printer_settings.font}.ttf", :italic => "public/fonts/#{printer_settings.font}.ttf", diff --git a/app/pdf/stock_result_pdf.rb b/app/pdf/stock_result_pdf.rb index 4787e9b1..510ab317 100755 --- a/app/pdf/stock_result_pdf.rb +++ b/app/pdf/stock_result_pdf.rb @@ -22,7 +22,7 @@ class StockResultPdf < Prawn::Document super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) # db font setup - if printer_settings.font != nil + if printer_settings.font != "" font_families.update("#{printer_settings.font}" => { :normal => "public/fonts/#{printer_settings.font}.ttf", :italic => "public/fonts/#{printer_settings.font}.ttf", diff --git a/app/views/crm/dining_queues/index.html.erb b/app/views/crm/dining_queues/index.html.erb index fab41cdc..17c7e7c8 100755 --- a/app/views/crm/dining_queues/index.html.erb +++ b/app/views/crm/dining_queues/index.html.erb @@ -55,9 +55,9 @@
view_headline QUEUE DETAILs

- 1) Latest Queue No - <%= @complete_queue.last.queue_no%>
- 2) Next Queue No - <% @next = @complete_queue.last.queue_no.to_i + 1%> - <%= @next%>
+ 1) Latest Queue No - <%= @complete_queue.last.queue_no rescue 0 %>
+ 2) Next Queue No - <% @next = (@complete_queue.last.queue_no.to_i rescue 0) + 1%> + <%= @next rescue 0 %>
3) Today Completed Queue - <%= @complete_queue.count %>

list <%= t("views.right_panel.header.button_lists") %>
diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index fa0c9c72..bf4321be 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -58,7 +58,7 @@
-
+

dashboard<%= (t :top) + " " + (t :products) %>

@@ -67,6 +67,15 @@
+
+
+
+

dashboard<%= (t :bottom) + " " + (t :products) %>

+ + <%= pie_chart @bottom_products %> +
+
+
- - -
-
-
- <%= form_tag oqs_root_path, :method => :get do %> -
-
- - -
-
- -
- + +
+
+
+ <%= form_tag oqs_root_path, :method => :get do %> +
+
+ +
- <% end %> +
+ +
+
- - -
+ + + - - + <% end %> + + + -
- +
+ -
-
- <% - @queue_completed_item.each do |qid| - %> -
-
-
- <%= qid.type %>-<%= qid.zone %> - - <%= qid.order_id %> -
-

- - <%= qid.item_name %> - [x - - <%= qid.qty %> - ] -

+
+
+ <% + @queue_completed_item.each do |qid| + %> +
+
+
+ <%= qid.type %>-<%= qid.zone %> + + <%= qid.order_id %> +
+

+ + <%= qid.item_name %> + [x + + <%= qid.qty %> + ] +

-

<%= qid.options == "[]"? "" : qid.options %>

+

<%= qid.options == "[]"? "" : qid.options %>

- - Order at - - - <%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> -
- Order By - - <%= qid.item_order_by %> - -
+ + Order at - + + <%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> +
+ Order By - + <%= qid.item_order_by %> +
- - - - -
-
- <% - end - %> -
+ + + + + +
+
+ <% + end + %>
+
- - -
+ + +
+
+ +
+
+ + +
+
+
+
ORDER DETAILS
+
+
+
+ + + + + + + + + + + + + + + + + + + +
Order ByOrder At
+
+
+ + + + + + + + + + +
ItemsQTY
-
+
- -
-
-
-
ORDER DETAILS
-
-
-
- - - - - - - - - - - - - - - - - - - -
Order ByOrder At
-
-
- - - - - - - - - - -
ItemsQTY
-
- -
-
-
- - +
reply Back - - -
- + diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb index 23b83054..2549849a 100755 --- a/app/views/origami/discounts/index.html.erb +++ b/app/views/origami/discounts/index.html.erb @@ -424,9 +424,11 @@ // Selected Items var sale_items = get_selected_sale_items(); + console.log(sale_items.length); if(sale_items.length == 0){ //swal("Information!", "You have no selected item!"); - swal ( "Oops" , "You have no selected item!" , "error" ); + swal ( "Oops" , "You have no selected item!" , "error" ); + return; } for(var i=0;i < sale_items.length;i++){ @@ -434,7 +436,8 @@ discount_items.push(sale_items[i]); } else { - swal ("Oops" , "You have no selected item!" , "error" ); + swal ("Oops" , "You have no selected item!" , "error" ); + return; } } diff --git a/config/locales/en.yml b/config/locales/en.yml index 95ee7115..f6cf640b 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -68,6 +68,7 @@ en: booking_details: "Booking Details" inventory_definitions: "Inventory Definitions" sale_audits: "Sale Audits" + bottom: "Bottom" views: btn: