Пример #1
0
        private void cmdINPHIEU_Click(object sender, EventArgs e)
        {
            try
            {
                dtPatient = SPs.BaocaoSluongXetnghiemTheodoituong(dtpFromDate.Value.Date, dtpToDate.Value.Date).GetDataSet().Tables[0];
                if (dtPatient.Rows.Count < 0)
                {
                    Utility.ShowMsg("Không có dữ liệu để in");
                }
                else
                {
                    string s = "";

                    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")));
                    Utility.UpdateLogotoDatatable(ref dtPatient);
                    CRPT_GTVT_BAOCAO_SLUONG_BNHAN_THEODOITUONG crpt = new CRPT_GTVT_BAOCAO_SLUONG_BNHAN_THEODOITUONG();
                    var objForm = new frmPrintPreview("In Báo Cáo", crpt, true, true);
                    crpt.SetDataSource(dtPatient);

                    crpt.SetParameterValue("ParentBranchName", globalVariables.ParentBranch_Name);
                    crpt.SetParameterValue("BranchName", globalVariables.Branch_Name);
                    crpt.SetParameterValue("sTitleReport", label7.Text);
                    crpt.SetParameterValue("sTuNgayDenNgay", s);
                    crpt.SetParameterValue("sCurrentDate", Utility.FormatDateTime(dtNgayInPhieu.Value));
                    objForm.crptViewer.ReportSource = crpt;
                    objForm.ShowDialog();
                    Utility.DefaultNow(this);
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.ToString());
            }
        }