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 

  • I have created custom field "line_tax_percent_c" and "custom_toggle" in "Quote Line Item(Product)". When I have edited quote line item but it's db store value not come.

    I have set field in "custom/modules/Products/clients/base/views/quote-data-group-list/quote-data-group-list.php".

    <?php
    /*
     * Your installation or use of this SugarCRM file is subject to the applicable
     * terms available at
     * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/.
     * If you do not agree to all of the applicable terms or do not have the
     * authority to bind the entity as an authorized representative, then do not
     * install or use this SugarCRM file.
     *
     * Copyright (C) SugarCRM Inc. All rights reserved.
     */
    $viewdefs['Products']['base']['view']['quote-data-group-list'] = array(
        'panels' => array(
            array(
                'name' => 'products_quote_data_group_list',
                'label' => 'LBL_PRODUCTS_QUOTE_DATA_LIST',
                'fields' => array(
                    array(
                        'name' => 'line_num',
                        'label' => null,
                        'widthClass' => 'cell-xsmall',
                        'css_class' => 'line_num tcenter',
                        'type' => 'line-num',
                        'readonly' => true,
                    ),
                    array(
                        'name' => 'quantity',
                        'label' => 'LBL_QUANTITY',
                        'widthClass' => 'cell-small',
                        'css_class' => 'quantity',
                        'type' => 'float',
                    ),
                    array(
                        'name' => 'product_template_name',
                        'label' => 'LBL_ITEM_NAME',
                        'widthClass' => 'cell-large',
                        'type' => 'quote-data-relate',
                        'required' => true,
                    ),
                    array(
                        'name' => 'mft_part_num',
                        'label' => 'LBL_MFT_PART_NUM',
                        'type' => 'base',
                    ),
                    array(
                        'name' => 'discount_price',
                        'label' => 'LBL_DISCOUNT_PRICE',
                        'type' => 'currency',
                        'convertToBase' => true,
                        'showTransactionalAmount' => true,
                        'related_fields' => array(
                            'discount_price',
                            'currency_id',
                            'base_rate',
                        ),
                    ),
                    array(
                        'name' => 'discount',
                        'type' => 'fieldset',
                        'css_class' => 'quote-discount-percent',
                        'label' => 'LBL_DISCOUNT_AMOUNT',
                        'fields' => array(
                            array(
                                'name' => 'discount_amount',
                                'label' => 'LBL_DISCOUNT_AMOUNT',
                                'type' => 'discount',
                                'convertToBase' => true,
                                'showTransactionalAmount' => true,
                            ),
                            array(
                                'type' => 'discount-select',
                                'name' => 'discount_select',
                                'no_default_action' => true,
                                'buttons' => array(
                                    array(
                                        'type' => 'rowaction',
                                        'name' => 'select_discount_amount_button',
                                        'label' => 'LBL_DISCOUNT_AMOUNT',
                                        'event' => 'button:discount_select_change:click',
                                    ),
                                    array(
                                        'type' => 'rowaction',
                                        'name' => 'select_discount_percent_button',
                                        'label' => 'LBL_DISCOUNT_PERCENT',
                                        'event' => 'button:discount_select_change:click',
                                    ),
                                ),
                            ),
                        ),
                    ),
                    array(
                      'name'=>'customrow_toggle_c',
                      'widthClass' => 'cell-small',
                      'label'=>'LBL_CUSTOMROW_TOGGLE',
                      'type' => 'varchar',
                    ),
                    array(
                      'name'=>'line_tax_percent_c',
                      'widthClass' => 'cell-small',
                      'label'=>'LBL_LINE_TAX_PERCENT_C',
                      'type' => 'float',

                    ),
                    array(
                      'name'=>'line_tax_amount_c',
                      'label'=>'LBL_LINE_TAX_AMOUNT_C',
                      'type' => 'currency',
                      'widthClass' => 'cell-small',
                      'showTransactionalAmount' => true,
                      'related_fields' => array(
                        'total_amount',
                        'currency_id',
                        'base_rate',
                      ),
                    ),
                    array(
                        'name' => 'total_amount',
                        'label' => 'LBL_LINE_ITEM_TOTAL',
                        'type' => 'currency',
                        'widthClass' => 'cell-medium',
                        'showTransactionalAmount' => true,
                        'related_fields' => array(
                            'total_amount',
                            'currency_id',
                            'base_rate',
                        ),
                    ),
                ),
            ),
        ),
    );

    Francesca Shiekh Aravind Kumar

    Thanks

    Asif

  • Hi Offshore Evolution, Did you followed Francesca Shiekh code? so what was the field type you have mentioned? Is it not working on Edit View alone or you cant view that values in Detail View?

    Provide us your Field Creation details code and the modification you have made.

  • Hi Aravind Kumar,

    It is not displaying value in detail or edit record page. I have set same as Francesca Shiekh code.

    1) line_tax_percent_c - It is float type field but it is not displaying value.

    2) line_tax_amount_c - It is currency formula field but it is displaying value.

    3) customrow_toggle_c - it is varchar type field but it is not displaying value.

  • Offshore Evolution did you add your field in custom/modules/Quotes/clients/base/views/record/record.php under 

    product_bundle_items

    it should work

  • Hi Aravind Kumar

    I have followed the same procedure but tax values not working fields are empty.

    Line item level tax is not working for me.

    help me to solve this..

  • Note that I sated that "I have an API which retrieves the correct amount based on tax tables on our ERP system and returns it to the Quote."
    You will need to populate the tax for the line item, then the totals will fall in place following this post.

  • Thanks For Reply Francesca Shiekh

    Any Reference Code for Creating Api To Fetch Prices from products. i have tried but its not working.