milamber Posted June 4, 2009 Share Posted June 4, 2009 Hello, I have started using WHMCS in Poland. I've got EU VAT. However I run into some important problem. I have changed in WHMCS to start invoices sequentially in templates. I can see that now invoices are created when payement is done which is good BUT the invoice date is the same date as proforma had which couses problems with accounting like: Inovice #100 - date 01/06/2009 Invoice #101 - date 25/05/2009 and as you can see invoice #101 has earlier date than invoice #100. I think that invoice should has creation date along with payment to avoide such problems. How did you manage to solve these problems? Thank you in advance! 0 Quote Link to comment Share on other sites More sharing options...
minadreapta Posted June 4, 2009 Share Posted June 4, 2009 (edited) i am from within the EU too, this is not a question for book keepers but a technical one imho: use action hooks to set the invoice date to paid date as soon as the invoice is marked as paid. function actionhook_InvoicePaid($vars) { update_query("tblinvoices",array("date"=>"now()"),array("id"=>$vars["InvoiceID"])); # This function runs when an invoice is fully paid and therefore the services renewed # $vars["InvoiceID"] } test before putting it in production and of course backup your DB first. Edited June 4, 2009 by minadreapta 0 Quote Link to comment Share on other sites More sharing options...
milamber Posted June 4, 2009 Author Share Posted June 4, 2009 Hello minadreapta, Thank you very much!! Could you give me the brief instruction how to install this action hook? I have never tried it before. 0 Quote Link to comment Share on other sites More sharing options...
milamber Posted June 4, 2009 Author Share Posted June 4, 2009 Ok I found it! Now testing... 0 Quote Link to comment Share on other sites More sharing options...
milamber Posted June 4, 2009 Author Share Posted June 4, 2009 Hello, Still problem. I have created test account make new invoice set as like it was created yesterday and then add payment. The invoice was created still with old date instead of today date. Invoice Date: 03/06/2009 Due Date: 03/06/2009 0 Quote Link to comment Share on other sites More sharing options...
minadreapta Posted June 4, 2009 Share Posted June 4, 2009 you're doing something wrong, i don't know what... try to empty the templates_c directory, maybe it helps. i am using WHMCS v3.6.2 yet, maybe the action hooks changed in the mean time in 4.0 version... take a better look at the action hook and adapt it to your needs... this works for me 0 Quote Link to comment Share on other sites More sharing options...
milamber Posted June 4, 2009 Author Share Posted June 4, 2009 Hello, Ok I found the problem. In 4.0.1 all hooks are in /includes/hooks there must be a file created. I solved it this way <?php function update_payment_date($invoiceid) { update_query("tblinvoices",array("date"=>"now()"),array("id"=>$invoiceid)); } add_hook("InvoicePaid",1,"update_payment_date",""); ?> It is working However I found a little annoying thing. The "due date" is now back in history I think that I should not update it this way so the best option would be to edit template and in proforma show due date and in normal invoice show payment date as due date. What do you think ? 0 Quote Link to comment Share on other sites More sharing options...
milamber Posted June 4, 2009 Author Share Posted June 4, 2009 I think I'll do something like this in invoice templates: if (invoice is paid) { not show Due Date } I mean that "Due Date" is not needed when invoice is Paid. 0 Quote Link to comment Share on other sites More sharing options...
drtduarte Posted June 4, 2009 Share Posted June 4, 2009 (edited) hello milamber, This is also a problem in portugal... but this issue was already discussed on another post http://forum.whmcs.com/showthread.php?t=10517&highlight=proforma+invoice+date Any way does anybody need to have the invoice with the proforma invoice date? Why not make the payment_date=invoice_date as default, after all isn't the real invoice created when the payment is made? Regards, David Duarte Edited June 4, 2009 by drtduarte 0 Quote Link to comment Share on other sites More sharing options...
milamber Posted June 5, 2009 Author Share Posted June 5, 2009 THank you drtduarte. In fact I asked Mat yesterday why not make this by default:?: I'm waiting for answer. Anyway thanks to you (in thread you sent link to) I have found out that clients get wrong pdf before date is changed. I stopped sending pdf invoices to clients. 0 Quote Link to comment Share on other sites More sharing options...
Austdata Posted June 5, 2009 Share Posted June 5, 2009 Hello, Still problem. I have created test account make new invoice set as like it was created yesterday and then add payment. The invoice was created still with old date instead of today date. Invoice Date: 03/06/2009 Due Date: 03/06/2009 It shouldn't change the date, that doesn't make sense. The invoice date hasn't changed. For your original question, have a look in invoicepdf.tpl and you will see a commented out group of lines. They should be uncommented. I don't know if the previous line should be commented out or not. Usual programming disclaimers, etc. apply. Cheers, Mike 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.