add indexes, add messagedetsta

This commit is contained in:
Roland Schneider 2016-01-29 17:13:33 +01:00
parent ad59cbb940
commit a00331ce7c
65 changed files with 3195 additions and 92 deletions

View File

@ -0,0 +1,27 @@
<?php
namespace backend\components;
use yii\base\Widget;
class AdminCustomerTabWidget extends Widget{
public $customer;
public $card;
public $title;
public $viewFile = '//common/_customer_tab';
public function init(){
parent::init();
$this->card = $this->customer->card;
}
public function run(){
echo $this->render($this->viewFile,[ 'card' => $this->card, 'customer' => $this->customer ,'title' => $this->title ]);
}
}

View File

@ -89,6 +89,7 @@ class AdminMenuStructure{
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/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,
'items' => $items
];
@ -108,6 +109,7 @@ class AdminMenuStructure{
// Tartós megbízások
/////////////////////////////
$items = [];
$items[] = ['label' => 'Szerződések', 'url' => ['/contract/index' ] ];
$items[] = ['label' => 'Megbízások', 'url' => ['/ticket-installment-request/index' , 'TicketInstallmentRequestSearch[start]' =>$today,'TicketInstallmentRequestSearch[end]' => $tomorrow ] ];
$items[] = ['label' => 'Giro kötegbe jelölés', 'url' => ['/ticket-installment-request/pending' , 'TicketInstallmentRequestSearchPending[end]' => $tomorrow ] ];
$items[] = ['label' => 'GIRO köteg létrehozás', 'url' => ['/ticket-installment-request/download-giro' ] ];

View File

@ -228,7 +228,7 @@ class CardController extends \backend\controllers\BackendController {
$card = Card::find()->andWhere(['number' => $item['number']])->one();
if ( $card != null ){
$card->rfid_key = $item['key'];
$sql = "update card set rfid_key = '" .$item['key'] ."' where id_card = " .$card->id_card .";";
$sql = "update card set rfid_key = '" . strtolower( $item['key'] )."' where id_card = " .$card->id_card .";";
$sqls[] = $sql;
$i++;
}else{

View File

@ -0,0 +1,143 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\Contract;
use backend\models\ContractSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use backend\models\ContractCustomerSearch;
use common\models\Customer;
/**
* ContractController implements the CRUD actions for Contract model.
*/
class ContractController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Contract models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new ContractSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Lists all Contract models.
* @return mixed
*/
public function actionIndexCustomer($id)
{
$model = Customer::findOne($id);
if ( !isset($model)){
throw new NotFoundHttpException('The requested page does not exist.');
}
$searchModel = new ContractCustomerSearch(['customer' => $model]);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index-customer', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Contract model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Contract model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Contract();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_contract]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Contract 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_contract]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Contract 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 Contract model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Contract the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Contract::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -8,6 +8,8 @@ use backend\models\KeySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\Customer;
use backend\models\KeyCustomerSearch;
/**
* KeyController implements the CRUD actions for Key model.
@ -41,6 +43,28 @@ class KeyController extends Controller
'dataProvider' => $dataProvider, //csomagoló osztály a queryhez
]);
}
/**
* Lists all Key models.
* @return mixed
*/
public function actionIndexCustomer($id)
{
$model = Customer::findOne($id);
if ( !isset($model)){
throw new NotFoundHttpException('The requested page does not exist.');
}
$searchModel = new KeyCustomerSearch(['customer' => $model]);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
// backend/views/kex/index.php
return $this->render('index-customer', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider, //csomagoló osztály a queryhez
]);
}
/**
* Displays a single Key model.

View File

@ -0,0 +1,137 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\MessageDetsta;
use backend\models\MessageDetstaSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\components\giro\GiroDETSTA;
use common\components\DetStaDBSave;
/**
* MessageDetstaController implements the CRUD actions for MessageDetsta model.
*/
class MessageDetstaController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all MessageDetsta models.
* @return mixed
*/
public function actionIndex()
{
$filename = \Yii::getAlias("@backend") ."/web/giro/valasz/detsta.txt";
$ugiro = GiroDETSTA::parse(file_get_contents($filename));
file_put_contents("c:\\tmp\\detsta.txt", $ugiro->toString());
$saver = new DetStaDBSave(
[
'giroDETSTA' => $ugiro,
'koteg' => null,
'idUser' =>\Yii::$app->user->id
]);
$saver->run();
$searchModel = new MessageDetstaSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single MessageDetsta model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new MessageDetsta model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new MessageDetsta();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_message]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing MessageDetsta 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_message]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing MessageDetsta 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 MessageDetsta model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return MessageDetsta the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = MessageDetsta::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -12,6 +12,7 @@ use common\models\Warehouse;
use common\models\Product;
use common\models\User;
use common\components\Helper;
use common\models\Account;
/**
* ProcurementController implements the CRUD actions for Procurement model.
@ -92,6 +93,8 @@ class ProcurementController extends \backend\controllers\BackendController
$model = new Procurement();
$model->scenario = 'create_general';
$accounts = Account::find()->andWhere(['status' => Account::STATUS_ACTIVE])->andWhere(['type' => Account::TYPE_ALL])->all();
$model->id_user = Yii::$app->user->id;
$warehouses = Warehouse::read(null);
@ -137,7 +140,8 @@ class ProcurementController extends \backend\controllers\BackendController
} else {
return $this->render('create', [
'model' => $model,
'warehouses' =>$warehouses
'warehouses' =>$warehouses,
'accounts' => $accounts
]);
}
}

View File

@ -10,6 +10,8 @@ use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\Account;
use common\models\ProductCategory;
use backend\models\ProductStatisticsSearch;
use PHPExcel;
/**
* ProductController implements the CRUD actions for Product model.
@ -17,6 +19,24 @@ use common\models\ProductCategory;
class ProductController extends \backend\controllers\BackendController
{
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// allow authenticated users
[
'actions' => ['create','index','view','update','statistics'],
'allow' => true,
'roles' => ['admin','employee','reception'],
],
// everything else is denied
],
],
];
}
/**
* Lists all Product models.
@ -106,6 +126,60 @@ class ProductController extends \backend\controllers\BackendController
return $this->redirect(['index']);
}
public function actionStatistics(){
$searchModel = new ProductStatisticsSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
if ( $searchModel->output == 'xls' ){
$models = $dataProvider->getModels();
$objPHPExcel = new \PHPExcel();
$sheet = $objPHPExcel->setActiveSheetIndex(0);
$row = 1;
$sheet->setCellValue('A'.$row, "Termék név")
->setCellValue('B'.$row, "Eladási ár")
->setCellValue('C'.$row, "Kassza")
->setCellValue('D'.$row, "Eladott mennyiség")
->setCellValue('E'.$row, "Eladás összege");
foreach ($models as $model ){
$row++;
$sheet->setCellValue('A'.$row, $model['product_name'])
->setCellValue('B'.$row, $model['product_sale_price'])
->setCellValue('C'.$row, $model['father_account_name'])
->setCellValue('D'.$row, $model['transfer_count'])
->setCellValue('E'.$row, $model['transfer_money']);
}
// Redirect output to a clients web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="termek_statisztika.xls"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be needed
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header ('Pragma: public'); // HTTP/1.0
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}
return $this->render('statistics', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Finds the Product model based on its primary key value.

View File

@ -15,6 +15,7 @@ use common\models\User;
use common\models\Customer;
use common\models\Card;
use backend\models\TicketSearchStatisitcs;
use backend\models\TicketSearchCustomer;
/**
* TicketController implements the CRUD actions for Ticket model.
@ -128,7 +129,7 @@ class TicketController extends \backend\controllers\BackendController {
throw new NotFoundHttpException ( 'The requested page does not exist.' );
}
$searchModel = new TicketSearch ();
$searchModel = new TicketSearchCustomer(['customer' => $customer]);
$searchModel->id_card = $customer->id_customer_card;
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
$searchModel->searchTotals ();

View File

@ -7,6 +7,8 @@ use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Card;
use common\models\Customer;
use yii\db\Query;
use common\models\Key;
/**
* CardSearch represents the model behind the search form about `common\models\Card`.
@ -15,6 +17,9 @@ class CardSearch extends Card
{
public $searchCustomerName;
public $searchKeyNumber;
public $usage;
public $key_assigned;
/**
* @inheritdoc
@ -22,8 +27,8 @@ class CardSearch extends Card
public function rules()
{
return [
[['id_card', 'status', 'type'], 'integer'],
[[ 'searchCustomerName', 'number','rfid_key', 'created_at', 'updated_at'], 'safe'],
[['id_card', 'status', 'type','usage'], 'integer'],
[[ 'searchCustomerName', 'number','rfid_key', 'created_at', 'updated_at','searchKeyNumber','key_assigned'], 'safe'],
];
}
@ -47,14 +52,64 @@ class CardSearch extends Card
{
$query = Card::find();
$query = new Query();
$query->select([
'card.id_card as card_id_card',
'card.number as card_number',
'card.rfid_key as card_rfid_key',
'card.status as card_status',
'card.type as card_type',
'customer.name as customer_name' ,
'customer.id_customer as customer_id_customer',
'key.number as key_number',
]);
$query->from(Card::tableName());
$query->leftJoin(Customer::tableName(), 'customer.id_customer_card = card.id_card');
$query->leftJoin("card_key_assignment", 'card.id_card = card_key_assignment.id_card');
$query->leftJoin(Key::tableName(), 'key.id_key = card_key_assignment.id_key');
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' =>[
'defaultOrder' => [
'card_number' => SORT_ASC
],
'attributes' => [
'card_number' => [
'asc' => ['card.number' => SORT_ASC ],
'desc' => ['card.number' => SORT_DESC],
],
'card_rfid_key' => [
'asc' => ['card.rfid_key' => SORT_ASC ],
'desc' => ['card.rfid_key' => SORT_DESC],
],
'card_status' => [
'asc' => ['card.status' => SORT_ASC ],
'desc' => ['card.status' => SORT_DESC],
],
'card_type' => [
'asc' => ['card.type' => SORT_ASC ],
'desc' => ['card.type' => SORT_DESC],
],
'customer_name' => [
'asc' => ['customer.name' => SORT_ASC ],
'desc' => ['customer.name' => SORT_DESC],
],
'customer_id_customer' => [
'asc' => ['customer.id_customer' => SORT_ASC ],
'desc' => ['customer.id_customer' => SORT_DESC],
],
'key_number' => [
'asc' => ['key.number' => SORT_ASC ],
'desc' => ['key.number' => SORT_DESC],
],
]
]
]);
$dataProvider->sort ->attributes['customerName'] =[
'asc' => ['customer.name' => SORT_ASC ],
'desc' => ['customer.name' => SORT_DESC ],
];
$this->load($params);
@ -64,7 +119,6 @@ class CardSearch extends Card
return $dataProvider;
}
$query->leftJoin(Customer::tableName(), 'customer.id_customer_card = card.id_card');
$query->andFilterWhere([
'card.status' => $this->status,
@ -74,6 +128,19 @@ class CardSearch extends Card
$query->andFilterWhere(['like', 'card.number', $this->number]);
$query->andFilterWhere(['like', 'card.rfid_key', $this->rfid_key]);
$query->andFilterWhere(['like', 'customer.name', $this->searchCustomerName]);
if ( $this->usage == '1') {
$query->andWhere('customer.id_customer is not null');
}else if ( $this->usage == '2') {
$query->andWhere('customer.id_customer is null');
}
if ( $this->key_assigned == '1') {
$query->andWhere('key.id_key is not null');
}else if ( $this->key_assigned == '2') {
$query->andWhere('key.id_key is null');
}
Key::addKeyConditionOptional($query, $this->searchKeyNumber);
return $dataProvider;
}

View File

@ -0,0 +1,79 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Contract;
/**
* ContractSearch represents the model behind the search form about `common\models\Contract`.
*/
class ContractCustomerSearch extends Contract
{
public $customer;
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_contract', 'id_user', 'id_customer', 'status', 'flag', 'part_paid', 'part_count', 'part_required', 'id_ticket_type'], 'integer'],
[['expired_at', '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 = Contract::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_contract' => $this->id_contract,
'id_user' => $this->id_user,
'id_customer' => $this->id_customer,
'status' => $this->status,
'flag' => $this->flag,
'part_paid' => $this->part_paid,
'part_count' => $this->part_count,
'part_required' => $this->part_required,
'expired_at' => $this->expired_at,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'id_ticket_type' => $this->id_ticket_type,
]);
$query->andWhere(['contract.id_customer' => $this->customer->id_customer]);
return $dataProvider;
}
}

View File

@ -0,0 +1,151 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Contract;
use yii\db\Query;
/**
* ContractSearch represents the model behind the search form about `common\models\Contract`.
*/
class ContractSearch extends Contract
{
public $customer_name;
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_contract', 'id_customer', 'status', 'flag', 'part_paid', 'part_count', 'part_required', 'id_ticket_type'], 'integer'],
[['customer_name' ], '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 = new Query();
$query->select([
'contract.id_contract as contract_id_contract',
'user.username as user_name',
'customer.id_customer as customer_id_customer',
'customer.name as customer_name',
'contract.status as contract_status',
'contract.flag as contract_flag',
'contract.part_required as contract_part_required',
'contract.part_paid as contract_part_paid',
'contract.part_count as contract_part_count',
'contract.created_at as contract_created_at',
'contract.expired_at as contract_expired_at',
]);
$query->from('contract');
$query->innerJoin('user' ,'user.id = contract.id_user');
$query->innerJoin('customer' ,'customer.id_customer = contract.id_customer');
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' =>[
'defaultOrder' =>[
'contract_id_contract' => SORT_ASC
],
'attributes' =>[
'contract_id_contract' => [
'asc' => ['contract.id_contract' => SORT_ASC ],
'desc' => ['contract.id_contract' => SORT_DESC],
],
'user_name' => [
'asc' => ['user.username' => SORT_ASC ],
'desc' => ['user.username' => SORT_DESC],
],
'customer_id_customer' => [
'asc' => ['customer.id_customer' => SORT_ASC ],
'desc' => ['customer.id_customer' => SORT_DESC],
],
'customer_name' => [
'asc' => ['customer.name' => SORT_ASC ],
'desc' => ['customer.name' => SORT_DESC],
],
'contract_status' => [
'asc' => ['contract.status' => SORT_ASC ],
'desc' => ['contract.status' => SORT_DESC],
],
'contract_flag' => [
'asc' => ['contract.flag' => SORT_ASC ],
'desc' => ['contract.flag' => SORT_DESC],
],
'contract_part_required' => [
'asc' => ['contract.part_required' => SORT_ASC ],
'desc' => ['contract.part_required' => SORT_DESC],
],
'contract_part_paid' => [
'asc' => ['contract.part_paid' => SORT_ASC ],
'desc' => ['contract.part_paid' => SORT_DESC],
],
'contract_part_count' => [
'asc' => ['contract.part_count' => SORT_ASC ],
'desc' => ['contract.part_count' => SORT_DESC],
],
'contract_created_at' => [
'asc' => ['contract.created_at' => SORT_ASC ],
'desc' => ['contract.created_at' => SORT_DESC],
],
'contract_expired_at' => [
'asc' => ['contract.expired_at' => SORT_ASC ],
'desc' => ['contract.expired_at' => SORT_DESC],
],
]
],
]);
$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([
'contract.id_contract' => $this->id_contract,
'contract.id_user' => $this->id_user,
'contract.id_customer' => $this->id_customer,
'contract.status' => $this->status,
'contract.flag' => $this->flag,
'contract.part_paid' => $this->part_paid,
'contract.part_count' => $this->part_count,
'contract.part_required' => $this->part_required,
'contract.expired_at' => $this->expired_at,
'contract.created_at' => $this->created_at,
'contract.updated_at' => $this->updated_at,
'contract.id_ticket_type' => $this->id_ticket_type,
]);
$query->andFilterWhere(['like', 'customer.name', $this->customer_name]);
return $dataProvider;
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Key;
use yii\db\Query;
/**
* KeySearch represents the model behind the search form about `common\models\Key`.
*/
class KeyCustomerSearch extends Key
{
public $customer;
/**
* @inheritdoc
*/
public function rules()
{
return [
/*[['id_key', 'status', 'type'], 'integer'],
[['number', 'created_at', 'updated_at'], 'safe'],*/
[['number'], 'safe'],
[['rfid_key'], '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 = new Query();
$query->select(['key.number','key.rfid_key','key.created_at','key.status','key.type','card_key_assignment.created_at as assigned_at']);
$query->from('key');
$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([
]);
$query->innerJoin('card_key_assignment', 'card_key_assignment.id_key = key.id_key');
$query->innerJoin('customer', 'card_key_assignment.id_card = customer.id_customer_card');
$query->andWhere(['customer.id_customer' => $this->customer->id_customer]);
return $dataProvider;
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\MessageDetsta;
/**
* MessageDetstaSearch represents the model behind the search form about `common\models\MessageDetsta`.
*/
class MessageDetstaSearch extends MessageDetsta
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_message', 'id_user'], 'integer'],
[['path', '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 = MessageDetsta::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_message' => $this->id_message,
'id_user' => $this->id_user,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'path', $this->path]);
return $dataProvider;
}
}

View File

@ -0,0 +1,184 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\ProductCategory;
use yii\db\Query;
use common\models\Transfer;
use common\models\Product;
use common\models\Account;
use common\components\Helper;
use common\components\RoleDefinition;
/**
* ProductCategorySearch represents the model behind the search form about `common\models\ProductCategory`.
*/
class ProductStatisticsSearch extends Product
{
public $start;
public $end;
public $timestampStart;
public $timestampEnd;
/**
* if output is 'xls', dataprovider pagination will be false
* */
public $output = '';
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_product_category', 'status','id_account'], 'integer'],
[['name','barcode','product_number','output' ], 'safe'],
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
];
}
/**
* @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([
'product.id_product as product_id_product',
'product.name as product_name',
'product.sale_price as product_sale_price',
'product.product_number as product_number',
'product.barcode as product_barcode',
"father_account.name as father_account_name",
// "coalesce(account.name,'-') as account_name",
'coalesce(sum(transfer.count),0) as transfer_count',
'coalesce(sum(transfer.money),0) as transfer_money',
]);
$query->from("product");
$query->innerJoin('account as father_account','father_account.id_account = product.id_account');
$query->innerJoin('product_category','product_category.id_product_category = product.id_product_category');
$query->leftJoin("sale" ,'sale.id_product = product.id_product ' );
$query->leftJoin("transfer" ,'transfer.id_object = sale.id_sale and transfer.type =' .Transfer::TYPE_PRODUCT );
$query->leftJoin('account','account.id_account = transfer.id_account');
if ( !RoleDefinition::isAdmin() ){
$query->innerJoin ( "user_account_assignment", 'father_account.id_account = user_account_assignment.id_account' );
$query->andWhere ( [
'user_account_assignment.id_user' => Yii::$app->user->id
] );
$query->andWhere(['account.type' => Account::TYPE_ALL]);
}
$query->andWhere(['in' , 'transfer.status',[Transfer::STATUS_PAID,Transfer::STATUS_NOT_PAID]]);
$query->groupBy([
'product.id_product',
'product.name',
'product.sale_price',
'father_account.name',
'product.barcode',
'product.product_number',
]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' =>[
'defaultOrder' =>[
'product_name' => SORT_ASC
],
'attributes' =>[
'product_name' => [
'asc' => ['product.name' => SORT_ASC ],
'desc' => ['product.name' => SORT_DESC],
],
'product_number' => [
'asc' => ['product.product_number' => SORT_ASC ],
'desc' => ['product.product_number' => SORT_DESC],
],
'product_barcode' => [
'asc' => ['product.barcode' => SORT_ASC ],
'desc' => ['product.barcode' => SORT_DESC],
],
'father_account_name' => [
'asc' => ['father_account.name' => SORT_ASC ],
'desc' => ['father_account.name' => SORT_DESC],
],
'product_sale_price' => [
'asc' => ['product.sale_price' => SORT_ASC ],
'desc' => ['product.sale_price' => SORT_DESC],
],
'transfer_count' => [
'asc' => ['coalesce(sum(transfer.count),0)' => SORT_ASC ],
'desc' => ['coalesce(sum(transfer.count),0)' => SORT_DESC],
],
'transfer_money' => [
'asc' => ['coalesce(sum(transfer.money),0)' => SORT_ASC ],
'desc' => ['coalesce(sum(transfer.money),0)' => SORT_DESC],
],
// 'account_name' => [
// 'asc' => ['account.name' => SORT_ASC ],
// 'desc' => ['account.name' => SORT_DESC],
// ],
]
],
]);
$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;
}
if ( $this->output == 'xls'){
$dataProvider->pagination = false;
}
$query->andFilterWhere([
'product_category.id_product_category' => $this->id_product_category,
'product.barcode' => Helper::fixAsciiChars($this->barcode),
'product.product_number' => Helper::fixAsciiChars($this->product_number),
'product.name' => ($this->name),
'product.id_account' => ($this->id_account),
// 'id_product_category' => $this->id_product_category,
]);
$created_condition = ['and',[ '>=', 'transfer.created_at', $this->timestampStart ] ,[ '<', 'transfer.created_at', $this->timestampEnd ] ];
$paid_condition = ['and',[ '>=', 'transfer.paid_at', $this->timestampStart ] ,[ '<', 'transfer.paid_at', $this->timestampEnd ] ];
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
// $query->andFilterWhere(['like', 'product.name', $this->name]);
return $dataProvider;
}
}

View File

@ -30,6 +30,8 @@ class TicketSearch extends Ticket
public $statistics;
public $statisticsTotal;
public $customer;
/**
* @inheritdoc

View File

@ -0,0 +1,296 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Ticket;
use common\components\Helper;
use yii\db\ActiveRecord;
use yii\helpers\ArrayHelper;
use yii\db\Query;
use common\models\Transfer;
/**
* TicketSearch represents the model behind the search form about `common\models\Ticket`.
*/
class TicketSearchCustomer extends Ticket
{
public $timestampStart;
public $timestampEnd;
public $users;
public $accounts;
public $ticketTypes;
public $valid_in_interval;
public $created_in_interval;
public $expire_in_interval;
public $statistics;
public $statisticsTotal;
public $customer;
/**
* @inheritdoc
*/
public function rules()
{
return [
[[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account','status'], 'integer'],
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[['valid_in_interval','created_in_interval','expire_in_interval'],'boolean'] ,
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
public function attributeLabels(){
return ArrayHelper::merge(parent::attributeLabels(), [
'start' => Yii::t('backend/ticket','Start of interval'),
'end' => Yii::t('backend/ticket','End of interval'),
'valid_in_interval' => Yii::t('backend/ticket','Valid in interval'),
'created_in_interval' => Yii::t('backend/ticket','Created in interval'),
'expire_in_interval' => Yii::t('backend/ticket','Expire in interval'),
]);
}
public function afterValidate(){
if ( !isset($this->timestampStart)) {
$this->timestampStart ='1900-01-01';
}
if ( !isset($this->timestampEnd)) {
$this->timestampEnd ='3000-01-01';
}
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = new Query();
$query->select([
'ticket.id_ticket as ticket_id_ticket',
'account.name as account_name',
'card.number as card_number',
'ticket_type.name as ticket_type_name',
'ticket.start as ticket_start',
'ticket.end as ticket_end',
'ticket.max_usage_count as ticket_max_usage_count',
'ticket.usage_count as ticket_usage_count',
'user.username as user_username',
'paid_by.username as paid_by_username',
'ticket.status as ticket_status',
'ticket.price_brutto as ticket_price_brutto',
]);
$query->from('ticket');
$query->innerJoin('ticket_type', 'ticket_type.id_ticket_type = ticket.id_ticket_type');
$query->innerJoin('transfer', 'transfer.id_object = ticket.id_ticket and transfer.type = ' . Transfer::TYPE_TICKET);
$query->innerJoin('account', 'account.id_account = ticket.id_account');
$query->innerJoin('user', 'user.id = transfer.id_user');
$query->leftJoin('user as paid_by', 'paid_by.id = transfer.paid_by');
$query->leftJoin('card', 'ticket.id_card = card.id_card');
$query->leftJoin('customer', 'customer.id_customer_card = card.id_card');
Helper::queryAccountConstraint($query, 'ticket.id_account');
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' =>[
// 'defaultOrder' => ['end' => SORT_DESC],
'attributes' => [
// 'end',
'ticket_id_ticket' => [
'asc' => ['ticket.id_ticket' => SORT_ASC ],
'desc' => ['ticket.id_ticket' => SORT_DESC],
],
'ticket_start' => [
'asc' => ['ticket.start' => SORT_ASC ],
'desc' => ['ticket.start' => SORT_DESC],
],
'ticket_end' => [
'asc' => ['ticket.end' => SORT_ASC ],
'desc' => ['ticket.end' => SORT_DESC],
],
'user_username' => [
'asc' => ['user.username' => SORT_ASC ],
'desc' => ['user.username' => SORT_DESC],
],
'paid_by_username' => [
'asc' => ['paid_by.username' => SORT_ASC ],
'desc' => ['paid_by.username' => SORT_DESC],
],
'ticket_type_name' => [
'asc' => ['ticket_type.name' => SORT_ASC ],
'desc' => ['ticket_type.name' => SORT_DESC],
],
'account_name' => [
'asc' => ['account.name' => SORT_ASC ],
'desc' => ['account.name' => SORT_DESC],
],
'ticket_status' => [
'asc' => ['ticket.status' => SORT_ASC ],
'desc' => ['ticket.status' => SORT_DESC],
],
'ticket_price_brutto' => [
'asc' => ['ticket.price_brutto' => SORT_ASC ],
'desc' => ['ticket.price_brutto' => SORT_DESC],
],
// 'id_card' => [
// 'asc' => ['card.number' => SORT_ASC ],
// 'desc' => ['card.number' => SORT_DESC],
// ],
]
]
]);
$this->load($params);
if (!$this->validate()) {
$query->where('0=1');
return $query;
}
$query->andFilterWhere([
'ticket.id_user' => $this->id_user,
'ticket.id_ticket_type' => $this->id_ticket_type,
'ticket.id_account' => $this->id_account,
'ticket.id_card' => $this->id_card,
'ticket.id_ticket' => $this->id_ticket,
'ticket.status' => $this->status
]);
$query->andWhere(['customer.id_customer' => $this->customer->id_customer]);
$all = (!($this->valid_in_interval) && !($this->expire_in_interval) && !($this->created_in_interval) )
||
($this->valid_in_interval == true && $this->expire_in_interval == true && $this->created_in_interval);
$dateConditions = [];
$start = $this->timestampStart;
$end = $this->timestampEnd;
if( $all || $this->created_in_interval ){
$dateConditions[] = Helper::queryInIntervalRule('ticket.created_at', $start, $end);
}
if ( $all || $this->valid_in_interval ){
$dateConditions[] = Helper::queryValidRule('ticket.start', 'ticket.end', $start, $end);
}
if ( $all || $this->expire_in_interval ){
$dateConditions[] = Helper::queryExpireRule('ticket.start', 'ticket.end', $start, $end);
}
if ( count($dateConditions) == 1 ){
$query->andWhere($dateConditions[0]);
}else if ( count($dateConditions) > 1 ){
$cond = ['or'];
foreach ($dateConditions as $c){
$cond[] = $c;
}
$query->andWhere($cond);
}
return $dataProvider;
}
public function searchTotals(){
$query = Ticket::mkStatisticQuery($this->timestampStart, $this->timestampEnd,$this->id_card);
$this->statistics = $query->all();
$this->statisticsTotal =[
'valid' => 0,
'created' => 0,
'created_at_money' => 0,
'expired' => 0,
];
$this->statisticsTotal['valid'] = array_sum(array_column($this->statistics, 'valid'));
$this->statisticsTotal['created'] = array_sum(array_column($this->statistics, 'created'));
$this->statisticsTotal['created_money'] = array_sum(array_column($this->statistics, 'created_money'));
$this->statisticsTotal['expired'] = array_sum(array_column($this->statistics, 'expired'));
}
public static function mkSearchCondition( $timestampStart, $timestampEnd, $id_user,$id_ticket_tpye,$id_account,$valid_in_interval ,$expire_in_interval,$created_in_interval ){
$query = Ticket::find();
Helper::queryAccountConstraint($query, 'ticket.id_account');
$query->with('ticketType' );
$query->with('user');
$query->with('customer');
$query->andFilterWhere([
'id_user' => $id_user,
'id_ticket_type' => $id_ticket_type,
'id_account' => $id_account,
]);
$all = (!($valid_in_interval) && !($expire_in_interval) && !($created_in_interval) )
||
($valid_in_interval == true && $expire_in_interval == true && $created_in_interval);
$dateConditions = [];
$start = $timestampStart;
$end = $timestampEnd;
if( $all || $created_in_interval ){
$dateConditions[] = Helper::queryInIntervalRule('ticket.created_at', $start, $end);
}
if ( $all || $valid_in_interval ){
$dateConditions[] = Helper::queryValidRule('ticket.start', 'ticket.end', $start, $end);
}
if ( $all || $expire_in_interval ){
$dateConditions[] = Helper::queryExpireRule('ticket.start', 'ticket.end', $start, $end);
}
if ( count($dateConditions) == 1 ){
$query->andWhere($dateConditions[0]);
}else if ( count($dateConditions) > 1 ){
$cond = ['or'];
foreach ($dateConditions as $c){
$cond[] = $c;
}
$query->andWhere($cond);
}
}
}

View File

@ -45,7 +45,7 @@ $userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($users,'id','username')
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) ?>
])->label('Időszak kezdete') ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'end') ->widget(DatePicker::classname(), [
@ -53,7 +53,7 @@ $userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($users,'id','username')
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) ?>
]) ->label('Időszak vége') ?>
</div>
</div>

View File

@ -49,6 +49,15 @@ $statusOptions = mkOptions(Card::statuses());
<div class='col-md-3'>
<?= $form->field($model, 'rfid_key')->textInput() ?>
</div>
<div class='col-md-3'>
<?= $form->field($model, 'searchKeyNumber')->textInput()->label("Kulcs") ?>
</div>
<div class='col-md-3'>
<?= $form->field($model, 'usage')->dropDownList(['' => 'Mind' , '1' => 'Használt', '2' => 'Üres' ])->label("Használat") ?>
</div>
<div class='col-md-3'>
<?= $form->field($model, 'key_assigned')->dropDownList(['' => 'Mind' , '1' => 'Kulcs hozzárendelve', '2' => 'Kulcs nélkül' ])->label("Kulcs hozzárendelés") ?>
</div>
</div>

View File

@ -2,6 +2,8 @@
use yii\helpers\Html;
use yii\grid\GridView;
use common\models\Card;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\CardSearch */
@ -10,6 +12,13 @@ use yii\grid\GridView;
$this->title = Yii::t('common/card', 'Cards');
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
.grid-view a{
margin-right: 6px;
}
</style>
<div class="card-index">
<h1><?= Html::encode($this->title) ?></h1>
@ -23,33 +32,63 @@ $this->params['breadcrumbs'][] = $this->title;
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'number',
'value' => 'number'
'attribute' => 'card_number',
'label' => 'Kártyaszám'
],
[
'attribute' => 'rfid_key',
'value' => 'rfid_key'
'attribute' => 'card_rfid_key',
'label' => 'RFID szám'
],
[
'attribute' => 'status',
'value' => 'statusHuman'
'attribute' => 'card_status',
'label' => 'Státusz',
'value' => function ($model, $key, $index, $column){
return Card::toStatusName($model['card_status'],'-');
}
],
[
'attribute' => 'type',
'value' => 'typeHuman'
],
[
'attribute' => 'customerName',
'value' => 'customerName'
],
'updated_at:datetime',
[
'attribute' => 'card_type',
'label' => 'Típus',
'value' => function ($model, $key, $index, $column){
return Card::toTypeName($model['card_type'],'-');
}
],
[
'attribute' => 'customer_id_customer',
'label' => 'Vendég azonosító'
],
[
'attribute' => 'customer_name',
'label' => 'Vendég név'
],
[
'attribute' => 'key_number',
'label' => 'Kulcs száma'
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view}{update}'
],
'template' => '{view}{update}',
'urlCreator' => function ($action, $model, $key, $index){
$result = "";
if ( 'view' == $action ){
$result = Url::toRoute(['card/view' , 'id' => $model['card_id_card'] ]);
}else if ( 'update' == $action ){
$result = Url::toRoute(['card/update' , 'id' => $model['card_id_card'] ]);
}
return $result;
},
'buttons' =>[
'view' => function ($url, $model, $key) {
return Html::a("Nézet" ,$url,['class' =>'btn btn-primary btn-xs']);
},
'update' => function ($url, $model, $key) {
return Html::a("Módosít" ,$url,['class' =>'btn btn-primary btn-xs']);
},
]
],
],
]); ?>

