Git Product home page Git Product logo

solidus_print_invoice's Introduction

SolidusPrintInvoice

CircleCI

This extension provides a "Print Invoice" button on the Admin Orders view screen which generates a PDF of the order details.

This is meant to provide an example of how this can be done, and is easily extended by overriding the templates however you prefer.

Installation

Add solidus_print_invoice to your Gemfile:

gem 'solidus_print_invoice' , github: 'solidusio-contrib/solidus_print_invoice'

Bundle your dependencies and run the installation generator:

$ bundle install
$ rails g solidus_print_invoice:install
  1. 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")
  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 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.

  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] })

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs, and Rubocop static code analysis.

bundle
bundle exec rake

When testing your application's integration with this extension you may use its factories. Simply add this require statement to your spec_helper:

require 'solidus_print_invoice/factories'

Releasing

Your new extension version can be released using gem-release like this:

bundle exec gem bump -v VERSION --tag --push --remote upstream && gem release

Copyright (c) 2020 Spree & Solidus Community, released under the New BSD License

solidus_print_invoice's People

Contributors

afdev82 avatar aitbw avatar aldesantis avatar angileri avatar binaryphile avatar dominiksteiner avatar dpritchett avatar elia avatar hates avatar jdutil avatar jhawthorn avatar jumph4x avatar kennyadsl avatar koprad avatar linrock avatar memotoro avatar mtylty avatar radar avatar romul avatar schof avatar senjai avatar smartacus avatar spaghetticode avatar ssendev avatar swcraig avatar tailic avatar tvdeyen avatar waiting-for-dev avatar zachfeldman avatar zhiyao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solidus_print_invoice's Issues

ERROR: undefined method `find_asset' for nil:NilClass on [PROD]

I'm getting this error on PROD undefined method `find_asset' for nil:NilClass when I try to print the invoice.

app/config/initializers/spree.rb

Spree::PrintInvoice::Config.set(print_buttons: "invoice,packaging_slip")
Spree::PrintInvoice::Config.set(print_invoice_logo_path: "logos/custom-admin.png")

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'solidus_extension_dev_tools' in git://github.com/solidusio-contrib/solidus_extension_dev_tools.git (at master@7c47ece).
The source does not contain any versions of 'solidus_extension_dev_tools'

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'solidus_extension_dev_tools' in git://github.com/solidusio-contrib/solidus_extension_dev_tools.git (at master@96208b9).
The source does not contain any versions of 'solidus_extension_dev_tools'

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'solidus_extension_dev_tools' in git://github.com/solidusio-contrib/solidus_extension_dev_tools.git (at master@042f10b).
The source does not contain any versions of 'solidus_extension_dev_tools'

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

NoMethodError in Spree::Admin::Orders#show

`im = Sprockets::Railtie.build_environment(Rails.application).find_asset(Spree::PrintInvoice::Config[:print_invoice_logo_path])
image im.filename , :at => [0,720], :scale => logo_scale

fill_color "E99323"
if @hide_prices
`

my spree.rb
Spree::PrintInvoice::Config.set(print_invoice_logo_path: "/path/to/public/images/logoserp.jpg")

not sure why it keep giving me this error, i've place my logo under public/images folder

Tax amount are itemized

Tax amount are itemized instead of sum up together. Just imagine if in the order there are 10 products, there will be at least 10 lines of tax amount.

Would appreciate advising on how to fix it?

TQ!

screen shot 2017-06-15 at 7 49 57 pm

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'solidus_extension_dev_tools' in git://github.com/solidusio-contrib/solidus_extension_dev_tools.git (at master@d358b9a).
The source does not contain any versions of 'solidus_extension_dev_tools'

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'solidus_extension_dev_tools' in git://github.com/solidusio-contrib/solidus_extension_dev_tools.git (at master@8140198).
The source does not contain any versions of 'solidus_extension_dev_tools'

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'solidus_extension_dev_tools' in git://github.com/solidusio-contrib/solidus_extension_dev_tools.git (at master@fe57891).
The source does not contain any versions of 'solidus_extension_dev_tools'

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Inclusion of SolidusSupport::EngineExtensions causes load order issues for Solidus apps with controller extensions

Hi there, we were trying to use this gem as-is in our Solidus app, but found that for some reason when the line include SolidusSupport::EngineExtensions is present, our controllers extended from Solidus core are not being loaded. With this line, methods that we've overriden end up being defined in core Solidus code instead, and without this line, our overridden definition is included.

Another reason that we're unable to use this gem as-is is its inclusion of just solidus as a dependency, which caused a lot of changes to our Gemfile.lock including pinning specific versions of Rails.

I don't have time to dig in further as to why the load order problem is present so will likely just be using this gem as an example to follow, but wanted to at least make the authors of them aware of the app, and provide a place for others to troubleshoot if they also see this issue.

Invoice numbers won't increment properly using static preferences

When using static preferences (the new default) invoice numbers won't increment properly and will be reset when the server restarts.

The next invoice number is stored as a preference, which has never been a safe way to do this and should never have been done. Nonetheless, with our change to static preferences it now basically doesn't work at all.

We should move this to a database table or use order.id or similar.

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'solidus_extension_dev_tools' in git://github.com/solidusio-contrib/solidus_extension_dev_tools.git (at master@5b33a25).
The source does not contain any versions of 'solidus_extension_dev_tools'

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Readme uncertainty (for Solidus\Rails beginners)

Hi there!
Firstly I apologize if Issues is not right place for that. If so point me a right direction and close this issue.

My problem is, as Rails\Solidus beginner I don't fully understand how to customize this extension.

  1. Set the logo path preference to include your store / company logo. - I placed it in spree.rb (is it right place?), logo now in invoice, but it is huge, covering all page (sizing not working).
  2. Add your own own footer texts to the locale. - is it myapp/config/locales/en.yml? I placed some content there but can't see any changes in invoice
  3. Override any of the partial templates. - how can I do this? I've created /app/views/spree/admin/orders/_header.pdf.prawn and changed fill_color to another color, can't see any changes in the header color.

and so on..
I would be grateful for any hints on how and where to do customization.

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'solidus_extension_dev_tools' in git://github.com/solidusio-contrib/solidus_extension_dev_tools.git (at master@27a4e38).
The source does not contain any versions of 'solidus_extension_dev_tools'

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

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.