mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 15:25:43 +00:00
feat: manual pullet cost
This commit is contained in:
@@ -33,6 +33,7 @@ type FarmDepreciationManualInputRow struct {
|
||||
ProjectFlockID uint
|
||||
FarmName string
|
||||
TotalCost float64
|
||||
CutoverDate time.Time
|
||||
Note *string
|
||||
}
|
||||
|
||||
@@ -271,6 +272,7 @@ func (r *expenseDepreciationRepository) GetLatestManualInputsByFarms(
|
||||
fdmi.project_flock_id AS project_flock_id,
|
||||
pf.flock_name AS farm_name,
|
||||
fdmi.total_cost AS total_cost,
|
||||
fdmi.cutover_date AS cutover_date,
|
||||
fdmi.note AS note
|
||||
`).
|
||||
Joins("JOIN project_flocks AS pf ON pf.id = fdmi.project_flock_id").
|
||||
@@ -308,9 +310,10 @@ func (r *expenseDepreciationRepository) UpsertManualInput(ctx context.Context, r
|
||||
{Name: "project_flock_id"},
|
||||
},
|
||||
DoUpdates: clause.Assignments(map[string]any{
|
||||
"total_cost": row.TotalCost,
|
||||
"note": row.Note,
|
||||
"updated_at": now,
|
||||
"total_cost": row.TotalCost,
|
||||
"cutover_date": row.CutoverDate,
|
||||
"note": row.Note,
|
||||
"updated_at": now,
|
||||
}),
|
||||
}).
|
||||
Create(row).Error
|
||||
@@ -320,7 +323,7 @@ func (r *expenseDepreciationRepository) UpsertManualInput(ctx context.Context, r
|
||||
|
||||
return r.db.WithContext(ctx).
|
||||
Table("farm_depreciation_manual_inputs").
|
||||
Select("id, project_flock_id, total_cost, note").
|
||||
Select("id, project_flock_id, total_cost, cutover_date, note").
|
||||
Where("project_flock_id = ?", row.ProjectFlockId).
|
||||
Take(row).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user