user balance function

eugene.k's Avatar

eugene.k

07 Nov, 2014 02:15 PM

Hello, i have a question about calculation user's current balance. There is a function getBalance in UserBL.java source file:
    public BigDecimal getBalance(Integer userId) {
        return new InvoiceDAS().findTotalBalanceByUser(userId).subtract(
                new PaymentDAS().findTotalBalanceByUser(userId));
    }

As i can see it calculates invoices sum, payments sum (minus refunds) and then returns (InvoicesSum - PaymentsSum).

So if some user paid more then invoices sum it returns negative value. But balance should be positive, shouldn't it? Please help me to figure it out, thanks!

  1. 1 Posted by Musaddique on 14 Nov, 2014 04:35 AM

    Musaddique's Avatar

    user balance in jbilling is the amount that user need to pay. think from company point of view. so iif user paid extra amount so it will return the amount in negative value.

    thanks

  2. 2 Posted by eugene.k on 14 Nov, 2014 08:22 AM

    eugene.k's Avatar

    Thanks a lot!

  3. Support Staff 3 Posted by Technical Suppo... on 08 Jan, 2015 05:39 AM

    Technical Support's Avatar

    Hello eugene.k

    Please let us know if you face this issue again .

    Thank you,
    Technical Support Team.

  4. Technical Support closed this discussion on 08 Jan, 2015 05:39 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac