acception settings

This commit is contained in:
Shohrat 2023-12-06 01:37:39 +05:00
parent bda92ad5c1
commit c656a5b6c8
7 changed files with 152 additions and 114 deletions

View File

@ -11,7 +11,8 @@ use Redirect;
use Carbon\Carbon;
use Flash;
// use Illuminate\Validation\Validator;
use \Validator;
use Validator;
use ValidationException;
use DB;
use Romanah\Gokbakja\Models\BagColor;
use Romanah\Gokbakja\Models\BagSize;
@ -241,7 +242,8 @@ class MachineProduction extends ComponentBase
];
}
public function onDeleteProductionMachine(){
public function onDeleteProductionMachine()
{
$id = post('production_id');
$productionDelete = ProductionMachineModel::Find($id);
@ -284,11 +286,9 @@ class MachineProduction extends ComponentBase
$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> &nbsp;&nbsp;' : '';
$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 {
$editBtn = '<a href="#" style="font-weight: bold;color: darkgreen;"> Sklada salyndy </a>';
}
}
// dd($machineProductions[0]->bag_size);
@ -485,7 +485,8 @@ class MachineProduction extends ComponentBase
}
public function onUpdateMachineProduction(){
public function onUpdateMachineProduction()
{
$user = \Auth::user();
@ -544,7 +545,16 @@ class MachineProduction extends ComponentBase
Flash::error("Yalnyshlyk bar!!");
return Redirect::refresh();
}
}
protected function validateForm($data, $rules)
{
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
throw new ValidationException($validator);
}
}
public function onCreateMachineProduction()
@ -553,12 +563,33 @@ class MachineProduction extends ComponentBase
$data = post();
if (empty($data["produced_weight"]) || $data["type_id"] == 0 || $data["machine_id"] == 0) {
Flash::error("Gutulary Dolduryn!");
return [
'#validationq' => ' Gutulary Dolduryn!',
];
} else {
$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"];
$rulonq = ProductionMachineModel::where('produced_weight', $produced_weightq)
->where('brutto_kg', $bruttoq)
->where('layer', $layerq)
->where('machine_id', $machineq)
->where('date', $dateq)
->first();
if ($rulonq) {
Flash::error("Bu Senede Haryt öň girizilen!!!");
return Redirect::refresh();
} else {
$createProductionMachine = new ProductionMachineModel();
$metrOfRulon = (float)((float)($data["gram"] / 100) * ($data["width"] / 100)) * (int)$data["layer"];
@ -604,3 +635,4 @@ class MachineProduction extends ComponentBase
}
}
}
}

View File

@ -73,8 +73,8 @@ function onStart(){
<th>Mukdary (sany)</th>
<th>Senesi</th>
<th>Sklad</th>
<th>Direktor</th>
<th>Bugalter</th>
<!-- <th>Direktor</th>
<th>Bugalter</th> -->
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
@ -93,7 +93,7 @@ function onStart(){
<td>{{record.created_at|date('d.m.Y')}}</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>
@ -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>
{% endif %}
-->
<td>{{record.note}}</td>
<td>
<div style="display: flex;justify-content: center;">
@ -160,8 +163,8 @@ function onStart(){
<th>Mukdary (sany)</th>
<th>Senesi</th>
<th>Sklad</th>
<th>Direktor</th>
<th>Bugalter</th>
<!-- <th>Direktor</th>
<th>Bugalter</th> -->
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>

View File

@ -71,8 +71,8 @@ function onStart(){
<th>Mukdary (KG)</th>
<th>Senesi</th>
<th>Sklad</th>
<th>Direktor</th>
<th>Bugalter</th>
<!-- <th>Direktor</th>
<th>Bugalter</th> -->
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
@ -90,8 +90,11 @@ function onStart(){
<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.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>
<div style="display: flex;justify-content: center;">
@ -140,8 +143,8 @@ function onStart(){
<th>Mukdary (KG)</th>
<th>Senesi</th>
<th>Sklad</th>
<th>Direktor</th>
<th>Bugalter</th>
<!-- <th>Direktor</th>
<th>Bugalter</th> -->
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>

View File

@ -10,8 +10,8 @@ function onStart(){
$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'])
->where("stock_id", $stockId)
->where("status_accountant", "accept")
->where("status_director", "accept")
//->where("status_accountant", "accept")
//->where("status_director", "accept")
->addSelect(DB::raw("SUM(amount) as quantity"))
->groupBy('romanah_gokbakja_bag_actions.product_id')
->orderBy('id', 'DESC')
@ -20,8 +20,8 @@ function onStart(){
$this["actionsQtyCount"] = Romanah\Gokbakja\Models\BagAction::select('romanah_gokbakja_bag_actions.*')
->where("stock_id", $stockId)
->where("status_accountant", "accept")
->where("status_director", "accept")
//->where("status_accountant", "accept")
//->where("status_director", "accept")
->sum('amount');
// dd($this["actions"]);

View File

@ -12,8 +12,8 @@ function onStart(){
$q->with(['bag_type', 'bag_size', 'color']);
}])
->where("stock_id", $stockId)
->where("status_accountant", "accept")
->where("status_director", "accept")
//->where("status_accountant", "accept")
//->where("status_director", "accept")
->addSelect(DB::raw("SUM(amount) as quantity"))
->groupBy('romanah_gokbakja_rulon_action.product_id')
->orderBy('id', 'DESC')
@ -21,8 +21,8 @@ function onStart(){
$this["actionsSumWeight"] = Romanah\Gokbakja\Models\RulonAction::select('romanah_gokbakja_rulon_action.*')
->where("stock_id", $stockId)
->where("status_accountant", "accept")
->where("status_director", "accept")
//->where("status_accountant", "accept")
//->where("status_director", "accept")
->sum('amount');

View File

@ -105,8 +105,8 @@ function onStart(){
<th>Mukdary (KG)</th>
<th>Senesi</th>
<th>Sklad</th>
<th>Direktor</th>
<th>Bugalter</th>
<!-- <th>Direktor</th>
<th>Bugalter</th> -->
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
@ -125,7 +125,7 @@ function onStart(){
<td>{{record.created_at|date('d.m.Y')}}</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>
@ -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>
{% endif %}
{% endif %} -->
<td>{{record.note}}</td>
<td>
@ -194,8 +194,8 @@ function onStart(){
<th>Mukdary (KG)</th>
<th>Senesi</th>
<th>Sklad</th>
<th>Direktor</th>
<th>Bugalter</th>
<!-- <th>Direktor</th>
<th>Bugalter</th> -->
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>

View File

@ -9,8 +9,8 @@ function onStart(){
$this["actions"] = Romanah\Gokbakja\Models\Action::select('romanah_gokbakja_action.*')
->where("stock_id", $stockId)
->where("status_accountant", "accept")
->where("status_director", "accept")
//->where("status_accountant", "accept")
//->where("status_director", "accept")
->addSelect(DB::raw("SUM(amount) as quantity"))
->groupBy('romanah_gokbakja_action.product_id')
->get();