public bool UpdateLabTestToken(InjectionLabTest inLb) { try { con = new OleDbConnection(); this.readconfile = new ReadConfigFile(); con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); string update = ""; tran = con.BeginTransaction(); cmd = new OleDbCommand(update, con); cmd.Transaction = tran; if (inLb.IsInjectionToken == false) { update = "update injectionlabtest set TokenAmount=" + inLb.CashReceived + " where TokenNumber=" + inLb.TokenNumber + " and LabTestId = " + inLb.Tests[0].LabTestId; cmd.CommandText = update; cmd.ExecuteNonQuery(); } tran.Commit(); return(true); } catch (Exception ex) { tran.Rollback(); throw ex; } finally { con.Close(); } }
private void tsReprintToken_Click(object sender, EventArgs e) { //////////////////////////////////////////////////////////////////////////////////////// InjectionLabTest inLb = new InjectionLabTest(); PrintDuplicate = true; //frm3rdreprnt.Reprint = true; frm3rdreprnt.ShowDialog(); if (frm3rdreprnt.inLb != null) { // assignedLabtest = new InjectionLabTestBLL().GetLabTestAssignedUnPaid3(frm3rdreprnt.inLb); // foreach (var item in assignedLabtest) // { // if (frm3rdreprnt.inLb.Type == PatientPayType.General) // frm3rdreprnt.inLb.CashReceived += Convert.ToDouble(item.General); // if (frm3rdreprnt.inLb.Type == PatientPayType.YCOD) // frm3rdreprnt.inLb.CashReceived += Convert.ToDouble(item.YCDO); // if (frm3rdreprnt.inLb.Type == PatientPayType.Poor) // frm3rdreprnt.inLb.CashReceived += Convert.ToDouble(item.Poor); // if (frm3rdreprnt.inLb.Type == PatientPayType.Deserving) // frm3rdreprnt.inLb.CashReceived += Convert.ToDouble(item.Deserving); // } //frm3rdreprnt.inLb.AssignedLabTest = assignedLabtest; //assignedLabtest = frm3rdreprnt.inLb.Tests.Where(t => t.IsMedicine == false).ToList<LabTest>(); frm3rdreprnt.inLb.AssignedLabTest = frm3rdreprnt.inLb.Tests.Where(t => t.IsMedicine == false).ToList <LabTest>(); frm3rdreprnt.inLb.Tests = frm3rdreprnt.inLb.Tests.Where(t => t.IsMedicine == true).ToList <LabTest>(); PrintPreviewLabandInj(false, frm3rdreprnt.inLb); } ////////////////////////////////////////////////////////////////////////////////////// }
public bool LabTestAssignedPaid(InjectionLabTest pr, List <LabTest> labs) { try { con = new OleDbConnection(); this.readconfile = new ReadConfigFile(); con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); tran = con.BeginTransaction(); cmd = new OleDbCommand(); cmd.Connection = con; cmd.Transaction = tran; foreach (LabTest lab in labs) { cmd.CommandText = "insert into LabTestPerformed (TokenDate,TokenMonthYear,TokenNumber,LabTestID,TestPerformed,TestPaid) values('" + pr.TokenDate.ToString("MM/dd/yyyy") + "'," + pr.TokenMonthYear + "," + pr.TokenNumber + "," + lab.LabTestId + "," + 0 + "," + 1 + ")"; cmd.ExecuteNonQuery(); } tran.Commit(); return(true); } catch (Exception ex) { tran.Rollback(); throw ex; } finally { con.Close(); } }
private void PrintPreviewLab(bool preview, InjectionLabTest pr) { prt = new DsPatientRegistration.PatientRegistrationDataTable(); foreach (var item in pr.Tests) { object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, item.TestName + " Qty : " + (item.TimesADay * item.TotalDays), pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.ExistingTokenNo, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate }; prt.LoadDataRow(values, true); } rptLabTestToken crp = new rptLabTestToken(); crp.SetDataSource((DataTable)prt); FrmReportViewer frmViewer = new FrmReportViewer(); frmViewer.crystalReportViewer1.ReportSource = crp; string BranchName = ConfigurationManager.AppSettings["Name"].ToString(); string BranchAddress = ConfigurationManager.AppSettings["Address"].ToString(); crp.SetParameterValue("Duplicate", PrintDuplicate); crp.SetParameterValue("Name", BranchName); crp.SetParameterValue("Address", BranchAddress); if (preview) { frmViewer.ShowDialog(); } else { //frmViewer.crystalReportViewer1.RefreshReport(); frmViewer.crystalReportViewer1.PrintReport(); } PrintDuplicate = false; }
public List <InjectionLabTest> GetInjectionLabTests() { inLbs = new List <InjectionLabTest>(); InjectionLabTest inLb; try { string select = "Select * from InjectionLabTest "; DataTable dt = new DataTable(); con = new OleDbConnection(); readconfile = new ReadConfigFile(); con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); if (con.State == ConnectionState.Open) { da = new OleDbDataAdapter(select, con); da.Fill(dt); } if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { inLb = new InjectionLabTest(); inLb.TokenNumber = Convert.ToInt64(row["TokenNumber"]); inLb.Patient.FirstName = Convert.ToString(row["PatientFirstName"] == DBNull.Value ? "" : row["PatientFirstName"]); inLb.Patient.LastName = Convert.ToString(row["PatientLastName"] == DBNull.Value ? "" : row["PatientLastName"]); inLb.Patient.NIC = Convert.ToString(row["PatientNIC"] == DBNull.Value ? "" : row["PatientNIC"]); inLb.Patient.RegistrationNumber = Convert.ToString(row["PatientRegistrationNumber"] == DBNull.Value ? "" : row["PatientRegistrationNumber"]); inLb.Patient.RegistrationDate = Convert.ToDateTime(row["PatientRegistrationDate"]); inLb.Patient.Address = Convert.ToString(row["PatientAddress"] == DBNull.Value ? "" : row["PatientAddress"]); inLb.CashReceived = Convert.ToDouble(row["TokenAmount"] == DBNull.Value ? "" : row["TokenAmount"]); if (row["PatientPayType"] != DBNull.Value) { inLb.Type = (PatientPayType)Enum.Parse(typeof(PatientPayType), row["PatientPayType"].ToString()); } inLb.TokenDate = Convert.ToDateTime(row["TokenDate"] == DBNull.Value ? DateTime.MinValue : row["TokenDate"]); inLb.ExistingTokenNo = Convert.ToInt64(row["ExistingTokenID"] == DBNull.Value ? 0 : row["ExistingTokenID"]); int testid = Convert.ToInt32(row["LabTestId"] == DBNull.Value ? 0 : row["LabTestId"]); if (testid != 0) { inLb.Tests.Add(new LabTest(testid)); } inLb.IsInjectionToken = Convert.ToBoolean(testid == 0 ? true : false); inLbs.Add(inLb); } } return(inLbs); // return labTests; } catch (Exception ex) { throw ex; } finally { con.Close(); } }
private void PrintPreviewLabandInj(bool preview, InjectionLabTest pr) { prt = new DsPatientRegistration.PatientRegistrationDataTable(); foreach (var item in pr.Tests) { //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Mobile, item.TestName + " Qty : " + item.TimesADay + "*" + item.TotalDays + "=" + (item.TimesADay * item.TotalDays) + " " + item.TimesADayUrdu, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.ExistingTokenNo, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, pr.CashReceivedByUser }; ------- Asif -- 02-04-19 //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Mobile, item.TestName + " " + item.TimesADayNumber, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.ExistingTokenNo, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, pr.CashReceivedByUser }; ------- Asif -- 08-04-19 //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.ExistingTokenNo, item.TestName + " \n" + item.TimesADayNumber, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.Room.Name, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, pr.CashReceivedByUser, pr.TokenBy }; ------- Asif -- 20-04-19 //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName + ' ' + pr.Patient.LastName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Age, pr.ExistingTokenNo, item.TestName + " (" + (item.TimesADay * item.TotalDays) + ")\n" + item.TimesADayUrdu, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.Room.Name + '-' + pr.Room.LabelName, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, pr.CashReceivedByUser, pr.TokenBy }; ------- Asif -- 01-06-19 object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName + ' ' + pr.Patient.LastName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Age, pr.ExistingTokenNo, item.TestName + " (" + (item.TimesADay * item.TotalDays) + ")\n" + item.TimesADayUrdu, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.Room.Name + '-' + pr.Room.LabelName, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, item.TotalDays, pr.TokenBy }; prt.LoadDataRow(values, true); } foreach (var item in pr.Injections) { //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Mobile, item.TestName + " Qty : " + item.TimesADay + "*" + item.TotalDays + "=" + (item.TimesADay * item.TotalDays) + " " + item.TimesADayUrdu, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.ExistingTokenNo, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate }; ------- Asif -- 02-04-19 //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Mobile, item.TestName + " " + item.TimesADayNumber, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.ExistingTokenNo, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate }; ------- Asif -- 08-04-19 //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.ExistingTokenNo, item.TestName + " \n" + item.TimesADayNumber, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.Room.Name, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, pr.TokenBy }; ------- Asif -- 20-04-19 //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName + ' ' + pr.Patient.LastName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Age, pr.ExistingTokenNo, item.TestName + " (" + (item.TimesADay * item.TotalDays) + ")\n" + item.TimesADayUrdu, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.Room.Name + '-' + pr.Room.LabelName, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, pr.TokenBy }; ------- Asif -- 01-06-19 object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName + ' ' + pr.Patient.LastName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Age, pr.ExistingTokenNo, item.TestName + " (" + (item.TimesADay * item.TotalDays) + ")\n" + item.TimesADayUrdu, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.Room.Name + '-' + pr.Room.LabelName, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, item.TotalDays, pr.TokenBy }; prt.LoadDataRow(values, true); } foreach (var item in pr.AssignedLabTest) { //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Mobile, item.TestName + " Qty : " + item.TimesADay + "*" + item.TotalDays + "=" + (item.TimesADay * item.TotalDays) + " " + item.TimesADayUrdu, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.ExistingTokenNo, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate }; ------- Asif -- 02-04-19 //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Mobile, item.TestName + " " + item.TimesADayNumber, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.ExistingTokenNo, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate }; ------- Asif -- 11-04-19 //object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName + ' ' + pr.Patient.LastName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Age, pr.ExistingTokenNo, item.TestName, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.Room.Name + '-' + pr.Room.LabelName, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, pr.CashReceivedByUser, pr.TokenBy }; ------- Asif -- 01-06-19 object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName + ' ' + pr.Patient.LastName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Age, pr.ExistingTokenNo, item.TestName, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.Room.Name + '-' + pr.Room.LabelName, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate, item.TotalDays, pr.TokenBy }; prt.LoadDataRow(values, true); } rptLabTestToken crp = new rptLabTestToken(); crp.SetDataSource((DataTable)prt); FrmReportViewer frmViewer = new FrmReportViewer(); frmViewer.crystalReportViewer1.ReportSource = crp; string BranchName = ConfigurationManager.AppSettings["Name"].ToString(); string BranchAddress = ConfigurationManager.AppSettings["Address"].ToString(); string CompNo = ConfigurationManager.AppSettings["ComplaintNo"].ToString(); crp.SetParameterValue("Duplicate", PrintDuplicate); crp.SetParameterValue("Name", BranchName); crp.SetParameterValue("Address", BranchAddress); crp.SetParameterValue("CashRecievedByUser", pr.CashReceivedByUser); crp.SetParameterValue("ComplaintNo", "Complaint #: " + CompNo); if (preview) { frmViewer.ShowDialog(); } else { //frmViewer.crystalReportViewer1.RefreshReport(); crp.PrintToPrinter(1, false, 0, 0); //// -------- Asif -- 02-06-19 ----- Print Without Showing Print Dialog (Disallow Multiple Copies) //frmViewer.crystalReportViewer1.PrintReport(); //// -------- Asif -- 02-06-19 } PrintDuplicate = false; }
private void btnOk_Click(object sender, EventArgs e) { if (Reprint == true) { Int64 tNo = 0, mYNo = 0; Int64.TryParse(txtTokenNo.Text, out tNo); InjectionLabTestBLL inLabBll = new InjectionLabTestBLL(); PatientRegistration pr = inLabBll.GetPatientRegistration(new PatientRegistration(tNo, Convert.ToInt64(dateTimePicker1.Value.Month + "" + dateTimePicker1.Value.Year))); if (pr.Patient.RegistrationNumber != null && pr.Patient.RegistrationNumber != "") { this.pr = pr; this.Close(); } else { MessageBox.Show("Invalid token no. for selected month and year"); txtTokenNo.Text = "0"; } } else { Int64 tNo = 0, mYNo = 0; Int64.TryParse(txtTokenNo.Text, out tNo); InjectionLabTestBLL inLabBll = new InjectionLabTestBLL(); InjectionLabTest inLb = inLabBll.GetInjectionLabTest(new InjectionLabTest(tNo, Convert.ToInt64(dateTimePicker1.Value.Month + "" + dateTimePicker1.Value.Year))); if (inLb.Patient.RegistrationNumber != null && inLb.Patient.RegistrationNumber != "") { this.inLb = inLb; this.Close(); } else { MessageBox.Show("Invalid token no. for selected month and year"); } } if (doctor) { Int64 tNo = 0, mYNo = 0; Int64.TryParse(txtTokenNo.Text, out tNo); InjectionLabTestBLL inLabBll = new InjectionLabTestBLL(); InjectionLabTest inLb = inLabBll.GetInjectionLabTest(new InjectionLabTest(tNo, Convert.ToInt32(dateTimePicker1.Value.Month + "" + dateTimePicker1.Value.Year))); PatientRegistration pr = inLabBll.GetPatientRegistration(new PatientRegistration(tNo, Convert.ToInt32(dateTimePicker1.Value.Month + "" + dateTimePicker1.Value.Year))); if (pr.Patient.RegistrationNumber != null && pr.Patient.RegistrationNumber != "") { this.pr = pr; this.inLb = inLb; this.Close(); } else { MessageBox.Show("Invalid token no. for selected month and year"); txtTokenNo.Text = "0"; } } }
private void tsSave_Click(object sender, EventArgs e) { InjectionLabTest inLb = new InjectionLabTest(); inLb.IsInjectionToken = false; if (rbThirdGeneral.Checked == true) { inLb.Type = PatientPayType.General; } else if (rbThirdPoor.Checked == true) { inLb.Type = PatientPayType.Poor; } else if (rbThirdYCDO.Checked == true) { inLb.Type = PatientPayType.YCOD; } if (lbxPaidMedicine.Items.Count > 0) { foreach (LabTest item in medications) { inLb.Tests.Add(item); } } Int64 exTokNo = 0; Int64.TryParse(txtThirdExistingToken.Text, out exTokNo); inLb.ExistingTokenNo = exTokNo; inLb.TokenNumber = Convert.ToInt32(this.lblCurrentTokenNumber2nd.Text); inLb.CashReceived = Convert.ToDouble(this.txtThirdCashReceived.Text.Trim()); inLb.Patient.FirstName = this.txtThirdFirstName.Text; inLb.Patient.LastName = this.txtThirdLastName.Text; inLb.Patient.NIC = this.txtThirdCNIC.Text; inLb.Patient.RegistrationDate = this.dtpThirdPatientRegistrationDate.Value.Date; inLb.TokenDate = System.DateTime.Now.Date; inLb.Patient.RegistrationNumber = this.txtThirdPatientRegistrationNumber.Text; //inLb.Patient.Address = this.txtPatientAddress2nd.Text; inLb.TokenMonthYear = Convert.ToInt64(DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString()); try { if (inLabBll.SavePatientToken(inLb)) { GetNextTokenNumber2nd(); PrintPreviewLab(false, inLb); MessageBox.Show("Second Turn in Days Saved Successfully", "Token Granted"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Save Patient Registration Error"); } }
public bool SavePatientToken(InjectionLabTest pr) { try { con = new OleDbConnection(); this.readconfile = new ReadConfigFile(); con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); string insert = ""; tran = con.BeginTransaction(); cmd = new OleDbCommand(insert, con); cmd.Transaction = tran; if (pr.IsInjectionToken == true) { insert = "Insert Into InjectionLabTest(TokenDate,TokenMonthYear,TokenNumber,PatientFirstName,PatientLastName" + ",PatientNIC,PatientAddress,TokenAmount,PatientRegistrationNumber,PatientRegistrationDate,ExistingTokenID) " + "values (#" + pr.TokenDate + "#," + pr.TokenMonthYear + "," + pr.TokenNumber + ",'" + pr.Patient.FirstName + "','" + pr.Patient.LastName + "','" + pr.Patient.NIC + "','" + pr.Patient.Address + "'," + (int)pr.CashReceived + ",'" + pr.Patient.RegistrationNumber + "',#" + pr.Patient.RegistrationDate + "#,'" + pr.ExistingTokenNo + "')"; cmd.CommandText = insert; cmd.ExecuteNonQuery(); } else { foreach (LabTest item in pr.Tests) { insert = "Insert Into InjectionLabTest(TokenDate,TokenMonthYear,TokenNumber,PatientFirstName,PatientLastName" + ",PatientNIC,PatientAddress,TokenAmount,PatientRegistrationNumber,PatientRegistrationDate,LabTestId,PatientPayType,ExistingTokenID) " + "values (#" + pr.TokenDate + "#," + pr.TokenMonthYear + "," + pr.TokenNumber + ",'" + pr.Patient.FirstName + "','" + pr.Patient.LastName + "','" + pr.Patient.NIC + "','" + pr.Patient.Address + "'," + (int)item.CurrentAmount + ",'" + pr.Patient.RegistrationNumber + "',#" + pr.Patient.RegistrationDate + "#," + item.LabTestId + ",'" + pr.Type.ToString() + "','" + pr.ExistingTokenNo + "')"; cmd.CommandText = insert; cmd.ExecuteNonQuery(); } } tran.Commit(); return(true); } catch (Exception ex) { tran.Rollback(); throw ex; } finally { con.Close(); } }
private void PrintPreviewInjection(bool preview, InjectionLabTest pr) { string BranchName = ConfigurationManager.AppSettings["Name"].ToString(); string BranchAddress = ConfigurationManager.AppSettings["Address"].ToString(); string CompNo = ConfigurationManager.AppSettings["ComplaintNo"].ToString(); prt = new DsPatientRegistration.PatientRegistrationDataTable(); if (pr.Injections.Count == 0) { object[] values = { 0, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName + ' ' + pr.Patient.LastName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Age, pr.Patient.Mobile, "", pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.ExistingTokenNo, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate }; prt.LoadDataRow(values, true); } else { foreach (LabTest item in pr.Injections) { object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName + ' ' + pr.Patient.LastName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Age, pr.Patient.Mobile, item.TestName, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, this.txtExistingToken.Text, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate }; prt.LoadDataRow(values, true); } } rptInectionToken crp = new rptInectionToken(); crp.SetDataSource((DataTable)prt); FrmReportViewer frmViewer = new FrmReportViewer(); frmViewer.crystalReportViewer1.ReportSource = crp; crp.SetParameterValue("Duplicate", PrintDuplicate); crp.SetParameterValue("Name", BranchName); crp.SetParameterValue("Address", BranchAddress); crp.SetParameterValue("ComplaintNo", "Complaint #: " + CompNo); if (preview) { frmViewer.ShowDialog(); } else { //frmViewer.crystalReportViewer1.RefreshReport(); frmViewer.crystalReportViewer1.PrintReport(); } PrintDuplicate = false; }
private void PrintPreviewInjection(bool preview, InjectionLabTest pr) { prt = new DsPatientRegistration.PatientRegistrationDataTable(); object[] values = { 0, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Address, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, this.txtExistingToken.Text, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate }; prt.LoadDataRow(values, true); rptInectionToken crp = new rptInectionToken(); crp.SetDataSource((DataTable)prt); FrmReportViewer frmViewer = new FrmReportViewer(); frmViewer.crystalReportViewer1.ReportSource = crp; if (preview) { frmViewer.ShowDialog(); } else { frmViewer.crystalReportViewer1.RefreshReport(); frmViewer.crystalReportViewer1.PrintReport(); } }
private void PrintPreviewLab(bool preview, InjectionLabTest pr) { prt = new DsPatientRegistration.PatientRegistrationDataTable(); foreach (var item in pr.Tests) { object[] values = { item.LabTestId, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, item.TestName, pr.IsInjectionToken ? "Injection" : "Lab Test", pr.CashReceived, pr.ExistingTokenNo, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate }; prt.LoadDataRow(values, true); } rptLabTestToken crp = new rptLabTestToken(); crp.SetDataSource((DataTable)prt); FrmReportViewer frmViewer = new FrmReportViewer(); frmViewer.crystalReportViewer1.ReportSource = crp; if (preview) { frmViewer.ShowDialog(); } else { frmViewer.crystalReportViewer1.RefreshReport(); frmViewer.crystalReportViewer1.PrintReport(); } }
private void tsSave_Click(object sender, EventArgs e) { List <LabTest> assignedLabTest2nd = new List <LabTest>(); InjectionLabTest inLb = new InjectionLabTest(); inLb.TokenDate = System.DateTime.Today; GetNextTokenNumber2nd(); inLb.TokenNumber = Convert.ToInt64(this.lblCurrentTokenNumber2nd.Text.Trim()); if (rbInjection.Checked == true) { inLb.IsInjectionToken = true; inLb.InjectionId = ((LabTest)this.cbxRs10.SelectedItem).LabTestId; inLb.Patient.Address = ((LabTest)this.cbxRs10.SelectedItem).TestName; inLb.Type = 0; if (chxSyringe.Checked) { defaultSyring.CurrentAmount = 0; inLb.Injections.Add(defaultSyring); } LabTest defaultInjection = ((LabTest)this.cbxRs10.SelectedItem); defaultInjection.CurrentAmount = 10; inLb.Injections.Add(defaultInjection); } else { //lab test token inLb.IsInjectionToken = false; if (rbDeserving.Checked == true) { inLb.Type = PatientPayType.Deserving; } else if (rbGeneral2nd.Checked == true) { inLb.Type = PatientPayType.General; } else if (rbPoor.Checked == true) { inLb.Type = PatientPayType.Poor; } else if (rbYCOD.Checked == true) { inLb.Type = PatientPayType.YCOD; } if (lstLabTest.Items.Count > 0) { foreach (LabTest item in lstLabTest.Items) { inLb.Tests.Add(item); if (item.IsMedicine == false) { assignedLabTest2nd.Add(item); } } } } Int64 exTokNo = 0; Int64.TryParse(txtExistingToken.Text, out exTokNo); inLb.ExistingTokenNo = exTokNo; inLb.CashReceived = Convert.ToDouble(this.txtCashRecieved2nd.Text.Trim()); inLb.Patient.FirstName = this.txtPatientFirstName2nd.Text; inLb.Patient.LastName = this.txtPatientLastName2nd.Text; inLb.Patient.NIC = this.txtPatientCNIC2nd.Text; inLb.Patient.RegistrationDate = this.dtpPatientRegistration2nd.Value.Date; inLb.Patient.RegistrationNumber = this.txtPateintRegistrationNumber2nd.Text; //inLb.Patient.Address = this.txtPatientAddress2nd.Text; inLb.TokenMonthYear = Convert.ToInt64(DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString()); // inLb.Patient.Member = cbxmembers.Text.Trim(); try { if (inLabBll.SavePatientToken(inLb)) { if (assignedLabTest2nd.Count > 0) { PatientBLL pbll = new PatientBLL(); pbll.LabTestAssignedPaid(inLb, assignedLabTest2nd); } if (inLb.IsInjectionToken) { PrintPreviewInjection(false, inLb); } else { PrintPreviewLab(false, inLb); } GetNextTokenNumber2nd(); NewPatient2nd(); MessageBox.Show("Patient Registered Successfully", "Token Granted"); this.txtPatientFirstName2nd.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Save Patient Registration Error"); } }
public bool UpdateInjectionLabTest(InjectionLabTest inLb) { return(new InjectionLabTestDAL().UpdateLabTestToken(inLb)); }
public InjectionLabTest GetInjectionLabTest(InjectionLabTest inLb) { return(new InjectionLabTestDAL().GetInjectionLabTest(inLb)); }
public bool SavePatientToken(InjectionLabTest pr) { return(new InjectionLabTestDAL().SavePatientToken(pr)); }
public bool LabTestAssignedPaid(InjectionLabTest pr, List <LabTest> meds) { return(new PatientDAL().LabTestAssignedPaid(pr, meds)); }
private void tsSave_Click(object sender, EventArgs e) { InjectionLabTest inLb = new InjectionLabTest(); inLb.TokenDate = System.DateTime.Today; GetNextTokenNumber3nd(); inLb.TokenNumber = Convert.ToInt64(this.lblThirdMainToken.Text.Trim()); inLb.IsInjectionToken = false; if (rbThirdGeneral.Checked == true) { inLb.Type = PatientPayType.General; } else if (rbThirdPoor.Checked == true) { inLb.Type = PatientPayType.Poor; } else if (rbThirdYCDO.Checked == true) { inLb.Type = PatientPayType.YCOD; } if (lbxPaidMedicine.Items.Count > 0) { // foreach (LabTest item in this.lbxPaidMedicine.Items) foreach (LabTest item in alwaysPaid) { inLb.Tests.Add(item); } } if (lbxInjection.Items.Count > 0) { foreach (LabTest item in this.lbxInjection.Items) { inLb.Injections.Add(item); } if (chxSyringThird.Checked) { defaultSyring.CurrentAmount = 0; inLb.Injections.Add(defaultSyring); } } if (lbxLabTest.Items.Count > 0) { foreach (LabTest item in this.lbxLabTest.Items) { inLb.AssignedLabTest.Add(item); } } Int64 exTokNo = 0; Int64.TryParse(txtThirdExistingToken.Text, out exTokNo); inLb.ExistingTokenNo = exTokNo; inLb.CashReceived = Convert.ToDouble(this.txtThirdCashReceived.Text.Trim()); inLb.Patient.FirstName = this.txtThirdFirstName.Text; inLb.Patient.LastName = this.txtThirdLastName.Text; inLb.Patient.NIC = this.txtThirdCNIC.Text; inLb.Patient.RegistrationDate = this.dtpThirdPatientRegistrationDate.Value.Date; inLb.Patient.RegistrationNumber = this.txtThirdPatientRegistrationNumber.Text; inLb.Patient.Address = this.txtThirdAddress.Text; inLb.TokenMonthYear = Convert.ToInt64(DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString()); try { GetNextTokenNumber3nd(); if (inLabBll.SavePatientTokenInjandLabTest(inLb)) { if (inLb.Injections.Count > 0) { new InjectionLabTestBLL().SetPharmacyIssued(inLb.Injections); } if (inLb.Tests.Count > 0) { new InjectionLabTestBLL().SetPharmacyIssued(inLb.Tests); } if (inLb.AssignedLabTest.Count > 0) { new InjectionLabTestBLL().SetPaidLabTest(inLb.AssignedLabTest); } PrintPreviewLabandInj(false, inLb); GetNextTokenNumber3nd(); ClearThidTurnControls(); MessageBox.Show("Patient Registered Successfully", "Token Granted"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Save Patient Registration Error"); } }
private void tsSave_Click(object sender, EventArgs e) { if (tcPatientRegistration.SelectedTab == tpSecondTurn) { InjectionLabTest inLb = new InjectionLabTest(); inLb.TokenDate = System.DateTime.Today; inLb.TokenNumber = Convert.ToInt64(this.lblCurrentTokenNumber2nd.Text.Trim()); if (rbInjection.Checked == true) { inLb.IsInjectionToken = true; inLb.Type = 0; } else { //lab test token inLb.IsInjectionToken = false; if (rbDeserving.Checked == true) { inLb.Type = PatientPayType.Deserving; } else if (rbGeneral2nd.Checked == true) { inLb.Type = PatientPayType.General; } else if (rbPoor.Checked == true) { inLb.Type = PatientPayType.Poor; } else if (rbYCOD.Checked == true) { inLb.Type = PatientPayType.YCOD; } if (lstLabTest.Items.Count > 0) { foreach (LabTest item in lstLabTest.Items) { inLb.Tests.Add(item); } } } Int64 exTokNo = 0; Int64.TryParse(txtExistingToken.Text, out exTokNo); inLb.ExistingTokenNo = exTokNo; inLb.CashReceived = Convert.ToDouble(this.txtCashRecieved2nd.Text.Trim()); inLb.Patient.FirstName = this.txtPatientFirstName2nd.Text; inLb.Patient.LastName = this.txtPatientLastName2nd.Text; inLb.Patient.NIC = this.txtPatientCNIC2nd.Text; inLb.Patient.RegistrationDate = this.dtpPatientRegistration2nd.Value.Date; inLb.Patient.RegistrationNumber = this.txtPateintRegistrationNumber2nd.Text; inLb.Patient.Address = this.txtPatientAddress2nd.Text; inLb.TokenMonthYear = Convert.ToInt64(DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString()); try { if (inLabBll.SavePatientToken(inLb)) { if (inLb.IsInjectionToken) { PrintPreviewInjection(false, inLb); } else { PrintPreviewLab(false, inLb); } GetNextTokenNumber2nd(); NewPatient2nd(); MessageBox.Show("Patient Registered Successfully", "Token Granted"); this.txtPatientFirstName2nd.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Save Patient Registration Error"); } } else if (tcPatientRegistration.SelectedTab == tpFirstTurn) { PatientRegistration pr = new PatientRegistration(); try { pr.TokenDate = System.DateTime.Today; pr.TokenNumber = Convert.ToInt64(this.lblCurrentTokenNumber.Text.Trim()); pr.TokenType = (rbGeneral.Checked) ? TokenType.General : TokenType.Private; pr.CashReceived = Convert.ToDouble(this.txtCashRecieved.Text.Trim()); pr.Patient.FirstName = this.txtPatientFirstName.Text; pr.Patient.LastName = this.txtPatientLastName.Text; pr.Patient.NIC = this.txtPatientCNIC.Text; pr.Patient.RegistrationDate = this.dtpPatientRegistrationDate.Value.Date; pr.Patient.RegistrationNumber = this.txtPateintRegistrationNumber.Text; pr.Patient.Address = this.txtPatientAddress.Text; pr.TokenMonthYear = Convert.ToInt64(DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString()); if (this.lstRooms.SelectedItem != null) { pr.Room = (Room)this.lstRooms.SelectedItem; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Patient Registration Data"); } try { if (pbll.SavePatientToken(pr)) { PrintPreview(false, pr); GetNextTokenNumber(); NewPatient(); MessageBox.Show("Patient Registered Successfully", "Token Granted"); this.txtPatientFirstName.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Save Patient Registration Error"); } } }
public List <LabTest> GetLabTestAssignedUnPaid3(InjectionLabTest inLB) { return(new InjectionLabTestDAL().GetLabTestAssignedUnPaid3(inLB)); }
public InjectionLabTest GetInjectionLabTest(InjectionLabTest inLb) { //List<LabTest> labTests = new List<LabTest>(); try { string select = "Select ilt.* ,(select [Test (A-Z)] from LabTest lt where ilt.Labtestid=lt.id) as TestName from InjectionLabTest ilt where TokenNumber=" + inLb.TokenNumber + " and TokenMonthYear=" + inLb.TokenMonthYear + ""; DataTable dt = new DataTable(); con = new OleDbConnection(); readconfile = new ReadConfigFile(); con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); if (con.State == ConnectionState.Open) { da = new OleDbDataAdapter(select, con); da.Fill(dt); } if (dt.Rows.Count > 0) { double cashRecieved = 0; foreach (DataRow row in dt.Rows) { inLb.Patient.FirstName = Convert.ToString(row["PatientFirstName"] == DBNull.Value ? "" : row["PatientFirstName"]); inLb.Patient.LastName = Convert.ToString(row["PatientLastName"] == DBNull.Value ? "" : row["PatientLastName"]); inLb.Patient.NIC = Convert.ToString(row["PatientNIC"] == DBNull.Value ? "" : row["PatientNIC"]); inLb.Patient.RegistrationNumber = Convert.ToString(row["PatientRegistrationNumber"] == DBNull.Value ? "" : row["PatientRegistrationNumber"]); inLb.Patient.RegistrationDate = Convert.ToDateTime(row["PatientRegistrationDate"]); inLb.Patient.Address = Convert.ToString(row["PatientAddress"] == DBNull.Value ? "" : row["PatientAddress"]); inLb.CashReceived = Convert.ToDouble(row["TokenAmount"] == DBNull.Value ? "" : row["TokenAmount"]); if (row["PatientPayType"] != DBNull.Value) { inLb.Type = (PatientPayType)Enum.Parse(typeof(PatientPayType), row["PatientPayType"].ToString()); } inLb.TokenDate = Convert.ToDateTime(row["TokenDate"] == DBNull.Value ? DateTime.MinValue : row["TokenDate"]); inLb.ExistingTokenNo = Convert.ToInt64(row["ExistingTokenID"] == DBNull.Value ? 0 : row["ExistingTokenID"]); int testid = Convert.ToInt32(row["LabTestId"] == DBNull.Value ? 0 : row["LabTestId"]); string testname = Convert.ToString(row["TestName"] == DBNull.Value ? "" : row["TestName"]); if (testid != 0) { inLb.Tests.Add(new LabTest(testid, testname)); cashRecieved += Convert.ToDouble(row["TokenAmount"] == DBNull.Value ? "" : row["TokenAmount"]); inLb.CashReceived = cashRecieved; } inLb.IsInjectionToken = Convert.ToBoolean(testid == 0 ? true : false); //return inLb; //LabTest labTest = new LabTest(); //labTest.TestName = Convert.ToString(row["Test (A-Z)"] == DBNull.Value ? "" : row["Test (A-Z)"]); //labTest.SampleName = Convert.ToString(row["Sample"] == DBNull.Value ? "" : row["Sample"]); //labTest.Performed = Convert.ToString(row["Performed"] == DBNull.Value ? "" : row["Performed"]); //labTest.LabTestId = Convert.ToInt32(row["ID"]); //labTest.Report = Convert.ToString(row["Report"] == DBNull.Value ? "" : row["Report"]); //labTest.Deserving = Convert.ToDecimal(row["Deserving"] == DBNull.Value ? 0 : row["Deserving"]); //labTest.Poor = Convert.ToDecimal(row["Poor"] == DBNull.Value ? 0 : row["Poor"]); //labTest.YCDO = Convert.ToDecimal(row["YCDO"] == DBNull.Value ? 0 : row["YCDO"]); //labTest.General = Convert.ToDecimal(row["General"] == DBNull.Value ? 0 : row["General"]); //labTest.Shahab = Convert.ToDecimal(row["Shahab"] == DBNull.Value ? 0 : row["Shahab"]); //labTest.Ghori = Convert.ToDecimal(row["Ghori"] == DBNull.Value ? 0 : row["Ghori"]); //labTests.Add(labTest); } } return(inLb); // return labTests; } catch (Exception ex) { throw ex; } finally { con.Close(); } }
private void tsSave_Click(object sender, EventArgs e) { if (txtCashRecievedByUser.Text == "") { MessageBox.Show("First Enter Received Amount"); return; } InjectionLabTest inLb = new InjectionLabTest(); //inLb.TokenDate = System.DateTime.Today; inLb.TokenDate = System.DateTime.Now; GetNextTokenNumber3nd(); inLb.TokenNumber = Convert.ToInt64(this.lblThirdMainToken.Text.Trim()); inLb.IsInjectionToken = false; if (rbThirdGeneral.Checked == true) { inLb.Type = PatientPayType.General; } else if (rbThirdPoor.Checked == true) { inLb.Type = PatientPayType.Poor; } else if (rbThirdYCDO.Checked == true) { inLb.Type = PatientPayType.YCOD; } if (lbxPaidMedicine.Items.Count > 0) { // foreach (LabTest item in this.lbxPaidMedicine.Items) foreach (LabTest item in alwaysPaid) { inLb.Tests.Add(item); } } if (lbxInjection.Items.Count > 0) { foreach (LabTest item in this.lbxInjection.Items) { inLb.Injections.Add(item); } if (chxSyringThird.Checked) { defaultSyring.CurrentAmount = 0; inLb.Injections.Add(defaultSyring); } } if (lbxLabTest.Items.Count > 0) { foreach (LabTest item in this.lbxLabTest.Items) { inLb.AssignedLabTest.Add(item); } } if (lbxFreeMedicine.Items.Count > 0) { foreach (LabTest item in free) { inLb.Tests.Add(item); } } Int64 exTokNo = 0; Int64.TryParse(txtThirdExistingToken.Text, out exTokNo); inLb.ExistingTokenNo = exTokNo; inLb.CashReceived = Convert.ToDouble(this.txtThirdCashReceived.Text.Trim()); inLb.CashReceivedByUser = Convert.ToDouble(this.txtCashRecievedByUser.Text); inLb.Patient.FirstName = this.txtThirdFirstName.Text; inLb.Patient.LastName = this.txtThirdLastName.Text; inLb.Patient.NIC = this.txtThirdCNIC.Text; inLb.Patient.Mobile = this.txtThirdMobile.Text; inLb.Patient.Age = Convert.ToInt16(this.txtThirdAge.Text); inLb.Patient.RegistrationDate = this.dtpThirdPatientRegistrationDate.Value.Date; inLb.Patient.RegistrationNumber = this.txtThirdPatientRegistrationNumber.Text; inLb.Patient.Address = this.txtThirdAddress.Text; inLb.TokenMonthYear = Convert.ToInt64(DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString()); inLb.TokenBy = IsloginUser; inLb.Room.Name = frm3rd.pr.Room.Name; inLb.Room.LabelName = frm3rd.pr.Room.LabelName; try { GetNextTokenNumber3nd(); //if (inLabBll.SavePatientTokenInjandLabTest(inLb)) // if (inLabBll.SavePatientTokenInjandLabTest(inLb)) { // if (inLb.Injections.Count > 0) // new InjectionLabTestBLL().SetPharmacyIssued(inLb.Injections); //if (inLb.Tests.Count > 0) // new InjectionLabTestBLL().SetPharmacyIssued(inLb.Tests); // if (inLb.AssignedLabTest.Count > 0) // new InjectionLabTestBLL().SetPaidLabTest(inLb.AssignedLabTest); //GetNextTokenNumber3nd(); //ClearThidTurnControls(); //MessageBox.Show("Patient Registered Successfully", "Token Granted"); ///new code starts /// // InjectionLabTest inLb = new InjectionLabTest(); inLb.IsInjectionToken = false; if (rbThirdGeneral.Checked == true) { inLb.Type = PatientPayType.General; } else if (rbThirdPoor.Checked == true) { inLb.Type = PatientPayType.Poor; } else if (rbThirdYCDO.Checked == true) { inLb.Type = PatientPayType.YCOD; } //if (lbxPaidMedicine.Items.Count > 0) //{ // foreach (LabTest item in medications) // { // inLb.Tests.Add(item); // } //} //Int64 exTokNo = 0; Int64.TryParse(txtThirdExistingToken.Text, out exTokNo); inLb.ExistingTokenNo = exTokNo; inLb.TokenNumber = Convert.ToInt32(this.lblThirdMainToken.Text); inLb.CashReceived = Convert.ToDouble(this.txtThirdCashReceived.Text.Trim()); inLb.Patient.FirstName = this.txtThirdFirstName.Text; inLb.Patient.LastName = this.txtThirdLastName.Text; inLb.Patient.NIC = this.txtThirdCNIC.Text; inLb.Patient.Mobile = this.txtThirdMobile.Text; inLb.Patient.Age = Convert.ToInt16(this.txtThirdAge.Text); inLb.Patient.RegistrationDate = this.dtpThirdPatientRegistrationDate.Value.Date; inLb.TokenDate = System.DateTime.Now; inLb.Patient.RegistrationNumber = this.txtThirdPatientRegistrationNumber.Text; //inLb.Patient.Address = this.txtPatientAddress2nd.Text; inLb.TokenMonthYear = Convert.ToInt64(DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString()); inLb.TokenBy = IsloginUser; inLb.Room.Name = frm3rd.pr.Room.Name; inLb.Room.LabelName = frm3rd.pr.Room.LabelName; //if (inLabBll.SavePatientToken(inLb)) ----------- Disable/Change -- Asif - 29-04-19 if (inLabBll.SavePatientTokenInjandLabTest(inLb)) { inLabBll.SetPaidLabTest(inLb.AssignedLabTest); List <LabTest> labtests = new List <LabTest>(); List <LabTest> pendings = new List <LabTest>(); labtests = new InjectionLabTestBLL().GetMedicineIssued(prCancel); pendings = labtests.Where(pen => pen.IsRsTenInjection == true || pen.IsAlwaysPaid == true).ToList <LabTest>(); //new InjectionLabTestBLL().SetPaidLabTest(pendings); if (new InjectionLabTestBLL().SetPharmacyIssued(pendings) == true) { // pendings = labtests.Where(pen => pen.IsRsTenInjection == true || pen.IsAlwaysPaid == true).ToList<LabTest>(); //foreach (LabTest cancelAlwaysPaid in pendings) //{ // new PatientBLL().MedicineCanceled(prCancel, cancelAlwaysPaid); //} ClearThidTurnControls(); } ////////////////---------------------------- Asif - 13-04-19 //foreach (LabTest item in free) //{ // inLb.Tests.Remove(item); //} ////////////////---------------------------- Asif - 13-04-19 PrintPreviewLabandInj(False, inLb); MessageBox.Show("Patient Registered Successfully", "Token Granted"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Save Patient Registration Error"); } }