add display money to account state close, delete ticket on customer tickets

This commit is contained in:
2016-01-10 15:25:25 +01:00
parent 5a98d128bc
commit 7c584a0779
21 changed files with 291 additions and 19 deletions

View File

@@ -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");

View File

@@ -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'];

View File

@@ -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();

View File

@@ -0,0 +1,9 @@
<?php
namespace common\components\total;
class TotalCassaOpenInfoWidget extends TotalBaseWidget{
public $viewFile = 'total_cassa_open.php';
}