Monday, May 22, 2023

How to reverse Free Text Invoice Voucher entries without Dialog

 Hey Folks , 


This blog post is in continuation of the previous post for Reversing Free Text Invoice Voucher entries with Dialog. Only difference is this time we are doing it without dialog or you can say by suppressing

For doing it we have extended TransactionReversal_Cust class. 

We have a staging table FTIVouchers which contains the Voucher Number to be reversed.

We can use the below code to achieve this : - 



class TransactionReversal extends TransactionReversal_Cust
{
    public static TransactionReversal construct()
    {
        return new TransactionReversal();
    }

    public boolean showDialog()
    {
        return false;
    }

    public static void main(Args _args)
    {
        CustTrans 				custTrans;
        FTIVouchers                             vouchers;
        TransactionReversal 	                transactionReversal;
        ReasonTable 			        reasonTable;
        ReasonCode 				reasonCode;
        ReasonRefRecID 			        reasonRefRecID;
        InvoiceId 				invoiceId;
        Args 					args;
        

        while select vouchers where vouchers.Voucher!=''
        {
            args = new Args();
            custTrans = CustTrans::findByVoucher(vouchers.Voucher);
            args.record(custTrans);  
            reasonCode = 'XYZ';
            reasonTable = ReasonTable::find(reasonCode);
            reasonRefRecID = ReasonTableRef::createReasonTableRef(
            reasonTable.Reason, vouchers.Voucher+'REV');
            transactionReversal = transactionReversal::construct();
            transactionReversal.parmReversalDate(custTrans.TransDate);
            transactionReversal.parmReasonRefRecId(reasonRefRecID);
            transactionReversal.reversal(args);
            info(strFmt("%1 %2 %3 %4 reversed.",
                custTrans.Voucher,
                custTrans.TransDate,
                custTrans.Invoice,
                custTrans.Txt));
        }
        
    }

}

}


That's all for now. Please let us know your questions or feedback in comments section !!!!

Thursday, May 11, 2023

How to reverse Free Text Invoice voucher entry through x++ with Dialog

 Hey Folks , 


In order to do quick reversal of wrongly created Customer Invoices it will take lot of time and effort to do this manually. Here x++ pitches in to help us achieve this quickly.

For doing it through a dialog for a single transaction we have TransactionReversal_Cust class. 

We have a staging table FTIVouchers which contains the Voucher Number to be reversed.

We can use the below code to achieve this : - 



internal final class RunnableClass1
{
    /// 
    /// Class entry point. The system will call this method when a designated menu 
    /// is selected or when execution starts and this class is set as the startup class.
    /// 
    /// The specified arguments.
    public static void main(Args _args)
    {
        FTIVouchers                vouchers;
        TransactionReversal_Cust   transactionReversal = TransactionReversal_Cust::construct();

        Args        args = new Args();

        while select vouchers  where vouchers.Voucher!=''
        {
            CustTrans   custTrans = CustTrans::findByVoucher(vouchers.Voucher);

            args.record(custTrans);

            transactionReversal.parmReversalDate(systemdateget());

            transactionReversal.reversal(args);
        }
    }

}


That's all for now. Please let us know your questions or feedback in comments section !!!!

How to reverse Free Text Invoice Voucher entries without Dialog

 Hey Folks ,  This blog post is in continuation of the previous post for Reversing Free Text Invoice Voucher entries with Dialog. Only diffe...