Example #1
0
        private void BuscarOrden()
        {
            DetalleCompraBL ObjetoDetalle = new DetalleCompraBL();
            ComprasBL       ObjetoFactura = new ComprasBL();
            Int64           ID;

            if (txtReferencia.Text != String.Empty)
            {
                //Obtenemos el ID del Documento por medio del numero de documento
                ID = Convert.ToInt64(txtReferencia.Text);

                //Buscamos la cotizacion que tiene este numero de documento
                cCompras Factura = ObjetoFactura.BuscarPorID(ID, "O");
                //Verificamos que obtuvimos algun resultado
                if (Int64.TryParse(Factura.ID.ToString(), out ID))
                {
                    //Guardamos el ID de la FacturA
                    Int64 CompraID = Factura.ID;
                    //Asignamos los datos del cliente que se encuentra en la cotizacion
                    BuscarProveedor(Convert.ToInt32(Factura.ProveedorID));

                    //Buscamos la lista de Articulos que se encuentran en la cotizacion
                    List <cDetalleCompra> ListaDetalle = ObjetoDetalle.ListarDetalle(CompraID, "O");

                    //Objeto Inventario para realizar operaciones
                    InventarioBL ObjetoInventario = new InventarioBL();
                    foreach (cDetalleCompra Detalle in ListaDetalle)
                    {
                        cInventario Articulo = ObjetoInventario.BuscarPorID(Detalle.ArticuloID);
                        //Insertamos los articulos en el DataGrid
                        InsertarLineaGrid(Detalle.ArticuloID,
                                          Articulo.CodigoArticulo,
                                          Articulo.Descripcion,
                                          Detalle.Cantidad,
                                          Detalle.Precio,
                                          Detalle.ImpuestoValor,
                                          (Detalle.ImpuestoValor / 100) * Detalle.Precio,
                                          //Detalle.DescuentoValor,
                                          //(Detalle.DescuentoValor / 100) * Detalle.Precio,
                                          ((Detalle.Cantidad * Detalle.Precio) + ((Detalle.ImpuestoValor / 100) * Detalle.Precio)),
                                          //Detalle.Costo,
                                          Detalle.UnidadCompraID,
                                          Detalle.TipoProducto);
                    }
                }
            }
        }
Example #2
0
        private void InsertarDetalle(Int32 CompraID)
        {
            //Obtenemos el detalle de las facturas creadas.

            List <cDetalleCompra> ListaDetalleCompra = new List <cDetalleCompra>();

            foreach (DataGridViewRow row in dgvDetalleFactura.Rows)
            {
                cDetalleCompra Detalle = new cDetalleCompra();
                Detalle.CompraID       = CompraID;
                Detalle.TipoDocumento  = "R";
                Detalle.ArticuloID     = Convert.ToInt32(row.Cells[0].Value);
                Detalle.Precio         = Convert.ToDecimal(row.Cells[4].Value);
                Detalle.Cantidad       = Convert.ToDecimal(row.Cells[3].Value);
                Detalle.ImpuestoValor  = Convert.ToDecimal(row.Cells[5].Value);
                Detalle.UnidadCompraID = Convert.ToInt32(row.Cells[8].Value);
                Detalle.TipoProducto   = row.Cells[9].Value.ToString();

                ListaDetalleCompra.Add(Detalle);
            }
            DetalleCompraBL ObjetoDetalleCompra = new DetalleCompraBL();

            ObjetoDetalleCompra.Crear(ListaDetalleCompra);
        }
Example #3
0
        private void BuscarArticulo(String CodigoArticulo)
        {
            try
            {
                DetalleCompraBL ObjetoDetalle = new DetalleCompraBL();

                //Buscamos el articulo en el inventario por su codigo de articulo
                List <cDetalleCompra> ListaArticulos = ObjetoDetalle.ListarDetalleDevolucion(CodigoArticulo, ObtenerDocumentoReferencia());
                //Verificamos el resultado de la busqueda
                //Int32 IX;
                if (ListaArticulos.Count > 0)
                {
                    if (ValidacionArticuloAgregado(CodigoArticulo))
                    {
                        LimpiarCampos();
                        throw new Exception("El articulo ya existe en la factura, favor revisar y volver a intentarlo");
                    }
                    else
                    {
                        //Mostramos los valores del resultado a los controles indicador en el formulario
                        MostrarResultados(ListaArticulos);
                    }
                }
                else
                {
                    //Si el resultado es nulo entonces arrojamos el mensaje de error y limpiamos los campos
                    MessageBox.Show("El articulo digitado no puedo se encontrado, vuelva a intentarlo", "Error en busqueda", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    LimpiarCampos();
                    txtCodigo.Focus();
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Error en la busqueda", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        private void BuscarRecepcion()
        {
            DetalleCompraBL ObjetoDetalle   = new DetalleCompraBL();
            ComprasBL       ObjetoFactura   = new ComprasBL();
            ProveedorBL     ObjetoProveedor = new ProveedorBL();

            Int64 ID;

            if (txtReferencia.Text != String.Empty)
            {
                //Obtenemos el ID del Documento por medio del numero de documento
                ID = Convert.ToInt64(txtReferencia.Text);

                //Buscamos la cotizacion que tiene este numero de documento
                cCompras Factura = ObjetoFactura.BuscarPorID(ID, "R");
                //Verificamos que obtuvimos algun resultado
                if (Int64.TryParse(Factura.ID.ToString(), out ID))
                {
                    //Validamos que la recepcion no tenga el estatus de devuelta
                    if (Factura.EstatusID.ToString() == "O")
                    {
                        //Guardamos el ID de la FacturA
                        Int64 FacturaID   = Factura.ID;
                        Int32 ProveedorID = Convert.ToInt32(Factura.ProveedorID);

                        //Asignamos los datos del cliente que se encuentra en la cotizacion
                        AsignarDatosProveedor(ObjetoProveedor.BuscarPorID(ProveedorID));

                        //Buscamos la lista de Articulos que se encuentran en la cotizacion
                        List <cDetalleCompra> ListaDetalle = ObjetoDetalle.ListarDetalle(FacturaID, "R");

                        //Objeto Inventario para realizar operaciones
                        InventarioBL ObjetoInventario = new InventarioBL();
                        foreach (cDetalleCompra Detalle in ListaDetalle)
                        {
                            cInventario Articulo = ObjetoInventario.BuscarPorID(Detalle.ArticuloID);

                            //Insertamos los articulos en el DataGrid
                            InsertarLineaGrid(Detalle.ArticuloID,
                                              Articulo.CodigoArticulo,
                                              Articulo.Descripcion,
                                              Detalle.Cantidad,
                                              Detalle.Precio,
                                              Detalle.ImpuestoValor,
                                              (Detalle.ImpuestoValor / 100) * Detalle.Precio,
                                              ((Detalle.Cantidad * Detalle.Precio) + ((Detalle.ImpuestoValor / 100) * Detalle.Precio)),
                                              Detalle.UnidadCompraID,
                                              Detalle.TipoProducto);
                        }
                    }
                    else
                    {
                        //Documento Cancelado
                        if (Factura.EstatusID.ToString() == "C")
                        {
                            MessageBox.Show("El documento se encuentra Cancelado, Operacion invalida", "Error en busqueda de recepcion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        //Documento Devuelto
                        else if (Factura.EstatusID.ToString() == "D")
                        {
                            MessageBox.Show("El documento ya fue devuelto, Operacion Invalida", "Error en busqueda de recepcion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }