nchatzidakis Posted May 11, 2014 Share Posted May 11, 2014 Hello, is there a way to add a custom field to the invoices? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted May 11, 2014 Share Posted May 11, 2014 is there a way to add a custom field to the invoices? do you mean that you need to display custom field values into Invoices? 0 Quote Link to comment Share on other sites More sharing options...
nchatzidakis Posted May 11, 2014 Author Share Posted May 11, 2014 Yes, I would like to add an extra field in the invoice section in the admin panel and show it in the invoice pdf. The value will be different in every invoice. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 11, 2014 Share Posted May 11, 2014 if you add a client custom field, you will be able to show it on the invoice... http://docs.whmcs.com/PDF_Invoice_Customisation#Displaying_Custom_Fields As of version 4.5 custom fields can be displayed on the printable and PDF invoices by ticking the Setup > Custom Client Fields > Show on Invoice option. the code to show them is already in the invoicepdf.tpl templates - they appear below the clients address... if ($customfields) { $pdf->Ln(); foreach ($customfields AS $customfield) { $pdf->Cell(0,4,$customfield['fieldname'].': '.$customfield['value'],0,1,'L'); } } 0 Quote Link to comment Share on other sites More sharing options...
nchatzidakis Posted May 11, 2014 Author Share Posted May 11, 2014 Thank you for your answer. The problem is that this value will not be the same in all invoices. I need to insert a specific value in each invoice. - - - Updated - - - Maybe I did not explain it clear in my last post. I need to insert in every invoice a value / variable like the invoice id, which can not be the same for all the invoices. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 11, 2014 Share Posted May 11, 2014 (edited) the value shown in the invoice will be whatever you have entered in the client's profile for that particular field - it will not show the same value, it will take the value from the field in the profile. perhaps if you could tell us what the value will be, we might understand better. Edited May 12, 2014 by brian! 0 Quote Link to comment Share on other sites More sharing options...
nchatzidakis Posted May 12, 2014 Author Share Posted May 12, 2014 In Greece, when an invoice's subtotal is bigger than 300 euros, the client has to prepay a tax. The prepaid tax has to be printed in the invoice, f.e. if the amount is 500 euros I print in the invoice "Prepaid tax 100 euros". In the invoicepdf.tpl I have added a script that does the above (when the subtotal is bigger than 300 euros it counts and prints the tax). In some cases this is not required. So, I would like to add a select box (Auto or Default / Yes / No) in every invoice. When the select box is set to auto, the script in invoicepdf.tpl will count the prepaid tax. If it is set to No it will not print anything. If it is set to Yes it will count the tax for every amount. The problem is that in case I add a profile custom field, it will have the same value for all the client's invoices, and I need to change this value in each invoice. For example, in the same client, in one invoice the select box value can be Yes and in another can be No. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 12, 2014 Share Posted May 12, 2014 The problem is that in case I add a profile custom field, it will have the same value for all the client's invoices, and I need to change this value in each invoice. For example, in the same client, in one invoice the select box value can be Yes and in another can be No. ok, I can now see why this is difficult! unfortunately, you can't tweak the admin side as you can with the client side because of the encrypted files - so you may need to get someone to write an addon module to add the option you describe. although such a button/box/dropdown would only affect invoices that you create - what happens when a customer orders online and receives their invoice automatically? when you say, "In some cases this is not required" - is this based on whether a particular product is in the invoice... if product X has been ordered and subtotal > 300 then print prepaid tax message ? if there is some rule as to which invoices need this and which don't, then you may be able to modify your script to check and display the prepaid tax message only when it's appropriate... perhaps if custom clients fields are too general, you could use product custom fields instead. however, if you are manually preparing all your invoices, perhaps a simpler solution would be to "Notes" tab in invoices... this is just a text box where you can some additional text to your invoice - perhaps in your case, you can use it to add "Prepaid tax x euros" to those invoices that this applies to ? by default, Notes are shown towards the bottom of the invoice pdf - but if you need to, it should be simple to move them to somewhere else on the invoice. 0 Quote Link to comment Share on other sites More sharing options...
nchatzidakis Posted May 12, 2014 Author Share Posted May 12, 2014 I preferred not to use Notes but as I see there is no other reliable way. Thank you for your answers! 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.