Re: [Emerald] Invoicing?

Dale E. Reed Jr. ( (no email) )
Sat, 18 Sep 1999 07:47:03 -0700

Emerald wrote:
>
> I've been trying to track down why radusers doesn't pull some customers,
> what I found is that balance forward accounts don't get accepted because
> they have no ma.expiredate
>
> Is there some reason it does things this way?

Because it was originally written for 2.2, which required an Expire
Date for Everything.

> I tried to modify the below script so it would extract balance forward
> billing customers as well as the normal bunch but it doesn't seem to work,
> anyone done this already?

The change you made is correct. However, you might want to add the
extensions in as well.

> CREATE PROCEDURE RU_RATC AS
> SELECT sa.Login, sa.Password, sa.AccountType, MasterExpire=DateAdd(Day,
> ma.Extension, maExpireDate),
> SubExpire=DateAdd(Day, sa.Extension, saExpireDate)
> From MasterAccounts ma, SubAccounts sa
> Where ma.CustomerID = sa.CustomerID
> AND (maExpireDate >= GetDate() or maExpireDate is NULL) <-this was my
> change
> AND sa.Login is not null
> AND ma.Active = 1 AND sa.Active = 1
> AND NOT EXISTS (
> Select * From RadConfigs rc where sa.AccountID = rc.AccountID
> )
> AND EXISTS (
> Select * From RadATConfigs at where sa.AccountType = at.AccountType
> )
>
> that script appears to do the right thing, but then the following one
> doesn't pull the same bunch for everyone with rad attributes
>
> SELECT sa.Login, sa.Password, ra.Name, ra.Type, rc.Data, rc.Value,
> rc.RadCheck,
> MasterExpire=DateAdd(Day, ma.Extension, maExpireDate),
> SubExpire=DateAdd(Day, sa.Extension, saExpireDate)
> From MasterAccounts ma, SubAccounts sa, RadConfigs rc, RadAttributes ra
> Where ma.CustomerID = sa.CustomerID
> AND rc.AccountID = sa.AccountID
> AND ra.RadAttributeID = rc.RadAttributeID
> AND sa.Login is not null
> AND (maExpireDate >= GetDate() or maExpireDate is NULL)
> AND ma.Active = 1 AND sa.Active = 1
> Order BY sa.Login, rc.RadCheck DESC

Those both look correct, except that maybe the extension isn't being
used. You would do something like:

AND (DateAdd(Day, (ma.Extension+ma.OverDue),maExpireDate) >= GetDate()
or maExpireDate is NULL)

-- 

Dale E. Reed Jr. Emerald and RadiusNT__________________________________________IEA Software, Inc. www.iea-software.com

For more information about this list (including removal) go to:http://www.iea-software.com/support/maillists/liststart