Display 2 taxes in Quotes and Invoices (GST 5% and PST 7%) on seperate lines?

Once you figure this out it’s fairly straight forward but it took me quite some time to figure it out.

this specific request is heavily dependent on JavaScript.

using this file modules/AOS_Products_Quotes/line_items.js

copy this file into your custom folder

/custom/modules/AOS_Products_Quotes/line_items.js

look in that file for “VAT” and start modifying the javascript file.

What I have done is taken the current tax drop down and duplicated it with a slightly different name “vat_pst” in my case and then do the calculations based on the new dropdowns.

I looked for a php/mysql solution when the answer was to brush up on the JavaScript which from what i’ve seen in the developer videos is the direction that sugar is going in. ie more and more javascript.

Sorry I don’t have a specific answer but hopefully that helps.

I have this to the point were it is doing the calculations.

It is not saving my selections for the custom pst and gst fields…

“:”",“gst_c”:“0.0”,“pst_c”:“0.0”}

although when I capture the post data I see it…

[pst_c] => Array ( [0] => 17.5 )

i get the selection but when it goes through the save process in AOS_Product_Sales it doesn’t save the data.

I am so close with this please help.

From what I can remember you need to make sure that your field follows the same naming conversions.

modules/AOS_Products_Quotes/AOS_Products_Quotes.php

line 44 - $post_data[$key.$field_def[‘name’]][$i];

The post data must start with a key, from what I can remember it will be either product_ or service_ hopefully this helps.

Ian

Thanks to smugford and Ian, I am not a pro in php and/or Java, I can edit, add or change anything but I am not able to find which one we need to add. We are ready to pay if someone know how to do.

Thanks!

I am just figuring out this code myself.

They do have development partners I would email Suite themselves and ask for a developer reference for your country.

I added the custom field to litenitemeidtviewdefs.php after adding the product_pst field to the lineitems quick create view.

7 =>
array (
‘name’ => ‘product_pst_c’,
‘label’ => ‘LBL_PRODUCT_PST’,
),

It is now saving the selection but it is not displaying the selection in the box.

i think I need to copy the vat_hidden code in Line_Items.php

I have talked to a Partner and he tell me we can take shipping taxe for the second taxe we need, I will try it and return to you if working!

I had that thought as well. I decided not to do that because we made need to add a discount eventually.

I got it to work but it would take me a few days to put together a “How To” (which I may do as a learning exercise but not 100% on that)

No matter how you do it most of what you need is in line_items.js

2 Likes

Great, we will wait, I know it is in line_item.js, but I can’t work on it because we have a lot of job and unfortunately don’t have time for now.

Thanks!

Yesterday I have worked some hours on it and I don’t have all information to complete this (I think).

I have done this:

In Studio: add new fields in quote with name tax2_amount_c

In Studio: Quotes / Layouts / Editview and Detailview add the Row for the second taxes

modules/AOS_Products_Quotes/Line_Item.php
add this line
Copied Line 147 and change LBL_TAX2_AMOUNT_C

