dem3/CalculationHelper.cs
2025-11-18 17:27:48 +04:00

27 lines
654 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dem2
{
internal class CalculationHelper
{
public static decimal CalculateMinOrderCost(
int materialId,
decimal currentStock,
decimal minStock,
decimal packSize,
decimal pricePerUnit)
{
if (currentStock >= minStock) return 0;
decimal needed = minStock - currentStock;
decimal packsNeeded = Math.Ceiling(needed / packSize);
decimal totalUnits = packsNeeded * packSize;
return totalUnits * pricePerUnit;
}
}
}