Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table>
- <thead>
- <tr>
- <th>Task</th>
- <th>Status</th>
- <th>Date</th>
- <th>Day</th>
- <th>Earning</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $i=1;
- $total_weekly_pay=0;
- while ($money = $selectprospectsqueryResult->fetch_assoc()){$i++;
- $task = 'Outbound call';
- $status = $money['call_status'];
- //format dates
- $date = $money['last_update'];
- $datetime = new DateTime($date);
- $day = $datetime->format('l');
- if($status == 'Success'){
- $pay = 0.25;
- $bonus = 5.00;
- $earning = $pay + $bonus;
- }else{
- $pay = 0.25;
- $earning = $pay;
- }
- //get week of date
- $this_week = date("W", strtotime($date));
- //get year of date
- $this_year = date("Y", strtotime($date));
- //this monday of date
- $this_monday_date = new DateTime();
- $this_monday_date->setISODate($this_year,$this_week);
- $this_monday = $this_monday_date->format('Y-m-d');
- //this sunday of date
- //calculate -1 day to find sunday of the same given week
- $sundate = strtotime($this_monday);
- $newsundate = strtotime("-1 day", $sundate);
- $this_sunday = date('Y-m-d', $newsundate);
- //echo ' to ' ;//testing
- //calculate +6 days to find saturday of the same given week
- $saturdate = strtotime($this_sunday);
- $newsaturdate = strtotime("+6 day", $saturdate);
- $this_saturday = date('Y-m-d', $newsaturdate);
- //echo ' <br> ' ;//testing
- //format the given call date
- $new_date_format = date( 'Y-m-d', strtotime($date)) ;
- //create array of saturdays : could be useful?
- /* $saturdays = array();
- $saturdays[0] = date('Y-m-d', strtotime('first saturday of this month'));
- $saturdays[1] = date('Y-m-d', strtotime('second saturday of this month'));
- $saturdays[2] = date('Y-m-d', strtotime('third saturday of this month'));
- $saturdays[3] = date('Y-m-d', strtotime('fourth saturday of this month'));
- $fifth = strtotime('fifth saturday of this month');
- if (date('m') === date('m', $fifth)) {
- $saturdays[4] = date('Y-m-d', $fifth);
- }*/
- echo ' <tr>
- <td>'.$task.'</td>
- <td>'.$status.'</td>
- <td>'.$date.'</td>
- <td>'.$day.'</td>
- <td>$'.$earning.'</td>
- </tr>';
- if(week_is_over){
- echo ' <tr>
- <td>-</td>
- <td>-</td>
- <td>From '.$this_sunday.' to '.$this_saturday.'</td>
- <td>Total for week</td>
- <td></td>
- </tr>';
- }
- }?>
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement