Fixing print pdf method bug
This commit is contained in:
parent
159085c55d
commit
7508ae2e65
Binary file not shown.
@ -638,21 +638,18 @@ class PriceDocument < ApplicationRecord
|
|||||||
|
|
||||||
system("node #{pdf}.js #{Shellwords.escape(url)} #{Shellwords.escape(@temp_file)}")
|
system("node #{pdf}.js #{Shellwords.escape(url)} #{Shellwords.escape(@temp_file)}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require 'posix/spawn'
|
require 'posix/spawn'
|
||||||
::POSIX::Spawn::Child.new 'pdftk', @temp_file, 'stamp', "#{Rails.root}/pdf_stamp/en-tete.pdf", 'output', @final_file
|
::POSIX::Spawn::Child.new 'pdftk', @temp_file, 'stamp', "#{Rails.root}/pdf_stamp/en-tete.pdf", 'output', @final_file
|
||||||
# if true
|
|
||||||
if self.label != "Bon de livraison"
|
if self.label != "Bon de livraison"
|
||||||
#::POSIX::Spawn::Child.new 'pdftk', @final_file,"#{Rails.root}/pdf_stamp/cgv.pdf", 'cat', 'output', @final_file2 #AJOUT CGV
|
#::POSIX::Spawn::Child.new 'pdftk', @final_file,"#{Rails.root}/pdf_stamp/cgv.pdf", 'cat', 'output', @final_file2 #AJOUT CGV
|
||||||
|
#return @final_file2
|
||||||
|
File.rename(@final_file, @final_file2)
|
||||||
|
File.delete(@temp_file) if File.exist?(@temp_file)
|
||||||
return @final_file2
|
return @final_file2
|
||||||
else
|
else
|
||||||
return @final_file
|
return @final_file
|
||||||
end
|
end
|
||||||
|
|
||||||
# File.rename(@temp_file, @final_file2)
|
|
||||||
#File.delete(@temp_file) if File.exist?(@temp_file)
|
|
||||||
#File.delete(@final_file) if File.exist?(@final_file)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,57 +50,9 @@
|
|||||||
table, tbody {
|
table, tbody {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-price_line_block = @price_document.price_line_block
|
-price_line_block = @price_document.price_line_block
|
||||||
%body
|
%body
|
||||||
|
|
||||||
-if @price_document.label == "Bon de livraison"
|
|
||||||
-@bl = true
|
|
||||||
-particular_doc = price_line_block.particular_send
|
|
||||||
|
|
||||||
|
|
||||||
-else
|
|
||||||
-particular_doc = price_line_block.particular_bill
|
|
||||||
|
|
||||||
|
|
||||||
-if particular_doc.organisation?
|
|
||||||
%strong=particular_doc.organisation
|
|
||||||
-if particular_doc.com_name?
|
|
||||||
%br
|
|
||||||
=particular_doc.com_name
|
|
||||||
|
|
||||||
%br
|
|
||||||
-if particular_doc.firstname? or particular_doc.name?
|
|
||||||
=particular_doc.civilite
|
|
||||||
|
|
||||||
=particular_doc.firstname
|
|
||||||
|
|
||||||
=particular_doc.name
|
|
||||||
%br
|
|
||||||
|
|
||||||
=particular_doc.address_2
|
|
||||||
|
|
||||||
-if particular_doc.address_3?
|
|
||||||
%br
|
|
||||||
=particular_doc.address_3
|
|
||||||
%br
|
|
||||||
=particular_doc.cp
|
|
||||||
|
|
||||||
=particular_doc.city
|
|
||||||
%br
|
|
||||||
=particular_doc.country
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%table
|
%table
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
@ -139,7 +91,33 @@
|
|||||||
%td
|
%td
|
||||||
%p{style: "line-height: 3px;"} Josef Falser
|
%p{style: "line-height: 3px;"} Josef Falser
|
||||||
%p{style: "line-height: 3px;"} zona produttiva Bodner 2
|
%p{style: "line-height: 3px;"} zona produttiva Bodner 2
|
||||||
%p{style: "line-height: 3px;"} 39053 Prato Isarco, IT
|
%p{style: "line-height: 3px;"}
|
||||||
|
39053 Prato Isarco, IT
|
||||||
|
-if @price_document.label == "Bon de livraison"
|
||||||
|
-@bl = true
|
||||||
|
-particular_doc = price_line_block.particular_send
|
||||||
|
-else
|
||||||
|
-particular_doc = price_line_block.particular_bill
|
||||||
|
-if particular_doc.organisation?
|
||||||
|
%strong=particular_doc.organisation
|
||||||
|
-if particular_doc.com_name?
|
||||||
|
%br
|
||||||
|
=particular_doc.com_name
|
||||||
|
%br
|
||||||
|
-if particular_doc.firstname? or particular_doc.name?
|
||||||
|
=particular_doc.civilite
|
||||||
|
=particular_doc.firstname
|
||||||
|
=particular_doc.name
|
||||||
|
%br
|
||||||
|
=particular_doc.address_2
|
||||||
|
-if particular_doc.address_3?
|
||||||
|
%br
|
||||||
|
=particular_doc.address_3
|
||||||
|
%br
|
||||||
|
=particular_doc.cp
|
||||||
|
=particular_doc.city
|
||||||
|
%br
|
||||||
|
=particular_doc.country
|
||||||
|
|
||||||
|
|
||||||
%table{style: "margin-top: 40px"}
|
%table{style: "margin-top: 40px"}
|
||||||
@ -209,27 +187,6 @@
|
|||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%div{:style => "position:absolute;top:20px;;right:0;"}
|
|
||||||
%span{:style => "font-size:14pt;font-weight:bold;text-transform:uppercase;"}
|
|
||||||
=@price_document.label
|
|
||||||
|
|
||||||
%span{:style => "font-weight:normal;"}=@price_document.d_number
|
|
||||||
|
|
||||||
%br
|
|
||||||
Date :
|
|
||||||
=l @price_document.date, :format => :date
|
|
||||||
|
|
||||||
|
|
||||||
-if @price_document.ref_element_type == "PCustomerSheet" and @price_document.ref_element
|
|
||||||
-bc = @price_document.ref_element.price_documents.where(:cc_label => "Bon de commande").order("date DESC, created_at DESC").first
|
|
||||||
-if bc
|
|
||||||
="-"
|
|
||||||
Ref commande :
|
|
||||||
=bc.d_number
|
|
||||||
|
|
||||||
|
|
||||||
%table.table{:style => "width:auto;"}
|
%table.table{:style => "width:auto;"}
|
||||||
%tr
|
%tr
|
||||||
%td N° Client
|
%td N° Client
|
||||||
|
Reference in New Issue
Block a user