private static function _fulpacc(
        $pval, $rate, $fee, $minpay, $payment, $months, $base
    ) {
        $bal = $pval;
        $payarray = array();
        while (($months != 0) && ($bal > self::$accuracy)) {
            $interest = $bal * $rate / (100.0 * 12);
            $newbal = $bal + $interest + $fee;

            if ($minpay >= $newbal || $payment >= $newbal) {
                $payarray[] = $newbal;
                return $payarray;
            }

            $newpay = max($payment, $minpay);
            if ($base) {
                $newpay = max($newpay, $bal/24.0 + $fee + $interest);
            }

            $bal = $newbal - $newpay;
            $payarray[] = $newpay;
            $months -= 1;
        }

        return $payarray;
    }
private static function _fulpacc(
        $pval, $rate, $fee, $minpay, $payment, $months, $base
    ) {
        $bal = $pval;
        $payarray = array();
        while (($months != 0) && ($bal > self::$accuracy)) {
            $interest = $bal * $rate / (100.0 * 12);
            $newbal = $bal + $interest + $fee;

            if ($minpay >= $newbal || $payment >= $newbal) {
                $payarray[] = $newbal;
                return $payarray;
            }

            $newpay = max($payment, $minpay);
            if ($base) {
                $newpay = max($newpay, $bal/24.0 + $fee + $interest);
            }

            $bal = $newbal - $newpay;
            $payarray[] = $newpay;
            $months -= 1;
        }

        return $payarray;
    }
private static function _fulpacc ( $ pval , $ rate , $ fee , $ minpay , $ payment , $ months , $ base ) { $ bal = $ pval ; $ payarray = array ( ) ; while ( ( $ months != 0 ) && ( $ bal > self :: $ accuracy ) ) { $ interest = $ bal * $ rate / ( 100.0 * 12 ) ; $ newbal = $ bal + $ interest + $ fee ; if ( $ minpay >= $ newbal || $ payment >= $ newbal ) { $ payarray [ ] = $ newbal ; return $ payarray ; } $ newpay = max ( $ payment , $ minpay ) ; if ( $ base ) { $ newpay = max ( $ newpay , $ bal / 24.0 + $ fee + $ interest ) ; } $ bal = $ newbal - $ newpay ; $ payarray [ ] = $ newpay ; $ months -= 1 ; } return $ payarray ; }
This is a simplified model of how our paccengine works if
a client always pays their bills. It adds interest and fees
and checks minimum payments. It will run until the value
of the account reaches 0, and return an array of all the
individual payments. Months is the amount of months to run
the simulation. Important! Don't feed it too few months or
the whole loan won't be paid off, but the other functions
should handle this correctly.

Giving it too many months has no bad effects, or negative
amount of months which means run forever, but it will stop
as soon as the account is paid in full.

Depending if the account is a base account or not, the
payment has to be 1/24 of the capital amount.

The payment has to be at least $minpay, unless the capital
amount + interest + fee is less than $minpay; in that case
that amount is paid and the function returns since the client
no longer owes any money.

@param float   $pval    initial loan to customer (in any currency)
@param float   $rate    interest rate per year in %
@param float   $fee     monthly invoice fee
@param float   $minpay  minimum monthly payment allowed for this country.
@param float   $payment payment the client to pay each month
@param int     $months  amount of months to run (-1 => infinity)
@param boolean $base    is it a base account?

@return array  An array of monthly payments for the customer.
This is a simplified model of how our paccengine works if a client always pays their bills . It adds interest and fees and checks minimum payments . It will run until the value of the account reaches 0 and return an array of all the individual payments . Months is the amount of months to run the simulation . Important! Don t feed it too few months or the whole loan won t be paid off but the other functions should handle this correctly .