master
cody 2 years ago
parent 1cff71bbec
commit a93e153c6d

@ -546,7 +546,7 @@ class StatisticsController extends CommonController
// 当月天数
$days = date('t', strtotime($month));
$area = Area::withCount('beds')->where('project_id', $project_id)->get();
$total['order_total'] = $total['shouxufei'] = $total['zengshishui'] = $total['shijishouru'] = $total['guanlifei'] = 0;
foreach ($area as $item) {
$beds = Bed::where('area_id', $item->id)->where('project_id', $project_id)->get();
// 订单总数
@ -559,6 +559,12 @@ class StatisticsController extends CommonController
$item->zengshishui = round($orderTotal * 0.06, 2);
$item->shijishouru = round($orderTotal - $item->shouxufei - $item->zengshishui, 2);
$item->guanlifei = round($item->shijishouru * 0.06, 2);
// 合计
$total['order_total'] += $item->order_total;
$total['shouxufei'] += $item->shouxufei;
$total['zengshishui'] += $item->zengshishui;
$total['shijishouru'] += $item->shijishouru;
$total['guanlifei'] += $item->guanlifei;
}
// 导出
@ -588,7 +594,7 @@ class StatisticsController extends CommonController
$writer->save('php://output');
exit;
}
return view($this->bladePath . ".income", compact("area", "project", "project_id", "month", "projects"));
return view($this->bladePath . ".income", compact("total","area", "project", "project_id", "month", "projects"));
}
}

@ -49,6 +49,14 @@
<td>{{ $row->guanlifei }}</td>
</tr>
@endforeach
<tr>
<td>合计</td>
<td>{{ $total['order_total'] }}</td>
<td>{{ $total['shouxufei'] }}</td>
<td>{{ $total['zengshishui'] }}</td>
<td>{{ $total['shijishouru'] }}</td>
<td>{{ $total['guanlifei'] }}</td>
</tr>
</tbody>
</table>
</div>

Loading…
Cancel
Save