protected void SetTipo()
        {
            CashLine item = Lines_DGW.CurrentRow.DataBoundItem as CashLine;

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            if (_linea_libre)
            {
                ETipoLineaCaja[] list = { ETipoLineaCaja.SalidaPorIngreso, ETipoLineaCaja.EntradaPorTraspaso, ETipoLineaCaja.EntradaPorTarjetaCredito, ETipoLineaCaja.Otros };
                form.SetDataSource(Library.Invoice.EnumText <ETipoLineaCaja> .GetList(list));
            }
            else
            {
                ETipoLineaCaja[] list = { ETipoLineaCaja.SalidaPorIngreso, ETipoLineaCaja.EntradaPorTraspaso, ETipoLineaCaja.EntradaPorTarjetaCredito };
                form.SetDataSource(Library.Invoice.EnumText <ETipoLineaCaja> .GetList(list));
            }

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource tipo = form.Selected as ComboBoxSource;
                item.ETipoLinea = (ETipoLineaCaja)tipo.Oid;

                SetRowFormat(Lines_DGW.CurrentRow);

                Lines_BS.ResetBindings(false);
            }
        }
        protected override void DeleteDeliveryAction()
        {
            if (Entity.AlbaranFacturas.Count == 0)
            {
                return;
            }

            DeliverySelectForm form = new DeliverySelectForm(this, ETipoEntidad.Cliente, OutputDeliveryList.GetList(_out_deliveries));

            form.ShowDialog(this);

            if (form.DialogResult == DialogResult.OK)
            {
                List <OutputDeliveryInfo> results = form.Selected as List <OutputDeliveryInfo>;

                foreach (OutputDeliveryInfo item in results)
                {
                    _entity.Extract(item);
                    _out_deliveries.Remove(item);
                }
            }

            if (_entity.AlbaranFacturas.Count == 0)
            {
                Serie_BT.Enabled = true;
            }

            Lines_BS.ResetBindings(false);
        }
 private void Descuento_NTB_TextChanged(object sender, EventArgs e)
 {
     _entity.PDescuento = PDescuento_NTB.DecimalValue;
     _entity.CalculateTotal();
     Lines_BS.ResetBindings(false);
     Datos.ResetBindings(false);
 }
Esempio n. 4
0
        protected bool ValidateAllocation()
        {
            if (_entity.EMedioPago == EMedioPago.CompensacionFactura)
            {
                decimal importe = 0;

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

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

                    Lines_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 (_deallocated < _entity.Pendiente)
                    {
                        PgMng.ShowInfoException(string.Format("La asignación {0:C2} es inferior a la cantidad pendiente en el cobro {1:C2}.", _deallocated, _entity.Pendiente));

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

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

            return(true);
        }
 private void FacturaAddForm_Shown(object sender, EventArgs e)
 {
     if (_out_delivery != null)
     {
         AddAlbaran(_out_delivery);
         Lines_BS.ResetBindings(true);
         Lines_DGW.Refresh();
     }
 }
        protected override void AddDeliveryAction()
        {
            _entity.AlbaranContado = Agrupada_CkB.Checked;

            AddAlbaran();

            if (Result == BGResult.OK)
            {
                Lines_BS.ResetBindings(false);
            }
        }
Esempio n. 7
0
        private void Descuento_NTB_TextChanged(object sender, EventArgs e)
        {
            if (_entity.PDescuento != 0)
            {
                Descuento_NTB.Text = Decimal.Round(_entity.Descuento, 2).ToString();
                return;
            }

            _entity.Descuento = Descuento_NTB.DecimalValue;
            _entity.CalculateTotal();
            Lines_BS.ResetBindings(false);
            Datos.ResetBindings(false);
        }
        protected override void AddLineaAction()
        {
            CashLine item = _entity.Lines.NewItem(_entity);

            Lines_BS.DataSource = _entity.Lines;

            Lines_BS.MoveLast();

            if (!_linea_libre)
            {
                item.ETipoLinea = ETipoLineaCaja.SalidaPorIngreso;
            }

            SetTipo();
        }
Esempio n. 9
0
        protected override void SetProvider(IAcreedorInfo source)
        {
            if (source == null)
            {
                return;
            }

            base.SetProvider(source);

            if (_entity.Conceptos.Count == 0)
            {
                _entity.AddProductosAcreedor(_provider, _serie);
            }

            Lines_BS.ResetBindings(false);
        }
Esempio n. 10
0
        public override void FormatControls()
        {
            if (Lines_DGW == null)
            {
                return;
            }

            base.MaximizeForm(new Size(0, 0));
            base.FormatControls();

            Saldo_Panel.Left = (PanelPrincipal.Width - Saldo_Panel.Width) / 2;
            Saldo_Panel.Left = Saldo_Panel.Left < 0 ? 0 : Saldo_Panel.Left;

            if (EntityInfo.Oid == Library.Invoice.ModulePrincipal.GetCajaTicketsSetting())
            {
                NCobro.HeaderText = "Nº Ticket";
            }

            Lines_BS.MoveLast();
        }
Esempio n. 11
0
        protected override void EditLineAllocationAction(DataGridViewRow row)
        {
            InputDecimalForm form = new InputDecimalForm();

            form.Message = Resources.Labels.IMPORTE_PAGO_GASTO;

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

                _deallocated += item.Asignado;

                _entity.EditTransactionPayment(item, form.Value);

                LinkLineAction(row);
                SetUnlinkedGridValues(Lines_DGW.Name);
                Lines_BS.ResetBindings(false);
                SetGridColors(Lines_DGW);
            }
        }
        protected override void SetCreditCardAction()
        {
            if (!ControlsMng.IsCurrentItemValid(Lines_DGW))
            {
                return;
            }

            CashLine item = ControlsMng.GetCurrentItem(Lines_DGW) as CashLine;

            if (item.Locked)
            {
                return;
            }

            if (!new ETipoLineaCaja[]
            {
                ETipoLineaCaja.EntradaPorTarjetaCredito
            }.Contains(item.ETipoLinea))
            {
                return;
            }

            CreditCardSelectForm form = new CreditCardSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                CreditCardInfo credit_card = form.Selected as CreditCardInfo;
                if (credit_card.ETipoTarjeta != ETipoTarjeta.Credito)
                {
                    return;
                }

                item.OidCreditCard     = credit_card.Oid;
                item.CreditCard        = credit_card.Nombre;
                item.OidCuentaBancaria = credit_card.OidCuentaBancaria;
                item.CuentaBancaria    = credit_card.CuentaBancaria;

                Lines_BS.ResetBindings(false);
            }
        }
Esempio n. 13
0
 protected virtual void RefreshLines()
 {
     Lines_BS.ResetBindings(true);
     Lines_DGW.Refresh();
 }
        protected virtual void AddPedidoAction(List <PedidoInfo> albaranes)
        {
            if (_entity.OidSerie == 0)
            {
                PgMng.ShowInfoException(Resources.Messages.NO_SERIE_SELECTED);
                return;
            }

            if (_pedidos.Count == 0)
            {
                if (_entity.OidHolder != 0)
                {
                    _pedidos = PedidoList.GetPendientesList(_entity.OidHolder, _entity.OidSerie, false);
                }
                else
                {
                    _pedidos = PedidoList.GetPendientesList(0, _entity.OidSerie, false);
                }
            }

            if (albaranes == null)
            {
                PedidoSelectForm form = new PedidoSelectForm(this, PedidoList.GetList(_pedidos));
                form.ShowDialog(this);
                if (form.DialogResult == DialogResult.OK)
                {
                    _results = form.Selected as List <PedidoInfo>;
                }
                else
                {
                    _results.Clear();
                }
            }
            else
            {
                _results = albaranes;
            }

            if (_results.Count > 0)
            {
                foreach (PedidoInfo item in _results)
                {
                    if (item.OidCliente != _results[0].OidCliente)
                    {
                        PgMng.ShowInfoException("No es posible asignar pedidos de clientes distintos a un mismo Albarán.");
                        return;
                    }
                }

                DoAddPedido(null);
            }

            if (Result == BGResult.OK)
            {
                Serie_BT.Enabled = false;
                Datos.ResetBindings(false);
            }

            if (Result == BGResult.OK)
            {
                Lines_BS.ResetBindings(false);
            }
        }