report
This commit is contained in:
parent
eb17dc61bd
commit
f94fd8c110
|
|
@ -259,14 +259,9 @@ class Order extends ComponentBase
|
||||||
$html_data = '';
|
$html_data = '';
|
||||||
|
|
||||||
$orderDatas = OrderModel::with(["client", "shipping"])
|
$orderDatas = OrderModel::with(["client", "shipping"])
|
||||||
->withCount(['order_items as order_all_amount' => function ($query) {
|
->withCount(['order_items as qty'])
|
||||||
$query->select(DB::raw('sum(amount)'));
|
|
||||||
}])
|
|
||||||
->withCount(['order_items as order_all_price' => function ($query) {
|
->withCount(['order_items as order_all_price' => function ($query) {
|
||||||
$query->select(DB::raw('sum(price) * sum(amount)'));
|
$query->select(DB::raw('sum(price) * sum(amount) / qty'));
|
||||||
}])
|
|
||||||
->withCount(['payment as all_payments' => function ($query) {
|
|
||||||
$query->select(DB::raw('sum(amount)'));
|
|
||||||
}])
|
}])
|
||||||
->orderBy('id', 'DESC')
|
->orderBy('id', 'DESC')
|
||||||
->get();
|
->get();
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ class OrderItem extends ComponentBase
|
||||||
if($orderItems[$x]->user_id != $user->id){
|
if($orderItems[$x]->user_id != $user->id){
|
||||||
$editBtnPrice = '<a href="#"
|
$editBtnPrice = '<a href="#"
|
||||||
class="badge badge-soft-success"
|
class="badge badge-soft-success"
|
||||||
style="font-size: 14px;">'.number_format($orderItems[$x]->price).' $</a>';
|
style="font-size: 14px;">'.number_format($orderItems[$x]->price, 2).' $</a>';
|
||||||
|
|
||||||
$editAmount = '<a href="#" >';
|
$editAmount = '<a href="#" >';
|
||||||
|
|
||||||
|
|
@ -159,11 +159,11 @@ class OrderItem extends ComponentBase
|
||||||
data-request-data="orderItemId: '.$orderItems[$x]->id.'"
|
data-request-data="orderItemId: '.$orderItems[$x]->id.'"
|
||||||
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1"
|
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1"
|
||||||
class="badge badge-soft-success"
|
class="badge badge-soft-success"
|
||||||
style="font-size: 14px;">'.number_format($orderItems[$x]->price).' $</a>'
|
style="font-size: 14px;">'.number_format($orderItems[$x]->price, 2).' $</a>'
|
||||||
:
|
:
|
||||||
|
|
||||||
'<a href="#" class="badge badge-soft-success"
|
'<a href="#" class="badge badge-soft-success"
|
||||||
style="font-size: 14px;">'.number_format($orderItems[$x]->price).' $</a>';
|
style="font-size: 14px;">'.number_format($orderItems[$x]->price, 2).' $</a>';
|
||||||
|
|
||||||
$editAmount = $crudOrderq ? '<a href="#" data-request="onModalSetAmount"
|
$editAmount = $crudOrderq ? '<a href="#" data-request="onModalSetAmount"
|
||||||
data-request-data="orderItemId: '.$orderItems[$x]->id.'"
|
data-request-data="orderItemId: '.$orderItems[$x]->id.'"
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@ class Production extends ComponentBase
|
||||||
$data = post();
|
$data = post();
|
||||||
|
|
||||||
|
|
||||||
$productions = ProductionModel::with(['pivot_production', 'excruiter', 'shift'])->orderBy('id', 'DESC');
|
$productions = ProductionModel::with(['pivot_production', 'excruiter', 'shift', 'pivot_production_calculation'])->orderBy('date', 'DESC')->orderBy('time', 'DESC');
|
||||||
|
|
||||||
$productionsCalc = ProductionModel::orderBy('id', 'DESC');
|
$productionsCalc = ProductionModel::orderBy('id', 'DESC');
|
||||||
|
|
||||||
$productionsCalcPivot = ProductionCalculateModel::orderBy('id', 'DESC');
|
$productionsCalcPivot = ProductionCalculateModel::orderBy('id', 'DESC');
|
||||||
|
|
@ -89,9 +90,17 @@ class Production extends ComponentBase
|
||||||
}
|
}
|
||||||
|
|
||||||
$productionsFiltered = $productions->get();
|
$productionsFiltered = $productions->get();
|
||||||
$calculationAmount = $productionsCalcPivot->sum("amount_calc");
|
|
||||||
|
|
||||||
//dd($calculationAmount);
|
//$calculationAmount = $productionsCalcPivot->sum("amount_calc");
|
||||||
|
|
||||||
|
$calculationAmountqq = $productions->where('id', '!=', $productionsFiltered[0]->id)->get()->pluck('id')->toArray();
|
||||||
|
|
||||||
|
$pivotIds = PivotProductionModel::whereIn('production_id', $calculationAmountqq)->get()->pluck('id')->toArray();
|
||||||
|
|
||||||
|
$calculationAmount = ProductionCalculateModel::whereIn('prev_pivot_id', $pivotIds)->sum("amount_calc");
|
||||||
|
|
||||||
|
|
||||||
|
//dd($pivotIds);
|
||||||
|
|
||||||
$html_data = '';
|
$html_data = '';
|
||||||
for ($x = 0; $x < count($productionsFiltered); $x++) {
|
for ($x = 0; $x < count($productionsFiltered); $x++) {
|
||||||
|
|
@ -104,7 +113,7 @@ class Production extends ComponentBase
|
||||||
// dd($productionsFiltered[0]->shift->desc);
|
// dd($productionsFiltered[0]->shift->desc);
|
||||||
$html_data .= '<tr>
|
$html_data .= '<tr>
|
||||||
<td style="font-weight: bold;width: 5%;">' . ($x + 1) . '</td>
|
<td style="font-weight: bold;width: 5%;">' . ($x + 1) . '</td>
|
||||||
<td><a href="#" style="font-weight: bold;color: #0005c5;">' . $date . '</a></td>
|
<td><a href="#'.$productionsFiltered[$x]->id.'" style="font-weight: bold;color: #0005c5;">' . $date . '</a></td>
|
||||||
<td><a href="#" style="font-weight: bold;color: #1e2038;">' . $productionsFiltered[$x]->shift->desc . '</a></td>
|
<td><a href="#" style="font-weight: bold;color: #1e2038;">' . $productionsFiltered[$x]->shift->desc . '</a></td>
|
||||||
<td style="text-align: center;">
|
<td style="text-align: center;">
|
||||||
<span class="badge badge-soft-info"
|
<span class="badge badge-soft-info"
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,15 @@ items:
|
||||||
isHidden: '0'
|
isHidden: '0'
|
||||||
cssClass: ''
|
cssClass: ''
|
||||||
isExternal: '0'
|
isExternal: '0'
|
||||||
|
-
|
||||||
|
title: 'Halta Hasabaty'
|
||||||
|
type: cms-page
|
||||||
|
code: bagActions
|
||||||
|
reference: actions/bag-report
|
||||||
|
viewBag:
|
||||||
|
isHidden: '0'
|
||||||
|
cssClass: ''
|
||||||
|
isExternal: '0'
|
||||||
-
|
-
|
||||||
title: 'Rulon Sklad Hereketleri'
|
title: 'Rulon Sklad Hereketleri'
|
||||||
nesting: null
|
nesting: null
|
||||||
|
|
@ -131,6 +140,19 @@ items:
|
||||||
isHidden: '0'
|
isHidden: '0'
|
||||||
cssClass: ''
|
cssClass: ''
|
||||||
isExternal: '0'
|
isExternal: '0'
|
||||||
|
-
|
||||||
|
title: 'Rulon Hasabaty'
|
||||||
|
nesting: null
|
||||||
|
type: cms-page
|
||||||
|
url: null
|
||||||
|
code: rulonActions
|
||||||
|
reference: actions/rulon-report
|
||||||
|
cmsPage: null
|
||||||
|
replace: null
|
||||||
|
viewBag:
|
||||||
|
isHidden: '0'
|
||||||
|
cssClass: ''
|
||||||
|
isExternal: '0'
|
||||||
-
|
-
|
||||||
title: 'Çig Mal Skladlar'
|
title: 'Çig Mal Skladlar'
|
||||||
nesting: null
|
nesting: null
|
||||||
|
|
@ -463,9 +485,13 @@ items:
|
||||||
isExternal: '0'
|
isExternal: '0'
|
||||||
-
|
-
|
||||||
title: Drobika
|
title: Drobika
|
||||||
|
nesting: null
|
||||||
type: cms-page
|
type: cms-page
|
||||||
|
url: null
|
||||||
code: drobika
|
code: drobika
|
||||||
reference: drobika/new
|
reference: drobika/new
|
||||||
|
cmsPage: null
|
||||||
|
replace: null
|
||||||
viewBag:
|
viewBag:
|
||||||
isHidden: '0'
|
isHidden: '0'
|
||||||
cssClass: ri-command-line
|
cssClass: ri-command-line
|
||||||
|
|
@ -473,18 +499,26 @@ items:
|
||||||
items:
|
items:
|
||||||
-
|
-
|
||||||
title: 'Täze Hasabat'
|
title: 'Täze Hasabat'
|
||||||
|
nesting: null
|
||||||
type: cms-page
|
type: cms-page
|
||||||
|
url: null
|
||||||
code: drobika
|
code: drobika
|
||||||
reference: drobika/new
|
reference: drobika/new
|
||||||
|
cmsPage: null
|
||||||
|
replace: null
|
||||||
viewBag:
|
viewBag:
|
||||||
isHidden: '0'
|
isHidden: '0'
|
||||||
cssClass: ''
|
cssClass: ''
|
||||||
isExternal: '0'
|
isExternal: '0'
|
||||||
-
|
-
|
||||||
title: Hasabat
|
title: Hasabat
|
||||||
|
nesting: null
|
||||||
type: cms-page
|
type: cms-page
|
||||||
|
url: null
|
||||||
code: drobika
|
code: drobika
|
||||||
reference: drobika/report
|
reference: drobika/report
|
||||||
|
cmsPage: null
|
||||||
|
replace: null
|
||||||
viewBag:
|
viewBag:
|
||||||
isHidden: '0'
|
isHidden: '0'
|
||||||
cssClass: ''
|
cssClass: ''
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
title = "actions/bag-report"
|
||||||
|
url = "/actions/bag-report/:month/:year?"
|
||||||
|
layout = "platform_main"
|
||||||
|
is_hidden = 0
|
||||||
|
==
|
||||||
|
<?php
|
||||||
|
function onStart() {
|
||||||
|
$currentDate = Carbon\Carbon::now();
|
||||||
|
$this["month"] = $this->param("month");
|
||||||
|
$year = $this->param("year");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($this["month"] == 'default'){
|
||||||
|
$this["month"] = $currentDate->month;
|
||||||
|
}
|
||||||
|
|
||||||
|
$reportDatas = [];
|
||||||
|
//dd($reportDatas);
|
||||||
|
|
||||||
|
$bagProds = Romanah\Gokbakja\Models\SewerProduction::select('width', 'height')
|
||||||
|
->whereMonth('date', 11)
|
||||||
|
->whereYear('date', $currentDate->year)
|
||||||
|
->groupBy('width')
|
||||||
|
->groupBy('height')
|
||||||
|
->orderBy('width', 'ASC')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
|
||||||
|
$bagGrams = Romanah\Gokbakja\Models\PivotSewer::select('bag_gram')
|
||||||
|
->with('sewer_production')
|
||||||
|
->whereHas('sewer_production', function($qq) use($currentDate){
|
||||||
|
$qq->whereMonth('date', 11)->whereYear('date', $currentDate->year);
|
||||||
|
})
|
||||||
|
->groupBy('bag_gram')
|
||||||
|
->orderBy('bag_gram', 'ASC')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
for ($x = 0; $x < count($bagProds); $x++) {
|
||||||
|
|
||||||
|
$reportDatas[$x]["width"] = $bagProds[$x]->width;
|
||||||
|
$reportDatas[$x]["height"] = $bagProds[$x]->height;
|
||||||
|
|
||||||
|
|
||||||
|
$action = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
|
||||||
|
->with('product')
|
||||||
|
->with('product.pivot_sewer')
|
||||||
|
->whereYear('created_at', $year)
|
||||||
|
->whereMonth('created_at', $this["month"])
|
||||||
|
->whereHas('product', function($qq) use($bagProds, $x){
|
||||||
|
$qq->where('width', $bagProds[$x]->width)->where('height', $bagProds[$x]->height);
|
||||||
|
})
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
|
||||||
|
$reportDatas[$x]["amount"] = $action;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dd($reportDatas);
|
||||||
|
if($year){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
==
|
||||||
|
{% put styles %}
|
||||||
|
<link href="{{'assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css'|theme}}" rel="stylesheet"
|
||||||
|
type="text/css" />
|
||||||
|
<link href="{{'assets/libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css'|theme}}" rel="stylesheet"
|
||||||
|
type="text/css" />
|
||||||
|
<link href="{{'assets/libs/datatables.net-select-bs4/css/select.bootstrap4.min.css'|theme}}" rel="stylesheet"
|
||||||
|
type="text/css" />
|
||||||
|
{% endput %}
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<!-- start page title -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="page-title-box d-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-0">Aýlar Boýunça {{year}}</h4>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end page title -->
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<!-- Left sidebar -->
|
||||||
|
<div class="email-leftbar card">
|
||||||
|
<div class="mail-list mt-4">
|
||||||
|
<a href="/actions/bag-report/1" class="{{ month == 1 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Ýanwar</a>
|
||||||
|
<a href="/actions/bag-report/2" class="{{ month == 2 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Fewral</a>
|
||||||
|
<a href="/actions/bag-report/3" class="{{ month == 3 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Mart</a>
|
||||||
|
<a href="/actions/bag-report/4" class="{{ month == 4 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Aprel</a>
|
||||||
|
<a href="/actions/bag-report/5" class="{{ month == 5 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Maý</a>
|
||||||
|
<a href="/actions/bag-report/6" class="{{ month == 6 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Iýun</a>
|
||||||
|
<a href="/actions/bag-report/7" class="{{ month == 7 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Iýul</a>
|
||||||
|
<a href="/actions/bag-report/8" class="{{ month == 8 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Awgust</a>
|
||||||
|
<a href="/actions/bag-report/9" class="{{ month == 9 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Sentýabr</a>
|
||||||
|
<a href="/actions/bag-report/10" class="{{ month == 10 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Oktýabr</a>
|
||||||
|
<a href="/actions/bag-report/11" class="{{ month == 11 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Noýabr</a>
|
||||||
|
<a href="/actions/bag-report/12" class="{{ month == 12 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Dekabr</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- End Left sidebar -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Right Sidebar -->
|
||||||
|
<div class="email-rightbar mb-3">
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap"
|
||||||
|
style="border-collapse: collapse; border-spacing: 0; width: 100%;" data-page-length='80'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 5%;">№</th>
|
||||||
|
<th>Gram</th>
|
||||||
|
<th>Ini</th>
|
||||||
|
<th>Boýy</th>
|
||||||
|
<th>Reňki</th>
|
||||||
|
<th>Öndürilen Haltasy (arassa)</th>
|
||||||
|
<th>Öndürilen Haltasy (brak)</th>
|
||||||
|
<th>Sürülmedik haltalar</th>
|
||||||
|
<th>Jemi öndüren haltasy</th>
|
||||||
|
<!-- <th>Настройки</th> -->
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 5%;">№</th>
|
||||||
|
<th>Gram</th>
|
||||||
|
<th>Ini</th>
|
||||||
|
<th>Boýy</th>
|
||||||
|
<th>Reňki</th>
|
||||||
|
<th>Öndürilen Haltasy (arassa)</th>
|
||||||
|
<th>Öndürilen Haltasy (brak)</th>
|
||||||
|
<th>Sürülmedik haltalar</th>
|
||||||
|
<th>Jemi öndüren haltasy</th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <!-- card -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End row -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% partial 'dataTableJs' %}
|
||||||
|
|
@ -0,0 +1,253 @@
|
||||||
|
title = "actions/rulon-report"
|
||||||
|
url = "/actions/rulon-report/:month/:year?"
|
||||||
|
layout = "platform_main"
|
||||||
|
is_hidden = 0
|
||||||
|
==
|
||||||
|
<?php
|
||||||
|
function onStart() {
|
||||||
|
$currentDate = Carbon\Carbon::now();
|
||||||
|
$this["month"] = $this->param("month");
|
||||||
|
$year = $this->param("year");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($this["month"] == 'default'){
|
||||||
|
$this["month"] = $currentDate->month;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//dd($reportDatas);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($year){
|
||||||
|
$reportDatas = [];
|
||||||
|
|
||||||
|
$rulonProds = Romanah\Gokbakja\Models\ProductionMachine::select('gram', 'width')
|
||||||
|
->whereMonth('date', $this["month"])
|
||||||
|
->whereYear('date', $year)
|
||||||
|
->groupBy('gram')->groupBy('width')
|
||||||
|
->orderBy('width', 'ASC')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
for ($x = 0; $x < count($rulonProds); $x++) {
|
||||||
|
|
||||||
|
$action = Romanah\Gokbakja\Models\RulonAction::select('romanah_gokbakja_rulon_action.*')
|
||||||
|
->with('product')
|
||||||
|
->whereYear('created_at', $year)
|
||||||
|
->whereMonth('created_at', $this["month"])
|
||||||
|
->whereHas('product', function($qq) use($rulonProds, $x){
|
||||||
|
$qq->where('gram', $rulonProds[$x]->gram)->where('width', $rulonProds[$x]->width);
|
||||||
|
})
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
$actionIn = Romanah\Gokbakja\Models\RulonAction::select('romanah_gokbakja_rulon_action.*')
|
||||||
|
->with('product')
|
||||||
|
->where('type', 'inbox')
|
||||||
|
->whereYear('created_at', $year)
|
||||||
|
->whereMonth('created_at', $this["month"])
|
||||||
|
->whereHas('product', function($qq) use($rulonProds, $x){
|
||||||
|
$qq->where('gram', $rulonProds[$x]->gram)->where('width', $rulonProds[$x]->width);
|
||||||
|
})
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
|
||||||
|
$actionOut = Romanah\Gokbakja\Models\RulonAction::select('romanah_gokbakja_rulon_action.*')
|
||||||
|
->with('product')
|
||||||
|
->where('type', 'outbox')
|
||||||
|
->whereYear('created_at', $year)
|
||||||
|
->whereMonth('created_at', $this["month"])
|
||||||
|
->whereHas('product', function($qq) use($rulonProds, $x){
|
||||||
|
$qq->where('gram', $rulonProds[$x]->gram)->where('width', $rulonProds[$x]->width);
|
||||||
|
})
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
$reportDatas[$x]["gram"] = $rulonProds[$x]->gram;
|
||||||
|
$reportDatas[$x]["width"] = $rulonProds[$x]->width;
|
||||||
|
$reportDatas[$x]["start_month"] = $action;
|
||||||
|
$reportDatas[$x]["in"] = $actionIn;
|
||||||
|
$reportDatas[$x]["out"] = $actionOut;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$this['reportDatas'] = $reportDatas;
|
||||||
|
}else{
|
||||||
|
$reportDatas = [];
|
||||||
|
|
||||||
|
$rulonProds = Romanah\Gokbakja\Models\ProductionMachine::select('gram', 'width')
|
||||||
|
->whereMonth('created_at', $this["month"])
|
||||||
|
->whereYear('date', $currentDate->year)
|
||||||
|
->groupBy('gram')->groupBy('width')
|
||||||
|
->orderBy('width', 'ASC')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
for ($x = 0; $x < count($rulonProds); $x++) {
|
||||||
|
|
||||||
|
$action = Romanah\Gokbakja\Models\RulonAction::select('romanah_gokbakja_rulon_action.*')
|
||||||
|
->with('product')
|
||||||
|
->whereYear('created_at', $currentDate->year)
|
||||||
|
->whereMonth('created_at', $this["month"])
|
||||||
|
->whereHas('product', function($qq) use($rulonProds, $x){
|
||||||
|
$qq->where('gram', $rulonProds[$x]->gram)->where('width', $rulonProds[$x]->width);
|
||||||
|
})
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
$actionIn = Romanah\Gokbakja\Models\RulonAction::select('romanah_gokbakja_rulon_action.*')
|
||||||
|
->with('product')
|
||||||
|
->where('type', 'inbox')
|
||||||
|
->whereYear('created_at', $currentDate->year)
|
||||||
|
->whereMonth('created_at', $this["month"])
|
||||||
|
->whereHas('product', function($qq) use($rulonProds, $x){
|
||||||
|
$qq->where('gram', $rulonProds[$x]->gram)->where('width', $rulonProds[$x]->width);
|
||||||
|
})
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
|
||||||
|
$actionOut = Romanah\Gokbakja\Models\RulonAction::select('romanah_gokbakja_rulon_action.*')
|
||||||
|
->with('product')
|
||||||
|
->where('type', 'outbox')
|
||||||
|
->whereYear('created_at', $currentDate->year)
|
||||||
|
->whereMonth('created_at', $this["month"])
|
||||||
|
->whereHas('product', function($qq) use($rulonProds, $x){
|
||||||
|
$qq->where('gram', $rulonProds[$x]->gram)->where('width', $rulonProds[$x]->width);
|
||||||
|
})
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
$reportDatas[$x]["gram"] = $rulonProds[$x]->gram;
|
||||||
|
$reportDatas[$x]["width"] = $rulonProds[$x]->width;
|
||||||
|
$reportDatas[$x]["start_month"] = $action;
|
||||||
|
$reportDatas[$x]["in"] = $actionIn;
|
||||||
|
$reportDatas[$x]["out"] = $actionOut;
|
||||||
|
|
||||||
|
}
|
||||||
|
$this['reportDatas'] = $reportDatas;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
==
|
||||||
|
{% put styles %}
|
||||||
|
<link href="{{'assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css'|theme}}" rel="stylesheet"
|
||||||
|
type="text/css" />
|
||||||
|
<link href="{{'assets/libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css'|theme}}" rel="stylesheet"
|
||||||
|
type="text/css" />
|
||||||
|
<link href="{{'assets/libs/datatables.net-select-bs4/css/select.bootstrap4.min.css'|theme}}" rel="stylesheet"
|
||||||
|
type="text/css" />
|
||||||
|
{% endput %}
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<!-- start page title -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="page-title-box d-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-0">Aýlar Boýunça {{year}}</h4>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end page title -->
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<!-- Left sidebar -->
|
||||||
|
<div class="email-leftbar card">
|
||||||
|
<div class="mail-list mt-4">
|
||||||
|
<a href="/actions/rulon-report/1" class="{{ month == 1 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Ýanwar</a>
|
||||||
|
<a href="/actions/rulon-report/2" class="{{ month == 2 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Fewral</a>
|
||||||
|
<a href="/actions/rulon-report/3" class="{{ month == 3 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Mart</a>
|
||||||
|
<a href="/actions/rulon-report/4" class="{{ month == 4 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Aprel</a>
|
||||||
|
<a href="/actions/rulon-report/5" class="{{ month == 5 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Maý</a>
|
||||||
|
<a href="/actions/rulon-report/6" class="{{ month == 6 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Iýun</a>
|
||||||
|
<a href="/actions/rulon-report/7" class="{{ month == 7 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Iýul</a>
|
||||||
|
<a href="/actions/rulon-report/8" class="{{ month == 8 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Awgust</a>
|
||||||
|
<a href="/actions/rulon-report/9" class="{{ month == 9 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Sentýabr</a>
|
||||||
|
<a href="/actions/rulon-report/10" class="{{ month == 10 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Oktýabr</a>
|
||||||
|
<a href="/actions/rulon-report/11" class="{{ month == 11 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Noýabr</a>
|
||||||
|
<a href="/actions/rulon-report/12" class="{{ month == 12 ? 'active' : '' }}"><i
|
||||||
|
class="mdi mdi-archive me-2 font-size-16"></i> Dekabr</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- End Left sidebar -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Right Sidebar -->
|
||||||
|
<div class="email-rightbar mb-3">
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap"
|
||||||
|
style="border-collapse: collapse; border-spacing: 0; width: 100%;" data-page-length='80'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 5%;">№</th>
|
||||||
|
<th>Gram</th>
|
||||||
|
<th>Ini</th>
|
||||||
|
<th>Aýyň Başyna</th>
|
||||||
|
<th>Gelen</th>
|
||||||
|
<th>Giden</th>
|
||||||
|
<!-- <th>Настройки</th> -->
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
{% for key, report in reportDatas %}
|
||||||
|
<tr>
|
||||||
|
<td style="font-weight: bold;">{{key + 1}}</td>
|
||||||
|
<td><a href="#" style="font-weight: bold;">{{report.gram}}</a></td>
|
||||||
|
<td>{{report.width}}</td>
|
||||||
|
<td>{{report.start_month}}</td>
|
||||||
|
<td style="color: darkgreen;">{{report.in}}</td>
|
||||||
|
<td style="color: darkred;">{{report.out}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 5%;">№</th>
|
||||||
|
<th>Gram</th>
|
||||||
|
<th>Ini</th>
|
||||||
|
<th>Aýyň Başyna</th>
|
||||||
|
<th>Gelen</th>
|
||||||
|
<th>Giden</th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <!-- card -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End row -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% partial 'dataTableJs' %}
|
||||||
|
|
@ -12,7 +12,7 @@ function onStart(){
|
||||||
|
|
||||||
$orderId = $this->param("orderId");
|
$orderId = $this->param("orderId");
|
||||||
|
|
||||||
$this["order"] = Romanah\Gokbakja\Models\Order::where("id", $orderId)->with(["client", "shipping"])
|
$this["order"] = Romanah\Gokbakja\Models\Order::where("id", $orderId)
|
||||||
->withCount(['order_items as order_all_amount' => function($query) {
|
->withCount(['order_items as order_all_amount' => function($query) {
|
||||||
$query->select(DB::raw('sum(amount)'));
|
$query->select(DB::raw('sum(amount)'));
|
||||||
}])
|
}])
|
||||||
|
|
@ -21,9 +21,13 @@ function onStart(){
|
||||||
}])
|
}])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$this["orderItems"] = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->get();
|
$count = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->count();
|
||||||
|
|
||||||
$this["all"] = ($this["order"]->order_all_amount * $this["order"]->order_all_price);
|
if($count > 0){
|
||||||
|
$this["all"] = ($this["order"]->order_all_amount * $this["order"]->order_all_price) / $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this["orderItems"] = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->get();
|
||||||
|
|
||||||
$this["transports"] = Romanah\Gokbakja\Models\ShippingTransport::where("shipping_id", $this["order"]->shipping_id)->with('shipping.order')->with('order_item')->orderBy("id", "DESC")->get();
|
$this["transports"] = Romanah\Gokbakja\Models\ShippingTransport::where("shipping_id", $this["order"]->shipping_id)->with('shipping.order')->with('order_item')->orderBy("id", "DESC")->get();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ function onStart(){
|
||||||
|
|
||||||
$orderId = $this->param("orderId");
|
$orderId = $this->param("orderId");
|
||||||
|
|
||||||
$this["order"] = Romanah\Gokbakja\Models\Order::where("id", $orderId)->with(["client", "shipping"])
|
$this["order"] = Romanah\Gokbakja\Models\Order::where("id", $orderId)
|
||||||
->withCount(['order_items as order_all_amount' => function($query) {
|
->withCount(['order_items as order_all_amount' => function($query) {
|
||||||
$query->select(DB::raw('sum(amount)'));
|
$query->select(DB::raw('sum(amount)'));
|
||||||
}])
|
}])
|
||||||
|
|
@ -21,7 +21,11 @@ function onStart(){
|
||||||
}])
|
}])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$this["all"] = ($this["order"]->order_all_amount * $this["order"]->order_all_price);
|
$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["payments"] = Romanah\Gokbakja\Models\Payment::where("order_id", $orderId)->with('order')->orderBy("id", "DESC")->get();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ function onStart(){
|
||||||
$q->with(['bag_type', 'bag_size', 'color']);
|
$q->with(['bag_type', 'bag_size', 'color']);
|
||||||
}])
|
}])
|
||||||
->where("stock_id", $stockId)
|
->where("stock_id", $stockId)
|
||||||
//->where("status_accountant", "accept")
|
|
||||||
//->where("status_director", "accept")
|
|
||||||
->addSelect(DB::raw("SUM(amount) as quantity"))
|
->addSelect(DB::raw("SUM(amount) as quantity"))
|
||||||
->having('quantity', '>', 0)
|
->having('quantity', '>', 0)
|
||||||
->groupBy('romanah_gokbakja_rulon_action.product_id')
|
->groupBy('romanah_gokbakja_rulon_action.product_id')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue