Monday, October 30, 2017

To update the bank reconcile date of the reconcile record and its transactions.

The bank reconciliation should be post on 12/10/2017 but user has wrongly posted or reconciled on 12/11/2017. Then Please run the below code which will fix the issue:


//To update the bank reconcile date of the reconcile record and its transactions.
static void UpdateDate(Args _args)
{
    BankAccountStatement    bankAccountStatement, bankAccountStmtUpdate;
    BankAccountTrans        bankAccountTrans;
    select RecId, AccountId from bankAccountStatement
        where bankAccountStatement.AccountId == "ABC_CD" &&
              bankAccountStatement.AccountStatementDate == str2Date("12/11/2017",123) &&
              bankAccountStatement.AccountStatementNum  == "20171012_ABC";
    if(bankAccountStatement.RecId)
    {
        ttsBegin;
        update_recordSet bankAccountStmtUpdate
            setting AccountStatementDate = str2Date("12/10/2017",123)
                where bankAccountStmtUpdate.RecId == bankAccountStatement.RecId;

        update_recordSet bankAccountTrans
            setting AccountStatementDate = str2Date("12/10/2017",123)
                where bankAccountTrans.AccountId        == bankAccountStatement.AccountId &&
                      bankAccountTrans.AccountStatement == bankAccountStatement.AccountStatementNum;
        ttsCommit;
    }
}