order item rulon integration

This commit is contained in:
Shohrat 2023-11-23 12:24:52 +05:00
parent a92281ad43
commit 68dbfd617e
6 changed files with 93 additions and 16 deletions

View File

@ -50,19 +50,23 @@ class OrderItem extends ComponentBase
$stock = Stock::where("type", 'rulon')->first();
$bag_type = $orderItems[$x]->type_id;
$bag_size = $orderItems[$x]->size_id;
$bag_size = $orderItems[$x]->width;
$bag_gram = $orderItems[$x]->rulon_gram;
$rulon_layer = $orderItems[$x]->rulon_layer;
$color = $orderItems[$x]->color_id;
$amountCalc = $orderItems[$x]->amount;
$rulonCalc = RulonAction::with('product')
->whereHas('product', function($q)use($bag_type, $bag_size, $color){
->whereHas('product', function($q)use($bag_type, $bag_size, $color, $bag_gram, $rulon_layer){
$q->where('type_id', $bag_type)
->where('size_id', $bag_size)
->where('width', $bag_size)
->where('gram', $bag_gram)
->where('layer', $rulon_layer)
->where('color_id', $color);
})
->where("stock_id", $stock->id)
->where("status_accountant", "accept")
->where("status_director", "accept")
//->where("status_accountant", "accept")
//->where("status_director", "accept")
->sum('amount');
@ -101,8 +105,8 @@ class OrderItem extends ComponentBase
$qqq->where('width', $bag_width)->where('height', $bag_height);
})
->where("stock_id", $stock->id)
->where("status_accountant", "accept")
->where("status_director", "accept")
//->where("status_accountant", "accept")
//->where("status_director", "accept")
->sum('amount');
@ -164,7 +168,7 @@ class OrderItem extends ComponentBase
$html_data .='</a></td>
<td>';
if ($orderItems[$x]->order_item_type == 'rulon'){
$html_data .= $orderItems[$x]->size->name ?? "";
$html_data .= 'Ölçegi: '.($orderItems[$x]->width ?? "").', '.$orderItems[$x]->rulon_gram.' gram m2 , rulon gaty: '.$orderItems[$x]->rulon_layer;
}else{
$html_data .= 'Ini: '.$orderItems[$x]->bag_width.' Boýy: '.$orderItems[$x]->bag_height;
}
@ -322,7 +326,9 @@ class OrderItem extends ComponentBase
$createOrderItem->order_item_type = $data["order_item_type"];
$createOrderItem->order_id = $orderId;
$createOrderItem->type_id = $data["type_id"];
$createOrderItem->size_id = $data["size_id"];
$createOrderItem->width = $data["width"];
$createOrderItem->rulon_layer = $data["rulon_layer"];
$createOrderItem->rulon_gram = $data["rulon_gram"];
$createOrderItem->color_id = $data["color_id"];
$createOrderItem->bag_gram = $data["bag_gram"];
$createOrderItem->bag_width = $data["bag_width"];

View File

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

View File

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

View File

@ -405,3 +405,9 @@
1.0.136:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_17.php
1.0.137:
- 'Updated table romanah_gokbakja_order_item'
- builder_table_update_romanah_gokbakja_order_item_9.php
1.0.138:
- 'Updated table romanah_gokbakja_order_item'
- builder_table_update_romanah_gokbakja_order_item_10.php

View File

@ -103,13 +103,24 @@ function onStart(){
placeholder="Halta Boýy" value="0">
</div>
<div class="col" id="rulon_size">
<label class="form-label">Razmer 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 %}
<label class="form-label">Rulon Ölçegi</label>
<input type="number" name="width" class="form-control"
placeholder="Rulon Ölçegi" value="0">
</div>
<div class="col" id="rulon_gram">
<label class="form-label">Rulon Gram m2</label>
<input type="number" name="rulon_gram" class="form-control"
placeholder="Rulon Ölçegi" value="0">
</div>
<div class="col" id="rulon_layer">
<label class="form-label">Rulon gaty</label>
<select class="form-control select2" name="rulon_layer">
<option value="1" selected>1 gat</option>
<option value="2">2 gat</option>
</select>
</div>
@ -263,6 +274,8 @@ function onStart(){
if(orderType == 'rulon'){
$("#rulon_type").show();
$("#rulon_size").show();
$("#rulon_gram").show();
$("#rulon_layer").show();
$("#bag_width").hide();
$("#bag_height").hide();
@ -273,6 +286,8 @@ function onStart(){
$("#bag_gram").show();
$("#rulon_size").hide();
$("#rulon_gram").hide();
$("#rulon_layer").hide();
}
}

View File

@ -93,7 +93,7 @@ function onStart(){
<tr>
<td style="font-weight: bold;width: 5%;">{{key + 1}}</td>
<td><a href="/machine">#Rulon{{record.product_id}}</a></td>
<td><a style="font-weight: bold;color: #0005c5;">{{record.product.bag_type.name}}, {{record.product.bag_size.name}}, {{record.product.color.name}}</a></td>
<td><a style="font-weight: bold;color: #0005c5;">{{record.product.bag_type.name}}, Ölçegi: {{record.product.width}}, {{record.product.gram}} m2, {{record.product.layer}} gat, {{record.product.color.name}}</a></td>
<td style="text-align: center;">
<span class="badge badge-soft-{% if record.type == 'inbox' %}success {% else %}danger {% endif %}" style="font-size: 14px;">{{record.type}}</span></td>
<td style="color: #500101;font-weight: bold;">{{record.quantity|number_format(2)}} kg</td>