$query = "REPLACE INTO `form_eye_mag_wearing` (`ENCOUNTER` ,`FORM_ID` ,`PID` ,`RX_NUMBER` ,`ODSPH` ,`ODCYL` ,`ODAXIS` ,\n `ODVA` ,`ODADD` ,`ODNEARVA` ,`OSSPH` ,`OSCYL` ,`OSAXIS` ,\n `OSVA` ,`OSADD` ,`OSNEARVA` ,`ODMIDADD` ,`OSMIDADD` ,\n `RX_TYPE` ,`COMMENTS`,\n `ODHPD`,`ODHBASE`,`ODVPD`,`ODVBASE`,`ODSLABOFF`,`ODVERTEXDIST`,\n `OSHPD`,`OSHBASE`,`OSVPD`,`OSVBASE`,`OSSLABOFF`,`OSVERTEXDIST`,\n `ODMPDD`,`ODMPDN`,`OSMPDD`,`OSMPDN`,`BPDD`,`BPDN`,`LENS_MATERIAL`,\n `LENS_TREATMENTS`\n ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; $LENS_TREATMENTS_4 = implode("|", $_POST['LENS_TREATMENTS_4']); sqlQuery($query, array($encounter, $form_id, $pid, $rx_number, $_POST['ODSPH_4'], $_POST['ODCYL_4'], $_POST['ODAXIS_4'], $_POST['ODVA_4'], $_POST['ODADD_4'], $_POST['ODNEARVA_4'], $_POST['OSSPH_4'], $_POST['OSCYL_4'], $_POST['OSAXIS_4'], $_POST['OSVA_4'], $_POST['OSADD_4'], $_POST['OSNEARVA_4'], $_POST['ODMIDADD_4'], $_POST['OSMIDADD_4'], 0 + $_POST['RX_TYPE_4'], $_POST['COMMENTS_4'], $_POST['ODHPD_4'], $_POST['ODHBASE_4'], $_POST['ODVPD_4'], $_POST['ODVBASE_4'], $_POST['ODSLABOFF_4'], $_POST['ODVERTEXDIST_4'], $_POST['OSHPD_4'], $_POST['OSHBASE_4'], $_POST['OSVPD_4'], $_POST['OSVBASE_4'], $_POST['OSSLABOFF_4'], $_POST['OSVERTEXDIST_4'], $_POST['ODMPDD_4'], $_POST['ODMPDN_4'], $_POST['OSMPDD_4'], $_POST['OSMPDN_4'], $_POST['BPDD_4'], $_POST['BPDN_4'], $_POST['LENS_MATERIAL_4'], $LENS_TREATMENTS_4)); $rx_number++; } else { $query = "DELETE FROM form_eye_mag_wearing where ENCOUNTER=? and PID=? and FORM_ID=? and RX_NUMBER=?"; sqlQuery($query, array($encounter, $pid, $form_id, '4')); } for ($i = $rx_number; $i < 5; $i++) { $query = "DELETE FROM form_eye_mag_wearing where ENCOUNTER=? and PID=? and FORM_ID=? and RX_NUMBER=?"; sqlQuery($query, array($encounter, $pid, $form_id, $i)); } //now return the obj $send['IMPPLAN_items'] = build_IMPPLAN_items($pid, $form_id); $send['Clinical'] = start_your_engines($_REQUEST); $send['PMH_panel'] = display_PMSFH('2'); $send['right_panel'] = show_PMSFH_panel($PMSFH); $send['PMSFH'] = $PMSFH[0]; echo json_encode($send); exit; } } elseif ($_REQUEST["mode"] == "retrieve") { if ($_REQUEST['PRIORS_query']) { echo display_PRIOR_section($_REQUEST['zone'], $_REQUEST['orig_id'], $_REQUEST['id_to_show'], $pid); exit; } } /** * Save the canvas drawings */ if ($_REQUEST['canvas']) {
/** * Function to prepare for sending the PMSFH_panel and PMSFH_right_panel * via display_PMSFH('2') and show_PMSFH_panel($PMSFH) respectively, * to javascript to display changes to the user. * @param associative array $PMSFH if it exists * @return json encoded string */ function send_json_values($PMSFH = "") { global $pid; global $form_id; if (!$PMSFH) { build_PMSFH(); } $send['PMSFH'] = $PMSFH[0]; //actual array $send['PMH_panel'] = display_PMSFH('2'); //display PMSFH next to the PMSFH Builder $send['right_panel'] = show_PMSFH_panel($PMSFH); //display PMSFH in a slidable right-sided panel $send['IMPPLAN_items'] = build_IMPPLAN_items($pid, $form_id); echo json_encode($send); }