Add article generation and pricelist categories
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user