Exemplo n.º 1
0
        private void btn_Buscar_Click(object sender, RoutedEventArgs e)
        {
            List <Reporte> listReporteBusqueda = new List <Reporte>();
            string         estatus             = cb_Estatus.Text;
            string         delegacion          = cb_Delegacion.Text;

            if (cb_Estatus.SelectedItem != null)
            {
                listReporteBusqueda    = ReporteDAO.getReportesEstatus(estatus);
                dgReportes.ItemsSource = listReporteBusqueda;
            }
            if (cb_Delegacion.SelectedItem != null)
            {
                listReporteBusqueda    = ReporteDAO.getReportesDelegacion(delegacion);
                dgReportes.ItemsSource = listReporteBusqueda;
            }
            if (cb_Delegacion.SelectedItem != null && cb_Estatus.SelectedItem != null)
            {
                listReporteBusqueda    = ReporteDAO.getReportesAvanzada(delegacion, estatus);
                dgReportes.ItemsSource = listReporteBusqueda;
            }

            cb_Delegacion.Text = "";
            cb_Estatus.Text    = "";
        }
Exemplo n.º 2
0
        public ActionResult FacturasPendientes()
        {
            if (Session["VenCod"] == null)
            {
                return(RedirectToAction("SesionExpirada", "Error"));
            }
            var            vendCodi = Session["ID"].ToString().Trim();
            UsuariosModels usr6     = new UsuariosModels();

            usr6.id = int.Parse(vendCodi);
            List <UsuariosModels> CorreoUsuario = new List <UsuariosModels>();

            CorreoUsuario = UsuariosDAO.ValidaCorreo(usr6);

            if (CorreoUsuario[0].email == null || CorreoUsuario[0].email == "")
            {
                TempData["Mensaje"] = "<div class='alert alert-warning alert - dismissable'>" + "<strong>Usuario no tiene correo configurado</strong></div>";
                return(RedirectToAction("Index", "Index"));
            }


            List <NotadeVentaCabeceraModels> doc = new List <NotadeVentaCabeceraModels>();
            var docPendientes = ReporteDAO.listarDocPendientes();

            if (docPendientes != null)
            {
                doc = docPendientes;
            }

            ViewBag.doc = doc;

            return(View());
        }
Exemplo n.º 3
0
        public ActionResult ListarNotasdeDetalle(int nvNumero)
        {
            try
            {
                NotadeVentaCabeceraModels        NVC  = new NotadeVentaCabeceraModels();
                List <NotadeVentaCabeceraModels> NVCL = new List <NotadeVentaCabeceraModels>();
                NotaDeVentaDetalleModels         NVD  = new NotaDeVentaDetalleModels();
                List <NotaDeVentaDetalleModels>  NVDL = new List <NotaDeVentaDetalleModels>();

                NVC.NVNumero = nvNumero;
                NVD.NVNumero = nvNumero;

                var listaNVD = ReporteDAO.ListarNotaDetalle(NVD);

                if (listaNVD != null)
                {
                    NVDL = listaNVD;
                }

                ViewBag.NVDL = NVDL;

                return(View());
            }
            catch (Exception ex)
            {
                return(View(ex.Message));
            }
        }
Exemplo n.º 4
0
        private void btn_dictaminar_Click(object sender, RoutedEventArgs e)
        {
            string descripcionDictamen = txt_Dictamen.Text;

            if (descripcionDictamen.Length > 0)
            {
                string   userNamePerito     = MainWindow.userName;
                DateTime fechaYHora         = DateTime.Now;
                int      idReporte          = VerReportes.idReporte;
                int      resultadoInsercion = DictamenDAO.agregarDictamen(userNamePerito, fechaYHora, descripcionDictamen, idReporte);
                if (resultadoInsercion > 0)
                {
                    int resultadoActualizacion = ReporteDAO.cambiarEstadoReporte(idReporte);
                    if (resultadoActualizacion > 0)
                    {
                        MessageBox.Show("Se dictaminó correctamente", "Reporte dictaminado");
                        abrirVentanaVerReportes();
                    }
                    else
                    {
                        MessageBox.Show("Error al cambiar el estado del reporte", "Error");
                    }
                }
                else
                {
                    MessageBox.Show("Error al agregar el dictamen", "Error");
                }
            }
            else
            {
                MessageBox.Show("Favor de llenar el campo", "ATENCIÓN");
            }
        }
