Skip to content

A free open source IT asset/license management system

Implement unit cost

Marcus Moorea1a7969d53d0
diff --git a/app/Http/Controllers/Reports/CustomComponentReportController.php b/app/Http/Controllers/Reports/CustomComponentReportController.php
index fa1609eac4..398d4b8864 100644
--- a/app/Http/Controllers/Reports/CustomComponentReportController.php
+++ b/app/Http/Controllers/Reports/CustomComponentReportController.php
@@ -88,6 +88,13 @@ class CustomComponentReportController extends Controller
]);
}
+ if ($request->filled(['unit_cost_start', 'unit_cost_end'])) {
+ $components->whereBetween('components.purchase_cost', [
+ $request->input('unit_cost_start'),
+ $request->input('unit_cost_end'),
+ ]);
+ }
+
$localConstraints = [
'by_model_number' => 'components.model_number',
'by_name' => 'components.name',
diff --git a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
index 3f713665e4..a54384726d 100644
--- a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
+++ b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
@@ -395,8 +395,6 @@ class CustomComponentReportTest extends TestCase
public function test_limiting_by_unit_cost()
{
- $this->markTestIncomplete();
-
Component::factory()->create(['name' => 'Component A', 'purchase_cost' => 10.00]);
Component::factory()->create(['name' => 'Component B', 'purchase_cost' => 500.00]);