Example #1
0
 function form_ccdev_breastfeed()
 {
     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];
         $validuser = $arg_list[3];
         $isadmin = $arg_list[4];
     }
     $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]);
     $ccdev_id = ccdev::registry_record_exists($patient_id);
     $q_dob = mysql_query("SELECT patient_dob FROM m_patient where patient_id='{$patient_id}'") or die("Cannot query 419 " . mysql_error());
     list($patient_dob) = mysql_fetch_array($q_dob);
     if ($ccdev_id == '0') {
         print "<font color='red'>" . LBL_NO_REGISTRY_ID . "</font><br/>";
     } else {
         echo "<form name='form_ccdev_bfed' action = '" . $_SERVER["SELF"] . "?page=" . $get_vars["page"] . "&menu_id={$menu_id}&consult_id=" . $get_vars["consult_id"] . "&ptmenu=" . $get_vars["ptmenu"] . "&module=" . $get_vars["module"] . "&ccdev=BFED' method='post'>";
         echo "<table width='400'>";
         echo "<tr><td><b>BREASTFEEDING STATUS</b></td></tr>";
         echo "<tr><td><span class='tinylight'>Please tick the month if mother exclusively breastfed this\tchild. To set month 6 date to blank, just delete the contents of the date box. Dates at the end of the months are projected as well.</spans></td></tr>";
         for ($i = 1; $i < 7; $i++) {
             $field = 'bfed_month' . $i;
             $buffer_day = $i * 30;
             $month_date = alert::compute_buffer_date($patient_dob, $buffer_day);
             $q_field = mysql_query("SELECT {$field}, bfed_month6_date FROM m_patient_ccdev WHERE ccdev_id='{$ccdev_id}'") or die("Cannot query: 433");
             list($bfed_status, $bfed_date) = mysql_fetch_array($q_field);
             echo "<tr><td>";
             if ($bfed_status == 'Y') {
                 echo "<input type='checkbox' name='bfed_month[]' value='{$i}' checked>Month {$i} ({$month_date})</input>";
             } else {
                 echo "<input type='checkbox' name='bfed_month[]' value='{$i}'><font color='red'>Month {$i} ({$month_date})</font></input>";
             }
             if ($i == 6) {
                 if ($bfed_date == '0000-00-00') {
                     $bfed_six_value = '';
                 } else {
                     list($y, $m, $d) = explode('-', $bfed_date);
                     $bfed_six_value = $m . '/' . $d . '/' . $y;
                 }
                 echo "&nbsp;&nbsp;&nbsp;<input type='text' name='date_bfed_six' size='7' value='{$bfed_six_value}'>&nbsp;";
                 echo "<a href=\"javascript:show_calendar4('document.form_ccdev_bfed.date_bfed_six', document.form_ccdev_bfed.date_bfed_six.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a><br>";
                 echo "</input>";
             }
             echo "</td></tr>";
         }
         echo "<tr><td><input type='submit' name='submitccdev' value='Save Breastfeeding Status' style='border: 1px solid #000000'>&nbsp;<input type='reset' name='reset' value='Reset' style='border: 1px solid #000000'></td></tr>";
         echo "</table>";
         echo "</form>";
     }
 }