This commit is contained in:
Myat Zin Wai Maw
2019-12-05 11:06:12 +06:30
parent cab37a6bfb
commit fabf3f613e
5 changed files with 46 additions and 33 deletions

View File

@@ -161,7 +161,7 @@ class Api::PaymentsController < Api::ApiController
printer = Printer::ReceiptPrinter.new(print_settings) 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) 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 else
if @membership_data if @membership_data
if @membership_data["card_balance_amount"] != "null" if @membership_data["card_balance_amount"] != "null"

View File

@@ -63,18 +63,19 @@ class Foodcourt::OrdersController < BaseFoodcourtController
@customer_id =@booking.customer_id @customer_id =@booking.customer_id
@booking_id =@booking.booking_id @booking_id =@booking.booking_id
@order_id =@booking.order_id @order_id =@booking.order_id
@sale_data = Sale.find_by_sale_id(@booking.sale_id)
end end
@bookings = Booking.select("bookings.*,customers.*") @bookings = Booking.select("bookings.*,customers.*")
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id") .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 orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id") .joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_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 end
def completed def completed
customer =Customer.find_by_customer_id(params[:customer_id]) customer =Customer.find_by_customer_id(params[:customer_id])
phone_number =customer.contact_no 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.find(params[:booking_id])
booking.booking_status ='completed' booking.booking_status ='completed'
booking.save! booking.save!

View File

@@ -591,8 +591,8 @@ class Order < ApplicationRecord
Rails.logger.debug '...... order sync completed .....' Rails.logger.debug '...... order sync completed .....'
end end
end end
def self.send_message(phone, order_id) 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&recipients="+ phone.to_s 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 begin
@result = HTTParty.get(url.to_str) @result = HTTParty.get(url.to_str)

View File

@@ -1,8 +1,8 @@
class VerifyNumber class VerifyNumber
def self.send_message(phone, pin) 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 begin
@result = HTTParty.get(url.to_str) @result = HTTParty.get(url.to_str)

View File

@@ -18,7 +18,7 @@
</ol> </ol>
</div> </div>
<% end %> <% end %>
<div class="container-fluid " style="padding:0px 3px 0px 3px;"> <div class="container-fluid " style="padding:0px 3px 0px 3px;margin-top:20px">
<div id="oqs_loading_wrapper" style="display:none;"> <div id="oqs_loading_wrapper" style="display:none;">
<div id="oqs_loading"></div> <div id="oqs_loading"></div>
</div> </div>
@@ -31,7 +31,6 @@
<div id="custom-slimscroll"> <div id="custom-slimscroll">
<div class="card-columns"> <div class="card-columns">
<% bk_color ='' %> <% bk_color ='' %>
<% @bookings.each do |bk| <% @bookings.each do |bk|
bk_status ='completed' bk_status ='completed'
if bk.booking_status =='assign' if bk.booking_status =='assign'
@@ -63,7 +62,7 @@
<div class="row" style="margin:auto"> <div class="row" style="margin:auto">
<div class="col-md-9 col-lg-9 col-sm-9"> <div class="col-md-9 col-lg-9 col-sm-9">
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@booking.dining_facility.name%></span><br> <strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@booking.dining_facility.name%></span><br>
<strong class="font-14 p-l-10">Booking - <%=@booking.booking_id%></strong> <strong class="font-14 p-l-10">Booking - <%=@booking.booking_id%></strong><br>
<strong class="font-14 p-l-10">Order No- <%=@booking.order_id%></strong> <strong class="font-14 p-l-10">Order No- <%=@booking.order_id%></strong>
</div> </div>
<div class="col-md-3 col-lg-3 col-sm-3"> <div class="col-md-3 col-lg-3 col-sm-3">
@@ -74,7 +73,7 @@
</div> </div>
</div> </div>
<div class="card-block"> <div class="card-block">
<div class="card-text" id="order-detail-slimscroll" data-height="140"> <div class="card-text" id="order-detail-slimscroll" data-height="250">
<table class="table table-striped summary-items"> <table class="table table-striped summary-items">
<thead> <thead>
<tr> <tr>
@@ -84,35 +83,48 @@
<th class="item-attr">Price</th> <th class="item-attr">Price</th>
</tr> </tr>
</thead> </thead>
<tbody class="font-13" > <tbody class="font-13">
<% count =0 %> <% sub_total = 0
<% total_price =0 %> count = 0
<% total_qty =0 %> %>
<% @booking.booking_orders.each do |bo| %> <% @sale_data.sale_items.each do |sale_item|
<% bo.order.order_items.each do |oi| %> count += 1
<% count +=1 %> %>
<% total_price += oi.price %> <% sub_total += sale_item.price%>
<% total_qty += oi.qty.to_i%> <tr>
<tr class="item_box"> <td><%= count %></td>
<td><%= count%></td> <td class="item-name"><%=sale_item.product_name%>@<%=number_with_precision( sale_item.unit_price, precision: precision.to_i )%></td>
<td><%= oi.item_name%></td> <td class=""><%=sale_item.qty%></td>
<td><%= oi.qty.to_i%></td> <td class="item-attr"><%=(number_with_precision(sale_item.price, precision: precision.to_i ))%></td>
<td class="item-attr"><%= oi.price%></td> </tr>
</tr> <%end %>
<% end %> </tbody>
<% end %>
</tbody>
</table> </table>
</div> </div>
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;"> <div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
<table class="table" id="order-charges-table" border="0"> <table class="table" id="order-charges-table" border="0">
<tr> <tr>
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td> <td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Sub Total</strong></td>
<td style="padding:2px;" width="15%"><strong id="total_qty"><%=total_qty %></strong></td> <td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%=number_with_precision(sub_total, precision: precision.to_i)%></strong></td>
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%=total_qty * total_price %></strong></td> </tr>
<tr>
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>(Discount)</strong></td>
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</strong></td>
</tr>
<tr>
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total Tax</strong></td>
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
</tr>
<tr>
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Rounding Adj</strong></td>
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.rounding_adjustment, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
</tr>
<tr>
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Grand Total</strong></td>
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
</tr> </tr>
</table> </table>
<button type="button" class="btn btn-primary action-btn create col-md-12" id="done_order" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">done</i></button> <button type="button" class="btn btn-primary action-btn create col-md-12" id="done_order" style="padding-top:4px !important;padding-bottom:4px !important;">DONE</button>
</div> </div>
</div> </div>
</div> </div>