291 lines
14 KiB
HTML
291 lines
14 KiB
HTML
title = "production/daily-seperate"
|
|
url = "/production/daily-seperate/: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 = [];
|
|
|
|
$productionDates = Romanah\Gokbakja\Models\production::select('date', 'excruiter_id')
|
|
->whereMonth('date', $this["month"])
|
|
->whereYear('date', $currentDate->year)
|
|
->with('excruiter')
|
|
->groupBy('date')
|
|
->groupBy('excruiter_id')
|
|
->orderBy('date', 'ASC')
|
|
->distinct()
|
|
->get();
|
|
|
|
|
|
|
|
for ($x = 0; $x < count($productionDates); $x++) {
|
|
|
|
$sumDiff = Romanah\Gokbakja\Models\ProductionCalculate::where('date', $productionDates[$x]->date)->where('excruiter_id', $productionDates[$x]->excruiter_id);
|
|
$sumDiff2 = Romanah\Gokbakja\Models\ProductionCalculate::where('date', $productionDates[$x]->date)->where('excruiter_id', $productionDates[$x]->excruiter_id);
|
|
|
|
|
|
|
|
//dd($lastId1);
|
|
$shift1 = $sumDiff->where('shift_id', 1)->sum('amount_calc');
|
|
$shift2 = $sumDiff2->where('shift_id', 2)->sum('amount_calc');
|
|
|
|
$reportDatas[$x]["date"] = $productionDates[$x]->date;
|
|
$reportDatas[$x]["shift1"] = $shift1;
|
|
$reportDatas[$x]["shift2"] = $shift2;
|
|
$reportDatas[$x]["extrudor"] = $productionDates[$x]->excruiter->name;
|
|
$reportDatas[$x]["all_shift_calc"] = ($shift1 + $shift2);
|
|
|
|
|
|
|
|
$products_all = $sumDiff->with('product')->groupBy('product_id')->get();
|
|
|
|
for ($xx = 0; $xx < count($products_all); $xx++) {
|
|
|
|
$sumDiffq = Romanah\Gokbakja\Models\ProductionCalculate::whereDate('date', $productionDates[$x]->date)->where('shift_id', 1)->where('excruiter_id', $productionDates[$x]->excruiter_id);
|
|
|
|
$sumDiff2q = Romanah\Gokbakja\Models\ProductionCalculate::whereDate('date', $productionDates[$x]->date)->where('shift_id', 2)->where('excruiter_id', $productionDates[$x]->excruiter_id);
|
|
|
|
$products_amount1 = $sumDiffq->where('product_id', $products_all[$xx]->product_id)->sum('amount_calc');
|
|
$products_amount2 = $sumDiff2q->where('product_id', $products_all[$xx]->product_id)->sum('amount_calc');
|
|
|
|
$reportDatas[$x]["products_shift1"][$xx]["product_code"] = $products_all[$xx]->product->code;
|
|
$reportDatas[$x]["products_shift1"][$xx]["product_value"] = $products_amount1;
|
|
|
|
$reportDatas[$x]["products_shift2"][$xx]["product_code"] = $products_all[$xx]->product->code;
|
|
$reportDatas[$x]["products_shift2"][$xx]["product_value"] = $products_amount2;
|
|
|
|
}
|
|
|
|
|
|
$reportDatas[$x]["count_change1"] = $sumDiff->where('shift_id', 1)->groupBy('product_id')->count();
|
|
$reportDatas[$x]["count_change2"] = $sumDiff2->where('shift_id', 2)->groupBy('product_id')->count();
|
|
|
|
}
|
|
|
|
$this["reportDatas"] = $reportDatas;
|
|
|
|
//dd($reportDatas);
|
|
|
|
if($year){
|
|
|
|
|
|
|
|
}else{
|
|
$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="/production/daily-seperate/1" class="{{ month == 1 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Ýanwar</a>
|
|
<a href="/production/daily-seperate/2" class="{{ month == 2 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Fewral</a>
|
|
<a href="/production/daily-seperate/3" class="{{ month == 3 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Mart</a>
|
|
<a href="/production/daily-seperate/4" class="{{ month == 4 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Aprel</a>
|
|
<a href="/production/daily-seperate/5" class="{{ month == 5 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Maý</a>
|
|
<a href="/production/daily-seperate/6" class="{{ month == 6 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Iýun</a>
|
|
<a href="/production/daily-seperate/7" class="{{ month == 7 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Iýul</a>
|
|
<a href="/production/daily-seperate/8" class="{{ month == 8 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Awgust</a>
|
|
<a href="/production/daily-seperate/9" class="{{ month == 9 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Sentýabr</a>
|
|
<a href="/production/daily-seperate/10" class="{{ month == 10 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Oktýabr</a>
|
|
<a href="/production/daily-seperate/11" class="{{ month == 11 ? 'active' : '' }}"><i
|
|
class="mdi mdi-archive me-2 font-size-16"></i> Noýabr</a>
|
|
<a href="/production/daily-seperate/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='13'>
|
|
<thead>
|
|
<tr>
|
|
<th style="width: 5%;">№</th>
|
|
<th>Senesi</th>
|
|
<th>Ekstrudor</th>
|
|
<th>Smen</th>
|
|
<th>Mukdary (kg)</th>
|
|
<th>HARYTLAR (kg)</th>
|
|
<th>Jemi</th>
|
|
<th>Üýtgedilen</th>
|
|
<!-- <th>Настройки</th> -->
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% set all_calculate = 0 %}
|
|
{% set all_changed = 0 %}
|
|
|
|
{% for key, report in reportDatas %}
|
|
|
|
{% set all_calculate = (all_calculate + report.all_shift_calc) %}
|
|
{% set all_changed = (all_changed + (report.count_change1 + report.count_change2)) %}
|
|
|
|
<tr>
|
|
<td style="font-weight: bold;">{{key + 1}}</td>
|
|
<td><a href="#" style="font-weight: bold;">{{report.date|date('d.m.Y')}}</a></td>
|
|
<td>
|
|
<div class="row">
|
|
<div class="col-12" style="padding-bottom: 10px;">
|
|
<font style="font-weight: {{report.extrudor == 'Lorex' ? 'bold' : 'regular'}};">
|
|
{{report.extrudor}}
|
|
</font>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<div class="row">
|
|
<div class="col-12" style="padding-bottom: 10px;">
|
|
Gündiz (1)
|
|
</div>
|
|
<div class="col-12" style="border-top: 1px solid gray;padding-top: 10px;">
|
|
Gije (2)
|
|
</div>
|
|
</div>
|
|
</td>
|
|
|
|
<td style="color: darkgreen;">
|
|
<div class="row">
|
|
<div class="col-12" style="padding-bottom: 10px;">
|
|
{{report.shift1|number_format}}
|
|
</div>
|
|
<div class="col-12" style="border-top: 1px solid gray;padding-top: 10px;">
|
|
{{report.shift2|number_format}}
|
|
</div>
|
|
</div>
|
|
</td>
|
|
|
|
<td style="color: darkred;">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="row">
|
|
{% for product_report1 in report.products_shift1 %}
|
|
<div class="col" style="padding-bottom: 10px;">
|
|
<font style="font-weight: bold;">
|
|
{{product_report1.product_code}}:</font>
|
|
{{product_report1.product_value|number_format}}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
<div class="col-12" style="border-top: 1px solid gray;">
|
|
<div class="row">
|
|
{% for product_report2 in report.products_shift2 %}
|
|
<div class="col" style="padding-bottom: 10px;">
|
|
<font style="font-weight: bold;">
|
|
{{product_report2.product_code}}:</font>
|
|
{{product_report2.product_value|number_format}}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td style="color: darkgreen;">
|
|
<div class="row">
|
|
<div class="col-12" style="padding-bottom: 10px;">
|
|
{{report.all_shift_calc|number_format}}
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td style="color: darkred;">
|
|
<div class="row">
|
|
<div class="col-12" style="padding-bottom: 10px;">
|
|
{{report.count_change1}}
|
|
</div>
|
|
<div class="col-12" style="border-top: 1px solid gray;">
|
|
{{report.count_change2}}
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
|
|
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<th colspan="4">HEMMESI: </th>
|
|
<th>{{all_calculate|number_format}} kg</th>
|
|
<th>HARYTLAR</th>
|
|
<th>{{all_calculate|number_format}} kg</th>
|
|
<th>{{all_changed}}</th>
|
|
<!-- <th>Настройки</th> -->
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div> <!-- card -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<!-- End row -->
|
|
</div>
|
|
|
|
|
|
{% partial 'dataTableJs' %}
|