Пример #1
0
 public function resolveType()
 {
     if ($config = Configs::movement($this->reff_type) !== null) {
         $this->type = $config['type'];
     } else {
         $this->addError('reff_type', "Reference type {$this->reff_type} not recognize");
     }
 }
Пример #2
0
 protected function getReference($reff_type, $reff_id, $origin = [])
 {
     $config = Configs::movement($reff_type);
     $class = $config['class'];
     $relation = $config['relation'];
     $modelRef = $class::findOne($reff_id);
     $refDtls = $modelRef->{$relation};
     $details = ArrayHelper::index($origin, 'product_id');
     foreach ($refDtls as $refDtl) {
         if (!isset($details[$refDtl->product_id])) {
             $details[$refDtl->product_id] = new GoodsMovementDtl(['product_id' => $refDtl->product_id]);
         }
         if (!empty($config['apply_method'])) {
             call_user_func([$refDtl, $config['apply_method']], $details[$refDtl->product_id]);
         }
     }
     return [$modelRef, array_values($details)];
 }
Пример #3
0
/* @var $searchModel app\models\inventory\searchs\GoodsMovement */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Goods Movement';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row purchase-index">    
    <section class="col-lg-12">
        <?php 
echo Toolbar::widget(['items' => [['label' => '', 'url' => ['print-html'], 'icon' => 'fa fa-print', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Html Print']], ['label' => '', 'url' => ['print-pdf'], 'icon' => 'fa fa-file', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Export to Pdf']], ['label' => '', 'url' => ['print-xsl'], 'icon' => 'fa fa-table', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Export to Excel']]]]) . '&nbsp;&nbsp;';
echo ActionToolbar::widget(['items' => [['label' => 'Create New', 'url' => ['create', 'type' => 100], 'icon' => 'fa fa-plus-square'], ['label' => 'Update', 'url' => ['update'], 'icon' => 'fa fa-pencil', 'linkOptions' => ['class' => 'disabled']], ['label' => 'Delete', 'url' => ['delete'], 'icon' => 'fa fa-trash-o', 'linkOptions' => ['class' => 'disabled', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]], ['label' => 'Goods Movement List', 'url' => ['index'], 'icon' => 'fa fa-list', 'linkOptions' => ['class' => 'disabled']]]]);
?>
        <div class="box box-info">
            <div class="box-body no-padding">
                <?php 
$filterRef = [];
foreach (Configs::movement() as $key => $value) {
    $filterRef[$key] = isset($value['name']) ? $value['name'] : $key;
}
?>
                <?php 
\yii\widgets\Pjax::begin(['enablePushState' => false]);
?>
                <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => "{items}\n{pager}", 'tableOptions' => ['class' => 'table table-striped'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'number', 'date:date', ['attribute' => 'reff_type', 'value' => 'nmReffType', 'filter' => $filterRef], ['label' => 'Reference', 'value' => 'reffLink', 'format' => 'raw'], ['attribute' => 'warehouse_id', 'value' => 'warehouse.name', 'filter' => Warehouse::selectOptions()], ['attribute' => 'status', 'format' => 'raw', 'filter' => [GoodsMovement::STATUS_DRAFT => 'Draft', GoodsMovement::STATUS_PROCESS => 'Proccess', GoodsMovement::STATUS_CLOSE => 'Closed'], 'value' => function ($data) {
    $color = $data->status == GoodsMovement::STATUS_DRAFT ? 'danger' : 'success';
    $color = $data->status == GoodsMovement::STATUS_PROCESS ? 'info' : $color;
    $color = $data->status == GoodsMovement::STATUS_CLOSE ? 'success' : $color;
    return Html::tag('small', $data->nmStatus, ['class' => 'label label-' . $color]);
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}{update}{delete}{apply}']]]);
?>
                <?php