Exemplo n.º 1
0
        public dynamic GetInfo(int Id)
        {
            CashBank model = new CashBank();

            try
            {
                model = _cashBankService.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.Name,
                model.Description,
                model.Amount,
                model.IsBank,
                model.Errors
            }, JsonRequestBehavior.AllowGet));
        }
        public dynamic GetInfo(int Id)
        {
            CashBankMutation model = new CashBankMutation();

            try
            {
                model = _cashBankMutationService.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.Amount,
                model.SourceCashBankId,
                SourceCashBank = _cashBankService.GetObjectById(model.SourceCashBankId).Name,
                model.TargetCashBankId,
                TargetCashBank = _cashBankService.GetObjectById(model.TargetCashBankId).Name,
                model.IsConfirmed,
                model.ConfirmationDate,
                model.Errors
            }, JsonRequestBehavior.AllowGet));
        }
        public dynamic GetList(string _search, long nd, int rows, int?page, string sidx, string sord, string filters = "")
        {
            // Construct where statement

            string strWhere = GeneralFunction.ConstructWhere(filters);

            // Get Data
            var query = _cashBankMutationService.GetAll().Where(d => d.IsDeleted == false);

            var list = query as IEnumerable <CashBankMutation>;

            var pageIndex    = Convert.ToInt32(page) - 1;
            var pageSize     = rows;
            var totalRecords = query.Count();
            var totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pageSize);

            // default last page
            if (totalPages > 0)
            {
                if (!page.HasValue)
                {
                    pageIndex = totalPages - 1;
                    page      = totalPages;
                }
            }

            list = list.Skip(pageIndex * pageSize).Take(pageSize);

            return(Json(new
            {
                total = totalPages,
                page = page,
                records = totalRecords,
                rows = (
                    from model in list
                    select new
                {
                    id = model.Id,
                    cell = new object[] {
                        model.Id,
                        model.Code,
                        model.SourceCashBankId,
                        _cashBankService.GetObjectById(model.SourceCashBankId).Name,
                        model.TargetCashBankId,
                        _cashBankService.GetObjectById(model.TargetCashBankId).Name,
                        model.Amount,
                        model.IsConfirmed,
                        model.ConfirmationDate,
                        model.CreatedAt,
                        model.UpdatedAt,
                    }
                }).ToArray()
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
 public CashBankMutation UnconfirmObject(CashBankMutation cashBankMutation, ICashMutationService _cashMutationService, ICashBankService _cashBankService)
 {
     if (_validator.ValidUnconfirmObject(cashBankMutation, _cashBankService))
     {
         CashBank             sourceCashBank = _cashBankService.GetObjectById(cashBankMutation.SourceCashBankId);
         CashBank             targetCashBank = _cashBankService.GetObjectById(cashBankMutation.TargetCashBankId);
         IList <CashMutation> cashMutations  = _cashMutationService.SoftDeleteCashMutationForCashBankMutation(cashBankMutation, sourceCashBank, targetCashBank);
         foreach (var cashMutation in cashMutations)
         {
             _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
         }
         _repository.UnconfirmObject(cashBankMutation);
     }
     return(cashBankMutation);
 }
Exemplo n.º 5
0
        public CashSalesInvoice PaidObject(CashSalesInvoice cashSalesInvoice, decimal AmountPaid, decimal Allowance, ICashBankService _cashBankService, IReceivableService _receivableService,
                                           IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                           IContactService _contactService, ICashMutationService _cashMutationService, ICashSalesReturnService _cashSalesReturnService,
                                           IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            cashSalesInvoice.AmountPaid = AmountPaid;
            cashSalesInvoice.Allowance  = Allowance;
            if (_validator.ValidPaidObject(cashSalesInvoice, _cashBankService, _receiptVoucherService, _cashSalesReturnService, _closingService))
            {
                CashBank cashBank = _cashBankService.GetObjectById((int)cashSalesInvoice.CashBankId.GetValueOrDefault());
                cashSalesInvoice.IsBank = cashBank.IsBank;

                if (cashSalesInvoice.AmountPaid + cashSalesInvoice.Allowance == cashSalesInvoice.Total)
                {
                    cashSalesInvoice.IsFullPayment = true;
                }
                Receivable receivable = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.CashSalesInvoice, cashSalesInvoice.Id);
                receivable.AllowanceAmount = Allowance;
                receivable.RemainingAmount = receivable.Amount - receivable.AllowanceAmount;
                _receivableService.UpdateObject(receivable);
                ReceiptVoucher receiptVoucher = _receiptVoucherService.CreateObject((int)cashSalesInvoice.CashBankId.GetValueOrDefault(), receivable.ContactId, DateTime.Now, cashSalesInvoice.AmountPaid.GetValueOrDefault() /*receivable.RemainingAmount*/,
                                                                                    false, (DateTime)cashSalesInvoice.DueDate.GetValueOrDefault(), cashSalesInvoice.IsBank, _receiptVoucherDetailService,
                                                                                    _receivableService, _contactService, _cashBankService);
                ReceiptVoucherDetail receiptVoucherDetail = _receiptVoucherDetailService.CreateObject(receiptVoucher.Id, receivable.Id, cashSalesInvoice.AmountPaid.GetValueOrDefault(),
                                                                                                      "Automatic Payment", _receiptVoucherService, _cashBankService, _receivableService);
                cashSalesInvoice = _repository.PaidObject(cashSalesInvoice);
                _generalLedgerJournalService.CreatePaidJournalForCashSalesInvoice(cashSalesInvoice, _accountService);
                _receiptVoucherService.ConfirmObject(receiptVoucher, (DateTime)cashSalesInvoice.ConfirmationDate.GetValueOrDefault(), _receiptVoucherDetailService, _cashBankService,
                                                     _receivableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);
            }
            return(cashSalesInvoice);
        }
Exemplo n.º 6
0
        public RetailSalesInvoice PaidObject(RetailSalesInvoice retailSalesInvoice, decimal AmountPaid, ICashBankService _cashBankService, IReceivableService _receivableService,
                                             IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService, IContactService _contactService,
                                             ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            retailSalesInvoice.AmountPaid = AmountPaid;
            if (_validator.ValidPaidObject(retailSalesInvoice, _cashBankService, _receiptVoucherService))
            {
                CashBank cashBank = _cashBankService.GetObjectById((int)retailSalesInvoice.CashBankId.GetValueOrDefault());
                retailSalesInvoice.IsBank = cashBank.IsBank;

                if (!retailSalesInvoice.IsGBCH)
                {
                    retailSalesInvoice.GBCH_No     = null;
                    retailSalesInvoice.Description = null;
                }
                if (retailSalesInvoice.AmountPaid == retailSalesInvoice.Total)
                {
                    retailSalesInvoice.IsFullPayment = true;
                }
                Receivable     receivable     = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.RetailSalesInvoice, retailSalesInvoice.Id);
                ReceiptVoucher receiptVoucher = _receiptVoucherService.CreateObject((int)retailSalesInvoice.CashBankId.GetValueOrDefault(), retailSalesInvoice.ContactId, DateTime.Now, retailSalesInvoice.Total,
                                                                                    retailSalesInvoice.IsGBCH, (DateTime)retailSalesInvoice.DueDate.GetValueOrDefault(), retailSalesInvoice.IsBank, _receiptVoucherDetailService,
                                                                                    _receivableService, _contactService, _cashBankService);
                ReceiptVoucherDetail receiptVoucherDetail = _receiptVoucherDetailService.CreateObject(receiptVoucher.Id, receivable.Id, (decimal)retailSalesInvoice.AmountPaid.GetValueOrDefault(),
                                                                                                      "Automatic Payment", _receiptVoucherService, _cashBankService, _receivableService);
                retailSalesInvoice = _repository.PaidObject(retailSalesInvoice);
                _receiptVoucherService.ConfirmObject(receiptVoucher, (DateTime)retailSalesInvoice.ConfirmationDate, _receiptVoucherDetailService, _cashBankService,
                                                     _receivableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);
            }
            return(retailSalesInvoice);
        }
Exemplo n.º 7
0
        public ReceiptVoucher UnconfirmObject(ReceiptVoucher receiptVoucher, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                              ICashBankService _cashBankService, IReceivableService _receivableService, ICashMutationService _cashMutationService)
        {
            if (_validator.ValidUnconfirmObject(receiptVoucher))
            {
                IList <ReceiptVoucherDetail> details = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var detail in details)
                {
                    detail.Errors = new Dictionary <string, string>();
                    _receiptVoucherDetailService.UnconfirmObject(detail, this, _receivableService);
                }
                _repository.UnconfirmObject(receiptVoucher);

                if (!receiptVoucher.IsGBCH)
                {
                    CashBank             cashBank      = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                    IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                    foreach (var cashMutation in cashMutations)
                    {
                        _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
                    }
                }
            }
            return(receiptVoucher);
        }
Exemplo n.º 8
0
        public PaymentVoucher UnreconcileObject(PaymentVoucher paymentVoucher, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                                ICashMutationService _cashMutationService, ICashBankService _cashBankService, IPayableService _payableService,
                                                IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            if (_validator.ValidUnreconcileObject(paymentVoucher, _closingService))
            {
                _repository.UnreconcileObject(paymentVoucher);

                CashBank             cashBank      = _cashBankService.GetObjectById(paymentVoucher.CashBankId);
                IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForPaymentVoucher(paymentVoucher, cashBank);
                foreach (var cashMutation in cashMutations)
                {
                    _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
                }

                IList <PaymentVoucherDetail> paymentVoucherDetails = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id);
                foreach (var paymentVoucherDetail in paymentVoucherDetails)
                {
                    Payable payable = _payableService.GetObjectById(paymentVoucherDetail.PayableId);
                    payable.PendingClearanceAmount += paymentVoucherDetail.Amount;
                    if (payable.PendingClearanceAmount != 0 || payable.RemainingAmount != 0)
                    {
                        payable.IsCompleted    = false;
                        payable.CompletionDate = null;
                    }
                    _payableService.UpdateObject(payable);
                }
            }
            return(paymentVoucher);
        }
Exemplo n.º 9
0
        public PaymentVoucher ConfirmObject(PaymentVoucher paymentVoucher, DateTime ConfirmationDate, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                            ICashBankService _cashBankService, IPayableService _payableService, ICashMutationService _cashMutationService,
                                            IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            paymentVoucher.ConfirmationDate = ConfirmationDate;
            if (_validator.ValidConfirmObject(paymentVoucher, this, _paymentVoucherDetailService, _cashBankService, _payableService, _closingService))
            {
                IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id);
                foreach (var detail in details)
                {
                    detail.Errors = new Dictionary <string, string>();
                    _paymentVoucherDetailService.ConfirmObject(detail, ConfirmationDate, this, _payableService);
                }

                _repository.ConfirmObject(paymentVoucher);

                if (!paymentVoucher.IsGBCH)
                {
                    CashBank     cashBank     = _cashBankService.GetObjectById(paymentVoucher.CashBankId);
                    CashMutation cashMutation = _cashMutationService.CreateCashMutationForPaymentVoucher(paymentVoucher, cashBank);
                    _cashMutationService.CashMutateObject(cashMutation, _cashBankService);
                    _generalLedgerJournalService.CreateConfirmationJournalForPaymentVoucher(paymentVoucher, cashBank, _accountService);
                }
            }
            return(paymentVoucher);
        }
Exemplo n.º 10
0
        public PaymentVoucher UnconfirmObject(PaymentVoucher paymentVoucher, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                              ICashBankService _cashBankService, IPayableService _payableService, ICashMutationService _cashMutationService,
                                              IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            if (_validator.ValidUnconfirmObject(paymentVoucher, _closingService))
            {
                IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id);
                foreach (var detail in details)
                {
                    detail.Errors = new Dictionary <string, string>();
                    _paymentVoucherDetailService.UnconfirmObject(detail, this, _payableService);
                }
                _repository.UnconfirmObject(paymentVoucher);

                if (!paymentVoucher.IsGBCH)
                {
                    CashBank             cashBank      = _cashBankService.GetObjectById(paymentVoucher.CashBankId);
                    IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForPaymentVoucher(paymentVoucher, cashBank);
                    foreach (var cashMutation in cashMutations)
                    {
                        _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
                    }
                    _generalLedgerJournalService.CreateUnconfirmationJournalForPaymentVoucher(paymentVoucher, cashBank, _accountService);
                }
            }
            return(paymentVoucher);
        }
Exemplo n.º 11
0
        public PaymentVoucher ReconcileObject(PaymentVoucher paymentVoucher, DateTime ReconciliationDate, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                              ICashMutationService _cashMutationService, ICashBankService _cashBankService, IPayableService _payableService,
                                              IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            paymentVoucher.ReconciliationDate = ReconciliationDate;
            if (_validator.ValidReconcileObject(paymentVoucher, _closingService))
            {
                _repository.ReconcileObject(paymentVoucher);

                CashBank     cashBank     = _cashBankService.GetObjectById(paymentVoucher.CashBankId);
                CashMutation cashMutation = _cashMutationService.CreateCashMutationForPaymentVoucher(paymentVoucher, cashBank);
                _cashMutationService.CashMutateObject(cashMutation, _cashBankService);

                IList <PaymentVoucherDetail> paymentVoucherDetails = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id);
                foreach (var paymentVoucherDetail in paymentVoucherDetails)
                {
                    Payable payable = _payableService.GetObjectById(paymentVoucherDetail.PayableId);
                    payable.PendingClearanceAmount -= paymentVoucherDetail.Amount;
                    if (payable.PendingClearanceAmount == 0 && payable.RemainingAmount == 0)
                    {
                        payable.IsCompleted    = true;
                        payable.CompletionDate = DateTime.Now;
                    }
                    _payableService.UpdateObject(payable);
                }
            }
            return(paymentVoucher);
        }
Exemplo n.º 12
0
        public ReceiptVoucher ReconcileObject(ReceiptVoucher receiptVoucher, DateTime ReconciliationDate,
                                              IReceiptVoucherDetailService _receiptVoucherDetailService, ICashMutationService _cashMutationService,
                                              ICashBankService _cashBankService, IReceivableService _receivableService)
        {
            receiptVoucher.ReconciliationDate = ReconciliationDate;
            if (_validator.ValidReconcileObject(receiptVoucher))
            {
                _repository.ReconcileObject(receiptVoucher);

                CashBank     cashBank     = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                CashMutation cashMutation = _cashMutationService.CreateCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                _cashMutationService.CashMutateObject(cashMutation, _cashBankService);

                IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var receiptVoucherDetail in receiptVoucherDetails)
                {
                    Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId);
                    receivable.PendingClearanceAmount -= receiptVoucherDetail.Amount;
                    if (receivable.PendingClearanceAmount == 0 && receivable.RemainingAmount == 0)
                    {
                        receivable.IsCompleted    = true;
                        receivable.CompletionDate = DateTime.Now;
                    }
                    _receivableService.UpdateObject(receivable);
                }
            }
            return(receiptVoucher);
        }
Exemplo n.º 13
0
        public ReceiptVoucher UnreconcileObject(ReceiptVoucher receiptVoucher, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                                ICashMutationService _cashMutationService, ICashBankService _cashBankService, IReceivableService _receivableService)
        {
            if (_validator.ValidUnreconcileObject(receiptVoucher))
            {
                _repository.UnreconcileObject(receiptVoucher);

                CashBank             cashBank      = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                foreach (var cashMutation in cashMutations)
                {
                    _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
                }

                IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var receiptVoucherDetail in receiptVoucherDetails)
                {
                    Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId);
                    receivable.PendingClearanceAmount += receiptVoucherDetail.Amount;
                    if (receivable.PendingClearanceAmount != 0 || receivable.RemainingAmount != 0)
                    {
                        receivable.IsCompleted    = false;
                        receivable.CompletionDate = null;
                    }
                    _receivableService.UpdateObject(receivable);
                }
            }
            return(receiptVoucher);
        }
Exemplo n.º 14
0
 public CashBankMutation ConfirmObject(CashBankMutation cashBankMutation, DateTime ConfirmationDate, ICashMutationService _cashMutationService, ICashBankService _cashBankService)
 {
     cashBankMutation.ConfirmationDate = ConfirmationDate;
     if (_validator.ValidConfirmObject(cashBankMutation, _cashBankService))
     {
         CashBank             sourceCashBank = _cashBankService.GetObjectById(cashBankMutation.SourceCashBankId);
         CashBank             targetCashBank = _cashBankService.GetObjectById(cashBankMutation.TargetCashBankId);
         IList <CashMutation> cashMutations  = _cashMutationService.CreateCashMutationForCashBankMutation(cashBankMutation, sourceCashBank, targetCashBank);
         foreach (var cashMutation in cashMutations)
         {
             _cashMutationService.CashMutateObject(cashMutation, _cashBankService);
         }
         _repository.ConfirmObject(cashBankMutation);
     }
     return(cashBankMutation);
 }
Exemplo n.º 15
0
        public dynamic GetInfo(int Id)
        {
            CashSalesReturn model = new CashSalesReturn();

            try
            {
                model = _cashSalesReturnService.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.Description,
                model.ReturnDate,
                model.Allowance,
                model.Total,
                model.CashBankId,
                CashBank = _cashBankService.GetObjectById((int)model.CashBankId.GetValueOrDefault()).Name,
                model.CashSalesInvoiceId,
                CashSalesInvoice = _cashSalesInvoiceService.GetObjectById(model.CashSalesInvoiceId).Code,
                model.Errors
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 16
0
 public CashBankMutation UnconfirmObject(CashBankMutation cashBankMutation, ICashMutationService _cashMutationService, ICashBankService _cashBankService,
                                         IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
 {
     if (_validator.ValidUnconfirmObject(cashBankMutation, _cashBankService, _closingService))
     {
         CashBank             sourceCashBank = _cashBankService.GetObjectById(cashBankMutation.SourceCashBankId);
         CashBank             targetCashBank = _cashBankService.GetObjectById(cashBankMutation.TargetCashBankId);
         IList <CashMutation> cashMutations  = _cashMutationService.SoftDeleteCashMutationForCashBankMutation(cashBankMutation, sourceCashBank, targetCashBank);
         foreach (var cashMutation in cashMutations)
         {
             _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
         }
         _generalLedgerJournalService.CreateUnconfirmationJournalForCashBankMutation(cashBankMutation, sourceCashBank, targetCashBank, _accountService);
         _repository.UnconfirmObject(cashBankMutation);
     }
     return(cashBankMutation);
 }
Exemplo n.º 17
0
        public void ReverseCashMutateObject(CashMutation cashMutation, ICashBankService _cashBankService)
        {
            decimal  Amount   = (cashMutation.Status == MasterConstant.MutationStatus.Deduction) ? cashMutation.Amount : (-1) * cashMutation.Amount;
            CashBank cashBank = _cashBankService.GetObjectById(cashMutation.CashBankId);

            cashBank.Amount += Amount;
            _cashBankService.UpdateObject(cashBank);
        }
        public CashBankAdjustment VHasCashBank(CashBankAdjustment cashBankAdjustment, ICashBankService _cashBankService)
        {
            CashBank cashBank = _cashBankService.GetObjectById(cashBankAdjustment.CashBankId);

            if (cashBank == null)
            {
                cashBankAdjustment.Errors.Add("CashBank", "Tidak terasosiasi dengan cashBank");
            }
            return(cashBankAdjustment);
        }
        public CashBankMutation VNonNegativeNorZeroTargetCashBank(CashBankMutation cashBankMutation, ICashBankService _cashBankService)
        {
            CashBank targetCashBank = _cashBankService.GetObjectById(cashBankMutation.TargetCashBankId);

            if (targetCashBank.Amount - cashBankMutation.Amount < 0)
            {
                cashBankMutation.Errors.Add("Amount", "Tidak boleh melebihi jumlah amount dari target CashBank");
            }
            return(cashBankMutation);
        }
        public CashBankMutation VHasTargetCashBank(CashBankMutation cashBankMutation, ICashBankService _cashBankService)
        {
            CashBank targetCashBank = _cashBankService.GetObjectById(cashBankMutation.TargetCashBankId);

            if (targetCashBank == null)
            {
                cashBankMutation.Errors.Add("TargetCashBank", "Tidak terasosiasi dengan warehouse");
            }
            return(cashBankMutation);
        }
Exemplo n.º 21
0
        public ReceiptVoucher VHasCashBank(ReceiptVoucher receiptVoucher, ICashBankService _cashBankService)
        {
            CashBank cashBank = _cashBankService.GetObjectById(receiptVoucher.CashBankId);

            if (cashBank == null)
            {
                receiptVoucher.Errors.Add("CashBankId", "Tidak boleh tidak ada");
            }
            return(receiptVoucher);
        }
Exemplo n.º 22
0
        public dynamic GetInfo(int Id)
        {
            CashBank model = new CashBank();

            try
            {
                model = _cashBankService.GetObjectById(Id);
            }
            catch (Exception ex)
            {
                LOG.Error("GetInfo", ex);
                model.Errors.Add("Generic", "Error" + ex);
            }

            return(Json(new
            {
                model
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 23
0
        public CashBankMutation VHasSourceCashBank(CashBankMutation cashBankMutation, ICashBankService _cashBankService)
        {
            CashBank sourceCashBank = _cashBankService.GetObjectById(cashBankMutation.SourceCashBankId);

            if (sourceCashBank == null)
            {
                cashBankMutation.Errors.Add("SourceCashBankId", "Tidak terasosiasi dengan source cashbank");
            }
            return(cashBankMutation);
        }
Exemplo n.º 24
0
        public PaymentVoucher VHasCashBank(PaymentVoucher paymentVoucher, ICashBankService _cashBankService)
        {
            CashBank cashBank = _cashBankService.GetObjectById(paymentVoucher.CashBankId);

            if (cashBank == null)
            {
                paymentVoucher.Errors.Add("CashBankId", "Tidak boleh tidak ada");
            }
            return(paymentVoucher);
        }
        public RetailPurchaseInvoice VHasCashBank(RetailPurchaseInvoice retailPurchaseInvoice, ICashBankService _cashBankService)
        {
            CashBank cashBank = _cashBankService.GetObjectById((int)retailPurchaseInvoice.CashBankId.GetValueOrDefault());

            if (cashBank == null)
            {
                retailPurchaseInvoice.Errors.Add("CashBankId", "Tidak valid");
            }
            return(retailPurchaseInvoice);
        }
Exemplo n.º 26
0
        public CashSalesReturn VHasCashBank(CashSalesReturn cashSalesReturn, ICashBankService _cashBankService)
        {
            CashBank cashBank = _cashBankService.GetObjectById((int)cashSalesReturn.CashBankId.GetValueOrDefault());

            if (cashBank == null)
            {
                cashSalesReturn.Errors.Add("CashBankId", "Tidak valid");
            }
            return(cashSalesReturn);
        }
        public RetailPurchaseInvoice VIsCashBankTypeBank(RetailPurchaseInvoice retailPurchaseInvoice, ICashBankService _cashBankService)
        {
            CashBank cashBank = _cashBankService.GetObjectById((int)retailPurchaseInvoice.CashBankId.GetValueOrDefault());

            if (!cashBank.IsBank)
            {
                retailPurchaseInvoice.Errors.Add("Generic", "CashBank bukan tipe Bank");
                return(retailPurchaseInvoice);
            }
            return(retailPurchaseInvoice);
        }
Exemplo n.º 28
0
 public ReceiptVoucher VIfGBCHThenIsBank(ReceiptVoucher receiptVoucher, ICashBankService _cashBankService)
 {
     if (receiptVoucher.IsGBCH)
     {
         CashBank cashBank = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
         if (!cashBank.IsBank)
         {
             receiptVoucher.Errors.Add("IsBank", "Jika GBCH Harus IsBank");
         }
     }
     return(receiptVoucher);
 }