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

            rpt.Site = this.Site;
            return(rpt);
        }
Ejemplo n.º 2
0
 private void btnPrint_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         if (opt1.IsChecked == true)
         {
             mau = "2";
             string strin = "select * from LUU_KHAOSATVAY where DOT='" + CboDot.SelectionBoxItem + "' and NAM='" +
                            dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and MAXA='" + CboXa.SelectedValue +
                            "'";
             var dtin = cls.LoadDataText(strin);
             if (dtin.Rows.Count > 0)
             {
                 rpt_ksVay01 rpt = new rpt_ksVay01();
                 RPUtility.ShowRp(rpt, dtin, 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.Warning);
             }
         }
         if (opt2.IsChecked == true)   //Mau 03
         {
             mau = "3";
             string strin = "select '" + mau + "' MAU,N'nhcsxh tỉnh quảng bình' title1,b.PO_TEN title2,a.DOT,a.NAM,a.MAPOS,b.PO_TEN,a.MAXA,a.TENXA,COUNT(distinct MATHON) SOTHON,COUNT(distinct MATO) SOTO,SUM(a.SH01) SH01,SUM(a.ST01) ST01 "
                            + " , SUM(a.SH19)SH19, SUM(a.ST19) ST19, SUM(a.SH09) SH09, SUM(a.ST09) ST09, SUM(a.SH06) SH06, SUM(a.ST06) ST06 "
                            + " , SUM(a.SH10) SH10, SUM(a.ST10) ST10, SUM(a.SH_CHUA) SH_CHUA, SUM(a.SH_KHONG) SH_KHONG "
                            + " from LUU_KHAOSATVAY a, DMPOS b where a.TRANGTHAI='A' and a.MAPOS = b.PO_MA and a.DOT = '" + CboDot.SelectionBoxItem + "' and a.MAPOS = '" + CboPos.SelectedValue + "' and a.NAM = '" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' "
                            + " group by a.DOT, a.NAM, a.MAPOS, b.PO_TEN, a.MAXA, a.TENXA order by a.MAXA";
             var dtin = cls.LoadDataText(strin);
             if (dtin.Rows.Count > 0)
             {
                 rpt_ksVay02 rpt = new rpt_ksVay02();
                 RPUtility.ShowRp(rpt, dtin, 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.Warning);
             }
         }
         else // mau 4
         {
             mau = "4";
             string strin = "select '" + mau + "' MAU,N'ngân hàng chinh sách xã hội' title1,N'chi nhánh tỉnh quảng bình' title2,a.DOT,a.NAM,a.MAPOS,b.PO_TEN,a.MAPOS MAXA,b.PO_TEN TENXA,COUNT(distinct MATHON) SOTHON,COUNT(distinct MATO) SOTO,SUM(a.SH01) SH01,SUM(a.ST01) ST01 "
                            + " , SUM(a.SH19)SH19, SUM(a.ST19) ST19, SUM(a.SH09) SH09, SUM(a.ST09) ST09, SUM(a.SH06) SH06, SUM(a.ST06) ST06 "
                            + " , SUM(a.SH10) SH10, SUM(a.ST10) ST10, SUM(a.SH_CHUA) SH_CHUA, SUM(a.SH_KHONG) SH_KHONG "
                            + " from LUU_KHAOSATVAY a, DMPOS b where a.TRANGTHAI='A' and a.MAPOS = b.PO_MA and a.DOT = '" + CboDot.SelectionBoxItem + "' and a.NAM = '" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' "
                            + " group by a.DOT, a.NAM, a.MAPOS, b.PO_TEN order by a.MAPOS";
             var dtin = cls.LoadDataText(strin);
             if (dtin.Rows.Count > 0)
             {
                 rpt_ksVay02 rpt = new rpt_ksVay02();
                 RPUtility.ShowRp(rpt, dtin, 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.Warning);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     cls.DongKetNoi();
 }