236 lines
6.7 KiB
PHP
236 lines
6.7 KiB
PHP
<?php
|
|
|
|
use yii\helpers\Html;
|
|
use yii\grid\GridView;
|
|
use yii\widgets\DetailView;
|
|
use yii\helpers\Url;
|
|
use backend\assets\InventoryItemIndexAsset;
|
|
|
|
/* @var $this yii\web\View */
|
|
/* @var $searchModel backend\models\InventoryItemSearch */
|
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
|
/* @var $model \common\models\Inventory */
|
|
|
|
$this->title = Yii::t('common/inventory-item', 'Leltár részletei');
|
|
if ( $model->type == \common\models\Inventory::$TYPE_DAILY){
|
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory', 'Leltár pillanat képek'), 'url' => ['inventory/daily']];
|
|
}else{
|
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory', 'Leltár lista'), 'url' => ['inventory/index']];
|
|
}
|
|
|
|
$this->params['breadcrumbs'][] = $this->title;
|
|
|
|
|
|
InventoryItemIndexAsset::register($this);
|
|
|
|
$options = [];
|
|
$options['products'] = $productOptions;
|
|
|
|
$this->registerJs('inventoryItemIndex.init( ' . json_encode($options) . ' );');
|
|
|
|
?>
|
|
|
|
<!--suppress CssUnusedSymbol -->
|
|
<style>
|
|
.table th {
|
|
white-space: normal;
|
|
}
|
|
|
|
.table td {
|
|
white-space: normal;
|
|
}
|
|
|
|
.table td.numeric {
|
|
width: 110px;
|
|
text-align: right;
|
|
}
|
|
|
|
.col-b{
|
|
/*background-color: #00a157;*/
|
|
}
|
|
|
|
.table-striped > tbody > tr:nth-of-type(even) td.col-b {
|
|
background-color: #DFE3E8;
|
|
/*background-color: #D3D7DC;*/
|
|
}
|
|
.table-striped > tbody > tr:nth-of-type(odd) td.col-b {
|
|
/*background-color: #E0E0E0;*/
|
|
background-color: #ECECEC;
|
|
}
|
|
|
|
</style>
|
|
<div class="inventory-item-index">
|
|
<h1><?= Html::encode($this->title) ?></h1>
|
|
<?= DetailView::widget([
|
|
'model' => $model,
|
|
'attributes' => [
|
|
'id_inventory',
|
|
'name',
|
|
['attribute' => 'id_user',
|
|
'value' => $model->userName
|
|
],
|
|
['attribute' => 'id_account',
|
|
'value' => $model->accountName
|
|
],
|
|
['attribute' => 'status',
|
|
'value' => $model->getStatusHuman(),
|
|
'label' => "Állapot"
|
|
],
|
|
'created_at:datetime',
|
|
],
|
|
]) ?>
|
|
<?php
|
|
if ($model->isOpen()) {
|
|
echo Html::a("Lezárás", ['inventory/close', 'id' => $model->id_inventory], ['data-method' => 'post', 'class' => 'btn btn-danger']);
|
|
}
|
|
?>
|
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
|
<div>
|
|
Magyarázat:
|
|
<ul>
|
|
<li>
|
|
Előző leltár (db): az előző leltárban összeszámolt mennyiség. Ha ez a termék első leltározása akkor 0.
|
|
</li>
|
|
<li>
|
|
Beszerzett mennyiség: Az előző leltár óta történt beszerzett mennyiségek összege
|
|
</li>
|
|
<li>
|
|
Eladott mennyiség: Az előző leltár óta eladott darabszám összege
|
|
</li>
|
|
<li>
|
|
Leltározott mennyiség: A felhasználó által összeszámolt és leltár létrehozásakor beírt mennyiség
|
|
</li>
|
|
<li>
|
|
Rendszer szerinti mennyiség: a rendszer által számolt és aktuális látott mennyiség
|
|
</li>
|
|
<li>
|
|
Különbség: = "Leltározott mennyiség - ( "Előző leltár" + "Beszerzett mennyiség" - "Eladott mennyiség" )
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<p>
|
|
<?php echo Html::a("XLS letöltése", Url::current(['InventoryItemSearch[output]' => 'xls']), ['class' => 'btn btn-primary']) ?>
|
|
</p>
|
|
<?php
|
|
$columns = [
|
|
[
|
|
'attribute' => 'item_name',
|
|
'label' => 'Név',
|
|
|
|
],
|
|
[
|
|
'attribute' => 'inventory_prev_name',
|
|
'label' => 'Utolsó leltár',
|
|
'contentOptions' => ['class' => '']
|
|
],
|
|
[
|
|
'attribute' => 'item_count_system',
|
|
'label' => 'Rendszer szerinti mennyiség (db)',
|
|
'contentOptions' => ['class' => 'numeric']
|
|
|
|
],
|
|
[
|
|
'attribute' => 'item_purchase_price_net',
|
|
'label' => 'Nettó beszerezési ár',
|
|
'contentOptions' => ['class' => 'numeric']
|
|
|
|
],
|
|
[
|
|
'attribute' => 'item_count',
|
|
'label' => 'Leltározott mennyiség (db)',
|
|
'contentOptions' => ['class' => 'numeric ']
|
|
|
|
],
|
|
[
|
|
'attribute' => 'item_count_prev',
|
|
'label' => 'Előzö leltár (db)',
|
|
'contentOptions' => ['class' => 'numeric']
|
|
|
|
],
|
|
[
|
|
'attribute' => 'item_count_in',
|
|
'label' => 'Beszerzett mennyiség (db)',
|
|
'contentOptions' => ['class' => 'numeric ' ]
|
|
|
|
],
|
|
[
|
|
'attribute' => 'item_count_waste',
|
|
'label' => 'Selejtezett mennyiség (db)',
|
|
'contentOptions' => ['class' => 'numeric ' ]
|
|
|
|
],
|
|
[
|
|
'attribute' => 'item_count_sold',
|
|
'label' => 'Eladott mennyiség (db)',
|
|
'contentOptions' => ['class' => 'numeric']
|
|
|
|
],
|
|
[
|
|
'attribute' => 'item_stock_missing_count',
|
|
'label' => 'Különbség (db)',
|
|
'contentOptions' => ['class' => 'numeric ']
|
|
|
|
],
|
|
[
|
|
'attribute' => 'item_price_brutto',
|
|
'label' => 'Eladási ár (Ft)',
|
|
'contentOptions' => ['class' => 'numeric']
|
|
],
|
|
[
|
|
'attribute' => 'item_stock_missing_money',
|
|
'label' => 'Leltár hiány (Ft)',
|
|
'contentOptions' => ['class' => 'numeric ']
|
|
]
|
|
];
|
|
|
|
if ($model->isOpen()) {
|
|
$columns[] = ['class' => 'yii\grid\ActionColumn',
|
|
'template' => '{update}',
|
|
'buttons' => [
|
|
'update' => function ($url) {
|
|
return Html::a('Módosítás', $url, ['class' => 'btn btn-xs btn-success',
|
|
'data' => [
|
|
],
|
|
]);
|
|
}
|
|
],
|
|
'urlCreator' => function ($action, $model) {
|
|
$result = "";
|
|
if ($action == 'update') {
|
|
$result = Url::toRoute(['update', 'id' => $model['item_id_inventory_item']]);
|
|
}
|
|
return $result;
|
|
}
|
|
];
|
|
}
|
|
|
|
$i = 0;
|
|
foreach ($columns as $col){
|
|
$value = "";
|
|
if ( !isset($col["contentOptions"])){
|
|
$col["contentOptions"] = [];
|
|
}
|
|
|
|
if ( isset($col["contentOptions"]["class"])){
|
|
$value = $col["contentOptions"]["class"];
|
|
}
|
|
|
|
if ( $i % 2 == 1){
|
|
$columns[$i]["contentOptions"]["class"] = $value . " col-b";
|
|
}else{
|
|
$columns[$i]["contentOptions"]["class"] = $value . " col-a";
|
|
}
|
|
|
|
|
|
|
|
$i++;
|
|
}
|
|
|
|
echo GridView::widget([
|
|
'dataProvider' => $dataProvider,
|
|
'columns' => $columns
|
|
]);
|
|
?>
|
|
|
|
</div>
|