feat: reimplement with plan hppv2 flow and logics

This commit is contained in:
Adnan Zahir
2026-04-19 14:06:42 +07:00
parent 187e497f97
commit 58fbceea24
9 changed files with 1864 additions and 52 deletions
@@ -498,6 +498,29 @@ func (c *RepportController) GetProductionResult(ctx *fiber.Ctx) error {
})
}
func (c *RepportController) GetHppV2Breakdown(ctx *fiber.Ctx) error {
query := &validation.HppV2BreakdownQuery{
ProjectFlockKandangID: uint(ctx.QueryInt("project_flock_kandang_id", 0)),
Period: ctx.Query("period", ""),
}
if err := m.EnsureProjectFlockKandangAccess(ctx, c.RepportService.DB(), 0, query.ProjectFlockKandangID); err != nil {
return err
}
data, err := c.RepportService.GetHppV2Breakdown(ctx, query)
if err != nil {
return err
}
return ctx.Status(fiber.StatusOK).JSON(response.Success{
Code: fiber.StatusOK,
Status: "success",
Message: "Get HPP v2 breakdown successfully",
Data: data,
})
}
func parseCommaSeparatedInt64s(raw string) ([]int64, error) {
return parseCommaSeparatedInt64sWithField(raw, "supplier_ids")
}