more organization of autoloaded files (#424)
[openemr.git] / contrib / forms / prosthesis / C_FormProsthesis.class.php
blobee7279e815d899fe3491787d4631f8d8bb7cef48
1 <?php
3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once ($GLOBALS['fileroot'] . "/library/forms.inc");
5 require_once("FormProsthesis.class.php");
7 class C_FormProsthesis extends Controller {
9 var $template_dir;
11 function C_FormProsthesis($template_mod = "general") {
12 parent::Controller();
13 $this->template_mod = $template_mod;
14 $this->template_dir = dirname(__FILE__) . "/templates/prosthesis/";
15 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
16 $this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
17 $this->assign("STYLE", $GLOBALS['style']);
20 function default_action() {
21 $prosthesis = new FormProsthesis();
22 $this->assign("prosthesis",$prosthesis);
23 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
26 function view_action($form_id) {
27 if (is_numeric($form_id)) {
28 $prosthesis = new FormProsthesis($form_id);
30 else {
31 $prosthesis = new FormProsthesis();
33 $this->assign("VIEW",true);
34 $this->assign("prosthesis",$prosthesis);
35 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
39 function default_action_process() {
40 if ($_POST['process'] != "true")
41 return;
42 $this->prosthesis = new FormProsthesis($_POST['id']);
43 parent::populate_object($this->prosthesis);
46 $this->prosthesis->persist();
47 if ($GLOBALS['encounter'] == "") {
48 $GLOBALS['encounter'] = date("Ymd");
50 addForm($GLOBALS['encounter'], "Prosthesis & Orthotics Form", $this->prosthesis->id, "prosthesis", $GLOBALS['pid'], $_SESSION['userauthorized']);
52 if (!empty($_POST['cpt_code'])) {
53 $sql = "select * from codes where code ='" . add_escape_custom($_POST['cpt_code']) . "' order by id";
55 $results = sqlQ($sql);
57 $row = sqlFetchArray($results);
58 if (!empty($row)) {
59 addBilling( date("Ymd"), 'CPT4', $row['code'], $row['code_text'], $_SESSION['pid'], $_SESSION['userauthorized'], $_SESSION['authUserID'],$row['modifier'],$row['units'],$row['fee']);
64 $_POST['process'] = "";
65 return;