feat[BE]: membetulkan perhitungan hpp di module penjualan harian

This commit is contained in:
aguhh18
2025-12-18 09:58:31 +07:00
parent a7069a2e50
commit 1b23861656
11 changed files with 592 additions and 299 deletions
@@ -96,28 +96,8 @@ func (c *RepportController) GetMarketing(ctx *fiber.Ctx) error {
return err
}
// Calculate total summary from result items
var total *dto.Summary
if len(result) > 0 {
totalQty := 0
totalWeightKg := 0.0
totalSalesAmount := int64(0)
totalHppAmount := int64(0)
for _, item := range result {
totalQty += int(item.Qty)
totalWeightKg += item.TotalWeightKg
totalSalesAmount += int64(item.SalesAmount)
totalHppAmount += int64(item.HppAmount)
}
total = &dto.Summary{
TotalQty: totalQty,
TotalWeightKg: totalWeightKg,
TotalSalesAmount: totalSalesAmount,
TotalHppAmount: totalHppAmount,
}
}
total := dto.ToSummaryFromDTOItems(result)
return ctx.Status(fiber.StatusOK).
JSON(MarketingReportResponse{