Jump to content
Sign in to follow this  
sokalsondha

tax line remove from pdf invoice

Recommended Posts

hello everyone.

hope all are doing fine. can some one help me with correct my tpl file for the pdf invoice.

basically what i am looking for is....

my product price is 55 euros which is included TAX . my tax rate is 21%

so my product real price is 45.45 euros and 9.55 is TAX

at the moment its showing like this

image.png.21f284c424db52bf2c7ef1909bd72e54.png

which is accurate i know. but i want to hide that line 21.00% VAT from this pdf

all i want it too looks like

image.png.d2e7509ea2519d4047d9cc39c66c6979.png

i dont want to remove the functionality just i want to hide the TAX thing from the invoicepdf

here is my 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->Ln(5);
$pdf->SetFont($pdfFont, 'B', 15);
$pdf->SetFillColor(255);
$pdf->SetFont($pdfFont, '', 16);
$pdf->Cell(100, 6, "My Bill Summary", 0, 1, 'L', '1');
$pdf->Image(ROOTDIR . '/assets/img/' . $logoFilename, 120, 25, 75);
# Company Details
$pdf->SetXY(15, 70);
$pdf->SetFont($pdfFont, '', 13);
foreach ($companyaddress as $addressLine) {
    $pdf->Cell(180, 4, trim($addressLine), 0, 1, 'R');
    $pdf->SetFont($pdfFont, '', 9);
}
if ($taxCode) {
    $pdf->Cell(180, 4, $taxIdLabel . ': ' . trim($taxCode), 0, 1, 'R');
}
$pdf->Ln(5);

# Clients Details
$pdf->SetXY(15, 70);
$pdf->SetFont($pdfFont, 'B', 10);
$pdf->SetFont($pdfFont, 'B', 14);
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->SetFont($pdfFont, '', 12);
$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["postcode"], 0, 1, 'L');
$pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'L');
if (array_key_exists('tax_id', $clientsdetails) && $clientsdetails['tax_id']) {
    $pdf->Cell(0, 4, $taxIdLabel . ': ' . $clientsdetails['tax_id'], 0, 1, 'L');
}
$pdf->Ln(5);
$pdf->Ln(5);
$pdf->Ln(5);
# Header Bar

/**
 * Invoice header
 *
 * You can optionally define a header/footer in a way that is repeated across page breaks.
 * For more information, see http://docs.whmcs.com/PDF_Invoice#Header.2FFooter
 */

$pdf->SetFont($pdfFont, 'B', 15);
$pdf->SetFillColor(239);
$pdf->SetFont($pdfFont, '', 12);
if ($customfields) {
    foreach ($customfields as $customfield) {
        $pdf->Cell(75, 6, $customfield['fieldname'] . '        ' . $customfield['value'], 0, 1, 'L', '1');
    }
}
$pdf->Cell(75, 6, "Invoice Number " . '        ' . $invoiceid, 0, 1, 'L', '1');
$pdf->Cell(75, 6, "Bill Issue Date" . '           ' . $datecreated, 0, 1, 'L', '1');
$pdf->Cell(75, 6, "Payment Method" . '       ' . $paymentmethod, 0, 1, 'L', '1');
$pdf->Ln(10);
                                     
$startpage = $pdf->GetPage();

# Invoice Items
$tblhtml = '<table width="85%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0">
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;text-align:center;">
        <td width="80%">' . Lang::trans('invoicesdescription') . '</td>
        <td width="20%">' . Lang::trans('quotelinetotal') . '</td>
    </tr>';
foreach ($invoiceitems as $item) {
    $tblhtml .= '
    <tr bgcolor="#fff">
        <td align="left">' . nl2br($item['description']) . '<br /></td>
        <td align="center">' . $item['amount'] . '</td>
    </tr>';
}
$tblhtml .= '
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
        <td align="right">' . Lang::trans('invoicessubtotal') . '</td>
        <td align="center">' . $subtotal . '</td>
    </tr>';
    
if ($taxname) {
    $tblhtml .= '
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
        <td align="right">' . $taxrate . '% ' . $taxname . '</td>
        <td align="center">' . $tax . '</td>
    </tr>';
}
if ($taxname2) {
    $tblhtml .= '
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
        <td align="right">' . $taxrate2 . '% ' . $taxname2 . '</td>
        <td align="center">' . $tax2 . '</td>
    </tr>';
}
    
$tblhtml .= '
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
        <td align="right">' . Lang::trans('invoicescredit') . '</td>
        <td align="center">' . $credit . '</td>
    </tr>
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;font-size:16px;">
        <td align="right">' . "Total Amount Due" . '</td>
        <td align="center">' . $total . '</td>
    </tr>
</table>';

$pdf->writeHTML($tblhtml, true, false, false, false, '');

$pdf->Ln(5);

