/// <summary> /// Override to achieve keyboard operated form /// </summary> /// <param name="msg"></param> /// <param name="keyData"></param> /// <returns></returns> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Control | Keys.P: crViewer.PrintReport(); break; case Keys.F5: LoadReport(); break; } return(base.ProcessCmdKey(ref msg, keyData)); }
public void ImprimirCobranza(ArrayList ListaCobranzas) { ParameterFieldDefinitions crParameterFieldDefinitions; ParameterFieldDefinition crParameterFieldDefinition; CrystalDecisions.Shared.ParameterValues crParametervalues; CrystalDecisions.Shared.ParameterDiscreteValue crParameterDiscretValue; _reporte.ReportSource = null; try { string fileReporte; if (ListaCobranzas.Count > 1) { fileReporte = _rutaReportes + @"\ReporteRelacionCobranza.rpt"; } else { fileReporte = _rutaReportes + @"\reporteRelacionCobranzaAutomatica.rpt"; } rptReporte.Load(fileReporte); foreach (CrystalDecisions.CrystalReports.Engine.Table _TablaReporte in rptReporte.Database.Tables) { CrystalDecisions.Shared.TableLogOnInfo _LogonInfo = _TablaReporte.LogOnInfo; _LogonInfo.ConnectionInfo.ServerName = SigaMetClasses.DataLayer.Conexion.DataSource; _LogonInfo.ConnectionInfo.DatabaseName = SigaMetClasses.DataLayer.Conexion.Database; _TablaReporte.ApplyLogOnInfo(_LogonInfo); } crParameterFieldDefinitions = rptReporte.DataDefinition.ParameterFields; crParameterFieldDefinition = crParameterFieldDefinitions["@Cobranza"]; crParametervalues = crParameterFieldDefinition.CurrentValues; foreach (int Cobranza in ListaCobranzas) { if (Cobranza > 0) { crParameterDiscretValue = new ParameterDiscreteValue(); crParameterDiscretValue.Value = Cobranza; crParametervalues.Add(crParameterDiscretValue); crParameterFieldDefinition.ApplyCurrentValues(crParametervalues); _reporte.ReportSource = rptReporte; _reporte.PrintReport(); } } rptReporte.Close(); rptReporte.Dispose(); rptReporte = new ReportDocument(); } catch (LoadSaveReportException ex) { throw ex; } catch (Exception ex) { throw ex; } }