add inventory daily

This commit is contained in:
2017-03-25 22:18:27 +01:00
parent 2b5f5f60fd
commit b9c442fe22
13 changed files with 262 additions and 34 deletions

View File

@@ -2,6 +2,8 @@
namespace backend\controllers;
use backend\components\InventoryManager;
use backend\models\InventorySearchAuto;
use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
Yii;
use common\models\Inventory;
@@ -45,6 +47,34 @@ class InventoryController extends Controller
]);
}
/**
* Lists all Inventory models.
* @return mixed
*/
public function actionDaily()
{
$searchModel = new InventorySearchAuto();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('daily', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Creates a new Inventory model with type daily.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreateDaily()
{
$inventoryManager = new InventoryManager();
$model = $inventoryManager->generateDaily();
return $this->redirect(['inventory-item/index', 'id' => $model->id_inventory]);
}
/**
* Creates a new Inventory model.
@@ -56,7 +86,8 @@ class InventoryController extends Controller
$model = new Inventory();
$user = User::findOne(\Yii::$app->user->id);
$model->status = Inventory::$STATUS_OPEN;
$model->status = Inventory::$STATUS_OPEN;
$model->type = Inventory::$TYPE_MANUAL;
$model->name = 'Leltár_'.date('Ymd_His') .'_' . $user->username;