GithubHelp home page GithubHelp logo

sts0mrg0 / spree_print_invoice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arkhitech/spree_print_invoice

0.0 2.0 0.0 819 KB

Create a PDF invoice for Spree orders.

Home Page: http://spreecommerce.com

License: BSD 3-Clause "New" or "Revised" License

Ruby 80.27% CoffeeScript 0.39% JavaScript 0.18% CSS 0.09% HTML 19.08%

spree_print_invoice's Introduction

Spree Print Invoice

Build Status Code Climate

This extension provides a "Print Invoice" button (per default) on the Admin Orders view screen which generates a PDF of the order details. It's fully extendable so you can add own print slips from your own Rails app. It also comes with a packaging slip.

Installation

Add to your Gemfile

gem 'spree_print_invoice', github: 'spree-contrib/spree_print_invoice', branch: 'master'

Run

bundle && exec rails g spree_print_invoice:install

Enjoy! Now allow to generate invoices with sequential numbers.


Configuration and extending slips

  1. Set the logo path preference to include your store / company logo.
Spree::PrintInvoice::Config.set(logo_path: '/path/to/public/images/company-logo.png')
  1. 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.

  2. 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.

  3. 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).

  4. Many european countries requires numeric and sequential invoices numbers. To use invoices sequential number fill the specific field in "General Settings" or by setting:

Spree::PrintInvoice::Config.set(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.

  1. 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.

  1. Set page/document options with:
Spree::PrintInvoice::Config.set(prawn_options: { page_layout: :landscape, page_size: 'A4', margin: [50, 100, 150, 200] })
  1. Enable PDF storage feature

PDF files can be stored to disk. This is very handy, if you want to send these files as email attachment.

Spree::PrintInvoice::Config.set(store_pdf: true) # Default: false
Spree::PrintInvoice::Config.set(storage_path: 'pdfs/orders') # Default: tmp/order_prints

*) Inside the storage_path a folder for each template will be created. Files will be saved with order number respectively invoice number as file name.

Customize templates

In order to customize the build in invoice and packaging slip templates you need to copy them into your app:

$ bundle exec rails g spree_print_invoice:templates

You can then customize them at app/views/spree/admin/orders/invoice.pdf.prawn and app/views/spree/admin/orders/packaging_slip.pdf.prawn.


Contributing

See corresponding guidelines


License

Copyright (c) 2011-2015 Spree Commerce, and other contributors, released under the New BSD License

spree_print_invoice's People

Contributors

alepore avatar angileri avatar benmorganio avatar binaryphile avatar dominiksteiner avatar dpritchett avatar francesco-carrella avatar futhr avatar greendog avatar hates avatar jdutil avatar jumph4x avatar kennyadsl avatar koprad avatar lbrapid avatar linrock avatar mtylty avatar peterberkenbosch avatar radar avatar romul avatar schof avatar smartacus avatar ssendev avatar tailic avatar zhiyao avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.