function display_patient_data()
 {
     if (func_num_args() > 0) {
         $arg_list = func_get_args();
         $menu_id = $arg_list[0];
         $post_vars = $arg_list[1];
         $get_vars = $arg_list[2];
     }
     $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]);
     $actual_weight = wtforage::get_body_weight($get_vars["consult_id"]);
     $ccdev_id = ccdev::registry_record_exists($patient_id);
     print "<span class='tinylight'>";
     print LBL_CCDEV_ID . ": <font color='red'>" . ($ccdev_id ? module::pad_zero($ccdev_id, 7) : "none") . "</font><br/>";
     print LBL_AGE_IN_WEEKS . ": " . ccdev::get_age_weeks($patient_id) . "<br/>";
     print LBL_WEIGHT . ": {$actual_weight}<br/>";
     list($min, $max, $class) = wtforage::_wtforage($get_vars["consult_id"]);
     if ($class) {
         print LBL_WT_FOR_AGE . ": <font color='red'>" . strtoupper($class) . "</font> (min: {$min}, max: {$max})<br/>";
     } else {
         print LBL_WT_FOR_AGE . ": <font color='red'>" . LBL_NO_WEIGHT_AVAILABLE . "</font><br/>";
     }
     print LBL_IMMUNIZATION_STATUS . ": ";
     $vacc_status = ccdev::determine_vacc_status($patient_id);
     if ($vacc_status == 'Incomplete') {
         echo "<font color='red'><b>{$vacc_status}</b></font><br>";
     } else {
         echo "<b>{$vacc_status}</b><br>";
     }
     print "CHILD PROTECTECTED AT BIRTH" . ": ";
     echo ccdev::get_cpab_status($ccdev_id, $patient_id) . "<br>";
     print "LOW BIRTH WEIGHT" . ": ";
     echo ccdev::check_low_birth_wt($ccdev_id, $patient_id) . '<br>';
     print "</span>";
 }
 function epi_alarms()
 {
     if (func_num_args() > 0) {
         $arr = func_get_args();
         $family_id = $arr[0];
         $members = $arr[1];
         $program_id = $arr[2];
     }
     $arr_px = array();
     //will contain patient id of family_members with any of the cases under indicators
     $arr_fam = array();
     foreach ($members as $key => $patient_id) {
         $arr_px = array();
         $arr_indicator = array();
         //this will contain indicator_id and array of consult_id
         $q_epi_indicators = mysql_query("SELECT alert_indicator_id,sub_indicator FROM m_lib_alert_indicators WHERE main_indicator='{$program_id}' ORDER by sub_indicator ASC") or die("Cannot query 475: " . mysql_error());
         $q_epi = $this->check_ccdev_enrollment($patient_id);
         if (mysql_num_rows($q_epi) != 0) {
             list($ccdev_id, $dob) = mysql_fetch_array($q_epi);
             //echo $ccdev_id.' '.$patient_id.' '.$dob.'<br>';
             while (list($indicator_id, $sub_indicator) = mysql_fetch_array($q_epi_indicators)) {
                 $arr_case_id = array();
                 //this will contain the consult_id and enrollment id's
                 $arr_definition = $this->get_alert_definition($indicator_id);
                 //composed of defition id, days before and after.
                 $alert_id = $arr_definition[0];
                 $days_before = $arr_definition[1];
                 $days_after = $arr_definition[2];
                 $date_today = date('Y-m-d');
                 switch ($indicator_id) {
                     case '7':
                         //BCG immunization
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'BCG');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('BCG');
                         break;
                     case '8':
                         //DPT1 immunization
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'DPT1');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('DPT1');
                         break;
                     case '9':
                         //DPT2 immunization
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'DPT2');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('DPT2', $patient_id, $dob);
                         break;
                     case '10':
                         //DPT3 immunization
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'DPT3');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('DPT3', $patient_id, $dob);
                         break;
                     case '11':
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'OPV1');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('OPV1');
                         break;
                     case '12':
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'OPV2');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('OPV2', $patient_id, $dob);
                         break;
                     case '13':
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'OPV3');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('OPV3', $patient_id, $dob);
                         break;
                     case '14':
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'HEPB1');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('HEPB1');
                         break;
                     case '15':
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'HEPB2');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('HEPB2', $patient_id, $dob);
                         break;
                     case '16':
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'HEPB3');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('HEPB3', $patient_id, $dob);
                         break;
                     case '17':
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'MSL');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('MSL');
                         break;
                     case '18':
                         //FIC
                         //$eligibility = $this->check_vaccine_eligibility($patient_id,$dob,'MSL');
                         $eligibility = (eregi('FIC', ccdev::determine_vacc_status($patient_id)) ? false : true) && $this->get_patient_age($patient_id) > 0;
                         $buffer_day = '365';
                         break;
                     case '19':
                         //CIC
                         if (eregi('CIC', ccdev::determine_vacc_status($patient_id)) == true && eregi('FIC', ccdev::determine_vacc_status($patient_id)) == false) {
                             $buffer_day = '365';
                             $eligibility = true;
                         } else {
                             $eligibility = false;
                         }
                         break;
                     case '41':
                         //PENTA1
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'PENTA1');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('PENTA1');
                         break;
                     case '42':
                         //PENTA2
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'PENTA2');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('PENTA2', $patient_id, $dob);
                         break;
                     case '43':
                         //PENTA3
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'PENTA3');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('PENTA3', $patient_id, $dob);
                         break;
                     case '44':
                         //MMR
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'MMR');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('MMR');
                         break;
                     case '45':
                         //ROTA 1
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'ROTA');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('ROTA');
                         break;
                     case '46':
                         //ROTA 2
                         $eligibility = $this->check_vaccine_eligibility($patient_id, $dob, 'ROTA2');
                         $buffer_day = $this->get_vaccine_min_age_eligibility('ROTA2', $patient_id, $dob);
                         break;
                     default:
                         break;
                 }
                 //end switch
                 if ($eligibility == true) {
                     $base_date = date('Y/m/d', strtotime(date("Y-m-d", strtotime($dob)) . " +" . $buffer_day . " day"));
                     array_push($arr_case_id, $ccdev_id, $base_date);
                 }
                 if (!empty($arr_case_id)) {
                     array_push($arr_indicator, array($indicator_id => $arr_case_id));
                 }
             }
             //end while
             if (!empty($arr_indicator)) {
                 array_push($arr_px, array($patient_id => $arr_indicator));
                 array_push($arr_fam, $arr_px);
             }
         }
     }
     //end for each
     return $arr_fam;
 }