コード例 #1
0
        private void btnGenerar_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            try
            {
                Fecinicio = DtpFechaIni.Value;
                FecFin    = DtpFechaFin.Value.AddDays(1);

                if (DtpFechaIni.Value != null & DtpFechaFin.Value != null)
                {
                    DtVentasNavidenha = ObjCL_Venta.GetVentasNavidenhasPorFecha(Fecinicio, FecFin);
                    ObjCrGetVentasNavidenhasPorFecha.SetDataSource(DtVentasNavidenha);

                    CrvVentasNavidenha.ReportSource = ObjCrGetVentasNavidenhasPorFecha;
                    //pasar datos directo al crystal reports
                    TextObject txt;
                    txt      = (TextObject)ObjCrGetVentasNavidenhasPorFecha.ReportDefinition.ReportObjects["TxtTitulo"];
                    txt.Text = "Ventas de Productos navideños comprendidos entre: " + Fecinicio.Date.ToString().Substring(0, 10) + " y " + FecFin.Date.ToString().Substring(0, 10);
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.InnerException.Message);
                MessageBox.Show(ex.Message);
            }

            Cursor = Cursors.Default;
        }