Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
12abd18e
Commit
12abd18e
authored
Jan 15, 2019
by
cjl
Browse files
修改库存状况打印和导出功能金额为小数点后保留两位
(cherry picked from commit
36139e26
)
parent
693a7558
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
12abd18e
...
...
@@ -15,6 +15,7 @@ import javax.annotation.Resource;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -440,6 +441,11 @@ public class DepotItemController {
Double
unitPrice
=
0.0
;
if
(
prevSum
+
InSum
-
OutSum
!=
0.0
)
{
unitPrice
=
(
prevPrice
+
InPrice
-
OutPrice
)
/
(
prevSum
+
InSum
-
OutSum
);
/**
* 2019-01-15通过除法算出金额后,保留两位小数
* */
DecimalFormat
df
=
new
DecimalFormat
(
"#.00"
);
unitPrice
=
Double
.
parseDouble
(
df
.
format
(
unitPrice
));
}
item
.
put
(
"UnitPrice"
,
unitPrice
);
item
.
put
(
"prevSum"
,
prevSum
);
...
...
@@ -721,6 +727,11 @@ public class DepotItemController {
Double
unitPrice
=
0.0
;
if
(
prevSum
+
InSum
-
OutSum
!=
0.0
)
{
unitPrice
=
(
prevPrice
+
InPrice
-
OutPrice
)
/
(
prevSum
+
InSum
-
OutSum
);
/**
* 2019-01-15通过除法算出金额后,保留两位小数
* */
DecimalFormat
df
=
new
DecimalFormat
(
"#.00"
);
unitPrice
=
Double
.
parseDouble
(
df
.
format
(
unitPrice
));
}
Double
thisSum
=
prevSum
+
InSum
-
OutSum
;
Double
thisAllPrice
=
prevPrice
+
InPrice
-
OutPrice
;
...
...
@@ -743,10 +754,10 @@ public class DepotItemController {
e
.
printStackTrace
();
message
=
"导出失败"
;
res
.
code
=
500
;
}
finally
{
map
.
put
(
"message"
,
message
);
res
.
data
=
map
;
}
/**
* 2019-01-15response已经返回,finally部分完全没必要
* */
return
res
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment