codebang
Posts: 74
|
| Posted: 02/04/2009, 12:41 PM |
|
Hi all..
Ok. the situation.
I have these set of fields on which i want the data to be changed periodically (every month), without my notice.
example:
I have 6 fields in which all of them are dependent of the other.
Fileds:
1) date in service.
2) life in months.
3) life remaining.
4) GBV - Gross book value.
5) NBV - Net book value
6) Depreciation.
Ok the whole picture:
i will input the date in service lets say 12/12/2006.
life in months will be:48 months.
life remaining should be the date in service - life in months.
now the GBV will be inserted manually as well as the depreciation.
the NBV will be the depreciation * life remaining - GBV.
Now i want this to be done periodically.
How should i do it, and how can it be updated automatically.
I need to write some sort of a trigger, procedure....i dunno. but the above data should be automatically changed every month.The data should not be static.
Thank you...
Salah Hafiz
|
 |
 |
damian
Posts: 838
|
| Posted: 02/04/2009, 2:50 PM |
|
there is another way to look at this - and that is to set the values for life remaining, value remaining etc programtically in your reports. you dont have to change it in your db - you can work it out at any time because you know its date in service and its life and its depreciation schedule - thus the data is static - but your report shows the info you need....
run your reports monthly - run a report to find which tools need servicing this month, run a report to find out what tools need replaciong in 6 months so you can get them ordered etc.
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
codebang
Posts: 74
|
| Posted: 02/04/2009, 10:34 PM |
|
Hey damian....
Ur solution is absolutely amazing, but when I want to implement it, my managers here said that they want the data to be dynamically changed, withing the structure of the database, just like how i mentioned earlier....
So any ideas.
Anyways, if in the end i dont find a solution, i think i need to go with ur solution..
Thank you again....
Salah Hafiz Midhat
|
 |
 |
damian
Posts: 838
|
| Posted: 02/05/2009, 12:53 AM |
|
your manager will never know
he will only see the data that your report provides
im not saying lie to your boss - just write the reports and show him - he sees what he wants to see
i am sure you can do itr the other way - but i dont know how and i havent the time to learn it for you - but i suggest you try a few google searchs on mysql and cron jobs...
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
datadoit
|
| Posted: 02/05/2009, 7:06 AM |
|
Yes, learn how to execute PHP scripts from cron (or Windows Task
Scheduler). Very important for a successful future in online database
application programming.
You can still create the logic in CodeCharge. Instead of sending the
output to HTML, you're going to send new values to the database (which I
assume other displayed reports reference).
From cron, you'll execute PHP (ie: /usr/bin/php
/var/www/yoursite.com/yourscript.php). There are other steps involved
to make it full proof, such as running it as a background process,
sending any output to a log file (or data table), etc.
Enjoy.
|
|
|
 |
codebang
Posts: 74
|
| Posted: 02/10/2009, 3:30 AM |
|
ok, now i want to know exactly how this will be programmed...
now the date in service is given like this: 12/12/2006 and the life in months=48, how do i calculate the life ramaining and how can i change the date in service or the life in months to actually calculate the life remaining, so finally the equation= date in service(-)life in months=life remaining.
If any one can solve the above i will be really grateful..
Please help out guys..
Salah Hafiz Midhat...
|
 |
 |
damian
Posts: 838
|
| Posted: 02/10/2009, 4:34 AM |
|
more like: date in service - now + life in months = life remaining
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
codebang
Posts: 74
|
| Posted: 02/10/2009, 4:41 AM |
|
?????
Please explain. Please give me some more data. Iasked how this is to be done,
How can i minus 2 dates . how can i convert them to normal numbers. Have the result and then add that to the life in months.
Please could u explain a bit more.
Thanks,
Salah Hafiz
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 02/10/2009, 8:11 AM |
|
Oh No...
Again Salah. I would be happy to develop your project for you.
Just let me know.
Have fun.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |