Jump to content
Sign in to follow this  
Hank Cohen

Can I print an order number on an invoice?

Recommended Posts

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

Share this post


Link to post
Share on other sites

OK I've done more reading in the community and find that this is a fairly common request that has been dismissed by the developers for over 10 years so I guess it ain't gonna get fixed.

Perhaps someone could suggest an alternative.  Going back to first principles I will state my requirements from a user interface point of view.

I have a product line with multiple products and my customer may want to buy multiple instances at the same or different times.

Let's keep it simple.  Customer A orders a Silver Widget and pays with her credit card.  Thank you I say, I have your order and I give him the order number by email.

Customer loves the Silver Widget so she orders another, again paying with the same credit card.  Thank very much, here's your new order number.

Meanwhile the customer has received two credit card payment confirmations and two invoices.  Both for one silver widget but she has absolutely no way of knowing which invoice is for which widget.

What's more, there is no way to differentiate between these two products in the WHMCS Client Area. I will see two identical rows "Silver Widget"

Let's put it into programmer speak, The product name Silver Widget is a Class, the Alice and Bob Widgets are instances of the class.  What I need is an instance identifier that I can use with my customer to track the things they have purchased.  Obviously I was not the first that assumed that this was the $order_number.

Any suggestions would be appreciated.

Share this post


Link to post
Share on other sites

Hi Hank,

On 25/03/2021 at 05:57, Hank Cohen said:

Forgive me for a newbie but I have been reading documentation and this community community all day without an answer.

you might need to get out more! 😎

On 25/03/2021 at 05:57, Hank Cohen said:

I want to print the order number as reported in the customer order confirmation email on the customer's invoice and the invoice email.

the simplest way, although untested, might be an action hook that applies a custom invoice number to the invoice - which when applicable includes the order number (bearing in mind that not all invoices will be related to an order e.g renewals).

the hook would have to check to see if there is an order existing in the database for the current invoice, and if so, update the invoices table to add the custom invoice number - this custom invoice number should be used on the client area, invoices and emails... whether that causes layout/design issues might depend on your theme... by default, the hook would only be applied to new invoices/orders, and wouldn't be retrospective.

if that happens, then you might need to look at manually editing the invoice PDF template and then addressing the issues elsewhere with other hooks.

On 25/03/2021 at 05:57, Hank Cohen said:

Seems a natural enough thing to want but the order_number seems not to exist in the context of invoices.  Why?

possibly as they're stored in separate tables - off-hand, I can't recall a lot of posts asking for order numbers to be shown on invoices...

On 25/03/2021 at 05:57, Hank Cohen said:

Is this a bug or a feature?

by WHMCS' definition, neither - it doesn't do it out of the box, so it's not a feature; and the fact it hasn't been designed to do this, and it isn't, means they won't consider it a bug - it would only be a bug if they intend to have the order number shown, but for some reason, it wasn't being added... or the opposite, they didn't intend to add it, but something was adding it.... long story short, it's not a bug or feature - welcome to using WHMCS! 🙄

On 25/03/2021 at 06:43, Hank Cohen said:

OK I've done more reading in the community and find that this is a fairly common request that has been dismissed by the developers for over 10 years so I guess it ain't gonna get fixed.

https://requests.whmcs.com/topic/add-an-indication-to-an-invoice-created-by-an-order-with-the-relevant-order-number

that request only got two votes - so it's unlikely WHMCS are going to do anything about it (though i've seen requests completed with 1 vote, and requests with three figures not - either way, they take years to get completed and I assume you want a shorter time-frame than the usual WHMCS development pace! 🐌

On 25/03/2021 at 06:43, Hank Cohen said:

Any suggestions would be appreciated.

with a modified invoice number, then the invoice would show the Order No in the admin area...

iFwQjLH.png

... it would be shown on the PDF invoice...

BS8DJYp.png

and in the client area...

lznRGTV.png

and on the invoice email...

ouKHVBQ.png

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 Nelson Neoh
      Hi there.
      After a long search in Google and this community, I didn't really able to find a clue on how to handle this, if there is a product which upgrade will incurs a full charge, rather than default prorated charge in WHMCS.  Do you guys has any hints or workaround?
      Here's the full list of issues I am experiencing now, hope will get any help from you here.  Thanks in advance.
      1. What's the proper procedures to take, if there is a product/service renewal or upgrade will incurs a full charge rather than prorated according to remaining days?
      2. When a product/service renewed (recurring auto CC charged or invoice paid), which hook or function in Addons/Provisions can use to trigger follow up actions?  Like post an API request to principle for such renewal action.
      3. When a Renewal button being click, either on Admin/Client Panel, it will triggers invoice and charge directly on client deposited funds if sufficient fund available.  Which localAPI should I call?
      4. I noticed if the Product/Service being created with recurring terms, for example monthly or annually, it will automatically triggered an invoice by WHMCS cron.  Wish to know if there is sufficient fund in client account, will the cron direct credited its balance and send a paid invoice?  Which hook should I use if the invoice send is a paid invoice?
      Best Regards,
      Nelson
    • By Cartitarul
      Hi, i live in Romania and in our country is mandatory to have the total of the invoice in the local currency also for example if the total is 5 Euro, to display under the currency in RON also.
      Plz help me configure this invoice so i can start my buissnes.
       
    • 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 sokalsondha
      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

      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

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