diff --git a/app/controllers/invoices_controller.rb b/app/controllers/invoices_controller.rb index 67e9b8c..4b34df0 100644 --- a/app/controllers/invoices_controller.rb +++ b/app/controllers/invoices_controller.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 class InvoicesController < ApplicationController def index @invoices = Invoice.where(user_id: current_user.id) @@ -10,7 +11,9 @@ class InvoicesController < ApplicationController format.pdf do render pdf: "Faktura_VAT_#{@invoice.id}", # Excluding ".pdf" extension. disposition: 'attachment', - exe_path: '' + layout: 'pdf', + encoding: 'UTF-8', + viewport_size: '1280x1024' end end end diff --git a/app/views/invoices/_show.html.erb b/app/views/invoices/_show.html.erb index 13fbd89..3037802 100644 --- a/app/views/invoices/_show.html.erb +++ b/app/views/invoices/_show.html.erb @@ -4,8 +4,8 @@
-
-
+
+
Miejsce wystawienia
<%= 'Rumia' %>
@@ -21,7 +21,7 @@

 

-

Faktura VAT nr <%= @invoice.number %>

+

Faktura VAT nr <%= @invoice.number %>

 

@@ -29,42 +29,46 @@
-

Sprzedawca:

+

Sprzedawca:

+
+
+
+
<%= @invoice.user_firm.name %>
-

<%= @invoice.user_firm.name %>

+
<%= @invoice.user_firm.street %>
-

<%= @invoice.user_firm.street %>

+
<%= @invoice.user_firm.postcode %> <%= @invoice.user_firm.city %>
-

<%= @invoice.user_firm.postcode %> <%= @invoice.user_firm.city %>

-
-
-

NIP: <%= @invoice.user_firm.nip %>

+
NIP: <%= @invoice.user_firm.nip %>
+
-

Nabywca:

+

Nabywca:

+
+
+
+
<%= @invoice.customer.name %>
-

<%= @invoice.customer.name %>

+
<%= @invoice.customer.street %>
-

<%= @invoice.customer.street %>

+
<%= @invoice.customer.postcode %> <%= @invoice.user_firm.city %>
-

<%= @invoice.customer.postcode %> <%= @invoice.user_firm.city %>

-
-
-

NIP: <%= @invoice.customer.nip %>

+
NIP: <%= @invoice.customer.nip %>
+
-

 

+

 

@@ -127,8 +131,8 @@
-
-
+
+
@@ -155,7 +159,9 @@
- +
+

 

+
@@ -181,28 +187,26 @@
-

 

+

 

-
-
-
+
+
- +
Sprzedający:
Osoba upowazniona do wystawienia faktury VATHinz Adrian
Osoba upowazniona do wystawienia faktury VAT
-
- +
+
- +
Kupujący:
Osoba upowazniona do odbioru faktury VATOsoba upowazniona do odbioru faktury VAT
-
diff --git a/app/views/layouts/pdf.pdf.erb b/app/views/layouts/pdf.pdf.erb new file mode 100644 index 0000000..acc9709 --- /dev/null +++ b/app/views/layouts/pdf.pdf.erb @@ -0,0 +1,17 @@ + + + + FireStorm - Faktury + + <%= csrf_meta_tags %> + <%= wicked_pdf_stylesheet_link_tag "bootstrap.css" -%> + <%= wicked_pdf_stylesheet_link_tag "bootstrap-theme.css" -%> + <%= wicked_pdf_stylesheet_link_tag "style.css" -%> + + + +
+ <%= yield %> +
+ + diff --git a/config/initializers/wicked_pdf.rb b/config/initializers/wicked_pdf.rb index ad5cec2..116a9ff 100644 --- a/config/initializers/wicked_pdf.rb +++ b/config/initializers/wicked_pdf.rb @@ -11,11 +11,12 @@ 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', + exe_path: 'c:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe', + # exe_path: '/usr/local/rvm/gems/ruby-2.2.5/gems/wkhtmltopdf-binary-0.9.9/bin/wkhtmltopdf_linux_x64' # or - exe_path: Gem.bin_path('wkhtmltopdf-binary', 'wkhtmltopdf') + #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', + layout: 'pdf.html' }