diff --git a/Gemfile b/Gemfile
index 4ca47865..c20dec66 100755
--- a/Gemfile
+++ b/Gemfile
@@ -46,8 +46,11 @@ gem 'mini_magick'
gem 'cups'
gem 'prawn'
gem 'prawn-table'
-gem 'spreadsheet'
gem 'to_xls-rails'
+gem 'rubyzip', '= 1.0.0'
+gem 'axlsx', '= 2.0.1'
+gem 'axlsx_rails'
+gem 'roo'
#Reporting gem
#gem 'compendium'
#gem "cancan"
diff --git a/Gemfile.lock b/Gemfile.lock
index 1c7e6534..254ff760 100755
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -50,6 +50,13 @@ GEM
airbrussh (1.3.0)
sshkit (>= 1.6.1, != 1.7.0)
arel (8.0.0)
+ axlsx (2.0.1)
+ htmlentities (~> 4.3.1)
+ nokogiri (>= 1.4.1)
+ rubyzip (~> 1.0.0)
+ axlsx_rails (0.5.1)
+ actionpack (>= 3.1)
+ axlsx (>= 2.0.1)
bcrypt (3.1.11)
bindex (0.5.0)
builder (3.2.3)
@@ -100,6 +107,7 @@ GEM
railties (>= 3.2, < 5.2)
globalid (0.4.1)
activesupport (>= 4.2.0)
+ htmlentities (4.3.4)
httparty (0.15.6)
multi_xml (>= 0.5.2)
i18n (0.9.1)
@@ -197,6 +205,10 @@ GEM
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
redis (3.3.5)
+ roo (1.13.2)
+ nokogiri
+ rubyzip
+ spreadsheet (> 0.6.4)
rspec-core (3.7.0)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
@@ -215,6 +227,7 @@ GEM
rspec-support (~> 3.7.0)
rspec-support (3.7.0)
ruby-ole (1.2.12.1)
+ rubyzip (1.0.0)
sass (3.5.3)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
@@ -286,6 +299,8 @@ PLATFORMS
DEPENDENCIES
aescrypt
+ axlsx (= 2.0.1)
+ axlsx_rails
bcrypt (~> 3.1.7)
byebug
cancancan (~> 1.10)
@@ -320,13 +335,14 @@ DEPENDENCIES
rack-cors
rails (~> 5.1.0)
redis (~> 3.0)
+ roo
rspec-rails (~> 3.5)
+ rubyzip (= 1.0.0)
sass-rails (~> 5.0)
schema_to_scaffold
shoulda-matchers (~> 3.1)
sidekiq
simple_form
- spreadsheet
spring
spring-watcher-listen (~> 2.0.0)
tether-rails
diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js
index f6365db0..d3723026 100755
--- a/app/assets/javascripts/addorder.js
+++ b/app/assets/javascripts/addorder.js
@@ -196,7 +196,7 @@ $(function() {
+add+ ''
+''
+''
- +"
0
+ remarks = "Junciton Gift Card Payment. RefNo-" + voucher_no
+ else
+ remarks = "Junciton Voucher Payment. RefNo-" + voucher_no
+ end
+
+ if(Sale.exists?(sale_id))
+ saleObj = Sale.find(sale_id)
+ shop_details = Shop::ShopDetail
+
+ # rounding adjustment
+ # if shop_details.is_rounding_adj
+ # new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
+ # rounding_adj = new_total-saleObj.grand_total
+ # saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
+ # end
+
+ # saleObj = Sale.find(sale_id)
+ sale_payment = SalePayment.new
+ @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "JunctionPay", remarks)
+ end
+ end
+
+end
diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb
index 00ad4e4d..f9aaa51c 100755
--- a/app/controllers/origami/payments_controller.rb
+++ b/app/controllers/origami/payments_controller.rb
@@ -27,7 +27,7 @@ class Origami::PaymentsController < BaseOrigamiController
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
- if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
+ # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
# Print for First Bill to Customer
unique_code = "ReceiptBillPdf"
@@ -79,8 +79,17 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
- printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil)
- end
+ filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil)
+
+ result = {
+ :filepath => filename,
+ :printer_model => print_settings.brand_name,
+ :printer_url => print_settings.api_settings
+ }
+
+ # Mobile Print
+ render :json => result.to_json
+ # end
end
def create
@@ -131,7 +140,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
# For Print
- if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
+ # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
unique_code = "ReceiptBillPdf"
if !receipt_bill_a5_pdf.empty?
@@ -195,7 +204,20 @@ class Origami::PaymentsController < BaseOrigamiController
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
- end
+
+ if params[:type] == "quick_service"
+ booking = Booking.find_by_sale_id(sale_id)
+ if booking.dining_facility_id.to_i>0
+ table_id = booking.dining_facility_id
+ else
+ table_id = 0
+ end
+
+ booking.booking_orders.each do |order|
+ Order.pay_process_order_queue(order.order_id,table_id)
+ end
+ # end
+ end
end
end
@@ -213,6 +235,7 @@ class Origami::PaymentsController < BaseOrigamiController
@jcbcount= 0.0
@mastercount = 0.0
@unionpaycount = 0.0
+ @junctionpaycount = 0.0
@credit = 0.0
@sale_data = Sale.find_by_sale_id(sale_id)
@balance = 0.00
@@ -325,6 +348,8 @@ class Origami::PaymentsController < BaseOrigamiController
@mastercount += spay.payment_amount
elsif spay.payment_method == "unionpay"
@unionpaycount += spay.payment_amount
+ elsif spay.payment_method == "JunctionPay"
+ @junctionpaycount += spay.payment_amount
elsif spay.payment_method == "creditnote"
@credit += spay.payment_amount
end
diff --git a/app/controllers/print_settings_controller.rb b/app/controllers/print_settings_controller.rb
index 710e6ea4..f12778af 100755
--- a/app/controllers/print_settings_controller.rb
+++ b/app/controllers/print_settings_controller.rb
@@ -64,6 +64,17 @@ class PrintSettingsController < ApplicationController
end
end
+ def get_printer_options
+ printer_name = params[:printer_name]
+ printer_options = Printer::PrinterWorker.printer_options(printer_name)
+ options = {
+ :url => printer_options['device-uri'],
+ :model => printer_options['printer-info'],
+ }
+
+ render :json => options.to_json
+ end
+
private
# Use callbacks to share common setup or constraints between actions.
def set_print_setting
@@ -72,7 +83,7 @@ class PrintSettingsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def print_setting_params
- params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
+ params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :brand_name, :printer_type, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
end
#Shop Name in Navbor
diff --git a/app/controllers/settings/menus_controller.rb b/app/controllers/settings/menus_controller.rb
index 0a6d87c7..8fed1e97 100755
--- a/app/controllers/settings/menus_controller.rb
+++ b/app/controllers/settings/menus_controller.rb
@@ -7,12 +7,9 @@ class Settings::MenusController < ApplicationController
def index
@settings_menus = Menu.all.page(params[:page]).per(10)
respond_to do |format|
- format.html
- # format.csv { send_data MenuCsvExport.generate }
-
-format.csv { send_data Menu.to_csv }
-# format.csv { send_data MenuCategory.to_csv }
- end
+ format.html
+ format.xlsx
+ end
end
# GET /settings/menus/1
@@ -76,7 +73,7 @@ format.csv { send_data Menu.to_csv }
def import
Menu.import(params[:file])
- redirect_to settings_menu_path, notice: "imported"
+ redirect_to settings_menus_path, notice: "imported"
end
private
diff --git a/app/models/menu.rb b/app/models/menu.rb
index 12784eea..e42ad876 100755
--- a/app/models/menu.rb
+++ b/app/models/menu.rb
@@ -1,4 +1,6 @@
class Menu < ApplicationRecord
+
+ require 'spreadsheet'
has_many :menu_categories, dependent: :destroy
validates_presence_of :name, :valid_days, :valid_time_from, :valid_time_to
@@ -34,7 +36,7 @@ class Menu < ApplicationRecord
def self.to_csv
m_attributes = %w{name is_active valid_days valid_time_from valid_time_to created_by created_at updated_at}
- CSV.generate(headers: true) do |csv|
+ CSV.generate(headers: true, row_sep: "\r\n") do |csv|
csv << m_attributes
menu = Menu.all
menu.each do |user|
@@ -44,9 +46,39 @@ class Menu < ApplicationRecord
end
def self.import(file)
- CSV.foreach(file.path, headers:true) do |row|
- Menu.create! row.to_hash
- end
+ spreadsheet = Roo::Spreadsheet.open(file.path)
+
+ spreadsheet = Roo::Excelx.new(file.path)
+
+ # Use the extension option if the extension is ambiguous.
+ spreadsheet = Roo::Spreadsheet.open(file.path, extension: :xlsx)
+
+ puts spreadsheet.info
+
+ header = spreadsheet.row(1)
+
+ (2..spreadsheet.last_row).each do |i|
+
+ row = Hash[[header,spreadsheet.row(i)].transpose]
+
+ menu = Menu.new
+ menu.name = row["name"]
+ menu.is_active = row["is_active"]
+ menu.valid_days = row["valid_days"]
+ menu.valid_time_from = row["valid_time_from"]
+ menu.valid_time_to = row["valid_time_to"]
+ menu.created_by = row["created_by"]
+ menu.save
+ end
+ end
+
+ def self.open_spreadsheet(file)
+ case File.extname(file.original_filename)
+ when ".csv" then Roo::CSV.new(file.path,nil,:ignore)
+ when ".xls" then Roo::Excel.new(file.path,nil,:ignore)
+ when ".xlsx" then Roo::Excelx.new(file.path,nil,:ignore)
+ else raise "Unknown File type: #{original_filename}"
+ end
end
end
\ No newline at end of file
diff --git a/app/models/print_setting.rb b/app/models/print_setting.rb
index d28b852b..a3cfc597 100755
--- a/app/models/print_setting.rb
+++ b/app/models/print_setting.rb
@@ -1,6 +1,6 @@
class PrintSetting < ApplicationRecord
# validations
- validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height, :print_copies
+ validates_presence_of :name, :unique_code, :printer_name, :brand_name, :api_settings, :page_width, :page_height, :print_copies
def self.get_precision_delimiter
PrintSetting.find_by_unique_code("ReceiptBillPdf")
diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb
index c0485187..2924853e 100755
--- a/app/models/printer/printer_worker.rb
+++ b/app/models/printer/printer_worker.rb
@@ -24,6 +24,11 @@ class Printer::PrinterWorker
end
end
+ # Options from printer name
+ def self.printer_options(printer_name)
+ Cups.options_for(printer_name)
+ end
+
def self.printers()
Cups.show_destinations
end
diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb
index d544c908..597f264a 100755
--- a/app/models/printer/receipt_printer.rb
+++ b/app/models/printer/receipt_printer.rb
@@ -176,7 +176,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data)
#Use CUPS service
#Generate PDF
- #Print
+ #Print
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data)
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
if !receipt_bill_a5_pdf.empty?
@@ -202,14 +202,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
begin
if count == 1
- filename = "/receipts/receipt_bill_#{sale_data.receipt_no}.pdf"
- pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf"
+ filename = directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf"
+ pdf.render_file filename
if printed_status != 'Paid'
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name)
end
else
- filename = "/receipts/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf"
- pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf"
+ filename = directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf"
+ pdf.render_file filename
if printed_status != 'Paid'
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf", cashier_terminal.printer_name)
end
diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb
index 5809dc0f..b82cbf18 100755
--- a/app/models/sale_payment.rb
+++ b/app/models/sale_payment.rb
@@ -11,6 +11,7 @@ class SalePayment < ApplicationRecord
def process_payment(invoice, action_by, cash_amount, payment_method,remark=nil)
self.sale = invoice
self.received_amount = cash_amount
+ self.payment_reference = remark
amount_due = invoice.grand_total
#get all payment for this invoices
@@ -48,6 +49,8 @@ class SalePayment < ApplicationRecord
payment_status = paypar_payment
when "foc"
payment_status = foc_payment
+ when "JunctionPay"
+ payment_status = junction_pay_payment
else
puts "it was something else"
end
@@ -297,6 +300,22 @@ class SalePayment < ApplicationRecord
end
+ def junction_pay_payment
+ payment_status = false
+
+ #Next time - validate if the vochure number is valid - within
+ self.payment_method = "JunctionPay"
+ self.payment_amount = self.received_amount
+ # self.payment_reference = self.payment_reference
+ self.outstanding_amount = self.sale.grand_total- self.received_amount
+ self.payment_status = "paid"
+ payment_method = self.save!
+ sale_update_payment_status(self.received_amount)
+
+ return payment_status
+
+ end
+
def sale_update_payment_status(paid_amount,check_foc = false)
#update amount_outstanding
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb
index fe1ee628..c0299033 100755
--- a/app/pdf/receipt_bill_pdf.rb
+++ b/app/pdf/receipt_bill_pdf.rb
@@ -1,111 +1,113 @@
class ReceiptBillPdf < Prawn::Document
- include ActionView::Helpers::NumberHelper
+ include ActionView::Helpers::NumberHelper
- attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
- def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data)
- self.page_width = printer_settings.page_width
- self.page_height = printer_settings.page_height
- self.margin = 0
- self.price_width = 60
- self.qty_width = 25
- self.total_width = 60
- self.item_width = self.page_width - ((self.qty_width + self.price_width + self.total_width))
- self.item_height = 15
- self.item_description_width = (self.page_width-5) / 2
- self.label_width = 100
+ attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
+
+ def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data)
+ self.page_width = printer_settings.page_width
+ self.page_height = printer_settings.page_height
+ self.margin = 0
+ self.price_width = 60
+ self.qty_width = 25
+ self.total_width = 60
+ self.item_width = self.page_width - ((self.qty_width + self.price_width + self.total_width))
+ self.item_height = 15
+ self.item_description_width = (self.page_width-5) / 2
+ self.label_width = 100
- self.description_width = 150
- self.price_num_width = 50
- self.line_move = 2
- # @item_width = self.page_width.to_i / 2
- # @qty_width = @item_width.to_i / 3
- # @double = @qty_width * 1.3
- # @half_qty = @qty_width / 2
- #setting page margin and width
- super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
+ self.description_width = 150
+ self.price_num_width = 50
+ self.line_move = 2
+ # @item_width = self.page_width.to_i / 2
+ # @qty_width = @item_width.to_i / 3
+ # @double = @qty_width * 1.3
+ # @half_qty = @qty_width / 2
+ #setting page margin and width
+ super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
- #precision checked
- if printer_settings.precision.to_i > 2
- printer_settings.precision = 2
+ #precision checked
+ if printer_settings.precision.to_i > 2
+ printer_settings.precision = 2
+ end
+
+ # db font setup
+ if printer_settings.font != ""
+ font_families.update("#{printer_settings.font}" => {
+ :normal => "public/fonts/#{printer_settings.font}.ttf",
+ :italic => "public/fonts/#{printer_settings.font}.ttf",
+ :bold => "public/fonts/#{printer_settings.font}.ttf",
+ :bold_italic => "public/fonts/#{printer_settings.font}.ttf"
+ })
+
+ font "#{printer_settings.font}"
+ fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
+ end
+ # font "public/fonts/Zawgyi-One.ttf"
+ # font "public/fonts/padauk.ttf"
+ self.header_font_size = 10
+ self.item_font_size = 8
+
+ if printer_settings.delimiter
+ delimiter = ","
+ else
+ delimiter = ""
+ end
+
+ header(shop_details)
+
+ stroke_horizontal_rule
+
+ cashier_info(sale_data, customer_name)
+ line_items(sale_items,printer_settings.precision,delimiter)
+ all_total(sale_data,printer_settings.precision,delimiter)
+
+
+ if member_info != nil
+ member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance)
+ end
+
+ customer(customer_name)
+
+ #start card sale trans data
+ if card_data != nil
+ card_sale_data(card_data)
+ end
+ #end card sale trans data
+
+ if discount_price_by_accounts.length > 0 && shop_details.show_account_info
+ discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
+ end
+
+ if shop_details.show_account_info
+ items_account(item_price_by_accounts,printer_settings.precision,delimiter)
+ end
+
+ #start for individual payment
+ if !sale_data.equal_persons.nil?
+ individual_payment(sale_data, printer_settings.precision, delimiter)
+ end
+ #end for individual payment
+
+ sign(sale_data)
+
+ footer(printed_status)
end
- # db font setup
- if printer_settings.font != ""
- font_families.update("#{printer_settings.font}" => {
- :normal => "public/fonts/#{printer_settings.font}.ttf",
- :italic => "public/fonts/#{printer_settings.font}.ttf",
- :bold => "public/fonts/#{printer_settings.font}.ttf",
- :bold_italic => "public/fonts/#{printer_settings.font}.ttf"
- })
-
- font "#{printer_settings.font}"
- fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
- end
- # font "public/fonts/Zawgyi-One.ttf"
- # font "public/fonts/padauk.ttf"
- self.header_font_size = 10
- self.item_font_size = 8
-
- if printer_settings.delimiter
- delimiter = ","
- else
- delimiter = ""
- end
-
- header(shop_details)
-
- stroke_horizontal_rule
-
- cashier_info(sale_data, customer_name)
- line_items(sale_items,printer_settings.precision,delimiter)
- all_total(sale_data,printer_settings.precision,delimiter)
-
-
- if member_info != nil
- member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance)
- end
-
- customer(customer_name)
-
- #start card sale trans data
- if card_data != nil
- card_sale_data(card_data)
- end
- #end card sale trans data
-
- if discount_price_by_accounts.length > 0 && shop_details.show_account_info
- discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
- end
-
- if shop_details.show_account_info
- items_account(item_price_by_accounts,printer_settings.precision,delimiter)
- end
-
- #start for individual payment
- if !sale_data.equal_persons.nil?
- individual_payment(sale_data, printer_settings.precision, delimiter)
- end
- #end for individual payment
-
- sign(sale_data)
-
- footer(printed_status)
- end
-
- def header (shop_details)
- text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
- move_down line_move
- text "#{shop_details.address}", :size => self.item_font_size,:align => :center
- # move_down self.item_height
- move_down line_move
- text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
- move_down line_move
-
- stroke_horizontal_rule
- end
-
- def cashier_info(sale_data, customer_name)
+ def header (shop_details)
+ text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
move_down line_move
+ text "#{shop_details.address}", :size => self.item_font_size,:align => :center
+ # move_down self.item_height
+ move_down line_move
+ text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
+ move_down line_move
+
+ stroke_horizontal_rule
+ end
+
+ def cashier_info(sale_data, customer_name)
+ move_down line_move
+
# move_down 2
y_position = cursor
bounding_box([0,y_position], :width =>self.description_width + self.price_num_width, :height => self.item_height) do
@@ -117,17 +119,10 @@ class ReceiptBillPdf < Prawn::Document
text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
end
end
-
+
move_down line_move
-
y_position = cursor
- if sale_data.bookings[0].dining_facility_id.to_i > 0
- bounding_box([0,y_position], :width => self.label_width, :height => self.item_height) do
- text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :left
- end
- end
-
- bounding_box([self.label_width, y_position], :width =>self.label_width, :height => self.item_height) do
+ bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
end
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
@@ -141,12 +136,11 @@ class ReceiptBillPdf < Prawn::Document
else
time = sale_data.receipt_date.strftime('%d-%m-%Y %H:%M %p')
end
-
+
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
text "Date : #{ time }",:size => self.item_font_size,:align => :left
end
-
# bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do
# text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }
# - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" ,
@@ -155,7 +149,7 @@ class ReceiptBillPdf < Prawn::Document
move_down line_move
stroke_horizontal_rule
- end
+ end
def line_items(sale_items,precision,delimiter)
if precision.to_i > 0
@@ -250,7 +244,6 @@ class ReceiptBillPdf < Prawn::Document
end
def all_total(sale_data,precision,delimiter)
-
move_down line_move
item_name_width = self.item_width
y_position = cursor
@@ -316,8 +309,7 @@ class ReceiptBillPdf < Prawn::Document
end
move_down line_move
- sale_payment(sale_data,precision,delimiter)
-
+ sale_payment(sale_data,precision,delimiter)
end
def sale_payment(sale_data,precision,delimiter)
@@ -494,8 +486,8 @@ class ReceiptBillPdf < Prawn::Document
end
#individual payment per person
- def individual_payment(sale_data, precision, delimiter)
- per_person = sale_data.grand_total.to_i / sale_data.equal_persons.to_i
+ def individual_payment(sale_data, survey, precision, delimiter)
+ per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
stroke_horizontal_rule
move_down line_move
y_position = cursor
@@ -548,8 +540,7 @@ class ReceiptBillPdf < Prawn::Document
text "Acknowledged By" , :size => self.item_font_size,:align => :center
end
end
-
-
+
end
def footer(printed_status)
diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb
index ffbf1e4c..8b6155c5 100755
--- a/app/views/origami/home/show.html.erb
+++ b/app/views/origami/home/show.html.erb
@@ -723,7 +723,9 @@
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,"");
-
+
+ // console.log(result);
+ // code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
location.reload();
}
});
diff --git a/app/views/origami/junction_pay/create.json.jbuilder b/app/views/origami/junction_pay/create.json.jbuilder
new file mode 100755
index 00000000..9767a7d8
--- /dev/null
+++ b/app/views/origami/junction_pay/create.json.jbuilder
@@ -0,0 +1,5 @@
+if(@status)
+ json.status @status
+else
+ json.status false
+end
diff --git a/app/views/origami/junction_pay/index.html.erb b/app/views/origami/junction_pay/index.html.erb
new file mode 100755
index 00000000..cdbdc47d
--- /dev/null
+++ b/app/views/origami/junction_pay/index.html.erb
@@ -0,0 +1,300 @@
+
+
+
+
+
+
<%= @membership_id%>
+
<%= @member_discount%>
+
<%= @sub_total%>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb
index a5449d35..1d25c5c4 100755
--- a/app/views/origami/payments/show.html.erb
+++ b/app/views/origami/payments/show.html.erb
@@ -265,6 +265,20 @@
<%= number_with_precision(0, precision: precision.to_i ) %>
<% end %>
+
+ <% if @junctionpaycount != 0.0 %>
+