// public PatientInsInfo insurance; public Patient() { if (PIMS.Program.currentUser is Doctor || PIMS.Program.currentUser is MedStaff) { directory = new PatientDirInfo(); treatment = new PatientTreatmentInfo(); billing = new PatientBillingInfo(); //insurance = new PatientInsInfo(); } else if (PIMS.Program.currentUser is OfficeStaff) { directory = new PatientDirInfo(); billing = new PatientBillingInfo(); // insurance = new PatientInsInfo(); treatment = null; } else { directory = new PatientDirInfo(); // insurance = null; treatment = null; billing = null; } }
static void updateBillingInfo() { Patient patient = PimsMain.Program.currentPatient; PatientBillingInfo bill = PimsMain.Program.currentPatient.billing; if (cnn != null && cnn.State == System.Data.ConnectionState.Open) { cnn.Close(); } cnn.Open(); String cmdText = "UPDATE Insurance SET provider = @pr, BIN = @bin, ID = @id, " + "PCN = @pcn, groupNo = @gn " + "WHERE patientID = " + patient.directory.patientID; SqlCommand cmd = new SqlCommand(cmdText, cnn); cmd.Parameters.AddWithValue("@pr", bill.insurance.provider); cmd.Parameters.AddWithValue("@bin", bill.insurance.bin); cmd.Parameters.AddWithValue("@id", bill.insurance.id); cmd.Parameters.AddWithValue("@pcn", bill.insurance.pcn); cmd.Parameters.AddWithValue("@gn", bill.insurance.groupNum); cmd.ExecuteNonQuery(); cmdText = "UPDATE Charges SET item = @item, cost = @c, amountPaid = @ap, " + "insurancePaid = @ip, dueDate = @dd WHERE idNum = @id " + "if @@ROWCOUNT = 0 INSERT into Charges values('@pid','@item'," + "'@c','@ap','@ip','@dd','id')"; foreach (BillingLineItem item in bill.items) { cmd = new SqlCommand(cmdText, cnn); cmd.Parameters.AddWithValue("@item", item.item); cmd.Parameters.AddWithValue("@c", item.cost); cmd.Parameters.AddWithValue("@ap", item.paid); cmd.Parameters.AddWithValue("@ip", item.insPaid); cmd.Parameters.AddWithValue("@dd", item.dueDate); cmd.Parameters.AddWithValue("@id", item.itemId); cmd.ExecuteNonQuery(); } }