/// <summary>
        /// Set Credit Status
        /// </summary>
        public void SetSOCreditStatus()
        {
            MBPartner bp          = new MBPartner(GetCtx(), GetC_BPartner_ID(), Get_TrxName());
            Decimal   creditLimit = GetSO_CreditLimit();

            //	Nothing to do
            if (SOCREDITSTATUS_NoCreditCheck.Equals(GetSOCreditStatus()) ||
                SOCREDITSTATUS_CreditStop.Equals(GetSOCreditStatus()) ||
                Env.ZERO.CompareTo(creditLimit) == 0)
            {
                return;
            }

            //	Above Credit Limit
            // changed this function for fetching open balance because in case of void it calculates again and fetches wrong value of open balance // Lokesh Chauhan
            //if (creditLimit.CompareTo(GetTotalOpenBalance(!_TotalOpenBalanceSet)) < 0)
            if (creditLimit.CompareTo(GetTotalOpenBalance()) <= 0)
            {
                SetSOCreditStatus(SOCREDITSTATUS_CreditHold);
            }
            else
            {
                //	Above Watch Limit
                Decimal watchAmt = Decimal.Multiply(creditLimit, bp.GetCreditWatchRatio());
                if (watchAmt.CompareTo(GetTotalOpenBalance()) < 0)
                {
                    SetSOCreditStatus(SOCREDITSTATUS_CreditWatch);
                }
                else    //	is OK
                {
                    SetSOCreditStatus(SOCREDITSTATUS_CreditOK);
                }
            }
            log.Fine("SOCreditStatus=" + GetSOCreditStatus());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get SO CreditStatus with additional amount
        /// </summary>
        /// <param name="additionalAmt">additional amount in Accounting Currency</param>
        /// <returns>sinulated credit status</returns>
        public String GetSOCreditStatus(Decimal?additionalAmt)
        {
            if (additionalAmt == null || Env.Signum((Decimal)additionalAmt) == 0)
            {
                return(GetSOCreditStatus());
            }
            //
            Decimal creditLimit = GetSO_CreditLimit();

            //	Nothing to do
            if (SOCREDITSTATUS_NoCreditCheck.Equals(GetSOCreditStatus()) ||
                SOCREDITSTATUS_CreditStop.Equals(GetSOCreditStatus()) ||
                Env.ZERO.CompareTo(creditLimit) == 0)
            {
                return(GetSOCreditStatus());
            }
            //	Above (reduced) Credit Limit
            creditLimit = Decimal.Subtract(creditLimit, (Decimal)additionalAmt);
            if (creditLimit.CompareTo(GetTotalOpenBalance(!_TotalOpenBalanceSet)) < 0)
            {
                return(SOCREDITSTATUS_CreditHold);
            }

            //	Above Watch Limit
            Decimal watchAmt = Decimal.Multiply(creditLimit, GetCreditWatchRatio());

            if (watchAmt.CompareTo(GetTotalOpenBalance()) < 0)
            {
                return(SOCREDITSTATUS_CreditWatch);
            }
            //	is OK
            return(SOCREDITSTATUS_CreditOK);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Credit Status is Stop or Hold.
        /// </summary>
        /// <returns>true if Stop/Hold</returns>
        public bool IsCreditStopHold()
        {
            String status = GetSOCreditStatus();

            return(SOCREDITSTATUS_CreditStop.Equals(status) ||
                   SOCREDITSTATUS_CreditHold.Equals(status));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Set Credit Status
        /// </summary>
        public void SetSOCreditStatus()
        {
            Decimal creditLimit = GetSO_CreditLimit();

            //	Nothing to do
            if (SOCREDITSTATUS_NoCreditCheck.Equals(GetSOCreditStatus()) ||
                SOCREDITSTATUS_CreditStop.Equals(GetSOCreditStatus()) ||
                Env.ZERO.CompareTo(creditLimit) == 0)
            {
                return;
            }

            //	Above Credit Limit
            if (creditLimit.CompareTo(GetTotalOpenBalance(!_TotalOpenBalanceSet)) < 0)
            {
                SetSOCreditStatus(SOCREDITSTATUS_CreditHold);
            }
            else
            {
                //	Above Watch Limit
                Decimal watchAmt = Decimal.Multiply(creditLimit, GetCreditWatchRatio());
                if (watchAmt.CompareTo(GetTotalOpenBalance()) < 0)
                {
                    SetSOCreditStatus(SOCREDITSTATUS_CreditWatch);
                }
                else    //	is OK
                {
                    SetSOCreditStatus(SOCREDITSTATUS_CreditOK);
                }
            }
            log.Fine("SOCreditStatus=" + GetSOCreditStatus());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Set Credit Status
        /// </summary>
        public void SetSOCreditStatus()
        {
            MBPartner bp          = new MBPartner(GetCtx(), GetC_BPartner_ID(), Get_TrxName());
            Decimal   creditLimit = GetSO_CreditLimit();

            //	Nothing to do
            if (SOCREDITSTATUS_NoCreditCheck.Equals(GetSOCreditStatus()) ||
                SOCREDITSTATUS_CreditStop.Equals(GetSOCreditStatus()) ||
                Env.ZERO.CompareTo(creditLimit) == 0)
            {
                return;
            }

            //	Above Credit Limit
            // changed this function for fetching open balance because in case of void it calculates again and fetches wrong value of open balance // Lokesh Chauhan
            //if (creditLimit.CompareTo(GetTotalOpenBalance(!_TotalOpenBalanceSet)) < 0)
            if (creditLimit.CompareTo(GetTotalOpenBalance()) <= 0)
            {
                SetSOCreditStatus(SOCREDITSTATUS_CreditHold);
            }
            else
            {
                //	Above Watch Limit
                //Peference check if credit watch per is zero on header then gets the value from bpgroup
                Decimal watchAmt;
                if (bp.Get_ColumnIndex("CreditWatchPercent") > 0)
                {
                    if (bp.GetCreditWatchPercent() == 0)
                    {
                        watchAmt = Decimal.Multiply(creditLimit, bp.GetCreditWatchRatio());
                    }
                    else
                    {
                        watchAmt = Decimal.Multiply(creditLimit, bp.GetCustomerCreditWatch());
                    }
                }
                else
                {
                    watchAmt = Decimal.Multiply(creditLimit, bp.GetCreditWatchRatio());
                }
                if (watchAmt.CompareTo(GetTotalOpenBalance()) < 0)
                {
                    SetSOCreditStatus(SOCREDITSTATUS_CreditWatch);
                }
                else    //	is OK
                {
                    SetSOCreditStatus(SOCREDITSTATUS_CreditOK);
                }
            }
            log.Fine("SOCreditStatus=" + GetSOCreditStatus());
        }