diff --git a/Gemfile b/Gemfile index 6058e7cc..6b3740a7 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ gem 'rails', '~> 5.1.0' gem 'mysql2', '>= 0.3.18', '< 0.5' #Use PosgreSQL -# gem 'pg' + gem 'pg' # redis server for cable # gem 'redis', '~> 3.0' diff --git a/Gemfile.lock b/Gemfile.lock index 7bf4f9a4..17b395eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -122,6 +122,7 @@ GEM nokogiri (1.7.2) mini_portile2 (~> 2.1.0) pdf-core (0.7.0) + pg (0.20.0) prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) @@ -256,6 +257,7 @@ DEPENDENCIES kaminari! listen (~> 3.0.5) mysql2 (>= 0.3.18, < 0.5) + pg prawn prawn-table puma (~> 3.0) diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 3fd7ffea..31766599 100644 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -14,7 +14,7 @@ class Origami::RequestBillsController < BaseOrigamiController else @sale_data = Sale.find_by_sale_id(check_booking.sale_id) @sale_items = SaleItem.where("sale_id=?",check_booking.sale_id) - end + end unique_code="ReceiptBillPdf" @@ -30,7 +30,7 @@ class Origami::RequestBillsController < BaseOrigamiController def show sale_id = params[:sale_id] if Sale.exists?(sale_id) - @sale_data = Sale.find_by_id(sale_id) + @sale_data = Sale.find_by_sale_id(sale_id) end end diff --git a/app/models/order.rb b/app/models/order.rb index 7225ea11..29083ef3 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -230,7 +230,7 @@ class Order < ApplicationRecord .joins("left join sale_orders on sale_orders.order_id = orders.order_id") .joins("left join sales on sales.sale_id = sale_orders.sale_id") .where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true) - .group("bookings.booking_id") + .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status") end @@ -243,7 +243,7 @@ class Order < ApplicationRecord .joins("left join sale_orders on sale_orders.order_id = orders.order_id") .joins("left join sales on sales.sale_id = sale_orders.sale_id") .where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true) - .group("bookings.booking_id") + .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name") end #Origami: Cashier : to view order type Room @@ -255,7 +255,7 @@ class Order < ApplicationRecord left join dining_facilities on dining_facilities.id = bookings.dining_facility_id left join order_items on order_items.order_id = orders.order_id") .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true) - .group("orders.order_id,order_items.order_items_id,dining_facilities.name") + .group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no") end @@ -271,7 +271,7 @@ class Order < ApplicationRecord left join sale_orders on sale_orders.order_id = orders.order_id left join sales on sales.sale_id = sale_orders.sale_id") .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) - .group("orders.order_id,order_items.order_items_id,dining_facilities.name") + .group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id") end private diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index cc8d2041..78f59422 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -25,7 +25,7 @@ <% if @booking_orders %> <% @booking_orders.each do |booking_order| %> - <% if !booking_order.order_status = 'new'%> + <% if booking_order.order_status != "new" %>

@@ -204,14 +204,17 @@ var old_order_id = 0 var old_table_name = "" var table_or_order_id = 0 - + var pay_sale_id = 0 function callOrderDetails(sale_order_id){ + var order_id = 0 + var sale_id = 0 var data_val = "" sale_order = sale_order_id.split("_")[0] + if (sale_order == 'sale') { - order_id = sale_order_id.split("_")[1] + sale_id = sale_order_id.split("_")[1] url = "origami/"+sale_order_id.split("_")[1] data_val = { sale_id: sale_order_id.split("_")[1]} @@ -222,6 +225,7 @@ function callOrderDetails(sale_order_id){ } table_or_order_id = order_id + pay_sale_id = sale_id var tbody = "" $("#append-table").html("") if (old_order_id != order_id){ @@ -312,7 +316,7 @@ $( document ).ready(function() { $( document ).ready(function() { $('#pay').click(function() { - window.location.href = '/origami/sale/'+ 10 + "/payment" + window.location.href = '/origami/sale/'+ pay_sale_id + "/payment" return false; }); });