Calculate total amount


I’m totally new to Epicor and I would like some help with some coding.

I’ve created two UD fields, one is UnitPrice and the other is Qty to an AR Miscellaneous table. The page already have an amount field. What I want to do is calculate (UnitPrice*Qty) and insert the result in the amount field.

I’m not to sure how to go about do this.


1 Like

you want to write from a UD field(s) to a database field?

  1. i advice to investigate deeply what is this ‘amount’ field for before setting any value to it, Epicor might have what you need already as standard but it is not on display, the way to do this is to check Table Data Dictionary in addition you do not know what Epicor is linking or doing with values from this field, alternatively and to be on the save side create a third UD field for you total.
  2. what BO screen are you using ,
  3. you need to decide when or based on what you would like this action to take place i.e. method or data BPM.

Thanks for your input. I was trying to write from a UD field to a database field. I got it working through the form event wizard. This is the code I wrote to get it working.

private void MiscChrg_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
// ** Argument Properties and Uses **
// args.Row[“FieldName”]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
case “Qty_c”:
UpdateMiscAmount(Convert.ToInt32(args.Row[“Qty_c”]), Convert.ToDecimal(args.Row[“UnitPrice_c”]));

	case "UnitPrice_c":
		UpdateMiscAmount(Convert.ToInt32(args.Row["Qty_c"]), Convert.ToDecimal(args.Row["UnitPrice_c"]));