Compare commits

...

10 Commits

Author SHA1 Message Date
EggMan20339
63e5ad09fb made QOL changes to refill edit 2024-02-23 09:46:49 -05:00
EggMan20339
f83804237c added refresh frminfo on refill delete, commented out 97 on frmrefillAdd 2024-02-23 08:10:06 -05:00
EggMan20339
8d24db6807 Merge remote-tracking branch 'origin/master' 2024-02-23 12:57:35 -05:00
EggMan20339
4da6d861e5 removed spare row on prescription dgv 2024-02-23 12:57:26 -05:00
Adam McCane
5622be21fd Refresh funtionality added to cmu of view refill form. 2024-02-23 02:23:31 -05:00
Adam McCane
a1f2fd1fe2 Added code to allow refill edit to modify prescription refill values successfully. 2024-02-22 22:19:12 -05:00
Adam McCane
9f8d567b3d Merge branch 'master' of https://github.com/EggMan20339/CNSA-212 2024-02-21 16:56:23 -05:00
Adam McCane
ea7474900f Merge 2024-02-21 16:56:17 -05:00
Adam McCane
03e7185225 Created delete functionality for view refill form. 2024-02-21 15:51:39 -05:00
64edeb203b made DOB format short in patients 2024-02-21 13:11:24 -05:00
8 changed files with 146 additions and 92 deletions

View File

@ -1235,6 +1235,34 @@ namespace Louis__Pharmacy_CNSA212_FP
}
}
public static void DecrementPastRefills(string rxNum)
{
try
{
myConn.Open();
cmdString.Parameters.Clear();
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "DecrementPastRefills";
cmdString.Parameters.Add("@Prescription_id", SqlDbType.VarChar, 11).Value = rxNum;
cmdString.ExecuteNonQuery();
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
}
finally
{
myConn.Close();
}
}
public static void CreatePrescription(
string RxNum,
string Patient_id,

View File

@ -237,7 +237,6 @@ namespace Louis__Pharmacy_CNSA212_FP
this.splcPatient.Panel1.Controls.Add(lblPatientFirst);
this.splcPatient.Panel1.Controls.Add(this.txtPatientFirst);
this.splcPatient.Panel1.Controls.Add(this.btnPatientSearch);
//this.splcPatient.Panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.Panel1_Paint);
//
// splcPatient.Panel2
//
@ -250,10 +249,7 @@ namespace Louis__Pharmacy_CNSA212_FP
// cmuPatient
//
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.Size = new System.Drawing.Size(108, 70);
//
@ -324,22 +320,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.dgvPatient.AllowUserToAddRows = false;
this.dgvPatient.AllowUserToDeleteRows = false;
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.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgvPatient.Location = new System.Drawing.Point(0, 0);
@ -526,10 +507,7 @@ namespace Louis__Pharmacy_CNSA212_FP
// cmuMedication
//
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.Size = new System.Drawing.Size(108, 70);
//
@ -603,14 +581,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.dgvMedication.AllowUserToAddRows = false;
this.dgvMedication.AllowUserToDeleteRows = false;
this.dgvMedication.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvMedication.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Medication_id,
this.MedicationName,
this.IntakeMethod,
this.Frequency,
this.Dosage,
this.Purpose,
this.RxNum});
this.dgvMedication.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Medication_id, this.MedicationName, this.IntakeMethod, this.Frequency, this.Dosage, this.Purpose, this.RxNum });
this.dgvMedication.ContextMenuStrip = this.cmuMedication;
this.dgvMedication.Location = new System.Drawing.Point(3, 3);
this.dgvMedication.Name = "dgvMedication";
@ -726,10 +697,7 @@ namespace Louis__Pharmacy_CNSA212_FP
// cmuPhysician
//
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.Size = new System.Drawing.Size(108, 70);
//
@ -799,18 +767,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.dgvPhysician.AllowUserToAddRows = false;
this.dgvPhysician.AllowUserToDeleteRows = false;
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.Location = new System.Drawing.Point(0, 3);
this.dgvPhysician.Name = "dgvPhysician";
@ -947,14 +904,9 @@ namespace Louis__Pharmacy_CNSA212_FP
// cmuPrescription
//
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.Size = new System.Drawing.Size(244, 136);
this.cmuPrescription.Size = new System.Drawing.Size(244, 114);
//
// cmuPrescriptionNew
//
@ -1068,15 +1020,10 @@ namespace Louis__Pharmacy_CNSA212_FP
//
// dgvPrescription
//
this.dgvPrescription.AllowUserToAddRows = false;
this.dgvPrescription.AllowUserToDeleteRows = false;
this.dgvPrescription.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.RxNum_id,
this.numRefills,
this.pastNumRefills,
this.PrescribedBy,
this.Physician_id,
this.Medicationid,
this.Patientid});
this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.RxNum_id, this.numRefills, this.pastNumRefills, this.PrescribedBy, this.Physician_id, this.Medicationid, this.Patientid });
this.dgvPrescription.ContextMenuStrip = this.cmuPrescription;
this.dgvPrescription.Location = new System.Drawing.Point(0, 236);
this.dgvPrescription.Name = "dgvPrescription";
@ -1177,7 +1124,6 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuPrescription.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvPrescription)).EndInit();
this.ResumeLayout(false);
}
private System.Windows.Forms.DataGridViewTextBoxColumn RxNum_id;

