summaryrefslogtreecommitdiff
path: root/ShedCalc/BOMController.swift
diff options
context:
space:
mode:
Diffstat (limited to 'ShedCalc/BOMController.swift')
-rw-r--r--ShedCalc/BOMController.swift16
1 files changed, 11 insertions, 5 deletions
diff --git a/ShedCalc/BOMController.swift b/ShedCalc/BOMController.swift
index be70a65..35713e4 100644
--- a/ShedCalc/BOMController.swift
+++ b/ShedCalc/BOMController.swift
@@ -126,14 +126,20 @@ class BOMController {
}
private func calcWeatherWrap(from paramModel: ParamModel) -> MaterialItem {
+ let wrapRollArea = paramModel.wrapWidth * paramModel.wrapLength
+ let wrapPricePerMeter = paramModel.wrapPrice / wrapRollArea
+ let wrapArea = paramModel.totalWallArea()
+
+ let totalPieces = roundUpPieces(Double(wrapArea)/Double(wrapRollArea))
+ let totalPrice = Double(totalPieces) * paramModel.wrapPrice
return MaterialItem(
materialName: "Weather Wrap",
- pricePerMeter: Double(0.1),
- totalMeters: Double(0.1),
- totalPrice: Double(0.1),
- metersPerPiece:Double(0.1),
- totalPieces: Double(0.1)
+ pricePerMeter: wrapPricePerMeter,
+ totalMeters: wrapArea,
+ totalPrice: totalPrice,
+ metersPerPiece: paramModel.wrapPrice,
+ totalPieces: Double(totalPieces)
)
}