added appointments-encounters report
[openemr.git] / contrib / forms / well_infant / C_FormWellInfant.class.php
blob0d66b63d9e4482a8a057b694df8e8a15e53a8edb
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("FormWellInfant.class.php");
8 class C_FormWellInfant extends Controller {
10 var $template_dir;
12 function C_FormWellInfant($template_mod = "general") {
13 parent::Controller();
14 $this->template_mod = $template_mod;
15 $this->template_dir = dirname(__FILE__) . "/templates/well_infant/";
16 $this->assign("FORM_ACTION", $GLOBALS['web_root']);
17 $this->assign("DONT_SAVE_LINK",$GLOBALS['webroot'] . "/interface/patient_file/encounter/patient_encounter.php");
18 $this->assign("STYLE", $GLOBALS['style']);
21 function default_action() {
22 $well_infant = new FormWellInfant();
23 $this->assign("checks",$well_infant->_form_layout());
24 $this->assign("checks2",$well_infant->_form_layout2());
25 $this->assign("checks3",$well_infant->_form_layout3());
26 $this->assign("well_infant",$well_infant);
27 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
30 function view_action($form_id) {
31 if (is_numeric($form_id)) {
32 $well_infant = new FormWellInfant($form_id);
34 else {
35 $well_infant = new FormWellInfant();
37 $this->assign("VIEW",true);
38 $this->assign("checks",$well_infant->_form_layout());
39 $this->assign("checks2",$well_infant->_form_layout2());
40 $this->assign("checks3",$well_infant->_form_layout3());
41 $this->assign("well_infant",$well_infant);
42 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
46 function default_action_process() {
47 if ($_POST['process'] != "true")
48 return;
49 $this->well_infant = new FormWellInfant($_POST['id']);
51 $new_form = false;
52 if (empty($_POST['id'])) {
53 $new_form = true;
56 parent::populate_object($this->well_infant);
58 $this->well_infant->persist();
59 if ($GLOBALS['encounter'] == "") {
60 $GLOBALS['encounter'] = date("Ymd");
63 if ($new_form) {
64 addForm($GLOBALS['encounter'], "Well Infant Visit", $this->well_infant->id, "well_infant", $GLOBALS['pid'], $_SESSION['userauthorized']);
67 if (!empty($_POST['cpt_code'])) {
68 $sql = "select * from codes where code ='" . mysql_real_escape_string($_POST['cpt_code']) . "' order by id";
70 $results = sqlQ($sql);
72 $row = mysql_fetch_array($results);
73 if (!empty($row)) {
74 addBilling( date("Ymd"), 'CPT4', $row['code'], $row['code_text'], $_SESSION['pid'], $_SESSION['userauthorized'], $_SESSION['authUserID'],$row['modifier'],$row['units'],$row['fee']);
79 $_POST['process'] = "";
80 return;