View File

@ -0,0 +1,53 @@
<?php
use yii\helpers\Url;
?>
<?php
$route = \Yii::$app->controller->id .'/'. \Yii::$app->controller->action->id;
$items = [
// [ 'Recepció', ['customer/reception', 'number' => $card->number ]],
// [ 'Termék eladás', ['product/sale', 'number' => $card->number ]],
[ 'Információ', ['customer/view', 'id' => $customer->id_customer ]],
[ 'Adatlap', ['customer/update', 'id' => $customer->id_customer ]],
[ 'Befizetések', ['ticket/index-customer', 'id' => $customer->id_customer ]],
[ 'Kulcsok', ['key/index-customer','id' => $customer->id_customer ]],
[ 'Szerződések', ['contract/index-customer', 'id' => $customer->id_customer ]],
// [ 'Kosár', ['transfer/customer-cart', 'id_card' => $card->id_card ]],
];
?>
<ul class="nav nav-tabs">
<?php foreach ($items as $item){?>
<?php
if ( empty($title)){
if ( $item[1][0] == $route) {
$title = $item[0];
}
}
?>
<li role="presentation" class="<?php echo $item[1][0] == $route ? 'active' : '' ?>"><a href="<?php echo Url::toRoute($item[1])?>"><?php echo $item[0] ?></a></li>
<?php }?>
</ul>
<?php if ( !empty($title)) {?>
<h1><?php echo $title?></h1>
<p>Vendég: <?php echo $card->customer->name ?></p>
<p>Kártyaszám: <?php echo $card->number ?></p>
<?php }?>

View File

@ -0,0 +1,45 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="contract-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_contract')->textInput() ?>
<?= $form->field($model, 'id_user')->textInput() ?>
<?= $form->field($model, 'id_customer')->textInput() ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'flag')->textInput() ?>
<?= $form->field($model, 'part_paid')->textInput() ?>
<?= $form->field($model, 'part_count')->textInput() ?>
<?= $form->field($model, 'part_required')->textInput() ?>
<?= $form->field($model, 'expired_at')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<?= $form->field($model, 'id_ticket_type')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/door_log', 'Create') : Yii::t('common/door_log', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,49 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\ContractSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="contract-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_contract') ?>
<?= $form->field($model, 'id_user') ?>
<?= $form->field($model, 'id_customer') ?>
<?= $form->field($model, 'status') ?>
<?= $form->field($model, 'flag') ?>
<?php // echo $form->field($model, 'part_paid') ?>
<?php // echo $form->field($model, 'part_count') ?>
<?php // echo $form->field($model, 'part_required') ?>
<?php // echo $form->field($model, 'expired_at') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'id_ticket_type') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/door_log', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('common/door_log', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,40 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\ContractSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="contract-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'id_contract')->label('Szerződés azonosító') ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'id_customer')->label('Vendég azonosító') ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'customer_name')->label('Vendég neve') ?>
</div>
<div class="col-md-3">
</div>
</div>
<div class="form-group">
<?= Html::submitButton("Keresés", ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
$this->title = Yii::t('common/door_log', 'Create Contract');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/door_log', 'Contracts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="contract-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,57 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use backend\components\AdminCustomerTabWidget;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\ContractSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = "Vendég szerződések";
$this->params['breadcrumbs'][] = "Vendég";
$this->params['breadcrumbs'][] = "Szerződések";
?>
<?php echo AdminCustomerTabWidget::widget(['customer' => $searchModel->customer]) ?>
<div class="contract-index">
<?php // echo $this->render('_search-customer', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'label' => 'Szerződés azonosító',
'value' => 'id_contract',
'attribute' =>'id_contract',
],
[
'label' => 'Felhasználó',
'value' => 'userName',
'attribute' =>'id_user',
],
[
'label' => 'Státusz',
'value' => 'statusName',
'attribute' =>'status',
],
[
'label' => 'Állapot',
'value' => 'flagName',
'attribute' =>'flag',
],
[
'label' => 'Lejárat',
'value' => 'expired_at',
'attribute' =>'expired_at',
'format' => 'date'
],
'created_at:datetime',
// ['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,85 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use common\models\Contract;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\ContractSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = "Szerződések";
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="contract-index">
<h1><?php echo "Szerződések" ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
/*
* 'contract.id_contract as contract_id_contract',
'user.username as user_name',
'customer.id_customer as customer_id_customer',
'customer.name as customer_name',
'customer.status as customer_status',
'customer.flags as customer_flags',*/
[
'attribute' => 'contract_id_contract' ,
'label' =>'Szerződés azonosító'
],
[
'attribute' => 'user_name' ,
'label' =>'Felhasználó'
],
[
'attribute' => 'customer_id_customer' ,
'label' =>'Vendég azonosító'
],
[
'attribute' => 'customer_name' ,
'label' =>'Vendég név'
],
[
'attribute' => 'contract_status' ,
'label' =>'Státusz',
'value' => function ($model, $key, $index, $column){
return Contract::toStatusName($model['contract_status']);
}
],
[
'attribute' => 'contract_flag' ,
'label' =>'Állapot',
'value' => function ($model, $key, $index, $column){
return Contract::toFlangName($model['contract_flag']);
}
],
[
'attribute' => 'contract_part_count' ,
'label' =>'Összes részlet'
],
[
'attribute' => 'contract_part_required' ,
'label' =>'Esedékes részletek'
],
[
'attribute' => 'contract_part_paid' ,
'label' =>'Részletek fizetve'
],
[
'attribute' => 'contract_created_at' ,
'label' =>'Létrehozva',
'format' => 'date'
],
[
'attribute' => 'contract_expired_at' ,
'label' =>'Lejárat',
'format' => 'date'
],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
$this->title = Yii::t('common/door_log', 'Update {modelClass}: ', [
'modelClass' => 'Contract',
]) . ' ' . $model->id_contract;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/door_log', 'Contracts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_contract, 'url' => ['view', 'id' => $model->id_contract]];
$this->params['breadcrumbs'][] = Yii::t('common/door_log', 'Update');
?>
<div class="contract-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,46 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
$this->title = $model->id_contract;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/door_log', 'Contracts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="contract-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('common/door_log', 'Update'), ['update', 'id' => $model->id_contract], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('common/door_log', 'Delete'), ['delete', 'id' => $model->id_contract], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('common/door_log', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_contract',
'id_user',
'id_customer',
'status',
'flag',
'part_paid',
'part_count',
'part_required',
'expired_at',
'created_at',
'updated_at',
'id_ticket_type',
],
]) ?>
</div>

View File

@ -1,18 +1,18 @@
<?php
use yii\helpers\Html;
use backend\components\AdminCustomerTabWidget;
/* @var $this yii\web\View */
/* @var $model common\models\Customer */
$this->title = Yii::t('common/customer', 'Módosítás: ' ) . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_customer]];
$this->title = "Vendég módosítása";
$this->params['breadcrumbs'][] = "Vendég";
$this->params['breadcrumbs'][] = Yii::t('common/customer', 'Update');
?>
<?php echo AdminCustomerTabWidget::widget(['customer' => $model]) ?>
<div class="customer-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form_update', [
'model' => $model,

View File

