#include <QtGui>
#include "oppg2.h"
//Start Oppg2 class
{
setupUi(this);
connect(pushButton_checkout, SIGNAL(clicked()), this, SLOT(checkout()));
connect(pushButton_clear, SIGNAL(clicked()), this, SLOT(clear()));
}
void Oppg2::checkout()
{
PatientAccount PA;
Surgery S;
Pharmacy P;
int numDays;
int numSurgery;
int numMedication;
numDays=spinBox_days->value();
numSurgery=spinBox_surgery->value();
numMedication=spinBox_medication->value();
textBrowser
->append
("Number of days spent in hospital: " + QString::number(numDays
));
textBrowser
->append
("Cost of hospitalstay: " + QString::number(PA.
getDaysInHospitalCost()));
textBrowser->append("Type of surgery: " + comboBox_surgery->currentText());
textBrowser
->append
("Number of " + comboBox_surgery
->currentText
() + " surgery: " + QString::number(numSurgery
));
textBrowser
->append
("Cost of surgery: " + QString::number(S.
getTotalSurgeryCost()));
textBrowser->append("Type of medication: " + comboBox_medication->currentText());
textBrowser
->append
("Amount of " + comboBox_medication
->currentText
() + " medication: " + QString::number(numMedication
));
textBrowser
->append
("Cost of medication: " + QString::number(P.
getTotalPharmacyCost()));
textBrowser
->append
("Total cost of hospitalstay: " + QString::number(PA.
getTotalCharges()));
}
void Oppg2::clear()
{
spinBox_days->setValue(0);
spinBox_surgery->setValue(0);
spinBox_medication->setValue(0);
textBrowser->clear();
}
//End Oppg2 class
//Start PatientAccount class
void PatientAccount::setDaysInHospital(int daysInHospital)
{
daysInHospital=spinBox_days->value();
}
void PatientAccount::setDaysInHospitalCost(int daysInHospitalCost)
{
daysInHospitalCost=daysInHospital*dailyRate;
}
void PatientAccount::setTotalCharges(int totalCharges)
{
Surgery S;
int gTSC=S.getTotalSurgeryCost();
Pharmacy P;
int gTPC=P.getTotalPharmacyCost();
totalCharges=(daysInHospitalCost+gTSC+gTPC);
}
int PatientAccount::getDaysInHospitalCost()
{
return daysInHospitalCost;
}
int PatientAccount::getTotalCharges()
{
return totalCharges;
}
//End PatientAccount class
//Start Surgery class
void Surgery::setNumSurgery(int numSurgery)
{
numSurgery=spinBox_surgery->value();
}
void Surgery::setSurgeryCost(int surgeryCost)
{
surgery=comboBox_surgery->currentText();
if (surgery=="Brain") surgeryCost=220;
else if (surgery=="Heart") surgeryCost=200;
else if (surgery=="Eye") surgeryCost=90;
else if (surgery=="Arm") surgeryCost=110;
else if (surgery=="Leg") surgeryCost=120;
}
void Surgery::setTotalSurgeryCost(int totalSurgeryCost)
{
totalSurgeryCost=(numSurgery)*(surgeryCost);
}
int Surgery::getTotalSurgeryCost()
{
return totalSurgeryCost;
}
//End Surgery class
//Start Pharmacy class
void Pharmacy::setNumMedication(int numMedication)
{
numMedication=spinBox_medication->value();
}
void Pharmacy::setPharmacyCost(int pharmacyCost)
{
medication=comboBox_medication->currentText();
if (medication=="Fentanyl") pharmacyCost=30;
else if (medication=="Naproxen") pharmacyCost=15;
else if (medication=="Oxycontin") pharmacyCost=35;
else if (medication=="Valium") pharmacyCost=10;
else if (medication=="Vicodin") pharmacyCost=25;
}
void Pharmacy::setTotalPharmacyCost(int totalPharmacyCost)
{
totalPharmacyCost=(numMedication)*(pharmacyCost);
}
int Pharmacy::getTotalPharmacyCost()
{
return totalPharmacyCost;
}
//End Pharmacy class
Bookmarks