Merge branch 'master' of /data/git/tiantian2

master
root 5 years ago
commit 1d2e047639

@ -142,7 +142,10 @@ class StatisticsController extends CommonController
->whereHas("order", function ($query) use ($project_id) {
$query->where("project_id", $project_id);
})->sum("money");
$this_month_balances = Balance::whereRaw("UNIX_TIMESTAMP(`created_at`) >= " . $start_timestamp . " and UNIX_TIMESTAMP(`created_at`) < " . $end_timestamp)->get();
$this_month_balances = Balance::whereRaw("UNIX_TIMESTAMP(`created_at`) >= " . $start_timestamp . " and UNIX_TIMESTAMP(`created_at`) < " . $end_timestamp)
->whereHas("order", function ($query) use ($project_id) {
$query->where("project_id", $project_id);
})->get();
return view($this->urlPrefix . "/overview", compact("project_id", "month", "project", "prev_month_balance", "this_month_balance", "this_month_balances"));
}
@ -199,8 +202,20 @@ class StatisticsController extends CommonController
$month = request()->month ?? date("Y-m");
$months = $this->_getMonths();
$recharges = Recharge::with(["manager", "order", "patient"])->withCount("refunds")->whereNotNull("paid_at")->whereRaw("DATE_FORMAT(`paid_at`,'%Y-%m') = '{$month}'")->get();
$refunds = Refund::whereNotNull("paid_at")->whereRaw("DATE_FORMAT(`paid_at`,'%Y-%m') = '{$month}'")->get();
$recharges = Recharge::with(["manager", "order", "patient"])
->withCount("refunds")
->whereNotNull("paid_at")
->whereRaw("DATE_FORMAT(`paid_at`,'%Y-%m') = '{$month}'")
->whereHas("order", function ($query) use ($project_id) {
$query->where("project_id", $project_id);
})
->get();
$refunds = Refund::whereNotNull("paid_at")
->whereRaw("DATE_FORMAT(`paid_at`,'%Y-%m') = '{$month}'")
->whereHas("order", function ($query) use ($project_id) {
$query->where("project_id", $project_id);
})
->get();
return view($this->bladePath . ".finance", compact("recharges", "refunds", "projects", "project_id", "months", "month"));
}

@ -58,22 +58,22 @@ class OrderItems extends SoftDeletesModel
public function bed()
{
return $this->belongsTo(Bed::class);
return $this->belongsTo(Bed::class)->withTrashed();
}
public function room()
{
return $this->hasOneThrough(Room::class, Bed::class, "id", "id", "bed_id", "room_id");
return $this->hasOneThrough(Room::class, Bed::class, "id", "id", "bed_id", "room_id")->withTrashed();
}
public function building()
{
return $this->hasOneThrough(Building::class, Bed::class, "id", "id", "bed_id", "building_id");
return $this->hasOneThrough(Building::class, Bed::class, "id", "id", "bed_id", "building_id")->withTrashed();
}
public function area()
{
return $this->hasOneThrough(Area::class, Bed::class, "id", "id", "bed_id", "area_id");
return $this->hasOneThrough(Area::class, Bed::class, "id", "id", "bed_id", "area_id")->withTrashed();
}
public function paramedic()

@ -105,7 +105,7 @@
<td class="p-1">{{ $item->order ? $item->order->contact."/".$item->order->mobile : "" }}</td>
<td class="p-1">{{ $item->building->name }}</td>
<td class="p-1">{{ $item->area->name }}</td>
<td class="p-1">{{ $item->room->name."-".$item->bed->name }}</td>
<td class="p-1">{{ ($item->room ? $item->room->name : "")."-".$item->bed->name }}</td>
<td class="p-1">{!! implode("<br>",$item->factor_texts) !!}</td>
<td class="p-1">{{ $item->total }}</td>
<td class="p-1">{{ $item->paramedic_total }}</td>

Loading…
Cancel
Save