Exemple #1
0
        public PaymentVoucherDetail ConfirmObject(PaymentVoucherDetail paymentVoucherDetail, DateTime ConfirmationDate,
                                                  IPaymentVoucherService _paymentVoucherService, IPayableService _payableService)
        {
            paymentVoucherDetail.ConfirmationDate = ConfirmationDate;
            if (_validator.ValidConfirmObject(paymentVoucherDetail, _payableService))
            {
                PaymentVoucher paymentVoucher = _paymentVoucherService.GetObjectById(paymentVoucherDetail.PaymentVoucherId);
                Payable        payable        = _payableService.GetObjectById(paymentVoucherDetail.PayableId);

                if (paymentVoucher.IsGBCH)
                {
                    payable.PendingClearanceAmount += paymentVoucherDetail.Amount;
                }
                payable.RemainingAmount -= paymentVoucherDetail.Amount;
                if (payable.RemainingAmount == 0 && payable.PendingClearanceAmount == 0)
                {
                    payable.IsCompleted    = true;
                    payable.CompletionDate = DateTime.Now;
                }
                _payableService.UpdateObject(payable);

                paymentVoucherDetail = _repository.ConfirmObject(paymentVoucherDetail);
            }
            return(paymentVoucherDetail);
        }
Exemple #2
0
        public PaymentVoucherDetail VHasPaymentVoucher(PaymentVoucherDetail paymentVoucherDetail, IPaymentVoucherService _paymentVoucherService)
        {
            PaymentVoucher paymentVoucher = _paymentVoucherService.GetObjectById(paymentVoucherDetail.PaymentVoucherId);

            if (paymentVoucher == null)
            {
                paymentVoucherDetail.Errors.Add("PaymentVoucherId", "Tidak boleh tidak ada");
            }
            return(paymentVoucherDetail);
        }
Exemple #3
0
        public PaymentVoucherDetail UnconfirmObject(PaymentVoucherDetail paymentVoucherDetail, IPaymentVoucherService _paymentVoucherService, IPayableService _payableService)
        {
            if (_validator.ValidUnconfirmObject(paymentVoucherDetail))
            {
                PaymentVoucher paymentVoucher = _paymentVoucherService.GetObjectById(paymentVoucherDetail.PaymentVoucherId);
                Payable        payable        = _payableService.GetObjectById(paymentVoucherDetail.PayableId);

                if (paymentVoucher.IsGBCH)
                {
                    payable.PendingClearanceAmount -= paymentVoucherDetail.Amount;
                }
                payable.RemainingAmount += paymentVoucherDetail.Amount;
                if (payable.RemainingAmount != 0 || payable.PendingClearanceAmount != 0)
                {
                    payable.IsCompleted    = false;
                    payable.CompletionDate = null;
                }
                _payableService.UpdateObject(payable);

                paymentVoucherDetail = _repository.UnconfirmObject(paymentVoucherDetail);
            }
            return(paymentVoucherDetail);
        }
        public dynamic GetInfo(int Id)
        {
            PaymentVoucher model = new PaymentVoucher();

            try
            {
                model = _paymentVoucherService.GetObjectById(Id);
            }
            catch (Exception ex)
            {
                LOG.Error("GetInfo", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Id,
                model.Code,
                model.ContactId,
                Contact = _contactService.GetObjectById(model.ContactId).Name,
                model.CashBankId,
                CashBank = _cashBankService.GetObjectById(model.CashBankId).Name,
                model.PaymentDate,
                model.IsGBCH,
                model.DueDate,
                _cashBankService.GetObjectById(model.CashBankId).IsBank, //model.IsBank,
                model.TotalAmount,
                model.Errors
            }, JsonRequestBehavior.AllowGet));
        }