View File

@ -941,7 +941,7 @@ namespace Louis__Pharmacy_CNSA212_FP
string rxNumString = (row.Cells[0].Value).ToString();
Int32 rxNum = Int32.Parse(rxNumString);
frmRefill refill = new frmRefill(rxNum);
frmRefill refill = new frmRefill(rxNum, this);
refill.MdiParent = MdiParent;
refill.StartPosition = FormStartPosition.CenterScreen;
refill.Show();

View File

@ -76,7 +76,8 @@ namespace Louis__Pharmacy_CNSA212_FP
txtWeight.Text = ds.Tables[0].Rows[0]["lbs"].ToString();
txtHeightFt.Text = ds.Tables[0].Rows[0]["Height_feet"].ToString();
txtHeightIn.Text = ds.Tables[0].Rows[0]["Height_inches"].ToString();
txtDOB.Text = ds.Tables[0].Rows[0]["DOB"].ToString();
DateTime date = DateTime.Parse(ds.Tables[0].Rows[0]["DOB"].ToString());
txtDOB.Text = date.ToString("d");
cboGender.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
txtCity.Text = ds.Tables[0].Rows[0]["City"].ToString();
txtZip.Text = ds.Tables[0].Rows[0]["Zip"].ToString();

View File

@ -53,6 +53,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuRefill = new System.Windows.Forms.ContextMenuStrip(this.components);
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.cmuRefresh = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dgvRefills)).BeginInit();
this.cmuRefill.SuspendLayout();
this.SuspendLayout();
@ -180,22 +181,31 @@ namespace Louis__Pharmacy_CNSA212_FP
//
this.cmuRefill.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.editToolStripMenuItem,
this.deleteToolStripMenuItem});
this.deleteToolStripMenuItem,
this.cmuRefresh});
this.cmuRefill.Name = "cmuRefill";
this.cmuRefill.Size = new System.Drawing.Size(108, 48);
this.cmuRefill.Size = new System.Drawing.Size(181, 92);
//
// editToolStripMenuItem
//
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.editToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.editToolStripMenuItem.Text = "Edit";
this.editToolStripMenuItem.Click += new System.EventHandler(this.editToolStripMenuItem_Click);
//
// deleteToolStripMenuItem
//
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.deleteToolStripMenuItem.Text = "Delete";
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
//
// cmuRefresh
//
this.cmuRefresh.Name = "cmuRefresh";
this.cmuRefresh.Size = new System.Drawing.Size(180, 22);
this.cmuRefresh.Text = "Refresh";
this.cmuRefresh.Click += new System.EventHandler(this.cmuRefresh_Click);
//
// frmRefill
//
@ -250,5 +260,6 @@ namespace Louis__Pharmacy_CNSA212_FP
private System.Windows.Forms.ContextMenuStrip cmuRefill;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem cmuRefresh;
}
}

View File

