Payment & Prepayment deletion through the custom button from Sales Order

By | September 16, 2020

In Sage X3, we are working on payment integration from x3 to the third party payment gateway. Here, we are doing sale/auth/refund/void transactions on the client’s payment gateway through Sales Order/Invoice transactions from X3. Here, we will provide prepayment & payment deletion functionality through the void button.

New Stuff:- How to change the LOT’s expiration date (for multiple sites) in Sage X3

Prepayment & Payment deletion in x3

As per the requirement analysis and the functionality provided, we are creating automated prepayment and payment in x3 on the click of sale button from Sales Order which will create Sale transaction in the payment gateway respectively. After the successful payment & prepayment creation, if the user wants to cancel or refund the transaction created on payment gateway, the adverse effect in x3 will be deleting the payment & prepayment created against the sales order.

Note:This will be only applicable if the respective payment and prepayment against the sales order is not posted in x3.

If the payment is posted for the sales order in x3, then the user need to manually run account cancellation process from the payment entry in x3 to cancel/refund the payment transaction in x3. There are many validations which we need to check while deleting the payment which are as follows:

  • Payment and prepayment should exist for the particular sales order.
  • Sales Order status should not be closed.
  • Payment against the sales order should not been posted.
  • Closing table whichever opened while deleting the payment and prepayment entry to avoid systematic error I.e. “Too many tables opened in x3”

In our analysis, we have found out there are few hurdles coming in the way while deleting the payment which we need to handle through code i.e to set default mask as sales order mask again to avoid different system errors.

 

Working:

Call AV_ANNULE2([L]CODE,FLGLOT) From SUBPAY3:

The above statement is written to call specific standard delete function from x3.

Delete [ZPYH] where NUM=ZPAYNUM

The above statement is written to delete payment entry from the payment table from x3.

Delete [ZDUD]  where NUM=ZVCRNUM

The above statement is written to delete prepayment entry from the prepayment table from x3.

Gosub AP_ANNULE  From SUBPAY3

The above statement is written to call the functions used after the deletion of the payment and prepayment entry from x3.

 

Gosub APRES_ANNULE From SUBPAY3

The above statement is written to call the functions used after the deletion of the payment and prepayment entry from x3.

 

Note: We need to handle any system error occurred during the customization of deletion of payment and prepayment entry against the sales order/invoice screen. Supposedly if we are opening masks or tables opened for our process then we need to close the tables and masks to avoid any type of crashing/error in Sales order/delivery/invoice transactions.

We can also provide the same functionality from sales delivery and invoice as well, whenever the user delete/close the sales order and the payment with prepayment is created (payment not posted)

Advantages:

Here, we are having the advantages :-

  • We don’t have to manually delete the payment & prepayment entries or run any account cancellation document from payment entry
  • All the functionalities runs from a single click from custom button to delete/cancel/refund transaction from Sales order/delivery/invoice.

This blog is used for understanding the process of deletion of payment and prepayment from Sales Order through code before payment posting and without effecting standard functionalities or crashing the screen. This blog’s functionality will provide users to delete payment and prepayment through sales order/delivery/invoice screen from a single click whenever the user want to cancel/delete/refund any sale transactions.