{"id":8662,"date":"2024-07-02T06:23:50","date_gmt":"2024-07-02T06:23:50","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=8662"},"modified":"2024-08-16T09:54:16","modified_gmt":"2024-08-16T09:54:16","slug":"easily-modify-invoice-total-calculation-in-vtiger-crm-guide","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/easily-modify-invoice-total-calculation-in-vtiger-crm-guide\/","title":{"rendered":"Easily Modify Invoice Total Calculation in Vtiger CRM | Guide"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 1,338<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p class=\"wp-block-paragraph\">To modify invoice total calculation in Vtiger CRM, you&#8217;ll typically follow these steps, which involve editing the core files of the Vtiger system. This task requires familiarity with PHP and possibly some knowledge of how Vtiger&#8217;s module system works.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s a step-by-step guide:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step-by-Step Guide<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Backup Your System:<\/strong><br>Before making any changes, ensure you back up your Vtiger CRM files and database.<\/li>\n\n\n\n<li><strong>Access Vtiger Files:<\/strong><br>Connect to your server using FTP, SFTP, or a file manager provided by your hosting provider. Navigate to the directory where Vtiger is installed.<\/li>\n\n\n\n<li><strong>Locate the Invoice Module:<\/strong><br>The files for the Invoice module are typically found in the following directory:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\/modules\/Invoice\/<\/mark><\/code><\/code><\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li><strong>Identify the File for Calculations:<\/strong><br>Vtiger usually handles the invoice calculations in the <code>Inventory<\/code> files within the module. Look for files named <code>Inventory.php<\/code> or similar. This file is responsible for the logic related to invoices, quotes, and sales orders. The specific file paths to check might include:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\/modules\/Invoice\/models\/Record.php\n   \/modules\/Invoice\/models\/Inventory.php<\/mark><\/code><\/code><\/pre>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li><strong>Edit the Calculation Logic:<\/strong><br>Open the identified file(s) and look for functions related to the calculation of the invoice total. Common functions to look for include:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>getTotal()<\/code><\/li>\n\n\n\n<li><code>calculateTotal()<\/code><\/li>\n\n\n\n<li><code>calculateGrandTotal()<\/code> Here\u2019s a simplified example of what you might find:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>   <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">public function getTotal() {\n       $subTotal = $this-&gt;getSubTotal();\n       $tax = $this-&gt;getTax();\n       $discount = $this-&gt;getDiscount();\n       return $subTotal + $tax - $discount;\n   }<\/mark><\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Modify this function to fit your custom calculation requirements. For example, if you want to add an extra fee:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">public function getTotal() {\n       $subTotal = $this-&gt;getSubTotal();\n       $tax = $this-&gt;getTax();\n       $discount = $this-&gt;getDiscount();\n       $extraFee = 50; \/\/ Custom fee\n       return $subTotal + $tax - $discount + $extraFee;\n   }<\/mark><\/code><\/code><\/pre>\n\n\n\n<ol start=\"6\" class=\"wp-block-list\">\n<li><strong>Test Your Changes:<\/strong><br>Save the file and test your changes by creating or editing an invoice in Vtiger CRM. Ensure that the total calculation reflects your modifications correctly.<\/li>\n\n\n\n<li><strong>Clear Cache:<\/strong><br>Vtiger CRM might cache some data. Clear your cache to ensure that your changes are effective. This can typically be done through the Vtiger admin interface or by manually deleting cache files in the <code>cache<\/code> directory.<\/li>\n\n\n\n<li><strong>Check for Updates:<\/strong><br>Be aware that updates to Vtiger CRM might overwrite your customizations. Document your changes thoroughly and be prepared to reapply them after any system updates.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Important Considerations<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Customization vs. Extension:<\/strong><br>Directly editing core files is not recommended because it can make upgrades difficult and might break the system. Consider creating an extension or a custom module to handle these changes if Vtiger\u2019s architecture supports it.<\/li>\n\n\n\n<li><strong>Testing Environment:<\/strong><br>Always test your changes in a development environment before applying them to your live system to avoid disruptions.<\/li>\n\n\n\n<li><strong>Community and Documentation:<\/strong><br>Refer to the Vtiger Developer Guide and community forums for additional guidance and best practices.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">By following these steps, you should be able to modify the invoice total calculation in Vtiger CRM to suit your specific business needs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To easily modify invoice total calculation in the case of <a href=\"https:\/\/www.infinitivehost.com\/managed-vtiger-solutions\"><strong><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color has-black-color\">best Vtiger hosting solutions<\/mark><\/strong><\/a>, then you will have to normally track all the above-mentioned steps, which consist of upgrading the important records of the Vtiger CRM system. This activity needs proper expertise in PHP and perhaps all some crucial knowledge about how the module system of Vtiger works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1,338 Views To modify invoice total calculation in Vtiger CRM, you&#8217;ll typically follow these steps, which involve editing the core files of the Vtiger system. This task requires familiarity with PHP and possibly some knowledge of how Vtiger&#8217;s module system works. Here\u2019s a step-by-step guide: Step-by-Step Guide Modify this function to fit your custom calculation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[204],"tags":[83,167,87,162],"class_list":["post-8662","post","type-post","status-publish","format-standard","hentry","category-vtiger-solutions","tag-cpanel","tag-panel","tag-web-hosting","tag-whm"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=8662"}],"version-history":[{"count":2,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8662\/revisions"}],"predecessor-version":[{"id":8850,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8662\/revisions\/8850"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=8662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=8662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=8662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}