|
@@ -85,7 +85,7 @@ class TransportService extends CrudService {
|
|
async carCalculate({ car_no, start, end }) {
|
|
async carCalculate({ car_no, start, end }) {
|
|
assert(start, '缺少时间范围-开始时间');
|
|
assert(start, '缺少时间范围-开始时间');
|
|
assert(end, '缺少时间范围-结束时间');
|
|
assert(end, '缺少时间范围-结束时间');
|
|
- let query = {
|
|
|
|
|
|
+ const query = {
|
|
'send_time@start': start,
|
|
'send_time@start': start,
|
|
'send_time@end': end,
|
|
'send_time@end': end,
|
|
'supplier.car_no': car_no,
|
|
'supplier.car_no': car_no,
|
|
@@ -106,22 +106,24 @@ class TransportService extends CrudService {
|
|
const count = {};
|
|
const count = {};
|
|
// 收入采用税后实收
|
|
// 收入采用税后实收
|
|
count.im = _.round(
|
|
count.im = _.round(
|
|
- res.inBill.reduce((p, n) => p + (n.sh_ss || 0), 0),
|
|
|
|
|
|
+ res.inBill.reduce((p, n) => _.add(p, (parseFloat(n.sh_ss) || 0)), 0),
|
|
2
|
|
2
|
|
);
|
|
);
|
|
|
|
+ console.log(res.outBill);
|
|
// 运输支出合计
|
|
// 运输支出合计
|
|
count.om = _.round(
|
|
count.om = _.round(
|
|
- res.outBill.reduce((p, n) => p + (n.money || 0), 0),
|
|
|
|
|
|
+ res.outBill.reduce((p, n) => _.add(p, (parseFloat(n.money) || 0)), 0),
|
|
2
|
|
2
|
|
);
|
|
);
|
|
// 日常支出
|
|
// 日常支出
|
|
count.dm = _.round(
|
|
count.dm = _.round(
|
|
- res.daily.reduce((p, n) => p + (n.money || 0), 0),
|
|
|
|
|
|
+ res.daily.reduce((p, n) => _.add(p, (parseFloat(n.money) || 0)), 0),
|
|
2
|
|
2
|
|
);
|
|
);
|
|
// 总计
|
|
// 总计
|
|
count.total = _.round(count.im - count.om - count.dm, 2);
|
|
count.total = _.round(count.im - count.om - count.dm, 2);
|
|
res.count = count;
|
|
res.count = count;
|
|
|
|
+ console.log(res);
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|