Jump to content

Get invoice due amount on Service suspension email


sufi

Recommended Posts

I am using latest version of WHMCS.

I apply late fee on 10th day from invoice due date, and an automatic service suspension on 11th day. But the problem is, when clients get service suspension email due to "overdue on payment", they see only the recurring amount of the service using this email template tag {$service_recurring_amount}. How can I show them the actual due amount (service recurring amount + late fee - credit [if any]) from the associated invoice?

Because it is very confusing, as clients see recurring amount and make that payment, but still sees there are due on the invoice.

So any guideline here will be very helpful.

 

Thanks.

Link to comment
Share on other sites

take a look at the thread below about doing calculations in the email template...

 

http://forum.whmcs.com/showthread.php?99258-Email-Marketer-send-price-with-VAT-included

 

i've had a quick look at the email template - it looks like you'll have SRA and credit values to work with (or can get them from the existing variables).. you might not have late fee variable, so you may have to code that value (fixed or percentage) in the formula... or write an action hook to create it - but you'll probably be able to do it in the template without needing to do that.

Link to comment
Share on other sites

Thanks. I can certainly use the calculation part to manually add the late fee.

But problem is with the applied credit. There is a variable to get the available credit balance {$client_credit}. If there are multiple unpaid invoices, credit balance automatically applies to the first generated invoice.

It will be great if, by somehow, I can get the due invoice amount associated with the service.

 

take a look at the thread below about doing calculations in the email template...

 

http://forum.whmcs.com/showthread.php?99258-Email-Marketer-send-price-with-VAT-included

 

i've had a quick look at the email template - it looks like you'll have SRA and credit values to work with (or can get them from the existing variables).. you might not have late fee variable, so you may have to code that value (fixed or percentage) in the formula... or write an action hook to create it - but you'll probably be able to do it in the template without needing to do that.

Link to comment
Share on other sites

Thanks. I can certainly use the calculation part to manually add the late fee.

But problem is with the applied credit. There is a variable to get the available credit balance {$client_credit}. If there are multiple unpaid invoices, credit balance automatically applies to the first generated invoice.

It will be great if, by somehow, I can get the due invoice amount associated with the service.

unless you could throw $client_due_invoices_balance into the equation somewhere, you'll probably need to use an action hook to create/obtain variables (merge fields) you can use in the template.

 

that hook would probably need to query tblinvoiceitems to get the values - I don't have any Late Fee invoices in our live or dev sites, so it's difficult for me to test this - but if you look in your tblinvoiceitems database table, that's where they should be (type = "Late Fee").

Link to comment
Share on other sites

Thanks again Brian.

Should I hook to this: http://docs.whmcs.com/Hooks:EmailTplMergeFields ?

I am certainly not much familiar with WHMCS hooks and functions.

Do you have any example of how they work? I can easily grab the value from db. I have looked in to tblinvoiceitems, and it is (type = 'LateFee' ). However, I think tblinvoices is good enough for me, as I can get applied credit as well as total due after calculating all late fees and applied credits.

Link to comment
Share on other sites

I think its more EmailPreSend - http://docs.whmcs.com/Hooks:EmailPreSend

 

EmailTplMergeFields adds the new fields to the merge fields box, but if you can remember what the variable is, then you don't necessarily need this - though you can use both at the same time if you wish.

 

take a look at the thread below...

 

http://forum.whmcs.com/showthread.php?98066-Hooks-and-or-email-merge-fields-for-custom-urls

 

that hook will add new merge fields to the email templates - though you won't want text strings as shown there, you'll need a SQL query to check the invoices table.

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.

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