private void btnPrint_Click(object sender, EventArgs e) { trn_report_vaccine_hdr trvh = (trn_report_vaccine_hdr)bsVaccineHdr.Current; Report.frmPreviewReport frm = new Report.frmPreviewReport(trvh.trvh_id, "AV104", Program.CurrentSite.mhs_ename); //frm.previewReport(); }
private void btnSave_Click(object sender, EventArgs e) { if (tpt_id == null) { MessageBox.Show("Please Select Patient."); txtPatientName.Focus(); } else if (mut_id == null) { MessageBox.Show("Please Select Doctor."); txtDoctor.Focus(); } else { DateTime dateNow = Program.GetServerDateTime(); trn_patient tpt = cdc.trn_patients.Where(x => x.tpt_id == tpt_id).FirstOrDefault(); trn_report_vaccine_hdr trvh = (trn_report_vaccine_hdr)bsVaccineHdr.Current; trvh.mut_id = mut_id; trvh.mhs_id = Program.CurrentSite.mhs_id; trvh.trvh_update_by = Program.CurrentUser.mut_username; trvh.trvh_update_date = dateNow; if (trvh.trvh_id == 0) { tpt.trn_report_vaccine_hdrs.Add(trvh); trvh.trvh_create_by = Program.CurrentUser.mut_username; trvh.trvh_create_date = dateNow; } else { bsVaccineHdr.EndEdit(); } cdc.SubmitChanges(); // แก้ bug colTimeName หาย หลังจาก submit foreach (DataGridViewRow row in gridDtl.Rows) { string val = ""; if (row.Cells["colTime"].Value != null) { val = row.Cells["colTime"].Value.ToString(); } row.Cells["colTimeName"].Value = mstTime.Where(x => x.val == val).Select(x => x.display).FirstOrDefault(); } // btnPrint.Enabled = true; } }