add frontend collection
This commit is contained in:
parent
ed9c1e77cd
commit
48a00e4bdc
26
common/components/AccountTotalWidget.php
Normal file
26
common/components/AccountTotalWidget.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace common\components;
|
||||
|
||||
use yii\base\Widget;
|
||||
|
||||
class AccountTotalWidget extends Widget{
|
||||
|
||||
public $totalHeading = 'Össesen';
|
||||
public $panelHeading = 'Össesen';
|
||||
public $panelType = 'panel-info';
|
||||
|
||||
public $statistic = ['total' => 0, 'accounts' => [] ];
|
||||
|
||||
|
||||
public $viewFile = '@common/views/common/_account_total';
|
||||
|
||||
public function init(){
|
||||
parent::init();
|
||||
|
||||
}
|
||||
|
||||
public function run(){
|
||||
echo $this->render($this->viewFile,[ 'model' => $this ]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@ namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
/**
|
||||
* This is the model class for table "account".
|
||||
@ -174,4 +175,8 @@ class Account extends \yii\db\ActiveRecord
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
public static function toAccaountMap($accounts){
|
||||
return ArrayHelper::map( $accounts,'id_account','name' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ use common\components\AccountAwareBehavior;
|
||||
use common\components\UserAwareBehavior;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\db\Query;
|
||||
use yii\db\Expression;
|
||||
|
||||
/**
|
||||
* This is the model class for table "collection".
|
||||
@ -104,4 +106,98 @@ class Collection extends \common\models\BaseFitnessActiveRecord
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* */
|
||||
public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$types,$idAccount){
|
||||
|
||||
$query = new Query();
|
||||
|
||||
$query->addSelect( [
|
||||
new Expression( ' collection.id_account as account'),
|
||||
new Expression( ' COALESCE(sum( collection.money ) ,0) as money /** collections total money */' )
|
||||
|
||||
]);
|
||||
$query->from('collection');
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id_account' => $idAccount,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['id_user' => $idUser]);
|
||||
$query->andFilterWhere(['in' ,'type', $types]);
|
||||
self::inInterval($query, 'collection.end' , $start, $end);
|
||||
|
||||
$query->groupBy('collection.id_account');
|
||||
|
||||
return $query;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static function mkTotalsResultWithAllAvailableAccount($queryResult,$accounts,$accountMap,$idAccount){
|
||||
|
||||
$totals = [];
|
||||
$totals['total'] = 0;
|
||||
|
||||
$totals['accounts'] = [];
|
||||
|
||||
foreach ($accounts as $account){
|
||||
if ( isset($idAccount) && is_numeric($idAccount) && $idAccount != $account->id_account ){
|
||||
continue ;
|
||||
}
|
||||
|
||||
$accountTotal = [
|
||||
'id_account' => $account->id_account,
|
||||
'label' => $account->name,
|
||||
'money' => 0,
|
||||
];
|
||||
|
||||
$item = self::findByAccountInQueryResult($queryResult, $account);
|
||||
|
||||
if ( isset($item)){
|
||||
$accountTotal['money'] = $item['money'];
|
||||
}
|
||||
|
||||
$totals['accounts'][] = $accountTotal;
|
||||
$totals['total'] += $accountTotal['money'];
|
||||
}
|
||||
return $totals;
|
||||
}
|
||||
|
||||
public static function findByAccountInQueryResult( $queryResult, $account ){
|
||||
$result = null;
|
||||
foreach ($queryResult as $item){
|
||||
if( $item['account'] == $account->id_account ){
|
||||
$result = $item;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function inInterval($query ,$field , $start,$end ){
|
||||
$query->andFilterWhere([ '>=', $field , $start ] );
|
||||
$query->andFilterWhere([ '<' , $field , $end ] );
|
||||
}
|
||||
|
||||
|
||||
/**create and execute a "total" query*/
|
||||
public static function exTotalQuery($mode,$start,$end,$idUser,$types,$idAccount){
|
||||
$query = self::mkTotalQuery($mode, $start, $end, $idUser, $types, $idAccount );
|
||||
$command = $query->createCommand();
|
||||
$result = $command->queryAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*find all transfers which were paid in the period
|
||||
* */
|
||||
public static function mkReceptionTotal( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap){
|
||||
$result = [];
|
||||
$queryResult = self::exTotalQuery('reception', $start, $end, $idUser, $types, $idAccount );
|
||||
$result = self::mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $accountMap, $idAccount);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ class CollectionCreate extends \common\models\Collection
|
||||
public $accountMap;
|
||||
public $account;
|
||||
public $totals;
|
||||
public $userCartTotal;
|
||||
|
||||
public $timestampEnd;
|
||||
public $timestampStart;
|
||||
@ -38,7 +39,10 @@ class CollectionCreate extends \common\models\Collection
|
||||
public function rules(){
|
||||
return [
|
||||
['end','required'],
|
||||
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||
/**enable seconds*/
|
||||
[[ 'end' , ], 'date' ,'format' => 'yyyy-MM-dd HH:mm:ss' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm:ss' ,'timeZone' => 'UTC' ],
|
||||
/*enable only minutes*/
|
||||
// [[ 'end' , ], 'date' ,'format' => 'yyyy-MM-dd HH:mm' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||
[[ 'end' ], 'validateEndDate' ]
|
||||
];
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\Query;
|
||||
use yii\db\Expression;
|
||||
|
||||
/**
|
||||
* This is the model class for table "user_sold_item".
|
||||
@ -60,6 +62,29 @@ class UserSoldItem extends \yii\db\ActiveRecord
|
||||
|
||||
}
|
||||
|
||||
public static function readTotalForAccount($idUser,$idAccount){
|
||||
|
||||
$query = new Query();
|
||||
|
||||
$query->addSelect( [
|
||||
new Expression( ' COALESCE(sum( transfer.money ) ,0) as money /** total unpaid reception cart */' )
|
||||
|
||||
]);
|
||||
$query->innerJoin('transfer',['user_sold_item.id_transfer' =>'transfer.id_transfer']);
|
||||
|
||||
$query->from('user_sold_item');
|
||||
|
||||
$query->andFilterWhere([
|
||||
'transfer.id_account' => $idAccount,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['user_sold_item.id_user' => $idUser]);
|
||||
|
||||
|
||||
return $query->scalar();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param common\models\User $user
|
||||
|
||||
17
common/views/common/_account_total.php
Normal file
17
common/views/common/_account_total.php
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="panel <?=$model->panelType ?>">
|
||||
<div class="panel-heading"><?php echo $model->panelHeading?></div>
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal dl-totals">
|
||||
<?php
|
||||
foreach ($model->statistic['accounts'] as $acc ){
|
||||
?>
|
||||
<dt><?php echo $acc['label'] ?></dt>
|
||||
<dd class="text-right"><?php echo $acc['money'] ?></dd>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<dt><?php echo $model->totalHeading ?></dt>
|
||||
<dd class="text-right"><?php echo $model->statistic['total'] ?></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
23
frontend/components/AccountStatisticWidget.php
Normal file
23
frontend/components/AccountStatisticWidget.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace frontend\components;
|
||||
|
||||
use yii\base\Widget;
|
||||
|
||||
class AccountStatisticWidget extends Widget{
|
||||
|
||||
public $totals;
|
||||
|
||||
|
||||
public $viewFile = '//common/_account_statistic';
|
||||
|
||||
public function init(){
|
||||
parent::init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function run(){
|
||||
echo $this->render($this->viewFile,[ 'model' => $this ]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -36,9 +36,6 @@ class FrontendMenuStructure{
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($this->start);
|
||||
// print_r($this->tomorrow);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -59,9 +56,7 @@ class FrontendMenuStructure{
|
||||
|
||||
protected function addRecepcio(){
|
||||
if ( $this->isLogged() ){
|
||||
$this->menuItems[] = ['label' => 'Recepcio', 'url' => ['/customer/reception'] ];
|
||||
// , 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow
|
||||
// $this->menuItems[] = ['label' => 'Pénzmozgások', 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ];
|
||||
$this->menuItems[] = ['label' => 'Recepció', 'url' => ['/customer/reception'] ];
|
||||
$this->menuItems[] = ['label' => 'Kassza',
|
||||
'items' => [
|
||||
['label' => Yii::t('frontend/account-state','Default account'), 'url' => ['/account/select'] ],
|
||||
@ -72,7 +67,6 @@ class FrontendMenuStructure{
|
||||
['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ],
|
||||
['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ]
|
||||
]
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ use common\models\CollectionCreate;
|
||||
use common\models\Transfer;
|
||||
use frontend\models\CreateAccountSelectForm;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use common\models\UserSoldItem;
|
||||
|
||||
/**
|
||||
* CollectionController implements the CRUD actions for Collection model.
|
||||
@ -41,8 +42,10 @@ class CollectionController extends Controller
|
||||
$searchModel = new CollectionSearch();
|
||||
|
||||
$searchModel->accounts = Account::read();
|
||||
$searchModel->accountMap = Account::toAccaountMap($searchModel->accounts);
|
||||
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
$searchModel->searchTotal();
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
@ -57,8 +60,16 @@ class CollectionController extends Controller
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
$accounts = Account::read();
|
||||
$accountMap = Account::toAccaountMap($accounts);
|
||||
|
||||
$totals = Transfer::mkTotals($model->start, $model->end, $model->id_user, null, $model->id_account, $accounts, $accountMap);
|
||||
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
'model' => $model,
|
||||
'totals' => $totals,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -83,12 +94,14 @@ class CollectionController extends Controller
|
||||
$model->timestampStart = isset($model->lastCollection) ? $model->lastCollection->end :null;
|
||||
$model->timestampEnd = date("Y-m-d H:i:s");
|
||||
|
||||
$model->start = isset($model->timestampStart) ? Yii::$app->formatter->asDatetime( $model->timestampStart ) : '';
|
||||
$model->end = isset($model->timestampEnd) ? Yii::$app->formatter->asDatetime( $model->timestampEnd ): '';
|
||||
$model->start = isset($model->timestampStart) ? Yii::$app->formatter->asDatetime( $model->timestampStart ,'yyyy-MM-dd HH:mm:ss') : '';
|
||||
$model->end = isset($model->timestampEnd) ? Yii::$app->formatter->asDatetime( $model->timestampEnd ,'yyyy-MM-dd HH:mm:ss'): '';
|
||||
|
||||
$model->type = Collection::TYPE_RECEPTION;
|
||||
|
||||
|
||||
$model->userCartTotal = UserSoldItem::readTotalForAccount($model->id_user, $model->id_account);
|
||||
|
||||
if ( $model->load(Yii::$app->request->post()) && $model->save() ) {
|
||||
return $this->redirect(['view', 'id' => $model->id_collection]);
|
||||
} else {
|
||||
@ -119,37 +132,7 @@ class CollectionController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing Collection model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_collection]);
|
||||
} else {
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing Collection model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Collection model based on its primary key value.
|
||||
|
||||
@ -13,10 +13,13 @@ use common\models\Collection;
|
||||
class CollectionSearch extends Collection
|
||||
{
|
||||
public $accounts;
|
||||
public $accountMap;
|
||||
|
||||
public $timestampStart;
|
||||
public $timestampEnd;
|
||||
|
||||
public $totals;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@ -69,4 +72,8 @@ class CollectionSearch extends Collection
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
public function searchTotal(){
|
||||
$this->totals = Collection::mkReceptionTotal($this->timestampStart, $this->timestampEnd , Yii::$app->user->id, [Collection::TYPE_RECEPTION], $this->id_account, $this->accounts, $this->accountMap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,13 +24,15 @@ class TransferSearch extends Transfer
|
||||
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 $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;
|
||||
@ -41,19 +43,12 @@ class TransferSearch extends Transfer
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
// [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
|
||||
[[ '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' ] , 'integer'],
|
||||
['types', 'each', 'rule' => ['integer']],
|
||||
// [ [ 'types' ], function ($attribute, $params) {
|
||||
// if (!is_array($this->$attribute)) {
|
||||
// $this->addError($attribute, 'Invalid array');
|
||||
// }
|
||||
// }],
|
||||
];
|
||||
}
|
||||
|
||||
@ -103,9 +98,9 @@ class TransferSearch extends Transfer
|
||||
'money' => 0
|
||||
];
|
||||
|
||||
if ( $this->hasErrors() ){
|
||||
return;
|
||||
}
|
||||
// if ( $this->hasErrors() ){
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@ -113,13 +108,13 @@ class TransferSearch extends Transfer
|
||||
$accountMap = ArrayHelper::map( $accounts ,'id_account','name' );
|
||||
$idUser = Yii::$app->user->id;
|
||||
|
||||
$totals = Transfer::mkTotals($this->timestampStart, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
|
||||
$this->totals = Transfer::mkTotals($this->timestampStart, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
|
||||
|
||||
$this->totalsCreatedAt = $totals['created_at'];
|
||||
$this->totalsPaidAt = $totals['paid_at'];
|
||||
$this->totalsCreatedAtPaid = $totals['created_at_paid'];
|
||||
$this->totalsCreatedAtNotPaid = $totals['created_at_not_paid'];
|
||||
$this->totalsPaidAtNotCreatedAt = $totals['paid_at_not_created_at'];
|
||||
// $this->totalsCreatedAt = $totals['created_at'];
|
||||
// $this->totalsPaidAt = $totals['paid_at'];
|
||||
// $this->totalsCreatedAtPaid = $totals['created_at_paid'];
|
||||
// $this->totalsCreatedAtNotPaid = $totals['created_at_not_paid'];
|
||||
// $this->totalsPaidAtNotCreatedAt = $totals['paid_at_not_created_at'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use frontend\components\TransferTotalWidget;
|
||||
use frontend\components\AccountStatisticWidget;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
@ -20,10 +21,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<dd><?php echo isset($model->lastCollection) ? Yii::$app->formatter->asDatetime($model->lastCollection->end) : Yii::t('frontend/collection', "No collection found") ?></dd>
|
||||
|
||||
<dt><?= Yii::t('frontend/collection', "Start of interval")?></dt>
|
||||
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampStart) ?></dd>
|
||||
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampStart,'yyyy-MM-dd HH:mm:ss') ?> (inkluzív)</dd>
|
||||
|
||||
<dt><?= Yii::t('frontend/collection', "End of interval")?></dt>
|
||||
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampEnd) ?></dd>
|
||||
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampEnd,'yyyy-MM-dd HH:mm:ss') ?> (exkluzív)</dd>
|
||||
</dl>
|
||||
|
||||
<p>
|
||||
@ -31,78 +32,23 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<?= Html::a(Yii::t('frontend/collection', 'Select another account'), ['select-account' ], ['class' => 'btn btn-primary']) ?>
|
||||
</p>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo TransferTotalWidget::widget([
|
||||
'options' => [
|
||||
'statistic' => $model->totals['created_at'],
|
||||
'panelHeading' => 'Kiadva',
|
||||
]
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo TransferTotalWidget::widget([
|
||||
'options' => [
|
||||
'statistic' => $model->totals['created_at_paid'],
|
||||
'panelHeading' => 'Kiadva/fizetve',
|
||||
]
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo TransferTotalWidget::widget([
|
||||
'options' => [
|
||||
'statistic' => $model->totals['created_at_not_paid'],
|
||||
'panelHeading' => 'Kiadva/nem fizetve (Hitel)',
|
||||
'panel-type' => 'panel-danger'
|
||||
]
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
if ( $model->userCartTotal > 0){
|
||||
?>
|
||||
<p class="bg-danger">
|
||||
Figyelem! A recepció kassza tartalmaz még fizetetlen elemeket!
|
||||
</p>
|
||||
<?php
|
||||
echo TransferTotalWidget::widget([
|
||||
'options' => [
|
||||
'statistic' => $model->totals['paid_at_not_created_at'],
|
||||
'panelHeading' => 'Adósság (Hitel)/Fizetve' ,
|
||||
]
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo TransferTotalWidget::widget([
|
||||
'options' => [
|
||||
'statistic' => $model->totals['paid_at'],
|
||||
'panelHeading' => 'Fizetve' ,
|
||||
'panel-type' => 'panel-success'
|
||||
]
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
echo AccountStatisticWidget::widget([
|
||||
'totals' => $model->totals
|
||||
]);
|
||||
?>
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use common\components\AccountTotalWidget;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel frontend\models\CollectionSearch */
|
||||
@ -19,15 +20,42 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<?= Html::a(Yii::t('frontend/collection', 'Create Collection'), ['select-account'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 ">
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $searchModel->totals
|
||||
])?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
'id_collection',
|
||||
'id_user',
|
||||
'id_account',
|
||||
'money',
|
||||
'start:datetime',
|
||||
'end:datetime',
|
||||
[
|
||||
'attribute' => 'id_user',
|
||||
'value' => 'userName',
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_account',
|
||||
'value' => 'accountName',
|
||||
],
|
||||
'money:integer',
|
||||
[
|
||||
'attribute' => 'start',
|
||||
'value' => function($model){
|
||||
return Yii::$app->formatter->asDatetime($model->start,'yyyy-MM-dd HH:mm:ss');
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'end',
|
||||
'value' => function($model){
|
||||
return Yii::$app->formatter->asDatetime($model->end,'yyyy-MM-dd HH:mm:ss');
|
||||
}
|
||||
],
|
||||
'created_at:datetime',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
|
||||
@ -2,11 +2,12 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
use frontend\components\AccountStatisticWidget;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Collection */
|
||||
|
||||
$this->title = $model->id_collection;
|
||||
$this->title = Yii::t('frontend/collection','Reception collection') . ' #'. $model->id_collection;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/collection', 'Collections'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
@ -34,4 +35,11 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
],
|
||||
]) ?>
|
||||
|
||||
<?php
|
||||
echo AccountStatisticWidget::widget([
|
||||
'totals' => $totals
|
||||
]);
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
64
frontend/views/common/_account_statistic.php
Normal file
64
frontend/views/common/_account_statistic.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
use common\components\AccountTotalWidget;
|
||||
?>
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['created_at'],
|
||||
'panelHeading' => 'Kiadva',
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['created_at_paid'],
|
||||
'panelHeading' => 'Kiadva/fizetve',
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['created_at_not_paid'],
|
||||
'panelHeading' => 'Kiadva/nem fizetve (Hitel)',
|
||||
'panelType' => 'panel-danger'
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['paid_at_not_created_at'],
|
||||
'panelHeading' => 'Adósság (Hitel)/Fizetve' ,
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php
|
||||
echo AccountTotalWidget::widget([
|
||||
'statistic' => $model->totals['paid_at'],
|
||||
'panelHeading' => 'Fizetve' ,
|
||||
'panelType' => 'panel-success'
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -1,57 +1,12 @@
|
||||
<?php
|
||||
|
||||
use frontend\components\TransferTotalWidget;
|
||||
use frontend\components\AccountStatisticWidget;
|
||||
?>
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?php echo TransferTotalWidget::widget([
|
||||
'options'=>[
|
||||
'statistic' => $searchModel->totalsCreatedAt,
|
||||
'panelHeading' => 'Kiadva az adott időszakban'
|
||||
]
|
||||
]);?>
|
||||
</div>
|
||||
<div class="col-md-4 ">
|
||||
<?php echo TransferTotalWidget::widget([
|
||||
'options'=>[
|
||||
'statistic' => $searchModel->totalsCreatedAtPaid,
|
||||
'panelHeading' => 'Kiadva/fizetve az adott időszakban'
|
||||
]
|
||||
]);?>
|
||||
</div>
|
||||
<div class="col-md-4 ">
|
||||
<?php echo TransferTotalWidget::widget([
|
||||
'options'=>[
|
||||
'statistic' => $searchModel->totalsCreatedAtNotPaid,
|
||||
'panelHeading' => 'Kiadva/nem fizetve az adott időszakban'
|
||||
]
|
||||
]);?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 ">
|
||||
|
||||
</div>
|
||||
<div class="col-md-4 ">
|
||||
<?php echo TransferTotalWidget::widget([
|
||||
'options'=>[
|
||||
'statistic' => $searchModel->totalsPaidAtNotCreatedAt,
|
||||
'panelHeading' => 'Adósságok fizetve az adott időszakban'
|
||||
]
|
||||
]);?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 ">
|
||||
</div>
|
||||
<div class="col-md-4 ">
|
||||
<?php echo TransferTotalWidget::widget([
|
||||
'options'=>[
|
||||
'statistic' => $searchModel->totalsPaidAt,
|
||||
'panelHeading' => 'Kiadva fizetve/adósság fizetve az adott időszakban'
|
||||
]
|
||||
]);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
echo AccountStatisticWidget::widget([
|
||||
'totals' => $model->totals
|
||||
]);
|
||||
|
||||
?>
|
||||
@ -32,7 +32,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
<?php echo $this->render('_index_stat', ['searchModel' => $searchModel]); ?>
|
||||
<?php echo $this->render('_index_stat', ['model' => $searchModel]); ?>
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user