Solved

Change "Closed" status on "Balanced" for Checks and Payments Item programmatically



Show first post

43 replies

Userlevel 4
Badge +2

You need to set the current adjustment that is going to be reversed. I believe Acumatica just changed the naming but in 2021 R2 the view is called APPost. Its the view under the Application History tab. 

If the method doesn’t find a current application it doesn’t do anything.

 

 

@markusray17 

The version of Acumatica is 2020R2

Can you please clarify what adjustment should be taken and where to set it ?

I did not see such parameter at Checks and Payments item fields values 

 

Userlevel 6
Badge +5

You need to set the current adjustment that is going to be reversed. I believe Acumatica just changed the naming but in 2021 R2 the view is called APPost. Its the view under the Application History tab. 

If the method doesn’t find a current application it doesn’t do anything.

 

 

Userlevel 4
Badge +2

It sounds like ReverseApplication is what you are looking for. Voiding will void(cancel) the payment.

There must be something that I am missing

After that code was executed, the payment remains being closed 

 

Userlevel 6
Badge +5

It sounds like ReverseApplication is what you are looking for. Voiding will void(cancel) the payment.

Userlevel 4
Badge +2

ReverseApplication just reverses the currently selected application which is the adjustment that applies x amount from the check to a document(usually an AP Invoice).

If you are trying to void a check there is a voidCheck action that you can call in the same way. 

You are also not searching for APInvoice.refNbr you should be searching for APPayment.refNbr.

Hi @markusray17 

I need to clarify one moment. My goal is to return “closed” item to “Open” state. The requirement is to return payment to previous state in case if User made the mistake and payment was not performed for definite item, so in that case Checks and Payments item must be returned and be available until the payment will be performed.

Firstly I thought it should be done via voidCheck, but now due to your response I think ReverseApplication  is what should be used. Suggest, please, which approach will be better for my aim 

Userlevel 6
Badge +5

ReverseApplication just reverses the currently selected application which is the adjustment that applies x amount from the check to a document(usually an AP Invoice).

If you are trying to void a check there is a voidCheck action that you can call in the same way. 

You are also not searching for APInvoice.refNbr you should be searching for APPayment.refNbr.

Userlevel 4
Badge +2

That looks mostly correct but that is the wrong graph if you are trying to reverse an application.

 

ReverseApplication is an action on the APPaymentEntry graph. You will typically call an action as

APPaymentEntry.reverseApplication.Press(adapter)

The adapter is optional you can also just call Press(). The case does matter as reverseApplication is the PXAction and ReverseApplication is the handler(you can call this directly but it is generally advisable to use the action, and calling it directly you will have to supply an adapter). 

@markusray17 

I changed type of graph as you mentioned

Will such code make this item “Void” ?

                string referenceNbr = "001571";
                APPaymentEntry graph = PXGraph.CreateInstance<APPaymentEntry>();
                graph.Document.Current = graph.Document.Search<APInvoice.refNbr>(referenceNbr);          
                graph.reverseApplication.Press();

 

Userlevel 6
Badge +5

That looks mostly correct but that is the wrong graph if you are trying to reverse an application.

 

ReverseApplication is an action on the APPaymentEntry graph. You will typically call an action as

APPaymentEntry.reverseApplication.Press(adapter)

The adapter is optional you can also just call Press(). The case does matter as reverseApplication is the PXAction and ReverseApplication is the handler(you can call this directly but it is generally advisable to use the action, and calling it directly you will have to supply an adapter). 

Userlevel 4
Badge +2

Void will void the check and it creates a Voided Check document to cancel out the original check.

Via the APPaymentEntry graph the action is called ReverseApplication so yes you can invoke it programmatically. It creates an inverted application against the check that will move it from closed → open once released. You can invoke actions on graphs by using [Graph(Instance)].[Action].Press().

 

Edit: if you are making a process screen you will likely want to use PXGraph.CreateInstance to get an instance of the APPaymentEntry graph. You can then set the current document to whatever APPayment you are handling and invoke the necessary actions. 

