Skip to main content
Question

How to add consulting item to Invoices screen (SO303000) when creating Invoices from Prepare Invoices

  • Sep 13, 2022 9:47 AM UTC
  • 8 replies
  • 253 views
  • Translate All

Forum|alt.badge.img

I want to add non stock consulting item(See below figure) to invoices screen details tab when creating prepare invoice from shipments screen. I tried override shipment screen “CreateInvoice” action as well as fire Row Persisted event and override Persist method in Invoices screen too but unbale to do. I saw when fire Row Persisted event or override Persist method just executing(looping) no end point. Please give me any answer or suggestions. 

 

8 replies

Kandy Beatty
Captain II
Forum|alt.badge.img+18
  • Captain II
  • Sep 13, 2022 11:54 AM UTC

HI @Lalith 

I’m not sure I am understanding what you are asking, but I was able to add a line item after the shipment was created similar to what you did.

Can you possibly explain more please?

Translate

Forum|alt.badge.img
  • Author
  • Freshman I
  • Sep 13, 2022 12:00 PM UTC

Hi @kbeatty21 

I want to add a line item after Invoice is created. 

Translate

Manikanta Dhulipudi
Captain II
Forum|alt.badge.img+16

Hi @Lalith 

Line Item can be added once an invoice is in balanced status not possible after release.

Thank you

Translate

Forum|alt.badge.img
  • Author
  • Freshman I
  • Sep 13, 2022 12:26 PM UTC

Hi @manikantad18 

Thank you your respond. 

Yes I want to add line item, the invoice is in balanced status but automatically. That’s why I tried to use Row Persisted event in the invoice. The problem is event executing continuously.

 

Translate

Kandy Beatty
Captain II
Forum|alt.badge.img+18

Hi @Lalith  

Are you talking about Automation schedules releasing the invoice?

Translate

Forum|alt.badge.img
  • Author
  • Freshman I
  • Sep 13, 2022 1:19 PM UTC

@kbeatty21 

My code was below. see it. It is working but this event continuously running. I want to stop that only one line item added to that graph.

protected void ARInvoice_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
    {

      
      var row = (ARInvoice)e.Row;
      if (row == null ) return;

      if (e.TranStatus == PXTranStatus.Completed)
      {         

          InventoryItem inventoryItem = new PXSelect<InventoryItem,           Where<InventoryItem.inventoryCD,
                      Equal<Required<InventoryItem.inventoryCD>>>>(Base).Select("ITEM1");


          ARTran aRTran = new ARTran();  
          aRTran.InventoryID = inventoryItem.InventoryID;         
          aRTran.Qty = 1;         
          aRTran.UnitPrice = 0;              
          Base.Transactions.Insert(aRTran);          
          Base.Actions.PressSave();        
          
      }
 
  }
 

 

Translate

Forum|alt.badge.img
  • Author
  • Freshman I
  • Sep 16, 2022 11:16 AM UTC

My target is like this. 

  1. So, all you know we can create Invoices from the shipment screen by using “Prepare Invoice” action.
  2. When means actually after creating a Invoice from that scenario, Just I want to add a special non-stock item which was created invoice.
  3. There fore firstly I created a object and set that item to created object and save to the Invoice graph. The code is below.

    protected void ARInvoice_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
        {

          
          var row = (ARInvoice)e.Row;
          if (row == null ) return;

          if (e.TranStatus == PXTranStatus.Completed)
          {         

              InventoryItem inventoryItem = new PXSelect<InventoryItem,           Where<InventoryItem.inventoryCD,
                          Equal<Required<InventoryItem.inventoryCD>>>>(Base).Select("ITEM1");


              ARTran aRTran = new ARTran();  
              aRTran.InventoryID = inventoryItem.InventoryID;         
              aRTran.Qty = 1;         
              aRTran.UnitPrice = 0;              
              Base.Transactions.Insert(aRTran);          
              Base.Actions.PressSave();        
              
          }
        }

  4. To do that process I tried handle Row Persisted or Persist(), but that event and method continuously looping. This Invoices screen not like other screen. Same thing I have done  when create shipment. That was fine.
  5. Can you give a solution to exit from a event which continuously looping or any method which I want to  save my nonstock item ASAP.

    @Naveen Boga  do you know any solution?

 

Translate

Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • Nov 2, 2022 10:55 PM UTC

Hi @Lalith - were you able to find a solution? Thank you!

Translate