function checkbox_ptgroup() {
     if (func_num_args()) {
         $arg_list = func_get_args();
         $age = $arg_list[0];
         $gender = $arg_list[1];
     }
     $sql = "select ptgroup_id, ptgroup_name, ptgroup_condition ".
            "from m_lib_ptgroup order by ptgroup_name";
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while(list($id, $name, $cond) = mysql_fetch_array($result)) {
                 if (strlen($cond)>0) {
                     if (eregi('is_childbearing_age',$cond)) {
                         if (ptgroup::is_childbearing_age($age, $gender)) {
                             print "<input type='checkbox' name='ptgroup[]' value='$id'> $name<br/>";
                         }
                     } elseif (eregi('is_child', $cond)) {
                         if (ptgroup::is_child($age)) {
                             print "<input type='checkbox' name='ptgroup[]' value='$id'> $name<br/>";
                         }
                     }
                 } else {
                     print "<input type='checkbox' name='ptgroup[]' value='$id'> $name<br/>";
                 }
             }
         }
     }
 }
Esempio n. 2
0
 function checkbox_ptgroup()
 {
     if (func_num_args()) {
         $arg_list = func_get_args();
         $age = $arg_list[0];
         $gender = $arg_list[1];
     }
     $sql = "select ptgroup_id, ptgroup_name, ptgroup_condition " . "from m_lib_ptgroup order by ptgroup_name";
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while (list($id, $name, $cond) = mysql_fetch_array($result)) {
                 if (strlen($cond) > 0) {
                     if (eregi('is_childbearing_age', $cond)) {
                         if (ptgroup::is_childbearing_age($age, $gender)) {
                             print "<input type='checkbox' name='ptgroup[]' value='{$id}'> {$name}<br/>";
                         }
                     } elseif (eregi('is_child', $cond)) {
                         if (ptgroup::is_child($age)) {
                             print "<input type='checkbox' name='ptgroup[]' value='{$id}'> {$name}<br/>";
                         }
                     }
                 } else {
                     if ($id == 'FP' && ($age >= 50 || $age <= 14)) {
                         //do not display FP checkbox if patient is >=50 or <=14
                     } else {
                         print "<input type='checkbox' name='ptgroup[]' value='{$id}'> {$name}<br/>";
                     }
                 }
             }
         }
     }
 }