From 7b1d103f6629da5c516afba8361322599722c687 Mon Sep 17 00:00:00 2001 From: "Johannes Berndorfer (berndoJ)" Date: Sun, 24 May 2020 21:51:25 +0200 Subject: [PATCH] Implement #341 / #404 Implements the feature described in issue #341 / #404 (related / duplicates) This simply adds a check to the report calculation which takes the packagingUnit into account. If the part count (so the missing parts which have to be ordered) is not larger than the packagingUnit of the part distributor, that distributor is omitted (by the continue keyword). --- .../js/Components/Project/ProjectReportResultGrid.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js index 440448299..62e1b61c4 100644 --- a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js +++ b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js @@ -439,7 +439,7 @@ Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", { }, processCheapestDistributorForProjectPart: function (projectPart) { - var cheapestDistributor = this.getCheapestDistributor(projectPart.getPart()); + var cheapestDistributor = this.getCheapestDistributor(projectPart.getPart(), projectPart.get("missing")); if (cheapestDistributor !== null) { @@ -450,7 +450,7 @@ Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", { projectPart.set("itemSum", projectPart.get("quantity") * projectPart.get("itemPrice")); } }, - getCheapestDistributor: function (part) + getCheapestDistributor: function (part, partCount) { var cheapestDistributor = null; var currentPrice; @@ -475,6 +475,11 @@ Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", { continue; } + if (activeDistributor.get("packagingUnit") > partCount) + { + continue; + } + currentPrice = parseFloat(activeDistributor.get("price")); if (currentPrice !== 0)