From 8d1b15f119f6e6916da2b5125cdd67226dede4e2 Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Tue, 19 Jun 2018 11:02:09 +0630 Subject: [PATCH 1/2] Pull from master --- app/controllers/api/bill_controller.rb | 27 ++++++++----------- .../origami/addorders_controller.rb | 1 - config/secrets.yml | 2 +- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index a2982b83..d5eb77b1 100755 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -14,22 +14,17 @@ class Api::BillController < Api::ApiController # for Multiple Cashier by Zone table = DiningFacility.find(booking.dining_facility_id) - cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) - - shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil) - get_cashier_by_terminal = Employee.find(shift_by_terminal.employee_id) - - if booking - if booking.sale_id.nil? - @sale = Sale.new - @status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier_by_terminal) - @sale_data = Sale.find_by_sale_id(@sale_id) - else - @status = true - @sale_id = booking.sale_id - @sale_data = Sale.find_by_sale_id(@sale_id) - end + if booking + if booking.sale_id.nil? + @sale = Sale.new + @status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, current_login_employee, "cashier") + @sale_data = Sale.find_by_sale_id(@sale_id) + else + @status = true + @sale_id = booking.sale_id + @sale_data = Sale.find_by_sale_id(@sale_id) end + end if ENV["SERVER_MODE"] != "cloud" #no print in cloud server @@ -47,7 +42,7 @@ class Api::BillController < Api::ApiController elsif (params[:order_id]) @sale = Sale.new - @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier) + @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier, "cashier") # for Job booking = Booking.find_by_sale_id(@sale_id) diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index a45f5638..220cce6c 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -261,7 +261,6 @@ class Origami::AddordersController < BaseOrigamiController #Send to background job for processing order = Order.find(order_id) sidekiq = Lookup.find_by_lookup_type("sidekiq") - if ENV["SERVER_MODE"] != 'cloud' cup_status = `#{"sudo service cups status"}` print_status = check_cup_status(cup_status) diff --git a/config/secrets.yml b/config/secrets.yml index aef81223..0282c5fc 100755 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -12,7 +12,7 @@ development: secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61 - sx_provision_url: connect.pos-myanmar.com/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api + sx_provision_url: connect.smartsales.asia/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api server_mode: application cipher_type: AES-256-CBC sx_key: Wh@t1$C2L From ec7ee8d675c649ae86f830803fd64b436c28ca8b Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Tue, 19 Jun 2018 13:35:11 +0630 Subject: [PATCH 2/2] Add Change Order PDF --- app/pdf/order_item_customise_pdf.rb | 20 ++++++++++---------- app/pdf/order_item_slim_customise_pdf.rb | 21 ++++++++++----------- app/pdf/order_set_item_customise_pdf.rb | 20 ++++++++++---------- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/app/pdf/order_item_customise_pdf.rb b/app/pdf/order_item_customise_pdf.rb index 9fd2d3e7..dde79917 100644 --- a/app/pdf/order_item_customise_pdf.rb +++ b/app/pdf/order_item_customise_pdf.rb @@ -98,7 +98,7 @@ class OrderItemCustomisePdf < Prawn::Document end bounding_box([self.item_width - 10,y_position], :width => self.qty_width) do - text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right end bounding_box([0,y_position], :width => self.item_width) do @@ -129,17 +129,17 @@ class OrderItemCustomisePdf < Prawn::Document end - #add updated qty text - def add_updated_qty_text(before_updated_qty, updated_qty, precision) - if before_updated_qty.to_i > 0 && !before_updated_qty.nil? - move_down 5 + #add updated qty text + def add_updated_qty_text(before_updated_qty, updated_qty, precision) + if before_updated_qty.to_i > 0 && !before_updated_qty.nil? + move_down 5 - # add option - y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + # add option + y_position = cursor + bounding_box([0,y_position], :width => self.page_width) do + text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + end end end - end end diff --git a/app/pdf/order_item_slim_customise_pdf.rb b/app/pdf/order_item_slim_customise_pdf.rb index 8c03adf5..a63900a6 100644 --- a/app/pdf/order_item_slim_customise_pdf.rb +++ b/app/pdf/order_item_slim_customise_pdf.rb @@ -99,7 +99,7 @@ class OrderItemSlimCustomisePdf < Prawn::Document end bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do - text "[#{number_with_precision(order_item_slim.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + text "[#{number_with_precision(order_item_slim.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right end bounding_box([0,y_position], :width => self.item_width) do @@ -129,17 +129,16 @@ class OrderItemSlimCustomisePdf < Prawn::Document end - #add updated qty text - def add_updated_qty_text(before_updated_qty, updated_qty, precision) - if before_updated_qty.to_i > 0 && !before_updated_qty.nil? - move_down 1 + #add updated qty text + def add_updated_qty_text(before_updated_qty, updated_qty, precision) + if before_updated_qty.to_i > 0 && !before_updated_qty.nil? + move_down 5 - # add option - y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + # add option + y_position = cursor + bounding_box([0,y_position], :width => self.page_width) do + text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + end end end - end - end diff --git a/app/pdf/order_set_item_customise_pdf.rb b/app/pdf/order_set_item_customise_pdf.rb index a6859189..2f985c5f 100644 --- a/app/pdf/order_set_item_customise_pdf.rb +++ b/app/pdf/order_set_item_customise_pdf.rb @@ -97,7 +97,7 @@ class OrderSetItemCustomisePdf < Prawn::Document end bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do - text "[#{number_with_precision(order_set_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + text "[#{number_with_precision(order_set_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right end bounding_box([0,y_position], :width => self.item_width) do @@ -144,17 +144,17 @@ class OrderSetItemCustomisePdf < Prawn::Document end - #add updated qty text - def add_updated_qty_text(before_updated_qty, updated_qty, precision) - if before_updated_qty.to_i > 0 && !before_updated_qty.nil? - move_down 5 + #add updated qty text + def add_updated_qty_text(before_updated_qty, updated_qty, precision) + if before_updated_qty.to_i > 0 && !before_updated_qty.nil? + move_down 5 - # add option - y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + # add option + y_position = cursor + bounding_box([0,y_position], :width => self.page_width) do + text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + end end end - end end