There are several ways to trigger the Recalculation.
Unfortunately Epicor behind the scenes has made some of the useful methods private. In many other entry screens you could simply do this.oTrans.MethodName() yet for some reason the recalcWorksheet is private and has been since E9.
// You could do it this way BO
((Erp.Proxy.BO.QuoteImpl)this.oTrans.PrimaryAdapter.BusinessObject).RecalcWorksheet(oTrans.currentQuoteNum(), <insertQuoteLine>, <insertQtyNum>, oTrans.QuoteData);
// You could do it this way AD - Add QuoteAdapter to your Assemblies
((Erp.Adapters.QuoteAdapter)this.oTrans.PrimaryAdapter).RecalcWorksheet(oTrans.currentQuoteNum(), <insertQuoteLine>, <insertQuoteNum>);
// You could do it also this way using Reflection and accessing the Quote Transactions private recalcWorksheet method
System.Reflection.MethodInfo mi = typeof(Erp.UI.App.QuoteEntry.Transaction).GetMethod("recalcWorksheet", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
mi.Invoke(this.oTrans, new object[] { this.oTrans.currentQuoteNum(), <insertQuoteLine>, <insertQtyNum> });
// Also the Worksheet is re-calculated by making any changes via code or UI to fields
UnitPrice, DocUnitPrice, BurdenMarkUp, LaborMarkUp, SubcontractMarkUp
MtlBurMarkUp, MiscCostMarkUp, MiscCost, CommissionPct...
When working with Client Side Customizations it is always best to simply use the Adapter. If you don’t want to have to rely on the Assembly you could use the Reflection way.
I would suggest in your case, simply use the Adapter version. Why? Because the Adapter often has Warning/Error MessageBoxes that it may trigger, in addition it may call other UI related methods.
When you use the Business Object version you have to handle the exception yourself. Example:
try {
// Do BO Magic
}
catch (BusinessObjectException ex) { ExceptionBox.Show(ex); }
So, let’s use the Adapter version.
How-to Reference QuoteAdapter:
- Go Into Customization Mode
- Tools -> Assembly Reference Manager
- Click Add Custom Reference
- Navigate to your E10 Client (usually C:\epicor\ERP10.1Client\Client)
- Select Erp.Adapters.Quote.dll
Now by using the Adapter snippet above, you should be able to Press F5 and successfully compile your customization.
However, if you are already saving the total to QuoteQty.MiscCost then the re-calculation should happen automatically.