add display money to account state close, delete ticket on customer tickets
This commit is contained in:
@@ -9,6 +9,7 @@ use common\models\Account;
|
||||
|
||||
use common\models\MoneyMovement;
|
||||
use common\components\RoleDefinition;
|
||||
use common\models\AccountState;
|
||||
/**
|
||||
* TransferListSearch represents the model behind the search form about `common\models\Transfer`.
|
||||
*/
|
||||
@@ -108,7 +109,15 @@ class DailyListing
|
||||
public $id_user;
|
||||
public $type;
|
||||
|
||||
|
||||
public $totalWithCassa;
|
||||
|
||||
public $cassaOpen;
|
||||
|
||||
public $showWithCassaOpen = false;// if easy total should be displayed with cassa open money
|
||||
|
||||
public $accountState; //the cassa object for we load the data
|
||||
|
||||
|
||||
public function readTotalEasy(){
|
||||
$this->readTicketMoney();
|
||||
$this->readProductsMoney();
|
||||
@@ -141,6 +150,7 @@ class DailyListing
|
||||
|
||||
public function loadAccountState($accountState){
|
||||
$this->mode = 'accountstate';
|
||||
$this->accountState = $accountState;
|
||||
$this->start = $accountState->start_date;
|
||||
$this->end = $accountState->created_at;
|
||||
$this->timestampStart = $accountState->start_date;
|
||||
@@ -149,13 +159,26 @@ class DailyListing
|
||||
$this->id_user = $accountState->id_user;
|
||||
}
|
||||
|
||||
public function readModeAccountState(){
|
||||
$this->readTotalEasy ();
|
||||
$this->readTotalDetailed ();
|
||||
$this->readTotalMedium ();
|
||||
|
||||
$this->readCassaOpen();
|
||||
$this->calcTotalWithCassaOpen();
|
||||
|
||||
$this->showWithCassaOpen = true;
|
||||
}
|
||||
|
||||
public function isModeAdmin(){
|
||||
return $this->mode == 'admin';
|
||||
}
|
||||
public function isModeAccountState(){
|
||||
return $this->mode == 'accountstate';
|
||||
}
|
||||
|
||||
public function isModeReception(){
|
||||
return $this->mode == 'reception';
|
||||
}
|
||||
|
||||
public function calcTotal(){
|
||||
$this->total = 0;
|
||||
@@ -170,6 +193,22 @@ class DailyListing
|
||||
$this->totalNetto += $this->moneyMovementMoneis;
|
||||
}
|
||||
|
||||
protected function readCassaOpen(){
|
||||
if ( isset($this->accountState) && $this->accountState->isTypeClose() && isset($this->accountState->prev_state) ){
|
||||
$this->cassaOpen = AccountState::findOne(['id_account_state' => $this->accountState->prev_state]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function calcTotalWithCassaOpen(){
|
||||
$this->totalWithCassa = 0;
|
||||
$this->totalWithCassa += $this->total;
|
||||
if ( isset($this->cassaOpen ) ){
|
||||
$this->totalWithCassa += $this->cassaOpen->money;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function addAccountConstraint($query){
|
||||
|
||||
@@ -513,7 +552,7 @@ class DailyListing
|
||||
|
||||
public function readMoneyMovements(){
|
||||
$query = (new \yii\db\Query());
|
||||
$query->select([ 'user.username as user_name','account.name as account_name', 'transfer.direction as transfer_direction' ,'money_movement.type as money_movement_type', 'transfer.money AS money_movement_money', 'money_movement.name as money_movement_name','transfer.created_at as money_movement_created_at', ]);
|
||||
$query->select([ 'user.username as user_name','account.name as account_name', 'transfer.direction as transfer_direction' ,'money_movement.type as money_movement_type', 'transfer.money AS money_movement_money', 'money_movement.name as money_movement_name','transfer.created_at as money_movement_created_at', 'money_movement.comment as money_movement_comment' ]);
|
||||
$query->from('transfer');
|
||||
$query->andWhere(['transfer.type' => Transfer::TYPE_MONEY_MOVEMENT_OUT]);
|
||||
$query->innerJoin("money_movement", "money_movement.id_money_movement = transfer.id_object");
|
||||
|
||||
@@ -161,6 +161,9 @@ class Helper {
|
||||
public static function isProductVisibilityAccount() {
|
||||
return \Yii::$app->params ['product_visiblity'] == 'account';
|
||||
}
|
||||
public static function isAccountStateClosePreloadMoney() {
|
||||
return \Yii::$app->params ['account_state_close_preload_money'] == true;
|
||||
}
|
||||
public static function getRealUserIp() {
|
||||
$client = @$_SERVER ['HTTP_CLIENT_IP'];
|
||||
$forward = @$_SERVER ['HTTP_X_FORWARDED_FOR'];
|
||||
|
||||
@@ -42,9 +42,11 @@ class AccountStateMail extends Object {
|
||||
$this->details = new DailyListing();
|
||||
$this->details->loadAccountState ( $this->model );
|
||||
|
||||
$this->details->readTotalEasy ();
|
||||
$this->details->readTotalDetailed ();
|
||||
$this->details->readTotalMedium ();
|
||||
$this->details->readModeAccountState();
|
||||
|
||||
// $this->details->readTotalEasy ();
|
||||
// $this->details->readTotalDetailed ();
|
||||
// $this->details->readTotalMedium ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +63,7 @@ class AccountStateMail extends Object {
|
||||
|
||||
$this->attachPdf();
|
||||
|
||||
$this->message->setFrom('noreplay@fitnessadmin.hu')
|
||||
$this->message->setFrom(\Yii::$app->params['infoEmail'])
|
||||
->setTo( \Yii::$app->params['notify_mail'] )
|
||||
->setSubject($subject )
|
||||
->send();
|
||||
|
||||
9
common/components/total/TotalCassaOpenInfoWidget.php
Normal file
9
common/components/total/TotalCassaOpenInfoWidget.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace common\components\total;
|
||||
|
||||
class TotalCassaOpenInfoWidget extends TotalBaseWidget{
|
||||
|
||||
public $viewFile = 'total_cassa_open.php';
|
||||
|
||||
|
||||
}
|
||||
@@ -12,5 +12,6 @@ return [
|
||||
'mail_account_state_open' => true,
|
||||
'login_reception_email' => true, //if reception login should send email
|
||||
'login_admin_email' => true, //if admin login should send email
|
||||
'account_state_close_preload_money' => 'true',//preload money wnen show account state close page
|
||||
|
||||
];
|
||||
|
||||
@@ -13,6 +13,7 @@ use common\components\total\TotalDifferenceWidget;
|
||||
use common\models\AccountState;
|
||||
use yii\helpers\Url;
|
||||
use common\components\accountstate\AccountStateWidget;
|
||||
use common\components\total\TotalCassaOpenInfoWidget;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\AccountState */
|
||||
@@ -72,6 +73,8 @@ if ( $model ->type == AccountState::TYPE_OPEN ){
|
||||
<?php if ( $model ->type == AccountState::TYPE_CLOSE ){?>
|
||||
|
||||
<?php echo TotalEasyWidget::widget(['dailyListing' => $details]);?>
|
||||
|
||||
<?php echo TotalCassaOpenInfoWidget::widget(['dailyListing' => $details]);?>
|
||||
<h2>Közepes összesítés</h2>
|
||||
<h3>Bérletek típus szerint</h3>
|
||||
<?php echo TotalMediumTicketsWidget::widget(['dailyListing' => $details]);?>
|
||||
|
||||
@@ -34,7 +34,7 @@ return [
|
||||
'Id Account' => 'Kassza',
|
||||
'Id Account State' => 'Kassza művelet',
|
||||
'Id User' => 'Felhasználó',
|
||||
'Money' => 'Összeg',
|
||||
'Money' => 'Kasszában lévő összeg',
|
||||
'Type' => 'Típus',
|
||||
'Updated At' => 'Módosítás ideje',
|
||||
];
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\QueryBuilder;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
|
||||
/**
|
||||
* This is the model class for table "account_state".
|
||||
@@ -38,6 +38,17 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
|
||||
|
||||
public $start_date;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
// public function behaviors()
|
||||
// {
|
||||
// return [[
|
||||
// 'class' => TimestampBehavior::className(),
|
||||
// 'value' => function(){ return date('Y-m-d H:i' ); }
|
||||
// ] ];
|
||||
// }
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@ use common\models\Account;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use common\models\MoneyMovement;
|
||||
use common\components\RoleDefinition;
|
||||
use common\components\Helper;
|
||||
/**
|
||||
* TransferListSearch represents the model behind the search form about `common\models\Transfer`.
|
||||
*/
|
||||
@@ -29,7 +30,10 @@ class TransferListSearch extends Transfer
|
||||
public $timestampEnd;
|
||||
|
||||
|
||||
public $includeCassaOpen = false;
|
||||
public $totalWithCassa;
|
||||
|
||||
public $cassaOpen;
|
||||
// public $totalsCreatedAt = ['total' => 0, 'accounts' =>[] ];
|
||||
// public $totalsCreatedAtNotPaid= ['total' => 0, 'accounts' =>[]];
|
||||
// public $totalsCreatedAtPaid= ['total' => 0, 'accounts' =>[]];
|
||||
@@ -124,6 +128,9 @@ class TransferListSearch extends Transfer
|
||||
public function isModeAdmin(){
|
||||
return $this->mode == 'admin';
|
||||
}
|
||||
public function isModeReception(){
|
||||
return $this->mode == 'reception';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
@@ -149,11 +156,20 @@ class TransferListSearch extends Transfer
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->readTicketMoney();
|
||||
$this->readProductsMoney();
|
||||
$this->readMoneyMovementMoney();
|
||||
$this->calcTotal();
|
||||
|
||||
if ( $this->isModeReception()){
|
||||
if ( Helper::isAccountStateClosePreloadMoney()){
|
||||
$this->readCassaOpen();
|
||||
$this->calcTotalWithCassaOpen();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->readProductsByCategory();
|
||||
$this->readProductsByCategoryDetailed();
|
||||
$this->readTicketStas();
|
||||
@@ -179,12 +195,24 @@ class TransferListSearch extends Transfer
|
||||
|
||||
}
|
||||
|
||||
protected function readCassaOpen(){
|
||||
$this->cassaOpen = AccountState::readLast(AccountState::TYPE_OPEN,null,Account::readDefault());
|
||||
}
|
||||
|
||||
protected function calcTotal(){
|
||||
$this->total = 0;
|
||||
$this->total += $this->ticketMoney;
|
||||
$this->total += $this->productMoney;
|
||||
$this->total += $this->moneyMovementMoneis;
|
||||
}
|
||||
protected function calcTotalWithCassaOpen(){
|
||||
$this->totalWithCassa = 0;
|
||||
$this->totalWithCassa += $this->total;
|
||||
if ( isset($this->cassaOpen ) ){
|
||||
$this->totalWithCassa += $this->cassaOpen->money;
|
||||
}
|
||||
|
||||
}
|
||||
protected function calcTotalNetto(){
|
||||
$this->totalNetto = 0;
|
||||
$this->totalNetto += $this->ticketMoney;
|
||||
@@ -437,7 +465,7 @@ class TransferListSearch extends Transfer
|
||||
|
||||
protected function readMoneyMovements(){
|
||||
$query = (new \yii\db\Query());
|
||||
$query->select([ 'user.username as user_name','account.name as account_name', 'transfer.direction as transfer_direction' ,'money_movement.type as money_movement_type', 'transfer.money AS money_movement_money', 'money_movement.name as money_movement_name','transfer.created_at as money_movement_created_at', ]);
|
||||
$query->select([ 'user.username as user_name','account.name as account_name', 'transfer.direction as transfer_direction' ,'money_movement.type as money_movement_type', 'transfer.money AS money_movement_money', 'money_movement.name as money_movement_name','transfer.created_at as money_movement_created_at', 'money_movement.comment as money_movement_comment' ]);
|
||||
$query->from('transfer');
|
||||
$query->andWhere(['transfer.type' => Transfer::TYPE_MONEY_MOVEMENT_OUT]);
|
||||
$query->innerJoin("money_movement", "money_movement.id_money_movement = transfer.id_object");
|
||||
|
||||
@@ -62,6 +62,9 @@ if ( $model ->type == AccountState::TYPE_OPEN ){
|
||||
<?php
|
||||
echo AccountStateWidget::widget(['model' => $model]);
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if ( $model->hasDifferenceToPrevState() ){
|
||||
?>
|
||||
|
||||
31
common/views/total/total_cassa_open.php
Normal file
31
common/views/total/total_cassa_open.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
use common\components\DailyListing;
|
||||
/** @var $model common\components\DailyListing */
|
||||
?>
|
||||
<?php if ( $model->showWithCassaOpen && isset($model->cassaOpen) ){?>
|
||||
<h2>Aktuális záró összeg</h2>
|
||||
<table class="table table-bordered table-striped table-summary">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Kasszanyitás </th>
|
||||
<td ><span style=' '><?php echo ( $model->cassaOpen->user->username ) ?> </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Kasszanyitás ideje</th>
|
||||
<td ><span style=' '><?php echo ( $model->cassaOpen->created_at ) ?> </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Kasszanyitás összege</th>
|
||||
<td class="money"><span style=' '><?php echo isset($model->cassaOpen) ? \Yii::$app->formatter->asInteger( $model->cassaOpen->money ) : ""?> FT</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Végösszeg</th>
|
||||
<td class="money"><span style=' '><?php echo \Yii::$app->formatter->asInteger($model->total)?> FT</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Kasszában lévő összeg</th>
|
||||
<td class="money"><span style='border-bottom: 1px solid black'><?php echo \Yii::$app->formatter->asInteger( $model->totalWithCassa ) ?> FT</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php }?>
|
||||
@@ -8,6 +8,7 @@
|
||||
<th>Név</th>
|
||||
<th>Típus</th>
|
||||
<th>Összeg</th>
|
||||
<th>Megjegyzés</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -19,6 +20,7 @@
|
||||
<td><?php echo $p['money_movement_name'] ?></td>
|
||||
<td><?php echo $p['money_movement_type_name'] ?></td>
|
||||
<td class='money'><?php echo \Yii::$app->formatter->asInteger( $p['signed_money'])?> Ft</td>
|
||||
<td><?php echo $p['money_movement_comment'] ?></td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
Reference in New Issue
Block a user