title = "order-detail/payment" url = "/order-detail/payment/:orderId" layout = "platform_main" is_hidden = 0 [order] == param("orderId"); $orderId = $this->param("orderId"); $this["order"] = Romanah\Gokbakja\Models\Order::where("id", $orderId) ->withCount(['order_items as order_all_amount' => function($query) { $query->select(DB::raw('sum(amount)')); }]) ->withCount(['order_items as order_all_price' => function($query) { $query->select(DB::raw('sum(price)')); }]) ->first(); $count = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->count(); if($count > 0){ $this["all"] = ($this["order"]->order_all_amount * $this["order"]->order_all_price) / $count; } $this["payments"] = Romanah\Gokbakja\Models\Payment::where("order_id", $orderId)->with('order')->orderBy("id", "DESC")->get(); $this["allPaid"] = Romanah\Gokbakja\Models\Payment::where("order_id", $orderId)->sum("amount"); $orderItems = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->orderBy("id", "DESC")->with(["type", "size", "color"])->get(); $sumOfPrice = 0; for ($x = 0; $x < count($orderItems); $x++) { $sumOfPrice = ($sumOfPrice + ($orderItems[$x]->amount * $orderItems[$x]->price)); } $this["sumOfPrice"] = $sumOfPrice; $allNot = ($sumOfPrice - $this["allPaid"]); $this["allNot"] = ""; if($allNot < 0){ $this["allNot"] = abs($allNot).' $ artyk tölenen'; }else{ $this["allNot"] = 'Bergisi: '.$allNot.' $'; } } ?> == {% put styles %} {% endput %}

Sargyt Maglumatlary

{% put scripts %} {% endput %} {% partial 'dataTableJs' %}