master
cody 2 years ago
parent e7a42b4e06
commit 3e6fa935c8

@ -546,6 +546,7 @@ class StatisticsController extends CommonController
// 当月天数 // 当月天数
$days = date('t', strtotime($month)); $days = date('t', strtotime($month));
$area = Area::withCount('beds')->where('project_id', $project_id)->get(); $area = Area::withCount('beds')->where('project_id', $project_id)->get();
// 合计
$total['order_total'] = $total['shouxufei'] = $total['zengshishui'] = $total['shijishouru'] = $total['guanlifei'] = 0; $total['order_total'] = $total['shouxufei'] = $total['zengshishui'] = $total['shijishouru'] = $total['guanlifei'] = 0;
foreach ($area as $item) { foreach ($area as $item) {
$beds = Bed::where('area_id', $item->id)->where('project_id', $project_id)->get(); $beds = Bed::where('area_id', $item->id)->where('project_id', $project_id)->get();
@ -577,7 +578,12 @@ class StatisticsController extends CommonController
$refund['order_total'] = Refund::where('created_at', 'like', '%' . $month . '%')->whereIn('order_id', $allOrderTotal->pluck('id'))->sum('money'); $refund['order_total'] = Refund::where('created_at', 'like', '%' . $month . '%')->whereIn('order_id', $allOrderTotal->pluck('id'))->sum('money');
$refund['shijishouru'] = $refund['order_total']; $refund['shijishouru'] = $refund['order_total'];
$refund['guanlifei'] = round($refund['order_total'] * 0.06, 2); $refund['guanlifei'] = round($refund['order_total'] * 0.06, 2);
// 总计
$zongji['order_total'] = $total['order_total'] - $refund['order_total'];
$zongji['shouxufei'] =
$zongji['zengshishui'] =
$zongji['shijishouru'] = $total['shijishouru'] - $refund['shijishouru'];
$zongji['guanlifei'] = $total['guanlifei'] - $refund['guanlifei'];
// 导出 // 导出
if ($is_export) { if ($is_export) {
@ -606,7 +612,7 @@ class StatisticsController extends CommonController
$writer->save('php://output'); $writer->save('php://output');
exit; exit;
} }
return view($this->bladePath . ".income", compact("refund","total", "area", "project", "project_id", "month", "projects")); return view($this->bladePath . ".income", compact("zongji","refund", "total", "area", "project", "project_id", "month", "projects"));
} }
} }

@ -65,6 +65,14 @@
<td>{{ $refund['shijishouru'] }}</td> <td>{{ $refund['shijishouru'] }}</td>
<td>{{ $refund['guanlifei'] }}</td> <td>{{ $refund['guanlifei'] }}</td>
</tr> </tr>
<tr>
<td>总计</td>
<td>{{ $zongji['order_total'] }}</td>
<td></td>
<td></td>
<td>{{ $zongji['shijishouru'] }}</td>
<td>{{ $zongji['guanlifei'] }}</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

Loading…
Cancel
Save