Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            VD_crpt_DailyParamTestReport rpt = new VD_crpt_DailyParamTestReport();

            rpt.Site = this.Site;
            return(rpt);
        }
 private void cmdPrint_Click(object sender, EventArgs e)
 {
     try
     {
         LayDuLieu();
         if (dt.Rows.Count<=0 || dtRawResult == null)
         {
             Utility.ShowMsg("Không có dữ liệu để báo cáo");
         }
         else
         {
             string s = "";
             if (dtpFromDate.Value.Date == dtpToDate.Value.Date)
             {
                 s = string.Format("{0}Ngày {1}", s, dtpFromDate.Value.ToString("dd/MM/yyyy"));
             }
             else
             {
                 s = string.Format("{0}{1}", s,
                                   string.Format("Từ ngày {0} đến ngày {1}",
                                                 dtpFromDate.Value.ToString("dd/MM/yyyy"),
                                                 dtpToDate.Value.ToString("dd/MM/yyyy")));
             }
             var crpt = new VD_crpt_DailyParamTestReport();
             var oForm = new frmPrintPreview("In Báo cáo lưu", crpt, true, true);
             crpt.SetDataSource(dt);
             crpt.DataDefinition.FormulaFields["Formula_1"].Text = "";
             crpt.SetParameterValue("sFromDateToDate", s);
             crpt.SetParameterValue("TongSoBenhNhan", dt.Rows.Count);
             crpt.SetParameterValue("ParentBranchName", ManagementUnit.gv_sParentBranchName);
             crpt.SetParameterValue("BranchName", ManagementUnit.gv_sBranchName);
             crpt.SetParameterValue("sPrintDate", dtpDatePrint.Value.ToString("dd/MM/yyyy"));
             oForm.crptViewer.ReportSource = crpt;
             oForm.ShowDialog();
             oForm.Dispose();
         }
     }
     catch (Exception ex)
     {
         Utility.ShowMsg("Lỗi" + ex, "Thông Báo", MessageBoxIcon.Warning);
     }
 }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     VD_crpt_DailyParamTestReport rpt = new VD_crpt_DailyParamTestReport();
     rpt.Site = this.Site;
     return rpt;
 }
        private void cmdINPHIEU_Click(object sender, EventArgs e)
        {
            try
            {
                //string sTenKhoa = cboDepartment.Text;
                //var dt = new DataTable();
                //dt.Columns.Add("Barcode");
                //dt.Columns.Add("Patient_ID");
                //dt.Columns.Add("Patient_Name");
                //dt.Columns.Add("AGE");
                //dt.Columns.Add("Sex");
                //dt.Columns.Add("Department");
                //dt.Columns.Add("Diagnostic");
                //dt.Columns.Add("AllResult");
                //dt.Columns.Add("Test_Date");

                //LDepartment objDepartment = LDepartment.FetchByID(Utility.Int32Dbnull(cboDepartment.SelectedValue));
                //if (objDepartment != null)
                //    sTenKhoa = Utility.sDbnull(objDepartment.SName, "");

                //if (dtRawResult == null)
                //{
                //    dtRawResult =
                //        SPs.SpRptBaoCaoLuu(dtpFromDate.Value,
                //                           dtpToDate.Value,
                //                           Utility.Int32Dbnull(cboDepartment.SelectedValue), chkPrintAll.Checked).
                //            GetDataSet().Tables[0];
                //    if (dtRawResult.Rows.Count == 0) dtRawResult = null;
                //}
                //if (dtRawResult != null && dtRawResult.Rows.Count <= 0)
                //{
                //    Utility.ShowMsg("Không tồn tại dữ liệu");
                //    return;
                //}
                //bool forVd = SysPara.BarcodeType.ToUpper() == "VIETDUC";
                ////Xử lý các giá trị bình thường
                //Utilities.ProcessNormalResult(ref dtRawResult, "Test_Result", "Normal_Level", "+",
                //                              "+", "-", "flag", forVd);

                //var patientResult = 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"]))
                //    {
                //        //patientResult.Remove(patientResult.Length - 2, 1);
                //        DataRow 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["AGE"] = dtRawResult.Rows[i - 1]["AGE"];
                //        newdr["Sex"] = dtRawResult.Rows[i - 1]["Sex"];
                //        newdr["Department"] = dtRawResult.Rows[i - 1]["Department"];
                //        newdr["Diagnostic"] = dtRawResult.Rows[i - 1]["Diagnostic"];
                //        if (dtRawResult.Rows[i - 1]["Test_Date"] != null)
                //            newdr["Test_Date"] = ((DateTime) dtRawResult.Rows[i - 1]["Test_Date"]).ToString("dd/MM/yyyy");
                //        //newdr["Test_Date"] = DateTime.Parse(dtRawResult.Rows[i - 1]["Test_Date"].ToString()).ToString("dd/MM/yyyy");
                //        newdr["AllResult"] = patientResult.ToString();
                //        dt.Rows.Add(newdr);
                //        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"])))
                //    {
                //        patientResult.Append("</p>");
                //        patientResult.Append(string.Format("</p><b>{0}</b>: ",
                //                                           Utility.sDbnull(dtRawResult.Rows[i]["TestType_Name"]).ToUpper
                //                                               ()));
                //    }
                //    string value;
                //    if (Utility.sDbnull(dtRawResult.Rows[i]["flag"]).Trim() == "+")
                //        value = string.Format("<font color=\"red\"><b>{0}({1}) {2};</b></font> ",
                //                              Utility.sDbnull(dtRawResult.Rows[i]["Test_Name"]),
                //                              Utility.sDbnull(dtRawResult.Rows[i]["flag"]),
                //                              dtRawResult.Rows[i]["Test_result"]);
                //    else if (Utility.sDbnull(dtRawResult.Rows[i]["flag"]).Trim() == "-")
                //        value = string.Format("{0}({1}) {2}; ",
                //                              Utility.sDbnull(dtRawResult.Rows[i]["Test_Name"]),
                //                              Utility.sDbnull(dtRawResult.Rows[i]["flag"]),
                //                              dtRawResult.Rows[i]["Test_result"]);
                //    else
                //        value = string.Format(
                //            Utility.sDbnull(dtRawResult.Rows[i]["Test_result"]).Trim() != ""
                //                ? "{0} {1};"
                //                : "<i>{0}&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</i> ",
                //            Utility.sDbnull(dtRawResult.Rows[i]["Test_Name"]),
                //            dtRawResult.Rows[i]["Test_result"]);

                //    patientResult.Append(value);
                //}

                //dt.AcceptChanges();

                string s = "";
                if (dtpFromDate.Value.Date == dtpToDate.Value.Date)
                {
                    s = string.Format("{0}Ngày {1}", s, dtpFromDate.Value.ToString("dd/MM/yyyy"));
                }
                else
                {
                    s = string.Format("{0}{1}", s,
                                      string.Format("Từ ngày {0} đến ngày {1}", dtpFromDate.Value.ToString("dd/MM/yyyy"),
                                                    dtpToDate.Value.ToString("dd/MM/yyyy")));
                }
                var crpt = new VD_crpt_DailyParamTestReport();
                var oForm = new frmPrintPreview("In Báo cáo lưu", crpt, true, true);
                crpt.SetDataSource(dt);
                crpt.DataDefinition.FormulaFields["Formula_1"].Text = "";
                //crpt.SetParameterValue("sTenKhoa", sTenKhoa);
                crpt.SetParameterValue("TongSoBenhNhan", dt.Rows.Count);
                crpt.SetParameterValue("sFromDateToDate", s);
                crpt.SetParameterValue("ParentBranchName", ManagementUnit.gv_sParentBranchName);
                crpt.SetParameterValue("BranchName", ManagementUnit.gv_sBranchName);
                //crpt.SetParameterValue("Address", ManagementUnit.gv_sAddress);
                //crpt.SetParameterValue("sPhone", ManagementUnit.gv_sPhone);
                crpt.SetParameterValue("sPrintDate", dtCreatePrint.Value.ToString("dd/MM/yyyy"));
                oForm.crptViewer.ReportSource = crpt;
                oForm.ShowDialog();
                oForm.Dispose();
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }