From f6a35d214fe20e9227136df34f3ef9cb8b3f2296 Mon Sep 17 00:00:00 2001 From: NyanLinHtut Date: Wed, 10 Jun 2020 18:12:15 +0630 Subject: [PATCH] fixed payment methods & license --- .gitignore | 1 + Gemfile.lock | 4 +- app/assets/stylesheets/BSBMaterial/style.css | 4 +- app/controllers/home_controller.rb | 2 - .../origami/waste_spoile_controller.rb | 5 +- .../reports/payment_method_controller.rb | 10 +-- .../reports/receipt_no_detail_controller.rb | 64 +++++++++---------- .../transactions/shift_sales_controller.rb | 14 ++-- app/models/license.rb | 6 +- app/models/sale.rb | 23 +++++-- app/models/sale_payment.rb | 5 +- app/views/home/dashboard.html.erb | 36 ++++++----- app/views/layouts/CRM.html.erb | 20 +++--- app/views/layouts/OQS.html.erb | 16 ++--- app/views/layouts/application.html.erb | 27 ++++---- app/views/layouts/inventory.html.erb | 14 ++-- app/views/layouts/origami.html.erb | 19 +++--- app/views/origami/dashboard/index.html.erb | 6 +- .../_shift_sale_report_filter.html.erb | 9 +-- .../reports/waste_and_spoilage/index.html.erb | 2 +- .../shared/_license_expire_warning.html.erb | 25 +++++--- .../transactions/shift_sales/show.html.erb | 60 ++++++----------- config/license.yml | 17 ----- 23 files changed, 187 insertions(+), 202 deletions(-) delete mode 100644 config/license.yml diff --git a/.gitignore b/.gitignore index 3560a44c..42dc0371 100755 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ pickle-email-*.html /config/initializers/* config/deploy/config/* #config/puma.rb +config/license.yml config/shops.json !/log/.keep diff --git a/Gemfile.lock b/Gemfile.lock index 4cdc2ded..578d79d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,6 +96,7 @@ GEM concurrent-ruby (1.1.5) connection_pool (2.2.2) crass (1.0.5) + cups (0.0.7) database_cleaner (1.7.0) diff-lcs (1.3) erubi (1.9.0) @@ -334,6 +335,7 @@ DEPENDENCIES carrierwave (~> 1.0) chartkick coffee-rails (~> 4.2) + cups (~> 0.0.7) database_cleaner factory_girl_rails (~> 4.0) faker @@ -382,4 +384,4 @@ RUBY VERSION ruby 2.6.5p114 BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/app/assets/stylesheets/BSBMaterial/style.css b/app/assets/stylesheets/BSBMaterial/style.css index 004439e9..a4620cf5 100755 --- a/app/assets/stylesheets/BSBMaterial/style.css +++ b/app/assets/stylesheets/BSBMaterial/style.css @@ -11,7 +11,7 @@ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3); border: none; position: fixed; - /*top: 0;*/ + top: 0; left: 0; z-index: 12; width: 100%; } @@ -6649,7 +6649,7 @@ fieldset[disabled] .form-control { box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3); border: none; position: fixed; - /*top: 0;*/ + top: 0; left: 0; z-index: 12; width: 100%; } diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 18928fc3..2665a330 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -108,8 +108,6 @@ class HomeController < ApplicationController @hourly_sales = Sale.hourly_sales(current_user,@from,@to) # .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p') # .sum(:grand_total) - logger.debug 'hourly_sales<>><><><<<<<<>><<<><><><><><><><><><<>><' - logger.debug @hourly_sales.to_json employee_sales = Sale.employee_sales(current_user,@from,@to) # .sum("(CASE WHEN sp.payment_method='cash' THEN ((sp.payment_amount) - (sales.amount_changed)) ELSE (sp.payment_amount) END)") @employee_sales = [] diff --git a/app/controllers/origami/waste_spoile_controller.rb b/app/controllers/origami/waste_spoile_controller.rb index ba0846ee..e1055323 100755 --- a/app/controllers/origami/waste_spoile_controller.rb +++ b/app/controllers/origami/waste_spoile_controller.rb @@ -10,10 +10,7 @@ class Origami::WasteSpoileController < BaseOrigamiController SaleTax.where("sale_id='#{sale_id}'").find_each do |existing_tax| existing_tax.delete end - sale.update_attributes(total_discount: 0,total_tax: 0,grand_total: sale.total_amount,rounding_adjustment:0) - sale.payment_status = remark - sale.sale_status = remark - sale.save + sale.update_attributes(total_discount: 0, total_tax: 0, grand_total: sale.total_amount, rounding_adjustment:0, payment_status: remark, sale_status: remark) # add to sale item with foc # sale_items = SaleItem.where("sale_id='#{ sale_id }' and status is null") diff --git a/app/controllers/reports/payment_method_controller.rb b/app/controllers/reports/payment_method_controller.rb index 752a2f4e..baad3350 100644 --- a/app/controllers/reports/payment_method_controller.rb +++ b/app/controllers/reports/payment_method_controller.rb @@ -4,12 +4,12 @@ class Reports::PaymentMethodController < BaseReportController @payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method") - @payments = [["All Payment",''],["Cash Payment","cash"], ["Credit Payment","creditnote"], - ["FOC Payment","foc"]] + @payments = [["All",''], ["Cash","cash"], ["Card", "card"], ["Credit","creditnote"], + ["FOC","foc"]] + PaymentMethodSetting.pluck(:payment_method).map { |payment_method| [payment_method, payment_method.parameterize] } - @payment_methods.each do |m| - @payments.push(["#{m} Payment", m.parameterize]) - end + # @payment_methods.each do |m| + # @payments.push(["#{m} Payment", m.parameterize]) + # end from, to = get_date_range_from_params diff --git a/app/controllers/reports/receipt_no_detail_controller.rb b/app/controllers/reports/receipt_no_detail_controller.rb index 775b2651..eba6c3e6 100755 --- a/app/controllers/reports/receipt_no_detail_controller.rb +++ b/app/controllers/reports/receipt_no_detail_controller.rb @@ -1,46 +1,46 @@ class Reports::ReceiptNoDetailController < BaseReportController authorize_resource :class => false def index - @payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]] - @payment_method = PaymentMethodSetting.all + @payment_methods = [["All", ''], ["Cash", "cash"], ["Card", "card"], ["Credit", "creditnote"], ["FOC", "foc"]] + PaymentMethodSetting.pluck(:payment_method).map { |payment_method| [payment_method, payment_method.parameterize] } + from, to = get_date_range_from_params @shift_sale_range = '' - @shift = '' - if params[:shift_name].to_i != 0 - @shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) + @shift = '' + if params[:shift_name].to_i != 0 + @shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) - @shift_sale = ShiftSale.find(params[:shift_name]) - if to.blank? - @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at) - else - if @shift_sale.shift_closed_at.blank? - @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at) - else - @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at) - end - end - end + @shift_sale = ShiftSale.find(params[:shift_name]) + if to.blank? + @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at) + else + if @shift_sale.shift_closed_at.blank? + @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at) + else + @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at) + end + end + end - payment_type = params[:payment_type] - @sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range,@shift,from,to,payment_type) + payment_type = params[:payment_type] + @sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range,@shift,from,to,payment_type) - @from = from - @to = to - # get printer info - @print_settings = PrintSetting.get_precision_delimiter() - if @shift.present? - @shift.each do |sh| - @shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p") - @shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") - @shift_data = sh - end - end + @from = from + @to = to + # get printer info + @print_settings = PrintSetting.get_precision_delimiter() + if @shift.present? + @shift.each do |sh| + @shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p") + @shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") + @shift_data = sh + end + end respond_to do |format| - format.html - format.xls - end + format.html + format.xls + end end def show diff --git a/app/controllers/transactions/shift_sales_controller.rb b/app/controllers/transactions/shift_sales_controller.rb index f3a9fc05..562d45e4 100644 --- a/app/controllers/transactions/shift_sales_controller.rb +++ b/app/controllers/transactions/shift_sales_controller.rb @@ -10,16 +10,16 @@ class Transactions::ShiftSalesController < ApplicationController to = params[:to] if filter.nil? && from.nil? && to.nil? - @shift_sales = ShiftSale.all.order("id desc") + @shift_sales = ShiftSale.all.order("id desc") @shift_sales = Kaminari.paginate_array(@shift_sales).page(params[:page]).per(20) else shift_sale = ShiftSale.search(filter,from,to) if shift_sale.count > 0 - @shift_sales = shift_sale + @shift_sales = shift_sale @shift_sales = Kaminari.paginate_array(@shift_sales).page(params[:page]).per(20) else @shift_sales = 0 - end + end end respond_to do |format| @@ -32,7 +32,7 @@ class Transactions::ShiftSalesController < ApplicationController # GET /transactions/shift_sales/1 # GET /transactions/shift_sales/1.json def show - + @shift = ShiftSale.find(params[:id]) #get tax @@ -40,13 +40,13 @@ class Transactions::ShiftSalesController < ApplicationController @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='') #other payment details for mpu or visa like card @other_payment = ShiftSale.get_by_shift_other_payment(@shift) - + @payment_methods = SalePayment.where.not(payment_method: ['cash', 'creditnote', 'foc']).distinct.pluck(:payment_method) # Calculate price_by_accounts @total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount') @total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount') @total_member_discount = ShiftSale.get_total_member_discount(@shift) - + respond_to do |format| format.html # show.html.erb @@ -59,7 +59,7 @@ class Transactions::ShiftSalesController < ApplicationController redirect_to root_path end end - + private # Use callbacks to share common setup or constraints between actions. def set_transactions_shift_sale diff --git a/app/models/license.rb b/app/models/license.rb index 92781a22..edbe5947 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -164,10 +164,10 @@ class License elsif old_renewable_date.to_date < @varified['renewable_date'].to_date update_license("renewable_date", @varified['renewable_date']) status = 1 - message = "*** License con be verified. ***" + message = "*** License con be verified. ***" end return status, message - + else delete_license_file end @@ -204,7 +204,7 @@ class License def days_to_expire if renewal_date_str = read_license("renewable_date") - Date.today - DateTime.parse(renewal_date_str).to_date + Date.today - DateTime.parse(renewal_date_str).to_date end end diff --git a/app/models/sale.rb b/app/models/sale.rb index aa2b6992..7018f0ff 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -1200,11 +1200,21 @@ def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,pay .includes(:bookings => :dining_facility) .select("sales.*, SUM(sale_payments.payment_amount) AS payments_for_credits_amount") .joins(:bookings) + .joins("INNER JOIN sale_payments sp ON sp.sale_id = sales.sale_id") .left_joins(:payments_for_credits) .completed .where.not(total_amount: 0) .group(:sale_id) .order(:receipt_date) + + if payment_type.present? + if payment_type == 'card' + query = query.where(sanitize_sql_array(["sp.payment_method IN (?)", SalePayment::CARD])) + else + query = query.where("sp.payment_method = (?)", payment_type) + end + end + if shift.present? query = query.where("sales.shift_sale_id in (?)", shift.to_a) elsif shift_sale_range.present? @@ -1363,7 +1373,11 @@ def self.get_payment_method_by_shift(shift,from,to,payment_type) end if payment_type.present? - sale_payment = sale_payment.where(payment_method: payment_type) + if payment_type == 'card' + sale_payment = sale_payment.where(sanitize_sql_array(["payment_method IN (?)", SalePayment::CARD])) + else + sale_payment = sale_payment.where("payment_method = (?)", payment_type) + end end return payments_total, sale_payment @@ -1577,11 +1591,10 @@ end end def self.total_payment_methods(current_user=nil,from=nil,to=nil) - payment_methods = SalePayment.where.not(payment_method: ['cash', 'creditnote', 'foc']).distinct.pluck(:payment_method) - query = Sale.select("CASE WHEN sp.payment_method IN (#{payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') }) THEN 'card' ELSE sp.payment_method END as payment_method") + query = Sale.select(sanitize_sql_array(["CASE WHEN sp.payment_method IN (?) THEN 'card' ELSE sp.payment_method END as payment_method", SalePayment::CARD])) .where("sales.sale_status = 'completed'") .joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") - .group("CASE WHEN sp.payment_method IN (#{payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') }) THEN 'card' ELSE sp.payment_method END") + .group(sanitize_sql_array(["CASE WHEN sp.payment_method IN (?) THEN 'card' ELSE sp.payment_method END", SalePayment::CARD])) if (!from.nil? && !to.nil?) query = query.receipt_date_between(from, to) @@ -2293,7 +2306,7 @@ private self.total_tax = self.total_tax.round(precision) end self.grand_total = (self.total_amount - self.total_discount) + self.total_tax - if (!['foc'].include? self.payment_status) + if (!['foc','waste','spoile'].include? self.payment_status) adjust_rounding end end diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 9ade9920..95162fb2 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -1,4 +1,7 @@ class SalePayment < ApplicationRecord + + CARD = ['mpu', 'visa', 'master', 'jcb', 'unionpay'] + self.primary_key = "sale_payment_id" #primary key - need to be unique generated for multiple shops @@ -11,7 +14,7 @@ class SalePayment < ApplicationRecord attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status,:action_by scope :credits, -> { where(payment_method: 'creditnote') } - scope :cards, -> { where(payment_method: PaymentMethodSetting.where("is_active='1'").pluck("payment_method")) } + scope :cards, -> { where(payment_method: ['mpu', 'visa', 'master', 'jcb', 'unionpay']) } def self.sync_sale_payment_records(sale_payments) if !sale_payments.nil? diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index b7bd5c44..e77cee9d 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -209,30 +209,36 @@ <% if !(@total_payment_methods.nil?) %> <% @total_payment_methods.each do |payment| %> - <% if payment.payment_method != 'card' %> - + <% if !@sale_data[0].empty? %> + <% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %> + <% if payment.payment_method == 'paypar' %> <% else %> <% end %> - - + + + <% end %> <% end %> <% end %> - <% total_card = @sale_data.find {|x| x.key?("card") } %> - <% if !total_card.nil? %> - - - - + <% total_card = @sale_data.select { |hash| hash["card"]!=nil } %> + <% if !total_card.nil? %> + + + + <% end %> - <% end %>
Redeem Sale : <%= payment.payment_method.to_s.capitalize %> Sale : - <%= number_format(@sale_data.find {|x| x.key?(payment.payment_method) }[payment.payment_method], precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %> -
+ <% @sale_data.each do |data| %> + <% pay_mth = payment.payment_method %> + <%= data[""+pay_mth+""] %> + <% end %> +
<%= t("views.right_panel.detail.other_payment") %> : - <%= number_format(total_card["card"], precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %> -
<%= t("views.right_panel.detail.other_payment") %> : + <% total_other_amt = 0 %> + <% @sale_data.map { |k,v| k.map{|meth,amt| meth != 'cash' && meth != 'foc' && meth != 'creditnote' ? total_other_amt += amt : meth }} %> + <%= total_other_amt %> +
diff --git a/app/views/layouts/CRM.html.erb b/app/views/layouts/CRM.html.erb index 5c2fc4b7..3fca697d 100755 --- a/app/views/layouts/CRM.html.erb +++ b/app/views/layouts/CRM.html.erb @@ -31,38 +31,38 @@

Please wait...

- <%= render 'shared/license_expire_warning' %> + <%= render 'shared/license_expire_warning' if Rails.env.production? %>
<%= render 'layouts/header' %> -
- <%= render 'layouts/left_sidebar' %> - <%= render 'layouts/right_sidebar' %> +
+ <%= render 'layouts/left_sidebar' %> + <%= render 'layouts/right_sidebar' %>
-
+
<% flash.each do |type, message| %> <% if !flash["errors"]%> - <% + <% if type == "notice" color = "alert-success" end if type == "error" color = "alert-danger" - end + end %> <% if flash["error"] || flash["notice"]%> <% end %> - <% end %> + <% end %> <% end %> - <%= yield %> + <%= yield %>
- \ No newline at end of file + diff --git a/app/views/layouts/OQS.html.erb b/app/views/layouts/OQS.html.erb index c4d18cab..4c02c0db 100755 --- a/app/views/layouts/OQS.html.erb +++ b/app/views/layouts/OQS.html.erb @@ -35,25 +35,25 @@

Please wait...

- <%= render 'shared/license_expire_warning' %> + <%= render 'shared/license_expire_warning' if Rails.env.production? %>
<%= render 'layouts/header' %> -
- <%= render 'layouts/left_sidebar' %> - <%= render 'layouts/right_sidebar' %> +
+ <%= render 'layouts/left_sidebar' %> + <%= render 'layouts/right_sidebar' %>
-
+
<% flash.each do |type, message| %>
<%= message %>
- <% end %> - <%= yield %> + <% end %> + <%= yield %>
- \ No newline at end of file + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 44d3c36a..5f78554c 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -4,7 +4,7 @@ - + SmartSales : Restaurant <%= csrf_meta_tags %> @@ -12,7 +12,7 @@ <%= stylesheet_link_tag 'application', media: 'all' %> - <%= javascript_include_tag 'application' %> + <%= javascript_include_tag 'application' %> @@ -32,33 +32,34 @@

Please wait...

- <%= render 'shared/license_expire_warning' %> + + <%= render 'shared/license_expire_warning' if Rails.env.production? %>
<%= render 'layouts/header' %> -
- <%= render 'layouts/left_sidebar' %> - <%= render 'layouts/right_sidebar' %> +
+ <%= render 'layouts/left_sidebar' %> + <%= render 'layouts/right_sidebar' %>
-
+
<% flash.each do |type, message| %> - <% if type == "notice" + <% if type == "notice" color = "alert-success" elsif type == "error" color = "alert-danger" else color = "bg-black" end %> - + - <% end %> - <%= yield %> -
+ <% end %> + <%= yield %> +
- \ No newline at end of file + diff --git a/app/views/layouts/inventory.html.erb b/app/views/layouts/inventory.html.erb index 9d52575f..283dd311 100755 --- a/app/views/layouts/inventory.html.erb +++ b/app/views/layouts/inventory.html.erb @@ -31,15 +31,15 @@

Please wait...

- <%= render 'shared/license_expire_warning' %> + <%= render 'shared/license_expire_warning' if Rails.env.production? %>
<%= render 'layouts/header' %> -
- <%= render 'layouts/left_sidebar' %> - <%= render 'layouts/right_sidebar' %> +
+ <%= render 'layouts/left_sidebar' %> + <%= render 'layouts/right_sidebar' %>
@@ -52,9 +52,9 @@ <% end %> - <% end %> - <%= yield %> + <% end %> + <%= yield %>
- \ No newline at end of file + diff --git a/app/views/layouts/origami.html.erb b/app/views/layouts/origami.html.erb index 398fc691..656898d3 100755 --- a/app/views/layouts/origami.html.erb +++ b/app/views/layouts/origami.html.erb @@ -31,15 +31,15 @@

Please wait...

- <%= render 'shared/license_expire_warning' %> + <%= render 'shared/license_expire_warning' if Rails.env.production? %>
<%= render 'layouts/header' %> -
- <%= render 'layouts/left_sidebar' %> - <%= render 'layouts/right_sidebar' %> +
+ <%= render 'layouts/left_sidebar' %> + <%= render 'layouts/right_sidebar' %>
@@ -47,21 +47,20 @@ -
+
<% flash.each do |type, message| %> - <% if type == "notice" + <% if type == "notice" color = "alert-success" elsif type == "error" color = "alert-danger" else color = "bg-black" end %> - + - <% end %> - <%= yield %> + <% end %> + <%= yield %>
- \ No newline at end of file diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index 38df56b3..8fec5deb 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -116,12 +116,14 @@ <% end %> <% end %> - <% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %> + <% total_card = @sale_data.select { |hash| hash["card"]!=nil } %> <% if !total_card.nil? %> <%= t("views.right_panel.detail.other_payment") %> : - <%= total_card["card"].to_f %> + <% total_other_amt = 0 %> + <% @sale_data.map { |k,v| k.map{|meth,amt| meth != 'cash' && meth != 'foc' && meth != 'creditnote' ? total_other_amt += amt : meth }} %> + <%= total_other_amt %> <% end %> diff --git a/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb b/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb index 89264e82..ad834e00 100755 --- a/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb +++ b/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb @@ -18,17 +18,14 @@ - <% if defined? payments %> + <% if defined? @payment_methods %>
diff --git a/app/views/reports/waste_and_spoilage/index.html.erb b/app/views/reports/waste_and_spoilage/index.html.erb index afd292f9..714f2e69 100755 --- a/app/views/reports/waste_and_spoilage/index.html.erb +++ b/app/views/reports/waste_and_spoilage/index.html.erb @@ -55,7 +55,7 @@ <% @sale_data.each do |sale| %> <% if !sale.item_instance_code.nil?%> <% waste_and_spoil_item_count += sale.qty.to_i %> - <% grand_total += sale.grand_total.to_i %> + <% grand_total += sale.price.to_i %> <% end %> <% if !menu_cat_arr.include?(sale.name) %> diff --git a/app/views/shared/_license_expire_warning.html.erb b/app/views/shared/_license_expire_warning.html.erb index a1292d4c..eb19cd49 100644 --- a/app/views/shared/_license_expire_warning.html.erb +++ b/app/views/shared/_license_expire_warning.html.erb @@ -3,15 +3,15 @@ <% date_count = (renewable_date.to_date - Date.today).to_i %> <% day = pluralize( date_count, 'day' )%> -<% if license_status == 0 +<% if license_status == 0 text = 'Your license has expired.' elsif license_status == 2 text = "Your license will expire in #{day}." end %> <% if license_status == 0 || license_status == 2 %> -