<?php include('log_entry.php'); ?> <table class="table m-0"> <thead> <tr style="color:black;"> <th style="background-color:white" width="6%"><strong>Sr.</strong></th> <th style="background-color:white" width="25%"><strong>Name</strong></th> <th style="background-color:white" width="25%"><strong>Medi. Exam. Type</strong></th> <th style="background-color:white" width="25%"><strong style="font-size: 10px; white-space: nowrap;">Previous Medi.Exam.Date</strong></th> <th style="background-color:white" width="20%"><strong>Due Date</strong></th> </tr> </thead> <tbody> <?php $sql = "select checkup_id,checkup_type_id as task,valid_upto,emp_id,checkup_date from checkup_form where emp_id in (select id from patient_master where `status`='Active') and valid_upto !='0000-00-00' and valid_upto <= curdate() + interval 30 day group by emp_id order by emp_id"; error_log("query for due date ".$sql); $result = mysqli_query($conn, $sql); ?> <?php $i = 1; while ($row = mysqli_fetch_array($result)) { $color=''; $name = getFieldFromTable('patient_name', 'patient_master', 'id', $row['emp_id']); $task = getFieldFromTable('checkup_type_name','checkup_type', 'checkup_type_id', $row['task']); $checkup_date = date_format(date_create($row['checkup_date']), "d-M-Y"); $valid_upto = date("d-m-Y", strtotime($row['valid_upto'])); $today= date('d-m-Y'); if( strtotime($today) > strtotime($valid_upto) ){ $color='#e505055c'; } else {$color='white';} error_log( $row['checkup_id'] ."name " . $name . " task " . $task . " date checkup " . $checkup_date ." exp " . $valid_upto . " color " . $color); ?> <tr style="background-color:<?= $color ?> ;" onclick="forward( <?= $row['emp_id'] ?>,'V' )"> <td><?= $i ?></td> <td><?= $name ?></td> <td><span style="padding-top:4px"><?= $task ?> </span></td> <td align="center"><?= $checkup_date ?></td> <td><?= $valid_upto ?></td> <?php $i++; ?> </tr> <?php } ?> </tbody> </table> <form name="flex_approved_patient_form" method="post" action="" id="flex_approved_patient_form"> <input type="hidden" name="emp_id" id="emp_id"> <input type="hidden" name="accessOption" id="accessOption"> <div id="flex1" style="width: 100%"> </div> </form> <script> function forward(id, action) { $("#emp_id").val(id); $("#accessOption").val(action); $("#flex_approved_patient_form").attr('method', 'POST'); if (action == 'V') { $("#flex_approved_patient_form").attr('action', 'view_employee_details.php'); } else if (action == 'E') { $("#flex_approved_patient_form").attr('action', 'edit_employee_details.php'); } $("#flex_approved_patient_form").submit(); } </script>