Exemplo n.º 1
0
     $all = $t->getUnprocessedEDTs($data['pid']);
     foreach ($all as $e) {
         if (!$b->processEDT($e['edtid'])) {
             $success = false;
             break;
         }
     }
     if ($success) {
         header('Location: index.php?billing&success=b');
     } else {
         printError("Failed to process all EDT records.");
     }
     break;
 case 'closeAccount':
     $b = new Billing();
     $bill = $b->getBill($data['pid']);
     if ($bill['balance'] >= 0) {
         $b->displayBill($data['pid']);
         echo "<p class='confirmDelete'>Are you sure you wish to delete all information associated with this account?</p>";
         $form = array('form_action' => 'closeAccountConfirm', 'submit_text' => 'Confirm Deletion of All Information', '_hidden1' => array('name' => 'pid', 'value' => $data['pid']), '_dropdown1' => array('label' => 'Response', 'name' => 'confirm', array(0 => 'No', 1 => 'Yes')));
         buildForm($form);
         break;
     }
     $data['confirm'] = 1;
     // Fall through otherwise
 // Fall through otherwise
 case 'closeAccountConfirm':
     $b = new Billing();
     if (!$data['confirm']) {
         header('Location: index.php?billing&success=bn');
     } else {
Exemplo n.º 2
0
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);
}