From 0970b0022e493ed2130c8d744e796a1e77224a68 Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 24 May 2018 11:36:35 +0630 Subject: [PATCH 01/14] check shift open or not --- .../order_reserve/order_reservation_controller.rb | 2 +- .../origami/order_reservation_controller.rb | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/order_reserve/order_reservation_controller.rb b/app/controllers/api/order_reserve/order_reservation_controller.rb index 32e87a20..97c44df9 100644 --- a/app/controllers/api/order_reserve/order_reservation_controller.rb +++ b/app/controllers/api/order_reserve/order_reservation_controller.rb @@ -63,7 +63,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController order_reservation = params order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation) - if flag #&& ENV["SERVER_MODE"] != 'cloud' + if flag shop = Shop.find_by_id(1) if !shop.shop_code.nil? shop_code = shop.shop_code diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index a3421fbd..ea760e33 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -48,8 +48,16 @@ class Origami::OrderReservationController < BaseOrigamiController end def send_status - response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason]) - + order_reservation = OrderReservation.find_by_transaction_ref(params[:ref_no]) + if !order_reservation.nil? + if !ShiftSale.current_shift.nil? || params[:status] == 'accepted' || (order_reservation.status == 'new' && params[:status] == 'rejected') + response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason]) + else + response = { status: false, message: 'No current shift open for this employee!'} + end + else + response = { status: false, message: 'There is no order for '+params[:ref_no]+'!'} + end render :json => response end From 6d6d90050ff623a1ba7b399feb5d035a58c18c63 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 24 May 2018 14:03:49 +0630 Subject: [PATCH 02/14] update commission && report --- .../origami/product_commissions_controller.rb | 72 +++++++++++-------- app/models/product_commission.rb | 5 +- .../load_commissioners.html.erb | 12 +++- app/views/reports/commission/index.html.erb | 2 +- config/pumass.rb | 11 +++ lib/tasks/clear_data.rake | 7 +- 6 files changed, 70 insertions(+), 39 deletions(-) create mode 100755 config/pumass.rb diff --git a/app/controllers/origami/product_commissions_controller.rb b/app/controllers/origami/product_commissions_controller.rb index b452cffe..a9c74b70 100755 --- a/app/controllers/origami/product_commissions_controller.rb +++ b/app/controllers/origami/product_commissions_controller.rb @@ -83,11 +83,12 @@ class Origami::ProductCommissionsController < BaseOrigamiController def set_commissioner_to_sale_item # byebug - deselect = false - sale_item_id = params[:sale_item_id] + deselect = false + type = nil + sale_item_id = params[:sale_item_id] commissioner_id = params[:commissioner_id] - @sale_item = SaleItem.find(sale_item_id) - @menu_item = MenuItem.find_by_item_code(@sale_item.product_code) + @sale_item = SaleItem.find(sale_item_id) + @menu_item = MenuItem.find_by_item_code(@sale_item.product_code) # @commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.item_code, true).take Commission.all.active.each do |com| @@ -98,41 +99,50 @@ class Origami::ProductCommissionsController < BaseOrigamiController end end end - @commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take + @commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take @product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take + if !@commission.nil? && @commissioner.commission_id == @commission.commission_id if !@product_commission.nil? - if @product_commission.commissioner_id == @commissioner.id - @product_commission.destroy - deselect = true - else - @product_commission.commissioner_id = @commissioner.id - deselect = false - end - else - @product_commission = ProductCommission.new - @product_commission.product_code = @menu_item.item_code - @product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type - unless @commission.nil? - @product_commission.commission_id = @commission.id - if @commission.commission_type == 'Percentage' - @product_commission.price = @sale_item.unit_price * (@commission.amount / 100.0) - @product_commission.amount = @product_commission.price * @sale_item.qty - elsif @commission.commission_type == 'Net Amount' - @product_commission.price = @commission.amount - @product_commission.amount = @product_commission.price * @sale_item.qty + if @product_commission.commissioner_id == @commissioner.id + @product_commission.destroy + deselect = true + type = "remove" + # render json: {status: true,deselect:deselect, message: "Remove Success !"} + else + @product_commission.commissioner_id = @commissioner.id + deselect = false end - end - @product_commission.commissioner_id = @commissioner.id - @product_commission.qty = @sale_item.qty - @product_commission.sale_id = @sale_item.sale_id - @product_commission.sale_item_id = @sale_item.sale_item_id + else + @product_commission = ProductCommission.new + @product_commission.product_code = @menu_item.item_code + @product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type + unless @commission.nil? + @product_commission.commission_id = @commission.id + if @commission.commission_type == 'Percentage' + @product_commission.price = @sale_item.unit_price * (@commission.amount / 100.0) + @product_commission.amount = @product_commission.price * @sale_item.qty + elsif @commission.commission_type == 'Net Amount' + @product_commission.price = @commission.amount + @product_commission.amount = @product_commission.price * @sale_item.qty + end + end + @product_commission.commissioner_id = @commissioner.id + @product_commission.qty = @sale_item.qty + @product_commission.sale_id = @sale_item.sale_id + @product_commission.sale_item_id = @sale_item.sale_item_id end if @product_commission.save - render json: {status: true, deselect: deselect} + message = "Success !" + if type == "remove" + message = "Remove Success !" + end + render json: {status: true, deselect:deselect,type:type,message: message} else - render json: {status: false, deselect: deselect} + render json: {status: false, deselect:deselect,type:type,message: "No Commission"} end + else + render json: {status: false, deselect:deselect,type:type,message: "No Commission"} end end diff --git a/app/models/product_commission.rb b/app/models/product_commission.rb index c865c674..9f91673a 100755 --- a/app/models/product_commission.rb +++ b/app/models/product_commission.rb @@ -61,9 +61,10 @@ class ProductCommission < ApplicationRecord end def self.get_transaction(from, to, commissioner) - transaction = all + transaction = ProductCommission.select("product_commissions.*,menu_items.name as porduct_name") + .joins("join menu_items on menu_items.item_code = product_commissions.product_code") if !from.nil? && !to.nil? - transaction = transaction.where('updated_at between ? and ?', from, to) + transaction = transaction.where('product_commissions.updated_at between ? and ?', from, to) end if commissioner != 0 transaction = transaction.where(commissioner_id: commissioner) diff --git a/app/views/origami/product_commissions/load_commissioners.html.erb b/app/views/origami/product_commissions/load_commissioners.html.erb index 6383f1fa..355b4501 100755 --- a/app/views/origami/product_commissions/load_commissioners.html.erb +++ b/app/views/origami/product_commissions/load_commissioners.html.erb @@ -126,7 +126,9 @@ $('.sale_item').on('click', function () { $('#order-items-table tr').siblings().css( "background-color", "white" ); - this.style.backgroundColor = 'lightgray'; + $('#order-items-table tr').siblings().css( "color", "black" ); + this.style.backgroundColor = 'blue'; + this.style.color = 'white'; var sale_item_id = this.getAttribute('data-sale-item'); var ajax_url = "/origami/select_sale_item"; selected_sale_item = sale_item_id; @@ -179,11 +181,17 @@ url: ajax_url, data: param_data, success: function (result) { - console.log(selected_sale_item + "," +commissioner_id); + console.log(result); if(result.deselect == true){ $(commissioner).removeClass("blue").addClass("green"); $("tr[data-sale-item=" + selected_sale_item + "] td.commissioner").text('-'); } + if(result.status == true){ + swal("Information",result.message,"success"); + }else{ + $("tr[data-sale-item=" + selected_sale_item + "] td.commissioner").text('-'); + swal("Opps",result.message,"warning"); + } } }); }; diff --git a/app/views/reports/commission/index.html.erb b/app/views/reports/commission/index.html.erb index 80cf5727..88dc46df 100755 --- a/app/views/reports/commission/index.html.erb +++ b/app/views/reports/commission/index.html.erb @@ -64,7 +64,7 @@ <%= result.sale_id rescue '-' %> <%= result.sale_item_id rescue '-' %> <%= result.commissioner.name rescue '-' %> - <%= result.commission.menu_item.name rescue '-' %> + <%= result.porduct_name rescue '-' %> <%= number_with_precision(result.qty.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> <%= number_with_precision(result.price.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> <%= number_with_precision(result.amount.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> diff --git a/config/pumass.rb b/config/pumass.rb new file mode 100755 index 00000000..cd3f0829 --- /dev/null +++ b/config/pumass.rb @@ -0,0 +1,11 @@ +application_path="#{File.expand_path("../..", __FILE__)}" +directory application_path +#environment ENV.fetch("RAILS_ENV") { "production" } +environment "production" +pidfile "#{application_path}/tmp/puma/pid" +state_path "#{application_path}/tmp/puma/state" +stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" +port ENV.fetch("PORT") { 62158 } +workers 2 +preload_app! + diff --git a/lib/tasks/clear_data.rake b/lib/tasks/clear_data.rake index 6e556c52..2f293832 100755 --- a/lib/tasks/clear_data.rake +++ b/lib/tasks/clear_data.rake @@ -15,18 +15,19 @@ namespace :clear do ShiftSale.delete_all PaymentJournal.delete_all Survey.delete_all + ProductCommission.delete_all DiningFacility.update_all(status:'available') CashierTerminal.update_all(is_currently_login: 0) SeedGenerator.where("id > 1").update(:current => 0, :next => 0) - Receipt.delete_all - ReceiptDetail.delete_all + # Receipt.delete_all + # ReceiptDetail.delete_all OrderReservation.delete_all OrderReservationItem.delete_all Delivery.delete_all puts "Clear Data Done." end - desc "Clear Menu" + desc "Clear-- Menu" task :menu => :environment do From 76d7b1c6c027e78d8314c75102817e67050c84cd Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 24 May 2018 14:58:09 +0630 Subject: [PATCH 03/14] change ui for xls --- app/views/reports/dailysale/index.xls.erb | 297 ++++++++++++---------- 1 file changed, 156 insertions(+), 141 deletions(-) diff --git a/app/views/reports/dailysale/index.xls.erb b/app/views/reports/dailysale/index.xls.erb index 0f2767c5..8c9cccb6 100755 --- a/app/views/reports/dailysale/index.xls.erb +++ b/app/views/reports/dailysale/index.xls.erb @@ -1,158 +1,173 @@ - - + + -
-
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - <% unless @sale_data.empty? %> +
+
+
+
+
<%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
<%= t("views.right_panel.detail.sr") %><%= t("views.right_panel.detail.date") %><%= t("views.right_panel.detail.void_amount") %><%= t("views.right_panel.detail.mpu_sales") %><%= t("views.right_panel.detail.master_sales") %><%= t("views.right_panel.detail.visa_sales") %><%= t("views.right_panel.detail.jcb_sales") %><%= t("views.right_panel.detail.unionpay_sales") %><%= t("views.right_panel.detail.alipay_sales") %><%= t("views.right_panel.detail.paymal_sales") %><%= t("views.right_panel.detail.dinga_sales") %><%= t("views.right_panel.detail.junctionpay_sales") %><%= t("views.right_panel.detail.redeem_sales") %><%= t("views.right_panel.detail.cash_sales") %><%= t("views.right_panel.detail.credit_sales") %><%= t("views.right_panel.detail.foc_sales") %>(<%= t("views.right_panel.detail.discount") %>)<%= t("views.right_panel.detail.grand_total") %> +
<%= t("views.right_panel.detail.rnd_adj_sh") %>
<%= t("views.right_panel.detail.rnd_adj_sh") %><%= t("views.right_panel.detail.grand_total") %>
+ + + + + + + + + + + + + + + + + + + + + + + + + - - <% void = 0 %> - <% mpu = 0 %> - <% master = 0 %> - <% visa = 0 %> - <% jcb = 0 %> - <% unionpay = 0 %> - <% alipay = 0 %> - <% paymal = 0 %> - <% dinga = 0 %> - <% junctionpay = 0 %> - <% paypar = 0 %> - <% cash = 0 %> - <% credit = 0 %> - <% foc = 0 %> - <% discount = 0 %> - <% total = 0 %> - <% grand_total = 0 %> - <% old_grand_total = 0 %> - <% count = 1 %> <% rounding_adj = 0 %> - <% @sale_data.each do |sale| %> - <% void += sale[:void_amount] %> - <% mpu += sale[:mpu_amount] %> - <% master += sale[:master_amount] %> - <% visa += sale[:visa_amount] %> - <% jcb += sale[:jcb_amount] %> - <% unionpay += sale[:unionpay_amount] %> - <% alipay += sale[:alipay_amount] %> - <% paymal += sale[:paymal_amount] %> - <% dinga += sale[:dinga_amount] %> - <% junctionpay += sale[:junctionpay_amount] %> - <% paypar += sale[:paypar_amount] %> - <% cash += sale[:cash_amount]-sale[:total_change_amount] %> - <% credit += sale[:credit_amount] %> - <% foc += sale[:foc_amount] %> - <% discount += sale[:total_discount] %> - <% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %> - <% grand_total += sale[:grand_total].to_f %> - <% old_grand_total += sale[:old_grand_total].to_f %> - <% rounding_adj += sale[:rounding_adj].to_f %> - - - - - - - - - - - - - - - - - - - - - - - <% count = count + 1 %> - <% end %> + + + <% if @print_settings.precision.to_i > 0 + precision = @print_settings.precision + else + precision = 0 + end + #check delimiter + if @print_settings.delimiter + delimiter = "," + else + delimiter = "" + end + %> + <% unless @sale_data.empty? %> - - - - - - - - - - - - - - - + + <% void = 0 %> + <% mpu = 0 %> + <% master = 0 %> + <% visa = 0 %> + <% jcb = 0 %> + <% unionpay = 0 %> + <% alipay = 0 %> + <% paymal = 0 %> + <% dinga = 0 %> + <% junctionpay = 0 %> + <% paypar = 0 %> + <% cash = 0 %> + <% credit = 0 %> + <% foc = 0 %> + <% discount = 0 %> + <% total = 0 %> + <% grand_total = 0 %> + <% old_grand_total = 0 %> + <% count = 1 %> <% rounding_adj = 0 %> + <% @sale_data.each do |sale| %> + <% void += sale[:void_amount] %> + <% mpu += sale[:mpu_amount] %> + <% master += sale[:master_amount] %> + <% visa += sale[:visa_amount] %> + <% jcb += sale[:jcb_amount] %> + <% unionpay += sale[:unionpay_amount] %> + <% alipay += sale[:alipay_amount] %> + <% paymal += sale[:paymal_amount] %> + <% dinga += sale[:dinga_amount] %> + <% junctionpay += sale[:junctionpay_amount] %> + <% paypar += sale[:paypar_amount] %> + <% cash += sale[:cash_amount]-sale[:total_change_amount] %> + <% credit += sale[:credit_amount] %> + <% foc += sale[:foc_amount] %> + <% discount += sale[:total_discount] %> + <% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %> + <% grand_total += sale[:grand_total].to_f %> + <% old_grand_total += sale[:old_grand_total].to_f %> + <% rounding_adj += sale[:rounding_adj].to_f %> + + + + + + + + + + + + + + + + + + + + + - <% total_tax = 0 %> - <% net = 0 %> - <% unless @tax.empty? %> - <% @tax.each do |tax| %> - <% total_tax += tax.tax_amount.to_f %> - - - - - + + <% count = count + 1 %> + <% end %> - <% end %> - <% net = grand_total %> - <% net = net - rounding_adj%> - <% net = net - total_tax %> - - - - - - <% end %> - - <% end %> -
<%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
<%= t("views.right_panel.detail.sr") %><%= t("views.right_panel.detail.date") %><%= t("views.right_panel.detail.void_amount") %><%= t("views.right_panel.detail.mpu_sales") %><%= t("views.right_panel.detail.master_sales") %><%= t("views.right_panel.detail.visa_sales") %><%= t("views.right_panel.detail.jcb_sales") %><%= t("views.right_panel.detail.unionpay_sales") %><%= t("views.right_panel.detail.alipay_sales") %><%= t("views.right_panel.detail.paymal_sales") %><%= t("views.right_panel.detail.dinga_sales") %><%= t("views.right_panel.detail.junctionpay_sales") %><%= t("views.right_panel.detail.redeem_sales") %><%= t("views.right_panel.detail.cash_sales") %><%= t("views.right_panel.detail.credit_sales") %><%= t("views.right_panel.detail.foc_sales") %>(<%= t("views.right_panel.detail.discount") %>)<%= t("views.right_panel.detail.grand_total") %><%= t("views.right_panel.detail.rnd_adj_sh") %>
<%= count %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:unionpay_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:dinga_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:junctionpay_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%>
Total<%= number_with_delimiter(sprintf("%.2f",mpu), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",master), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",visa), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",jcb), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",paypar), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%>
<%= count %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:unionpay_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:dinga_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:junctionpay_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), delimiter: delimiter) rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]),delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]),delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f),delimiter => ',') rescue '-'%>
<%= tax.tax_name rescue '-'%><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%> 
<%= t("views.right_panel.detail.net_amount") %><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%> 
+ + Total + <%= number_with_delimiter(sprintf("%.2f",mpu),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",master),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",visa), delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",jcb),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",unionpay),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",alipay),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",paymal),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",dinga),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",junctionpay),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",paypar),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",cash),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",credit),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",foc), delimiter => ',') rescue '-'%> + (<%= number_with_delimiter(discount,delimiter => ',') rescue '-'%>) + + <%= number_with_delimiter(sprintf("%.2f",grand_total),delimiter => ',') rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",rounding_adj),delimiter => ',') rescue '-'%> + + + <% total_tax = 0 %> + <% net = 0 %> + <% unless @tax.empty? %> + <% @tax.each do |tax| + total_tax += tax.tax_amount.to_f %> + + <%= tax.tax_name rescue '-'%> + <%= number_with_delimiter(sprintf("%.2f",tax.tax_amount),delimiter => ',') rescue '-'%> +   + + <% end %> + <% end %> + + <% net = grand_total %> + <% net = net - rounding_adj%> + <% net = net - total_tax %> + + <%= t("views.right_panel.detail.net_amount") %> + <%= number_with_delimiter(sprintf("%.2f",net),delimiter => ',') rescue '-'%> +   + + + <% end %> +
-
\ No newline at end of file From 1c9674fa533ab4f2c2667c115950eea669ec43fc Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 24 May 2018 15:26:12 +0630 Subject: [PATCH 04/14] update processing itemjs --- app/assets/javascripts/settings/processing_items.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/assets/javascripts/settings/processing_items.js b/app/assets/javascripts/settings/processing_items.js index 1dc5e97f..e43aedde 100755 --- a/app/assets/javascripts/settings/processing_items.js +++ b/app/assets/javascripts/settings/processing_items.js @@ -1,7 +1,6 @@ $(document).ready(function() { $(".processitems").click(function(event){ event.preventDefault(); - console.log($(this).data("id")); var item = $(this).data("id"); $(this).toggleClass("opi_selected"); @@ -13,7 +12,6 @@ $(document).ready(function() { console.log($(this).data("id")); var group_id = $(this).data("id"); var selector = "#" + group_id + " li div"; - console.log ($(selector)); $(selector).removeClass("opi_selected"); $(selector).addClass("opi_selected"); @@ -25,7 +23,6 @@ $(document).ready(function() { console.log($(this).data("id")); var group_id = $(this).data("id"); var selector = "#" + group_id + " li div"; - console.log ($(selector)); $(selector).removeClass("opi_selected"); }); @@ -36,7 +33,6 @@ $(document).ready(function() { var items = new Array(); selected_div = $(".opi_selected"); $.each( selected_div, function( key, value ) { - console.log($(value).attr("data-id")); items.push($(value).attr("data-id")); }); From 445f98cf7cba6d370f8a3d4f4cf38a8fe7446151 Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 24 May 2018 15:30:44 +0630 Subject: [PATCH 05/14] payment tax UI --- .../origami/payments_controller.rb | 2 +- app/views/origami/payments/show.html.erb | 56 ++++++++++++++++--- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 045afafb..40d8c573 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -300,7 +300,7 @@ class Origami::PaymentsController < BaseOrigamiController @account_arr =[] accounts.each do |acc| account = TaxProfile.find(acc.id) - @account_arr.push(account) + @account_arr.push(account.name) end rebate = MembershipSetting.find_by_rebate(1) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index fb4824ec..477cdca6 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -97,15 +97,53 @@ (<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>) - Tax - (<% @i = 0 - @account_arr.each do |ct| %> - <%=ct.name%> - <% if @account_arr.count != @i+1%> - + <% @i =+1 %> - <%end%> - <%end %>) - + + + Tax + +
+
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+
+ <%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%> From a4390361be149834c2f1591a3fe477c6d845ec9f Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 24 May 2018 15:31:48 +0630 Subject: [PATCH 06/14] change puma name --- config/pumass.rb | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100755 config/pumass.rb diff --git a/config/pumass.rb b/config/pumass.rb deleted file mode 100755 index cd3f0829..00000000 --- a/config/pumass.rb +++ /dev/null @@ -1,11 +0,0 @@ -application_path="#{File.expand_path("../..", __FILE__)}" -directory application_path -#environment ENV.fetch("RAILS_ENV") { "production" } -environment "production" -pidfile "#{application_path}/tmp/puma/pid" -state_path "#{application_path}/tmp/puma/state" -stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" -port ENV.fetch("PORT") { 62158 } -workers 2 -preload_app! - From 7649728c4de4ce38128bce9d97729635f22f7ebc Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 24 May 2018 16:29:51 +0630 Subject: [PATCH 07/14] update menu json for sort by name --- app/views/origami/dashboard/_menu.json.jbuilder | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/origami/dashboard/_menu.json.jbuilder b/app/views/origami/dashboard/_menu.json.jbuilder index 8d17208c..e5f75639 100644 --- a/app/views/origami/dashboard/_menu.json.jbuilder +++ b/app/views/origami/dashboard/_menu.json.jbuilder @@ -6,11 +6,12 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M") if (menu.menu_categories) order_by = Lookup.find_by_lookup_type("order_by") - if !order_by.nil? && order_by.value == "name" - categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc") - else - categories = menu.menu_categories - end + # if !order_by.nil? && order_by.value == "name" + # categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc") + # else + # categories = menu.menu_categories + # end + categories = menu.menu_categories json.categories categories do |category| menu_category = MenuCategory.find_by_menu_category_id(category.id) From 29814f61f241377585afabcee83de39dfbb0c2a8 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 24 May 2018 18:13:10 +0630 Subject: [PATCH 08/14] update addorder sort name --- app/assets/javascripts/addorder.js | 6 ++++-- app/assets/stylesheets/addorder.scss | 1 + app/views/origami/addorders/detail.html.erb | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 6d9782e3..3fea4c6b 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -1437,7 +1437,8 @@ $(function() { } } - row = '
' + row = '
' + +'
' +'
' +'
'+ menu_items[field].name +'
' +"
' +''+ price +'' +'
' - +'
'; + +'
' + +'
'; ; $('.menu_items_list').append(row); } //end instances in menu-items alest 1 instance diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss index 929ffb13..64bbc08f 100755 --- a/app/assets/stylesheets/addorder.scss +++ b/app/assets/stylesheets/addorder.scss @@ -12,6 +12,7 @@ section .content{ } .custom-card { border: 2px solid rgba(0, 0, 0, 0.125) !important; + margin-bottom: 7px !important; } .custom-card-footer{ padding:0.35rem 1.25rem !important; diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 7aeb6342..bbd9cb79 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -101,7 +101,7 @@
-