public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crptDoanhThuTungSPTrongThang rpt = new crptDoanhThuTungSPTrongThang();

            rpt.Site = this.Site;
            return(rpt);
        }
Esempio n. 2
0
        public void BaoCaoDoanhThuTungSPTrongThang()
        {
            DateTime tuNgay  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime denNgay = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            cmd.CommandText = "select tu.TENTU, cthd.GIABAN, sum(cthd.SL) as TONGSL, sum(cthd.SL*cthd.GIABAN) as TONGDOANHTHU"
                              + " from THUC_UONG tu, CHI_TIET_HOA_DON cthd, HOA_DON hd"
                              + " where tu.MATU=cthd.MATU and cthd.MAHD=hd.MAHD and tu.TRANGTHAIXOA=0 and hd.NGAYLAP>='" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", tuNgay) + "' and hd.NGAYLAP<='" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", denNgay) + "'"
                              + " group by tu.MATU, tu.TENTU, cthd.GIABAN";
            da.SelectCommand = cmd;

            DataTable dt = new DataTable("DoanhThuTungSPTrongThang");

            da.Fill(dt);

            crptDoanhThuTungSPTrongThang rp = new crptDoanhThuTungSPTrongThang();

            rp.SetDataSource(dt);
            crystalReportViewer1.ReportSource = rp;
        }