Calulating Tax amount on quote when discount applied

답변됨 Calulating Tax amount on quote when discount applied

  • Monday, July 16, 2012 9:40 PM
     
     

    Hi All,

    I have a challenge witht he tax amount on the quote form.  I have automatically calculated the tax on the quote product form.  CRM nicely adds the tax values to the quote form and provide me with the 'pre-delivery amount' and the 'Total Amount'.  It's all fine until a user enters a discount value on the quote.

    I've added a plugin to the quote save, and while it doesn't error, it doesn't update tax amount or the total; I've tried using JScript as well, with no success.

    Once the quote products have been added, I want to manipulate the tax and total amounts and more importantly update the fields!!!!

    Can anyone help with how to do it?, the only thing I can think of is to add bespoke fields and hide the tax and amounts which I'd like to avoid.

    Thanks,

    Tim


    SAAS-SD

All Replies

  • Tuesday, July 17, 2012 3:51 AM
     
     
    Is your plugin on pre or post operation?  Also do you have auditing enabled so you can see if CRM is overwriting your update?

    Blake Scarlavai - http://mscrmdev.blogspot.com/ - Sonoma Partners - http://www.sonomapartners.com/ - Follow @bscarlav
    CRM 2011 JavaScript Model Generator - CRM 2011 Appender for log4net

  • Tuesday, July 17, 2012 7:47 AM
     
     

    Blake, thanks for your feedback.

    Plugin is on post.  i have read on MSDN that tax and total are 'read-only', which appears to be the issue.

    I'm not aware of auditing - can you explain how to turn on...? (certainly logs are being produced server side capturing errors and such like)

    I have read a number of posts suggesting that JScript can be added to the OnChange events of the tax and totals, however I cannot get JScript to fire on these fields.  Now I assume that this is because they are read only.  i don't understand why you can add JScript if it is not fired (or be made to fire?)..

    Further assistance appreciated.  It's been a long night on this one! (and no doubt more to come!!!).

    Thanks,

    Tim


    SAAS-SD

  • Tuesday, July 17, 2012 11:12 AM
     
     
    Which filtering attributes are you using for the update post plugin? Set it only on the "Total Amount" field which is updated when the discount field gets modified. Also make sure that in your plugin you are only updating the "Total Tax" field, since updating other fields will trigger recalculating the total amount.
  • Wednesday, July 18, 2012 7:33 PM
     
     
    Jad Thanks.  I'm going to explore this further as I believe (as Blake mentioned) CRM might be over writing the values rather than not updating with my code.  I will lookat the Audit Blake mentioned and then take into account your direction and see what happens... I'll report back...

    SAAS-SD

  • Thursday, July 19, 2012 9:29 PM
     
     

    So far I have found that you cannot update the tax amount as it always appears to overright or ignore the CRMService update in the plugin.  I am going to install the audit plugin (hich is what i think blake mentions)...

    thans for your help guys...


    SAAS-SD


    Just to add that the auditing tool does not show the taxamount being updated at all.....  Though I'm not sure how the auditing tool works when recording the modifications via plugins...
    • Edited by Tim Windsor Thursday, July 19, 2012 10:15 PM
    •  
  • Wednesday, July 25, 2012 7:09 PM
     
     

    Ok installed the auditing tool (plugin from codeplex) and it doesn't seem to show any updates happening...  It feels to me like the restriction is the 'read only' fields as descibed on MSDN.  So i'm off to start writing my own CRM tax solution.....  don't think it'll be that hard after all i've written half the plugins to calculate the tax anyway.

    Thanks for your help gents.

    Tim


    SAAS-SD

  • Wednesday, April 24, 2013 4:11 PM
     
     Answered

    To complete this one for anyone else.  Write plugins on the save actions for quotes, orders and invoices.  It's a much simpler solution to manage all the calculations yourself.  This project was simplified by the fact it was only calculating tax (VAT) amounts in the UK.  you will have to check the currency / country for more complex solutions....  but not that hard to add a table containing the country percentage's etc - Just watch out for the tax rules!!!!

    thanks folks.


    Thank you for you time folks!

    • Marked As Answer by Tim Windsor Wednesday, April 24, 2013 4:11 PM
    •