For the Invoice-Creation:
Copy all prawn files from
..\app\views\spree\admin\orders
to
YOUR_STORE\app\views
o/w marking a order as shipped will not work.
This extension provides a "Print Invoice" button on the Admin Orders view screen which generates a PDF of the order details.
-
The gem relies only on the prawn gem, to install you need to add the following lines to your Gemfile
gem 'spree_print_invoice' , :git => 'git://github.com/the86freak/spree_print_invoice.git'
-
Run bundler
bundle install
-
Install migration
rails g spree_print_invoice:install
-
Enjoy! Now allow to generate invoices with sequential numbers
add configs to config/initializers/spree.rb Spree::PrintInvoice::Config.set(:print_invoice_logo_path => 'logo.png') Spree::PrintInvoice::Config.set(:print_invoice_next_number => 24) Spree::PrintInvoice::Config.set(:prawn_options => {:page_layout => :portrait, :page_size => "A4", :margin => [50, 50, 50, 50]})
The Logo must be in app/assets/images (NOT in public...)
-
Set the logo path preference to include your store / company logo.
Spree::PrintInvoice::Config.set(:print_invoice_logo_path => "/path/to/public/images/company-logo.png")
-
Add your own own footer texts to the locale. The current footer works with :footer_left1 , :footer_left2 and :footer_right1, :footer_right2 where the 1 version is on the left in bold, and the 2 version the "value" on the right.
-
Override any of the partial templates. they are address, footer, totals, header, bye , and the line_items. In bye the text :thanks is printed. The :extra_note hook has been deprecated as Spree no longer supports hooks.
-
Set :suppress_anonymous_address option to get blank addresses for anonymous email addresses (as created by my spree_last_address extension for empty/unknown user info)
-
Many european countries requires numeric and sequential invoices numbers. To use invoices sequential number fill the specific field in "General Settings" or by set Spree::PrintInvoice::Config.set(:print_invoice_next_number => [1|{your current next invoice number}])
The next invoice number will be the one that you specified. You will able to increase it in any moment, for example, to re-sync invoices number if you are making invoices also in other programs for the same business name.
- Enable packaging slips, by setting
Spree::PrintInvoice::Config.set(:print_buttons => "invoice,packaging_slip") #comma separated list
Use above feature for your own template if you want. For each button_name, define button_name_print text in your locale.
- Set page/document options with
Spree::PrintInvoice::Config.set(:prawn_options => {:page_layout => :landscape, :page_size => "A4", :margin => [50, 100, 150, 200]})
Next receipts and then product related stuff with barcodes.
Contributions welcome
Torsten