fix merge conflicts
This commit is contained in:
commit
8f85d99a0a
31
backend/assets/InventoryItemCreateAsset.php
Normal file
31
backend/assets/InventoryItemCreateAsset.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
namespace backend\assets;
|
||||
|
||||
use yii\web\AssetBundle;
|
||||
|
||||
/**
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @since 2.0
|
||||
*/
|
||||
class InventoryItemCreateAsset extends AssetBundle
|
||||
{
|
||||
public $basePath = '@webroot';
|
||||
public $baseUrl = '@web';
|
||||
public $css = [
|
||||
];
|
||||
public $js = [
|
||||
'js/app.js',
|
||||
'js/inventory.item.create.js',
|
||||
];
|
||||
public $depends = [
|
||||
'backend\assets\AppAsset',
|
||||
'yii\jui\JuiAsset',
|
||||
'common\assets\TypeAheadAsset',
|
||||
];
|
||||
}
|
||||
@ -91,6 +91,7 @@ class AdminMenuStructure{
|
||||
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
|
||||
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index'] ];
|
||||
$items[] = ['label' => 'Leltár csoport', 'url' => ['/inventory-group/index'] ];
|
||||
$items[] = ['label' => 'Leltár', 'url' => ['/inventory/index'] ];
|
||||
$items[] = ['label' => 'Részletes eladások', 'url' => ['/transfer/sale' ,'TransferSaleSearch[start]' =>$todayDatetime,'TransferSaleSearch[end]' => $tomorrowDatetime ] ];
|
||||
$items[] = ['label' => 'Termék összesítő', 'url' => ['/product/statistics' ,'ProductStatisticsSearch[start]' =>$todayDatetime,'ProductStatisticsSearch[end]' => $tomorrowDatetime ] ];
|
||||
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
|
||||
|
||||
@ -13,6 +13,7 @@ use backend\models\CardImportRfidForm;
|
||||
use yii\web\UploadedFile;
|
||||
use common\components\Helper;
|
||||
use backend\models\CardInsertForm;
|
||||
use common\models\Ticket;
|
||||
|
||||
/**
|
||||
* CardController implements the CRUD actions for Card model.
|
||||
@ -32,7 +33,8 @@ class CardController extends \backend\controllers\BackendController {
|
||||
'update',
|
||||
'list' ,
|
||||
'import-rfid',
|
||||
'insert'
|
||||
'insert',
|
||||
'recalculate',
|
||||
],
|
||||
'allow' => true,
|
||||
'roles' => [
|
||||
@ -349,4 +351,21 @@ class CardController extends \backend\controllers\BackendController {
|
||||
}
|
||||
|
||||
|
||||
public function actionRecalculate(){
|
||||
|
||||
if (Yii::$app->request->isPost) {
|
||||
$connection = \Yii::$app->db;
|
||||
$command = $connection->createCommand( Ticket::$SQL_UPDATE );
|
||||
$result = $command->execute();
|
||||
\Yii::info("Tickets updated: " . $result );
|
||||
|
||||
|
||||
\Yii::$app->session->setFlash('success', 'Módosított bérletek száma: ' . $result);
|
||||
|
||||
}
|
||||
|
||||
return $this->render("recalculate");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
140
backend/controllers/InventoryController.php
Normal file
140
backend/controllers/InventoryController.php
Normal file
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\Inventory;
|
||||
use backend\models\InventorySearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use common\models\InventoryItem;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\components\Helper;
|
||||
use common\models\User;
|
||||
use common\models\Product;
|
||||
use common\models\InventoryGroup;
|
||||
use yii\db\Expression;
|
||||
use yii\db\Query;
|
||||
use backend\models\InventoryItemSearch;
|
||||
|
||||
/**
|
||||
* InventoryController implements the CRUD actions for Inventory model.
|
||||
*/
|
||||
class InventoryController extends Controller
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Inventory models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new InventorySearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single Inventory model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
$inventory = $this->findModel($id);
|
||||
|
||||
$searchModel = new InventoryItemSearch(['inventory' => $inventory]);
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
$query = new Query();
|
||||
|
||||
return $this->render('view', [
|
||||
'model' => $inventory,
|
||||
'dataProvider' => $dataProvider
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Inventory model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new Inventory();
|
||||
|
||||
$model->id_user = \Yii::$app->user->id;
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_inventory]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing Inventory model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_inventory]);
|
||||
} else {
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing Inventory model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Inventory model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return Inventory the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = Inventory::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
136
backend/controllers/InventoryItemController.php
Normal file
136
backend/controllers/InventoryItemController.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\InventoryItem;
|
||||
use backend\models\InventoryItemSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use backend\models\InventoryItemForm;
|
||||
use common\models\Inventory;
|
||||
|
||||
/**
|
||||
* InventoryItemController implements the CRUD actions for InventoryItem model.
|
||||
*/
|
||||
class InventoryItemController extends Controller
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all InventoryItem models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex($id)
|
||||
{
|
||||
$inventory = Inventory::findOne($id);
|
||||
|
||||
if ( !isset($inventory)){
|
||||
throw new NotFoundHttpException("Leltár nem található");
|
||||
}
|
||||
|
||||
$searchModel = new InventoryItemSearch(['inventory' => $inventory]);
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'model' => $inventory,
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single InventoryItem model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new InventoryItem model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate($id)
|
||||
{
|
||||
$model = new InventoryItemForm([
|
||||
'id_inventory' => $id
|
||||
]);
|
||||
|
||||
$model->read();
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['inventory-item/index', 'id' => $model->inventory->id_inventory]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing InventoryItem model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_inventory_item]);
|
||||
} else {
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing InventoryItem model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$item = $this->findModel($id);
|
||||
$id_inventory = $item->id_inventory;
|
||||
$item->delete();
|
||||
|
||||
return $this->redirect(['index', 'id' => $id_inventory]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the InventoryItem model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return InventoryItem the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = InventoryItem::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,8 @@ class DoorLogSearch extends DoorLog
|
||||
'door_log.direction as door_log_direction',
|
||||
'door_log.created_at as door_log_created_at',
|
||||
'door_log.source_app as door_log_source_app',
|
||||
'account.name as account_name'
|
||||
'account.name as account_name',
|
||||
'door_log.card_flag as door_log_card_flag',
|
||||
]);
|
||||
$query->from('door_log');
|
||||
$query->innerJoin('card','card.id_card = door_log.id_card');
|
||||
@ -131,6 +132,10 @@ class DoorLogSearch extends DoorLog
|
||||
'account_name' =>[
|
||||
'asc' => ['account.name' => SORT_ASC ],
|
||||
'desc' => ['account.name' => SORT_DESC],
|
||||
],
|
||||
'door_log_card_flag' =>[
|
||||
'asc' => ['door_log_card_flag' => SORT_ASC ],
|
||||
'desc' => ['door_log_card_flag' => SORT_DESC],
|
||||
]
|
||||
],
|
||||
]
|
||||
|
||||
273
backend/models/InventoryItemForm.php
Normal file
273
backend/models/InventoryItemForm.php
Normal file
@ -0,0 +1,273 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use common\models\Card;
|
||||
use common\models\Customer;
|
||||
use common\models\Ticket;
|
||||
use common\models\Account;
|
||||
use yii\web\UploadedFile;
|
||||
use common\models\Inventory;
|
||||
use yii\base\Exception;
|
||||
use common\models\Product;
|
||||
use common\models\InventoryGroup;
|
||||
use common\models\InventoryItem;
|
||||
use yii\db\Query;
|
||||
use common\models\Procurement;
|
||||
use common\models\Transfer;
|
||||
use common\models\Sale;
|
||||
|
||||
/**
|
||||
* ContactForm is the model behind the contact form.
|
||||
* @property \Yii\web\UploadedFile $file
|
||||
*/
|
||||
class InventoryItemForm extends Model{
|
||||
|
||||
/**Form data*/
|
||||
public $count;
|
||||
public $id_product;
|
||||
public $type;
|
||||
public $name;
|
||||
|
||||
/**common data*/
|
||||
public $inventory;
|
||||
public $last_inventory;
|
||||
public $id_inventory;
|
||||
public $products;
|
||||
public $inventoryGroups;
|
||||
|
||||
public $productOptions;
|
||||
|
||||
/**save data*/
|
||||
public $product;
|
||||
public $inventoryGroup;
|
||||
public $prevInventoryItem;
|
||||
|
||||
/** internal stuff*/
|
||||
public $product_in;
|
||||
public $product_out;
|
||||
public $product_stock;
|
||||
public $last_inventory_item;
|
||||
public $inventory_item;
|
||||
|
||||
public function rules(){
|
||||
return [
|
||||
[[ 'name', 'count'], 'required'],
|
||||
[['id_product','type','name'], 'string'],
|
||||
[['count'], 'integer'],
|
||||
['type','validateType','skipOnEmpty' => false, 'skipOnError' => false],
|
||||
['id_product','validateId','skipOnEmpty' => false, 'skipOnError' => false]
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public function validateType($attribute,$params){
|
||||
if ( array_search($this->type, ['product','group']) === false ){
|
||||
\Yii::error("Típus nem megfelelő: " . $this->type);
|
||||
$this->addError("name","Nincs termék vagy termék csoport kiválasztva");
|
||||
}
|
||||
}
|
||||
|
||||
public function validateId($attribute,$params){
|
||||
if ( !$this->hasErrors('type')){
|
||||
if ( $this->type == 'group'){
|
||||
$this->inventoryGroup = InventoryGroup::findOne($this->id_product);
|
||||
if ( !isset($this->inventoryGroup)){
|
||||
\Yii::error("Termék csoport nem található");
|
||||
$this->addError("name","Nincs termék vagy termék csoport kiválasztva");
|
||||
}
|
||||
}else{
|
||||
$this->product = Product::findOne($this->id_product);
|
||||
if ( !isset($this->product )){
|
||||
\Yii::error("Termék nem található");
|
||||
$this->addError("name","Nincs termék vagy termék csoport kiválasztva");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save(){
|
||||
if ( $this->validate()) {
|
||||
|
||||
$this->loadLastInventoryItem();
|
||||
$this->loadProductIn();
|
||||
$this->loadProductSold();
|
||||
$this->loadProductStock();
|
||||
|
||||
$item = new InventoryItem();
|
||||
$item->count_in = $this->product_in;
|
||||
$item->count_sold = $this->product_out;
|
||||
$item->count = $this->product_stock;
|
||||
|
||||
if ( isset( $this->last_inventory_item ) ){
|
||||
$item->id_inventory_item_prev = $this->last_inventory_item->id_inventory_item;
|
||||
$item->count_prev = $this->last_inventory_item->count;
|
||||
}else{
|
||||
$item->count_prev = 0;
|
||||
}
|
||||
|
||||
$item->id_user = \Yii::$app->user->id;
|
||||
|
||||
if ( $this->type == 'product'){
|
||||
$item->id_product = $this->product->id_product;
|
||||
}else{
|
||||
$item->id_inventory_group = $this->inventoryGroup->id_inventory_group;
|
||||
}
|
||||
$item->id_inventory = $this->inventory->id_inventory;
|
||||
|
||||
if ( !$item->save() ){
|
||||
throw new \Exception("Nem sikerült a leltár végrehajtása");
|
||||
}
|
||||
$this->inventory_item = $item;
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function loadProductIn(){
|
||||
$query = new Query();
|
||||
$query->select(['sum(procurement.count) as total_in']);
|
||||
$query->from(Procurement::tableName());
|
||||
$query->innerJoin(Product::tableName(),"product.id_product = procurement.id_product");
|
||||
|
||||
if ( isset($this->last_inventory_item ) ){
|
||||
$query->andWhere([ '>', 'procurement.created_at' ,$this->last_inventory_item->created_at]);
|
||||
}
|
||||
|
||||
if ( $this->type == 'product') {
|
||||
$query->andWhere(['product.id_product' => $this->product->id_product]);
|
||||
}else{
|
||||
$query->andWhere(['product.id_inventory_group' => $this->inventoryGroup->id_inventory_group]);
|
||||
}
|
||||
|
||||
$this->product_in = $query->scalar();
|
||||
|
||||
}
|
||||
|
||||
protected function loadProductSold(){
|
||||
|
||||
$query = new Query();
|
||||
$query->select(['sum(transfer.count) as total_sold']);
|
||||
$query->from(Transfer::tableName());
|
||||
$query->innerJoin(Sale::tableName(),"sale.id_sale = transfer.id_object and transfer.type = " .Transfer::TYPE_PRODUCT);
|
||||
$query->innerJoin(Product::tableName(),"product.id_product = sale.id_product ");
|
||||
$query->andWhere(['in', 'transfer.status' ,[Transfer::STATUS_PAID ,Transfer::STATUS_NOT_PAID ] ]);
|
||||
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||
|
||||
if ( $this->type == 'product') {
|
||||
$query->andWhere(['product.id_product' => $this->product->id_product]);
|
||||
}else{
|
||||
$query->andWhere(['product.id_inventory_group' => $this->inventoryGroup->id_inventory_group]);
|
||||
}
|
||||
|
||||
$this->product_out = $query->scalar();
|
||||
}
|
||||
|
||||
protected function loadProductStock(){
|
||||
|
||||
$query = new Query();
|
||||
$query->select(['sum(product.stock) as total_stock']);
|
||||
$query->from(Product::tableName());
|
||||
|
||||
if ( $this->type == 'product') {
|
||||
$query->andWhere(['product.id_product' => $this->product->id_product]);
|
||||
}else{
|
||||
$query->andWhere(['product.id_inventory_group' => $this->inventoryGroup->id_inventory_group]);
|
||||
}
|
||||
|
||||
$this->product_stock = $query->scalar();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function addProductItem(){
|
||||
|
||||
}
|
||||
|
||||
public function addGroupItem(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load previous inventory item, if exists
|
||||
* */
|
||||
protected function loadLastInventoryItem( ){
|
||||
if ( isset( $this->last_inventory ) ){
|
||||
$query = InventoryItem::find();
|
||||
$query->andWhere(['id_inventory' => $this->last_inventory->id_inventory]);
|
||||
|
||||
if ( $this->type == 'product'){
|
||||
$query->andWhere(['id_product' => $this->product->id_product]);
|
||||
}else{
|
||||
$query->andWhere(['id_inventory_group' => $this->inventoryGroup->id_inventory_group]);
|
||||
}
|
||||
|
||||
$this->last_inventory_item = $query->one();
|
||||
}
|
||||
}
|
||||
|
||||
public function read(){
|
||||
$this->loadInventory();
|
||||
$this->loadLastInventory();
|
||||
|
||||
$this->loadProducts();
|
||||
$this->loadInventoryGroups();
|
||||
|
||||
$this->buildProductList();
|
||||
|
||||
}
|
||||
|
||||
public function loadInventory(){
|
||||
$this->inventory = Inventory::findOne($this->id_inventory);
|
||||
if ( !isset( $this->inventory) ){
|
||||
throw new Exception("Nem található a leltár objektum");
|
||||
}
|
||||
}
|
||||
public function loadLastInventory(){
|
||||
$query = Inventory::find();
|
||||
$query->andWhere(['<', 'inventory.created_at' , $this->inventory->created_at]);
|
||||
$query->orderBy(['created_at' => SORT_DESC ]);
|
||||
$this->last_inventory =$query->limit(1)->one();
|
||||
}
|
||||
|
||||
public function loadProducts(){
|
||||
$query = Product::find();
|
||||
$query->andWhere("id_inventory_group is null");
|
||||
$query->andWhere(['status' => Product::STATUS_ACTIVE]);
|
||||
$this->products = $query->all();
|
||||
}
|
||||
|
||||
public function loadInventoryGroups(){
|
||||
$query = InventoryGroup::find();
|
||||
$query->andWhere(['status' => Product::STATUS_ACTIVE]);
|
||||
$this->inventoryGroups = $query->all();
|
||||
}
|
||||
|
||||
public function buildProductList(){
|
||||
$this->productOptions = [];
|
||||
|
||||
foreach ($this->products as $product ){
|
||||
$this->productOptions[]= [ 'type' =>'product', 'id' => $product->id_product ,'name' => $product->name . " (Termék/" .$product->productCategoryName ."/" . $product->accountName .")" ];
|
||||
|
||||
}
|
||||
|
||||
foreach ($this->inventoryGroups as $inventoryGroup ){
|
||||
$this->productOptions[] = ['type' =>'group', 'id' =>$inventoryGroup->id_inventory_group ,'name' =>$inventoryGroup->name ."/Termékcsoport" ];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'count' => 'Mennyiség'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
114
backend/models/InventoryItemSearch.php
Normal file
114
backend/models/InventoryItemSearch.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\InventoryItem;
|
||||
use yii\db\Query;
|
||||
use yii\db\Expression;
|
||||
use common\models\User;
|
||||
use common\models\Product;
|
||||
use common\models\InventoryGroup;
|
||||
use common\components\Helper;
|
||||
|
||||
/**
|
||||
* InventoryItemSearch represents the model behind the search form about `common\models\InventoryItem`.
|
||||
*/
|
||||
class InventoryItemSearch extends InventoryItem
|
||||
{
|
||||
public $inventory;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_inventory_item', 'id_inventory', 'count_in', 'count_sold', 'count', 'type', 'id_product', 'id_inventory_group', 'id_user'], 'integer'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = new Query();
|
||||
$query->select([
|
||||
'inventory_item.id_inventory_item as item_id_inventory_item',
|
||||
'inventory_item.created_at as item_created_at',
|
||||
new Expression('case when inventory_item.id_product is null then inventory_group.name else product.name end as item_name'),
|
||||
'user.username as user_username',
|
||||
'coalesce(inventory_item.count_prev ,0)as item_count_prev',
|
||||
'coalesce(inventory_item.count_in,0) as item_count_in',
|
||||
'coalesce(inventory_item.count_sold,0) as item_count_sold',
|
||||
'coalesce(inventory_item.count,0) as item_count',
|
||||
new Expression('(inventory_item.count - ( inventory_item.count_prev + inventory_item.count_in - inventory_item.count_sold )) as item_difference'),
|
||||
]);
|
||||
$query->from(InventoryItem::tableName());
|
||||
|
||||
|
||||
$query->innerJoin(User::tableName(), "user.id = inventory_item.id_user");
|
||||
$query->leftJoin(Product::tableName(), "product.id_product = inventory_item.id_product");
|
||||
$query->leftJoin(InventoryGroup::tableName(), "inventory_group.id_inventory_group = inventory_item.id_inventory_group");
|
||||
|
||||
$query->andWhere( ['id_inventory' => $this->inventory->id_inventory] );
|
||||
|
||||
$dataProvider = new ActiveDataProvider(
|
||||
['query' => $query ,
|
||||
'sort' => [
|
||||
'attributes' => Helper::mkYiiSortItems([
|
||||
['item_created_at', 'item_created_at'],
|
||||
['item_name', 'item_name'],
|
||||
['user_username', 'user_username'],
|
||||
['item_count_prev', 'item_count_prev'],
|
||||
['item_count_sold', 'item_count_sold'],
|
||||
['item_count_in', 'item_count_in'],
|
||||
['item_count', 'item_count'],
|
||||
['item_count', 'item_count'],
|
||||
['item_difference', 'item_difference'],
|
||||
])
|
||||
,
|
||||
]
|
||||
]
|
||||
);
|
||||
$this->load($params);
|
||||
|
||||
if (!$this->validate()) {
|
||||
// uncomment the following line if you do not want to return any records when validation fails
|
||||
// $query->where('0=1');
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id_inventory_item' => $this->id_inventory_item,
|
||||
'id_inventory' => $this->id_inventory,
|
||||
'count_in' => $this->count_in,
|
||||
'count_sold' => $this->count_sold,
|
||||
'count' => $this->count,
|
||||
'type' => $this->type,
|
||||
'id_product' => $this->id_product,
|
||||
'id_inventory_group' => $this->id_inventory_group,
|
||||
'id_user' => $this->id_user,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
||||
67
backend/models/InventorySearch.php
Normal file
67
backend/models/InventorySearch.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Inventory;
|
||||
|
||||
/**
|
||||
* InventorySearch represents the model behind the search form about `common\models\Inventory`.
|
||||
*/
|
||||
class InventorySearch extends Inventory
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_inventory', 'id_user'], 'integer'],
|
||||
[['created_at', 'updated_at'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = Inventory::find();
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
|
||||
$this->load($params);
|
||||
|
||||
if (!$this->validate()) {
|
||||
// uncomment the following line if you do not want to return any records when validation fails
|
||||
// $query->where('0=1');
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id_inventory' => $this->id_inventory,
|
||||
'id_user' => $this->id_user,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
||||
15
backend/views/card/recalculate.php
Normal file
15
backend/views/card/recalculate.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
?>
|
||||
<p>
|
||||
Bérletek kapu flag -jének újraszámolása
|
||||
</p>
|
||||
<?php
|
||||
|
||||
echo Html::a("Újra számolás", ['recalculate'], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
@ -61,6 +61,13 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'value' => function ($model, $key, $index, $column){
|
||||
return Helper::getArrayValue(DoorLog::getDirectionTypes(), $model['door_log_direction'],"-" );
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'door_log_card_flag',
|
||||
'label' => 'Info',
|
||||
'value' => function ($model, $key, $index, $column){
|
||||
return Helper::getArrayValue(DoorLog::getCardFlagTexts(), $model['door_log_card_flag'],"-" );
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'door_log_source_app',
|
||||
|
||||
27
backend/views/inventory-item/_form.php
Normal file
27
backend/views/inventory-item/_form.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\InventoryItem */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="inventory-item-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['autocomplete' => 'off']) ?>
|
||||
<?= $form->field($model, 'id_product')->hiddenInput()->label(false) ?>
|
||||
<?= $form->field($model, 'type')->hiddenInput()->label(false) ?>
|
||||
<?= $form->field($model, 'count')->textInput() ?>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton( Yii::t('common/inventory-item', 'Mentés') , ['class' => 'btn btn-success' ]) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
48
backend/views/inventory-item/_search.php
Normal file
48
backend/views/inventory-item/_search.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\InventoryItemSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="inventory-item-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id_inventory_item') ?>
|
||||
|
||||
<?= $form->field($model, 'id_inventory') ?>
|
||||
|
||||
<?= $form->field($model, 'count_in') ?>
|
||||
|
||||
<?= $form->field($model, 'count_sold') ?>
|
||||
|
||||
<?= $form->field($model, 'count') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'type') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'id_product') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'id_inventory_group') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'id_user') ?>
|
||||
|
||||
|
||||
<?php // echo $form->field($model, 'created_at') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'updated_at') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('common/inventory-item', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton(Yii::t('common/inventory-item', 'Reset'), ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
33
backend/views/inventory-item/create.php
Normal file
33
backend/views/inventory-item/create.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use backend\assets\InventoryItemCreateAsset;
|
||||
use yii\helpers\Url;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\InventoryItem */
|
||||
|
||||
$this->title = Yii::t('common/inventory-item', 'Új leltár elem');
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Leltár' , 'url' => ['inventory/view', 'id' => $model->inventory->id_inventory]];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
InventoryItemCreateAsset::register($this);
|
||||
|
||||
|
||||
$options = [];
|
||||
$options['products'] = $model->productOptions;
|
||||
$options['url_product_find'] = Url::toRoute(['product/find']);
|
||||
|
||||
$this->registerJs('inventoryItemCreate.init( '. json_encode($options) .' );');
|
||||
|
||||
?>
|
||||
<div class="inventory-item-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
103
backend/views/inventory-item/index.php
Normal file
103
backend/views/inventory-item/index.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\DetailView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\InventoryItemSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('common/inventory-item', 'Leltár részletei');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="inventory-item-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_inventory',
|
||||
['attribute'=>'id_user',
|
||||
'value'=>$model->userName
|
||||
],
|
||||
'created_at:datetime',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/inventory', 'Új termék'), ['inventory-item/create','id' =>$model->id_inventory], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
echo GridView::widget( [
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' =>[
|
||||
[
|
||||
'attribute' => 'item_created_at',
|
||||
'label' => 'Létrehozva',
|
||||
'format' => 'datetime'
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_name',
|
||||
'label' => 'Név',
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'user_username',
|
||||
'label' => 'Felhasználó',
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_count_prev',
|
||||
'label' => 'Előzö leltár (db)'
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_count_in',
|
||||
'label' => 'Beszerzett mennyiség (db)'
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_count_sold',
|
||||
'label' => 'Eladott mennyiség (db)',
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_count',
|
||||
'label' => 'Leltározott mennyiség (db)',
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_difference',
|
||||
'label' => 'Különbség (db)',
|
||||
|
||||
],
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{delete}',
|
||||
'urlCreator' => function ($action, $model, $key, $index){
|
||||
return Url::to(['inventory-item/delete', 'id' => $model['item_id_inventory_item' ] ]) ;
|
||||
},
|
||||
'buttons' =>[
|
||||
'delete' =>function ($url, $model, $key) {
|
||||
return Html::a('Törlés', $url,['class' => 'btn btn-xs btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('common/inventory-item', 'Biztosan törlöd ezt az elemet?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ;
|
||||
}
|
||||
]
|
||||
|
||||
]
|
||||
]
|
||||
|
||||
]);
|
||||
?>
|
||||
|
||||
</div>
|
||||
23
backend/views/inventory-item/update.php
Normal file
23
backend/views/inventory-item/update.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\InventoryItem */
|
||||
|
||||
$this->title = Yii::t('common/inventory-item', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Inventory Item',
|
||||
]) . ' ' . $model->id_inventory_item;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory-item', 'Inventory Items'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id_inventory_item, 'url' => ['view', 'id' => $model->id_inventory_item]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/inventory-item', 'Update');
|
||||
?>
|
||||
<div class="inventory-item-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
45
backend/views/inventory-item/view.php
Normal file
45
backend/views/inventory-item/view.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\InventoryItem */
|
||||
|
||||
$this->title = $model->id_inventory_item;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory-item', 'Inventory Items'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="inventory-item-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/inventory-item', 'Update'), ['update', 'id' => $model->id_inventory_item], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a(Yii::t('common/inventory-item', 'Delete'), ['delete', 'id' => $model->id_inventory_item], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('common/inventory-item', 'Are you sure you want to delete this item?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_inventory_item',
|
||||
'id_inventory',
|
||||
'count_in',
|
||||
'count_sold',
|
||||
'count',
|
||||
'type',
|
||||
'id_product',
|
||||
'id_inventory_group',
|
||||
'id_user',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
22
backend/views/inventory/_form.php
Normal file
22
backend/views/inventory/_form.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Inventory */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="inventory-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/inventory', 'Létrehoz') : Yii::t('common/inventory', 'Módosít'), [ 'name'=>'Inventory[submit]' ,'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
33
backend/views/inventory/_search.php
Normal file
33
backend/views/inventory/_search.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\InventorySearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="inventory-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id_inventory') ?>
|
||||
|
||||
<?= $form->field($model, 'id_user') ?>
|
||||
|
||||
<?= $form->field($model, 'created_at') ?>
|
||||
|
||||
<?= $form->field($model, 'updated_at') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('common/inventory', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton(Yii::t('common/inventory', 'Reset'), ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
21
backend/views/inventory/create.php
Normal file
21
backend/views/inventory/create.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Inventory */
|
||||
|
||||
$this->title = Yii::t('common/inventory', 'Új leltár');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory', 'Leltár lista'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="inventory-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
43
backend/views/inventory/index.php
Normal file
43
backend/views/inventory/index.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\InventorySearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('common/inventory', 'Leltár lista');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="inventory-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/inventory', 'Új leltár'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
|
||||
'id_inventory',
|
||||
'id_user',
|
||||
'created_at:datetime',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view}',
|
||||
'urlCreator' => function( $action, $model, $key, $index ){
|
||||
if ( $action == 'view' ){
|
||||
return Url::to(['inventory-item/index' , 'id'=> $model->id_inventory]);
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
23
backend/views/inventory/update.php
Normal file
23
backend/views/inventory/update.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Inventory */
|
||||
|
||||
$this->title = Yii::t('common/inventory', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Inventory',
|
||||
]) . ' ' . $model->id_inventory;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory', 'Inventories'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id_inventory, 'url' => ['view', 'id' => $model->id_inventory]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/inventory', 'Update');
|
||||
?>
|
||||
<div class="inventory-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
88
backend/views/inventory/view.php
Normal file
88
backend/views/inventory/view.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
use yii\grid\GridView;
|
||||
use yii\base\Widget;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Inventory */
|
||||
|
||||
$this->title = $model->id_inventory;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory', 'Leltár lista'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = "Leltár";
|
||||
?>
|
||||
<div class="inventory-view">
|
||||
|
||||
<h1><?= Html::encode("Leltár") ?></h1>
|
||||
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_inventory',
|
||||
['attribute'=>'id_user',
|
||||
'value'=>$model->userName
|
||||
],
|
||||
'created_at:datetime',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/inventory', 'Új termék'), ['inventory-item/create','id' =>$model->id_inventory], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
|
||||
echo GridView::widget( [
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' =>[
|
||||
[
|
||||
'attribute' => 'item_created_at',
|
||||
'label' => 'Létrehozva',
|
||||
'format' => 'datetime'
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_name',
|
||||
'label' => 'Név',
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'user_username',
|
||||
'label' => 'Felhasználó',
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_count_prev',
|
||||
'label' => 'Előzö leltár (db)'
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_count_in',
|
||||
'label' => 'Beszerzett mennyiség (db)'
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_count_sold',
|
||||
'label' => 'Eladott mennyiség (db)',
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_count',
|
||||
'label' => 'Leltározott mennyiség (db)',
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'item_difference',
|
||||
'label' => 'Különbség (db)',
|
||||
|
||||
],
|
||||
]
|
||||
|
||||
]);
|
||||
?>
|
||||
|
||||
59
backend/web/js/inventory.item.create.js
Normal file
59
backend/web/js/inventory.item.create.js
Normal file
@ -0,0 +1,59 @@
|
||||
|
||||
|
||||
var inventoryItemCreate = {
|
||||
|
||||
defaults : {
|
||||
products: [],
|
||||
selector_type : '#inventoryitemform-type',
|
||||
selector_name : '#inventoryitemform-name',
|
||||
selector_id : '#inventoryitemform-id_product',
|
||||
},
|
||||
product: null,
|
||||
init: function(o){
|
||||
this.defaults = $.extend( this.defaults, o );
|
||||
console.info(this.defaults.products);
|
||||
this.initAutocomplete();
|
||||
|
||||
},
|
||||
|
||||
initAutocomplete : function (){
|
||||
var self = this;
|
||||
|
||||
var $input = $(self.defaults.selector_name);
|
||||
$input.typeahead({source : self.defaults.products,
|
||||
autoSelect: true,
|
||||
items: 20,
|
||||
minLength: 3,
|
||||
});
|
||||
$input.change(function() {
|
||||
var current = $input.typeahead("getActive");
|
||||
$("#filter_text").val('');
|
||||
if (current) {
|
||||
// Some item from your model is active!
|
||||
if (current.name == $input.val()) {
|
||||
self.product = current;
|
||||
} else {
|
||||
self.product = null;
|
||||
}
|
||||
} else {
|
||||
self.product = null;
|
||||
}
|
||||
self.productChange();
|
||||
});
|
||||
},
|
||||
productChange: function( ){
|
||||
this.clearProductData();
|
||||
this.setProductData();
|
||||
},
|
||||
clearProductData: function(){
|
||||
$(this.defaults.selector_type).val('');
|
||||
$(this.defaults.selector_id).val('');
|
||||
},
|
||||
setProductData: function(){
|
||||
if ( this.product ){
|
||||
$(this.defaults.selector_type).val( this.product.type);
|
||||
$(this.defaults.selector_id).val( this.product.id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,6 @@
|
||||
-0.0.52
|
||||
- card flag
|
||||
- inventory item
|
||||
-0.0.51
|
||||
- fix storno @transfers -> delete from carts on storno
|
||||
-0.0.50
|
||||
|
||||
@ -166,4 +166,10 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
]);
|
||||
}
|
||||
|
||||
public static function updateCardFlagTicket($id){
|
||||
$db = \Yii::$app->db;
|
||||
$command = $db->createCommand(Ticket::$SQL_UPDATE_CARD,[':id' => $id]);
|
||||
$command->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -140,4 +140,13 @@ class DoorLog extends \yii\db\ActiveRecord
|
||||
19 => "Bérlet érvényességi időn kívüli BE olvastatás (nem enged)",
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCardFlagTexts( ){
|
||||
return [
|
||||
0 => "Kártya ok",
|
||||
1 => "Nincs érvényes bérlet",
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
60
common/models/Inventory.php
Normal file
60
common/models/Inventory.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use common\components\UserAwareBehavior;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
/**
|
||||
* This is the model class for table "inventory".
|
||||
*
|
||||
* @property integer $id_inventory
|
||||
* @property integer $id_user
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class Inventory extends \common\models\BaseFitnessActiveRecord
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'inventory';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id_inventory' => Yii::t('common/inventory', 'Leltár azonosító'),
|
||||
'id_user' => Yii::t('common/inventory', 'Felhasználó'),
|
||||
'created_at' => Yii::t('common/inventory', 'Létrehozás'),
|
||||
'updated_at' => Yii::t('common/inventory', 'Módosítás'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function behaviors()
|
||||
{
|
||||
return ArrayHelper::merge( [
|
||||
[
|
||||
'class' => UserAwareBehavior::className(),
|
||||
]
|
||||
], parent::behaviors());
|
||||
}
|
||||
}
|
||||
135
common/models/InventoryItem.php
Normal file
135
common/models/InventoryItem.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use common\components\UserAwareBehavior;
|
||||
use common\components\Helper;
|
||||
|
||||
/**
|
||||
* This is the model class for table "inventory_item".
|
||||
*
|
||||
* @property integer $id_inventory_item
|
||||
* @property integer $id_inventory
|
||||
* @property integer $count_in
|
||||
* @property integer $count_sold
|
||||
* @property integer $count
|
||||
* @property integer $count_prev
|
||||
* @property integer $type
|
||||
* @property integer $id_product
|
||||
* @property integer $id_inventory_group
|
||||
* @property integer $id_user
|
||||
* @property integer $id_inventory_item_prev
|
||||
* @property integer $id_user
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class InventoryItem extends BaseFitnessActiveRecord
|
||||
{
|
||||
|
||||
public static $TYPE_PRODUCT = 10;
|
||||
public static $TYPE_INVENTORY_GROUP = 20;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'inventory_item';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id_inventory_item' => Yii::t('common/inventory_item', 'Id Inventory Item'),
|
||||
'id_inventory' => Yii::t('common/inventory_item', 'Id Inventory'),
|
||||
'count_in' => Yii::t('common/inventory_item', 'Count In'),
|
||||
'count_sold' => Yii::t('common/inventory_item', 'Count Sold'),
|
||||
'count' => Yii::t('common/inventory_item', 'Count'),
|
||||
'type' => Yii::t('common/inventory_item', 'Type'),
|
||||
'id_product' => Yii::t('common/inventory_item', 'Id Product'),
|
||||
'id_inventory_group' => Yii::t('common/inventory_item', 'Id Inventory Group'),
|
||||
'id_user' => Yii::t('common/inventory_item', 'Id User'),
|
||||
'created_at' => Yii::t('common/inventory_item', 'Created At'),
|
||||
'updated_at' => Yii::t('common/inventory_item', 'Updated At'),
|
||||
];
|
||||
}
|
||||
public function behaviors()
|
||||
{
|
||||
return ArrayHelper::merge( [
|
||||
[
|
||||
'class' => UserAwareBehavior::className(),
|
||||
]
|
||||
], parent::behaviors());
|
||||
}
|
||||
|
||||
public static function creqteQueryInventoryItems($id_inventory ) {
|
||||
$query = InventoryItem::find();
|
||||
|
||||
$query->andWhere(['inventory_item.id_inventory' => $id_inventory]);
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getProduct(){
|
||||
return $this->hasOne( Product::className() , [ 'id_product' => 'id_product' ]);
|
||||
}
|
||||
|
||||
public function getInventoryGroup(){
|
||||
return $this->hasOne( Product::className() , [ 'id_inventory_group' => 'id_inventory_group' ]);
|
||||
}
|
||||
|
||||
public function getProductName(){
|
||||
$result = "";
|
||||
|
||||
$product = $this->product;
|
||||
|
||||
if ( isset($product)){
|
||||
$result = $product->name;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
public function getInventoryGroupName(){
|
||||
$result = "";
|
||||
|
||||
$product = $this->inventoryGroup;
|
||||
|
||||
if ( isset($product)){
|
||||
$result = $product->name;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
$name = "";
|
||||
|
||||
if ( isset($this->id_product )){
|
||||
$name = $this->getProductName();
|
||||
}else{
|
||||
$name = $this->getInventoryGroupName();
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
||||
public function getDifference(){
|
||||
$diff = $this->count - ( $this->count_prev + $this->count_in - $this->count_sold );
|
||||
return $diff;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -36,6 +36,20 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
|
||||
const STATUS_ACTIVE = 10;
|
||||
const STATUS_INACTIVE = 20;
|
||||
|
||||
public static $SQL_UPDATE = "UPDATE card as c1
|
||||
left JOIN ( select distinct ticket.id_card as id_card from ticket
|
||||
where ticket.start <= CURDATE() and ticket.end >= curdate() and ticket.status = 10 ) as t
|
||||
on t.id_card = c1.id_card
|
||||
SET c1.flag = case when t.id_card is null then ( c1.flag | 1 << 0 ) else ( c1.flag & ~(1 << 0) ) end";
|
||||
|
||||
public static $SQL_UPDATE_CARD = "UPDATE card as c1
|
||||
left JOIN ( select distinct ticket.id_card as id_card from ticket
|
||||
where ticket.start <= CURDATE() and ticket.end >= curdate() and ticket.status = 10 ) as t
|
||||
on t.id_card = c1.id_card
|
||||
SET c1.flag = case when t.id_card is null then ( c1.flag | 1 << 0 ) else ( c1.flag & ~(1 << 0) ) end
|
||||
WHERE c1.id_card = :id";
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@ -312,4 +326,13 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function afterSave($insert, $changedAttributes) {
|
||||
Card::updateCardFlagTicket($this->id_card);;
|
||||
}
|
||||
|
||||
public function afterDelete(){
|
||||
Card::updateCardFlagTicket($this->id_card);;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -927,6 +927,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
||||
] );
|
||||
}
|
||||
|
||||
|
||||
// storno contract
|
||||
|
||||
} else if ($this->type == Transfer::TYPE_PRODUCT) {
|
||||
|
||||
@ -16,7 +16,7 @@ return [
|
||||
'targets' => [
|
||||
[
|
||||
'class' => 'yii\log\FileTarget',
|
||||
'levels' => ['error', 'warning'],
|
||||
'levels' => ['error', 'warning','info'],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
21
console/controllers/TicketController.php
Normal file
21
console/controllers/TicketController.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace console\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models;
|
||||
use yii\console\Controller;
|
||||
use common\models\Ticket;
|
||||
|
||||
class TicketController extends Controller{
|
||||
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$connection = \Yii::$app->db;
|
||||
$command = $connection->createCommand( Ticket::$SQL_UPDATE );
|
||||
$result = $command->execute();
|
||||
\Yii::info("Tickets updated: " . $result );
|
||||
echo "Tickets updated: " . $result ;
|
||||
}
|
||||
|
||||
}
|
||||
58
console/migrations/m160306_130115_add_inventory_item.php
Normal file
58
console/migrations/m160306_130115_add_inventory_item.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m160306_130115_add_inventory_item extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$tableOptions = null;
|
||||
if ($this->db->driverName === 'mysql') {
|
||||
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||
}
|
||||
|
||||
|
||||
$this->createTable('{{%inventory}}', [
|
||||
'id_inventory' => $this->primaryKey(),
|
||||
'id_user' => $this->integer(11),
|
||||
'created_at' => $this->dateTime()->notNull(),
|
||||
'updated_at' => $this->dateTime()->notNull(),
|
||||
], $tableOptions);
|
||||
|
||||
$this->createTable('{{%inventory_item}}', [
|
||||
'id_inventory_item' => $this->primaryKey(),
|
||||
'id_inventory' => $this->integer(11),
|
||||
'count_in' => $this->integer(11),
|
||||
'count_sold' => $this->integer(11),
|
||||
'count' => $this->integer(11),
|
||||
'type' => $this->integer(11),
|
||||
'id_product' => $this->integer(11),
|
||||
'id_inventory_group' => $this->integer(11),
|
||||
'id_user' => $this->integer(11),
|
||||
'last_inventroy_at' => $this->dateTime(),
|
||||
'created_at' => $this->dateTime()->notNull(),
|
||||
'updated_at' => $this->dateTime()->notNull(),
|
||||
], $tableOptions);
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m160306_130115_add_inventory_item cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class m160307_174038_alter__tablle__inventory_item__add__column_id_inventory_prev__count_prev extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->addColumn("inventory_item", "id_inventory_item_prev", "int");
|
||||
$this->addColumn("inventory_item", "count_prev", "int");
|
||||
$this->dropColumn("inventory_item", 'last_inventroy_at');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m160307_174038_alter__tablle__inventory_item__add__column_id_inventory_prev__count_prev cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
31
console/migrations/m160308_201451_add_door_flag.php
Normal file
31
console/migrations/m160308_201451_add_door_flag.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m160308_201451_add_door_flag extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->addColumn("door_log", "card_flag", "int default 0");
|
||||
$this->addColumn("card", "flag", "int default 0");
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m160308_201451_add_door_flag cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
2
cutler_daily.sh
Normal file
2
cutler_daily.sh
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
php yii ticket/index
|
||||
@ -115,6 +115,8 @@ class ReceptionForm extends Model
|
||||
|
||||
$dlog->id_account = Account::readDefault();
|
||||
|
||||
$dlog->card_flag = $this->card->flag;
|
||||
|
||||
$dlog->created_at = date('Y-m-d H:i:s');
|
||||
$dlog->save(false);
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ use yii\base\Object;
|
||||
use common\models\TicketInstallmentRequest;
|
||||
use common\models\Contract;
|
||||
use common\components\Helper;
|
||||
use common\models\Card;
|
||||
|
||||
/**
|
||||
* @property $cart string name of cart, into we put the ticket
|
||||
@ -158,9 +159,14 @@ class TicketCreate extends Ticket{
|
||||
$this->appendToUserCart();
|
||||
$this->appendToCustomerCart();
|
||||
$this->addContract($insert);
|
||||
$this->updateCardFlag();
|
||||
|
||||
}
|
||||
|
||||
protected function updateCardFlag(){
|
||||
Card::updateCardFlagTicket($this->id_card);
|
||||
}
|
||||
|
||||
public function addContract($insert){
|
||||
if ($insert){
|
||||
$ticketType = TicketType::findOne($this->id_ticket_type);
|
||||
|
||||
@ -5,6 +5,9 @@ use frontend\model\ReceptionForm;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use common\models\Contract;
|
||||
use common\components\Helper;
|
||||
use common\models\Card;
|
||||
use common\models\DoorLog;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model frontend\model\ReceptionForm */
|
||||
@ -19,28 +22,38 @@ if ( count($model->tickets) > 0 ){
|
||||
|
||||
if ( isset($model->card)){
|
||||
if ( isset($model->customer)){
|
||||
if ( isset($ticket)){
|
||||
echo Html::beginTag("div",['class'=>"alert alert-success" , "role"=>"alert"]);
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Érvényes bérlet!" ;
|
||||
echo Html::endTag("strong");
|
||||
echo Html::tag("br");
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Típus: " ;
|
||||
echo Html::endTag("strong");
|
||||
echo $ticket->ticketTypeName ;
|
||||
echo Html::tag("br");
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Érvényes: " ;
|
||||
echo Html::endTag("strong");
|
||||
echo Yii::$app->formatter->asDate($ticket->start);
|
||||
echo " - ";
|
||||
echo Yii::$app->formatter->asDate($ticket->end);
|
||||
echo Html::endTag("div");
|
||||
}else{
|
||||
if ( $model->card->flag == 0 ){
|
||||
if ( isset($ticket)){
|
||||
echo Html::beginTag("div",['class'=>"alert alert-success" , "role"=>"alert"]);
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Érvényes bérlet!" ;
|
||||
echo Html::endTag("strong");
|
||||
echo Html::tag("br");
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Típus: " ;
|
||||
echo Html::endTag("strong");
|
||||
echo $ticket->ticketTypeName ;
|
||||
echo Html::tag("br");
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Érvényes: " ;
|
||||
echo Html::endTag("strong");
|
||||
echo Yii::$app->formatter->asDate($ticket->start);
|
||||
echo " - ";
|
||||
echo Yii::$app->formatter->asDate($ticket->end);
|
||||
echo Html::endTag("div");
|
||||
}else{
|
||||
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Bérlet lejárt vagy nem érvényes!";
|
||||
echo Html::endTag("strong");
|
||||
echo Html::endTag("div");
|
||||
}
|
||||
} else{
|
||||
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
||||
echo "Kártya korlátozás:";
|
||||
echo "<br>";
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Bérlet lejárt vagy nem érvényes!";
|
||||
echo Helper::getArrayValue(DoorLog::getCardFlagTexts(), $model->card->flag, "Ismeretlen ok") ;
|
||||
echo Html::endTag("strong");
|
||||
echo Html::endTag("div");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user