From a2aa82e934976d557b1f1ac32fbecb773136d3ff Mon Sep 17 00:00:00 2001 From: Shohrat Date: Mon, 23 Oct 2023 04:05:55 +0500 Subject: [PATCH] sewer insert --- .../gokbakja/components/MachineProduction.php | 74 +++++-- plugins/romanah/gokbakja/components/Sewer.php | 204 ++++++++++++------ ...romanah_gokbakja_production_machine_11.php | 23 ++ ...te_romanah_gokbakja_sewer_production_5.php | 23 ++ plugins/romanah/gokbakja/updates/version.yaml | 6 + themes/gokbakja/pages/machine/report.htm | 11 + themes/gokbakja/pages/sewer/month.htm | 7 +- themes/gokbakja/pages/sewer/new.htm | 13 +- themes/gokbakja/pages/sewer/report.htm | 62 +++++- themes/gokbakja/partials/sewer/row.htm | 12 +- 10 files changed, 341 insertions(+), 94 deletions(-) create mode 100644 plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_11.php create mode 100644 plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_sewer_production_5.php diff --git a/plugins/romanah/gokbakja/components/MachineProduction.php b/plugins/romanah/gokbakja/components/MachineProduction.php index 4b49717..e927658 100644 --- a/plugins/romanah/gokbakja/components/MachineProduction.php +++ b/plugins/romanah/gokbakja/components/MachineProduction.php @@ -13,6 +13,7 @@ use Flash; // use Illuminate\Validation\Validator; use \Validator; use DB; +use Romanah\Gokbakja\Models\PivotSewer; class MachineProduction extends ComponentBase { @@ -69,7 +70,11 @@ class MachineProduction extends ComponentBase $data = post(); - $machineProductions = ProductionMachineModel::select('id', 'type_id', 'size_id', 'machine_id', 'produced_weight', 'employee_id', 'mechanic_id', 'note', 'date', 'color_id', 'left_weight', 'building_name', 'employee_name', 'mechanic_name') + $machineProductions = ProductionMachineModel::select('id', 'is_finished', 'type_id', 'size_id', 'machine_id', 'produced_weight', 'employee_id', 'mechanic_id', 'note', 'date', 'color_id', 'building_name', 'employee_name', 'mechanic_name') + ->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color']) + ->orderBy('id', 'DESC'); + + $machineProductionsCalc = ProductionMachineModel::select('id', 'is_finished', 'type_id', 'size_id', 'machine_id', 'produced_weight', 'employee_id', 'mechanic_id', 'note', 'date', 'color_id', 'building_name', 'employee_name', 'mechanic_name') ->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color']) ->orderBy('id', 'DESC'); @@ -79,38 +84,76 @@ class MachineProduction extends ComponentBase $mechanic = $data["mechanic_id"]; $size = $data["size_id"]; $type = $data["type_id"]; + // $is_finished = $data["is_finished"]; + // if ($is_finished) { + // $machineProductions->where("is_finished", (bool) $is_finished); + // } + if ($machine) { $machineProductions->where("machine_id", $machine); + $machineProductionsCalc->where("machine_id", $machine); } if ($mechanic) { $machineProductions->where("mechanic_id", $mechanic); + $machineProductionsCalc->where("mechanic_id", $mechanic); } if ($size) { $machineProductions->where("size_id", $size); + $machineProductionsCalc->where("size_id", $size); } if ($type) { $machineProductions->where("type_id", $type); + $machineProductionsCalc->where("type_id", $type); } if ($start != $currentDateFormat){ $machineProductions->whereBetween('date', [$start, $end]); + $machineProductionsCalc->whereBetween('date', [$start, $end]); } - $machineProductionsFiltered = $machineProductions->selectRaw('produced_weight - left_weight as spent')->get(); + + + $machineProductionsFiltered = $machineProductions->withCount([ + 'pivot_sewer AS leftSum' => function ($query) { + $query->select(DB::raw("(amount - SUM(spent_amount)) as leftSum"))->where('status', 'complated'); + } + ]) + ->withCount([ + 'pivot_sewer AS spentSum' => function ($query) { + $query->select(DB::raw("(SUM(spent_amount)) as spentSum"))->where('status', 'complated'); + } + ])->get(); + + + $finishedRulons = $machineProductionsCalc->where('is_finished', 1)->count(); + $leftAllRulons = (count($machineProductionsFiltered) - $finishedRulons); + // $pivotSewersWorking = PivotSewer::select('id', 'status', 'machine_production_id') + // ->where('status', 'working') + // ->get() + // ->pluck('machine_production_id') + // ->toArray(); + + + + + + $machineProductionsSum = $machineProductions->sum("produced_weight"); - $machineLeftProductionsSum = $machineProductions->sum("left_weight"); - $allSpent = $machineProductionsSum - $machineLeftProductionsSum; + $machineLeftProductionsSum = 0; + $allSpent = 0; $html_data = ''; for ($x = 0; $x < count($machineProductionsFiltered); $x++) { + + if($machineProductionsFiltered[$x]->date != null){ $dateFormat = $machineProductionsFiltered[$x]->date->format("d.m.Y"); }else{ @@ -118,11 +161,20 @@ class MachineProduction extends ComponentBase } $spent = '' . number_format($machineProductionsFiltered[$x]->spent) . ' kg'; + style="font-size: 14px;">' . number_format($machineProductionsFiltered[$x]->spentSum, 2) . ' kg'; + $left = number_format(($machineProductionsFiltered[$x]->produced_weight - $machineProductionsFiltered[$x]->spentSum),2); + + if($left==0){ + $left='Gutardy'; + } + + $allSpent += $machineProductionsFiltered[$x]->spentSum; + $machineLeftProductionsSum += ($machineProductionsFiltered[$x]->produced_weight - $machineProductionsFiltered[$x]->spentSum); $html_data .= ' ' . ($x + 1) . ' + #' . $machineProductionsFiltered[$x]->id . ' ' . $dateFormat . ' ' . $machineProductionsFiltered[$x]->building_name . ' ' . $machineProductionsFiltered[$x]->machine->name . ' @@ -135,7 +187,7 @@ class MachineProduction extends ComponentBase '.$spent.' ' . number_format($machineProductionsFiltered[$x]->left_weight) . ' kg + style="font-size: 14px;">' . $left .' ' . $machineProductionsFiltered[$x]->employee_name . ' @@ -151,8 +203,7 @@ class MachineProduction extends ComponentBase
-
Rulon: '.count($machineProductionsFiltered).'
+
Öndürlen Rulon: '.count($machineProductionsFiltered).'
Ulanylan Rulon: ' .$finishedRulons.'
Sklatdaky: '.$leftAllRulons.'
@@ -160,7 +211,7 @@ class MachineProduction extends ComponentBase
Öndürlen: '.number_format($machineProductionsSum).' kg
+ class="mdi mdi-bullseye-arrow me-3"> Öndürlen: '.number_format($machineProductionsSum, 2).' kg
@@ -168,7 +219,7 @@ class MachineProduction extends ComponentBase
Sklatda: '.number_format($machineLeftProductionsSum).' kg
+ class="mdi mdi-bullseye-arrow me-3"> Sklatda: '.number_format($machineLeftProductionsSum, 2).' kg
@@ -177,7 +228,7 @@ class MachineProduction extends ComponentBase
Ulanylan: '.number_format($allSpent).' kg
+ class="mdi mdi-bullseye-arrow me-3"> Ulanylan: '.number_format($allSpent, 2).' kg
', @@ -211,7 +262,6 @@ class MachineProduction extends ComponentBase $createProductionMachine->note = $data["note"]; $createProductionMachine->date = Carbon::parse($data["date"])->format('Y-m-d'); $createProductionMachine->user_id = $user->id; - $createProductionMachine->left_weight = $data["produced_weight"]; $createProductionMachine->save(); $productionMachine = ProductionMachineModel::where('id', $createProductionMachine->id)->with(['machine.employee', 'machine.mechanic', 'machine.building'])->first(); diff --git a/plugins/romanah/gokbakja/components/Sewer.php b/plugins/romanah/gokbakja/components/Sewer.php index fc0ee6b..afaa6ce 100644 --- a/plugins/romanah/gokbakja/components/Sewer.php +++ b/plugins/romanah/gokbakja/components/Sewer.php @@ -40,7 +40,7 @@ class Sewer extends ComponentBase $sewerProd = SewerModel::where("id", $data["sewerId"])->with("employee", "pivot_sewer")->first(); $html_data = ' @@ -53,18 +53,29 @@ class Sewer extends ComponentBase +
+
+ +
+ pivot_sewer[0]->status == 'complated' ? "disabled" : "") . '> + +
+
+
pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'> + placeholder="Halta Ini" value="' . ($sewerProd->width == null ? 0 : $sewerProd->width) . '" ' . ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") . '>
@@ -73,7 +84,7 @@ class Sewer extends ComponentBase pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'> + placeholder="Halta Boýy" value="' . ($sewerProd->height == null ? 0 : $sewerProd->height) . '" ' . ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") . '> @@ -87,7 +98,8 @@ class Sewer extends ComponentBase pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'> + placeholder="tikilen halta sany" value="' . $sewerProd->produced_bag_qty . '" ' . ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") . '> + @@ -96,7 +108,7 @@ class Sewer extends ComponentBase pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'> + placeholder="Galyndy (kg)" value="' . ($sewerProd->pivot_sewer[0]->left_amount) . '" ' . ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") . '> @@ -105,7 +117,7 @@ class Sewer extends ComponentBase
- pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'> + pivot_sewer[0]->status == 'complated' ? "disabled" : "") . '>
@@ -130,35 +142,56 @@ class Sewer extends ComponentBase $data = post(); - $sewer = SewerModel::where("id", $data["sewer_id"])->first(); - $pivotSewer = PivotSewer::where("sewer_production_id", $data["sewer_id"])->first(); + if ($data["produced_bag_qty"] == 0) { + return Flash::error("Tikilen halta sanyny girizin"); + }elseif(!$data["produced_bag_qty"] && $data["status"] == "working"){ - $spentCalc = (float)((float) $pivotSewer->amount - (float) $data["left_amount"]); + $sewer = SewerModel::where("id", $data["sewer_id"])->first(); + $pivotSewer = PivotSewer::where("sewer_production_id", $data["sewer_id"])->first(); - $sewer->produced_bag_qty = (float) $data["produced_bag_qty"]; - $sewer->width = (float) $data["width"]; - $sewer->height = (float) $data["height"]; - $sewer->note = $data["note"]; - $sewer->save(); + $pivotSewer->status = $data["status"]; + $pivotSewer->save(); - $pivotSewer->left_amount = (float) $data["left_amount"]; - $pivotSewer->spent_amount = (float) $spentCalc; - $pivotSewer->status = $data["status"]; - $pivotSewer->save(); - - if($data["left_amount"] == 0){ - $machinProduction = ProductionMachine::where("id", $pivotSewer->machine_production_id)->first(); - $machinProduction->is_finished = true; - $machinProduction->save(); - } - - if ($sewer) { - - Flash::success("Maglumatlar Ustunlikli Üýtgedildi"); - return Redirect::refresh(); + if ($sewer && $pivotSewer) { + Flash::success("Maglumatlar Ustunlikli Üýtgedildi"); + return Redirect::refresh(); + } else { + return Flash::error("Yalnyshlyk bar!!"); + return Redirect::refresh(); + } } else { - return Flash::error("Yalnyshlyk bar!!"); - return Redirect::refresh(); + $sewer = SewerModel::where("id", $data["sewer_id"])->first(); + $pivotSewer = PivotSewer::where("sewer_production_id", $data["sewer_id"])->first(); + + $spentCalc = (float)((float) $pivotSewer->amount - (float) $data["left_amount"]); + + $sewer->produced_bag_qty = (float) $data["produced_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) $data["left_amount"]; + $pivotSewer->spent_amount = (float) $spentCalc; + $pivotSewer->status = $data["status"]; + $pivotSewer->save(); + + if ($data["left_amount"] == 0 && $data["status"] == "complated") { + $machinProduction = ProductionMachine::where("id", $pivotSewer->machine_production_id)->first(); + $machinProduction->is_finished = true; + $machinProduction->save(); + }else{ + return Flash::error("Status tamamlamaly!"); + } + + if ($sewer && $pivotSewer) { + Flash::success("Maglumatlar Ustunlikli Üýtgedildi"); + return Redirect::refresh(); + } else { + return Flash::error("Yalnyshlyk bar!!"); + return Redirect::refresh(); + } } } @@ -171,22 +204,25 @@ class Sewer extends ComponentBase // dd($sewerDatas); for ($x = 0; $x < count($sewerDatas); $x++) { $statusTitle = ''; - if($sewerDatas[$x]->pivot_sewer[0]->status == "working"){ + if ($sewerDatas[$x]->pivot_sewer[0]->status == "working") { $statusTitle = "Işlenilýär"; - }else{ + } else { $statusTitle = "Tamamlandy"; } + $dateTitle = ($sewerDatas[$x]->date == null ? "" : Carbon::parse($sewerDatas[$x]->date)->format('d.m.Y')); + + $html_data .= ' ' . ($x + 1) . ' #' . $sewerDatas[$x]->id . ' ini: ' . ($sewerDatas[$x]->width ?? "") . '- boyy:'. ($sewerDatas[$x]->height ?? "") .' + style="font-size: 14px;">ini: ' . ($sewerDatas[$x]->width ?? "") . '- boyy:' . ($sewerDatas[$x]->height ?? "") . ' - #'.$sewerDatas[$x]->machin_production->id.'- ' . ($sewerDatas[$x]->machin_production->bag_size->width ?? "") . 'x' .($sewerDatas[$x]->machin_production->bag_size->height ?? "").'m2, '.($sewerDatas[$x]->machin_production->bag_type->name ?? "") .', '.($sewerDatas[$x]->machin_production->color->name ?? "").' + #' . $sewerDatas[$x]->machin_production->id . '- ' . ($sewerDatas[$x]->machin_production->bag_size->width ?? "") . 'x' . ($sewerDatas[$x]->machin_production->bag_size->height ?? "") . 'm2, ' . ($sewerDatas[$x]->machin_production->bag_type->name ?? "") . ', ' . ($sewerDatas[$x]->machin_production->color->name ?? "") . ' ' . $sewerDatas[$x]->employee->name . ' - ' . $sewerDatas[$x]->created_at->format('d.m.Y') . ' + ' . $dateTitle . ' ' . number_format($sewerDatas[$x]->pivot_sewer[0]->amount, 2) . ' kg @@ -201,9 +237,8 @@ class Sewer extends ComponentBase
Täzele @@ -232,56 +267,96 @@ class Sewer extends ComponentBase $data = post(); - $sewerProductions = SewerModel::with("employee")->orderBy('id', 'DESC'); + $sewerProductions = SewerModel::with(["employee", "machin_production.bag_size", "machin_production.bag_type", "machin_production.color", "pivot_sewer"])->orderBy('id', 'DESC'); $start = Carbon::parse($data["start"])->format('Y-m-d'); $end = Carbon::parse($data["end"])->format('Y-m-d');; $employee = $data["employee_id"]; $min = $data["min"]; $max = $data["max"]; - $amount = $data["amount"]; + $status = $data["status"]; + $width = $data["width"]; + $height = $data["height"]; + + if ($height) { + $sewerProductions->where("height", $height); + } + + if ($width) { + $sewerProductions->where("width", $width); + } + if ($employee) { $sewerProductions->where("employee_id", $employee); } + if ($status) { + $sewerProductions->with("pivot_sewer")->whereHas('pivot_sewer', function ($query) use($status) { + $query->where('status', $status); + }); + } + if ($min) { - $sewerProductions->whereRaw('produced_bag_qty >' . $min); + $sewerProductions->whereRaw('produced_bag_qty >' . ($min - 1)); } if ($max) { - $sewerProductions->whereRaw('produced_bag_qty <' . $max); + $sewerProductions->whereRaw('produced_bag_qty <' . ($max + 1)); } - if ($amount) { - $sewerProductions->whereRaw('amount <=' . $amount); - } + if ($start != $currentDateFormat) { - $sewerProductions->whereBetween('created_at', [$start, $end]); + $sewerProductions->whereBetween('date', [$start, $end]); } - $sewerProductionsFiltered = $sewerProductions->get(); - $sewerProductionsSumBagQty = $sewerProductions->sum("produced_bag_qty"); - $sewerProductionsamount = $sewerProductions->sum("amount"); + $sewerDatas = $sewerProductions->get(); + $sewerIds = $sewerProductions->get()->pluck("id")->toArray(); + + $sewerProductionsSumBagQty = $sewerProductions->sum("produced_bag_qty"); + + $sewerProductionsamount = PivotSewer::whereIn("sewer_production_id", $sewerIds)->sum("spent_amount"); + // dd($sewerProductionsamount->spentAmount); $html_data = ''; - for ($x = 0; $x < count($sewerProductionsFiltered); $x++) { + for ($x = 0; $x < count($sewerDatas); $x++) { + $statusTitle = ''; + if ($sewerDatas[$x]->pivot_sewer[0]->status == "working") { + $statusTitle = "Işlenilýär"; + } else { + $statusTitle = "Tamamlandy"; + } + + $dateTitle = ($sewerDatas[$x]->date == null ? "" : Carbon::parse($sewerDatas[$x]->date)->format('d.m.Y')); + + $html_data .= ' ' . ($x + 1) . ' - ' . $sewerProductionsFiltered[$x]->employee->name . ' - ' . $sewerProductionsFiltered[$x]->created_at->format('d.m.Y') . ' - ' . $sewerProductionsFiltered[$x]->amount . ' kg + #' . $sewerDatas[$x]->id . ' + ini: ' . ($sewerDatas[$x]->width ?? "") . '- boyy:' . ($sewerDatas[$x]->height ?? "") . ' - ' . $sewerProductionsFiltered[$x]->produced_bag_qty . ' - ' . $sewerProductionsFiltered[$x]->note . ' + #' . $sewerDatas[$x]->machin_production->id . '- ' . ($sewerDatas[$x]->machin_production->bag_size->width ?? "") . 'x' . ($sewerDatas[$x]->machin_production->bag_size->height ?? "") . 'm2, ' . ($sewerDatas[$x]->machin_production->bag_type->name ?? "") . ', ' . ($sewerDatas[$x]->machin_production->color->name ?? "") . ' + + ' . $sewerDatas[$x]->employee->name . ' + ' . $dateTitle . ' + ' . number_format($sewerDatas[$x]->pivot_sewer[0]->amount, 2) . ' kg + + ' . $sewerDatas[$x]->produced_bag_qty . ' + ' . number_format($sewerDatas[$x]->pivot_sewer[0]->spent_amount, 2) . ' kg + ' . number_format($sewerDatas[$x]->pivot_sewer[0]->left_amount, 2) . ' kg + ' . $statusTitle . ' + ' . $sewerDatas[$x]->note . ' + '; } - if ($sewerProductionsFiltered) { + if ($sewerDatas) { return [ '#sewer_report_datas' => $html_data, '#all_amount' => '
@@ -298,7 +373,7 @@ class Sewer extends ComponentBase
-
Jemi Sarp Edilen Çig mal: ' . number_format($sewerProductionsamount) . ' kg
+
Jemi Sarp Edilen Çig mal: ' . number_format($sewerProductionsamount, 2) . ' kg
', @@ -321,13 +396,13 @@ class Sewer extends ComponentBase $machineProductionSpent = PivotSewer::where("machine_production_id", $data["machine_production_id"])->sum('spent_amount'); $leftAmount = 0; - if($machineProduction->produced_weight > $machineProductionSpent){ + if ($machineProduction->produced_weight > $machineProductionSpent) { $calcLeft = ((float) $machineProduction->produced_weight - (float) $machineProductionSpent); $leftAmount = $calcLeft; - }elseif($machineProduction->produced_weight == $machineProductionSpent){ + } elseif ($machineProduction->produced_weight == $machineProductionSpent) { $leftAmount = 0; - }else{ + } else { $leftAmount = 0; } @@ -340,6 +415,7 @@ class Sewer extends ComponentBase $createSewer->machine_production_id = $data["machine_production_id"]; $createSewer->width = (float) $data["width"]; $createSewer->height = (float) $data["height"]; + $createSewer->date = Carbon::parse($data["date"])->format('Y-m-d'); $createSewer->save(); $createPivotSewer = new PivotSewer(); diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_11.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_11.php new file mode 100644 index 0000000..1d8fd22 --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_production_machine_11.php @@ -0,0 +1,23 @@ +dropColumn('left_weight'); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_production_machine', function($table) + { + $table->double('left_weight', 10, 0); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_sewer_production_5.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_sewer_production_5.php new file mode 100644 index 0000000..76fea40 --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_sewer_production_5.php @@ -0,0 +1,23 @@ +date('date')->nullable(); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_sewer_production', function($table) + { + $table->dropColumn('date'); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/version.yaml b/plugins/romanah/gokbakja/updates/version.yaml index 23ed58b..ed48fb6 100644 --- a/plugins/romanah/gokbakja/updates/version.yaml +++ b/plugins/romanah/gokbakja/updates/version.yaml @@ -273,3 +273,9 @@ 1.0.92: - 'Updated table romanah_gokbakja_production_machine' - builder_table_update_romanah_gokbakja_production_machine_10.php +1.0.93: + - 'Updated table romanah_gokbakja_sewer_production' + - builder_table_update_romanah_gokbakja_sewer_production_5.php +1.0.94: + - 'Updated table romanah_gokbakja_production_machine' + - builder_table_update_romanah_gokbakja_production_machine_11.php diff --git a/themes/gokbakja/pages/machine/report.htm b/themes/gokbakja/pages/machine/report.htm index de13a37..fae1c03 100644 --- a/themes/gokbakja/pages/machine/report.htm +++ b/themes/gokbakja/pages/machine/report.htm @@ -92,6 +92,15 @@ function onStart(){ {% endfor %}
+
@@ -170,6 +179,7 @@ function onStart(){ № + Kody Sene Bina No Enjam No @@ -191,6 +201,7 @@ function onStart(){ № + Kody Sene Bina No Enjam No diff --git a/themes/gokbakja/pages/sewer/month.htm b/themes/gokbakja/pages/sewer/month.htm index f50b601..d96a8b7 100644 --- a/themes/gokbakja/pages/sewer/month.htm +++ b/themes/gokbakja/pages/sewer/month.htm @@ -17,10 +17,11 @@ function onStart(){ $this["year"] = $currentDate->year; } - $this["all_amount_total"] = Romanah\Gokbakja\Models\SewerProduction::whereYear('created_at', $this["year"]) - ->sum('amount'); + $sewerIds = Romanah\Gokbakja\Models\SewerProduction::whereYear('date', $this["year"])->get()->pluck("id")->toArray(); - $this["all_bag_qty_total"] = Romanah\Gokbakja\Models\SewerProduction::whereYear('created_at', $this["year"]) + $this["all_amount_total"] = Romanah\Gokbakja\Models\PivotSewer::whereIn("sewer_production_id", $sewerIds)->sum("spent_amount"); + + $this["all_bag_qty_total"] = Romanah\Gokbakja\Models\SewerProduction::whereYear('date', $this["year"]) ->sum('produced_bag_qty'); } diff --git a/themes/gokbakja/pages/sewer/new.htm b/themes/gokbakja/pages/sewer/new.htm index 1736e42..e0c164a 100644 --- a/themes/gokbakja/pages/sewer/new.htm +++ b/themes/gokbakja/pages/sewer/new.htm @@ -52,7 +52,7 @@ function onStart(){
-
+
+
+ +
+ + + +
+
+ + {% for sewer in sewers %} + + {% endfor %} + +
+ +
+ + +
+ +
+ + +
+
@@ -47,12 +81,13 @@ function onStart(){
- - - {% for sewer in sewers %} - - {% endfor %} + + + +
@@ -64,10 +99,7 @@ function onStart(){
-
- - -
+
@@ -105,10 +137,16 @@ function onStart(){ № + Önümçilik No + Halta Görnüş + Rulon Görnüş Tikinçi Senesi Çig mal mukdary Tikilen Halta + Ulanylan + Galyndy + Status Bellik @@ -120,10 +158,16 @@ function onStart(){ № + Önümçilik No + Halta Görnüş + Rulon Görnüş Tikinçi Senesi Çig mal mukdary Tikilen Halta + Ulanylan + Galyndy + Status Bellik diff --git a/themes/gokbakja/partials/sewer/row.htm b/themes/gokbakja/partials/sewer/row.htm index 0b92de9..a5bd625 100644 --- a/themes/gokbakja/partials/sewer/row.htm +++ b/themes/gokbakja/partials/sewer/row.htm @@ -5,12 +5,14 @@ function onStart (){ $no = $this->no; $year = $this->year; - $this["all_amount"] = Romanah\Gokbakja\Models\SewerProduction::whereMonth('created_at', $no) - ->whereYear('created_at', $year) - ->sum('amount'); - $this["all_bag_qty"] = Romanah\Gokbakja\Models\SewerProduction::whereMonth('created_at', $no) - ->whereYear('created_at', $year) + $sewerIds = Romanah\Gokbakja\Models\SewerProduction::whereMonth('date', $no)->whereYear('date', $year)->get()->pluck("id")->toArray(); + + $this["all_amount"] = Romanah\Gokbakja\Models\PivotSewer::whereIn("sewer_production_id", $sewerIds)->sum("spent_amount"); + + + $this["all_bag_qty"] = Romanah\Gokbakja\Models\SewerProduction::whereMonth('date', $no) + ->whereYear('date', $year) ->sum('produced_bag_qty'); }