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(); $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 {