Ejemplo n.º 1
0
        private void SeqeunceSelectionChnaged(object sender, SelectionChangedEventArgs e)
        {
            if (SelectedSeqeunce == null)
            {
                return;
            }

            _payment = _paymentRepository.Query
                       (
                pay => pay.PeriodSetting.Id == SelectedYear.Id
                &&
                pay.PaymentSequence.Id == SelectedSeqeunce.Id
                       ).Single();

            _paymentDetail =
                _detailRepository.Query
                (
                    det => det.FamilyMember.Code == _selectedMember.Code
                    &&
                    det.Payment.PaymentNo == _payment.PaymentNo
                ).Single();

            LoansHistory =
                _hisotryRepository.Query
                (
                    hist => hist.PaymentTransaction.TransNo == _paymentDetail.TransNo
                ).ToList();

            MemberLoans.Clear();

            foreach (LoanPayment lohis in LoansHistory)
            {
                var memLoan = new MemberLoan
                              (
                    lohis.Id, lohis.Loan.LoanNo, lohis.AmountPaid,
                    lohis.Loan.Description, lohis.Loan.Remarks
                              );
                MemberLoans.Add(memLoan);
            }

            MemberShares  = _paymentDetail.ShareNumbers;
            PaymentAmount = _payment.Amount;
            PaymentTotal  = (MemberShares * PaymentAmount);
            LoansTotal    = MemberLoans.Sum(x => x.LoanAmount);
            NetPayment    = _paymentDetail.NetPayments;
            if (_payment.PaymentStatus.Id != PaymentInReviewStatus.Id)
            {
                CanEdit = false;
            }
            SetState(ViewState.Saved);
        }
Ejemplo n.º 2
0
        private void SeqeunceSelectionChnaged(PeriodYear paymentYear, PaymentSequence paymentSequence)
        {
            if (paymentSequence == null)
            {
                return;
            }

            _payment = _paymentRepository.Single
                       (
                pay => pay.PeriodYear.Year == paymentYear.Year
                &&
                pay.PaymentSequence.Id == paymentSequence.Id
                       );

            _paymentDetail =
                _detailRepository.Single
                (
                    det => det.FamilyMember.Code == _selectedMember.Code
                    &&
                    det.Payment.PaymentNo == _payment.PaymentNo
                );

            LoansHistory =
                _loanPaymentsRepository.Where
                (
                    hist => hist.PaymentTransaction.TransNo == _paymentDetail.TransNo
                ).ToList();

            MemberLoans.Clear();

            foreach (LoanPayment loanPayment in LoansHistory)
            {
                var memLoan = new MemberLoan
                              (
                    loanPayment.DocNo, loanPayment.Loan.LoanNo, loanPayment.AmountPaid,
                    loanPayment.Loan.Description, loanPayment.Loan.Remarks
                              );
                MemberLoans.Add(memLoan);
            }

            MemberShares  = _paymentDetail.ShareNumbers;
            PaymentAmount = _payment.Amount;
            PaymentTotal  = (MemberShares * PaymentAmount);
            LoansTotal    = MemberLoans.Sum(x => x.LoanAmount);
            NetPayment    = _paymentDetail.NetPayments;
            if (_payment.Posted)
            {
                CanEdit = false;
            }
            SetState(ViewState.Saved);
        }