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");
|
||||
|
||||
Reference in New Issue
Block a user