Ejemplo n.º 1
0
        public RetailPurchaseInvoice UnpaidObject(RetailPurchaseInvoice retailPurchaseInvoice, IPaymentVoucherService _paymentVoucherService,
                                                  IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService,
                                                  IPayableService _payableService, ICashMutationService _cashMutationService,
                                                  IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            if (_validator.ValidUnpaidObject(retailPurchaseInvoice))
            {
                Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.RetailPurchaseInvoice, retailPurchaseInvoice.Id);
                IList <PaymentVoucher> paymentVouchers = _paymentVoucherService.GetObjectsByCashBankId((int)retailPurchaseInvoice.CashBankId.GetValueOrDefault());
                foreach (var paymentVoucher in paymentVouchers)
                {
                    if (paymentVoucher.ContactId == retailPurchaseInvoice.ContactId)
                    {
                        paymentVoucher.Errors = new Dictionary <string, string>();
                        _paymentVoucherService.UnconfirmObject(paymentVoucher, _paymentVoucherDetailService, _cashBankService, _payableService,
                                                               _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);

                        IList <PaymentVoucherDetail> paymentVoucherDetails = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id);
                        foreach (var paymentVoucherDetail in paymentVoucherDetails)
                        {
                            _paymentVoucherDetailService.SoftDeleteObject(paymentVoucherDetail);
                        }
                        _paymentVoucherService.SoftDeleteObject(paymentVoucher, _paymentVoucherDetailService);
                    }
                }
                retailPurchaseInvoice.AmountPaid    = 0;
                retailPurchaseInvoice.IsFullPayment = false;
                retailPurchaseInvoice = _repository.UnpaidObject(retailPurchaseInvoice);
            }
            return(retailPurchaseInvoice);
        }
Ejemplo n.º 2
0
 public PaymentVoucher CreateObject(PaymentVoucher paymentVoucher, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                    IPayableService _payableService, IContactService _contactService, ICashBankService _cashBankService)
 {
     paymentVoucher.Errors = new Dictionary <String, String>();
     return(_validator.ValidCreateObject(paymentVoucher, this, _paymentVoucherDetailService, _payableService, _contactService, _cashBankService) ?
            _repository.CreateObject(paymentVoucher) : paymentVoucher);
 }
 public RetailPurchaseInvoice VUnconfirmObject(RetailPurchaseInvoice retailPurchaseInvoice, IRetailPurchaseInvoiceDetailService _retailPurchaseInvoiceDetailService,
                                               IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService)
 {
     VIsNotDeleted(retailPurchaseInvoice);
     if (!isValid(retailPurchaseInvoice))
     {
         return(retailPurchaseInvoice);
     }
     VIsConfirmed(retailPurchaseInvoice);
     if (!isValid(retailPurchaseInvoice))
     {
         return(retailPurchaseInvoice);
     }
     VIsNotPaid(retailPurchaseInvoice);
     if (!isValid(retailPurchaseInvoice))
     {
         return(retailPurchaseInvoice);
     }
     VIsUnconfirmableRetailPurchaseInvoiceDetails(retailPurchaseInvoice, _retailPurchaseInvoiceDetailService);
     if (!isValid(retailPurchaseInvoice))
     {
         return(retailPurchaseInvoice);
     }
     VHasNoPaymentVoucherDetails(retailPurchaseInvoice, _payableService, _paymentVoucherDetailService);
     return(retailPurchaseInvoice);
 }
Ejemplo n.º 4
0
 public CashSalesReturn VUnconfirmObject(CashSalesReturn cashSalesReturn, ICashSalesReturnDetailService _cashSalesReturnDetailService,
                                         IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService)
 {
     VIsNotDeleted(cashSalesReturn);
     if (!isValid(cashSalesReturn))
     {
         return(cashSalesReturn);
     }
     VIsConfirmed(cashSalesReturn);
     if (!isValid(cashSalesReturn))
     {
         return(cashSalesReturn);
     }
     VIsNotPaid(cashSalesReturn);
     if (!isValid(cashSalesReturn))
     {
         return(cashSalesReturn);
     }
     VHasNoPaymentVoucherDetails(cashSalesReturn, _payableService, _paymentVoucherDetailService);
     if (!isValid(cashSalesReturn))
     {
         return(cashSalesReturn);
     }
     VIsUnconfirmableCashSalesReturnDetails(cashSalesReturn, _cashSalesReturnDetailService);
     return(cashSalesReturn);
 }
Ejemplo n.º 5
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);
        }
 public CustomPurchaseInvoiceController()
 {
     _contactService                     = new ContactService(new ContactRepository(), new ContactValidator());
     _itemService                        = new ItemService(new ItemRepository(), new ItemValidator());
     _itemTypeService                    = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator());
     _uoMService                         = new UoMService(new UoMRepository(), new UoMValidator());
     _warehouseItemService               = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator());
     _warehouseService                   = new WarehouseService(new WarehouseRepository(), new WarehouseValidator());
     _stockMutationService               = new StockMutationService(new StockMutationRepository(), new StockMutationValidator());
     _barringService                     = new BarringService(new BarringRepository(), new BarringValidator());
     _priceMutationService               = new PriceMutationService(new PriceMutationRepository(), new PriceMutationValidator());
     _contactGroupService                = new ContactGroupService(new ContactGroupRepository(), new ContactGroupValidator());
     _purchaseOrderDetailService         = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
     _salesOrderDetailService            = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator());
     _stockAdjustmentDetailService       = new StockAdjustmentDetailService(new StockAdjustmentDetailRepository(), new StockAdjustmentDetailValidator());
     _cashBankService                    = new CashBankService(new CashBankRepository(), new CashBankValidator());
     _cashMutationService                = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
     _customPurchaseInvoiceService       = new CustomPurchaseInvoiceService(new CustomPurchaseInvoiceRepository(), new CustomPurchaseInvoiceValidator());
     _customPurchaseInvoiceDetailService = new CustomPurchaseInvoiceDetailService(new CustomPurchaseInvoiceDetailRepository(), new CustomPurchaseInvoiceDetailValidator());
     _cashSalesReturnService             = new CashSalesReturnService(new CashSalesReturnRepository(), new CashSalesReturnValidator());
     _quantityPricingService             = new QuantityPricingService(new QuantityPricingRepository(), new QuantityPricingValidator());
     _payableService                     = new PayableService(new PayableRepository(), new PayableValidator());
     _paymentVoucherService              = new PaymentVoucherService(new PaymentVoucherRepository(), new PaymentVoucherValidator());
     _paymentVoucherDetailService        = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
     _receivableService                  = new ReceivableService(new ReceivableRepository(), new ReceivableValidator());
     _accountService                     = new AccountService(new AccountRepository(), new AccountValidator());
     _generalLedgerJournalService        = new GeneralLedgerJournalService(new GeneralLedgerJournalRepository(), new GeneralLedgerJournalValidator());
     _closingService                     = new ClosingService(new ClosingRepository(), new ClosingValidator());
     _validCombService                   = new ValidCombService(new ValidCombRepository(), new ValidCombValidator());
 }
Ejemplo n.º 7
0
 public bool ValidUnconfirmObject(CashSalesReturn cashSalesReturn, ICashSalesReturnDetailService _cashSalesReturnDetailService,
                                  IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService)
 {
     cashSalesReturn.Errors.Clear();
     VUnconfirmObject(cashSalesReturn, _cashSalesReturnDetailService, _payableService, _paymentVoucherDetailService);
     return(isValid(cashSalesReturn));
 }
 public bool ValidUnconfirmObject(CustomPurchaseInvoice customPurchaseInvoice, ICustomPurchaseInvoiceDetailService _customPurchaseInvoiceDetailService,
                                  IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService, IClosingService _closingService)
 {
     customPurchaseInvoice.Errors.Clear();
     VUnconfirmObject(customPurchaseInvoice, _customPurchaseInvoiceDetailService, _payableService, _paymentVoucherDetailService, _closingService);
     return(isValid(customPurchaseInvoice));
 }
Ejemplo n.º 9
0
        public PaymentVoucher ReconcileObject(PaymentVoucher paymentVoucher, DateTime ReconciliationDate,
                                              IPaymentVoucherDetailService _paymentVoucherDetailService, ICashMutationService _cashMutationService,
                                              ICashBankService _cashBankService, IPayableService _payableService)
        {
            paymentVoucher.ReconciliationDate = ReconciliationDate;
            if (_validator.ValidReconcileObject(paymentVoucher))
            {
                _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);
        }
Ejemplo n.º 10
0
        public PaymentVoucher VAllPaymentVoucherDetailsAreConfirmable(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService,
                                                                      IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService,
                                                                      IPayableService _payableService)
        {
            IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id);

            foreach (var detail in details)
            {
                detail.Errors           = new Dictionary <string, string>();
                detail.ConfirmationDate = paymentVoucher.ConfirmationDate;
                detail.Errors           = new Dictionary <string, string>();
                if (!_paymentVoucherDetailService.GetValidator().ValidConfirmObject(detail, _payableService))
                {
                    foreach (var error in detail.Errors)
                    {
                        paymentVoucher.Errors.Add(error.Key, error.Value);
                    }
                    if (paymentVoucher.Errors.Any())
                    {
                        return(paymentVoucher);
                    }
                }
            }
            return(paymentVoucher);
        }
 public CustomPurchaseInvoice VUnconfirmObject(CustomPurchaseInvoice customPurchaseInvoice, ICustomPurchaseInvoiceDetailService _customPurchaseInvoiceDetailService,
                                               IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService, IClosingService _closingService)
 {
     VIsNotDeleted(customPurchaseInvoice);
     if (!isValid(customPurchaseInvoice))
     {
         return(customPurchaseInvoice);
     }
     VIsConfirmed(customPurchaseInvoice);
     if (!isValid(customPurchaseInvoice))
     {
         return(customPurchaseInvoice);
     }
     VIsNotPaid(customPurchaseInvoice);
     if (!isValid(customPurchaseInvoice))
     {
         return(customPurchaseInvoice);
     }
     VIsUnconfirmableCustomPurchaseInvoiceDetails(customPurchaseInvoice, _customPurchaseInvoiceDetailService);
     if (!isValid(customPurchaseInvoice))
     {
         return(customPurchaseInvoice);
     }
     VHasNoPaymentVoucherDetails(customPurchaseInvoice, _payableService, _paymentVoucherDetailService);
     if (!isValid(customPurchaseInvoice))
     {
         return(customPurchaseInvoice);
     }
     VGeneralLedgerPostingHasNotBeenClosed(customPurchaseInvoice, _closingService, 2);
     return(customPurchaseInvoice);
 }
Ejemplo n.º 12
0
        public CashSalesReturn UnpaidObject(CashSalesReturn cashSalesReturn, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                            ICashBankService _cashBankService, IPayableService _payableService, ICashMutationService _cashMutationService,
                                            IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            if (_validator.ValidUnpaidObject(cashSalesReturn))
            {
                Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.CashSalesReturn, cashSalesReturn.Id);
                IList <PaymentVoucher> paymentVouchers = _paymentVoucherService.GetObjectsByCashBankId((int)cashSalesReturn.CashBankId.GetValueOrDefault());
                foreach (var paymentVoucher in paymentVouchers)
                {
                    if (paymentVoucher.ContactId == payable.ContactId)
                    {
                        paymentVoucher.Errors = new Dictionary <string, string>();
                        _paymentVoucherService.UnconfirmObject(paymentVoucher, _paymentVoucherDetailService, _cashBankService, _payableService,
                                                               _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);

                        IList <PaymentVoucherDetail> paymentVoucherDetails = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id);
                        foreach (var paymentVoucherDetail in paymentVoucherDetails)
                        {
                            paymentVoucherDetail.Errors = new Dictionary <string, string>();
                            _paymentVoucherDetailService.SoftDeleteObject(paymentVoucherDetail);
                        }
                        _paymentVoucherService.SoftDeleteObject(paymentVoucher, _paymentVoucherDetailService);
                    }
                }
                payable.AllowanceAmount = 0;
                _payableService.UpdateObject(payable);
                cashSalesReturn.Allowance = 0;
                cashSalesReturn           = _repository.UnpaidObject(cashSalesReturn);
            }
            return(cashSalesReturn);
        }
Ejemplo n.º 13
0
 public PaymentVoucher VCreateObject(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                     IPayableService _payableService, IContactService _contactService, ICashBankService _cashBankService)
 {
     VHasContact(paymentVoucher, _contactService);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VHasCashBank(paymentVoucher, _cashBankService);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VHasPaymentDate(paymentVoucher);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VIfGBCHThenIsBank(paymentVoucher, _cashBankService);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VIfGBCHThenHasDueDate(paymentVoucher);
     return(paymentVoucher);
 }
Ejemplo n.º 14
0
 public bool ValidUpdateObject(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService,
                               IPayableService _payableService, IContactService _contactService, ICashBankService _cashBankService)
 {
     paymentVoucher.Errors.Clear();
     VUpdateObject(paymentVoucher, _paymentVoucherService, _paymentVoucherDetailService, _payableService, _contactService, _cashBankService);
     return(isValid(paymentVoucher));
 }
Ejemplo n.º 15
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);
        }
 public bool ValidUnconfirmObject(RetailPurchaseInvoice retailPurchaseInvoice, IRetailPurchaseInvoiceDetailService _retailPurchaseInvoiceDetailService,
                                  IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService)
 {
     retailPurchaseInvoice.Errors.Clear();
     VUnconfirmObject(retailPurchaseInvoice, _retailPurchaseInvoiceDetailService, _payableService, _paymentVoucherDetailService);
     return(isValid(retailPurchaseInvoice));
 }
Ejemplo n.º 17
0
 public bool ValidConfirmObject(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService,
                                IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService,
                                IPayableService _payableService, IClosingService _closingService)
 {
     paymentVoucher.Errors.Clear();
     VConfirmObject(paymentVoucher, _paymentVoucherService, _paymentVoucherDetailService, _cashBankService, _payableService, _closingService);
     return(isValid(paymentVoucher));
 }
Ejemplo n.º 18
0
 public PaymentVoucher VUpdateObject(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                     IPayableService _payableService, IContactService _contactService, ICashBankService _cashBankService)
 {
     VHasNoPaymentVoucherDetail(paymentVoucher, _paymentVoucherDetailService);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VCreateObject(paymentVoucher, _paymentVoucherService, _paymentVoucherDetailService, _payableService, _contactService, _cashBankService);
     return(paymentVoucher);
 }
Ejemplo n.º 19
0
 public PaymentRequestController()
 {
     _purchaseOrderService          = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
     _purchaseOrderDetailService    = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
     _paymentRequestService         = new PaymentRequestService(new PaymentRequestRepository(), new PaymentRequestValidator());
     _contactService                = new ContactService(new ContactRepository(), new ContactValidator());
     _purchaseReceivalService       = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
     _purchaseReceivalDetailService = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
     _paymentVoucherDetailService   = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
     _payableService                = new PayableService(new PayableRepository(), new PayableValidator());
     _itemService = new ItemService(new ItemRepository(), new ItemValidator());
 }
Ejemplo n.º 20
0
 public PurchaseInvoiceController()
 {
     _purchaseOrderService          = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
     _purchaseOrderDetailService    = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
     _purchaseInvoiceService        = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator());
     _purchaseInvoiceDetailService  = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator());
     _purchaseReceivalService       = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
     _purchaseReceivalDetailService = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
     _paymentVoucherDetailService   = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
     _payableService = new PayableService(new PayableRepository(), new PayableValidator());
     _itemService    = new ItemService(new ItemRepository(), new ItemValidator());
 }
Ejemplo n.º 21
0
        public PaymentVoucherDetail CreateObject(int paymentVoucherId, int payableId, decimal amount, string description,
                                                 IPaymentVoucherService _paymentVoucherService, ICashBankService _cashBankService,
                                                 IPayableService _payableService)
        {
            PaymentVoucherDetail paymentVoucherDetail = new PaymentVoucherDetail
            {
                PaymentVoucherId = paymentVoucherId,
                PayableId        = payableId,
                Amount           = amount,
                Description      = description,
            };

            return(this.CreateObject(paymentVoucherDetail, _paymentVoucherService, _cashBankService, _payableService));
        }
Ejemplo n.º 22
0
        public PaymentVoucherDetail VUniquePayableId(PaymentVoucherDetail paymentVoucherDetail, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                                     IPayableService _payableService)
        {
            IList <PaymentVoucherDetail> paymentVoucherDetails = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucherDetail.PaymentVoucherId);
            Payable payable = _payableService.GetObjectById(paymentVoucherDetail.PayableId);

            foreach (var detail in paymentVoucherDetails)
            {
                if (detail.PayableId == paymentVoucherDetail.PayableId && detail.Id != paymentVoucherDetail.Id)
                {
                    paymentVoucherDetail.Errors.Add("Generic", "PayableId harus unique dibandingkan payment voucher details di dalam satu payment voucher");
                    return(paymentVoucherDetail);
                }
            }
            return(paymentVoucherDetail);
        }
Ejemplo n.º 23
0
        public ReportController()
        {
            _itemService       = new ItemService(new ItemRepository(), new ItemValidator());
            _itemTypeService   = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator());
            _uoMService        = new UoMService(new UoMRepository(), new UoMValidator());
            _companyService    = new CompanyService(new CompanyRepository(), new CompanyValidator());
            _cashBankService   = new CashBankService(new CashBankRepository(), new CashBankValidator());
            _payableService    = new PayableService(new PayableRepository(), new PayableValidator());
            _receivableService = new ReceivableService(new ReceivableRepository(), new ReceivableValidator());

            _cashSalesInvoiceService            = new CashSalesInvoiceService(new CashSalesInvoiceRepository(), new CashSalesInvoiceValidator());
            _cashSalesInvoiceDetailService      = new CashSalesInvoiceDetailService(new CashSalesInvoiceDetailRepository(), new CashSalesInvoiceDetailValidator());
            _cashSalesReturnService             = new CashSalesReturnService(new CashSalesReturnRepository(), new CashSalesReturnValidator());
            _cashSalesReturnDetailService       = new CashSalesReturnDetailService(new CashSalesReturnDetailRepository(), new CashSalesReturnDetailValidator());
            _customPurchaseInvoiceService       = new CustomPurchaseInvoiceService(new CustomPurchaseInvoiceRepository(), new CustomPurchaseInvoiceValidator());
            _customPurchaseInvoiceDetailService = new CustomPurchaseInvoiceDetailService(new CustomPurchaseInvoiceDetailRepository(), new CustomPurchaseInvoiceDetailValidator());
        }
Ejemplo n.º 24
0
 public RetailPurchaseInvoice UnconfirmObject(RetailPurchaseInvoice retailPurchaseInvoice, IRetailPurchaseInvoiceDetailService _retailPurchaseInvoiceDetailService,
                                              IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                              IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService, IItemService _itemService,
                                              IBarringService _barringService, IStockMutationService _stockMutationService, IClosingService _closingService)
 {
     if (_validator.ValidUnconfirmObject(retailPurchaseInvoice, _retailPurchaseInvoiceDetailService, _payableService, _paymentVoucherDetailService))
     {
         retailPurchaseInvoice = _repository.UnconfirmObject(retailPurchaseInvoice);
         IList <RetailPurchaseInvoiceDetail> retailPurchaseInvoiceDetails = _retailPurchaseInvoiceDetailService.GetObjectsByRetailPurchaseInvoiceId(retailPurchaseInvoice.Id);
         foreach (var retailPurchaseInvoiceDetail in retailPurchaseInvoiceDetails)
         {
             retailPurchaseInvoiceDetail.Errors = new Dictionary <string, string>();
             _retailPurchaseInvoiceDetailService.UnconfirmObject(retailPurchaseInvoiceDetail, _warehouseItemService, _warehouseService, _itemService, _barringService, _stockMutationService);
         }
         Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.RetailPurchaseInvoice, retailPurchaseInvoice.Id);
         _payableService.SoftDeleteObject(payable);
     }
     return(retailPurchaseInvoice);
 }
Ejemplo n.º 25
0
 public PaymentVoucher VConfirmObject(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService,
                                      IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService,
                                      IPayableService _payableService, IClosingService _closingService)
 {
     VHasConfirmationDate(paymentVoucher);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VHasPaymentVoucherDetails(paymentVoucher, _paymentVoucherDetailService);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VTotalAmountIsNotZero(paymentVoucher, _paymentVoucherDetailService);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VHasNotBeenConfirmed(paymentVoucher);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VHasNotBeenDeleted(paymentVoucher);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VAllPaymentVoucherDetailsAreConfirmable(paymentVoucher, _paymentVoucherService, _paymentVoucherDetailService, _cashBankService, _payableService);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VCashBankHasMoreAmountPaymentVoucherDetails(paymentVoucher, _paymentVoucherDetailService, _cashBankService);
     if (!isValid(paymentVoucher))
     {
         return(paymentVoucher);
     }
     VGeneralLedgerPostingHasNotBeenClosed(paymentVoucher, _closingService, 1);
     return(paymentVoucher);
 }
Ejemplo n.º 26
0
 public PaymentVoucherController()
 {
     _cashBankService               = new CashBankService(new CashBankRepository(), new CashBankValidator());
     _cashMutationService           = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
     _purchaseOrderService          = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
     _purchaseOrderDetailService    = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
     _purchaseInvoiceService        = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator());
     _purchaseInvoiceDetailService  = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator());
     _purchaseReceivalService       = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
     _purchaseReceivalDetailService = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
     _paymentVoucherDetailService   = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
     _payableService              = new PayableService(new PayableRepository(), new PayableValidator());
     _itemService                 = new ItemService(new ItemRepository(), new ItemValidator());
     _paymentVoucherService       = new PaymentVoucherService(new PaymentVoucherRepository(), new PaymentVoucherValidator());
     _contactService              = new ContactService(new ContactRepository(), new ContactValidator());
     _accountService              = new AccountService(new AccountRepository(), new AccountValidator());
     _generalLedgerJournalService = new GeneralLedgerJournalService(new GeneralLedgerJournalRepository(), new GeneralLedgerJournalValidator());
     _closingService              = new ClosingService(new ClosingRepository(), new ClosingValidator());
     _validCombService            = new ValidCombService(new ValidCombRepository(), new ValidCombValidator());
 }
Ejemplo n.º 27
0
 public SalesInvoiceController()
 {
     _purchaseOrderService          = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
     _purchaseOrderDetailService    = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
     _purchaseInvoiceService        = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator());
     _purchaseInvoiceDetailService  = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator());
     _purchaseReceivalService       = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
     _purchaseReceivalDetailService = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
     _paymentVoucherDetailService   = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
     _payableService              = new PayableService(new PayableRepository(), new PayableValidator());
     _itemService                 = new ItemService(new ItemRepository(), new ItemValidator());
     _salesInvoiceService         = new SalesInvoiceService(new SalesInvoiceRepository(), new SalesInvoiceValidator());
     _salesInvoiceDetailService   = new SalesInvoiceDetailService(new SalesInvoiceDetailRepository(), new SalesInvoiceDetailValidator());
     _deliveryOrderDetailService  = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
     _receiptVoucherDetailService = new ReceiptVoucherDetailService(new ReceiptVoucherDetailRepository(), new ReceiptVoucherDetailValidator());
     _receivableService           = new ReceivableService(new ReceivableRepository(), new ReceivableValidator());
     _salesOrderService           = new SalesOrderService(new SalesOrderRepository(), new SalesOrderValidator());
     _deliveryOrderDetailService  = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
     _salesOrderDetailService     = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator());
     _deliveryOrderService        = new DeliveryOrderService(new DeliveryOrderRepository(), new DeliveryOrderValidator());
 }
Ejemplo n.º 28
0
 public CashSalesReturn UnconfirmObject(CashSalesReturn cashSalesReturn, ICashSalesReturnDetailService _cashSalesReturnDetailService,
                                        ICashSalesInvoiceDetailService _cashSalesInvoiceDetailService,
                                        IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                        IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService, IItemService _itemService,
                                        IBarringService _barringService, IStockMutationService _stockMutationService, IClosingService _closingService)
 {
     if (_validator.ValidUnconfirmObject(cashSalesReturn, _cashSalesReturnDetailService, _payableService, _paymentVoucherDetailService))
     {
         cashSalesReturn = _repository.UnconfirmObject(cashSalesReturn);
         IList <CashSalesReturnDetail> cashSalesReturnDetails = _cashSalesReturnDetailService.GetObjectsByCashSalesReturnId(cashSalesReturn.Id);
         foreach (var cashSalesReturnDetail in cashSalesReturnDetails)
         {
             cashSalesReturnDetail.Errors = new Dictionary <string, string>();
             _cashSalesReturnDetailService.UnconfirmObject(cashSalesReturnDetail, _cashSalesInvoiceDetailService, _warehouseItemService,
                                                           _warehouseService, _itemService, _barringService, _stockMutationService);
         }
         Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.CashSalesReturn, cashSalesReturn.Id);
         _payableService.SoftDeleteObject(payable);
         cashSalesReturn.Total     = 0;
         cashSalesReturn.Allowance = 0;
     }
     return(cashSalesReturn);
 }
Ejemplo n.º 29
0
 public CustomPurchaseInvoice UnconfirmObject(CustomPurchaseInvoice customPurchaseInvoice, ICustomPurchaseInvoiceDetailService _customPurchaseInvoiceDetailService,
                                              IPayableService _payableService, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                              IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService, IItemService _itemService,
                                              IBarringService _barringService, IStockMutationService _stockMutationService, IPriceMutationService _priceMutationService,
                                              IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
 {
     if (_validator.ValidUnconfirmObject(customPurchaseInvoice, _customPurchaseInvoiceDetailService, _payableService, _paymentVoucherDetailService, _closingService))
     {
         IList <CustomPurchaseInvoiceDetail> customPurchaseInvoiceDetails = _customPurchaseInvoiceDetailService.GetObjectsByCustomPurchaseInvoiceId(customPurchaseInvoice.Id);
         foreach (var customPurchaseInvoiceDetail in customPurchaseInvoiceDetails)
         {
             customPurchaseInvoiceDetail.Errors = new Dictionary <string, string>();
             _customPurchaseInvoiceDetailService.UnconfirmObject(customPurchaseInvoiceDetail, _warehouseItemService, _warehouseService, _itemService, _barringService, _stockMutationService, _priceMutationService);
         }
         Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.CustomPurchaseInvoice, customPurchaseInvoice.Id);
         _payableService.SoftDeleteObject(payable);
         customPurchaseInvoice.Total = 0;
         customPurchaseInvoice.CoGS  = 0;
         _generalLedgerJournalService.CreateUnconfirmationJournalForCustomPurchaseInvoice(customPurchaseInvoice, _accountService);
         customPurchaseInvoice = _repository.UnconfirmObject(customPurchaseInvoice);
     }
     return(customPurchaseInvoice);
 }
Ejemplo n.º 30
0
 public bool ValidCreateObject(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService,
                               IPayableService _payableService, IContactService _contactService, ICashBankService _cashBankService)
 {
     VCreateObject(paymentVoucher, _paymentVoucherService, _paymentVoucherDetailService, _payableService, _contactService, _cashBankService);
     return(isValid(paymentVoucher));
 }