Exemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crpt_LaoKhoa_SLMau_TheoBarcode rpt = new crpt_LaoKhoa_SLMau_TheoBarcode();

            rpt.Site = this.Site;
            return(rpt);
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     crpt_LaoKhoa_SLMau_TheoBarcode rpt = new crpt_LaoKhoa_SLMau_TheoBarcode();
     rpt.Site = this.Site;
     return rpt;
 }
        public void DanhSachXetNghiem()
        {
            try
            {
                string pFromBarcode = dtpDatePrintFrom.Value.ToString("yyMMdd") +
                                      txtFromBarcode.Text.Trim().PadLeft(4, '0');

                string pToBarcode = dtpDatePrintFrom.Value.ToString("yyMMdd") +
                                    txtToBarcode.Text.Trim().PadLeft(4, '0');

                dt = new DataTable();
                dt.Columns.Add("Patient_ID");
                dt.Columns.Add("Barcode");
                dt.Columns.Add("Patient_Name");
                dt.Columns.Add("TestType_ID");
                dt.Columns.Add("TestType_Name");
                dt.Columns.Add("AllResult");
                dtRawResult =
                    LAOKHOA_DANHSACH_THEOBARCODE(dtpDatePrintFrom.Value, pFromBarcode, pToBarcode).GetDataSet().Tables[0
                        ];
                var patientResult = new StringBuilder();
                var patientResult2 = new StringBuilder();
                dtRawResult.Rows.InsertAt(dtRawResult.NewRow(), 0);
                dtRawResult.Rows[0]["Patient_ID"] = dtRawResult.Rows[1]["Patient_ID"];
                dtRawResult.Rows.Add(dtRawResult.NewRow());
                for (int i = 1; i <= dtRawResult.Rows.Count - 1; i++)
                {
                    if (Utility.sDbnull(dtRawResult.Rows[i]["Patient_ID"]) !=
                        Utility.sDbnull(dtRawResult.Rows[i - 1]["Patient_ID"]))
                    {
                        var newdr = dt.NewRow();
                        newdr["Patient_ID"] = dtRawResult.Rows[i - 1]["Patient_ID"];
                        newdr["Barcode"] = dtRawResult.Rows[i - 1]["Barcode"];
                        newdr["Patient_Name"] = dtRawResult.Rows[i - 1]["Patient_Name"];
                        newdr["AllResult"] = patientResult.ToString();
                        dt.Rows.Add(newdr);
                        patientResult2 = new StringBuilder();
                        patientResult = new StringBuilder();
                    }
                    if ((Utility.sDbnull(dtRawResult.Rows[i]["TestType_Name"]) !=
                         Utility.sDbnull(dtRawResult.Rows[i - 1]["TestType_Name"])) |
                        (Utility.sDbnull(dtRawResult.Rows[i]["Patient_ID"]) !=
                         Utility.sDbnull(dtRawResult.Rows[i - 1]["Patient_ID"])))
                    {
                        //patientResult2.Append(dtRawResult.Rows[i]["TestType_Name"] + ":");
                       // patientResult.Append("</p>");
                        patientResult.Append(string.Format("<font  color=\"red\"><b>{0}</b></font>: ",
                                                           Utility.sDbnull(dtRawResult.Rows[i]["TestType_Name"]).ToUpper
                                                               ()));
                        //   patientResult.Append("</p>");
                    }
                    string value;
                    if (Utility.sDbnull(dtRawResult.Rows[i]["TestType_ID"]) == "2" && Utility.sDbnull(dtRawResult.Rows[i]["Test_Name"]) =="")
                    {
                        value = string.Format("{0}; ", "Tổng phân tích huyết học");
                    }

                    else
                    {
                        if (Utility.sDbnull(dtRawResult.Rows[i]["TestType_ID"]) == "10" && Utility.sDbnull(dtRawResult.Rows[i]["Test_Name"]) =="")
                        {
                        value = string.Format("{0}; ", "Tổng phân tích nước tiểu");
                         }
                        else
                        {
                            value = string.Format("{0}; ", Utility.sDbnull(dtRawResult.Rows[i]["Test_Name"]));
                        }

                    }
                    patientResult.Append(value);
                   // patientResult2.Append(value);
                }
                if (dt.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy bản ghi nào", "Thông Báo", MessageBoxIcon.Information);
                }
                else
                {
                    string stringBarcode = string.Format("Từ Barcode {0} đến barcode {1}", pFromBarcode, pToBarcode);
                    var crpt = new crpt_LaoKhoa_SLMau_TheoBarcode();
                    var objFrom = new frmPrintPreview("Danh Sách Bệnh Nhân Theo Barcode", crpt, true, true);
                    crpt.SetDataSource(dt);
                    crpt.DataDefinition.FormulaFields["Formula_1"].Text = "";
                    crpt.SetParameterValue("stringBarcode", stringBarcode);
                    crpt.SetParameterValue("ParentBranchName", globalVariables.ParentBranch_Name);
                    crpt.SetParameterValue("BranchName", globalVariables.Branch_Name);
                    objFrom.crptViewer.ReportSource = crpt;
                    objFrom.ShowDialog();
                }
            }
            catch (Exception)
            {
                Utility.ShowMsg("Bạn chưa chọn loại xét nghiệm", "Thông báo", MessageBoxIcon.Warning);
            }
        }