migrated ubiquitous libraries to composer autoloader (#421)
[openemr.git] / interface / forms / misc_billing_options / save.php
blobb2a6f147b3f26d07c865032948ffbffd3e5bd8f1
1 <?php
2 /*
3 * save.php for the saving of information from the misc_billing_form
5 * This program saves data from the misc_billing_form
7 * Copyright (C) 2007 Bo Huynh
8 * Copyright (C) 2016 Terry Hill <terry@lillysystems.com>
10 * LICENSE: This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 3
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see http://opensource.org/licenses/gpl-license.php.
21 * @package OpenEMR
22 * @author Terry Hill <terry@lilysystems.com>
23 * @author Brady Miller <brady.g.miller@gmail.com>
24 * @link http://www.open-emr.org
26 require_once("../../globals.php");
27 require_once("$srcdir/api.inc");
28 require_once("$srcdir/forms.inc");
30 if (! $encounter) { // comes from globals.php
31 die(xlt("Internal error: we do not seem to be in an encounter!"));
34 if ($_POST["off_work_from"] == "0000-00-00" || $_POST["off_work_from"] == "")
35 { $_POST["is_unable_to_work"] = "0"; $_POST["off_work_to"] = "";}
36 else {$_POST["is_unable_to_work"] = "1";}
38 if ($_POST["hospitalization_date_from"] == "0000-00-00" || $_POST["hospitalization_date_from"] == "")
39 { $_POST["is_hospitalized"] = "0"; $_POST["hospitalization_date_to"] = "";}
40 else {$_POST["is_hospitalized"] = "1";}
42 $id = formData('id','G') + 0;
44 $sets = "pid = {$_SESSION["pid"]},
45 groupname = '" . $_SESSION["authProvider"] . "',
46 user = '" . $_SESSION["authUser"] . "',
47 authorized = $userauthorized, activity=1, date = NOW(),
48 employment_related = '" . formData("employment_related") . "',
49 auto_accident = '" . formData("auto_accident") . "',
50 accident_state = '" . formData("accident_state") . "',
51 other_accident = '" . formData("other_accident") . "',
52 outside_lab = '" . formData("outside_lab") . "',
53 medicaid_referral_code = '" . formData("medicaid_referral_code") . "',
54 epsdt_flag = '" . formData("epsdt_flag") . "',
55 provider_id = '" . formData("provider_id") . "',
56 provider_qualifier_code = '" . formData("provider_qualifier_code") . "',
57 lab_amount = '" . formData("lab_amount") . "',
58 is_unable_to_work = '" . formData("is_unable_to_work") . "',
59 date_initial_treatment = '" . formData("date_initial_treatment") . "',
60 off_work_from = '" . formData("off_work_from") . "',
61 off_work_to = '" . formData("off_work_to") . "',
62 is_hospitalized = '" . formData("is_hospitalized") . "',
63 hospitalization_date_from = '" . formData("hospitalization_date_from") . "',
64 hospitalization_date_to = '" . formData("hospitalization_date_to") . "',
65 medicaid_resubmission_code = '" . formData("medicaid_resubmission_code") . "',
66 medicaid_original_reference = '" . formData("medicaid_original_reference") . "',
67 prior_auth_number = '" . formData("prior_auth_number") . "',
68 replacement_claim = '" . formData("replacement_claim") . "',
69 icn_resubmission_number = '" . formData("icn_resubmission_number") . "',
70 box_14_date_qual = '" . formData("box_14_date_qual") . "',
71 box_15_date_qual = '" . formData("box_15_date_qual") . "',
72 comments = '" . formData("comments") . "'";
74 if (empty($id)) {
75 $newid = sqlInsert("INSERT INTO form_misc_billing_options SET $sets");
76 addForm($encounter, "Misc Billing Options", $newid, "misc_billing_options", $pid, $userauthorized);
78 else {
79 sqlStatement("UPDATE form_misc_billing_options SET $sets WHERE id = $id");
82 formHeader("Redirecting....");
83 formJump();
84 formFooter();