Exemplo n.º 5
0
        private void btn_AgregarDictamen_Click(object sender, RoutedEventArgs e)
        {
            int index = dgReportes.SelectedIndex;

            if (index >= 0)
            {
                Reporte reporte = listReporte[index];

                int dictamenVer = ReporteDAO.verificaExistenciaDictamen(reporte.IdReporte);
                if (dictamenVer == 0)
                {
                    DictaminarReporte nuevoDictamen = new DictaminarReporte(this, reporte, personal);
                    nuevoDictamen.ShowDialog();
                    bool resultado = nuevoDictamen.Resultado;
                    if (resultado)
                    {
                        CargaReportes();
                    }
                }
                else
                {
                    MessageBox.Show("Ya existe un dictamen");
                }
            }
        }
Exemplo n.º 6
0
        private void filtrarTabla()
        {
            reportes = ReporteDAO.getAllReportes();
            String busqueda = tb_reporte.Text;

            foreach (Reporte reporte in reportes)
            {
                if (reporte.Direccion.ToLower() == busqueda.ToLower() ||
                    reporte.Estado.ToLower() == busqueda.ToLower() ||
                    reporte.Fecha.ToString() == busqueda ||
                    reporte.Fecha.ToString().ToLower().Contains(busqueda))
                {
                    reportesFiltrados.Add(reporte);
                }
            }

            if (reportesFiltrados.Count > 0)
            {
                dg_reportes.ItemsSource = reportesFiltrados;
            }
            else
            {
                llenarTablaReportes();
            }
        }
Exemplo n.º 7
0
        private ReporteTiendaVO obtenerResumen(String _idTienda)
        {
            ReporteTiendaVO rp     = new ReporteTiendaVO();
            ReporteDAO      repDAO = new ReporteDAO();

            rp = repDAO.listarReporte(_idTienda);
            return(rp);
        }
Exemplo n.º 8
0
        private List <ReporteTiendaVO> obtenerResumenRubro(String _idTienda)
        {
            List <ReporteTiendaVO> rp     = new List <ReporteTiendaVO>();
            ReporteDAO             repDAO = new ReporteDAO();

            rp = repDAO.listarRubro(_idTienda);
            return(rp);
        }
Exemplo n.º 9
0
 public List <Cita> ReporteCitasPorMedico(Int32 IdMedico)
 {
     try
     {
         return(ReporteDAO.getInstance().ListarCitasPorMedico(IdMedico));
     }
     catch (Exception) { throw; }
 }
Exemplo n.º 10
0
        public List <Cliente> Nombre_Cliente_Reporte()
        {
            ReporteDAO dao = new ReporteDAO();

            string val_reporte = aux.Decrypt(HttpUtility.UrlDecode(Request.QueryString["key"]));

            int id_reporte = int.Parse(val_reporte);

            list2 = dao.ObtenerNombreCliente(id_reporte);

            return(list2);
        }
Exemplo n.º 11
0
        public List <Contrato> Nombre_Contrato_Proyecto_Reporte()
        {
            ReporteDAO dao = new ReporteDAO();

            string val_reporte = aux.Decrypt(HttpUtility.UrlDecode(Request.QueryString["key"]));

            int id_reporte = int.Parse(val_reporte);

            list3 = dao.ObtenerNombreContratoProyecto(id_reporte);

            return(list3);
        }
Exemplo n.º 12
0
        public List <Reporte> Datos_Reporte()
        {
            ReporteDAO dao = new ReporteDAO();

            string val_reporte = aux.Decrypt(HttpUtility.UrlDecode(Request.QueryString["key"]));

            int id_reporte = int.Parse(val_reporte);

            list = dao.listaReporte(id_reporte);

            return(list);
        }
Exemplo n.º 13
0
        public ActionResult FacturasAprobadas()
        {
            List <NotadeVentaCabeceraModels> doc = new List <NotadeVentaCabeceraModels>();
            var docAprobados = ReporteDAO.listarDocAprobados();

            if (docAprobados != null)
            {
                doc = docAprobados;
            }

            ViewBag.doc = doc;

            return(View());
        }
Exemplo n.º 14
0
        public ActionResult FacturasPendientes(FormCollection frm)
        {
            NotadeVentaCabeceraModels notaVenta = new NotadeVentaCabeceraModels();

            notaVenta.NVNumero = Int32.Parse(Request.Form["nvnumero"]);

            List <NotadeVentaCabeceraModels> proceso = ReporteDAO.actualizaEstado(notaVenta);

            List <NotadeVentaCabeceraModels> doc = ReporteDAO.listarDocPendientes();

            ViewBag.doc = doc;
            VerificationEmail(notaVenta.NVNumero);
            return(Json(proceso));
        }
Exemplo n.º 15
0
        public ActionResult VerDetalleNV(int nvNumero)
        {
            try
            {
                NotadeVentaCabeceraModels        NVC  = new NotadeVentaCabeceraModels();
                List <NotadeVentaCabeceraModels> NVCL = new List <NotadeVentaCabeceraModels>();
                NotaDeVentaDetalleModels         NVD  = new NotaDeVentaDetalleModels();
                List <NotaDeVentaDetalleModels>  NVDL = new List <NotaDeVentaDetalleModels>();

                NVC.NVNumero = nvNumero;
                NVD.NVNumero = nvNumero;

                var nvc = ReporteDAO.BuscarNVC(NVC);

                if (nvc != null)
                {
                    NVCL = nvc;
                }
                else
                {
                    ViewBag.mensaje = 1;
                    ViewBag.NVnum   = nvNumero;
                    return(View());
                }

                ViewBag.cabecera = NVCL;

                var nvd = ReporteDAO.BuscarNVD(NVD);

                if (nvd != null)
                {
                    NVDL = nvd;
                }

                ViewBag.detalle = NVDL;

                return(View());
            }
            catch (Exception ex)
            {
                return(View(ex.Message));
            }
        }
Exemplo n.º 16
0
        private void btn_EliminarReporte_Click(object sender, RoutedEventArgs e)
        {
            int index = dg_Reportes.SelectedIndex;

            if (index >= 0)
            {
                Reporte rep = listReporte[index];
                if (MessageBox.Show("¿Desea eliminar el reporte con numero: " + rep.IdReporte + "?", "Eliminar reporte", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    ImagenDAO.eliminarImagenes(rep.IdReporte);
                    Reporte_VehiculoDAO.eliminarVehiculosReporte(rep.IdReporte);
                    ReporteDAO.eliminarReporte(rep.IdReporte);
                    MessageBox.Show("Reporte eliminado completamente");
                }
                cargarReportes();
            }
            else
            {
                MessageBox.Show("Seleccione un Reporte");
            }
        }
Exemplo n.º 17
0
 private void CargaReportes()
 {
     listReporte            = ReporteDAO.getReportes();
     dgReportes.ItemsSource = listReporte;
 }
Exemplo n.º 18
0
        private void btn_AgregarReporte_Click(object sender, RoutedEventArgs e)
        {
            Reporte nuevoReporte = new Reporte();

            var    dateAux    = DateTime.Now;
            string dateString = Convert.ToString(dateAux);

            string estatus    = "No revisado";
            string direccion  = txt_Direccion.Text;
            string delegacion = delegacionSeleccionada;

            try
            {
                nuevoReporte.Estatus          = "No revisado";
                nuevoReporte.Direccion        = direccion;
                nuevoReporte.NombreDelegacion = delegacionSeleccionada;
                nuevoReporte.FechaCreacion    = dateString;


                //string fechaAux = dateAux.ToString("yyyy-MM-dd hh:mm:ss[.nnn]");


                ReporteDAO.guardaReporte(nuevoReporte);
                int idReporteAux = ReporteDAO.consultaReporteNuevo(dateString);

                Reporte_Vehiculo reporte_Vehiculo = new Reporte_Vehiculo();
                foreach (var a in listVehiculos)
                {
                    if (a.IdVehiculo > 0)
                    {
                        int idVehiculoObtenido = a.IdVehiculo;
                        reporte_Vehiculo.IdVehiculo = idVehiculoObtenido;
                        reporte_Vehiculo.IdReporte  = idReporteAux;
                        Reporte_VehiculoDAO.guardarReporteVehiculo(reporte_Vehiculo);
                    }
                }


                Imagen imagen = new Imagen();
                if (imagenes.Count > 0)
                {
                    foreach (var archivo in imagenes)
                    {
                        Console.WriteLine(archivo);
                        imagen.Ruta          = archivo;
                        img                  = ConvierteImageToByteArray(archivo);
                        imagen.Dato          = img;
                        imagen.IdReporte     = idReporteAux;
                        imagen.FechaCreacion = dateString;
                        ImagenDAO.guardarImagen(imagen);
                    }
                }

                this.itActualizar.actualizar(idReporteAux, estatus, delegacion, direccion, 0);
                this.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 19
0
        private void btn_registrar_reporte_Click(object sender, RoutedEventArgs e)
        {
            String direccion = txt_direccion.Text;
            String fecha     = txt_fecha.Text;
            String estatus   = "Pendiente";

            Boolean camposLlenos = true;

            if (direccion.Length == 0)
            {
                camposLlenos = false;
                txt_direccion.BorderBrush = Brushes.Red;
            }
            if (fecha.Length == 0)
            {
                camposLlenos          = false;
                txt_fecha.BorderBrush = Brushes.Red;
            }
            if (img_num1.Source == null)
            {
                camposLlenos = false;
            }
            if (img_num2.Source == null)
            {
                camposLlenos = false;
            }
            if (img_num3.Source == null)
            {
                camposLlenos = false;
            }

            if (camposLlenos)
            {
                int idDelegacion = MainWindow.idDelegacionLoggeada;

                byte[] imagen1;
                byte[] imagen2;
                byte[] imagen3;
                byte[] imagen4;
                byte[] imagen5;
                byte[] imagen6;
                byte[] imagen7;
                byte[] imagen8;

                imagen1 = System.IO.File.ReadAllBytes(fileUri1.LocalPath);
                imagen2 = System.IO.File.ReadAllBytes(fileUri2.LocalPath);
                imagen3 = System.IO.File.ReadAllBytes(fileUri3.LocalPath);

                if (img_num4.Source == null)
                {
                    imagen4 = new byte [0];
                }
                else
                {
                    imagen4 = System.IO.File.ReadAllBytes(fileUri4.LocalPath);
                }

                if (img_num5.Source == null)
                {
                    imagen5 = new byte[0];
                }
                else
                {
                    imagen5 = System.IO.File.ReadAllBytes(fileUri5.LocalPath);
                }

                if (img_num6.Source == null)
                {
                    imagen6 = new byte[0];
                }
                else
                {
                    imagen6 = System.IO.File.ReadAllBytes(fileUri6.LocalPath);
                }

                if (img_num7.Source == null)
                {
                    imagen7 = new byte[0];
                }
                else
                {
                    imagen7 = System.IO.File.ReadAllBytes(fileUri7.LocalPath);
                }

                if (img_num8.Source == null)
                {
                    imagen8 = new byte[0];
                }
                else
                {
                    imagen8 = System.IO.File.ReadAllBytes(fileUri8.LocalPath);
                }


                int resultado = ReporteDAO.agregarReporte(idDelegacion, fecha, estatus, direccion, imagen1, imagen2, imagen3, imagen4, imagen5, imagen6, imagen7, imagen8);

                int resultado2 = 0;
                int reporteMax = ReporteDAO.obtenerIdReporteMax();

                Console.WriteLine("El reporte max es: " + reporteMax);

                foreach (Vehiculo vehiculoAReporte in vehiculosReporte)
                {
                    Vehiculo vehiculoAux = new Vehiculo(vehiculoAReporte.NumeroLicencia, vehiculoAReporte.IdVehiculo);

                    resultado2 = ReporteConductorVehiculoDAO.agregarReporteConductorVehiculo(reporteMax, vehiculoAux);
                }

                if (resultado > 0 && resultado2 > 0)
                {
                    MessageBox.Show("El Reporte se registro exitosamente", "Registro exitoso");
                }
                else
                {
                    MessageBox.Show("No fue posible hacer el registro", "Ocurrió un error");
                }

                salir();
            }
            else
            {
                MessageBox.Show("Favor de llenar todos los campos e ingresar mínimo 3 fotografías", "Campos vacíos");
            }
        }
Exemplo n.º 20
0
 private void cargarReportes()
 {
     reportes = ReporteDAO.obtenerDetallesReportes();
     dg_reportes.AutoGenerateColumns = false;
     dg_reportes.ItemsSource         = reportes;
 }
Exemplo n.º 21
0
 private void cargarReportes()
 {
     listReporte             = ReporteDAO.getReportes();
     dg_Reportes.ItemsSource = listReporte;
 }
Exemplo n.º 22
0
 public ReportesBLL()
 {
     reporteDAO = new ReporteDAO();
 }
        private void button_RegistrarReporte_Click(object sender, RoutedEventArgs e)
        {
            if (validarCampos())
            {
                if (conductoresSeleccionados.Count > 0)
                {
                    if (vehiculosSeleccionados.Count > 0)
                    {
                        if (images.Count >= 3)
                        {
                            Reporte reporte = new Reporte();
                            reporte.Direccion   = tb_direccion.Text;
                            reporte.Descripcion = tb_descripcion.Text;
                            reporte.Fecha       = (DateTime)dp_fecha.SelectedDate;
                            reporte.Estado      = "Activo";
                            ReporteDAO.addReporte(reporte);

                            int ultimoReporte = ReporteDAO.getLastIndex();

                            Dictamen dictamen = new Dictamen();
                            dictamen.Descripcion = "";
                            dictamen.Estado      = "Activo";
                            dictamen.Fecha       = (DateTime)dp_fecha.SelectedDate;
                            string hora = DateTime.Now.ToString("t");
                            dictamen.Hora      = hora;
                            dictamen.IdPerito  = 0;
                            dictamen.IdReporte = ultimoReporte;
                            dictamen.Folio     = ultimoReporte;
                            DictamenDAO.addDictamen(dictamen);



                            VehiculosReporte vehiculosReporte;
                            foreach (Vehiculo vehiculo in vehiculosSeleccionados)
                            {
                                vehiculosReporte            = new VehiculosReporte();
                                vehiculosReporte.IdReporte  = ultimoReporte;
                                vehiculosReporte.IdVehiculo = vehiculo.IdVehiculo;
                                VehiculosReporteDAO.addVehiculosReporte(vehiculosReporte);
                            }

                            ConductoresReporte conductoresReporte;
                            foreach (Conductor conductor in conductoresSeleccionados)
                            {
                                conductoresReporte             = new ConductoresReporte();
                                conductoresReporte.IdReporte   = ultimoReporte;
                                conductoresReporte.IdConductor = conductor.IdConductor;
                                ConductoresReporteDAO.addConductoresReporte(conductoresReporte);
                            }

                            try
                            {
                                foreach (Image imagen in images)
                                {
                                    String filepath = imagen.Source.ToString().Substring(8);
                                    String filename = String.Format("Reporte{0}", ultimoReporte);
                                    ConexionSFTP.subirArchivo(filepath, filename);
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.Message);
                                throw;
                            }
                            MessageBox.Show("Registro exitoso.");
                            limpiarCampos();
                        }
                        else
                        {
                            MessageBox.Show("Debe seleccionar al menos 3 fotografías.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Debe elegir al menos un vehículo.");
                    }
                }
                else
                {
                    MessageBox.Show("Debe elegir al menos un Conductor");
                }
            }
            else
            {
                MessageBox.Show("Asegúrese de llenar todos los campos.");
            }
        }
 public void extraerDatosReportes()
 {
     reportes = ReporteDAO.obtenerReportes();
     dg_ListaReportes.AutoGenerateColumns = false;
     dg_ListaReportes.ItemsSource         = reportes;
 }
Exemplo n.º 25
0
 private void llenarTablaReportes()
 {
     reportes = ReporteDAO.getAllReportes();
     dg_reportes.ItemsSource = reportes;
 }