generated from PenaSide/GolangTemplate
fix: report.docx
This commit is contained in:
parent
21ef86d6ab
commit
5525c3c9de
1
.~lock.report.docx#
Normal file
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 {
|
for _, tariff := range tariffs.RawDetails.Tariffs {
|
||||||
totalAmount := uint64(0)
|
totalAmount := uint64(0)
|
||||||
|
privilegeMeasurement := ""
|
||||||
|
piecePrice := ""
|
||||||
|
privilegeName := ""
|
||||||
for _, privilege := range tariff.Privileges {
|
for _, privilege := range tariff.Privileges {
|
||||||
totalAmount += privilege.Amount
|
totalAmount += privilege.Amount
|
||||||
|
privilegeMeasurement = string(privilege.Type)
|
||||||
|
piecePrice = fmt.Sprintf("%.2f",float64(privilege.Price)/100)
|
||||||
|
privilegeName = privilege.Name
|
||||||
}
|
}
|
||||||
data := models.RespGeneratorService{
|
data := models.RespGeneratorService{
|
||||||
DocNumber: fmt.Sprint(historyMap[req.Id] + 1),
|
DocNumber: fmt.Sprint(historyMap[req.Id] + 1),
|
||||||
Date: time.Now().Format("2006-01-02"),
|
Date: time.Now().Format("2006-01-02"),
|
||||||
OrgTaxNum: verifuser.TaxNumber,
|
OrgTaxNum: verifuser.TaxNumber,
|
||||||
OrgName: account.Name.Orgname,
|
OrgName: account.Name.Orgname,
|
||||||
Name: tariff.Name,
|
Name: tariff.Name + " " + privilegeName,
|
||||||
Amount: fmt.Sprint(totalAmount),
|
Amount: fmt.Sprint(totalAmount),
|
||||||
Price: fmt.Sprint(tariffs.RawDetails.Price),
|
Unit: piecePrice,
|
||||||
Sum: fmt.Sprint(tariffs.RawDetails.Price),
|
Price: fmt.Sprintf("%.2f",float64(tariffs.RawDetails.Price)/100),
|
||||||
|
Sum: privilegeMeasurement,
|
||||||
}
|
}
|
||||||
err = api.clients.template.SendData(ctx.Request().Context(), data, fileContents, authuser.Login)
|
err = api.clients.template.SendData(ctx.Request().Context(), data, fileContents, authuser.Login)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -9,4 +9,5 @@ type RespGeneratorService struct {
|
|||||||
Amount string `json:"amount"`
|
Amount string `json:"amount"`
|
||||||
Price string `json:"price"`
|
Price string `json:"price"`
|
||||||
Sum string `json:"sum"`
|
Sum string `json:"sum"`
|
||||||
|
Unit string `json:"unit"`
|
||||||
}
|
}
|
||||||
|
BIN
report.docx
BIN
report.docx
Binary file not shown.
Loading…
Reference in New Issue
Block a user