Answered by:
TotalTax and TotalDiscountAmount Calculations

Question
-
Hi There,
We have a customized field called new_directcosts on the "Proposal and CIS" screen. My users complain that the calculations are sometime wrong. They think the new_directcosts should be equal to the sum of the direct costs for all of the sercies associated with that proposal. But, sometimes, one of the services is not included in the calculation. I cheded the customizations and found the new_directcosts are calculated as (TotalTax - TotalDiscountAmount). I also know the Total Tax and TotalDiscountAmount are two fields on the "Proposal Service" form and they are two columns in the QuoteBase table. But I have no clue how the values are calculated. Could anyone give me some help or hint? Thank you very much in advance!
Rho
Tuesday, January 19, 2010 4:31 PM
Answers
-
Hi Rho,
Not a problem. Well based on the information you've provided I would assume that the total tax and discount are calculated by the system which is simply based on the tax and discounts provided on the products associated with the quote.
You can if you want change the way this is calculated by developing your own custom code (Plug-in). To do this you will need a good understanding of the MS CRM SDK.
Hassan.
Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/- Marked as answer by Jim Glass Jr Tuesday, January 26, 2010 9:10 PM
Monday, January 25, 2010 9:43 PM
All replies
-
Hi Rho,
When do the calculations happen? If the calculated field is updated when the record is saved the calculations might be happening in a Plug-in on the server side. If the calculations happen when the user changes focus from one field to the other then the calculations might be implemented in JavaScript on the form.
My recommendation would be to ask the consultant to modify the code that does the calcuations. He/She would be best placed to change the logic if there is a problem with the code.
If that is not possible you should look at the JavaScript code behind the OnLoad event of the form Or the OnChange event of the totaltax and totaldiscountamount fields. You might be able to modify the code Or if you need assistance paste the code on this forum and we will be able to help.
If the calculations are implemented in a Plug-in, you will need the source code to make changes to the code.
Hassan.
Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/- Proposed as answer by Hassan Hussain Tuesday, January 19, 2010 10:49 PM
- Marked as answer by Jim Glass Jr Wednesday, January 20, 2010 5:40 PM
- Unmarked as answer by Rho CRM Wednesday, January 20, 2010 7:15 PM
Tuesday, January 19, 2010 10:48 PM -
Hi Hassan,
Thank you very much for your reply. The calculation of the DirectCosts happens during the event "OnSave" in customizations.
crmForm.all.new_directcosts.DataValue =
(crmForm.all.totaltax.DataValue -
crmForm.all.totaldiscountamount.DataValue);
But, I do not know how the totaltax and totaldiscountamount are calculated. I checked the OnLoad and OnChange events and the calculations are not there. I also did an export of all the customizations and could not find the calculations. It looks like the totaltax and totaldiscountamount are out-of-box columns/fields. You mentioned the Plug-in on the server side. Is there any way to check that? By the way, Thanks!
RhoWednesday, January 20, 2010 6:17 PM -
Hi Rho,
Is the "Proposal and CIS" screen based on a custom entity or the quote entity? The code you posted "crmForm.all.totaltax.DataValue" makes me believe that a system entity has been renamed to proposal and CIS.
IF this is the case the total discount and tax would be based on the products added to the quote "Proposal and CIS" record.
Hassan.
Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/Monday, January 25, 2010 1:47 PM -
Hi Hassan,
Thanks for the reply. Yes, the "Proposal and CIS" screen is based on the quote entity. The totalTax and totalDiscountAmount fields are grayed out on the screen. That means the values are calculated automatically behide the screen. But, I could not find where the calculations are. What I try to do is to look at the code to see how the totalTax and totalDiscountAmount are calculated. Is there any way to find it out? Thanks a lot!
RhoMonday, January 25, 2010 6:36 PM -
Hi Rho,
Thank you for the additional information. The totaltax and the totaldiscountamount fields on the quote form are calculated based on the products and write-in products added to the quote record.
So the totaltax on the quote is the sum of tax on the product forms. Same for the totaldiscountamount. This is default system behaviour.
Hassan.
Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/Monday, January 25, 2010 9:27 PM -
Hi Hassan,
Do you mean the calculations are in the compiled out-of-box software? If so, does this mean we have no way to open the code? Sorry for too many questions. Thanks!
RhoMonday, January 25, 2010 9:36 PM -
Hi Rho,
Not a problem. Well based on the information you've provided I would assume that the total tax and discount are calculated by the system which is simply based on the tax and discounts provided on the products associated with the quote.
You can if you want change the way this is calculated by developing your own custom code (Plug-in). To do this you will need a good understanding of the MS CRM SDK.
Hassan.
Hassan Hussain | http://hassanhussain.wordpress.com/ | http://www.mscrmvirtualusergroup.com/- Marked as answer by Jim Glass Jr Tuesday, January 26, 2010 9:10 PM
Monday, January 25, 2010 9:43 PM -
Hi Hassan,
Thank you very much for your help!
RhoTuesday, January 26, 2010 7:17 PM