public StockAdjustment ConfirmObject(StockAdjustment stockAdjustment, DateTime ConfirmationDate, IStockAdjustmentDetailService _stockAdjustmentDetailService, IStockMutationService _stockMutationService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService) { stockAdjustment.ConfirmationDate = ConfirmationDate; if (_validator.ValidConfirmObject(stockAdjustment, this, _stockAdjustmentDetailService, _itemService, _barringService, _warehouseItemService)) { IList <StockAdjustmentDetail> stockAdjustmentDetails = _stockAdjustmentDetailService.GetObjectsByStockAdjustmentId(stockAdjustment.Id); foreach (var detail in stockAdjustmentDetails) { detail.Errors = new Dictionary <string, string>(); _stockAdjustmentDetailService.ConfirmObject(detail, ConfirmationDate, this, _stockMutationService, _itemService, _barringService, _warehouseItemService); } _repository.ConfirmObject(stockAdjustment); } return(stockAdjustment); }
public StockAdjustment ConfirmObject(StockAdjustment stockAdjustment, DateTime ConfirmationDate, IStockAdjustmentDetailService _stockAdjustmentDetailService, IStockMutationService _stockMutationService, IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { stockAdjustment.ConfirmationDate = ConfirmationDate; if (_validator.ValidConfirmObject(stockAdjustment, this, _stockAdjustmentDetailService, _itemService, _barringService, _warehouseItemService, _closingService)) { IList <StockAdjustmentDetail> stockAdjustmentDetails = _stockAdjustmentDetailService.GetObjectsByStockAdjustmentId(stockAdjustment.Id); foreach (var detail in stockAdjustmentDetails) { detail.Errors = new Dictionary <string, string>(); _stockAdjustmentDetailService.ConfirmObject(detail, ConfirmationDate, this, _stockMutationService, _itemService, _barringService, _warehouseItemService); stockAdjustment.Total += (detail.Quantity * detail.Price); } _generalLedgerJournalService.CreateConfirmationJournalForStockAdjustment(stockAdjustment, _accountService); _repository.ConfirmObject(stockAdjustment); } return(stockAdjustment); }