Esempio n. 1
0
        public static string Anular(int idIngreso)
        {
            DCompra Obj = new DCompra();

            Obj.IdIngreso = idIngreso;
            return(Obj.Anular(Obj));
        }
Esempio n. 2
0
        public static string Insertar(int idUsuario, int idProveedor, DateTime fechaIngreso, string tipoComprobante, string serie, string correlativo, decimal igv, string formaPago, string tipoMoneda, string estado, decimal total, DataTable dtDetalle)
        {
            DCompra Obj = new DCompra();

            Obj.IdUsuario       = idUsuario;
            Obj.IdProveedor     = idProveedor;
            Obj.FechaIngreso    = fechaIngreso;
            Obj.TipoComprobante = tipoComprobante;
            Obj.Serie           = serie;
            Obj.Correlativo     = correlativo;
            Obj.Igv             = igv;
            Obj.FormaPago       = formaPago;
            Obj.TipoMoneda      = tipoMoneda;
            Obj.Estado          = estado;
            Obj.Total           = total;

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

            foreach (DataRow row in dtDetalle.Rows)
            {
                DDetalleCompra detalle = new DDetalleCompra();
                detalle.IdProducto   = Convert.ToInt32(row["Codigo"].ToString());
                detalle.Cantidad     = Convert.ToDecimal(row["Cantidad"].ToString());
                detalle.PrecioCompra = Convert.ToDecimal(row["Precio_Unitario"].ToString());
                detalle.PrecioVenta  = Convert.ToDecimal(row["Precio_Venta"].ToString());
                detalle.Tipo         = row["Tipo"].ToString();
                detalles.Add(detalle);
            }
            return(Obj.Insertar(Obj, detalles));
        }
Esempio n. 3
0
        public static string Insertar(int Id_Empleado, int Id_Proveedor, DateTime Fecha, int CodFactura, decimal Iva, int correlativo, string Estado, DataTable dtDetalles)
        {
            DCompra Obj = new DCompra();

            Obj.Id_Empleado  = Id_Empleado;
            Obj.Id_Proveedor = Id_Proveedor;
            Obj.Fecha_Hora   = Fecha;
            Obj.Cod_Factura  = CodFactura;
            Obj.Iva          = Iva;
            Obj.Correlativo  = correlativo;
            Obj.Estado       = Estado;
            List <DDetalleCompra> detalles = new List <DDetalleCompra>();

            foreach (DataRow row in dtDetalles.Rows)
            {
                DDetalleCompra detalle = new DDetalleCompra();
                detalle.Id_Producto   = Convert.ToInt32(row["Id_Producto"].ToString());
                detalle.Precio_Compra = Convert.ToDecimal(row["Precio_Compra"].ToString());
                detalle.Precio_Venta  = Convert.ToDecimal(row["Precio_Venta"].ToString());
                detalle.Stock_Inicial = Convert.ToInt32(row["Stock_Inicial"].ToString());
                detalle.Stock_Actual  = Convert.ToInt32(row["Stock_Inicial"].ToString());
                detalles.Add(detalle);
            }
            return(Obj.Insertar(Obj, detalles));
        }
Esempio n. 4
0
        public static string Anular(int Id_Compra)
        {
            DCompra Obj = new DCompra();

            Obj.Id_Compra = Id_Compra;
            return(Obj.Anular(Obj));
        }
Esempio n. 5
0
        public static string Insertar(int idUsuario, int idProveedor, DateTime fechaIngreso, string tipoComprobante, string serie, string correlativo, decimal igv, string formaPago,
                                      string tipoMoneda, string estado, decimal total, DataTable dtDetalle, decimal adelanto, decimal descuento, decimal flete, decimal comisiones, decimal lavadoJaba,
                                      decimal gastoCarga, decimal saldo, decimal merma)
        {
            DCompra Obj = new DCompra();

            Obj.IdUsuario       = idUsuario;
            Obj.IdProveedor     = idProveedor;
            Obj.FechaIngreso    = fechaIngreso;
            Obj.TipoComprobante = tipoComprobante;
            Obj.Serie           = serie;
            Obj.Correlativo     = correlativo;
            Obj.Igv             = igv;
            Obj.FormaPago       = formaPago;
            Obj.TipoMoneda      = tipoMoneda;
            Obj.Estado          = estado;
            Obj.Total           = total;
            Obj.Adelanto        = adelanto;
            Obj.Descuento       = descuento;
            Obj.Flete           = flete;
            Obj.Comisiones      = comisiones;
            Obj.LavadoJaba      = lavadoJaba;
            Obj.GastoCarga      = gastoCarga;
            Obj.Saldo           = saldo;
            Obj.Merma           = merma;

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

            foreach (DataRow row in dtDetalle.Rows)
            {
                DDetalleCompra detalle = new DDetalleCompra();
                detalle.IdProducto      = Convert.ToInt32(row["Codigo"].ToString());
                detalle.Cantidad        = Convert.ToDecimal(row["Cantidad"].ToString());
                detalle.PrecioCompra    = Convert.ToDecimal(row["Costo_Uni"].ToString());
                detalle.CantXJabas      = Convert.ToInt32(row["CantxJaba"].ToString());
                detalle.NroJabas        = Convert.ToInt32(row["NroJabas"].ToString());
                detalle.PesoJabasVacias = Convert.ToDecimal(row["PJabaVacia"].ToString());
                detalle.Tipo            = row["Tipo"].ToString();
                detalle.PVxMenor        = Convert.ToDecimal(row["PVxMenor"].ToString());
                detalle.PVxMayor        = Convert.ToDecimal(row["PVxMayor"].ToString());
                detalle.PV3             = Convert.ToDecimal(row["PV3"].ToString());
                detalle.PV4             = Convert.ToDecimal(row["PV4"].ToString());
                detalle.PV4             = Convert.ToDecimal(row["PV4"].ToString());
                detalle.PV5             = Convert.ToDecimal(row["PV5"].ToString());
                detalle.NroUnidades     = Convert.ToDecimal(row["NroUnidades"].ToString());
                detalles.Add(detalle);
            }
            return(Obj.Insertar(Obj, detalles));
        }
Esempio n. 6
0
        private void CargarDatos()
        {
            DCompra venta = new DCompra();
            DataRow row   = venta.SeleccionarCompra(Serie, Numero);

            if (row != null)
            {
                TxtTipoComprobante.Text = row["Tipo"].ToString();
                TxtSerie.Text           = row["Serie"].ToString();
                TxtNumero.Text          = row["Numero"].ToString();
                TxtFecha.Text           = Convert.ToDateTime(row["Fecha"]).ToString("dd/MM/yyyy");
                TxtRucProveedor.Text    = row["RUC"].ToString();
                TxtRazonSocial.Text     = row["RazonSocial"].ToString();
                TxtPEmail.Text          = row["Email"].ToString();
                TxtPTelefono.Text       = row["Telefono"].ToString();
                TxtNDEmpleado.Text      = row["NDE"].ToString();
                TxtNEmpleado.Text       = row["ENombre"].ToString() + " " + row["EApellido"].ToString();
                RLblSubTotal.Text       = "S/. " + row["SubTotal"].ToString();
                RLblIgv.Text            = "S/. " + row["Igv"].ToString();
                RLblTotal.Text          = "S/. " + row["Total"].ToString();
            }
        }
Esempio n. 7
0
        public static string Eliminar(int idIngreso)
        {
            DCompra Obj = new DCompra();

            return(Obj.Eliminar(idIngreso));
        }
Esempio n. 8
0
        public static DataTable BuscarFechas(string TextoBuscar, string TextoBuscar2)
        {
            DCompra Obj = new DCompra();

            return(Obj.BuscarFechas(TextoBuscar, TextoBuscar2));
        }
Esempio n. 9
0
        public static DataTable MostrarDetalle(string TextoBuscar)
        {
            DCompra Obj = new DCompra();

            return(Obj.MostrarDetalle(TextoBuscar));
        }
Esempio n. 10
0
        public static DataTable reporteCompraProveedor(DateTime fechaInicio, DateTime fechaFin, int idProveedor)
        {
            DCompra Obj = new DCompra();

            return(Obj.reporteComprasProveedor(fechaInicio, fechaFin, idProveedor));
        }
Esempio n. 11
0
        private void BuscarxFecha(DateTime FirstDate, DateTime LastDate)
        {
            DCompra bo = new DCompra();

            DgvCompra.DataSource = bo.BuscarxFecha(FirstDate, LastDate);
        }
Esempio n. 12
0
        private void GuardarCompra()
        {
            Compra beCompra = new Compra
            {
                Proveedor       = Convert.ToInt32(LblIDProveedor.Text),
                Empleado        = FrmPrincipal.AccesoUsernameID,
                TipoComprobante = CbxTipoComprobante.SelectedValue.ToString(),
                Serie           = TxtSerie.Text,
                Numero          = TxtNumero.Text,
                Fecha           = Convert.ToDateTime(DtpFecha.Text),
                SubTotal        = Compra_SubTotal,
                Igv             = Compra_Igv,
                Total           = Compra_Total,
                Estado          = 1
            };
            DCompra boCompra = new DCompra();

            if (boCompra.Agregar(beCompra) == true)
            {
                if (MLVDetalle.Items.Count > 0)
                {
                    DDetalleCompra boDetalleCompra = new DDetalleCompra();
                    foreach (ListViewItem items in MLVDetalle.Items)
                    {
                        DetalleCompra beDetalleCompra = new DetalleCompra
                        {
                            Serie          = beCompra.Serie,
                            Numero         = beCompra.Numero,
                            Producto       = items.SubItems[0].Text,
                            PrecioUnitario = Convert.ToDouble(items.SubItems[3].Text),
                            Cantidad       = Convert.ToInt32(items.SubItems[4].Text),
                            PrecioTotal    = Convert.ToDouble(items.SubItems[5].Text)
                        };
                        //Agregar dettalle compra
                        if (boDetalleCompra.Agregar(beDetalleCompra) == true)
                        {
                            int    cantidadfinal      = 0;
                            double costounitariofinal = 0;
                            double costototalfinal    = 0;
                            //Obteniendo Ultimo Movimiento
                            DMovimiento boM   = new DMovimiento();
                            Movimiento  datos = boM.SeleccionarUltimoMovimientoProducto(beDetalleCompra.Producto);
                            if (string.IsNullOrEmpty(datos.Producto))
                            {
                                cantidadfinal      = beDetalleCompra.Cantidad;
                                costounitariofinal = beDetalleCompra.PrecioUnitario;
                                costototalfinal    = beDetalleCompra.PrecioTotal;
                            }
                            else
                            {
                                //Si hay datos
                                cantidadfinal      = datos.CantidadFinal + beDetalleCompra.Cantidad;
                                costototalfinal    = datos.CostoTotalFinal + beDetalleCompra.PrecioTotal;
                                costounitariofinal = Math.Round((costototalfinal / cantidadfinal), 2);
                            }
                            Movimiento beMovimiento = new Movimiento
                            {
                                Fecha                = DateTime.Now,
                                TipoComprobante      = beCompra.TipoComprobante,
                                Serie                = beCompra.Serie,
                                Numero               = beCompra.Numero,
                                TipoOperacion        = "02",
                                Producto             = beDetalleCompra.Producto,
                                CantidadEntrada      = beDetalleCompra.Cantidad,
                                CostoUnitarioEntrada = beDetalleCompra.PrecioUnitario,
                                CostoTotalEntrada    = beDetalleCompra.PrecioTotal,
                                CantidadSalida       = 0,
                                CostoUnitarioSalida  = 0,
                                CostoTotalSalida     = 0,
                                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
                FrmCompras frm = Owner as FrmCompras;
                frm.Listar();
                Close();
                FrmPrincipal.Main.ChangeMessage("La Compra se ingreso correctamente", "Success");
            }
            else
            {
                FrmPrincipal.Main.ChangeMessage("Algo salio mal", "Failed");
            }
        }
Esempio n. 13
0
        public static DataTable mostrarDetalleIngreso(int textoBuscar)
        {
            DCompra Obj = new DCompra();

            return(Obj.MostrarDetalleIngreso(textoBuscar));
        }
Esempio n. 14
0
        public static string EditarStcok(int idProducto, decimal kgs, decimal nroUnidades)
        {
            DCompra Obj = new DCompra();

            return(Obj.EditarStockCompra(idProducto, kgs, nroUnidades));
        }
Esempio n. 15
0
        public void Listar()
        {
            DCompra bo = new DCompra();

            DgvCompra.DataSource = bo.Listar();
        }
Esempio n. 16
0
        public static DataTable imprimirDetalleCompra(int idCompra)
        {
            DCompra Obj = new DCompra();

            return(Obj.imprimirCompraDetalle(idCompra));
        }
Esempio n. 17
0
        public static DataTable mostrarGastoCompra(int idCompra)
        {
            DCompra Obj = new DCompra();

            return(Obj.mostrarGastoCompra(idCompra));
        }
Esempio n. 18
0
        public static DataTable mostrarTransporteGasto(int idCompra)
        {
            DCompra Obj = new DCompra();

            return(Obj.mostrarTransporteCompra(idCompra));
        }