Tax calculation on line item - Quote Sugar 7.9

Hello,

I have noticed currently quote calculation on Quote level. I can apply to calculation tax on quote line item level. Because I have different type categories and product, so each product apply different type of VAT.

I have attached below screen shot. 

1) First product line item apply "20% (Vat on Income)"

2) Second product line item apply "5% (Vat on Income)"

3) Third product line item apply "0% (No Vat)"

Thanks

Asif

Offshore Evolution

Francesca Shiekh André Lopes Ramana Raju Santhana Alex Nassi 

Parents
  • I needed line item tax as well, I called the field line_tax_amount_c. In my case this is not a percentage but an amount, I have an API which retrieves the correct amount based on tax tables on our ERP system and returns it to the Quote. 

    I add up the line item tax at ProductBundle level:

    custom/Extension/modules/ProductBundles/Ext/Vardefs/vardef.ext.php

    <?php
    $dictionary['ProductBundle']['fields']['tax_amount_c']['labelValue']='Tax Amount';
    $dictionary['ProductBundle']['fields']['tax_amount_c']['calculated']='true';
    $dictionary['ProductBundle']['fields']['tax_amount_c']['formula']='rollupCurrencySum($products, "line_tax_amount_c")';
    $dictionary['ProductBundle']['fields']['tax_amount_c']['enforced']='true';
    $dictionary['ProductBundle']['fields']['tax_amount_c']['dependency']='';
    $dictionary['ProductBundle']['fields']['tax_amount_c']['related_fields']=array (
      0 => 'currency_id',
      1 => 'base_rate',
    );

    Then I add the Tax to the Bundle Total:

    custom/Extension/modules/ProductBundles/Ext/Vardefs/sugarfield_total.php

    <?php
    $dictionary['ProductBundle']['fields']['total']['formula']='currencyAdd($new_sub, $tax_amount_c)';
    $dictionary['ProductBundle']['fields']['total']['related_fields']=array (
      0 => 'currency_id',
      1 => 'base_rate',
      2 => 'new_sub',
      3 => 'tax_amount_c',
    );
    $dictionary['ProductBundle']['fields']['total']['calculated']='true';
    $dictionary['ProductBundle']['fields']['total']['enforced']='true';

    I then add the bundle tax for the total Tax at Quote level:

    custom/Extension/modules/Quotes/Ext/Vardefs/sugarfield_tax_amount_c.php

    <?php
    // created: 2017-06-13 11:14:46
    $dictionary['Quote']['fields']['tax_amount_c']['duplicate_merge_dom_value']=0;
    $dictionary['Quote']['fields']['tax_amount_c']['labelValue']='Tax';
    $dictionary['Quote']['fields']['tax_amount_c']['calculated']='true';
    $dictionary['Quote']['fields']['tax_amount_c']['formula']='rollupCurrencySum($product_bundles,"tax_amount_c")';
    $dictionary['Quote']['fields']['tax_amount_c']['enforced']='true';
    $dictionary['Quote']['fields']['tax_amount_c']['dependency']='';
    $dictionary['Quote']['fields']['tax_amount_c']['related_fields']=array (
      0 => 'currency_id',
      1 => 'base_rate',
    );

    The Quote total includes all the tax as it is because it's just a rollup total of the individual bundle totals, which include the line item tax per the customization above.

    HTH

    FrancescaS

Reply Children
No Data