Example #1
0
        private void btnBuscarPacienteReporte_Click(object sender, RoutedEventArgs e)
        {
            Reportes.Reporte listaReporteUnico = new Reportes.Reporte();
            if(txtBuscarPacienteIdentidad.Text == "" && txtBuscarPacienteReporte.Text == "")
            {
                MessageBox.Show("Ingrese el Nombre Completo o la Identidad", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);

            }
            else
            {
                dgListarHistoriaClina.ItemsSource = listaReporteUnico.ListarReportesPacienteUnico(txtBuscarPacienteReporte.Text, txtBuscarPacienteIdentidad.Text);
            }
        }
Example #2
0
        private void btnReportePDF_Click(object sender, RoutedEventArgs e)
        {
            Reportes.Reporte seleccionar = dgListarHistoriaClina.SelectedItem as Reportes.Reporte;

            if (seleccionar != null)
            {
                // Datos del paciente
                string nombrePaciente = seleccionar.nombrePaciente;
                int edadPaciente = seleccionar.edadPaciente;
                string sexoPaciente = seleccionar.sexoPaciente;
                string motivoConsulta = seleccionar.motivoConsulta;
                string hea = seleccionar.HEA;
                string antecedentes = seleccionar.antecedentes;
                string tratamiento = seleccionar.tratamiento;
                DateTime fechaIngreso = seleccionar.fechaIngreso;
                string examenFisico = seleccionar.descripcionHistoria;
                string claveEnfermeddad = seleccionar.claveEnfermedad;
                string enfermedad = seleccionar.nombreEnfermedad;

                // Pasar los datos
                ReportePDF reportePDF = new ReportePDF();
                reportePDF.nombrePaciente = nombrePaciente;
                reportePDF.edadPaciete = edadPaciente;
                reportePDF.sexoPaciente = sexoPaciente;
                reportePDF.motivoConsulta = motivoConsulta;
                reportePDF.HEA = hea;
                reportePDF.Antecedentes = antecedentes;
                reportePDF.Tratamiento = tratamiento;
                reportePDF.fechaIngreso = fechaIngreso;
                reportePDF.examenFisico = examenFisico;
                reportePDF.clave = claveEnfermeddad;
                reportePDF.enfermedad = enfermedad;

                reportePDF.Show();

            }
            else
            {

                MessageBox.Show("No hay datos", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Example #3
0
 private void cargarGrid()
 {
     Reportes.Reporte listar = new Reportes.Reporte();
     dgListarHistoriaClina.ItemsSource = listar.ListarReportes();
 }
Example #4
0
        private void btnReporteWord_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();
            object missing = Missing.Value;

            Reportes.Reporte seleccionar = dgListarHistoriaClina.SelectedItem as Reportes.Reporte;

            if (seleccionar != null)
            {
                // Datos del paciente
                string nombrePaciente = seleccionar.nombrePaciente;
                int edadPaciente = seleccionar.edadPaciente;
                string sexoPaciente = seleccionar.sexoPaciente;
                string motivoConsulta = seleccionar.motivoConsulta;
                string hea = seleccionar.HEA;
                string antecedentes = seleccionar.antecedentes;
                string tratamiento = seleccionar.tratamiento;
                DateTime fechaIngreso = seleccionar.fechaIngreso;
                string examenFisico = seleccionar.descripcionHistoria;
                string claveEnfermeddad = seleccionar.claveEnfermedad;
                string enfermedad = seleccionar.nombreEnfermedad;

                // Datos word
                word.Application wordApp = new word.Application();
                object objMiss = Missing.Value;
                word.Document document = null;

                object readOnly = false;
                object isVisible = false;
                wordApp.Visible = false;

                try

                {

                    document = wordApp.Documents.Open(ref fileLocation, ref objMiss, ref readOnly,
                                                            ref objMiss, ref objMiss, ref objMiss,
                                                            ref objMiss, ref objMiss, ref objMiss,
                                                            ref objMiss, ref objMiss, ref objMiss,
                                                            ref objMiss, ref objMiss,   ref objMiss, ref objMiss);

                    document.Activate();

                    FindAndReplace(wordApp,"[nombre]", nombrePaciente);
                    FindAndReplace(wordApp, "[edad]", Convert.ToString(edadPaciente));
                    FindAndReplace(wordApp, "[sexo]", sexoPaciente);
                    FindAndReplace(wordApp, "[fechaIngreso]", Convert.ToString(fechaIngreso));
                    FindAndReplace(wordApp, "[motivo]", motivoConsulta);
                    FindAndReplace(wordApp, "[HEA]", hea);
                    FindAndReplace(wordApp, "[antecedentes]", antecedentes);
                    FindAndReplace(wordApp, "[historial]", examenFisico);
                    FindAndReplace(wordApp, "[clave]", claveEnfermeddad);
                    FindAndReplace(wordApp, "[enfermedad]", enfermedad);
                    FindAndReplace(wordApp, "[tratamiento]", tratamiento);

                    dlg.FileName = "Historia Clinica - "+nombrePaciente;
                    dlg.Filter = "Word File (.docx ,.doc)|*.docx;*.doc";

                    if (dlg.ShowDialog() == true)
                    {
                        object location = dlg.FileName;

                        document.SaveAs2(ref location, ref objMiss, ref objMiss, ref objMiss,
                                    ref objMiss, ref objMiss, ref objMiss,
                                    ref objMiss, ref objMiss, ref objMiss,
                                    ref objMiss, ref objMiss, ref objMiss,
                                    ref objMiss, ref objMiss, ref objMiss);

                        MessageBoxResult result = MessageBox.Show("Documento Creado" +Environment.NewLine +"Abrir Historia Clinca", "Historia Clinica", MessageBoxButton.YesNo, MessageBoxImage.Question);
                        if(result == MessageBoxResult.Yes)
                        {
                            Process.Start((string)location);
                        }
                        else
                        {

                        }

                        //MessageBox.Show("Documento Creado", "Historia Clinica", MessageBoxButton.OK, MessageBoxImage.Information);

                        //wordApp.Visible = true;
                    }

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                   document.Close(Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges, Microsoft.Office.Interop.Word.WdOriginalFormat.wdOriginalDocumentFormat, false);
                   wordApp.Quit(Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges);
                }
            }
            else
            {

                 MessageBox.Show("No hay datos", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);

            }
        }