prints, excels,pdf gems

This commit is contained in:
Min Zeya Phyo
2017-04-14 16:00:53 +06:30
parent 7cc2ac395d
commit c1e61c1a39
3 changed files with 45 additions and 1 deletions

View File

@@ -24,6 +24,12 @@ gem 'simple_form'
gem 'bootstrap', '~> 4.0.0.alpha3'
gem "font-awesome-rails"
#Report and Printing gems
gem 'cups', '~> 0.0.7'
gem 'prawn'
gem 'prawn-table'
gem 'spreadsheet'
gem 'to_xls-rails'
# Use jquery as the JavaScript library
gem 'jquery-rails'

View File

@@ -55,6 +55,7 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
cups (0.0.7)
database_cleaner (1.5.3)
debug_inspector (0.0.2)
diff-lcs (1.3)
@@ -98,6 +99,12 @@ GEM
nio4r (2.0.0)
nokogiri (1.7.1)
mini_portile2 (~> 2.1.0)
pdf-core (0.7.0)
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
prawn-table (0.2.2)
prawn (>= 1.3.0, < 3.0.0)
puma (3.8.2)
rack (2.0.1)
rack-test (0.6.3)
@@ -146,6 +153,7 @@ GEM
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
ruby-ole (1.2.12.1)
sass (3.4.23)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
@@ -160,6 +168,8 @@ GEM
simple_form (3.4.0)
actionpack (> 4, < 5.1)
activemodel (> 4, < 5.1)
spreadsheet (1.1.4)
ruby-ole (>= 1.0)
spring (2.0.1)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
@@ -175,6 +185,9 @@ GEM
thor (0.19.4)
thread_safe (0.3.6)
tilt (2.0.7)
to_xls-rails (1.3.1)
spreadsheet (>= 0.8.5)
ttfunk (1.5.0)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
@@ -199,6 +212,7 @@ DEPENDENCIES
bootstrap (~> 4.0.0.alpha3)
byebug
coffee-rails (~> 4.2)
cups (~> 0.0.7)
database_cleaner
factory_girl_rails (~> 4.0)
faker
@@ -207,6 +221,8 @@ DEPENDENCIES
jquery-rails
listen (~> 3.0.5)
mysql2 (>= 0.3.18, < 0.5)
prawn
prawn-table
puma (~> 3.0)
rails (~> 5.0.2)
rspec-rails (~> 3.5)
@@ -214,12 +230,14 @@ DEPENDENCIES
schema_to_scaffold
shoulda-matchers (~> 3.1)
simple_form
spreadsheet
spring
spring-watcher-listen (~> 2.0.0)
to_xls-rails
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
BUNDLED WITH
1.13.7
1.14.6

View File

@@ -0,0 +1,20 @@
require 'cups'
class PrintWorker
def self.printers()
Cups.show_destinations
end
def self.default_printer()
Cups.default_printer
end
def self.print_receipt_cashgo(sale,receipt_setting, printer_destination,order_id)
pdf = CashPdf.new(sale,receipt_setting,order_id)
pdf.render_file "tmp/receipt_#{sale.receipt_no}" + ".pdf"
page = Cups::PrintJob.new("tmp/receipt_#{sale.receipt_no}.pdf", printer_destination)
page.print
end
end