private void btnPaymentDelete_Click(object sender, EventArgs e) { string patientid = txtPaymentPatientID.Text; int registrationfee = 0; if (chkboxPaymentNewPatient.Checked == true) { PatientDBO pdbo2 = new PatientDBO(); Patient patient = pdbo2.findPatient(patientid); lblPaymentRegistrationFee.Text = "Registration Fee:- " + patient.getRegistrationFee().ToString(); registrationfee = patient.getRegistrationFee(); } else if (chkboxPaymentNewPatient.Checked == false) { lblPaymentRegistrationFee.Text = " "; registrationfee = 0; } ; string treatmentcode = txtPaymentTreatmentCode.Text; TreatmentDBO tdbo = new TreatmentDBO(); Treatment treatment = tdbo.findCharges(treatmentcode); lblPaymentDoctorsCharge.Text = "Doctor's charge:- " + treatment.getDoctorsCharge().ToString(); lblPaymentStandardFee.Text = "Treatment Standard Fee:- " + treatment.getStandardFee().ToString(); lblPaymentTotalCharge.Text = "Total Charge:- " + (treatment.getDoctorsCharge() + registrationfee + treatment.getStandardFee()).ToString(); int doctorscharge = treatment.getDoctorsCharge(); int treatmentfee = treatment.getStandardFee(); int totalcharge = treatment.getDoctorsCharge() + treatment.getStandardFee() + registrationfee; PaymentDBO pdbo = new PaymentDBO(); string invoiceno = txtPaymentInvoiceNo.Text; //string patientid = txtPaymentPatientID.Text; (temp) string paymentmode = "None"; if (rdobtnPaymentCash.Checked == true) { paymentmode = "Cash"; } else if (rdobtnPaymentCreditCard.Checked == true) { paymentmode = "Credit Card"; } else if (rdobtnPaymentCheque.Checked == true) { paymentmode = "Cheque"; } ; Payment payment = new Payment(invoiceno, treatmentcode, patientid, paymentmode, doctorscharge, treatmentfee, totalcharge, registrationfee); pdbo.deletePaymentInfo(payment); MessageBox.Show("The invoice & it's payment information has been removed.", "Delete Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtPaymentInvoiceNo.Text = ""; txtPaymentTreatmentCode.Text = ""; txtPaymentPatientID.Text = ""; rdobtnPaymentCash.Checked = false; rdobtnPaymentCheque.Checked = false; chkboxPaymentNewPatient.Checked = false; rdoBtnsasas.Checked = false; rdobtnPaymentCreditCard.Checked = false; lblPaymentTreatmentType.Text = ""; lblPaymentPatientName.Text = ""; lblPaymentDoctorsCharge.Text = "Doctor's charge:- "; lblPaymentStandardFee.Text = "Treatment Standard Fee:- "; lblPaymentTotalCharge.Text = "Total Charge:- "; lblPaymentRegistrationFee.Text = "Registration Fee:- "; }
private void btnPaymentSave_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtPaymentInvoiceNo.Text)) { MessageBox.Show("An Invoice No should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (string.IsNullOrWhiteSpace(txtPaymentTreatmentCode.Text)) { MessageBox.Show("The treatment ID should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (string.IsNullOrWhiteSpace(txtPaymentPatientID.Text)) { MessageBox.Show("The patient's ID should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { string patientid = txtPaymentPatientID.Text; int registrationfee = 0; if (chkboxPaymentNewPatient.Checked == true) { PatientDBO pdbo2 = new PatientDBO(); Patient patient = pdbo2.findPatient(patientid); lblPaymentRegistrationFee.Text = "Registration Fee:- " + patient.getRegistrationFee().ToString(); registrationfee = patient.getRegistrationFee(); } else if (chkboxPaymentNewPatient.Checked == false) { lblPaymentRegistrationFee.Text = " "; registrationfee = 0; } ; string treatmentcode = txtPaymentTreatmentCode.Text; TreatmentDBO tdbo = new TreatmentDBO(); Treatment treatment = tdbo.findCharges(treatmentcode); lblPaymentDoctorsCharge.Text = "Doctor's charge:- " + treatment.getDoctorsCharge().ToString(); lblPaymentStandardFee.Text = "Treatment Standard Fee:- " + treatment.getStandardFee().ToString(); lblPaymentTotalCharge.Text = "Total Charge:- " + (treatment.getDoctorsCharge() + registrationfee + treatment.getStandardFee()).ToString(); int doctorscharge = treatment.getDoctorsCharge(); int treatmentfee = treatment.getStandardFee(); int totalcharge = treatment.getDoctorsCharge() + treatment.getStandardFee() + registrationfee; try { PaymentDBO pdbo = new PaymentDBO(); string invoiceno = txtPaymentInvoiceNo.Text; //string patientid = txtPaymentPatientID.Text; (temp) string paymentmode = "None"; if (rdobtnPaymentCash.Checked == true) { paymentmode = "Cash"; } else if (rdobtnPaymentCreditCard.Checked == true) { paymentmode = "Credit Card"; } else if (rdobtnPaymentCheque.Checked == true) { paymentmode = "Cheque"; } ; Payment payment = new Payment(invoiceno, treatmentcode, patientid, paymentmode, doctorscharge, treatmentfee, totalcharge, registrationfee); pdbo.paymentInfo(payment); MessageBox.Show("Payment information has been recorded successfully.", "Save Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex2) { MessageBox.Show("This Invoice ID has already been generated.", "Duplicate Entry", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }