Ejemplo n.º 1
0
        public static DataTable mostrarNroDetalle(int idVenta)
        {
            DVenta Obj = new DVenta();

            return(Obj.mostrarNroDetalle(idVenta));
        }
Ejemplo n.º 2
0
        private void BuscarxFecha(DateTime FirstDate, DateTime LastDate)
        {
            DVenta bo = new DVenta();

            DgvVenta.DataSource = bo.BuscarxFecha(FirstDate, LastDate);
        }
Ejemplo n.º 3
0
        //Método BuscarFecha que llama al método Buscar por Fecha
        //de la clase DVenta de la CapaDatos

        public static DataTable BuscarFechas(string textobuscar, string textobuscar2)
        {
            DVenta Obj = new DVenta();

            return(Obj.BuscarFechas(textobuscar, textobuscar2));
        }
Ejemplo n.º 4
0
        public static string InsertarPedidoDelivery(int?idCliente, int?idMesa, DateTime fecha, string estado, string formaPago, decimal descuento, int idTrabajador, string modo, int nroCaja,
                                                    string tipoCompr, decimal vuelto, string estadoD, DataTable dtDetalle, decimal total, decimal pagaCon,
                                                    string repartidor, decimal dctoInd, DataTable dtDetalleMenu, DateTime fechaEntrega, decimal adelanto,
                                                    int idTrabajador_Cobro, string obs, string motivo, string cliente, string telefono)
        {
            DVenta Obj = new DVenta();

            Obj.IdCliente          = idCliente;
            Obj.IdMesa             = idMesa;
            Obj.Fecha              = fecha;
            Obj.Estado             = estado;
            Obj.FormaPago          = formaPago;
            Obj.Descuento          = descuento;
            Obj.IdTrabajador       = idTrabajador;
            Obj.Modo               = modo;
            Obj.NroCaja            = nroCaja;
            Obj.FechaEntrega       = fechaEntrega;
            Obj.Adelanto           = adelanto;
            Obj.IdTrabajador_Cobro = idTrabajador_Cobro;
            Obj.Obs      = obs;
            Obj.Motivo   = motivo;
            Obj.Cliente  = cliente;
            Obj.Telefono = telefono;

            List <DDetalleVenta> detalles = new List <DDetalleVenta>();

            foreach (DataRow row in dtDetalle.Rows)
            {
                DDetalleVenta detalle = new DDetalleVenta();
                detalle.IdProducto  = Convert.ToInt32(row["Cod"].ToString());
                detalle.Cantidad    = Convert.ToInt32(row["Cant"].ToString());
                detalle.PrecioVenta = Convert.ToDecimal(row["Precio_Un"].ToString());
                detalle.Descuento   = Convert.ToDecimal(row["Descuento"].ToString());
                detalle.Nota        = row["Nota"].ToString();
                detalle.Tipo        = row["Tipo"].ToString();
                detalle.Barra       = row["Barra"].ToString();
                detalle.Estado      = row["Estado"].ToString();
                detalles.Add(detalle);
            }

            List <DDetalleVentaMenu> detallesMenu1 = new List <DDetalleVentaMenu>();

            foreach (DataRow row in dtDetalleMenu.Rows)
            {
                DDetalleVentaMenu detalleM = new DDetalleVentaMenu();
                detalleM.IdProducto = Convert.ToInt32(row["Cod"].ToString());
                detalleM.Cantidad   = Convert.ToInt32(row["Cant"].ToString());
                detalleM.Barra      = row["Barra"].ToString();

                detallesMenu1.Add(detalleM);
            }


            DDelivery Obj1 = new DDelivery();

            Obj1.TipoCompr  = tipoCompr;
            Obj1.Vuelto     = vuelto;
            Obj1.Estado     = estadoD;
            Obj1.Total      = total;
            Obj1.PagaCon    = pagaCon;
            Obj1.Repartidor = repartidor;
            Obj1.DctoInd    = dctoInd;

            return(Obj.InsertarPedidoDelivery(Obj, detalles, Obj1, detallesMenu1));
        }
Ejemplo n.º 5
0
        public static DataTable MostrarArticulo_Venta_Nombre(string textobuscar)
        {
            DVenta Obj = new DVenta();

            return(Obj.MostrarArticulo_Venta_Nombre(textobuscar));
        }
Ejemplo n.º 6
0
        public static DataTable reporteVentaCliente(DateTime fechaInicio, DateTime fechaFin, int idCliente)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteVentasCliente(fechaInicio, fechaFin, idCliente));
        }
Ejemplo n.º 7
0
        public static DataTable reporteVentaCaja(DateTime fechaInicio, DateTime fechaFin, int nroCaja)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteVentasCaja(fechaInicio, fechaFin, nroCaja));
        }
Ejemplo n.º 8
0
        public static DataTable BuscarReporteVentaFechas_TipoCompr(string textoBuscar, DateTime fechaInicio, DateTime fechaFin)
        {
            DVenta Obj = new DVenta();

            return(Obj.BuscarReporteVentasFecha_TipoCompr(textoBuscar, fechaInicio, fechaFin));
        }
Ejemplo n.º 9
0
        public static string EditarEstadoVentaCredito_Cortesia(string estado, int idVenta)
        {
            DVenta Obj = new DVenta();

            return(Obj.EditarEstadoVentaCredito_Cortesia(estado, idVenta));
        }
Ejemplo n.º 10
0
        public static DataTable Listar()
        {
            DVenta Datos = new DVenta();

            return(Datos.Listar());
        }
Ejemplo n.º 11
0
        private void GuardarVenta()
        {
            string tipocomprobante  = CbxTipoComprobante.SelectedValue.ToString();
            string ventaserie       = "####";
            string ventacorrelativo = "########";
            DVenta venta            = new DVenta();

            if (venta.ObtenerSerieCorrelativo(tipocomprobante) != null)
            {
                DataRow row = venta.ObtenerSerieCorrelativo(tipocomprobante);
                ventaserie       = row["Serie"].ToString();
                ventacorrelativo = row["Correlativo"].ToString();
            }
            Venta beVenta = new Venta
            {
                Cliente         = Convert.ToInt32(LblIDCliente.Text),
                Empleado        = FrmPrincipal.AccesoUsernameID,
                TipoComprobante = tipocomprobante,
                Serie           = ventaserie,
                Numero          = ventacorrelativo,
                Fecha           = Convert.ToDateTime(DateTime.Now),
                Hora            = Convert.ToDateTime(DateTime.Now),
                SubTotal        = Venta_SubTotal,
                Igv             = Venta_Igv,
                Total           = Venta_Total,
                Estado          = 1
            };
            DVenta boVenta = new DVenta();

            if (boVenta.Agregar(beVenta) == true)
            {
                if (MLVDetalle.Items.Count > 0)
                {
                    DDetalleVenta boDetalleVenta = new DDetalleVenta();
                    foreach (ListViewItem items in MLVDetalle.Items)
                    {
                        DetalleVenta beDetalleVenta = new DetalleVenta
                        {
                            Serie    = beVenta.Serie,
                            Numero   = beVenta.Numero,
                            Producto = items.SubItems[0].Text,
                            Precio   = Convert.ToDouble(items.SubItems[3].Text),
                            Cantidad = Convert.ToInt32(items.SubItems[4].Text),
                            Importe  = Convert.ToDouble(items.SubItems[5].Text)
                        };
                        //Agregar dettalle compra
                        if (boDetalleVenta.Agregar(beDetalleVenta) == true)
                        {
                            int    cantidadfinal      = 0;
                            double costounitariofinal = 0;
                            double costototalfinal    = 0;
                            //Obteniendo Ultimo Movimiento
                            DMovimiento boM   = new DMovimiento();
                            Movimiento  datos = boM.SeleccionarUltimoMovimientoProducto(beDetalleVenta.Producto);
                            if (!string.IsNullOrEmpty(datos.Producto))
                            {
                                //Si hay datos
                                cantidadfinal      = datos.CantidadFinal - beDetalleVenta.Cantidad;
                                costounitariofinal = datos.CostoUnitarioFinal;
                                double costofinaly = Math.Round((costounitariofinal * beDetalleVenta.Cantidad), 2);
                                costototalfinal = datos.CostoTotalFinal - costofinaly;
                                //Movimiento
                                Movimiento beMovimiento = new Movimiento
                                {
                                    Fecha                = DateTime.Now,
                                    TipoComprobante      = beVenta.TipoComprobante,
                                    Serie                = beVenta.Serie,
                                    Numero               = beVenta.Numero,
                                    TipoOperacion        = "01",
                                    Producto             = beDetalleVenta.Producto,
                                    CantidadEntrada      = 0,
                                    CostoUnitarioEntrada = 0,
                                    CostoTotalEntrada    = 0,

                                    CantidadSalida      = beDetalleVenta.Cantidad,
                                    CostoUnitarioSalida = costounitariofinal,
                                    CostoTotalSalida    = costofinaly,

                                    CantidadFinal      = cantidadfinal,
                                    CostoUnitarioFinal = costounitariofinal,
                                    CostoTotalFinal    = costototalfinal
                                };
                                DMovimiento boMovimiento = new DMovimiento();
                                if (boMovimiento.Agregar(beMovimiento) == true)
                                {
                                    Inventario beInventario = new Inventario
                                    {
                                        Producto        = beMovimiento.Producto,
                                        ValorUnitario   = beMovimiento.CostoUnitarioFinal,
                                        Existencias     = beMovimiento.CantidadFinal,
                                        ValorInventario = beMovimiento.CostoTotalFinal
                                    };
                                    DInventario boInventario = new DInventario();
                                    boInventario.Modificar(beInventario);
                                }
                            }
                        }
                    }
                }
                //message
                FrmVentas frm = Owner as FrmVentas;
                frm.Listar();
                Close();
                FrmPrincipal.Main.ChangeMessage("La Venta se ingreso correctamente", "Success");
            }
            else
            {
                FrmPrincipal.Main.ChangeMessage("Algo salio mal", "Failed");
            }
        }
Ejemplo n.º 12
0
        public static string Anular(int Id)
        {
            DVenta Datos = new DVenta();

            return(Datos.Anular(Id));
        }
Ejemplo n.º 13
0
        public static DataTable ListarDetalle(int Id)
        {
            DVenta Datos = new DVenta();

            return(Datos.ListarDetalle(Id));
        }
Ejemplo n.º 14
0
        public static DataTable Buscar(string Valor)
        {
            DVenta Datos = new DVenta();

            return(Datos.Buscar(Valor));
        }
Ejemplo n.º 15
0
        public static DataTable reporteVentaProducto(DateTime fechaInicio, DateTime fechaFin, int idProducto)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteVentasProducto(fechaInicio, fechaFin, idProducto));
        }
Ejemplo n.º 16
0
        public static DataTable reporteVentaFormaTrabajador(DateTime fechaInicio, DateTime fechaFin, string forma)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteVentasFecha_FormaPagTo(fechaInicio, fechaFin, forma));
        }
Ejemplo n.º 17
0
        public static DataTable reporteVentaInsumoCaja(DateTime fechaInicio, DateTime fechaFin, int idProducto, int nroCaja)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteVentasInsumoCaja(fechaInicio, fechaFin, idProducto, nroCaja));
        }
Ejemplo n.º 18
0
        public static DataTable reporteCantProductosVendidos(DateTime fechaInicio, DateTime fechaFin)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteCantProductosVendidos(fechaInicio, fechaFin));
        }
Ejemplo n.º 19
0
        public static DataTable reporteVentaTrabajador(DateTime fechaInicio, DateTime fechaFin, int idTrabajador)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteVentasUsuario(fechaInicio, fechaFin, idTrabajador));
        }
Ejemplo n.º 20
0
        public static DataTable mostrarClienteVenta(int idVenta)
        {
            DVenta Obj = new DVenta();

            return(Obj.mostrarClienteVenta(idVenta));
        }
Ejemplo n.º 21
0
        public static string InsertarPedidoPagadoR(int?idCliente, int?idMesa, DateTime fecha, string estado, string formaPago, decimal descuento, int idTrabajador, string modo, int nroCaja,
                                                   string tipoCompr, int serie, decimal igv, string estadoComp, decimal monto, decimal efectivo, decimal tarjeta, decimal redondeo,
                                                   DataTable dtDetalle, decimal vuelto, DataTable dtDetalleMenu, DateTime fechaEntrega, decimal adelanto,
                                                   int idTrabajador_Cobro, string obs, string motivo, string cliente, string telefono)
        {
            DVenta Obj = new DVenta();

            Obj.IdCliente          = idCliente;
            Obj.IdMesa             = idMesa;
            Obj.Fecha              = fecha;
            Obj.Estado             = estado;
            Obj.FormaPago          = formaPago;
            Obj.Descuento          = descuento;
            Obj.IdTrabajador       = idTrabajador;
            Obj.Modo               = modo;
            Obj.NroCaja            = nroCaja;
            Obj.FechaEntrega       = fechaEntrega;
            Obj.Adelanto           = adelanto;
            Obj.IdTrabajador_Cobro = idTrabajador_Cobro;
            Obj.Obs      = obs;
            Obj.Motivo   = motivo;
            Obj.Cliente  = cliente;
            Obj.Telefono = telefono;

            List <DDetalleVenta> detalles = new List <DDetalleVenta>();

            foreach (DataRow row in dtDetalle.Rows)
            {
                DDetalleVenta detalle = new DDetalleVenta();
                detalle.IdProducto  = Convert.ToInt32(row["Cod"].ToString());
                detalle.Cantidad    = Convert.ToInt32(row["Cant"].ToString());
                detalle.PrecioVenta = Convert.ToDecimal(row["Precio_Un"].ToString());
                detalle.Descuento   = Convert.ToDecimal(row["Descuento"].ToString());
                detalle.Nota        = row["Nota"].ToString();
                detalle.Tipo        = row["Tipo"].ToString();
                detalle.Barra       = row["Barra"].ToString();
                detalle.Estado      = "Reservada";

                detalles.Add(detalle);
            }

            List <DDetalleVentaMenu> detallesMenu = new List <DDetalleVentaMenu>();

            foreach (DataRow row in dtDetalleMenu.Rows)
            {
                DDetalleVentaMenu detalleM = new DDetalleVentaMenu();
                detalleM.IdProducto = Convert.ToInt32(row["Cod"].ToString());
                detalleM.Cantidad   = Convert.ToInt32(row["Cant"].ToString());
                detalleM.Barra      = row["Barra"].ToString();
                detallesMenu.Add(detalleM);
            }

            DComprobante Obj1 = new DComprobante();

            Obj1.TipoComprobante = tipoCompr;
            Obj1.Serie           = serie;
            Obj1.Igv             = igv;
            Obj1.Fecha           = fecha;
            Obj1.Estado          = estadoComp;
            Obj1.IdCliente       = idCliente;
            Obj1.Monto           = monto;
            Obj1.Efectivo        = efectivo;
            Obj1.Tarjeta         = tarjeta;
            Obj1.Redondeo        = redondeo;
            Obj1.FormaPago       = formaPago;
            Obj1.Vuelto          = vuelto;

            return(Obj.InsertarPedido_Pagado(Obj, detalles, Obj1, detallesMenu));
        }
Ejemplo n.º 22
0
        public static DataTable mostrarDetallePedido(int idVenta)
        {
            DVenta Obj = new DVenta();

            return(Obj.MostrarDetallePedido(idVenta));
        }
Ejemplo n.º 23
0
        public static DataTable reporteVentaFechas_TipoComprobante(DateTime fechaInicio, DateTime fechaFin, string tipo)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteVentasFecha_TipoComprobante(fechaInicio, fechaFin, tipo));
        }
Ejemplo n.º 24
0
        public static DataTable mostrarDetalleVenta_SepararCuenta(int idVenta)
        {
            DVenta Obj = new DVenta();

            return(Obj.MostrarDetalleVenta_SepararCuenta(idVenta));
        }
Ejemplo n.º 25
0
        public void Listar()
        {
            DVenta bo = new DVenta();

            DgvVenta.DataSource = bo.Listar();
        }
Ejemplo n.º 26
0
        //REPORTES

        public static DataTable reporteVentaFechas(DateTime fechaInicio, DateTime fechaFin)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteVentasFecha(fechaInicio, fechaFin));
        }
Ejemplo n.º 27
0
        public static DataTable MostrarProducto_Venta_Codigo(string textobuscar)
        {
            DVenta Obj = new DVenta();

            return(Obj.MostrarProducto_Venta_codigo(textobuscar));
        }
Ejemplo n.º 28
0
        public static DataTable reporteDetalleVenta(int idVenta)
        {
            DVenta Obj = new DVenta();

            return(Obj.reporteDetalleVenta(idVenta));
        }
Ejemplo n.º 29
0
        public static DataTable MostrarDetalle(string textobuscar)
        {
            DVenta Obj = new DVenta();

            return(Obj.MostrarDetalle(textobuscar));
        }
Ejemplo n.º 30
0
        public static DataTable mostrarTotalCreditoVentaCliente(int idPersona)
        {
            DVenta Obj = new DVenta();

            return(Obj.MostrarTotalCreditoVentaCliente(idPersona));
        }