protected override void DeleteLineAction()
        {
            if (Lines_BS.Current == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                if (Concepto.OidPedido == 0)
                {
                    PgMng.Reset(4, 1, Store.Resources.Messages.UPDATING_STOCK, this);

                    if (Concepto.OidPartida != 0)
                    {
                        BatchInfo partida = BatchInfo.Get(Concepto.OidPartida, true);
                        PgMng.Grow();

                        if (partida.IsKit)
                        {
                            DeleteKit(partida);
                        }
                        PgMng.Grow();
                    }

                    _entity.Conceptos.Remove(Concepto, true);
                    _entity.CalculateTotal();
                    PgMng.Grow();
                }
                else
                {
                    long oidPedido = Concepto.OidPedido;

                    _entity.Conceptos.Remove(Concepto, true);
                    _entity.CalculateTotal();

                    bool free_pedido = true;

                    foreach (OutputDeliveryLine item in _entity.Conceptos)
                    {
                        if (item.OidPedido == Concepto.OidPedido)
                        {
                            free_pedido = false;
                        }
                    }

                    //Actualizamos la lista de pedidos disponibles
                    if (free_pedido)
                    {
                        _pedidos.AddItem(_pedidos_cliente.GetItem(oidPedido));
                    }
                }

                ControlsMng.UpdateBinding(Lines_BS);
                ControlsMng.UpdateBinding(Datos);
                PgMng.FillUp();
            }

            Serie_BT.Enabled = (_entity.Conceptos.Count > 0);
        }
        private bool CheckStock()
        {
            ProductInfo producto = ProductInfo.Get(_entity.OidProducto);

            if (producto.AvisarStock)
            {
                BatchInfo partida = BatchInfo.Get(_entity.OidPartida, false);

                if (!partida.CheckStock(_entity, producto))
                {
                    DialogResult result = PgMng.ShowWarningException(Resources.Messages.AVISO_STOCK_MINIMO);

                    if (result == DialogResult.Yes)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(true);
            }
        }
        protected override void EliminarConceptoAction()
        {
            if (Datos_Concepto.Current == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                PgMng.Reset(5, 1, Store.Resources.Messages.UPDATING_STOCK, this);

                BatchInfo pexp = BatchInfo.Get(Line.OidPartida, true);
                PgMng.Grow();

                if (pexp.IsKit)
                {
                    DeleteKit(pexp);
                }
                PgMng.Grow();

                _entity.Conceptos.Remove(Line);
                _entity.CalculaTotal();
                PgMng.Grow();

                RefreshConceptos();
                ControlsMng.UpdateBinding(Datos);
                PgMng.FillUp();
            }

            Serie_BT.Enabled = (_entity.Conceptos.Count > 0);
        }
        protected override void DeleteLineaAction()
        {
            if (Lineas_DGW.CurrentRow.DataBoundItem == null)
            {
                return;
            }
            LineaPedido item = (LineaPedido)Lineas_DGW.CurrentRow.DataBoundItem;

            if (item == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                PgMng.Reset(4, 1, Store.Resources.Messages.UPDATING_STOCK, this);

                BatchInfo partida = BatchInfo.Get(item.OidPartida, true);
                PgMng.Grow();

                if (partida.IsKit)
                {
                    DeleteKit(partida);
                }
                PgMng.Grow();

                _entity.Lineas.Remove(item, _entity);

                ControlsMng.UpdateBinding(Datos_Lineas);
                ControlsMng.UpdateBinding(Datos);
                PgMng.FillUp();
            }
        }
Example #5
0
        protected override void DeleteLineAction()
        {
            if (Lines_BS.Current == null)
            {
                return;
            }

            if (PgMng.ShowDeleteConfirmation() == DialogResult.Yes)
            {
                if (Line.OidPedido == 0)
                {
                    PgMng.Reset(4, 1, Resources.Messages.UPDATING_STOCK, this);

                    BatchInfo partida = BatchInfo.Get(Line.OidPartida, true);
                    PgMng.Grow();

                    if (partida.IsKit)
                    {
                        DeleteKit(partida);
                    }
                    PgMng.Grow();

                    _entity.Conceptos.Remove(Line, true);
                    _entity.CalculateTotal();
                    PgMng.Grow();
                }
                else
                {
                    long oidPedido = Line.OidPedido;

                    _entity.Conceptos.Remove(Line, true);
                    _entity.CalculateTotal();

                    bool free_pedido = true;

                    foreach (InputDeliveryLine item in _entity.Conceptos)
                    {
                        if (item.OidPedido == Line.OidPedido)
                        {
                            free_pedido = false;
                        }
                    }

                    //Actualizamos la lista de pedidos disponibles
                    if (free_pedido)
                    {
                        _orders.AddItem(_provider_orders.GetItem(oidPedido));
                    }
                }


                ControlsMng.UpdateBinding(Lines_BS);
                ControlsMng.UpdateBinding(Datos);
                PgMng.FillUp();
            }

            Serie_BT.Enabled = (_entity.Conceptos.Count == 0);
        }
        protected override void RefreshMainData()
        {
            if (_entity == null)
            {
                return;
            }

            Datos.DataSource = _entity;

            _product = ProductInfo.Get(_entity.OidProducto, false);
            PgMng.Grow();

            switch (_product_type)
            {
            case ETipoProducto.Almacen:
            {
                BatchList lista;

                if (_delivery.Rectificativo)
                {
                    lista = BatchList.GetListBySerie(_serie.Oid, false, true);
                }
                else
                {
                    lista = BatchList.GetListBySerieAndStock(_serie.Oid, false, true);
                }

                _batch = lista.GetItem(_entity.OidPartida);

                //Caso extraño de que se vaya a modificar un concepto de un producto con stock 0
                if (_batch == null)
                {
                    _batch = BatchInfo.Get(_entity.OidPartida, false);
                }

                Batch_BS.DataSource = _batch;

                _batch.StockBultos += _entity.CantidadBultos;
                _batch.StockKilos  += _entity.CantidadKilos;
                PgMng.Grow();
            }
            break;

            case ETipoProducto.Libres:
            {
                _batch = null;

                Products_BS.DataSource = _product;
                PgMng.Grow();
            }
            break;
            }

            base.RefreshMainData();

            EnableKilos();
        }
        protected override void UpdateDeliveryAction()
        {
            OutputDeliveryLine item     = Lines_BS.Current as OutputDeliveryLine;
            ProductInfo        producto = ProductInfo.Get(item.OidProducto, false, false);
            BatchInfo          partida  = BatchInfo.Get(item.OidPartida, false, false);

            item.AjustaCantidad(producto, (partida.Oid == 0) ? null : partida);
            _entity.CalculateTotal();

            ControlsMng.UpdateBinding(Lines_BS);
        }
Example #8
0
        protected override void RefreshMainData()
        {
            if (_entity == null)
            {
                return;
            }

            Datos.DataSource = _entity;

            _producto = ProductInfo.Get(_entity.OidProducto, false);
            PgMng.Grow();

            switch (_tipo)
            {
            case ETipoProducto.Almacen:
            {
                BatchList lista;

                lista = BatchList.GetListBySerieAndStock(_serie.Oid, false, true);

                _partida = lista.GetItem(_entity.OidPartida);

                //Caso extraño de que se vaya a modificar un concepto de un producto con stock 0
                if (_partida == null)
                {
                    _partida = BatchInfo.Get(_entity.OidPartida, false);
                }

                Datos_Partida.DataSource = _partida;

                _partida.StockBultos += _entity.CantidadBultos;
                _partida.StockKilos  += _entity.CantidadKilos;
                PgMng.Grow();
            }
            break;

            case ETipoProducto.Libres:
            {
                _partida = null;

                Datos_Productos.DataSource = _producto;
                PgMng.Grow();
            }
            break;
            }

            base.RefreshMainData();

            EnableKilos();
        }
        protected override void UpdateInvoiceAction()
        {
            try
            {
                OutputInvoiceLine item     = Lines_DGW.CurrentRow.DataBoundItem as OutputInvoiceLine;
                BatchInfo         batch    = BatchInfo.Get(item.OidPartida, false, true);
                ProductInfo       producto = ProductInfo.Get(item.OidProducto, false, false);

                item.AjustaCantidad(producto, batch);
                _entity.CalculateTotal();

                ControlsMng.UpdateBinding(Lines_BS);
            }
            catch { }
        }