@ -2,21 +2,21 @@
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\base\Widget;
use backend\components\AdminCustomerTabWidget;
/* @var $this yii\web\View */
/* @var $model common\models\Customer */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$this->title = "Vendég információk";
$this->params['breadcrumbs'][] = "Vendég";
$this->params['breadcrumbs'][] = "Információk";
?>
<?php echo AdminCustomerTabWidget::widget(['customer' => $model]) ?>
<div class="customer-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('common/customer', 'Update'), ['update', 'id' => $model->id_customer], ['class' => 'btn btn-primary']) ?>
</p>
<?= DetailView::widget([
'model' => $model,

View File

@ -0,0 +1,53 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use common\models\Key;
use backend\components\AdminCustomerTabWidget;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\KeySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('backend/key', 'Keys');
$this->params['breadcrumbs'][] = "Vendég";
$this->params['breadcrumbs'][] = "Kulcsok";
?>
<?php echo AdminCustomerTabWidget::widget(['customer' => $searchModel->customer]) ?>
<div class="key-index">
<?= GridView::widget([
'dataProvider' => $dataProvider,
//'filterModel' => $searchModel, // ezt nem szeretjük
'columns' => [
// ['class' => 'yii\grid\SerialColumn'],
// 'id_key',
[
'attribute' => 'number',
'label' => "Kulcs szám",
],
[
'attribute' => 'rfid_key',
'label' => "RFID kód",
],
[
'attribute' => 'status',
'value' => function ($model, $key, $index, $column){
$statuszok = Key::statuses();
$result = $statuszok[$model['status']];
return $result;
}
],
[
'attribute' => 'assigned_at',
'label' => "Kiadva",
'format' =>'datetime'
],
],
]); ?>
</div>

View File

@ -0,0 +1,31 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\MessageDetsta */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="message-detsta-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_message')->textInput() ?>
<?= $form->field($model, 'path')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'id_user')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/message_detsta', 'Create') : Yii::t('common/message_detsta', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,35 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\MessageDetstaSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="message-detsta-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_message') ?>
<?= $form->field($model, 'path') ?>
<?= $form->field($model, 'id_user') ?>
<?= $form->field($model, 'created_at') ?>
<?= $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/message_detsta', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('common/message_detsta', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\MessageDetsta */
$this->title = Yii::t('common/message_detsta', 'Create Message Detsta');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/message_detsta', 'Message Detstas'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="message-detsta-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,38 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\MessageDetstaSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/message_detsta', 'Message Detstas');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="message-detsta-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('common/message_detsta', 'Create Message Detsta'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id_message',
'path',
'id_user',
'created_at',
'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\MessageDetsta */
$this->title = Yii::t('common/message_detsta', 'Update {modelClass}: ', [
'modelClass' => 'Message Detsta',
]) . ' ' . $model->id_message;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/message_detsta', 'Message Detstas'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_message, 'url' => ['view', 'id' => $model->id_message]];
$this->params['breadcrumbs'][] = Yii::t('common/message_detsta', 'Update');
?>
<div class="message-detsta-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,171 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\MessageDetsta */
$this->title = $model->id_message;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/message_detsta', 'Message Detstas'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="message-detsta-view">
<?php
echo Html::a("Vissza a köteghez",['ugiro/view', 'id' => $model->id_ugiro] ,[ 'class' => 'btn btn-primary']);
?>
<div class="row">
<div class="col-md-4">
<h1>Fej</h1>
<?= DetailView::widget([
'model' => $model->fej,
'attributes' => [
[
'attribute' => 'record_tipus' ,
'label' => 'Rekord típus'
],
[
'attribute' => 'uzenet_tipus' ,
'label' => 'Üzenet típus'
],
[
'attribute' => 'jelentes_jelzo' ,
'label' => 'Jelentés jelző'
],
[
'attribute' => 'kezdemenyezo_azonosito' ,
'label' => 'Kezdeményező azonosító'
],
[
'attribute' => 'csoportos_uzenet_sorszam' ,
'label' => 'Csoportos üzenet sorszám'
],
[
'attribute' => 'csoportos_uzenet_datum' ,
'label' => 'Csoportos üzenet dátum',
'format' => 'date'
],
[
'attribute' => 'detsta_uzenet_sorszam' ,
'label' => 'Detsta üzenet sorszám'
],
[
'attribute' => 'detsta_uzenet_datum' ,
'label' => 'Detsta üzenet dátum',
'format' => 'date'
],
[
'attribute' => 'ido' ,
'label' => 'Idő'
],
],
]) ?>
</div>
<div class="col-md-4">
<h1>Láb</h1>
<?= DetailView::widget([
'model' => $model->lab,
'attributes' => [
[
'attribute' => 'record_tipus' ,
'label' => 'Rekord típus'
],
[
'attribute' => 'teljesitett_tetelek_szama' ,
'label' => 'Teljesített tételek száma'
],
[
'attribute' => 'teljesitett_tetelek_osszerteke' ,
'label' => 'Teljesített tételek összértéke'
],
[
'attribute' => 'visszautasitott_tetelek_szama' ,
'label' => 'Visszautasított tételek száma'
],
[
'attribute' => 'visszautasitott_tetelek_osszerteke' ,
'label' => 'Visszautasított tételek összértéke'
],
[
'attribute' => 'megnemvalaszolt_tetelek_szama' ,
'label' => 'Meg nem válaszolt tételek száma'
],
[
'attribute' => 'megnemvalaszolt_tetelek_osszerteke' ,
'label' => 'Meg nem válaszolt tételek összértéke'
],
],
]) ?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<h1>Tételek</h1>
<?php
$tetelek = $model->tetelek;
foreach ($tetelek as $tetel){
echo "<h2>Tétel: ".$tetel->tetel_sorszam."</h2>";
echo DetailView::widget([
'model' => $tetel,
'attributes' => [
[
'attribute' => 'record_tipus' ,
'label' => 'Rekord típus'
],
[
'attribute' => 'tetel_sorszam' ,
'label' => 'Tétel sorszám'
],
[
'attribute' => 'osszeg' ,
'label' => 'Összeg'
],
[
'attribute' => 'eredeti_tetel_elszamolasi_datuma' ,
'label' => 'Eredeti tétel elszámolási dátum'
],
[
'attribute' => 'visszajelzes_informacio' ,
'label' => 'Visszajelzés Informacio'
],
[
'attribute' => 'terhelesi_datum' ,
'label' => 'Terhelési dátuma'
],
[
'attribute' => 'feldolgozas_datum' ,
'label' => 'Feldolgozás dátuma'
],
[
'attribute' => 'valasz_hivatkozasi_kod' ,
'label' => 'Válasz hivatkozási kód'
],
[
'attribute' => 'eredeti_hivatkozasi_kod' ,
'label' => 'Eredeti hivatkozási kód'
],
[
'attribute' => 'ugyfel_azonosito' ,
'label' => 'Ügyfél azonosító'
],
[
'value' => $tetel->request->customer->name ,
'label' => 'Vendég'
],
]
]);
}
?>
</div>
</div>
</div>

View File

@ -12,15 +12,17 @@ use yii\helpers\ArrayHelper;
<?php
$warehouseOptions = ArrayHelper::map($warehouses, 'id_warehouse', 'name') ;
$accountsOptions = ArrayHelper::map($accounts, 'id_account', 'name') ;
?>
<div class="procurement-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'productIdentifier')->textInput()->hint(Yii::t('common/procurement', "Product name, product number or barcode")) ?>
<?= $form->field($model, 'productIdentifier')->textInput()->hint(Yii::t('common/procurement', "Product name, product number or barcode"))->label('Vonalkód vagy termékszám') ?>
<?= $form->field($model, 'id_warehouse')->dropDownList($warehouseOptions) ?>
<?= $form->field($model, 'id_account')->dropDownList($accountsOptions)->label('Kassza') ?>
<?= $form->field($model, 'count')->textInput() ?>

View File

@ -17,7 +17,8 @@ $this->params['breadcrumbs'][] = $this->title;
<?= $this->render('_form', [
'model' => $model,
'warehouses' => $warehouses
'warehouses' => $warehouses,
'accounts' => $accounts
]) ?>
</div>

View File

@ -0,0 +1,85 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Product;
use common\models\ProductCategory;
use yii\helpers\ArrayHelper;
use common\models\Account;
use kartik\widgets\DateTimePicker;
/* @var $this yii\web\View */
/* @var $model backend\models\ProductSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
function mkOptions($options){
$o = $options;
$o[''] = Yii::t('common/product','All' ) ;
return $o;
}
$statusOptions = ['' => "Mind"] + ( Product::statuses() );
$productCategories = ['' => "Mind"] + ArrayHelper::map( ProductCategory::read(null) ,'id_product_category','name') ;
$accounts = ['' => "Mind"] + ( ArrayHelper::map( Account::read(null) ,'id_account','name'));
?>
<div class="product-search">
<?php $form = ActiveForm::begin([
'action' => ['product/statistics'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'id_product_category')->dropDownList($productCategories) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'id_account')->dropDownList($accounts) ?>
</div>
<div class="col-md-4">
<?php // echo $form->field($model, 'status')->dropDownList($statusOptions) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'name')->label("Terméknév") ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'barcode') ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'product_number') ?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
])->label("Időszak kezdete (inklúzív)") ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
])->label("Időszak vége (exklúzív)") ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/product', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,64 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\ProductSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/product', 'Products');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-index">
<h1><?php echo "Termék eladás statisztika" ?></h1>
<?php echo $this->render('_search_statistics', ['model' => $searchModel]); ?>
<?php
$params = [];
$params[ Html::getInputName($searchModel, 'output')] = "xls";
echo Html::a("XLS", Url::current($params), ['class' => 'btn btn-primary'] );
?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'product_name',
'label' => 'Terméknév',
],
[
'attribute' => 'product_number',
'label' => 'Termékszám',
],
[
'attribute' => 'product_barcode',
'label' => 'Vonalkód',
],
[
'attribute' => 'father_account_name',
'label' => 'Termék kassza',
],
// [
// 'attribute' => 'account_name',
// 'label' => 'Fizetési kassza',
// ],
[
'attribute' => 'product_sale_price',
'label' => 'Eladási ár',
],
[
'attribute' => 'transfer_count',
'label' => 'Eladott mennyiség',
],
[
'attribute' => 'transfer_money',
'label' => 'Eladás összege',
],
],
]); ?>
</div>

View File

@ -149,7 +149,7 @@ use yii\helpers\Html;
</tr>
<tr>
<th>
Sorszám a kötegben belül
Tétel sorszám
</th>
<td>
<?php echo ( $model['request_number'] ) ;?>

View File

@ -20,7 +20,7 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna
<div class="ticket-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
// 'action' => ['index-customer',''],
'method' => 'get',
]); ?>

View File

@ -4,6 +4,8 @@ use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
use yii\data\ArrayDataProvider;
use backend\components\AdminCustomerTabWidget;
use common\models\Ticket;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TicketSearch */
@ -15,15 +17,15 @@ if ( isset($card)){
}
$this->title = Yii::t('common/ticket', '{customer} Tickets', ['customer'=>$customer]);
$this->params['breadcrumbs'][] = $this->title;
$this->params['breadcrumbs'][] = "Vendég";
$this->params['breadcrumbs'][] = "Befizetések";
?>
<?php echo AdminCustomerTabWidget::widget(['customer' => $searchModel->customer]) ?>
<div class="ticket-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search_customer', ['model' => $searchModel]); ?>
@ -83,27 +85,50 @@ $this->params['breadcrumbs'][] = $this->title;
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id_customer',
'value' => 'customerName'
'attribute' => 'ticket_id_ticket',
'label' => 'Bérlet azonosító'
],
// [
// 'attribute' => 'card_number',
// 'label' => 'Kártyaszám'
// ],
[
'attribute' => 'ticket_start',
'label' => 'Érvényesség kezdete',
'format' => 'datetime'
],
[
'attribute' => 'id_card',
'value' => 'cardNumber'
'attribute' => 'ticket_end',
'label' => 'Érvényesség vége',
'format' => 'datetime'
],
'start:date',
'end:date',
[
'attribute' => 'id_user',
'value' => 'userName'
'attribute' => 'user_username',
'label' => 'Kiadta',
],
[
'attribute' => 'paid_by_username',
'label' => 'Fizette'
],
[
'attribute' => 'id_ticket_type',
'value' => 'ticketTypeName'
'attribute' => 'ticket_type_name',
'label' => 'Típus'
],
[
'attribute' => 'id_account',
'value' => 'accountName'
'attribute' => 'account_name',
'label' => 'Kassza'
],
[
'attribute' => 'ticket_status',
'label' => 'Státusz',
'value' => function ($model, $key, $index, $column){
return Ticket::toStatusName($model['ticket_status']);
}
],
[
'attribute' => 'ticket_price_brutto',
'label' => 'Ár'
],
// 'max_usage_count',
// 'usage_count',

