Add article generation and pricelist categories

This commit is contained in:
Mikhail Chusavitin
2026-02-11 19:16:01 +03:00
parent 99fd80bca7
commit 5edffe822b
32 changed files with 1953 additions and 323 deletions

View File

@@ -27,6 +27,7 @@ func NewExportService(cfg config.ExportConfig, categoryRepo *repository.Category
type ExportData struct {
Name string
Article string
Items []ExportItem
Total float64
Notes string
@@ -109,7 +110,7 @@ func (s *ExportService) ToCSV(w io.Writer, data *ExportData) error {
// Total row
totalStr := strings.ReplaceAll(fmt.Sprintf("%.2f", data.Total), ".", ",")
if err := csvWriter.Write([]string{"", "", "", "", "ИТОГО:", totalStr}); err != nil {
if err := csvWriter.Write([]string{data.Article, "", "", "", "ИТОГО:", totalStr}); err != nil {
return fmt.Errorf("failed to write total row: %w", err)
}
@@ -162,6 +163,7 @@ func (s *ExportService) ConfigToExportData(config *models.Configuration, compone
return &ExportData{
Name: config.Name,
Article: "",
Items: items,
Total: total,
Notes: config.Notes,