sewer insert

This commit is contained in:
Shohrat 2023-10-21 02:54:07 +05:00
parent 00ddfba36a
commit 6967f9b66e
23 changed files with 993 additions and 97 deletions

View File

@ -41,6 +41,7 @@ class MachineProduction extends ComponentBase
// dd($machineProductions[0]->bag_size);
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td style="font-weight: bold;"> #' . ($machineProductions[$x]->id) . '</td>
<td><a href="#">' . ($machineProductions[$x]->date == null ? "" : Carbon::parse($machineProductions[$x]->date)->format('d.m.Y')) . '</a></td>
<td><a href="#" style="font-weight: bold;">' . $machineProductions[$x]->building_name . '</a></td>
<td>' . $machineProductions[$x]->machine->name . '</td>
@ -68,7 +69,9 @@ class MachineProduction extends ComponentBase
$data = post();
$machineProductions = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])->orderBy('id', 'DESC');
$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')
->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
->orderBy('id', 'DESC');
$start = Carbon::parse($data["start"])->format('Y-m-d');
$end = Carbon::parse($data["end"])->format('Y-m-d');
@ -98,22 +101,43 @@ class MachineProduction extends ComponentBase
$machineProductions->whereBetween('date', [$start, $end]);
}
$machineProductionsFiltered = $machineProductions->get();
$machineProductionsFiltered = $machineProductions->selectRaw('produced_weight - left_weight as spent')->get();
$machineProductionsSum = $machineProductions->sum("produced_weight");
$machineLeftProductionsSum = $machineProductions->sum("left_weight");
$allSpent = $machineProductionsSum - $machineLeftProductionsSum;
$html_data = '';
for ($x = 0; $x < count($machineProductionsFiltered); $x++) {
if($machineProductionsFiltered[$x]->date != null){
$dateFormat = $machineProductionsFiltered[$x]->date->format("d.m.Y");
}else{
$dateFormat = "";
}
$spent = '<span class="badge badge-soft-warning"
style="font-size: 14px;">' . number_format($machineProductionsFiltered[$x]->spent) . ' kg</span>';
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td><a href="#" style="font-weight: bold;">' . $machineProductionsFiltered[$x]->created_at->format("d.m.Y") . '</a></td>
<td><a href="#" style="font-weight: bold;">' . $dateFormat . '</a></td>
<td><a href="#" style="font-weight: bold;">' . $machineProductionsFiltered[$x]->building_name . '</a></td>
<td>' . $machineProductionsFiltered[$x]->machine->name . '</td>
<td>' . $machineProductionsFiltered[$x]->bag_size->name . '</td>
<td>' . $machineProductionsFiltered[$x]->bag_type->name . '</td>
<td><span class="badge badge-soft-success"
<td><span class="badge badge-soft-primary"
style="font-size: 14px;">' . number_format($machineProductionsFiltered[$x]->produced_weight) . ' kg</span>
</td>
<td>
'.$spent.'
</td>
<td><span class="badge badge-soft-success"
style="font-size: 14px;">' . number_format($machineProductionsFiltered[$x]->left_weight) . ' kg</span>
</td>
<td>' . $machineProductionsFiltered[$x]->employee_name . '</td>
<td>' . $machineProductionsFiltered[$x]->mechanic_name . '</td>
<td>' . $machineProductionsFiltered[$x]->note . '</td>
@ -123,10 +147,38 @@ class MachineProduction extends ComponentBase
if ($machineProductionsFiltered) {
return [
'#machine_report_datas' => $html_data,
'#all_amount' => '<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i
class="mdi mdi-bullseye-arrow me-3"></i> Jemi Öndürlen Önüm: '.number_format($machineProductionsSum).' kg</h5>
'#all_amount' => '
<div class="col-md-3">
<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i
class="mdi mdi-bullseye-arrow me-3"></i> Rulon: '.count($machineProductionsFiltered).' </h5>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i
class="mdi mdi-bullseye-arrow me-3"></i> Öndürlen: '.number_format($machineProductionsSum).' kg</h5>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-primary text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i
class="mdi mdi-bullseye-arrow me-3"></i> Sklatda: '.number_format($machineLeftProductionsSum).' kg</h5>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-danger text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i
class="mdi mdi-bullseye-arrow me-3"></i> Ulanylan: '.number_format($allSpent).' kg</h5>
</div>
</div>
</div>',
];
@ -159,6 +211,7 @@ 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();

View File

@ -100,7 +100,7 @@ class Production extends ComponentBase
// dd($productionsFiltered[0]->shift->desc);
$html_data .= '<tr>
<td style="font-weight: bold;width: 5%;">' . ($x + 1) . '</td>
<td><a href="#" style="font-weight: bold;color: #0005c5;">' . $productionsFiltered[$x]->created_at->format("d.m.Y | H:i") . '</a></td>
<td><a href="#" style="font-weight: bold;color: #0005c5;">' . $productionsFiltered[$x]->date->format("d.m.Y | H:i") . '</a></td>
<td><a href="#" style="font-weight: bold;color: #1e2038;">' . $productionsFiltered[$x]->shift->desc . '</a></td>
<td style="text-align: center;">
<span class="badge badge-soft-info"

View File

@ -10,6 +10,8 @@ use Redirect;
use Carbon\Carbon;
use Flash;
use DB;
use Romanah\Gokbakja\Models\ProductionMachine;
use Romanah\Gokbakja\Models\PivotSewer;
class Sewer extends ComponentBase
{
@ -30,24 +32,191 @@ class Sewer extends ComponentBase
// $this->sewers = $this->loadSewers();
// }
public function onModalSetSewer()
{
$data = post();
$sewerProd = SewerModel::where("id", $data["sewerId"])->with("employee", "pivot_sewer")->first();
$html_data = '<div class="modal-header">
<h5 class="modal-title" id="mySmallModalLabel">Önümçilik No #' . $sewerProd->id . ', Rulon: '.$sewerProd->pivot_sewer[0]->amount.' kg</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<form data-request="onUpdateSewerItem" method="POST" data-request-flash>
<div class="row">
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Status</label>
<select class="form-control select2" name="status">
<option value="working"'. ($sewerProd->pivot_sewer[0]->status == 'working' ? "selected" : "") .'>Işlenýär</option>
<option value="complated" '. ($sewerProd->pivot_sewer[0]->status == 'complated' ? "selected" : "") .'>Tamamlandy</option>
</select>
</div>
</div>
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Halta Ini</label>
<input type="number" name="width" step="0.01" class="form-control"
placeholder="Halta Ini" value="' . ($sewerProd->width == null ? 0 : $sewerProd->width) . '" '. ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'>
</div>
</div>
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Halta Boýy</label>
<input type="number" name="height" step="0.01" class="form-control"
placeholder="Halta Boýy" value="' . ($sewerProd->height == null ? 0 : $sewerProd->height) . '" '. ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'>
</div>
</div>
<div class="col-md-12 mt-3">
<label class="form-label">Tikinçi</label>
<input type="text" name="employee" class="form-control" value="' . $sewerProd->employee->name . '" disabled>
</div>
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Tikilen Halta</label>
<input type="number" name="produced_bag_qty" class="form-control"
placeholder="tikilen halta sany" value="' . $sewerProd->produced_bag_qty . '" '. ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'>
</div>
</div>
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Galyndy (kg) </label>
<input type="number" name="left_amount" step="0.01" class="form-control"
placeholder="Galyndy (kg)" value="' . ($sewerProd->pivot_sewer[0]->left_amount) . '" '. ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'>
</div>
</div>
public function onRender(){
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Bellik</label>
<input type="text" name="note" class="form-control" placeholder="Bellik" value="' . $sewerProd->note . '" '. ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") .'>
</div>
</div>
</div>
<input type="hidden" name="sewer_id" value="' . $data["sewerId"] . '">
<button type="submit" data-bs-dismiss="modal"
class="btn btn-primary waves-effect waves-light"
style="margin-top: 15px;width: 100%;">Üýtget</button>
</form>
</div>';
return [
'#modal-form' => $html_data,
];
}
public function onUpdateSewerItem()
{
$currentDate = Carbon::now()->timezone('UTC +05:00');
$currentDateFormat = $currentDate->format('Y-m-d');
$data = post();
$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->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){
$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();
} else {
return Flash::error("Yalnyshlyk bar!!");
return Redirect::refresh();
}
}
public function onRender()
{
$html_data = '';
$sewerDatas = SewerModel::with("employee")->orderBy('id', 'DESC')->get();
$sewerDatas = SewerModel::with(["employee", "machin_production.bag_size", "machin_production.bag_type", "machin_production.color", "pivot_sewer"])->orderBy('id', 'DESC')->get();
// dd($sewerDatas);
for ($x = 0; $x < count($sewerDatas); $x++) {
$statusTitle = '';
if($sewerDatas[$x]->pivot_sewer[0]->status == "working"){
$statusTitle = "Işlenilýär";
}else{
$statusTitle = "Tamamlandy";
}
$html_data .= '<tr>
<td style="font-weight: bold;">'.($x+1).'</td>
<td><a href="#" style="font-weight: bold;">'.$sewerDatas[$x]->employee->name.'</a></td>
<td>'.$sewerDatas[$x]->created_at->format('d.m.Y').'</td>
<td><span class="badge badge-soft-success"
style="font-size: 14px;">'.$sewerDatas[$x]->amount.' kg</span>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td style="font-weight: bold;"> #' . $sewerDatas[$x]->id . '</td>
<td><span class="badge badge-soft-primary"
style="font-size: 14px;">ini: ' . ($sewerDatas[$x]->width ?? "") . '- boyy:'. ($sewerDatas[$x]->height ?? "") .' </span>
</td>
<td> #'.$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 ?? "").'
</td>
<td><a href="#" style="font-weight: bold;">' . $sewerDatas[$x]->employee->name . '</a></td>
<td>' . $sewerDatas[$x]->created_at->format('d.m.Y') . '</td>
<td><span class="badge badge-soft-success"
style="font-size: 14px;">' . number_format($sewerDatas[$x]->pivot_sewer[0]->amount, 2) . ' kg</span>
</td>
<td>' . $sewerDatas[$x]->produced_bag_qty . '</td>
<td>' . number_format($sewerDatas[$x]->pivot_sewer[0]->spent_amount, 2) . ' kg</td>
<td>' . number_format($sewerDatas[$x]->pivot_sewer[0]->left_amount, 2) . ' kg</td>
<td><span class="badge badge-soft-warning"
style="font-size: 14px;">' . $statusTitle . '</span></td>
<td>' . $sewerDatas[$x]->note . '</td>
<td>
<div style="display: flex;justify-content: center;">
<div style="margin-right: 10px;">
<a type="button" data-request="onModalSetSewer"
data-request-data="sewerId: ' . $sewerDatas[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1"
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;">
<i class="ri-pencil-line align-middle me-2"></i> Täzele
</a>
</div>
<div>
<a type="button"
class="btn btn-danger waves-effect waves-light"
style="padding-top: 5px;padding-bottom: 5px;">
<i class="ri-close-line align-middle me-2"></i> Poz
</a>
</div>
</div>
</td>
<td>'.$sewerDatas[$x]->produced_bag_qty.'</td>
<td>'.$sewerDatas[$x]->note.'</td>
</tr>';
}
@ -77,19 +246,19 @@ class Sewer extends ComponentBase
$sewerProductions->where("employee_id", $employee);
}
if ($min){
$sewerProductions->whereRaw('produced_bag_qty >'.$min);
if ($min) {
$sewerProductions->whereRaw('produced_bag_qty >' . $min);
}
if ($max){
$sewerProductions->whereRaw('produced_bag_qty <'.$max);
if ($max) {
$sewerProductions->whereRaw('produced_bag_qty <' . $max);
}
if ($amount){
$sewerProductions->whereRaw('amount <='.$amount);
if ($amount) {
$sewerProductions->whereRaw('amount <=' . $amount);
}
if ($start != $currentDateFormat){
if ($start != $currentDateFormat) {
$sewerProductions->whereBetween('created_at', [$start, $end]);
}
@ -97,48 +266,46 @@ class Sewer extends ComponentBase
$sewerProductionsSumBagQty = $sewerProductions->sum("produced_bag_qty");
$sewerProductionsamount = $sewerProductions->sum("amount");
$html_data = '';
$html_data = '';
for ($x = 0; $x < count($sewerProductionsFiltered); $x++) {
$html_data .= '<tr>
<td style="font-weight: bold;">'.($x+1).'</td>
<td><a href="#" style="font-weight: bold;">'.$sewerProductionsFiltered[$x]->employee->name.'</a></td>
<td>'.$sewerProductionsFiltered[$x]->created_at->format('d.m.Y').'</td>
for ($x = 0; $x < count($sewerProductionsFiltered); $x++) {
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td><a href="#" style="font-weight: bold;">' . $sewerProductionsFiltered[$x]->employee->name . '</a></td>
<td>' . $sewerProductionsFiltered[$x]->created_at->format('d.m.Y') . '</td>
<td><span class="badge badge-soft-success"
style="font-size: 14px;">'.$sewerProductionsFiltered[$x]->amount.' kg</span>
style="font-size: 14px;">' . $sewerProductionsFiltered[$x]->amount . ' kg</span>
</td>
<td>'.$sewerProductionsFiltered[$x]->produced_bag_qty.'</td>
<td>'.$sewerProductionsFiltered[$x]->note.'</td>
<td>' . $sewerProductionsFiltered[$x]->produced_bag_qty . '</td>
<td>' . $sewerProductionsFiltered[$x]->note . '</td>
</tr>';
}
}
if ($sewerProductionsFiltered) {
return [
'#sewer_report_datas' => $html_data,
'#all_amount' => '<div class="col-md-6">
if ($sewerProductionsFiltered) {
return [
'#sewer_report_datas' => $html_data,
'#all_amount' => '<div class="col-md-6">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Tikinçiler Boýunça Umumy</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
</div>
<div class="col-md-3">
<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i> Jemi Dikilen Halta: '.number_format($sewerProductionsSumBagQty).' sany</h5>
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i> Jemi Dikilen Halta: ' . number_format($sewerProductionsSumBagQty) . ' sany</h5>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i> Jemi Sarp Edilen Çig mal: '.number_format($sewerProductionsamount).' kg</h5>
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i> Jemi Sarp Edilen Çig mal: ' . number_format($sewerProductionsamount) . ' kg</h5>
</div>
</div>
</div>',
];
} else {
Flash::error("Yalnyshlyk bar!!");
}
];
} else {
Flash::error("Yalnyshlyk bar!!");
}
}
public function onCreateSewerProduction()
@ -149,43 +316,47 @@ class Sewer extends ComponentBase
$data = post();
$machineProduction = ProductionMachine::where("id", $data["machine_production_id"])->first();
$machineProductionSpent = PivotSewer::where("machine_production_id", $data["machine_production_id"])->sum('spent_amount');
$leftAmount = 0;
if($machineProduction->produced_weight > $machineProductionSpent){
$calcLeft = ((float) $machineProduction->produced_weight - (float) $machineProductionSpent);
$leftAmount = $calcLeft;
}elseif($machineProduction->produced_weight == $machineProductionSpent){
$leftAmount = 0;
}else{
$leftAmount = 0;
}
// dd($leftAmount);
$createSewer = new SewerModel();
$createSewer->employee_id = $data["employee_id"];
$createSewer->amount = $data["amount"];
$createSewer->produced_bag_qty = $data["produced_bag_qty"];
$createSewer->note = $data["note"];
$createSewer->produced_bag_qty = 0;
$createSewer->note = $data["note"] ?? '';
$createSewer->machine_production_id = $data["machine_production_id"];
$createSewer->width = (float) $data["width"];
$createSewer->height = (float) $data["height"];
$createSewer->save();
$createPivotSewer = new PivotSewer();
$createPivotSewer->machine_production_id = $createSewer->machine_production_id;
$createPivotSewer->sewer_production_id = $createSewer->id;
$createPivotSewer->left_amount = 0;
$createPivotSewer->amount = $leftAmount;
$createPivotSewer->save();
$html_data = '';
$sewerDatas = SewerModel::with("employee")->orderBy('id', 'DESC')->get();
if ($createSewer && $createPivotSewer) {
for ($x = 0; $x < count($sewerDatas); $x++) {
$html_data .= '<tr>
<td style="font-weight: bold;">'.($x+1).'</td>
<td><a href="#" style="font-weight: bold;">'.$sewerDatas[$x]->employee->name.'</a></td>
<td>'.$sewerDatas[$x]->created_at->format('d.m.Y').'</td>
<td><span class="badge badge-soft-success"
style="font-size: 14px;">'.$sewerDatas[$x]->amount.' kg</span>
</td>
<td>'.$sewerDatas[$x]->produced_bag_qty.'</td>
<td>'.$sewerDatas[$x]->note.'</td>
</tr>';
}
if($createSewer){
Flash::success("Hasabat Ustunlikli Goşuldy");
return [
'#sewer_datas' => $html_data,
];
}else{
Flash::success("Maglumatlar Ustunlikli Goshuldy");
return Redirect::refresh();
} else {
return Flash::error("Yalnyshlyk bar!!");
return Redirect::refresh();
}
}
}

View File

@ -0,0 +1,37 @@
<?php namespace Romanah\Gokbakja\Models;
use Model;
/**
* Model
*/
class PivotSewer extends Model
{
use \October\Rain\Database\Traits\Validation;
use \October\Rain\Database\Traits\SoftDelete;
protected $dates = ['deleted_at'];
public $belongsTo = [
'sewer_production' => [
'Romanah\Gokbakja\Models\SewerProduction',
'key' => 'sewer_production_id'
],
'machin_production' => [
'Romanah\Gokbakja\Models\ProductionMachine',
'key' => 'machine_production_id'
],
];
/**
* @var string The database table used by the model.
*/
public $table = 'romanah_gokbakja_pivot_sewer';
/**
* @var array Validation rules
*/
public $rules = [
];
}

View File

@ -13,6 +13,17 @@ class ProductionMachine extends Model
protected $dates = ['deleted_at', 'date'];
public $hasMany = [
'sewer_productions' => [
'Romanah\Gokbakja\Models\SewerProduction',
'key' => 'machine_production_id'
],
'pivot_sewer' => [
'Romanah\Gokbakja\Models\PivotSewer',
'key' => 'machine_production_id'
],
];
public $belongsTo = [
'bag_type' => [
'Romanah\Gokbakja\Models\BagType',

View File

@ -13,11 +13,22 @@ class SewerProduction extends Model
protected $dates = ['deleted_at'];
public $hasMany = [
'pivot_sewer' => [
'Romanah\Gokbakja\Models\PivotSewer',
'key' => 'sewer_production_id'
],
];
public $belongsTo = [
'employee' => [
'Romanah\Gokbakja\Models\Employee',
'key' => 'employee_id'
],
'machin_production' => [
'Romanah\Gokbakja\Models\ProductionMachine',
'key' => 'machine_production_id'
],
];
/**

View File

@ -0,0 +1,28 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateRomanahGokbakjaPivotSewer extends Migration
{
public function up()
{
Schema::create('romanah_gokbakja_pivot_sewer', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->integer('sewer_production_id');
$table->integer('machine_production_id');
$table->string('status')->default('working');
$table->string('note')->nullable();
});
}
public function down()
{
Schema::dropIfExists('romanah_gokbakja_pivot_sewer');
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -240,3 +240,36 @@
1.0.81:
- 'Updated table romanah_gokbakja_production_calculate'
- builder_table_update_romanah_gokbakja_production_calculate_6.php
1.0.82:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_7.php
1.0.83:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_8.php
1.0.84:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_9.php
1.0.85:
- 'Updated table romanah_gokbakja_sewer_production'
- builder_table_update_romanah_gokbakja_sewer_production.php
1.0.86:
- 'Updated table romanah_gokbakja_sewer_production'
- builder_table_update_romanah_gokbakja_sewer_production_2.php
1.0.87:
- 'Created table romanah_gokbakja_pivot_sewer'
- builder_table_create_romanah_gokbakja_pivot_sewer.php
1.0.88:
- 'Updated table romanah_gokbakja_sewer_production'
- builder_table_update_romanah_gokbakja_sewer_production_3.php
1.0.89:
- 'Updated table romanah_gokbakja_pivot_sewer'
- builder_table_update_romanah_gokbakja_pivot_sewer.php
1.0.90:
- 'Updated table romanah_gokbakja_sewer_production'
- builder_table_update_romanah_gokbakja_sewer_production_4.php
1.0.91:
- 'Updated table romanah_gokbakja_pivot_sewer'
- builder_table_update_romanah_gokbakja_pivot_sewer_2.php
1.0.92:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_10.php

View File

@ -171,6 +171,15 @@ items:
isHidden: '0'
cssClass: ''
isExternal: '0'
-
title: 'Rulonlar Sklady'
type: cms-page
code: ''
reference: machine/rulon
viewBag:
isHidden: '1'
cssClass: ''
isExternal: '0'
-
title: Hasabat
nesting: null
@ -305,9 +314,13 @@ items:
isExternal: '0'
-
title: Tölegler
nesting: null
type: cms-page
url: null
code: ''
reference: orders/payment-report
cmsPage: null
replace: null
viewBag:
isHidden: '1'
cssClass: ''

View File

@ -173,6 +173,7 @@ pageNumber = "{{ :page }}"
<thead>
<tr>
<th style="width: 5%;"></th>
<th>Önümçilik Kody</th>
<th>Öndürlen Sene</th>
<th>Bina No</th>
<th>Enjam No</th>
@ -192,6 +193,7 @@ pageNumber = "{{ :page }}"
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Önümçilik Kody</th>
<th>Öndürlen Sene</th>
<th>Bina No</th>
<th>Enjam No</th>

View File

@ -82,6 +82,16 @@ function onStart(){
<div class="card-body">
<form data-request="onReport" data-request-flash>
<div class="row">
<div class="col">
<label class="form-label">Enjam Saýlaň</label>
<select class="form-control select2" name="machine_id" id="machine_id">
<option value="0">Saýla</option>
{% for machine in machines %}
<option value="{{machine.id}}">{{machine.name}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<div>
<label class="form-label">Seneleri Saýlaň</label>
@ -96,15 +106,6 @@ function onStart(){
</div>
</div>
</div>
<div class="col">
<label class="form-label">Enjam Saýlaň</label>
<select class="form-control select2" name="machine_id" id="machine_id">
<option value="0">Saýla</option>
{% for machine in machines %}
<option value="{{machine.id}}">{{machine.name}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<label class="form-label">Mehanik Saýlaň</label>
<select class="form-control select2" name="mechanic_id" id="mechanic_id">
@ -154,16 +155,13 @@ function onStart(){
<div class="col-md-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="row" id="all_amount">
<div class="col-md-6">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Enjamlar Boýunça Umumy</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
</div>
<div class="col-md-2">
</div>
<div class="col-md-4" id="all_amount">
</div>
</div>
@ -178,6 +176,8 @@ function onStart(){
<th>Ölçegi</th>
<th>Görnüşi</th>
<th>Önen Önüm (kg)</th>
<th>Ulanylan Önüm (kg)</th>
<th>Galan Önüm (kg)</th>
<th>Ady Familiýasy</th>
<th>Mehanik</th>
<th>Bellik</th>
@ -197,6 +197,8 @@ function onStart(){
<th>Ölçegi</th>
<th>Görnüşi</th>
<th>Önen Önüm (kg)</th>
<th>Ulanylan Önüm (kg)</th>
<th>Galan Önüm (kg)</th>
<th>Ady Familiýasy</th>
<th>Mehanik</th>
<th>Bellik</th>

View File

@ -0,0 +1,224 @@
title = "machine/rulon"
url = "/machine/rulon"
layout = "platform_main"
is_hidden = 0
[builderList]
modelClass = "Romanah\Gokbakja\Models\Building"
scope = "-"
scopeValue = "{{ :scope }}"
displayColumn = "id"
noRecordsMessage = "No records found"
detailsPage = "-"
detailsUrlParameter = "id"
pageNumber = "{{ :page }}"
[builderList builderList2]
modelClass = "Romanah\Gokbakja\Models\Machine"
scope = "-"
scopeValue = "{{ :scope }}"
displayColumn = "id"
noRecordsMessage = "No records found"
detailsPage = "-"
detailsUrlParameter = "id"
pageNumber = "{{ :page }}"
[builderList builderList3]
modelClass = "Romanah\Gokbakja\Models\BagSize"
scope = "-"
scopeValue = "{{ :scope }}"
displayColumn = "id"
noRecordsMessage = "No records found"
detailsPage = "-"
detailsUrlParameter = "id"
pageNumber = "{{ :page }}"
[builderList builderList4]
modelClass = "Romanah\Gokbakja\Models\BagType"
scope = "-"
scopeValue = "{{ :scope }}"
displayColumn = "id"
noRecordsMessage = "No records found"
detailsPage = "-"
detailsUrlParameter = "id"
pageNumber = "{{ :page }}"
[machineProduction]
==
<?php
function onStart(){
$this["shifts"] = Romanah\Gokbakja\Models\Shift::get();
$this["machines"] = Romanah\Gokbakja\Models\Machine::all();
$this["mechanics"] = Romanah\Gokbakja\Models\Employee::where("is_mechanic", 1)->get();
$this["m_productions"] = Romanah\Gokbakja\Models\ProductionMachine::select('id', 'type_id', 'size_id', 'machine_id', 'produced_weight', 'employee_id', 'mechanic_id', 'note', 'date', 'color_id', 'left_weight')
->selectRaw('produced_weight - left_weight as spent')->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 data-request="onReport" data-request-flash>
<div class="row">
<div class="col">
<label class="form-label">Enjam Saýlaň</label>
<select class="form-control select2" name="machine_id" id="machine_id">
<option value="0">Saýla</option>
{% for machine in machines %}
<option value="{{machine.id}}">{{machine.name}}</option>
{% endfor %}
</select>
</div>
<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">
<label class="form-label">Mehanik Saýlaň</label>
<select class="form-control select2" name="mechanic_id" id="mechanic_id">
<option value="0">Saýla</option>
{% for mechanic in mechanics %}
<option value="{{mechanic.id}}">{{mechanic.name}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<label class="form-label">Ölçeg Saýlaň</label>
<select class="form-control select2" name="size_id">
<option value="0">Saýla</option>
{% for size in sizes %}
<option value="{{size.id}}">{{size.name}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<label class="form-label">Görnüş Saýlaň</label>
<select class="form-control select2" name="type_id">
<option value="0">Görnüş Saýla</option>
{% for type in types %}
<option value="{{type.id}}">{{type.name}}</option>
{% endfor %}
</select>
</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 class="col-md-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-6">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Rulonlar boýunça</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
</div>
<!-- <div class="col-md-6" style="text-align: right;">
<a class="btn btn-primary" data-bs-toggle="collapse" href="#multiCollapseExample1"
role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Täze
Maglumat</a>
</div> -->
</div>
<h1>{{m_productions}}</h1>
<table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap"
style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead>
<tr>
<th style="width: 5%;"></th>
<th>Ady</th>
<th>Rulon Ölçegi</th>
<th>Rulon Görnüşi</th>
<th>Rulon Reňki</th>
<th>Önen Önüm (kg)</th>
<th>Ady Familiýasy</th>
<th>Mehanik</th>
<th>Bellik</th>
<!-- <th>Настройки</th> -->
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Öndürlen Sene</th>
<th>Bina No</th>
<th>Enjam No</th>
<th>Rulon Ölçegi</th>
<th>Rulon Görnüşi</th>
<th>Rulon Reňki</th>
<th>Önen Önüm (kg)</th>
<th>Ady Familiýasy</th>
<th>Mehanik</th>
<th>Bellik</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
{% 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 %}
{% partial 'dataTableJs' %}

View File

@ -8,6 +8,26 @@ is_hidden = 0
<?php
function onStart(){
$this["employees"] = Romanah\Gokbakja\Models\Employee::where("status", 1)->where("is_sewer", 1)->get();
$pivotSewersWorking = Romanah\Gokbakja\Models\PivotSewer::select('id', 'status', 'machine_production_id')
->where('status', 'working')
->get()
->pluck('machine_production_id')
->toArray();
//dd($pivotSewersWorking);
$this["machineProductions"] = Romanah\Gokbakja\Models\ProductionMachine::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
->whereNotIn('id', $pivotSewersWorking)
->where('is_finished', '!=', 1)
->withCount([
'pivot_sewer AS leftSum' => function ($query) {
$query->select(DB::raw("(amount - SUM(spent_amount)) as leftSum"))->where('status', 'complated');
}
])
->orderBy('id', 'DESC')
->get();
}
?>
==
@ -24,6 +44,7 @@ function onStart(){
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="collapse multi-collapse" id="multiCollapseExample1">
<form data-request="onCreateSewerProduction" data-request-flash>
@ -31,7 +52,7 @@ function onStart(){
<div class="card">
<div class="card-body">
<div class="row">
<div class="col">
<div class="col-3">
<label class="form-label">Tikinçi Saýlaň</label>
<select class="form-control select2" name="employee_id">
<option value="0">Saýla</option>
@ -40,12 +61,42 @@ function onStart(){
{% endfor %}
</select>
</div>
<div class="col-3">
<label class="form-label">Rulon Saýlaň</label>
<select class="form-control select2" name="machine_production_id">
<option value="0">Saýla</option>
{% for machineProduction in machineProductions %}
<option value="{{machineProduction.id}}">
#{{machineProduction.id}}-
{{machineProduction.bag_size.width}} x
{{machineProduction.bag_size.height}} m2,
{{machineProduction.bag_type.name}}, {{machineProduction.color.name}}
{% if machineProduction.leftSum != 0 %}
({{machineProduction.leftSum|number_format(2)}} kg galyndy)
{% else %}
({{machineProduction.produced_weight|number_format(2)}} kg)
{% endif %}
</option>
{% endfor %}
</select>
</div>
<div class="col">
<div>
<label class="form-label">Çig mal mukdary</label>
<label class="form-label">Halta Ini</label>
<input type="number" name="amount" class="form-control"
placeholder="Çig mal mukdary kg">
<input type="number" name="width" step="0.01" class="form-control"
placeholder="Halta Ini">
</div>
</div>
<div class="col">
<div>
<label class="form-label">Halta Boýy</label>
<input type="number" name="height" step="0.01" class="form-control"
placeholder="Halta Boýy">
</div>
</div>
<div class="col">
@ -56,12 +107,12 @@ function onStart(){
placeholder="tikilen halta sany">
</div>
</div>
<div class="col">
<div>
<label class="form-label">Bellik</label>
<input type="text" name="note" class="form-control"
placeholder="Bellik">
<input type="text" name="note" class="form-control" placeholder="Bellik">
</div>
</div>
@ -97,17 +148,25 @@ function onStart(){
</div>
</div>
<!-- <h1>{{machineProductions}}</h1> -->
<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 style="width: 5%;"></th>
<th>Önümçilik No</th>
<th>Halta Görnüş</th>
<th>Rulon Görnüş</th>
<th>Tikinçi</th>
<th>Senesi</th>
<th>Çig mal mukdary</th>
<th>Tikilen Halta</th>
<th>Ulanylan</th>
<th>Galyndy</th>
<th>Status</th>
<th>Bellik</th>
<th>Sazlamalar</th>
<!-- <th>Настройки</th> -->
</tr>
</thead>
@ -119,18 +178,34 @@ function onStart(){
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Önümçilik No</th>
<th>Halta Görnüş</th>
<th>Rulon Görnüş</th>
<th>Tikinçi</th>
<th>Senesi</th>
<th>Çig mal mukdary</th>
<th>Tikilen Halta</th>
<th>Ulanylan</th>
<th>Galyndy</th>
<th>Status</th>
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
</tfoot>
</table>
</div>
<div class="modal fade bs-example-modal-sm-1" tabindex="-1" role="dialog"
aria-labelledby="mySmallModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" id="modal-form">
</div>
</div>
</div>
</div>
</div>
</div>