add changes

This commit is contained in:
Roland Schneider 2016-08-08 18:56:55 +02:00
parent c5bfae9ec1
commit f30acbc7d2

View File

@ -9,6 +9,7 @@ use backend\assets\InventoryItemIndexAsset;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel backend\models\InventoryItemSearch */ /* @var $searchModel backend\models\InventoryItemSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */ /* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $model \common\models\Inventory */
$this->title = Yii::t('common/inventory-item', 'Leltár részletei'); $this->title = Yii::t('common/inventory-item', 'Leltár részletei');
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
@ -19,177 +20,162 @@ InventoryItemIndexAsset::register($this);
$options = []; $options = [];
$options['products'] = $productOptions; $options['products'] = $productOptions;
$this->registerJs('inventoryItemIndex.init( '. json_encode($options) .' );'); $this->registerJs('inventoryItemIndex.init( ' . json_encode($options) . ' );');
?> ?>
<style> <style>
.table th{ .table th {
white-space: normal; white-space: normal;
} }
.table td{
white-space: normal; .table td {
} white-space: normal;
}
.table td.numeric{
width: 110px; .table td.numeric {
text-align: right; width: 110px;
} text-align: right;
}
</style> </style>
<div class="inventory-item-index"> <div class="inventory-item-index">
<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>
<?= DetailView::widget([ <?= DetailView::widget([
'model' => $model, 'model' => $model,
'attributes' => [ 'attributes' => [
'id_inventory', 'id_inventory',
'name', 'name',
['attribute'=>'id_user', ['attribute' => 'id_user',
'value'=>$model->userName 'value' => $model->userName
], ],
['attribute'=>'id_account', ['attribute' => 'id_account',
'value'=>$model->accountName 'value' => $model->accountName
], ],
['attribute'=>'status', ['attribute' => 'status',
'value'=>$model->getStatusHuman(), 'value' => $model->getStatusHuman(),
'label' => "Állapot" 'label' => "Állapot"
], ],
'created_at:datetime', 'created_at:datetime',
], ],
]) ?> ]) ?>
<?php
<?php if ($model->isOpen()) {
if ( $model->isOpen()){ echo Html::a("Lezárás", ['inventory/close', 'id' => $model->id_inventory], ['data-method' => 'post', 'class' => 'btn btn-danger']);
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]); ?>
<p>
<?php echo $this->render('_search', ['model' => $searchModel]); ?> 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>
</p>
<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'
],
[
'attribute' => 'item_count_system',
'label' => 'Rendszer szerinti mennyiség (db)',
'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_sold',
'label' => 'Eladott mennyiség (db)',
'contentOptions' => ['class' => 'numeric']
],
[
'attribute' => 'item_difference',
'label' => 'Különbség (db)',
'contentOptions' => ['class' => 'numeric']
],
[
'attribute' => 'item_price_brutto',
'label' => 'Eladási ár (Ft)',
'contentOptions' => ['class' => 'numeric']
],
[
'attribute' => 'item_total_price_brutto',
'label' => 'Összeg (Ft)',
'contentOptions' => ['class' => 'numeric']
],
];
<p> if ($model->isOpen()) {
Magyarázat: $columns[] = ['class' => 'yii\grid\ActionColumn',
<ul> 'template' => '{update}',
<li> 'buttons' => [
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. 'update' => function ($url) {
</li> return Html::a('Módosítás', $url, ['class' => 'btn btn-xs btn-success',
<li> 'data' => [
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> 'urlCreator' => function ($action, $model) {
<li> $result = "";
Leltározott mennyiség: A felhasználó által összeszámolt és leltár létrehozásakor beírt mennyiség if ($action == 'update') {
</li> $result = Url::toRoute(['update-item', 'id' => $model['item_id_inventory_item']]);
<li> }
Rendszer szerinti mennyiség: a rendszer által számolt és aktuális látott mennyiség return $result;
</li> }
<li> ];
Különbség: = "Leltározott mennyiség - ( "Előző leltár" + "Beszerzett mennyiség" - "Eladott mennyiség" ) }
</li>
</ul>
</p>
<p> echo GridView::widget([
<?php echo Html::a("XLS letöltése", Url::current(['InventoryItemSearch[output]' =>'xls']),['class' =>'btn btn-primary'])?> 'dataProvider' => $dataProvider,
</p> 'columns' => $columns
]);
<?php ?>
$columns = [
[
'attribute' => 'item_name',
'label' => 'Név',
],
[
'attribute' => 'inventory_prev_name',
'label' => 'Utolsó leltár'
],
[
'attribute' => 'item_count_system',
'label' => 'Rendszer szerinti mennyiség (db)',
'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_sold',
'label' => 'Eladott mennyiség (db)',
'contentOptions' => ['class' => 'numeric']
],
[
'attribute' => 'item_difference',
'label' => 'Különbség (db)',
'contentOptions' => ['class' => 'numeric']
],
[
'attribute' => 'item_price_brutto',
'label' => 'Eladási ár (Ft)',
'contentOptions' => ['class' => 'numeric']
],
[
'attribute' => 'item_total_price_brutto',
'label' => 'Összeg (Ft)',
'contentOptions' => ['class' => 'numeric']
],
];
if ( $model->isOpen() ){
$columns[] = ['class' => 'yii\grid\ActionColumn',
'template' => '{update}',
'urlCreator' => function ($action, $model, $key, $index){
return Url::to(['inventory-item/update', 'id' => $model['item_id_inventory_item' ] ]) ;
},
'buttons' =>[
'update' =>function ($url, $model, $key) {
return Html::a('Módosítás', $url,['class' => 'btn btn-xs btn-success',
'data' => [
],
]) ;
}
],
'urlCreator' => function($action, $model, $key, $index){
$result = "";
if ( $action == 'update'){
$result = Url::toRoute( [ 'update-item' ,'id' => $model['item_id_inventory_item']]);
}
return $result;
}
] ;
}
echo GridView::widget( [
'dataProvider' => $dataProvider,
'columns' => $columns
]);
?>
</div> </div>