g_sto/themes/gokbakja/pages/production/all-production-month.htm

181 lines
8.4 KiB
HTML

title = "All production by month"
url = "/all-production-month/:month/:year?"
layout = "platform_main"
is_hidden = 0
==
<?php
function onStart() {
$currentDate = Carbon\Carbon::now();
$this["month"] = $this->param("month");
$year = $this->param("year");
$this["reportProducts"] = Romanah\Gokbakja\Models\Product::where("report", "simple")->orderBy('order', 'ASC')->get();
if($this["month"] == 'default'){
$this["month"] = $currentDate->month;
}
if($year){
$this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->whereYear('created_at', $year)->with(['pivot_production'])->get();
$this["month_all_amount_calcq"] = Romanah\Gokbakja\Models\ProductionCalculate::whereMonth('date', $this["month"])->whereYear('date', $year)->sum("amount_calc");
}else{
$this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->whereYear('created_at', $currentDate->year)->with(['pivot_production'])->get();
$this["month_all_amount_calcq"] = Romanah\Gokbakja\Models\ProductionCalculate::whereMonth('date', $this["month"])->whereYear('date', $currentDate->year)->sum("amount_calc");
}
}
?>
==
{% 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">
<a href="/excruiters" type="button" class="btn btn-danger waves-effect waves-light">
Täze Hasabat
</a>
<div class="mail-list mt-4">
<a href="/all-production-month/1" class="{{ month == 1 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Ýanwar</a>
<a href="/all-production-month/2" class="{{ month == 2 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Fewral</a>
<a href="/all-production-month/3" class="{{ month == 3 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Mart</a>
<a href="/all-production-month/4" class="{{ month == 4 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Aprel</a>
<a href="/all-production-month/5" class="{{ month == 5 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Maý</a>
<a href="/all-production-month/6" class="{{ month == 6 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Iýun</a>
<a href="/all-production-month/7" class="{{ month == 7 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Iýul</a>
<a href="/all-production-month/8" class="{{ month == 8 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Awgust</a>
<a href="/all-production-month/9" class="{{ month == 9 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Sentýabr</a>
<a href="/all-production-month/10" class="{{ month == 10 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Oktýabr</a>
<a href="/all-production-month/11" class="{{ month == 11 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Noýabr</a>
<a href="/all-production-month/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>Senesi</th>
<th>Hemmesi</th>
{% for key, record in reportProducts %}
<th>{{record.code}}</th>
{% endfor %}
<th>Bellik</th>
<!-- <th>Настройки</th> -->
</tr>
</thead>
<tbody>
{% for key, report in productions %}
<tr>
<td style="font-weight: bold;width: 5%;">{{key + 1}}</td>
<td><a href="/get-production/{{report.id}}"
style="font-weight: bold;color: #0005c5;">{{report.created_at|date('d.m.Y |
H:i')}}</a></td>
<td style="text-align: center;">
<span class="badge badge-soft-success"
style="font-size: 14px;">{{report.all_amount|number_format}} kg</span>
</td>
{% for product in report.pivot_production %}
<td>{{product.amount_percentage}} %</td>
{% endfor %}
<td style="font-weight: bold;color: #0005c5;">{{report.note}}</td>
</tr>
{% endfor %}
<tr>
<td style="font-weight: bold;width: 5%;">#</td>
<td style="font-weight: bold;width: 5%;">ORTAÇA JEMI</td>
<td style="text-align: center;">
<span class="badge badge-soft-info"
style="font-size: 14px;">{{month_all_amount_calcq|number_format}} kg</span>
</td>
{% for key, product in reportProducts %}
{% partial 'report/product-month-row' prodId=product.id all_amount=month_all_amount_calc.amount_subtraction %}
{% endfor %}
<td style="font-weight: bold;color: #0005c5;"></td>
</tr>
</tbody>
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Senesi</th>
<th>Hemmesi</th>
{% for key, record in reportProducts %}
<th>{{record.code}}</th>
{% endfor %}
<th>Bellik</th>
</tr>
</tfoot>
</table>
</div>
</div> <!-- card -->
</div>
</div>
</div>
<!-- End row -->
</div>
{% partial 'dataTableJs' %}