Finish reception_changes

This commit is contained in:
Roland Schneider 2016-10-01 18:42:43 +02:00
commit 4cbc1bd4c8
13 changed files with 632 additions and 127 deletions

View File

@ -12,6 +12,34 @@ use yii\i18n\Formatter;
class DateUtil class DateUtil
{ {
/**
* Get UTC today @00:00:00 .
* Helper method to generate date for mysql
*
* @return \DateTime
*/
public static function todayStart( ){
$d2 = new \DateTime();
$d2->setTimezone( new \DateTimeZone( "UTC" ) );
$d2->setTime(0, 0, 0);
return $d2;
}
/**
* Get UTC t @00:00:00 .
* Helper method to generate date for mysql
*
* @return \DateTime
*/
public static function tomorrowStart( ){
$d2 = new \DateTime();
$d2->add(new \DateInterval('P1D'));
$d2->setTimezone( new \DateTimeZone( "UTC" ) );
$d2->setTime(0, 0, 0);
return $d2;
}
public static function addMonth($timestamp, $monthCount = 1) public static function addMonth($timestamp, $monthCount = 1)
{ {
@ -65,4 +93,12 @@ class DateUtil
return $formatter->asDatetime($dateTimeObject); return $formatter->asDatetime($dateTimeObject);
} }
public static function formatDateUtc($dateTimeObject)
{
$formatter = new Formatter;
$formatter->datetimeFormat = 'php:Y-m-d';
$formatter->timeZone = 'UTC';
return $formatter->asDatetime($dateTimeObject);
}
} }

View File

