Exemplo n.º 1
0
        protected void Unnamed_ServerClick1(object sender, EventArgs e)
        {
            Buscadores bus = new Buscadores();
            string     a   = txtpatente.Value;

            using (aplicadaBDEntities2 DBF = new aplicadaBDEntities2())
            {
                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;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void CargarGrid(orden oOrden)
        {
            MetodosdePago();
            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("Cantidad"), new DataColumn("Detalle"), new DataColumn("Precio"), new DataColumn("Total")
            });
            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(o.cantidad, oservicio.detalle, oservicio.precio, total);
                preciototal = preciototal + int.Parse(total);
            }
            //foreach (servicio x in Lservicios)
            //{
            //    a = a + int.Parse(x.precio);
            //}
            lblprecio.Text = preciototal.ToString();
            //GridView1.DataSource = Lservicios;
            dt = dtable;
            GridView1.DataSource = dtable;
            GridView1.DataBind();
        }
Exemplo n.º 3
0
        public void Calculaelprimero()
        {
            Buscadores bus = new Buscadores();

            if (DropServicio.SelectedIndex != -1)
            {
                servicio oservicio = bus.buscarservicio(int.Parse(DropServicio.SelectedItem.Value));
                txtprecioporcantidad.Value = (int.Parse(oservicio.precio) * int.Parse(txtcantidad.Text)).ToString();
            }
        }
Exemplo n.º 4
0
        public servicio buscarservicio(int id)
        {
            servicio objserv = new servicio();

            using (aplicadaBDEntities2 DBF = new aplicadaBDEntities2())
            {
                objserv = (from q in DBF.servicio where q.id_servicios == id select q).FirstOrDefault();
            }
            return(objserv);
        }
Exemplo n.º 5
0
        private List <servicio> ObtenerServicios(List <ordenservicio> Lidservidcios)
        {
            List <servicio> Lservicio = new List <servicio>();
            Buscadores      bus       = new Buscadores();

            foreach (ordenservicio idservicios in Lidservidcios)
            {
                servicio oservicio = bus.buscarservicio(idservicios.id_servicio);
                Lservicio.Add(oservicio);
            }
            return(Lservicio);
        }
Exemplo n.º 6
0
        private servicio Encontrarservicio(int a, int w)
        {
            servicio ooservicio = new servicio();

            foreach (servicio oservicio in LSAC)
            {
                if (a == w)
                {
                    ooservicio = oservicio;
                }
                a = a + 1;
            }
            return(ooservicio);
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
        public void EstadoOriginal()
        {
            txtmodelo.Visible    = true;
            txtmarca.Visible     = true;
            Dmodelo.Visible      = false;
            Dmarca.Visible       = false;
            txtapellido.Disabled = true;
            txtnombre.Disabled   = true;
            txttelefono.Disabled = true;
            txtemail.Disabled    = true;
            txtaño.Disabled      = true;

            RecargarAuto();
            servicio oservicio = new servicio();

            VerGrid(oservicio);
        }
Exemplo n.º 9
0
        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
        }
Exemplo n.º 10
0
        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 + "/Taller.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('Taller.pdf','_newtab');", true);
                }
            }
        }
Exemplo n.º 11
0
        protected void DropTipoServicio_SelectedIndexChanged(object sender, EventArgs e)
        {
            servicio oservicio = new servicio();

            VerGrid(oservicio);
        }
Exemplo n.º 12
0
        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";
            }
        }
Exemplo n.º 13
0
        public void VerGrid(servicio oservicio)
        {
            List <servicio> Lservicios;

            DropServicio.Items.Clear();
            if (GridView2.Rows.Count == 0)
            {
                using (aplicadaBDEntities2 DBF = new aplicadaBDEntities2())
                {
                    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 (aplicadaBDEntities2 DBF = new aplicadaBDEntities2())
                    {
                        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);
                    }
                }
            }
        }