mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
adjust calculate hpp filter delivery date marketing delivery
This commit is contained in:
@@ -20,7 +20,7 @@ type HppCostRepository interface {
|
||||
GetTotalPopulation(ctx context.Context, projectFlockKandangIDs []uint) (float64, error)
|
||||
GetPulletCost(ctx context.Context, projectFlockKandangId uint) (float64, error)
|
||||
GetEggProduksiPiecesAndWeightKgByProjectFlockKandangIds(ctx context.Context, projectFlockKandangIDs []uint, date *time.Time) (float64, float64, error)
|
||||
GetEggTerjualPiecesAndWeightKgByProjectFlockKandangIds(ctx context.Context, projectFlockKandangIDs []uint, date *time.Time) (float64, float64, error)
|
||||
GetEggTerjualPiecesAndWeightKgByProjectFlockKandangIds(ctx context.Context, projectFlockKandangIDs []uint, startDate *time.Time, endDate *time.Time) (float64, float64, error)
|
||||
GetProjectFlockIDByProjectFlockKandangID(ctx context.Context, projectFlockKandangId uint) (uint, error)
|
||||
GetTransferSourceSummary(ctx context.Context, projectFlockKandangId uint) (uint, float64, error)
|
||||
}
|
||||
@@ -196,10 +196,10 @@ func (r *HppRepositoryImpl) GetPulletCost(ctx context.Context, projectFlockKanda
|
||||
}
|
||||
|
||||
func (r *HppRepositoryImpl) GetEggProduksiPiecesAndWeightKgByProjectFlockKandangIds(ctx context.Context, projectFlockKandangIDs []uint, date *time.Time) (float64, float64, error) {
|
||||
if date == nil {
|
||||
now := time.Now()
|
||||
date = &now
|
||||
}
|
||||
// if date == nil {
|
||||
// now := time.Now()
|
||||
// date = &now
|
||||
// }
|
||||
|
||||
var totals struct {
|
||||
TotalPieces float64
|
||||
@@ -222,12 +222,13 @@ func (r *HppRepositoryImpl) GetEggProduksiPiecesAndWeightKgByProjectFlockKandang
|
||||
func (r *HppRepositoryImpl) GetEggTerjualPiecesAndWeightKgByProjectFlockKandangIds(
|
||||
ctx context.Context,
|
||||
projectFlockKandangIDs []uint,
|
||||
date *time.Time,
|
||||
startDate *time.Time,
|
||||
endDate *time.Time,
|
||||
) (float64, float64, error) {
|
||||
|
||||
if date == nil {
|
||||
if endDate == nil {
|
||||
now := time.Now()
|
||||
date = &now
|
||||
endDate = &now
|
||||
}
|
||||
|
||||
type subResult struct {
|
||||
@@ -251,7 +252,8 @@ func (r *HppRepositoryImpl) GetEggTerjualPiecesAndWeightKgByProjectFlockKandangI
|
||||
).
|
||||
Joins("JOIN marketing_delivery_products mdp ON mdp.id = sa.usable_id").
|
||||
Where("r.project_flock_kandangs_id IN (?)", projectFlockKandangIDs).
|
||||
Where("r.record_datetime <= ?", *date)
|
||||
Where("r.record_datetime <= ?", *endDate).
|
||||
Where("mdp.delivery_date = ?", *startDate)
|
||||
|
||||
var totals struct {
|
||||
TotalPieces float64
|
||||
|
||||
Reference in New Issue
Block a user