acception settings
This commit is contained in:
parent
bda92ad5c1
commit
c656a5b6c8
|
|
@ -11,7 +11,8 @@ use Redirect;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Flash;
|
use Flash;
|
||||||
// use Illuminate\Validation\Validator;
|
// use Illuminate\Validation\Validator;
|
||||||
use \Validator;
|
use Validator;
|
||||||
|
use ValidationException;
|
||||||
use DB;
|
use DB;
|
||||||
use Romanah\Gokbakja\Models\BagColor;
|
use Romanah\Gokbakja\Models\BagColor;
|
||||||
use Romanah\Gokbakja\Models\BagSize;
|
use Romanah\Gokbakja\Models\BagSize;
|
||||||
|
|
@ -39,7 +40,7 @@ class MachineProduction extends ComponentBase
|
||||||
$data = post();
|
$data = post();
|
||||||
$machinProdId = $data["machineProdId"];
|
$machinProdId = $data["machineProdId"];
|
||||||
|
|
||||||
$productions = PivotSewer::whereHas("rulon_action", function($q) use($machinProdId){
|
$productions = PivotSewer::whereHas("rulon_action", function ($q) use ($machinProdId) {
|
||||||
$q->where('product_id', $machinProdId);
|
$q->where('product_id', $machinProdId);
|
||||||
})->with(["sewer_production", "rulon_action.product"])->get();
|
})->with(["sewer_production", "rulon_action.product"])->get();
|
||||||
|
|
||||||
|
|
@ -51,7 +52,7 @@ class MachineProduction extends ComponentBase
|
||||||
|
|
||||||
//dd(count($productions));
|
//dd(count($productions));
|
||||||
|
|
||||||
if (count($productions) > 0){
|
if (count($productions) > 0) {
|
||||||
$html_data = '<div class="modal-header">
|
$html_data = '<div class="modal-header">
|
||||||
<h5 class="modal-title" id="mySmallModalLabel">#Rulon' . $machinProdId . ' Agramy: ' . $machineProductionData->produced_weight . ' kg</h5>
|
<h5 class="modal-title" id="mySmallModalLabel">#Rulon' . $machinProdId . ' Agramy: ' . $machineProductionData->produced_weight . ' kg</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal"
|
<button type="button" class="btn-close" data-bs-dismiss="modal"
|
||||||
|
|
@ -104,7 +105,7 @@ class MachineProduction extends ComponentBase
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
||||||
$html_data .= '</table></div>';
|
$html_data .= '</table></div>';
|
||||||
}else{
|
} else {
|
||||||
$html_data = '<div class="modal-header">
|
$html_data = '<div class="modal-header">
|
||||||
<h5 class="modal-title" id="mySmallModalLabel">Maglumat Yok</h5>
|
<h5 class="modal-title" id="mySmallModalLabel">Maglumat Yok</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal"
|
<button type="button" class="btn-close" data-bs-dismiss="modal"
|
||||||
|
|
@ -146,88 +147,88 @@ class MachineProduction extends ComponentBase
|
||||||
|
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Jogapkär</label>
|
<label style="color: black;">Jogapkär</label>
|
||||||
<input type="text" name="employee_name" class="form-control" placeholder="Jogapkär" value="'.($production->employee_name ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
<input type="text" name="employee_name" class="form-control" placeholder="Jogapkär" value="' . ($production->employee_name ?? "") . '" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Enjam</label>
|
<label style="color: black;">Enjam</label>
|
||||||
<select class="form-control select2" name="machine_id" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
<select class="form-control select2" name="machine_id" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
<option value="0">Enjam Saýla</option>';
|
<option value="0">Enjam Saýla</option>';
|
||||||
for ($x = 0; $x < count($machines); $x++) {
|
for ($x = 0; $x < count($machines); $x++) {
|
||||||
$html_data .='<option value="'.$machines[$x]->id.'" '.($production->machine_id == $machines[$x]->id ? 'selected' : '').'>'.$machines[$x]->name.'</option>';
|
$html_data .= '<option value="' . $machines[$x]->id . '" ' . ($production->machine_id == $machines[$x]->id ? 'selected' : '') . '>' . $machines[$x]->name . '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html_data .='</select>
|
$html_data .= '</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Gat sany</label>
|
<label style="color: black;">Gat sany</label>
|
||||||
<select class="form-control select2" name="layer" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
<select class="form-control select2" name="layer" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
<option value="1">Rulon Gat sany</option>
|
<option value="1">Rulon Gat sany</option>
|
||||||
|
|
||||||
<option value="1" '.($production->layer == 1 ? 'selected' : '').'>1 gat</option>
|
<option value="1" ' . ($production->layer == 1 ? 'selected' : '') . '>1 gat</option>
|
||||||
<option value="2" '.($production->layer == 2 ? 'selected' : '').'>2 gat</option>
|
<option value="2" ' . ($production->layer == 2 ? 'selected' : '') . '>2 gat</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Sene</label>
|
<label style="color: black;">Sene</label>
|
||||||
<input type="date" name="date" class="form-control" placeholder="Sene" value="'.($production->date != null ? Carbon::parse($production->date)->format('Y-m-d') : "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
<input type="date" name="date" class="form-control" placeholder="Sene" value="' . ($production->date != null ? Carbon::parse($production->date)->format('Y-m-d') : "") . '" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Görnüşi</label>
|
<label style="color: black;">Görnüşi</label>
|
||||||
<select class="form-control select2" name="type_id" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
<select class="form-control select2" name="type_id" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
<option value="0">Görnüş Saýla</option>';
|
<option value="0">Görnüş Saýla</option>';
|
||||||
for ($x = 0; $x < count($types); $x++) {
|
for ($x = 0; $x < count($types); $x++) {
|
||||||
$html_data .='<option value="'.$types[$x]->id.'" '.($production->type_id == $types[$x]->id ? 'selected' : '').'>'.$types[$x]->name.'</option>';
|
$html_data .= '<option value="' . $types[$x]->id . '" ' . ($production->type_id == $types[$x]->id ? 'selected' : '') . '>' . $types[$x]->name . '</option>';
|
||||||
}
|
}
|
||||||
$html_data .='</select>
|
$html_data .= '</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Ini</label>
|
<label style="color: black;">Ini</label>
|
||||||
<input type="number" name="width" step="0.01" class="form-control"
|
<input type="number" name="width" step="0.01" class="form-control"
|
||||||
placeholder="Ini" value="'.($production->width ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
placeholder="Ini" value="' . ($production->width ?? "") . '" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Gram</label>
|
<label style="color: black;">Gram</label>
|
||||||
<input type="number" name="gram" step="0.01" class="form-control"
|
<input type="number" name="gram" step="0.01" class="form-control"
|
||||||
placeholder="Gram" value="'.($production->gram ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
placeholder="Gram" value="' . ($production->gram ?? "") . '" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Reňki</label>
|
<label style="color: black;">Reňki</label>
|
||||||
<select class="form-control select2" name="color_id" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
<select class="form-control select2" name="color_id" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
<option value="0">Reňk Saýla</option>';
|
<option value="0">Reňk Saýla</option>';
|
||||||
for ($x = 0; $x < count($colors); $x++) {
|
for ($x = 0; $x < count($colors); $x++) {
|
||||||
$html_data .='<option value="'.$colors[$x]->id.'" '.($production->color_id == $colors[$x]->id ? 'selected' : '').'>'.$colors[$x]->name.'</option>';
|
$html_data .= '<option value="' . $colors[$x]->id . '" ' . ($production->color_id == $colors[$x]->id ? 'selected' : '') . '>' . $colors[$x]->name . '</option>';
|
||||||
}
|
}
|
||||||
$html_data .='</select>
|
$html_data .= '</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Öndürlen önüm (kg)</label>
|
<label style="color: black;">Öndürlen önüm (kg)</label>
|
||||||
<input type="number" name="produced_weight" step="0.01" class="form-control"
|
<input type="number" name="produced_weight" step="0.01" class="form-control"
|
||||||
placeholder="Mukdar (kg)" value="'.($production->produced_weight ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
placeholder="Mukdar (kg)" value="' . ($production->produced_weight ?? "") . '" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Brutto (kg)</label>
|
<label style="color: black;">Brutto (kg)</label>
|
||||||
<input type="number" name="brutto_kg" step="0.01" class="form-control"
|
<input type="number" name="brutto_kg" step="0.01" class="form-control"
|
||||||
placeholder="Brutto (kg)" value="'.($production->brutto_kg ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
placeholder="Brutto (kg)" value="' . ($production->brutto_kg ?? "") . '" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Othod (kg)</label>
|
<label style="color: black;">Othod (kg)</label>
|
||||||
<input type="number" name="defective_weight" step="0.01" class="form-control"
|
<input type="number" name="defective_weight" step="0.01" class="form-control"
|
||||||
placeholder="Othod (kg)" value="'.($production->defective_weight ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
placeholder="Othod (kg)" value="' . ($production->defective_weight ?? "") . '" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<label style="color: black;">Bellik</label>
|
<label style="color: black;">Bellik</label>
|
||||||
<input type="text" name="note" class="form-control" placeholder="Bellik" value="'.$production->note.'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
|
<input type="text" name="note" class="form-control" placeholder="Bellik" value="' . $production->note . '" ' . ($production->user_id != $user->id ? 'disabled' : '') . '>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="production_id" value="'.$production->id.'">
|
<input type="hidden" name="production_id" value="' . $production->id . '">
|
||||||
<div class="col-md-12 mt-3">
|
<div class="col-md-12 mt-3">
|
||||||
<button '.($production->user_id != $user->id ? 'disabled' : '') .' type="submit" class="btn btn-primary waves-effect waves-light"
|
<button ' . ($production->user_id != $user->id ? 'disabled' : '') . ' type="submit" class="btn btn-primary waves-effect waves-light"
|
||||||
style="width: 100%;">Üýtget</button>
|
style="width: 100%;">Üýtget</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -241,7 +242,8 @@ class MachineProduction extends ComponentBase
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onDeleteProductionMachine(){
|
public function onDeleteProductionMachine()
|
||||||
|
{
|
||||||
$id = post('production_id');
|
$id = post('production_id');
|
||||||
|
|
||||||
$productionDelete = ProductionMachineModel::Find($id);
|
$productionDelete = ProductionMachineModel::Find($id);
|
||||||
|
|
@ -276,19 +278,17 @@ class MachineProduction extends ComponentBase
|
||||||
|
|
||||||
$editBtn = '';
|
$editBtn = '';
|
||||||
|
|
||||||
if($machineProductions[$x]->user_id != $user->id){
|
if ($machineProductions[$x]->user_id != $user->id) {
|
||||||
$editBtn = '<a href="#" style="font-weight: bold;color: darkred;"> Size degişli däl </a>';
|
$editBtn = '<a href="#" style="font-weight: bold;color: darkred;"> Size degişli däl </a>';
|
||||||
}else{
|
} else {
|
||||||
if(!$inStock){
|
if (!$inStock) {
|
||||||
|
|
||||||
$editBtn = $crudProductionRulonq ? '<button data-request="onSetFormUpdate" data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg" data-request-data="machineProdId: ' . $machineProductions[$x]->id . '" type="button" class="btn btn-warning waves-light waves-effect"><i class="fa fa-pen"></i></button> ' : '';
|
$editBtn = $crudProductionRulonq ? '<button data-request="onSetFormUpdate" data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg" data-request-data="machineProdId: ' . $machineProductions[$x]->id . '" type="button" class="btn btn-warning waves-light waves-effect"><i class="fa fa-pen"></i></button> ' : '';
|
||||||
|
|
||||||
$editBtn .= $inboxProductionRulonq ? '<button data-request="onCreateAction" data-request-data="type: '.((string) "'inbox'") .', itemId: '.$machineProductions[$x]->id.'" data-request-confirm="Bu harydy sklada salmak iskleýäňizmi?" type="button" class="btn btn-success waves-light waves-effect"><i class="fa ri-upload-line"></i></button>' : '';
|
$editBtn .= $inboxProductionRulonq ? '<button data-request="onCreateAction" data-request-data="type: ' . ((string) "'inbox'") . ', itemId: ' . $machineProductions[$x]->id . '" data-request-confirm="Bu harydy sklada salmak iskleýäňizmi?" type="button" class="btn btn-success waves-light waves-effect"><i class="fa ri-upload-line"></i></button>' : '';
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
|
|
||||||
$editBtn = '<a href="#" style="font-weight: bold;color: darkgreen;"> Sklada salyndy </a>';
|
$editBtn = '<a href="#" style="font-weight: bold;color: darkgreen;"> Sklada salyndy </a>';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// dd($machineProductions[0]->bag_size);
|
// dd($machineProductions[0]->bag_size);
|
||||||
|
|
@ -298,12 +298,12 @@ class MachineProduction extends ComponentBase
|
||||||
data-request-data="machineProdId: ' . $machineProductions[$x]->id . '"
|
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) . '</a></td>
|
data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg" style="color: darkblue;"> #Rulon' . ($machineProductions[$x]->id) . '</a></td>
|
||||||
<td><a href="#">' . ($machineProductions[$x]->date == null ? "" : Carbon::parse($machineProductions[$x]->date)->format('d.m.Y')) . '</a></td>
|
<td><a href="#">' . ($machineProductions[$x]->date == null ? "" : Carbon::parse($machineProductions[$x]->date)->format('d.m.Y')) . '</a></td>
|
||||||
<td>' . ($machineProductions[$x]->shift->desc ?? ''). '</td>
|
<td>' . ($machineProductions[$x]->shift->desc ?? '') . '</td>
|
||||||
<td>' . $machineProductions[$x]->machine->name . '</td>
|
<td>' . $machineProductions[$x]->machine->name . '</td>
|
||||||
<td>' . $machineProductions[$x]->width . '</td>
|
<td>' . $machineProductions[$x]->width . '</td>
|
||||||
<td>' . $machineProductions[$x]->gram . ' m2</td>
|
<td>' . $machineProductions[$x]->gram . ' m2</td>
|
||||||
<td>' . $machineProductions[$x]->bag_type->name . '</td>
|
<td>' . $machineProductions[$x]->bag_type->name . '</td>
|
||||||
<td>' . ($machineProductions[$x]->color->name ?? "") . ', '. $machineProductions[$x]->layer .' gat</td>
|
<td>' . ($machineProductions[$x]->color->name ?? "") . ', ' . $machineProductions[$x]->layer . ' gat</td>
|
||||||
<td><span class="badge badge-soft-success"
|
<td><span class="badge badge-soft-success"
|
||||||
style="font-size: 14px;">' . number_format($machineProductions[$x]->produced_weight, 2) . ' kg</span>
|
style="font-size: 14px;">' . number_format($machineProductions[$x]->produced_weight, 2) . ' kg</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -318,7 +318,7 @@ class MachineProduction extends ComponentBase
|
||||||
</td>
|
</td>
|
||||||
<td>' . $machineProductions[$x]->employee_name . '</td>
|
<td>' . $machineProductions[$x]->employee_name . '</td>
|
||||||
<td>' . $machineProductions[$x]->note . '</td>
|
<td>' . $machineProductions[$x]->note . '</td>
|
||||||
<td> '. $editBtn.' </td>
|
<td> ' . $editBtn . ' </td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -425,7 +425,7 @@ class MachineProduction extends ComponentBase
|
||||||
<td>' . $machineProductionsFiltered[$x]->width . '</td>
|
<td>' . $machineProductionsFiltered[$x]->width . '</td>
|
||||||
<td>' . $machineProductionsFiltered[$x]->gram . ' m2</td>
|
<td>' . $machineProductionsFiltered[$x]->gram . ' m2</td>
|
||||||
<td>' . $machineProductionsFiltered[$x]->bag_type->name . '</td>
|
<td>' . $machineProductionsFiltered[$x]->bag_type->name . '</td>
|
||||||
<td>' . ($machineProductionsFiltered[$x]->color->name ?? "") . ', '. $machineProductionsFiltered[$x]->layer .' gat</td>
|
<td>' . ($machineProductionsFiltered[$x]->color->name ?? "") . ', ' . $machineProductionsFiltered[$x]->layer . ' gat</td>
|
||||||
<td><span class="badge badge-soft-success"
|
<td><span class="badge badge-soft-success"
|
||||||
style="font-size: 14px;">' . number_format($machineProductionsFiltered[$x]->produced_weight, 2) . ' kg</span>
|
style="font-size: 14px;">' . number_format($machineProductionsFiltered[$x]->produced_weight, 2) . ' kg</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -450,7 +450,7 @@ class MachineProduction extends ComponentBase
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="card bg-info text-white-50">
|
<div class="card bg-info text-white-50">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;">Öndürlen Rulon: ' . count($machineProductionsFiltered) .'</h5>
|
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;">Öndürlen Rulon: ' . count($machineProductionsFiltered) . '</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -485,22 +485,23 @@ class MachineProduction extends ComponentBase
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function onUpdateMachineProduction(){
|
public function onUpdateMachineProduction()
|
||||||
|
{
|
||||||
|
|
||||||
$user = \Auth::user();
|
$user = \Auth::user();
|
||||||
|
|
||||||
$data = post();
|
$data = post();
|
||||||
$oldData = ProductionMachineModel::where("id", $data["production_id"])
|
$oldData = ProductionMachineModel::where("id", $data["production_id"])
|
||||||
->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
|
->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$updateProductionMachine = ProductionMachineModel::where("id", $data["production_id"])
|
$updateProductionMachine = ProductionMachineModel::where("id", $data["production_id"])
|
||||||
->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
|
->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
$metrOfRulon = (float)((float)($data["gram"] / 100) * ($data["width"] / 100)) * (int)$data["layer"];
|
$metrOfRulon = (float)((float)($data["gram"] / 100) * ($data["width"] / 100)) * (int)$data["layer"];
|
||||||
|
|
@ -544,7 +545,16 @@ class MachineProduction extends ComponentBase
|
||||||
Flash::error("Yalnyshlyk bar!!");
|
Flash::error("Yalnyshlyk bar!!");
|
||||||
return Redirect::refresh();
|
return Redirect::refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function validateForm($data, $rules)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($data, $rules);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
throw new ValidationException($validator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onCreateMachineProduction()
|
public function onCreateMachineProduction()
|
||||||
|
|
@ -553,53 +563,75 @@ class MachineProduction extends ComponentBase
|
||||||
|
|
||||||
$data = post();
|
$data = post();
|
||||||
|
|
||||||
|
|
||||||
if (empty($data["produced_weight"]) || $data["type_id"] == 0 || $data["machine_id"] == 0) {
|
if (empty($data["produced_weight"]) || $data["type_id"] == 0 || $data["machine_id"] == 0) {
|
||||||
Flash::error("Gutulary Dolduryn!");
|
Flash::error("Gutulary Dolduryn!");
|
||||||
return [
|
return [
|
||||||
'#validationq' => ' Gutulary Dolduryn!',
|
'#validationq' => ' Gutulary Dolduryn!',
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$createProductionMachine = new ProductionMachineModel();
|
$dateq = Carbon::parse($data["date"])->format('Y-m-d');
|
||||||
|
$bruttoq = $data["brutto_kg"];
|
||||||
|
$layerq = $data["layer"];
|
||||||
|
$produced_weightq = $data["produced_weight"];
|
||||||
|
$machineq = $data["machine_id"];
|
||||||
|
|
||||||
$metrOfRulon = (float)((float)($data["gram"] / 100) * ($data["width"] / 100)) * (int)$data["layer"];
|
$rulonq = ProductionMachineModel::where('produced_weight', $produced_weightq)
|
||||||
$metrOfAllRulon = (float) $data["produced_weight"] / $metrOfRulon;
|
->where('brutto_kg', $bruttoq)
|
||||||
|
->where('layer', $layerq)
|
||||||
|
->where('machine_id', $machineq)
|
||||||
|
->where('date', $dateq)
|
||||||
|
->first();
|
||||||
|
|
||||||
$createProductionMachine->type_id = $data["type_id"];
|
if ($rulonq) {
|
||||||
$createProductionMachine->width = $data["width"];
|
|
||||||
$createProductionMachine->gram = $data["gram"];
|
|
||||||
$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;
|
|
||||||
$createProductionMachine->defective_weight = $data["defective_weight"];
|
|
||||||
$createProductionMachine->employee_name = $data["employee_name"];
|
|
||||||
$createProductionMachine->mechanic_name = $data["employee_name"];
|
|
||||||
$createProductionMachine->note = $data["note"];
|
|
||||||
$createProductionMachine->date = Carbon::parse($data["date"])->format('Y-m-d');
|
|
||||||
$createProductionMachine->user_id = $user->id;
|
|
||||||
$createProductionMachine->save();
|
|
||||||
|
|
||||||
$productionMachine = ProductionMachineModel::where('id', $createProductionMachine->id)->with(['machine.employee', 'machine.mechanic', 'machine.building'])->first();
|
Flash::error("Bu Senede Haryt öň girizilen!!!");
|
||||||
// dd($productionMachine->machine->name);
|
|
||||||
if ($productionMachine) {
|
|
||||||
$updateResult = ProductionMachineModel::where('id', $productionMachine->id)
|
|
||||||
->update(array(
|
|
||||||
'building_name' => $productionMachine->machine->building->name,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($createProductionMachine && $updateResult) {
|
|
||||||
|
|
||||||
Flash::success("Hasabat Ustunlikli Goşuldy");
|
|
||||||
return Redirect::refresh();
|
return Redirect::refresh();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Flash::error("Yalnyshlyk bar!!");
|
|
||||||
return Redirect::refresh();
|
$createProductionMachine = new ProductionMachineModel();
|
||||||
|
|
||||||
|
$metrOfRulon = (float)((float)($data["gram"] / 100) * ($data["width"] / 100)) * (int)$data["layer"];
|
||||||
|
$metrOfAllRulon = (float) $data["produced_weight"] / $metrOfRulon;
|
||||||
|
|
||||||
|
$createProductionMachine->type_id = $data["type_id"];
|
||||||
|
$createProductionMachine->width = $data["width"];
|
||||||
|
$createProductionMachine->gram = $data["gram"];
|
||||||
|
$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;
|
||||||
|
$createProductionMachine->defective_weight = $data["defective_weight"];
|
||||||
|
$createProductionMachine->employee_name = $data["employee_name"];
|
||||||
|
$createProductionMachine->mechanic_name = $data["employee_name"];
|
||||||
|
$createProductionMachine->note = $data["note"];
|
||||||
|
$createProductionMachine->date = Carbon::parse($data["date"])->format('Y-m-d');
|
||||||
|
$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(
|
||||||
|
'building_name' => $productionMachine->machine->building->name,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($createProductionMachine && $updateResult) {
|
||||||
|
|
||||||
|
Flash::success("Hasabat Ustunlikli Goşuldy");
|
||||||
|
return Redirect::refresh();
|
||||||
|
} else {
|
||||||
|
Flash::error("Yalnyshlyk bar!!");
|
||||||
|
return Redirect::refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,8 @@ function onStart(){
|
||||||
<th>Mukdary (sany)</th>
|
<th>Mukdary (sany)</th>
|
||||||
<th>Senesi</th>
|
<th>Senesi</th>
|
||||||
<th>Sklad</th>
|
<th>Sklad</th>
|
||||||
<th>Direktor</th>
|
<!-- <th>Direktor</th>
|
||||||
<th>Bugalter</th>
|
<th>Bugalter</th> -->
|
||||||
<th>Bellik</th>
|
<th>Bellik</th>
|
||||||
<th>Sazlamalar</th>
|
<th>Sazlamalar</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -93,7 +93,7 @@ function onStart(){
|
||||||
<td>{{record.created_at|date('d.m.Y')}}</td>
|
<td>{{record.created_at|date('d.m.Y')}}</td>
|
||||||
<td>{{record.stock.name}}</td>
|
<td>{{record.stock.name}}</td>
|
||||||
|
|
||||||
{% if isDirector %}
|
<!-- {% if isDirector %}
|
||||||
|
|
||||||
<td style="color: {% if record.status_director == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_director == 'accept' %} + {% else %} <a href="#" data-request="onApproveAction" data-request-data="user_type: 'director', id: {{record.id}}" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
<td style="color: {% if record.status_director == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_director == 'accept' %} + {% else %} <a href="#" data-request="onApproveAction" data-request-data="user_type: 'director', id: {{record.id}}" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
||||||
|
|
||||||
|
|
@ -112,6 +112,9 @@ function onStart(){
|
||||||
<td style="color: {% if record.status_accountant == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_accountant == 'accept' %} + {% else %} <a href="#" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
<td style="color: {% if record.status_accountant == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_accountant == 'accept' %} + {% else %} <a href="#" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
<td>{{record.note}}</td>
|
<td>{{record.note}}</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="display: flex;justify-content: center;">
|
<div style="display: flex;justify-content: center;">
|
||||||
|
|
@ -160,8 +163,8 @@ function onStart(){
|
||||||
<th>Mukdary (sany)</th>
|
<th>Mukdary (sany)</th>
|
||||||
<th>Senesi</th>
|
<th>Senesi</th>
|
||||||
<th>Sklad</th>
|
<th>Sklad</th>
|
||||||
<th>Direktor</th>
|
<!-- <th>Direktor</th>
|
||||||
<th>Bugalter</th>
|
<th>Bugalter</th> -->
|
||||||
<th>Bellik</th>
|
<th>Bellik</th>
|
||||||
<th>Sazlamalar</th>
|
<th>Sazlamalar</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ function onStart(){
|
||||||
<th>Mukdary (KG)</th>
|
<th>Mukdary (KG)</th>
|
||||||
<th>Senesi</th>
|
<th>Senesi</th>
|
||||||
<th>Sklad</th>
|
<th>Sklad</th>
|
||||||
<th>Direktor</th>
|
<!-- <th>Direktor</th>
|
||||||
<th>Bugalter</th>
|
<th>Bugalter</th> -->
|
||||||
<th>Bellik</th>
|
<th>Bellik</th>
|
||||||
<th>Sazlamalar</th>
|
<th>Sazlamalar</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -90,8 +90,11 @@ function onStart(){
|
||||||
<td style="color: #500101;font-weight: bold;">{{record.amount|number_format(2)}} kg</td>
|
<td style="color: #500101;font-weight: bold;">{{record.amount|number_format(2)}} kg</td>
|
||||||
<td>{{record.created_at|date('d.m.Y')}}</td>
|
<td>{{record.created_at|date('d.m.Y')}}</td>
|
||||||
<td>{{record.stock.name}}</td>
|
<td>{{record.stock.name}}</td>
|
||||||
<td style="color: {% if record.status_director == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_director == 'accept' %} + {% else %}<a href="#" data-request="onApproveAction" data-request-data="user_type: 'director', id: {{record.id}}" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
|
||||||
<td style="color: {% if record.status_accountant == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_accountant == 'accept' %} + {% else %} <a href="#" data-request="onApproveAction" data-request-data="user_type: 'accountant', id: {{record.id}}'" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
<!-- <td style="color: {% if record.status_director == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_director == 'accept' %} + {% else %}<a href="#" data-request="onApproveAction" data-request-data="user_type: 'director', id: {{record.id}}" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
||||||
|
<td style="color: {% if record.status_accountant == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_accountant == 'accept' %} + {% else %} <a href="#" data-request="onApproveAction" data-request-data="user_type: 'accountant', id: {{record.id}}'" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td> -->
|
||||||
|
|
||||||
|
|
||||||
<td>{{record.note}}</td>
|
<td>{{record.note}}</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="display: flex;justify-content: center;">
|
<div style="display: flex;justify-content: center;">
|
||||||
|
|
@ -140,8 +143,8 @@ function onStart(){
|
||||||
<th>Mukdary (KG)</th>
|
<th>Mukdary (KG)</th>
|
||||||
<th>Senesi</th>
|
<th>Senesi</th>
|
||||||
<th>Sklad</th>
|
<th>Sklad</th>
|
||||||
<th>Direktor</th>
|
<!-- <th>Direktor</th>
|
||||||
<th>Bugalter</th>
|
<th>Bugalter</th> -->
|
||||||
<th>Bellik</th>
|
<th>Bellik</th>
|
||||||
<th>Sazlamalar</th>
|
<th>Sazlamalar</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ function onStart(){
|
||||||
$this["actions"] = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
|
$this["actions"] = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
|
||||||
->with(['product.rulon_action.product.bag_type', 'product.rulon_action.product.color', 'product.pivot_sewer'])
|
->with(['product.rulon_action.product.bag_type', 'product.rulon_action.product.color', 'product.pivot_sewer'])
|
||||||
->where("stock_id", $stockId)
|
->where("stock_id", $stockId)
|
||||||
->where("status_accountant", "accept")
|
//->where("status_accountant", "accept")
|
||||||
->where("status_director", "accept")
|
//->where("status_director", "accept")
|
||||||
->addSelect(DB::raw("SUM(amount) as quantity"))
|
->addSelect(DB::raw("SUM(amount) as quantity"))
|
||||||
->groupBy('romanah_gokbakja_bag_actions.product_id')
|
->groupBy('romanah_gokbakja_bag_actions.product_id')
|
||||||
->orderBy('id', 'DESC')
|
->orderBy('id', 'DESC')
|
||||||
|
|
@ -20,8 +20,8 @@ function onStart(){
|
||||||
|
|
||||||
$this["actionsQtyCount"] = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
|
$this["actionsQtyCount"] = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
|
||||||
->where("stock_id", $stockId)
|
->where("stock_id", $stockId)
|
||||||
->where("status_accountant", "accept")
|
//->where("status_accountant", "accept")
|
||||||
->where("status_director", "accept")
|
//->where("status_director", "accept")
|
||||||
->sum('amount');
|
->sum('amount');
|
||||||
|
|
||||||
// dd($this["actions"]);
|
// dd($this["actions"]);
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ function onStart(){
|
||||||
$q->with(['bag_type', 'bag_size', 'color']);
|
$q->with(['bag_type', 'bag_size', 'color']);
|
||||||
}])
|
}])
|
||||||
->where("stock_id", $stockId)
|
->where("stock_id", $stockId)
|
||||||
->where("status_accountant", "accept")
|
//->where("status_accountant", "accept")
|
||||||
->where("status_director", "accept")
|
//->where("status_director", "accept")
|
||||||
->addSelect(DB::raw("SUM(amount) as quantity"))
|
->addSelect(DB::raw("SUM(amount) as quantity"))
|
||||||
->groupBy('romanah_gokbakja_rulon_action.product_id')
|
->groupBy('romanah_gokbakja_rulon_action.product_id')
|
||||||
->orderBy('id', 'DESC')
|
->orderBy('id', 'DESC')
|
||||||
|
|
@ -21,8 +21,8 @@ function onStart(){
|
||||||
|
|
||||||
$this["actionsSumWeight"] = Romanah\Gokbakja\Models\RulonAction::select('romanah_gokbakja_rulon_action.*')
|
$this["actionsSumWeight"] = Romanah\Gokbakja\Models\RulonAction::select('romanah_gokbakja_rulon_action.*')
|
||||||
->where("stock_id", $stockId)
|
->where("stock_id", $stockId)
|
||||||
->where("status_accountant", "accept")
|
//->where("status_accountant", "accept")
|
||||||
->where("status_director", "accept")
|
//->where("status_director", "accept")
|
||||||
->sum('amount');
|
->sum('amount');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,8 @@ function onStart(){
|
||||||
<th>Mukdary (KG)</th>
|
<th>Mukdary (KG)</th>
|
||||||
<th>Senesi</th>
|
<th>Senesi</th>
|
||||||
<th>Sklad</th>
|
<th>Sklad</th>
|
||||||
<th>Direktor</th>
|
<!-- <th>Direktor</th>
|
||||||
<th>Bugalter</th>
|
<th>Bugalter</th> -->
|
||||||
<th>Bellik</th>
|
<th>Bellik</th>
|
||||||
<th>Sazlamalar</th>
|
<th>Sazlamalar</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -125,7 +125,7 @@ function onStart(){
|
||||||
<td>{{record.created_at|date('d.m.Y')}}</td>
|
<td>{{record.created_at|date('d.m.Y')}}</td>
|
||||||
<td>{{record.stock.name}}</td>
|
<td>{{record.stock.name}}</td>
|
||||||
|
|
||||||
{% if isDirector %}
|
<!-- {% if isDirector %}
|
||||||
|
|
||||||
<td style="color: {% if record.status_director == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_director == 'accept' %} + {% else %} <a href="#" data-request="onApproveAction" data-request-data="user_type: 'director', id: {{record.id}}" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
<td style="color: {% if record.status_director == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_director == 'accept' %} + {% else %} <a href="#" data-request="onApproveAction" data-request-data="user_type: 'director', id: {{record.id}}" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ function onStart(){
|
||||||
|
|
||||||
<td style="color: {% if record.status_accountant == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_accountant == 'accept' %} + {% else %} <a href="#" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
<td style="color: {% if record.status_accountant == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_accountant == 'accept' %} + {% else %} <a href="#" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %} -->
|
||||||
|
|
||||||
<td>{{record.note}}</td>
|
<td>{{record.note}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -194,8 +194,8 @@ function onStart(){
|
||||||
<th>Mukdary (KG)</th>
|
<th>Mukdary (KG)</th>
|
||||||
<th>Senesi</th>
|
<th>Senesi</th>
|
||||||
<th>Sklad</th>
|
<th>Sklad</th>
|
||||||
<th>Direktor</th>
|
<!-- <th>Direktor</th>
|
||||||
<th>Bugalter</th>
|
<th>Bugalter</th> -->
|
||||||
<th>Bellik</th>
|
<th>Bellik</th>
|
||||||
<th>Sazlamalar</th>
|
<th>Sazlamalar</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ function onStart(){
|
||||||
|
|
||||||
$this["actions"] = Romanah\Gokbakja\Models\Action::select('romanah_gokbakja_action.*')
|
$this["actions"] = Romanah\Gokbakja\Models\Action::select('romanah_gokbakja_action.*')
|
||||||
->where("stock_id", $stockId)
|
->where("stock_id", $stockId)
|
||||||
->where("status_accountant", "accept")
|
//->where("status_accountant", "accept")
|
||||||
->where("status_director", "accept")
|
//->where("status_director", "accept")
|
||||||
->addSelect(DB::raw("SUM(amount) as quantity"))
|
->addSelect(DB::raw("SUM(amount) as quantity"))
|
||||||
->groupBy('romanah_gokbakja_action.product_id')
|
->groupBy('romanah_gokbakja_action.product_id')
|
||||||
->get();
|
->get();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue