public void ShowPagoAction()
        {
            if (ActiveItem.EEstado == moleQule.Base.EEstado.Anulado)
            {
                return;
            }

            if (ActiveItem.OidPago == 0)
            {
                Payment pago = Payment.New(ActiveItem);
                PayrollPaymentAddForm form = new PayrollPaymentAddForm(pago, this);
                form.ShowDialog(this);

                if (form.ActionResult == DialogResult.OK)
                {
                    ActiveItem.CopyFrom(form.Entity);
                    ExecuteAction(molAction.Refresh);
                }
            }
            else
            {
                PayrollPaymentEditForm form = new PayrollPaymentEditForm(ActiveItem.OidPago, moleQule.Store.Structs.EnumConvert.ToETipoPago(ECategoriaGasto.Nomina), this);
                form.ShowDialog(this);
                ExecuteAction(molAction.Refresh);
            }
        }
Ejemplo n.º 2
0
        protected override void AddPagoAction()
        {
            PayrollPaymentAddForm form = new PayrollPaymentAddForm(this, _entity);

            form.ShowDialog(this);

            RefreshAction();
            Payments_BS.MoveFirst();
        }
        public override void OpenAddForm()
        {
            ETipoPago tipo = (_tipo != ETipoPago.Todos)
                                ? _tipo
                                : ActiveItem == null
                                    ? _tipo
                                    : ActiveItem.ETipoPago;

            switch (tipo)
            {
            case ETipoPago.Factura:
            {
                OpenEditForm();
                _entity = null;
            }
            break;

            case ETipoPago.Gasto:
            {
                ExpensePaymentAddForm form = new ExpensePaymentAddForm(tipo, this);
                AddForm(form);
                _entity = (form.ActionResult == DialogResult.OK) ? form.Entity : null;
            }
            break;

            case ETipoPago.Nomina:
            {
                if (ActiveItem.OidAgente == 0)
                {
                    PayrollPaymentAddForm form = new PayrollPaymentAddForm(tipo, this);
                    AddForm(form);
                    _entity = (form.ActionResult == DialogResult.OK) ? form.Entity : null;
                }
                else
                {
                    OpenEditForm();
                    _entity = null;
                }
            }
            break;

            case ETipoPago.Prestamo:
            {
                LoanPaymentAddForm form = new LoanPaymentAddForm(tipo, this);
                AddForm(form);
                _entity = (form.ActionResult == DialogResult.OK) ? form.Entity : null;
            }
            break;

            case ETipoPago.Fraccionado:
            {
                PagoFraccionadoAddForm form = new PagoFraccionadoAddForm(tipo, this);
                AddForm(form);
                _entity = (form.ActionResult == DialogResult.OK) ? form.Entity : null;
            }
            break;

            case ETipoPago.ExtractoTarjeta:
            {
                CreditCardPaymentAddForm form = new CreditCardPaymentAddForm(tipo, this);
                AddForm(form);
                _entity = (form.ActionResult == DialogResult.OK) ? form.Entity : null;
            }
            break;
            }
        }