diff --git a/changelog.txt b/changelog.txt index 304f18c..3f7db34 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,8 +1,12 @@ --0.0.21 +-0.0.22 - fix product barcode unique on admin site - When checking ticket, use status = Active - force cassa open, if trying to enter prodcut/ticket sell page - force select default account +-0.0.21 + - account state fix account on reception + - reception user - tickets > delete ticket + - show current account -0.0.20 - account state email with pdf - login email diff --git a/common/models/Account.php b/common/models/Account.php index 59c9438..77e51a9 100644 --- a/common/models/Account.php +++ b/common/models/Account.php @@ -152,11 +152,29 @@ class Account extends \yii\db\ActiveRecord } + /** read id_transfer from session (default account ) + * + * @return int id_transfer + * */ public static function readDefault( ){ $session = Yii::$app->session; $result = $session->get('id_account'); return $result; + } + + /** + * read default transfer object + * return the default account or null, if not found + * @return common\models\Account + * */ + public static function readDefaultObject( ){ + $account = null; + $id_account = self::readDefault(); + if ( isset($id_account)){ + $account = Account::findOne($id_account); + } + return $account; } diff --git a/common/models/AccountState.php b/common/models/AccountState.php index 350e27d..4039fb4 100644 --- a/common/models/AccountState.php +++ b/common/models/AccountState.php @@ -63,11 +63,10 @@ class AccountState extends \common\models\BaseFitnessActiveRecord public function rules() { return [ - [['id_account','money' ], 'required'], - [['id_account', 'type', 'money', 'banknote_5_ft', 'banknote_10_ft', 'banknote_20_ft', 'banknote_50_ft', 'banknote_100_ft', 'banknote_200_ft', 'banknote_500_ft', 'banknote_1000_ft', 'banknote_2000_ft', 'banknote_5000_ft', 'banknote_10000_ft', 'banknote_20000_ft' ], 'integer'], + [['money' ], 'required'], + [['type', 'money', 'banknote_5_ft', 'banknote_10_ft', 'banknote_20_ft', 'banknote_50_ft', 'banknote_100_ft', 'banknote_200_ft', 'banknote_500_ft', 'banknote_1000_ft', 'banknote_2000_ft', 'banknote_5000_ft', 'banknote_10000_ft', 'banknote_20000_ft' ], 'integer'], [['comment' ], 'string' ,'max' => 255], [['prev_state' ], 'integer'], - [['id_account'] , 'validatePrevState'], ]; } diff --git a/common/models/Product.php b/common/models/Product.php index 6be0861..56c4b53 100644 --- a/common/models/Product.php +++ b/common/models/Product.php @@ -46,6 +46,7 @@ class Product extends \common\models\BaseFitnessActiveRecord { [['id_product_category', 'id_account', 'name'], 'required'], [['id_product_category', 'id_account', 'purchase_price', 'sale_price', 'profit_margins', 'status'], 'integer'], [['product_number', 'barcode'], 'string', 'max' => 20], + [['product_number', 'barcode'], 'filter', 'filter' => 'trim', 'skipOnArray' => true], [['name'], 'string', 'max' => 128], [['description'], 'string', 'max' => 255], // [['product_number'], 'unique' ], diff --git a/common/models/TransferListSearch.php b/common/models/TransferListSearch.php index efd3997..3bae835 100644 --- a/common/models/TransferListSearch.php +++ b/common/models/TransferListSearch.php @@ -23,33 +23,28 @@ class TransferListSearch extends Transfer public $mode = "reception";//reception or admin + /**start date string*/ public $start; + /**end date string*/ public $end; - + /**start date*/ public $timestampStart; + /** end date*/ public $timestampEnd; - - + /**if include cassa open*/ public $includeCassaOpen = false; + /**total with cassa open*/ public $totalWithCassa; - + /**last cassa open*/ public $cassaOpen; -// public $totalsCreatedAt = ['total' => 0, 'accounts' =>[] ]; -// public $totalsCreatedAtNotPaid= ['total' => 0, 'accounts' =>[]]; -// public $totalsCreatedAtPaid= ['total' => 0, 'accounts' =>[]]; -// public $totalsPaidAt= ['total' => 0, 'accounts' =>[]]; -// public $totalsPaidAtNotCreatedAt= ['total' => 0, 'accounts' =>[]]; - public $totals; - + /**The accounts*/ public $accounts; - + /**types*/ public $types; - + /**users*/ public $users; - - /** * all money gained with ticket sell * */ diff --git a/frontend/components/FrontendMenuStructure.php b/frontend/components/FrontendMenuStructure.php index 0449231..fbc439c 100644 --- a/frontend/components/FrontendMenuStructure.php +++ b/frontend/components/FrontendMenuStructure.php @@ -84,7 +84,7 @@ class FrontendMenuStructure{ if ( $isadmin || Yii::$app->user->can('reception.transfers') ){ $items[] = ['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[id_user]' =>\Yii::$app->user->id, 'TransferSearch[id_account]' => Account::readDefault(), 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ]; - $items[] = ['label' => Yii::t('frontend/collection','Collections'), 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ]; + //$items[] = ['label' => Yii::t('frontend/collection','Collections'), 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ]; } $items[] = ['label' => Yii::t('frontend/card','Vendégek'), 'url' => [ '/card/index' ] ]; diff --git a/frontend/controllers/AccountStateController.php b/frontend/controllers/AccountStateController.php index 4cd70d5..1c5b947 100644 --- a/frontend/controllers/AccountStateController.php +++ b/frontend/controllers/AccountStateController.php @@ -74,12 +74,14 @@ class AccountStateController extends Controller { $lastStates = AccountState::readLastForUser ( AccountState::TYPE_CLOSE ); $lastStates = AccountState::modelsToArray ( $lastStates ); -// \Yii::$app->session->setFlash('error','ok'); $model = new AccountState (); $model->type = AccountState::TYPE_OPEN; $model->id_user = Yii::$app->user->id; $model->id_account = Account::readDefault (); + + $account = Account::readDefaultObject(); + if ($model->load ( Yii::$app->request->post () ) && $model->save ()) { // return $this->redirect(['view', 'id' => $model->id_account_state]); @@ -98,7 +100,8 @@ class AccountStateController extends Controller { return $this->render ( 'open', [ 'model' => $model, 'accounts' => $accounts, - 'lastStates' => $lastStates + 'lastStates' => $lastStates, + 'account' => $account ] ); } } @@ -115,6 +118,7 @@ class AccountStateController extends Controller { $model->type = AccountState::TYPE_CLOSE; $model->id_user = Yii::$app->user->id; $model->id_account = Account::readDefault (); + $account = Account::readDefaultObject(); $lastCassaState = AccountState::readLast(null,null, Account::readDefault()); @@ -143,6 +147,7 @@ class AccountStateController extends Controller { return $this->render ( 'close', [ 'model' => $model, 'accounts' => $accounts, + 'account' => $account, 'lastStates' => $lastStates , 'lastCassaState' => $lastCassaState, ] ); diff --git a/frontend/views/account-state/_form_close.php b/frontend/views/account-state/_form_close.php index a023ef5..a3a3d31 100644 --- a/frontend/views/account-state/_form_close.php +++ b/frontend/views/account-state/_form_close.php @@ -16,10 +16,14 @@ use frontend\components\HtmlHelper;