Bug fix for document upload. Document entry is no longer created in
[openemr.git] / contrib / forms / routine_screening_record / save.php
blob5691d44818d8e8c2c8e0669226858247c7dbde12
1 <?php
2 // 2005-03-14
3 // Routine screening storage and update module
4 //
6 include_once("../../globals.php");
7 include_once("$srcdir/api.inc");
8 include_once("$srcdir/forms.inc");
10 $flds = sqlListFields("form_routine_screening_record");
11 $flds = array_slice($flds,7);
12 foreach ($flds as $key => $fld){
13 $data[$fld] = '';
16 foreach ($_POST as $k => $var) {
17 $_POST[$k] = mysql_escape_string($var);
18 //echo "$var\n";
20 $factors = array("cervical", "lipid", "mammo", "colorectal",
21 "bone", "chlamyd", "gonor", "urinal", "glucose", "thyroid");
24 $ii = 1;
25 while ($ii<9){
26 $record = '';
27 foreach($factors as $k=>$v){
28 $record .= $_POST[$v."_date_".$ii] .'|'. $_POST[$v."_res_".$ii];
29 if ($v != "thyroid") { $record .= '|~'; }
31 $data["record_".$ii] = $record;
32 $ii++;
35 if ($_GET["mode"] == "new"){
36 if ($encounter == "") { $encounter = date("Ymd"); }
37 $newid = formSubmit("form_routine_screening_record", $data, $_GET["id"], $userauthorized);
38 addForm($encounter, "Routine screening record", $newid, "routine_screening_record", $pid, $userauthorized);
39 $_SESSION["encounter"] = $encounter;
40 } elseif ($_GET["mode"] == "update") {
41 $q1 = '';
42 foreach ($data as $key => $val){
43 $q1 .= "$key='$val', ";
45 sqlInsert("update form_routine_screening_record set pid = {$_SESSION["pid"]},groupname='".$_SESSION["authProvider"]."',user='".$_SESSION["authUser"]."',authorized=$userauthorized,activity=1, $q1 date = NOW() where id=$id");
47 sqlInsert("update patient_data set DOB='".$_POST['pbdate']."' where id=$pid");
49 //$_SESSION["pid"] = $pid;
50 formHeader("Redirecting....");
51 formJump();
52 formFooter();