Beispiel #1
0
        protected void BtnBuscarO(object sender, EventArgs e)
        {
            Buscadores bus = new Buscadores();



            if (txtorden.Value != "")
            {
                foreach (orden oOrden in LOrden)
                {
                    if (int.Parse(txtorden.Value) == oOrden.id_orden)
                    {
                        labeltitulo.InnerText = "DATOS DEL PROPIETARIO Y VEHICULO";
                        Ordenn          = oOrden;
                        lblPatente.Text = oOrden.vehiculo.patente;
                        cliente objcliente = bus.ocliente(oOrden.vehiculo);
                        lblNombre.Text = objcliente.nombre;
                        lblDNI.Text    = objcliente.dni;
                        modelo omodelo = bus.buscarmodelo(oOrden.vehiculo);
                        lblModelo.Text = omodelo.nombre;
                        lblMarca.Text  = bus.buscarmarca(omodelo).nombre;
                        lblEstado.Text = "Para entregar";
                    }
                }
            }
            else
            {
                labeltitulo.InnerText = "La patente ingresada no se encuentra para Entregar";
            }
        }
        protected void CargaryAvanzar(object sender, EventArgs e)
        {
            Buscadores bus       = new Buscadores();
            cliente    ocliente  = bus.oclientedni(txtdni.Value);
            vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);


            if (ovehiculo == null)
            {
                GuardarVehiculo();
            }
            ovehiculo = bus.buscarvehiculo(txtpatente.Value);
            cliente oclientes = bus.ocliente(ovehiculo);

            if ((ovehiculo.id_cliente == null) || (ocliente == null) || (ocliente.dni != oclientes.dni))
            {
                GuardarCambiodecliente();
            }
            EstadoOriginal();
            btnAgregarcliente.Visible    = false;
            DropTipoServicio.Enabled     = true;
            DropServicio.Enabled         = true;
            txtprecioporcantidad.Visible = true;
            txtcantidad.Enabled          = true;

            btnServicios.Visible   = true;
            txtcantidad.Visible    = true;
            lblpreciototal.Visible = true;
            btnfinalizar.Visible   = true;
            Calculaelprimero();
        }
        protected void Avanzar(object sender, EventArgs e)
        {
            if ((GridView2.Rows.Count > 0) && (LSAC.Count > 0))
            {
                if ((txtpatente.Value != "") && (txtdni.Value != "") && (StockError.Visible != true))
                {
                    Buscadores bus       = new Buscadores();
                    cliente    ocliente  = bus.oclientedni(txtdni.Value);
                    vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);
                    cliente    oclientes = bus.ocliente(ovehiculo);

                    if ((ovehiculo != null) && (ovehiculo.id_cliente != null) && (ocliente != null) && (ovehiculo.id_cliente == ocliente.id) && (LSAC.Count <= 5) && (LSAC.Count >= 1))
                    {
                        CargarOrden();
                        PDFESTADOCERO();
                        btnpasartaller.Visible       = true;
                        btnAgregarcliente.Visible    = false;
                        btnGuardar.Visible           = false;
                        btnServicios.Visible         = false;
                        btnfinalizar.Visible         = false;
                        GridView2.Columns[4].Visible = false;
                    }
                    else
                    {
                        Server.Transfer("NuevoDetalle.aspx");
                    }
                }
                else
                {
                    Server.Transfer("NuevoDetalle.aspx");
                }
            }
        }
        public void RecargarAuto()
        {
            Buscadores bus = new Buscadores();
            string     a   = txtpatente.Value;

            using (aplicadaBDEntities DBF = new aplicadaBDEntities())
            {
                vehiculo objvehiculo = bus.buscarvehiculo(a);
                if (objvehiculo != null)
                {
                    txtpatente.Disabled = true;
                    cliente objcliente = bus.ocliente(objvehiculo);
                    modelo  objmodelo  = bus.buscarmodelo(objvehiculo);
                    txtaño.Value    = objvehiculo.annio;
                    txtmodelo.Value = objmodelo.nombre;
                    txtmarca.Value  = bus.buscarmarca(objmodelo).nombre.ToString();

                    string[] separadas;
                    if (objcliente.dni != null)
                    {
                        separadas         = objcliente.nombre.Split(' ');
                        txtdni.Value      = objcliente.dni;
                        txtapellido.Value = separadas[0];
                        txtnombre.Value   = separadas[1];
                        txttelefono.Value = objcliente.telefono;
                        txtemail.Value    = objcliente.email;
                    }
                }
            }
        }
        protected void Unnamed_ServerClick1(object sender, EventArgs e)
        {
            Buscadores bus = new Buscadores();
            string     a   = txtpatente.Value;

            using (aplicadaBDEntities DBF = new aplicadaBDEntities())
            {
                vehiculo objvehiculo = bus.buscarvehiculo(a);

                if (objvehiculo != null)
                {
                    ordenestado ordenestado = new ordenestado();

                    orden orden = bus.buscarordenporvehiculo(objvehiculo.id_vehiculo);
                    if (orden != null)
                    {
                        ordenestado = bus.buscarvestadoorden(orden.id_orden);
                    }
                    if ((orden == null) || (ordenestado.estado == null) || (ordenestado.estado == 5))
                    {
                        NoAuto.Visible = false;
                        RecargarAuto();
                        servicio oservicio = new servicio();
                        VerGrid(oservicio);
                        A1.Visible                   = true;
                        btnServicios.Visible         = true;
                        DropServicio.Enabled         = true;
                        txtcantidad.Visible          = true;
                        DropTipoServicio.Enabled     = true;
                        lblpreciototal.Visible       = true;
                        btnfinalizar.Visible         = true;
                        txtprecioporcantidad.Visible = true;
                        Calculaelprimero();
                        txtcantidad.Enabled = true;
                    }
                    else
                    {
                        Label3.Text    = "EL VEHICULO YA POSEE UNA ORDEN ACTIVA";
                        NoAuto.Visible = true;
                    }
                }
                else
                {
                    NoAuto.Visible = true;
                    Label3.Text    = "PONER ENTRE DE 6 Y 7 CARACTERES";
                    int b = txtpatente.Value.Length;
                    if (b >= 6 && b <= 7)
                    {
                        NoAuto.Visible            = false;
                        Dmodelo.Visible           = true;
                        Dmarca.Visible            = true;
                        txtmodelo.Visible         = false;
                        txtmarca.Visible          = false;
                        btnAgregarcliente.Visible = true;
                        txtaño.Disabled           = false;
                        btnGuardar.Visible        = Visible;
                    }
                }
            }
        }
        public List <serviciostock> Lserviciostock(String id)
        {
            Buscadores           bus             = new Buscadores();
            List <serviciostock> Lserviciostocks = bus.Lstockservi();
            List <serviciostock> NLserviciostock = new List <serviciostock>();

            NLserviciostock = Lserviciostocks.FindAll(s => s.id_servicio == int.Parse(id));

            return(NLserviciostock);
        }
        protected void BuscarCliente(object sender, EventArgs e)
        {
            Buscadores bus       = new Buscadores();
            cliente    ocliente  = bus.oclientedni(txtdni.Value);
            vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);
            cliente    oclientes = new cliente();

            if (ovehiculo != null)
            {
                oclientes = bus.ocliente(ovehiculo);
            }
            else
            {
                oclientes.id = 0;
            }


            if ((ocliente == null) || (ocliente.dni != oclientes.dni))
            {
                using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                {
                    if (ocliente != null)
                    {
                        string[] separadas;
                        separadas            = ocliente.nombre.Split(' ');
                        txtdni.Value         = ocliente.dni;
                        txtapellido.Value    = separadas[0];
                        txtnombre.Value      = separadas[1];
                        txttelefono.Value    = ocliente.telefono;
                        txtemail.Value       = ocliente.email;
                        txtapellido.Disabled = true;
                        txtnombre.Disabled   = true;
                        txttelefono.Disabled = true;
                        txtemail.Disabled    = true;

                        btnGuardar.Visible = true;
                    }
                    else
                    {
                        txtapellido.Disabled = false;
                        txtnombre.Disabled   = false;
                        txttelefono.Disabled = false;
                        txtemail.Disabled    = false;
                        txtapellido.Value    = "";
                        txtnombre.Value      = "";
                        txttelefono.Value    = "";
                        txtemail.Value       = "";
                        txtpatente.Disabled  = true;
                        btnGuardar.Visible   = true;
                    }
                }
            }
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (LogEmpleado.id_tipo != 7)
            {
                Server.Transfer("Default.aspx");
            }

            Buscadores         bus          = new Buscadores();
            List <ordenestado> Lordenestado = bus.buscarListOrdenEstado(4);
            List <orden>       Lorden       = bus.buscarordeestado(Lordenestado);
            List <vehiculo>    LVehiculo    = bus.buscarordevehiculo(Lorden);

            LOrden = Lorden;
        }
Beispiel #9
0
        protected void btnLogin_ServerClick(object sender, EventArgs e)
        {
            Buscadores bus       = new Buscadores();
            empleado   oempleado = bus.buscarempleado(txtemail.Value);

            if (oempleado != null)
            {
                if (oempleado.contraseña == txtcontraseña.Value)
                {
                    LogEmpleado = oempleado;
                    Server.Transfer("Default.aspx");
                }
            }
        }
        private void CargarOrden()
        {
            A1.Visible = false;
            btnAgregarcliente.Visible = false;
            btnGuardar.Visible        = false;
            Buscadores bus       = new Buscadores();
            vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);

            using (aplicadaBDEntities DBF = new aplicadaBDEntities())
            {
                orden oorden = new orden
                {
                    id_vehiculo = ovehiculo.id_vehiculo,
                };

                DBF.orden.Add(oorden);
                DBF.SaveChanges();
                ordenestado oOrdenEstado = new ordenestado
                {
                    id_orden = oorden.id_orden,
                    estado   = 0,
                    fecha    = System.DateTime.Now
                };
                DBF.ordenestado.Add(oOrdenEstado);
                DBF.SaveChanges();
                ordenempleado ordenemple = new ordenempleado
                {
                    id_orden    = oorden.id_orden,
                    id_empleado = LogEmpleado.id_empleado,
                };
                DBF.ordenempleado.Add(ordenemple);
                DBF.SaveChanges();

                foreach (servicio l in LSAC)
                {
                    Cantidad      ocantidad  = Lcantidades.Find(x => x.codigo == l.id_servicios);
                    ordenservicio ooServicio = new ordenservicio
                    {
                        id_orden    = oorden.id_orden,
                        id_servicio = l.id_servicios,
                        cantidad    = ocantidad.cantidade
                    };

                    DBF.ordenservicio.Add(ooServicio);
                    DBF.SaveChanges();
                }
                OrdenActual = oorden;
                Lcantidades.Clear();
            }
        }
        private void CargarGrid(orden oOrden)
        {
            StockError.Visible   = false;
            StockWarning.Visible = false;

            Buscadores bus = new Buscadores(); List <ordenservicio> Lidservidcios = new List <ordenservicio>();

            Lidservidcios = bus.buscarlistaid(oOrden.id_orden);
            List <servicio> Lservicios = ObtenerServicios(Lidservidcios);
            DataTable       dtable     = new DataTable();

            dtable.Columns.AddRange(new DataColumn[4] {
                new DataColumn("Detalle"), new DataColumn("Precio"), new DataColumn("Total"), new DataColumn("Cantidad")
            });
            int preciototal = 0;

            foreach (ordenservicio o in Lidservidcios)
            {
                servicio oservicio = Lservicios.Find(x => x.id_servicios == o.id_servicio);
                int      cantidad  = o.cantidad ?? default(int);
                string   total     = (double.Parse(oservicio.precio) * Convert.ToDouble(cantidad)).ToString();
                dtable.Rows.Add(oservicio.detalle, oservicio.precio, total, o.cantidad);
                preciototal = preciototal + int.Parse(total);
            }
            //lblprecio.Text = preciototal.ToString(); <--- poner label para el total
            lblprecio.Text = preciototal.ToString();
            Lservicios     = ObtenerServicios(Lidservidcios);
            List <serviciostock> Lserstock = Lserviciostock(Lservicios);
            List <stock>         Nstock    = Lstockuso(Lserstock);

            foreach (stock ostock in Nstock)
            {
                Lstock.Add(ostock);
                if (int.Parse(ostock.cantidad) <= int.Parse(ostock.minimo))
                {
                    StockError.Visible = true;
                    Label1.Text        = "¡ATENCION! EL STOCK ES MENOR AL MINIMO: " + ostock.detalle;
                }
                if ((int.Parse(ostock.cantidad) >= int.Parse(ostock.minimo)) && (int.Parse(ostock.cantidad) <= (int.Parse(ostock.minimo) + 5)) && (StockError.Visible == false))
                {
                    StockWarning.Visible = true;
                    Label2.Text          = "¡ATENCION! EL STOCK ESTA CERCANO AL MINIMO: " + ostock.detalle;
                }
            }


            GridView2.DataSource = dtable;
            GridView2.DataBind();
        }
        protected void Avanzar(object sender, EventArgs e)
        {
            if ((txtpatente.Value != "") && (txtdni.Value != "") && (StockError.Visible == false))
            {
                Buscadores bus       = new Buscadores();
                cliente    ocliente  = bus.oclientedni(txtdni.Value);
                vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);
                cliente    oclientes = bus.ocliente(ovehiculo);

                if ((ovehiculo != null) && (ovehiculo.id_cliente != null) && (ocliente != null) && (ovehiculo.id_cliente == ocliente.id))
                {
                    Server.Transfer("DetalleTaller.aspx");
                }
                else
                {
                }
            }
        }
        public List <stock> Lstockuso(List <serviciostock> Lstockservi)
        {
            Buscadores   bus         = new Buscadores();
            List <stock> Lstock      = bus.Lstock();
            List <stock> stockactivo = new List <stock>();

            foreach (stock Stock in Lstock)
            {
                foreach (serviciostock Servistock in Lstockservi)
                {
                    if (Stock.id_stock == Servistock.id_stock)
                    {
                        stockactivo.Add(Stock);
                    }
                }
            }

            return(stockactivo);
        }
        protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string Detalle = GridView2.SelectedRow.Cells[0].Text;
            string total   = GridView2.SelectedRow.Cells[2].Text;
            int    w       = GridView2.SelectedRow.RowIndex;

            dtable.Rows.RemoveAt(w);
            int      contador = 0;
            servicio prueba   = Encontrarservicio(contador, w);

            GridView2.DataSource = dtable;
            GridView2.DataBind();



            Buscadores bus = new Buscadores();
            string     a   = txtpatente.Value;

            servicio oservicio = new servicio();

            int z = int.Parse(lblprecio.Text) - int.Parse(total);

            lblprecio.Text = z.ToString();
            oservicio      = LSAC.Find(ser => ser.id_servicios == prueba.id_servicios);
            LSAC.Remove(oservicio);
            List <serviciostock> Lserstock = Lserviciostock(oservicio.id_servicios.ToString());
            List <stock>         Nstock    = Lstockuso(Lserstock);
            List <stock>         Copia     = Lstock;

            foreach (stock ostock in Nstock)
            {
                stock oostock = Lstock.Find(x => x.id_stock == ostock.id_stock);
                Lstock.Remove(oostock);
            }



            oservicio.precio = "1";

            VerGrid(oservicio);
            //Queda remover la lista de stock
        }
        private void GuardarCambiodecliente()
        {
            Buscadores bus       = new Buscadores();
            vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);
            cliente    ocliente  = bus.ocliente(ovehiculo);
            cliente    oclientes = bus.oclientedni(txtdni.Value);

            btnGuardar.Visible = false;
            if ((ocliente != null) && (oclientes != null))
            {
                ocliente = bus.oclientedni(txtdni.Value);
                using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                {
                    vehiculo oVehiculo = (from q in DBF.vehiculo where q.id_vehiculo == ovehiculo.id_vehiculo select q).First();
                    oVehiculo.id_cliente = ocliente.id;
                    DBF.SaveChanges();
                }
            }
            else
            {
                using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                {
                    cliente ncliente = new cliente
                    {
                        dni      = txtdni.Value,
                        nombre   = txtapellido.Value + " " + txtnombre.Value,
                        telefono = txttelefono.Value,
                        email    = txtemail.Value,
                    };

                    DBF.cliente.Add(ncliente);
                    DBF.SaveChanges();
                }
                ocliente = bus.oclientedni(txtdni.Value);
                using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                {
                    vehiculo oVehiculo = (from q in DBF.vehiculo where q.id_vehiculo == ovehiculo.id_vehiculo select q).First();
                    oVehiculo.id_cliente = ocliente.id;
                    DBF.SaveChanges();
                }
            }
        }
        public List <serviciostock> Lserviciostock(List <servicio> Lservicios)
        {
            Buscadores           bus             = new Buscadores();
            List <serviciostock> Lserviciostocks = bus.Lstockservi();
            List <serviciostock> NLserviciostock = new List <serviciostock>();

            foreach (servicio x in Lservicios)
            {
                foreach (serviciostock t in Lserviciostocks)
                {
                    if (x.id_servicios == t.id_servicio)
                    {
                        NLserviciostock.Add(t);
                    }
                }
            }


            return(NLserviciostock);
        }
        protected void CargarServicios(object sender, EventArgs e)
        {
            StockError.Visible   = false;
            StockWarning.Visible = false;
            List <servicio> Lse        = new List <servicio>();
            List <servicio> Lservicios = new List <servicio>();

            lblpreciototal.Visible = true;
            lblprecio.Visible      = true;

            if ((GridView2.Rows.Count < 5) && (DropServicio.SelectedValue.ToString() != ""))
            {
                Buscadores bus         = new Buscadores();
                string     id          = DropServicio.SelectedValue.ToString();
                int        id_servicio = int.Parse(id);
                servicio   oservicio   = bus.buscarservicio(id_servicio);
                Lse = LSM;
                foreach (servicio x in Lse)
                {
                    if (id_servicio == x.id_servicios)
                    {
                        oservicio = x;
                    }
                }
                Lse.Remove(oservicio);
                Lservi = Lse;
                string   detalle   = oservicio.detalle;
                string   precio    = oservicio.precio;
                string   total     = (double.Parse(oservicio.precio) * double.Parse(txtcantidad.Text)).ToString();
                string   cantidad  = txtcantidad.Text;
                Cantidad oCantidad = new Cantidad(oservicio.id_servicios, int.Parse(cantidad));
                Lcantidades.Add(oCantidad);

                List <serviciostock> Lserstock = Lserviciostock(id_servicio.ToString());
                List <stock>         Nstock    = Lstockuso(Lserstock);//revisar esto


                LSAC.Add(oservicio);
                dtable.Rows.Add(detalle, precio, cantidad, total);
                lblprecio.Visible = true;
                int a = int.Parse(lblprecio.Text) + int.Parse(total);
                lblprecio.Text = a.ToString();

                foreach (stock ostock in Nstock)
                {
                    Lstock.Add(ostock);
                    if (int.Parse(ostock.cantidad) <= int.Parse(ostock.minimo))
                    {
                        StockError.Visible = true;
                        Label1.Text        = "¡ATENCION! EL STOCK ES MENOR AL MINIMO: " + ostock.detalle;
                    }
                    if ((int.Parse(ostock.cantidad) >= int.Parse(ostock.minimo)) && (int.Parse(ostock.cantidad) <= (int.Parse(ostock.minimo) + 5)) && (StockError.Visible == false))
                    {
                        StockWarning.Visible = true; //Aca alerta queda poco stock Queda restar
                        Label2.Text          = "¡ATENCION! EL STOCK ESTA CERCANO AL MINIMO: " + ostock.detalle;
                    }
                }
                NoAuto.Visible = false;
                //Lservi = Lse;
                GridView2.DataSource = dtable;
                GridView2.DataBind();
                VerGrid(oservicio);
                Calculaelprimero();
            }
            else
            {
                NoAuto.Visible = true;
                Label3.Text    = "No ingrese mas de 5 servicios";
            }
        }
        public void VerGrid(servicio oservicio)
        {
            List <servicio> Lservicios;

            DropServicio.Items.Clear();
            if (GridView2.Rows.Count == 0)
            {
                using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                {
                    IQueryable <servicio> lista = (from q in DBF.servicio select q);
                    Lservicios = lista.ToList();

                    Buscadores bus         = new Buscadores();
                    string     a           = txtpatente.Value;
                    vehiculo   objvehiculo = bus.buscarvehiculo(a);
                    modelo     objmodelo   = bus.buscarmodelo(objvehiculo);


                    Lservicios = Lservicios.FindAll(ser => ser.id_modelo == objmodelo.id_modelo);
                    LSM        = Lservicios;
                    Lservicios = Lservicios.FindAll(servicio => servicio.id_tipo == int.Parse(DropTipoServicio.SelectedValue));



                    foreach (servicio x in Lservicios)
                    {
                        System.Web.UI.WebControls.ListItem i = new System.Web.UI.WebControls.ListItem(x.detalle.ToString(), x.id_servicios.ToString());
                        DropServicio.Items.Add(i);
                    }
                }
            }
            else
            {
                if (oservicio.precio != "1")
                {
                    Lservi.Remove(oservicio);
                    Lservicios = Lservi.FindAll(servicio => servicio.id_tipo == int.Parse(DropTipoServicio.SelectedValue));
                    foreach (servicio x in Lservicios)
                    {
                        System.Web.UI.WebControls.ListItem i;
                        i = new System.Web.UI.WebControls.ListItem(x.detalle.ToString(), x.id_servicios.ToString());
                        DropServicio.Items.Add(i);
                    }
                }
                else
                {
                    using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                    {
                        IQueryable <servicio> lista = (from q in DBF.servicio select q);
                        Lservicios = lista.ToList();
                        oservicio  = Lservicios.Find(x => x.id_servicios == oservicio.id_servicios);
                    }
                    Lservi.Add(oservicio);
                    Lservicios = Lservi.FindAll(servicio => servicio.id_tipo == int.Parse(DropTipoServicio.SelectedValue));
                    foreach (servicio x in Lservicios)
                    {
                        System.Web.UI.WebControls.ListItem i;
                        i = new System.Web.UI.WebControls.ListItem(x.detalle.ToString(), x.id_servicios.ToString());
                        DropServicio.Items.Add(i);
                    }
                }
            }
        }
        protected void BtnBuscar(object sender, EventArgs e)
        {
            Buscadores bus = new Buscadores();

            if (txtidorden.Value != "")
            {
                orden       oOrden       = bus.buscarorden(int.Parse(txtidorden.Value));
                ordenestado Oordenestado = new ordenestado();

                if (oOrden != null)
                {
                    Oordenestado = bus.buscarvestadoorden(oOrden.id_orden);
                }

                if (oOrden != null)
                {
                    if ((Oordenestado == null) || (Oordenestado.estado == null) || (Oordenestado.estado == 0) || (Oordenestado.estado == 5))
                    {
                        //Validar orden estado 2 o superior aca? si?
                        NoAuto.Visible = false;
                        vehiculo Ovehiculo = bus.buscarvehiculoid(int.Parse(oOrden.id_vehiculo.ToString()));
                        cliente  oCliente  = bus.ocliente(Ovehiculo);
                        modelo   omodelo   = bus.buscarmodelo(Ovehiculo);
                        Ovehiculo.modelo = omodelo;
                        marca omarca = bus.buscarmarca(Ovehiculo.modelo);
                        Ovehiculo.modelo.marca = omarca;
                        Ovehiculo.cliente      = oCliente;
                        oOrden.vehiculo        = Ovehiculo;

                        txtpatente.Value = oOrden.vehiculo.patente;
                        txtmodelo.Value  = oOrden.vehiculo.modelo.nombre;
                        txtmarca.Value   = oOrden.vehiculo.modelo.marca.nombre;

                        txtaño.Value = oOrden.vehiculo.annio;
                        string[] separadas;
                        if (Ovehiculo.cliente.dni != null)
                        {
                            separadas         = Ovehiculo.cliente.nombre.Split(' ');
                            txtdni.Value      = Ovehiculo.cliente.dni;
                            txtapellido.Value = separadas[0];
                            txtnombre.Value   = separadas[1];
                            txttelefono.Value = Ovehiculo.cliente.telefono;
                            txtemail.Value    = Ovehiculo.cliente.email;
                        }
                        OrdenActual = oOrden;
                        CargarGrid(oOrden);
                        PDFESTADOCERO();
                    }
                    else
                    {
                        Label3.Text    = "EL VEHICULO YA POSEE UNA ORDEN ACTIVA";
                        NoAuto.Visible = true;
                    }
                }
                else
                {
                    Label3.Text    = "ORDEN NO EXISTENTE";
                    NoAuto.Visible = true;
                }
            }
        }
Beispiel #20
0
        public void PDFESTADOCERO()
        {
            Buscadores bus    = new Buscadores();
            var        doc    = new iTextSharp.text.Document(PageSize.A4);
            string     path   = Server.MapPath("~");
            PdfWriter  writer = PdfWriter.GetInstance(doc, new FileStream(path + "/Conformidad.pdf", FileMode.Create));


            vehiculo ovehiculo = bus.buscarvehiculo(lblPatente.Text);
            cliente  ocliente  = bus.ocliente(ovehiculo);
            modelo   omarca    = bus.buscarmodelo(ovehiculo);
            marca    omodelo   = bus.buscarmarca(omarca);

            doc.Open();

            //Cabecera
            BaseFont bfntHead = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

            iTextSharp.text.Font fntHead    = new iTextSharp.text.Font(bfntHead, 16, 1, iTextSharp.text.BaseColor.GREEN.Darker());
            Paragraph            prgHeading = new Paragraph();

            prgHeading.Alignment = 1;
            prgHeading.Add(new Chunk("Contrato de Conformidad".ToUpper(), fntHead));
            doc.Add(prgHeading);
            doc.Add(Chunk.NEWLINE);

            //Generado By
            Paragraph prgGeneratedBY = new Paragraph();
            BaseFont  btnAuthor      = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

            iTextSharp.text.Font fntAuthor = new iTextSharp.text.Font(btnAuthor, 12, 2, iTextSharp.text.BaseColor.BLACK);
            prgGeneratedBY.Alignment = Element.ALIGN_RIGHT;
            prgGeneratedBY.Add(new Chunk("Generado por: " + LogEmpleado.nombreyapellido, fntAuthor));  //Agregar LOG Empleado
            prgGeneratedBY.Add(new Chunk("\nFecha : " + DateTime.Now.ToShortDateString(), fntAuthor));
            prgGeneratedBY.Add(new Chunk("\nN° de Orden : " + Ordenn.id_orden, fntAuthor));
            doc.Add(prgGeneratedBY);


            Paragraph l = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, iTextSharp.text.BaseColor.BLACK, Element.ALIGN_LEFT, 1)));

            doc.Add(l);
            doc.Add(Chunk.NEWLINE);

            Paragraph Cliente1 = new Paragraph("Apellido y Nombre: " + ocliente.nombre);

            doc.Add(Cliente1);

            Paragraph Cliente2 = new Paragraph("DNI: " + ocliente.dni);

            doc.Add(Cliente2);

            Paragraph Cliente3 = new Paragraph("Telefono: " + ocliente.telefono);

            doc.Add(Cliente3);

            Paragraph Cliente4 = new Paragraph("Correo Electronico: " + ocliente.email);

            doc.Add(Cliente4);
            doc.Add(Chunk.NEWLINE);



            Paragraph Vehiculo1 = new Paragraph("Patente: " + ovehiculo.patente);

            doc.Add(Vehiculo1);

            Paragraph Vehiculo2 = new Paragraph("Marca: " + omodelo.nombre);

            doc.Add(Vehiculo2);

            Paragraph Vehiculo3 = new Paragraph("Modelo: " + omarca.nombre);

            doc.Add(Vehiculo3);
            doc.Add(Chunk.NEWLINE);
            doc.Add(Chunk.NEWLINE);

            Paragraph e = new Paragraph("Estimado cliente:");

            e.Font.Size = 18;
            doc.Add(e);
            doc.Add(Chunk.NEWLINE);

            Paragraph cu = new Paragraph("Gracias por confiar en nosotros para reparar su vehiculo, esperamos que la atencion haya sido de su agrado atte el personal de la empresa.");

            cu.Alignment = Element.ALIGN_JUSTIFIED;
            doc.Add(cu);
            doc.Add(Chunk.NEWLINE);
            doc.Add(Chunk.NEWLINE);
            doc.Add(Chunk.NEWLINE);


            Paragraph ff = new Paragraph("________");

            ff.Alignment = 1;
            doc.Add(ff);

            Paragraph fff = new Paragraph("(FIRMA)");

            fff.Alignment = 1;
            doc.Add(fff);
            doc.Add(Chunk.NEWLINE);


            doc.Close();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('Conformidad.pdf','_newtab');", true);
            //Response.Redirect("Presupuesto.pdf");
        }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LogEmpleado.id_tipo != 6)
                {
                    Server.Transfer("Default.aspx");
                }

                Buscadores    bus           = new Buscadores();
                ordenempleado OrdenEmpleado = bus.buscarempleadoorden(LogEmpleado.id_empleado);
                if (OrdenEmpleado == null)
                {
                    lblpatente.Text      = "No tienes ningun vehiculo asignado. ";
                    lblmodelo.Text       = "-";
                    btnaceptar.Visible   = false;
                    btnfinalizar.Visible = false;
                }
                else
                {
                    int   a     = int.Parse(OrdenEmpleado.id_orden.ToString());
                    orden Orden = bus.buscarorden(a);
                    OrdenActual = Orden;
                    vehiculo             ovehiculo     = bus.buscarvehiculoid(int.Parse(Orden.id_vehiculo.ToString()));
                    modelo               omodelo       = bus.buscarmodelo(ovehiculo);
                    ordenestado          oestado       = bus.buscarvestadoorden(Orden.id_orden);
                    List <ordenservicio> Lidservidcios = new List <ordenservicio>();
                    Lidservidcios = bus.buscarlistaid(Orden.id_orden);
                    CheckBoton(oestado);
                    List <servicio>      Lservicios = ObtenerServicios(Lidservidcios);
                    List <serviciostock> Lserstock  = new List <serviciostock>();
                    List <serviciostock> Lserstock2 = new List <serviciostock>();
                    foreach (servicio s in Lservicios)
                    {
                        Lserstock = Lserviciostock(s.id_servicios.ToString());
                        if (Lserstock.Count != 0)
                        {
                            foreach (serviciostock ss in Lserstock)
                            {
                                Lserstock2.Add(ss);
                            }
                        }
                    }
                    List <stock> Nstock = Lstockuso(Lserstock2);

                    if ((oestado.estado == 1) || (oestado.estado == 2))
                    {
                        GridView1.DataSource = Lservicios;
                        GridView1.DataBind();
                        GridView2.DataSource = Nstock;
                        GridView2.DataBind();
                        lblpatente.Text = "PATENTE: " + ovehiculo.patente.ToString();
                        lblmodelo.Text  = "MODELO: " + omodelo.nombre.ToString();
                    }
                    else
                    {
                        lblpatente.Text      = "No tienes ningun vehiculo asignado. ";
                        lblmodelo.Text       = "-";
                        btnaceptar.Visible   = false;
                        btnfinalizar.Visible = false;
                    }
                }
            }
        }
        protected void PDFLST(object sender, EventArgs e)
        {
            Buscadores   bus    = new Buscadores();
            List <stock> Lstock = bus.listastock();
            DataTable    dt     = new DataTable();

            dt.Columns.AddRange(new DataColumn[4] {
                new DataColumn("Codigo"), new DataColumn("Detalle"), new DataColumn("Marca"), new DataColumn("Cantidad")
            });
            foreach (stock ostock in Lstock)
            {
                dt.Rows.Add(ostock.codigo, ostock.detalle, ostock.marca, ostock.cantidad);
            }
            iTextSharp.text.Rectangle rec = new iTextSharp.text.Rectangle(PageSize.A4);
            var doc = new iTextSharp.text.Document(rec);

            rec.BackgroundColor = new BaseColor(System.Drawing.Color.Olive);
            doc.SetPageSize(iTextSharp.text.PageSize.A4);
            string path = Server.MapPath("~");

            PdfWriter.GetInstance(doc, new FileStream(path + "/ReportesLSTT.pdf", FileMode.Create));
            doc.Open();
            //Cabecera
            BaseFont bfntHead = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

            iTextSharp.text.Font fntHead    = new iTextSharp.text.Font(bfntHead, 16, 1, iTextSharp.text.BaseColor.GREEN.Darker());
            Paragraph            prgHeading = new Paragraph();

            prgHeading.Alignment = Element.ALIGN_LEFT;
            prgHeading.Add(new Chunk("Taller de Reparaciones Reportes PDF".ToUpper(), fntHead));
            doc.Add(prgHeading);
            //Generado By
            Paragraph prgGeneratedBY = new Paragraph();
            BaseFont  btnAuthor      = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

            iTextSharp.text.Font fntAuthor = new iTextSharp.text.Font(btnAuthor, 8, 2, iTextSharp.text.BaseColor.BLACK);
            prgGeneratedBY.Alignment = Element.ALIGN_RIGHT;
            prgGeneratedBY.Add(new Chunk("Generado por: " + LogEmpleado.nombreyapellido, fntAuthor));  //Agregar LOG Empleado
            prgGeneratedBY.Add(new Chunk("\nFecha Generada : " + DateTime.Now.ToShortDateString(), fntAuthor));
            doc.Add(prgGeneratedBY);
            //La f Linea
            Paragraph p = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, iTextSharp.text.BaseColor.BLACK, Element.ALIGN_LEFT, 1)));

            doc.Add(p);
            //Espacio
            doc.Add(new Chunk("\n", fntHead));
            //Tabla
            PdfPTable table = new PdfPTable(dt.Columns.Count);

            for (int i = 0; i < dt.Columns.Count; i++)
            {
                string   cellText = Server.HtmlDecode(dt.Columns[i].ColumnName);
                PdfPCell cell     = new PdfPCell();
                cell.Phrase              = new Phrase(cellText, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 10, 1, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
                cell.BackgroundColor     = new BaseColor(System.Drawing.ColorTranslator.FromHtml("#C8C8C8"));
                cell.HorizontalAlignment = Element.ALIGN_CENTER;
                cell.PaddingBottom       = 5;
                table.AddCell(cell);
            }
            //Agregando Campos a la tabla
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    table.AddCell(dt.Rows[i][j].ToString());
                }
            }
            doc.Add(table);
            doc.Close();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('ReportesLSTT.pdf','_newtab');", true);
        }
        protected void PDFRPE(object sender, EventArgs e)
        {
            if (((FechaFinale.Value != "") && (FechaInicios.Value != "")))
            {
                Buscadores      bus           = new Buscadores();
                DateTime        oDateinicio   = Convert.ToDateTime(FechaInicios.Value);
                DateTime        oDatefin      = Convert.ToDateTime(FechaFinale.Value);
                int             tipodempleado = int.Parse(DropTipodeEmpleados.SelectedValue);
                List <empleado> Lempleados    = bus.Lempleado();
                Lempleados = Lempleados.FindAll(x => (x.id_tipo ?? default(int)) == tipodempleado);
                if (Lempleados.Count != 0)
                {
                    var       doc    = new iTextSharp.text.Document(PageSize.A4);
                    string    path   = Server.MapPath("~");
                    PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(path + "/RE.pdf", FileMode.Create));
                    doc.Open();
                    //Cabecera
                    BaseFont             bfntHead   = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                    iTextSharp.text.Font fntHead    = new iTextSharp.text.Font(bfntHead, 16, 1, iTextSharp.text.BaseColor.GREEN.Darker());
                    Paragraph            prgHeading = new Paragraph();
                    prgHeading.Alignment = 1;
                    prgHeading.Add(new Chunk("Taller de Reparaciones".ToUpper(), fntHead));
                    doc.Add(prgHeading);
                    doc.Add(Chunk.NEWLINE);
                    //Generado By
                    Paragraph            prgGeneratedBY = new Paragraph();
                    BaseFont             btnAuthor      = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                    iTextSharp.text.Font fntAuthor      = new iTextSharp.text.Font(btnAuthor, 12, 2, iTextSharp.text.BaseColor.BLACK);
                    prgGeneratedBY.Alignment = Element.ALIGN_RIGHT;
                    prgGeneratedBY.Add(new Chunk("Generado por: " + LogEmpleado.nombreyapellido, fntAuthor));  //Agregar LOG Empleado
                    prgGeneratedBY.Add(new Chunk("\nFecha : " + DateTime.Now.ToShortDateString(), fntAuthor));
                    doc.Add(prgGeneratedBY);
                    Paragraph p = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, iTextSharp.text.BaseColor.BLACK, Element.ALIGN_LEFT, 1)));
                    doc.Add(p);
                    //Espacio
                    doc.Add(new Chunk("\n", fntHead));
                    //Datos
                    Paragraph            Datos     = new Paragraph();
                    BaseFont             bfntDatos = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                    iTextSharp.text.Font fntDatos  = new iTextSharp.text.Font(bfntDatos, 16, 0, iTextSharp.text.BaseColor.BLACK);
                    Datos.Alignment = Element.ALIGN_CENTER;
                    Datos.Add(new Chunk("\nEmpleado tipo: " + DropTipodeEmpleados.SelectedItem.Text, fntDatos));
                    doc.Add(Datos);
                    //Espacio
                    doc.Add(new Chunk("\n", fntHead));
                    int controlprecio;
                    foreach (empleado oempleado in Lempleados)
                    {
                        controlprecio = 0;
                        DataTable dt = new DataTable();
                        dt.Columns.AddRange(new DataColumn[4] {
                            new DataColumn("N°Orden"), new DataColumn("Vehiculo"), new DataColumn("Fecha"), new DataColumn("PrecioTotal")
                        });                                                                                                                                                      //nombre de las columnas
                        List <ordenempleado> Lordenempleado = bus.buscarListOrdenEstadoporempleado(oempleado.id_empleado);
                        List <orden>         Lorden         = bus.buscarordexempleado(Lordenempleado);
                        foreach (orden OrdenActual in Lorden)
                        {
                            int         id          = int.Parse(OrdenActual.id_vehiculo.ToString());
                            vehiculo    ovehiculo   = bus.buscarvehiculoid(id);
                            int         preciototal = 0;
                            ordenestado oestado     = bus.buscarvestadoorden(OrdenActual.id_orden);
                            if ((oestado.fecha_entregado >= oDateinicio) && (oestado.fecha_entregado <= oDatefin))
                            {
                                List <ordenservicio> Lidservidcios = new List <ordenservicio>();
                                Lidservidcios = bus.buscarlistaid(OrdenActual.id_orden);
                                List <servicio> Lservicio = bus.ObtenerServicios(Lidservidcios);
                                foreach (ordenservicio ordenservi in Lidservidcios)
                                {
                                    servicio oservicio = Lservicio.Find(x => x.id_servicios == ordenservi.id_servicio);
                                    int      cantidad  = ordenservi.cantidad ?? default(int);
                                    string   total     = (double.Parse(oservicio.precio) * Convert.ToDouble(cantidad)).ToString();
                                    preciototal = preciototal + int.Parse(total);
                                }
                                string   fecha = oestado.fecha_entregado.ToString();
                                string[] fechasinhora;
                                fechasinhora = fecha.Split(' ');


                                dt.Rows.Add(OrdenActual.id_orden, ovehiculo.patente, fechasinhora[0], preciototal);

                                controlprecio = preciototal;
                            }
                        }
                        //aqui
                        if (dt.Rows.Count != 0)
                        {
                            doc.Add(p);
                            Paragraph Dato = new Paragraph();
                            Dato.Alignment = Element.ALIGN_LEFT;
                            Dato.Add(new Chunk("\nNombre y Apellido: " + oempleado.nombreyapellido + "   Correo: " + oempleado.correo + "  Direccion:  " + oempleado.direccion + "\nDireccion:  " + oempleado.telefono, fntDatos));
                            doc.Add(Dato);
                            //Espacio
                            doc.Add(new Chunk("\n", fntHead));
                            //Tabla
                            PdfPTable table = new PdfPTable(dt.Columns.Count);
                            for (int i = 0; i < dt.Columns.Count; i++)
                            {
                                string   cellText = Server.HtmlDecode(dt.Columns[i].ColumnName);
                                PdfPCell cell     = new PdfPCell();
                                cell.Phrase              = new Phrase(cellText, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 10, 1, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
                                cell.BackgroundColor     = new BaseColor(System.Drawing.ColorTranslator.FromHtml("#C8C8C8"));
                                cell.HorizontalAlignment = Element.ALIGN_CENTER;
                                cell.PaddingBottom       = 5;

                                table.AddCell(cell);
                            }
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                for (int j = 0; j < dt.Columns.Count; j++)
                                {
                                    table.AddCell(dt.Rows[i][j].ToString());
                                }
                            }
                            table.HorizontalAlignment = Element.ALIGN_CENTER;

                            doc.Add(table);


                            //Espacio
                            doc.Add(new Chunk("\n", fntHead));
                        }
                    }
                    doc.Close();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('RE.pdf','_newtab');", true);
                }
            }
        }