Finish accont_hidden
This commit is contained in:
commit
76ec26039f
@ -81,6 +81,7 @@ class AdminMenuStructure{
|
|||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
|
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
|
||||||
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index'] ];
|
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index'] ];
|
||||||
|
$items[] = ['label' => 'Részletes eladások', 'url' => ['/transfer/sale' ,'TransferSaleSearch[start]' =>$todayDatetime,'TransferSaleSearch[end]' => $tomorrowDatetime ] ];
|
||||||
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
|
|||||||
@ -11,6 +11,9 @@ use common\models\Account;
|
|||||||
use common\models\User;
|
use common\models\User;
|
||||||
use backend\models\TransferSummarySearch;
|
use backend\models\TransferSummarySearch;
|
||||||
use backend\models\TransferListSearch;
|
use backend\models\TransferListSearch;
|
||||||
|
use backend\models\TransferSaleSearch;
|
||||||
|
use common\models\ProductCategory;
|
||||||
|
use common\models\Product;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransferController implements the CRUD actions for Transfer model.
|
* TransferController implements the CRUD actions for Transfer model.
|
||||||
@ -25,7 +28,7 @@ class TransferController extends \backend\controllers\BackendController
|
|||||||
'rules' => [
|
'rules' => [
|
||||||
// allow authenticated users
|
// allow authenticated users
|
||||||
[
|
[
|
||||||
'actions' => [ 'index','view','summary','list' ],
|
'actions' => [ 'index','view','summary','list',"sale","sale-pdf" ],
|
||||||
'allow' => true,
|
'allow' => true,
|
||||||
'roles' => ['admin','employee','reception'],
|
'roles' => ['admin','employee','reception'],
|
||||||
],
|
],
|
||||||
@ -78,6 +81,46 @@ class TransferController extends \backend\controllers\BackendController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Transfer models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionSale()
|
||||||
|
{
|
||||||
|
$searchModel = new TransferSaleSearch();
|
||||||
|
$searchModel->accounts = Account::read();
|
||||||
|
$searchModel->users = User::read();
|
||||||
|
$searchModel->productCategories = ProductCategory::read();
|
||||||
|
$searchModel->productOptions = Product::read();
|
||||||
|
|
||||||
|
$searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->render('sale', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function actionSalePdf(){
|
||||||
|
$searchModel = new TransferSaleSearch();
|
||||||
|
$searchModel->accounts = Account::read();
|
||||||
|
$searchModel->users = User::read();
|
||||||
|
$searchModel->productCategories = ProductCategory::read();
|
||||||
|
$searchModel->productOptions = Product::read();
|
||||||
|
|
||||||
|
$searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
|
||||||
|
$mpdf=new \mPDF('utf-8', 'A4-L');
|
||||||
|
$mpdf->WriteHTML($this->renderPartial('_result_sale', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
]));
|
||||||
|
$mpdf->Output('MyPDF.pdf', 'D');
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all Transfer models.
|
* Lists all Transfer models.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
|||||||
@ -5,6 +5,7 @@ namespace backend\models;
|
|||||||
use Yii;
|
use Yii;
|
||||||
use common\models\Transfer;
|
use common\models\Transfer;
|
||||||
use common\components\RoleDefinition;
|
use common\components\RoleDefinition;
|
||||||
|
use common\models\Account;
|
||||||
/**
|
/**
|
||||||
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
||||||
*/
|
*/
|
||||||
@ -15,7 +16,13 @@ class TransferListSearch extends \common\models\TransferListSearch
|
|||||||
if ( !RoleDefinition::isAdmin() ){
|
if ( !RoleDefinition::isAdmin() ){
|
||||||
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
||||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||||
|
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
|
||||||
|
|
||||||
|
if ( RoleDefinition::isReception()){
|
||||||
|
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
43
backend/models/TransferSaleSearch.php
Normal file
43
backend/models/TransferSaleSearch.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use yii\base\Object;
|
||||||
|
use yii\db\Query;
|
||||||
|
use yii\db\Expression;
|
||||||
|
use common\models\Account;
|
||||||
|
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
use common\models\MoneyMovement;
|
||||||
|
use common\components\RoleDefinition;
|
||||||
|
/**
|
||||||
|
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
||||||
|
*/
|
||||||
|
class TransferSaleSearch extends \common\models\TransferSaleSearch
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected function addAccountConstraint($query){
|
||||||
|
if ( !RoleDefinition::isAdmin() ){
|
||||||
|
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
||||||
|
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
|
if ( RoleDefinition::isReception()){
|
||||||
|
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -67,11 +67,19 @@ class TransferSearch extends Transfer
|
|||||||
public function search($params)
|
public function search($params)
|
||||||
{
|
{
|
||||||
$query = Transfer::find();
|
$query = Transfer::find();
|
||||||
|
|
||||||
|
$query->innerJoinWith('account');
|
||||||
|
|
||||||
|
|
||||||
if ( !RoleDefinition::isAdmin() ){
|
if ( !RoleDefinition::isAdmin() ){
|
||||||
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
||||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
|
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
|
||||||
|
|
||||||
|
if ( RoleDefinition::isReception()){
|
||||||
|
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$dataProvider = new ActiveDataProvider([
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
|||||||
29
backend/views/transfer/_export_btn_sale.php
Normal file
29
backend/views/transfer/_export_btn_sale.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\TransferSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?= Html::a(
|
||||||
|
Yii::t('frontend/transfer', 'Export PDF'),
|
||||||
|
Url::to(['sale-pdf' ,
|
||||||
|
Html::getInputName($model, "start") => Html::getAttributeValue($model, "start"),
|
||||||
|
Html::getInputName($model, "end") =>Html::getAttributeValue($model, "end"),
|
||||||
|
Html::getInputName($model, "id_account") => Html::getAttributeValue($model, "id_account"),
|
||||||
|
Html::getInputName($model, "id_user") => Html::getAttributeValue($model, "id_user"),
|
||||||
|
Html::getInputName($model, "category") => Html::getAttributeValue($model, "category"),
|
||||||
|
Html::getInputName($model, "id_product") => Html::getAttributeValue($model, "id_product"),
|
||||||
|
Html::getInputName($model, "status") => Html::getAttributeValue($model, "status"),
|
||||||
|
] ),
|
||||||
|
['class' => 'btn btn-primary'])
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
142
backend/views/transfer/_result_sale.php
Normal file
142
backend/views/transfer/_result_sale.php
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use common\models\Account;
|
||||||
|
use common\models\User;
|
||||||
|
use common\models\ProductCategory;
|
||||||
|
use common\models\Product;
|
||||||
|
use common\models\Transfer;
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
td,th{
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
.table-summary td.count {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-summary td.money {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-filter th{
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
// ////////////////////////
|
||||||
|
// Termék eladás
|
||||||
|
// //////////////////////
|
||||||
|
?>
|
||||||
|
<h3>Termék eladások</h3>
|
||||||
|
|
||||||
|
<table class="table-filter">
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('start')) ?></th>
|
||||||
|
<td><?php echo Html::getAttributeValue($searchModel, "start")?></td>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('end')) ?></th>
|
||||||
|
<td><?php echo Html::getAttributeValue($searchModel, "end")?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_account')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->id_account) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$account = Account::findOne($searchModel->id_account) ;
|
||||||
|
if ( $account != null ){
|
||||||
|
echo $account->name;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_user')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->id_user) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$user = User::findOne($searchModel->id_user) ;
|
||||||
|
if ( $user != null ){
|
||||||
|
echo $user->username;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('category')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->category) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$category = ProductCategory::findOne($searchModel->category) ;
|
||||||
|
if ( $category != null ){
|
||||||
|
echo $category->name;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_product')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->id_product) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$product = Product::findOne($searchModel->id_product) ;
|
||||||
|
if ( $product != null ){
|
||||||
|
echo $product->name;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('status')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->status) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$statuses = Transfer::statuses();
|
||||||
|
$status = "";
|
||||||
|
if (array_key_exists($searchModel->status, $statuses) ){
|
||||||
|
echo $statuses[$searchModel->status];
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo $searchModel->productMoney; ?> Ft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>T</th>
|
||||||
|
<th>Kiadva</th>
|
||||||
|
<th>Fizetve</th>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<!-- <th>Vásárló</th> -->
|
||||||
|
<th>Kategória</th>
|
||||||
|
<th>Termék</th>
|
||||||
|
<th>Egység ár</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($searchModel->products as $p ){?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo "#".$p['id_transfer']?> </td>
|
||||||
|
<td><?php echo $p['product_created_at']?> </td>
|
||||||
|
<td><?php echo $p['product_paid_at']?> </td>
|
||||||
|
<td><?php echo $p['account_name']?> </td>
|
||||||
|
<td><?php echo $p['user_name']?> </td>
|
||||||
|
|
||||||
|
<td><?php echo $p['product_category_name'] ?></td>
|
||||||
|
<td><?php echo $p['product_name'] ?></td>
|
||||||
|
<td class='money'><?php echo $p['product_item_price']?> Ft</td>
|
||||||
|
<td class='count'><?php echo $p['product_count']?> Db</td>
|
||||||
|
<td class='money'><?php echo $p['product_money']?> FT</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (count ( $searchModel->products ) == 0) {
|
||||||
|
?>
|
||||||
|
Nincs találat
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
77
backend/views/transfer/_search_sale.php
Normal file
77
backend/views/transfer/_search_sale.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use kartik\widgets\DatePicker;
|
||||||
|
use frontend\components\HtmlHelper;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\TransferSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$accountOptions = ['' =>'Mind']+ HtmlHelper::mkAccountOptions( $model->accounts );
|
||||||
|
$userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->users,'id','username');
|
||||||
|
$productOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->productOptions,'id_product','name');
|
||||||
|
$productCategoryOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->productCategories,'id_product_category','name');
|
||||||
|
$transferStatusOptions = ['' => 'Mind'] + Transfer::statuses();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="transfer-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['sale'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'category')->dropDownList($productCategoryOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_product')->dropDownList($productOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'status')->dropDownList($transferStatusOptions) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
115
backend/views/transfer/sale.php
Normal file
115
backend/views/transfer/sale.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use yii\widgets\ListView;
|
||||||
|
use yii\base\Widget;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel common\models\TransferSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t ( 'frontend/transfer', 'Product sale detailed' );
|
||||||
|
$this->params ['breadcrumbs'] [] = $this->title;
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
.dl-transfer {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-transfer {
|
||||||
|
border: 1px solid #b4b4b4;
|
||||||
|
margin-top: 12px;
|
||||||
|
padding-top: 6px;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.count, td.money {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.name {
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-category-product td.name {
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-category-product td.count {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-category-product td.money {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="transfer-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search_sale', ['model' => $searchModel]); ?>
|
||||||
|
<?php echo $this->render('_export_btn_sale', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<?php
|
||||||
|
// ////////////////////////
|
||||||
|
// Termék eladás
|
||||||
|
// //////////////////////
|
||||||
|
?>
|
||||||
|
<h3>Termék eladások</h3>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo $searchModel->productMoney; ?> Ft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Tranzakció</th>
|
||||||
|
<th>Kiadva</th>
|
||||||
|
<th>Fizetve</th>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<th>Vásárló</th>
|
||||||
|
<th>Kategória</th>
|
||||||
|
<th>Termék</th>
|
||||||
|
<th>Egység ár</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($searchModel->products as $p ){?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo "#".$p['id_transfer']?> </td>
|
||||||
|
<td><?php echo $p['product_created_at']?> </td>
|
||||||
|
<td><?php echo $p['product_paid_at']?> </td>
|
||||||
|
<td><?php echo $p['account_name']?> </td>
|
||||||
|
<td><?php echo $p['user_name']?> </td>
|
||||||
|
<td><?php echo $p['customer_name']?> </td>
|
||||||
|
<td><?php echo $p['product_category_name'] ?></td>
|
||||||
|
<td><?php echo $p['product_name'] ?></td>
|
||||||
|
<td class='money'><?php echo $p['product_item_price']?> Ft</td>
|
||||||
|
<td class='count'><?php echo $p['product_count']?> Db</td>
|
||||||
|
<td class='money'><?php echo $p['product_money']?> FT</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (count ( $searchModel->products ) == 0) {
|
||||||
|
?>
|
||||||
|
Nincs találat
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -24,7 +24,7 @@ return [
|
|||||||
'datetimeFormat' => 'yyyy.MM.dd HH:mm',
|
'datetimeFormat' => 'yyyy.MM.dd HH:mm',
|
||||||
'timeFormat' => 'HH:mm',
|
'timeFormat' => 'HH:mm',
|
||||||
'locale' => 'hu-Hu',
|
'locale' => 'hu-Hu',
|
||||||
'timeZone' => 'UTC',
|
'timeZone' => 'Europe/Budapest',
|
||||||
'defaultTimeZone' => 'UTC',
|
'defaultTimeZone' => 'UTC',
|
||||||
'nullDisplay' => "-",
|
'nullDisplay' => "-",
|
||||||
],
|
],
|
||||||
|
|||||||
@ -44,6 +44,7 @@ return [
|
|||||||
'Reset' => 'Reset',
|
'Reset' => 'Reset',
|
||||||
'Sale Price' => 'Eladási ár',
|
'Sale Price' => 'Eladási ár',
|
||||||
'Search' => 'Keresés',
|
'Search' => 'Keresés',
|
||||||
|
'Sell' => 'Fizetve',
|
||||||
'Sell product' => 'Termék eladás',
|
'Sell product' => 'Termék eladás',
|
||||||
'Stock' => 'Raktáron',
|
'Stock' => 'Raktáron',
|
||||||
'Stock {stock} lower then {count}!' => 'Raktáron {stock} kevesebb mint {count}!',
|
'Stock {stock} lower then {count}!' => 'Raktáron {stock} kevesebb mint {count}!',
|
||||||
|
|||||||
@ -29,5 +29,8 @@ return [
|
|||||||
'Update {modelClass}: ' => '{modelClass} módosítás: ',
|
'Update {modelClass}: ' => '{modelClass} módosítás: ',
|
||||||
'pieces' => 'db',
|
'pieces' => 'db',
|
||||||
'Transfers Summary' => 'Bevétel',
|
'Transfers Summary' => 'Bevétel',
|
||||||
'Daily transfers' => 'Napi bevételek'
|
'Daily transfers' => 'Napi bevételek',
|
||||||
|
'Ticket sale detailed' => 'Bérlet eladás részletes',
|
||||||
|
'Product sale detailed' => 'Termék eladás részletes',
|
||||||
|
'Sales detailed' => 'Termék eladás részletes',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -96,7 +96,7 @@ class Account extends \yii\db\ActiveRecord
|
|||||||
static function types() {
|
static function types() {
|
||||||
return [
|
return [
|
||||||
self::TYPE_ALL => Yii::t('common/account', 'Account'),
|
self::TYPE_ALL => Yii::t('common/account', 'Account'),
|
||||||
// self::TYPE_VALUE_HIDDEN => Yii::t('common/account', 'Only the name is visible'),
|
self::TYPE_VALUE_HIDDEN => Yii::t('common/account', 'Only the name is visible'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -355,6 +355,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
$transfer->status = $status;
|
$transfer->status = $status;
|
||||||
$transfer->type = Transfer::TYPE_TICKET;
|
$transfer->type = Transfer::TYPE_TICKET;
|
||||||
|
$transfer->direction = Transfer::DIRECTION_IN;
|
||||||
|
|
||||||
$transfer->id_object = $ticket->id_ticket;
|
$transfer->id_object = $ticket->id_ticket;
|
||||||
|
|
||||||
|
|||||||
@ -157,10 +157,14 @@ class TransferListSearch extends Transfer
|
|||||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
|
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addQueryFilters($query){
|
protected function addQueryFilters($query){
|
||||||
|
$query->innerJoin("account", "transfer.id_account = account.id_account");
|
||||||
|
|
||||||
$this->addAccountConstraint($query);
|
$this->addAccountConstraint($query);
|
||||||
|
|
||||||
$query->andFilterWhere([
|
$query->andFilterWhere([
|
||||||
@ -323,12 +327,12 @@ class TransferListSearch extends Transfer
|
|||||||
|
|
||||||
protected function readTickets(){
|
protected function readTickets(){
|
||||||
$query = (new \yii\db\Query());
|
$query = (new \yii\db\Query());
|
||||||
$query->select(['user.username as user_name', 'account.name as account_name','ticket_type.name as ticket_type_name' , 'transfer.count AS ticket_count', 'transfer.money AS ticket_money','transfer.item_price AS ticket_item_price', 'transfer.created_at as ticket_created_at','transfer.paid_at as ticket_paid_at']);
|
$query->select([ 'customer.name as customer_name', 'user.username as user_name', 'account.name as account_name','ticket_type.name as ticket_type_name' , 'transfer.count AS ticket_count', 'transfer.money AS ticket_money','transfer.item_price AS ticket_item_price', 'transfer.created_at as ticket_created_at','transfer.paid_at as ticket_paid_at']);
|
||||||
$query->from('transfer');
|
$query->from('transfer');
|
||||||
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
||||||
$query->innerJoin("ticket", "ticket.id_ticket = transfer.id_object");
|
$query->innerJoin("ticket", "ticket.id_ticket = transfer.id_object");
|
||||||
|
$query->innerJoin("customer","customer.id_customer = transfer.id_customer");
|
||||||
$query->innerJoin("ticket_type", "ticket.id_ticket_type = ticket_type.id_ticket_type");
|
$query->innerJoin("ticket_type", "ticket.id_ticket_type = ticket_type.id_ticket_type");
|
||||||
$query->innerJoin("account", "transfer.id_account = account.id_account");
|
|
||||||
$query->innerJoin("user", "transfer.id_user = user.id");
|
$query->innerJoin("user", "transfer.id_user = user.id");
|
||||||
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
||||||
$this->addQueryFilters($query);
|
$this->addQueryFilters($query);
|
||||||
@ -352,7 +356,7 @@ class TransferListSearch extends Transfer
|
|||||||
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
$query->innerJoin("product", "sale.id_product = product.id_product");
|
$query->innerJoin("product", "sale.id_product = product.id_product");
|
||||||
$query->innerJoin("product_category", "product.id_product_category = product_category.id_product_category");
|
$query->innerJoin("product_category", "product.id_product_category = product_category.id_product_category");
|
||||||
$query->innerJoin("account", "transfer.id_account = account.id_account");
|
|
||||||
$query->innerJoin("user", "transfer.id_user = user.id");
|
$query->innerJoin("user", "transfer.id_user = user.id");
|
||||||
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
||||||
$this->addQueryFilters($query);
|
$this->addQueryFilters($query);
|
||||||
@ -372,7 +376,6 @@ class TransferListSearch extends Transfer
|
|||||||
$query->from('transfer');
|
$query->from('transfer');
|
||||||
$query->andWhere(['transfer.type' => Transfer::TYPE_MONEY_MOVEMENT_OUT]);
|
$query->andWhere(['transfer.type' => Transfer::TYPE_MONEY_MOVEMENT_OUT]);
|
||||||
$query->innerJoin("money_movement", "money_movement.id_money_movement = transfer.id_object");
|
$query->innerJoin("money_movement", "money_movement.id_money_movement = transfer.id_object");
|
||||||
$query->innerJoin("account", "transfer.id_account = account.id_account");
|
|
||||||
$query->innerJoin("user", "transfer.id_user = user.id");
|
$query->innerJoin("user", "transfer.id_user = user.id");
|
||||||
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
||||||
$this->addQueryFilters($query);
|
$this->addQueryFilters($query);
|
||||||
|
|||||||
286
common/models/TransferSaleSearch.php
Normal file
286
common/models/TransferSaleSearch.php
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use yii\base\Object;
|
||||||
|
use yii\db\Query;
|
||||||
|
use yii\db\Expression;
|
||||||
|
use common\models\Account;
|
||||||
|
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
use common\models\MoneyMovement;
|
||||||
|
/**
|
||||||
|
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
||||||
|
*/
|
||||||
|
class TransferSaleSearch extends Transfer
|
||||||
|
{
|
||||||
|
|
||||||
|
public $start;
|
||||||
|
public $end;
|
||||||
|
|
||||||
|
public $timestampStart;
|
||||||
|
public $timestampEnd;
|
||||||
|
|
||||||
|
public $totals;
|
||||||
|
|
||||||
|
public $accounts;
|
||||||
|
|
||||||
|
public $types;
|
||||||
|
|
||||||
|
public $users;
|
||||||
|
|
||||||
|
public $productCategories;
|
||||||
|
|
||||||
|
public $productOptions;
|
||||||
|
/**
|
||||||
|
* all money gained with product sell
|
||||||
|
* */
|
||||||
|
public $productMoney;
|
||||||
|
/**
|
||||||
|
* all money gained with product sell grouped by category
|
||||||
|
* */
|
||||||
|
public $productMoneies;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* total gained money
|
||||||
|
* */
|
||||||
|
public $total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* all product transfer
|
||||||
|
* */
|
||||||
|
public $products;
|
||||||
|
|
||||||
|
public $productsByCategory;
|
||||||
|
|
||||||
|
public $category;
|
||||||
|
public $status;
|
||||||
|
public $id_product;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
|
||||||
|
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
|
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
|
|
||||||
|
[ [ 'id_account','id_user' ,'category','status','id_product' ] , 'integer'],
|
||||||
|
['types', 'each', 'rule' => ['integer']],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function attributeLabels(){
|
||||||
|
$result = parent::attributeLabels();
|
||||||
|
$result['category'] = "Termék kategória";
|
||||||
|
$result['id_product'] = "Termék";
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = Transfer::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->readProductsMoney();
|
||||||
|
$this->calcTotal();
|
||||||
|
|
||||||
|
// $this->readProductsByCategory();
|
||||||
|
// $this->readProductsByCategoryDetailed();
|
||||||
|
|
||||||
|
|
||||||
|
$this->readProducts();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function calcTotal(){
|
||||||
|
$this->total = 0;
|
||||||
|
$this->total += $this->productMoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function addAccountConstraint($query){
|
||||||
|
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
||||||
|
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
|
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
|
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addQueryFilters($query){
|
||||||
|
$query->innerJoin("account", "transfer.id_account = account.id_account");
|
||||||
|
|
||||||
|
$this->addAccountConstraint($query);
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'transfer.id_account' => $this->id_account,
|
||||||
|
'transfer.id_user' => $this->id_user,
|
||||||
|
'transfer.type' => $this->type,
|
||||||
|
'transfer.id_user' => $this->id_user,
|
||||||
|
'product_category.id_product_category' => $this->category,
|
||||||
|
'transfer.status' => $this->status,
|
||||||
|
'product.id_product' => $this->id_product,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$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->andWhere(['transfer.status' => Transfer::STATUS_PAID]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected function readProductsByCategory(){
|
||||||
|
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['coalesce(sum(transfer.money),0) AS product_money', 'coalesce(sum(transfer.count),0) as category_count', 'product_category.name as category_name']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->groupBy(['product_category.id_product_category','product_category.name']);
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||||
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
|
$query->innerJoin("product", "sale.id_product = product.id_product");
|
||||||
|
$query->innerJoin("product_category", "product.id_product_category = product_category.id_product_category");
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$this->productMoneies = $query->all();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function readProductsByCategoryDetailed(){
|
||||||
|
|
||||||
|
$formatted = [];
|
||||||
|
$formatted['categories'] = [];
|
||||||
|
$formatted['total'] = 0;
|
||||||
|
$prevCategory = null;
|
||||||
|
$curCategory = null;
|
||||||
|
|
||||||
|
$category = null;
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['product_category.id_product_category as product_category_id','product_category.name as product_category_name', 'product.name as product_name' ,'coalesce(sum(transfer.money),0) AS product_money', 'coalesce(sum(transfer.count),0) as product_count']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->groupBy(['product.id_product','product.name','product_category.id_product_category','product_category.name']);
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||||
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
|
$query->innerJoin("product", "sale.id_product = product.id_product");
|
||||||
|
$query->innerJoin("product_category", "product.id_product_category = product_category.id_product_category");
|
||||||
|
$query->orderBy(['product_category.name' => SORT_ASC,'product.name' => SORT_ASC]);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$result = $query->all();
|
||||||
|
|
||||||
|
foreach ($result as $row){
|
||||||
|
$curCategory = $row['product_category_id'];
|
||||||
|
if ( $curCategory != $prevCategory ){
|
||||||
|
//store last category
|
||||||
|
if ( $category != null ){
|
||||||
|
$formatted['categories'][] = $category;
|
||||||
|
}
|
||||||
|
$prevCategory = $curCategory;
|
||||||
|
//create new category
|
||||||
|
$category = [];
|
||||||
|
$category['category'] = [];
|
||||||
|
$category['category']['name'] = $row['product_category_name'];
|
||||||
|
$category['category']['id'] = $row['product_category_id'];
|
||||||
|
$category['products'] = [];
|
||||||
|
$category['total'] = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
$category['products'][] = $row;
|
||||||
|
$category['total'] += $row['product_money'];
|
||||||
|
$formatted['total'] += $row['product_money'];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $category != null ){
|
||||||
|
$formatted['categories'][]= $category;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->productsByCategory = $formatted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function readProductsMoney(){
|
||||||
|
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['coalesce(sum(transfer.money),0) AS product_money' ]);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||||
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
|
$query->innerJoin("product", "sale.id_product = product.id_product");
|
||||||
|
$query->innerJoin("product_category", "product.id_product_category = product_category.id_product_category");
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$this->productMoney = $query->scalar();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected function readProducts(){
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select([ 'transfer.id_transfer as id_transfer', 'customer.name as customer_name' ,'user.username as user_name','account.name as account_name' , 'product_category.name as product_category_name', 'product.name as product_name', 'transfer.money AS product_money', 'transfer.count AS product_count', 'transfer.money AS product_money','transfer.item_price AS product_item_price', 'transfer.created_at as product_created_at','transfer.paid_at as product_paid_at']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||||
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
|
$query->innerJoin("product", "sale.id_product = product.id_product");
|
||||||
|
$query->innerJoin("product_category", "product.id_product_category = product_category.id_product_category");
|
||||||
|
$query->leftJoin("customer", "transfer.id_customer = customer.id_customer");
|
||||||
|
$query->innerJoin("user", "transfer.id_user = user.id");
|
||||||
|
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$this->products = $query->all();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($this->products) ;$i++ ){
|
||||||
|
$this->products[$i]['product_created_at'] = Yii::$app->formatter->asDatetime($this->products[$i]['product_created_at'], 'yyyy.MM.dd HH:mm:ss');
|
||||||
|
$this->products[$i]['product_paid_at'] = empty($this->products[$i]['product_paid_at'] ) ? '-' : Yii::$app->formatter->asDatetime($this->products[$i]['product_paid_at'], 'yyyy.MM.dd HH:mm:ss');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
230
common/models/TransferTicketSearch.php
Normal file
230
common/models/TransferTicketSearch.php
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use yii\base\Object;
|
||||||
|
use yii\db\Query;
|
||||||
|
use yii\db\Expression;
|
||||||
|
use common\models\Account;
|
||||||
|
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
use common\models\MoneyMovement;
|
||||||
|
/**
|
||||||
|
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
||||||
|
*/
|
||||||
|
class TransferTicketSearch extends Transfer
|
||||||
|
{
|
||||||
|
|
||||||
|
public $start;
|
||||||
|
public $end;
|
||||||
|
|
||||||
|
public $timestampStart;
|
||||||
|
public $timestampEnd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// public $totalsCreatedAt = ['total' => 0, 'accounts' =>[] ];
|
||||||
|
// public $totalsCreatedAtNotPaid= ['total' => 0, 'accounts' =>[]];
|
||||||
|
// public $totalsCreatedAtPaid= ['total' => 0, 'accounts' =>[]];
|
||||||
|
// public $totalsPaidAt= ['total' => 0, 'accounts' =>[]];
|
||||||
|
// public $totalsPaidAtNotCreatedAt= ['total' => 0, 'accounts' =>[]];
|
||||||
|
|
||||||
|
|
||||||
|
public $totals;
|
||||||
|
|
||||||
|
public $accounts;
|
||||||
|
|
||||||
|
public $types;
|
||||||
|
|
||||||
|
public $users;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* all money gained with ticket sell
|
||||||
|
* */
|
||||||
|
public $ticketMoney;
|
||||||
|
/**
|
||||||
|
* total gained money
|
||||||
|
* */
|
||||||
|
public $total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ticket sale statisitc
|
||||||
|
* */
|
||||||
|
public $ticketStats;
|
||||||
|
|
||||||
|
public $tickets;
|
||||||
|
|
||||||
|
public $customer;
|
||||||
|
|
||||||
|
public $ticketTypes;
|
||||||
|
public $id_ticket_type;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
|
||||||
|
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
|
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
|
|
||||||
|
[ [ 'id_account','id_user' ,'id_ticket_type' ] , 'integer'],
|
||||||
|
['types', 'each', 'rule' => ['integer']],
|
||||||
|
[['customer' ] , 'string' , 'max' => 200 ]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function attributeLabels(){
|
||||||
|
$result = parent::attributeLabels();
|
||||||
|
$result['id_ticket_type'] = 'Bérlet típus';
|
||||||
|
$result['customer'] = 'Vendég';
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = Transfer::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->readTicketMoney();
|
||||||
|
$this->calcTotal();
|
||||||
|
|
||||||
|
$this->readTicketStas();
|
||||||
|
|
||||||
|
|
||||||
|
$this->readTickets();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function calcTotal(){
|
||||||
|
$this->total = 0;
|
||||||
|
$this->total += $this->ticketMoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function addAccountConstraint($query){
|
||||||
|
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
||||||
|
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
|
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
|
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addQueryFilters($query){
|
||||||
|
$query->innerJoin("account", "transfer.id_account = account.id_account");
|
||||||
|
|
||||||
|
$this->addAccountConstraint($query);
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'transfer.id_account' => $this->id_account,
|
||||||
|
'transfer.id_user' => $this->id_user,
|
||||||
|
'transfer.type' => $this->type,
|
||||||
|
'transfer.id_user' => $this->id_user,
|
||||||
|
'ticket_type.id_ticket_type' => $this->id_ticket_type,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$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' , 'LOWER(customer.name)' , strtolower( $this->customer ) ]);
|
||||||
|
|
||||||
|
$query->andWhere(['transfer.status' => Transfer::STATUS_PAID]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function readTicketStas(){
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['ticket_type.name as ticket_type_name' , 'coalesce(sum(abs(transfer.count)),0) AS ticket_count', 'coalesce(sum(abs(transfer.money)),0) AS ticket_money']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
||||||
|
$query->innerJoin("ticket", "ticket.id_ticket = transfer.id_object");
|
||||||
|
$query->innerJoin("ticket_type", "ticket.id_ticket_type = ticket_type.id_ticket_type");
|
||||||
|
$query->innerJoin("customer","customer.id_customer = transfer.id_customer");
|
||||||
|
$query->groupBy(['ticket_type.id_ticket_type','ticket_type.name']);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
|
||||||
|
$this->ticketStats = $query->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function readTicketMoney(){
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select([' coalesce(sum(abs(transfer.money)),0) AS ticket_money']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
||||||
|
$query->innerJoin("ticket", "ticket.id_ticket = transfer.id_object");
|
||||||
|
$query->innerJoin("ticket_type", "ticket.id_ticket_type = ticket_type.id_ticket_type");
|
||||||
|
$query->innerJoin("customer","customer.id_customer = transfer.id_customer");
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
$this->ticketMoney = $query->scalar();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected function readTickets(){
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select([ 'customer.name as customer_name', 'user.username as user_name', 'account.name as account_name','ticket_type.name as ticket_type_name' , 'transfer.count AS ticket_count', 'transfer.money AS ticket_money','transfer.item_price AS ticket_item_price', 'transfer.created_at as ticket_created_at','transfer.paid_at as ticket_paid_at']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
||||||
|
$query->innerJoin("ticket", "ticket.id_ticket = transfer.id_object");
|
||||||
|
$query->innerJoin("customer","customer.id_customer = transfer.id_customer");
|
||||||
|
$query->innerJoin("ticket_type", "ticket.id_ticket_type = ticket_type.id_ticket_type");
|
||||||
|
$query->innerJoin("user", "transfer.id_user = user.id");
|
||||||
|
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
|
||||||
|
$this->tickets = $query->all();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($this->tickets) ;$i++ ){
|
||||||
|
$this->tickets[$i]['ticket_created_at'] = Yii::$app->formatter->asDatetime($this->tickets[$i]['ticket_created_at'], 'yyyy.MM.dd HH:mm:ss');
|
||||||
|
$this->tickets[$i]['ticket_paid_at'] = empty($this->tickets[$i]['ticket_paid_at'] ) ? '-' : Yii::$app->formatter->asDatetime($this->tickets[$i]['ticket_paid_at'], 'yyyy.MM.dd HH:mm:ss');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -26,7 +26,9 @@
|
|||||||
"bower-asset/accounting": "^0.3.2",
|
"bower-asset/accounting": "^0.3.2",
|
||||||
"dmstr/yii2-adminlte-asset": "2.*",
|
"dmstr/yii2-adminlte-asset": "2.*",
|
||||||
"bassjobsen/bootstrap-3-typeahead": "^4.0",
|
"bassjobsen/bootstrap-3-typeahead": "^4.0",
|
||||||
"bower-asset/webcamjs": "^1.0"
|
"bower-asset/webcamjs": "^1.0",
|
||||||
|
"mpdf/mpdf": "^6.0",
|
||||||
|
"os/php-excel": "^2.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"yiisoft/yii2-codeception": "*",
|
"yiisoft/yii2-codeception": "*",
|
||||||
|
|||||||
84
composer.lock
generated
84
composer.lock
generated
@ -4,8 +4,8 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "fa82e6ba1233a366a5f044d19a7bd69d",
|
"hash": "e0ae7f422a0ca8c9297c28eefe9acd9b",
|
||||||
"content-hash": "ea0b9fcfc8a270415b8f9292af1c17d3",
|
"content-hash": "6277b5f664f4bc22c02c689e701964a5",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "almasaeed2010/adminlte",
|
"name": "almasaeed2010/adminlte",
|
||||||
@ -1802,6 +1802,86 @@
|
|||||||
],
|
],
|
||||||
"time": "2014-11-09 19:54:17"
|
"time": "2014-11-09 19:54:17"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "mpdf/mpdf",
|
||||||
|
"version": "v6.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/mpdf/mpdf.git",
|
||||||
|
"reference": "a15743d030ce3b5b7be36c6e83f76589b27c3f2c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/a15743d030ce3b5b7be36c6e83f76589b27c3f2c",
|
||||||
|
"reference": "a15743d030ce3b5b7be36c6e83f76589b27c3f2c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"php": ">=4.3.10"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"mpdf.php",
|
||||||
|
"classes"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"GPL-1.0+"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Ian Back"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support",
|
||||||
|
"homepage": "http://www.mpdf1.com/mpdf/index.php",
|
||||||
|
"keywords": [
|
||||||
|
"pdf",
|
||||||
|
"php",
|
||||||
|
"utf-8"
|
||||||
|
],
|
||||||
|
"time": "2015-03-01 10:27:49"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "os/php-excel",
|
||||||
|
"version": "2.1",
|
||||||
|
"target-dir": "PHPExcel",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ouardisoft/PHPExcel.git",
|
||||||
|
"reference": "1dcb280a82b94943a00d478eac099542aa0be2bd"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/ouardisoft/PHPExcel/zipball/1dcb280a82b94943a00d478eac099542aa0be2bd",
|
||||||
|
"reference": "1dcb280a82b94943a00d478eac099542aa0be2bd",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.2.6"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "LOUARDI Abdeltif",
|
||||||
|
"email": "louardi.abdeltif@yahoo.fr",
|
||||||
|
"homepage": "http://phphub.net"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Excel Library",
|
||||||
|
"homepage": "http://github.com/ouardisoft/PHPExcel",
|
||||||
|
"keywords": [
|
||||||
|
"excel"
|
||||||
|
],
|
||||||
|
"time": "2012-05-02 20:42:37"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "rmrevin/yii2-fontawesome",
|
"name": "rmrevin/yii2-fontawesome",
|
||||||
"version": "2.12.2",
|
"version": "2.12.2",
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m160103_172422_alter__table__card__make__number__unique extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->execute("ALTER IGNORE TABLE card ADD UNIQUE (number);");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m160103_172422_alter__table__card__make__number__unique cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -69,6 +69,8 @@ class FrontendMenuStructure{
|
|||||||
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
|
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
|
||||||
['label' => Yii::t('frontend/money-movement','Money movements'), 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ],
|
['label' => Yii::t('frontend/money-movement','Money movements'), 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ],
|
||||||
['label' => Yii::t('frontend/transfer','Daily transfers'), 'url' => [ '/transfer/list', 'TransferListSearch[start]' => $this->start, 'TransferListSearch[end]' => $this->tomorrow ] ],
|
['label' => Yii::t('frontend/transfer','Daily transfers'), 'url' => [ '/transfer/list', 'TransferListSearch[start]' => $this->start, 'TransferListSearch[end]' => $this->tomorrow ] ],
|
||||||
|
['label' => Yii::t('frontend/transfer','Sales detailed'), 'url' => [ '/transfer/sale', 'TransferSaleSearch[start]' => $this->start, 'TransferSaleSearch[end]' => $this->tomorrow ] ],
|
||||||
|
['label' => Yii::t('frontend/transfer','Ticket sale detailed'), 'url' => [ '/transfer/tickets', 'TransferTicketSearch[start]' => $this->start, 'TransferTicketSearch[end]' => $this->tomorrow ] ],
|
||||||
];
|
];
|
||||||
|
|
||||||
if ( $isadmin || Yii::$app->user->can('reception.transfers') ){
|
if ( $isadmin || Yii::$app->user->can('reception.transfers') ){
|
||||||
|
|||||||
@ -11,6 +11,14 @@ use yii\filters\VerbFilter;
|
|||||||
use frontend\models\TransferMoneyMovementSearch;
|
use frontend\models\TransferMoneyMovementSearch;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use frontend\models\TransferListSearch;
|
use frontend\models\TransferListSearch;
|
||||||
|
use common\models\ShoppingCart;
|
||||||
|
use common\models\UserSoldItem;
|
||||||
|
use common\models\TransferSaleSearch;
|
||||||
|
use common\models\User;
|
||||||
|
use common\models\ProductCategory;
|
||||||
|
use common\models\Product;
|
||||||
|
use common\models\TransferTicketSearch;
|
||||||
|
use common\models\TicketType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransferController implements the CRUD actions for Transfer model.
|
* TransferController implements the CRUD actions for Transfer model.
|
||||||
@ -24,8 +32,21 @@ class TransferController extends Controller
|
|||||||
'class' => VerbFilter::className(),
|
'class' => VerbFilter::className(),
|
||||||
'actions' => [
|
'actions' => [
|
||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
|
'payout' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
// 'actions' => [ 'index','view','summary','list',"sale","sale-pdf" ],
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['admin','employee','reception'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +175,38 @@ class TransferController extends Controller
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing Transfer model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionPayout($id)
|
||||||
|
{
|
||||||
|
$transfer = $this->findModel($id);
|
||||||
|
$connection = \Yii::$app->db;
|
||||||
|
$transaction = $connection->beginTransaction();
|
||||||
|
try {
|
||||||
|
$transfer->status = Transfer::STATUS_PAID;
|
||||||
|
$transfer->paid_at = date('Y-m-d H:i:s' ) ;
|
||||||
|
ShoppingCart::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
|
||||||
|
UserSoldItem::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
|
||||||
|
if ( $transfer->save() ){
|
||||||
|
\Yii::$app->session->setFlash( 'success','Tranzakció kifizetve' );
|
||||||
|
$transaction->commit();
|
||||||
|
}else{
|
||||||
|
throw new \Exception("Failed to save");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(Exception $e) {
|
||||||
|
$transaction->rollback();
|
||||||
|
\Yii::$app->session->setFlash( 'danger','Tranzakció kifizetése nem sikerült' );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this->redirect(Yii::$app->request->referrer);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an existing Transfer model.
|
* Deletes an existing Transfer model.
|
||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
@ -166,6 +219,8 @@ class TransferController extends Controller
|
|||||||
$connection = \Yii::$app->db;
|
$connection = \Yii::$app->db;
|
||||||
$transaction = $connection->beginTransaction();
|
$transaction = $connection->beginTransaction();
|
||||||
try {
|
try {
|
||||||
|
ShoppingCart::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
|
||||||
|
UserSoldItem::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
|
||||||
if ( $transfer->delete() ){
|
if ( $transfer->delete() ){
|
||||||
\Yii::$app->session->setFlash( 'success','Tranzakció törölve' );
|
\Yii::$app->session->setFlash( 'success','Tranzakció törölve' );
|
||||||
$transaction->commit();
|
$transaction->commit();
|
||||||
@ -181,4 +236,103 @@ class TransferController extends Controller
|
|||||||
|
|
||||||
return $this->redirect(Yii::$app->request->referrer);
|
return $this->redirect(Yii::$app->request->referrer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function delete($id){
|
||||||
|
$transfer = $this->findModel($id);
|
||||||
|
$connection = \Yii::$app->db;
|
||||||
|
$transaction = $connection->beginTransaction();
|
||||||
|
try {
|
||||||
|
if ( $transfer->delete() ){
|
||||||
|
\Yii::$app->session->setFlash( 'success','Tranzakció törölve' );
|
||||||
|
$transaction->commit();
|
||||||
|
}else{
|
||||||
|
throw new \Exception("Failed to save");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(Exception $e) {
|
||||||
|
$transaction->rollback();
|
||||||
|
\Yii::$app->session->setFlash( 'danger','Tranzakció törlése nem sikerült' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Transfer models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionSale()
|
||||||
|
{
|
||||||
|
$searchModel = new TransferSaleSearch();
|
||||||
|
$searchModel->accounts = Account::read();
|
||||||
|
$searchModel->users = User::read();
|
||||||
|
$searchModel->productCategories = ProductCategory::read();
|
||||||
|
$searchModel->productOptions = Product::read();
|
||||||
|
|
||||||
|
$searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->render('sale', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function actionSalePdf(){
|
||||||
|
$searchModel = new TransferSaleSearch();
|
||||||
|
$searchModel->accounts = Account::read();
|
||||||
|
$searchModel->users = User::read();
|
||||||
|
$searchModel->productCategories = ProductCategory::read();
|
||||||
|
$searchModel->productOptions = Product::read();
|
||||||
|
|
||||||
|
$searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
|
||||||
|
$mpdf=new \mPDF('utf-8', 'A4-L');
|
||||||
|
$mpdf->WriteHTML($this->renderPartial('_result_sale', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
]));
|
||||||
|
$mpdf->Output('eladasaim.pdf', 'D');
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Transfer models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionTickets()
|
||||||
|
{
|
||||||
|
$searchModel = new TransferTicketSearch();
|
||||||
|
$searchModel->accounts = Account::read();
|
||||||
|
$searchModel->users = User::read();
|
||||||
|
$searchModel->ticketTypes = TicketType::read(null, Account::readDefault());
|
||||||
|
|
||||||
|
$searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->render('tickets', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function actionTicketsPdf(){
|
||||||
|
$searchModel = new TransferTicketSearch();
|
||||||
|
$searchModel->accounts = Account::read();
|
||||||
|
$searchModel->users = User::read();
|
||||||
|
$searchModel->ticketTypes = TicketType::read(null, Account::readDefault());
|
||||||
|
|
||||||
|
$searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
|
||||||
|
$mpdf=new \mPDF('utf-8', 'A4-L');
|
||||||
|
$mpdf->WriteHTML($this->renderPartial('_result_ticket', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
]));
|
||||||
|
$mpdf->Output('eladdot_berletek_'. \Yii::$app->formatter->asDatetime(time()).'.pdf', 'D');
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -187,18 +187,27 @@ class ProductSaleForm extends Model
|
|||||||
|
|
||||||
protected function saveTransfer(){
|
protected function saveTransfer(){
|
||||||
$customer = null;
|
$customer = null;
|
||||||
|
$paid_at;
|
||||||
$status = Transfer::STATUS_PAID;
|
$status = Transfer::STATUS_PAID;
|
||||||
if ( $this->isAppendToUserCart() ){
|
if ( $this->isAppendToUserCart() ){
|
||||||
$status = Transfer::STATUS_NOT_PAID;
|
$status = Transfer::STATUS_NOT_PAID;
|
||||||
}else if ( $this->isAppendToCustomerCart() ){
|
}else if ( $this->isAppendToCustomerCart() ){
|
||||||
$status = Transfer::STATUS_NOT_PAID;
|
$status = Transfer::STATUS_NOT_PAID;
|
||||||
$customer = $this->customer;
|
$customer = $this->customer;
|
||||||
|
}else{
|
||||||
|
$paid_at = date('Y-m-d H:i:s' ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->transfer = Transfer::createProductTransfer($this->sale,$this->account, $this->discount, $this->currency, $this->count, $this->product,$status,$customer);
|
$this->transfer = Transfer::createProductTransfer($this->sale,$this->account, $this->discount, $this->currency, $this->count, $this->product,$status,$customer);
|
||||||
if ( isset($this->comment)){
|
if ( isset($this->comment)){
|
||||||
$this->transfer->comment = $this->comment;
|
$this->transfer->comment = $this->comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isset($paid_at)){
|
||||||
|
$this->transfer->paid_at = $paid_at;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->transfer->id_user = Yii::$app->user->id;
|
$this->transfer->id_user = Yii::$app->user->id;
|
||||||
$this->transfer->save();
|
$this->transfer->save();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class ReceptionForm extends Model
|
|||||||
|
|
||||||
$this->number = str_replace("ö", "0", $this->number);
|
$this->number = str_replace("ö", "0", $this->number);
|
||||||
|
|
||||||
$this->card = Card::find()->andWhere(['or',[ 'in','number' , [$this->number]], ['in','rfid_key' ,[ $this->number]]])->one();
|
$this->card = Card::find()->andWhere(['or', [ 'in','number' , [$this->number]], ['and', ['in','rfid_key' ,[ $this->number] ],"trim(coalesce(rfid_key, '')) <>'' "]])->one();
|
||||||
if ( $this->card != null ){
|
if ( $this->card != null ){
|
||||||
$this->customer = $this->card->customer;
|
$this->customer = $this->card->customer;
|
||||||
$this->readValidTickets();
|
$this->readValidTickets();
|
||||||
|
|||||||
@ -110,11 +110,25 @@ class TicketCreate extends Ticket{
|
|||||||
|
|
||||||
protected function addTransfer(){
|
protected function addTransfer(){
|
||||||
$transfer = Transfer::createTicketTransfer($this->_account, $this->_discount, null, 1, $this);
|
$transfer = Transfer::createTicketTransfer($this->_account, $this->_discount, null, 1, $this);
|
||||||
// $transfer->status = Transfer::STATUS_PAID;
|
|
||||||
|
$status = Transfer::STATUS_PAID;
|
||||||
|
if ( $this->isAppendToUserCart() ){
|
||||||
|
$status = Transfer::STATUS_NOT_PAID;
|
||||||
|
}else if ( $this->isAppendToCustomerCart() ){
|
||||||
|
$status = Transfer::STATUS_NOT_PAID;
|
||||||
|
$customer = $this->customer;
|
||||||
|
}else {
|
||||||
|
$status = Transfer::STATUS_PAID;
|
||||||
|
$transfer->paid_at = date('Y-m-d H:i:s' ) ;
|
||||||
|
}
|
||||||
|
$transfer->status = $status;
|
||||||
|
|
||||||
|
|
||||||
if ( isset($this->comment)){
|
if ( isset($this->comment)){
|
||||||
$transfer->comment = $this->comment;
|
$transfer->comment = $this->comment;
|
||||||
}
|
}
|
||||||
$transfer->id_user = \Yii::$app->user->id;
|
$transfer->id_user = \Yii::$app->user->id;
|
||||||
|
$transfer->id_customer = $this->customer->id_customer;
|
||||||
$transfer->save();
|
$transfer->save();
|
||||||
$this->_transfer = $transfer;
|
$this->_transfer = $transfer;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,10 +100,13 @@ $discountOptions = mkOptions( ArrayHelper::map($discounts, 'id_discount', 'name'
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class='col-md-6'>
|
<div class='col-md-4'>
|
||||||
|
<?php echo Html::a(Yii::t("frontend/product","Sell"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
<?php echo Html::a(Yii::t("frontend/product","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_sell_append'] );?>
|
<?php echo Html::a(Yii::t("frontend/product","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_sell_append'] );?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-6'>
|
<div class='col-md-4'>
|
||||||
<?php
|
<?php
|
||||||
if ( $receptionForm->isCardWithCustomer() ){
|
if ( $receptionForm->isCardWithCustomer() ){
|
||||||
echo Html::a(Yii::t("frontend/product","Write up"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_customer_cart'] );
|
echo Html::a(Yii::t("frontend/product","Write up"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_customer_cart'] );
|
||||||
|
|||||||
@ -26,6 +26,9 @@ use kartik\widgets\ActiveForm;
|
|||||||
<th>
|
<th>
|
||||||
<?php echo Yii::t('frontend/product', 'Total Price')?>
|
<?php echo Yii::t('frontend/product', 'Total Price')?>
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
<?php echo "";?>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@ -19,6 +19,8 @@ $options = [];
|
|||||||
$options['lookup_product_url'] = Url::toRoute(['product/lookup']);
|
$options['lookup_product_url'] = Url::toRoute(['product/lookup']);
|
||||||
$options['find_product_url'] = Url::toRoute(['product/find']);
|
$options['find_product_url'] = Url::toRoute(['product/find']);
|
||||||
$options['url_pay_user_cart'] = Url::toRoute(['product/payout-user-cart']);
|
$options['url_pay_user_cart'] = Url::toRoute(['product/payout-user-cart']);
|
||||||
|
$options['url_delete_transaction'] = Url::toRoute(['transfer/delete']);
|
||||||
|
$options['url_pay_transaction'] = Url::toRoute(['transfer/payout']);
|
||||||
$options['user_cart'] = $userTransfers;
|
$options['user_cart'] = $userTransfers;
|
||||||
$options['products'] = $model->products;
|
$options['products'] = $model->products;
|
||||||
if ( isset($model->card) ){
|
if ( isset($model->card) ){
|
||||||
|
|||||||
@ -67,10 +67,13 @@ use common\models\Account;
|
|||||||
<?= $form->field($model, 'comment')->textarea(['maxlength' => true]) ?>
|
<?= $form->field($model, 'comment')->textarea(['maxlength' => true]) ?>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class='col-md-6'>
|
<div class='col-md-4'>
|
||||||
|
<?php echo Html::a(Yii::t("frontend/ticket","Sell"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
<?php echo Html::a(Yii::t("frontend/ticket","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_user_cart'] );?>
|
<?php echo Html::a(Yii::t("frontend/ticket","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_user_cart'] );?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-6'>
|
<div class='col-md-4'>
|
||||||
<?php
|
<?php
|
||||||
if ( $receptionForm->isCardWithCustomer() ){
|
if ( $receptionForm->isCardWithCustomer() ){
|
||||||
echo Html::a(Yii::t("frontend/ticket","Write up"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_customer_cart'] );
|
echo Html::a(Yii::t("frontend/ticket","Write up"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_customer_cart'] );
|
||||||
|
|||||||
@ -31,6 +31,8 @@ $options['types'] = TicketType::modelsToArray($ticketTypes);
|
|||||||
$options['user_cart'] = $model->userCart;
|
$options['user_cart'] = $model->userCart;
|
||||||
$options['customer_cart'] = $model->customerCart;
|
$options['customer_cart'] = $model->customerCart;
|
||||||
$options['selected_type'] = count($ticketTypes) > 0 ? $ticketTypes[0]->id_ticket_type : 0;
|
$options['selected_type'] = count($ticketTypes) > 0 ? $ticketTypes[0]->id_ticket_type : 0;
|
||||||
|
$options['url_delete_transaction'] = Url::toRoute(['transfer/delete']);
|
||||||
|
$options['url_pay_transaction'] = Url::toRoute(['transfer/payout']);
|
||||||
|
|
||||||
$this->registerJs ( 'new TicketSell( '. json_encode($options).');' );
|
$this->registerJs ( 'new TicketSell( '. json_encode($options).');' );
|
||||||
?>
|
?>
|
||||||
|
|||||||
29
frontend/views/transfer/_export_btn_sale.php
Normal file
29
frontend/views/transfer/_export_btn_sale.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\TransferSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?= Html::a(
|
||||||
|
Yii::t('frontend/transfer', 'Export PDF'),
|
||||||
|
Url::to(['sale-pdf' ,
|
||||||
|
Html::getInputName($model, "start") => Html::getAttributeValue($model, "start"),
|
||||||
|
Html::getInputName($model, "end") =>Html::getAttributeValue($model, "end"),
|
||||||
|
Html::getInputName($model, "id_account") => Html::getAttributeValue($model, "id_account"),
|
||||||
|
Html::getInputName($model, "id_user") => Html::getAttributeValue($model, "id_user"),
|
||||||
|
Html::getInputName($model, "category") => Html::getAttributeValue($model, "category"),
|
||||||
|
Html::getInputName($model, "id_product") => Html::getAttributeValue($model, "id_product"),
|
||||||
|
Html::getInputName($model, "status") => Html::getAttributeValue($model, "status"),
|
||||||
|
] ),
|
||||||
|
['class' => 'btn btn-primary'])
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
29
frontend/views/transfer/_export_btn_ticket.php
Normal file
29
frontend/views/transfer/_export_btn_ticket.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\TransferSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?= Html::a(
|
||||||
|
Yii::t('frontend/transfer', 'Export PDF'),
|
||||||
|
Url::to(['tickets-pdf' ,
|
||||||
|
Html::getInputName($model, "start") => Html::getAttributeValue($model, "start"),
|
||||||
|
Html::getInputName($model, "end") =>Html::getAttributeValue($model, "end"),
|
||||||
|
Html::getInputName($model, "id_account") => Html::getAttributeValue($model, "id_account"),
|
||||||
|
Html::getInputName($model, "id_user") => Html::getAttributeValue($model, "id_user"),
|
||||||
|
Html::getInputName($model, "status") => Html::getAttributeValue($model, "status"),
|
||||||
|
Html::getInputName($model, "customer") => Html::getAttributeValue($model, "customer"),
|
||||||
|
Html::getInputName($model, "id_ticket_type") => Html::getAttributeValue($model, "id_ticket_type"),
|
||||||
|
] ),
|
||||||
|
['class' => 'btn btn-primary'])
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
142
frontend/views/transfer/_result_sale.php
Normal file
142
frontend/views/transfer/_result_sale.php
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use common\models\Account;
|
||||||
|
use common\models\User;
|
||||||
|
use common\models\ProductCategory;
|
||||||
|
use common\models\Product;
|
||||||
|
use common\models\Transfer;
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
td,th{
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
.table-summary td.count {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-summary td.money {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-filter th{
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
// ////////////////////////
|
||||||
|
// Termék eladás
|
||||||
|
// //////////////////////
|
||||||
|
?>
|
||||||
|
<h3>Termék eladások</h3>
|
||||||
|
|
||||||
|
<table class="table-filter">
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('start')) ?></th>
|
||||||
|
<td><?php echo Html::getAttributeValue($searchModel, "start")?></td>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('end')) ?></th>
|
||||||
|
<td><?php echo Html::getAttributeValue($searchModel, "end")?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_account')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->id_account) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$account = Account::findOne($searchModel->id_account) ;
|
||||||
|
if ( $account != null ){
|
||||||
|
echo $account->name;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_user')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->id_user) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$user = User::findOne($searchModel->id_user) ;
|
||||||
|
if ( $user != null ){
|
||||||
|
echo $user->username;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('category')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->category) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$category = ProductCategory::findOne($searchModel->category) ;
|
||||||
|
if ( $category != null ){
|
||||||
|
echo $category->name;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_product')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->id_product) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$product = Product::findOne($searchModel->id_product) ;
|
||||||
|
if ( $product != null ){
|
||||||
|
echo $product->name;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('status')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->status) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$statuses = Transfer::statuses();
|
||||||
|
$status = "";
|
||||||
|
if (array_key_exists($searchModel->status, $statuses) ){
|
||||||
|
echo $statuses[$searchModel->status];
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo $searchModel->productMoney; ?> Ft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>T</th>
|
||||||
|
<th>Kiadva</th>
|
||||||
|
<th>Fizetve</th>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<!-- <th>Vásárló</th> -->
|
||||||
|
<th>Kategória</th>
|
||||||
|
<th>Termék</th>
|
||||||
|
<th>Egység ár</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($searchModel->products as $p ){?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo "#".$p['id_transfer']?> </td>
|
||||||
|
<td><?php echo $p['product_created_at']?> </td>
|
||||||
|
<td><?php echo $p['product_paid_at']?> </td>
|
||||||
|
<td><?php echo $p['account_name']?> </td>
|
||||||
|
<td><?php echo $p['user_name']?> </td>
|
||||||
|
|
||||||
|
<td><?php echo $p['product_category_name'] ?></td>
|
||||||
|
<td><?php echo $p['product_name'] ?></td>
|
||||||
|
<td class='money'><?php echo $p['product_item_price']?> Ft</td>
|
||||||
|
<td class='count'><?php echo $p['product_count']?> Db</td>
|
||||||
|
<td class='money'><?php echo $p['product_money']?> FT</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (count ( $searchModel->products ) == 0) {
|
||||||
|
?>
|
||||||
|
Nincs találat
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
136
frontend/views/transfer/_result_ticket.php
Normal file
136
frontend/views/transfer/_result_ticket.php
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use common\models\Account;
|
||||||
|
use common\models\User;
|
||||||
|
use common\models\ProductCategory;
|
||||||
|
use common\models\Product;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use common\models\TicketType;
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
td,th{
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
.table-summary td.count {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-summary td.money {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-filter th{
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
// ////////////////////////
|
||||||
|
// Termék eladás
|
||||||
|
// //////////////////////
|
||||||
|
?>
|
||||||
|
<h3>Termék eladások</h3>
|
||||||
|
|
||||||
|
<table class="table-filter">
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('start')) ?></th>
|
||||||
|
<td><?php echo Html::getAttributeValue($searchModel, "start")?></td>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('end')) ?></th>
|
||||||
|
<td><?php echo Html::getAttributeValue($searchModel, "end")?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_account')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->id_account) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$account = Account::findOne($searchModel->id_account) ;
|
||||||
|
if ( $account != null ){
|
||||||
|
echo $account->name;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_user')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->id_user) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$user = User::findOne($searchModel->id_user) ;
|
||||||
|
if ( $user != null ){
|
||||||
|
echo $user->username;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_ticket_type')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->id_ticket_type) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$ticketType = TicketType::findOne($searchModel->id_ticket_type) ;
|
||||||
|
if ( $ticketType != null ){
|
||||||
|
echo $ticketType->name;
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('customer')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->customer) ){
|
||||||
|
echo"" ;
|
||||||
|
}else{
|
||||||
|
echo Html::encode($searchModel->customer) ;
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo Html::encode($searchModel->getAttributeLabel('status')) ?></th>
|
||||||
|
<td><?php if ( empty($searchModel->status) ){
|
||||||
|
echo"Mind" ;
|
||||||
|
}else{
|
||||||
|
$statuses = Transfer::statuses();
|
||||||
|
$status = "";
|
||||||
|
if (array_key_exists($searchModel->status, $statuses) ){
|
||||||
|
echo $statuses[$searchModel->status];
|
||||||
|
}
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline; ">
|
||||||
|
Összesen: <?php echo $searchModel->ticketMoney; ?> Ft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Kiadva</th>
|
||||||
|
<th>Fizetve</th>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<th>Vendég</th>
|
||||||
|
<th>Bérlet típus</th>
|
||||||
|
<th>Egység ár</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($searchModel->tickets as $t ){?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $t['ticket_created_at']?> </td>
|
||||||
|
<td><?php echo $t['ticket_paid_at']?> </td>
|
||||||
|
<td><?php echo $t['account_name']?> </td>
|
||||||
|
<td><?php echo $t['user_name']?> </td>
|
||||||
|
<td><?php echo $t['customer_name']?> </td>
|
||||||
|
<td><?php echo $t['ticket_type_name'] ?></td>
|
||||||
|
<td class='money'><?php echo $t['ticket_item_price']?> Ft</td>
|
||||||
|
<td class='count'><?php echo $t['ticket_count']?> Db</td>
|
||||||
|
<td class='money'><?php echo $t['ticket_money']?> FT</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (count ( $searchModel->tickets ) == 0) {
|
||||||
|
?>
|
||||||
|
Nincs találat
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
77
frontend/views/transfer/_search_sale.php
Normal file
77
frontend/views/transfer/_search_sale.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use kartik\widgets\DatePicker;
|
||||||
|
use frontend\components\HtmlHelper;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\TransferSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$accountOptions = ['' =>'Mind']+ HtmlHelper::mkAccountOptions( $model->accounts );
|
||||||
|
$userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->users,'id','username');
|
||||||
|
$productOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->productOptions,'id_product','name');
|
||||||
|
$productCategoryOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->productCategories,'id_product_category','name');
|
||||||
|
$transferStatusOptions = ['' => 'Mind'] + Transfer::statuses();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="transfer-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['sale'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'category')->dropDownList($productCategoryOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_product')->dropDownList($productOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'status')->dropDownList($transferStatusOptions) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
78
frontend/views/transfer/_search_ticket.php
Normal file
78
frontend/views/transfer/_search_ticket.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use kartik\widgets\DatePicker;
|
||||||
|
use frontend\components\HtmlHelper;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\TransferSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$accountOptions = ['' =>'Mind']+ HtmlHelper::mkAccountOptions( $model->accounts );
|
||||||
|
$userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->users,'id','username');
|
||||||
|
$transferStatusOptions = ['' => 'Mind'] + Transfer::statuses();
|
||||||
|
$ticketTypeOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->ticketTypes,'id_ticket_type','name');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="transfer-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['tickets'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_ticket_type')->dropDownList($ticketTypeOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'status')->dropDownList($transferStatusOptions) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'customer')->textInput() ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -245,6 +245,7 @@ td.name{
|
|||||||
<th>Fizetve</th>
|
<th>Fizetve</th>
|
||||||
<th>Kassza</th>
|
<th>Kassza</th>
|
||||||
<th>Felhasználó</th>
|
<th>Felhasználó</th>
|
||||||
|
<th>Vendég</th>
|
||||||
<th>Bérlet típus</th>
|
<th>Bérlet típus</th>
|
||||||
<th>Egység ár</th>
|
<th>Egység ár</th>
|
||||||
<th>Mennyiség</th>
|
<th>Mennyiség</th>
|
||||||
@ -258,6 +259,7 @@ td.name{
|
|||||||
<td><?php echo $t['ticket_paid_at']?> </td>
|
<td><?php echo $t['ticket_paid_at']?> </td>
|
||||||
<td><?php echo $t['account_name']?> </td>
|
<td><?php echo $t['account_name']?> </td>
|
||||||
<td><?php echo $t['user_name']?> </td>
|
<td><?php echo $t['user_name']?> </td>
|
||||||
|
<td><?php echo $t['customer_name']?> </td>
|
||||||
<td><?php echo $t['ticket_type_name'] ?></td>
|
<td><?php echo $t['ticket_type_name'] ?></td>
|
||||||
<td class='money'><?php echo $t['ticket_item_price']?> Ft</td>
|
<td class='money'><?php echo $t['ticket_item_price']?> Ft</td>
|
||||||
<td class='count'><?php echo $t['ticket_count']?> Db</td>
|
<td class='count'><?php echo $t['ticket_count']?> Db</td>
|
||||||
|
|||||||
115
frontend/views/transfer/sale.php
Normal file
115
frontend/views/transfer/sale.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use yii\widgets\ListView;
|
||||||
|
use yii\base\Widget;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel common\models\TransferSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t ( 'frontend/transfer', 'Product sale detailed' );
|
||||||
|
$this->params ['breadcrumbs'] [] = $this->title;
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
.dl-transfer {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-transfer {
|
||||||
|
border: 1px solid #b4b4b4;
|
||||||
|
margin-top: 12px;
|
||||||
|
padding-top: 6px;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.count, td.money {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.name {
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-category-product td.name {
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-category-product td.count {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-category-product td.money {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="transfer-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search_sale', ['model' => $searchModel]); ?>
|
||||||
|
<?php echo $this->render('_export_btn_sale', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<?php
|
||||||
|
// ////////////////////////
|
||||||
|
// Termék eladás
|
||||||
|
// //////////////////////
|
||||||
|
?>
|
||||||
|
<h3>Termék eladások</h3>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo $searchModel->productMoney; ?> Ft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Tranzakció</th>
|
||||||
|
<th>Kiadva</th>
|
||||||
|
<th>Fizetve</th>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<th>Vásárló</th>
|
||||||
|
<th>Kategória</th>
|
||||||
|
<th>Termék</th>
|
||||||
|
<th>Egység ár</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($searchModel->products as $p ){?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo "#".$p['id_transfer']?> </td>
|
||||||
|
<td><?php echo ( $p['product_created_at'])?> </td>
|
||||||
|
<td><?php echo $p['product_paid_at']?> </td>
|
||||||
|
<td><?php echo $p['account_name']?> </td>
|
||||||
|
<td><?php echo $p['user_name']?> </td>
|
||||||
|
<td><?php echo $p['customer_name']?> </td>
|
||||||
|
<td><?php echo $p['product_category_name'] ?></td>
|
||||||
|
<td><?php echo $p['product_name'] ?></td>
|
||||||
|
<td class='money'><?php echo $p['product_item_price']?> Ft</td>
|
||||||
|
<td class='count'><?php echo $p['product_count']?> Db</td>
|
||||||
|
<td class='money'><?php echo $p['product_money']?> FT</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (count ( $searchModel->products ) == 0) {
|
||||||
|
?>
|
||||||
|
Nincs találat
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
77
frontend/views/transfer/search_tickets.php
Normal file
77
frontend/views/transfer/search_tickets.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use kartik\widgets\DatePicker;
|
||||||
|
use frontend\components\HtmlHelper;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\TransferSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$accountOptions = ['' =>'Mind']+ HtmlHelper::mkAccountOptions( $model->accounts );
|
||||||
|
$userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->users,'id','username');
|
||||||
|
$productOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->productOptions,'id_product','name');
|
||||||
|
$productCategoryOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->productCategories,'id_product_category','name');
|
||||||
|
$transferStatusOptions = ['' => 'Mind'] + Transfer::statuses();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="transfer-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['sale'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'category')->dropDownList($productCategoryOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_product')->dropDownList($productOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'status')->dropDownList($transferStatusOptions) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
111
frontend/views/transfer/tickets.php
Normal file
111
frontend/views/transfer/tickets.php
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use yii\widgets\ListView;
|
||||||
|
use yii\base\Widget;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel common\models\TransferSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t ( 'frontend/transfer', 'Ticket sale detailed' );
|
||||||
|
$this->params ['breadcrumbs'] [] = $this->title;
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
.dl-transfer {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-transfer {
|
||||||
|
border: 1px solid #b4b4b4;
|
||||||
|
margin-top: 12px;
|
||||||
|
padding-top: 6px;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.count, td.money {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.name {
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-category-product td.name {
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-category-product td.count {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-category-product td.money {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="transfer-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search_ticket', ['model' => $searchModel]); ?>
|
||||||
|
<?php echo $this->render('_export_btn_ticket', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<?php
|
||||||
|
// ////////////////////////
|
||||||
|
// Termék eladás
|
||||||
|
// //////////////////////
|
||||||
|
?>
|
||||||
|
<h3>Bérlet eladások</h3>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo $searchModel->ticketMoney; ?> Ft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Kiadva</th>
|
||||||
|
<th>Fizetve</th>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<th>Vendég</th>
|
||||||
|
<th>Bérlet típus</th>
|
||||||
|
<th>Egység ár</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($searchModel->tickets as $t ){?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $t['ticket_created_at']?> </td>
|
||||||
|
<td><?php echo $t['ticket_paid_at']?> </td>
|
||||||
|
<td><?php echo $t['account_name']?> </td>
|
||||||
|
<td><?php echo $t['user_name']?> </td>
|
||||||
|
<td><?php echo $t['customer_name']?> </td>
|
||||||
|
<td><?php echo $t['ticket_type_name'] ?></td>
|
||||||
|
<td class='money'><?php echo $t['ticket_item_price']?> Ft</td>
|
||||||
|
<td class='count'><?php echo $t['ticket_count']?> Db</td>
|
||||||
|
<td class='money'><?php echo $t['ticket_money']?> FT</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (count ( $searchModel->tickets ) == 0) {
|
||||||
|
?>
|
||||||
|
Nincs találat
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -30,6 +30,8 @@ function ProductSell(o){
|
|||||||
customer_cart: [],
|
customer_cart: [],
|
||||||
id_account: null,
|
id_account: null,
|
||||||
products : [],
|
products : [],
|
||||||
|
url_delete_transaction : '',
|
||||||
|
url_pay_transaction : '',
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -55,6 +57,13 @@ function ProductSell(o){
|
|||||||
// addDocumentKeypressedListener();
|
// addDocumentKeypressedListener();
|
||||||
|
|
||||||
initAutocomplete();
|
initAutocomplete();
|
||||||
|
disalbeMousewheelSpinOnNumberInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
function disalbeMousewheelSpinOnNumberInput(){
|
||||||
|
$(':input[type=number]').on('mousewheel', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,7 +208,7 @@ function ProductSell(o){
|
|||||||
if ( event.which == 13 ) {
|
if ( event.which == 13 ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
$('#productsaleform-id_currency').focus();
|
submitSellAndAppend();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -477,12 +486,16 @@ function ProductSell(o){
|
|||||||
|
|
||||||
function createUserCartTable(){
|
function createUserCartTable(){
|
||||||
$(app.defaults.selector_user_cart).transferList({
|
$(app.defaults.selector_user_cart).transferList({
|
||||||
'transfers' : app.defaults.user_cart
|
'transfers' : app.defaults.user_cart,
|
||||||
|
'url_delete' : app.defaults.url_delete_transaction,
|
||||||
|
'url_pay' : app.defaults.url_pay_transaction,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function createCustomerCartTable(){
|
function createCustomerCartTable(){
|
||||||
$(app.defaults.selector_customer_cart).transferList({
|
$(app.defaults.selector_customer_cart).transferList({
|
||||||
'transfers' : app.defaults.customer_cart
|
'transfers' : app.defaults.customer_cart,
|
||||||
|
'url_delete' : app.defaults.url_delete_transaction,
|
||||||
|
'url_pay' : app.defaults.url_pay_transaction,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,8 @@ function TicketSell(o){
|
|||||||
/**mark list paid url*/
|
/**mark list paid url*/
|
||||||
url_pay_customer_card: '-',
|
url_pay_customer_card: '-',
|
||||||
url_pay_user_cart: '',
|
url_pay_user_cart: '',
|
||||||
|
url_delete_transaction: '',
|
||||||
|
url_pay_transaction: '',
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -91,18 +93,23 @@ function TicketSell(o){
|
|||||||
|
|
||||||
function createUserCartTable(){
|
function createUserCartTable(){
|
||||||
$(app.defaults.selector_user_cart).transferList({
|
$(app.defaults.selector_user_cart).transferList({
|
||||||
'transfers' : app.defaults.user_cart
|
'transfers' : app.defaults.user_cart,
|
||||||
|
'url_delete' : app.defaults.url_delete_transaction,
|
||||||
|
'url_pay' : app.defaults.url_pay_transaction,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function createCustomerCartTable(){
|
function createCustomerCartTable(){
|
||||||
$(app.defaults.selector_customer_cart).transferList({
|
$(app.defaults.selector_customer_cart).transferList({
|
||||||
'transfers' : app.defaults.customer_cart
|
'transfers' : app.defaults.customer_cart,
|
||||||
|
'url_delete' : app.defaults.url_delete_transaction,
|
||||||
|
'url_pay' : app.defaults.url_pay_transaction,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSellButtons(){
|
function addSellButtons(){
|
||||||
addBehaviourBtnSellAndAppendToUserCart();
|
addBehaviourBtnSellAndAppendToUserCart();
|
||||||
addBehaviourBtnAddToCustomerCart();
|
addBehaviourBtnAddToCustomerCart();
|
||||||
|
addBehaviourBtnSell();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addBehaviourBtnSellAndAppendToUserCart(){
|
function addBehaviourBtnSellAndAppendToUserCart(){
|
||||||
@ -113,6 +120,10 @@ function TicketSell(o){
|
|||||||
$('#btn_add_to_customer_cart').on('click',submitAddTicketToCustomerCart);
|
$('#btn_add_to_customer_cart').on('click',submitAddTicketToCustomerCart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function submitSell(){
|
||||||
|
$('#ticketcreate-cart').val('');
|
||||||
|
$('#ticket_form').submit();
|
||||||
|
}
|
||||||
function submitAddTicketToUserCart(){
|
function submitAddTicketToUserCart(){
|
||||||
$('#ticketcreate-cart').val('user');
|
$('#ticketcreate-cart').val('user');
|
||||||
$('#ticket_form').submit();
|
$('#ticket_form').submit();
|
||||||
@ -123,6 +134,9 @@ function TicketSell(o){
|
|||||||
$('#ticket_form').submit();
|
$('#ticket_form').submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addBehaviourBtnSell(){
|
||||||
|
$('#btn_sell').on('click',submitSell);
|
||||||
|
}
|
||||||
|
|
||||||
function addBehaviourPayoutUserCart( ){
|
function addBehaviourPayoutUserCart( ){
|
||||||
// $( app.defaults.selector_btn_pay_user_cart ).on('click',function(){
|
// $( app.defaults.selector_btn_pay_user_cart ).on('click',function(){
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
$.widget( "fitness.transferList", {
|
$.widget( "fitness.transferList", {
|
||||||
options: {
|
options: {
|
||||||
transfers: [],
|
transfers: [],
|
||||||
|
url_delete : '',
|
||||||
|
url_pay : '',
|
||||||
columns: [
|
columns: [
|
||||||
|
|
||||||
{ 'label' : 'Idő' },
|
{ 'label' : 'Idő' },
|
||||||
@ -8,6 +10,7 @@ $.widget( "fitness.transferList", {
|
|||||||
{ 'label' : 'Ár' },
|
{ 'label' : 'Ár' },
|
||||||
{ 'label' : 'Db' },
|
{ 'label' : 'Db' },
|
||||||
{ 'label' : 'Összesen' },
|
{ 'label' : 'Összesen' },
|
||||||
|
{ 'label' : '' },
|
||||||
],
|
],
|
||||||
footers: [
|
footers: [
|
||||||
{
|
{
|
||||||
@ -100,6 +103,14 @@ $.widget( "fitness.transferList", {
|
|||||||
s += '<td class=\'product-money\' >';
|
s += '<td class=\'product-money\' >';
|
||||||
s += transfer.money;
|
s += transfer.money;
|
||||||
s += '</td>';
|
s += '</td>';
|
||||||
|
s += '<td class=\'product-action\' style="width: 110px;" >';
|
||||||
|
s += '<form action="'+this.options.url_pay +"&id="+ transfer.id_transfer +'" method="POST" >';
|
||||||
|
s += "<button type='submit' class='btn btn-success pull-left' style='margin-right: 3px;' title='Tranzakció kifizetve' ><span style='font-size: 10px;' class= 'glyphicon glyphicon-eur\'></span></button>";
|
||||||
|
s += '</form>';
|
||||||
|
s += '<form action="'+this.options.url_delete +"&id="+ transfer.id_transfer +'" method="POST">';
|
||||||
|
s += "<button type='submit' class='btn btn-danger pull-left' title='Tranzakció törlése' ><span style='font-size: 10px;' class= 'glyphicon glyphicon-trash\'></span></button>";
|
||||||
|
s += '</form>';
|
||||||
|
s += '</td>';
|
||||||
s += '</tr>';
|
s += '</tr>';
|
||||||
break;
|
break;
|
||||||
case 'footer':
|
case 'footer':
|
||||||
@ -120,6 +131,9 @@ $.widget( "fitness.transferList", {
|
|||||||
s += "<td class=\'product-money\' >";
|
s += "<td class=\'product-money\' >";
|
||||||
s += footer.total( params.transfers );
|
s += footer.total( params.transfers );
|
||||||
s += "</td>";
|
s += "</td>";
|
||||||
|
s += "<td >";
|
||||||
|
s += "";
|
||||||
|
s += "</td>";
|
||||||
s += "</tr>";
|
s += "</tr>";
|
||||||
}
|
}
|
||||||
s += "</tfoot>";
|
s += "</tfoot>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user