From 14a4d9e944374478eb6e74708734069b0a029763 Mon Sep 17 00:00:00 2001 From: ragilap Date: Thu, 18 Dec 2025 16:02:57 +0700 Subject: [PATCH] Feat(BE-334):Fixing dto closing hpp expedisi --- internal/modules/closings/dto/closingExpedition.dto.go | 4 ---- .../dto/{sapronak.dto.go => closingSapronak.dto.go} | 0 .../modules/closings/repositories/closing.repository.go | 5 +---- internal/modules/closings/services/closing.service.go | 8 -------- 4 files changed, 1 insertion(+), 16 deletions(-) rename internal/modules/closings/dto/{sapronak.dto.go => closingSapronak.dto.go} (100%) diff --git a/internal/modules/closings/dto/closingExpedition.dto.go b/internal/modules/closings/dto/closingExpedition.dto.go index f1b8628b..5f8a09d4 100644 --- a/internal/modules/closings/dto/closingExpedition.dto.go +++ b/internal/modules/closings/dto/closingExpedition.dto.go @@ -3,10 +3,7 @@ package dto // ExpeditionCostItemDTO merepresentasikan biaya ekspedisi per vendor. type ExpeditionCostItemDTO struct { Id uint64 `json:"id"` - ExpeditionVendorID uint64 `json:"expedition_vendor_id"` ExpeditionVendorName string `json:"expedition_vendor_name"` - Qty float64 `json:"qty"` - UnitPrice float64 `json:"unit_price"` HPPAmount float64 `json:"hpp_amount"` } @@ -15,4 +12,3 @@ type ExpeditionHPPDTO struct { ExpeditionCosts []ExpeditionCostItemDTO `json:"expedition_costs"` TotalHPPAmount float64 `json:"total_hpp_amount"` } - diff --git a/internal/modules/closings/dto/sapronak.dto.go b/internal/modules/closings/dto/closingSapronak.dto.go similarity index 100% rename from internal/modules/closings/dto/sapronak.dto.go rename to internal/modules/closings/dto/closingSapronak.dto.go diff --git a/internal/modules/closings/repositories/closing.repository.go b/internal/modules/closings/repositories/closing.repository.go index 14854430..0214d739 100644 --- a/internal/modules/closings/repositories/closing.repository.go +++ b/internal/modules/closings/repositories/closing.repository.go @@ -55,9 +55,7 @@ type SapronakRow struct { } type ExpeditionHPPRow struct { - SupplierID uint64 `gorm:"column:supplier_id"` SupplierName string `gorm:"column:supplier_name"` - Qty float64 `gorm:"column:qty"` TotalAmount float64 `gorm:"column:total_amount"` } @@ -147,7 +145,6 @@ func (r *ClosingRepositoryImpl) GetExpeditionHPP(ctx context.Context, projectFlo Select( "e.supplier_id AS supplier_id, " + "s.name AS supplier_name, " + - "SUM(er.qty) AS qty, " + "SUM(er.qty * er.price) AS total_amount", ). Group("e.supplier_id, s.name"). @@ -645,4 +642,4 @@ func (r *ClosingRepositoryImpl) FetchSapronakTransfers(ctx context.Context, kand return fmt.Sprintf("TRF-%d", row.ID) }) return in, out, nil -} \ No newline at end of file +} diff --git a/internal/modules/closings/services/closing.service.go b/internal/modules/closings/services/closing.service.go index d6e24e7f..afba0a9d 100644 --- a/internal/modules/closings/services/closing.service.go +++ b/internal/modules/closings/services/closing.service.go @@ -398,17 +398,9 @@ func (s closingService) GetExpeditionHPP(c *fiber.Ctx, projectFlockID uint, proj var totalHPP float64 for idx, row := range rows { - unitPrice := 0.0 - if row.Qty > 0 { - unitPrice = row.TotalAmount / row.Qty - } - expeditionCosts = append(expeditionCosts, dto.ExpeditionCostItemDTO{ Id: uint64(idx + 1), - ExpeditionVendorID: row.SupplierID, ExpeditionVendorName: row.SupplierName, - Qty: row.Qty, - UnitPrice: unitPrice, HPPAmount: row.TotalAmount, })