[freeside] Intended use of 'closed' field in cust_bill and
friends. (1.4.0pre13)
baloo at gimpgirl.com
baloo at gimpgirl.com
Thu May 30 23:11:51 PDT 2002
On Thu, 30 May 2002, ivan wrote:
> On Sat, May 25, 2002 at 05:58:39AM -0700, baloo at gimpgirl.com wrote:
(snip somewhat shaky reasoning, that nonetheless led me to a correct
conclusion).
> > which confirm my suspicion that the 'closed' field is unused, and that
> > 'open' in that message means "owed/unapplied/credited > 0"(*), not 'closed
> > isnull or closed != "Y"'.
>
> Correct.
(more snipping)
> > update cust_bill set closed = "Y"
> > where date <= (timestamp for end of financial year)
> > and charged = coalesce(sum(select amount from cust_credit_bill
> > where cust_credit_bill.invnum =
> > = cust_bill.invnum), 0)
> > + coalesce(sum(select amount from cust_bill_pay
> > where cust_bill_pay.invnum
> > = cust_bill.invnum), 0)
> >
> > and ditto with suitable changes for payments, credits, and refunds.
>
> Other than the fact that modifying the database directly bypasses the
> history mechanism, that's the basic idea, yes. Use the perl API.
OK. Hmm, I saw that pre12 added history tables, but didn't see any
description of their role. Is there a FM I could R? Or is it still a gleam
in soneone's eye?
> (Yes, the ideal way to keep history would be with triggers in the
> database. I'm still under the delusion that we might support MySQL again
> someday, and it doesn't have triggers yet.)
Ask, and ye shall receive. :-)
http://www.mysql.com/documentation/mysql/bychapter/manual_Introduction.html
#Nutshell_4.1_development_release
http://www.mysql.com/documentation/mysql/bychapter/manual_Introduction.html
#Nutshell_Stepwise_Rollout
Looks like they plan to add everything you want, assuming stored
procedures would work as triggers. But perhaps you knew that already. (And
integrity constraints too! Yay integrity! :-) )
> [wrt cust_bill.owed]
> > 'open' in that message means "owed/unapplied/credited > 0"(*)
> >
> > (*) BTW, there's no mention of a corresponding method for refunds in the
> > documentation, or anything in the source that looks like it. Oversight? Or
> > complete trust that although customers sometimes pay more than they owe,
> > accounts clerks never make that mistake? :-)
>
> Sorry, don't understand your question here.
cust_bill.pm has owed and cust_pay.pm has unapplied. cust_credit.pm has
credited. If cust_refund is to cust_credit what cust_pay is to cust_bill,
there should be a method in cust_refund that matches what unapplied in
cust_pay does. Or am I missing something?
More information about the freeside-users
mailing list