Jump to content

Moving Invoiced To: to the right side of pdf invoice


Hosting NSB

Recommended Posts

Good Afternoon Everyone, I am new to WHMCS and am loving this system, I have a simple pdf change I would like to initiated, I have gone through the documentation but the php is over my head

 

My billing department has specially made envelopes with the clear plastic on the right side of the paper, I need to switch the Invoiced To: section of the pdf invoice to the right side, as I am having to physically print some invoices and mail them.

 

Can anyone help with this, I tried adding a table around it to push it to the right but it completely broke it. I have restored but I just need a simple way to tell the data to be right aligned instead of left

 

Thank you in advance for anyone that can help!

Link to comment
Share on other sites

open /templates/{Your-Template}/invoicepdf.tpl file for editing,

 

between (approximately) line #69 and #94 change the following code (taken from v7.1.2):

 

# Clients Details
$addressypos = $pdf->GetY();
$pdf->SetFont($pdfFont, 'B', 10);
$pdf->Cell(0, 4, Lang::trans('invoicesinvoicedto'), 0, 1);
$pdf->SetFont($pdfFont, '', 9);
if ($clientsdetails["companyname"]) {
   $pdf->Cell(0, 4, $clientsdetails["companyname"], 0, 1, 'L');
   $pdf->Cell(0, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'L');
} else {
   $pdf->Cell(0, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'L');
}
$pdf->Cell(0, 4, $clientsdetails["address1"], 0, 1, 'L');
if ($clientsdetails["address2"]) {
   $pdf->Cell(0, 4, $clientsdetails["address2"], 0, 1, 'L');
}
$pdf->Cell(0, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'L');
$pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'L');
if ($customfields) {
   $pdf->Ln();
   foreach ($customfields as $customfield) {
       $pdf->Cell(0, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'L');
   }
}
$pdf->Ln(10);

 

with this:

 

# Clients Details
$addressypos = $pdf->GetY();
$pdf->SetFont($pdfFont, 'B', 10);
$pdf->Cell(0, 4, Lang::trans('invoicesinvoicedto'), 0, 1, 'R');
$pdf->SetFont($pdfFont, '', 9);
if ($clientsdetails["companyname"]) {
   $pdf->Cell(0, 4, $clientsdetails["companyname"], 0, 1, 'R');
   $pdf->Cell(0, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'R');
} else {
   $pdf->Cell(0, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'R');
}
$pdf->Cell(0, 4, $clientsdetails["address1"], 0, 1, 'R');
if ($clientsdetails["address2"]) {
   $pdf->Cell(0, 4, $clientsdetails["address2"], 0, 1, 'R');
}
$pdf->Cell(0, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'R');
$pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'R');
if ($customfields) {
   $pdf->Ln();
   foreach ($customfields as $customfield) {
       $pdf->Cell(0, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'R');
   }
}
$pdf->Ln(10);

Link to comment
Share on other sites

open /templates/{Your-Template}/invoicepdf.tpl file for editing,

 

between (approximately) line #69 and #94 change the following code (taken from v7.1.2):

 

# Clients Details
$addressypos = $pdf->GetY();
$pdf->SetFont($pdfFont, 'B', 10);
$pdf->Cell(0, 4, Lang::trans('invoicesinvoicedto'), 0, 1);
$pdf->SetFont($pdfFont, '', 9);
if ($clientsdetails["companyname"]) {
   $pdf->Cell(0, 4, $clientsdetails["companyname"], 0, 1, 'L');
   $pdf->Cell(0, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'L');
} else {
   $pdf->Cell(0, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'L');
}
$pdf->Cell(0, 4, $clientsdetails["address1"], 0, 1, 'L');
if ($clientsdetails["address2"]) {
   $pdf->Cell(0, 4, $clientsdetails["address2"], 0, 1, 'L');
}
$pdf->Cell(0, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'L');
$pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'L');
if ($customfields) {
   $pdf->Ln();
   foreach ($customfields as $customfield) {
       $pdf->Cell(0, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'L');
   }
}
$pdf->Ln(10);

 

with this:

 

# Clients Details
$addressypos = $pdf->GetY();
$pdf->SetFont($pdfFont, 'B', 10);
$pdf->Cell(0, 4, Lang::trans('invoicesinvoicedto'), 0, 1, 'R');
$pdf->SetFont($pdfFont, '', 9);
if ($clientsdetails["companyname"]) {
   $pdf->Cell(0, 4, $clientsdetails["companyname"], 0, 1, 'R');
   $pdf->Cell(0, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'R');
} else {
   $pdf->Cell(0, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'R');
}
$pdf->Cell(0, 4, $clientsdetails["address1"], 0, 1, 'R');
if ($clientsdetails["address2"]) {
   $pdf->Cell(0, 4, $clientsdetails["address2"], 0, 1, 'R');
}
$pdf->Cell(0, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'R');
$pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'R');
if ($customfields) {
   $pdf->Ln();
   foreach ($customfields as $customfield) {
       $pdf->Cell(0, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'R');
   }
}
$pdf->Ln(10);

 

Thank you so much that did the trick!

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