Class APRM_MatchingUtility


  • public class APRM_MatchingUtility
    extends Object
    • Constructor Detail

      • APRM_MatchingUtility

        public APRM_MatchingUtility()
    • Method Detail

      • fixMixedLines

        public static void fixMixedLines​(FIN_Reconciliation reconciliation)
        Fix wrong financial transactions of a reconciliation. If the fix is not possible, it launches an OBException
        Parameters:
        reconciliation - The reconciliation whose lines are to be fixed
      • fixMixedLine

        public static void fixMixedLine​(FIN_FinaccTransaction mixedLine)
        Fix wrong financial transaction of a reconciliation
        Parameters:
        mixedLine - The financial transaction to be fixed
      • processReconciliation

        public static OBError processReconciliation​(String strAction,
                                                    FIN_Reconciliation reconciliation)
                                             throws Exception
        Process to process a reconciliation
        Parameters:
        strAction - String with the action of the process. {P, D, R}
        reconciliation - Reconciliation that needs to be processed
        Returns:
        returns error/success message
        Throws:
        Exception
      • matchBankStatementLine

        public static boolean matchBankStatementLine​(FIN_BankStatementLine bankStatementLine,
                                                     FIN_FinaccTransaction transaction,
                                                     FIN_Reconciliation reconciliation,
                                                     String matchLevel,
                                                     boolean throwException)
        Match a bank statement line with a financial account transaction. If the bank statement has associated a transaction, it is first unmatched and then matched against the given transaction. If the bank statement line amount is different from the transaction amount, the process will automatically split the bank statement line in two (see splitBankStatementLine(FIN_Reconciliation, FIN_BankStatementLine, FIN_FinaccTransaction)
        Returns:
        If success, the method automatically flushes and returns true. In case of exceptions, the method will either throw the exception or return false. This behavior is controlled by the throwException boolean parameter
      • unmatch

        public static void unmatch​(FIN_BankStatementLine bsline)
        Remove the match of a bank statement line with a transaction
        Parameters:
        bsline - Bank Statement Line to be unmatched from a transaction
      • removeTransaction

        public static void removeTransaction​(VariablesSecureApp vars,
                                             ConnectionProvider conn,
                                             FIN_FinaccTransaction transaction)
        Removes a financial account transaction
        Parameters:
        vars - VariablesSecureApp with the session data.
        conn - ConnectionProvider with the connection being used.
        transaction - Financial Account Transaction to be removed
      • removePayment

        public static void removePayment​(VariablesSecureApp vars,
                                         ConnectionProvider conn,
                                         FIN_Payment payment)
        Removes a payment
        Parameters:
        vars - VariablesSecureApp with the session data.
        conn - ConnectionProvider with the connection being used.
        payment - Payment to be removed
      • processTransaction

        public static OBError processTransaction​(VariablesSecureApp vars,
                                                 ConnectionProvider conn,
                                                 String strAction,
                                                 FIN_FinaccTransaction transaction)
                                          throws Exception
        It calls the Transaction Process for the given transaction and action.
        Parameters:
        vars - VariablesSecureApp with the session data.
        conn - ConnectionProvider with the connection being used.
        strAction - String with the action of the process. {P, D, R}
        transaction - FIN_FinaccTransaction that needs to be processed.
        Returns:
        a OBError with the result message of the process.
        Throws:
        Exception
      • getPendingToBeMatchedBankStatementLines

        public static org.hibernate.ScrollableResults getPendingToBeMatchedBankStatementLines​(String strFinancialAccountId,
                                                                                              String strReconciliationId)
        Get the bank statement lines that are not yet matched to a transaction for the given financial account. If the reconciliation passed as parameter is the last one, the method filters by the bank statement lines with transaction date less or equal than the reconciliation's ending date
      • addNewDraftReconciliation

        public static FIN_Reconciliation addNewDraftReconciliation​(FIN_FinancialAccount financialAccount)
        Creates a new draft reconciliation for the given financial account
      • updateReconciliation

        public static boolean updateReconciliation​(FIN_Reconciliation reconciliation,
                                                   FIN_FinancialAccount financialAccount,
                                                   boolean process)
        Updates the dates of a given reconciliation and if the process parameter is true it processes the reconciliation
      • createMessageInProcessView

        public static org.codehaus.jettison.json.JSONArray createMessageInProcessView​(String messageSearchKey,
                                                                                      String msgType,
                                                                                      Object... messageParams)
                                                                               throws org.codehaus.jettison.json.JSONException
        Returns a JSONArray with a message to be shown in the process view
        Parameters:
        messageSearchKey - String with the message to translate (see OBMessageUtils.translateError(String)
        msgType - error, warning, success, info
        messageParams - parameters to be applied to the message text using String.format(String, Object...)
        Returns:
        a JSONArray with a message to be shown in the process view
        Throws:
        org.codehaus.jettison.json.JSONException