add collections to backend
This commit is contained in:
23
common/components/AccountStatisticWidget.php
Normal file
23
common/components/AccountStatisticWidget.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace common\components;
|
||||
|
||||
use yii\base\Widget;
|
||||
|
||||
class AccountStatisticWidget extends Widget{
|
||||
|
||||
public $totals;
|
||||
|
||||
|
||||
public $viewFile = '@common/views/common/_account_statistic';
|
||||
|
||||
public function init(){
|
||||
parent::init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function run(){
|
||||
echo $this->render($this->viewFile,[ 'model' => $this ]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,4 +13,18 @@ class Helper
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function notInInterval($query ,$field , $start,$end ){
|
||||
$query->andFilterWhere( ['or', [ '<', $field , isset( $start ) ? $start : '1900-01-01' ] ,[ '>=' , $field , isset($end) ? $end : '3000-01-01' ] ] );
|
||||
}
|
||||
|
||||
public static function notPaid($query ,$field , $start,$end ){
|
||||
$query->andFilterWhere( ['or', [ '<', $field , isset( $start ) ? $start : '1900-01-01' ] ,[ '>=' , $field , isset($end) ? $end : '3000-01-01' ] ,[ "transfer.status" => Transfer::STATUS_NOT_PAID ] ] );
|
||||
}
|
||||
public static function inInterval($query ,$field , $start,$end ){
|
||||
$query->andFilterWhere([ '>=', $field , $start ] );
|
||||
$query->andFilterWhere([ '<' , $field , $end ] );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -114,6 +114,9 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
||||
'created_at' => Yii::t('common/transfer', 'Created At'),
|
||||
'updated_at' => Yii::t('common/transfer', 'Updated At'),
|
||||
'paid_at' => Yii::t('common/transfer', 'Paid At'),
|
||||
'types' => Yii::t('common/transfer', 'Types'),
|
||||
'start' => Yii::t('common/transfer', 'Start'),
|
||||
'end' => Yii::t('common/transfer', 'End'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
64
common/views/common/_account_statistic.php
Normal file
64
common/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>
|
||||
Reference in New Issue
Block a user