Example #1
0
        public void CreateOrderSummaryTest()
        {
            var testUser     = GetTestUser();
            var testCompany  = GetTestCompany(testUser, true);
            var testPurchase = GetTestPurchaseOrderHeader(testCompany, testUser, 10);

            var pohtModel = PurchasingService.CopyPurchaseOrderToTemp(testCompany, testPurchase, testUser);

            var pos = PurchasingService.CreateOrderSummary(pohtModel, testCompany.DateFormat);

            // 16/1/2018    TBD: Lines commented out below are because CreateOrderSummary does not
            //              populate them yet as allocations have not been implemented
            Assert.IsTrue(pos.OrderNumber != 0, $"Error: OrderNumber '{pos.OrderNumber}' was returned when a non-zero value was expected");
            Assert.IsTrue(pos.TotalCbms != 0, $"Error: TotalCbms '{pos.TotalCbms}' was returned when a non-zero value was expected");
            //Assert.IsTrue(pos.AllocValueEx != 0, $"Error: AllocValueEx '{pos.AllocValueEx}' was returned when a non-zero value was expected");
            Assert.IsTrue(pos.OrderValueEx != 0, $"Error: OrderValueEx '{pos.OrderValueEx}' was returned when a non-zero value was expected");
            //Assert.IsTrue(pos.AllocatedPercent != 0, $"Error: AllocatedPercent '{pos.AllocatedPercent}' was returned when a non-zero value was expected");

            // Can't check GST because it is permissible to be zero
            //Assert.IsTrue(pos.Tax != 0, $"Error: GST '{pos.Tax}' was returned when a non-zero value was expected");
            Assert.IsTrue(pos.Total != 0, $"Error: Total '{pos.Total}' was returned when a non-zero value was expected");

            Assert.IsTrue(!string.IsNullOrEmpty(pos.POStatusText), $"Error: POStatusText '{pos.POStatusText}' was returned when a non-empty value was expected");

            // Can't test the LandingDate field as it is caluculated from multiple other tables which haven't been set up in this test
            //Assert.IsTrue(!string.IsNullOrEmpty(pos.LandingDate), $"Error: LandingDate '{pos.LandingDate}' was returned when a non-empty value was expected");
            Assert.IsTrue(!string.IsNullOrEmpty(pos.RealisticRequiredDate), $"Error: RealisticRequiredDate '{pos.RealisticRequiredDate}' was returned when a non-empty value was expected");
            Assert.IsTrue(!string.IsNullOrEmpty(pos.RequiredDate), $"Error: RequiredDate '{pos.RequiredDate}' was returned when a non-empty value was expected");
            Assert.IsTrue(!string.IsNullOrEmpty(pos.CompletedDate), $"Error: CompletedDate '{pos.CompletedDate}' was returned when a non-empty value was expected");
        }
        public ActionResult GetOrderSummary(int id)
        {
            var poht  = PurchasingService.FindPurchaseOrderHeaderTempModel(id, CurrentCompany);
            var model = PurchasingService.CreateOrderSummary(poht, CurrentUser.DateFormat);

            model.CurrencySymbol = LookupService.FindCurrencySymbol(CurrentCompany.DefaultCurrencyID);
            return(View("OrderSummary", model));
        }