Made code for cmu add refill in info form.

This commit is contained in:
Adam McCane 2024-02-20 18:34:59 -05:00
parent 26cc310f50
commit ec5d2fb769
2 changed files with 105 additions and 17 deletions

View File

@ -34,8 +34,8 @@ namespace Louis__Pharmacy_CNSA212_FP
System.Windows.Forms.Label lblPatientLast; System.Windows.Forms.Label lblPatientLast;
System.Windows.Forms.Label lblPhysicianFirst; System.Windows.Forms.Label lblPhysicianFirst;
System.Windows.Forms.Label lblPhysicianLast; System.Windows.Forms.Label lblPhysicianLast;
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmInfo)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmInfo));
this.tbcInfo = new System.Windows.Forms.TabControl(); this.tbcInfo = new System.Windows.Forms.TabControl();
this.tbpPatient = new System.Windows.Forms.TabPage(); this.tbpPatient = new System.Windows.Forms.TabPage();
@ -285,7 +285,22 @@ namespace Louis__Pharmacy_CNSA212_FP
this.dgvPatient.AllowUserToAddRows = false; this.dgvPatient.AllowUserToAddRows = false;
this.dgvPatient.AllowUserToDeleteRows = false; this.dgvPatient.AllowUserToDeleteRows = false;
this.dgvPatient.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvPatient.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvPatient.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.pat_id, this.FirstName, this.LastName, this.MiddleInitials, this.City, this.UsState, this.Zip, this.Ibs, this.Height_feet, this.Height_inches, this.Ailment, this.DOB, this.PhoneNumber, this.Gender, this.Medications }); this.dgvPatient.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.pat_id,
this.FirstName,
this.LastName,
this.MiddleInitials,
this.City,
this.UsState,
this.Zip,
this.Ibs,
this.Height_feet,
this.Height_inches,
this.Ailment,
this.DOB,
this.PhoneNumber,
this.Gender,
this.Medications});
this.dgvPatient.ContextMenuStrip = this.cmuPatient; this.dgvPatient.ContextMenuStrip = this.cmuPatient;
this.dgvPatient.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgvPatient.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgvPatient.Location = new System.Drawing.Point(0, 0); this.dgvPatient.Location = new System.Drawing.Point(0, 0);
@ -400,9 +415,9 @@ namespace Louis__Pharmacy_CNSA212_FP
// DOB // DOB
// //
this.DOB.DataPropertyName = "DOB"; this.DOB.DataPropertyName = "DOB";
dataGridViewCellStyle3.Format = "d"; dataGridViewCellStyle1.Format = "d";
dataGridViewCellStyle3.NullValue = null; dataGridViewCellStyle1.NullValue = null;
this.DOB.DefaultCellStyle = dataGridViewCellStyle3; this.DOB.DefaultCellStyle = dataGridViewCellStyle1;
this.DOB.HeaderText = "DOB"; this.DOB.HeaderText = "DOB";
this.DOB.MinimumWidth = 6; this.DOB.MinimumWidth = 6;
this.DOB.Name = "DOB"; this.DOB.Name = "DOB";
@ -439,7 +454,10 @@ namespace Louis__Pharmacy_CNSA212_FP
// cmuPatient // cmuPatient
// //
this.cmuPatient.ImageScalingSize = new System.Drawing.Size(20, 20); this.cmuPatient.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmuPatient.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPatientNew, this.cmuPatientEdit, this.cmuPatientDelete }); this.cmuPatient.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmuPatientNew,
this.cmuPatientEdit,
this.cmuPatientDelete});
this.cmuPatient.Name = "contextMenuStrip1"; this.cmuPatient.Name = "contextMenuStrip1";
this.cmuPatient.Size = new System.Drawing.Size(108, 70); this.cmuPatient.Size = new System.Drawing.Size(108, 70);
// //
@ -544,7 +562,14 @@ namespace Louis__Pharmacy_CNSA212_FP
this.dgvPrescription.AllowUserToAddRows = false; this.dgvPrescription.AllowUserToAddRows = false;
this.dgvPrescription.AllowUserToDeleteRows = false; this.dgvPrescription.AllowUserToDeleteRows = false;
this.dgvPrescription.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvPrescription.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Medication_id, this.MedicationName, this.IntakeMethod, this.Frequency, this.Dosage, this.Purpose, this.RxNum }); this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Medication_id,
this.MedicationName,
this.IntakeMethod,
this.Frequency,
this.Dosage,
this.Purpose,
this.RxNum});
this.dgvPrescription.ContextMenuStrip = this.cmuMedication; this.dgvPrescription.ContextMenuStrip = this.cmuMedication;
this.dgvPrescription.Location = new System.Drawing.Point(3, 3); this.dgvPrescription.Location = new System.Drawing.Point(3, 3);
this.dgvPrescription.Name = "dgvPrescription"; this.dgvPrescription.Name = "dgvPrescription";
@ -620,7 +645,10 @@ namespace Louis__Pharmacy_CNSA212_FP
// cmuMedication // cmuMedication
// //
this.cmuMedication.ImageScalingSize = new System.Drawing.Size(20, 20); this.cmuMedication.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmuMedication.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuMedicationNew, this.cmuMedicationEdit, this.cmuMedicationDelete }); this.cmuMedication.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmuMedicationNew,
this.cmuMedicationEdit,
this.cmuMedicationDelete});
this.cmuMedication.Name = "cmuMedication"; this.cmuMedication.Name = "cmuMedication";
this.cmuMedication.Size = new System.Drawing.Size(108, 70); this.cmuMedication.Size = new System.Drawing.Size(108, 70);
// //
@ -729,7 +757,18 @@ namespace Louis__Pharmacy_CNSA212_FP
this.dgvPhysician.AllowUserToAddRows = false; this.dgvPhysician.AllowUserToAddRows = false;
this.dgvPhysician.AllowUserToDeleteRows = false; this.dgvPhysician.AllowUserToDeleteRows = false;
this.dgvPhysician.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvPhysician.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvPhysician.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Phys_id, this.namefirst, this.namelast, this.initialsmiddle, this.cit, this.state, this.zipp, this.dobb, this.numberphone, this.gennder, this.Specialty }); this.dgvPhysician.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Phys_id,
this.namefirst,
this.namelast,
this.initialsmiddle,
this.cit,
this.state,
this.zipp,
this.dobb,
this.numberphone,
this.gennder,
this.Specialty});
this.dgvPhysician.ContextMenuStrip = this.cmuPhysician; this.dgvPhysician.ContextMenuStrip = this.cmuPhysician;
this.dgvPhysician.Location = new System.Drawing.Point(0, 3); this.dgvPhysician.Location = new System.Drawing.Point(0, 3);
this.dgvPhysician.Name = "dgvPhysician"; this.dgvPhysician.Name = "dgvPhysician";
@ -806,9 +845,9 @@ namespace Louis__Pharmacy_CNSA212_FP
// dobb // dobb
// //
this.dobb.DataPropertyName = "DOB"; this.dobb.DataPropertyName = "DOB";
dataGridViewCellStyle4.Format = "d"; dataGridViewCellStyle2.Format = "d";
dataGridViewCellStyle4.NullValue = null; dataGridViewCellStyle2.NullValue = null;
this.dobb.DefaultCellStyle = dataGridViewCellStyle4; this.dobb.DefaultCellStyle = dataGridViewCellStyle2;
this.dobb.HeaderText = "DOB"; this.dobb.HeaderText = "DOB";
this.dobb.MinimumWidth = 6; this.dobb.MinimumWidth = 6;
this.dobb.Name = "dobb"; this.dobb.Name = "dobb";
@ -845,7 +884,10 @@ namespace Louis__Pharmacy_CNSA212_FP
// cmuPhysician // cmuPhysician
// //
this.cmuPhysician.ImageScalingSize = new System.Drawing.Size(20, 20); this.cmuPhysician.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmuPhysician.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPhysicianNew, this.cmuPhysicianEdit, this.cmuPhysicianDelete }); this.cmuPhysician.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmuPhysicianNew,
this.cmuPhysicianEdit,
this.cmuPhysicianDelete});
this.cmuPhysician.Name = "cmuPhysician"; this.cmuPhysician.Name = "cmuPhysician";
this.cmuPhysician.Size = new System.Drawing.Size(108, 70); this.cmuPhysician.Size = new System.Drawing.Size(108, 70);
// //
@ -978,9 +1020,14 @@ namespace Louis__Pharmacy_CNSA212_FP
// cmuPrescription // cmuPrescription
// //
this.cmuPrescription.ImageScalingSize = new System.Drawing.Size(20, 20); this.cmuPrescription.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmuPrescription.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPrescriptionNew, this.cmuPrescriptionEdit, this.cmuPrescriptionDelete, this.cmuPrescriptionRefillThis, this.cmuPrescriptionViewRefills }); this.cmuPrescription.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmuPrescriptionNew,
this.cmuPrescriptionEdit,
this.cmuPrescriptionDelete,
this.cmuPrescriptionRefillThis,
this.cmuPrescriptionViewRefills});
this.cmuPrescription.Name = "cmuPrescription"; this.cmuPrescription.Name = "cmuPrescription";
this.cmuPrescription.Size = new System.Drawing.Size(244, 136); this.cmuPrescription.Size = new System.Drawing.Size(244, 114);
// //
// cmuPrescriptionNew // cmuPrescriptionNew
// //
@ -1007,6 +1054,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuPrescriptionRefillThis.Name = "cmuPrescriptionRefillThis"; this.cmuPrescriptionRefillThis.Name = "cmuPrescriptionRefillThis";
this.cmuPrescriptionRefillThis.Size = new System.Drawing.Size(243, 22); this.cmuPrescriptionRefillThis.Size = new System.Drawing.Size(243, 22);
this.cmuPrescriptionRefillThis.Text = "Refill This Prescription"; this.cmuPrescriptionRefillThis.Text = "Refill This Prescription";
this.cmuPrescriptionRefillThis.Click += new System.EventHandler(this.cmuPrescriptionRefillThis_Click);
// //
// cmuPrescriptionViewRefills // cmuPrescriptionViewRefills
// //
@ -1055,6 +1103,7 @@ namespace Louis__Pharmacy_CNSA212_FP
((System.ComponentModel.ISupportInitialize)(this.dgvRx)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvRx)).EndInit();
this.cmuPrescription.ResumeLayout(false); this.cmuPrescription.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionViewRefills; private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionViewRefills;

