コード例 #1
0
        /// <summary>
        /// In báo cáo
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ptbPrintImport_Click(object sender, EventArgs e)
        {
            DateTime TuNgay           = dtpkTuNgayThu.Value;
            DateTime denNgay          = dtpkDenNgayThu.Value;
            CrystalReportBaoCaoThu cr = new CrystalReportBaoCaoThu();

            cr.SetDataSource(HoaDonDAO.Instance.getHoaDonbyThoiGian(TuNgay, denNgay));
            ParameterFieldDefinitions crParameterFieldDefinitions = cr.DataDefinition.ParameterFields;

            ParameterFieldDefinition crParameterFieldDefinition = crParameterFieldDefinitions["TuNgay"];
            ParameterDiscreteValue   crParameterDiscreteValue   = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = TuNgay;
            ParameterValues crParameterValues = new ParameterValues();

            //reset lại value
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            ParameterFieldDefinition crParameterFieldDefinitionDenNgay = crParameterFieldDefinitions["DenNgay"];
            ParameterDiscreteValue   crParameterDiscreteValueDenNgay   = new ParameterDiscreteValue();

            crParameterDiscreteValueDenNgay.Value = denNgay;
            ParameterValues crParameterValuesDenNgay = new ParameterValues();

            //reset lại value
            crParameterValuesDenNgay = crParameterFieldDefinitionDenNgay.CurrentValues;
            crParameterValuesDenNgay.Add(crParameterDiscreteValueDenNgay);
            crParameterFieldDefinitionDenNgay.ApplyCurrentValues(crParameterValuesDenNgay);
            fReport f = new fReport(cr);

            f.ShowDialog();
        }
コード例 #2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CrystalReportBaoCaoThu rpt = new CrystalReportBaoCaoThu();

            rpt.Site = this.Site;
            return(rpt);
        }