diff --git a/.~lock.report.docx# b/.~lock.report.docx# new file mode 100644 index 0000000..bea0197 --- /dev/null +++ b/.~lock.report.docx# @@ -0,0 +1 @@ +,skeris,skeris-notebook,18.05.2024 00:31,file:///home/skeris/.config/libreoffice/4; \ No newline at end of file diff --git a/internal/interface/swagger/api.2.go b/internal/interface/swagger/api.2.go index b53302b..7ee99a4 100644 --- a/internal/interface/swagger/api.2.go +++ b/internal/interface/swagger/api.2.go @@ -796,18 +796,25 @@ func (api *API2) SendReport(ctx echo.Context) error { for _, tariff := range tariffs.RawDetails.Tariffs { totalAmount := uint64(0) + privilegeMeasurement := "" + piecePrice := "" + privilegeName := "" for _, privilege := range tariff.Privileges { totalAmount += privilege.Amount + privilegeMeasurement = string(privilege.Type) + piecePrice = fmt.Sprintf("%.2f",float64(privilege.Price)/100) + privilegeName = privilege.Name } data := models.RespGeneratorService{ DocNumber: fmt.Sprint(historyMap[req.Id] + 1), Date: time.Now().Format("2006-01-02"), OrgTaxNum: verifuser.TaxNumber, OrgName: account.Name.Orgname, - Name: tariff.Name, + Name: tariff.Name + " " + privilegeName, Amount: fmt.Sprint(totalAmount), - Price: fmt.Sprint(tariffs.RawDetails.Price), - Sum: fmt.Sprint(tariffs.RawDetails.Price), + Unit: piecePrice, + Price: fmt.Sprintf("%.2f",float64(tariffs.RawDetails.Price)/100), + Sum: privilegeMeasurement, } err = api.clients.template.SendData(ctx.Request().Context(), data, fileContents, authuser.Login) if err != nil { diff --git a/internal/models/templategen.go b/internal/models/templategen.go index d584810..4d293db 100644 --- a/internal/models/templategen.go +++ b/internal/models/templategen.go @@ -9,4 +9,5 @@ type RespGeneratorService struct { Amount string `json:"amount"` Price string `json:"price"` Sum string `json:"sum"` + Unit string `json:"unit"` } diff --git a/report.docx b/report.docx index 40b88ce..16cfff2 100644 Binary files a/report.docx and b/report.docx differ