mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-23 14:55:42 +00:00
feat: expose received_date in laporan pembelian
This commit is contained in:
@@ -27,6 +27,7 @@ type PurchaseListDTO struct {
|
||||
PurchaseRelationDTO
|
||||
Supplier *supplierDTO.SupplierRelationDTO `json:"supplier"`
|
||||
DueDate *time.Time `json:"due_date"`
|
||||
ReceivedDate *time.Time `json:"received_date"`
|
||||
CreatedUser *userDTO.UserRelationDTO `json:"created_user"`
|
||||
RequesterName string `json:"requester_name"`
|
||||
PoExpedition []PoExpeditionDTO `json:"po_expedition"`
|
||||
@@ -174,6 +175,7 @@ func ToPurchaseListDTO(p entity.Purchase) PurchaseListDTO {
|
||||
poExpedition = make([]PoExpeditionDTO, 0)
|
||||
location *locationDTO.LocationRelationDTO
|
||||
area *areaDTO.AreaRelationDTO
|
||||
receivedDate *time.Time
|
||||
)
|
||||
productMap := make(map[uint]productDTO.ProductRelationDTO)
|
||||
expeditionRefSet := make(map[uint64]struct{})
|
||||
@@ -205,6 +207,12 @@ func ToPurchaseListDTO(p entity.Purchase) PurchaseListDTO {
|
||||
ar := areaDTO.ToAreaRelationDTO(item.Warehouse.Area)
|
||||
area = &ar
|
||||
}
|
||||
if item.ReceivedDate != nil && !item.ReceivedDate.IsZero() {
|
||||
if receivedDate == nil || item.ReceivedDate.Before(*receivedDate) {
|
||||
t := *item.ReceivedDate
|
||||
receivedDate = &t
|
||||
}
|
||||
}
|
||||
}
|
||||
products := make([]productDTO.ProductRelationDTO, 0, len(productMap))
|
||||
for _, prod := range productMap {
|
||||
@@ -215,6 +223,7 @@ func ToPurchaseListDTO(p entity.Purchase) PurchaseListDTO {
|
||||
PurchaseRelationDTO: ToPurchaseRelationDTO(&p),
|
||||
Supplier: supplier,
|
||||
DueDate: p.DueDate,
|
||||
ReceivedDate: receivedDate,
|
||||
CreatedUser: createdUser,
|
||||
RequesterName: requesterName,
|
||||
PoExpedition: poExpedition,
|
||||
|
||||
Reference in New Issue
Block a user