rulon bag report

This commit is contained in:
Shohrat 2023-12-16 02:52:51 +05:00
parent f94fd8c110
commit 6a8ffac9f6
14 changed files with 551 additions and 87 deletions

View File

@ -200,9 +200,9 @@ class Sewer extends ComponentBase
if ($sewer->is_sewed == 1) { if ($sewer->is_sewed == 1) {
// $spentCalc = (float)((float) $pivotSewer->amount - (float) $data["left_amount"]); // $spentCalc = (float)((float) $pivotSewer->amount - (float) $data["left_amount"]);
$spentCalc = (float)((float) $data["produced_bag_qty"] * (float) $pivotSewer->bag_gram) / 1000; $spentCalc = (float)((float) $data["produced_bag_qty"] * (float) $sewer->bag_gram) / 1000;
$spentCalcDefective = (float)((float) $data["defective_bag_qty"] * (float) $pivotSewer->bag_gram) / 1000; $spentCalcDefective = (float)((float) $data["defective_bag_qty"] * (float) $sewer->bag_gram) / 1000;
$spentCalcDefectiveRepair = (float)((float) $data["defective_repair_qty"] * (float) $pivotSewer->bag_gram) / 1000; $spentCalcDefectiveRepair = (float)((float) $data["defective_repair_qty"] * (float) $sewer->bag_gram) / 1000;
$spentCalcDefectiveAll = (float)($spentCalcDefective + $spentCalcDefectiveRepair); $spentCalcDefectiveAll = (float)($spentCalcDefective + $spentCalcDefectiveRepair);
@ -210,6 +210,8 @@ class Sewer extends ComponentBase
$leftCalc = (float)((float)$pivotSewer->amount - $spentCalc); $leftCalc = (float)((float)$pivotSewer->amount - $spentCalc);
$leftq = (float) ((float)$leftCalc - (float)$spentCalcDefectiveAll);
$sewer->shift_id = $data["shift_id"]; $sewer->shift_id = $data["shift_id"];
$sewer->sewer_machine_id = $data["sewer_machine_id"]; $sewer->sewer_machine_id = $data["sewer_machine_id"];
@ -230,19 +232,20 @@ class Sewer extends ComponentBase
$pivotSewer->status = $data["status"]; $pivotSewer->status = $data["status"];
$pivotSewer->save(); $pivotSewer->save();
$currentRulonAction = RulonAction::where("id", $pivotSewer->rulon_action_id)->first(); $currentRulonAction = RulonAction::where("id", $pivotSewer->rulon_action_id)->first();
if($leftq > 0){
$createResult = new RulonAction(); $createResult = new RulonAction();
$createResult->product_id = $currentRulonAction->product_id; $createResult->product_id = $currentRulonAction->product_id;
$createResult->type = 'inbox'; $createResult->type = 'inbox';
$createResult->status_accountant = "new"; $createResult->status_accountant = "new";
$createResult->status_director = "new"; $createResult->status_director = "new";
$createResult->note = "#Dikiş" . $sewer->id . " galyndy"; $createResult->note = "#Dikiş" . $sewer->id . " galyndy";
$createResult->amount = (float) $pivotSewer->left_amount; $createResult->amount = (float) $pivotSewer->left_amount;
$createResult->stock_id = $stock->id; $createResult->stock_id = $stock->id;
$createResult->user_id = $user->id; $createResult->user_id = $user->id;
$createResult->save(); $createResult->save();
}
$createResultBag = new BagAction(); $createResultBag = new BagAction();
@ -258,7 +261,7 @@ class Sewer extends ComponentBase
if ($sewer && $pivotSewer && $createResult && $createResultBag) { if ($sewer && $pivotSewer && $createResultBag) {
Flash::success("Maglumatlar Ustunlikli Üýtgedildi"); Flash::success("Maglumatlar Ustunlikli Üýtgedildi");
return Redirect::refresh(); return Redirect::refresh();
} else { } else {
@ -334,7 +337,7 @@ class Sewer extends ComponentBase
$crudSewerProductionq = $this->page["crudSewerProduction"]; $crudSewerProductionq = $this->page["crudSewerProduction"];
$sewerDatas = SewerModel::with(["employee", "shift", "sewer_machine"])->with(["pivot_sewer" => function ($q) { $sewerDatas = SewerModel::with(["employee", "shift", "sewer_machine", "color"])->with(["pivot_sewer" => function ($q) {
$q->with(["rulon_action.product.bag_type", "rulon_action.product.bag_size", "rulon_action.product.color"]); $q->with(["rulon_action.product.bag_type", "rulon_action.product.bag_size", "rulon_action.product.color"]);
}])->orderBy('id', 'DESC')->get(); }])->orderBy('id', 'DESC')->get();
@ -356,9 +359,9 @@ class Sewer extends ComponentBase
$rulonDynamic = ''; $rulonDynamic = '';
if ($sewerDatas[$x]->is_sewed == 1) { if ($sewerDatas[$x]->is_sewed == 1) {
$rulonDynamic = '#Rulon' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product_id ?? 0) . '- ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->bag_size->width ?? "") . 'x' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->bag_size->height ?? "") . 'm2, ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->bag_type->name ?? "") . ', ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->color->name ?? ""); $rulonDynamic = '#Rulon' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product_id ?? 0) . '- ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->width ?? "") . ' x ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->gram ?? "") . ' m2, ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->bag_type->name ?? "") . ', ' . ($sewerDatas[$x]->color->name ?? "");
} else { } else {
$rulonDynamic = 'Sürülmedik täzeden sürüldi'; $rulonDynamic = 'Sürülmedik sürüldi, reňki: '.($sewerDatas[$x]->color->name ?? "");
} }
if ($sewerDatas[$x]->user_id != $user->id) { if ($sewerDatas[$x]->user_id != $user->id) {
@ -413,7 +416,7 @@ class Sewer extends ComponentBase
<td><a href="#" style="font-weight: bold;">' . ($sewerDatas[$x]->sewer_machine->name ?? "") . '</a></td> <td><a href="#" style="font-weight: bold;">' . ($sewerDatas[$x]->sewer_machine->name ?? "") . '</a></td>
<td>' . (number_format($sewerDatas[$x]->pivot_sewer[0]->bag_gram ?? 0, 2)) . ' gr</td> <td>' . (number_format($sewerDatas[$x]->bag_gram ?? 0, 2)) . ' gr</td>
<td style="color: darkgreen !important;">' . ($sewerDatas[$x]->produced_bag_qty ?? 0) . '</td> <td style="color: darkgreen !important;">' . ($sewerDatas[$x]->produced_bag_qty ?? 0) . '</td>
<td style="color: darkred !important;">' . ($sewerDatas[$x]->defective_bag_qty ?? 0) . '</td> <td style="color: darkred !important;">' . ($sewerDatas[$x]->defective_bag_qty ?? 0) . '</td>
@ -486,15 +489,11 @@ class Sewer extends ComponentBase
} }
if ($bag_gram) { if ($bag_gram) {
$sewerProductions->with("pivot_sewer")->whereHas('pivot_sewer', function ($query) use ($bag_gram) { $sewerProductions->where("bag_gram", $bag_gram);
$query->where('bag_gram', $bag_gram);
});
} }
if ($color_id) { if ($color_id) {
$sewerProductions->with("rulon_action.product")->whereHas('rulon_action.product', function ($query) use ($color_id) { $sewerProductions->where('color_id', $color_id);
$query->where('color_id', $color_id);
});
} }
@ -525,6 +524,14 @@ class Sewer extends ComponentBase
$statusTitle = "Tamamlandy"; $statusTitle = "Tamamlandy";
} }
$rulonDynamic = '';
if ($sewerDatas[$x]->is_sewed == 1) {
$rulonDynamic = '#Rulon' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product_id ?? 0) . '- ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->width ?? "") . ' x ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->gram ?? "") . ' m2, ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->bag_type->name ?? "") . ', ' . ($sewerDatas[$x]->color->name ?? "");
} else {
$rulonDynamic = 'Sürülmedik sürüldi, reňki: '.($sewerDatas[$x]->color->name ?? "");
}
$dateTitle = ($sewerDatas[$x]->date == null ? "" : Carbon::parse($sewerDatas[$x]->date)->format('d.m.Y')); $dateTitle = ($sewerDatas[$x]->date == null ? "" : Carbon::parse($sewerDatas[$x]->date)->format('d.m.Y'));
@ -532,7 +539,7 @@ class Sewer extends ComponentBase
<td style="font-weight: bold;">' . ($x + 1) . '</td> <td style="font-weight: bold;">' . ($x + 1) . '</td>
<td>' . $dateTitle . '</td> <td>' . $dateTitle . '</td>
<td style="font-weight: bold;"> #Dikiş' . $sewerDatas[$x]->id . '</td> <td style="font-weight: bold;"> #Dikiş' . $sewerDatas[$x]->id . '</td>
<td> #Rulon' . $sewerDatas[$x]->pivot_sewer[0]->rulon_action->product_id . '- ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->bag_size->width ?? "") . 'x' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->bag_size->height ?? "") . 'm2, ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->bag_type->name ?? "") . ', ' . ($sewerDatas[$x]->pivot_sewer[0]->rulon_action->product->color->name ?? "") . ' <td>'.$rulonDynamic.'
</td> </td>
<td><span class="badge badge-soft-success" <td><span class="badge badge-soft-success"
style="font-size: 14px;">' . number_format($sewerDatas[$x]->pivot_sewer[0]->amount, 2) . ' kg</span> style="font-size: 14px;">' . number_format($sewerDatas[$x]->pivot_sewer[0]->amount, 2) . ' kg</span>
@ -545,7 +552,7 @@ class Sewer extends ComponentBase
<td><a href="#" style="font-weight: bold;">' . ($sewerDatas[$x]->sewer_machine->name ?? "") . '</a></td> <td><a href="#" style="font-weight: bold;">' . ($sewerDatas[$x]->sewer_machine->name ?? "") . '</a></td>
<td>' . (number_format($sewerDatas[$x]->pivot_sewer[0]->bag_gram ?? 0, 2)) . ' gr</td> <td>' . (number_format($sewerDatas[$x]->bag_gram ?? 0, 2)) . ' gr</td>
<td style="color: darkgreen !important;">' . ($sewerDatas[$x]->produced_bag_qty ?? 0) . '</td> <td style="color: darkgreen !important;">' . ($sewerDatas[$x]->produced_bag_qty ?? 0) . '</td>
<td style="color: darkred !important;">' . ($sewerDatas[$x]->defective_bag_qty ?? 0) . '</td> <td style="color: darkred !important;">' . ($sewerDatas[$x]->defective_bag_qty ?? 0) . '</td>
@ -624,6 +631,8 @@ class Sewer extends ComponentBase
$createSewer->width = (float) $data["width"]; $createSewer->width = (float) $data["width"];
$createSewer->height = (float) $data["height"]; $createSewer->height = (float) $data["height"];
$createSewer->is_sewed = $data["is_sewed"]; $createSewer->is_sewed = $data["is_sewed"];
$createSewer->bag_gram = (float) $data["bag_gram"];
$createSewer->color_id = $data["color_id"];
$createSewer->date = Carbon::parse($data["date"])->format('Y-m-d'); $createSewer->date = Carbon::parse($data["date"])->format('Y-m-d');
$createSewer->save(); $createSewer->save();
@ -631,7 +640,6 @@ class Sewer extends ComponentBase
$createPivotSewer->rulon_action_id = $createSewer->rulon_action_id; $createPivotSewer->rulon_action_id = $createSewer->rulon_action_id;
$createPivotSewer->sewer_production_id = $createSewer->id; $createPivotSewer->sewer_production_id = $createSewer->id;
$createPivotSewer->left_amount = 0; $createPivotSewer->left_amount = 0;
$createPivotSewer->bag_gram = (float) $data["bag_gram"];
$createPivotSewer->amount = $rulonAmountSum ?? 0; $createPivotSewer->amount = $rulonAmountSum ?? 0;
$createPivotSewer->save(); $createPivotSewer->save();
@ -665,7 +673,7 @@ class Sewer extends ComponentBase
if ($sewer) { if ($sewer) {
if ($sewer->produced_bag_qty > 0) { if ($sewer->produced_bag_qty > 0 && $sewer->is_sewed == 1) {
$stock = Stock::where("type", 'rulon')->first(); $stock = Stock::where("type", 'rulon')->first();
$createResult = new RulonAction(); $createResult = new RulonAction();
@ -701,6 +709,21 @@ class Sewer extends ComponentBase
$createResult->user_id = $user->id; $createResult->user_id = $user->id;
$createResult->note = "#Dikiş" . $sewer->id . " maglumat girizidi, soňundan pozulan"; $createResult->note = "#Dikiş" . $sewer->id . " maglumat girizidi, soňundan pozulan";
$createResult->save(); $createResult->save();
}elseif ($sewer->is_sewed == 0 && $sewer->produced_bag_qty > 0) {
$stockBag = Stock::where("type", 'bag')->first();
$createResultBag = new BagAction();
$createResultBag->product_id = $sewer->id;
$createResultBag->type = 'outbox';
$createResultBag->status_accountant = "new";
$createResultBag->status_director = "new";
$createResultBag->note = "#Dikiş" . $sewer->id . " sürülmedik, soňundan pozulan";
$createResultBag->amount = -$sewer->produced_bag_qty;
$createResultBag->stock_id = $stockBag->id;
$createResultBag->user_id = $user->id;
$createResultBag->save();
} }
} }

