Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Addition of days |
|
Author |
|
fifimtwana
Joined: 24 Feb 2011 Posts: 22
|
Posted: Wed 09 Mar '11 10:56 Post subject: Addition of days |
|
|
Hey guys
Can some one please help me with my problem
Im creating an attendnce report using php.
On the attendance report the is different parts to the horizontal graph.
Different parts include
Total attendance
Leave
Offsite work
Sick leave
Absent/Register not signed
Ontime attendance[b]
[b]Late attendance
Next to the percentage i want to show the number of days for ech part
Now my problem is i cannot seem to get the result for number of days to be one value. Instead of getting 159 days next to total att. I get 157 + 2 days.
I used the formula :
<?PHP echo $TATT.' % ('.$OT_entry_found. + $LT_entry_found.' DAYS)'?>
Total attendance = ontime attendance + late attendance
TATT percentage =( OT + LT / total entries) * 100,2
Total entries = max_days * no_of_rows on attendance register |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 11 Mar '11 5:40 Post subject: |
|
|
instead of comma you have to use a dot.
This works to get the 159
Code: |
<?php
$TATT = 'bla ';
$OT_entry_found = 157;
$LT_entry_found = 2;
$sum = $OT_entry_found + $LT_entry_found;
echo $TATT.' % ('. $sum .' DAYS)'
?>
|
|
|
Back to top |
|
fifimtwana
Joined: 24 Feb 2011 Posts: 22
|
Posted: Fri 11 Mar '11 11:27 Post subject: |
|
|
Thanx very much James Bond, it worked like a miracle |
|
Back to top |
|
|
|
|
|
|