Jump to content

Adding an item in the middle of an invoice (blank line at certain point in invoice)


ou812

Recommended Posts

I've always hated when I have to add line items in the middle of a WHMCS invoice because I would copy-and-paste everything down one line. It's super annoying and now I must do this with an invoice with 35 items, so I decided to create an account here and ask.

 

How can I easily add a blank line to a WHMCS invoice in the middle of that invoice? Here's an example of what I mean:

 

whmcs-question.png

 

PS: I am versed in SQL so if I have to do this directly via the database in PHPMyAdmin I could.

Link to comment
Share on other sites

whmcs-sql-example.png

 

I looked up the table tblinvoiceitems and saw a duedate field. I was hoping the invoice items might be sorted by this field so I manually edited this date but that didn't work. I think I could simply change the 'id' field to be one before the row I'm trying to add ahead of but I'm sure that won't work because that would conflict with another item 'id'.

Link to comment
Share on other sites

How can I easily add a blank line to a WHMCS invoice in the middle of that invoice?

I suspect with difficulty. :?:

 

if you wanted to add it to the end, that would be simple - but I assume that it's just looping through the tblinvoiceitems ID values for that invoice... and those ID values increase by 1 each time, so there are no available gaps in which you could "insert" a line item.

unless someone has a different idea, I think copy&paste will still be the easiest, if a time-consuming, way.

Link to comment
Share on other sites

You're adding items into an existing invoice, why?

 

I have an invoice that was merged from other invoices, so it's like 25 lines long. I have some initial work we did for client (such as logo design, sem consultation, etc) that happened at the START of the project. Client wants one invoice and the invoice is already in order by date, so it's a must that I include these at the top of the invoice (so the dates are ascending).

 

I can't believe no one else has had a similar issue! Or is everyone just cutting-and-pasting all rows down individually? We need a way to sort items on an invoice like in other systems.

Link to comment
Share on other sites

unsure - are you saying that all of the invoice items are already ordered by date - or that they're not and you want them to be? :?:

 

if the latter, then it might be easier to work on the output of the invoice templates rather than trying to squeeze an entry in using SQL.

Link to comment
Share on other sites

unsure - are you saying that all of the invoice items are already ordered by date - or that they're not and you want them to be?

 

It's exactly like this example. I already have a bunch of line items on my invoice and I want to add an item at a certain point above a particular line. See illustration attached below:

 

whmcs-question.png

Link to comment
Share on other sites

It's exactly like this example. I already have a bunch of line items on my invoice and I want to add an item at a certain point above a particular line. See illustration attached below:

yeah I get that, but i've more or less ruled out being able to add it via SQL to a specific location - my point was to just add it at the end and then make the invoice template(s) sort it by date (if that's what you want to do).

 

if WHMCS can't do this by default (it can't), then you're into the realms of either getting a developer to write a solution for you; finding an existing solution (not sure if one exists); working around it by tweaking the output rather than tweaking the source... or just sticking with the copy&paste method.

 

I suppose you could start a feature request - but that's not a quick fix option and you might be waiting months (or years) for the feature if you take that path. :roll:

Link to comment
Share on other sites

Oh! I see what you mean. Thanks Brian.

 

It would be easy, just would need to modify the SQL to sort by item due date. But aren't all WHMCS files encrypted now? And I remember them saying they don't do any more custom coding.

 

I see the "viewinvoice.php" in the root folder, but it's encrypted by IonCube, so that doesn't help. Can anyone point me to another file that isn't encrypted that I can edit to make the invoice sort by item "due date" field.

Edited by ou812
Link to comment
Share on other sites

it will be invoicepdf.tpl for the PDF Invoice template; and viewinvoice.tpl for the HTML version - both are not encrypted.

 

with the invoicepdf template, you'll be able to use PHP in the template... perhaps you'll be able to manipulate the existing array, but worst case, you can use a SQL query to the db to get the info you need in the format you need and then output it; viewinvoice.tpl might need hooks or Smarty to do the same thing.

Link to comment
Share on other sites

In my opinion the best way is that you add a new button named "Merge by date" next to the standard "Merge" button. When you click "Merge by date" a script automatically removes all the involved items from tblinvoiceitems and create new ones based on them grouped by date. In this way you don't need to sacrifice the standard "Merge" functions.

Link to comment
Share on other sites

It can be simpler than all that even! Just a simple "+" button by the lines on a WHMCS invoice that one can click to add a line above that line on the invoice and it shifts everything else down. Can be done with Javascript even... would be a pretty easy fix to implement for the WHMCS team.

 

How can I point their team to this thread to show interest in a feature like this? Can you guys post here if you'd like to see this added to show support for the idea.

Link to comment
Share on other sites

How can I point their team to this thread to show interest in a feature like this?

as I said previously, via a Feature Request and you could add the thread link in the request..

 

there are lots of things that would be a "pretty easy fix to implement"... but they hardly ever do.

 

for your own sanity, don't allow yourself to imagine that you can post here (WHMCS will tell you to create a request instead of posting here anyway), suggest an idea and WHMCS whip it up quickly - i've been here 3 years and i'm still waiting to see things like that occur.

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