From 3838ee29e04e03c707b66381b912dc868fbadada Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 17 May 2018 16:39:59 +0630 Subject: [PATCH 1/3] change func: for receipt bill --- app/pdf/receipt_bill_a5_pdf.rb | 4 +++- app/pdf/receipt_bill_pdf.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index 78b27e3f..08caf1b8 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -207,7 +207,9 @@ class ReceiptBillA5Pdf < Prawn::Document # check for item not to show if item.price != 0 sub_total += item.price #(item.qty*item.unit_price) - comment for room charges - total_qty += item.qty + if item.status != 'Discount' && item.qty > 0 + total_qty += item.qty + end qty = item.qty total_price = item.price #item.qty*item.unit_price - comment for room charges price = item.unit_price diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 59e6a320..5c1f8c01 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -201,7 +201,9 @@ class ReceiptBillPdf < Prawn::Document # check for item not to show if item.price != 0 sub_total += item.price #(item.qty*item.unit_price) - comment for room charges - total_qty += item.qty + if item.status != 'Discount' && item.qty > 0 + total_qty += item.qty + end qty = item.qty total_price = item.price #item.qty*item.unit_price - comment for room charges price = item.unit_price From a3f7e21120e46c0ba2597bab14b9e8c2cdeee769 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 17 May 2018 17:01:18 +0630 Subject: [PATCH 2/3] update touch start in print --- app/views/origami/payments/show.html.erb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 7c99df3c..246bbcfe 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -447,9 +447,9 @@ @@ -988,7 +988,8 @@ var customer_name = "<%= @customer.name %>"; } //print pdf function - $(".print_receipt").on('click',function(){ + // $(".print_receipt").on('click',function(){ + $(document).on('touchstart click', '.print_receipt', function(event){ var sale_id = $('#sale_id').text(); var filename = $("#filename").val(); var printer_name = $("#printer_name").val(); From 6890b3a01eea3176f90c7d317cde18f2f9d15069 Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 17 May 2018 17:51:47 +0630 Subject: [PATCH 3/3] check report and change alert for order reservation --- app/assets/javascripts/application.js | 9 -- .../javascripts/channels/check_new_order.js | 16 +-- .../channels/check_order_ready_to_delivery.js | 16 +-- .../channels/check_order_send_to_kitchen.js | 16 +-- app/assets/javascripts/custom.js | 9 ++ app/assets/javascripts/order_reservation.js | 100 ++++++++++++------ app/models/sale.rb | 2 +- .../origami/order_reservation/index.html.erb | 93 +--------------- app/views/transactions/sales/show.html.erb | 4 +- 9 files changed, 87 insertions(+), 178 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index d7c93cd2..d2faf9da 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -199,12 +199,3 @@ function export_to(path) var form_params = $("#frm_report").serialize(); window.location = path+"?"+ form_params; } - -function audioPlayBackground(shop_code){ - //audio play - var audio = new Audio('/'+shop_code+'-beep.mp3'); // define your audio - // setTimeout(function(){ - // audio.loop = true; - audio.play(); - // },10000); -} diff --git a/app/assets/javascripts/channels/check_new_order.js b/app/assets/javascripts/channels/check_new_order.js index 4aa0f1b0..ced5b3c2 100644 --- a/app/assets/javascripts/channels/check_new_order.js +++ b/app/assets/javascripts/channels/check_new_order.js @@ -19,21 +19,7 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', { }); // alert(order_lists); - // swal({ - // title: 'Information', - // target: document.getElementById(shop_code+"_notify_new_order"), - // text: "You have new orders
"+ - // "Are you accept or reject for these orders "+order_lists+"?", - // type: 'success', - // html: true, - // closeOnConfirm: false, - // closeOnCancel: false, - // allowOutsideClick: false - // }, function (isConfirm) { - // if(isConfirm){ - // swal.close(); - // } - // }); + checkNewOrderAlert(shop_code, order_lists); // $("#notify_new_order_lists").text(order_lists); // if($("#"+shop_code+"_notify_new_order").hasClass("hidden")){ // $("#"+shop_code+"_notify_new_order").removeClass("hidden"); diff --git a/app/assets/javascripts/channels/check_order_ready_to_delivery.js b/app/assets/javascripts/channels/check_order_ready_to_delivery.js index dc406d5e..4ec3ea08 100644 --- a/app/assets/javascripts/channels/check_order_ready_to_delivery.js +++ b/app/assets/javascripts/channels/check_order_ready_to_delivery.js @@ -19,21 +19,7 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe }); // alert(order_lists); - // swal({ - // title: 'Information', - // target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"), - // text: "You have orders that are ready to deliver
"+ - // "Could you ready these orders "+order_lists+" to deliver?", - // type: 'success', - // html: true, - // closeOnConfirm: false, - // closeOnCancel: false, - // allowOutsideClick: false - // }, function (isConfirm) { - // if(isConfirm){ - // swal.close(); - // } - // }); + checkOrderReadyToKitchenAlert(shop_code, order_lists); // $("#notify_order_ready_to_delivery_lists").text(order_lists); // if($("#notify_order_ready_to_delivery").hasClass("hidden")){ // $("#"+shop_code+"_notify_order_ready_to_delivery").removeClass("hidden"); diff --git a/app/assets/javascripts/channels/check_order_send_to_kitchen.js b/app/assets/javascripts/channels/check_order_send_to_kitchen.js index 0d11207e..5e8751b1 100644 --- a/app/assets/javascripts/channels/check_order_send_to_kitchen.js +++ b/app/assets/javascripts/channels/check_order_send_to_kitchen.js @@ -19,21 +19,7 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend }); // alert(order_lists); - // swal({ - // title: 'Information', - // target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"), - // text: "You have to send order to kitchen
"+ - // "Could you send these orders "+order_lists+" to kitchen?", - // type: 'success', - // html: true, - // closeOnConfirm: false, - // closeOnCancel: false, - // allowOutsideClick: false - // }, function (isConfirm) { - // if(isConfirm){ - // swal.close(); - // } - // }); + checkOrderSendToKitchen(shop_code, order_lists); // $("#notify_order_send_to_kitchen_lists").text(order_lists); // if($("#notify_order_send_to_kitchen").hasClass("hidden")){ // $("#"+shop_code+"_notify_order_send_to_kitchen").removeClass("hidden"); diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index f81daaa3..6d91f504 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -157,3 +157,12 @@ $(document).ready(function() { } //end Notificaiotn message }); + +function audioPlayBackground(shop_code){ + //audio play + var audio = new Audio('/'+shop_code+'-beep.mp3'); // define your audio + // setTimeout(function(){ + // audio.loop = true; + audio.play(); + // },10000); +} diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index e7f63188..fb210f6b 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -483,41 +483,81 @@ function showNewOrder(order_reservation,shop_code){ var date = new Date(order_reservation.requested_time); var time = timeFormat(date); var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time; + $('.first-1').click(); audioPlayBackground(shop_code); - // $("#new_order").text(order_reservation.order_reservation_id); - // $("#new_order_date").text(requested_date); - // if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){ - // $("#"+shop_code+"_doemal_new_order").removeClass("hidden"); - // } - // $("#"+shop_code+"_doemal_new_order").on('shown.bs.modal', function(e){ - // // $(document).off('focusin.modal'); - // $("#"+shop_code+"_doemal_new_order").focus(); - // $("#"+shop_code+"_notify_new_order").addClass("hidden"); - // $("#"+shop_code+"_notify_order_send_to_kitchen").addClass("hidden"); - // $("#"+shop_code+"_notify_order_ready_to_delivery").addClass("hidden"); - // }).on('hide.bs.modal', function (e) { - // $("#"+shop_code+"_doemal_new_order").addClass("hidden"); - // }).modal({show: true, keyboard: false, backdrop: false}); - // swal({ - // title: 'Information', - // target: document.getElementById(shop_code+"_notify_new_order"), - // text: "You have new order "+ - // ""+order_reservation.order_reservation_id+" requested for "+requested_date+"?", - // type: 'success', - // html: true, - // closeOnConfirm: false, - // closeOnCancel: false, - // allowOutsideClick: false - // }, function (isConfirm) { - // if(isConfirm){ - // audio.pause(); - // swal.close(); - // } - // }); + swal({ + title: 'Information', + target: document.getElementById(shop_code+"_notify_new_order"), + text: "You have new order "+ + ""+order_reservation.order_reservation_id+" requested for "+requested_date+"?", + type: 'success', + html: true, + closeOnConfirm: false, + closeOnCancel: false, + allowOutsideClick: false + }, function (isConfirm) { + if(isConfirm){ + swal.close(); + } + }); } } +function checkNewOrderAlert(shop_code, order_lists){ + swal({ + title: 'Information', + target: document.getElementById(shop_code+"_notify_new_order"), + text: "You have new orders
"+ + "Are you accept or reject for these orders "+order_lists+"?", + type: 'success', + html: true, + closeOnConfirm: false, + closeOnCancel: false, + allowOutsideClick: false + }, function (isConfirm) { + if(isConfirm){ + swal.close(); + } + }); +} + +function checkOrderSendToKitchen(shop_code, order_lists){ + swal({ + title: 'Information', + target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"), + text: "You have to send order to kitchen
"+ + "Could you send these orders "+order_lists+" to kitchen?", + type: 'success', + html: true, + closeOnConfirm: false, + closeOnCancel: false, + allowOutsideClick: false + }, function (isConfirm) { + if(isConfirm){ + swal.close(); + } + }); +} + +function checkOrderReadyToKitchenAlert(shop_code, order_lists){ + swal({ + title: 'Information', + target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"), + text: "You have orders that are ready to deliver
"+ + "Could you ready these orders "+order_lists+" to deliver?", + type: 'success', + html: true, + closeOnConfirm: false, + closeOnCancel: false, + allowOutsideClick: false + }, function (isConfirm) { + if(isConfirm){ + swal.close(); + } + }); +} + function getOrderMonth(month){ var MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"]; return MONTHS[month]; diff --git a/app/models/sale.rb b/app/models/sale.rb index d365771e..6803e8f2 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -752,7 +752,7 @@ def self.daily_sales_list(from,to) SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount, SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount, SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount") - .joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id") + .joins(" left join sale_payments on sale_payments.sale_id = sales.sale_id") .where("sale_status = ? AND sales.receipt_date between ? and ? ", 'completed', from, to) .group("DATE_FORMAT((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')),'%Y-%m-%d')") diff --git a/app/views/origami/order_reservation/index.html.erb b/app/views/origami/order_reservation/index.html.erb index 45bbfb6f..4894e9b5 100644 --- a/app/views/origami/order_reservation/index.html.erb +++ b/app/views/origami/order_reservation/index.html.erb @@ -463,10 +463,10 @@ - +
@@ -582,92 +582,3 @@ - - - - - - - - - diff --git a/app/views/transactions/sales/show.html.erb b/app/views/transactions/sales/show.html.erb index 9cab82a5..049ca8c9 100755 --- a/app/views/transactions/sales/show.html.erb +++ b/app/views/transactions/sales/show.html.erb @@ -67,8 +67,8 @@ <%=s.product_name rescue ' '%> <%=s.qty rescue ' '%> - <%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%> - <%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%> + <%= number_with_precision(s.unit_price, :precision => 2, :delimiter => ',') rescue ' '%> + <%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%> <%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %> <%=s.remark rescue ' '%>