View File

@ -87,6 +87,11 @@ $attributes = [
echo Html::a("DetSta Fájl Feldoglozás",['view', 'id' => $model->id_ugiro] ,['data-method' =>'post', 'class' => 'btn btn-danger']);
}
echo Html::a("Megbízások a kötegben",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ugiro]' => $model->id_ugiro] ,[ 'class' => 'btn btn-primary']);
$detstaMessage = $model->messageDetsta;
if ( isset($detstaMessage)){
echo Html::a("Detsta üzenet",['message-detsta/view', 'id' => $detstaMessage->id_message] ,[ 'class' => 'btn btn-primary']);
}
?>
</div>

View File

@ -0,0 +1,177 @@
<?php
namespace common\components;
use common\models\Transfer;
use yii\base\Object;
use common\models\MessageDetstaLab;
use common\models\MessageDetstaTetel;
use common\models\MessageDetsta;
use common\models\MessageDetstaFej;
use common\models\TicketInstallmentRequest;
/**
* Detstat üzenet mentése adatbázisba
*
* @property common\models\Ugiro $koteg
* @property common\models\giro\GiroDETSTA $giroDETSTA
*/
class DetStaDBSave extends Object
{
/**
* giro köteg
* */
public $koteg;
/**
* GiroDetsta üzenet
* */
public $giroDETSTA;
/**felhasználó*/
public $idUser;
/**messagedetsta*/
public $message;
/**messagedetsta fej*/
public $messageFej;
/**messagedetsta lab*/
public $messageLab;
/**messagedetsta tetelek*/
public $messageTetelek = [];
public function run(){
$this->saveMessageDetsta();
$this->saveMessageDetstaFej( );
$this->saveMessageDetstaLab();
$this->saveMessageDetstaTetelek();
}
/**
*
* @param common\models\Ugiro;
* @param common\models\giro\GiroDETSTA $giroDETSTA
* */
protected function saveMessageDetsta( ) {
$this->message = new MessageDetsta();
$this->message->id_user = $this->idUser;
if ( isset( $this->koteg ) ){
$this->message->id_ugiro = $this->koteg->id_ugiro;
}
if ( !$this->message->save() ){
\Yii::error("Nem sikerült menteni a detsta üzenet fájlt");
throw new \Exception("Nem sikerült menteni a detsta üzenet fájtl");
}
\Yii::info("detsta üzenet mentve");
}
protected function readDate($date){
$date = trim($date);
if ( empty($date))
return null;
$dtime = \DateTime::createFromFormat('Ymd' ,$date);
if ( !$dtime ){
return false;
}
return $dtime->format('Y-m-d');
}
/**
*
* */
protected function saveMessageDetstaFej( ){
$this->messageFej = new MessageDetstaFej();
$fej = $this->giroDETSTA->fej;
/** @var common\components\giro\GiroDETSTAFej $fej */
$dtime = \DateTime::createFromFormat("yyyyMMdd","");
$this->messageFej->id_message = $this->message->id_message;
$this->messageFej->record_tipus = $fej->recordTipus;
$this->messageFej->uzenet_tipus = $fej->uzenetTipus;
$this->messageFej->jelentes_jelzo = $fej->jelentesJelzo;
$this->messageFej->kezdemenyezo_azonosito = $fej->kezdemenyezoAzonosito;
$this->messageFej->csoportos_uzenet_sorszam = $fej->csoportosUzenetSorszam->sorszam;
$this->messageFej->csoportos_uzenet_datum = $this->readDate($fej->csoportosUzenetSorszam->osszeallitasDatuma );
$this->messageFej->detsta_uzenet_sorszam = $fej->detstaUzenetSorszam->sorszam;
$this->messageFej->detsta_uzenet_datum = $this->readDate( $fej->detstaUzenetSorszam->osszeallitasDatuma );
$this->messageFej->ido = $fej->ido;
if ( !$this->messageFej->save(false)){
\Yii::error("Nem sikerült menteni a detsta üzenet fej fájlt");
throw new \Exception("Nem sikerült menteni a detsta üzenet fej fájlt");
}
\Yii::info("detsta fej üzenet mentve");
}
protected function saveMessageDetstaLab( ){
$this->messageLab = new MessageDetstaLab();
$lab = $this->giroDETSTA->lab;
$this->messageLab->id_message = $this->message->id_message;
$this->messageLab->record_tipus = $lab->recordTipus;
$this->messageLab->teljesitett_tetelek_szama = $lab->teljesitettTetelekSzama;
$this->messageLab->teljesitett_tetelek_osszerteke = $lab->teljesitettTetelekOsszerteke;
$this->messageLab->visszautasitott_tetelek_szama = $lab->visszautasitottTetelekSzama;
$this->messageLab->visszautasitott_tetelek_osszerteke = $lab->visszautasitottTetelekSzama;
$this->messageLab->megnemvalaszolt_tetelek_szama = $lab->megNemValaszoltTetelekSzama;
$this->messageLab->megnemvalaszolt_tetelek_osszerteke = $lab->megNemValaszoltTetelekOsszerteke;
if ( !$this->messageLab->save(false)){
\Yii::error("Nem sikerült menteni a detsta üzenet lab fájlt");
throw new \Exception("Nem sikerült menteni a detsta üzenet lab fájlt");
}
\Yii::info("detsta lab üzenet mentve");
}
protected function saveMessageDetstaTetelek( ){
$tetelek = $this->giroDETSTA->tetelek;
foreach ($tetelek as $tetel){
$this->saveMessageDetstaTetel($tetel);
}
}
protected function saveMessageDetstaTetel($tetel ){
$mt = new MessageDetstaTetel();
$mt->id_message = $this->message->id_message;
$mt->record_tipus = $tetel->recordTipus ;
$mt->tetel_sorszam= $tetel->tetelSorszam ;
$mt->osszeg= $tetel->osszeg ;
$mt->eredeti_tetel_elszamolasi_datuma= $tetel->eredetiTetelElszamolasiDatuma ;
$mt->visszajelzes_informacio= $tetel->visszajelzesInformacio ;
$mt->feldolgozas_datum= $tetel->feldolgozasDatum ;
$mt->terhelesi_datum= $this->readDate($tetel->terhelesiDatum);
$mt->valasz_hivatkozasi_kod= $tetel->valaszHivatkozasiKod ;
$mt->eredeti_hivatkozasi_kod= $tetel->eredetiHivatkozasiKod ;
$mt->ugyfel_azonosito= $tetel->ugyfelAzonosito ;
$request = $this->readRequest($mt->tetel_sorszam);
if ( isset($request) ){
$mt->id_ticket_installment_request = $request->id_ticket_installment_request;
}
if ( !$mt->save(false)){
\Yii::error("Nem sikerült menteni a detsta üzenet tetelt");
throw new \Exception("Nem sikerült menteni a detsta üzenet tetelt");
}
\Yii::info("detsta tetel üzenet mentve");
$this->messageTetelek[] = $mt;
}
protected function readRequest($tetel_sorszam){
$query = TicketInstallmentRequest::find();
$query->innerJoin("ugiro_request_assignment","ugiro_request_assignment.id_request = ticket_installment_request.id_ticket_installment_request");
$query->innerJoin("ugiro","ugiro.id_ugiro = ugiro_request_assignment.id_ugiro");
$query->andWhere(['ugiro.id_ugiro' => $this->koteg->id_ugiro]);
$query->andWhere(['ticket_installment_request.number' => $tetel_sorszam]);
return $query->one();
}
}

View File

@ -5,12 +5,11 @@ namespace common\components;
use yii\base\Object;
use common\models\TicketInstallmentRequest;
use common\components\giro\GiroDETSTATetel;
use backend\models\TicketInstallmentMarkForSendForm;
use common\models\Ugiro;
use yii\db\Query;
use common\components\giro\GiroDETSTA;
use common\components\giro\GiroDETSTAFej;
use common\components\giro\GiroDETSTALab;
use common\components\DetStaDBSave;
/**
@ -35,11 +34,23 @@ class DetStatProcessor extends Object{
// $this->readKoteg();
$this->readKotegMegbizasok();
$this->readDetstaUzenet();
$this->saveMessageDetsta();
$this->createMegbizasTetelHozzarendelesek();
$this->processMegbizasok();
$this->markKotegFinished();
}
public function saveMessageDetsta(){
$saver = new DetStaDBSave(
[
'giroDETSTA' => $this->detstatUzenet,
'koteg' => $this->koteg,
'idUser' =>\Yii::$app->user->id
]);
$saver->run();
}
public function markKotegFinished(){
$this->koteg->status = Ugiro::$STATUS_FINISHED;
$this->koteg->save();
@ -64,11 +75,10 @@ class DetStatProcessor extends Object{
$content = file_get_contents($filename);
$this->detstatUzenet = GiroDETSTA::parse($content);
/*
$this->detstatUzenet = new GiroDETSTA();
$this->idKoteg = 38;
$this->idKoteg = 42;
$fej = new GiroDETSTAFej();
@ -81,16 +91,15 @@ class DetStatProcessor extends Object{
$this->detstatUzenet->tetelek[] = $tetel;
$tetel = new GiroDETSTATetel();
$tetel->tetelSorszam = 2;
$tetel->visszajelzesInformacio = "00";
$tetel->visszajelzesInformacio = "02";
$this->detstatUzenet->tetelek[] = $tetel;
// $tetel = new GiroDETSTATetel();
// $tetel->tetelSorszam = 2;
// $tetel->visszajelzesInformacio = "00";
// $tetel->visszajelzesInformacio = "02";
// $this->detstatUzenet->tetelek[] = $tetel;
*/
$lab = new GiroDETSTALab();
$this->detstatUzenet->lab = $lab;
*/
}

