You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by "skip@theDevers" <sk...@thedevers.org> on 2007/10/30 06:09:03 UTC

Billing Accounts

Hi Jacopo

I have two questions concerning billing accounts.  Account balances are
computed in BillingAccountWorker.getBillingAccountBalance().  This routine
uses an algorithm that subtracts the sum of OrderPaymentPreference.maxAmount
where the statusId is "PAYMENT_NOT_RECEIVED" (and a few others).

What I am wondering is why this entity was chosen over the sum of Invoices
outstanding which to me makes more sense.  Maybe this way is faster?


Second, in the same file is getBillingAccountNetBalance() which returns the
sum of PaymentApplication.  The comment sez this "Calculates the net balance
of a billing account, which is sum of all amounts applied to invoices minus
sum of all amounts applied from payments".  If you write an order against a
BillingAccount, PaymentApplication is empty after an invoice is created, so
I don't see the value of this function.  Maybe I am misinterpreting the name
"getBillingAccountNetBalance".  However, getBillingAccountAvailableBalance
returns the billing account limit - getBillingAccountNetBalance, so I would
have thought that getBillingAccountBalance() would =
getBillingAccountAvailableBalance if there are no uninvoiced Orders.

Note that I see that  getBillingAccountAvailableBalance is commented out in
the one place it is used in favor of getBillingAccountBalance().

I am thinking of re-writing the  getBillingAccountNetBalance()  to use
Invoice because that, along with Payment is the basis for statements sent to
customers and it makes sense to me from a data consistancy standpoint.

Am I barking up the wrong tree?

Skip



Backorder Question

Posted by "skip@theDevers" <sk...@thedevers.org>.
Can anyone tell me how to create a backorder?  I created an order for 1
GZ-1001 and 1 WG-1111.  Because there are no GZ-1001s, I expected to find a
Requirement created but did not in spite of the fact that the Order sez [1
Backordered].

Also, are there other entities involved besides Requirement?

Skip


RE: Billing Accounts

Posted by "skip@theDevers" <sk...@thedevers.org>.
Yep, already got this done, except that it also provides a list of payments
in the statement period.  Just gotta check this all out with a few returns
and stuff to make sure it all works.

Thanks for all your help BTW in case I forgot to say it before.

Skip

-----Original Message-----
From: Jacopo Cappellato [mailto:tiz@sastau.it]
Sent: Monday, October 29, 2007 10:26 PM
To: user@ofbiz.apache.org
Subject: Re: Billing Accounts


Sorry,

I've missed the following statement:

skip@theDevers wrote:
>
> I am thinking of re-writing the  getBillingAccountNetBalance()  to use
> Invoice because that, along with Payment is the basis for statements sent
to
> customers and it makes sense to me from a data consistancy standpoint.
>

Wouldn't be better to provide a report to the customer about the balance
of a billing account with the following information:

==== billing account id (and other info) ====
account limit

* list of open invoices associated to the account with outstanding amount

* total outstanding amount

* difference between account limit and total outstanding amount

(optionally you could also include the list of unapplied payments, if any).

Of course you can create a new helper method in the BillingAccountWorker
class to help you to run the total, but it is important to use this only
for reporting purposes (and maybe it is easier to run the total directly
in your report); the reasons are in my last email.

Jacopo





Re: Billing Accounts

Posted by Jacopo Cappellato <ti...@sastau.it>.
Sorry,

I've missed the following statement:

skip@theDevers wrote:
> 
> I am thinking of re-writing the  getBillingAccountNetBalance()  to use
> Invoice because that, along with Payment is the basis for statements sent to
> customers and it makes sense to me from a data consistancy standpoint.
> 

Wouldn't be better to provide a report to the customer about the balance 
of a billing account with the following information:

==== billing account id (and other info) ====
account limit

* list of open invoices associated to the account with outstanding amount

* total outstanding amount

* difference between account limit and total outstanding amount

(optionally you could also include the list of unapplied payments, if any).

Of course you can create a new helper method in the BillingAccountWorker 
class to help you to run the total, but it is important to use this only 
for reporting purposes (and maybe it is easier to run the total directly 
in your report); the reasons are in my last email.

Jacopo




RE: Billing Accounts

Posted by "skip@theDevers" <sk...@thedevers.org>.
Hmmm, now I am beginning to understand why Si wants to make a
PaymentApplication when an invoice is created.  Both are "messy", but I
guess I like your way better.

 I was just thinking of using the delta of OrderItem and OrderItemBilling,
but, because this value is only used in an advisory capacity, maybe getting
too clever isn't justified.  But I am gonna think on it some more.

Skip

