private void btn_agregarDetalles_Click(object sender, EventArgs e)
        {
            Detalles item = new Detalles();

            item.nombre    = txt_nombreDetalles.Text;
            item.cantidad  = int.Parse(txt_cantidadDetalles.Text);
            item.precio    = int.Parse(txt_precioDetalles.Text);
            item.total     = int.Parse(txt_totalDetalles.Text);
            item.descuento = int.Parse(txt_descuentoDetalles.Text);
            if (chbx_exentoSi.Checked)
            {
                item.isExento = true;
            }
            else
            {
                item.isExento = false;
            }
            detalles.Add(item);
            grid_detalles.DataSource   = null;
            grid_detalles.DataSource   = detalles;
            txt_nombreDetalles.Text    = "";
            txt_cantidadDetalles.Text  = "0";
            txt_precioDetalles.Text    = "0";
            txt_totalDetalles.Text     = "0";
            txt_descuentoDetalles.Text = "0";
            chbx_exentoSi.Checked      = true;
            chbx_exentoNo.Checked      = false;
            grid_detalles.ClearSelection();
        }
Esempio n. 2
0
        public void GuardarDetalleData(string Tipo)
        {
            this.DatosdataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            this.DatosdataGridView.MultiSelect   = false;
            var detalle = new Detalles();

            DatosdataGridView.Rows.Add();
            int cantFilas = DatosdataGridView.Rows.Count - 1;

            DatosdataGridView[0, cantFilas].Value = Tipo;
            DatosdataGridView[1, cantFilas].Value = JugadatextBox.Text;
            DatosdataGridView[2, cantFilas].Value = MontotextBox.Text;
            total = total + Utilidades.ToInt(MontotextBox.Text);
            //  detalle.IdLoteria = Utilidades.ToInt(Loteriabutton.Text);
            detalle.Jugada = Utilidades.ToInt(JugadatextBox.Text);
            detalle.Precio = Utilidades.ToInt(MontotextBox.Text);
            detalle.Tipo   = Tipo.ToString();


            if (DetallesBLL.Guardar(detalle))
            {
                id++;
                ticket.detalles.Add(DetallesBLL.Buscar(id));
                TotaltextBox.Clear();
                JugadatextBox.Clear();
                MontotextBox.Clear();
                TotaltextBox.Text = total.ToString();
                MontotextBox.Focus();
            }
            else
            {
                MessageBox.Show("Error en guardar los datos intente de nuevo");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Articulo seleccionado = (Articulo)dgvArticulos.CurrentRow.DataBoundItem;
            Detalles detalle      = new Detalles(seleccionado);

            detalle.ShowDialog();
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("idDetalle,idFactura,idProducto,Cantidad,PrecioUnitario")] Detalles detalles)
        {
            if (id != detalles.idDetalle)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(detalles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DetallesExists(detalles.idDetalle))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["idFactura"]  = new SelectList(_context.Facturas, "idFactura", "NombreCliente", detalles.idFactura);
            ViewData["idProducto"] = new SelectList(_context.Productos, "idProducto", "Producto", detalles.idProducto);
            return(View(detalles));
        }
