Tengri Posted August 14, 2019 Share Posted August 14, 2019 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! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 14, 2019 Share Posted August 14, 2019 (edited) 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 August 14, 2019 by brian! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted August 14, 2019 Share Posted August 14, 2019 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. 1 Quote Link to comment Share on other sites More sharing options...
Tengri Posted August 14, 2019 Author Share Posted August 14, 2019 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. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted August 14, 2019 Share Posted August 14, 2019 (edited) 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 August 14, 2019 by Kian 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted August 14, 2019 Author Share Posted August 14, 2019 I change URL name of file to my own. System name is "banktransfer" too. I'm sure, because we with brian! help change logo of gateways. 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted August 14, 2019 Author Share Posted August 14, 2019 <?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. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 15, 2019 Share Posted August 15, 2019 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... 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. 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!). 1 Quote Link to comment Share on other sites More sharing options...
Tengri Posted August 22, 2019 Author Share Posted August 22, 2019 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... 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. 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. 🙂 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 22, 2019 Share Posted August 22, 2019 where did you put that line of code in invoicepdf.tpl and you'll have to enable error reporting from general settings for WHMCS to give you more information about what it doesn't like. 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted August 22, 2019 Author Share Posted August 22, 2019 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); } 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 22, 2019 Share Posted August 22, 2019 does the image file exist and what's the error shown when you enable error reporting ? 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted August 22, 2019 Author Share Posted August 22, 2019 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} 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 22, 2019 Share Posted August 22, 2019 in my code, there will be a hidden tab character - remove it and see if that helps... if ($paymentmodule == 'banktransfer') { $pdf->Image(ROOTDIR . '/assets/img/imza.png', 15, 150, 75); } 1 Quote Link to comment Share on other sites More sharing options...
Tengri Posted August 22, 2019 Author Share Posted August 22, 2019 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? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 22, 2019 Share Posted August 22, 2019 (edited) 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 August 22, 2019 by brian! 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Technical Analyst WHMCS Sachin Posted August 22, 2019 WHMCS Technical Analyst Share Posted August 22, 2019 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. 1 Quote Link to comment Share on other sites More sharing options...
Tengri Posted August 31, 2019 Author Share Posted August 31, 2019 Thank you very much! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.