Re: [Emerald] Re: download charges

Dale E. Reed Jr. ( (no email) )
Tue, 19 Oct 1999 10:23:13 -0700 wrote:
> the basic idea is that we have an account that offers unlimitted hours but
> restricted download. "Download" is defined as any data that is transfered
> from our service to the clients PC. We need to measure this data each month
> and generate an "excess" charge based on download that is in excess
> of a stated byte count (say 100Mbytes).

The data is already collected in the Calls table. Emerald 2.5 doesn't
have the native ability to charge on it, but you might be able to come
up with a way to sum the AcctOutputOctets and create charges. For
example, the below can be scheduled to run on the 1st of each month,
to do the usage billing.

Create Procedure Calc_Usage_Charges as

DECLARE @limit as int, @overcharge as money, @startdate as datetime,
@enddate as datetime
Select @limit = 100, @overcharge = 1,
@enddate=convert(varchar(2), DatePart(Month, GetDate())) + '/01/'+
convert(varchar(4), DatePart(Year, GetDate())),
@startdate=DateAdd(Month, -1, @enddate)

Select Username, MBSent=(sum(AcctOutputOctets))/1024000
Into #tmp_charges