-----Original Message-----
From: Jacopo Cappellato [mailto:tiz@sastau.it]
Sent: Monday, October 29, 2007 10:17 PM
To: user@ofbiz.apache.org
Subject: Re: Billing Accounts


Hi Skip,

skip@theDevers wrote:
> Hi Jacopo
>
> I have two questions concerning billing accounts.  Account balances are
> computed in BillingAccountWorker.getBillingAccountBalance().  This routine
> uses an algorithm that subtracts the sum of
OrderPaymentPreference.maxAmount
> where the statusId is "PAYMENT_NOT_RECEIVED" (and a few others).
>
> What I am wondering is why this entity was chosen over the sum of Invoices
> outstanding which to me makes more sense.  Maybe this way is faster?
>

Actually, that was the initial plan. Unfortunately, when you create an
order, and the customer asks to 'pay' it with a billing account we have
to consider this and adjust the billing account balance immediately (if
not, the customer could enter a lot of orders exceeding the billing
account credit/limit) ... but there is still no invoice for the order
(that is created when the order is shipped).

>
> Second, in the same file is getBillingAccountNetBalance() which returns
the
> sum of PaymentApplication.  The comment sez this "Calculates the net
balance
> of a billing account, which is sum of all amounts applied to invoices
minus
> sum of all amounts applied from payments".  If you write an order against
a
> BillingAccount, PaymentApplication is empty after an invoice is created,
so
> I don't see the value of this function.  Maybe I am misinterpreting the
name
> "getBillingAccountNetBalance".  However, getBillingAccountAvailableBalance
> returns the billing account limit - getBillingAccountNetBalance, so I
would
> have thought that getBillingAccountBalance() would =
> getBillingAccountAvailableBalance if there are no uninvoiced Orders.

Many of the methods in that class were created before the last
refactoring of the billing accounts and they will be removed soon: sorry
for the confusion. If I well remember there is only one balance method
that is still valid, all the other ones are deprecated.

Jacopo

>
> Note that I see that  getBillingAccountAvailableBalance is commented out
in
> the one place it is used in favor of getBillingAccountBalance().
>
> I am thinking of re-writing the  getBillingAccountNetBalance()  to use
> Invoice because that, along with Payment is the basis for statements sent
to
> customers and it makes sense to me from a data consistancy standpoint.
>
> Am I barking up the wrong tree?
>
> Skip
>




Re: Billing Accounts

Posted by Jacopo Cappellato <ti...@sastau.it>.
Hi Skip,

skip@theDevers wrote:
> Hi Jacopo
> 
> I have two questions concerning billing accounts.  Account balances are
> computed in BillingAccountWorker.getBillingAccountBalance().  This routine
> uses an algorithm that subtracts the sum of OrderPaymentPreference.maxAmount
> where the statusId is "PAYMENT_NOT_RECEIVED" (and a few others).
> 
> What I am wondering is why this entity was chosen over the sum of Invoices
> outstanding which to me makes more sense.  Maybe this way is faster?
> 

Actually, that was the initial plan. Unfortunately, when you create an 
order, and the customer asks to 'pay' it with a billing account we have 
to consider this and adjust the billing account balance immediately (if 
not, the customer could enter a lot of orders exceeding the billing 
account credit/limit) ... but there is still no invoice for the order 
(that is created when the order is shipped).

> 
> Second, in the same file is getBillingAccountNetBalance() which returns the
> sum of PaymentApplication.  The comment sez this "Calculates the net balance
> of a billing account, which is sum of all amounts applied to invoices minus
> sum of all amounts applied from payments".  If you write an order against a
> BillingAccount, PaymentApplication is empty after an invoice is created, so
> I don't see the value of this function.  Maybe I am misinterpreting the name
> "getBillingAccountNetBalance".  However, getBillingAccountAvailableBalance
> returns the billing account limit - getBillingAccountNetBalance, so I would
> have thought that getBillingAccountBalance() would =
> getBillingAccountAvailableBalance if there are no uninvoiced Orders.

Many of the methods in that class were created before the last 
refactoring of the billing accounts and they will be removed soon: sorry 
for the confusion. If I well remember there is only one balance method 
that is still valid, all the other ones are deprecated.

Jacopo

> 
> Note that I see that  getBillingAccountAvailableBalance is commented out in
> the one place it is used in favor of getBillingAccountBalance().
> 
> I am thinking of re-writing the  getBillingAccountNetBalance()  to use
> Invoice because that, along with Payment is the basis for statements sent to
> customers and it makes sense to me from a data consistancy standpoint.
> 
> Am I barking up the wrong tree?
> 
> Skip
>