master
cody 2 years ago
parent a93e153c6d
commit d4c98f0943

@ -567,6 +567,18 @@ class StatisticsController extends CommonController
$total['guanlifei'] += $item->guanlifei;
}
// 获取所有订单数据
$beds = Bed::whereIn('area_id', $area->pluck('id'))->where('project_id', $project_id)->get();
// 订单总数
$allOrderTotal = Orders::where('project_id', $project_id)
->where('created_at', 'like', '%' . $month . '%')
->whereIn('bed_id', $beds->pluck('id'))
->get();
$refund['order_total'] = Refund::where('created_at', 'like', '%' . $month . '%')->whereIn('order_id', $allOrderTotal->pluck('id'))->sum('money');
$refund['shijishouru'] = $refund['order_total'];
$refund['guanlifei'] = round($refund['order_total'] * 0.06, 2);
// 导出
if ($is_export) {
$area = $area->toArray();
@ -594,7 +606,7 @@ class StatisticsController extends CommonController
$writer->save('php://output');
exit;
}
return view($this->bladePath . ".income", compact("total","area", "project", "project_id", "month", "projects"));
return view($this->bladePath . ".income", compact("total", "area", "project", "project_id", "month", "projects"));
}
}

@ -57,6 +57,14 @@
<td>{{ $total['shijishouru'] }}</td>
<td>{{ $total['guanlifei'] }}</td>
</tr>
<tr>
<td>退款</td>
<td>{{ $refund['order_total'] }}</td>
<td>{{ $refund['shouxufei'] }}</td>
<td></td>
<td></td>
<td>{{ $refund['guanlifei'] }}</td>
</tr>
</tbody>
</table>
</div>

Loading…
Cancel
Save