View File

@ -45,7 +45,7 @@ class GiroDETSTAFej extends GiroBase{
$fej->csoportosUzenetSorszam ->osszeallitasDatuma = substr($row, 22, 8);
$fej->csoportosUzenetSorszam->sorszam = static::szamOlvas($row, 30, 4);
$fej->detstaUzenetSorszam ->osszeallitasDatuma = substr($row, 34,8);
$fej->detstaUzenetSorszam->sorszam = substr($row, 42,4);
$fej->detstaUzenetSorszam->sorszam = static::szamOlvas($row, 42,4);
$fej->ido = substr($row, 46,6);
return $fej;

View File

@ -40,12 +40,12 @@ class GiroDETSTALab extends GiroBase {
public static function parse($row) {
$lab = new GiroDETSTALab ();
$lab->recordTipus = substr($row,0,2 );
$lab->teljesitettTetelekSzama = substr($row,2,6 );
$lab->teljesitettTetelekOsszerteke = substr($row,8,16 );
$lab->visszautasitottTetelekSzama = substr($row,24,6 );
$lab->visszautasitottTetelekOsszerteke = substr($row,30,16 );
$lab->megNemValaszoltTetelekSzama = substr($row,46,6 );
$lab->megNemValaszoltTetelekOsszerteke = substr($row,52, 16 );
$lab->teljesitettTetelekSzama = GiroBase::szamOlvas($row,2,6 );
$lab->teljesitettTetelekOsszerteke = GiroBase::szamOlvas($row,8,16 );
$lab->visszautasitottTetelekSzama = GiroBase::szamOlvas($row,24,6 );
$lab->visszautasitottTetelekOsszerteke = GiroBase::szamOlvas($row,30,16 );
$lab->megNemValaszoltTetelekSzama = GiroBase::szamOlvas($row,46,6 );
$lab->megNemValaszoltTetelekOsszerteke = GiroBase::szamOlvas($row,52, 16 );
return $lab;
}
}

View File

@ -56,15 +56,15 @@ class GiroDETSTATetel extends GiroBase {
$tetel = new GiroDETSTATetel ();
$tetel->recordTipus = substr ( $row, 0, 2 );
$tetel->tetelSorszam = substr ( $row, 2, 6 );
$tetel->osszeg = substr ( $row, 8, 10 );
$tetel->tetelSorszam = GiroBase::szamOlvas( $row, 2, 6 );
$tetel->osszeg = GiroBase::szamOlvas( $row, 8, 10 );
$tetel->eredetiTetelElszamolasiDatuma = substr ( $row, 18, 8 );
$tetel->visszajelzesInformacio = substr ( $row, 26, 2 );
$tetel->feldolgozasDatum = substr ( $row, 28, 8 );
$tetel->terhelesiDatum = substr ( $row, 36, 8 );
$tetel->valaszHivatkozasiKod = substr ( $row, 44, 29 );
$tetel->eredetiHivatkozasiKod = substr ( $row, 73, 29 );
$tetel->ugyfelAzonosito = substr ( $row, 102, 24 );
$tetel->ugyfelAzonosito = GiroBase::szovegOlvas($row, 102, 24 );
return $tetel;
}

View File

@ -89,6 +89,12 @@ class Card extends \common\models\BaseFitnessActiveRecord
}
return $result;
}
public static function toStatusName($status , $def = ""){
return Helper::getArrayValue(self::statuses(), $status, $def);
}
public static function toTypeName($type , $def = ""){
return Helper::getArrayValue(self::types(), $type, $def);
}
static function types() {
return [

View File

@ -4,6 +4,8 @@ namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\Query;
use common\components\Helper;
/**
* This is the model class for table "key".
@ -91,5 +93,20 @@ class Key extends \yii\db\ActiveRecord
}
return $result;
}
/**
* @param yii\db\Query $query
* */
public static function addKeyCondition($query, $number , $fieldNumber = "key.number",$fieldRfid = "key.rfid_key"){
$number = Helper::fixAsciiChars($number);
$query->andWhere( ['or' , [$fieldNumber =>$number ],[$fieldRfid =>$number ] ]);
}
/**
* @param yii\db\Query $query
* */
public static function addKeyConditionOptional($query, $number , $fieldNumber = "key.number",$fieldRfid = "key.rfid_key"){
$number = Helper::fixAsciiChars($number);
$query->andFilterWhere( ['or' , [$fieldNumber =>$number ],[$fieldRfid =>$number ] ]);
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace common\models;
use Yii;
use common\components\giro\GiroDETSTA;
/**
* This is the model class for table "message_detsta".
*
* @property integer $id_message
* @property string $path
* @property integer $id_user
* @property string $created_at
* @property string $updated_at
*/
class MessageDetsta extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'message_detsta';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_message' => Yii::t('common/message_detsta', 'Id Message'),
'path' => Yii::t('common/message_detsta', 'Path'),
'id_user' => Yii::t('common/message_detsta', 'Id User'),
'created_at' => Yii::t('common/message_detsta', 'Created At'),
'updated_at' => Yii::t('common/message_detsta', 'Updated At'),
];
}
public function getFej( ) {
return $this->hasOne(MessageDetstaFej::className(), ['id_message' => 'id_message']);
}
public function getLab( ) {
return $this->hasOne(MessageDetstaLab::className(), ['id_message' => 'id_message']);
}
public function getTetelek( ) {
return $this->hasMany(MessageDetstaTetel::className(), ['id_message' => 'id_message']);
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "message_detsta_fej".
*
* @property integer $id_message_detsta_fej
* @property integer $id_message
* @property string $record_tipus
* @property string $uzenet_tipus
* @property string $jelentes_jelzo
* @property string $kezdemenyezo_azonosito
* @property integer $csoportos_uzenet_sorszam
* @property string $csoportos_uzenet_datum
* @property integer $detsta_uzenet_sorszam
* @property string $detsta_uzenet_datum
* @property string $ido
*/
class MessageDetstaFej extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'message_detsta_fej';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_message', 'csoportos_uzenet_sorszam', 'detsta_uzenet_sorszam'], 'integer'],
[['csoportos_uzenet_datum', 'detsta_uzenet_datum'], 'safe'],
[['record_tipus', 'uzenet_tipus', 'jelentes_jelzo', 'ido'], 'string', 'max' => 10],
[['kezdemenyezo_azonosito'], 'string', 'max' => 20]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_message_detsta_fej' => Yii::t('common/message_detsta', 'Id Message Detsta Fej'),
'id_message' => Yii::t('common/message_detsta', 'Id Message'),
'record_tipus' => Yii::t('common/message_detsta', 'Record Tipus'),
'uzenet_tipus' => Yii::t('common/message_detsta', 'Uzenet Tipus'),
'jelentes_jelzo' => Yii::t('common/message_detsta', 'Jelentes Jelzo'),
'kezdemenyezo_azonosito' => Yii::t('common/message_detsta', 'Kezdemenyezo Azonosito'),
'csoportos_uzenet_sorszam' => Yii::t('common/message_detsta', 'Csoportos Uzenet Sorszam'),
'csoportos_uzenet_datum' => Yii::t('common/message_detsta', 'Csoportos Uzenet Datum'),
'detsta_uzenet_sorszam' => Yii::t('common/message_detsta', 'Detsta Uzenet Sorszam'),
'detsta_uzenet_datum' => Yii::t('common/message_detsta', 'Detsta Uzenet Datum'),
'ido' => Yii::t('common/message_detsta', 'Ido'),
];
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "message_detsta_lab".
*
* @property integer $id_message_detsta_lab
* @property integer $id_message
* @property string $record_tipus
* @property integer $teljesitett_tetelek_szama
* @property integer $teljesitett_tetelek_osszerteke
* @property integer $visszautasitott_tetelek_szama
* @property integer $visszautasitott_tetelek_osszerteke
* @property integer $megnemvalaszolt_tetelek_szama
* @property integer $megnemvalaszolt_tetelek_osszerteke
*/
class MessageDetstaLab extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'message_detsta_lab';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_message', 'teljesitett_tetelek_szama', 'teljesitett_tetelek_osszerteke', 'visszautasitott_tetelek_szama', 'visszautasitott_tetelek_osszerteke', 'megnemvalaszolt_tetelek_szama', 'megnemvalaszolt_tetelek_osszerteke'], 'integer'],
[['record_tipus'], 'string', 'max' => 10]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_message_detsta_lab' => Yii::t('common/message_detsta', 'Id Message Detsta Lab'),
'id_message' => Yii::t('common/message_detsta', 'Id Message'),
'record_tipus' => Yii::t('common/message_detsta', 'Record Tipus'),
'teljesitett_tetelek_szama' => Yii::t('common/message_detsta', 'Teljesitett Tetelek Szama'),
'teljesitett_tetelek_osszerteke' => Yii::t('common/message_detsta', 'Teljesitett Tetelek Osszerteke'),
'visszautasitott_tetelek_szama' => Yii::t('common/message_detsta', 'Visszautasitott Tetelek Szama'),
'visszautasitott_tetelek_osszerteke' => Yii::t('common/message_detsta', 'Visszautasitott Tetelek Osszerteke'),
'megnemvalaszolt_tetelek_szama' => Yii::t('common/message_detsta', 'Megnemvalaszolt Tetelek Szama'),
'megnemvalaszolt_tetelek_osszerteke' => Yii::t('common/message_detsta', 'Megnemvalaszolt Tetelek Osszerteke'),
];
}
}

View File