Esempio n. 5
0
        public bool Inserta_detalle(Detalles detalle)
        {
            bool inserta = false;

            try
            {
                if (Objcon.Open_cnx())
                {
                    Objcon.cmd             = new SqlCommand("Crear_detalle", Objcon.cnx);
                    Objcon.cmd.CommandType = CommandType.StoredProcedure;
                    Objcon.cmd.Parameters.Add("@cantidad", SqlDbType.Int).Value        = detalle.c_cantidad;
                    Objcon.cmd.Parameters.Add("@precio_producto", SqlDbType.Int).Value = detalle.c_precio_producto;
                    Objcon.cmd.Parameters.Add("@nombre_art", SqlDbType.VarChar).Value  = detalle.c_nombre_art;
                    Objcon.cmd.Parameters.Add("@total", SqlDbType.Int).Value           = detalle.c_total;
                    Objcon.cmd.Parameters.Add("@id_producto", SqlDbType.Int).Value     = detalle.c_id_producto;
                    Objcon.cmd.Parameters.Add("@num_factura", SqlDbType.Int).Value     = detalle.c_num_factura;

                    Objcon.cmd.ExecuteNonQuery();
                    inserta = true;
                }
            }
            catch (Exception e)
            {
                throw e;
                //Console.WriteLine(e.ToString());
                //inserta = false;
            }

            return(inserta);
        }
 public void Llenar(Detalles p)
 {
     p.Fecha       = Convert.ToDateTime(FechaTextBox.Text);
     p.Descripcion = DescripcionTextBox.Text;
     p.Monto       = Convert.ToInt32(MontoTextBox.Text);
     p.Categoria   = CategoriaDropDownList.Text;
 }
Esempio n. 7
0
        private void ProcessEntradaObra(GeofenceEvent data)
        {
            // Obtengo el estado a procesar
            var detalle = GetDetalle(data, Estado.Evento.LlegaAObra);

            if (detalle == null)
            {
                return;
            }

            if (!detalle.Automatico.HasValue)
            {
                // Guardo la fecha del evento
                detalle.Automatico = data.Date;
                DaoFactory.DetalleTicketDAO.SaveOrUpdate(detalle);

                SaveMessage(MessageCode.EstadoLogisticoCumplido.GetMessageCode(), detalle.EstadoLogistico.Descripcion, data);
                SaveMessageAtraso(data, detalle);
            }
            else
            {
                var salida = Detalles.Where(d => d.EstadoLogistico.EsPuntoDeControl == Estado.Evento.SaleDeObra && d.Automatico.HasValue).FirstOrDefault();
                if (salida != null)
                {
                    // Si ya hay una fecha para el evento de salida, la borro: la salida siempre es la ultima.
                    salida.Automatico = null;
                    DaoFactory.DetalleTicketDAO.SaveOrUpdate(salida);
                }
            }
        }
        public string CrearXML(EnumeradoresFEL.enmTipoDocumento tipoDoc)
        {
            var encDoc = ResolverEncabezado(tipoDoc);

            encDoc.Clave             = Encabezado.Clave;
            encDoc.NumeroConsecutivo = Encabezado.NumeroConsecutivo;
            encDoc.FechaEmision      = Encabezado.FechaEmision;
            encDoc.Emisor            = Encabezado.Emisor;
            encDoc.Receptor          = Validador.esReceptorValido(Encabezado.Receptor) ? Encabezado.Receptor : null;
            encDoc.CondicionVenta    = ModFunciones.ObtenerValorEnumerador(Encabezado.CondicionVenta,
                                                                           Enumeradores.CondicionVenta.Item99);
            encDoc.PlazoCredito          = Encabezado.PlazoCredito;
            encDoc.MedioPago             = AsignarMediosPago();
            encDoc.DetalleServicio       = Detalles.ToArray();
            encDoc.ResumenFactura        = Resumen;
            encDoc.InformacionReferencia = CrearArregloReferencias();
            encDoc.Normativa             = new Normativa
            {
                NumeroResolucion = Encabezado.NormativaNombre,
                FechaResolucion  = Encabezado.NormativaFecha
            };
            encDoc.Otros = CrearSeccionOtros();
            return(encDoc.GenerarXML());

            throw new NotImplementedException();
        }
Esempio n. 9
0
        public static async Task <bool> CrearNuevoDetalles(FacturacionContext context, int codigoProducto, int cantidadProducto, int precioProducto)
        {
            try
            {
                Detalles detalle = new Detalles();
                detalle.idFactura      = codigoProducto;
                detalle.idProducto     = codigoProducto;
                detalle.Cantidad       = cantidadProducto;
                detalle.PrecioUnitario = precioProducto;
                context.Detalles.Add(detalle);
                await context.SaveChangesAsync();

                System.Diagnostics.Debug.WriteLine("SE CREO El DETALLE");
                return(true);
            }
            catch (Exception e)
            {
                /**
                 * Se podría monitorear los errores,
                 * En este caso simplemente escribimos en consola
                 */
                System.Diagnostics.Debug.WriteLine("ERROR: " + e);
                return(false);
            }
        }
