public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { FaltasPeriodo rpt = new FaltasPeriodo(); rpt.Site = this.Site; return(rpt); }
//*********************************************************************************************** //Autor: Benjamin Huizar Barajas //Fecha creación:12-05-2017 Última Modificacion: //Descripción: Forma que llama al Reporte -> Mas de 3 Faltas en un período de 30 días //*********************************************************************************************** //----------------------------------------------------------------------------------------------- // C O M B O S //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- // G R I D // S //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- // B O T O N E S //----------------------------------------------------------------------------------------------- private void btnImprimir_Click(object sender, EventArgs e) { ///////////////////////////// string sIdtrab = ""; if (cboEmpleados.Text == String.Empty) { sIdtrab = "%"; } else { sIdtrab = cboEmpleados.SelectedValue.ToString(); } if (sIdtrab == "0") { sIdtrab = "%"; } /////////////////////// /* if (cboEmpleados.SelectedIndex.ToString() == "0") * sIdTrab = "%"; * else * sIdTrab = cboEmpleados.SelectedIndex.ToString(); */ if (cbCompania.SelectedIndex.ToString() == "0") { sCompania = "%"; } else { sCompania = cbCompania.SelectedIndex.ToString(); } if (cbUbicacion.SelectedIndex.ToString() == "0") { sUbicacion = "%"; } else { sUbicacion = cbUbicacion.SelectedIndex.ToString(); } dtFechaBase = new DateTime(dpFechaBase.Value.Year, dpFechaBase.Value.Month, dpFechaBase.Value.Day); //sIdTrab = cboEmpleados.SelectedIndex.ToString() != "0" ? cboEmpleados.SelectedValue.ToString() : '%'; //sCompania = cbCompania.SelectedIndex > 0 ? cbCompania.SelectedValue.ToString() : 0; //sUbicacion = cbUbicacion.SelectedIndex > 0 ? cbUbicacion.SelectedValue.ToString() : 0; //dtFechaBase = new DateTime(dpFechaBase.Value.Year, dpFechaBase.Value.Month, dpFechaBase.Value.Day); DataTable dtReporteRegistro = oTrabajador.MasDe3Faltas(5, sIdtrab, sCompania, sUbicacion, dtFechaBase); switch (dtReporteRegistro.Rows.Count) { case 0: DialogResult result = MessageBox.Show("Sin Resultados", "SIPAA"); break; default: //Preparación de los objetos para mandar a imprimir el reporte de Crystal Reports ViewerReporte form = new ViewerReporte(); FaltasPeriodo dtrpt = new FaltasPeriodo(); ReportDocument ReportDoc = Utilerias.ObtenerObjetoReporte(dtReporteRegistro, this.CompanyName, dtrpt.ResourceName); ReportDoc.SetParameterValue("titulo1", TITULO_REPORTE); ReportDoc.SetParameterValue("descripcion1", NOMBRE_REPORTE); ReportDoc.SetParameterValue("descripcion2", "Fecha base: " + dpFechaBase.Value.ToShortDateString()); form.RptDoc = ReportDoc; form.Show(); // crear CSV DialogResult Resultado = MessageBox.Show("¿Desea crear el archivo en formato .csv para abrirlo con excel?", "SIPAA", MessageBoxButtons.YesNo); if (Resultado == DialogResult.Yes) { creacsv(dtReporteRegistro); } break; } }