fix: report.docx

This commit is contained in:
skeris 2024-05-18 00:15:11 +03:00
parent 21ef86d6ab
commit 5525c3c9de
4 changed files with 12 additions and 3 deletions

1
.~lock.report.docx# Normal file

@ -0,0 +1 @@
,skeris,skeris-notebook,18.05.2024 00:31,file:///home/skeris/.config/libreoffice/4;

@ -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 {

@ -9,4 +9,5 @@ type RespGeneratorService struct {
Amount string `json:"amount"`
Price string `json:"price"`
Sum string `json:"sum"`
Unit string `json:"unit"`
}

Binary file not shown.