feat(purchase
This commit is contained in:
@@ -156,6 +156,7 @@ func PurchasingAnalyticsContractToModel(req *contract.PurchasingAnalyticsRequest
|
||||
return &models.PurchasingAnalyticsRequest{
|
||||
OrganizationID: req.OrganizationID,
|
||||
OutletID: parseOutletID(req.OutletID),
|
||||
Team: req.Team,
|
||||
DateFrom: dateFrom,
|
||||
DateTo: dateTo,
|
||||
GroupBy: req.GroupBy,
|
||||
@@ -208,10 +209,26 @@ func PurchasingAnalyticsModelToContract(resp *models.PurchasingAnalyticsResponse
|
||||
}
|
||||
}
|
||||
|
||||
teamData := make([]contract.PurchasingTeamData, len(resp.TeamData))
|
||||
for i, item := range resp.TeamData {
|
||||
teamData[i] = contract.PurchasingTeamData{
|
||||
Scope: item.Scope,
|
||||
CategoryID: item.CategoryID,
|
||||
Name: item.Name,
|
||||
TotalPurchases: item.TotalPurchases,
|
||||
RawMaterialPurchases: item.RawMaterialPurchases,
|
||||
ExpensePurchases: item.ExpensePurchases,
|
||||
PurchaseOrderCount: item.PurchaseOrderCount,
|
||||
Quantity: item.Quantity,
|
||||
Percentage: item.Percentage,
|
||||
}
|
||||
}
|
||||
|
||||
return &contract.PurchasingAnalyticsResponse{
|
||||
OrganizationID: resp.OrganizationID,
|
||||
OutletID: resp.OutletID,
|
||||
OutletName: resp.OutletName,
|
||||
Team: resp.Team,
|
||||
DateFrom: resp.DateFrom,
|
||||
DateTo: resp.DateTo,
|
||||
GroupBy: resp.GroupBy,
|
||||
@@ -226,10 +243,12 @@ func PurchasingAnalyticsModelToContract(resp *models.PurchasingAnalyticsResponse
|
||||
AveragePurchaseOrderValue: resp.Summary.AveragePurchaseOrderValue,
|
||||
TotalIngredients: resp.Summary.TotalIngredients,
|
||||
TotalVendors: resp.Summary.TotalVendors,
|
||||
TotalTeams: resp.Summary.TotalTeams,
|
||||
},
|
||||
Data: data,
|
||||
IngredientData: ingredientData,
|
||||
VendorData: vendorData,
|
||||
TeamData: teamData,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user