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

            rpt.Site = this.Site;
            return(rpt);
        }
Exemple #2
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            #region

            try
            {
                cls.ClsConnect();
                int      thamso = 4;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                bien[1]   = "@MaPos";
                giatri[1] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien[2]   = "@MaXa";
                if (str.Right(CboPos.SelectedValue.ToString(), 2) != "00")
                {
                    giatri[2] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                }
                else
                {
                    giatri[2] = "";
                }
                bien[3] = "@Mau";
                if (str.Right(CboPos.SelectedValue.ToString(), 2) != "00" && str.Right(CboXa.SelectedValue.ToString(), 2) != "00")
                {
                    giatri[3] = "1";
                }
                else if (str.Right(CboPos.SelectedValue.ToString(), 2) != "00" && str.Right(CboXa.SelectedValue.ToString(), 2) == "00")
                {
                    giatri[3] = "2";
                }
                if (str.Right(CboPos.SelectedValue.ToString(), 2) == "00")
                {
                    giatri[3] = "3";
                }
                dt = cls.LoadLdbf("usp_NOXH", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    if (Ration1.IsChecked == true)
                    {
                        rpt_NOXH rpt = new rpt_NOXH();
                        RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                    }
                    else
                    {
                        FileName = Thumuc + "\\" + giatri[2] + "_" + giatri[3] + "_NOXH_" +
                                   dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
                        str.ExportToExcel(dt, FileName);
                        MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK,
                                        MessageBoxImage.Information);
                        str.OpenExcel(FileName);
                    }
                }
                else
                {
                    MessageBox.Show("Không có số liệu", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            cls.DongKetNoi();

            #endregion
        }