示例#1
0
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\inventory\search\ProductStock */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Product Stocks';
$this->params['breadcrumbs'][] = $this->title;
?>
<p class="pull-right">
    <?php 
echo '';
?>
    <?php 
echo Html::a('<i class="fa fa-download"></i> Unduh Data-Stok', ['csv-download', 'params' => $_GET], ['class' => 'btn btn-default', 'title' => 'CSV Download', 'data' => ['method' => 'post']]);
?>
</p><br>
<div class="product-stock-index">

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-hover'], 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Warehouse', 'attribute' => 'warehouse_id', 'value' => 'warehouse.name', 'filter' => backend\models\master\Warehouse::selectOptions(), 'headerOptions' => ['style' => 'width:10%;']], ['label' => 'Code', 'attribute' => 'product.code', 'filter' => Html::textInput('ProductStock[product_code]', $searchModel->product_code, array('class' => 'form-control')), 'headerOptions' => ['style' => 'width:10%;']], ['label' => 'Product', 'format' => 'html', 'value' => 'product.name', 'filter' => Html::textInput('ProductStock[product_name]', $searchModel->product_name, array('class' => 'form-control'))], ['label' => 'Group', 'format' => 'html', 'value' => 'product.group.name', 'filter' => false, 'headerOptions' => ['style' => 'width:15%;']], ['attribute' => 'qty', 'filter' => false, 'headerOptions' => ['style' => 'width:5%;']], ['label' => 'Value', 'format' => ['decimal', 0], 'value' => function ($model) {
    $dcogs = !empty($model->cogs) ? $model->cogs->cogs : 0;
    return $dcogs * $model->qty;
}, 'filter' => false, 'format' => ['decimal', 0], 'headerOptions' => ['style' => 'text-align:right; width:15%;'], 'contentOptions' => ['style' => 'text-align:right;'], 'footerOptions' => ['style' => 'text-align:right;']]]]);
?>

</div>
示例#2
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\inventory\search\ProductStockHistory */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Product Stock Histories';
$this->params['breadcrumbs'][] = $this->title;
?>
<br>

<div class="product-stock-history-index">

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-hover'], 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Warehouse', 'attribute' => 'warehouse_id', 'value' => 'warehouse.name', 'filter' => backend\models\master\Warehouse::selectOptions(), 'contentOptions' => ['style' => 'width:15%;']], ['label' => 'Code', 'attribute' => 'product.code', 'filter' => Html::textInput('ProductStockHistory[product_code]', $searchModel->product_code, array('class' => 'form-control')), 'contentOptions' => ['style' => 'width:10%;']], ['label' => 'Product', 'format' => 'html', 'value' => 'product.name', 'filter' => Html::textInput('ProductStockHistory[product_name]', $searchModel->product_name, array('class' => 'form-control'))], ['attribute' => 'qty_movement', 'filter' => false, 'contentOptions' => ['style' => 'width:10%;text-align:center;']], ['attribute' => 'qty_current', 'filter' => false, 'contentOptions' => ['style' => 'width:10%;text-align:center;']], ['attribute' => 'time', 'format' => 'datetime', 'filter' => false, 'contentOptions' => ['style' => 'width:10%;']], ['label' => 'Reff.Number', 'attribute' => 'goods_movement_number', 'format' => 'raw', 'value' => function ($model) {
    return isset($model->goodsmovements->number) ? \yii\bootstrap\Html::a($model->goodsmovements->number, ['/inventory/gm-manual/view', 'id' => $model->movement_id]) : '';
}, 'filter' => Html::textInput('ProductStockHistory[goods_movement_number]', $searchModel->goods_movement_number, array('class' => 'form-control'))], 'goodsmovements.description']]);
?>

</div>
示例#3
0
use mdm\admin\models\User;
use yii\jui\AutoComplete;
use yii\web\JsExpression;
/* @var $this yii\web\View */
/* @var $model app\models\master\U2Warehouse */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="u2-warehouse-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'warehouse_id')->dropDownList(backend\models\master\Warehouse::selectOptions(), ['style' => 'width:40%;']);
?>
    <?php 
$data = User::find()->select(['username as value', 'username as  label', 'id as id'])->asArray()->all();
echo AutoComplete::widget(['model' => $model, 'attribute' => 'user_name', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $data, 'autoFill' => true, 'minLength' => '1', 'select' => new JsExpression("function( event, ui ) {\n                \$('#u2warehouse-user_id').val(ui.item.id);\n             }"), 'search' => new JsExpression("function( event, ui ) {\n                \$('#u2warehouse-user_id').val('');\n             }")]]);
?>

    <?php 
echo $form->field($model, 'user_id')->hiddenInput()->label(false);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>