0
votes

I'm trying to use this PHIEUTHU sequence in AR302000 Payment and application screen to enter image description here

auto fill in ExtRefNbr text field enter image description here

Here is the code I wrote:

    protected void ARPayment_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
  base.ARPayment_RowPersisting(sender, e);
  //var row = (ARPayment)e.Row;
  if (this.IsImport)
    {
      if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Insert)
        {
            String numbering = ARSetup.Current.ExtRefNbr;
            Boolean autonumber = true;
            if (numbering != null)
               {
                 Numbering num = PXSelect<Numbering, Where<Numbering.numberingID, Equal<Required<Numbering.numberingID>>>>.Select(this, numbering);
                 if (num != null && num.UserNumbering == true)
                   {
                     autonumber = false;
                   }

      }}

}

    var payment = (ARPayment)e.Row;
    if (autonumber == false)
      {
        AutoNumberAttribute.SetNumberingId<APPayment.refNbr>(this.Document.Cache, payment.DocType, numbering);
      }

}

enter image description here Here is the error:

\App_RuntimeCode\ARPaymentEntry.cs(33): error CS0117: 'PX.Data.PXGraphExtension' does not contain a definition for 'ARPayment_RowPersisting' \App_RuntimeCode\ARPaymentEntry.cs(33): error CS0103: The name 'sender' does not exist in the current context \App_RuntimeCode\ARPaymentEntry.cs(35): error CS1061: 'PX.Objects.AR.ARPaymentEntry_Extension' does not contain a definition for 'IsImport' and no extension method 'IsImport' accepting a first argument of type 'PX.Objects.AR.ARPaymentEntry_Extension' could be found (are you missing a using directive or an assembly reference?) \App_RuntimeCode\ARPaymentEntry.cs(39): error CS0117: 'PX.Objects.AR.ARSetup' does not contain a definition for 'Current' \App_RuntimeCode\ARPaymentEntry.cs(43): error CS0120: An object reference is required for the non-static field, method, or property 'PX.Data.PXSelectBase.Select(params object[])' \App_RuntimeCode\ARPaymentEntry.cs(54): error CS0103: The name 'autonumber' does not exist in the current context \App_RuntimeCode\ARPaymentEntry.cs(56): error CS0246: The type or namespace name 'APPayment' could not be found (are you missing a using directive or an assembly reference?) \App_RuntimeCode\ARPaymentEntry.cs(56): error CS1061: 'PX.Objects.AR.ARPaymentEntry_Extension' does not contain a definition for 'Document' and no extension method 'Document' accepting a first argument of type 'PX.Objects.AR.ARPaymentEntry_Extension' could be found (are you missing a using directive or an assembly reference?) \App_RuntimeCode\ARPaymentEntry.cs(56): error CS0103: The name 'numbering' does not exist in the current context \App_RuntimeCode\ARPaymentEntry.cs(33): error CS0117: 'PX.Data.PXGraphExtension' does not contain a definition for 'ARPayment_RowPersisting'

enter image description here

My uploade included pictures, please take a look! Help me with step by step please, I'm newbie. Thank for helping me !

1

1 Answers

0
votes

If using a graph extension you will use "Base" as your call to the base graph and not base. When extending the events you can use the row delegate like this to call the base call. The example should work regardless if a base call exists in the base graph or not.

public class ARPaymentEntry_Extension : PXGraphExtension<ARPaymentEntry>
{
    protected virtual void ARPayment_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting del)
    {
        // base call...
        del?.Invoke(cache, e);

        // extended logic...
    }
}