add transfer#list pdf download, fix helper#fixascii function

This commit is contained in:
2016-01-06 16:18:15 +01:00
parent 932f071c13
commit 39ae361505
29 changed files with 1519 additions and 373 deletions

View File

@@ -14,6 +14,7 @@ use backend\models\TransferListSearch;
use backend\models\TransferSaleSearch;
use common\models\ProductCategory;
use common\models\Product;
use backend\models\TransferListUserGroupedSearch;
/**
* TransferController implements the CRUD actions for Transfer model.
@@ -28,7 +29,7 @@ class TransferController extends \backend\controllers\BackendController
'rules' => [
// allow authenticated users
[
'actions' => [ 'index','view','summary','list',"sale","sale-pdf" ],
'actions' => [ 'index','view','summary','list',"sale","sale-pdf" ,'list-user-grouped'],
'allow' => true,
'roles' => ['admin','employee','reception'],
],
@@ -75,7 +76,75 @@ class TransferController extends \backend\controllers\BackendController
$searchModel->search(Yii::$app->request->queryParams);
return $this->render('list', [
if ( $searchModel->output == 'pdf'){
$user = User::findOne(\Yii::$app->user->id);
$mpdf=new \mPDF('utf-8', 'A4-L');
$fn = "";
$ov = '_total_content_pdf';
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$interval="";
$account = "";
$currentUser= "";
if ( isset($searchModel->currentAccount) ){
$account =( "_kassza_".$searchModel->currentAccount->name);
}
if ( isset($searchModel->currentUser) ){
$currentUser = ( "_felhasznalo_".$searchModel->currentUser->username);
}
if ( isset($searchModel->timestampStart) ){
$interval .="_tol_". \Yii::$app->formatter->asDatetime($searchModel->timestampStart,'yyyyMMdd_HHmm');
}
if ( isset($searchModel->timestampEnd) ){
$interval .="_ig_". \Yii::$app->formatter->asDatetime($searchModel->timestampEnd,'yyyyMMdd_HHmm');
}
if ( $searchModel->outputView == 'easy'){
$ov = '_total_easy';
$fn="napi_bevetelek_egyszeru";
}else if ( $searchModel->outputView == 'medium'){
$ov = '_total_medium';
$fn="napi_bevetelek_kozepes";
}else if ( $searchModel->outputView == 'detailed'){
$ov = '_total_detailed';
$fn="napi_bevetelek_reszletes";
}else{
$ov = '_total_content_pdf';
$fn="napi_bevetelek.teljes";
}
$fn = $fn. $interval . $dt .$account .$currentUser. ".pdf";
$mpdf->useSubstitutions=false;
$mpdf->simpleTables = true;
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
$mpdf->setFooter('{PAGENO} / {nb}');
$mpdf->WriteHTML($this->renderPartial($ov, [
'searchModel' => $searchModel,
]));
$mpdf->Output($fn, 'D');
exit;
}else{
return $this->render('list', [
'searchModel' => $searchModel,
]);
}
}
/**
* Lists all Transfer models.
* @return mixed
*/
public function actionListUserGrouped()
{
$searchModel = new TransferListUserGroupedSearch();
$searchModel->accounts = Account::read();
$searchModel->users = User::read();
$searchModel->search(Yii::$app->request->queryParams);
return $this->render('list_user_grouped', [
'searchModel' => $searchModel,
]);
@@ -88,6 +157,7 @@ class TransferController extends \backend\controllers\BackendController
public function actionSale()
{
$searchModel = new TransferSaleSearch();
$searchModel->mode = 'admin';
$searchModel->accounts = Account::read();
$searchModel->users = User::read();
$searchModel->productCategories = ProductCategory::read();
@@ -104,6 +174,7 @@ class TransferController extends \backend\controllers\BackendController
public function actionSalePdf(){
$searchModel = new TransferSaleSearch();
$searchModel->mode = 'admin';
$searchModel->accounts = Account::read();
$searchModel->users = User::read();
$searchModel->productCategories = ProductCategory::read();

View File

@@ -12,17 +12,23 @@ use common\models\Account;
class TransferListSearch extends \common\models\TransferListSearch
{
public function init(){
parent::init();
$this->mode = 'admin';
}
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 ]);
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
// 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 ]);
// $query->andWhere(['account.type' => Account::TYPE_ALL ]);
if ( RoleDefinition::isReception()){
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
}
// if ( RoleDefinition::isReception()){
// $query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
// }
}
// }
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace backend\models;
use Yii;
use common\models\Transfer;
use common\components\RoleDefinition;
use common\models\Account;
use common\components\DailyListing;
/**
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
*/
class TransferListUserGroupedSearch extends \common\models\TransferListSearch
{
public $ticketMoneyByUser;
public function init(){
parent::init();
$this->mode = 'admin';
}
public function search($params)
{
$this->load($params);
if (!$this->validate()) {
}
$listing = new DailyListing();
$listing->mode = $this->mode;
$listing->loadFilters($this);
$this->ticketMoneyByUser = $listing->readTicketMoneyByUser();
}
}

View File

@@ -16,7 +16,7 @@ use yii\helpers\Html;
</a>
<div class="navbar-header">
<a class="navbar-brand" href="#">Web Recepció</a>
<a class="navbar-brand" href="#">Adminisztráció</a>
</div>
<div class="navbar-custom-menu">

View File

@@ -0,0 +1,61 @@
<?php
use common\components\RoleDefinition;
use yii\helpers\Html;
use yii\helpers\Url;
?>
<?php
if ( $searchModel->output == 'pdf'){
?>
<link rel='stylesheet' href='<?php echo \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')?>'>
<style>
.item-transfer {
border: 1px solid #b4b4b4;
margin-top: 12px;
padding-top: 6px;
padding-bottom: 6px;
}
.table td{
padding: 3px;
}
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>
<?php if ( isset($searchModel->outputView ) || $type == 'full' ){?>
<h1><?php echo $label ?></h1>
<?php }?>
<?php
if ( $searchModel->outputView == 'easy'){
echo $this->render('_view_search_list',['searchModel'=>$searchModel]);
}
else if ( $searchModel->outputView == 'medium'){
echo $this->render('_view_search_list',['searchModel'=>$searchModel]);
}
else if ( $searchModel->outputView == 'detailed'){
echo $this->render('_view_search_list',['searchModel'=>$searchModel]);
}else if ( $type == 'full'){
echo $this->render('_view_search_list',['searchModel'=>$searchModel]);
}
}
?>