View File

@ -16,7 +16,7 @@ class ProductionMachine extends Model
public $hasMany = [ public $hasMany = [
'sewer_productions' => [ 'sewer_productions' => [
'Romanah\Gokbakja\Models\SewerProduction', 'Romanah\Gokbakja\Models\SewerProduction',
'key' => 'machine_production_id', 'key' => 'rulon_action_id',
'softDelete' => true 'softDelete' => true
], ],
'pivot_sewer' => [ 'pivot_sewer' => [
@ -24,6 +24,14 @@ class ProductionMachine extends Model
'key' => 'rulon_action_id', 'key' => 'rulon_action_id',
'softDelete' => true 'softDelete' => true
], ],
];
public $hasOne = [
'rulonAction' => [
'Romanah\Gokbakja\Models\RulonAction',
'key' => 'product_id',
],
]; ];
public $belongsTo = [ public $belongsTo = [

View File

@ -13,6 +13,13 @@ class RulonAction extends Model
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];
public $hasMany = [
'sewer_productions' => [
'Romanah\Gokbakja\Models\SewerProduction',
'key' => 'rulon_action_id'
]
];
public $belongsTo = [ public $belongsTo = [
'product' => [ 'product' => [
'Romanah\Gokbakja\Models\ProductionMachine', 'Romanah\Gokbakja\Models\ProductionMachine',

View File

@ -38,6 +38,10 @@ class SewerProduction extends Model
'Romanah\Gokbakja\Models\SewerMachine', 'Romanah\Gokbakja\Models\SewerMachine',
'key' => 'sewer_machine_id' 'key' => 'sewer_machine_id'
], ],
'color' => [
'Romanah\Gokbakja\Models\BagColor',
'key' => 'color_id'
],
]; ];
/** /**

View File

@ -0,0 +1,23 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaPivotSewer10 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_pivot_sewer', function($table)
{
$table->dropColumn('bag_gram');
});
}
public function down()
{
Schema::table('romanah_gokbakja_pivot_sewer', function($table)
{
$table->double('bag_gram', 10, 0)->nullable();
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaSewerProduction16 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_sewer_production', function($table)
{
$table->double('bag_gram', 10, 0)->nullable();
});
}
public function down()
{
Schema::table('romanah_gokbakja_sewer_production', function($table)
{
$table->dropColumn('bag_gram');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaSewerProduction17 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_sewer_production', function($table)
{
$table->integer('color_id');
});
}
public function down()
{
Schema::table('romanah_gokbakja_sewer_production', function($table)
{
$table->dropColumn('color_id');
});
}
}

View File

@ -456,3 +456,12 @@
1.0.153: 1.0.153:
- 'Updated table romanah_gokbakja_drobika' - 'Updated table romanah_gokbakja_drobika'
- builder_table_update_romanah_gokbakja_drobika_3.php - builder_table_update_romanah_gokbakja_drobika_3.php
1.0.154:
- 'Updated table romanah_gokbakja_pivot_sewer'
- builder_table_update_romanah_gokbakja_pivot_sewer_10.php
1.0.155:
- 'Updated table romanah_gokbakja_sewer_production'
- builder_table_update_romanah_gokbakja_sewer_production_16.php
1.0.156:
- 'Updated table romanah_gokbakja_sewer_production'
- builder_table_update_romanah_gokbakja_sewer_production_17.php

View File

@ -78,15 +78,6 @@ items:
isHidden: '0' isHidden: '0'
cssClass: '' cssClass: ''
isExternal: '0' isExternal: '0'
-
title: 'Halta Hasabaty'
type: cms-page
code: bagActions
reference: actions/bag-report
viewBag:
isHidden: '0'
cssClass: ''
isExternal: '0'
- -
title: 'Rulon Sklad Hereketleri' title: 'Rulon Sklad Hereketleri'
nesting: null nesting: null
@ -351,6 +342,15 @@ items:
isHidden: '0' isHidden: '0'
cssClass: '' cssClass: ''
isExternal: '0' isExternal: '0'
-
title: 'Rulon Halta Hasabaty'
type: cms-page
code: productionRulon
reference: machine/rulon-bags
viewBag:
isHidden: '0'
cssClass: ''
isExternal: '0'
- -
title: Tikinçiler title: Tikinçiler
nesting: null nesting: null
@ -404,6 +404,15 @@ items:
isHidden: '0' isHidden: '0'
cssClass: '' cssClass: ''
isExternal: '0' isExternal: '0'
-
title: 'Görnüş Hasabaty'
type: cms-page
code: sewerProduction
reference: actions/bag-report
viewBag:
isHidden: '0'
cssClass: ''
isExternal: '0'
- -
title: Sargytlar title: Sargytlar
nesting: null nesting: null

View File

@ -18,53 +18,127 @@ function onStart() {
$reportDatas = []; $reportDatas = [];
//dd($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){ if($year){
$bagProds = Romanah\Gokbakja\Models\SewerProduction::select('width', 'height', 'bag_gram', 'color_id')
->with('color')
->whereMonth('date', $this["month"])
->whereYear('date', $year)
->groupBy('width')
->groupBy('height')
->groupBy('bag_gram')
->groupBy('color_id')
->orderBy('width', 'ASC')
->distinct()
->get();
for ($x = 0; $x < count($bagProds); $x++) {
$action = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
->with('product')
->whereHas('product', function($qq) use($bagProds, $x, $year){
$qq->whereMonth('date', $this["month"])->whereYear('date', $year)->where('width', $bagProds[$x]->width)->where('height', $bagProds[$x]->height)->where('bag_gram', $bagProds[$x]->bag_gram)->where('color_id', $bagProds[$x]->color_id);
})
->sum('amount');
$actionNow = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
->with('product')
->whereHas('product', function($qq) use($bagProds, $x, $year){
$qq->where('width', $bagProds[$x]->width)->where('height', $bagProds[$x]->height)->where('bag_gram', $bagProds[$x]->bag_gram)->where('color_id', $bagProds[$x]->color_id);
})
->sum('amount');
$actionBraks = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
->with('product.color')
->whereHas('product', function($qq) use($bagProds, $x, $year){
$qq->whereMonth('date', $this["month"])->whereYear('date', $year)->where('width', $bagProds[$x]->width)->where('height', $bagProds[$x]->height)->where('bag_gram', $bagProds[$x]->bag_gram)->where('color_id', $bagProds[$x]->color_id);
})
->get();
$calculateBrak = 0;
$calculateBrakRepair = 0;
for ($xx = 0; $xx < count($actionBraks); $xx++) {
$calculateBrak += $actionBraks[$xx]->product->defective_bag_qty;
$calculateBrakRepair += $actionBraks[$xx]->product->defective_repair_qty;
}
$reportDatas[$x]["width"] = $bagProds[$x]->width;
$reportDatas[$x]["height"] = $bagProds[$x]->height;
$reportDatas[$x]["color"] = $bagProds[$x]->color->name;
$reportDatas[$x]["bag_gram"] = $bagProds[$x]->bag_gram ?? 0;
$reportDatas[$x]["amount"] = $action;
$reportDatas[$x]["defective"] = $calculateBrak;
$reportDatas[$x]["defectiveRepair"] = $calculateBrakRepair;
$reportDatas[$x]["all"] = $action + $calculateBrakRepair + $calculateBrakRepair;
$reportDatas[$x]["amountNow"] = $actionNow;
}
}else{ }else{
$bagProds = Romanah\Gokbakja\Models\SewerProduction::select('width', 'height', 'bag_gram', 'color_id')
->with('color')
->whereMonth('date', $this["month"])
->whereYear('date', $currentDate->year)
->groupBy('width')
->groupBy('height')
->groupBy('bag_gram')
->groupBy('color_id')
->orderBy('width', 'ASC')
->distinct()
->get();
for ($x = 0; $x < count($bagProds); $x++) {
$action = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
->with('product')
->whereHas('product', function($qq) use($bagProds, $x, $currentDate){
$qq->whereMonth('date', $this["month"])->whereYear('date', $currentDate->year)->where('width', $bagProds[$x]->width)->where('height', $bagProds[$x]->height)->where('bag_gram', $bagProds[$x]->bag_gram)->where('color_id', $bagProds[$x]->color_id);
})
->sum('amount');
$actionNow = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
->with('product')
->whereHas('product', function($qq) use($bagProds, $x, $currentDate){
$qq->where('width', $bagProds[$x]->width)->where('height', $bagProds[$x]->height)->where('bag_gram', $bagProds[$x]->bag_gram)->where('color_id', $bagProds[$x]->color_id);
})
->sum('amount');
$actionBraks = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
->with('product')
->whereHas('product', function($qq) use($bagProds, $x, $currentDate){
$qq->whereMonth('date', $this["month"])->whereYear('date', $currentDate->year)->where('width', $bagProds[$x]->width)->where('height', $bagProds[$x]->height)->where('bag_gram', $bagProds[$x]->bag_gram)->where('color_id', $bagProds[$x]->color_id);
})
->get();
$calculateBrak = 0;
$calculateBrakRepair = 0;
for ($xx = 0; $xx < count($actionBraks); $xx++) {
$calculateBrak += $actionBraks[$xx]->product->defective_bag_qty;
$calculateBrakRepair += $actionBraks[$xx]->product->defective_repair_qty;
}
$reportDatas[$x]["width"] = $bagProds[$x]->width;
$reportDatas[$x]["height"] = $bagProds[$x]->height;
$reportDatas[$x]["color"] = $bagProds[$x]->color->name;
$reportDatas[$x]["bag_gram"] = $bagProds[$x]->bag_gram ?? 0;
$reportDatas[$x]["amount"] = $action;
$reportDatas[$x]["defective"] = $calculateBrak;
$reportDatas[$x]["defectiveRepair"] = $calculateBrakRepair;
$reportDatas[$x]["all"] = ($action + $calculateBrakRepair + $calculateBrak);
$reportDatas[$x]["amountNow"] = $actionNow;
}
} }
// dd($reportDatas);
$this["reportDatas"] = $reportDatas;
} }
?> ?>
== ==
@ -150,15 +224,33 @@ function onStart() {
<th>Öndürilen Haltasy (brak)</th> <th>Öndürilen Haltasy (brak)</th>
<th>Sürülmedik haltalar</th> <th>Sürülmedik haltalar</th>
<th>Jemi öndüren haltasy</th> <th>Jemi öndüren haltasy</th>
<th>Şuwagtky Ýagdaýy</th>
<!-- <th>Настройки</th> --> <!-- <th>Настройки</th> -->
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for key, report in reportDatas %}
<tr>
<td style="font-weight: bold;">{{key + 1}}</td>
<td><a href="#" style="font-weight: bold;">{{report.bag_gram}}</a></td>
<td>{{report.width}}</td>
<td>{{report.height}}</td>
<td>{{report.color}}</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.defective}}</span></td>
<td><span class="badge badge-soft-warning"
style="font-size: 14px;">{{report.defectiveRepair}}</span></td>
<td><span class="badge badge-soft-primary"
style="font-size: 14px;">{{report.all}}</span></td>
<td><span class="badge badge-soft-info"
style="font-size: 14px;">{{report.amountNow}}</span></td>
</tr>
{% endfor %}
</tbody> </tbody>
<tfoot> <tfoot>
@ -172,6 +264,7 @@ function onStart() {
<th>Öndürilen Haltasy (brak)</th> <th>Öndürilen Haltasy (brak)</th>
<th>Sürülmedik haltalar</th> <th>Sürülmedik haltalar</th>
<th>Jemi öndüren haltasy</th> <th>Jemi öndüren haltasy</th>
<th>Şuwagtky Ýagdaýy</th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View File

@ -77,7 +77,7 @@ function onStart() {
$rulonProds = Romanah\Gokbakja\Models\ProductionMachine::select('gram', 'width') $rulonProds = Romanah\Gokbakja\Models\ProductionMachine::select('gram', 'width')
->whereMonth('created_at', $this["month"]) ->whereMonth('created_at', $this["month"])
->whereYear('date', $currentDate->year) ->whereYear('created_at', $currentDate->year)
->groupBy('gram')->groupBy('width') ->groupBy('gram')->groupBy('width')
->orderBy('width', 'ASC') ->orderBy('width', 'ASC')
->distinct() ->distinct()

View File

@ -0,0 +1,221 @@
title = "machine/rulon-bags"
url = "/machine/rulon-bags/:filter"
layout = "platform_main"
is_hidden = 0
==
<?php
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();
}
?>
==
{% set records = builderList.records %}
{% set displayColumn = builderList.displayColumn %}
{% set noRecordsMessage = builderList.noRecordsMessage %}
{% set detailsPage = builderList.detailsPage %}
{% set detailsKeyColumn = builderList.detailsKeyColumn %}
{% set detailsUrlParameter = builderList.detailsUrlParameter %}
{% set machines = builderList2.records %}
{% set types = builderList4.records %}
{% set sizes = builderList3.records %}
{% 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" />
<link href="{{'assets/libs/select2/css/select2.min.css'|theme}}" rel="stylesheet" type="text/css">
{% endput %}
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<form action="/machine/rulon-bags/filter">
<div class="row">
<div class="col">
<div>
<label class="form-label">Seneleri Saýlaň</label>
<div class="input-daterange input-group" id="datepicker6"
data-date-format="d.m.yyyy" data-date-autoclose="true" data-provide="datepicker"
data-date-container='#datepicker6'>
<input type="text" class="form-control" name="start"
placeholder="Başlanýan sene" />
<input type="text" class="form-control" name="end"
placeholder="Gutarýan sene" />
</div>
</div>
</div>
<div class="col">
<button type="submit" class="btn btn-primary waves-effect waves-light"
style="margin-top: 30px;width: 100%;">Hasabat</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="row">
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<div class="row" id="all_amount">
<div class="col-md-6">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Rulon Halta</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
</div>
</div>
<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 colspan="6" 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="2" style="background: #ffbbbb;">Jemi Öndürlen Halta</th>
<th>Turba agramy</th>
<th>Rulon Galyndysy</th>
<th rowspan="2">Brak %</th>
</tr>
<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 (kg)</th>
<th>Gramy</th>
<th>Ini</th>
<th>Boýy</th>
<th>Öndürlen Halta (arassa)</th>
<th>Öndürlen Halta (brak)</th>
<th>Sürülmedik</th>
<th>Sany</th>
<th>kg</th>
<th>kg</th>
<th>kg</th>
<!-- <th>Настройки</th> -->
</tr>
</thead>
<tbody>
{% for key, rulon in rulons %}
<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>{{rulon.rulonAction}}</td>
<td>Ini</td>
<td>Boýy</td>
<td>Öndürlen Halta (arassa)</td>
<td>Öndürlen Halta (brak)</td>
<td>Sürülmedik</td>
<td>Sany</td>
<td>kg</td>
<td>kg</td>
<td>kg</td>
<td>Brak %</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Sene</th>
<th>Stanok No</th>
<th>Reňki</th>
<th>Ini</th>
<th>Gram m2</th>
<th>Rulanyň agramy</th>
<th>Gramy</th>
<th>Ini</th>
<th>Boýy</th>
<th>Öndürlen Halta (arassa)</th>
<th>Öndürlen Halta (brak)</th>
<th>Sürülmedik</th>
<th>Sany</th>
<th>kg</th>
<th>kg</th>
<th>kg</th>
<th>Brak %</th>
</tr>
</tfoot>
</table>
</div>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog"
aria-labelledby="mySmallModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" style="max-width: 1211px;">
<div class="modal-content" id="modal-form">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% partial 'dataTableJs' %}
{% put scripts %}
<script src="{{'assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js'|theme}}"></script>
<script src="{{'assets/libs/select2/js/select2.min.js'|theme}}"></script>
<script src="{{'assets/js/pages/form-advanced.init.js'|theme}}"></script>
{% endput %}

View File

@ -85,9 +85,20 @@ function onStart(){
<td style="font-weight: bold;width: 5%;">{{key + 1}}</td> <td style="font-weight: bold;width: 5%;">{{key + 1}}</td>
<td><a href="/sewer/new">#Dikiş{{record.product_id}}</a></td> <td><a href="/sewer/new">#Dikiş{{record.product_id}}</a></td>
<td>ini: {{record.product.width}} x boýy: {{record.product.height}}</td> <td>ini: {{record.product.width}} x boýy: {{record.product.height}}</td>
<td>{{record.product.pivot_sewer[0].bag_gram|number_format}} gr</td> <td>{{record.product.bag_gram|number_format}} gr</td>
<td style="text-align: center;"> <td style="text-align: center;">
<span class="badge badge-soft-primary" style="font-size: 14px;">#Rulon{{record.product.rulon_action.product.id}} - {{record.product.rulon_action.product.bag_type.name}}, {{record.product.rulon_action.product.color.name}}</span></td>
{% if record.product.rulon_action_id == 0 %}
<span class="badge badge-soft-warning" style="font-size: 14px;">
Sürülmedik Täzeden Sürülen
</span>
{% else %}
<span class="badge badge-soft-primary" style="font-size: 14px;">
#Rulon{{record.product.rulon_action.product.id}} - {{record.product.rulon_action.product.bag_type.name}}, {{record.product.rulon_action.product.color.name}}
</span>
{% endif %}
</td>
<td style="text-align: center;"> <td style="text-align: center;">
<span class="badge badge-soft-{% if record.type == 'inbox' %}success {% else %}danger {% endif %}" style="font-size: 14px;">{{record.type}}</span></td> <span class="badge badge-soft-{% if record.type == 'inbox' %}success {% else %}danger {% endif %}" style="font-size: 14px;">{{record.type}}</span></td>
<td style="color: #500101;font-weight: bold;">{{record.quantity|number_format}} sany</td> <td style="color: #500101;font-weight: bold;">{{record.quantity|number_format}} sany</td>

View File

@ -8,6 +8,7 @@ is_hidden = 0
<?php <?php
function onStart(){ function onStart(){
$this["shifts"] = Romanah\Gokbakja\Models\Shift::get(); $this["shifts"] = Romanah\Gokbakja\Models\Shift::get();
$this["colors"] = Romanah\Gokbakja\Models\BagColor::get();
$this["sewerMachines"] = Romanah\Gokbakja\Models\SewerMachine::get(); $this["sewerMachines"] = Romanah\Gokbakja\Models\SewerMachine::get();
@ -89,6 +90,15 @@ function onStart(){
<span class="input-group-text"><i class="mdi mdi-calendar"></i></span> <span class="input-group-text"><i class="mdi mdi-calendar"></i></span>
</div> </div>
</div> </div>
<div class="col">
<label class="form-label">Reňk Saýlaň</label>
<select class="form-control select2" name="color_id">
<option value="0">Saýla</option>
{% for color in colors %}
<option value="{{color.id}}">{{color.name}}</option>
{% endfor %}
</select>
</div>
<div class="col-3" id="rulon_section"> <div class="col-3" id="rulon_section">
<label class="form-label">Rulon Saýlaň</label> <label class="form-label">Rulon Saýlaň</label>
@ -279,4 +289,4 @@ function onStart(){
</script> </script>
{% endput %} {% endput %}
{% partial 'dataTableJs' %} {% partial 'dataTableJs' %}