Classic Screen Customization totals the Prepaid Invoice Deposits and fills a Text Box with the result.
This was something that someone else built. They are not around to ask.
I am tasked to move it to the browser on AR Invoice Entry.
I find C# in the Script Editor.
Here’s the main bit, but I’ll post the whole thing at the end:
if ((args.Row > -1))
{
//ARInvPrepaidIvcDeps.DocAllocBal
EpiDataView edvDep = oTrans.Factory("ARInvPrepaidIvcDeps");
decimal depTotal = 0;
foreach (DataRowView dr in edvDep.dataView)
{
depTotal += (decimal)dr["DocAllocBal"];
}
epiNumericEditorPpdDepBal.Value = depTotal;
}
else
epiNumericEditorPpdDepBal.Value = 0;
I can see the ARInvPrepaidIvcDeps dataview when I look at what’s available in Application Studio.
Can I replace this with a BPM, or do I need to write a Function?
I don’t have any previous experience with a dataview reference in a Function.
I tried some things out that were failing and getting me nowhere.
There doesn’t seem to be a way to make the foreach without C# that I can see.
Is that generally correct?
If I have a Function output value of a currency amount, I’m not clear on how to get that output shoved into an erp-currency-box.
I’m used to binding to the database field.
I assume the trigger for a Function should be when the InvoiceNum changes.
That looks like after the GetByID.
I’ve searched for a while on this site to educate myself.
I feel I lose on terminology.
I’m just not used to this stuff on a regular basis.
If anyone could provide the links on this site that is talking about what I need, I’m happy to build from that on my own.
I seek advice, not to get the work done for me.
I want to learn.
Here is the entire Script Editor code:
extern alias Erp_Contracts_BO_ARInvoice;
extern alias Erp_Contracts_BO_ARPromissoryNotes;
extern alias Erp_Contracts_BO_ARInvSearch;
extern alias Erp_Contracts_BO_ARInvcDtlSearch;
extern alias Erp_Contracts_BO_Company;
extern alias Erp_Contracts_BO_Customer;
extern alias Erp_Contracts_BO_Part;
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
private EpiDataView edvInvcHead;
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.edvInvcHead = ((EpiDataView)(this.oTrans.EpiDataViews["InvcHead"]));
this.edvInvcHead.EpiViewNotification += new EpiViewNotification(this.edvInvcHead_EpiViewNotification);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.edvInvcHead.EpiViewNotification -= new EpiViewNotification(this.edvInvcHead_EpiViewNotification);
this.edvInvcHead = null;
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void edvInvcHead_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row]["FieldName"]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
epiNumericEditorPpdDepBal.ReadOnly = true;
if ((args.Row > -1))
{
//ARInvPrepaidIvcDeps.DocAllocBal
EpiDataView edvDep = oTrans.Factory("ARInvPrepaidIvcDeps");
decimal depTotal = 0;
foreach (DataRowView dr in edvDep.dataView)
{
depTotal += (decimal)dr["DocAllocBal"];
}
epiNumericEditorPpdDepBal.Value = depTotal;
}
else
epiNumericEditorPpdDepBal.Value = 0;
}
} ```












