private void setGrfQue() { //grfQue.Clear(); grfQue.Rows.Count = 1; //grfQue.Rows.Count = 1; grfQue.Cols.Count = 18; //Column colpic1 = grf.Cols[colPic1]; //colpic1.DataType = typeof(Image); //Column colpic2 = grf.Cols[colPic2]; //colpic2.DataType = typeof(Image); //Column colpic3 = grf.Cols[colPic3]; //colpic3.DataType = typeof(Image); //Column colpic4 = grf.Cols[colPic4]; //colpic4.DataType = typeof(Image); grfQue.Cols[colQueVnShow].Caption = "VN"; grfQue.Cols[colQueHn].Caption = "HN"; grfQue.Cols[colQuePttName].Caption = "Patient Name"; grfQue.Cols[colQueVsDate].Caption = "Date"; grfQue.Cols[colQueVsTime].Caption = "Time"; grfQue.Cols[colQueSex].Caption = "Sex"; grfQue.Cols[colQueAge].Caption = "Age"; grfQue.Cols[colQuePaid].Caption = "Paid"; grfQue.Cols[colQueSymptom].Caption = "Symptom"; grfQue.Cols[colQueHeight].Caption = "Height"; grfQue.Cols[coolQueBw].Caption = "BW"; grfQue.Cols[colQueBp].Caption = "BP"; grfQue.Cols[colQuePulse].Caption = "Pulse"; grfQue.Cols[colQyeTemp].Caption = "Temp"; grfQue.Cols[colQueDsc].Caption = "Description"; grfQue.Cols[colQueVnShow].Width = 80; grfQue.Cols[colQueHn].Width = 80; grfQue.Cols[colQuePttName].Width = 310; grfQue.Cols[colQueVsDate].Width = 110; grfQue.Cols[colQueVsTime].Width = 80; grfQue.Cols[colQueSex].Width = 60; grfQue.Cols[colQueAge].Width = 80; grfQue.Cols[colQuePaid].Width = 110; grfQue.Cols[colQueSymptom].Width = 300; grfQue.Cols[colQueHeight].Width = 60; grfQue.Cols[coolQueBw].Width = 60; grfQue.Cols[colQueBp].Width = 60; grfQue.Cols[colQuePulse].Width = 60; grfQue.Cols[colQyeTemp].Width = 60; grfQue.Cols[colQueDsc].Width = 300; grfQue.ShowCursor = true; //grf.Cols[colPic1].ImageAndText = true; //grf.Cols[colPic2].ImageAndText = true; //grf.Cols[colPic3].ImageAndText = true; //grf.Cols[colPic4].ImageAndText = true; //grf.Styles.Normal.ImageAlign = ImageAlignEnum.CenterTop; //grf.Styles.Normal.TextAlign = TextAlignEnum.CenterBottom; ContextMenu menuGw = new ContextMenu(); //menuGw.MenuItems.Add("&แก้ไข Image", new EventHandler(ContextMenu_edit)); //menuGw.MenuItems.Add("&Rotate Image", new EventHandler(ContextMenu_retate)); //menuGw.MenuItems.Add("Delete Image", new EventHandler(ContextMenu_delete)); grfQue.ContextMenu = menuGw; //foreach (DocGroupScan dgs in bc.bcDB.dgsDB.lDgs) //{ //menuGw.MenuItems.Add("&เลือกประเภทเอกสาร และUpload Image ["+dgs.doc_group_name+"]", new EventHandler(ContextMenu_upload)); String date = ""; DateTime dtt = new DateTime(); //if (lDgss.Count <= 0) getlBsp(); //new LogWriter("d", "FrmDoctorView1 setGrfQue 01 "); date = txtDate.Text; DataTable dt = new DataTable(); //if (DateTime.TryParse(txtDate.Value.ToString(), out dtt)) //{ // date = dtt.Year.ToString() + "-" + dtt.ToString("MM-dd"); //} //if (date.Length <= 0) //{ // return; //} //this.Text = "Last Update 2020-02-06 Format Date " + System.DateTime.Now.ToString("dd-MM-yyyy") + " [" + date + "] hostFTP " + bc.iniC.hostFTP + " folderFTP " + bc.iniC.folderFTP; //new LogWriter("d", "FrmDoctorView1 setGrfQue 02 date "+ date); dt = bc.bcDB.vsDB.selectVisitByDtr(bc.user.staff_id, bc.datetoDB(date), "queue"); //new LogWriter("d", "FrmDoctorView1 setGrfQue 03 "); int i = 1; grfQue.Rows.Count = dt.Rows.Count + 1; foreach (DataRow row in dt.Rows) { try { String status = "", vn = ""; Patient ptt = new Patient(); vn = row["MNC_VN_NO"].ToString() + "/" + row["MNC_VN_SEQ"].ToString() + "(" + row["MNC_VN_SUM"].ToString() + ")"; ptt.patient_birthday = bc.datetoDB(row["mnc_bday"].ToString()); grfQue[i, 0] = (i); grfQue[i, colQueId] = vn; grfQue[i, colQueVnShow] = vn; grfQue[i, colQueVsDate] = bc.datetoShow(row["mnc_date"].ToString()); grfQue[i, colQueHn] = row["MNC_HN_NO"].ToString(); grfQue[i, colQuePttName] = row["prefix"].ToString() + " " + row["MNC_FNAME_T"].ToString() + " " + row["MNC_LNAME_T"].ToString(); grfQue[i, colQueVsTime] = bc.FormatTime(row["mnc_time"].ToString()); //grfQue[i, colQueVnShow] = row["MNC_REQ_DAT"].ToString(); grfQue[i, colQueSex] = row["mnc_sex"].ToString(); grfQue[i, colQueAge] = ptt.AgeStringShort(); grfQue[i, colQuePaid] = row["MNC_FN_TYP_DSC"].ToString(); grfQue[i, colQueSymptom] = row["MNC_SHIF_MEMO"].ToString(); grfQue[i, colQueHeight] = row["mnc_high"].ToString(); grfQue[i, coolQueBw] = row["mnc_weight"].ToString(); grfQue[i, colQueBp] = row["mnc_bp1_l"].ToString(); grfQue[i, colQuePulse] = row["MNC_ratios"].ToString(); grfQue[i, colQyeTemp] = row["MNC_temp"].ToString(); grfQue[i, colQuePreNo] = row["MNC_pre_no"].ToString(); grfQue[i, colQueDsc] = row["MNC_ref_dsc"].ToString(); if ((i % 2) == 0) { grfQue.Rows[i].StyleNew.BackColor = ColorTranslator.FromHtml(bc.iniC.grfRowColor); } i++; } catch (Exception ex) { new LogWriter("e", "FrmDoctorView setGrfQue ex " + ex.Message); } } grfQue.Cols[0].Visible = true; grfQue.Rows[0].Visible = true; //addDevice.MenuItems.Add("", new EventHandler(ContextMenu_upload)); //menuGw.MenuItems.Add(addDevice); //} //row1[colVSE2] = row[ic.ivfDB.pApmDB.pApm.e2].ToString().Equals("1") ? imgCorr : imgTran; grfQue.Cols[colQueId].Visible = false; grfQue.Cols[colQuePreNo].Visible = false; grfQue.Cols[colQueVnShow].AllowEditing = false; grfQue.Cols[colQueHn].AllowEditing = false; grfQue.Cols[colQuePttName].AllowEditing = false; grfQue.Cols[colQueVsDate].AllowEditing = false; grfQue.Cols[colQueVsTime].AllowEditing = false; grfQue.Cols[colQueSex].AllowEditing = false; grfQue.Cols[colQueAge].AllowEditing = false; grfQue.Cols[colQuePaid].AllowEditing = false; grfQue.Cols[colQueSymptom].AllowEditing = false; grfQue.Cols[colQueHeight].AllowEditing = false; grfQue.Cols[coolQueBw].AllowEditing = false; grfQue.Cols[colQueBp].AllowEditing = false; grfQue.Cols[colQuePulse].AllowEditing = false; grfQue.Cols[colQyeTemp].AllowEditing = false; grfQue.Cols[colQuePreNo].AllowEditing = false; grfQue.Cols[colQueDsc].AllowEditing = false; //grfQue.Cols[colQueVnShow].AllowEditing = false; }
private void setGrfApm() { grfApm.Clear(); grfApm.Rows.Count = 1; //grfQue.Rows.Count = 1; grfApm.Cols.Count = 11; grfApm.Cols[colApmHn].Caption = "HN"; grfApm.Cols[colApmPttName].Caption = "Patient Name"; grfApm.Cols[colApmDate].Caption = "Date"; grfApm.Cols[colApmTime].Caption = "Time"; grfApm.Cols[colApmSex].Caption = "Sex"; grfApm.Cols[colApmAge].Caption = "Age"; grfApm.Cols[colApmDsc].Caption = "Appointment"; grfApm.Cols[colApmRemark].Caption = "Remark"; grfApm.Cols[colApmDept].Caption = "Dept"; grfApm.Cols[colApmHn].Width = 80; grfApm.Cols[colApmPttName].Width = 300; grfApm.Cols[colApmDate].Width = 100; grfApm.Cols[colApmTime].Width = 80; grfApm.Cols[colApmSex].Width = 80; grfApm.Cols[colApmAge].Width = 80; grfApm.Cols[colApmDsc].Width = 300; grfApm.Cols[colApmRemark].Width = 300; grfApm.Cols[colApmDept].Width = 110; ContextMenu menuGw = new ContextMenu(); grfApm.ContextMenu = menuGw; String date = ""; //if (lDgss.Count <= 0) getlBsp(); date = txtDate.Text; DataTable dt = new DataTable(); dt = bc.bcDB.vsDB.selectAppointmentByDtr(bc.user.staff_id, bc.datetoDB(date)); int i = 1; grfApm.Rows.Count = dt.Rows.Count + 1; foreach (DataRow row in dt.Rows) { try { Patient ptt = new Patient(); ptt.patient_birthday = bc.datetoDB(row["mnc_bday"].ToString()); grfApm[i, 0] = (i); grfApm[i, colApmHn] = row["MNC_HN_NO"].ToString(); grfApm[i, colApmHn] = row["MNC_HN_NO"].ToString(); grfApm[i, colApmPttName] = row["prefix"].ToString() + "" + row["MNC_FNAME_T"].ToString() + "" + row["MNC_LNAME_T"].ToString(); grfApm[i, colApmDate] = bc.datetoShow(row["mnc_app_dat"].ToString()); grfApm[i, colApmTime] = bc.FormatTime(row["mnc_app_tim"].ToString()); grfApm[i, colApmSex] = row["mnc_sex"].ToString(); grfApm[i, colApmAge] = ptt.AgeStringShort(); grfApm[i, colApmDsc] = row["mnc_app_dsc"].ToString(); grfApm[i, colApmRemark] = row["MNC_REM_MEMO"].ToString(); grfApm[i, colApmDept] = row["mnc_name"].ToString(); //if ((i % 2) == 0) // grfApm.Rows[i].StyleNew.BackColor = ColorTranslator.FromHtml(bc.iniC.grfRowColor); i++; } catch (Exception ex) { new LogWriter("e", "FrmDoctorView setGrfApm ex " + ex.Message); } } grfApm.Cols[colApmId].Visible = false; grfApm.Cols[colApmHn].AllowEditing = false; grfApm.Cols[colApmPttName].AllowEditing = false; grfApm.Cols[colApmDate].AllowEditing = false; grfApm.Cols[colApmTime].AllowEditing = false; grfApm.Cols[colApmSex].AllowEditing = false; grfApm.Cols[colApmAge].AllowEditing = false; grfApm.Cols[colApmDsc].AllowEditing = false; grfApm.Cols[colApmRemark].AllowEditing = false; grfApm.Cols[colApmDept].AllowEditing = false; }
private void setGrfHn() { String datestart = "", dateend = "", hn = "", txt = ""; String[] hn1; DataTable dt = new DataTable(); datestart = bc.datetoDB(txtDateStart.Text); dateend = bc.datetoDB(txtDateEnd.Text); hn = txtHn.Text.Trim(); hn1 = hn.Split(','); if (hn1.Length <= 0) { MessageBox.Show("No data HN", ""); return; } for (int j = 0; j < hn1.Length; j++) { hn1[j] = "'" + hn1[j].Trim() + "'"; txt += hn1[j] + ","; } if (txt.Length > 0) { if (txt.Substring(txt.Length - 1).Equals(",")) { txt = txt.Substring(0, txt.Length - 1); } } dt = bc.bcDB.vsDB.selectVisitByLikeHn(txt, datestart, dateend); grfHn.Clear(); grfHn.Rows.Count = 1; //grfQue.Rows.Count = 1; grfHn.Cols.Count = 20; Column colChk = grfHn.Cols[colHnPrnReqLab]; colChk.DataType = typeof(Boolean); Column colChk2 = grfHn.Cols[colHnPrnReqXray]; colChk2.DataType = typeof(Boolean); Column colChk3 = grfHn.Cols[colHnPrnResLab]; colChk3.DataType = typeof(Boolean); Column colChk4 = grfHn.Cols[colHnPrnResXray]; colChk4.DataType = typeof(Boolean); Column colChk5 = grfHn.Cols[colHnPrnDrug]; colChk5.DataType = typeof(Boolean); Column colChk6 = grfHn.Cols[colHnPrnStaffNote]; colChk6.DataType = typeof(Boolean); grfHn.Cols[colHnPrnDrug].Caption = "ใบยา"; grfHn.Cols[colHnPrnStaffNote].Caption = "Staff N."; grfHn.Cols[colHnPrnReqLab].Caption = "Req Lab"; grfHn.Cols[colHnPrnReqXray].Caption = "Req Xray"; grfHn.Cols[colHnPrnResLab].Caption = "Req Lab"; grfHn.Cols[colHnPrnResXray].Caption = "Res Xray"; grfHn.Cols[colHnVnShow].Caption = "VN"; grfHn.Cols[colHnHn].Caption = "HN"; grfHn.Cols[colHnPttName].Caption = "Patient Name"; grfHn.Cols[colHnVsDate].Caption = "Date"; grfHn.Cols[colHnVsTime].Caption = "Time"; grfHn.Cols[colHnSex].Caption = "Sex"; grfHn.Cols[colHnAge].Caption = "Age"; grfHn.Cols[colHnPaid].Caption = "Paid"; grfHn.Cols[colHnDsc].Caption = "Description"; grfHn.Cols[colHnPrnStaffNote].Width = 60; grfHn.Cols[colHnPrnReqLab].Width = 60; grfHn.Cols[colHnPrnReqLab].Width = 60; grfHn.Cols[colHnPrnReqXray].Width = 60; grfHn.Cols[colHnPrnResLab].Width = 60; grfHn.Cols[colHnPrnResXray].Width = 65; grfHn.Cols[colHnVnShow].Width = 80; grfHn.Cols[colHnHn].Width = 80; grfHn.Cols[colHnPttName].Width = 310; grfHn.Cols[colHnVsDate].Width = 110; grfHn.Cols[colHnVsTime].Width = 80; grfHn.Cols[colHnSex].Width = 60; grfHn.Cols[colHnAge].Width = 80; grfHn.Cols[colHnPaid].Width = 110; grfHn.Cols[colHnDsc].Width = 300; grfHn.ShowCursor = true; //grf.Cols[colPic1].ImageAndText = true; //grf.Cols[colPic2].ImageAndText = true; //grf.Cols[colPic3].ImageAndText = true; //grf.Cols[colPic4].ImageAndText = true; //grf.Styles.Normal.ImageAlign = ImageAlignEnum.CenterTop; //grf.Styles.Normal.TextAlign = TextAlignEnum.CenterBottom; ContextMenu menuGw = new ContextMenu(); //menuGw.MenuItems.Add("&แก้ไข Image", new EventHandler(ContextMenu_edit)); //menuGw.MenuItems.Add("&Rotate Image", new EventHandler(ContextMenu_retate)); //menuGw.MenuItems.Add("Delete Image", new EventHandler(ContextMenu_delete)); grfHn.ContextMenu = menuGw; //foreach (DocGroupScan dgs in bc.bcDB.dgsDB.lDgs) //{ //menuGw.MenuItems.Add("&เลือกประเภทเอกสาร และUpload Image ["+dgs.doc_group_name+"]", new EventHandler(ContextMenu_upload)); String date = ""; //if (lDgss.Count <= 0) getlBsp(); date = txtDateStart.Text; int i = 1; grfHn.Rows.Count = dt.Rows.Count + 1; foreach (DataRow row in dt.Rows) { try { String status = "", vn = ""; Patient ptt = new Patient(); vn = row["MNC_VN_NO"].ToString() + "/" + row["MNC_VN_SEQ"].ToString() + "(" + row["MNC_VN_SUM"].ToString() + ")"; ptt.patient_birthday = bc.datetoDB(row["mnc_bday"].ToString()); grfHn[i, 0] = (i); grfHn[i, colHnPrn] = true; grfHn[i, colHnPrnDrug] = chkDrug.Checked; grfHn[i, colHnPrnStaffNote] = chkStaffNote.Checked; grfHn[i, colHnPrnReqLab] = chkReqLab.Checked; grfHn[i, colHnPrnReqXray] = chkReqXray.Checked; grfHn[i, colHnPrnResLab] = chkResLab.Checked; grfHn[i, colHnPrnResXray] = chkResXray.Checked; grfHn[i, colHnId] = vn; grfHn[i, colHnVnShow] = vn; grfHn[i, colHnVsDate] = bc.datetoShow(row["mnc_date"].ToString()); grfHn[i, colHnHn] = row["MNC_HN_NO"].ToString(); grfHn[i, colHnPttName] = row["prefix"].ToString() + " " + row["MNC_FNAME_T"].ToString() + " " + row["MNC_LNAME_T"].ToString(); grfHn[i, colHnVsTime] = bc.FormatTime(row["mnc_time"].ToString()); //grfQue[i, colQueVnShow] = row["MNC_REQ_DAT"].ToString(); grfHn[i, colHnSex] = row["mnc_sex"].ToString(); grfHn[i, colHnAge] = ptt.AgeStringShort(); grfHn[i, colHnPaid] = row["MNC_FN_TYP_DSC"].ToString(); grfHn[i, colHnSymptom] = row["MNC_SHIF_MEMO"].ToString(); grfHn[i, colHnPreNo] = row["MNC_pre_no"].ToString(); grfHn[i, colHnDsc] = row["MNC_ref_dsc"].ToString(); if ((i % 2) == 0) { grfHn.Rows[i].StyleNew.BackColor = ColorTranslator.FromHtml(bc.iniC.grfRowColor); } i++; } catch (Exception ex) { new LogWriter("e", "FrmPrintCri setGrfHn ex " + ex.Message); } } //addDevice.MenuItems.Add("", new EventHandler(ContextMenu_upload)); //menuGw.MenuItems.Add(addDevice); //} //row1[colVSE2] = row[ic.ivfDB.pApmDB.pApm.e2].ToString().Equals("1") ? imgCorr : imgTran; grfHn.Cols[colHnId].Visible = false; grfHn.Cols[colHnPreNo].Visible = false; grfHn.Cols[colHnPrn].Visible = false; grfHn.Cols[colHnVnShow].AllowEditing = false; grfHn.Cols[colHnHn].AllowEditing = false; grfHn.Cols[colHnPttName].AllowEditing = false; grfHn.Cols[colHnVsDate].AllowEditing = false; grfHn.Cols[colHnVsTime].AllowEditing = false; grfHn.Cols[colHnSex].AllowEditing = false; grfHn.Cols[colHnAge].AllowEditing = false; grfHn.Cols[colHnPaid].AllowEditing = false; grfHn.Cols[colHnSymptom].AllowEditing = false; grfHn.Cols[colHnPreNo].AllowEditing = false; grfHn.Cols[colHnDsc].AllowEditing = false; //grfQue.Cols[colQueVnShow].AllowEditing = false; }
private void setGrfVs() { Cursor cursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; //pB1.Visible = true; String sql = "", datestart = "", dateend = ""; datestart = bc.datetoDB(txtDateStart.Text); dateend = bc.datetoDB(txtDateEnd.Text); System.Drawing.Font font = new System.Drawing.Font("Microsoft Sans Serif", 12); DataTable dt = new DataTable(); grfVs.Cols.Count = 15; //grfVs.Rows.cl grfVs.Rows.Count = 1; grfVs.Cols[colHn].Width = 80; grfVs.Cols[colName].Width = 300; grfVs.Cols[colDate].Width = 110; grfVs.Cols[colVn].Width = 65; grfVs.Cols[colPreno].Width = 50; grfVs.Cols[colAn].Width = 80; grfVs.Cols[colHn].Caption = "HN"; grfVs.Cols[colName].Caption = "Name"; grfVs.Cols[colDate].Caption = "Date"; grfVs.Cols[colDateDisc].Caption = "Date Disc"; grfVs.Cols[colVn].Caption = "Vn"; grfVs.Cols[colPreno].Caption = "preno"; grfVs.Cols[colAn].Caption = "An"; grfVs.Cols[colID].Caption = "ID"; grfVs.Cols[colWeight].Caption = "Wright"; if (txtAn.Text.Trim().Length > 0) { dt = bc.bcDB.vsDB.selectNHSOPrint3(txtAn.Text.Trim()); } else { dt = bc.bcDB.vsDB.selectNHSOPrint(datestart, dateend, ""); } //pB1.Maximum = dt.Rows.Count; //dgvPE.Columns[colPEId].HeaderText = "id"; if (dt.Rows.Count > 0) { if (txtAn.Text.Length > 0) { String where = ""; int len = txtAn.Text.Trim().Length; //if (txtAn.Text.IndexOf(",") <= 0) //{ // where = " mnc_an_no = '" + txtAn.Text + "' "; // DataRow[] dr = dt.Select(where); // int i = 0; // if (dr.Length == 0) // { // MessageBox.Show("ไม่พบ AN " + txtAn.Text + " ที่ต้องการค้นหา", "1."); // return; // } // grfVs.Rows.Count = dr.Length + 1; // foreach (DataRow row in dr) // { // if (dr[i]["mnc_an_no"].ToString().Equals("21364")) // { // sql = ""; // } // grfVs[i+1,0] = (i + 1); // grfVs[i + 1, colHn] = dr[i]["mnc_hn_no"].ToString(); // grfVs[i + 1, colName] = dr[i]["MNC_PFIX_DSC"].ToString() + " " + dr[i]["MNC_FNAME_T"].ToString() + " " + dr[i]["MNC_LNAME_T"].ToString() + " [" + dr[i]["MNC_id_no"].ToString() + "]"; // grfVs[i + 1, colVn] = dr[i]["mnc_vn_no"].ToString() + "." + dr[i]["MNC_VN_SEQ"].ToString() + "." + dr[i]["MNC_VN_SUM"].ToString(); // grfVs[i + 1, colPreno] = dr[i]["MNC_PRE_NO"].ToString(); // grfVs[i + 1, colPaid] = bc.shortPaidName(dr[i]["MNC_FN_TYP_DSC"].ToString()); // grfVs[i + 1, colDate] = bc.dateDBtoShowShort1(bc.datetoDB(dr[i]["MNC_DATE"].ToString())) + " " + bc.FormatTime(dr[i]["MNC_time"].ToString()); // grfVs[i + 1, colDoctor] = dr[i]["prefix"].ToString() + " " + dr[i]["Fname"].ToString() + " " + dr[i]["Lname"].ToString() + " [" + dr[i]["mnc_dot_cd"].ToString() + "] "; // grfVs[i + 1, colPdf] = "PDF"; // grfVs[i + 1, colDob] = bc.dateDBtoShowShort1(bc.datetoDB(dr[i]["MNC_BDAY"].ToString())); // grfVs[i + 1, colDateDisc] = bc.dateDBtoShowShort1(bc.datetoDB(dr[i]["mnc_ds_date"].ToString())); // grfVs[i + 1, colID] = dr[i]["mnc_id_no"].ToString(); // grfVs[i + 1, colWeight] = dr[i]["mnc_weight"].ToString(); // grfVs[i + 1, colAn] = dr[i]["mnc_an_no"].ToString() + "/" + dr[i]["mnc_an_yr"].ToString(); // int cnt = bc.bcDB.vsDB.selectNHSOPrintHN2("", grfVs[i + 1, colHn].ToString(), grfVs[i + 1, colPreno].ToString(), grfVs[i + 1, colVn].ToString()); // //if ((i % 2) != 0) // grfVs[i, colChk] = cnt > 0 ? "1" : "0"; // //dgvView.Rows[i].DefaultCellStyle.BackColor = cnt > 0 ? Color.LightSalmon : Color.White; // i++; // //pB1.Value = i; // } //} //else //{ String[] an = txtAn.Text.Split(','); String wherean = ""; for (int j = 0; j < an.Length; j++) { wherean += "'" + an[j].Trim() + "',"; } if (wherean.Length > 0) { if (wherean.IndexOf(',', wherean.Length - 1) > 0) { wherean = wherean.Substring(0, wherean.Length - 1); } } where = " mnc_an_no in (" + wherean + ") "; DataRow[] dr = dt.Select(where); //pB1.Maximum = dr.Length; int i = 0; if (dr.Length == 0) { MessageBox.Show("ไม่พบ AN " + txtAn.Text + " ที่ต้องการค้นหา", "2."); return; } grfVs.Rows.Count = dr.Length + 1; foreach (DataRow row in dr) { String hn = "", preno = "", vn = ""; hn = dr[i]["mnc_hn_no"].ToString(); preno = dr[i]["MNC_PRE_NO"].ToString(); vn = dr[i]["mnc_vn_no"].ToString() + "." + dr[i]["MNC_VN_SEQ"].ToString() + "." + dr[i]["MNC_VN_SUM"].ToString(); grfVs[i + 1, 0] = (i + 1); grfVs[i + 1, colHn] = hn; grfVs[i + 1, colName] = dr[i]["MNC_PFIX_DSC"].ToString() + " " + dr[i]["MNC_FNAME_T"].ToString() + " " + dr[i]["MNC_LNAME_T"].ToString() + " [" + dr[i]["MNC_id_no"].ToString() + "]"; grfVs[i + 1, colVn] = vn; grfVs[i + 1, colPreno] = preno; grfVs[i + 1, colPaid] = bc.shortPaidName(dr[i]["MNC_FN_TYP_DSC"].ToString()); grfVs[i + 1, colDate] = bc.dateDBtoShowShort(bc.datetoDB(dr[i]["MNC_DATE"].ToString())) + " " + bc.FormatTime(dr[i]["MNC_time"].ToString()); grfVs[i + 1, colDoctor] = dr[i]["prefix"].ToString() + " " + dr[i]["Fname"].ToString() + " " + dr[i]["Lname"].ToString() + " [" + dr[i]["mnc_dot_cd"].ToString() + "] "; grfVs[i + 1, colPdf] = "PDF"; grfVs[i + 1, colDob] = bc.dateDBtoShowShort(bc.datetoDB(dr[i]["MNC_BDAY"].ToString())); grfVs[i + 1, colDateDisc] = bc.dateDBtoShowShort(bc.datetoDB(dr[i]["mnc_ds_date"].ToString())); grfVs[i + 1, colID] = dr[i]["mnc_id_no"].ToString(); grfVs[i + 1, colWeight] = dr[i]["mnc_weight"].ToString(); grfVs[i + 1, colAn] = dr[i]["mnc_an_no"].ToString() + "/" + dr[i]["mnc_an_yr"].ToString(); int cnt = bc.bcDB.vsDB.selectNHSOPrintHN2("", hn, preno, vn); //if ((i % 2) != 0) grfVs[i + 1, colChk] = cnt > 0 ? "1" : "0"; //dgvView.Rows[i].DefaultCellStyle.BackColor = cnt > 0 ? Color.LightSalmon : Color.White; i++; //pB1.Value = i; } //} } else { grfVs.Rows.Count = dt.Rows.Count + 1; for (int i = 1; i < dt.Rows.Count; i++) { if (dt.Rows[i]["mnc_an_no"].ToString().Equals("21364")) { sql = ""; } grfVs[i, 0] = (i + 1); grfVs[i, colHn] = dt.Rows[i]["mnc_hn_no"].ToString(); grfVs[i, colName] = dt.Rows[i]["MNC_PFIX_DSC"].ToString() + " " + dt.Rows[i]["MNC_FNAME_T"].ToString() + " " + dt.Rows[i]["MNC_LNAME_T"].ToString() + " [" + dt.Rows[i]["MNC_id_no"].ToString() + "]"; grfVs[i, colVn] = dt.Rows[i]["mnc_vn_no"].ToString() + "." + dt.Rows[i]["MNC_VN_SEQ"].ToString() + "." + dt.Rows[i]["MNC_VN_SUM"].ToString(); grfVs[i, colPreno] = dt.Rows[i]["MNC_PRE_NO"].ToString(); grfVs[i, colPaid] = bc.shortPaidName(dt.Rows[i]["MNC_FN_TYP_DSC"].ToString()); grfVs[i, colDate] = bc.dateDBtoShowShort(bc.datetoDB(dt.Rows[i]["MNC_DATE"].ToString())) + " " + bc.FormatTime(dt.Rows[i]["MNC_time"].ToString()); grfVs[i, colDoctor] = dt.Rows[i]["prefix"].ToString() + " " + dt.Rows[i]["Fname"].ToString() + " " + dt.Rows[i]["Lname"].ToString() + " [" + dt.Rows[i]["mnc_dot_cd"].ToString() + "] "; grfVs[i, colPdf] = "PDF"; grfVs[i, colDob] = bc.dateDBtoShowShort(bc.datetoDB(dt.Rows[i]["MNC_BDAY"].ToString())); grfVs[i, colDateDisc] = bc.dateDBtoShowShort(bc.datetoDB(dt.Rows[i]["mnc_ds_date"].ToString())); grfVs[i, colID] = dt.Rows[i]["mnc_id_no"].ToString(); grfVs[i, colWeight] = dt.Rows[i]["mnc_weight"].ToString(); grfVs[i, colAn] = dt.Rows[i]["mnc_an_no"].ToString() + "/" + dt.Rows[i]["mnc_an_yr"].ToString(); int cnt = bc.bcDB.vsDB.selectNHSOPrintHN2("", grfVs[i, colHn].ToString(), grfVs[i, colPreno].ToString(), grfVs[i, colVn].ToString()); //if ((i % 2) != 0) grfVs[i, colChk] = cnt > 0 ? "1" : "0"; //dgvView.Rows[i].DefaultCellStyle.BackColor = cnt > 0 ? Color.LightSalmon : Color.White; //pB1.Value = i; } } } for (int i = 0; i < grfVs.Rows.Count; i++) { if (grfVs.Rows.Count <= 1) { break; } if (grfVs[i, colChk] == null) { continue; } if (grfVs[i, colChk].ToString().Equals("0")) { grfVs.Rows.Remove(i); i--; } } for (int i = 0; i < grfVs.Rows.Count; i++) { grfVs[i, 0] = (i + 1); } grfVs.Font = font; grfVs.Cols[colPreno].Visible = false; grfVs.Cols[colChk].Visible = false; grfVs.Cols[colWeight].Visible = false; //dgvView.Columns[colAn].Visible = false; grfVs.Cols[colID].Visible = false; grfVs.Cols[colDob].Visible = false; grfVs.Cols[colHn].AllowEditing = false; grfVs.Cols[colName].AllowEditing = false; grfVs.Cols[colVn].AllowEditing = false; grfVs.Cols[colPreno].AllowEditing = false; grfVs.Cols[colPaid].AllowEditing = false; grfVs.Cols[colDate].AllowEditing = false; grfVs.Cols[colDoctor].AllowEditing = false; grfVs.Cols[colPdf].AllowEditing = false; grfVs.Cols[colDob].AllowEditing = false; grfVs.Cols[colDateDisc].AllowEditing = false; grfVs.Cols[colID].AllowEditing = false; grfVs.Cols[colWeight].AllowEditing = false; grfVs.Cols[colAn].AllowEditing = false; //pB1.Visible = false; Cursor.Current = cursor; }