mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-26 00:05:44 +00:00
fix list penjualan and export penjualan dengan qty
This commit is contained in:
@@ -29,6 +29,7 @@ type MarketingListDTO struct {
|
||||
SalesPerson userDTO.UserRelationDTO `json:"sales_person"`
|
||||
SoDocs string `json:"so_docs"`
|
||||
SalesOrder []DeliveryMarketingProductDTO `json:"sales_order"`
|
||||
DeliveryOrder []DeliveryGroupDTO `json:"delivery_order"`
|
||||
CreatedUser userDTO.UserRelationDTO `json:"created_user"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
@@ -203,6 +204,7 @@ func ToMarketingListDTO(marketing *entity.Marketing, deliveryProducts []entity.M
|
||||
SalesPerson: salesPerson,
|
||||
SoDocs: marketing.SoDocs,
|
||||
SalesOrder: salesOrderProducts,
|
||||
DeliveryOrder: extractDeliveryGroupsFromProducts(marketing),
|
||||
CreatedUser: createdUser,
|
||||
CreatedAt: marketing.CreatedAt,
|
||||
UpdatedAt: marketing.UpdatedAt,
|
||||
@@ -376,6 +378,23 @@ func GenerateDeliveryOrderNumber(soNumber string, deliveryDate *time.Time, wareh
|
||||
return numberPrefix
|
||||
}
|
||||
|
||||
func extractDeliveryGroupsFromProducts(marketing *entity.Marketing) []DeliveryGroupDTO {
|
||||
var dps []MarketingDeliveryProductDTO
|
||||
for _, product := range marketing.Products {
|
||||
if product.DeliveryProduct == nil || product.DeliveryProduct.DeliveryDate == nil {
|
||||
continue
|
||||
}
|
||||
dp := ToMarketingDeliveryProductDTO(*product.DeliveryProduct)
|
||||
if product.ProductWarehouse.Id != 0 {
|
||||
mapped := productwarehouseDTO.ToProductWarehouseNestedDTO(product.ProductWarehouse)
|
||||
dp.ProductWarehouse = &mapped
|
||||
}
|
||||
dp.ConvertionUnit = product.ConvertionUnit
|
||||
dps = append(dps, dp)
|
||||
}
|
||||
return groupDeliveryProducts(dps, marketing.SoNumber)
|
||||
}
|
||||
|
||||
func collectDoNumbers(marketing *entity.Marketing) []string {
|
||||
if marketing == nil || len(marketing.Products) == 0 {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user