コード例 #1
0
        private void btnCobro_Click(object sender, EventArgs e)
        {
            if (nudCobro.Value > 0)
            {
                if (MessageBox.Show("Esta Por Cobrar Un Adelanto, Desea Continuar?", "Adelanto", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var pedido = pedidoServicio.Buscar(PedidoId);

                    //Total Cta Cte

                    var cuentaId = new CtaCteDto();

                    cuentaId = ctaCteServicio.ObtenerPorIdDePedidosId(pedido.Id);

                    ctaCteServicio.Pagar(nudCobro.Value, pedido.ClienteId, cuentaId.Id);

                    //caja

                    var detalle = new DetalleCajaDto
                    {
                        Descripcion = $"{lblPersona.Text} - Adelanto de Pedido",
                        Fecha       = DateTime.Now.ToLongDateString(),
                        Total       = nudCobro.Value,
                        CajaId      = detalleCajaServicio.BuscarCajaAbierta()
                    };

                    TipoPago(detalle);

                    detalleCajaServicio.AgregarDetalleCaja(detalle);

                    cajaServicio.SumarDineroACaja(nudCobro.Value);

                    pedidoServicio.CambiarRamas(nudCobro.Value, PedidoId);

                    var venta = new VentaDto
                    {
                        ClienteId = pedido.ClienteId,
                        Descuento = 0,
                        Fecha     = DateTime.Now,
                        Total     = nudCobro.Value
                    };

                    ventaServicio.NuevaVenta(venta);

#pragma warning disable CS0436 // El tipo 'Afirmacion' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs' está en conflicto con el tipo importado 'Afirmacion' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs'.
                    var completado = new Afirmacion("Felicidades!", $"Completado \nSe obtuvo de ganancias $ {nudCobro.Value}\nTipo de Pago: {detalle.TipoPago}");
#pragma warning restore CS0436 // El tipo 'Afirmacion' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs' está en conflicto con el tipo importado 'Afirmacion' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs'.
                    completado.ShowDialog();

                    nudCobro.Value = 0;

                    Datos(PedidoId);
                }
            }
        }
コード例 #2
0
ファイル: CtaCte.cs プロジェクト: JoseSabeckis/KosakoJean
 private void dgvGrilla_RowEnter(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvGrilla.RowCount > 0)
     {
         _CtaCteId = (long)dgvGrilla["Id", e.RowIndex].Value;
         _ctaDto   = _ctaCteServicio.ObtenerPorId(_CtaCteId);
         nudCobroMaximo();
     }
     else
     {
         _CtaCteId = 0;
     }
 }
コード例 #3
0
        public void Agregar(CtaCteDto ctaCteDto)
        {
            using (var contex = new KosakoDBEntities())
            {
                var cuenta = new AccesoDatos.CtaCte
                {
                    Descripcion = ctaCteDto.Descripcion,
                    Fecha       = ctaCteDto.Fecha,
                    Total       = ctaCteDto.Total,
                    Debe        = ctaCteDto.Debe,
                    Estado      = ctaCteDto.Estado,
                    ClienteId   = ctaCteDto.ClienteId,
                    PedidoId    = ctaCteDto.PedidoId
                };

                contex.CtasCtes.Add(cuenta);

                contex.SaveChanges();
            }
        }
コード例 #4
0
        public CtaCteDto ObtenerPorId(long ctaId)
        {
            using (var context = new KosakoDBEntities())
            {
                var cuenta = context.CtasCtes.FirstOrDefault(x => x.Id == ctaId);

                var cuentaNueva = new CtaCteDto
                {
                    Id          = cuenta.Id,
                    ClienteId   = cuenta.ClienteId,
                    Debe        = cuenta.Debe,
                    Descripcion = cuenta.Descripcion,
                    Total       = cuenta.Total,
                    Fecha       = cuenta.Fecha,
                    Estado      = cuenta.Estado,
                    PedidoId    = cuenta.PedidoId
                };

                return(cuentaNueva);
            }
        }
