change account dropdown to fix account on account state open/close
This commit is contained in:
parent
7c584a0779
commit
a782232ad8
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -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' ],
|
||||
|
||||
@ -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
|
||||
* */
|
||||
|
||||
@ -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' ] ];
|
||||
|
||||
@ -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,
|
||||
] );
|
||||
|
||||
@ -16,10 +16,14 @@ use frontend\components\HtmlHelper;
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'id_account')->dropDownList( HtmlHelper::mkAccountOptions($accounts) ) ?>
|
||||
<div class='col-md-8'>
|
||||
<div class="form-group field-accountstate-money required">
|
||||
<label class="control-label" for="accountstate-money">Kassza</label><br>
|
||||
<?php echo ( isset($account) ? $account->name : 'Nincs alapértelmezett kassza kiválasztva!' )?>
|
||||
</div>
|
||||
<?php //echo $form->field($model, 'id_account')->dropDownList( HtmlHelper::mkAccountOptions($accounts) ) ?>
|
||||
</div>
|
||||
<div class='col-md-6'>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'money')->textInput(['class' => 'form-control text-right']); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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;
|
||||
<?php echo Html::activeHiddenInput($model, "prev_state") ?>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'id_account')->dropDownList( HtmlHelper::mkAccountOptions($accounts) ) ?>
|
||||
</div>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'money')->textInput(['class' => 'form-control text-right']); ?>
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<div class="form-group field-accountstate-money required">
|
||||
<label class="control-label" for="accountstate-money">Kassza</label><br>
|
||||
<?php echo ( isset($account) ? $account->name : 'Nincs alapértelmezett kassza kiválasztva!' )?>
|
||||
</div>
|
||||
|
||||
<?php //echo $form->field($model, 'id_account')->dropDownList( HtmlHelper::mkAccountOptions($accounts) ) ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'money')->textInput(['class' => 'form-control text-right']); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo $this->render('_notes',[ 'form' => $form, 'model' => $model])?>
|
||||
|
||||
@ -22,6 +22,7 @@ $this->registerJs ( 'new AccountState( '. json_encode($options).');' );
|
||||
<?= $this->render('_form_close', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
'account' => $account,
|
||||
'lastCassaState' => $lastCassaState,
|
||||
]) ?>
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ $this->registerJs ( 'new AccountState( '. json_encode($options).');' );
|
||||
<?= $this->render('_form_open', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
'account' => $account,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user