Jump to content

Stamp on Invoice


Tengri

Recommended Posts

Hello!

For some reasons sometimes our banks don't accept invoice from customers without stamp, name of CEO and signature. Is there any way that when the user chooses payment via a Bank under the invoice had the name of the Director signature and stamp.

Thank you!

Link to comment
Share on other sites

22 minutes ago, Tengri said:

For some reasons sometimes our banks don't accept invoice from customers without stamp, name of CEO and signature. Is there any way that when the user chooses payment via a Bank under the invoice had the name of the Director signature and stamp.

if you've got the signature/stamp as an image, e.g png file, then I don't see why you couldn't add it to paid Bank invoices on the invoicespdf.tpl template - if that's where you had it in mind to use it... it will just be a case of deciding where in the layout to put it.

Edited by brian!
Link to comment
Share on other sites

Edit your invoicepdf.tpl and place an if like this one:

<?php

if ($paymentmethod == 'banktransfer') {
	$pdf->Image(ROOTDIR . '/assets/img/yoursignature.png', 15, 25, 75);
}

In the above example I'm supposing that your "Bank" payment method is named "banktransfer". Change image path/name and coordinates accordingly. "yoursignature.png" will be the signature/name of your CEO.

Link to comment
Share on other sites

1 hour ago, Kian said:

Edit your invoicepdf.tpl and place an if like this one:


<?php

if ($paymentmethod == 'banktransfer') {
	$pdf->Image(ROOTDIR . '/assets/img/yoursignature.png', 15, 25, 75);
}

In the above example I'm supposing that your "Bank" payment method is named "banktransfer". Change image path/name and coordinates accordingly. "yoursignature.png" will be the signature/name of your CEO. 

Thank you very much.

I add this code:

<?php

# Logo
$logoFilename = 'placeholder.png';
if (file_exists(ROOTDIR . '/assets/img/logo.png')) {
    $logoFilename = 'logo.png';
} elseif (file_exists(ROOTDIR . '/assets/img/logo.jpg')) {
    $logoFilename = 'logo.jpg';
}
$pdf->Image(ROOTDIR . '/assets/img/' . $logoFilename, 15, 25, 75);

if ($paymentmethod == 'banktransfer') {
	$pdf->Image(ROOTDIR . '/assets/img/yoursignature.png', 15, 25, 75);
}

But no effect.

Link to comment
Share on other sites

As I said in my previous post, you have to adapt the provided code.

if ($paymentmethod == 'banktransfer') { // make sure that "banktransfer" is the system name of your "Bank" payment method 
	$pdf->Image(ROOTDIR . '/assets/img/yoursignature.png', 15, 25, 75); // the name/signature of your CEO must be stored on a png image that you have to create. When you have this file, replace /assets/img/yoursignature.png with /path/to/your/image.png. You'll also need to change coordinates to show display the signature in the right place on invoice
}

 

Edited by Kian
Link to comment
Share on other sites

<?php

# Logo
$logoFilename = 'placeholder.png';
if (file_exists(ROOTDIR . '/assets/img/logo.png')) {
    $logoFilename = 'logo.png';
} elseif (file_exists(ROOTDIR . '/assets/img/logo.jpg')) {
    $logoFilename = 'logo.jpg';
}
$pdf->Image(ROOTDIR . '/assets/img/' . $logoFilename, 15, 25, 75);

if ($paymentmethod == 'banktransfer') {
	$pdf->Image(ROOTDIR . '/assets/img/imza.png', 15, 25, 75);
}

Image path is correct.

Link to comment
Share on other sites

23 hours ago, Tengri said:

Image path is correct.

your problem is partially caused by ignoring one important bit of advice that Kian gave you... 🙂

On 14/08/2019 at 14:02, Kian said:

You'll also need to change coordinates to show display the signature in the right place on invoice

as things stand, you're displaying your company logo and signature images in exactly the same place...

0SV6fI3.png

with these pdfs, you have to think in terms of print, not web - so they are relative positions, based in mm, for x location (across), y location (down) and width (of image)... so your logo is 15mm across (from left), 25mm down (from top) and 75mm in width.