Hi @markusray17 

Can you provide help with this part :

“if you are making a process screen you will likely want to use PXGraph.CreateInstance to get an instance of the APPaymentEntry graph. You can then set the current document to whatever APPayment you are handling and invoke the necessary actions. ”

I wrote the following way, where I send to graph instance ReferenceNbr of item that must be Voided

 string referenceNbr = "023675";
                APInvoiceEntry graph = PXGraph.CreateInstance<APInvoiceEntry>();
                graph.Document.Current = graph.Document.Search<APInvoice.refNbr>(referenceNbr);
                graph.ReverseApplication();

That is how it should be done, firstly I send reference Nbe to instance and after that I call the action, right ?

Userlevel 6
Badge +5

Void will void the check and it creates a Voided Check document to cancel out the original check.

Via the APPaymentEntry graph the action is called ReverseApplication so yes you can invoke it programmatically. It creates an inverted application against the check that will move it from closed → open once released. You can invoke actions on graphs by using [Graph(Instance)].[Action].Press().

 

Edit: if you are making a process screen you will likely want to use PXGraph.CreateInstance to get an instance of the APPaymentEntry graph. You can then set the current document to whatever APPayment you are handling and invoke the necessary actions. 

Userlevel 4
Badge +2

Yes, it is possible.

you can invoke form Base graph like below.

Base.putonhold.Press();

Base.ReleaseFromHold.Press();

@Naveen Boga 

In previous comment where I replied to markusray17 I described that I need it to call from code that is called by Acumatica Automation Schedule that will open folder and check files which will have list of Checks and Payment Items that must be returned to Open status. I think it will not be available to call Base graph and there should be list of parameters for Void methods where I define which Item to process ( For example send ReferenceNbr to parameters in method)

 

Userlevel 4
Badge +2

You can reverse the applications that closed the check to bring it back to an OPEN state but you cannot get it back to a BALANCED state. 

BALANCED → OPEN for AR/AP Documents involves posting to the GL at that point you would need to void(or create a canceling document) instead of deleting or changing the document. 

Voiding a check will move it to the voided status.

Hi @markusray17 

It looks good. Is it possible to call Void and bring item back to OPEN state programmatically ?

I have code that is executed according to automation schedule, that will open folder and checks files which will have list of Checks and Payment Items that must be returned to Open status.

 

Userlevel 7
Badge +17

Yes, it is possible.

you can invoke form Base graph like below.

Base.putonhold.Press();

Base.ReleaseFromHold.Press();

Userlevel 4
Badge +2

Hi @Ivan  Once you click on the VOID, it will create a new VOIDED CHECK type of document against CHECK document and once you RELEASE it, the status will be changed to CLOSED

 

 

now it looks real it implement, I checked void option, all data is saved after void action

Firstly it makes “Hold” status 

After that I can remove it from hold

is it possible to call Void and remove Hold status programmatically ?

Userlevel 6
Badge +5

You can reverse the applications that closed the check to bring it back to an OPEN state but you cannot get it back to a BALANCED state. 

BALANCED → OPEN for AR/AP Documents involves posting to the GL at that point you would need to void(or create a canceling document) instead of deleting or changing the document. 

Voiding a check will move it to the voided status.

Userlevel 7
Badge +17

Hi @Ivan  Once you click on the VOID, it will create a new VOIDED CHECK type of document against CHECK document and once you RELEASE it, the status will be changed to CLOSED

 

Userlevel 4
Badge +2

Hi @Ivan  Once Document is changed to CLOSED status, you cannot change it BALANCED, you can only do VOID and create new document

.

Hi @Naveen Boga 

If I make it void once, will be it possible to to close it after void ?

Userlevel 7
Badge +17

Hi @Ivan  Once Document is changed to CLOSED status, you cannot change it BALANCED, you can only do VOID and create new document

.

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