Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. <table>
  2. <thead>
  3. <tr>
  4. <th>Task</th>
  5. <th>Status</th>
  6. <th>Date</th>
  7. <th>Day</th>
  8. <th>Earning</th>
  9.  
  10. </tr>
  11. </thead>
  12. <tbody>
  13. <?php
  14. $i=1;
  15. $total_weekly_pay=0;
  16. while ($money = $selectprospectsqueryResult->fetch_assoc()){$i++;
  17.  
  18.  
  19. $task = 'Outbound call';
  20. $status = $money['call_status'];
  21. //format dates
  22. $date = $money['last_update'];
  23. $datetime = new DateTime($date);
  24. $day = $datetime->format('l');
  25.  
  26.  
  27. if($status == 'Success'){
  28.  
  29. $pay = 0.25;
  30. $bonus = 5.00;
  31. $earning = $pay + $bonus;
  32.  
  33. }else{
  34. $pay = 0.25;
  35. $earning = $pay;
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42. //get week of date
  43. $this_week = date("W", strtotime($date));
  44. //get year of date
  45. $this_year = date("Y", strtotime($date));
  46.  
  47. //this monday of date
  48. $this_monday_date = new DateTime();
  49. $this_monday_date->setISODate($this_year,$this_week);
  50. $this_monday = $this_monday_date->format('Y-m-d');
  51.  
  52. //this sunday of date
  53. //calculate -1 day to find sunday of the same given week
  54. $sundate = strtotime($this_monday);
  55. $newsundate = strtotime("-1 day", $sundate);
  56. $this_sunday = date('Y-m-d', $newsundate);
  57. //echo ' to ' ;//testing
  58. //calculate +6 days to find saturday of the same given week
  59. $saturdate = strtotime($this_sunday);
  60. $newsaturdate = strtotime("+6 day", $saturdate);
  61. $this_saturday = date('Y-m-d', $newsaturdate);
  62. //echo ' <br> ' ;//testing
  63.  
  64. //format the given call date
  65. $new_date_format = date( 'Y-m-d', strtotime($date)) ;
  66.  
  67. //create array of saturdays : could be useful?
  68. /* $saturdays = array();
  69. $saturdays[0] = date('Y-m-d', strtotime('first saturday of this month'));
  70. $saturdays[1] = date('Y-m-d', strtotime('second saturday of this month'));
  71. $saturdays[2] = date('Y-m-d', strtotime('third saturday of this month'));
  72. $saturdays[3] = date('Y-m-d', strtotime('fourth saturday of this month'));
  73. $fifth = strtotime('fifth saturday of this month');
  74. if (date('m') === date('m', $fifth)) {
  75. $saturdays[4] = date('Y-m-d', $fifth);
  76. }*/
  77.  
  78. echo ' <tr>
  79.  
  80. <td>'.$task.'</td>
  81.  
  82. <td>'.$status.'</td>
  83.  
  84. <td>'.$date.'</td>
  85.  
  86. <td>'.$day.'</td>
  87.  
  88. <td>$'.$earning.'</td>
  89.  
  90. </tr>';
  91.  
  92.  
  93. if(week_is_over){
  94.  
  95. echo ' <tr>
  96.  
  97. <td>-</td>
  98.  
  99. <td>-</td>
  100.  
  101. <td>From '.$this_sunday.' to '.$this_saturday.'</td>
  102.  
  103. <td>Total for week</td>
  104.  
  105. <td></td>
  106.  
  107. </tr>';
  108.  
  109. }
  110.  
  111.  
  112. }?>
  113.  
  114. </tbody>
  115. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement