mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
feat: manual pullet cost
This commit is contained in:
@@ -347,6 +347,7 @@ func (s *repportService) GetExpenseDepreciationManualInputs(ctx *fiber.Ctx) ([]d
|
||||
ProjectFlockID: int64(row.ProjectFlockID),
|
||||
FarmName: row.FarmName,
|
||||
TotalCost: row.TotalCost,
|
||||
CutoverDate: row.CutoverDate.Format("2006-01-02"),
|
||||
Note: row.Note,
|
||||
})
|
||||
}
|
||||
@@ -397,10 +398,19 @@ func (s *repportService) UpsertExpenseDepreciationManualInput(ctx *fiber.Ctx, re
|
||||
if s.ExpenseDepreciationRepo == nil {
|
||||
return nil, fiber.NewError(fiber.StatusInternalServerError, "expense depreciation repository is not configured")
|
||||
}
|
||||
location, err := time.LoadLocation("Asia/Jakarta")
|
||||
if err != nil {
|
||||
return nil, fiber.NewError(fiber.StatusInternalServerError, "failed to load timezone configuration")
|
||||
}
|
||||
cutoverDate, err := time.ParseInLocation("2006-01-02", req.CutoverDate, location)
|
||||
if err != nil {
|
||||
return nil, fiber.NewError(fiber.StatusBadRequest, "cutover_date must follow format YYYY-MM-DD")
|
||||
}
|
||||
|
||||
row := entity.FarmDepreciationManualInput{
|
||||
ProjectFlockId: req.ProjectFlockID,
|
||||
TotalCost: req.TotalCost,
|
||||
CutoverDate: cutoverDate,
|
||||
Note: req.Note,
|
||||
}
|
||||
if err := s.ExpenseDepreciationRepo.UpsertManualInput(ctx.Context(), &row); err != nil {
|
||||
@@ -411,6 +421,7 @@ func (s *repportService) UpsertExpenseDepreciationManualInput(ctx *fiber.Ctx, re
|
||||
ID: int64(row.Id),
|
||||
ProjectFlockID: int64(row.ProjectFlockId),
|
||||
TotalCost: row.TotalCost,
|
||||
CutoverDate: row.CutoverDate.Format("2006-01-02"),
|
||||
Note: row.Note,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user