@ -19,9 +19,12 @@ namespace Louis__Pharmacy_CNSA212_FP
{
public DataSet ds = new DataSet();
private int rxNum = 0;
public frmRefill(int thisRxID)
private frmInfo SourceForm = new frmInfo();
public frmRefill(int thisRxID, frmInfo SenderForm)
{
SourceForm = SenderForm;
InitializeComponent();
rxNum = thisRxID;
frmRefill_Load(null, null);
@ -45,6 +48,19 @@ namespace Louis__Pharmacy_CNSA212_FP
dgvRefills.DataSource = ds.Tables[0];
}
public void frmRefill_reLoad(object sender, EventArgs e)
{
int rxID = 0;
DataGridViewRow row = new DataGridViewRow();
rxID = rxNum;
DataSet ds = new DataSet();
ds = PharmacyDataTier.GetRefill(rxID.ToString());
dgvRefills.DataSource = ds.Tables[0];
}
private void editToolStripMenuItem_Click(object sender, EventArgs e)
{
string refillID = "";
@ -54,7 +70,7 @@ namespace Louis__Pharmacy_CNSA212_FP
refillID = (row.Cells[0].Value).ToString();
frmRefillAdd add = new frmRefillAdd(false);
frmRefillAdd add = new frmRefillAdd(false, this);
add.MdiParent = MdiParent;
add.StartPosition = FormStartPosition.CenterScreen;
add.Show();
@ -67,6 +83,39 @@ namespace Louis__Pharmacy_CNSA212_FP
editToolStripMenuItem_Click(sender, e);
}
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
string refillID = "";
string rxID = "";
DataGridViewRow row = new DataGridViewRow();
row = dgvRefills.SelectedRows[0];
refillID = (row.Cells[0].Value).ToString();
rxID = (row.Cells[4].Value).ToString();
PharmacyDataTier.DeleteRefill(refillID);
PharmacyDataTier.DecrementPastRefills(rxID);
frmRefill_reLoad(sender, e);
SourceForm.btnPrescriptionSearch_Click(sender,e);
}
public void refreshrefills(object sender, EventArgs e)
{
DataGridViewRow row = new DataGridViewRow();
row = dgvRefills.SelectedRows[0];
string rxNumString = (row.Cells[4].Value).ToString();
Int32 rxNum = Int32.Parse(rxNumString);
frmRefill_Load(null, null);
}
private void cmuRefresh_Click(object sender, EventArgs e)
{
refreshrefills(sender, e);
}
//private void btnSearch_Click(object sender, EventArgs e)
//{
// string patientID = "";

View File

@ -160,6 +160,7 @@
this.Controls.Add(this.lblRefillID);
this.Name = "frmRefillAdd";
this.Text = "frmRefillAdd";
//this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmRefillAdd_FormClosed);
this.Load += new System.EventHandler(this.frmRefillAdd_Load);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -15,9 +15,12 @@ namespace Louis__Pharmacy_CNSA212_FP
{
private static bool isAdd;
public DataSet ds = new DataSet();
public frmRefillAdd(bool isNew)
public string currentID = "";
private frmRefill SourceForm;
public frmRefillAdd(bool isNew, frmRefill refillform)
{
SourceForm = refillform;
isAdd = isNew;
InitializeComponent();
@ -59,6 +62,8 @@ namespace Louis__Pharmacy_CNSA212_FP
txtPatientID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString();
txtMedicationID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString();
txtRxNumber.Text = ds.Tables[0].Rows[0]["RxNum_id"].ToString();
currentID = txtRxNumber.Text;
}
private void btnAdd_Click(object sender, EventArgs e)
@ -91,28 +96,41 @@ namespace Louis__Pharmacy_CNSA212_FP
medicationID = txtMedicationID.Text.Trim();
rxNum = txtRxNumber.Text.Trim();
PharmacyDataTier.UpdateRefill(refillID, date, patientID, medicationID, rxNum);
}
else
{
if (numRefills == pastNumRefills)
{
MessageBox.Show("This prescription has reached the maximum number of refills.", "Max Refill", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (isAdd)
{
refillID = txtRefillID.Text.Trim();
date = DateTime.Parse(txtRefillDate.Text.Trim());
patientID = txtPatientID.Text.Trim();
medicationID = txtMedicationID.Text.Trim();
// frmRefill refill = new frmRefill(0, this);
PharmacyDataTier.AddRefill(refillID, date, patientID, medicationID, rxNum);
PharmacyDataTier.UpdateRefill(refillID, date, patientID, medicationID, rxNum);
if (currentID != rxNum)
{
PharmacyDataTier.DecrementPastRefills(currentID);
PharmacyDataTier.PastRefills(rxNum);
}
}
else
{
//if (numRefills == pastNumRefills)
//{
// MessageBox.Show("This prescription has reached the maximum number of refills.", "Max Refill", MessageBoxButtons.OK, MessageBoxIcon.Error);
//}
//else
//{
// if (isAdd)
// {
// refillID = txtRefillID.Text.Trim();
// date = DateTime.Parse(txtRefillDate.Text.Trim());
// patientID = txtPatientID.Text.Trim();
// medicationID = txtMedicationID.Text.Trim();
// PharmacyDataTier.AddRefill(refillID, date, patientID, medicationID, rxNum);
// PharmacyDataTier.PastRefills(rxNum);
// }
//}
}
SourceForm.frmRefill_reLoad(sender, e);
Close();
}
catch (Exception exception)
{