Revert "We are using a field PrescriptionGUID, obtained from NewCrop, to check if...
[openemr.git] / contrib / forms / prosthesis / C_FormProsthesis.class.php
blob0dbe33829b4b8b00443916b3363a5bb7e88834db
1 <?php
3 require_once ($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
4 require_once ($GLOBALS['fileroot'] . "/library/forms.inc");
5 require_once ($GLOBALS['fileroot'] . "/library/sql.inc");
6 require_once("FormProsthesis.class.php");
8 class C_FormProsthesis extends Controller {
10 var $template_dir;
12 function C_FormProsthesis($template_mod = "general") {
13 parent::Controller();
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() {
22 $prosthesis = new FormProsthesis();
23 $this->assign("prosthesis",$prosthesis);
24 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
27 function view_action($form_id) {
28 if (is_numeric($form_id)) {
29 $prosthesis = new FormProsthesis($form_id);
31 else {
32 $prosthesis = new FormProsthesis();
34 $this->assign("VIEW",true);
35 $this->assign("prosthesis",$prosthesis);
36 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
40 function default_action_process() {
41 if ($_POST['process'] != "true")
42 return;
43 $this->prosthesis = new FormProsthesis($_POST['id']);
44 parent::populate_object($this->prosthesis);
47 $this->prosthesis->persist();
48 if ($GLOBALS['encounter'] == "") {
49 $GLOBALS['encounter'] = date("Ymd");
51 addForm($GLOBALS['encounter'], "Prosthesis & Orthotics Form", $this->prosthesis->id, "prosthesis", $GLOBALS['pid'], $_SESSION['userauthorized']);
53 if (!empty($_POST['cpt_code'])) {
54 $sql = "select * from codes where code ='" . mysql_real_escape_string($_POST['cpt_code']) . "' order by id";
56 $results = sqlQ($sql);
58 $row = mysql_fetch_array($results);
59 if (!empty($row)) {
60 addBilling( date("Ymd"), 'CPT4', $row['code'], $row['code_text'], $_SESSION['pid'], $_SESSION['userauthorized'], $_SESSION['authUserID'],$row['modifier'],$row['units'],$row['fee']);
65 $_POST['process'] = "";
66 return;