diff --git a/plugins/romanah/gokbakja/components/Production.php b/plugins/romanah/gokbakja/components/Production.php index 2b2cb8d..0aa6ae0 100644 --- a/plugins/romanah/gokbakja/components/Production.php +++ b/plugins/romanah/gokbakja/components/Production.php @@ -5,6 +5,7 @@ namespace Romanah\Gokbakja\Components; use Cms\Classes\ComponentBase; use Romanah\Gokbakja\Models\Product as ProductModel; use Romanah\Gokbakja\Models\Production as ProductionModel; +use Romanah\Gokbakja\Models\ProductionMachine as ProductionMachineModel; use Romanah\Gokbakja\Models\PivotProduction as PivotProductionModel; use Redirect; use Flash; @@ -21,6 +22,41 @@ class Production extends ComponentBase ]; } + public function onCreateMachineProduction() + { + $user = \Auth::user(); + + $data = post(); + + $createProductionMachine = new ProductionMachineModel(); + + $createProductionMachine->type_id = $data["type_id"]; + $createProductionMachine->size_id = $data["size_id"]; + $createProductionMachine->machine_id = $data["machine_id"]; + $createProductionMachine->produced_weight = $data["produced_weight"]; + $createProductionMachine->note = $data["note"]; + $createProductionMachine->user_id = $user->id; + $createProductionMachine->save(); + + $productionMachine = ProductionMachineModel::where('id', $createProductionMachine->id)->with(['machine.employee', 'machine.mechanic', 'machine.building'])->first(); + // dd($productionMachine->machine->name); + if($productionMachine){ + $updateResult = ProductionMachineModel::where('id', $productionMachine->id) + ->update(array( + 'employee_id' => $productionMachine->machine->employee->id, + 'mechanic_id' => $productionMachine->machine->mechanic->id, + 'employee_name' => $productionMachine->machine->employee->name, + 'mechanic_name' => $productionMachine->machine->mechanic->name, + 'building_name' => $productionMachine->machine->building->name, + )); + } + + if ($createProductionMachine && $updateResult) { + Flash::success("Hasabat Ustunlikli Goşuldy"); + return Redirect::refresh(); + } + + } public function onCreateProduction() { diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_2.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_2.php new file mode 100644 index 0000000..b97b535 --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_2.php @@ -0,0 +1,23 @@ +integer('user_id')->nullable(); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_production_machine', function($table) + { + $table->dropColumn('user_id'); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_3.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_3.php new file mode 100644 index 0000000..953c60b --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_3.php @@ -0,0 +1,31 @@ +integer('type_id')->nullable()->change(); + $table->integer('size_id')->nullable()->change(); + $table->integer('machine_id')->nullable()->change(); + $table->integer('employee_id')->nullable()->change(); + $table->integer('mechanic_id')->nullable()->change(); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_production_machine', function($table) + { + $table->integer('type_id')->nullable(false)->change(); + $table->integer('size_id')->nullable(false)->change(); + $table->integer('machine_id')->nullable(false)->change(); + $table->integer('employee_id')->nullable(false)->change(); + $table->integer('mechanic_id')->nullable(false)->change(); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_4.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_4.php new file mode 100644 index 0000000..e1c3b37 --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_4.php @@ -0,0 +1,23 @@ +string('building_name')->nullable(); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_production_machine', function($table) + { + $table->dropColumn('building_name'); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/version.yaml b/plugins/romanah/gokbakja/updates/version.yaml index d7b1118..b69ad71 100644 --- a/plugins/romanah/gokbakja/updates/version.yaml +++ b/plugins/romanah/gokbakja/updates/version.yaml @@ -102,3 +102,12 @@ 1.0.35: - 'Updated table romanah_gokbakja_pivot_production' - builder_table_update_romanah_gokbakja_pivot_production_4.php +1.0.36: + - 'Updated table romanah_gokbakja_production_machine' + - builder_table_update_romanah_gokbakja_production_machine_2.php +1.0.37: + - 'Updated table romanah_gokbakja_production_machine' + - builder_table_update_romanah_gokbakja_production_machine_3.php +1.0.38: + - 'Updated table romanah_gokbakja_production_machine' + - builder_table_update_romanah_gokbakja_production_machine_4.php diff --git a/themes/gokbakja/meta/menus/aside.yaml b/themes/gokbakja/meta/menus/aside.yaml index fd5a78e..fcbb726 100644 --- a/themes/gokbakja/meta/menus/aside.yaml +++ b/themes/gokbakja/meta/menus/aside.yaml @@ -67,9 +67,13 @@ items: isExternal: '0' - title: 'Çig mallar boýunça' + nesting: null type: url url: /w code: '' + reference: null + cmsPage: null + replace: null viewBag: isHidden: '0' cssClass: ri-stack-line @@ -77,9 +81,13 @@ items: items: - title: 'Täze Hasabat' + nesting: null type: cms-page + url: null code: '' reference: production + cmsPage: null + replace: null viewBag: isHidden: '0' cssClass: '' @@ -88,13 +96,13 @@ items: title: 'Aýlar Boýunça' type: cms-page code: '' - reference: all-production-month + reference: all-productions viewBag: isHidden: '0' cssClass: '' isExternal: '0' - - title: 'Ortaça Hasaplama' + title: 'Ýyl Boýunça' type: cms-page code: '' reference: report-production @@ -104,9 +112,13 @@ items: isExternal: '0' - title: 'Enjamlar Boýunça' + nesting: null type: url url: /ee code: '' + reference: null + cmsPage: null + replace: null viewBag: isHidden: '0' cssClass: 'ri-bar-chart-2-line ' @@ -114,27 +126,53 @@ items: items: - title: 'Täze Hasabat' + nesting: null type: cms-page + url: null code: '' reference: machine + cmsPage: null + replace: null viewBag: isHidden: '0' cssClass: '' isExternal: '0' - - title: 'Aylar boyunca' - type: url - url: /sss + title: 'Aýlar boýunca' + type: cms-page code: '' + reference: all-production-machine-month + viewBag: + isHidden: '0' + cssClass: '' + isExternal: '0' + - + title: 'Ýyl Boýunça' + type: cms-page + code: '' + reference: report-production-machine + viewBag: + isHidden: '0' + cssClass: '' + isExternal: '0' + - + title: 'Mehanikler boýunça' + type: cms-page + code: '' + reference: machine-production-mechanic viewBag: isHidden: '0' cssClass: '' isExternal: '0' - title: Tikinçiler + nesting: null type: url url: /tt code: '' + reference: null + cmsPage: null + replace: null viewBag: isHidden: '0' cssClass: 'ri-surround-sound-line ' @@ -142,9 +180,13 @@ items: items: - title: 'Taze hasabat' + nesting: null type: url url: /s code: '' + reference: null + cmsPage: null + replace: null viewBag: isHidden: '0' cssClass: '' diff --git a/themes/gokbakja/pages/all-production-machine-month.htm b/themes/gokbakja/pages/all-production-machine-month.htm new file mode 100644 index 0000000..7dbf16d --- /dev/null +++ b/themes/gokbakja/pages/all-production-machine-month.htm @@ -0,0 +1,151 @@ +title = "All production machine by month group" +url = "/all-production-machine-month/:month/:year?" +layout = "platform_main" +is_hidden = 0 +== +timezone('UTC +05:00'); + $this["month"] = $this->param("month"); + $year = $this->param("year"); + + + if($this["month"] == 'default'){ + $this["month"] = $currentDate->month; + } + + if($year){ + $this["machineProductions"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"])->whereYear('created_at', $year)->groupBy(DB::raw("DAY(created_at)"))->get(); + + $this["month_all_amount"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"]) + ->whereYear('created_at', $year) + ->sum('produced_weight'); + }else{ + $this["machineProductions"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"])->whereYear('created_at', $currentDate->year)->groupBy(DB::raw("DAY(created_at)"))->addSelect(DB::raw("*, SUM(produced_weight) as produced_weight"))->get(); + + $this["month_all_amount"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"]) + ->whereYear('created_at', $currentDate->year) + ->sum('produced_weight'); + } +} +?> +== +{% put styles %} + + + +{% endput %} + +
Hasabat
+| № | +Bina No | +Enjam No | +Ölçegi | +Görnüşi | +Önen Önüm (kg) | +Ady Familiýasy | +Mehanik | +Bellik | + +
|---|---|---|---|---|---|---|---|---|
| {{key + 1}} | +{{machine.building_name}} | +{{machine.machine.name}} | +{{machine.bag_size.name}} | +{{machine.bag_type.name}} | +{{machine.produced_weight|number_format}} kg | +{{machine.employee_name}} | +{{machine.mechanic_name}} | +{{machine.note}} | +
| # | +JEMI | ++ | + | + + | + {{month_all_amount|number_format}} kg + | ++ | + + + + | + |
| № | +Bina No | +Enjam No | +Ölçegi | +Görnüşi | +Önen Önüm (kg) | +Ady Familiýasy | +Mehanik | +Bellik | +
Hasabat
+| № | +Bina No | +Enjam No | +Ölçegi | +Görnüşi | +Önen Önüm (kg) | +Ady Familiýasy | +Mehanik | +Bellik | + +
|---|---|---|---|---|---|---|---|---|
| {{key + 1}} | +{{machine.building_name}} | +{{machine.machine.name}} | +{{machine.bag_size.name}} | +{{machine.bag_type.name}} | +{{machine.produced_weight|number_format}} kg | +{{machine.employee_name}} | +{{machine.mechanic_name}} | +{{machine.note}} | +
| # | +JEMI | ++ | + | + + | + {{month_all_amount|number_format}} kg + | ++ | + + + + | + |
| № | +Bina No | +Enjam No | +Ölçegi | +Görnüşi | +Önen Önüm (kg) | +Ady Familiýasy | +Mehanik | +Bellik | +
Hasabat
+| № | +Bina No | +Enjam No | +Ölçegi | +Görnüşi | +Önen Önüm (kg) | +Ady Familiýasy | +Mehanik | +Bellik | + +
|---|---|---|---|---|---|---|---|---|
| {{key + 1}} | +{{machine.building_name}} | +{{machine.machine.name}} | +{{machine.bag_size.name}} | +{{machine.bag_type.name}} | +{{machine.produced_weight|number_format}} kg | +{{machine.employee_name}} | +{{machine.mechanic_name}} | +{{machine.note}} | +
| # | +JEMI | ++ | + | + + | + {{month_all_amount|number_format}} kg + | ++ | + + + + | + |
| № | +Bina No | +Enjam No | +Ölçegi | +Görnüşi | +Önen Önüm (kg) | +Ady Familiýasy | +Mehanik | +Bellik | +
Hasabat
| № | Bina No | Enjam No | +Ölçegi | +Görnüşi | Önen Önüm (kg) | Ady Familiýasy | Mehanik | -Ölçegi | -Görnüşi | Bellik | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{key + 1}} | -{{machine.building.name}} | -{{machine.name}} | -onen onum | -{{machine.employee.name}} | -{{machine.mechanic.name}} | -- | - | + | {{machine.building_name}} | +{{machine.machine.name}} | +{{machine.bag_size.name}} | +{{machine.bag_type.name}} | +{{machine.produced_weight|number_format}} kg | +{{machine.employee_name}} | +{{machine.mechanic_name}} | +{{machine.note}} | № | Bina No | Enjam No | +Ölçegi | +Görnüşi | Önen Önüm (kg) | Ady Familiýasy | Mehanik | -Ölçegi | -Görnüşi | Bellik | @@ -108,4 +206,9 @@ is_hidden = 0 +{% put scripts %} + + +{% endput %} + {% partial 'dataTableJs' %} diff --git a/themes/gokbakja/pages/product/actions.htm b/themes/gokbakja/pages/product/actions.htm index 3dc643d..d8f5486 100644 --- a/themes/gokbakja/pages/product/actions.htm +++ b/themes/gokbakja/pages/product/actions.htm @@ -122,7 +122,7 @@ function onStart(){ class="btn btn-warning waves-effect waves-light" data-bs-toggle="offcanvas" data-bs-target="#offcanvasBottom" aria-controls="offcanvasBottom" style="padding-top: 5px;padding-bottom: 5px;"> - Обновить + Täzele
| № | +Aýlar | +Öndürlen Önüm | + + +
|---|---|---|
| № | +Senesi | +Hemmesi | + +