} foreach ($data as $datum) { // Note this will auto-assign the seq value. sqlBeginTrans(); $answer_seq = sqlQuery("SELECT IFNULL(MAX(answer_seq),0) + 1 AS increment FROM procedure_answers WHERE procedure_order_id = ? AND procedure_order_seq = ? AND question_code = ? ", array($formid, $poseq, $qcode)); sqlStatement("INSERT INTO procedure_answers SET " . "procedure_order_id = ?, " . "procedure_order_seq = ?, " . "question_code = ?, " . "answer_seq = ?, " . "answer = ?", array($formid, $poseq, $qcode, $answer_seq['increment'], strip_escape_custom($datum))); sqlCommitTrans(); } } } $alertmsg = ''; if ($_POST['bn_xmit']) { $hl7 = ''; $alertmsg = gen_hl7_order($formid, $hl7); if (empty($alertmsg)) { $alertmsg = send_hl7_order($ppid, $hl7); } if (empty($alertmsg)) { sqlStatement("UPDATE procedure_order SET date_transmitted = NOW() WHERE " . "procedure_order_id = ?", array($formid)); } } formHeader("Redirecting...."); if ($alertmsg) { echo "\n<script language='Javascript'>alert('"; echo addslashes(xl('Transmit failed') . ': ' . $alertmsg); echo "')</script>\n"; } formJump(); formFooter(); exit; }
// Check authorization. $thisauth = acl_check('patients', 'med'); if (!$thisauth) { die(xlt('Not authorized')); } $errmsg = ''; // Send selected unsent orders if requested. This does not support downloading // very well as it will only send the first of those. if ($_POST['form_xmit']) { foreach ($_POST['form_cb'] as $formid) { $row = sqlQuery("SELECT lab_id FROM procedure_order WHERE " . "procedure_order_id = ?", array($formid)); $ppid = intval($row['lab_id']); $hl7 = ''; $errmsg = gen_hl7_order($formid, $hl7); if (empty($errmsg)) { $errmsg = send_hl7_order($ppid, $hl7); } if ($errmsg) { break; } sqlStatement("UPDATE procedure_order SET date_transmitted = NOW() WHERE " . "procedure_order_id = ?", array($formid)); } } ?> <html> <head> <?php html_header_show(); ?> <link rel="stylesheet" href='<?php