Пример #1
0
        public void GotoPagoAction()
        {
            if (ActiveItem.EEstado == moleQule.Base.EEstado.Anulado)
            {
                return;
            }
            if (ActiveItem.Total == 0)
            {
                return;
            }

            if (ActiveItem.OidPago == 0)
            {
                //Se obtiene el registro desde la DB para que actualice el pendiente de pago
                //en el caso de que se haya creado justo antes de esta acción
                Payment pago = Payment.New(ExpenseInfo.Get(ActiveItem.Oid, false), moleQule.Store.Structs.EnumConvert.ToETipoPago(ActiveItem.ECategoriaGasto));
                ExpensePaymentAddForm form = new ExpensePaymentAddForm(pago, this);
                form.ShowDialog(this);

                if (form.ActionResult == DialogResult.OK)
                {
                    ActiveItem.CopyFrom(form.Entity);
                }
            }
            else
            {
                ExpensePaymentEditForm form = new ExpensePaymentEditForm(ActiveItem.OidPago, moleQule.Store.Structs.EnumConvert.ToETipoPago(ActiveItem.ECategoriaGasto), this);
                form.ShowDialog(this);
            }
        }
        protected override void EditPaymentAction()
        {
            Payment currentPago = Payments_BS.Current as Payment;

            if (currentPago != null)
            {
                ExpensePaymentEditForm form = new ExpensePaymentEditForm(_entity.GetInfo(true), currentPago, this);
                form.ShowDialog(this);
            }

            RefreshAction();
        }
        public override void OpenEditForm()
        {
            switch (ActiveItem.ETipoPago)
            {
            case ETipoPago.Factura:
            {
                PaymentSummary item = PaymentSummary.Get((ETipoAcreedor)ActiveItem.TipoAgente, ActiveItem.OidAgente);

                PaymentEditForm form = new PaymentEditForm(this, ActiveItem.OidAgente, item);
                if (form.Entity != null)
                {
                    form.Select(ActiveItem);
                    AddForm(form);
                }
                item.CloseSession();
            }
            break;

            case ETipoPago.Nomina:
            {
                if (ActiveItem.OidAgente == 0)
                {
                    PayrollPaymentEditForm form = new PayrollPaymentEditForm(ActiveItem.Oid, ETipoPago.Nomina, this);
                    if (form.Entity != null)
                    {
                        AddForm(form);
                        _entity = form.Entity;
                    }
                }
                else
                {
                    PaymentSummary item = PaymentSummary.Get((ETipoAcreedor)ActiveItem.TipoAgente, ActiveItem.OidAgente);

                    EmployeePaymentEditForm form = new EmployeePaymentEditForm(this, ActiveItem.OidAgente, item);
                    if (form.Entity != null)
                    {
                        form.Select(ActiveItem);
                        AddForm(form);
                    }
                    item.CloseSession();
                }
            }
            break;

            case ETipoPago.Prestamo:
            {
                LoanPaymentEditForm form = new LoanPaymentEditForm(ActiveItem.Oid, ETipoPago.Prestamo, this);
                if (form.Entity != null)
                {
                    AddForm(form);
                    _entity = form.Entity;
                }
            }
            break;

            case ETipoPago.Fraccionado:
            {
                PagoFraccionadoEditForm form = new PagoFraccionadoEditForm(ActiveItem.Oid, ETipoPago.Fraccionado, this);
                if (form.Entity != null)
                {
                    AddForm(form);
                    _entity = form.Entity;
                }
            }
            break;

            case ETipoPago.ExtractoTarjeta:
            {
                CreditCardPaymentEditForm form = new CreditCardPaymentEditForm(ActiveItem.Oid, ETipoPago.ExtractoTarjeta, this);
                if (form.Entity != null)
                {
                    AddForm(form);
                    _entity = form.Entity;
                }
            }
            break;

            default:
            {
                ExpensePaymentEditForm form = new ExpensePaymentEditForm(ActiveItem.Oid, ActiveItem.ETipoPago, this);
                if (form.Entity != null)
                {
                    AddForm(form);
                    _entity = form.Entity;
                }
            }
            break;
            }
        }