mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
adjust response list marketing add grand total so dan do
This commit is contained in:
@@ -28,6 +28,8 @@ type MarketingListDTO struct {
|
||||
Customer customerDTO.CustomerRelationDTO `json:"customer"`
|
||||
SalesPerson userDTO.UserRelationDTO `json:"sales_person"`
|
||||
SoDocs string `json:"so_docs"`
|
||||
GrandTotalSO float64 `json:"grand_total_so"`
|
||||
GrandTotalDO float64 `json:"grand_total_do"`
|
||||
SalesOrder []DeliveryMarketingProductDTO `json:"sales_order"`
|
||||
DeliveryOrder []DeliveryGroupDTO `json:"delivery_order"`
|
||||
CreatedUser userDTO.UserRelationDTO `json:"created_user"`
|
||||
@@ -198,11 +200,18 @@ func ToMarketingListDTO(marketing *entity.Marketing, deliveryProducts []entity.M
|
||||
salesOrderProducts[i] = ToDeliveryMarketingProductDTO(product, marketing.MarketingType)
|
||||
}
|
||||
}
|
||||
var grandTotalSO float64
|
||||
for _, p := range marketing.Products {
|
||||
grandTotalSO += p.TotalPrice
|
||||
}
|
||||
|
||||
return MarketingListDTO{
|
||||
MarketingRelationDTO: ToMarketingRelationDTO(marketing),
|
||||
Customer: customer,
|
||||
SalesPerson: salesPerson,
|
||||
SoDocs: marketing.SoDocs,
|
||||
GrandTotalSO: grandTotalSO,
|
||||
GrandTotalDO: marketing.GrandTotal,
|
||||
SalesOrder: salesOrderProducts,
|
||||
DeliveryOrder: extractDeliveryGroupsFromProducts(marketing),
|
||||
CreatedUser: createdUser,
|
||||
|
||||
Reference in New Issue
Block a user