Jump to content

[NEED HELP] Edit Invoice pdf template (add few text lines)


JohnnyL

Recommended Posts

Hi WHMCS Gurus!

 

Im in need of some help, this might be easy peazy for some of you. But i don't know what to add to the lines.

 

 

Currently my this upper corner looks like this:

not good.png

 

 

BUT

 

I want to add some of the lines in the invoice to look like this:

 

80c64685cd6c6f670e9a39192e024871.png

 

 

How can i accomplish this?

 

BIG THANK YOU in advance!

 

Johnny

80c64685cd6c6f670e9a39192e024871.png

not good.png

Link to comment
Share on other sites

Johnny,

 

the first part is easy, the second part will take a little work...

 

so for removing the due date, you just remove the line below from invoicepdf.tpl...

 

$pdf->Cell(0, 6, Lang::trans('invoicesdatedue') . ': ' . $duedate, 0, 1, 'L', '1');

 

for the second half, I don't know whether you need this to work in multiple languages - i'm going to assume just one language as one of your terms isn't mentioned in the language files (seems to be a mix of Dutch and Danish!).. if you need the solution to be multilingual, then you'd need to use Language Overrides - as i've used for Payment Method...

 

$create = new DateTime($datecreated);
$due = new DateTime($duedate);
$days = $create->diff($due);
$pdf->Cell(0, 6, 'Betalingstermijn: ' . $days->days . ' ' . Lang::trans('days'), 0, 1, 'L', '1');
$pdf->Cell(0, 6, Lang::trans('paymentmethod') . ': ' . $paymentmethod, 0, 1, 'L', '1');

Link to comment
Share on other sites

Johnny,

 

the first part is easy, the second part will take a little work...

 

so for removing the due date, you just remove the line below from invoicepdf.tpl...

 

$pdf->Cell(0, 6, Lang::trans('invoicesdatedue') . ': ' . $duedate, 0, 1, 'L', '1');

 

for the second half, I don't know whether you need this to work in multiple languages - i'm going to assume just one language as one of your terms isn't mentioned in the language files (seems to be a mix of Dutch and Danish!).. if you need the solution to be multilingual, then you'd need to use Language Overrides - as i've used for Payment Method...

 

$create = new DateTime($datecreated);
$due = new DateTime($duedate);
$days = $create->diff($due);
$pdf->Cell(0, 6, 'Betalingstermijn: ' . $days->days . ' ' . Lang::trans('days'), 0, 1, 'L', '1');
$pdf->Cell(0, 6, Lang::trans('paymentmethod') . ': ' . $paymentmethod, 0, 1, 'L', '1');

 

AWESOME Brian!!

 

Its indeed just 1 language! that's Dutch.

 

Ill give that code a try! will reply with the results.

Link to comment
Share on other sites

Brian!

 

Ive tested the code, Whenever i copy paste the whole code under

 

$pdf->Cell(0, 6, Lang::trans('invoicesdatecreated') . ': ' . $datecreated, 0, 1, 'L', '1');

 

Im getting a white screen when opening the PDF.

 

But whenever i remove these lines;

$create = new DateTime($datecreated);
$due = new DateTime($duedate);
$days = $create->diff($due);

 

It works, but it doesnt show the actuall number days.. See screenshot: https://gyazo.com/9a1b4b7dadd097ad0e62266632bdc717

 

How to fix that part?

 

Big thank you for the reply and help!

Link to comment
Share on other sites

those lines that you removed should work in any PHP version later than 5.3? :?:

 

try the following instead....

 

$diffdays = floor(abs((strtotime($datecreated))-(strtotime($duedate)))/86400);
$pdf->Cell(0, 6, 'Betalingstermijn: ' . $diffdays . ' ' . Lang::trans('days'), 0, 1, 'L', '1'); 
$pdf->Cell(0, 6, Lang::trans('paymentmethod') . ': ' . $paymentmethod, 0, 1, 'L', '1');

if you still get a white screen, then goto setup -> general settings -> other -> display errors and tick the box - and it should then tell you where the error is.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated