コード例 #1
0
        public ReceiptVoucher ReconcileObject(ReceiptVoucher receiptVoucher, DateTime ReconciliationDate, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                              ICashMutationService _cashMutationService, ICashBankService _cashBankService, IReceivableService _receivableService,
                                              IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            receiptVoucher.ReconciliationDate = ReconciliationDate;
            if (_validator.ValidReconcileObject(receiptVoucher, _closingService))
            {
                _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);
        }
コード例 #2
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);
        }
コード例 #3
0
        public CustomPurchaseInvoice UnpaidObject(CustomPurchaseInvoice customPurchaseInvoice, IPaymentVoucherService _paymentVoucherService,
                                                  IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService, IPayableService _payableService,
                                                  ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService,
                                                  IClosingService _closingService)
        {
            if (_validator.ValidUnpaidObject(customPurchaseInvoice, _closingService))
            {
                Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.CustomPurchaseInvoice, customPurchaseInvoice.Id);
                IList <PaymentVoucher> paymentVouchers = _paymentVoucherService.GetObjectsByCashBankId((int)customPurchaseInvoice.CashBankId.GetValueOrDefault());
                foreach (var paymentVoucher in paymentVouchers)
                {
                    if (paymentVoucher.ContactId == customPurchaseInvoice.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);
                    }
                }
                customPurchaseInvoice.AmountPaid    = 0;
                customPurchaseInvoice.IsFullPayment = false;
                _generalLedgerJournalService.CreateUnpaidJournalForCustomPurchaseInvoice(customPurchaseInvoice, _accountService);
                customPurchaseInvoice = _repository.UnpaidObject(customPurchaseInvoice);
            }
            return(customPurchaseInvoice);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
 public CashBankMutationController()
 {
     _cashBankAdjustmentService = new CashBankAdjustmentService(new CashBankAdjustmentRepository(), new CashBankAdjustmentValidator());
     _cashBankService           = new CashBankService(new CashBankRepository(), new CashBankValidator());
     _cashMutationService       = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
     _cashBankMutationService   = new CashBankMutationService(new CashBankMutationRepository(), new CashBankMutationValidator());
 }
コード例 #7
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);
        }
コード例 #8
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);
        }
コード例 #9
0
 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());
 }
コード例 #10
0
 public CashBankAdjustmentController()
 {
     _cashBankAdjustmentService   = new CashBankAdjustmentService(new CashBankAdjustmentRepository(), new CashBankAdjustmentValidator());
     _cashBankService             = new CashBankService(new CashBankRepository(), new CashBankValidator());
     _cashMutationService         = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
     _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());
 }
コード例 #11
0
        public CashBank VHasNoCashMutation(CashBank cashBank, ICashMutationService _cashMutationService)
        {
            IList <CashMutation> cashMutations = _cashMutationService.GetObjectsByCashBankId(cashBank.Id);

            if (cashMutations.Any())
            {
                cashBank.Errors.Add("Generic", "Tidak boleh ada asosiasi dengan cash mutations");
            }
            return(cashBank);
        }
コード例 #12
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);
 }
コード例 #13
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);
 }
コード例 #14
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());
 }
コード例 #15
0
        public CustomPurchaseInvoice PaidObject(CustomPurchaseInvoice customPurchaseInvoice, decimal AmountPaid, ICashBankService _cashBankService, IPayableService _payableService,
                                                IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService, IContactService _contactService,
                                                ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService,
                                                IClosingService _closingService)
        {
            customPurchaseInvoice.AmountPaid = AmountPaid;
            if (_validator.ValidPaidObject(customPurchaseInvoice, _cashBankService, _paymentVoucherService, _closingService))
            {
                CashBank cashBank = _cashBankService.GetObjectById((int)customPurchaseInvoice.CashBankId.GetValueOrDefault());
                customPurchaseInvoice.IsBank = cashBank.IsBank;

                if (!customPurchaseInvoice.IsGBCH)
                {
                    customPurchaseInvoice.GBCH_No     = null;
                    customPurchaseInvoice.Description = null;
                }
                if (customPurchaseInvoice.AmountPaid == customPurchaseInvoice.Total)
                {
                    customPurchaseInvoice.IsFullPayment = true;
                }
                Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.CustomPurchaseInvoice, customPurchaseInvoice.Id);
                payable.AllowanceAmount = customPurchaseInvoice.Allowance;
                payable.RemainingAmount = payable.Amount - customPurchaseInvoice.Allowance;
                _payableService.UpdateObject(payable);
                PaymentVoucher paymentVoucher = _paymentVoucherService.CreateObject((int)customPurchaseInvoice.CashBankId.GetValueOrDefault(), customPurchaseInvoice.ContactId, DateTime.Now, customPurchaseInvoice.AmountPaid.GetValueOrDefault() /*payable.RemainingAmount*/,
                                                                                    customPurchaseInvoice.IsGBCH, (DateTime)customPurchaseInvoice.DueDate.GetValueOrDefault(), customPurchaseInvoice.IsBank, _paymentVoucherDetailService,
                                                                                    _payableService, _contactService, _cashBankService);
                PaymentVoucherDetail paymentVoucherDetail = _paymentVoucherDetailService.CreateObject(paymentVoucher.Id, payable.Id, customPurchaseInvoice.AmountPaid.GetValueOrDefault(),
                                                                                                      "Automatic Payment", _paymentVoucherService, _cashBankService, _payableService);

                customPurchaseInvoice = _repository.PaidObject(customPurchaseInvoice);
                _generalLedgerJournalService.CreatePaidJournalForCustomPurchaseInvoice(customPurchaseInvoice, _accountService);
                _paymentVoucherService.ConfirmObject(paymentVoucher, (DateTime)customPurchaseInvoice.ConfirmationDate.GetValueOrDefault(), _paymentVoucherDetailService,
                                                     _cashBankService, _payableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);
            }

            return(customPurchaseInvoice);
        }
コード例 #16
0
 public CashSalesReturn PaidObject(CashSalesReturn cashSalesReturn, /*decimal Allowance,*/ ICashBankService _cashBankService, IPayableService _payableService,
                                   IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService,
                                   IContactService _contactService, ICashMutationService _cashMutationService,
                                   IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
 {
     if (_validator.ValidPaidObject(cashSalesReturn, _cashBankService))
     {
         CashBank cashBank = _cashBankService.GetObjectById((int)cashSalesReturn.CashBankId.GetValueOrDefault());
         //cashSalesReturn.Allowance = Allowance;
         Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.CashSalesReturn, cashSalesReturn.Id);
         payable.AllowanceAmount = cashSalesReturn.Allowance;
         payable.RemainingAmount = payable.Amount - payable.AllowanceAmount;
         _payableService.UpdateObject(payable);
         PaymentVoucher paymentVoucher = _paymentVoucherService.CreateObject((int)cashSalesReturn.CashBankId.GetValueOrDefault(), payable.ContactId,
                                                                             DateTime.Now, payable.RemainingAmount, false, payable.DueDate, cashBank.IsBank,
                                                                             _paymentVoucherDetailService, _payableService, _contactService, _cashBankService);
         PaymentVoucherDetail paymentVoucherDetail = _paymentVoucherDetailService.CreateObject(paymentVoucher.Id, payable.Id, payable.RemainingAmount,
                                                                                               "Automatic Payment", _paymentVoucherService, _cashBankService, _payableService);
         _paymentVoucherService.ConfirmObject(paymentVoucher, (DateTime)cashSalesReturn.ConfirmationDate.GetValueOrDefault(), _paymentVoucherDetailService,
                                              _cashBankService, _payableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);
         cashSalesReturn = _repository.PaidObject(cashSalesReturn);
     }
     return(cashSalesReturn);
 }
コード例 #17
0
 public bool ValidDeleteObject(CashBank cashBank, ICashMutationService _cashMutationService)
 {
     cashBank.Errors.Clear();
     VDeleteObject(cashBank, _cashMutationService);
     return(isValid(cashBank));
 }
コード例 #18
0
 public CashBank VDeleteObject(CashBank cashBank, ICashMutationService _cashMutationService)
 {
     VHasNoCashMutation(cashBank, _cashMutationService);
     return(cashBank);
 }
コード例 #19
0
        public PurchaseBuilder()
        {
            _barringService                  = new BarringService(new BarringRepository(), new BarringValidator());
            _barringOrderService             = new BarringOrderService(new BarringOrderRepository(), new BarringOrderValidator());
            _barringOrderDetailService       = new BarringOrderDetailService(new BarringOrderDetailRepository(), new BarringOrderDetailValidator());
            _cashBankAdjustmentService       = new CashBankAdjustmentService(new CashBankAdjustmentRepository(), new CashBankAdjustmentValidator());
            _cashBankMutationService         = new CashBankMutationService(new CashBankMutationRepository(), new CashBankMutationValidator());
            _cashBankService                 = new CashBankService(new CashBankRepository(), new CashBankValidator());
            _cashMutationService             = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
            _coreBuilderService              = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator());
            _coreIdentificationDetailService = new CoreIdentificationDetailService(new CoreIdentificationDetailRepository(), new CoreIdentificationDetailValidator());
            _coreIdentificationService       = new CoreIdentificationService(new CoreIdentificationRepository(), new CoreIdentificationValidator());
            _contactService                  = new ContactService(new ContactRepository(), new ContactValidator());
            _deliveryOrderService            = new DeliveryOrderService(new DeliveryOrderRepository(), new DeliveryOrderValidator());
            _deliveryOrderDetailService      = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
            _itemService                          = new ItemService(new ItemRepository(), new ItemValidator());
            _itemTypeService                      = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator());
            _machineService                       = new MachineService(new MachineRepository(), new MachineValidator());
            _payableService                       = new PayableService(new PayableRepository(), new PayableValidator());
            _paymentVoucherDetailService          = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
            _paymentVoucherService                = new PaymentVoucherService(new PaymentVoucherRepository(), new PaymentVoucherValidator());
            _purchaseInvoiceDetailService         = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator());
            _purchaseInvoiceService               = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator());
            _purchaseOrderService                 = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
            _purchaseOrderDetailService           = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
            _purchaseReceivalService              = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
            _purchaseReceivalDetailService        = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
            _receivableService                    = new ReceivableService(new ReceivableRepository(), new ReceivableValidator());
            _receiptVoucherDetailService          = new ReceiptVoucherDetailService(new ReceiptVoucherDetailRepository(), new ReceiptVoucherDetailValidator());
            _receiptVoucherService                = new ReceiptVoucherService(new ReceiptVoucherRepository(), new ReceiptVoucherValidator());
            _recoveryOrderDetailService           = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator());
            _recoveryOrderService                 = new RecoveryOrderService(new RecoveryOrderRepository(), new RecoveryOrderValidator());
            _recoveryAccessoryDetailService       = new RecoveryAccessoryDetailService(new RecoveryAccessoryDetailRepository(), new RecoveryAccessoryDetailValidator());
            _rollerBuilderService                 = new RollerBuilderService(new RollerBuilderRepository(), new RollerBuilderValidator());
            _rollerTypeService                    = new RollerTypeService(new RollerTypeRepository(), new RollerTypeValidator());
            _rollerWarehouseMutationDetailService = new RollerWarehouseMutationDetailService(new RollerWarehouseMutationDetailRepository(), new RollerWarehouseMutationDetailValidator());
            _rollerWarehouseMutationService       = new RollerWarehouseMutationService(new RollerWarehouseMutationRepository(), new RollerWarehouseMutationValidator());
            _salesInvoiceDetailService            = new SalesInvoiceDetailService(new SalesInvoiceDetailRepository(), new SalesInvoiceDetailValidator());
            _salesInvoiceService                  = new SalesInvoiceService(new SalesInvoiceRepository(), new SalesInvoiceValidator());
            _salesOrderService                    = new SalesOrderService(new SalesOrderRepository(), new SalesOrderValidator());
            _salesOrderDetailService              = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator());
            _stockAdjustmentDetailService         = new StockAdjustmentDetailService(new StockAdjustmentDetailRepository(), new StockAdjustmentDetailValidator());
            _stockAdjustmentService               = new StockAdjustmentService(new StockAdjustmentRepository(), new StockAdjustmentValidator());
            _stockMutationService                 = new StockMutationService(new StockMutationRepository(), new StockMutationValidator());
            _uomService                          = new UoMService(new UoMRepository(), new UoMValidator());
            _warehouseItemService                = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator());
            _warehouseService                    = new WarehouseService(new WarehouseRepository(), new WarehouseValidator());
            _warehouseMutationOrderService       = new WarehouseMutationOrderService(new WarehouseMutationOrderRepository(), new WarehouseMutationOrderValidator());
            _warehouseMutationOrderDetailService = new WarehouseMutationOrderDetailService(new WarehouseMutationOrderDetailRepository(), new WarehouseMutationOrderDetailValidator());

            typeAccessory    = _itemTypeService.CreateObject("Accessory", "Accessory");
            typeBar          = _itemTypeService.CreateObject("Bar", "Bar");
            typeBarring      = _itemTypeService.CreateObject("Barring", "Barring", true);
            typeBearing      = _itemTypeService.CreateObject("Bearing", "Bearing");
            typeBlanket      = _itemTypeService.CreateObject("Blanket", "Blanket");
            typeChemical     = _itemTypeService.CreateObject("Chemical", "Chemical");
            typeCompound     = _itemTypeService.CreateObject("Compound", "Compound");
            typeConsumable   = _itemTypeService.CreateObject("Consumable", "Consumable");
            typeCore         = _itemTypeService.CreateObject("Core", "Core", true);
            typeGlue         = _itemTypeService.CreateObject("Glue", "Glue");
            typeUnderpacking = _itemTypeService.CreateObject("Underpacking", "Underpacking");
            typeRoller       = _itemTypeService.CreateObject("Roller", "Roller", true);

            typeDamp       = _rollerTypeService.CreateObject("Damp", "Damp");
            typeFoundDT    = _rollerTypeService.CreateObject("Found DT", "Found DT");
            typeInkFormX   = _rollerTypeService.CreateObject("Ink Form X", "Ink Form X");
            typeInkDistD   = _rollerTypeService.CreateObject("Ink Dist D", "Ink Dist D");
            typeInkDistM   = _rollerTypeService.CreateObject("Ink Dist M", "Ink Dist M");
            typeInkDistE   = _rollerTypeService.CreateObject("Ink Dist E", "Ink Dist E");
            typeInkDuctB   = _rollerTypeService.CreateObject("Ink Duct B", "Ink Duct B");
            typeInkDistH   = _rollerTypeService.CreateObject("Ink Dist H", "Ink Dist H");
            typeInkFormW   = _rollerTypeService.CreateObject("Ink Form W", "Ink Form W");
            typeInkDistHQ  = _rollerTypeService.CreateObject("Ink Dist HQ", "Ink Dist HQ");
            typeDampFormDQ = _rollerTypeService.CreateObject("Damp Form DQ", "Damp Form DQ");
            typeInkFormY   = _rollerTypeService.CreateObject("Ink Form Y", "Ink Form Y");
        }
コード例 #20
0
 public CashBankAdjustment UnconfirmObject(CashBankAdjustment cashBankAdjustment, ICashMutationService _cashMutationService, ICashBankService _cashBankService)
 {
     if (_validator.ValidUnconfirmObject(cashBankAdjustment, _cashBankService))
     {
         CashBank             cashBank      = _cashBankService.GetObjectById(cashBankAdjustment.CashBankId);
         IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForCashBankAdjustment(cashBankAdjustment, cashBank);
         // cashBank.Amount -= cashBankAdjustment.Amount;
         foreach (var cashMutation in cashMutations)
         {
             _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
         }
         _repository.UnconfirmObject(cashBankAdjustment);
     }
     return(cashBankAdjustment);
 }
コード例 #21
0
 public MstCashBankController()
 {
     _cashBankService     = new CashBankService(new CashBankRepository(), new CashBankValidator());
     _cashMutationService = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
 }
コード例 #22
0
        public ReceiptVoucher ConfirmObject(ReceiptVoucher receiptVoucher, DateTime ConfirmationDate, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                            ICashBankService _cashBankService, IReceivableService _receivableService, ICashMutationService _cashMutationService)
        {
            receiptVoucher.ConfirmationDate = ConfirmationDate;
            if (_validator.ValidConfirmObject(receiptVoucher, this, _receiptVoucherDetailService, _cashBankService, _receivableService))
            {
                IList <ReceiptVoucherDetail> details = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var detail in details)
                {
                    detail.Errors = new Dictionary <string, string>();
                    _receiptVoucherDetailService.ConfirmObject(detail, ConfirmationDate, this, _receivableService);
                }
                _repository.ConfirmObject(receiptVoucher);

                if (!receiptVoucher.IsGBCH)
                {
                    CashBank     cashBank     = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                    CashMutation cashMutation = _cashMutationService.CreateCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                    _cashMutationService.CashMutateObject(cashMutation, _cashBankService);
                }
            }
            return(receiptVoucher);
        }
コード例 #23
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);
        }
コード例 #24
0
 public CashBankAdjustment ConfirmObject(CashBankAdjustment cashBankAdjustment, DateTime ConfirmationDate, ICashMutationService _cashMutationService, ICashBankService _cashBankService,
                                         IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
 {
     cashBankAdjustment.ConfirmationDate = ConfirmationDate;
     if (_validator.ValidConfirmObject(cashBankAdjustment, _cashBankService, _closingService))
     {
         CashBank     cashBank     = _cashBankService.GetObjectById(cashBankAdjustment.CashBankId);
         CashMutation cashMutation = _cashMutationService.CreateCashMutationForCashBankAdjustment(cashBankAdjustment, cashBank);
         // cashBank.Amount += cashBankAdjustment.Amount;
         _cashMutationService.CashMutateObject(cashMutation, _cashBankService);
         _generalLedgerJournalService.CreateConfirmationJournalForCashBankAdjustment(cashBankAdjustment, cashBank, _accountService);
         _repository.ConfirmObject(cashBankAdjustment);
     }
     return(cashBankAdjustment);
 }
コード例 #25
0
 public CashBankAdjustment UnconfirmObject(CashBankAdjustment cashBankAdjustment, ICashMutationService _cashMutationService, ICashBankService _cashBankService,
                                           IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
 {
     if (_validator.ValidUnconfirmObject(cashBankAdjustment, _cashBankService, _closingService))
     {
         CashBank             cashBank      = _cashBankService.GetObjectById(cashBankAdjustment.CashBankId);
         IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForCashBankAdjustment(cashBankAdjustment, cashBank);
         // cashBank.Amount -= cashBankAdjustment.Amount;
         foreach (var cashMutation in cashMutations)
         {
             _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
         }
         _generalLedgerJournalService.CreateUnconfirmationJournalForCashBankAdjustment(cashBankAdjustment, cashBank, _accountService);
         _repository.UnconfirmObject(cashBankAdjustment);
     }
     return(cashBankAdjustment);
 }
コード例 #26
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);
        }
コード例 #27
0
        public CashSalesInvoice UnpaidObject(CashSalesInvoice cashSalesInvoice, IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                             ICashBankService _cashBankService, IReceivableService _receivableService, ICashMutationService _cashMutationService,
                                             ICashSalesReturnService _cashSalesReturnService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService,
                                             IClosingService _closingService)
        {
            if (_validator.ValidUnpaidObject(cashSalesInvoice, _cashSalesReturnService, _closingService))
            {
                Receivable             receivable      = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.CashSalesInvoice, cashSalesInvoice.Id);
                IList <ReceiptVoucher> receiptVouchers = _receiptVoucherService.GetObjectsByCashBankId((int)cashSalesInvoice.CashBankId.GetValueOrDefault());
                foreach (var receiptVoucher in receiptVouchers)
                {
                    if (receiptVoucher.ContactId == receivable.ContactId)
                    {
                        receiptVoucher.Errors = new Dictionary <string, string>();
                        _receiptVoucherService.UnconfirmObject(receiptVoucher, _receiptVoucherDetailService, _cashBankService, _receivableService,
                                                               _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);

                        IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                        foreach (var receiptVoucherDetail in receiptVoucherDetails)
                        {
                            receiptVoucherDetail.Errors = new Dictionary <string, string>();
                            _receiptVoucherDetailService.SoftDeleteObject(receiptVoucherDetail);
                        }
                        _receiptVoucherService.SoftDeleteObject(receiptVoucher, _receiptVoucherDetailService);
                    }
                }
                receivable.AllowanceAmount = 0;
                _receivableService.UpdateObject(receivable);
                cashSalesInvoice.AmountPaid    = 0;
                cashSalesInvoice.IsFullPayment = false;
                cashSalesInvoice.Allowance     = 0;
                _generalLedgerJournalService.CreateUnpaidJournalForCashSalesInvoice(cashSalesInvoice, _accountService);
                cashSalesInvoice = _repository.UnpaidObject(cashSalesInvoice);
            }
            return(cashSalesInvoice);
        }
コード例 #28
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);
 }
コード例 #29
0
        public PurchaseBuilder()
        {
            _accountService                  = new AccountService(new AccountRepository(), new AccountValidator());
            _barringService                  = new BarringService(new BarringRepository(), new BarringValidator());
            _barringOrderService             = new BarringOrderService(new BarringOrderRepository(), new BarringOrderValidator());
            _barringOrderDetailService       = new BarringOrderDetailService(new BarringOrderDetailRepository(), new BarringOrderDetailValidator());
            _cashBankAdjustmentService       = new CashBankAdjustmentService(new CashBankAdjustmentRepository(), new CashBankAdjustmentValidator());
            _cashBankMutationService         = new CashBankMutationService(new CashBankMutationRepository(), new CashBankMutationValidator());
            _cashBankService                 = new CashBankService(new CashBankRepository(), new CashBankValidator());
            _cashMutationService             = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
            _closingService                  = new ClosingService(new ClosingRepository(), new ClosingValidator());
            _coreBuilderService              = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator());
            _coreIdentificationDetailService = new CoreIdentificationDetailService(new CoreIdentificationDetailRepository(), new CoreIdentificationDetailValidator());
            _coreIdentificationService       = new CoreIdentificationService(new CoreIdentificationRepository(), new CoreIdentificationValidator());
            _contactService                  = new ContactService(new ContactRepository(), new ContactValidator());
            _deliveryOrderService            = new DeliveryOrderService(new DeliveryOrderRepository(), new DeliveryOrderValidator());
            _deliveryOrderDetailService      = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
            _generalLedgerJournalService     = new GeneralLedgerJournalService(new GeneralLedgerJournalRepository(), new GeneralLedgerJournalValidator());
            _itemService                          = new ItemService(new ItemRepository(), new ItemValidator());
            _itemTypeService                      = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator());
            _machineService                       = new MachineService(new MachineRepository(), new MachineValidator());
            _payableService                       = new PayableService(new PayableRepository(), new PayableValidator());
            _paymentVoucherDetailService          = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
            _paymentVoucherService                = new PaymentVoucherService(new PaymentVoucherRepository(), new PaymentVoucherValidator());
            _purchaseInvoiceDetailService         = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator());
            _purchaseInvoiceService               = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator());
            _purchaseOrderService                 = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
            _purchaseOrderDetailService           = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
            _purchaseReceivalService              = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
            _purchaseReceivalDetailService        = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
            _receivableService                    = new ReceivableService(new ReceivableRepository(), new ReceivableValidator());
            _receiptVoucherDetailService          = new ReceiptVoucherDetailService(new ReceiptVoucherDetailRepository(), new ReceiptVoucherDetailValidator());
            _receiptVoucherService                = new ReceiptVoucherService(new ReceiptVoucherRepository(), new ReceiptVoucherValidator());
            _recoveryOrderDetailService           = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator());
            _recoveryOrderService                 = new RecoveryOrderService(new RecoveryOrderRepository(), new RecoveryOrderValidator());
            _recoveryAccessoryDetailService       = new RecoveryAccessoryDetailService(new RecoveryAccessoryDetailRepository(), new RecoveryAccessoryDetailValidator());
            _rollerBuilderService                 = new RollerBuilderService(new RollerBuilderRepository(), new RollerBuilderValidator());
            _rollerTypeService                    = new RollerTypeService(new RollerTypeRepository(), new RollerTypeValidator());
            _rollerWarehouseMutationDetailService = new RollerWarehouseMutationDetailService(new RollerWarehouseMutationDetailRepository(), new RollerWarehouseMutationDetailValidator());
            _rollerWarehouseMutationService       = new RollerWarehouseMutationService(new RollerWarehouseMutationRepository(), new RollerWarehouseMutationValidator());
            _salesInvoiceDetailService            = new SalesInvoiceDetailService(new SalesInvoiceDetailRepository(), new SalesInvoiceDetailValidator());
            _salesInvoiceService                  = new SalesInvoiceService(new SalesInvoiceRepository(), new SalesInvoiceValidator());
            _salesOrderService                    = new SalesOrderService(new SalesOrderRepository(), new SalesOrderValidator());
            _salesOrderDetailService              = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator());
            _stockAdjustmentDetailService         = new StockAdjustmentDetailService(new StockAdjustmentDetailRepository(), new StockAdjustmentDetailValidator());
            _stockAdjustmentService               = new StockAdjustmentService(new StockAdjustmentRepository(), new StockAdjustmentValidator());
            _stockMutationService                 = new StockMutationService(new StockMutationRepository(), new StockMutationValidator());
            _uomService                          = new UoMService(new UoMRepository(), new UoMValidator());
            _validCombService                    = new ValidCombService(new ValidCombRepository(), new ValidCombValidator());
            _warehouseItemService                = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator());
            _warehouseService                    = new WarehouseService(new WarehouseRepository(), new WarehouseValidator());
            _warehouseMutationOrderService       = new WarehouseMutationOrderService(new WarehouseMutationOrderRepository(), new WarehouseMutationOrderValidator());
            _warehouseMutationOrderDetailService = new WarehouseMutationOrderDetailService(new WarehouseMutationOrderDetailRepository(), new WarehouseMutationOrderDetailValidator());

            _priceMutationService = new PriceMutationService(new PriceMutationRepository(), new PriceMutationValidator());
            _contactGroupService  = new ContactGroupService(new ContactGroupRepository(), new ContactGroupValidator());

            typeAccessory    = _itemTypeService.CreateObject("Accessory", "Accessory");
            typeBar          = _itemTypeService.CreateObject("Bar", "Bar");
            typeBarring      = _itemTypeService.CreateObject("Barring", "Barring", true);
            typeBearing      = _itemTypeService.CreateObject("Bearing", "Bearing");
            typeBlanket      = _itemTypeService.CreateObject("Blanket", "Blanket");
            typeChemical     = _itemTypeService.CreateObject("Chemical", "Chemical");
            typeCompound     = _itemTypeService.CreateObject("Compound", "Compound");
            typeConsumable   = _itemTypeService.CreateObject("Consumable", "Consumable");
            typeCore         = _itemTypeService.CreateObject("Core", "Core", true);
            typeGlue         = _itemTypeService.CreateObject("Glue", "Glue");
            typeUnderpacking = _itemTypeService.CreateObject("Underpacking", "Underpacking");
            typeRoller       = _itemTypeService.CreateObject("Roller", "Roller", true);

            typeDamp       = _rollerTypeService.CreateObject("Damp", "Damp");
            typeFoundDT    = _rollerTypeService.CreateObject("Found DT", "Found DT");
            typeInkFormX   = _rollerTypeService.CreateObject("Ink Form X", "Ink Form X");
            typeInkDistD   = _rollerTypeService.CreateObject("Ink Dist D", "Ink Dist D");
            typeInkDistM   = _rollerTypeService.CreateObject("Ink Dist M", "Ink Dist M");
            typeInkDistE   = _rollerTypeService.CreateObject("Ink Dist E", "Ink Dist E");
            typeInkDuctB   = _rollerTypeService.CreateObject("Ink Duct B", "Ink Duct B");
            typeInkDistH   = _rollerTypeService.CreateObject("Ink Dist H", "Ink Dist H");
            typeInkFormW   = _rollerTypeService.CreateObject("Ink Form W", "Ink Form W");
            typeInkDistHQ  = _rollerTypeService.CreateObject("Ink Dist HQ", "Ink Dist HQ");
            typeDampFormDQ = _rollerTypeService.CreateObject("Damp Form DQ", "Damp Form DQ");
            typeInkFormY   = _rollerTypeService.CreateObject("Ink Form Y", "Ink Form Y");

            baseGroup = _contactGroupService.CreateObject(Core.Constants.Constant.GroupType.Base, "Base Group", true);

            if (!_accountService.GetLegacyObjects().Any())
            {
                Asset = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Asset", Code = Constant.AccountCode.Asset, LegacyCode = Constant.AccountLegacyCode.Asset, Level = 1, Group = Constant.AccountGroup.Asset, IsLegacy = true
                }, _accountService);
                CashBank = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "CashBank", Code = Constant.AccountCode.CashBank, LegacyCode = Constant.AccountLegacyCode.CashBank, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);
                AccountReceivable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Account Receivable", IsLeaf = true, Code = Constant.AccountCode.AccountReceivable, LegacyCode = Constant.AccountLegacyCode.AccountReceivable, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);
                GBCHReceivable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "GBCH Receivable", IsLeaf = true, Code = Constant.AccountCode.GBCHReceivable, LegacyCode = Constant.AccountLegacyCode.GBCHReceivable, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);
                Inventory = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Inventory", IsLeaf = true, Code = Constant.AccountCode.Inventory, LegacyCode = Constant.AccountLegacyCode.Inventory, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);

                Expense = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Expense", Code = Constant.AccountCode.Expense, LegacyCode = Constant.AccountLegacyCode.Expense, Level = 1, Group = Constant.AccountGroup.Expense, IsLegacy = true
                }, _accountService);
                CashBankAdjustmentExpense = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "CashBank Adjustment Expense", IsLeaf = true, Code = Constant.AccountCode.CashBankAdjustmentExpense, LegacyCode = Constant.AccountLegacyCode.CashBankAdjustmentExpense, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                COGS = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Cost Of Goods Sold", IsLeaf = true, Code = Constant.AccountCode.COGS, LegacyCode = Constant.AccountLegacyCode.COGS, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                Discount = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Discount", IsLeaf = true, Code = Constant.AccountCode.Discount, LegacyCode = Constant.AccountLegacyCode.Discount, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                SalesAllowance = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Sales Allowance", IsLeaf = true, Code = Constant.AccountCode.SalesAllowance, LegacyCode = Constant.AccountLegacyCode.SalesAllowance, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                StockAdjustmentExpense = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Stock Adjustment Expense", IsLeaf = true, Code = Constant.AccountCode.StockAdjustmentExpense, LegacyCode = Constant.AccountLegacyCode.StockAdjustmentExpense, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);

                Liability = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Liability", Code = Constant.AccountCode.Liability, LegacyCode = Constant.AccountLegacyCode.Liability, Level = 1, Group = Constant.AccountGroup.Liability, IsLegacy = true
                }, _accountService);
                AccountPayable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Account Payable", IsLeaf = true, Code = Constant.AccountCode.AccountPayable, LegacyCode = Constant.AccountLegacyCode.AccountPayable, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true
                }, _accountService);
                GBCHPayable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "GBCH Payable", IsLeaf = true, Code = Constant.AccountCode.GBCHPayable, LegacyCode = Constant.AccountLegacyCode.GBCHPayable, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true
                }, _accountService);
                GoodsPendingClearance = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Goods Pending Clearance", IsLeaf = true, Code = Constant.AccountCode.GoodsPendingClearance, LegacyCode = Constant.AccountLegacyCode.GoodsPendingClearance, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true
                }, _accountService);

                Equity = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Equity", Code = Constant.AccountCode.Equity, LegacyCode = Constant.AccountLegacyCode.Equity, Level = 1, Group = Constant.AccountGroup.Equity, IsLegacy = true
                }, _accountService);
                OwnersEquity = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Owners Equity", Code = Constant.AccountCode.OwnersEquity, LegacyCode = Constant.AccountLegacyCode.OwnersEquity, Level = 2, Group = Constant.AccountGroup.Equity, ParentId = Equity.Id, IsLegacy = true
                }, _accountService);
                EquityAdjustment = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Equity Adjustment", IsLeaf = true, Code = Constant.AccountCode.EquityAdjustment, LegacyCode = Constant.AccountLegacyCode.EquityAdjustment, Level = 3, Group = Constant.AccountGroup.Equity, ParentId = OwnersEquity.Id, IsLegacy = true
                }, _accountService);

                Revenue = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Revenue", IsLeaf = true, Code = Constant.AccountCode.Revenue, LegacyCode = Constant.AccountLegacyCode.Revenue, Level = 1, Group = Constant.AccountGroup.Revenue, IsLegacy = true
                }, _accountService);
            }
        }
コード例 #30
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);
        }