function runTreatment() { global $results; $t = new Treatment(); $a = new Admin(); $patients = $a->getAllPatients(); $emps = $a->getAllPhysicians(); // New $pid = key($patients); $eidin = key($emps); $moo = array('pid' => $pid, 'dateperf' => '11/30/2010', 'activitytype' => 'E', 'enames' => current($emps), 'description' => "Today I did things", 'duration' => '1', 'outcome' => 'Yay?', 'cost' => 100); // Pre-req: Checked In. $data = array('pid' => $pid, 'indate' => date('m/d/Y'), 'eidin' => $eidin); $results['admin_checkInPatient'] = $a->checkInPatient($data); // New EDT Record $results['treatment_newEDT'] = $t->newEDT($moo); // Get EDT Records $results['treatment_getEDTs'] = $t->getEDTRecords($pid); $db = new Database(); $db->delete('EDTRecords', array('field' => 'pid', 'value' => $pid), 1); return array_search(false, $results); }
break; // ==================================================== // Treatment Module 2 // ==================================================== // Treatment Module 2 case 'newEDT': $t = new Treatment(); if ($t->newEDT($data)) { header('Location: index.php?treatment&success=t'); } else { printError("Failed to insert new EDT Record."); } break; case 'getEDT': $t = new Treatment(); $results = $t->getEDTRecords($data['pid'], (bool) $data['option']); if ($results) { $t->displayEDTRecords($results); } else { header('Location: index.php?treatment&success=tn'); } break; // ==================================================== // Billing Module 3 // ==================================================== // Billing Module 3 case 'addAccount': $b = new Billing(); if ($b->addAccount($data)) { header('Location: index.php?billing&success=b'); } else {
public function checkOutPatient($data) { if (!$this->isPatient($data['pid']) || !checkFilled($data) || !verifyDate($data['outdate']) || !checkNumber($data['eidout']) || !checkNumber($data['pid']) || !$this->isCheckedIn($data['pid'])) { return false; } $where = array('field' => 'pid', 'value' => $data['pid']); // Add up costs of EDT records for that visit $total = 0; $t = new Treatment(); $edts = $t->getEDTRecords($data['pid'], true); foreach ($edts as $e) { $total = $total + $e['cost']; } $data['totalbill'] = $total; unset($data['pid']); // remove pid from elements return $this->dbh->update('CheckInOuts', $data, $where, true); }