Esempio n. 10
0
 public void DeleteDetalle(int index)
 {
     if (index >= 0 && index < Detalles.Count)
     {
         Detalles.RemoveAt(index);
     }
 }
Esempio n. 11
0
        public string m_numero_detalle()
        {
            SqlCommand cmd = new SqlCommand();

            Detalles objins = new Detalles();

            try
            {
                Objcon.Open_cnx();

                Objcon.cmd             = new SqlCommand("ID_detalle", Objcon.cnx);
                Objcon.cmd.CommandType = CommandType.StoredProcedure;


                SqlDataReader ObjReader = Objcon.cmd.ExecuteReader();
                if (ObjReader.Read())
                {
                    objins.c_id_detalle = ObjReader["NumeroB"].ToString();
                }
                Objcon.cnx.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(objins.c_id_detalle);
        }
Esempio n. 12
0
 public virtual IList <EntregaDistribucion> GetEntregasPorOrdenReal()
 {
     if (Tipo == Tipos.Desordenado)
     {
         var salidas = Detalles.Where(e => e.Linea != null);
         var llegada = Detalles.Last();
         if (llegada.Linea == null)
         {
             llegada = null;
         }
         var det = Detalles.Where(e => e.Linea == null && e.Estado != EntregaDistribucion.Estados.Cancelado)
                   .OrderBy(e => e.FechaMin).ToList();
         if (salidas.Any())
         {
             det.Insert(0, salidas.First());
         }
         det.AddRange(Detalles.Where(e => e.Linea == null && e.Estado == EntregaDistribucion.Estados.Cancelado)
                      .OrderBy(e => e.FechaMin));
         if (llegada != null && Detalles.Count > 1)
         {
             det.Add(llegada);
         }
         return(det.ToList());
     }
     return(Detalles.ToList());
 }
Esempio n. 13
0
        public virtual IList <EntregaDistribucion> GetEntregasPorOrdenManual()
        {
            var salidas = Detalles.Where(e => e.Linea != null);
            var llegada = Detalles.Last();

            if (llegada.Linea == null)
            {
                llegada = null;
            }

            var det = Detalles.Where(e => e.Linea == null && e.Manual.HasValue)
                      .OrderBy(e => e.Manual.Value).ToList();

            if (salidas.Any())
            {
                det.Insert(0, salidas.First());
            }
            det.AddRange(Detalles.Where(e => e.Linea == null && !e.Manual.HasValue)
                         .OrderBy(e => e.Programado));

            if (llegada != null && Detalles.Count > 1)
            {
                det.Add(llegada);
            }
            return(det.ToList());
        }
Esempio n. 14
0
 public List <string> IsOk()
 {
     Errores = new List <string>();
     if (Detalles == null)
     {
         Errores.Add("La venta debe tener mínimo un producto.");
     }
     else
     {
         double total = 0;
         Detalles.ForEach(x => total += x.Total);
         if (Abonado > total)
         {
             Errores.Add("El abono no puede ser mayor al total de la factura.");
         }
     }
     if (Detalles.Count < 1)
     {
         Errores.Add("La venta debe tener mínimo un producto");
     }
     if (Comprobante == null)
     {
         Errores.Add("El comprobante no debe estar vacío.");
     }
     return(Errores);
 }
Esempio n. 15
0
 public void CalcularTotales()
 {
     CalcularSubTotal();
     CalcularDescuentoTotal();
     CalcularIvaTotal();
     Total = Detalles.Sum((d) => d.Total);
 }
Esempio n. 16
0
            public string Render()
            {
                var m  = string.Format(Template, Id, Interno, LabelStyle, Icono, Completed, Tipo);
                var st = string.Concat("[", string.Join(",", Detalles.Select(d => d.Render()).ToArray()), "]");

                return(string.Format("addMimico('{0}', {1}, {2});", Id, m, st));
            }
Esempio n. 17
0
        private void ProcessEntradaBase(GeofenceEvent data)
        {
            // Obtengo el estado a procesar
            var detalle = GetDetalle(data, Estado.Evento.LlegaAPlanta);

            if (detalle == null)
            {
                return;
            }

            // Si ya hay una fecha para sale de planta de menos de 5 minutos antes, tomo esta entrada como una "entrada-salida"
            var salida = Detalles.Where(d => d.EstadoLogistico.EsPuntoDeControl == Estado.Evento.SaleDePlanta && d.Automatico.HasValue).FirstOrDefault();

            if (salida != null && data.Date.Subtract(salida.Automatico.Value) < TimeSpan.FromMinutes(InOutGecercaMinutes))
            {
                return;
            }

            if (!detalle.Automatico.HasValue)
            {
                // Guardo la fecha del evento
                detalle.Automatico = data.Date;
                DaoFactory.DetalleTicketDAO.SaveOrUpdate(detalle);

                Ticket.FechaFin    = data.Date;
                Ticket.BaseLlegada = DaoFactory.LineaDAO.GetList(new[] { Ticket.Empresa != null ? Ticket.Empresa.Id : Ticket.Linea.Empresa.Id })
                                     .Where(lin => lin.ReferenciaGeografica != null && lin.ReferenciaGeografica.Id == data.Id)
                                     .FirstOrDefault();
                DaoFactory.TicketDAO.SaveOrUpdate(Ticket);

                SaveMessage(MessageCode.EstadoLogisticoCumplido.GetMessageCode(), detalle.EstadoLogistico.Descripcion, data);
                SaveMessageAtraso(data, detalle);
            }
        }
Esempio n. 18
0
        private void UpdateDetalle(Detalle detalle)
        {
            var index = Detalles.IndexOf(detalle);

            Detalles.Remove(detalle);
            Detalles.Insert(index, detalle);
        }
Esempio n. 19
0
        public ActionResult DeleteConfirmed(int id)
        {
            Detalles detalles = db.Detalles.Find(id);

            db.Detalles.Remove(detalles);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            Detalles pre = new Detalles();

            Llenar(pre);
            MasterDetailBLL.Guardar(pre);
            Label1.Text = "Registro con exito";
        }
Esempio n. 21
0
 public virtual DetalleTicket GetDetalleProximo()
 {
     return(Detalles
            .OfType <DetalleTicket>()
            .Where(d => !d.Automatico.HasValue && !d.Manual.HasValue)
            .OrderBy(d => d.Programado)
            .FirstOrDefault());
 }
Esempio n. 22
0
 private void Removerbutton_Click(object sender, EventArgs e)
 {
     if (MydataGridView.Rows.Count > 0 && MydataGridView.CurrentRow != null)
     {
         Detalles.RemoveAt(MydataGridView.CurrentRow.Index);
         CargarGrid();
     }
 }
Esempio n. 23
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Detalles detalles = await db.Detalles.FindAsync(id);

            db.Detalles.Remove(detalles);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 24
0
 private bool DetalleRepetido(int id)
 {
     if (Detalles.Any(dc => dc.ID_ITEM == id))
     {
         MessageBox.Show("Detalle repetido.", Application.Current.Resources["NombreAplicacion"].ToString(), MessageBoxButton.OK, MessageBoxImage.Exclamation);
         return(true);
     }
     return(false);
 }
Esempio n. 25
0
        public void AgregarDetalle(Producto producto, int cantidad, decimal ValorUnitario)
        {
            Detalle detalle = new Detalle(producto, cantidad, ValorUnitario)
            {
                Id_Factura = Id_Factura
            };

            Detalles.Add(detalle);
        }
        public static Detalles Buscar(int id)
        {
            Detalles detalles = new Detalles();

            using (var db = new BancaDB())
            {
                detalles = db.detalles.Find(id);
            }
            return(detalles);
        }
Esempio n. 27
0
        public static Detalles Guardar(Detalles nuevo)
        {
            Detalles retorno = null;

            using (var conn = new DAL.Repositorio <Detalles>())
            {
                retorno = conn.Guardar(nuevo);
            }
            return(retorno);
        }
Esempio n. 28
0
 public void AgregarDetalle(Producto producto, int cantidad)
 {
     {
         Detalle detalle = new Detalle(producto, cantidad)
         {
             Id_Factura = Id_Factura
         };
         Detalles.Add(detalle);
     }
 }
Esempio n. 29
0
 protected void btnguardar_Click(object sender, EventArgs e)
 {
     try
     {
         PedidoDAO  db = new PedidoDAO();
         Encabezado en = new Encabezado();
         en.Id_Encab      = Convert.ToInt32(Request.QueryString["IDMP"]);
         en.Id_cliente    = Convert.ToInt32(txtcodigo.Text);
         en.fechaCheque   = txtfecha.Text;
         en.Id_Vendedor   = Convert.ToInt32(ddlvendedor.SelectedValue);
         en.Total_Venta   = Convert.ToDecimal(lbltotal.Text);
         en.Id_Moneda     = Convert.ToInt32(ddlmoneda.SelectedValue);
         en.IGV           = Convert.ToDecimal(lbligv.Text);
         en.Id_Vendedor   = Convert.ToInt32(ddlvendedor.SelectedValue);
         en.Id_FormaPago  = Convert.ToInt32(ddlformapago.SelectedValue);
         en.Notas         = txtnota.Text;
         en.Estado_Docmto = chkrecibio.Checked;
         if (en.Estado_Docmto == true)
         {
             en.Estado_Pago = "Recibió";
         }
         else
         {
             en.Estado_Pago = "No recibió";
         }
         Int32 id = en.Id_Encab;
         db.ModificarCabecera(en);
         db.EliminarDetalle(id);
         foreach (GridViewRow fila in grvDetalles.Rows)
         {
             Detalles det      = new Detalles();
             TextBox  cantidad = (TextBox)fila.FindControl("txtcantidad");
             det.Paquetes = Convert.ToInt32(cantidad.Text);
             TextBox precio = (TextBox)fila.FindControl("txtprecio");
             det.PrecioUnit = Convert.ToDecimal(precio.Text);
             TextBox peso = (TextBox)fila.FindControl("txtpeso");
             det.CantidadKilos = Convert.ToDecimal(peso.Text);
             det.Id_prod       = Convert.ToInt32(fila.Cells[0].Text);
             det.SubTotal      = Convert.ToDecimal(fila.Cells[6].Text);
             det.IGV           = Convert.ToDecimal(fila.Cells[5].Text);
             TextBox unidad = (TextBox)fila.FindControl("txtunidad");
             det.Unidad     = Convert.ToInt32(unidad.Text);
             det.Id_UMedida = Convert.ToInt32(fila.Cells[9].Text);
             db.InsertarDetalles(det, id);
         }
         Response.Redirect("MantePedido.aspx", true);
     }
     catch (Exception ex)
     {
         txtmensaje.Text = ex.Message;
         string script = "openModal();";
         ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", script, true);
     }
 }
Esempio n. 30
0
        private DateTime GetMaxDate()
        {
            var lastDetalle = Detalles.Last();
            var maxDate     = lastDetalle.Programado.Value;

            if (lastDetalle.Automatico.HasValue && maxDate < lastDetalle.Automatico.Value)
            {
                maxDate = lastDetalle.Automatico.Value;
            }
            return(maxDate);
        }