borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (satanic messages)Next Topic (Email notification) New Topic New Poll Post Reply
AndreaVB Forum : Off-Topic : Cybercafe idea Solved Topic
Poster Message
jonybd
Level: Master

Registered: 18-01-2005
Posts: 115

icon Cybercafe idea

Dear Analyst,
how could be a price plane can be done in database , in cyber cafe ? like if someone want to have price or something else. what should be the idea of query and database ?

1 - 15 min  = 0.50 cent
30 min = 0.90 cent
60 = 1.50 cent

reg
coder.




____________________________
Telecommunication programmer.
Sip, Isdn - technology.

22-02-2006 at 07:46 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: Cybercafe idea

you could have a database with three fields

LowLimitMin   UpperLimitMin   Price
0                   15                   0.5
16                 30                   0.9
31                 60                   1.5

then when you want to know for the cost you can use this select

SELECT Price FROM Table WHERE @Minutes BETWEEN LowLimitMin AND UpperLimitMin

you could also add a "price per minute" value to the table in this way you'll be able to compute the exact cost for every connection time

LowLimitMin   UpperLimitMin   Price    CostPerMinute
0                   15                   0.5       0.0333
16                 30                   0.9       0.03
31                 60                   1.5       0.025

and the SP
SELECT Price,@Minutes*CostPerMinute AS Cost FROM Table WHERE @Minutes BETWEEN LowLimitMin AND UpperLimitMin


____________________________
AndreaVB

23-02-2006 at 07:48 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
jonybd
Level: Master

Registered: 18-01-2005
Posts: 115
icon Re: Cybercafe idea (solved)

Exactly , you are right. thank you.


____________________________
Telecommunication programmer.
Sip, Isdn - technology.

25-02-2006 at 12:57 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
jonybd
Level: Master

Registered: 18-01-2005
Posts: 115
icon Re: Cybercafe idea

here ... its perfect.

mysql>create table price (lowmin int(3),upmin int(3),price decimal
(4,2),permin decimal(4,2) );
mysql>insert into price values (0,15,0.50,0.02),(16,30,0.90,0.02),(31,60,1.50,0.02);

mysql> SELECT Price,15*permin AS Cost FROM price WHERE 15 BETWEEN Lowmin AND Upmin;
+-------+------+
| Price | Cost |
+-------+------+
|  0.50 | 0.30 |
+-------+------+
1 row in set (0.00 sec)

____________________________
Telecommunication programmer.
Sip, Isdn - technology.

25-02-2006 at 01:17 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Off-Topic : Cybercafe idea Solved Topic
Previous Topic (satanic messages)Next Topic (Email notification) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder