Signed-off-by: Adrian Hinz <ahinz@voicetelecom.pl>
This commit is contained in:
parent
414c35b2c6
commit
4bc074febd
3
Gemfile
3
Gemfile
|
|
@ -35,7 +35,8 @@ gem 'jbuilder', '~> 2.5'
|
|||
|
||||
# Use Capistrano for deployment
|
||||
# gem 'capistrano-rails', group: :development
|
||||
|
||||
gem 'wicked_pdf'
|
||||
gem 'wkhtmltopdf-binary'
|
||||
group :development, :test do
|
||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||
gem 'byebug', platform: :mri
|
||||
|
|
|
|||
|
|
@ -5,6 +5,14 @@ class InvoicesController < ApplicationController
|
|||
|
||||
def show
|
||||
@invoice = Invoice.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.pdf do
|
||||
render pdf: "Faktura_VAT_#{@invoice.id}", # Excluding ".pdf" extension.
|
||||
disposition: 'attachment',
|
||||
exe_path: ''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
|||
|
|
@ -180,6 +180,30 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12"><h1> </h1></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-1"></div>
|
||||
<div class="col-md-4">
|
||||
<table width="100%" border="1" class="table">
|
||||
<tr><td>Sprzedający:</td></tr>
|
||||
<tr>
|
||||
<td height="150" valign="bottom" class="text-center" style="vertical-align:bottom;">Osoba upowazniona do wystawienia faktury VAT</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-4">
|
||||
<table width="100%" border="1" class="table">
|
||||
<tr><td>Kupujący:</td></tr>
|
||||
<tr>
|
||||
<td height="150" class="text-center" style="vertical-align:bottom;">Osoba upowazniona do odbioru faktury VAT</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-1"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<div class="panel-title">Faktura: <%= @invoice.number %></div>
|
||||
<div class="panel-options">
|
||||
<%= link_to raw("<i class=\"glyphicon glyphicon-arrow-left text-success\"></i> " + I18n.t('back')), invoices_path, title: I18n.t('back'), class: "text-primary" %>
|
||||
<%= link_to 'PDF', invoice_path(@invoice, format: :pdf) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-box-large box-with-header" style="background:#dddddd">
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
<%= render file: '/invoices/_show.html.erb' %>
|
||||
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
Mime::Type.register "application/pdf", :pdf
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
# WickedPDF Global Configuration
|
||||
#
|
||||
# Use this to set up shared configuration options for your entire application.
|
||||
# Any of the configuration options shown here can also be applied to single
|
||||
# models by passing arguments to the `render :pdf` call.
|
||||
#
|
||||
# To learn more, check out the README:
|
||||
#
|
||||
# https://github.com/mileszs/wicked_pdf/blob/master/README.md
|
||||
|
||||
WickedPdf.config = {
|
||||
# Path to the wkhtmltopdf executable: This usually isn't needed if using
|
||||
# one of the wkhtmltopdf-binary family of gems.
|
||||
# exe_path: 'c:/Program Files/wkhtmltopdf/bin/wkhtmltopdf',
|
||||
# or
|
||||
exe_path: Gem.bin_path('wkhtmltopdf-binary', 'wkhtmltopdf')
|
||||
|
||||
# Layout file to be used for all PDFs
|
||||
# (but can be overridden in `render :pdf` calls)
|
||||
# layout: 'pdf.html',
|
||||
}
|
||||
Loading…
Reference in New Issue