Need some quick help for a custom script footer

165 views
Skip to first unread message

flo...@gmail.com

unread,
Apr 25, 2014, 6:39:27 AM4/25/14
to erpnext-dev...@googlegroups.com
Hey guys,

I am pretty good in understanding HTML and also in editing the print forms in ERPnext. I only have problems with scripts. So I would be really thankful if you could give me some help in regard to below issue.

What I basically want to do is adding a footer to quotation / invoice / purchase orders etc printouts (with our legal company details etc).

So the only thing I need is a line of script which enables me to do the following;

1) Whether the footer is shown / printed depends on whether the letterhead checkbox is ticked in the print screen (if that is not possible I am ok with adding another check box via custom fields function)

2) I am utilizing multiple companies in ERPNext so I need to use two different footers. Which footer is shown should then be depended on the value of the field "Letter Head" in the More Info section of e.g. a quotation.



3) The html code for the footer I will add myself. 

So summarizing I am just seraching for a short line of code which does the following

If Letterhead Checkbox = True
Second If Letterhead Select = "Company1" then show "HTML-Code1" (in footer)
Third If Letterhead Select = "Company2" then show "HTML-Code2" (in footer)
Else Dont show any Header or Footer

Hope its understandable what I mean.

Thanks a lot for your help! Really appreciate it!
Kind regards,
Flo

rushabh

unread,
Apr 25, 2014, 11:08:21 AM4/25/14
to erpnext-dev...@googlegroups.com
You will need to create a new Print Format.

In v3, you can write that script via Javascript. Add <script> tags where ever you want dynamic code like 

<script>doc.company=="Company 1" ? doc.html1 : doc.html2</script>

here are some old formats you can take for reference.

flo...@gmail.com

unread,
Apr 25, 2014, 6:13:09 PM4/25/14
to erpnext-dev...@googlegroups.com
Thanks a lot for your post.

I already created the print form and prepared everything. I just need to work on this last piece of script now.

The link you posted is unfortunately not really helpful as none includes any of the script I need.

Could you kindly have a look at it again and help me out on how to do what I described in point 1 (footer shows only when letterhead checkbox is ticked in the print window) & 2 (dependance on used company what html code is used). Where is the html-code for the doc.html1 attribue stored?

I really appreciate you help.

Thanks a lot,
Flo

rushabh

unread,
Apr 26, 2014, 12:06:59 AM4/26/14
to erpnext-dev...@googlegroups.com
What did you try so far?

flo...@gmail.com

unread,
Apr 26, 2014, 5:16:18 AM4/26/14
to erpnext-dev...@googlegroups.com
To be honest I have no clue about JavaScript. I also tried to read into it but I just dont get ahead. I also tried to copy some stuff of the "Discount" function in the quotation template but I just was not able to get anything done. My company really wants to utilize erpnext but if we dont get this footer thing sorted out they gonna reject it. It would be great if you could give me some more ideas on what to do. thanks.

rushabh

unread,
Apr 27, 2014, 11:39:02 AM4/27/14
to erpnext-dev...@googlegroups.com
Hi,

You should engage the help of a freelancer (there could be a few on this forum) to help you out. If you are stuck somewhere but would be happy to help you out. But if you have no clue about javascript, then thats not a very good starting point.
Reply all
Reply to author
Forward
0 new messages