fix: allow viewing of fee sheet items if billing.billed is null (#7808)
[openemr.git] / contrib / forms / review_of_systems / C_FormReviewOfSystems.class.php
blob967a277cc4e06e7fb337e5fd0da3e47e46d69627
1 <?php
3 require_once($GLOBALS['fileroot'] . "/library/forms.inc.php");
4 require_once("FormReviewOfSystems.class.php");
6 use OpenEMR\Billing\BillingUtilities;
8 class C_FormReviewOfSystems 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/review_of_systems/";
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 $review_of_systems = new FormReviewOfSystems();
25 $this->assign("review_of_systems", $review_of_systems);
26 $this->assign("checks", $review_of_systems->_form_layout());
27 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
30 function view_action($form_id)
32 if (is_numeric($form_id)) {
33 $review_of_systems = new FormReviewOfSystems($form_id);
34 } else {
35 $review_of_systems = new FormReviewOfSystems();
38 $this->assign("VIEW", true);
39 $this->assign("review_of_systems", $review_of_systems);
40 $this->assign("checks", $review_of_systems->_form_layout());
41 return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
44 function default_action_process()
46 if ($_POST['process'] != "true") {
47 return;
50 $this->form = new FormReviewOfSystems($_POST['id']);
51 parent::populate_object($this->form);
52 $this->form->persist();
53 if ($GLOBALS['encounter'] == "") {
54 $GLOBALS['encounter'] = date("Ymd");
57 addForm($GLOBALS['encounter'], "Review Of Systems", $this->form->id, "review_of_systems", $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;