diff --git a/backend/components/AdminCustomerTabWidget.php b/backend/components/AdminCustomerTabWidget.php
new file mode 100644
index 0000000..baa9a6f
--- /dev/null
+++ b/backend/components/AdminCustomerTabWidget.php
@@ -0,0 +1,27 @@
+card = $this->customer->card;
+ }
+
+
+ public function run(){
+ echo $this->render($this->viewFile,[ 'card' => $this->card, 'customer' => $this->customer ,'title' => $this->title ]);
+ }
+
+
+}
\ No newline at end of file
diff --git a/backend/components/AdminMenuStructure.php b/backend/components/AdminMenuStructure.php
index 9119d51..ad9f591 100644
--- a/backend/components/AdminMenuStructure.php
+++ b/backend/components/AdminMenuStructure.php
@@ -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' ] ];
diff --git a/backend/controllers/CardController.php b/backend/controllers/CardController.php
index e8ced89..852fb63 100644
--- a/backend/controllers/CardController.php
+++ b/backend/controllers/CardController.php
@@ -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{
diff --git a/backend/controllers/ContractController.php b/backend/controllers/ContractController.php
new file mode 100644
index 0000000..6991f97
--- /dev/null
+++ b/backend/controllers/ContractController.php
@@ -0,0 +1,143 @@
+ [
+ '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.');
+ }
+ }
+}
diff --git a/backend/controllers/KeyController.php b/backend/controllers/KeyController.php
index 9d2efb7..11b1b3f 100644
--- a/backend/controllers/KeyController.php
+++ b/backend/controllers/KeyController.php
@@ -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.
diff --git a/backend/controllers/MessageDetstaController.php b/backend/controllers/MessageDetstaController.php
new file mode 100644
index 0000000..9f2eb15
--- /dev/null
+++ b/backend/controllers/MessageDetstaController.php
@@ -0,0 +1,137 @@
+ [
+ '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.');
+ }
+ }
+}
diff --git a/backend/controllers/ProcurementController.php b/backend/controllers/ProcurementController.php
index 1acb89d..61b7114 100644
--- a/backend/controllers/ProcurementController.php
+++ b/backend/controllers/ProcurementController.php
@@ -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
]);
}
}
diff --git a/backend/controllers/ProductController.php b/backend/controllers/ProductController.php
index 178fd0f..333c9ea 100644
--- a/backend/controllers/ProductController.php
+++ b/backend/controllers/ProductController.php
@@ -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 client’s 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.
diff --git a/backend/controllers/TicketController.php b/backend/controllers/TicketController.php
index 8adc0e6..a6b6c1b 100644
--- a/backend/controllers/TicketController.php
+++ b/backend/controllers/TicketController.php
@@ -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 ();
diff --git a/backend/models/CardSearch.php b/backend/models/CardSearch.php
index 5ddcbbd..f71af90 100644
--- a/backend/models/CardSearch.php
+++ b/backend/models/CardSearch.php
@@ -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;
}
diff --git a/backend/models/ContractCustomerSearch.php b/backend/models/ContractCustomerSearch.php
new file mode 100644
index 0000000..4ac003f
--- /dev/null
+++ b/backend/models/ContractCustomerSearch.php
@@ -0,0 +1,79 @@
+ $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;
+ }
+}
diff --git a/backend/models/ContractSearch.php b/backend/models/ContractSearch.php
new file mode 100644
index 0000000..6fe2c03
--- /dev/null
+++ b/backend/models/ContractSearch.php
@@ -0,0 +1,151 @@
+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;
+ }
+}
diff --git a/backend/models/KeyCustomerSearch.php b/backend/models/KeyCustomerSearch.php
new file mode 100644
index 0000000..e1df3b6
--- /dev/null
+++ b/backend/models/KeyCustomerSearch.php
@@ -0,0 +1,75 @@
+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;
+ }
+}
diff --git a/backend/models/MessageDetstaSearch.php b/backend/models/MessageDetstaSearch.php
new file mode 100644
index 0000000..dca3ff8
--- /dev/null
+++ b/backend/models/MessageDetstaSearch.php
@@ -0,0 +1,69 @@
+ $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;
+ }
+}
diff --git a/backend/models/ProductStatisticsSearch.php b/backend/models/ProductStatisticsSearch.php
new file mode 100644
index 0000000..517018d
--- /dev/null
+++ b/backend/models/ProductStatisticsSearch.php
@@ -0,0 +1,184 @@
+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;
+ }
+}
diff --git a/backend/models/TicketSearch.php b/backend/models/TicketSearch.php
index a0e7922..963be67 100644
--- a/backend/models/TicketSearch.php
+++ b/backend/models/TicketSearch.php
@@ -30,6 +30,8 @@ class TicketSearch extends Ticket
public $statistics;
public $statisticsTotal;
+ public $customer;
+
/**
* @inheritdoc
diff --git a/backend/models/TicketSearchCustomer.php b/backend/models/TicketSearchCustomer.php
new file mode 100644
index 0000000..c800f0a
--- /dev/null
+++ b/backend/models/TicketSearchCustomer.php
@@ -0,0 +1,296 @@
+ '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);
+ }
+ }
+
+}
diff --git a/backend/views/account-state/_search.php b/backend/views/account-state/_search.php
index fe23edf..abaf5d5 100644
--- a/backend/views/account-state/_search.php
+++ b/backend/views/account-state/_search.php
@@ -45,7 +45,7 @@ $userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($users,'id','username')
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
- ]) ?>
+ ])->label('Időszak kezdete') ?>
= $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') ?>
diff --git a/backend/views/card/_search.php b/backend/views/card/_search.php
index 36ab2e0..552d43b 100644
--- a/backend/views/card/_search.php
+++ b/backend/views/card/_search.php
@@ -49,6 +49,15 @@ $statusOptions = mkOptions(Card::statuses());
= $form->field($model, 'rfid_key')->textInput() ?>
+
+ = $form->field($model, 'searchKeyNumber')->textInput()->label("Kulcs") ?>
+
+
+ = $form->field($model, 'usage')->dropDownList(['' => 'Mind' , '1' => 'Használt', '2' => 'Üres' ])->label("Használat") ?>
+
+
+ = $form->field($model, 'key_assigned')->dropDownList(['' => 'Mind' , '1' => 'Kulcs hozzárendelve', '2' => 'Kulcs nélkül' ])->label("Kulcs hozzárendelés") ?>
+
diff --git a/backend/views/card/index.php b/backend/views/card/index.php
index 32802f2..b088d21 100644
--- a/backend/views/card/index.php
+++ b/backend/views/card/index.php
@@ -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;
?>
+
+
= Html::encode($this->title) ?>
@@ -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']);
+ },
+ ]
+ ],
],
]); ?>
diff --git a/backend/views/common/_customer_tab.php b/backend/views/common/_customer_tab.php
new file mode 100644
index 0000000..6ff20d5
--- /dev/null
+++ b/backend/views/common/_customer_tab.php
@@ -0,0 +1,53 @@
+
+
+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 ]],
+];
+
+
+
+
+
+?>
+
+
+
+
+
+
+
+
+
Vendég: customer->name ?>
+
Kártyaszám: number ?>
+
\ No newline at end of file
diff --git a/backend/views/contract/_form.php b/backend/views/contract/_form.php
new file mode 100644
index 0000000..24bf878
--- /dev/null
+++ b/backend/views/contract/_form.php
@@ -0,0 +1,45 @@
+
+
+
diff --git a/backend/views/contract/_search-customer.php b/backend/views/contract/_search-customer.php
new file mode 100644
index 0000000..fe354ab
--- /dev/null
+++ b/backend/views/contract/_search-customer.php
@@ -0,0 +1,49 @@
+
+
+
+
+ ['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') ?>
+
+ field($model, 'part_paid') ?>
+
+ field($model, 'part_count') ?>
+
+ field($model, 'part_required') ?>
+
+ field($model, 'expired_at') ?>
+
+ field($model, 'created_at') ?>
+
+ field($model, 'updated_at') ?>
+
+ field($model, 'id_ticket_type') ?>
+
+
+ = Html::submitButton(Yii::t('common/door_log', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('common/door_log', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/contract/_search.php b/backend/views/contract/_search.php
new file mode 100644
index 0000000..1d77246
--- /dev/null
+++ b/backend/views/contract/_search.php
@@ -0,0 +1,40 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+
+
+ = $form->field($model, 'id_contract')->label('Szerződés azonosító') ?>
+
+
+ = $form->field($model, 'id_customer')->label('Vendég azonosító') ?>
+
+
+ = $form->field($model, 'customer_name')->label('Vendég neve') ?>
+
+
+
+
+
+
+
+
+ = Html::submitButton("Keresés", ['class' => 'btn btn-primary']) ?>
+
+
+
+
+
diff --git a/backend/views/contract/create.php b/backend/views/contract/create.php
new file mode 100644
index 0000000..4244f1b
--- /dev/null
+++ b/backend/views/contract/create.php
@@ -0,0 +1,21 @@
+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;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/contract/index-customer.php b/backend/views/contract/index-customer.php
new file mode 100644
index 0000000..89069a1
--- /dev/null
+++ b/backend/views/contract/index-customer.php
@@ -0,0 +1,57 @@
+title = "Vendég szerződések";
+$this->params['breadcrumbs'][] = "Vendég";
+$this->params['breadcrumbs'][] = "Szerződések";
+?>
+
+ $searchModel->customer]) ?>
+
+
+ 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'],
+ ],
+ ]); ?>
+
+
diff --git a/backend/views/contract/index.php b/backend/views/contract/index.php
new file mode 100644
index 0000000..634bc47
--- /dev/null
+++ b/backend/views/contract/index.php
@@ -0,0 +1,85 @@
+title = "Szerződések";
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
+ 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'
+ ],
+ ],
+ ]); ?>
+
+
diff --git a/backend/views/contract/update.php b/backend/views/contract/update.php
new file mode 100644
index 0000000..5fdadcb
--- /dev/null
+++ b/backend/views/contract/update.php
@@ -0,0 +1,23 @@
+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');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/contract/view.php b/backend/views/contract/view.php
new file mode 100644
index 0000000..806c352
--- /dev/null
+++ b/backend/views/contract/view.php
@@ -0,0 +1,46 @@
+title = $model->id_contract;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('common/door_log', 'Contracts'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = 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',
+ ],
+ ]) ?>
+
+
+ = 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',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/customer/update.php b/backend/views/customer/update.php
index ff3a1cf..4ab4d77 100644
--- a/backend/views/customer/update.php
+++ b/backend/views/customer/update.php
@@ -1,18 +1,18 @@
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');
?>
+ $model]) ?>
-
= Html::encode($this->title) ?>
= $this->render('_form_update', [
'model' => $model,
diff --git a/backend/views/customer/view.php b/backend/views/customer/view.php
index 4974a4e..aabcd1f 100644
--- a/backend/views/customer/view.php
+++ b/backend/views/customer/view.php
@@ -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";
?>
+
+ $model]) ?>
+
-
= Html::encode($this->title) ?>
-
-
- = Html::a(Yii::t('common/customer', 'Update'), ['update', 'id' => $model->id_customer], ['class' => 'btn btn-primary']) ?>
-
= DetailView::widget([
'model' => $model,
diff --git a/backend/views/key/index-customer.php b/backend/views/key/index-customer.php
new file mode 100644
index 0000000..1c25d71
--- /dev/null
+++ b/backend/views/key/index-customer.php
@@ -0,0 +1,53 @@
+title = Yii::t('backend/key', 'Keys');
+$this->params['breadcrumbs'][] = "Vendég";
+$this->params['breadcrumbs'][] = "Kulcsok";
+?>
+
+ $searchModel->customer]) ?>
+
+
+
+
+ = 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'
+ ],
+
+ ],
+ ]); ?>
+
+
diff --git a/backend/views/message-detsta/_form.php b/backend/views/message-detsta/_form.php
new file mode 100644
index 0000000..7680a00
--- /dev/null
+++ b/backend/views/message-detsta/_form.php
@@ -0,0 +1,31 @@
+
+
+
diff --git a/backend/views/message-detsta/_search.php b/backend/views/message-detsta/_search.php
new file mode 100644
index 0000000..4421023
--- /dev/null
+++ b/backend/views/message-detsta/_search.php
@@ -0,0 +1,35 @@
+
+
+
+
+ ['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') ?>
+
+
+ = Html::submitButton(Yii::t('common/message_detsta', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('common/message_detsta', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/message-detsta/create.php b/backend/views/message-detsta/create.php
new file mode 100644
index 0000000..49d6c30
--- /dev/null
+++ b/backend/views/message-detsta/create.php
@@ -0,0 +1,21 @@
+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;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/message-detsta/index.php b/backend/views/message-detsta/index.php
new file mode 100644
index 0000000..a025122
--- /dev/null
+++ b/backend/views/message-detsta/index.php
@@ -0,0 +1,38 @@
+title = Yii::t('common/message_detsta', 'Message Detstas');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('common/message_detsta', 'Create Message Detsta'), ['create'], ['class' => 'btn btn-success']) ?>
+
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'id_message',
+ 'path',
+ 'id_user',
+ 'created_at',
+ 'updated_at',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
+
diff --git a/backend/views/message-detsta/update.php b/backend/views/message-detsta/update.php
new file mode 100644
index 0000000..cf6a876
--- /dev/null
+++ b/backend/views/message-detsta/update.php
@@ -0,0 +1,23 @@
+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');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/message-detsta/view.php b/backend/views/message-detsta/view.php
new file mode 100644
index 0000000..38132c1
--- /dev/null
+++ b/backend/views/message-detsta/view.php
@@ -0,0 +1,171 @@
+title = $model->id_message;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('common/message_detsta', 'Message Detstas'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+ $model->id_ugiro] ,[ 'class' => 'btn btn-primary']);
+?>
+
+
+
+
+
+
Fej
+ = 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ő'
+ ],
+ ],
+ ]) ?>
+
+
+
Láb
+ = 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'
+ ],
+ ],
+ ]) ?>
+
+
+
+
+
+
Tételek
+
+ tetelek;
+
+ foreach ($tetelek as $tetel){
+ echo "Tétel: ".$tetel->tetel_sorszam."
";
+ 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'
+ ],
+ ]
+ ]);
+
+ }
+
+ ?>
+
+
+
+
diff --git a/backend/views/procurement/_form.php b/backend/views/procurement/_form.php
index 3035e6a..8df1a3c 100644
--- a/backend/views/procurement/_form.php
+++ b/backend/views/procurement/_form.php
@@ -12,15 +12,17 @@ use yii\helpers\ArrayHelper;
- = $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() ?>
diff --git a/backend/views/procurement/create.php b/backend/views/procurement/create.php
index 415e4aa..936a858 100644
--- a/backend/views/procurement/create.php
+++ b/backend/views/procurement/create.php
@@ -17,7 +17,8 @@ $this->params['breadcrumbs'][] = $this->title;
= $this->render('_form', [
'model' => $model,
- 'warehouses' => $warehouses
+ 'warehouses' => $warehouses,
+ 'accounts' => $accounts
]) ?>
diff --git a/backend/views/product/_search_statistics.php b/backend/views/product/_search_statistics.php
new file mode 100644
index 0000000..c807bf8
--- /dev/null
+++ b/backend/views/product/_search_statistics.php
@@ -0,0 +1,85 @@
+
+ "Mind"] + ( Product::statuses() );
+
+$productCategories = ['' => "Mind"] + ArrayHelper::map( ProductCategory::read(null) ,'id_product_category','name') ;
+
+$accounts = ['' => "Mind"] + ( ArrayHelper::map( Account::read(null) ,'id_account','name'));
+
+?>
+
+
+ ['product/statistics'],
+ 'method' => 'get',
+ ]); ?>
+
+
+
+ = $form->field($model, 'id_product_category')->dropDownList($productCategories) ?>
+
+
+ = $form->field($model, 'id_account')->dropDownList($accounts) ?>
+
+
+ field($model, 'status')->dropDownList($statusOptions) ?>
+
+
+ = $form->field($model, 'name')->label("Terméknév") ?>
+
+
+ = $form->field($model, 'barcode') ?>
+
+
+ = $form->field($model, 'product_number') ?>
+
+
+
+
+
+ = $form->field($model, 'start')->widget(DateTimePicker::classname(), [
+ 'pluginOptions' => [
+ 'autoclose'=>true,
+ 'format' => 'yyyy.mm.dd hh:ii'
+ ]
+ ])->label("Időszak kezdete (inklúzív)") ?>
+
+
+
+ = $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
+ 'pluginOptions' => [
+ 'autoclose'=>true,
+ 'format' => 'yyyy.mm.dd hh:ii'
+ ]
+ ])->label("Időszak vége (exklúzív)") ?>
+
+
+
+
+
+ = Html::submitButton(Yii::t('common/product', 'Search'), ['class' => 'btn btn-primary']) ?>
+
+
+
+
+
diff --git a/backend/views/product/statistics.php b/backend/views/product/statistics.php
new file mode 100644
index 0000000..27ab011
--- /dev/null
+++ b/backend/views/product/statistics.php
@@ -0,0 +1,64 @@
+title = Yii::t('common/product', 'Products');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
+ render('_search_statistics', ['model' => $searchModel]); ?>
+
+ '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',
+ ],
+
+ ],
+ ]); ?>
+
+
diff --git a/backend/views/ticket-installment-request/_index_view.php b/backend/views/ticket-installment-request/_index_view.php
index ddd8adf..6b869cf 100644
--- a/backend/views/ticket-installment-request/_index_view.php
+++ b/backend/views/ticket-installment-request/_index_view.php
@@ -149,7 +149,7 @@ use yii\helpers\Html;
|
- Sorszám a kötegben belül
+ Tétel sorszám
|
diff --git a/backend/views/ticket/_search_customer.php b/backend/views/ticket/_search_customer.php
index 04e7bf5..d83642e 100644
--- a/backend/views/ticket/_search_customer.php
+++ b/backend/views/ticket/_search_customer.php
@@ -20,7 +20,7 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna
['index'],
+// 'action' => ['index-customer',''],
'method' => 'get',
]); ?>
diff --git a/backend/views/ticket/index_customer.php b/backend/views/ticket/index_customer.php
index e02beff..092c032 100644
--- a/backend/views/ticket/index_customer.php
+++ b/backend/views/ticket/index_customer.php
@@ -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";
?>
-
+ $searchModel->customer]) ?>
- = Html::encode($this->title) ?>
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',
diff --git a/backend/views/ugiro/view.php b/backend/views/ugiro/view.php
index f3904e1..3839296 100644
--- a/backend/views/ugiro/view.php
+++ b/backend/views/ugiro/view.php
@@ -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']);
+ }
?>
diff --git a/common/components/DetStaDBSave.php b/common/components/DetStaDBSave.php
new file mode 100644
index 0000000..bdbc84a
--- /dev/null
+++ b/common/components/DetStaDBSave.php
@@ -0,0 +1,177 @@
+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();
+ }
+
+
+}
\ No newline at end of file
diff --git a/common/components/DetStatProcessor.php b/common/components/DetStatProcessor.php
index 1bf782b..35ce381 100644
--- a/common/components/DetStatProcessor.php
+++ b/common/components/DetStatProcessor.php
@@ -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;
- */
}
diff --git a/common/components/giro/GiroDETSTAFej.php b/common/components/giro/GiroDETSTAFej.php
index 1a509c0..913b906 100644
--- a/common/components/giro/GiroDETSTAFej.php
+++ b/common/components/giro/GiroDETSTAFej.php
@@ -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;
diff --git a/common/components/giro/GiroDETSTALab.php b/common/components/giro/GiroDETSTALab.php
index 44c211d..80a03a0 100644
--- a/common/components/giro/GiroDETSTALab.php
+++ b/common/components/giro/GiroDETSTALab.php
@@ -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;
}
}
\ No newline at end of file
diff --git a/common/components/giro/GiroDETSTATetel.php b/common/components/giro/GiroDETSTATetel.php
index f59afc8..af958cf 100644
--- a/common/components/giro/GiroDETSTATetel.php
+++ b/common/components/giro/GiroDETSTATetel.php
@@ -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;
}
diff --git a/common/models/Card.php b/common/models/Card.php
index b94c873..8d28da9 100644
--- a/common/models/Card.php
+++ b/common/models/Card.php
@@ -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 [
diff --git a/common/models/Key.php b/common/models/Key.php
index b9a3feb..74c09a8 100644
--- a/common/models/Key.php
+++ b/common/models/Key.php
@@ -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 ] ]);
+ }
+
}
diff --git a/common/models/MessageDetsta.php b/common/models/MessageDetsta.php
new file mode 100644
index 0000000..76f5497
--- /dev/null
+++ b/common/models/MessageDetsta.php
@@ -0,0 +1,61 @@
+ 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']);
+ }
+
+
+}
diff --git a/common/models/MessageDetstaFej.php b/common/models/MessageDetstaFej.php
new file mode 100644
index 0000000..3b69793
--- /dev/null
+++ b/common/models/MessageDetstaFej.php
@@ -0,0 +1,64 @@
+ 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'),
+ ];
+ }
+}
diff --git a/common/models/MessageDetstaLab.php b/common/models/MessageDetstaLab.php
new file mode 100644
index 0000000..73936d3
--- /dev/null
+++ b/common/models/MessageDetstaLab.php
@@ -0,0 +1,58 @@
+ 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'),
+ ];
+ }
+}
diff --git a/common/models/MessageDetstaTetel.php b/common/models/MessageDetstaTetel.php
new file mode 100644
index 0000000..6a6a802
--- /dev/null
+++ b/common/models/MessageDetstaTetel.php
@@ -0,0 +1,73 @@
+ 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']);
+ }
+
+}
diff --git a/common/models/Procurement.php b/common/models/Procurement.php
index 6a2b5b7..8a7add7 100644
--- a/common/models/Procurement.php
+++ b/common/models/Procurement.php
@@ -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;
diff --git a/common/models/Ugiro.php b/common/models/Ugiro.php
index 7544e9b..33ff63e 100644
--- a/common/models/Ugiro.php
+++ b/common/models/Ugiro.php
@@ -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()
diff --git a/composer.json b/composer.json
index 2477402..291f694 100644
--- a/composer.json
+++ b/composer.json
@@ -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": "*",
diff --git a/composer.lock b/composer.lock
index bc88bf3..858f7f3 100644
--- a/composer.lock
+++ b/composer.lock
@@ -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",
diff --git a/console/migrations/m160128_130803_add_index_customer_id_customer_card.php b/console/migrations/m160128_130803_add_index_customer_id_customer_card.php
new file mode 100644
index 0000000..d464ed6
--- /dev/null
+++ b/console/migrations/m160128_130803_add_index_customer_id_customer_card.php
@@ -0,0 +1,30 @@
+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()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160128_131700_add_index_transfer_id_object_type.php b/console/migrations/m160128_131700_add_index_transfer_id_object_type.php
new file mode 100644
index 0000000..8042b4e
--- /dev/null
+++ b/console/migrations/m160128_131700_add_index_transfer_id_object_type.php
@@ -0,0 +1,39 @@
+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()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160129_072601_add__tables__detsta_message.php b/console/migrations/m160129_072601_add__tables__detsta_message.php
new file mode 100644
index 0000000..93b05e1
--- /dev/null
+++ b/console/migrations/m160129_072601_add__tables__detsta_message.php
@@ -0,0 +1,113 @@
+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()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160129_114910_alter__table__message_detsta__add__column__id_ugiro.php b/console/migrations/m160129_114910_alter__table__message_detsta__add__column__id_ugiro.php
new file mode 100644
index 0000000..febfb00
--- /dev/null
+++ b/console/migrations/m160129_114910_alter__table__message_detsta__add__column__id_ugiro.php
@@ -0,0 +1,30 @@
+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()
+ {
+ }
+ */
+}
|