From 00c19fdd67a6565605c271c01068d6e96af97955 Mon Sep 17 00:00:00 2001 From: Yan Date: Mon, 26 Jun 2017 14:16:22 +0630 Subject: [PATCH] sub total fixed in origami shows --- app/models/order.rb | 2 +- app/models/order_queue_station.rb | 1 + app/models/sale.rb | 6 +++--- app/views/origami/home/show.html.erb | 2 +- app/views/origami/rooms/show.html.erb | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/models/order.rb b/app/models/order.rb index 78585b52..018013e4 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -27,7 +27,7 @@ class Order < ApplicationRecord if self.new_booking booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking", - :checkin_at => Time.now.utc, :checkin_by => self.employee_name, + :checkin_at => Time.now.utc.getlocal, :checkin_by => self.employee_name, :booking_status => "assign" }) table = DiningFacility.find(self.table_id) table.status = "occupied" diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 04619379..aaa69bcc 100644 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -40,6 +40,7 @@ class OrderQueueStation < ApplicationRecord # end # Auto Printing + # ToDo per item per printer if oqs.auto_print && is_auto_printed == false print_slip(oqs, order, order_items) is_auto_printed = true diff --git a/app/models/sale.rb b/app/models/sale.rb index f79d8642..f833cea2 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -98,7 +98,7 @@ class Sale < ApplicationRecord order.save booking.sale_id = self.id - booking.checkout_at = Time.now.utc + booking.checkout_at = Time.now.utc.getlocal booking.checkout_by = requested_by.name booking.save @@ -115,7 +115,7 @@ class Sale < ApplicationRecord def generate_invoice_by_items (items, requested_by) taxable = true self.requested_by = requested_by - self.requested_at = DateTime.now.utc + self.requested_at = DateTime.now.utc.getlocal items.each do |item| add_item(item) @@ -185,7 +185,7 @@ class Sale < ApplicationRecord sales_items.each do |item| #compute each item and added to total subtotal_price = subtotal_price + item.price - total_taxable = total_taxable + item.taxable_price + total_taxable = total_taxable + (item.taxable_price * item.qty) end apply_tax (total_taxable) diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 17dbbada..63b7dab4 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -174,7 +174,7 @@ count = 0 @order_items.each do |order_item | count += 1 - sub_total = sub_total + order_item.price + sub_total = sub_total + (order_item.price * order_item.qty) unless order_item.price == 0 %> diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 381edb25..d5218657 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -148,7 +148,7 @@ sub_total = 0 if @status == "sale" @obj.sale_items.each do |sale_item| - sub_total = sub_total + sale_item.price + sub_total = sub_total + sale_item.price %> <% unless sale_item.price == 0 %> @@ -165,7 +165,7 @@ if @status == 'order' unless @order_items.nil? @order_items.each do |order_item | - sub_total = sub_total + order_item.price + sub_total = sub_total + (order_item.price * order_item.qty) unless order_item.price == 0 %>