192 lines
7.0 KiB
HTML
192 lines
7.0 KiB
HTML
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' %}
|