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"`
|
Customer customerDTO.CustomerRelationDTO `json:"customer"`
|
||||||
SalesPerson userDTO.UserRelationDTO `json:"sales_person"`
|
SalesPerson userDTO.UserRelationDTO `json:"sales_person"`
|
||||||
SoDocs string `json:"so_docs"`
|
SoDocs string `json:"so_docs"`
|
||||||
|
GrandTotalSO float64 `json:"grand_total_so"`
|
||||||
|
GrandTotalDO float64 `json:"grand_total_do"`
|
||||||
SalesOrder []DeliveryMarketingProductDTO `json:"sales_order"`
|
SalesOrder []DeliveryMarketingProductDTO `json:"sales_order"`
|
||||||
DeliveryOrder []DeliveryGroupDTO `json:"delivery_order"`
|
DeliveryOrder []DeliveryGroupDTO `json:"delivery_order"`
|
||||||
CreatedUser userDTO.UserRelationDTO `json:"created_user"`
|
CreatedUser userDTO.UserRelationDTO `json:"created_user"`
|
||||||
@@ -198,11 +200,18 @@ func ToMarketingListDTO(marketing *entity.Marketing, deliveryProducts []entity.M
|
|||||||
salesOrderProducts[i] = ToDeliveryMarketingProductDTO(product, marketing.MarketingType)
|
salesOrderProducts[i] = ToDeliveryMarketingProductDTO(product, marketing.MarketingType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var grandTotalSO float64
|
||||||
|
for _, p := range marketing.Products {
|
||||||
|
grandTotalSO += p.TotalPrice
|
||||||
|
}
|
||||||
|
|
||||||
return MarketingListDTO{
|
return MarketingListDTO{
|
||||||
MarketingRelationDTO: ToMarketingRelationDTO(marketing),
|
MarketingRelationDTO: ToMarketingRelationDTO(marketing),
|
||||||
Customer: customer,
|
Customer: customer,
|
||||||
SalesPerson: salesPerson,
|
SalesPerson: salesPerson,
|
||||||
SoDocs: marketing.SoDocs,
|
SoDocs: marketing.SoDocs,
|
||||||
|
GrandTotalSO: grandTotalSO,
|
||||||
|
GrandTotalDO: marketing.GrandTotal,
|
||||||
SalesOrder: salesOrderProducts,
|
SalesOrder: salesOrderProducts,
|
||||||
DeliveryOrder: extractDeliveryGroupsFromProducts(marketing),
|
DeliveryOrder: extractDeliveryGroupsFromProducts(marketing),
|
||||||
CreatedUser: createdUser,
|
CreatedUser: createdUser,
|
||||||
|
|||||||
Reference in New Issue
Block a user