コード例 #1
0
ファイル: process.php プロジェクト: h4xnoodle/cs348
         header('Location: index.php?billing&success=b');
     } else {
         printError("Failed to receive payment.");
     }
     break;
 case 'processEDTDisplay':
     $t = new Treatment();
     $b = new Billing();
     $edts = $t->getUnprocessedEDTs($data['pid']);
     $b->displayUnprocessedEDTs($edts);
     break;
 case 'processAllEDTs':
     $success = true;
     $b = new Billing();
     $t = new Treatment();
     $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']);
コード例 #2
0
ファイル: tests.php プロジェクト: h4xnoodle/cs348
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);
}