private InventoryAdjustmentDto GetInventoryAdjustment2()
        {
            InventoryAdjustmentDto dto = new InventoryAdjustmentDto();
            dto.Date = DateTime.Now;
            dto.Summary = "Test Inventory Adjustment CRUD 2";
            dto.Notes = "Inventory Adjustmemt from API 2";
            dto.Tags = "IA, Test";

            InventoryAdjustmentItemDto item = new InventoryAdjustmentItemDto();
            item.Quantity = 2.5M;
            item.InventoryItemUid = this.HardDisk.Uid;
            item.AccountUid = this.ExpenseOffice.Uid;
            item.UnitPriceExclTax = 100.00M;
            item.TotalPriceExclTax = 250.00M;
            dto.Items.Add(item);

            return dto;
        }
示例#2
0
        public void InventoryAdjustments(List<Tuple<BuildItem, decimal>> itemQuantityList)
        {
            var itemList = new ArrayList();

            itemQuantityList.ForEach(iq =>
            {
                var dtoItem = new InventoryAdjustmentItemDto()
                {
                    AccountUid = _inventoryAccountId,
                    InventoryItemUid = iq.Item1.Id,
                    Quantity = iq.Item2,
                    TotalPriceExclTax = 1,
                    UnitPriceExclTax = 10
                };
                itemList.Add(dtoItem);
            });

            var legacyProxy = new Ola.RestClient.Proxies.InventoryAdjustmentProxy();

            var dtoAdjustment = new InventoryAdjustmentDto()
            {
                Date = DateTime.Now,
                Items = itemList
            };

            legacyProxy.Insert(dtoAdjustment);
        }
 private void AssertEqual(InventoryAdjustmentDto expected, InventoryAdjustmentDto actual)
 {
     foreach(InventoryAdjustmentItemDto expectedItem in expected.Items)
     {
         this.AssertExistsAndRemove(expectedItem, actual.Items);
     }
 }
        private InventoryAdjustmentDto GetInventoryAdjustment1()
        {
            InventoryAdjustmentDto dto = new InventoryAdjustmentDto();
            dto.Date = DateTime.Now;
            dto.Summary = "Test Inventory Adjustment CRUD";
            dto.Notes = "Inventory Adjustmemt from API";
            dto.Tags = "IA, Test";

            InventoryAdjustmentItemDto item = new InventoryAdjustmentItemDto();
            item.Quantity = 1;
            item.InventoryItemUid = this.Cat5Cable.Uid;
            item.AccountUid = this.AssetInventory.Uid;
            item.UnitPriceExclTax = 120.50M;
            item.TotalPriceExclTax = 120.50M;
            dto.Items.Add(item);

            item = new InventoryAdjustmentItemDto();
            item.Quantity = 2;
            item.InventoryItemUid = this.AsusLaptop.Uid;
            item.AccountUid = this.ExpenseOffice.Uid;
            item.UnitPriceExclTax = 100.25M;
            item.TotalPriceExclTax = 200.50M;
            dto.Items.Add(item);

            return dto;
        }
        public void TestUpdatingTotal()
        {
            CrudProxy proxy = new InventoryAdjustmentProxy();
            InventoryAdjustmentDto dto = new InventoryAdjustmentDto();
            dto.Date = DateTime.Now;

            InventoryAdjustmentItemDto dtoItem = new InventoryAdjustmentItemDto();
            dtoItem.InventoryItemUid = this.AsusLaptop.Uid;
            dtoItem.Quantity = 10;
            dtoItem.AccountUid = this.AssetInventory.Uid;
            dtoItem.UnitPriceExclTax = 150.00M;
            dtoItem.TotalPriceExclTax = 1500.00M;
            dto.Items.Add(dtoItem);

            proxy.Insert(dto);

            Assert.IsTrue(dto.Uid > 0, "Uid must be > 0 after save.");

            dto = new InventoryAdjustmentDto();
            dto.Date = DateTime.Now;
            dto.Summary = "Update Total only";

            dtoItem = new InventoryAdjustmentItemDto();
            dtoItem.InventoryItemUid = this.AsusLaptop.Uid;
            dtoItem.AccountUid = this.AssetInventory.Uid;
            dtoItem.TotalPriceExclTax = 1800.00M;
            dto.Items.Add(dtoItem);

            proxy.Insert(dto);

            Assert.IsTrue(dto.Uid > 0, "Uid must be > 0 after save.");

            InventoryAdjustmentDto dtoFromDB = (InventoryAdjustmentDto)proxy.GetByUid(dto.Uid);

            AssertEqual(dto, dtoFromDB);
        }
        public void TestUpdatingStockOnHand()
        {
            CrudProxy proxy = new InventoryAdjustmentProxy();
            InventoryAdjustmentDto dto = new InventoryAdjustmentDto();
            dto.Date = DateTime.Now;
            dto.Summary = "Update stock on hand only";

            InventoryAdjustmentItemDto dtoItem = new InventoryAdjustmentItemDto();
            dtoItem.InventoryItemUid = this.AsusLaptop.Uid;
            dtoItem.Quantity = 5;
            dto.Items.Add(dtoItem);

            proxy.Insert(dto);

            Assert.IsTrue(dto.Uid > 0, "Uid must be > 0 after save.");

            InventoryAdjustmentDto dtoFromDB = (InventoryAdjustmentDto)proxy.GetByUid(dto.Uid);

            AssertEqual(dto, dtoFromDB);
        }
 protected virtual ITask CreateUpdateTask(InventoryAdjustmentDto inventoryAdjustment)
 {
     UpdateInventoryAdjustmentTask task = (UpdateInventoryAdjustmentTask)base.CreateUpdateTask(inventoryAdjustment);
     return task;
 }
 protected virtual ITask CreateInsertTask(InventoryAdjustmentDto inventoryAdjustment)
 {
     InsertInventoryAdjustmentTask task = (InsertInventoryAdjustmentTask)base.CreateInsertTask(inventoryAdjustment);
     return task;
 }
        private InventoryAdjustmentDto GetInventoryAdjustment()
        {
            InventoryAdjustmentDto dto = new InventoryAdjustmentDto();
            dto.Date = DateTime.Now;
            dto.Summary = "Test Average Cost is returned for inventory item";

            InventoryAdjustmentItemDto item = new InventoryAdjustmentItemDto();
            item.Quantity = 2;
            item.InventoryItemUid = this.HardDisk.Uid;
            item.AccountUid = this.ExpenseOffice.Uid;
            item.UnitPriceExclTax = 200.50M;
            item.TotalPriceExclTax = 401.00M;
            dto.Items.Add(item);

            return dto;
        }