add sorting transaction, report keuangan

This commit is contained in:
giovanni
2026-05-16 23:40:52 +07:00
parent a40adc22d2
commit 18bd8ad1d9
8 changed files with 127 additions and 49 deletions
@@ -1029,6 +1029,13 @@ func (s *repportService) GetProductionResult(ctx *fiber.Ctx, params *validation.
}
func (s *repportService) GetCustomerPayment(ctx *fiber.Ctx, params *validation.CustomerPaymentQuery) ([]dto.CustomerPaymentReportItem, int64, error) {
if params.SortBy == "" {
params.SortBy = "customer"
}
if params.SortOrder == "" {
params.SortOrder = "asc"
}
if err := s.Validate.Struct(params); err != nil {
return nil, 0, err
}
@@ -1083,7 +1090,7 @@ func (s *repportService) GetCustomerPayment(ctx *fiber.Ctx, params *validation.C
offset := (page - 1) * limit
var err error
customerIDs, totalCustomers, err = s.CustomerPaymentRepo.GetCustomerIDsWithTransactions(ctx.Context(), limit, offset, allowedCustomerIDs)
customerIDs, totalCustomers, err = s.CustomerPaymentRepo.GetCustomerIDsWithTransactions(ctx.Context(), limit, offset, allowedCustomerIDs, params.SortBy, params.SortOrder)
if err != nil {
return nil, 0, err
}
@@ -1755,6 +1762,12 @@ func (s *repportService) GetDebtSupplier(c *fiber.Ctx, params *validation.DebtSu
if params.FilterBy == "" {
params.FilterBy = "received_date"
}
if params.SortBy == "" {
params.SortBy = "supplier"
}
if params.SortOrder == "" {
params.SortOrder = "asc"
}
if err := s.Validate.Struct(params); err != nil {
return nil, 0, err