This commit is contained in:
Shohrat 2023-12-17 17:43:47 +05:00
parent 6a8ffac9f6
commit aa1019314c
2 changed files with 55 additions and 30 deletions

View File

@ -21,6 +21,13 @@ class SewerProduction extends Model
] ]
]; ];
public $hasOne = [
'pivot_sewer_lst' => [
'Romanah\Gokbakja\Models\PivotSewer',
'key' => 'sewer_production_id',
]
];
public $belongsTo = [ public $belongsTo = [
'employee' => [ 'employee' => [
'Romanah\Gokbakja\Models\Employee', 'Romanah\Gokbakja\Models\Employee',

View File

@ -7,13 +7,16 @@ is_hidden = 0
function onStart(){ function onStart(){
$filter = $this->param('filter'); $filter = $this->param('filter');
$this["rulons"] = Romanah\Gokbakja\Models\ProductionMachine::with(['bag_type', 'machine.building', 'employee', 'mechanic', 'color', 'shift']) $this["rulons"] = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
->with(['rulonAction' => function($q){ ->with(['product.rulon_action.product.bag_type', 'product.rulon_action.product.color', 'product.pivot_sewer', 'product.pivot_sewer_lst'])
$q->with(['sewer_productions' => function ($subQuery) { ->whereHas('product', function($q){
$subQuery->select('width','height','rulon_action_id', DB::raw('SUM(produced_bag_qty) as produced_bag_qty')); $q->where('is_sewed', 1);
}]); })
}])->orderBy('date', 'DESC')->get(); ->groupBy('romanah_gokbakja_bag_actions.product_id')
->orderBy('id', 'DESC')
->get();
//dd($this["rulons"]);
} }
?> ?>
== ==
@ -100,9 +103,9 @@ function onStart(){
<thead> <thead>
<tr> <tr>
<th colspan="6" style="background: #ccd9e3;">Gelen Rulon</th> <th colspan="7" style="background: #ccd9e3;">Gelen Rulon</th>
<th colspan="3" style="background: #c7e4fd;">Öndürlen Halta</th> <th colspan="3" style="background: #c7e4fd;">Öndürlen Halta</th>
<th colspan="3" style="background: bisque;">Halta</th> <th colspan="3" style="background: bisque;">Halta Sany</th>
<th colspan="2" style="background: #ffbbbb;">Jemi Öndürlen Halta</th> <th colspan="2" style="background: #ffbbbb;">Jemi Öndürlen Halta</th>
<th>Turba agramy</th> <th>Turba agramy</th>
<th>Rulon Galyndysy</th> <th>Rulon Galyndysy</th>
@ -137,31 +140,44 @@ function onStart(){
</thead> </thead>
<tbody> <tbody>
{% for key, rulon in rulons %} {% for key, report in rulons %}
{% set sumOfBags = (report.amount + report.product.defective_bag_qty + report.product.defective_repair_qty) %}
{% set gramInkg = (report.product.bag_gram / 1000) %}
{% set allInKg = (sumOfBags * gramInkg) %}
{% set percentDefective = ((report.product.defective_bag_qty * 100) / report.amount) %}
<tr> <tr>
<td>{{key+1}}</td> <td style="font-weight: bold;">{{key+1}}</td>
<td>{{rulon.date|date('d.m.Y')}}</td> <td><a href="#" style="font-weight: bold;">{{report.product.rulon_action.created_at|date('d.m.Y')}}</a></td>
<td>{{rulon.machine.name}}</td> <td>{{report.product.rulon_action.product.machine.name}}</td>
<td>{{rulon.color.name}}</td> <td>{{report.product.rulon_action.product.color.name}}</td>
<td>{{rulon.width}}</td> <td>{{report.product.rulon_action.product.width}}</td>
<td>{{rulon.gram}}</td> <td>{{report.product.rulon_action.product.gram}}</td>
<td>{{rulon.produced_weight}}</td> <td>{{report.product.rulon_action.product.produced_weight}}</td>
<td>{{rulon.rulonAction}}</td> <td>{{gramInkg}}</td>
<td>Ini</td> <td>{{report.product.width}}</td>
<td>Boýy</td> <td>{{report.product.height}}</td>
<td>Öndürlen Halta (arassa)</td> <td><span class="badge badge-soft-success"
<td>Öndürlen Halta (brak)</td> style="font-size: 14px;">{{report.amount}}</span></td>
<td>Sürülmedik</td> <td><span class="badge badge-soft-danger"
style="font-size: 14px;">{{report.product.defective_bag_qty}}</span></td>
<td><span class="badge badge-soft-warning"
style="font-size: 14px;">{{report.product.defective_repair_qty}}</span></td>
<td>Sany</td> <td><span class="badge badge-soft-primary"
<td>kg</td> style="font-size: 14px;">{{sumOfBags}}</span></td>
<td>{{allInKg}}</td>
<td>kg</td> <td>{{report.product.pipe_weight}}</td>
<td>kg</td> <td>{{report.product.pivot_sewer_lst.left_amount}}</td>
<td>Brak %</td>
<td style="color: darkred;">{{percentDefective|number_format(2)}} %</td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -169,12 +185,13 @@ function onStart(){
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<th>NO</th>
<th>Sene</th> <th>Sene</th>
<th>Stanok No</th> <th>Stanok No</th>
<th>Reňki</th> <th>Reňki</th>
<th>Ini</th> <th>Ini</th>
<th>Gram m2</th> <th>Gram m2</th>
<th>Rulanyň agramy</th> <th>Rulanyň agramy (kg)</th>
<th>Gramy</th> <th>Gramy</th>
<th>Ini</th> <th>Ini</th>
@ -187,8 +204,9 @@ function onStart(){
<th>Sany</th> <th>Sany</th>
<th>kg</th> <th>kg</th>
<th>kg</th> <th>Turba Agramy</th>
<th>kg</th> <th>Rulon Galyndysy</th>
<th>Brak %</th> <th>Brak %</th>
</tr> </tr>
</tfoot> </tfoot>