Exemplo n.º 1
0
 /**
  * 	Before Save
  *	@param newRecord new
  *	@return true if valid
  */
 protected override Boolean BeforeSave(Boolean newRecord)
 {
     MBank bank = GetBank();
     BankVerificationInterface verify = bank.GetVerificationClass();
     if (verify != null)
     {
         String errorMsg = verify.VerifyAccountNo(bank, GetAccountNo());
         if (errorMsg != null)
         {
             //log.saveError("Error", "@Invalid@ @AccountNo@ " + errorMsg);
             return false;
         }
         errorMsg = verify.VerifyBBAN(bank, GetBBAN());
         if (errorMsg != null)
         {
             //log.saveError("Error", "@Invalid@ @BBAN@ " + errorMsg);
             return false;
         }
         errorMsg = verify.VerifyIBAN(bank, GetIBAN());
         if (errorMsg != null)
         {
             //log.saveError("Error", "@Invalid@ @IBAN@ " + errorMsg);
             return false;
         }
     }
     return true;
 }
        /**
         *  Before Save
         *	@param newRecord new
         *	@return true
         */
        protected override bool BeforeSave(bool newRecord)
        {
            //	maintain routing on bank level
            if (IsACH() && GetBank() != null)
            {
                SetRoutingNo(null);
            }
            //	Verify Bank
            MBank bank = GetBank();

            if (bank != null)
            {
                BankVerificationInterface verify = bank.GetVerificationClass();
                if (verify != null)
                {
                    String errorMsg = verify.VerifyRoutingNo(bank.GetC_Country_ID(), GetRoutingNo());
                    if (errorMsg != null)
                    {
                        log.SaveError("Error", "@Invalid@ @RoutingNo@ " + errorMsg);
                        return(false);
                    }
                    //
                    errorMsg = verify.VerifyAccountNo(bank, GetAccountNo());
                    if (errorMsg != null)
                    {
                        log.SaveError("Error", "@Invalid@ @AccountNo@ " + errorMsg);
                        return(false);
                    }
                    errorMsg = verify.VerifyBBAN(bank, GetBBAN());
                    if (errorMsg != null)
                    {
                        log.SaveError("Error", "@Invalid@ @BBAN@ " + errorMsg);
                        return(false);
                    }
                    errorMsg = verify.VerifyIBAN(bank, GetIBAN());
                    if (errorMsg != null)
                    {
                        log.SaveError("Error", "@Invalid@ @IBAN@ " + errorMsg);
                        return(false);
                    }
                }
            }
            return(true);
        }
        /**
         *  Before Save
         *	@param newRecord new
         *	@return true if valid
         */
        protected override Boolean BeforeSave(Boolean newRecord)
        {
            MBank bank = GetBank();
            BankVerificationInterface verify = bank.GetVerificationClass();

            if (verify != null)
            {
                String errorMsg = verify.VerifyAccountNo(bank, GetAccountNo());
                if (errorMsg != null)
                {
                    //log.saveError("Error", "@Invalid@ @AccountNo@ " + errorMsg);
                    return(false);
                }
                errorMsg = verify.VerifyBBAN(bank, GetBBAN());
                if (errorMsg != null)
                {
                    //log.saveError("Error", "@Invalid@ @BBAN@ " + errorMsg);
                    return(false);
                }
                errorMsg = verify.VerifyIBAN(bank, GetIBAN());
                if (errorMsg != null)
                {
                    //log.saveError("Error", "@Invalid@ @IBAN@ " + errorMsg);
                    return(false);
                }
            }

            //Issue ID- SI_0613 in Google Sheet Standard Issues.. On Bank account currency should not allow to change if any transcation made against bank.
            if (!newRecord && Is_ValueChanged("C_Currency_ID"))
            {
                string sql = "SELECT SUM(total) AS TOTAL FROM (SELECT COUNT(*) AS TOTAL FROM C_PAYMENT WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID()
                             + " UNION ALL SELECT COUNT(*) AS TOTAL FROM C_ELEMENTVALUE WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID()
                             + " UNION ALL  SELECT COUNT(*) AS TOTAL FROM C_BP_BANKACCOUNT WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID()
                             + " UNION ALL  SELECT COUNT(*) AS TOTAL  FROM C_BANKACCOUNT_ACCT  WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID()
                             + " UNION ALL  SELECT COUNT(*) AS TOTAL FROM C_BANKSTATEMENT WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID()
                             + " UNION ALL  SELECT COUNT(*) AS TOTAL  FROM C_PAYMENTPROCESSOR  WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID()
                             + " UNION ALL  SELECT COUNT(*) AS TOTAL  FROM C_CASHLINE WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID()
                             + " UNION ALL  SELECT COUNT(*) AS TOTAL FROM C_PAYSELECTION WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID()
                             + " UNION ALL  SELECT COUNT(*) AS TOTAL FROM C_BANKACCOUNTDOC WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID()
                             + " UNION ALL  SELECT COUNT(*) AS Total FROM C_BankAccountLine WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID();

                if (Env.IsModuleInstalled("VA026_")) // if Letter Of Credit Module is Installed..
                {
                    sql += " UNION ALL SELECT count(*) as Total FROM VA026_LCDETAIL WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID();
                }
                if (Env.IsModuleInstalled("VA027_")) // If Post dated Check Module is Installed..
                {
                    sql += " UNION ALL SELECT count(*) as total FROM VA027_POSTDATEDCHECK WHERE AD_Client_ID= " + GetAD_Client_ID() + " AND C_BANKACCOUNT_ID =" + GetC_BankAccount_ID();
                }

                sql += ")";

                if (Util.GetValueOfInt(DB.ExecuteScalar(sql)) > 0)
                {
                    log.SaveError("Error", Msg.GetMsg(GetCtx(), "CouldNotChnageCurrency"));
                    return(false);
                }

                // JID_1583: system will update the Opening balance value in Current Balance field
                if (newRecord && Get_ColumnIndex("OpenBalance") > 0)
                {
                    SetCurrentBalance(Util.GetValueOfDecimal(Get_Value("OpenBalance")));
                }
            }
            //End

            // JID_1583: system will update the Opening balance value in Current Balance field
            if (newRecord && Get_ColumnIndex("OpenBalance") > 0)
            {
                SetCurrentBalance(Util.GetValueOfDecimal(Get_Value("OpenBalance")));
            }
            return(true);
        }