// If this line had report data entry fields, filled or not, set the // "current report ID" which the following result data will link to. if (isset($_POST["form_date_report"][$lino])) { $current_report_id = $report_id; } // If there's a report, save corresponding results. if ($current_report_id) { // Comments and notes will be combined into one comments field. $form_comments = oresRawData("form_comments", $lino); $form_comments = str_replace("\n", '~', $form_comments); $form_comments = str_replace("\r", '', $form_comments); $form_notes = oresRawData("form_notes", $lino); if ($form_notes !== '') { $form_comments .= "\n" . $form_notes; } $sets = "procedure_report_id = '{$current_report_id}', " . "result_code = '" . oresData("form_result_code", $lino) . "', " . "result_text = '" . oresData("form_result_text", $lino) . "', " . "abnormal = '" . oresData("form_result_abnormal", $lino) . "', " . "result = '" . oresData("form_result_result", $lino) . "', " . "`range` = '" . oresData("form_result_range", $lino) . "', " . "units = '" . oresData("form_result_units", $lino) . "', " . "facility = '" . oresData("form_facility", $lino) . "', " . "comments = '" . add_escape_custom($form_comments) . "', " . "result_status = '" . oresData("form_result_status", $lino) . "'"; if ($result_id) { // result already exists sqlStatement("UPDATE procedure_result SET {$sets} " . "WHERE procedure_result_id = '{$result_id}'"); } else { // Add new result. $result_id = sqlInsert("INSERT INTO procedure_result SET {$sets}"); } } } // end foreach } ?> <html> <head>
if ($report_id) { // Report already exists. sqlStatement("UPDATE procedure_report SET {$sets} " . "WHERE procedure_report_id = '{$report_id}'"); } else { // Add new report. $report_id = sqlInsert("INSERT INTO procedure_report SET {$sets}"); } } // If this line had report data entry fields, filled or not, set the // "current report ID" which the following result data will link to. if (isset($_POST["form_date_report"][$lino])) { $current_report_id = $report_id; } // If there's a report, save corresponding results. if ($current_report_id) { $sets = "procedure_report_id = '{$current_report_id}', " . "procedure_type_id = '{$restyp_id}', " . "abnormal = '" . oresData("form_result_abnormal", $lino) . "', " . "result = '" . oresData("form_result_result", $lino) . "', " . "`range` = '" . oresData("form_result_range", $lino) . "', " . "facility = '" . oresData("form_facility", $lino) . "', " . "comments = '" . oresData("form_comments", $lino) . "', " . "result_status = '" . oresData("form_result_status", $lino) . "'"; if ($result_id) { // result already exists sqlStatement("UPDATE procedure_result SET {$sets} " . "WHERE procedure_result_id = '{$result_id}'"); } else { // Add new result. $result_id = sqlInsert("INSERT INTO procedure_result SET {$sets}"); } } } // end foreach } ?> <html> <head>