View File

@@ -0,0 +1,63 @@
<?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');
?>
<div class="transfer-search">
<?php $form = ActiveForm::begin([
'action' => ['list'],
'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="form-group">
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,9 @@
<div role="tabpanel" class="tab-pane active" id="easy">
<?php echo $this->render('_total_easy', ['searchModel' => $searchModel]); ?>
</div>
<div role="tabpanel" class="tab-pane" id="medium">
<?php echo $this->render('_total_medium', ['searchModel' => $searchModel]); ?>
</div>
<div role="tabpanel" class="tab-pane" id="detailed">
<?php echo $this->render('_total_detailed', ['searchModel' => $searchModel]); ?>
</div>

View File

@@ -0,0 +1,8 @@
<?php
echo $this->render('_list_pdf_head',[ 'searchModel' =>$searchModel, 'label' => 'Napi bevételek','type' =>'full']);
?>
<?php echo $this->render('_total_easy', ['searchModel' => $searchModel]); ?>
<pagebreak />
<?php echo $this->render('_total_medium', ['searchModel' => $searchModel]); ?>
<pagebreak />
<?php echo $this->render('_total_detailed', ['searchModel' => $searchModel]); ?>

View File

@@ -0,0 +1,175 @@
<?php
use common\components\RoleDefinition;
use yii\helpers\Html;
use yii\helpers\Url;
?>
<?php
echo $this->render('_list_pdf_head',[ 'searchModel' =>$searchModel, 'label' => 'Napi bevételek - Rézsletes','type' =>'detailed']);
?>
<h2>Részletes összesítés</h2>
<?php
//////////////////////////
// Bérletek
////////////////////////
?>
<h3>Bérletek</h3>
<?php
if ( !isset($searchModel->output) ){
$pdfUrl = Url::current([ Html::getInputName($searchModel, 'output') => 'pdf']);
echo Html::a("Teljes PDF letöltése", $pdfUrl,['class' => 'btn btn-primary btn-all' ]);
$pdfUrl = Url::current([ Html::getInputName($searchModel, 'output') => 'pdf', Html::getInputName($searchModel, 'outputView') => 'detailed']);
echo Html::a("Egyszerű összesítő Pdf", $pdfUrl,['class' => 'btn btn-primary' ]);
}
?>
<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>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['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
}else{?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->ticketMoney; ?> Ft
</div>
</div>
<pagebreak />
<?php
}
?>
<?php
//////////////////////////
// Termék eladás
////////////////////////
?>
<h3>Termék eladások</h3>
<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>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['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
}else{?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->productMoney; ?> Ft
</div>
</div>
<pagebreak />
<?php
}
?>
<?php
//////////////////////////
// Pénzmozgások
////////////////////////
?>
<h3>Pénzmozgások</h3>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>Dátum</th>
<th>Kassza</th>
<th>Felhasználó</th>
<th>Név</th>
<th>Típus</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php foreach ($searchModel->moneyMovements as $p ){?>
<tr>
<td><?php echo $p['money_movement_created_at']?> </td>
<td><?php echo $p['account_name']?> </td>
<td><?php echo $p['user_name']?> </td>
<td><?php echo $p['money_movement_name'] ?></td>
<td><?php echo $p['money_movement_type_name'] ?></td>
<td class='money'><?php echo $p['signed_money']?> Ft</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php if ( count($searchModel->moneyMovements ) == 0 ) {
?>
Nincs találat
<?php
}else{?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->moneyMovementMoneis; ?> Ft
</div>
</div>
<?php
}
?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline; font-weight: bold;">
Végösszeg: <?php echo $searchModel->total; ?> Ft
</div>
</div>

View File

@@ -0,0 +1,69 @@
<?php
use common\components\RoleDefinition;
use yii\helpers\Html;
use yii\helpers\Url;
?>
<?php
echo $this->render('_list_pdf_head',[ 'searchModel' =>$searchModel, 'label' => 'Napi bevételek - Egyszerű','type' =>'easy']);
?>
<h2>Egyszerű összesítés</h2>
<?php
if ( !isset($searchModel->output) ){
$pdfUrl = Url::current([ Html::getInputName($searchModel, 'output') => 'pdf']);
echo Html::a("Teljes PDF letöltése", $pdfUrl,['class' => 'btn btn-primary btn-all' ]);
$pdfUrl = Url::current([ Html::getInputName($searchModel, 'output') => 'pdf', Html::getInputName($searchModel, 'outputView') => 'easy']);
echo Html::a("Egyszerű összesítő Pdf", $pdfUrl,['class' => 'btn btn-primary' ]);
}
?>
<h3>Bruttó</h3>
<table class="table table-bordered table-striped table-summary">
<tbody>
<tr>
<th>Bérletek</th>
<td class="money"><?php echo $searchModel->ticketMoney?> FT</td>
</tr>
<tr>
<th>Termékek</th>
<td class="money"><?php echo $searchModel->productMoney?> FT</td>
</tr>
<tr>
<th>Pénzmozgások</th>
<td class="money"><?php echo $searchModel->moneyMovementMoneis?> FT</td>
</tr>
<tr>
<th>Végösszeg bruttó</th>
<td class="money"><span style='border-bottom: 1px solid black'><?php echo $searchModel->total?> FT</span></td>
</tr>
</tbody>
</table>
<?php if( RoleDefinition::isAdmin() ) {?>
<h3>Nettó</h3>
<table class="table table-bordered table-striped table-summary">
<tbody>
<tr>
<th>Bérletek</th>
<td class="money"><?php echo $searchModel->ticketMoney?> FT</td>
</tr>
<tr>
<th>Termékek</th>
<td class="money"><?php echo $searchModel->productMoneyNetto?> FT</td>
</tr>
<tr>
<th>Pénzmozgások</th>
<td class="money"><?php echo $searchModel->moneyMovementMoneis?> FT</td>
</tr>
<tr>
<th>Végösszeg nettó</th>
<td class="money"><span style='border-bottom: 1px solid black'><?php echo $searchModel->totalNetto?> FT</span></td>
</tr>
</tbody>
</table>
<?php }?>

View File

@@ -0,0 +1,158 @@
<?php
use yii\helpers\Html;
use yii\helpers\Url;
?>
<?php
echo $this->render('_list_pdf_head',[ 'searchModel' =>$searchModel, 'label' => 'Napi bevételek - Közepes', 'type' =>'medium']);
?>
<h2>Közepes összesítés</h2>
<?php
if ( !isset($searchModel->output) ){
$pdfUrl = Url::current([ Html::getInputName($searchModel, 'output') => 'pdf']);
echo Html::a("Teljes PDF letöltése", $pdfUrl,['class' => 'btn btn-primary btn-all' ]);
$pdfUrl = Url::current([ Html::getInputName($searchModel, 'output') => 'pdf', Html::getInputName($searchModel, 'outputView') => 'medium']);
echo Html::a("Közepes összesítő Pdf", $pdfUrl,['class' => 'btn btn-primary' ]);
}
?>
<h3>Bérletek típus szerint</h3>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>Bérlet típus</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $searchModel->ticketStats as $ticketStat ) {
?>
<tr>
<td class="name"><?php echo $ticketStat['ticket_type_name'] ?></td>
<td class="count"><?php echo $ticketStat['ticket_count']?> Db</td>
<td class="money"><?php echo $ticketStat['ticket_money']?> FT</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->ticketMoney; ?> Ft
</div>
</div>
<h3>Termékek kategória szerint</h3>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>Termék kategória</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $searchModel->productMoneies as $pm ) {
?>
<tr>
<td class="name"><?php echo $pm['category_name'] ?></td>
<td class="count"><?php echo $pm['category_count']?> Db</td>
<td class="money"><?php echo $pm['product_money']?> FT</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->productMoney; ?> Ft
</div>
</div>
<h3>Termékek kategória szerint részletes</h3>
<?php
foreach($searchModel->productsByCategory['categories'] as $categoryHolder ){
$products = $categoryHolder['products'];
?>
<h4><?php echo $categoryHolder['category']['name']?></h4>
<table class="table table-bordered table-striped table-summary table-category-product">
<thead>
<tr>
<th>Termék</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php foreach ( $products as $p){?>
<tr>
<td class='name'><?php echo $p['product_name'] ?></td>
<td class='count'><?php echo $p['product_count'] ?> Db</td>
<td class='money'><?php echo $p['product_money']?> FT</td>
</tr>
<?php }?>
<tr class="warning">
<td><?php echo "Összesen" ?></td>
<td><?php ?></td>
<td class='money'><?php echo $categoryHolder['total']?> FT</td>
</tr>
</tbody>
</table>
<?php
}
?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen:
<?php
echo $searchModel->productsByCategory['total'];
?>
</div>
</div>
<h3>Pénzmozgások típus szerint</h3>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>Pénzmozgás típus</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $searchModel->moneyMovementsByType as $mmStat ) {
?>
<tr>
<td class="name"><?php echo $mmStat['name'] ?></td>
<td class="count"><?php echo $mmStat['money_movement_count']?> Db</td>
<td class="money"><?php echo $mmStat['money_movement_money']?> FT</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->moneyMovementMoneis; ?> Ft
</div>
</div>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline; font-weight: bold;">
Végösszeg: <?php echo $searchModel->total; ?> Ft
</div>
</div>

View File

@@ -0,0 +1,21 @@
<table class="table table-bordered table-striped table-summary">
<tbody>
<tr>
<th>Bérletek</th>
<td class="money"><?php echo $ticketMoney?> FT
</td>
</tr>
<tr>
<th>Termékek</th>
<td class="money"><?php echo $productMoney?> FT</td>
</tr>
<tr>
<th>Pénzmozgások</th>
<td class="money"><?php echo $moneyMovementMoneis?> FT</td>
</tr>
<tr>
<th>Végösszeg bruttó</th>
<td class="money"><span style='border-bottom: 1px solid black'><?php echo $total?> FT</span></td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,45 @@
<table class="table table-bordered">
<tbody>
<tr>
<th>
Időszak kezdete
</th>
<td>
<?php echo $searchModel->start?>
</td>
<th>
Időszak vége
</th>
<td>
<?php echo $searchModel->end?>
</td>
</tr>
<tr>
<th>
Kassza
</th>
<td>
<?php
if ( isset($searchModel->currentAccount)){
echo $searchModel->currentAccount->name;
}else{
echo "Mind";
}
?>
</td>
<th>
Felhasználó
</th>
<td>
<?php
if ( isset($searchModel->currentUser)){
echo $searchModel->currentUser->username;
}else{
echo "Mind";
}
?>
</td>
</tr>
</tbody>
</table>

View File

@@ -3,9 +3,11 @@ use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;
use common\components\RoleDefinition;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel common\models\TransferSearch */
/* @var $searchModel common\models\TransferListSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t ( 'frontend/transfer', 'Daily transfers' );
@@ -42,6 +44,10 @@ td.name{
.table-category-product td.money{
text-align: right;
}
.btn-all{
margin-right: 6px;
}
</style>
<div class="transfer-index">
@@ -49,347 +55,43 @@ td.name{
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search_list', ['model' => $searchModel]); ?>
<?php
if ( isset($searchModel->currentUser) ){
?>
<table class='table table-striped'>
<tr>
<th>
Felhasználó:
</th>
<td>
<?php echo $searchModel->currentUser->username?>
</td>
</tr>
</table>
<?php
}
?>
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#big"
aria-controls="big" role="tab" data-toggle="tab">Egyszerű összesítő</a></li>
<li role="presentation" class="active"><a href="#easy"
aria-controls="easy" role="tab" data-toggle="tab">Egyszerű összesítő</a></li>
<li role="presentation"><a href="#medium" aria-controls="medium"
role="tab" data-toggle="tab">Közepes összesítő</a></li>
<li role="presentation"><a href="#detailed" aria-controls="detailed"
role="tab" data-toggle="tab">Részletes összesítő</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="big">
<h2>Egyszerű összesítés</h2>
<table class="table table-bordered table-striped table-summary">
<tbody>
<tr>
<th>Bérletek</th>
<td class="money"><?php echo $searchModel->ticketMoney?> FT</td>
</tr>
<tr>
<th>Termékek</th>
<td class="money"><?php echo $searchModel->productMoney?> FT</td>
</tr>
<tr>
<th>Pénzmozgások</th>
<td class="money"><?php echo $searchModel->moneyMovementMoneis?> FT</td>
</tr>
<tr>
<th>Végösszeg</th>
<td class="money"><span style='border-bottom: 1px solid black'><?php echo $searchModel->total?> FT</span></td>
</tr>
</tbody>
</table>
</div>
<div role="tabpanel" class="tab-pane" id="medium">
<h2>Közepes összesítés</h2>
<h3>Bérletek típus szerint</h3>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>Bérlet típus</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $searchModel->ticketStats as $ticketStat ) {
?>
<tr>
<td class="name"><?php echo $ticketStat['ticket_type_name'] ?></td>
<td class="count"><?php echo $ticketStat['ticket_count']?> Db</td>
<td class="money"><?php echo $ticketStat['ticket_money']?> FT</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->ticketMoney; ?> Ft
</div>
</div>
<h3>Termékek kategória szerint</h3>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>Termék kategória</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $searchModel->productMoneies as $pm ) {
?>
<tr>
<td class="name"><?php echo $pm['category_name'] ?></td>
<td class="count"><?php echo $pm['category_count']?> Db</td>
<td class="money"><?php echo $pm['product_money']?> FT</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->productMoney; ?> Ft
</div>
</div>
<h3>Termékek kategória szerint részletes</h3>
<?php
foreach($searchModel->productsByCategory['categories'] as $categoryHolder ){
$products = $categoryHolder['products'];
?>
<h4><?php echo $categoryHolder['category']['name']?></h4>
<table class="table table-bordered table-striped table-summary table-category-product">
<thead>
<tr>
<th>Termék</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php foreach ( $products as $p){?>
<tr>
<td class='name'><?php echo $p['product_name'] ?></td>
<td class='count'><?php echo $p['product_count'] ?> Db</td>
<td class='money'><?php echo $p['product_money']?> FT</td>
</tr>
<?php }?>
<tr class="warning">
<td><?php echo "Összesen" ?></td>
<td><?php ?></td>
<td class='money'><?php echo $categoryHolder['total']?> FT</td>
</tr>
</tbody>
</table>
<?php
}
?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen:
<?php
echo $searchModel->productsByCategory['total'];
?>
</div>
</div>
<h3>Pénzmozgások típus szerint</h3>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>Pénzmozgás típus</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $searchModel->moneyMovementsByType as $mmStat ) {
?>
<tr>
<td class="name"><?php echo $mmStat['name'] ?></td>
<td class="count"><?php echo $mmStat['money_movement_count']?> Db</td>
<td class="money"><?php echo $mmStat['money_movement_money']?> FT</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->moneyMovementMoneis; ?> Ft
</div>
</div>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline; font-weight: bold;">
Végösszeg: <?php echo $searchModel->total; ?> Ft
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="detailed">
<h2>Részletes összesítés</h2>
<?php
//////////////////////////
// Bérletek
////////////////////////
?>
<h3>Bérletek</h3>
<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>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['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
}else{?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->ticketMoney; ?> Ft
</div>
</div>
<?php
}
?>
<?php
//////////////////////////
// Termék eladás
////////////////////////
?>
<h3>Termék eladások</h3>
<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>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['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
}else{?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->productMoney; ?> Ft
</div>
</div>
<?php
}
?>
<?php
//////////////////////////
// Pénzmozgások
////////////////////////
?>
<h3>Pénzmozgások</h3>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>Dátum</th>
<th>Kassza</th>
<th>Felhasználó</th>
<th>Név</th>
<th>Típus</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php foreach ($searchModel->moneyMovements as $p ){?>
<tr>
<td><?php echo $p['money_movement_created_at']?> </td>
<td><?php echo $p['account_name']?> </td>
<td><?php echo $p['user_name']?> </td>
<td><?php echo $p['money_movement_name'] ?></td>
<td><?php echo $p['money_movement_type_name'] ?></td>
<td class='money'><?php echo $p['signed_money']?> Ft</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php if ( count($searchModel->moneyMovements ) == 0 ) {
?>
Nincs találat
<?php
}else{?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->moneyMovementMoneis; ?> Ft
</div>
</div>
<?php
}
?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline; font-weight: bold;">
Végösszeg: <?php echo $searchModel->total; ?> Ft
</div>
</div>
</div>
<?php echo $this->render('_total_content', ['searchModel' => $searchModel]); ?>
</div>
</div>

View File

@@ -0,0 +1,66 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;
use common\components\RoleDefinition;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TransferListUserGroupedSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t ( 'frontend/transfer', 'Daily transfers' );
$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_list_user_grouped', ['model' => $searchModel]); ?>
<?php
foreach ($searchModel->ticketMoneyByUser as $user){
echo "<h3>".$user['username']."</h3>";
}
?>
</div>