break; // ==================================================== // Billing Module 3 // ==================================================== // Billing Module 3 case 'addAccount': $b = new Billing(); if ($b->addAccount($data)) { header('Location: index.php?billing&success=b'); } else { printError("Failed to add billing account."); } break; case 'updateAccount': $b = new Billing(); if ($b->updateAccount($data)) { header('Location: index.php?billing&success=b'); } else { printError("Failed to update billing account."); } break; case 'receivePayment': $b = new Billing(); if ($b->receivePayment($data)) { header('Location: index.php?billing&success=b'); } else { printError("Failed to receive payment."); } break; case 'processEDTDisplay': $t = new Treatment();
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); }