diff --git a/app/controllers/api/payments_controller.rb b/app/controllers/api/payments_controller.rb index c36d7ab7..9d060a51 100755 --- a/app/controllers/api/payments_controller.rb +++ b/app/controllers/api/payments_controller.rb @@ -161,7 +161,7 @@ class Api::PaymentsController < Api::ApiController printer = Printer::ReceiptPrinter.new(print_settings) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) - render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no, :message => "Payment successful."}) + render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no,:order_no => latest_order_no, :message => "Payment successful."}) else if @membership_data if @membership_data["card_balance_amount"] != "null" diff --git a/app/controllers/foodcourt/orders_controller.rb b/app/controllers/foodcourt/orders_controller.rb index d0eafc62..b4a24a3b 100755 --- a/app/controllers/foodcourt/orders_controller.rb +++ b/app/controllers/foodcourt/orders_controller.rb @@ -63,18 +63,19 @@ class Foodcourt::OrdersController < BaseFoodcourtController @customer_id =@booking.customer_id @booking_id =@booking.booking_id @order_id =@booking.order_id + @sale_data = Sale.find_by_sale_id(@booking.sale_id) end @bookings = Booking.select("bookings.*,customers.*") .joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id") .joins("JOIN orders ON orders.order_id=booking_orders.order_id") .joins("JOIN order_items ON orders.order_id=order_items.order_id") .joins("JOIN customers ON orders.customer_id=customers.customer_id") - .where("orders.source='app' and DATE(bookings.created_at) = '#{Date.today}' and bookings.shop_code='#{Shop.current_shop.shop_code}'").order("bookings.created_at desc").uniq + .where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}'").order("bookings.created_at desc").uniq end def completed customer =Customer.find_by_customer_id(params[:customer_id]) phone_number =customer.contact_no - if Order.send_message(phone_number,params[:order_id]) + if Order.send_message(phone_number,params[:order_id],Shop.current_shop.name) booking =Booking.find(params[:booking_id]) booking.booking_status ='completed' booking.save! diff --git a/app/models/order.rb b/app/models/order.rb index c0fc7b4b..6bf30813 100755 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -591,8 +591,8 @@ class Order < ApplicationRecord Rails.logger.debug '...... order sync completed .....' end end - def self.send_message(phone, order_id) - url = "http://smspoh.com/api/http/send?key=5QfyN0OtGsFXnOqwtpVAGZCyPGP28nbX_Nm_oPsUw2ybq714T_951ycz3Ypl5URA&message=Your order "+order_id.to_s+" is ready to pick up&recipients="+ phone.to_s + def self.send_message(phone, order_id,shop_name) + url = "http://smspoh.com/api/http/send?key=5QfyN0OtGsFXnOqwtpVAGZCyPGP28nbX_Nm_oPsUw2ybq714T_951ycz3Ypl5URA&message=Your order "+order_id.to_s+" is ready to pick up ,thanks from "+shop_name.to_s+"&recipients="+ phone.to_s begin @result = HTTParty.get(url.to_str) diff --git a/app/models/verify_number.rb b/app/models/verify_number.rb index f8a67226..50b0fcca 100644 --- a/app/models/verify_number.rb +++ b/app/models/verify_number.rb @@ -1,8 +1,8 @@ -class VerifyNumber +class VerifyNumber def self.send_message(phone, pin) - url = "http://smspoh.com/api/http/send?key=5QfyN0OtGsFXnOqwtpVAGZCyPGP28nbX_Nm_oPsUw2ybq714T_951ycz3Ypl5URA&message=Doemal,+Pin+Code:+"+pin.to_s+"&recipients="+ phone.to_s + url = "http://smspoh.com/api/http/send?key=5QfyN0OtGsFXnOqwtpVAGZCyPGP28nbX_Nm_oPsUw2ybq714T_951ycz3Ypl5URA&message=Local Kitchen,+Pin+Code:+"+pin.to_s+"&recipients="+ phone.to_s begin @result = HTTParty.get(url.to_str) diff --git a/app/views/foodcourt/orders/app_orders.html.erb b/app/views/foodcourt/orders/app_orders.html.erb index ed21bb6f..0f751c2d 100644 --- a/app/views/foodcourt/orders/app_orders.html.erb +++ b/app/views/foodcourt/orders/app_orders.html.erb @@ -18,7 +18,7 @@ <% end %> -
+
@@ -31,7 +31,6 @@
<% bk_color ='' %> - <% @bookings.each do |bk| bk_status ='completed' if bk.booking_status =='assign' @@ -63,7 +62,7 @@
ORDER DETAILS | Table-<%=@booking.dining_facility.name%>
- Booking - <%=@booking.booking_id%> + Booking - <%=@booking.booking_id%>
Order No- <%=@booking.order_id%>
@@ -74,7 +73,7 @@
-
+
@@ -84,35 +83,48 @@ - - <% count =0 %> - <% total_price =0 %> - <% total_qty =0 %> - <% @booking.booking_orders.each do |bo| %> - <% bo.order.order_items.each do |oi| %> - <% count +=1 %> - <% total_price += oi.price %> - <% total_qty += oi.qty.to_i%> - - - - - - - <% end %> - <% end %> - + + <% sub_total = 0 + count = 0 + %> + <% @sale_data.sale_items.each do |sale_item| + count += 1 + %> + <% sub_total += sale_item.price%> + + + + + + + <%end %> +
Price
<%= count%><%= oi.item_name%><%= oi.qty.to_i%><%= oi.price%>
<%= count %><%=sale_item.product_name%>@<%=number_with_precision( sale_item.unit_price, precision: precision.to_i )%><%=sale_item.qty%><%=(number_with_precision(sale_item.price, precision: precision.to_i ))%>