fix: preserve per-row sale markup in pricing CSV

This commit is contained in:
mchus committed 2026-11-26 14:55:28 +03:00
1 parent 52720d8e38
commit e1e266285e
3 files changed
+15 -4

No files matched your search

+2
View File
@@ -107,6 +107,8 @@ Sale per-row pricing (`_saleRowPrice`/`recomputeSalePrices` in `index.html`,
`minimal_sale_columns: true` + `sale_row_markups`, which collapses
`POST /api/configs/:uuid/export/pricing` output to exactly `LOT;Описание;Кол-во;Цена`
(`ProjectPricingExportOptions.MinimalSaleColumns` in `internal/services/export.go`).
The minimal CSV expands vendor BOM rows even when the BOM column is hidden, so each
vendor PN and LOT pair receives its own markup.
This is scoped to that one request: Buy export and the project-level bulk export
never set it and are unaffected.
+8 -4
View File
@@ -415,6 +415,9 @@ func (s *ExportService) buildPricingExportBlock(cfg *models.Configuration, opts
Estimate: floatPtr(item.UnitPrice * float64(item.Quantity)),
})
}
if opts.MinimalSaleColumns {
applySalePricing(block.Rows, cfg, opts)
}
return block, nil
}
@@ -423,9 +426,10 @@ func (s *ExportService) buildPricingExportBlock(cfg *models.Configuration, opts
localCfg = nil
}
priceMap := s.resolvePricingTotals(cfg, localCfg, opts)
includeVendorRows := opts.IncludeBOM || opts.MinimalSaleColumns
priceMap := s.resolvePricingTotals(cfg, localCfg, includeVendorRows)
componentDescriptions := s.resolveLotDescriptions(cfg, localCfg)
if opts.IncludeBOM && localCfg != nil && len(localCfg.VendorSpec) > 0 {
if includeVendorRows && localCfg != nil && len(localCfg.VendorSpec) > 0 {
coveredLots := make(map[string]struct{})
for _, row := range localCfg.VendorSpec {
rowMappings := localdb.NormalizeLotMappings(row.LotMappings)
@@ -716,9 +720,9 @@ type pricingLevels struct {
CompetitorWorld bool
}
func (s *ExportService) resolvePricingTotals(cfg *models.Configuration, localCfg *localdb.LocalConfiguration, opts ProjectPricingExportOptions) map[string]pricingLevels {
func (s *ExportService) resolvePricingTotals(cfg *models.Configuration, localCfg *localdb.LocalConfiguration, includeVendorRows bool) map[string]pricingLevels {
result := map[string]pricingLevels{}
lots := collectPricingLots(cfg, localCfg, opts.IncludeBOM)
lots := collectPricingLots(cfg, localCfg, includeVendorRows)
if len(lots) == 0 || s.localDB == nil {
return result
}
+5
View File
@@ -0,0 +1,5 @@
# QuoteForge v3.53
26 ноября 2026
Экспорт CSV из раздела «Цена продажи» учитывает накидку каждой строки, в том числе когда один LOT встречается у нескольких артикулов вендора.