add collection changes
This commit is contained in:
parent
931b83040b
commit
ed9c1e77cd
@ -24,6 +24,9 @@ use yii\behaviors\TimestampBehavior;
|
|||||||
*/
|
*/
|
||||||
class Collection extends \common\models\BaseFitnessActiveRecord
|
class Collection extends \common\models\BaseFitnessActiveRecord
|
||||||
{
|
{
|
||||||
|
|
||||||
|
const TYPE_RECEPTION = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -86,17 +89,17 @@ class Collection extends \common\models\BaseFitnessActiveRecord
|
|||||||
/**
|
/**
|
||||||
* @param \common\models\User $user the user
|
* @param \common\models\User $user the user
|
||||||
* */
|
* */
|
||||||
public static function readLast($user){
|
public static function readLast($user,$types = [Collection::TYPE_RECEPTION]){
|
||||||
$result = null;
|
$result = null;
|
||||||
$query = Collection::find();
|
$query = Collection::find();
|
||||||
if ( isset($user)){
|
if ( isset($user)){
|
||||||
$query->andWhere($user->id);
|
$query->andWhere(['id_user' =>$user->id]);
|
||||||
}
|
}
|
||||||
|
$query->andFilterWhere([ 'in', 'type' ,$types]);
|
||||||
|
|
||||||
$query->orderBy(['end' => SORT_DESC]);
|
$query->orderBy(['end' => SORT_DESC]);
|
||||||
|
|
||||||
$query->limit(1);
|
$query->limit(1);
|
||||||
|
|
||||||
$result = $query->one();
|
$result = $query->one();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -27,11 +27,41 @@ class CollectionCreate extends \common\models\Collection
|
|||||||
|
|
||||||
public $lastCollection;
|
public $lastCollection;
|
||||||
public $accounts;
|
public $accounts;
|
||||||
|
public $accountMap;
|
||||||
public $account;
|
public $account;
|
||||||
public $totals;
|
public $totals;
|
||||||
|
|
||||||
|
public $timestampEnd;
|
||||||
|
public $timestampStart;
|
||||||
|
|
||||||
|
|
||||||
|
public function rules(){
|
||||||
|
return [
|
||||||
|
['end','required'],
|
||||||
|
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
|
[[ 'end' ], 'validateEndDate' ]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validateEndDate($attribute,$params){
|
||||||
|
if ( isset($this->lastCollection)){
|
||||||
|
if ( strtotime( $this->lastCollection->end ) >= strtotime( $this->timestampEnd ) ){
|
||||||
|
$this->addError($attribute,Yii::t('frontend/collection' ,'End date is invalid') );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeSave($insert){
|
||||||
|
if (parent::beforeSave($insert)) {
|
||||||
|
$this->id_user = Yii::$app->user->id;
|
||||||
|
$this->created_by = Yii::$app->user->id;
|
||||||
|
$paidAt = Transfer::mkPaidAtTotals($this->timestampStart, $this->timestampEnd, $this->user->id, null, $this->account->id_account, $this->accounts, $this->accountMap);
|
||||||
|
$this->money = $paidAt['total'];
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -503,25 +503,18 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
|
|
||||||
if ( $mode == 'created_at'){
|
if ( $mode == 'created_at'){
|
||||||
$query->andFilterWhere([ '>=', 'transfer.created_at' , $start] );
|
self::inInterval($query, 'transfer.created_at', $start, $end);
|
||||||
$query->andFilterWhere([ '<' , 'transfer.created_at' , $end ] );
|
|
||||||
}else if ( $mode == 'paid_at'){
|
}else if ( $mode == 'paid_at'){
|
||||||
$query->andFilterWhere([ '>=', 'transfer.paid_at' , $start ] );
|
self::inInterval($query, 'transfer.paid_at' , $start, $end);
|
||||||
$query->andFilterWhere([ '<' , 'transfer.paid_at' , $end ] );
|
|
||||||
}else if ( $mode == 'created_at_not_paid'){
|
}else if ( $mode == 'created_at_not_paid'){
|
||||||
$query->andFilterWhere([ "transfer.status" => Transfer::STATUS_NOT_PAID ] );
|
self::notPaid($query, 'transfer.paid_at', $start, $end);
|
||||||
$query->andFilterWhere([ '>=', 'transfer.created_at' , $start ] );
|
self::inInterval($query, 'transfer.created_at', $start, $end);
|
||||||
$query->andFilterWhere([ '<' , 'transfer.created_at' , $end ] );
|
|
||||||
}else if ( $mode == 'created_at_paid'){
|
}else if ( $mode == 'created_at_paid'){
|
||||||
$query->andFilterWhere([ "transfer.status" => Transfer::STATUS_PAID ] );
|
self::inInterval($query, 'transfer.created_at', $start, $end);
|
||||||
$query->andFilterWhere([ '>=', 'transfer.created_at' , $start ] );
|
self::inInterval($query, 'transfer.paid_at', $start, $end);
|
||||||
$query->andFilterWhere([ '<' , 'transfer.created_at' , $end ] );
|
|
||||||
}else if ( $mode == 'paid_at_not_created_at'){
|
}else if ( $mode == 'paid_at_not_created_at'){
|
||||||
$query->andFilterWhere([ "transfer.status" => Transfer::STATUS_PAID ] );
|
self::inInterval($query, 'transfer.paid_at' , $start, $end);
|
||||||
$query->andFilterWhere([ '>=', 'transfer.paid_at' , $start ] );
|
self::notInInterval($query, 'transfer.created_at', $start, $end);
|
||||||
$query->andFilterWhere([ '<' , 'transfer.paid_at' , $end ] );
|
|
||||||
|
|
||||||
$query->andFilterWhere( ['or', [ '<', 'transfer.created_at' , isset( $start ) ? $start : '1900-01-01' ] ,[ '>=' , 'transfer.created_at' , $end ] ] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->groupBy('transfer.id_account');
|
$query->groupBy('transfer.id_account');
|
||||||
@ -531,6 +524,18 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,10 @@ class TransferTotalWidget extends Widget{
|
|||||||
$this->options['totalHeading'] = 'Összesen';
|
$this->options['totalHeading'] = 'Összesen';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !isset($this->options['panel-type'] ) ){
|
||||||
|
$this->options['panel-type'] = 'panel-info';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(){
|
public function run(){
|
||||||
|
|||||||
@ -73,24 +73,26 @@ class CollectionController extends Controller
|
|||||||
|
|
||||||
$user = User::findOne(Yii::$app->user->id);
|
$user = User::findOne(Yii::$app->user->id);
|
||||||
|
|
||||||
// $accounts = Account::find()->orderBy("name asc")->all();
|
|
||||||
|
|
||||||
$model->accounts = Account::read();
|
$model->accounts = Account::read();
|
||||||
$model->lastCollection = Collection::readLast($user);
|
$model->lastCollection = Collection::readLast($user);
|
||||||
$model->id_user = $user->id;
|
$model->id_user = $user->id;
|
||||||
$model->id_account = Account::readDefault();
|
$model->id_account = $id_account;
|
||||||
$model->account = Account::readOne($model->id_account);
|
$model->account = Account::readOne($model->id_account);
|
||||||
$accountMap = ArrayHelper::map( $model->accounts ,'id_account','name' );
|
$model->accountMap = ArrayHelper::map( $model->accounts ,'id_account','name' );
|
||||||
|
|
||||||
$model->start = isset($model->lastCollection) ? $model->lastCollection->end :null;
|
$model->timestampStart = isset($model->lastCollection) ? $model->lastCollection->end :null;
|
||||||
$model->end = date("Y-m-d H:i:s");
|
$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->type = Collection::TYPE_RECEPTION;
|
||||||
|
|
||||||
|
|
||||||
$model->totals = Transfer::mkTotals($model->start, $model->end, $model->user->id, null, $model->account->id_account, $model->accounts, $accountMap);
|
if ( $model->load(Yii::$app->request->post()) && $model->save() ) {
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
|
||||||
return $this->redirect(['view', 'id' => $model->id_collection]);
|
return $this->redirect(['view', 'id' => $model->id_collection]);
|
||||||
} else {
|
} else {
|
||||||
|
$model->totals = Transfer::mkTotals($model->timestampStart, $model->timestampEnd, $model->user->id, null, $model->account->id_account, $model->accounts, $model->accountMap);
|
||||||
return $this->render('create', [
|
return $this->render('create', [
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -28,6 +28,7 @@ class TransferSearch extends Transfer
|
|||||||
public $totalsCreatedAtNotPaid= ['total' => 0, 'accounts' =>[]];
|
public $totalsCreatedAtNotPaid= ['total' => 0, 'accounts' =>[]];
|
||||||
public $totalsCreatedAtPaid= ['total' => 0, 'accounts' =>[]];
|
public $totalsCreatedAtPaid= ['total' => 0, 'accounts' =>[]];
|
||||||
public $totalsPaidAt= ['total' => 0, 'accounts' =>[]];
|
public $totalsPaidAt= ['total' => 0, 'accounts' =>[]];
|
||||||
|
public $totalsPaidAtNotCreatedAt= ['total' => 0, 'accounts' =>[]];
|
||||||
|
|
||||||
|
|
||||||
public $accounts;
|
public $accounts;
|
||||||
@ -95,173 +96,6 @@ class TransferSearch extends Transfer
|
|||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function mkTotalQuery($mode){
|
|
||||||
|
|
||||||
$query = new Query();
|
|
||||||
|
|
||||||
$query->addSelect( [
|
|
||||||
new Expression( 'transfer.id_account as account'),
|
|
||||||
new Expression( ' COALESCE(sum( ( case when direction = '.Transfer::DIRECTION_OUT.' then -1 else 1 end )* transfer.money ),0) as money' )
|
|
||||||
|
|
||||||
]);
|
|
||||||
$query->from('transfer');
|
|
||||||
|
|
||||||
$query->andFilterWhere([
|
|
||||||
'id_account' => $this->id_account,
|
|
||||||
'type' => $this->type,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$query->andWhere(['id_user' => Yii::$app->user->id]);
|
|
||||||
|
|
||||||
$query->andFilterWhere(['in' ,'type', $this->types]);
|
|
||||||
|
|
||||||
|
|
||||||
if ( $mode == 'created_at'){
|
|
||||||
$query->andFilterWhere([ '>=', 'transfer.created_at' , $this->timestampStart ] );
|
|
||||||
$query->andFilterWhere([ '<' , 'transfer.created_at' , $this->timestampEnd ] );
|
|
||||||
}else if ( $mode == 'paid_at'){
|
|
||||||
$query->andFilterWhere([ '>=', 'transfer.paid_at' , $this->timestampStart ] );
|
|
||||||
$query->andFilterWhere([ '<' , 'transfer.paid_at' , $this->timestampEnd ] );
|
|
||||||
}else if ( $mode == 'created_at_not_paid'){
|
|
||||||
$query->andFilterWhere([ "transfer.status" => Transfer::STATUS_NOT_PAID ] );
|
|
||||||
$query->andFilterWhere([ '>=', 'transfer.created_at' , $this->timestampStart ] );
|
|
||||||
$query->andFilterWhere([ '<' , 'transfer.created_at' , $this->timestampEnd ] );
|
|
||||||
}else if ( $mode == 'created_at_paid'){
|
|
||||||
$query->andFilterWhere([ "transfer.status" => Transfer::STATUS_PAID ] );
|
|
||||||
$query->andFilterWhere([ '>=', 'transfer.created_at' , $this->timestampStart ] );
|
|
||||||
$query->andFilterWhere([ '<' , 'transfer.created_at' , $this->timestampEnd ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
$query->groupBy('transfer.id_account');
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function mkTransferTotalsWithZeroValue( ){
|
|
||||||
$result = [];
|
|
||||||
|
|
||||||
foreach ( $this->accounts as $a ){
|
|
||||||
$accountTotal = [
|
|
||||||
'id_account' => $a->id_account,
|
|
||||||
'label' => $a->name,
|
|
||||||
'money' => 0
|
|
||||||
];
|
|
||||||
|
|
||||||
$result[] = $accountTotal;
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected function mkTotalsResult($queryResult,$accountMap){
|
|
||||||
|
|
||||||
$totals = [];
|
|
||||||
$totals['total'] = 0;
|
|
||||||
|
|
||||||
$totals['accounts'] = [];
|
|
||||||
|
|
||||||
foreach ($queryResult as $item){
|
|
||||||
$account = "";
|
|
||||||
if ( array_key_exists($item['account'], $accountMap)){
|
|
||||||
$account = $accountMap[$item['account']];
|
|
||||||
}
|
|
||||||
|
|
||||||
$accountTotal = [
|
|
||||||
'id_account' => $item['account'],
|
|
||||||
'label' => $account,
|
|
||||||
'money' => $item['money']
|
|
||||||
];
|
|
||||||
$totals['accounts'][] = $accountTotal;
|
|
||||||
$totals['total'] += $item['money'];
|
|
||||||
}
|
|
||||||
return $totals;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function findByAccountInQueryResult($queryResult, $account){
|
|
||||||
$result = null;
|
|
||||||
foreach ($queryResult as $item){
|
|
||||||
if( $item['account'] == $account->id_account ){
|
|
||||||
$result = $item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function mkTotalsResultWithAllAvailableAccount($queryResult,$accountMap){
|
|
||||||
|
|
||||||
$totals = [];
|
|
||||||
$totals['total'] = 0;
|
|
||||||
|
|
||||||
$totals['accounts'] = [];
|
|
||||||
|
|
||||||
foreach ($this->accounts as $account){
|
|
||||||
if ( isset($this->id_account) && is_numeric($this->id_account) && $this->id_account != $account->id_account ){
|
|
||||||
continue ;
|
|
||||||
}
|
|
||||||
$accountTotal = [
|
|
||||||
'id_account' => $account->id_account,
|
|
||||||
'label' => $account->name,
|
|
||||||
'money' => 0,
|
|
||||||
];
|
|
||||||
|
|
||||||
$item = $this->findByAccountInQueryResult($queryResult, $account);
|
|
||||||
|
|
||||||
if ( isset($item)){
|
|
||||||
$accountTotal['money'] = $item['money'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$totals['accounts'][] = $accountTotal;
|
|
||||||
$totals['total'] += $accountTotal['money'];
|
|
||||||
}
|
|
||||||
return $totals;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function mkPaidAtTotals($accountMap){
|
|
||||||
$query = $this->mkTotalQuery('paid_at');
|
|
||||||
$command = $query->createCommand();
|
|
||||||
$result = $command->queryAll();
|
|
||||||
|
|
||||||
$paidAtTotals = $this->mkTotalsResultWithAllAvailableAccount($result, $accountMap);
|
|
||||||
|
|
||||||
return $paidAtTotals;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mkCreatedAtTotals($accountMap){
|
|
||||||
$query = $this->mkTotalQuery('created_at');
|
|
||||||
$command = $query->createCommand();
|
|
||||||
$result = $command->queryAll();
|
|
||||||
|
|
||||||
$createdAtTotals = $this->mkTotalsResultWithAllAvailableAccount($result, $accountMap);
|
|
||||||
|
|
||||||
return $createdAtTotals;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mkCreatedAtNotPaidTotals($accountMap){
|
|
||||||
$query = $this->mkTotalQuery('created_at_not_paid');
|
|
||||||
$command = $query->createCommand();
|
|
||||||
$result = $command->queryAll();
|
|
||||||
|
|
||||||
$createdAtTotals = $this->mkTotalsResultWithAllAvailableAccount($result, $accountMap);
|
|
||||||
|
|
||||||
return $createdAtTotals;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mkCreatedAtPaidTotals($accountMap){
|
|
||||||
$query = $this->mkTotalQuery('created_at_paid');
|
|
||||||
$command = $query->createCommand();
|
|
||||||
$result = $command->queryAll();
|
|
||||||
|
|
||||||
$createdAtTotals = $this->mkTotalsResultWithAllAvailableAccount($result, $accountMap);
|
|
||||||
|
|
||||||
return $createdAtTotals;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function totalsTransfers($params){
|
public function totalsTransfers($params){
|
||||||
$accountTotals = [];
|
$accountTotals = [];
|
||||||
$fullTotal = [
|
$fullTotal = [
|
||||||
@ -273,13 +107,19 @@ class TransferSearch extends Transfer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$accounts = Account::find()->orderBy("name asc")->all();
|
$accounts = Account::find()->orderBy("name asc")->all();
|
||||||
$accountMap = ArrayHelper::map( $accounts ,'id_account','name' );
|
$accountMap = ArrayHelper::map( $accounts ,'id_account','name' );
|
||||||
|
$idUser = Yii::$app->user->id;
|
||||||
|
|
||||||
$this->totalsCreatedAt = $this->mkCreatedAtTotals($accountMap);
|
$totals = Transfer::mkTotals($this->timestampStart, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
|
||||||
$this->totalsPaidAt = $this->mkPaidAtTotals($accountMap);
|
|
||||||
$this->totalsCreatedAtPaid = $this->mkCreatedAtPaidTotals($accountMap);
|
$this->totalsCreatedAt = $totals['created_at'];
|
||||||
$this->totalsCreatedAtNotPaid = $this->mkCreatedAtNotPaidTotals($accountMap);
|
$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'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,8 @@ use frontend\components\HtmlHelper;
|
|||||||
|
|
||||||
<?php $form = ActiveForm::begin(); ?>
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?php echo $form->field($model, 'end')->hiddenInput()->label(false) ?>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('frontend/collection', 'Create') : Yii::t('frontend/collection', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('frontend/collection', 'Create') : Yii::t('frontend/collection', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -20,37 +20,88 @@ $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>
|
<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>
|
<dt><?= Yii::t('frontend/collection', "Start of interval")?></dt>
|
||||||
<dd><?php echo Yii::$app->formatter->asDatetime($model->start) ?></dd>
|
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampStart) ?></dd>
|
||||||
|
|
||||||
<dt><?= Yii::t('frontend/collection', "End of interval")?></dt>
|
<dt><?= Yii::t('frontend/collection', "End of interval")?></dt>
|
||||||
<dd><?php echo Yii::$app->formatter->asDatetime($model->end) ?></dd>
|
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampEnd) ?></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('frontend/collection', 'Refresh'), ['create', 'id_account' => $model->id_account], ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::a(Yii::t('frontend/collection', 'Select another account'), ['select-account' ], ['class' => 'btn btn-primary']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
<?php
|
<div class='row'>
|
||||||
|
<div class='col-md-4'>
|
||||||
echo TransferTotalWidget::widget([
|
<?php
|
||||||
'options' => [
|
|
||||||
'statistic' => $model->totals['paid_at'],
|
|
||||||
'panelHeading' => 'Fizetve' ,
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
echo TransferTotalWidget::widget([
|
echo TransferTotalWidget::widget([
|
||||||
'options' => [
|
'options' => [
|
||||||
'statistic' => $model->totals['created_at'],
|
'statistic' => $model->totals['created_at'],
|
||||||
'panelHeading' => 'Kiadva',
|
'panelHeading' => 'Kiadva',
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?php
|
||||||
echo TransferTotalWidget::widget([
|
echo TransferTotalWidget::widget([
|
||||||
'options' => [
|
'options' => [
|
||||||
'statistic' => $model->totals['created_at_paid'],
|
'statistic' => $model->totals['created_at_paid'],
|
||||||
'panelHeading' => 'Kiadva és fizetve',
|
'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
|
||||||
|
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>
|
||||||
|
|
||||||
<?= $this->render('_form', [
|
<?= $this->render('_form', [
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
|
|||||||
@ -14,30 +14,23 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
<p>
|
|
||||||
<?= Html::a(Yii::t('frontend/collection', 'Update'), ['update', 'id' => $model->id_collection], ['class' => 'btn btn-primary']) ?>
|
|
||||||
<?= Html::a(Yii::t('frontend/collection', 'Delete'), ['delete', 'id' => $model->id_collection], [
|
|
||||||
'class' => 'btn btn-danger',
|
|
||||||
'data' => [
|
|
||||||
'confirm' => Yii::t('frontend/collection', 'Are you sure you want to delete this item?'),
|
|
||||||
'method' => 'post',
|
|
||||||
],
|
|
||||||
]) ?>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<?= DetailView::widget([
|
<?= DetailView::widget([
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'id_collection',
|
'id_collection',
|
||||||
'id_user',
|
[
|
||||||
'created_by',
|
'attribute' =>'id_user',
|
||||||
'id_account',
|
'value' => $model->userName
|
||||||
'money',
|
],
|
||||||
'start',
|
[
|
||||||
'end',
|
'attribute' =>'id_account',
|
||||||
'type',
|
'value' => $model->accountName
|
||||||
'created_at',
|
],
|
||||||
'updated_at',
|
'money:integer',
|
||||||
|
'start:datetime',
|
||||||
|
'end:datetime',
|
||||||
|
'created_at:datetime',
|
||||||
],
|
],
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
<div class="row">
|
<div class="panel <?= $options['panel-type']?>">
|
||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="panel-heading"><?php echo $options['panelHeading']?></div>
|
||||||
<div class="panel panel-info">
|
<div class="panel-body">
|
||||||
<div class="panel-heading"><?php echo $options['panelHeading']?></div>
|
<dl class="dl-horizontal dl-totals">
|
||||||
<div class="panel-body">
|
<?php
|
||||||
<dl class="dl-horizontal dl-totals">
|
|
||||||
<?php
|
|
||||||
foreach ($options['statistic']['accounts'] as $acc ){
|
foreach ($options['statistic']['accounts'] as $acc ){
|
||||||
?>
|
?>
|
||||||
<dt><?php echo $acc['label'] ?></dt>
|
<dt><?php echo $acc['label'] ?></dt>
|
||||||
@ -17,5 +15,3 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@ -1,96 +1,57 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use yii\helpers\Html;
|
use frontend\components\TransferTotalWidget;
|
||||||
use yii\grid\GridView;
|
|
||||||
use yii\widgets\ListView;
|
|
||||||
use yii\base\Widget;
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div>
|
<div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="panel panel-info">
|
<?php echo TransferTotalWidget::widget([
|
||||||
<div class="panel-heading">Kiadva az adott időszakban</div>
|
'options'=>[
|
||||||
<div class="panel-body">
|
'statistic' => $searchModel->totalsCreatedAt,
|
||||||
<dl class="dl-horizontal dl-totals">
|
'panelHeading' => 'Kiadva az adott időszakban'
|
||||||
<?php
|
]
|
||||||
foreach ($searchModel->totalsCreatedAt['accounts'] as $acc ){
|
]);?>
|
||||||
?>
|
|
||||||
<dt><?php echo $acc['label'] ?></dt>
|
|
||||||
<dd class="text-right"><?php echo $acc['money'] ?></dd>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<dt><?php echo Yii::t('frontend/transfer','Total') ?></dt>
|
|
||||||
<dd class="text-right"><?php echo $searchModel->totalsCreatedAt['total'] ?></dd>
|
|
||||||
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="panel panel-info">
|
|
||||||
<div class="panel-heading">Kiadva/nem fizetve az adott időszakban</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<dl class="dl-horizontal dl-totals">
|
|
||||||
<?php
|
|
||||||
foreach ($searchModel->totalsCreatedAtNotPaid['accounts'] as $acc ){
|
|
||||||
?>
|
|
||||||
<dt><?php echo $acc['label'] ?></dt>
|
|
||||||
<dd class="text-right"><?php echo $acc['money'] ?></dd>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<dt><?php echo Yii::t('frontend/transfer','Total') ?></dt>
|
|
||||||
<dd class="text-right"><?php echo $searchModel->totalsCreatedAtNotPaid['total'] ?></dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 ">
|
<div class="col-md-4 ">
|
||||||
<div class="panel panel-info">
|
<?php echo TransferTotalWidget::widget([
|
||||||
<div class="panel-heading">Kifizetve az adott időszakban</div>
|
'options'=>[
|
||||||
<div class="panel-body">
|
'statistic' => $searchModel->totalsCreatedAtPaid,
|
||||||
<dl class="dl-horizontal dl-totals">
|
'panelHeading' => 'Kiadva/fizetve az adott időszakban'
|
||||||
<?php
|
]
|
||||||
foreach ($searchModel->totalsPaidAt['accounts'] as $acc ){
|
]);?>
|
||||||
?>
|
</div>
|
||||||
<dt><?php echo $acc['label'] ?></dt>
|
<div class="col-md-4 ">
|
||||||
<dd class="text-right"><?php echo $acc['money'] ?></dd>
|
<?php echo TransferTotalWidget::widget([
|
||||||
|
'options'=>[
|
||||||
<?php
|
'statistic' => $searchModel->totalsCreatedAtNotPaid,
|
||||||
}
|
'panelHeading' => 'Kiadva/nem fizetve az adott időszakban'
|
||||||
?>
|
]
|
||||||
<dt><?php echo Yii::t('frontend/transfer','Total') ?></dt>
|
]);?>
|
||||||
<dd class="text-right"><?php echo $searchModel->totalsPaidAt['total'] ?></dd>
|
|
||||||
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="col-md-4 ">
|
||||||
<div class="panel panel-info">
|
|
||||||
<div class="panel-heading">Kiadva/fizetve az adott időszakban</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<dl class="dl-horizontal dl-totals">
|
|
||||||
<?php
|
|
||||||
foreach ($searchModel->totalsCreatedAtPaid['accounts'] as $acc ){
|
|
||||||
?>
|
|
||||||
<dt><?php echo $acc['label'] ?></dt>
|
|
||||||
<dd class="text-right"><?php echo $acc['money'] ?></dd>
|
|
||||||
|
|
||||||
<?php
|
</div>
|
||||||
}
|
<div class="col-md-4 ">
|
||||||
?>
|
<?php echo TransferTotalWidget::widget([
|
||||||
<dt><?php echo Yii::t('frontend/transfer','Total') ?></dt>
|
'options'=>[
|
||||||
<dd class="text-right"><?php echo $searchModel->totalsCreatedAtPaid['total'] ?></dd>
|
'statistic' => $searchModel->totalsPaidAtNotCreatedAt,
|
||||||
</dl>
|
'panelHeading' => 'Adósságok fizetve az adott időszakban'
|
||||||
</div>
|
]
|
||||||
</div>
|
]);?>
|
||||||
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -57,9 +57,6 @@ use kartik\widgets\DateTimePicker;
|
|||||||
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
|
||||||
echo "types:";
|
|
||||||
print_r($model->types) ?>
|
|
||||||
|
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user