Friday, March 30, 2012

Invoice calcualtion

hi!

i actually have more than question related to the SQL Server 2000

1) On my systemI charge users for using an online service (SMS ) and I have a monthly fees charge and monthly allowance usage so if they exceed the limit I can also charge them for over usage this is an example for a rate that I have in my Rate Table

Rate Id = 1

MonthlyFees £10.0

MothlyAllowence = 100 sms/ month

Extra usage = 0.12 p for each extra SMS

The system should calculate the monthly invoice from the registration date so if you register in 14 April the invoice will be generated every month at the same day (15) each month.

Now! I need to generate and calculate the invoice …..Where shall I do the calculation? In the Business object Layer or in somewhere else? And for invoicing the client every month I might have 20 clients and each one might have different day so the billing should be auto generated also what properties or methods that can calculate or check monthly related to the day so it will run in the way like the phone bill!! any advice is appreciate it!

Did you mean you want to caculate monthly invoice for each client? If so, we can accomplish in SQL server, using such T-SQL script to get the monthly statistics:

select sum(MonthlyFees),max(RecDate),max(clientID) from [Rate Table]
group by clientID,year(RecDate),month(RecDate)

I wish I didn't understand you.

sql

No comments:

Post a Comment