case 'getBill': $b = new Billing(); $b->displayBill($data['pid']); break; // Do nothing // Do nothing default: printError("Nothing was done..."); } // ================================================== // Special cases // Process an individual EDT } elseif (array_key_exists('processEDT', $_GET) && $_GET['processEDT']) { $b = new Billing(); $t = new Treatment(); if ($b->processEDT($_GET['processEDT'])) { header('Location: index.php?billing&success=b'); } else { printError("Failed to process EDT record."); } // For first run of this HMS (index.php) } elseif ($_SERVER['QUERY_STRING'] == 'insertEmployees') { $db = new Database(); if ($db->query("SELECT sin FROM Employees")) { echo "<p class='notice'>This employee already exists.</p>"; } else { $employee = array('ename' => 'Emp1', 'sin' => 1337, 'address' => '1 Hello Wrld.'); $job = array('jname' => 'OB', 'jtype' => 'C'); if ($db->insert('Employees', $employee)) { echo "<p class='success'>Employee inserted</p>"; } else {
function runBilling() { global $results; $b = new Billing(); $t = new Treatment(); $a = new Admin(); // For getting list of patients $patients = $a->getAllPatients(); $pid = array_search('BTEST1', $patients); // Create billing account // Prereq: Patient exists (uses PTEST1) $new = array('pid' => $pid, 'insname' => 'test', 'insacct' => '1337'); $results['billing_newAcct'] = $b->addAccount($new); // Update Billing account // Prereq: Billing account exists $new = array('pid' => $pid, 'insname' => 'MooCows Inc.'); $results['billing_updateAcct'] = $b->updateAccount($new); // Get Bill // Prereq: Billing account exists. $results['billing_getBill'] = $b->getBill($pid); //Process EDT record //Prereq: Unprocessed EDT record exists for patient, billing account exists. $edts = $t->getUnprocessedEDTs($pid); $edt = $edts[0]['edtid']; $results['billing_processEDT'] = $b->processEDT($edt); //Receive a payment //Prereq: Billing account exists. $results['billing_receivePayment'] = $b->receivePayment(array('pid' => $pid, 'amnt' => 10)); // Close Account // Prereq: Account exists. // - For testing purposes, balance should be negative as to avoid two-stage process (manually tested). $results['billing_closeAccount'] = $b->closeAccount($pid); }