diff --git a/interface/forms/Aftercareplan/new.php b/interface/forms/Aftercareplan/new.php
new file mode 100644
index 00000000000..af31265c5d7
--- /dev/null
+++ b/interface/forms/Aftercareplan/new.php
@@ -0,0 +1,170 @@
+ CapMinds Technologies
+
+//SANITIZE ALL ESCAPES
+$sanitize_all_escapes=true;
+
+//STOP FAKE REGISTER GLOBALS
+$fake_register_globals=false;
+
+include_once("../../globals.php");
+include_once("$srcdir/api.inc");
+require_once("$srcdir/patient.inc");
+require_once("$srcdir/options.inc.php");
+require_once("$srcdir/htmlspecialchars.inc.php");
+formHeader("Form:AfterCare Planning");
+$returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/interface/forms/Aftercareplan/report.php b/interface/forms/Aftercareplan/report.php
new file mode 100644
index 00000000000..c0a4ca27101
--- /dev/null
+++ b/interface/forms/Aftercareplan/report.php
@@ -0,0 +1,36 @@
+
+ CapMinds Technologies
+
+//SANITIZE ALL ESCAPES
+ $sanitize_all_escapes=true;
+
+ //STOP FAKE REGISTER GLOBALS
+ $fake_register_globals=false;
+
+include_once("../../globals.php");
+include_once($GLOBALS["srcdir"]."/api.inc");
+function aftercareplan_report( $pid, $encounter, $cols, $id) {
+$count = 0;
+$data = formFetch("form_aftercareplan", $id);
+if ($data) {
+print "";
+foreach($data as $key => $value) {
+if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") {
+ continue;
+}
+if ($value == "on") {
+$value = "yes";
+}
+$key=ucwords(str_replace("_"," ",$key));
+print "$key : $value | ";
+$count++;
+if ($count == $cols) {
+$count = 0;
+print "
\n";
+}
+}
+}
+print "
";
+}
+?>
diff --git a/interface/forms/Aftercareplan/save.php b/interface/forms/Aftercareplan/save.php
new file mode 100644
index 00000000000..e5292ea16e4
--- /dev/null
+++ b/interface/forms/Aftercareplan/save.php
@@ -0,0 +1,39 @@
+ CapMinds Technologies
+
+include_once("../../globals.php");
+include_once("$srcdir/api.inc");
+include_once("$srcdir/forms.inc");
+require_once("$srcdir/htmlspecialchars.inc.php");
+require_once("$srcdir/formdata.inc.php");
+
+foreach ($_POST as $k => $var) {
+$_POST[$k]= mysql_escape_string($var);
+echo "$var\n";
+}
+if (attr($encounter) == "")
+$encounter = date("Ymd");
+if($_GET["mode"] == "new"){
+$newid = formSubmit("form_aftercareplan", $_POST, $_GET["id"], $userauthorized);
+addForm($encounter, "AfterCare Plan Form", $newid, "aftercareplan", $pid, $userauthorized);
+}elseif ($_GET["mode"] == "update") {
+sqlInsert("update form_aftercareplan set pid = {$_SESSION["pid"]},groupname='".add_escape_custom($_SESSION["authProvider"])."',user='".add_escape_custom($_SESSION["authUser"])."',authorized=$userauthorized,activity=1, date = NOW(),
+ provider ='".add_escape_custom($_POST["provider"])."',
+ admit_date ='".add_escape_custom($_POST["admit_date"])."',
+ discharged ='".add_escape_custom($_POST["discharged"])."',
+ goal_a_acute_intoxication ='".add_escape_custom($_POST["goal_a_acute_intoxication"])."',
+ goal_a_acute_intoxication_I ='".add_escape_custom($_POST["goal_a_acute_intoxication_I"])."',
+ goal_a_acute_intoxication_II ='".add_escape_custom($_POST["goal_a_acute_intoxication_II"])."',
+ goal_b_emotional_behavioral_conditions ='".add_escape_custom($_POST["goal_b_emotional_behavioral_conditions"])."',
+ goal_b_emotional_behavioral_conditions_I ='".add_escape_custom($_POST["goal_b_emotional_behavioral_conditions_I"])."',
+ goal_c_relapse_potential ='".add_escape_custom($_POST["goal_c_relapse_potential"])."',
+ goal_c_relapse_potential_I ='".add_escape_custom($_POST["goal_c_relapse_potential_I"])."'
+
+ where id=$id");
+
+}
+$_SESSION["encounter"] = attr($encounter);
+formHeader("Redirecting....");
+formJump();
+formFooter();
+?>
diff --git a/interface/forms/Aftercareplan/table.sql b/interface/forms/Aftercareplan/table.sql
new file mode 100644
index 00000000000..95854bdc306
--- /dev/null
+++ b/interface/forms/Aftercareplan/table.sql
@@ -0,0 +1,27 @@
+--
+-- Table structure for table `form_aftercareplan`
+--
+
+CREATE TABLE IF NOT EXISTS `form_aftercareplan` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `date` datetime DEFAULT NULL,
+ `pid` bigint(20) DEFAULT NULL,
+ `user` varchar(255) DEFAULT NULL,
+ `provider` varchar(255) DEFAULT NULL,
+ `groupname` varchar(255) DEFAULT NULL,
+ `authorized` tinyint(4) DEFAULT NULL,
+ `activity` tinyint(4) DEFAULT NULL,
+ `client_name` varchar(255) DEFAULT NULL,
+ `DOB` date DEFAULT NULL,
+ `admit_date` date DEFAULT NULL,
+ `discharged` date DEFAULT NULL,
+ `goal_a_acute_intoxication` text,
+ `goal_a_acute_intoxication_I` text,
+ `goal_a_acute_intoxication_II` text,
+ `goal_b_emotional_behavioral_conditions` text,
+ `goal_b_emotional_behavioral_conditions_I` text,
+ `goal_c_relapse_potential` text,
+ `goal_c_relapse_potential_I` text,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
diff --git a/interface/forms/Aftercareplan/view.php b/interface/forms/Aftercareplan/view.php
new file mode 100644
index 00000000000..aeea4bd056a
--- /dev/null
+++ b/interface/forms/Aftercareplan/view.php
@@ -0,0 +1,150 @@
+ CapMinds Technologies
+ //SANITIZE ALL ESCAPES
+ $sanitize_all_escapes=true;
+
+ //STOP FAKE REGISTER GLOBALS
+ $fake_register_globals=false;
+
+include_once("../../globals.php");
+require_once("$srcdir/options.inc.php");
+require_once("$srcdir/htmlspecialchars.inc.php");
+$returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/interface/forms/transfersummary/new.php b/interface/forms/transfersummary/new.php
new file mode 100644
index 00000000000..06e7a9da307
--- /dev/null
+++ b/interface/forms/transfersummary/new.php
@@ -0,0 +1,132 @@
+ CapMinds Technologies
+
+//SANITIZE ALL ESCAPES
+ $sanitize_all_escapes=true;
+
+ //STOP FAKE REGISTER GLOBALS
+ $fake_register_globals=false;
+
+include_once("../../globals.php");
+include_once("$srcdir/api.inc");
+require_once("$srcdir/patient.inc");
+require_once("$srcdir/options.inc.php");
+formHeader("Form:Transfer Summary");
+$returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Transfer Summary
+
+
+
+
diff --git a/interface/forms/transfersummary/report.php b/interface/forms/transfersummary/report.php
new file mode 100644
index 00000000000..ec9e99da2d7
--- /dev/null
+++ b/interface/forms/transfersummary/report.php
@@ -0,0 +1,36 @@
+
+ CapMinds Technologies
+
+//SANITIZE ALL ESCAPES
+ $sanitize_all_escapes=true;
+
+ //STOP FAKE REGISTER GLOBALS
+ $fake_register_globals=false;
+
+include_once("../../globals.php");
+include_once($GLOBALS["srcdir"]."/api.inc");
+function transfersummary_report( $pid, $encounter, $cols, $id) {
+$count = 0;
+$data = formFetch("form_transfersummary", $id);
+if ($data) {
+print "";
+foreach($data as $key => $value) {
+if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") {
+ continue;
+}
+if ($value == "on") {
+$value = "yes";
+}
+$key=ucwords(str_replace("_"," ",$key));
+print "$key : $value | ";
+$count++;
+if ($count == $cols) {
+$count = 0;
+print "
\n";
+}
+}
+}
+print "
";
+}
+?>
diff --git a/interface/forms/transfersummary/save.php b/interface/forms/transfersummary/save.php
new file mode 100644
index 00000000000..92a05927584
--- /dev/null
+++ b/interface/forms/transfersummary/save.php
@@ -0,0 +1,31 @@
+ CapMinds Technologies
+include_once("../../globals.php");
+include_once("$srcdir/api.inc");
+include_once("$srcdir/forms.inc");
+foreach ($_POST as $k => $var) {
+$_POST[$k] = mysql_escape_string($var);
+echo "$var\n";
+}
+if ($encounter == "")
+$encounter = date("Ymd");
+if ($_GET["mode"] == "new"){
+$newid = formSubmit("form_transfersummary", $_POST, $_GET["id"], $userauthorized);
+addForm($encounter, "Transfer Summary", $newid, "transfersummary", $pid, $userauthorized);
+}elseif ($_GET["mode"] == "update") {
+sqlInsert("update form_transfersummary set pid = {$_SESSION["pid"]},groupname='".$_SESSION["authProvider"]."',user='".$_SESSION["authUser"]."',authorized=$userauthorized,activity=1, date = NOW(),
+ provider ='".$_POST["provider"]."',
+ transfer_to ='".$_POST["transfer_to"]."',
+ transfer_date ='".$_POST["transfer_date"]."',
+ status_of_admission ='".$_POST["status_of_admission"]."',
+ diagnosis_diagnses ='".$_POST["diagnosis_diagnses"]."',
+ intervention_provided ='".$_POST["intervention_provided"]."',
+ overall_status_of_discharge ='".$_POST["overall_status_of_discharge"]."'
+
+ where id=$id");
+}
+$_SESSION["encounter"] = $encounter;
+formHeader("Redirecting....");
+formJump();
+formFooter();
+?>
diff --git a/interface/forms/transfersummary/table.sql b/interface/forms/transfersummary/table.sql
new file mode 100644
index 00000000000..3549b62b1b8
--- /dev/null
+++ b/interface/forms/transfersummary/table.sql
@@ -0,0 +1,25 @@
+
+--
+-- Table structure for table `form_transfersummary`
+--
+
+CREATE TABLE IF NOT EXISTS `form_transfersummary` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `date` datetime DEFAULT NULL,
+ `pid` bigint(20) DEFAULT NULL,
+ `user` varchar(255) DEFAULT NULL,
+ `groupname` varchar(255) DEFAULT NULL,
+ `authorized` tinyint(4) DEFAULT NULL,
+ `activity` tinyint(4) DEFAULT NULL,
+ `client_name` varchar(255) DEFAULT NULL,
+ `DOB` date DEFAULT NULL,
+ `provider` varchar(255) DEFAULT NULL,
+ `transfer_to` varchar(255) DEFAULT NULL,
+ `transfer_date` date DEFAULT NULL,
+ `status_of_admission` text,
+ `diagnosis_diagnses` text,
+ `intervention_provided` text,
+ `overall_status_of_discharge` text,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB;
+
diff --git a/interface/forms/transfersummary/view.php b/interface/forms/transfersummary/view.php
new file mode 100644
index 00000000000..99a18383d1e
--- /dev/null
+++ b/interface/forms/transfersummary/view.php
@@ -0,0 +1,118 @@
+ CapMinds Technologies
+
+//SANITIZE ALL ESCAPES
+ $sanitize_all_escapes=true;
+
+ //STOP FAKE REGISTER GLOBALS
+ $fake_register_globals=false;
+
+include_once("../../globals.php");
+require_once("$srcdir/options.inc.php");
+include_once("$srcdir/api.inc");
+$returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+Transfer Summary
+
+
+
+
+
+
diff --git a/interface/forms/treatmentplan/new.php b/interface/forms/treatmentplan/new.php
new file mode 100644
index 00000000000..22402fbe248
--- /dev/null
+++ b/interface/forms/treatmentplan/new.php
@@ -0,0 +1,181 @@
+ CapMinds Technologies
+//SANITIZE ALL ESCAPES
+ $sanitize_all_escapes=true;
+
+ //STOP FAKE REGISTER GLOBALS
+ $fake_register_globals=false;
+
+include_once("../../globals.php");
+include_once("$srcdir/api.inc");
+require_once("$srcdir/patient.inc");
+require_once("$srcdir/options.inc.php");
+formHeader("Form:Treatment Planning");
+$returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
+
+// Get the providers list.
+ $ures = sqlStatement("SELECT id, username, fname, lname FROM users WHERE " .
+ "authorized != 0 AND active = 1 ORDER BY lname, fname");
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+Treatment Planning
+
+
+
+
diff --git a/interface/forms/treatmentplan/report.php b/interface/forms/treatmentplan/report.php
new file mode 100644
index 00000000000..2b0aa466e88
--- /dev/null
+++ b/interface/forms/treatmentplan/report.php
@@ -0,0 +1,34 @@
+ CapMinds Technologies
+//SANITIZE ALL ESCAPES
+ $sanitize_all_escapes=true;
+
+ //STOP FAKE REGISTER GLOBALS
+ $fake_register_globals=false;
+
+include_once("../../globals.php");
+include_once($GLOBALS["srcdir"]."/api.inc");
+function treatmentplan_report( $pid, $encounter, $cols, $id) {
+$count = 0;
+$data = formFetch("form_treatmentplan", $id);
+if ($data) {
+print "";
+foreach($data as $key => $value) {
+if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") {
+ continue;
+}
+if ($value == "on") {
+$value = "yes";
+}
+$key=ucwords(str_replace("_"," ",$key));
+print "". xl($key) . " : $value | ";
+$count++;
+if ($count == $cols) {
+$count = 0;
+print "
\n";
+}
+}
+}
+print "
";
+}
+?>
diff --git a/interface/forms/treatmentplan/save.php b/interface/forms/treatmentplan/save.php
new file mode 100644
index 00000000000..ea22bbb26dc
--- /dev/null
+++ b/interface/forms/treatmentplan/save.php
@@ -0,0 +1,33 @@
+ CapMinds Technologies
+
+include_once("../../globals.php");
+include_once("$srcdir/api.inc");
+include_once("$srcdir/forms.inc");
+foreach ($_POST as $k => $var) {
+$_POST[$k] = mysql_escape_string($var);
+echo "$var\n";
+}
+if ($encounter == "")
+$encounter = date("Ymd");
+if ($_GET["mode"] == "new"){
+$newid = formSubmit("form_treatmentplan", $_POST, $_GET["id"], $userauthorized);
+addForm($encounter, "Treatment plan Form", $newid, "treatmentplan", $pid, $userauthorized);
+}elseif ($_GET["mode"] == "update") {
+sqlInsert("update form_treatmentplan set pid = {$_SESSION["pid"]},groupname='".$_SESSION["authProvider"]."',user='".$_SESSION["authUser"]."',authorized=$userauthorized,activity=1, date = NOW(),
+ provider ='".$_POST["provider"]."',
+ admit_date ='".$_POST["admit_date"]."',
+ presenting_issues ='".$_POST["presenting_issues"]."',
+ patient_history ='".$_POST["patient_history"]."',
+ medications ='".$_POST["medications"]."',
+ anyother_relevant_information ='".$_POST["anyother_relevant_information"]."',
+ diagnosis ='".$_POST["diagnosis"]."',
+ treatment_received ='".$_POST["treatment_received"]."',
+ recommendation_for_follow_up ='".$_POST["recommendation_for_follow_up"]."'
+ where id=$id");
+}
+$_SESSION["encounter"] = $encounter;
+formHeader("Redirecting....");
+formJump();
+formFooter();
+?>
diff --git a/interface/forms/treatmentplan/table.sql b/interface/forms/treatmentplan/table.sql
new file mode 100644
index 00000000000..968d94a601e
--- /dev/null
+++ b/interface/forms/treatmentplan/table.sql
@@ -0,0 +1,28 @@
+
+--
+-- Table structure for table `form_treatmentplan`
+--
+
+CREATE TABLE IF NOT EXISTS `form_treatmentplan` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `date` datetime DEFAULT NULL,
+ `pid` bigint(20) DEFAULT NULL,
+ `user` varchar(255) DEFAULT NULL,
+ `groupname` varchar(255) DEFAULT NULL,
+ `authorized` tinyint(4) DEFAULT NULL,
+ `activity` tinyint(4) DEFAULT NULL,
+ `client_name` varchar(255) DEFAULT NULL,
+ `client_number` bigint(20) DEFAULT NULL,
+ `provider` varchar(255) DEFAULT NULL,
+ `DOB` date DEFAULT NULL,
+ `admit_date` varchar(255) DEFAULT NULL,
+ `presenting_issues` text,
+ `patient_history` text,
+ `medications` text,
+ `anyother_relevant_information` text,
+ `diagnosis` text,
+ `treatment_received` text,
+ `recommendation_for_follow_up` text,
+
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB;
diff --git a/interface/forms/treatmentplan/view.php b/interface/forms/treatmentplan/view.php
new file mode 100644
index 00000000000..cdb38ef746c
--- /dev/null
+++ b/interface/forms/treatmentplan/view.php
@@ -0,0 +1,149 @@
+ CapMinds Technologies
+//SANITIZE ALL ESCAPES
+ $sanitize_all_escapes=true;
+
+ //STOP FAKE REGISTER GLOBALS
+ $fake_register_globals=false;
+
+include_once("../../globals.php");
+require_once("$srcdir/options.inc.php");
+$returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
+
+// Get the providers list.
+ $ures = sqlStatement("SELECT id, username, fname, lname FROM users WHERE " .
+ "authorized != 0 AND active = 1 ORDER BY lname, fname");
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Treatment Planning
+
+
+
+
+