@ -0,0 +1,73 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "message_detsta_tetel".
*
* @property integer $id_message_detsta_tetel
* @property integer $id_message
* @property integer $id_ticket_installment_request
* @property string $record_tipus
* @property integer $tetel_sorszam
* @property integer $osszeg
* @property string $eredeti_tetel_elszamolasi_datuma
* @property string $visszajelzes_informacio
* @property string $feldolgozas_datum
* @property string $terhelesi_datum
* @property string $valasz_hivatkozasi_kod
* @property string $eredeti_hivatkozasi_kod
* @property string $ugyfel_azonosito
*/
class MessageDetstaTetel extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'message_detsta_tetel';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_message', 'id_ticket_installment_request', 'tetel_sorszam', 'osszeg'], 'integer'],
[['eredeti_tetel_elszamolasi_datuma', 'feldolgozas_datum', 'terhelesi_datum'], 'safe'],
[['record_tipus', 'visszajelzes_informacio'], 'string', 'max' => 10],
[['valasz_hivatkozasi_kod', 'eredeti_hivatkozasi_kod', 'ugyfel_azonosito'], 'string', 'max' => 50]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_message_detsta_tetel' => Yii::t('common/message_detsta', 'Id Message Detsta Tetel'),
'id_message' => Yii::t('common/message_detsta', 'Id Message'),
'id_ticket_installment_request' => Yii::t('common/message_detsta', 'Id Ticket Installment Request'),
'record_tipus' => Yii::t('common/message_detsta', 'Record Tipus'),
'tetel_sorszam' => Yii::t('common/message_detsta', 'Tetel Sorszam'),
'osszeg' => Yii::t('common/message_detsta', 'Osszeg'),
'eredeti_tetel_elszamolasi_datuma' => Yii::t('common/message_detsta', 'Eredeti Tetel Elszamolasi Datuma'),
'visszajelzes_informacio' => Yii::t('common/message_detsta', 'Visszajelzes Informacio'),
'feldolgozas_datum' => Yii::t('common/message_detsta', 'Feldolgozas Datum'),
'terhelesi_datum' => Yii::t('common/message_detsta', 'Terhelesi Datum'),
'valasz_hivatkozasi_kod' => Yii::t('common/message_detsta', 'Valasz Hivatkozasi Kod'),
'eredeti_hivatkozasi_kod' => Yii::t('common/message_detsta', 'Eredeti Hivatkozasi Kod'),
'ugyfel_azonosito' => Yii::t('common/message_detsta', 'Ugyfel Azonosito'),
];
}
public function getRequest(){
return $this->hasOne(TicketInstallmentRequest::className(), ['id_ticket_installment_request' => 'id_ticket_installment_request']);
}
}

View File

@ -3,6 +3,7 @@
namespace common\models;
use Yii;
use common\components\Helper;
/**
* This is the model class for table "procurement".
@ -22,6 +23,7 @@ class Procurement extends \common\models\BaseFitnessActiveRecord
{
public $productIdentifier;
public $id_account;
/**
* @inheritdoc
@ -38,8 +40,8 @@ class Procurement extends \common\models\BaseFitnessActiveRecord
{
return [
[['id_warehouse', 'count', 'purchase_price' ], 'required'],
[['id_warehouse', 'count', 'productIdentifier', 'purchase_price' ], 'required' , 'on' => 'create_general'],
[['id_warehouse', 'id_user', 'id_product', 'count', 'stock', 'purchase_price'], 'integer'],
[['id_warehouse', 'count', 'productIdentifier', 'purchase_price' ,'id_account'], 'required' , 'on' => 'create_general'],
[['id_warehouse', 'id_user', 'id_product', 'count', 'stock', 'purchase_price','id_account'], 'integer'],
[['description'], 'string', 'max' => 255],
[['productIdentifier'], 'string', 'max' => 128],
[['productIdentifier'] ,'validateProductIdentifier', 'on' => 'create_general']
@ -70,11 +72,17 @@ class Procurement extends \common\models\BaseFitnessActiveRecord
$product = null;
if ( isset($this->productIdentifier)){
$id = $this->productIdentifier;
$conditionProductName = ['name' =>$id];
$name = $this->productIdentifier;
$id = Helper::fixAsciiChars( $this->productIdentifier );
// $conditionProductName = ['name' =>$id];
$conditionProductNumber = ['product_number' =>$id];
$conditionBarcode= ['barcode' =>$id];
$products = Product::find()->andWhere(['or', ['name' =>$id] , ['product_number' =>$id] ,['barcode' =>$id] ] )->all();
$query = Product::find()
->andWhere(['or', ['product_number' =>$id] ,['barcode' =>$id] ] );
if ( Helper::isProductVisibilityAccount() ){
$query->andWhere(['id_account' => $this->id_account]);
}
$products = $query->all();
if ( count($products) == 1 ){
$product = $products[0];
$this->id_product = $product->id_product;

View File

@ -71,6 +71,10 @@ class Ugiro extends \yii\db\ActiveRecord
public function getUser(){
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
}
public function getMessageDetsta(){
return $this->hasOne( MessageDetsta::className(), ["id_ugiro" =>"id_ugiro" ] );
}
public function getRequests()

View File

@ -28,7 +28,8 @@
"bassjobsen/bootstrap-3-typeahead": "^4.0",
"bower-asset/webcamjs": "^1.0",
"mpdf/mpdf": "^6.0",
"os/php-excel": "^2.1"
"os/php-excel": "^2.1",
"phpoffice/phpexcel": "^1.8"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",

61
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "e0ae7f422a0ca8c9297c28eefe9acd9b",
"content-hash": "6277b5f664f4bc22c02c689e701964a5",
"hash": "c484600811777b0032034033ae4414b9",
"content-hash": "f44617094989091a2f19c2feb2257d3a",
"packages": [
{
"name": "almasaeed2010/adminlte",
@ -1882,6 +1882,63 @@
],
"time": "2012-05-02 20:42:37"
},
{
"name": "phpoffice/phpexcel",
"version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPExcel.git",
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
"shasum": ""
},
"require": {
"ext-xml": "*",
"ext-xmlwriter": "*",
"php": ">=5.2.0"
},
"type": "library",
"autoload": {
"psr-0": {
"PHPExcel": "Classes/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
},
{
"name": "Mark Baker"
},
{
"name": "Franck Lefevre",
"homepage": "http://blog.rootslabs.net"
},
{
"name": "Erik Tilt"
}
],
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "http://phpexcel.codeplex.com",
"keywords": [
"OpenXML",
"excel",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"time": "2015-05-01 07:00:55"
},
{
"name": "rmrevin/yii2-fontawesome",
"version": "2.12.2",

View File

@ -0,0 +1,30 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160128_130803_add_index_customer_id_customer_card extends Migration
{
public function up()
{
$this->execute("CREATE INDEX ix_customer_id_customer_card ON customer (id_customer_card);");
}
public function down()
{
echo "m160128_130803_add_index_customer_id_customer_card cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,39 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160128_131700_add_index_transfer_id_object_type extends Migration
{
public function up()
{
$this->execute("CREATE INDEX transfer_object_type ON transfer (id_object,type);");
$this->execute("CREATE INDEX transfer_object_type_status ON transfer (id_object,type,status);");
$this->execute("CREATE INDEX transfer_status ON transfer (status);");
$this->execute("CREATE INDEX transfer_paid_by ON transfer (paid_by);");
$this->execute("CREATE INDEX transfer_paid_at ON transfer (paid_at);");
$this->execute("CREATE INDEX transfer_paid_at_by ON transfer (paid_by,paid_at);");
$this->execute("CREATE INDEX transfer_discount ON transfer (id_discount);");
$this->execute("CREATE INDEX transfer_customer ON transfer (id_customer);");
$this->execute("CREATE INDEX transfer_user ON transfer (id_user);");
$this->execute("CREATE INDEX transfer_created ON transfer (created_at);");
}
public function down()
{
echo "m160128_131700_add_index_transfer_id_object_type cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,113 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160129_072601_add__tables__detsta_message extends Migration
{
public function up()
{
$this->addMessage();
$this->addMessageFej();
$this->addMessageLab();
$this->addMessageTetel();
}
protected function addMessage(){
$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('{{%message_detsta}}', [
'id_message' => $this->primaryKey(),
'path' => $this->string(255),
'id_user' => $this->integer(11),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
}
protected function addMessageFej(){
$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('{{%message_detsta_fej}}', [
'id_message_detsta_fej' => $this->primaryKey(),
'id_message' => $this->integer(11),
'record_tipus' => $this->string(10),
'uzenet_tipus' => $this->string(10),
'jelentes_jelzo' => $this->string(10),
'kezdemenyezo_azonosito' => $this->string(20),
'csoportos_uzenet_sorszam' => $this->integer(11),
'csoportos_uzenet_datum' => $this->dateTime(),
'detsta_uzenet_sorszam' => $this->integer(11),
'detsta_uzenet_datum' => $this->dateTime(),
'ido' => $this->string(10),
], $tableOptions);
}
protected function addMessageLab(){
$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('{{%message_detsta_lab}}', [
'id_message_detsta_lab' => $this->primaryKey(),
'id_message' => $this->integer(11),
'record_tipus' => $this->string(10),
'teljesitett_tetelek_szama' => $this->integer(11),
'teljesitett_tetelek_osszerteke' => $this->integer(11),
'visszautasitott_tetelek_szama' => $this->integer(11),
'visszautasitott_tetelek_osszerteke' => $this->integer(11),
'megnemvalaszolt_tetelek_szama' => $this->integer(11),
'megnemvalaszolt_tetelek_osszerteke' => $this->integer(11),
], $tableOptions);
}
protected function addMessageTetel(){
$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('{{%message_detsta_tetel}}', [
'id_message_detsta_tetel' => $this->primaryKey(),
'id_message' => $this->integer(11),
'id_ticket_installment_request' => $this->integer(11),
'record_tipus' => $this->string(10),
'tetel_sorszam' => $this->integer(11),
'osszeg' => $this->integer(11),
'eredeti_tetel_elszamolasi_datuma' => $this->dateTime(),
'visszajelzes_informacio' => $this->string(10),
'feldolgozas_datum' => $this->dateTime(),
'terhelesi_datum' => $this->dateTime(),
'valasz_hivatkozasi_kod' => $this->string(50),
'eredeti_hivatkozasi_kod' => $this->string(50),
'ugyfel_azonosito' => $this->string(50),
], $tableOptions);
}
public function down()
{
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,30 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160129_114910_alter__table__message_detsta__add__column__id_ugiro extends Migration
{
public function up()
{
$this->addColumn("message_detsta", "id_ugiro", "int");
}
public function down()
{
echo "m160129_114910_alter__table__message_detsta__add__column__id_ugiro cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}