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 = [
'employee' => [
'Romanah\Gokbakja\Models\Employee',

View File

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