Esempio n. 1
0
        private void INPHIEU_XETNGHIEM_GTVT()
        {
            string strPatient_ID = string.Empty;
            var    DTPrint       = new DataTable();
            string vTestTypeId   = GetCheckTestType();
            string vTestID       = GetcheckTestID();

            if (vTestTypeId == "-1")
            {
                Utility.ShowMsg("Chưa chọn loại xét nghiệm để in");
                return;
            }

            if (grdList.GetCheckedRows().Length > 0)
            {
                foreach (GridEXRow gridExRow in grdList.GetCheckedRows())
                {
                    strPatient_ID += "," + Utility.Int32Dbnull(gridExRow.Cells["Patient_ID"].Value, -1);
                }
                strPatient_ID = strPatient_ID.Remove(0, 1);
            }
            else
            {
                strPatient_ID = Utility.sDbnull(grdList.GetValue("Patient_ID"));
            }
            DTPrint =
                SPs.GtvtGetTestResultForPrintV2FromDateToDate(strPatient_ID, vTestTypeId, vTestID,
                                                              dtFromDate.Date.ToShortDateString(),
                                                              dtToDate.Date.ToShortDateString()).GetDataSet().Tables[0];
            if (DTPrint.Rows.Count <= 0)
            {
                Utility.ShowMsg("Không tìm thấy bản ghi nào", "Thông báo");
                return;
            }
            ProcessData(ref DTPrint);
            if (SysPara.IsNormalResult == 1)
            {
                string normalLevel = Utility.Int32Dbnull(DTPrint.Rows[0]["Sex"], 1) == 1
                                         ? "Normal_Level"
                                         : "Normal_LevelW";
                //ProcessNormalResult(ref DTPrint);
                //ProcessNormalResult(ref DTPrint, "Test_result", normalLevel, -1, 1, 0,
                //                                             "binhthuong", false);
                foreach (DataRow row in DTPrint.Rows)
                {
                    if (
                        (row["Test_result"].ToString().Trim().ToUpper().StartsWith("ÂM")) ||
                        (row["Test_result"].ToString().Trim().ToUpper().Contains("AM"))
                        )
                    {
                        row["binhthuong"] = -1;
                    }
                    else if (
                        (row["Test_result"].ToString().Trim().ToUpper().StartsWith("DƯƠ")) ||
                        (row["Test_result"].ToString().Trim().ToUpper().Contains("DUO"))
                        )
                    {
                        row["binhthuong"] = 1;
                    }
                }
            }

            var crptBusiness = new CrptBusiness();

            crptBusiness.ReportSourceTable = DTPrint;

            //thang nao thich in A4 hay A5 thì khai bao trong rpt(.)

            try
            {
                reporttype = File.ReadAllText(filereporttype);
                if (chkA5.Checked)
                {
                    StrCode = reporttype;
                }
                else if (chkA4.Checked)
                {
                    StrCode = reporttype;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Loz" + ex, "Thông báo");
            }

            StrCode = reporttype.Trim();
            // neu rpt A4 hoac A5 ma chua khai bao thi lay me no cai mac dinh(.)
            if (StrCode == "")
            {
                crptBusiness.StrCode = rdoNoheader.Checked ? "LABNOHEADER" : "LABREPORT";
            }
            else
            {
                crptBusiness.StrCode = StrCode;
            }
            crptBusiness.FormPreviewTitle = "In kết quả xét nghiệm";
            crptBusiness.Print(IsQuick, printDocument.PrinterSettings.PrinterName);
        }
Esempio n. 2
0
        /// <summary>
        /// Hàm thực hiện in.
        /// Nếu bệnh nhân không có kết quả thì bỏ qua.
        /// </summary>
        /// <param name="patientId"></param>
        private void PerformPrint()
        {
            try
            {
                if (((List<DataRow>) dtPrintingStatus.Rows[0]["PrintData"]).Count <= 0)
                {
                    dtPrintingStatus.Rows.RemoveAt(0);
                    dtPrintingStatus.AcceptChanges();
                    Utility.ShowMsg(Utility.sDbnull(dtPrintingStatus.Rows[0]["Patient_ID"]) + "đã bị xóa");
                    return;
                }
                DataTable dtPrint = ((List<DataRow>) dtPrintingStatus.Rows[0]["PrintData"]).CopyToDataTable();

                ProcessData(ref dtPrint);
                if (SysPara.IsNormalResult == 1)
                {
                    string normalLevel = Utility.Int32Dbnull(dtPrint.Rows[0]["Sex"], 1) == 1
                                             ? "Normal_Level"
                                             : "Normal_LevelW";
                    //ProcessNormalResult(ref DTPrint);
                    Utilities.ProcessNormalResult(ref dtPrint, "Test_result", normalLevel, -1, 1,
                                                  0,
                                                  "binhthuong", false);
                    foreach (DataRow printRow in dtPrint.Rows)
                    {
                        if (
                            (printRow["Test_result"].ToString().Trim().ToUpper().StartsWith("ÂM"))
                            || (printRow["Test_result"].ToString().Trim().ToUpper().Contains("AM"))
                            )
                        {
                            printRow["binhthuong"] = -1;
                        }
                        else if (
                            (printRow["Test_result"].ToString().Trim().ToUpper().StartsWith("DƯƠ"))
                            || (printRow["Test_result"].ToString().Trim().ToUpper().Contains("DUO"))
                            )
                        {
                            printRow["binhthuong"] = 1;
                        }
                    }
                }

                var crptBusiness = new CrptBusiness();
                crptBusiness.ReportSourceTable = dtPrint;
                crptBusiness.StrCode = rboA4.Checked ? "A4" : "A5";
                if(rboA4.Checked)
                {
                    crptBusiness.StrCode = "A4";
                }
                else if(rboA5.Checked)
                {
                    crptBusiness.StrCode = "A5";
                }
                else
                {
                    crptBusiness.StrCode = "LABREPORT";
                }
                crptBusiness.FormPreviewTitle = "In kết quả xét nghiệm";
                CrptBusiness.printDateTime = dtpPrintDate.Value.Date;
                CrptBusiness.testTypeList.Clear();
                foreach (var row in grdTestType.GetCheckedRows())
                {
                    var a = row.Cells["TestType_ID"].Value;
                    CrptBusiness.testTypeList.Add(Utility.Int32Dbnull(row.Cells["TestType_ID"].Value));
                }
                crptBusiness.Print(true, dtPrintingStatus.Rows[0]["PrinterName"].ToString());

                if (dtPrintingStatus.Rows.Count > 0)
                {
                    dtPrintingStatus.Rows.RemoveAt(0);
                    //log.Debug(Utility.sDbnull(dtPrintingStatus.Rows[0]["Patient_ID"]));
                    dtPrintingStatus.AcceptChanges();
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Hàm thực hiện in.
        /// Nếu bệnh nhân không có kết quả thì bỏ qua.
        /// </summary>
        /// <param name="patientId"></param>
        private void PerformPrint()
        {
            try
            {
                if (((List <DataRow>)dtPrintingStatus.Rows[0]["PrintData"]).Count <= 0)
                {
                    dtPrintingStatus.Rows.RemoveAt(0);
                    dtPrintingStatus.AcceptChanges();
                    Utility.ShowMsg(Utility.sDbnull(dtPrintingStatus.Rows[0]["Patient_ID"]) + "đã bị xóa");
                    return;
                }
                DataTable dtPrint = ((List <DataRow>)dtPrintingStatus.Rows[0]["PrintData"]).CopyToDataTable();


                ProcessData(ref dtPrint);
                if (SysPara.IsNormalResult == 1)
                {
                    string normalLevel = Utility.Int32Dbnull(dtPrint.Rows[0]["Sex"], 1) == 1
                                             ? "Normal_Level"
                                             : "Normal_LevelW";
                    //ProcessNormalResult(ref DTPrint);
                    Utilities.ProcessNormalResult(ref dtPrint, "Test_result", normalLevel, -1, 1,
                                                  0,
                                                  "binhthuong", false);
                    foreach (DataRow printRow in dtPrint.Rows)
                    {
                        if (
                            (printRow["Test_result"].ToString().Trim().ToUpper().StartsWith("ÂM")) ||
                            (printRow["Test_result"].ToString().Trim().ToUpper().Contains("AM"))
                            )
                        {
                            printRow["binhthuong"] = -1;
                        }
                        else if (
                            (printRow["Test_result"].ToString().Trim().ToUpper().StartsWith("DƯƠ")) ||
                            (printRow["Test_result"].ToString().Trim().ToUpper().Contains("DUO"))
                            )
                        {
                            printRow["binhthuong"] = 1;
                        }
                    }
                }


                var crptBusiness = new CrptBusiness();
                crptBusiness.ReportSourceTable = dtPrint;
                crptBusiness.StrCode           = rboA4.Checked ? "A4" : "A5";
                if (rboA4.Checked)
                {
                    crptBusiness.StrCode = "A4";
                }
                else if (rboA5.Checked)
                {
                    crptBusiness.StrCode = "A5";
                }
                else
                {
                    crptBusiness.StrCode = "LABREPORT";
                }
                crptBusiness.FormPreviewTitle = "In kết quả xét nghiệm";
                CrptBusiness.printDateTime    = dtpPrintDate.Value.Date;
                CrptBusiness.testTypeList.Clear();
                foreach (var row in grdTestType.GetCheckedRows())
                {
                    var a = row.Cells["TestType_ID"].Value;
                    CrptBusiness.testTypeList.Add(Utility.Int32Dbnull(row.Cells["TestType_ID"].Value));
                }
                crptBusiness.Print(true, dtPrintingStatus.Rows[0]["PrinterName"].ToString());

                if (dtPrintingStatus.Rows.Count > 0)
                {
                    dtPrintingStatus.Rows.RemoveAt(0);
                    //log.Debug(Utility.sDbnull(dtPrintingStatus.Rows[0]["Patient_ID"]));
                    dtPrintingStatus.AcceptChanges();
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }