protected bool ValidateAllocation()
        {
            if (_entity.EMedioPago == EMedioPago.CompensacionFactura)
            {
                decimal importe = 0;

                Expenses_BS.MoveFirst();
                foreach (DataGridViewRow row in Lineas_DGW.Rows)
                {
                    InputInvoiceInfo item = row.DataBoundItem as InputInvoiceInfo;

                    if (item.Vinculado == Library.Store.Resources.Labels.RESET_PAGO)
                    {
                        importe += item.Asignado;
                    }

                    Expenses_BS.MoveNext();
                }

                if (importe != 0)
                {
                    PgMng.ShowInfoException(Resources.Messages.IMPORTE_PAGO_COMPENSACION);

                    _action_result = DialogResult.Ignore;
                    return(false);
                }
            }
            else
            {
                if (_entity.Pendiente == 0)
                {
                    return(true);
                }

                if (_entity.Importe < 0)
                {
                    if (_no_asignado < _entity.Pendiente)
                    {
                        PgMng.ShowInfoException(string.Format("La asignaciĆ³n {0:C2} es inferior a la cantidad pendiente en el cobro {1:C2}.", _no_asignado, _entity.Pendiente));

                        _action_result = DialogResult.Ignore;
                        return(false);
                    }
                }
                else
                {
                    if (_no_asignado > _entity.Pendiente)
                    {
                        PgMng.ShowInfoException(string.Format("La asignaciĆ³n {0:C2} es superior a la cantidad pendiente en el cobro {1:C2}.", _no_asignado, _entity.Pendiente));

                        _action_result = DialogResult.Ignore;
                        return(false);
                    }
                }
            }

            return(true);
        }
        protected override void UpdateExpensesList()
        {
            ExpensesInvoices_BS.RaiseListChangedEvents = false;
            Expenses_BS.RaiseListChangedEvents         = false;

            ExpensesInvoices_BS.DataSource = _entity.Facturas;
            Expenses_BS.DataSource         = Expenses.GetListAgrupada(_entity.Gastos.GetSubListOtrosGastos());

            ExpensesInvoices_BS.RaiseListChangedEvents = true;
            Expenses_BS.RaiseListChangedEvents         = true;

            ExpensesInvoices_BS.ResetBindings(true);
            ExpensesInvoices_DGW.Refresh();

            Expenses_BS.ResetBindings(true);
            Expenses_DGW.Refresh();
        }
        protected override void EditLineAllocationAction(DataGridViewRow row)
        {
            InputDecimalForm form = new InputDecimalForm();

            form.Message = Resources.Labels.IMPORTE_PAGO_GASTO;

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ExpenseInfo item = row.DataBoundItem as ExpenseInfo;

                _no_asignado += item.Asignado;

                _entity.EditTransactionPayment(item, form.Value);

                LinkLineAction(row);
                SetUnlinkedGridValues(Lineas_DGW.Name);
                Expenses_BS.ResetBindings(false);
                SetGridColors(Lineas_DGW);
            }
        }