FIX[BE]: fixing umur on closing penjualan for penjualan OVK and PAKAN

This commit is contained in:
aguhh18
2026-01-23 10:32:40 +07:00
parent b1b50c3c01
commit 6b4eb758e4
2 changed files with 13 additions and 5 deletions
@@ -311,14 +311,11 @@ func (s salesOrdersService) UpdateOne(c *fiber.Ctx, req *validation.Update, id u
}
}
// Hitung total_weight dan total_price berdasarkan flag
totalWeight := rp.Qty * rp.AvgWeight
var totalPrice float64
if isPakanOrOVK {
// PAKAN atau OVK: qty × unit_price
totalPrice = rp.Qty * rp.UnitPrice
} else {
// Produk lain: total_weight × unit_price
totalPrice = totalWeight * rp.UnitPrice
}