From 0cffcefe735a24328b18262472bd18c558634a40 Mon Sep 17 00:00:00 2001 From: Shohrat Date: Thu, 23 Nov 2023 22:30:57 +0500 Subject: [PATCH] sewer attributes --- .../gokbakja/components/MachineProduction.php | 15 +- plugins/romanah/gokbakja/components/Sewer.php | 152 +++++++++--------- .../gokbakja/models/ProductionMachine.php | 4 + ...romanah_gokbakja_production_machine_18.php | 23 +++ plugins/romanah/gokbakja/updates/version.yaml | 3 + themes/gokbakja/pages/machine/machine.htm | 18 +++ themes/gokbakja/pages/machine/report.htm | 12 +- themes/gokbakja/pages/sewer/month.htm | 4 + themes/gokbakja/partials/sewer/row.htm | 11 ++ 9 files changed, 165 insertions(+), 77 deletions(-) create mode 100644 plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_18.php diff --git a/plugins/romanah/gokbakja/components/MachineProduction.php b/plugins/romanah/gokbakja/components/MachineProduction.php index ce9bec6..6c9d6b0 100644 --- a/plugins/romanah/gokbakja/components/MachineProduction.php +++ b/plugins/romanah/gokbakja/components/MachineProduction.php @@ -267,7 +267,7 @@ class MachineProduction extends ComponentBase $currentDateFormat = Carbon::now()->format('Y-m-d'); - $machineProductions = ProductionMachineModel::with(['bag_type', 'machine.building', 'employee', 'mechanic', 'color'])->orderBy('id', 'DESC')->get(); + $machineProductions = ProductionMachineModel::with(['bag_type', 'machine.building', 'employee', 'mechanic', 'color', 'shift'])->orderBy('id', 'DESC')->get(); $html_data = ''; for ($x = 0; $x < count($machineProductions); $x++) { @@ -298,6 +298,7 @@ class MachineProduction extends ComponentBase data-request-data="machineProdId: ' . $machineProductions[$x]->id . '" data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg" style="color: darkblue;"> #Rulon' . ($machineProductions[$x]->id) . ' ' . ($machineProductions[$x]->date == null ? "" : Carbon::parse($machineProductions[$x]->date)->format('d.m.Y')) . ' + ' . ($machineProductions[$x]->shift->desc ?? ''). ' ' . $machineProductions[$x]->machine->name . ' ' . $machineProductions[$x]->width . ' ' . $machineProductions[$x]->gram . ' m2 @@ -331,10 +332,10 @@ class MachineProduction extends ComponentBase $data = post(); - $machineProductions = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color']) + $machineProductions = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color', 'shift']) ->orderBy('id', 'DESC'); - $machineProductionsCalc = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color']) + $machineProductionsCalc = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color', 'shift']) ->orderBy('id', 'DESC'); $start = Carbon::parse($data["start"])->format('Y-m-d'); @@ -342,6 +343,7 @@ class MachineProduction extends ComponentBase $machine = $data["machine_id"]; // $mechanic = $data["mechanic_id"]; $type = $data["type_id"]; + $shift = $data["shift_id"]; $width = $data["width"]; $employee_name = $data["employee_name"]; @@ -364,6 +366,11 @@ class MachineProduction extends ComponentBase $machineProductionsCalc->where("machine_id", $machine); } + if ($shift) { + $machineProductions->where("shift_id", $shift); + $machineProductionsCalc->where("shift_id", $shift); + } + // if ($mechanic) { // $machineProductions->where("mechanic_id", $mechanic); // $machineProductionsCalc->where("mechanic_id", $mechanic); @@ -410,6 +417,7 @@ class MachineProduction extends ComponentBase data-request-data="machineProdId: ' . $machineProductionsFiltered[$x]->id . '" data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg" style="color: darkblue;"> #Rulon' . ($machineProductionsFiltered[$x]->id) . ' ' . ($machineProductionsFiltered[$x]->date == null ? "" : Carbon::parse($machineProductionsFiltered[$x]->date)->format('d.m.Y')) . ' + ' . ($machineProductionsFiltered[$x]->shift->desc ?? '') . ' ' . $machineProductionsFiltered[$x]->machine->name . ' ' . $machineProductionsFiltered[$x]->width . ' ' . $machineProductionsFiltered[$x]->gram . ' m2 @@ -549,6 +557,7 @@ class MachineProduction extends ComponentBase $createProductionMachine->brutto_kg = $data["brutto_kg"]; $createProductionMachine->layer = $data["layer"]; $createProductionMachine->machine_id = $data["machine_id"]; + $createProductionMachine->shift_id = $data["shift_id"]; $createProductionMachine->color_id = $data["color_id"]; $createProductionMachine->produced_weight = $data["produced_weight"]; $createProductionMachine->produced_length = $metrOfAllRulon; diff --git a/plugins/romanah/gokbakja/components/Sewer.php b/plugins/romanah/gokbakja/components/Sewer.php index fb45423..150f28e 100644 --- a/plugins/romanah/gokbakja/components/Sewer.php +++ b/plugins/romanah/gokbakja/components/Sewer.php @@ -66,10 +66,10 @@ class Sewer extends ComponentBase + for ($x = 0; $x < count($shifts); $x++) { + $html_data .= ''; + } + $html_data .= ' @@ -78,10 +78,10 @@ class Sewer extends ComponentBase + for ($x = 0; $x < count($sewerMachines); $x++) { + $html_data .= ''; + } + $html_data .= ' @@ -203,63 +203,70 @@ class Sewer extends ComponentBase $spentCalcDefectiveAll = (float)($spentCalcDefective + $spentCalcDefectiveRepair); - $leftCalc = (float)((float)$pivotSewer->amount - $spentCalc); + $allSpent = (float)($spentCalc + $spentCalcDefectiveAll); - $sewer->shift_id = $data["shift_id"]; - $sewer->sewer_machine_id = $data["sewer_machine_id"]; - $sewer->defective_repair_qty = (float) $data["defective_repair_qty"]; - $sewer->pipe_weight = (float) $data["pipe_weight"]; - - $sewer->produced_bag_qty = (float) $data["produced_bag_qty"]; - $sewer->defective_bag_qty = (float) $data["defective_bag_qty"]; - $sewer->width = (float) $data["width"]; - $sewer->height = (float) $data["height"]; - $sewer->date = Carbon::parse($data["date"])->format('Y-m-d'); - $sewer->note = $data["note"]; - $sewer->save(); - - $pivotSewer->left_amount = (float) ((float)$leftCalc - (float)$spentCalcDefectiveAll); - $pivotSewer->spent_amount = (float) ((float)$spentCalc + (float)$spentCalcDefectiveAll); - $pivotSewer->spent_defective_amount = (float) $spentCalcDefectiveAll; - $pivotSewer->status = $data["status"]; - $pivotSewer->save(); - - - $currentRulonAction = RulonAction::where("id", $pivotSewer->rulon_action_id)->first(); - - $createResult = new RulonAction(); - $createResult->product_id = $currentRulonAction->product_id; - $createResult->type = 'inbox'; - $createResult->status_accountant = "new"; - $createResult->status_director = "new"; - $createResult->note = "#Dikiş" . $sewer->id . " galyndy"; - $createResult->amount = (float) $pivotSewer->left_amount; - $createResult->stock_id = $stock->id; - $createResult->user_id = $user->id; - $createResult->save(); - - - $createResultBag = new BagAction(); - $createResultBag->product_id = $sewer->id; - $createResultBag->type = 'inbox'; - $createResultBag->status_accountant = "new"; - $createResultBag->status_director = "new"; - $createResultBag->note = "#Dikiş" . $sewer->id . " #Rulon".$currentRulonAction->product_id; - $createResultBag->amount = $sewer->produced_bag_qty; - $createResultBag->stock_id = $stockBag->id; - $createResultBag->user_id = $user->id; - $createResultBag->save(); - - - - if ($sewer && $pivotSewer && $createResult && $createResultBag) { - Flash::success("Maglumatlar Ustunlikli Üýtgedildi"); + if ($allSpent > $pivotSewer->amount) { + Flash::error("Ulanylan Rulon agramy berilen rulondan uly!! Halta sanyny dogry giriziň!!"); return Redirect::refresh(); } else { - Flash::error("Yalnyshlyk bar!!"); - return Redirect::refresh(); + $leftCalc = (float)((float)$pivotSewer->amount - $spentCalc); + + $sewer->shift_id = $data["shift_id"]; + $sewer->sewer_machine_id = $data["sewer_machine_id"]; + $sewer->defective_repair_qty = (float) $data["defective_repair_qty"]; + $sewer->pipe_weight = (float) $data["pipe_weight"]; + + $sewer->produced_bag_qty = (float) $data["produced_bag_qty"]; + $sewer->defective_bag_qty = (float) $data["defective_bag_qty"]; + $sewer->width = (float) $data["width"]; + $sewer->height = (float) $data["height"]; + $sewer->date = Carbon::parse($data["date"])->format('Y-m-d'); + $sewer->note = $data["note"]; + $sewer->save(); + + $pivotSewer->left_amount = (float) ((float)$leftCalc - (float)$spentCalcDefectiveAll); + $pivotSewer->spent_amount = (float) ((float)$spentCalc + (float)$spentCalcDefectiveAll); + $pivotSewer->spent_defective_amount = (float) $spentCalcDefectiveAll; + $pivotSewer->status = $data["status"]; + $pivotSewer->save(); + + + $currentRulonAction = RulonAction::where("id", $pivotSewer->rulon_action_id)->first(); + + $createResult = new RulonAction(); + $createResult->product_id = $currentRulonAction->product_id; + $createResult->type = 'inbox'; + $createResult->status_accountant = "new"; + $createResult->status_director = "new"; + $createResult->note = "#Dikiş" . $sewer->id . " galyndy"; + $createResult->amount = (float) $pivotSewer->left_amount; + $createResult->stock_id = $stock->id; + $createResult->user_id = $user->id; + $createResult->save(); + + + $createResultBag = new BagAction(); + $createResultBag->product_id = $sewer->id; + $createResultBag->type = 'inbox'; + $createResultBag->status_accountant = "new"; + $createResultBag->status_director = "new"; + $createResultBag->note = "#Dikiş" . $sewer->id . " #Rulon" . $currentRulonAction->product_id; + $createResultBag->amount = $sewer->produced_bag_qty; + $createResultBag->stock_id = $stockBag->id; + $createResultBag->user_id = $user->id; + $createResultBag->save(); + + + + if ($sewer && $pivotSewer && $createResult && $createResultBag) { + Flash::success("Maglumatlar Ustunlikli Üýtgedildi"); + return Redirect::refresh(); + } else { + Flash::error("Yalnyshlyk bar!!"); + return Redirect::refresh(); + } } - }else{ + } else { Flash::error("Statusy Tamlaň ya-da halta sany girizilmedik"); return Redirect::refresh(); } @@ -316,8 +323,8 @@ class Sewer extends ComponentBase
Poz @@ -353,7 +360,7 @@ class Sewer extends ComponentBase ' . $statusTitle . ' - ' . $sewerDatas[$x]->note . ' turba: '.$sewerDatas[$x]->pipe_weight.' + ' . $sewerDatas[$x]->note . ' turba: ' . $sewerDatas[$x]->pipe_weight . ' ' . $editBtn . ' @@ -485,7 +492,7 @@ class Sewer extends ComponentBase ' . $statusTitle . ' - ' . $sewerDatas[$x]->note . ' turba: '.$sewerDatas[$x]->pipe_weight.' + ' . $sewerDatas[$x]->note . ' turba: ' . $sewerDatas[$x]->pipe_weight . ' '; } @@ -568,7 +575,7 @@ class Sewer extends ComponentBase $createResult->amount = -$rulonAmountSum; $createResult->stock_id = $stock->id; $createResult->user_id = $user->id; - $createResult->note = "#Dikiş".$createSewer->id." üçin çykaryldy"; + $createResult->note = "#Dikiş" . $createSewer->id . " üçin çykaryldy"; $createResult->save(); @@ -588,9 +595,9 @@ class Sewer extends ComponentBase $user = \Auth::user(); $sewer = SewerModel::where("id", $data["sewerId"])->with(['pivot_sewer', 'rulon_action.product'])->first(); - if($sewer){ + if ($sewer) { - if($sewer->produced_bag_qty > 0){ + if ($sewer->produced_bag_qty > 0) { $stock = Stock::where("type", 'rulon')->first(); $createResult = new RulonAction(); @@ -599,7 +606,7 @@ class Sewer extends ComponentBase $createResult->amount = (float)$sewer->pivot_sewer[0]->spent_amount; $createResult->stock_id = $stock->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(); @@ -610,13 +617,12 @@ class Sewer extends ComponentBase $createResultBag->type = 'outbox'; $createResultBag->status_accountant = "new"; $createResultBag->status_director = "new"; - $createResultBag->note = "#Dikiş".$sewer->id." maglumat girizidi, soňundan pozulan"; + $createResultBag->note = "#Dikiş" . $sewer->id . " maglumat girizidi, soňundan pozulan"; $createResultBag->amount = -$sewer->produced_bag_qty; $createResultBag->stock_id = $stockBag->id; $createResultBag->user_id = $user->id; $createResultBag->save(); - - }elseif ($sewer->produced_bag_qty == 0){ + } elseif ($sewer->produced_bag_qty == 0) { $stock = Stock::where("type", 'rulon')->first(); $createResult = new RulonAction(); @@ -625,7 +631,7 @@ class Sewer extends ComponentBase $createResult->amount = (float)$sewer->pivot_sewer[0]->amount; $createResult->stock_id = $stock->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(); } } diff --git a/plugins/romanah/gokbakja/models/ProductionMachine.php b/plugins/romanah/gokbakja/models/ProductionMachine.php index 7054550..70b4044 100644 --- a/plugins/romanah/gokbakja/models/ProductionMachine.php +++ b/plugins/romanah/gokbakja/models/ProductionMachine.php @@ -51,6 +51,10 @@ class ProductionMachine extends Model 'Romanah\Gokbakja\Models\BagColor', 'key' => 'color_id' ], + 'shift' => [ + 'Romanah\Gokbakja\Models\Shift', + 'key' => 'shift_id' + ], ]; /** diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_18.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_18.php new file mode 100644 index 0000000..8dd9ab3 --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_18.php @@ -0,0 +1,23 @@ +integer('shift_id'); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_production_machine', function($table) + { + $table->dropColumn('shift_id'); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/version.yaml b/plugins/romanah/gokbakja/updates/version.yaml index 884c865..1f95afc 100644 --- a/plugins/romanah/gokbakja/updates/version.yaml +++ b/plugins/romanah/gokbakja/updates/version.yaml @@ -426,3 +426,6 @@ 1.0.143: - 'Updated table romanah_gokbakja_sewer_production' - builder_table_update_romanah_gokbakja_sewer_production_12.php +1.0.144: + - 'Updated table romanah_gokbakja_production_machine' + - builder_table_update_romanah_gokbakja_production_machine_18.php diff --git a/themes/gokbakja/pages/machine/machine.htm b/themes/gokbakja/pages/machine/machine.htm index 23a7903..67027b4 100644 --- a/themes/gokbakja/pages/machine/machine.htm +++ b/themes/gokbakja/pages/machine/machine.htm @@ -57,6 +57,14 @@ pageNumber = "{{ :page }}" [rulonAction] == + +== {% set records = builderList.records %} {% set displayColumn = builderList.displayColumn %} {% set noRecordsMessage = builderList.noRecordsMessage %} @@ -93,6 +101,14 @@ pageNumber = "{{ :page }}"
+
+ +
+ + {% for shift in shifts %} + + {% endfor %} + +