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

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnSua_Click(object sender, RoutedEventArgs e)
        {
            string strup = "";

            try
            {
                cls.ClsConnect();
                dtNew = dt.GetChanges();
                if (dtNew == null || dtNew.Rows.Count == 0)
                {
                    MessageBox.Show("Chưa có thay đổi ngày nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    foreach (DataRow dr in dtNew.Rows)
                    {
                        if ((bool)dr["GDX"])
                        {
                            strup = "update LUU_TSCC set GDX=1 where MA_TS='" + dr["MA_TS"] + "'";
                        }
                        else
                        {
                            strup = "update LUU_TSCC set GDX=0 where MA_TS='" + dr["MA_TS"] + "'";
                        }
                        cls.UpdateDataText(strup);
                        string strupmt = "update LUU_TSCC set DE_NGHI=N'" + dr["DE_NGHI"] + "' where MA_TS='" + dr["MA_TS"] + "'";
                        // MessageBox.Show(strupmt);
                        cls.UpdateDataText(strupmt);
                    }
                    MessageBox.Show("Cập nhật thành công !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                string mau = "";
                mau = "4";
                string ng      = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                string sqlload =
                    "select '" + mau + "' MAU,'" + ng + "' NGAY,a.*,b.PO_TEN from LUU_TSCC a left join DMPOS b on a.POS_CD=b.PO_MA " +
                    "where a.GDX=1 and a.TRANGTHAI='A' and a.POS_CD='" + CboPos.SelectedValue + "' order by a.MAPHONG,a.LOAI_TS_CHITIET,a.MA_NHANHIEU_TS,a.MA_TS";
                string sqlth =
                    "select '" + mau + "' MAU,'" + ng + "' NGAY,a.*,b.PO_TEN from LUU_TSCC a left join DMPOS b on a.POS_CD=b.PO_MA " +
                    "where a.LOAI_TS_CHITIET='TI1' and a.GDX=1 and a.TRANGTHAI='A' and a.MA_NHANHIEU_TS in ('TI11','TI12','TI13','TI19','MM19') order by a.LOAI_TS_CHITIET,a.MA_NHANHIEU_TS,a.MA_TS";

                var dtin = cls.LoadDataText(sqlload);
                var dtth = cls.LoadDataText(sqlth);
                if (dtin.Rows.Count > 0)
                {
                    if (chkTh.IsChecked == true)
                    {
                        rpt_TSCC_GDX01 rpt = new rpt_TSCC_GDX01();
                        RPUtility.ShowRp(rpt, dtth, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                        //RPUtility.ShowRp(rpt, dtxa, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),srv.DbPassSerVer());
                    }
                    else
                    {
                        rpt_TSCC_GDX rpt = new rpt_TSCC_GDX();
                        RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                        //RPUtility.ShowRp(rpt, dtxa, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),srv.DbPassSerVer());
                    }
                }
                else
                {
                    MessageBox.Show("Không có dữ liệu !", "Thông báo", MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }