locked
Sales tax question RRS feed

  • Question

  • How can a get tax to calculate on a quote? We have one tax percentage and we can only tax on product, so what I was going to do was to create a field in the quote product that served as a marker if it should be taxed or not (0 or 1), but then how can I get the system to calculate the tax. I will also create a custom tax field on the quote form since I think the one that is there is read only.

    If js is the option can someone help we with the code. I'm not a js developer.

    Thanks

    Thursday, February 28, 2013 2:13 PM

Answers

  • You could use a javascript on the save of the form or on the load of it to calculate the tax based on the base amount or similar fields (related to the business of taxing). However, use the function below:

    function tax ()
    {
    var val3 = Xrm.Page.getAttribute("tax").getValue();
    var val4 = Xrm.Page.getAttribute("extendedamountwithouttax").getValue();
    if (val3==null && val4!=null)
    {
    var total = Xrm.Page.getAttribute("extendedamountwithouttax").getValue();
    total=total*0.05;
    Xrm.Page.getAttribute("tax").setValue(total);
    }
    }

    Create a script web resource. Place the function above in it. Save and publish customizations. Then from the properties of the field or form set the handler and give the name of the function. Save changes and publish customizations. Then on the event you have registered the tax would be calculated on the quote product etc. Hope this helps you.


    If the answer helped you, remember to mark it as answer.


    Thursday, February 28, 2013 2:50 PM
    Moderator

All replies

  • You could use a javascript on the save of the form or on the load of it to calculate the tax based on the base amount or similar fields (related to the business of taxing). However, use the function below:

    function tax ()
    {
    var val3 = Xrm.Page.getAttribute("tax").getValue();
    var val4 = Xrm.Page.getAttribute("extendedamountwithouttax").getValue();
    if (val3==null && val4!=null)
    {
    var total = Xrm.Page.getAttribute("extendedamountwithouttax").getValue();
    total=total*0.05;
    Xrm.Page.getAttribute("tax").setValue(total);
    }
    }

    Create a script web resource. Place the function above in it. Save and publish customizations. Then from the properties of the field or form set the handler and give the name of the function. Save changes and publish customizations. Then on the event you have registered the tax would be calculated on the quote product etc. Hope this helps you.


    If the answer helped you, remember to mark it as answer.


    Thursday, February 28, 2013 2:50 PM
    Moderator
  • Thanks,

    How do I tell it to only calculate tax on products that have the marker I mention in my post (a 1 in this case)?

    Thursday, February 28, 2013 2:56 PM
  • Place a radio button on the quote product. Then at the begin of the function get the value of the radio button. If it is true, then calculate the tax, else, return.

    BTW, if the answers helped you please mark them as answer and vote them helpful. Thanks.

    Thursday, February 28, 2013 3:39 PM
    Moderator
  • DHpub check this article how can find sample javascript sample to learn and start doing the scenario

    http://crmbusiness.wordpress.com/2011/02/17/crm-2011-javascript-xrm-page-basics/


    ms crm

    Thursday, February 28, 2013 4:14 PM