コード例 #5
0
        private void btnTerminar_Click(object sender, EventArgs e)
        {
            if (cajaServicio.BuscarCajaAbierta() != null)
            {
                if (MessageBox.Show("Esta por Terminar el Pedido, Esta Seguro?", "Preguntar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var pedido = pedidoServicio.Buscar(PedidoId);

                    pedidoServicio.CambiarProcesoRetirado(pedido.Id);

                    pedidoServicio.CambiarFechaRetirado(pedido.Id);

                    producto_Pedido_Servicio.CambiarEstado(pedido.Id);

                    //Total Cta Cte

                    var cuentaId = new CtaCteDto();

                    if (pedido.ClienteId != 1)
                    {
                        cuentaId = ctaCteServicio.ObtenerPorIdDePedidosId(pedido.Id);

                        ctaCteServicio.Pagar(_Debe, pedido.ClienteId, cuentaId.Id);
                    }

                    //Fin Cta Cte

                    btnTerminar.Visible = false;

                    //caja

                    var detalle = new DetalleCajaDto
                    {
                        Descripcion = $"{lblPersona.Text} - Pedido Terminado",
                        Fecha       = DateTime.Now.ToLongDateString(),
                        Total       = _Debe,
                        CajaId      = detalleCajaServicio.BuscarCajaAbierta()
                    };

                    TipoPago(detalle);

                    detalleCajaServicio.AgregarDetalleCaja(detalle);

                    cajaServicio.SumarDineroACaja(_Debe);

                    pedidoServicio.CambiarRamas(_Debe, PedidoId);

                    var venta = new VentaDto
                    {
                        ClienteId = pedido.ClienteId,
                        Descuento = 0,
                        Fecha     = DateTime.Now,
                        Total     = _Debe
                    };

                    ventaServicio.NuevaVenta(venta);

#pragma warning disable CS0436 // El tipo 'Afirmacion' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs' está en conflicto con el tipo importado 'Afirmacion' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs'.
                    var completado = new Afirmacion("Felicidades!", $"Completado \nse obtuvo de ganancias $ {_Debe}\nTipo de Pago: {detalle.TipoPago}");
#pragma warning restore CS0436 // El tipo 'Afirmacion' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs' está en conflicto con el tipo importado 'Afirmacion' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs'.
                    completado.ShowDialog();

                    Datos(PedidoId);

                    lblVendido.Visible                    = true;
                    btnAgregarProductos.Visible           = false;
                    btnVolverPedidoNoRetirado.Visible     = true;
                    btnEliminarPedidoSeleccionado.Visible = false;
                }
            }
            else
            {
                MessageBox.Show("la Caja se encuentra cerrada", "Cerrada", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #6
0
ファイル: Pedido.cs プロジェクト: JoseSabeckis/KosakoJean
        private void btnCargar_Click(object sender, EventArgs e)
        {
            if (AsignarControles())
            {
                if (ckbNormal.Checked == false && ckbCtaCte.Checked == false && ckbTarjeta.Checked == false)
                {
                    MessageBox.Show("Seleccione el Tipo de Pago: Contado, CtaCte, Tarjeta.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }

                if (MessageBox.Show("Esta Seguro de Continuar? Puede ser un Cobro para Despues", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var pedido = new PedidoDto
                    {
                        Adelanto        = nudAdelanto.Value,
                        Apellido        = txtApellido.Text,
                        FechaPedido     = DateTime.Now,
                        Nombre          = txtNombre.Text,
                        Proceso         = AccesoDatos.Proceso.InicioPedido,
                        FechaEntrega    = dtpFechaEntrega.Value.Date,
                        Total           = _total,
                        ClienteId       = ClienteId,
                        Descripcion     = txtDescripcion.Text,
                        Horario         = cmbHorario.Text,
                        DiasHastaRetiro = null
                    };

                    var pedidoId = pedidoServicio.NuevoPedido(pedido);

                    ProductoDto producto = new ProductoDto();

                    string segunda = string.Empty;

                    foreach (var item in ListaVentas)
                    {
                        producto = productoServicio.ObtenerPorId(item.Id);

                        segunda += " " + producto.Descripcion + " ";

                        //stock
                        productoServicio.BajarStock(producto.Id, item.Cantidad);
                    }

                    foreach (var item in ListaVentas)
                    {
                        var aux = new Producto_Pedido_Dto
                        {
                            Cantidad    = item.Cantidad,
                            ProductoId  = productoServicio.ObtenerPorId(item.Id).Id,
                            Estado      = AccesoDatos.EstadoPedido.Esperando,
                            Talle       = item.Talle,
                            PedidoId    = pedidoId,
                            Descripcion = segunda,
                            TalleId     = talleServicio.BuscarNombreDevuelveId(item.Talle),
                            Precio      = item.Precio
                        };

                        var _Id_Pedido = producto_Pedido_Servicio.NuevoProductoPedido(aux);

                        //datos
                        if (productoServicio.ObtenerPorId(item.Id).Creacion)
                        {
                            for (int i = 0; i < item.Cantidad; i++)
                            {
                                var dato = new Producto_Dato_Dto
                                {
                                    EstadoPorPedido   = AccesoDatos.EstadoPorPedido.EnEspera,
                                    Producto_PedidoId = _Id_Pedido
                                };

                                producto_Dato_Servicio.Insertar(dato);
                            }
                        }
                    }

                    var cuenta = new CtaCteDto
                    {
                        ClienteId   = ClienteId,
                        Estado      = AccesoDatos.CtaCteEstado.EnEspera,
                        Fecha       = dtpFechaEntrega.Value,
                        Total       = _total,
                        Debe        = _total - nudAdelanto.Value,
                        Descripcion = $"{segunda}",
                        PedidoId    = pedidoId
                    };

                    ctaCteServicio.Agregar(cuenta);


                    var detalle = new DetalleCajaDto
                    {
                        Descripcion = txtApellido.Text + " " + txtNombre.Text + " - " + segunda,
                        Fecha       = DateTime.Now.ToLongDateString(),
                        Total       = nudAdelanto.Value,
                        CajaId      = detallCajaServicio.BuscarCajaAbierta()
                    };

                    TipoPago(detalle);

                    detallCajaServicio.AgregarDetalleCaja(detalle);

                    //dinero a caja
                    cajaServicio.SumarDineroACaja(nudAdelanto.Value); //

#pragma warning disable CS0436                                        // El tipo 'Afirmacion' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs' está en conflicto con el tipo importado 'Afirmacion' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs'.
                    var mensaje = new Afirmacion("Agregado a la Cuenta!", $"Dinero Cobrado Por Adelanto $ {nudAdelanto.Value}\nTipo de Pago: {detalle.TipoPago}");
#pragma warning restore CS0436                                        // El tipo 'Afirmacion' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs' está en conflicto con el tipo importado 'Afirmacion' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs'.
                    mensaje.ShowDialog();

                    if (ckbNormal.Checked || ckbTarjeta.Checked)
                    {
                        if (nudAdelanto.Value == _total)
                        {
                            foreach (var item in ListaVentas)
                            {
                                item.Precio = item.Cantidad * item.Precio;
                            }

                            //ticket

                            var fecha = new FechaDto
                            {
                                Fecha = DateTime.Now.ToShortDateString(),
                                Hora  = DateTime.Now.ToShortTimeString()
                            };

                            var factura = new Comprobante(ListaVentas.ToList(), fecha);
                            factura.ShowDialog();
                        }
                    }

                    semaforo = true;

                    this.Close();

                    return;
                }
            }
            else
            {
#pragma warning disable CS0436 // El tipo 'Negativo' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Negativo.cs' está en conflicto con el tipo importado 'Negativo' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Negativo.cs'.
                var mens = new Negativo("Error", "Apellido y Nombre \nno puede estar vacio");
#pragma warning restore CS0436 // El tipo 'Negativo' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Negativo.cs' está en conflicto con el tipo importado 'Negativo' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Negativo.cs'.
                mens.ShowDialog();
                //MessageBox.Show("El Campo Apellido y Nombre no puede estar vacio", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtApellido.Text == string.Empty)
            {
                MessageBox.Show("Coloque El Nombre o el Apellido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            if (!ckbTarjeta.Checked && !ckbNormal.Checked)
            {
                MessageBox.Show("Seleccione Contado o Tarjeta", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            if (MessageBox.Show("Seguro de Continuar?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                ventaDto.ClienteId = _Cliente.Id;
                ventaDto.Fecha     = DateTime.Now;
                ventaDto.Total     = nudAdelanto.Value;

                var ventaId = ventaServicio.NuevaVenta(ventaDto);

                string descripcion = string.Empty;

                foreach (var item in ListaVenta)
                {
                    var producto = productoServicio.ObtenerPorId(item.ProductoId);

                    item.VentaId = ventaId;

                    descripcion += " " + item.Descripcion + " ";

                    // descontar stock
                    productoServicio.BajarStock(producto.Id, item.Cantidad);

                    producto_vent.NuevoProductoVenta(item);
                }

                AccesoDatos.Proceso _Proceso;

                if (_Cliente.Id == 1)
                {
                    _Proceso = AccesoDatos.Proceso.Guardado;
                }
                else
                {
                    _Proceso = AccesoDatos.Proceso.CtaCte;
                }

                var pedido = new PedidoDto
                {
                    Adelanto     = nudAdelanto.Value,
                    Apellido     = txtApellido.Text,
                    FechaPedido  = DateTime.Now,
                    Nombre       = txtNombre.Text,
                    Proceso      = _Proceso,
                    FechaEntrega = dtpFechaEntrega.Value,
                    Total        = _Total,
                    ClienteId    = _Cliente.Id,
                    Descripcion  = $"Espera de Pago - {txtApellido.Text} {txtNombre.Text}",
                    Horario      = $"Sera Retirado a la {cmbHorario.Text}"
                };

                var pedidoId = pedidoServicio.NuevoPedido(pedido);

                foreach (var item in ListaVentasDto2)
                {
                    var aux = new Producto_Pedido_Dto
                    {
                        Cantidad    = item.Cantidad,
                        ProductoId  = productoServicio.ObtenerPorId(item.Id).Id,
                        Estado      = AccesoDatos.EstadoPedido.Esperando,
                        Talle       = item.Talle,
                        PedidoId    = pedidoId,
                        Descripcion = descripcion,
                        TalleId     = talleServicio.BuscarNombreDevuelveId(item.Talle),
                        Precio      = item.Precio
                    };

                    producto_Pedido_Servicio.NuevoProductoPedido(aux);
                }

                var cuenta = new CtaCteDto
                {
                    ClienteId   = _Cliente.Id,
                    Estado      = AccesoDatos.CtaCteEstado.EnEspera,
                    Fecha       = DateTime.Now,
                    Total       = _Total,
                    Debe        = _Total - nudAdelanto.Value,
                    Descripcion = $"Prenda Guardada",
                    PedidoId    = pedidoId
                };

                ctaCteServicio.Agregar(cuenta);


                var detalle = new DetalleCajaDto
                {
                    Descripcion = txtApellido.Text + " " + txtNombre.Text,
                    Fecha       = DateTime.Now.ToLongDateString(),
                    Total       = nudAdelanto.Value,
                    CajaId      = detallCajaServicio.BuscarCajaAbierta()
                };

                TipoPago(detalle);

                detallCajaServicio.AgregarDetalleCaja(detalle);

                //dinero a caja
                cajaServicio.SumarDineroACaja(nudAdelanto.Value); //

#pragma warning disable CS0436                                    // El tipo 'Afirmacion' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs' está en conflicto con el tipo importado 'Afirmacion' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs'.
                var NewPrenda = new Afirmacion("Prenda Guardada", $"A Esperar...\nAdelanto de Cobro: $ {nudAdelanto.Value}\n\nTipo de Pago: {detalle.TipoPago}");
#pragma warning restore CS0436                                    // El tipo 'Afirmacion' de 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs' está en conflicto con el tipo importado 'Afirmacion' de 'Presentacion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se usará el tipo definido en 'C:\Users\Pepe\Source\Repos\JoseSabeckis\KosakoJean\Presentacion.Core\Mensaje\Afirmacion.cs'.
                NewPrenda.ShowDialog();

                semaforo = true;

                this.Close();
            }
        }