Dear,
I have a requirement to add a field that shows the result of Subtract (Subtotal amount - Total discount) in the Totals form in the PurchTotal Group,
Totals form that can be reached by navigating from :
Accounts Payable -> Purchase Orders -> All Purchase orders
in the upper menu panel next Delete (Purchase order) -> View -> Totals
so what I did is create an extension in my project from the form PurchTotals [Application Suite] in AOT ->user interface ->forms
I added a field of type (Real) in the extension form design and it worked well, but I don't know how to modify the code in the form (PurchTotals.xpp) I get an error message says, cant save ... Unauthorized to modify model 'Application Suite"
I know I need to create an extinction of the class:
"
[Form]
public class PurchTotals extends FormRun {
"
but I can not find it anywhere to create an extension of it
----------------------------------------------------------------------------------------------------------------------------------------
another approach I try to create a copy of the PurchTotals form and I created the new field as real and changed the code in the form class, but now I don't know hot to replace the Totals from "PurchTotals" with the new one "purchTotalsCopy"
I try to go to Accounts Payable -> Form-> Form setup
but there is no option to change the PurchTotals form
-----------------------------------------------------------------------------------------------------------------------------------------
another approach I try is to use events that triggers on the current form ,
so I copy the following :
[FormEventHandler(formStr(PurchTotals), FormEventType::Initialized)]
public static void PurchTotals_OnInitialized(xFormRun sender, FormEventArgs e)
{
}
and I created an info message and it showed me the message once I use the form in the upper part of the form,
so I tried to modify the field value but could not hade a way to grab the handler on the form
PurchTotals purchTotals;
PurchTable purchTable;
container displayFields;
PurchtotalsForm totalsForm;
totalsForm = PurchtotalsForm::newPurchTotalsForm(purchTable, 1);
but it gives me empty all attributes are NULL when debug
and it also gives me error message say that the currency is not set i try the code and it did not work :
CurrencyCode accountingCurrency = Ledger::accountingCurrency(CompanyInfo::current());
totalsForm.setCurrencyCode(accountingCurrency);
toCurrencyCode = accountingCurrency;
i don't know what is the approach i need to accomplish that , any suggestion would be appreciated , thank you in advance


I know I need to add this code in the form code.
