Ejemplo n.º 1
0
        public override void DeleteObject(long oid)
        {
            LoanInfo    prestamo = LoanInfo.Get(ActiveOID, false);
            PaymentList pagos    = PaymentList.GetListByPrestamo(prestamo, false);

            PaymentInfo p = pagos.FirstOrDefault(x => x.EEstado != moleQule.Base.EEstado.Anulado);

            if (pagos != null && (pagos.FirstOrDefault(x => x.EEstado != moleQule.Base.EEstado.Anulado) != default(PaymentInfo)))
            {
                PgMng.ShowErrorException(Resources.Messages.PRESTAMO_CON_PAGOS_ASOCIADOS);
                _action_result = DialogResult.Cancel;
            }
            else
            {
                if (prestamo.OidPago != 0)
                {
                    PgMng.ShowErrorException(Resources.Messages.PRESTAMO_ASOCIADO_PAGO_FACTURA);
                    _action_result = DialogResult.Cancel;
                }
                else
                {
                    Loan.Delete(oid);
                    _action_result = DialogResult.OK;
                }
            }
        }
Ejemplo n.º 2
0
        protected override void GetFormSourceData(object[] parameters)
        {
            _loan   = (Loan)parameters[1];
            _entity = (Payment)parameters[2];
            _loans  = LoanList.NewList(_loan);

            PaymentList pagos = PaymentList.GetListByPrestamo(_loans[0], false);

            TransactionPayment pf = _entity.Operations.GetItemByFactura(_loans[0].Oid);

            if (pf != null)
            {
                _loans[0].Asignado    = pf.Cantidad;
                _loans[0].TotalPagado = 0;

                foreach (PaymentInfo pago in pagos)
                {
                    if (pago.EEstado == moleQule.Base.EEstado.Anulado)
                    {
                        continue;
                    }

                    _loans[0].TotalPagado += pago.Importe;
                }
            }

            _loans[0].Pendiente        = _loans[0].Importe - _loans[0].TotalPagado + _loans[0].Asignado;
            _loans[0].PendienteAsignar = _loans[0].Pendiente - _loans[0].Asignado;
        }
Ejemplo n.º 3
0
        protected override void GetFormSourceData(long oid, object[] parameters)
        {
            try
            {
                ETipoPago tipo = ETipoPago.Prestamo;

                if (parameters[1] != null)
                {
                    _loan = (Loan)parameters[1];
                }

                if (parameters.Length >= 3)
                {
                    _entity = (Payment)parameters[2];
                }
                else
                {
                    _entity = Payment.Get(oid, tipo, true);
                    _entity.BeginEdit();
                }

                _loans = _loan != null?
                         LoanList.NewList(_loan)
                             : LoanList.GetByPagoAndPendientesList(_entity.GetInfo(false));

                if (_loans.Count > 0)
                {
                    PaymentList pagos = PaymentList.GetListByPrestamo(_loans[0], false);

                    TransactionPayment pf = _entity.Operations.GetItemByFactura(_loans[0].Oid);

                    if (pf != null)
                    {
                        _loans[0].Asignado    = pf.Cantidad;
                        _loans[0].TotalPagado = 0;

                        foreach (PaymentInfo pago in pagos)
                        {
                            if (pago.EEstado == moleQule.Base.EEstado.Anulado)
                            {
                                continue;
                            }

                            _loans[0].TotalPagado += pago.Importe;
                        }
                    }

                    _loans[0].Pendiente        = _loans[0].Importe - _loans[0].TotalPagado + _loans[0].Asignado;
                    _loans[0].PendienteAsignar = _loans[0].Pendiente - _loans[0].Asignado;
                }
            }
            catch (Exception ex)
            {
                if (_entity != null)
                {
                    _entity.CloseSession();
                }
                throw ex;
            }
        }
        protected override void GetFormSourceData(object[] parameters)
        {
            if (parameters[0] == null)
            {
                _loan   = (Loan)parameters[2];
                _entity = Payment.New(_loan.GetInfo(false));
                _entity.BeginEdit();
                _entity.Oid = -1;
                _loans      = LoanList.NewList(_loan);

                PaymentList pagos = PaymentList.GetListByPrestamo(_loans[0], false);

                _loans[0].TotalPagado = 0;
                _loans[0].Asignado    = 0;

                foreach (PaymentInfo pago in pagos)
                {
                    if (pago.EEstado == moleQule.Base.EEstado.Anulado)
                    {
                        continue;
                    }

                    _loans[0].TotalPagado += pago.Importe;
                }

                _loans[0].Pendiente        = _loans[0].Importe - _loans[0].TotalPagado;
                _loans[0].PendienteAsignar = _loans[0].Pendiente;
            }
            else
            {
                _entity = (Payment)parameters[0];
                _entity.BeginEdit();
                _entity.Oid = -1;
                _loans      = LoanList.GetPendientesList(_entity.GetInfo(false));
            }


            //Asociamos los gastos previamente vinculados
            foreach (TransactionPayment item in _entity.Operations)
            {
                LoanInfo prestamo = _loans.GetItem(item.OidOperation);
                prestamo.Vincula();
            }
        }
Ejemplo n.º 5
0
        protected override void GetFormSourceData(long oid, object[] parameters)
        {
            ETipoPago tipo = ETipoPago.Prestamo;

            if (parameters[1] != null)
            {
                _loan = (LoanInfo)parameters[1];
            }

            _entity  = PaymentInfo.Get(oid, tipo, true);
            _mf_type = ManagerFormType.MFView;


            _loans = _loan != null?
                     LoanList.NewList(_loan)
                         : LoanList.GetByPagoAndPendientesList(_entity);

            //if (_prestamo != null)
            {
                PaymentList pagos = PaymentList.GetListByPrestamo(_loans[0], false);

                TransactionPaymentInfo pf = _entity.Operations != null?_entity.Operations.GetItemByFactura(_loans[0].Oid) : null;

                if (pf != null)
                {
                    _loans[0].Asignado    = pf.Cantidad;
                    _loans[0].TotalPagado = 0;

                    foreach (PaymentInfo pago in pagos)
                    {
                        if (pago.EEstado == moleQule.Base.EEstado.Anulado)
                        {
                            continue;
                        }

                        _loans[0].TotalPagado += pago.Importe;
                    }
                }

                _loans[0].Pendiente        = _loans[0].Importe - _loans[0].TotalPagado + _loans[0].Asignado;
                _loans[0].PendienteAsignar = _loans[0].Pendiente - _loans[0].Asignado;
            }
        }