public InventoryLedgerDto GetBeginningBalance(int customerId)
        {
            var inventoryLedger = new InventoryLedgerDto
            {
                CustomerId = customerId,
                Notes      = "Beginning Balance",
                PostDate   = DateTime.UtcNow
            };

            var ledgerEntries =
                inventoryLedgerRepository.Get(
                    x =>
                    x.CustomerId == customerId && x.ReferenceId == DataConstants.Inventory.BeginningBalanceId &&
                    x.InventoryLedgerTypeId == DataConstants.InventoryLedgerType.Adjustment);

            foreach (var entry in ledgerEntries)
            {
                if (entry.ProductTypeId == DataConstants.ProductTypes.Slim)
                {
                    inventoryLedger.SlimQty = entry.Quantity;
                }
                else if (entry.ProductTypeId == DataConstants.ProductTypes.Round)
                {
                    inventoryLedger.RoundQty = entry.Quantity;
                }
                inventoryLedger.PostDate = entry.PostDate;
            }
            return(inventoryLedger);
        }
        public ActionResult SaveAdjustment(InventoryLedgerDto inventoryLedger)
        {
            inventoryLedgerService.SetBeginningBalance(inventoryLedger);
            var customerInventoryDetail =
                InventorySummaryRepository.Get(x => x.CustomerId == inventoryLedger.CustomerId).FirstOrDefault();

            return(Json(customerInventoryDetail));
        }
 public void SetBeginningBalance(InventoryLedgerDto inventoryLedgerDto)
 {
     //Slim
     PostToLedger(DataConstants.Inventory.BeginningBalanceId, inventoryLedgerDto.CustomerId,
                  DataConstants.InventoryLedgerType.Adjustment, inventoryLedgerDto.PostDate,
                  DataConstants.ProductTypes.Slim, inventoryLedgerDto.SlimQty, inventoryLedgerDto.Notes);
     //Round
     PostToLedger(DataConstants.Inventory.BeginningBalanceId, inventoryLedgerDto.CustomerId,
                  DataConstants.InventoryLedgerType.Adjustment, inventoryLedgerDto.PostDate,
                  DataConstants.ProductTypes.Round, inventoryLedgerDto.RoundQty, inventoryLedgerDto.Notes);
 }