diff --git a/changelog.txt b/changelog.txt index 3ff810a..0cb857c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +-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/config/params.php b/common/config/params.php index 882e91a..904cbcb 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -4,7 +4,7 @@ return [ 'supportEmail' => 'rocho02@gmail.com', 'infoEmail' => 'info@rocho-net.hu', 'user.passwordResetTokenExpire' => 3600, - 'version' => 'v0.0.20', + 'version' => 'v0.0.21', 'company' => 'movar',//gyor 'company_name' => "Freimann Kft.", 'product_visiblity' => 'account',// on reception which products to display. account or global 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 197c0b7..10dfb55 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 3113161..d8eeed8 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 a02c764..1c5b947 100644 --- a/frontend/controllers/AccountStateController.php +++ b/frontend/controllers/AccountStateController.php @@ -74,10 +74,14 @@ class AccountStateController extends Controller { $lastStates = AccountState::readLastForUser ( AccountState::TYPE_CLOSE ); $lastStates = AccountState::modelsToArray ( $lastStates ); + $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]); @@ -96,7 +100,8 @@ class AccountStateController extends Controller { return $this->render ( 'open', [ 'model' => $model, 'accounts' => $accounts, - 'lastStates' => $lastStates + 'lastStates' => $lastStates, + 'account' => $account ] ); } } @@ -113,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()); @@ -141,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;
-
- field($model, 'id_account')->dropDownList( HtmlHelper::mkAccountOptions($accounts) ) ?> +
+
+
+ name : 'Nincs alapértelmezett kassza kiválasztva!' )?> +
+ field($model, 'id_account')->dropDownList( HtmlHelper::mkAccountOptions($accounts) ) ?>
-
+
field($model, 'money')->textInput(['class' => 'form-control text-right']); ?>
diff --git a/frontend/views/account-state/_form_open.php b/frontend/views/account-state/_form_open.php index 7878103..9af871e 100644 --- a/frontend/views/account-state/_form_open.php +++ b/frontend/views/account-state/_form_open.php @@ -6,6 +6,7 @@ use frontend\components\HtmlHelper; /* @var $this yii\web\View */ /* @var $model common\models\AccountState */ +/* @var $account common\models\Account the default account */ /* @var $form yii\widgets\ActiveForm */ ?> @@ -16,12 +17,17 @@ use frontend\components\HtmlHelper;
-
- field($model, 'id_account')->dropDownList( HtmlHelper::mkAccountOptions($accounts) ) ?> -
-
- field($model, 'money')->textInput(['class' => 'form-control text-right']); ?> -
+
+
+
+ name : 'Nincs alapértelmezett kassza kiválasztva!' )?> +
+ + field($model, 'id_account')->dropDownList( HtmlHelper::mkAccountOptions($accounts) ) ?> +
+
+ field($model, 'money')->textInput(['class' => 'form-control text-right']); ?> +
render('_notes',[ 'form' => $form, 'model' => $model])?> diff --git a/frontend/views/account-state/close.php b/frontend/views/account-state/close.php index 8bbaa43..5efbf37 100644 --- a/frontend/views/account-state/close.php +++ b/frontend/views/account-state/close.php @@ -22,6 +22,7 @@ $this->registerJs ( 'new AccountState( '. json_encode($options).');' ); render('_form_close', [ 'model' => $model, 'accounts' => $accounts, + 'account' => $account, 'lastCassaState' => $lastCassaState, ]) ?> diff --git a/frontend/views/account-state/open.php b/frontend/views/account-state/open.php index 9768481..44254e7 100644 --- a/frontend/views/account-state/open.php +++ b/frontend/views/account-state/open.php @@ -24,6 +24,7 @@ $this->registerJs ( 'new AccountState( '. json_encode($options).');' ); render('_form_open', [ 'model' => $model, 'accounts' => $accounts, + 'account' => $account, ]) ?>