|
@@ -197,9 +197,9 @@ class ImportBaseTree {
|
|
|
for (const node of this.items) {
|
|
|
if (node.children && node.children.length > 0) { continue; }
|
|
|
if (!node.pos || node.pos.length === 0) { continue; }
|
|
|
- node.quantity = _.sum(_.map(node.pos, 'quantity'));
|
|
|
+ node.quantity = _.round(_.sum(_.map(node.pos, 'quantity')), 6);
|
|
|
if (node.quantity && node.unit_price) {
|
|
|
- node.total_price = node.quantity * node.unit_price;
|
|
|
+ node.total_price = _.round(node.quantity * node.unit_price, 6);
|
|
|
} else {
|
|
|
node.total_price = null;
|
|
|
}
|
|
@@ -229,11 +229,8 @@ class AnalysisExcelTree {
|
|
|
}
|
|
|
|
|
|
toNumber (value) {
|
|
|
- if (value) {
|
|
|
- return _.isNumber(value) ? value : _.toNumber(value);
|
|
|
- } else {
|
|
|
- return null;
|
|
|
- }
|
|
|
+ let num = _.toNumber(value);
|
|
|
+ return _.isNaN(num) ? null : num;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -254,7 +251,7 @@ class AnalysisExcelTree {
|
|
|
node.drawing_code = row[this.colsDef.drawing_code];
|
|
|
node.memo = row[this.colsDef.memo];
|
|
|
if (node.quantity && node.unit_price) {
|
|
|
- node.total_price = node.quantity * node.unit_price;
|
|
|
+ node.total_price = _.round(node.quantity * node.unit_price, 6);
|
|
|
} else {
|
|
|
node.total_price = null;
|
|
|
}
|
|
@@ -276,7 +273,7 @@ class AnalysisExcelTree {
|
|
|
node.drawing_code = row[this.colsDef.drawing_code];
|
|
|
node.memo = row[this.colsDef.memo];
|
|
|
if (node.quantity && node.unit_price) {
|
|
|
- node.total_price = node.quantity * node.unit_price;
|
|
|
+ node.total_price = _.round(node.quantity * node.unit_price, 6);
|
|
|
} else {
|
|
|
node.total_price = null;
|
|
|
}
|