Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Invoice
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
mashplace
backend
Invoice
Commits
f90033ec
Commit
f90033ec
authored
3 years ago
by
gfalileev
Browse files
Options
Downloads
Patches
Plain Diff
MRM-4063: fix total and taxAmount fields
parent
8e375459
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
internal/service/server_report.go
+10
-2
10 additions, 2 deletions
internal/service/server_report.go
with
10 additions
and
2 deletions
internal/service/server_report.go
+
10
−
2
View file @
f90033ec
...
...
@@ -178,6 +178,12 @@ func (srv *serverImpl) reportUserdata(ctx context.Context, i *model.ReportItem)
func
(
srv
*
serverImpl
)
reportRenderCSV
(
ctx
context
.
Context
,
items
[]
*
model
.
ReportItem
)
([]
byte
,
error
)
{
var
rows
[]
csvRow
total
:=
make
(
map
[
string
]
float64
)
for
_
,
i
:=
range
items
{
total
[
i
.
SystemReference
]
+=
float64
(
i
.
Quantity
)
*
(
i
.
Price
+
i
.
TaxAmount
)
}
for
_
,
i
:=
range
items
{
userdata
,
_
:=
srv
.
reportUserdata
(
ctx
,
i
)
...
...
@@ -202,6 +208,8 @@ func (srv *serverImpl) reportRenderCSV(ctx context.Context, items []*model.Repor
reference
=
i
.
SystemReference
}
taxAmount
:=
float64
(
i
.
Quantity
)
*
i
.
TaxAmount
rows
=
append
(
rows
,
csvRow
{
ContactName
:
contactName
,
EmailAddress
:
userdata
.
Contacts
.
EmailPrimary
,
...
...
@@ -217,7 +225,7 @@ func (srv *serverImpl) reportRenderCSV(ctx context.Context, items []*model.Repor
Reference
:
reference
,
InvoiceDate
:
i
.
Created
.
Format
(
"02/01/2006 15:04:05"
),
DueDate
:
i
.
Created
.
Format
(
"02/01/2006 15:04:05"
),
Total
:
fmt
.
Sprintf
(
"%.2f"
,
i
.
Price
+
i
.
TaxAmount
),
Total
:
fmt
.
Sprintf
(
"%.2f"
,
total
[
i
.
SystemReference
]
),
InventoryItemCode
:
strconv
.
FormatUint
(
i
.
ID
,
10
),
Description
:
i
.
Title
,
Quantity
:
strconv
.
FormatInt
(
i
.
Quantity
,
10
),
...
...
@@ -225,7 +233,7 @@ func (srv *serverImpl) reportRenderCSV(ctx context.Context, items []*model.Repor
Discount
:
"0.00"
,
AccountCode
:
"207"
,
TaxType
:
fmt
.
Sprintf
(
"%.0f%% (%s)"
,
i
.
TaxPercentage
,
taxType
),
TaxAmount
:
fmt
.
Sprintf
(
"%.2f"
,
i
.
T
axAmount
),
TaxAmount
:
fmt
.
Sprintf
(
"%.2f"
,
t
axAmount
),
TrackingName1
:
"Activity"
,
TrackingOption1
:
"Rentals"
,
TrackingName2
:
""
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment