if ($row_mp_detail['grandparent_id'] != -1) {
     $mp_string .= ' or s.marking_period_id=' . $row_mp_detail[1]['GRANDPARENT_ID'] . '';
 }
 # -------------------------- Date Function Start ------------------------------- #
 function cov_date($dt)
 {
     $temp_date = explode("-", $dt);
     $final_date = $temp_date[1] . '-' . $temp_date[2] . '-' . $temp_date[0];
     return $final_date;
 }
 # -------------------------- Date Function End ------------------------------- #
 if (count($RET_stu)) {
     $handle = PDFStart();
     foreach ($RET_stu as $student_id => $courses) {
         echo "<table width=100%  style=\" font-family:Arial; font-size:12px;\" >";
         echo "<tr><td  style=\"font-size:15px; font-weight:bold; padding-top:20px;\">" . GetSchool(UserSchool()) . "<div style=\"font-size:12px;\">Student Daily Schedule</div></td><td style=\"font-size:15px; font-weight:bold; padding-top:20px;\"> Schedule for: " . $row_mp_detail[1]['TITLE'] . " : " . cov_date($row_mp_detail[1]['START_DATE']) . " - " . cov_date($row_mp_detail[1]['END_DATE']) . "</td><td align=right style=\"padding-top:20px;\">" . ProperDate(DBDate()) . "</td></tr><tr><td colspan=4 style=\"border-top:1px solid #333;\">&nbsp;</td></tr></table>";
         # --------------------------------------- Start Change ------------------------------------------- #
         $st_data = DBGet(DBQuery("SELECT * FROM students WHERE student_id = " . $courses[1]['STUDENT_ID']));
         unset($_openSIS['DrawHeader']);
         echo '<br>';
         echo '<table  border=0>';
         echo '<tr><td>Student ID:</td>';
         echo '<td>' . $courses[1]['STUDENT_ID'] . '</td></tr>';
         echo '<tr><td>Student Name:</td>';
         echo '<td><b>' . $courses[1]['FULL_NAME'] . '</b></td></tr>';
         echo '<tr><td>' . $courses[1]['GRD_LVL'] . '</td>';
         echo '<td>' . $st_data[1]['CUSTOM_10'] . '</td></tr>';
         echo '</table>';
         $sch_exist = DBGet(DBQuery("SELECT COUNT(s.id) AS SCH_COUNT FROM schedule s WHERE s.syear=" . UserSyear() . "\r\n\t\t\t\t\tAND s.student_id='" . $courses[1]['STUDENT_ID'] . "'\r\n\t\t\t\t\tAND s.school_id=" . UserSchool() . "\r\n\t\t\t\t\tAND {$mp_string} )"));
         $sch_exist_yn = $sch_exist[1]['SCH_COUNT'];
         if ($sch_exist_yn != 0) {
 if ($row_mp_detail['grandparent_id'] != -1) {
     $mp_string .= ' or s.marking_period_id=' . $row_mp_detail['grandparent_id'] . '';
 }
 # -------------------------- Date Function Start ------------------------------- #
 function cov_date($dt)
 {
     $temp_date = explode("-", $dt);
     $final_date = $temp_date[1] . '-' . $temp_date[2] . '-' . $temp_date[0];
     return $final_date;
 }
 # -------------------------- Date Function End ------------------------------- #
 if (count($RET_stu)) {
     $handle = PDFStart();
     foreach ($RET_stu as $student_id => $courses) {
         echo "<table width=100%  style=\" font-family:Arial; font-size:12px;\" >";
         echo "<tr><td width=105>" . DrawLogo() . "</td><td  style=\"font-size:15px; font-weight:bold; padding-top:20px;\">" . GetSchool(UserSchool()) . "<div style=\"font-size:12px;\">" . _('Student Daily Schedule') . "</div></td><td style=\"font-size:15px; font-weight:bold; padding-top:20px;\"> " . _('Schedule for') . ": " . $row_mp_detail['title'] . " : " . cov_date($row_mp_detail['start_date']) . " - " . cov_date($row_mp_detail['end_date']) . "</td><td align=right style=\"padding-top:20px;\">" . ProperDate(DBDate()) . "<br />" . _('Powered by openSIS') . "</td></tr><tr><td colspan=4 style=\"border-top:1px solid #333;\">&nbsp;</td></tr></table>";
         # --------------------------------------- Start Change ------------------------------------------- #
         $st_data = DBGet(DBQuery("SELECT * FROM students WHERE student_id = " . $courses[1]['STUDENT_ID']));
         unset($_openSIS['DrawHeader']);
         echo '<br>';
         echo '<table  border=0>';
         /*echo '<tr><td>Student ID:</td>';
         		echo '<td>'.$courses[1]['STUDENT_ID'] .'</td></tr>';*/
         echo '<tr><td>' . _('Student ID') . ':</td>';
         echo '<td>' . $courses[1]['STUDENT_ID'] . '</td></tr>';
         echo '<tr><td>' . _('Student Name') . ':</td>';
         echo '<td><b>' . $courses[1]['FULL_NAME'] . '</b></td></tr>';
         echo '<tr><td>' . $courses[1]['GRD_LVL'] . '</td>';
         echo '<td>' . $st_data[1]['CUSTOM_10'] . '</td></tr>';
         echo '</table>';
         $sch_exist = DBGet(DBQuery("SELECT COUNT(s.id) AS SCH_COUNT FROM schedule s WHERE s.syear=" . UserSyear() . "\n\t\t\t\t\tAND s.student_id='" . $courses[1]['STUDENT_ID'] . "'\n\t\t\t\t\tAND s.school_id=" . UserSchool() . "\n\t\t\t\t\tAND {$mp_string} )"));