Question

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

  • 13 September 2022
  • 8 replies
  • 147 views

Userlevel 1
Badge

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

Userlevel 7
Badge

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

Userlevel 1
Badge

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?

 

Userlevel 1
Badge

@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();        
          
      }
 
  }
 

 

Userlevel 7
Badge +16

Hi @Lalith  

Are you talking about Automation schedules releasing the invoice?

Userlevel 1
Badge

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.

 

Userlevel 7
Badge +12

Hi @Lalith 

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

Thank you

Userlevel 1
Badge

Hi @kbeatty21 

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

Userlevel 7
Badge +16

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?

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved