fix: fix ci (#7614)
[openemr.git] / contrib / forms / prosthesis / C_FormProsthesis.class.php
blob3fd62451146fc979325a0a40fb16581dd6d1d682
1 <?php
3 require_once($GLOBALS['fileroot'] . "/library/forms.inc.php");
4 require_once("FormProsthesis.class.php");
6 use OpenEMR\Billing\BillingUtilities;
8 class C_FormProsthesis extends Controller
10 var $template_dir;
12 function __construct($template_mod = "general")
14 parent::__construct();
15 $this->template_mod = $template_mod;
16 $this->template_dir = dirname(__FILE__) . "/templates/prosthesis/";
17 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
18 $this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
19 $this->assign("STYLE", $GLOBALS['style']);
22 function default_action()
24 $prosthesis = new FormProsthesis();
25 $this->assign("prosthesis", $prosthesis);
26 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
29 function view_action($form_id)
31 if (is_numeric($form_id)) {
32 $prosthesis = new FormProsthesis($form_id);
33 } else {
34 $prosthesis = new FormProsthesis();
37 $this->assign("VIEW", true);
38 $this->assign("prosthesis", $prosthesis);
39 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
42 function default_action_process()
44 if ($_POST['process'] != "true") {
45 return;
48 $this->form = new FormProsthesis($_POST['id']);
49 parent::populate_object($this->form);
52 $this->form->persist();
53 if ($GLOBALS['encounter'] == "") {
54 $GLOBALS['encounter'] = date("Ymd");
57 addForm($GLOBALS['encounter'], "Prosthesis & Orthotics Form", $this->form->id, "prosthesis", $GLOBALS['pid'], $_SESSION['userauthorized']);
59 if (!empty($_POST['cpt_code'])) {
60 $sql = "select * from codes where code = ? order by id";
62 $results = sqlQ($sql, array($_POST['cpt_code']));
64 $row = sqlFetchArray($results);
65 if (!empty($row)) {
66 BillingUtilities::addBilling(date("Ymd"), 'CPT4', $row['code'], $row['code_text'], $_SESSION['pid'], $_SESSION['userauthorized'], $_SESSION['authUserID'], $row['modifier'], $row['units'], $row['fee']);
70 $_POST['process'] = "";
71 return;