feat[BE]: implement customer payment report retrieval with pagination and filtering

This commit is contained in:
aguhh18
2026-01-14 11:46:39 +07:00
parent 7f1d796b65
commit f6e872c0aa
6 changed files with 460 additions and 73 deletions
@@ -2,42 +2,33 @@ package dto
import (
"time"
customerDTO "gitlab.com/mbugroup/lti-api.git/internal/modules/master/customers/dto"
)
// CustomerPaymentReportCustomer represents customer information in the report
type CustomerPaymentReportCustomer struct {
ID uint `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
AccountNumber string `json:"account_number"`
Balance float64 `json:"balance"`
Address string `json:"address"`
}
// CustomerPaymentReportRow represents each transaction row
type CustomerPaymentReportRow struct {
ID uint `json:"id"`
DoDate time.Time `json:"do_date"`
RealizationDate time.Time `json:"realization_date"`
AgingDay int `json:"aging_day"`
Reference string `json:"reference"`
VehiclePlate []string `json:"vehicle_plate"`
Qty float64 `json:"qty"`
Weight float64 `json:"weight"`
AverageWeight float64 `json:"average_weight"`
Price float64 `json:"price"`
CreditNote float64 `json:"credit_note"`
FinalPrice float64 `json:"final_price"`
PPN float64 `json:"ppn"`
Total float64 `json:"total"`
Payment float64 `json:"payment"`
AccountsReceivable float64 `json:"accounts_receivable"`
Notes string `json:"notes"`
PickupInfo string `json:"pickup_info"`
SalesMarketing string `json:"sales_marketing"`
TransactionType string `json:"transaction_type"`
TransactionID int64 `json:"transaction_id"`
TransDate time.Time `json:"trans_date"`
DeliveryDate *time.Time `json:"delivery_date"`
Reference string `json:"reference"`
VehicleNumbers string `json:"vehicle_numbers"`
Qty float64 `json:"qty"`
Weight float64 `json:"weight"`
AverageWeight float64 `json:"average_weight"`
Price float64 `json:"price"`
CreditNote float64 `json:"credit_note"`
FinalPrice float64 `json:"final_price"`
PPN float64 `json:"ppn"`
TotalPrice float64 `json:"total_price"`
PaymentAmount float64 `json:"payment_amount"`
AccountsReceivable float64 `json:"accounts_receivable"`
AgingDay int `json:"aging_day"`
Status string `json:"status"`
PickupInfo string `json:"pickup_info"`
SalesPerson string `json:"sales_person"`
}
// CustomerPaymentReportSummary represents summary calculations per customer
type CustomerPaymentReportSummary struct {
TotalQty float64 `json:"total_qty"`
TotalWeight float64 `json:"total_weight"`
@@ -50,14 +41,13 @@ type CustomerPaymentReportSummary struct {
TotalAccountsReceivable float64 `json:"total_accounts_receivable"`
}
// CustomerPaymentReportItem represents data grouped by customer
type CustomerPaymentReportItem struct {
Customer CustomerPaymentReportCustomer `json:"customer"`
Rows []CustomerPaymentReportRow `json:"rows"`
Summary CustomerPaymentReportSummary `json:"summary"`
Customer customerDTO.CustomerRelationDTO `json:"customer"`
InitialBalance float64 `json:"initial_balance"`
Rows []CustomerPaymentReportRow `json:"rows"`
Summary CustomerPaymentReportSummary `json:"summary"`
}
// CustomerPaymentReportResponse represents the complete response
type CustomerPaymentReportResponse struct {
Data []CustomerPaymentReportItem `json:"data"`
}