Hi Rashko,

Rashko Rejmer wrote:
Hi all, Jacopo,

I have noticed couple of issues that are connected to billing accounts, but
I am not so familiar with
accounting processes and I want to ask couple of question(maybe Jacopo would
give me answers).
1. After the recent re-factoring of billing accounts every order that is
created and payed with billing account
is associated to this particular account. The invoice for this order is
associate to the account too.
I was wondering how the payment for this invoice should be applied to the
invoice and billing account:
 - only to the billing account;
 - to the billing account and invoice;
 - only to the invoice;
I think that the payment should be applied to the both, but I am not sure.

First of all, a small but important clarification: a payment can only be applied to invoices, not to billing account. However a payment can be *associated* to a billing account and this simply means that it will be applied to invoices associated to the same billing account. However, right now, the screen to *associate* a payment to a billing account is the same screen that is used to apply a payment to an invoice: I know this is a bit confusing and we will have to change this in the future (the screen should at least show a message that says "apply to invoice id:" or "associate to billing account id:").
To answer your question:
a) if you receive a payment for an invoice (i.e. the invoice is already in the system, and is associated to the billing account) you can simply apply it to the invoice as usual (the system will automatically associate it to the billing account as well) b) if you receive a payment in advance (i.e. the invoice is still not in the system) you can associate the payment to the billing account: it will increase the credit available to the customer in the billing account and when an invoice will be created and associated to the account, you will apply it to the invoice (you can do it as in the previous point #a or you can use the experimental "capture" link in the billing account->Invoices screen)


2. What is the meaning of the term "billing account available balance"? The


Many of the balance methods were used before my last refactoring and we should probably remove them. In my opinion the only one we need to have and use is BillingAccountWorker.getBillingAccountBalance(...) That method should return the right balance; all the other ones are deprecated and probably return bad numbers.

method that calculates this value
(getBillingAccountAvailableBalance) performs this formula: availableBalance = accountLimit - accountBalance;

Yes, this formula is wrong... but I don't think the method is currently used.

so if they are created orders with amount 200$, payed via billing
account(but the payments are not received yet)
and the account limit is 10000$
        availableBalance = 200$ = 10000(limit) - 9800(billing account balance);
Is this correct? I mean the name of this value.

3. What is the meaning of the term "billing account net balance"?


I don't know... I don't think the method is currently used.

4. What is the meaning of the term "amount available to capture"? The comment of the method that calculates this amount is:
        "Returns the amount of the billing account which could be captured"
the only place that this method is used is while payments are applied to
billing and there is a comment:
        "when creating a new PaymentApplication, check if there is sufficient
balance in the billing account"
but the method performs this formula:
        availableToCapture = accountLimit - accountNetBalance
If we use the mentioned situation:
        availableToCapture = 10000; because the accountNetBalance = 0;
I think that this is a little bit confusing.


Hmmm... I missed this code when I refactored the billing accounts processes; I don't think we should use the BillingAccountWorker.getBillingAccountBalance(...) call (in InvoiceServices at line 2348) and we have to probably change it to BillingAccountWorker.getBillingAccountBalance(...)

Do you have a chance to try to apply this change?

However I'm not 100% sure in the code that handles billing accounts (starting from line 2336) is correct: I've still not reviewed it.

Jacopo

Sorry about the big amount of the questions but if someone can clarify to me
these terms, that are accepted in OFBiz, maybe I would be able to create some issues, that would improve the billing
accounts behavior.

Regards,
Rashko Rejmer


Reply via email to