View File

@ -707,9 +707,48 @@ namespace Louis__Pharmacy_CNSA212_FP
} }
private void cmuAddRefill_Click(object sender, EventArgs e) private void cmuPrescriptionRefillThis_Click(object sender, EventArgs e)
{ {
string refillID = "";
DateTime date = new DateTime();
string patientID = "";
string medicationID = "";
string rxNum = "";
Int32 numRefills = 0;
Int32 pastNumRefills = 0;
rxNum = ds.Tables[0].Rows[0]["RxNum_id"].ToString();
try
{
DataSet ds = new DataSet();
PharmacyDataTier phaDT = new PharmacyDataTier();
ds = phaDT.NumberofRefills(rxNum);
numRefills = Int32.Parse(ds.Tables[0].Rows[0]["numRefills"].ToString());
pastNumRefills = Int32.Parse(ds.Tables[0].Rows[0]["pastNumRefills"].ToString());
if (numRefills == pastNumRefills)
{
MessageBox.Show("This prescription has reached the maximum number of refills.", "Max Refill", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
refillID = PharmacyDataTier.GetNextRefillID().ToString();
date = DateTime.Now;
patientID = ds.Tables[0].Rows[0]["Patient_id"].ToString() ;
medicationID = ds.Tables[0].Rows[0]["Medication_id"].ToString();
PharmacyDataTier.AddRefill(refillID, date, patientID, medicationID, rxNum);
PharmacyDataTier.PastRefills(rxNum);
}
}
catch (Exception exception)
{
}
} }
} }
}
} }