$html = "<h2 style=\"color:red;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please pay by ${duedate} </h2>";
$pdf->writeHTML($html, true, false, false, false, '');
$pdf->Ln(10);
$pdf->SetFont($pdfFont, 'B', 15);
$pdf->SetFillColor(239);
$pdf->SetFont($pdfFont, '', 10);
$pdf->Cell(125, 6, "Failure to pay your account in full may result in loss of service.", 0, 1, 'L', '1');
$pdf->Cell(125, 6, "Reactivation of your service could take up to 7 days and will incur a fee. ", 0, 1, 'L', '1');
$pdf->Ln(10);

# Notes
if ($notes) {
    $pdf->Ln(5);
    $pdf->SetFont($pdfFont, '', 8);
    $pdf->MultiCell(170, 5, Lang::trans('invoicesnotes') . ': ' . $notes);
}

/**
 * Invoice footer
 */

 

 

can someone please help me in this issue.. i really need to solve it

 

Thanks a million in advnace

Share this post


Link to post
Share on other sites
5 hours ago, sokalsondha said:

can someone please help me in this issue.. i really need to solve it

it should just be removing the {if $taxname1} and {if $taxname2} blocks of code....

if ($taxname) {
    $tblhtml .= '
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
        <td align="right">' . $taxrate . '% ' . $taxname . '</td>
        <td align="center">' . $tax . '</td>
    </tr>';
}
if ($taxname2) {
    $tblhtml .= '
    <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
        <td align="right">' . $taxrate2 . '% ' . $taxname2 . '</td>
        <td align="center">' . $tax2 . '</td>
    </tr>';
}

... and then working out if you want $subtotal to always equal $total - if so, then you change...

<td align="center">' . $subtotal . '</td>

to..

<td align="center">' . $total . '</td>

Share this post


Link to post
Share on other sites

hello Brian

thanks again for your kind help

i have done the changes.

but now i have this output

image.png.02ae3638f122a3a6b80e652801cd14d3.png

i need to display Subtotal without the Credit balance of the customer. this customer has 10 euros credit.

so i need to see the subtotal 110 euros then credit will be minus and total due is 100 euros

any idea what can i do?

 

thanks a billion

Share this post


Link to post
Share on other sites
2 hours ago, sokalsondha said:

i need to display Subtotal without the Credit balance of the customer. this customer has 10 euros credit.

if you really want to do that, then add the code below....

$subtotal = formatCurrency(($subtotal->toNumeric() - $credit->toNumeric()), $currencyData['id']);

on a blank line before you output $subtotal

Share this post


Link to post
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.

Sign in to follow this  

  • Similar Content

    • By Chaila9
      Hello I am using PHP 7.4 with WHMCS Version: 8.1.3. I am trying to download my invoices using the Batch PDF Invoice but I am getting this strange error - https://prnt.sc/124t370 when I try to generate the invoices. I visited my console to see what's wrong and it gives me this - https://prnt.sc/124t5b5
      Can anyone please tell me what's wrong?
    • By vpshove
      Hello,
      It's almost half year, our customers complain on Paid Invoice getting terminated (Whether it is on time/due/suspended).
      It is not sure what causes it, the customer is increasing leading to increasing complains on service terminated (Which cannot be recovered) although that it has been paid.
      For example of Use Case: For Subscription A, due is on today and knowing termination date is 2 days after. I managed to paid it before termination date. However, the system still terminate my service on specified termination date. End of Use Case  
      Known changes made last year:
      - Installed LiteSpeed Web Server.
      - Upgraded to php73 (from ea-php56 to ea-php73) of Apache + (Cloudlinux Uninstalled)
      - Updated CronJob accordingly for php73
      [Note: I've also removed all custom hooks made to see if it is the causes, it doesn't seems like it]
      [Current version of WHMCS: 8.1.3 (Manual Update)]
      Modules Extension used:
      1. ASPnix License Manager
      2. Braintree Advacne Fraud Helper
      3. Braintree Transaction Lookup
      4. EunaRede Core (GA Ecommerce Tracking)
       
      Thank you. I try my best to give more details if needed.
    • By Hank Cohen
      Forgive me for a newbie but I have been reading documentation and this community community all day without an answer.
      I want to print the order number as reported in the customer order confirmation email on the customer's invoice and the invoice email.
      Seems a natural enough thing to want but the order_number seems not to exist in the context of invoices.  Why?
      Is this a bug or a feature?
       
      Thanks,
      Hank Cohen
    • By code47
      Hello,
      I am creating a module for invoice to display data from database. I want to know how to add that fetch value from module to invoice using hooks.
    • By sokalsondha
      Hello everyone.
      greetings from me again. i need to print out monthly sales report to submit tax office and the way whmcs sales tax liability report print its not possible to submit.
      there is no company name showing and also we dont work with clients name so i dont need to show the client name in the report.
      also after print out the report it showing in the top the whole whmcs admin link and whmcs printer friendly report.
      is there any chance i can customize the pdf report? like the way we customize the pdf invoice
      Hope someone can help me on this issue
       
      Thanks again
  • 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