add transfer#list pdf download, fix helper#fixascii function

This commit is contained in:
2016-01-06 16:18:15 +01:00
parent 932f071c13
commit 39ae361505
29 changed files with 1519 additions and 373 deletions

View File

@@ -13,12 +13,15 @@ use common\models\Account;
use yii\helpers\ArrayHelper;
use common\models\MoneyMovement;
use common\components\RoleDefinition;
/**
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
*/
class TransferSaleSearch extends Transfer
{
public $mode = "reception";//reception or admin
public $start;
public $end;
@@ -84,6 +87,10 @@ class TransferSaleSearch extends Transfer
return $result;
}
public function isModeAdmin(){
return $this->mode == 'admin';
}
/**
* Creates data provider instance with search query applied
@@ -113,8 +120,6 @@ class TransferSaleSearch extends Transfer
$this->readProductsMoney();
$this->calcTotal();
// $this->readProductsByCategory();
// $this->readProductsByCategoryDetailed();
$this->readProducts();
@@ -128,12 +133,18 @@ class TransferSaleSearch extends Transfer
protected function addAccountConstraint($query){
if ( !$this->isModeAdmin() || !RoleDefinition::isAdmin()){
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
if ( RoleDefinition::isReception()){
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
}
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
}
}