@ -320,6 +320,17 @@ class Helper {
public static function isTicketCreatePriceEditable() { public static function isTicketCreatePriceEditable() {
return \Yii::$app->params ['ticket_create_price_editable'] == true ; return \Yii::$app->params ['ticket_create_price_editable'] == true ;
} }
public static function isReceptionTransferListToday(){
return \Yii::$app->params['reception_transfer_list_only_today'];
}
public static function isReceptionAccountStateIndexToday(){
return \Yii::$app->params['reception_account_state_index_only_today'];
}
public static function isReceptionTransferIndexEnabled(){
return !Helper::isReceptionTransferListToday();
}
public static function getRealUserIp() { public static function getRealUserIp() {
$client = @$_SERVER ['HTTP_CLIENT_IP']; $client = @$_SERVER ['HTTP_CLIENT_IP'];

View File

@ -30,6 +30,9 @@ return [
* Hány napig láthatják visszamenőleg a recepciósok az adatokat * Hány napig láthatják visszamenőleg a recepciósok az adatokat
* */ * */
'reception_visibility_days' => 3, 'reception_visibility_days' => 3,
'reception_account_state_index_only_today' => false,
'reception_transfer_list_only_today' => false,
'backend_skin' => 'skin-red', //skin-green 'backend_skin' => 'skin-red', //skin-green
/**User cart module on/off*/ /**User cart module on/off*/
'user_cart_on' => true, 'user_cart_on' => true,

View File

@ -11,117 +11,127 @@ use backend\models\AccountSearch;
use common\models\Account; use common\models\Account;
use common\components\Helper; use common\components\Helper;
class FrontendMenuStructure{ class FrontendMenuStructure
{
public $menuItems;
public $start;//start date and time
public $tomorrow;//tomorrow date and time
public $startDate;//start date
public $tomorrowDate;//tomorrow date
public $yesterDay;//yesterday date
public function __construct(){
$this->menuItems = [];
$this->yesterDay = \Yii::$app->formatter->asDatetime( strtotime('yesterday UTC') );
$this->start = \Yii::$app->formatter->asDatetime( strtotime('today UTC') );
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
$this->startDate = Yii::$app->formatter->asDate( strtotime('today UTC') );
$this->tomorrowDate = Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
Yii::info("Start date is : ". $this->start);
if ( $this->isLogged() ){
$lastAccountState = AccountState::find()->andWhere(['id_user' => Yii::$app->user->id])->andWhere(['type' => AccountState::TYPE_OPEN ])->orderBy(['account_state.created_at' => SORT_DESC])->limit(1)->one();
if ( isset($lastAccountState) ){
$this->start = Yii::$app->formatter->asDatetime(strtotime( $lastAccountState->created_at . ' UTC' ));
}
}
} public $menuItems;
public $start;//start date and time
public $tomorrow;//tomorrow date and time
protected function can($authItem){ public $startDate;//start date
$result = false; public $tomorrowDate;//tomorrow date
if (\Yii::$app->user->can($authItem)) { public $yesterDay;//yesterday date
$result = true;
} public function __construct()
return $result; {
} $this->menuItems = [];
$this->yesterDay = \Yii::$app->formatter->asDatetime(strtotime('yesterday UTC'));
protected function isLogged(){ $this->start = \Yii::$app->formatter->asDatetime(strtotime('today UTC'));
return !Yii::$app->user->isGuest; $this->tomorrow = Yii::$app->formatter->asDatetime(strtotime('tomorrow UTC'));
} $this->startDate = Yii::$app->formatter->asDate(strtotime('today UTC'));
$this->tomorrowDate = Yii::$app->formatter->asDate(strtotime('tomorrow UTC'));
protected function addRecepcio(){ Yii::info("Start date is : " . $this->start);
if ( $this->isLogged() ){
$isadmin =Yii::$app->user->can('admin') ||Yii::$app->user->can('employee'); if ($this->isLogged()) {
$lastAccountState = AccountState::find()->andWhere(['id_user' => Yii::$app->user->id])->andWhere(['type' => AccountState::TYPE_OPEN])->orderBy(['account_state.created_at' => SORT_DESC])->limit(1)->one();
$this->menuItems[] = ['label' => Yii::t('frontend/customer','Reception'), 'url' => ['/customer/reception'] ]; if (isset($lastAccountState)) {
$this->start = Yii::$app->formatter->asDatetime(strtotime($lastAccountState->created_at . ' UTC'));
$items = [ }
['label' => Yii::t('frontend/account-state','Default account'), 'url' => ['/account/select'] ], }
['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/index' ,'AccountstateSearch[id_account]' => Account::readDefault(), 'AccountstateSearch[start]' => $this->yesterDay] ],
['label' => Yii::t('frontend/account-state','Open account state'), 'url' => ['/account-state/open'] ], }
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
['label' => Yii::t('frontend/money-movement','Money movements'), 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ], protected function can($authItem)
{
]; $result = false;
if (\Yii::$app->user->can($authItem)) {
if ( Helper::isCompanyMovar() ){ $result = true;
$items[] = ['label' => Yii::t('frontend/transfer','Daily transfers'), 'url' => [ '/transfer/list', 'TransferListSearch[id_account]' => Account::readDefault(), 'TransferListSearch[start]' => $this->start, 'TransferListSearch[end]' => $this->tomorrow ] ]; }
$items[] = ['label' => Yii::t('frontend/transfer','Sales detailed'), 'url' => [ '/transfer/sale', 'TransferSaleSearch[id_user]' =>\Yii::$app->user->id, 'TransferSaleSearch[id_account]' => Account::readDefault(), 'TransferSaleSearch[start]' => $this->start, 'TransferSaleSearch[end]' => $this->tomorrow ] ]; return $result;
$items[] = ['label' => Yii::t('frontend/transfer','Ticket sale detailed'), 'url' => [ '/transfer/tickets','TransferTicketSearch[id_user]' =>\Yii::$app->user->id, 'TransferTicketSearch[id_account]' => Account::readDefault(), 'TransferTicketSearch[start]' => $this->start, 'TransferTicketSearch[end]' => $this->tomorrow ] ]; }
}
// if ( $isadmin || Yii::$app->user->can('reception.transfers') ){ protected function isLogged()
$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 ] ]; return !Yii::$app->user->isGuest;
// } }
$items[] = ['label' => Yii::t('frontend/card','Vendégek'), 'url' => [ '/card/index' ] ];
protected function addRecepcio()
{
if ($this->isLogged()) {
$isadmin = Yii::$app->user->can('admin') || Yii::$app->user->can('employee');
$this->menuItems[] = ['label' => Yii::t('frontend/customer', 'Reception'), 'url' => ['/customer/reception']];
$items = [];
$items[] = ['label' => Yii::t('frontend/account-state', 'Default account'), 'url' => ['/account/select']];
if ( Helper::isReceptionAccountStateIndexToday() ){
$items[] = ['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/today' ]];
}else{
$items[] = ['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/index', 'AccountstateSearch[id_account]' => Account::readDefault(), 'AccountstateSearch[start]' => $this->yesterDay]];
}
$items[] = ['label' => Yii::t('frontend/account-state', 'Open account state'), 'url' => ['/account-state/open']];
$items[] = ['label' => Yii::t('frontend/account-state', 'Close account state'), 'url' => ['/account-state/close']];
$items[] = ['label' => Yii::t('frontend/money-movement', 'Money movements'), 'url' => ['/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow]];
if (Helper::isCompanyMovar()) {
$items[] = ['label' => Yii::t('frontend/transfer', 'Daily transfers'), 'url' => ['/transfer/list', 'TransferListSearch[id_account]' => Account::readDefault(), 'TransferListSearch[start]' => $this->start, 'TransferListSearch[end]' => $this->tomorrow]];
$items[] = ['label' => Yii::t('frontend/transfer', 'Sales detailed'), 'url' => ['/transfer/sale', 'TransferSaleSearch[id_user]' => \Yii::$app->user->id, 'TransferSaleSearch[id_account]' => Account::readDefault(), 'TransferSaleSearch[start]' => $this->start, 'TransferSaleSearch[end]' => $this->tomorrow]];
$items[] = ['label' => Yii::t('frontend/transfer', 'Ticket sale detailed'), 'url' => ['/transfer/tickets', 'TransferTicketSearch[id_user]' => \Yii::$app->user->id, 'TransferTicketSearch[id_account]' => Account::readDefault(), 'TransferTicketSearch[start]' => $this->start, 'TransferTicketSearch[end]' => $this->tomorrow]];
}
if ( Helper::isReceptionTransferListToday()){
$items[] = ['label' => Yii::t('frontend/transfer', 'Transfers'), 'url' => ['/transfer/today', ]];
}else{
$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/card', 'Vendégek'), 'url' => ['/card/index']];
// $items[] = ['label' => Yii::t('frontend/card','Leltár'), 'url' => [ '/product/inventory' ] ]; // $items[] = ['label' => Yii::t('frontend/card','Leltár'), 'url' => [ '/product/inventory' ] ];
// $items[] = ['label' => Yii::t('frontend/card','Leltár'), 'url' => [ '/inventory/index' ] ]; // $items[] = ['label' => Yii::t('frontend/card','Leltár'), 'url' => [ '/inventory/index' ] ];
$this->menuItems[] = ['label' => Yii::t('frontend/account', 'Account'), $this->menuItems[] = ['label' => Yii::t('frontend/account', 'Account'),
'items' => $items 'items' => $items
];
}
]; }
}
}
protected function addLoginMainMenu()
{
protected function addLoginMainMenu(){ if (Yii::$app->user->isGuest) {
if (Yii::$app->user->isGuest) { $mainMenuItem = ['label' => Yii::t('frontend/site', 'Login'), 'url' => ['/site/login']];
$mainMenuItem= ['label' => Yii::t('frontend/site','Login'), 'url' => ['/site/login']]; } else {
} else { $mainMenuItem = [
$mainMenuItem= [ 'label' => Yii::t('frontend/transfer', 'Logout') . '(' . Yii::$app->user->identity->username . ')',
'label' => Yii::t('frontend/transfer','Logout'). '(' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'],
'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']
'linkOptions' => ['data-method' => 'post'] ];
]; }
} $this->menuItems[] = $mainMenuItem;
$this->menuItems[] = $mainMenuItem; }
}
public function run()
public function run(){ {
$this->addRecepcio(); $this->addRecepcio();
$this->addLoginMainMenu(); $this->addLoginMainMenu();
return $this->menuItems; return $this->menuItems;
} }
} }

View File

@ -2,12 +2,13 @@
namespace frontend\controllers; namespace frontend\controllers;
use common\components\DateUtil;
use frontend\models\AccountstateSearchToday;
use Yii; use Yii;
use common\models\AccountState; use common\models\AccountState;
use frontend\models\AccountstateSearch; use frontend\models\AccountstateSearch;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\Account; use common\models\Account;
use common\components\DailyListing; use common\components\DailyListing;
use common\models\User; use common\models\User;
@ -45,13 +46,18 @@ class AccountStateController extends Controller {
]; ];
} }
/** /**
* Lists all AccountState models. * Lists all AccountState models.
* * @return mixed
* @return mixed * @throws NotFoundHttpException
*/ */
public function actionIndex() { public function actionIndex() {
if ( Helper::isReceptionAccountStateIndexToday()){
throw new NotFoundHttpException();
}
$searchModel = new AccountstateSearch (); $searchModel = new AccountstateSearch ();
$searchModel->accounts = Account::read (); $searchModel->accounts = Account::read ();
@ -64,7 +70,24 @@ class AccountStateController extends Controller {
'dataProvider' => $dataProvider 'dataProvider' => $dataProvider
] ); ] );
} }
/**
* Lists all AccountState models.
* @return mixed
* @throws NotFoundHttpException
*/
public function actionToday() {
$searchModel = new AccountstateSearchToday();
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
return $this->render ( 'today', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
] );
}
/** /**
* Creates a new AccountState model. * Creates a new AccountState model.
* If creation is successful, the browser will be redirected to the 'view' page. * If creation is successful, the browser will be redirected to the 'view' page.
@ -92,9 +115,14 @@ class AccountStateController extends Controller {
$mail->sednMail(); $mail->sednMail();
} }
$redirectTo = 'index';
if ( Helper::isReceptionAccountStateIndexToday() ){
$redirectTo = 'today';
}
return $this->redirect ( [ return $this->redirect ( [
'index' $redirectTo
] ); ] );
} else { } else {
@ -139,9 +167,16 @@ class AccountStateController extends Controller {
$mail = new AccountStateMail(['model' => $model,'controller' => $this]); $mail = new AccountStateMail(['model' => $model,'controller' => $this]);
$mail->sednMail(); $mail->sednMail();
} }
return $this->redirect ( [ $redirectTo = 'index';
'index'
if ( Helper::isReceptionAccountStateIndexToday() ){
$redirectTo = 'today';
}
return $this->redirect ( [
$redirectTo
] ); ] );
// return $this->redirect(['view', 'id' => $model->id_account_state]); // return $this->redirect(['view', 'id' => $model->id_account_state]);
} else { } else {
@ -179,7 +214,14 @@ class AccountStateController extends Controller {
* @throws NotFoundHttpException if the model cannot be found * @throws NotFoundHttpException if the model cannot be found
*/ */
protected function findModel($id) { protected function findModel($id) {
if (($model = AccountState::findOne ( $id )) !== null) { $query = AccountState::find();
$query->andWhere(['id_account_state'=> $id]);
if ( Helper::isReceptionAccountStateIndexToday()){
$query->andWhere(['id_user'=>\Yii::$app->user->id]);
$query->andWhere(['>=','account_state.created_at', DateUtil::formatDateUtc(DateUtil::todayStart()) ]);
}
$model = $query->one();
if ( $model !== null ) {
return $model; return $model;
} else { } else {
throw new NotFoundHttpException ( 'The requested page does not exist.' ); throw new NotFoundHttpException ( 'The requested page does not exist.' );
@ -256,7 +298,7 @@ class AccountStateController extends Controller {
$details = null; $details = null;
if ($accountState->isTypeClose ()) { if ($accountState->isTypeClose ()) {
$prev; $prev = null;
if ($accountState->type == AccountState::TYPE_CLOSE) { if ($accountState->type == AccountState::TYPE_CLOSE) {
if (isset ( $accountState->prev_state )) { if (isset ( $accountState->prev_state )) {
$prev = AccountState::findOne ( $accountState->prev_state ); $prev = AccountState::findOne ( $accountState->prev_state );
@ -311,7 +353,7 @@ class AccountStateController extends Controller {
if ($accountState->isTypeClose ()) { if ($accountState->isTypeClose ()) {
$prev; $prev = null;
if ($accountState->type == AccountState::TYPE_CLOSE) { if ($accountState->type == AccountState::TYPE_CLOSE) {
if (isset ( $accountState->prev_state )) { if (isset ( $accountState->prev_state )) {
$prev = AccountState::findOne ( $accountState->prev_state ); $prev = AccountState::findOne ( $accountState->prev_state );

View File

@ -2,6 +2,7 @@
namespace frontend\controllers; namespace frontend\controllers;
use frontend\models\TransferSearchToday;
use Yii; use Yii;
use common\models\Transfer; use common\models\Transfer;
use frontend\models\TransferSearch; use frontend\models\TransferSearch;
@ -71,12 +72,18 @@ class TransferController extends Controller
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
]); ]);
} }
/** /**
* Lists all Transfer models. * Lists all Transfer models.
* @return mixed * @return mixed
* @throws NotFoundHttpException
*/ */
public function actionIndex() public function actionIndex()
{ {
if ( !Helper::isReceptionTransferIndexEnabled()){
throw new NotFoundHttpException();
}
$searchModel = new TransferSearch(); $searchModel = new TransferSearch();
$searchModel->accounts = Account::read(); $searchModel->accounts = Account::read();
$searchModel->load(Yii::$app->request->queryParams); $searchModel->load(Yii::$app->request->queryParams);
@ -90,6 +97,27 @@ class TransferController extends Controller
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
]); ]);
}
/**
* Lists all Transfer models.
* @return mixed
*/
public function actionToday()
{
$searchModel = new TransferSearchToday();
$searchModel->id_account = Account::readDefault();
$searchModel->load(Yii::$app->request->queryParams);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
//$searchModel->totalsTransfers(Yii::$app->request->queryParams);
return $this->render('today', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
} }
/** /**

View File

@ -0,0 +1,85 @@
<?php
namespace frontend\models;
use common\components\DateUtil;
use common\models\Account;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\AccountState;
use common\components\Helper;
/**
* AccountstateSearch represents the model behind the search form about `common\models\AccountState`.
*/
class AccountstateSearchToday extends AccountState
{
public $start;
public $end;
public $timestampStart;
public $timestampEnd;
/**
* @inheritdoc
*/
public function rules()
{
return [
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = AccountState::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => false
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
$query->where('0=1');
return $dataProvider;
}
$query->innerJoinWith('account');
$query->innerJoinWith('account.userAccountAssignments');
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id]);
$query->andWhere([
'account_state.id_user' => \Yii::$app->user->id,
'account_state.id_account' => Account::readDefault()
]);
$query->andWhere( [ '>=','account_state.created_at', DateUtil::formatDateUtc( DateUtil::todayStart() ) ] );
$query->orderBy( 'account_state.created_at desc' );
$query->limit = 20;
return $dataProvider;
}
}

View File

@ -0,0 +1,117 @@
<?php
namespace frontend\models;
use common\components\DateUtil;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\base\Object;
use yii\db\Query;
use yii\db\Expression;
use common\models\Account;
use yii\helpers\ArrayHelper;
use common\components\Helper;
use yii\web\NotFoundHttpException;
/**
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
*/
class TransferSearchToday extends Transfer
{
public $totals;
public $accounts;
public $types;
public $timestampStart;
public $timestampEnd;
/**
* @inheritdoc
*/
public function rules()
{
return [
['types', 'each', 'rule' => ['integer']],
];
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
* @return ActiveDataProvider
* @throws NotFoundHttpException
*/
public function search($params)
{
if ( !isset( $this->id_account ) ){
throw new NotFoundHttpException("Kassza nem található");
}
$this->timestampStart = DateUtil::formatDateUtc( DateUtil::todayStart() ) ;
$this->timestampEnd = DateUtil::formatDateUtc( DateUtil::tomorrowStart() );
$query = Transfer::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
$query->where('0=1');
}
$query->andWhere( ['or',['id_user' => Yii::$app->user->id ] , ['paid_by' => Yii::$app->user->id],] );
$query->andWhere(['transfer.id_account' => $this->id_account]);
$query->andFilterWhere([
'type' => $this->type,
]);
$query->andFilterWhere(['in' ,'type', $this->types]);
$created_condition = ['and',[ '>=', 'transfer.created_at', $this->timestampStart ] ,[ '<', 'transfer.created_at', $this->timestampEnd ] ];
$paid_condition = ['and',[ '>=', 'transfer.paid_at', $this->timestampStart ] ,[ '<', 'transfer.paid_at', $this->timestampEnd ] ];
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
return $dataProvider;
}
public function totalsTransfers($params){
$accountTotals = [];
$fullTotal = [
'label' => Yii::t('common/transfer', 'Total'),
'money' => 0
];
$accounts = Account::find()->orderBy("name asc")->all();
$accountMap = ArrayHelper::map( $accounts ,'id_account','name' );
$idUser = Yii::$app->user->id;
$this->totals = Transfer::mkTotals($this->timestampStart, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
}
}

View File

@ -0,0 +1,64 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\DateTimePicker;
use frontend\components\HtmlHelper;
use common\models\AccountState;
/* @var $this yii\web\View */
/* @var $model frontend\models\AccountstateSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$accountOptions = ['' =>'Mind']+ HtmlHelper::mkAccountOptions( $model->accounts );
$userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->users,'id','username');
$typeOptions = ['' => 'Mind'] + AccountState::types();
?>
<div class="account-state-search">
<?php $form = ActiveForm::begin([
'action' => ['today'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'type')->dropDownList($typeOptions) ?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
])->label('Időszak kezdete') ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
])->label("Időszak vége") ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('frontend/account-state', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,37 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\AccountstateSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('frontend/account-state', 'Account States');
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
.notes-view table thead th,
.notes-view table td{
text-align: right;
}
</style>
<div class="account-state-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search_today', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('frontend/account-state', 'Open Account State'), ['open'], ['class' => 'btn btn-success']) ?>
<?= Html::a(Yii::t('frontend/account-state', 'Close Account State'), ['close'], ['class' => 'btn btn-success']) ?>
</p>
<?php echo ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => '_item_view'
])?>
</div>

View File

@ -24,7 +24,11 @@ if ( $model ->type == AccountState::TYPE_OPEN ){
}else{ }else{
$this->title = "Kassza zárás"; $this->title = "Kassza zárás";
} }
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/account-state', 'Account States'), 'url' => ['index']]; if ( \common\components\Helper::isReceptionAccountStateIndexToday()){
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/account-state', 'Account States'), 'url' => ['today']];
}else{
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/account-state', 'Account States'), 'url' => ['index']];
}
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>

View File

@ -0,0 +1,36 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\DatePicker;
use frontend\components\HtmlHelper;
use common\models\Transfer;
use kartik\widgets\DateTimePicker;
/* @var $this yii\web\View */
/* @var $model common\models\TransferSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="transfer-search">
<?php $form = ActiveForm::begin([
'action' => ['today'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-md-4">
<?php echo $form->field($model, 'types')->checkboxList( Transfer::types()) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,32 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;
/* @var $this yii\web\View */
/* @var $searchModel common\models\TransferSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('frontend/transfer', 'Transfers');
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
.dl-transfer{
margin-bottom: 0px;
}
.item-transfer{
border: 1px solid #b4b4b4;
margin-top: 12px;
padding-top: 6px;
padding-bottom: 6px;
}
</style>
<div class="transfer-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search_today', ['model' => $searchModel]); ?>
<?php echo ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => '_view' ,
'itemOptions' => ['class' => 'item-transfer']
] )
?>
</div>