require admin/users permissions to view logs
[openemr.git] / interface / new / new_patient_save.php
blobdc56c907b6f1a055088c21994e032e4932200c3c
1 <?
2 include_once("../globals.php");
4 include_once("$srcdir/sql.inc");
5 include_once("$srcdir/pid.inc");
6 include_once("$srcdir/patient.inc");
8 //here, we lock the patient data table while we find the most recent max PID
9 //other interfaces can still read the data during this lock, however
10 sqlStatement("lock tables patient_data read");
12 $result = sqlQuery("select max(pid)+1 as pid from patient_data");
14 sqlStatement("unlock tables");
15 //end table lock
16 $newpid = 1;
18 if ($result['pid'] > 1)
19 $newpid = $result['pid'];
21 setpid($newpid);
23 if($pid == NULL) {
24 $pid = 0;
27 //what do we set for the public pid?
28 if (isset($_POST["pubpid"]) && ($_POST["pubpid"] != "")) {
29 $mypubpid = $_POST["pubpid"];
30 } else {
31 $mypubpid = $pid;
36 newPatientData( $_POST["db_id"],
37 $_POST["title"],
38 ucwords($_POST["fname"]),
39 ucwords($_POST["lname"]),
40 ucwords($_POST["mname"]),
41 "",
42 "",
43 "",
44 "",
45 "",
46 "",
47 "",
48 "",
49 "",
50 "",
51 "",
52 "",
53 "",
54 "",
55 "",
56 "",
57 "",
58 "",
59 "",
60 "",
61 "",
62 "",
63 "",
64 "",
65 "",
66 "$mypubpid",
67 $pid
71 newEmployerData( $pid);
73 newHistoryData( $pid);
76 newInsuranceData( $pid, "primary");
81 newInsuranceData( $pid, "secondary");
84 newInsuranceData( $pid, "tertiary");
92 <html>
93 <body>
94 <script language="Javascript">
95 <!--
96 window.location="<?echo "$rootdir/patient_file/patient_file.php?set_pid=$pid";?>";
97 -->
98 </script>
101 </body>
102 </html>