Highway to PSR2
[openemr.git] / contrib / forms / prosthesis / C_FormProsthesis.class.php
blob098698a80ce4eb0e59d9ed409f1d94a337a96141
1 <?php
3 require_once($GLOBALS['fileroot'] . "/library/forms.inc");
4 require_once("FormProsthesis.class.php");
6 class C_FormProsthesis extends Controller
9 var $template_dir;
11 function __construct($template_mod = "general")
13 parent::__construct();
14 $this->template_mod = $template_mod;
15 $this->template_dir = dirname(__FILE__) . "/templates/prosthesis/";
16 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
17 $this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
18 $this->assign("STYLE", $GLOBALS['style']);
21 function default_action()
23 $prosthesis = new FormProsthesis();
24 $this->assign("prosthesis", $prosthesis);
25 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
28 function view_action($form_id)
30 if (is_numeric($form_id)) {
31 $prosthesis = new FormProsthesis($form_id);
32 } else {
33 $prosthesis = new FormProsthesis();
36 $this->assign("VIEW", true);
37 $this->assign("prosthesis", $prosthesis);
38 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
41 function default_action_process()
43 if ($_POST['process'] != "true") {
44 return;
47 $this->prosthesis = new FormProsthesis($_POST['id']);
48 parent::populate_object($this->prosthesis);
51 $this->prosthesis->persist();
52 if ($GLOBALS['encounter'] == "") {
53 $GLOBALS['encounter'] = date("Ymd");
56 addForm($GLOBALS['encounter'], "Prosthesis & Orthotics Form", $this->prosthesis->id, "prosthesis", $GLOBALS['pid'], $_SESSION['userauthorized']);
58 if (!empty($_POST['cpt_code'])) {
59 $sql = "select * from codes where code ='" . add_escape_custom($_POST['cpt_code']) . "' order by id";
61 $results = sqlQ($sql);
63 $row = sqlFetchArray($results);
64 if (!empty($row)) {
65 addBilling(date("Ymd"), 'CPT4', $row['code'], $row['code_text'], $_SESSION['pid'], $_SESSION['userauthorized'], $_SESSION['authUserID'], $row['modifier'], $row['units'], $row['fee']);
69 $_POST['process'] = "";
70 return;