if you were to change the signature location to 15,50,75, it should be below the logo (you might have to play with the 50 value depending on your logo size and the 75 value depending on the width of this signature.

T2mKUUS.png

if ($paymentmodule == 'banktransfer') {
	$pdf->Image(ROOTDIR . '/assets/img/imza.png', 15, 50, 75);
}

note that in my code i'm using $paymentmodule and not $paymentmethod - $paymentmethod uses the display name of your gateway for the gateway settings, it's probably "Bank Transfer" unless you've changed it - but for BT, $paymentmodule will be equal to "banktransfer".

i'd also suggest adding that status must be paid to that IF statement as I don't see the point of adding the signature to an unpaid invoice (unless i'm missing the point of adding this signature!).

Link to comment
Share on other sites

On 8/15/2019 at 8:39 PM, brian! said:

your problem is partially caused by ignoring one important bit of advice that Kian gave you... 🙂 

as things stand, you're displaying your company logo and signature images in exactly the same place... 

0SV6fI3.png

with these pdfs, you have to think in terms of print, not web - so they are relative positions, based in mm, for x location (across), y location (down) and width (of image)... so your logo is 15mm across (from left), 25mm down (from top) and 75mm in width.

if you were to change the signature location to 15,50,75, it should be below the logo (you might have to play with the 50 value depending on your logo size and the 75 value depending on the width of this signature. 

T2mKUUS.png


if ($paymentmodule == 'banktransfer') {
	$pdf->Image(ROOTDIR . '/assets/img/imza.png', 15, 50, 75);
}

note that in my code i'm using $paymentmodule and not $paymentmethod - $paymentmethod uses the display name of your gateway for the gateway settings, it's probably "Bank Transfer" unless you've changed it - but for BT, $paymentmodule will be equal to "banktransfer".

i'd also suggest adding that status must be paid to that IF statement as I don't see the point of adding the signature to an unpaid invoice (unless i'm missing the point of adding this signature!). 

Oops!

Something went wrong and we couldn't process your request.

Please go back to the previous page and try again.

🙂

Link to comment
Share on other sites

Before:
 

<?php

# Logo
$logoFilename = 'placeholder.png';
if (file_exists(ROOTDIR . '/assets/img/logo.png')) {
    $logoFilename = 'logo.png';
} elseif (file_exists(ROOTDIR . '/assets/img/logo.jpg')) {
    $logoFilename = 'logo.jpg';
}
$pdf->Image(ROOTDIR . '/assets/img/' . $logoFilename, 15, 25, 75);

After:

<?php

# Logo
$logoFilename = 'placeholder.png';
if (file_exists(ROOTDIR . '/assets/img/logo.png')) {
    $logoFilename = 'logo.png';
} elseif (file_exists(ROOTDIR . '/assets/img/logo.jpg')) {
    $logoFilename = 'logo.jpg';
}
$pdf->Image(ROOTDIR . '/assets/img/' . $logoFilename, 15, 25, 75);

if ($paymentmethod == 'banktransfer') {
	$pdf->Image(ROOTDIR . '/assets/img/imza.png', 15, 25, 75);
}

 

Link to comment
Share on other sites

Yes, image is exist.

ParseError: syntax error, unexpected '$pdf' (T_VARIABLE) in /home/**/templates/**/invoicepdf.tpl:19
Stack trace:
#0 /home/**/vendor/whmcs/whmcs-foundation/lib/Invoice.php(0): WHMCS\Invoice->pdfAddPage('invoicepdf.tpl', Array)
#1 /home/**/includes/invoicefunctions.php(0): WHMCS\Invoice->pdfInvoicePage(1278)
#2 /home/**/dl.php(0): pdfInvoice(1278)
#3 {main}

 

Link to comment
Share on other sites

3 hours ago, Tengri said:

It's work now. But, image go upper of file. How I know, for change it I must change "15, 25, 75" right?

yeah, remembering what I said before about x,y & the width of the signature... you might find it easier to print out an invoice on paper, get a ruler and work out where you want the signature to go in your design... and then measure that location in mm.

Edited by brian!
Link to comment
Share on other sites

  • WHMCS Technical Analyst
9 minutes ago, Tengri said:

Thank you!

It's work now. But, image go upper of file. How I know, for change it I must change "15, 25, 75" right?

That is correct. You can play around with these numbers to place the image where you need. 

Link to comment
Share on other sites

  • 2 weeks later...

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.

×
×
  • 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