[color=#ff0000]$groupEnd .= “

”.$mod_strings.": ";[/color]

Not sure If I need to add something else

modules/AOS_Products_Quotes/line_items.js
add this line
Copied Line 174 to 180 and ad a 2 at each vat

[color=#ff0000]var f = x.insertCell(8 );
f.innerHTML = “”;
f.innerHTML += “” + vat_hidden + “”;

if (typeof currencyFields !== ‘undefined’){
currencyFields.push(“product_vat_amt” + prodln);
}[/color]

Copied Line 528 to 832 and change the name to LBL_TAX2_AMOUNT_C

[color=#ff0000]var footer_row4=tablefooter.insertRow(-1);
var footer_cell4 = footer_row4.insertCell(0);
footer_cell4.scope=“row”;
footer_cell4.colSpan=“20”;
footer_cell4.innerHTML=""+SUGAR.language.get(module_sugar_grp1, ‘LBL_TAX2_AMOUNT_C’)+": ";[/color]

Not sure If I need to add something else

It is what I have done for now, If you can help me to complete the work, it will be very helpfull for me and other!!

Thanks!

Anyone can help us? Do we need to switch to other CRM? We are ready to pay if is nessecary.

Thanks!

Hi

Were you able to post a “how to” I’d be interested in that? Spain has the same issue with dealers. VAT 21% + 5,2% R.E. which I need to display separately.

Thanks

Hi Cperrot,
We are already at the same point here, Maybe no one have found the solution? I’m not able to find the complete solution for now because we have a lot of job.

Very sorry!

thanks for your reply. I am amazed that SutieCRM OpenSales cannot be used in Canada at all and that no one is actually taking this problem up as a feature request.

You are right, but the company tell us that we need to made it as a module.

Hi

I just finished today one approach which works for me. It probably is not suitable for Canadian taxes as this would need to be calculated on line items. However I imagine the approach would be fairly similar.

This is the scenario. In Spain when the tax office had some issues with the VAT payments of e.g. XYZ Ltd. they propagate the responsability to the company selling products and services to XYZ Ltd. Instead of XYZ Ltd charging 21% to their customers. All companies selling to XYZ Ltd need to add 5.2% to their invoices in addition of the 21% VAT. Therefore the Tax office gets the VAT from the vendors to XYZ Ltd and XYZ Ltd. does not charge any VAT.

Here are the steps I have taken.

  1. Created new custom fields for R.E. Tax Amt and R.E. Taxlist 0.0% and 5.2%

  2. Assign the new fields to the Invoice form where you want them to be.

  3. In custom\modules\AOS_Invoices\metadata\editviewdefs.php I added
    array (
    ‘name’ => ‘retaxlist_c’,
    ‘studio’ => ‘visible’,
    ‘label’ => ‘LBL_RETAXLIST’,
    [color=#00bb00] ‘displayParams’ =>
    array (
    ‘field’ =>
    array (
    ‘onchange’ => ‘calculateTotal(‘lineItems’);’,
    ),
    ),
    [/color] ),
    ),

  4. Do a “Quick Repair and Rebuild” for the changes to activate.

  5. change the javascript to factor in my new tax in file modules\AOS_Products_Quotes\line_items.js
    change in function following section in function function calculateTotal(key) starting at line 800

    /start custom code for R.E. Tax cperrot 15.4.2016/
    var retaxlist = get_value(key+‘retaxlist_c’);
    var retax_amt = subtotal * (retaxlist/100);
    set_value(key+‘retax_c’,retax_amt);
    /end custom code for R.E. Tax/

    set_value(key+‘tax_amount’,tax);

    set_value(key+‘subtotal_tax_amount’,subtotal + tax);
    /start custom code for R.E. Tax cperrot 15.4.2016/
    //set_value(key+‘total_amount’,subtotal + tax + shipping);
    set_value(key+‘total_amount’,subtotal + tax + shipping + retax_amt);
    /end custom code for R.E. Tax/

That’s it. If you find a way to make that upgrade safe please let me know.

Cheers

Cedric

1 Like

I am fed up with this problem. Looking for service providers who can do it for me. I need to customize my Quotes and Invoice modules to meet GST requirements in India. I need following:
I need to add three types of tax rates with their corresponding dropdown lists : sGST, cGST and IGST. All these three taxes need to be accounted for calculation of tax.
There are other options like exempted and NA not sure how they can be included in calculations.
Interested folks can connect with their quote on rucha@letsexcel.in

use dolibarr https://www.dolibarr.org they seem to have it figured out.
https://github.com/Dolibarr/dolibarr/issues/18168

Hey thanks for the pointer, but I am looking for something that can be integrated with suitecrm

Canadian or any other Custom Tax additions can be done by customising modules/AOS_Products_Quotes/line_items.js and modules/AOS_Products_Quotes/Line_Items.php files. It is not straight forward unless you are a good developer. If people are frustrated with what they can not achieve with their limited skills, it would be better to get a knowledgeable person from crm domain on board.