public function generateHTML($fieldName) { if (self::$custom_field_list == null) { self::$custom_field_list = get_custom_fields_specimen(); foreach (self::$custom_field_list as $custom_field) { if ($custom_field->flag == NULL) { array_push(self::$custom_field_name_array, $custom_field->fieldName); } } } if ($fieldName == "specimenId" || $fieldName == "Specimen ID") { CustomFieldOrderGeneration_Patient::generate_patient_Id(); } else { if ($fieldName == "comm" || $fieldName == "Comments") { CustomFieldOrderGeneration_Patient::generate_patient_addl(); } else { if ($fieldName == "Lab Reciept Date" || $fieldName == "rdate") { //CustomFieldOrderGeneration_Patient::generate_patient_rdate(); } else { if ($fieldName == "refout" || $fieldName == "Referred Out") { CustomFieldOrderGeneration_Patient::generate_patient_dailynum(); } else { if ($fieldName == "doctor" || $fieldName == "Physician") { CustomFieldOrderGeneration_Patient::generate_patient_name(); } else { if (in_array($fieldName, self::$custom_field_name_array)) { $custom_field_obj = get_custom_fields_patient_by_name($fieldName); CustomFieldOrderGeneration_Patient::generate_patient_custom_fields($custom_field_obj); } } } } } } }
function getNewSpecimenForm($form_num, $pid, $dnum, $session_num, $doc="" ,$title ="Dr.") { # Returns HTML for new specimen form LangUtil::setPageId("new_specimen"); $form_name = 'specimenform_'.$form_num; $form_id = $form_name; $form_class = 'specimenform_class'; $testbox_id = $form_id.'_testbox'; $stype_id = $form_id.'_stype'; $dnum_id = $form_id.'_dnum'; $time_id = $form_id.'_ctime'; $div_id = 'specimen_form_container_'.$form_num; $dialog_id = $div_id."_dialog"; $specimen_id_div_id = 'specimen-id_'.$form_num; $specimen_err_div_id = 'specimen_msg_'.$form_num; $doc_row_id = 'doc_row_'.$form_num; $ref_out_row_id = 'ref_out_row_'.$form_num; $ref_out_check_id = 'ref_out_'.$form_num; $lab_config = LabConfig::getById($_SESSION['lab_config_id']); ?> <div id='<?php echo $div_id; ?>'> <div class='pretty_box' style='width:530px;'> <form name='<?php echo $form_name; ?>' id='<?php echo $form_id; ?>' action='ajax/specimen_add.php?session_num=<?php echo $session_num ?>' method='post'> <input type='hidden' name='pid' value='<?php echo $pid; ?>' class='uniform_width'></input> <?php /*<input type='hidden' name='session_num' value='<?php echo get_session_number(); ?>' class='uniform_width'></input> */ ?> <table class='regn_form_table'> <tbody> <tr valign='top' <?php if(is_numeric($_SESSION['dnum']) && $_SESSION['dnum'] == 0) { # Hide if daily num not in use echo " style='display:none;' "; } ?> > <td> <label for='dnum'><?php echo LangUtil::$generalTerms['PATIENT_DAILYNUM']; ?><?php $this->getAsterisk(); ?></label> </td> <td> </td> <td> <input type="text" name="dnum" id="dnum" value=<?php echo $dnum; ?> size="20" class='uniform_width'> </input> </td> </tr> <tr valign='top'> <td> <label for='stype'><?php echo LangUtil::$generalTerms['SPECIMEN_TYPE']; ?><?php $this->getAsterisk(); ?></label> </td> <td> </td> <td> <select name='stype' id='<?php echo $stype_id; ?>' onchange="javascript:get_testbox('<?php echo $testbox_id; ?>', '<?php echo $stype_id; ?>');" class='uniform_width' > option value="">-<?php echo LangUtil::$generalTerms['CMD_SELECT']; ?>-</option> <?php $this->getSpecimenTypesSelect($_SESSION['lab_config_id']); ?> </select> </td> </tr> <tr valign='top'> <td> <label for='tests'><?php echo LangUtil::$generalTerms['TESTS']; ?> <?php $this->getAsterisk(); ?></label> </td> <td> </td> <td> <span id='<?php echo $testbox_id; ?>' class='uniform_width'> -<?php echo LangUtil::$pageTerms['MSG_SELECT_STYPE']; ?>- </span> </td> </tr> <tr valign='top'<?php //if($_SESSION['sid'] == 0) if(true) echo " style='display:none;' "; ?>> <td> <label for='sid'>DB Key <?php if($_SESSION['sid'] == 2) $this->getAsterisk(); ?></label> </td> <td> </td> <td> <!-- <input type="text" name="specimen_id" id="<?php echo $specimen_id_div_id; ?>" value="" onblur="javascript:check_specimen_id('<?php echo $specimen_id_div_id; ?>', '<?php echo $specimen_err_div_id; ?>');" size="20" class='uniform_width'> </input> --> <input type='text' name='specimen_id' id='specimen_id' value="<?php echo $form_num; ?>" readonly="readonly" class='uniform_width'> </input> <br><span id='<?php echo $specimen_err_div_id; ?>'></span> </td> </tr> <tr valign='top' <?php if($lab_config->specimenAddl == 0) echo " style='display:none;' "; ?>> <td> <label for='addlid'><?php echo LangUtil::$generalTerms['SPECIMEN_ID']; ?><?php if($_SESSION['s_addl'] == 2) $this->getAsterisk(); ?> </label> </td> <td> </td> <td> <input type="text" name="addl_id" id="addl_id" value="" size="20" class='uniform_width'> </input> </td> </tr> <tr valign='top' <?php if($_SESSION['rdate'] == 0) echo " style='display:none;' "; ?>> <td> <label><?php echo LangUtil::$generalTerms['R_DATE']; ?> <?php if($_SESSION['rdate'] == 2) $this->getAsterisk(); ?></label> </td> <td> </td> <td> <?php $today = date("Y-m-d"); $today_array = explode("-", $today); $name_list = array("receipt_yyyy", "receipt_mm", "receipt_dd"); $id_list = array($form_id."_receipt_yyyy", $form_id."_receipt_mm", $form_id."_receipt_dd"); $value_list = array($today_array[0], $today_array[1], $today_array[2]); $this->getDatePicker($name_list, $id_list, $value_list, true); ?> </td> </tr> <tr valign='top' style='display:none;'> <td> <label><?php echo LangUtil::$generalTerms['C_DATE']; ?></label> </td> <td> </td> <td> <?php $today = date("Y-m-d"); $today_array = explode("-", $today); $name_list = array("collect_yyyy", "collect_mm", "collect_dd"); $id_list = array($form_id."_collect_yyyy", $form_id."_collect_mm", $form_id."_collect_dd"); $value_list = array($today_array[0], $today_array[1], $today_array[2]); $this->getDatePicker($name_list, $id_list, $value_list, false); ?> </td> </tr> <tr valign='top' style='display:none;'> <td> <label><?php echo LangUtil::$generalTerms['C_TIME']; ?></label> </td> <td> <select name='ctime_hh' autocomplete="OFF"> <?php $time = date("H:i"); $time_parts = explode(":", $time); for($i = 0; $i < 24; $i++) { if($i < 10) $option = '0'.$i; else $option = $i; echo "<option value='$option' "; if($option == $time_parts[0]) //if($option == 9) echo "selected "; echo ">$option</option>"; } ?> </select> : <select name='ctime_mm' autocomplete="OFF"> <?php for($i = 0; $i < 60; $i++) { if($i < 10) $option = '0'.$i; else $option = $i; echo "<option value='$option' "; if($option == $time_parts[1]) //if($option == "00") echo "selected "; echo ">$option</option>"; } ?> </select> hrs </td> </tr> <tr valign='top'<?php if($_SESSION['comm'] == 0) echo " style='display:none;' "; ?>> <td> <label for='comments' valign='top'><?php echo LangUtil::$generalTerms['COMMENTS']; ?><?php if($_SESSION['comm'] == 2) $this->getAsterisk(); ?></label> </td><td> </td> <td> <textarea name="comments" id="comments" class='uniform_width'></textarea> </td> </tr> <tr valign='top' style='display:none' <?php ## Disabled for now ?>> <td> <label for='report_to' valign='top'>Report To</label> </td> <td> </td> <td> <select name='report_to' class='uniform_width'> <?php # Enable the following line if this field is to be used: echo " onchange=\"javascript:checkandtoggle(this, '$doc_row_id');\" "; ?> <option value='1'>Patient</option> <option value='2'>Doctor/Hospital</option> </select> </td> </tr> <tr valign='top' id='<?php echo $doc_row_id; ?>' <?php if($_SESSION['doctor'] == 0) echo " style='display:none;' "; ?>> <td><label for='doctor' valign='top'><?php echo LangUtil::$generalTerms['DOCTOR']; ?><?php if($_SESSION['doctor'] == 2) $this->getAsterisk(); ?></label></label> </td> <td> <SELECT name='title' id='<?php echo $doc_row_id; ?>_title'> <?php $labtitlefieldoptions = get_custom_fields_labtitle(1); $lab_titles = explode("/",$labtitlefieldoptions); foreach($lab_titles as $option) { if(trim($option) == "") continue; echo "<option value='$option'"; if($option == $field_value) { echo " selected "; } echo " >$option</option>"; } ?> </SELECT> </td> <td> <input type='text' name='doctor' id='<?php echo $doc_row_id."_input"; ?>' value='<?php echo $doc; ?>' ></input> </td> </tr> <?php $custom_field_list = get_custom_fields_specimen(); foreach($custom_field_list as $custom_field) { if(($custom_field->flag)==NULL) { ?> <tr valign='top'> <td><?php echo $custom_field->fieldName; ?></td> <td></td> <td><?php $this->getCustomFormField($custom_field); ?></td> </tr> <?php } } ?> <tr valign='top'<?php if($_SESSION['refout'] == 0) echo " style='display:none;' "; ?>> <td> <label for='ref_out' valign='top'><?php echo LangUtil::$generalTerms['REF_OUT']; ?>? <?php if($_SESSION['refout'] == 2) $this->getAsterisk(); ?></label> </td> <td> </td> <td> <INPUT TYPE=RADIO NAME="ref_out" id='<?php echo $ref_out_check_id; ?>' VALUE="Y" onchange="javascript:checkandtoggle_ref('<?php echo $ref_out_check_id; ?>', '<?php echo $ref_out_row_id; ?>');"><?php echo LangUtil::$generalTerms['YES']; ?> <INPUT TYPE=RADIO NAME="ref_out" onchange="javascript:checkandtoggle_ref('<?php echo $ref_out_check_id; ?>', '<?php echo $ref_out_row_id; ?>');" VALUE="N" checked><?php echo LangUtil::$generalTerms['NO']; ?> </td> </tr> <tr valign='top' id='<?php echo $ref_out_row_id; ?>' style='display:none'> <td><?php echo LangUtil::$generalTerms['REF_TO']; ?></td> <td> <input name='ref_out_name' class='uniform_width'></input> </td> </tr> <?php if($form_num != 1) { ?> <tr valign='top'> <td> <a href="javascript:show_dialog_box('<?php echo $div_id; ?>');"><?php echo LangUtil::$generalTerms['CMD_REMOVE']; ?></a> </td> <td> <?php $message = LangUtil::$pageTerms['MSG_SURETO_REMOVE']; $ok_function = "remove_specimenbox('$div_id')"; $cancel_function = "hide_dialog_box('$div_id')"; $this->getConfirmDialog($dialog_id, $message, $ok_function, $cancel_function, $width=200); ?> </td> </tr> <?php } ?> </tbody> </table> </form> </div> <small> <span style='float:right'> <?php $this->getAsteriskMessage(); ?> </span> </small> <br> </div> <?php }
} if (isset($_REQUEST['ref_from_name'])) { $specimen->referredFromName = $_REQUEST['ref_from_name']; } } $specimen->referredTo = 0; $specimen->reportTo = $report_to; if ($doctor != "") { $specimen->doctor = $title . $doctor; } else { $specimen->doctor = $doctor; } # Add entry to 'specimen' table add_specimen($specimen); # Add entries to 'specimen_custom_data' $custom_field_list = get_custom_fields_specimen(); foreach ($custom_field_list as $custom_field) { $custom_value = get_custom_value($custom_field); $custom_data = new SpecimenCustomData(); $custom_data->fieldId = $custom_field->id; $custom_data->fieldValue = $custom_value; $custom_data->specimenId = $specimen_id; add_custom_data_specimen($custom_data); } # Add entries to 'test' table foreach ($tests_list as $test_type_id) { $test = new Test(); $test->specimenId = $specimen_id; $test->testTypeId = $test_type_id; $test->comments = ""; $test->userId = $_SESSION['user_id'];
function getNewSpecimenForm($form_num, $pid, $dnum, $session_num, $doc="" ,$title ="Dr.", $refTo="") { # Returns HTML for new specimen form LangUtil::setPageId("new_specimen"); $form_name = 'specimenform_'.$form_num; $form_id = $form_name; $form_class = 'specimenform_class'; $testbox_id = $form_id.'_testbox'; $stype_id = $form_id.'_stype'; $dnum_id = $form_id.'_dnum'; $time_id = $form_id.'_ctime'; $div_id = 'specimen_form_container_'.$form_num; $dialog_id = $div_id."_dialog"; $specimen_id_div_id = 'specimen-id_'.$form_num; $specimen_err_div_id = 'specimen_msg_'.$form_num; $doc_row_id = 'doc_row_'.$form_num; $refTo_row_id = 'refTo_row_'.$form_num; $ref_out_row_id = 'ref_out_row_'.$form_num; $ref_out_check_id = 'ref_out_'.$form_num; $ref_from_row_id = 'ref_from_row_'.$form_num; $ref_from_check_id = 'ref_out_'.$form_num; $lab_config = LabConfig::getById($_SESSION['lab_config_id']); ?> <div id='<?php echo $div_id; ?>'> <div class='pretty_box' style='width:530px;'> <form name='<?php echo $form_name; ?>' id='<?php echo $form_id; ?>' action='ajax/specimen_add.php?session_num=<?php echo $session_num ?>' method='post'> <input type='hidden' name='pid' value='<?php echo $pid; ?>' class='uniform_width'></input> <?php /*<input type='hidden' name='session_num' value='<?php echo get_session_number(); ?>' class='uniform_width'></input> */ ?> <table class='regn_form_table'> <tbody> <?php $this->generate_patient_Number($dnum);?> <?php $this->generate_specimen_type($stype_id, $testbox_id);?> <?php $this->generate_test($testbox_id);?> <?php $specimenFieldOrder = $_SESSION['specimenFieldOrder']; $custom_field_list = get_custom_fields_specimen(); $custFieldArray = array(); foreach($custom_field_list as $custom_field) { if(($custom_field->flag)==NULL) { array_push($custFieldArray, $custom_field->fieldName); } } if(sizeOf($specimenFieldOrder) > 0){ foreach($specimenFieldOrder as $field){ if(in_array($field, $custFieldArray)){ // custom field generation $custom_field = null; foreach($custom_field_list as $custField){ if($custField->fieldName == $field){ $custom_field = $custField; } } $this->generate_customFields($custom_field); } else if($field == "Specimen ID"){ $this->generate_specimen_addId($lab_config); } /*else if($field == "Specimen Additional ID"){ <?php $this->generate_specimen_addId($lab_config);?> }*/ else if($field == "Comments"){ $this->generate_comments(); } else if($field == "Lab Reciept Date"){ $this->generate_reciept_date($lab_config, $form_id); } else if($field == "Referred Out"){ $this->generate_refOut($ref_out_check_id, $ref_out_row_id, $refTo_row_id, $ref_from_row_id, $refTo); } else if($field == "Physician"){ $this->generate_doctors($doc_row_id, $doc); } } } ?> <tr valign='top'<?php //if($_SESSION['sid'] == 0) if(true) echo " style='display:none;' "; ?>> <td> <label for='sid'>DB Key <?php if($_SESSION['sid'] == 2) $this->getAsterisk(); ?></label> </td> <td> </td> <td> <!-- <input type="text" name="specimen_id" id="<?php echo $specimen_id_div_id; ?>" value="" onblur="javascript:check_specimen_id('<?php echo $specimen_id_div_id; ?>', '<?php echo $specimen_err_div_id; ?>');" size="20" class='uniform_width'> </input> --> <input type='text' name='specimen_id' id='specimen_id' value="<?php echo $form_num; ?>" readonly="readonly" class='uniform_width'> </input> <br><span id='<?php echo $specimen_err_div_id; ?>'></span> </td> </tr> <tr valign='top' style='display:none;'> <td> <label><?php echo LangUtil::$generalTerms['C_DATE']; ?></label> </td> <td> </td> <td> <?php $today = date("Y-m-d"); $today_array = explode("-", $today); $name_list = array("collect_yyyy", "collect_mm", "collect_dd"); $id_list = array($form_id."_collect_yyyy", $form_id."_collect_mm", $form_id."_collect_dd"); $value_list = array($today_array[0], $today_array[1], $today_array[2]); $this->getDatePicker($name_list, $id_list, $value_list, false); ?> </td> </tr> <tr valign='top' style='display:none;'> <td> <label><?php echo LangUtil::$generalTerms['C_TIME']; ?></label> </td> <td> <select name='ctime_hh' autocomplete="OFF"> <?php $time = date("H:i"); $time_parts = explode(":", $time); for($i = 0; $i < 24; $i++) { if($i < 10) $option = '0'.$i; else $option = $i; echo "<option value='$option' "; if($option == $time_parts[0]) //if($option == 9) echo "selected "; echo ">$option</option>"; } ?> </select> : <select name='ctime_mm' autocomplete="OFF"> <?php for($i = 0; $i < 60; $i++) { if($i < 10) $option = '0'.$i; else $option = $i; echo "<option value='$option' "; if($option == $time_parts[1]) //if($option == "00") echo "selected "; echo ">$option</option>"; } ?> </select> hrs </td> </tr> <tr valign='top' style='display:none' <?php ## Disabled for now ?>> <td> <label for='report_to' valign='top'>Report To</label> </td> <td> </td> <td> <select name='report_to' class='uniform_width'> <?php # Enable the following line if this field is to be used: echo " onchange=\"javascript:checkandtoggle(this, '$doc_row_id');\" "; ?> <option value='1'>Patient</option> <option value='2'>Doctor/Hospital</option> </select> </td> </tr> <?php /*$custom_field_list = get_custom_fields_specimen(); foreach($custom_field_list as $custom_field) { if(($custom_field->flag)==NULL) { ?> <tr valign='top'> <td><?php echo $custom_field->fieldName; ?></td> <td></td> <td><?php $this->getCustomFormField($custom_field); ?></td> </tr> <?php } }*/ ?> <?php if($form_num != 1) { ?> <tr valign='top'> <td> <a href="javascript:show_dialog_box('<?php echo $div_id; ?>');"><?php echo LangUtil::$generalTerms['CMD_REMOVE']; ?></a> </td> <td> <?php $message = LangUtil::$pageTerms['MSG_SURETO_REMOVE']; $ok_function = "remove_specimenbox('$div_id')"; $cancel_function = "hide_dialog_box('$div_id')"; $this->getConfirmDialog($dialog_id, $message, $ok_function, $cancel_function, $width=200); ?> </td> </tr> <?php } ?> </tbody> </table> </form> </div> <small> <span style='float:right'> <?php $this->getAsteriskMessage(); ?> </span> </small> <br> </div> <?php }